diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..30ace6a87 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + 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 +. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..eae9730c5 --- /dev/null +++ b/Makefile @@ -0,0 +1,207 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITARM)),) +$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") +endif + +TOPDIR ?= $(CURDIR) +include $(DEVKITARM)/3ds_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +# +# NO_SMDH: if set to anything, no SMDH file is generated. +# APP_TITLE is the name of the app stored in the SMDH file (Optional) +# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional) +# APP_AUTHOR is the author of the app stored in the SMDH file (Optional) +# ICON is the filename of the icon (.png), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .png +# - icon.png +# - /default_icon.png +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := inc +ROMFS := assets/romfs +APP_TITLE := "PKSM" +APP_DESCRIPTION := "AIO tool for Pokemon games" +APP_AUTHOR := "Bernardo Giordano" +APP_PRODUCT_CODE:= CTR-HB-PKSM +APP_UNIQUE_ID := 0xEC100 +ICON := assets/icon.png + +APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128) +APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256) +APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128) +APP_PRODUCT_CODE:= $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16) +APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7) + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard + +CFLAGS := -g -Wall -O2 -mword-relocations \ + -fomit-frame-pointer -ffast-math \ + $(ARCH) + +CFLAGS += $(INCLUDE) -DARM11 -D_3DS + +CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 + +ASFLAGS := -g $(ARCH) +LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) + +LIBS := -lsfil -lsftd -lfreetype -lpng -lz -lsf2d -lcitro3d -lctru -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CTRULIB) $(PORTLIBS) + + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) +export TOPDIR := $(CURDIR) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +CFILES := $(shell find $(SOURCES) -name '*.c' -printf "%P\n") +CPPFILES := $(shell find $(SOURCES) -name '*.cpp' -printf "%P\n") +SFILES := $(shell find $(SOURCES) -name '*.s' -printf "%P\n") +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) +#--------------------------------------------------------------------------------- + export LD := $(CC) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- + export LD := $(CXX) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- + +export OFILES := $(addsuffix .o,$(BINFILES)) \ + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)/include) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I-$(CURDIR)/$(SOURCES) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + $(foreach dir,$(INCLUDES),-L$(CURDIR)/$(dir)/lib) + +ifeq ($(strip $(ICON)),) + icons := $(wildcard *.png) + ifneq (,$(findstring $(TARGET).png,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).png + else + ifneq (,$(findstring icon.png,$(icons))) + export APP_ICON := $(TOPDIR)/icon.png + endif + endif +else + export APP_ICON := $(TOPDIR)/$(ICON) +endif + +export _3DSXFLAGS += --smdh=$(OUTPUT).smdh + +ifneq ($(ROMFS),) + export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) +endif + +.PHONY: $(BUILD) clean all + +#--------------------------------------------------------------------------------- +all: $(BUILD) + +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @find $(SOURCES) -type d -printf "%P\0" | xargs -0 -I {} mkdir -p $(BUILD)/{} + @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -rf $(BUILD) $(OUTPUT).3dsx $(OUTPUT).smdh $(OUTPUT).elf $(OUTPUT).cia + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +ifeq ($(strip $(NO_SMDH)),) +.PHONY: all +all : $(OUTPUT).3dsx $(OUTPUT).smdh $(OUTPUT).cia +endif + +$(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh + +$(OUTPUT).elf : $(OFILES) + +#$(TOPDIR)/assets/banner.bin: $(TOPDIR)/assets/banner.png $(TOPDIR)/assets/banner.wav +# @bannertool makebanner -i $(TOPDIR)/assets/banner.png -a $(TOPDIR)/assets/banner.wav -o $(TOPDIR)/assets/banner.bin + +#$(TOPDIR)/assets/icon.bin: $(TOPDIR)/assets/icon.png +# @bannertool makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i $(TOPDIR)/assets/icon.png -o $(TOPDIR)/assets/icon.bin + +$(OUTPUT)_stripped.elf: $(OUTPUT).elf + @cp $(OUTPUT).elf $(OUTPUT)_stripped.elf + @$(PREFIX)strip $(OUTPUT)_stripped.elf + +$(OUTPUT).cia: $(OUTPUT)_stripped.elf $(TOPDIR)/assets/banner.bin $(TOPDIR)/assets/icon.icn + @makerom -f cia -o $(OUTPUT).cia -rsf $(TOPDIR)/assets/cia.rsf -target t -exefslogo -elf $(OUTPUT)_stripped.elf -icon $(TOPDIR)/assets/icon.icn -banner $(TOPDIR)/assets/banner.bin -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(APP_UNIQUE_ID)" -DAPP_ROMFS="$(TOPDIR)/$(ROMFS)" + @echo "built ... $(notdir $@)" + +#--------------------------------------------------------------------------------- +# you need a rule like this for each extension you use as binary data +#--------------------------------------------------------------------------------- +%.bin.o : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +# WARNING: This is not the right way to do this! TODO: Do it right! +#--------------------------------------------------------------------------------- +%.vsh.o : %.vsh +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin + @bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@ + @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h + @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h + @echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h + @rm ../$(notdir $<).shbin + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- diff --git a/PKSM/3ds/PKSM/PKSM.3dsx b/PKSM/3ds/PKSM/PKSM.3dsx new file mode 100644 index 000000000..d24eb473e Binary files /dev/null and b/PKSM/3ds/PKSM/PKSM.3dsx differ diff --git a/PKSM/3ds/PKSM/PKSM.smdh b/PKSM/3ds/PKSM/PKSM.smdh new file mode 100644 index 000000000..13279888d Binary files /dev/null and b/PKSM/3ds/PKSM/PKSM.smdh differ diff --git a/PKSM/3ds/PKSM/PKSM.xml b/PKSM/3ds/PKSM/PKSM.xml new file mode 100644 index 000000000..3f6b88df2 --- /dev/null +++ b/PKSM/3ds/PKSM/PKSM.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/PKSM/PKSM.cia b/PKSM/PKSM.cia new file mode 100644 index 000000000..b174f65c7 Binary files /dev/null and b/PKSM/PKSM.cia differ diff --git a/README.md b/README.md new file mode 100644 index 000000000..ac23e7458 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# ![pksm](assets/bannersite.png) ![pksm](assets/banner.png) + +**Editor**, **wondercard injector** and **offline homebrew bank**. + +## Installation + +**If you already installed the 4.0.0alpha**: remove your ` /3ds/data/PKSM/additionalassets/ ` folder before installing, in order to avoid edge-case graphic glitches. + +Download and install the latest release (4.0.0) with your favourite installation method. When booted, the application will download automatically the required additional assets from a third party source. You can provide your own assets, if you want. + +If you're using Homebrew Launcher, make sure you have it updated to the [latest version](https://smealum.github.io/ninjhax2/starter.zip). + +If you're using Homebrew Launcher and you don't have the latest firmware on your console, you may want to use **ctr-httpwn** to get internet access and let the application download everything correctly. If you can't still download them through the application, you can put them manually in the SD card, putting the external [additionalassets](https://github.com/dsoldier/PKResources) folder in your SD card, located at ` /3ds/data/PKSM/ `. To avoid troubles, the final result should be a folder filled with assets, located at ` /3ds/data/PKSM/additionalassets/ `. + +## Compiling + +You need devKitPro, ctrulib, sf2d, sfil, sftd and Xerpi's portlibs to be able to compile this. + +## Screenshots + +![pksm](resources/01.png) ![pksm](resources/02.png) +![pksm](resources/03.png) ![pksm](resources/04.png) +![pksm](resources/05.png) ![pksm](resources/06.png) +![pksm](resources/07.png) ![pksm](resources/08.png) +![pksm](resources/09.png) ![pksm](resources/10.png) +![pksm](resources/11.png) ![pksm](resources/12.png) +![pksm](resources/13.png) + +## Credits + +* @dsoldier for the gorgeous graphic work +* Smealum for ctrulib, Xerpi for sf2d +* Kaphotics for PKHeX and being an awesome guy +* SciresM for C-memecrypto, you rock man +* J-K-D for direct save import/export and being awesome +* Slashcash for PCHex++ and Strackeror for PCHex +* Gocario for PKBrew +* TuxSH for TWLSaveTool +* MarcusD for romfs support +* Nba_Yoh for received flags fix +* Hamcha for cybertrust.h and digicert.h +* PPorg for most of wc6/wc7 included here +* Simona, Carlo, Matteo for fill.c work +* Shai, Federico, YodaDaCoda, /u/SatansRoommate for tests +* Alex, Immersion, Hat3Mond4ys, sgtkwol for descriptions +* Paul, Kian for a few wc6 +* Majickhat55 for few collections and descriptions +* Poutros for N's collection + +## License + +This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. diff --git a/assets/audio.wav b/assets/audio.wav new file mode 100644 index 000000000..ccf861d54 Binary files /dev/null and b/assets/audio.wav differ diff --git a/assets/banner.bin b/assets/banner.bin new file mode 100644 index 000000000..6756aaa69 Binary files /dev/null and b/assets/banner.bin differ diff --git a/assets/banner.png b/assets/banner.png new file mode 100644 index 000000000..8deb565cd Binary files /dev/null and b/assets/banner.png differ diff --git a/assets/bannersite.png b/assets/bannersite.png new file mode 100644 index 000000000..686caf705 Binary files /dev/null and b/assets/bannersite.png differ diff --git a/assets/buildbd.bat b/assets/buildbd.bat new file mode 100644 index 000000000..e139181cf --- /dev/null +++ b/assets/buildbd.bat @@ -0,0 +1,3 @@ +@bannertool makebanner -i banner.png -a audio.wav -o banner.bin +@bannertool makesmdh -s "PKSM" -l "AIO tool for Pokemon games" -p "Bernardo Giordano" -i icon.png -o icon.icn +pause \ No newline at end of file diff --git a/assets/icon.icn b/assets/icon.icn new file mode 100644 index 000000000..68c2e17b9 Binary files /dev/null and b/assets/icon.icn differ diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 000000000..d87e765b5 Binary files /dev/null and b/assets/icon.png differ diff --git a/assets/romfs/database/1.txt b/assets/romfs/database/1.txt new file mode 100644 index 000000000..99b5a9a95 --- /dev/null +++ b/assets/romfs/database/1.txt @@ -0,0 +1,18 @@ +0001 - Birthday Pokemon + +Pokemon: Pikachu & Eevolutions +Level: 10 +Ability: Various +Held Item: None +TID: 10123, 10014, 10015 +SID: 00001 +OT: ????? +Met: a Pokemon Center +Nature: Random +Ribbon: Birthday Ribbon + + Relearn Moves: +Games: XY ORAS - Celebrate +Method: Infrared +Region: All +Duration: \ No newline at end of file diff --git a/assets/romfs/database/100.txt b/assets/romfs/database/100.txt new file mode 100644 index 000000000..b48926dce --- /dev/null +++ b/assets/romfs/database/100.txt @@ -0,0 +1,18 @@ +0100 - 7/11 Pancham (Serena) + +Pokemon: Pancham +Level: 30 +Ability: Mold Breaker +Held Item: Black Glasses +TID: 00711 +SID: 00100 +OT: ??? +Met: a lovely place +Nature: Adamant +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY/ORAS - Arm Thrust +Method: Serial Code - Stone Edge +Region: JPN - Dark Pulse +Duration: Jul 18 to Sep 30, 2015 \ No newline at end of file diff --git a/assets/romfs/database/101.txt b/assets/romfs/database/101.txt new file mode 100644 index 000000000..d11191afa --- /dev/null +++ b/assets/romfs/database/101.txt @@ -0,0 +1,18 @@ +0101 - 7/11 Lugia + +Pokemon: Lugia +Level: 50 +Ability: Pressure +Held Item: Leftovers +TID: 00711 +SID: 00101 +OT: 7 SPOT +Met: a lovely place +Nature: Timid +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY/ORAS - Aeroblast +Method: Serial Code - Hydro Pump +Region: JPN - Dragon Rush +Duration: Aug 1 to Sep 30, 2015 - Ice Beam \ No newline at end of file diff --git a/assets/romfs/database/102.txt b/assets/romfs/database/102.txt new file mode 100644 index 000000000..b0d7576cf --- /dev/null +++ b/assets/romfs/database/102.txt @@ -0,0 +1,18 @@ +0102 - 7/11 Latios + +Pokemon: Latios +Level: 50 +Ability: Levitate +Held Item: Latiosite +TID: 00711 +SID: 00102 +OT: 7 SPOT +Met: a lovely place +Nature: Modest +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY/ORAS - Dragon Pulse +Method: Serial Code - Luster Purge +Region: JPN - Psychic +Duration: Aug 1 to Sep 30, 2015 - Heal Pulse \ No newline at end of file diff --git a/assets/romfs/database/1060.txt b/assets/romfs/database/1060.txt new file mode 100644 index 000000000..b6a75f407 --- /dev/null +++ b/assets/romfs/database/1060.txt @@ -0,0 +1,18 @@ +1060 - XY&Z Xerneas + +Pokemon: Xerneas +Level: 100 +Ability: Fairy Aura +Held Item: No Item +TID: 03226 +SID: 01060 +OT: XY&Z +Met: a Pokemon Event +Nature: Any Nature +Ribbon: Classic + + Relearn Moves: +Games: ORAS - Geomancy +Method: Universal Serial Code - Moonblast +Region: KOR - Aromatherapy +Duration: Mar 22 to Jun 30, 2016 - Focus Blast \ No newline at end of file diff --git a/assets/romfs/database/1061.txt b/assets/romfs/database/1061.txt new file mode 100644 index 000000000..bee37c4f7 --- /dev/null +++ b/assets/romfs/database/1061.txt @@ -0,0 +1,18 @@ +1061 - XY&Z Yveltal + +Pokemon: Yveltal +Level: 100 +Ability: Dark Aura +Held Item: No Item +TID: 04206 +SID: 01061 +OT: XY&Z +Met: the Pokemon cartoon +Nature: Any Nature +Ribbon: Classic + + Relearn Moves: +Games: ORAS - Oblivion Wing +Method: Universal Serial Code - Sucker Punch +Region: KOR - Dark Pulse +Duration: Apr 20 to Jun 30, 2016 - Foul Play \ No newline at end of file diff --git a/assets/romfs/database/1064.txt b/assets/romfs/database/1064.txt new file mode 100644 index 000000000..9d51f4ac8 --- /dev/null +++ b/assets/romfs/database/1064.txt @@ -0,0 +1,18 @@ +1064 - XY&Z Zygarde + +Pokemon: Zygarde +Level: 100 +Ability: Aura Break +Held Item: No Item +TID: 03196 +SID: 01064 +OT: XY&Z +Met: the Pokemon cartoon +Nature: Any Nature +Ribbon: Classic + + Relearn Moves: +Games: ORAS - Land's Wrath +Method: Universal Serial Code - Extreme Speed +Region: KOR - Glare +Duration: Apr 20 to Jun 30, 2016 - Outrage \ No newline at end of file diff --git a/assets/romfs/database/107.txt b/assets/romfs/database/107.txt new file mode 100644 index 000000000..0694f2368 --- /dev/null +++ b/assets/romfs/database/107.txt @@ -0,0 +1,18 @@ +0107 - Yokohama 2015 Shiny Pikachu + +Pokemon: Pikachu +Level: 10 +Ability: Static +Held Item: Persim Berry +TID: 08085 +SID: 00107 +OT: ???? +Met: a Pokemon event +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY/ORAS - Teeter Dance +Method: Local Wireless - Play Nice +Region: JPN - Tail Whip +Duration: August 8 to 16, 2015 - Nuzzle \ No newline at end of file diff --git a/assets/romfs/database/1071.txt b/assets/romfs/database/1071.txt new file mode 100644 index 000000000..2a113dd52 --- /dev/null +++ b/assets/romfs/database/1071.txt @@ -0,0 +1,18 @@ +1071 - All Stars Diancie + +Pokemon: Diancie +Level: 50 +Ability: Clear Body +Held Item: Normal Gem +TID: 08136 +SID: 01071 +OT: ??? +Met: a Pokemon event +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY ORAS - Diamond Storm +Method: Local Infared - Moonblast +Region: KOR - Reflect +Duration: August 13 to 14, 2016 - Return \ No newline at end of file diff --git a/assets/romfs/database/114.txt b/assets/romfs/database/114.txt new file mode 100644 index 000000000..e5137a8cf --- /dev/null +++ b/assets/romfs/database/114.txt @@ -0,0 +1,18 @@ +0114 - Expo Charizard + +Pokemon: Charizard +Level: 36 +Ability: Blaze +Held Item: Charizardite Y +TID: 11195 +SID: 00114 +OT: ?? +Met: a Pokemon event +Nature: Serious +Ribbon: Souvenir + + Relearn Moves: +Games: XY/ORAS - Flamethrower +Method: Serial Code - Ember +Region: JPN - Fire Spin +Duration: 19 Nov '15 to 31 May '16 - Flame Burst \ No newline at end of file diff --git a/assets/romfs/database/117.txt b/assets/romfs/database/117.txt new file mode 100644 index 000000000..8a12d3afa --- /dev/null +++ b/assets/romfs/database/117.txt @@ -0,0 +1,18 @@ +0117 - Expo Zoroark + +Pokemon: Zoroark +Level: 45 +Ability: Illusion +Held Item: Expert Belt +TID: 11195 +SID: 00117 +OT: ?? +Met: a Pokemon event +Nature: Naughty +Ribbon: Souvenir + + Relearn Moves: +Games: XY/ORAS - Scary Face +Method: Serial code - Fury Swipes +Region: JPN - Nasty Plot +Duration: 19 Nov '15 to 31 May '15 - Punishment \ No newline at end of file diff --git a/assets/romfs/database/147.txt b/assets/romfs/database/147.txt new file mode 100644 index 000000000..46a21c10a --- /dev/null +++ b/assets/romfs/database/147.txt @@ -0,0 +1,18 @@ +0147 - Pokescrap Shiny Eevee + +Pokemon: Eevee +Level: 15 +Ability: Anticipation +Held Item: None +TID: 03016 +SID: 00147 +OT: ?????? +Met: a lovely place +Nature: Random +Ribbon: Classic + + Relearn Moves: +Games: XY ORAS - Swift +Method: Serial Code - Quick Attack +Region: JPN - Baby-Doll Eyes +Duration: Mar 1 to Aug 31, 2016 - Helping Hand \ No newline at end of file diff --git a/assets/romfs/database/148.txt b/assets/romfs/database/148.txt new file mode 100644 index 000000000..0dbc9638c --- /dev/null +++ b/assets/romfs/database/148.txt @@ -0,0 +1,19 @@ +0148 - Pokescrap Articuno + +Pokemon: Articuno +Level: 70 +Ability: Snow Cloak +Held Item: None +TID: 03016 +SID: 00147 +OT: ?????? +Met: a lovely place +Nature: Random +Ribbon: Classic + + Relearn Moves: +Games: XY/ORAS - Freeze-Dry +Method: Serial Code - Ice Beam +Region: JPN - Hail +Duration: Mar 1 to Aug 31, 2016 - Reflect + \ No newline at end of file diff --git a/assets/romfs/database/149.txt b/assets/romfs/database/149.txt new file mode 100644 index 000000000..70279510c --- /dev/null +++ b/assets/romfs/database/149.txt @@ -0,0 +1,18 @@ +0149 - Pokescrap Zapdos + +Pokemon: Zapdos +Level: 70 +Ability: Static +Held Item: None +TID: 03016 +SID: 00147 +OT: ?????? +Met: a lovely place +Nature: Random +Ribbon: Classic + + Relearn Moves: +Games: XY/ORAS - Discharge +Method: Serial Code - Thunder Shock +Region: JPN - Rain Dance +Duration: Mar 1 to Aug 31, 2016 - Agility \ No newline at end of file diff --git a/assets/romfs/database/150.txt b/assets/romfs/database/150.txt new file mode 100644 index 000000000..8be4ddaf9 --- /dev/null +++ b/assets/romfs/database/150.txt @@ -0,0 +1,18 @@ +0150 - Pokescrap Moltres + +Pokemon: Moltres +Level: 70 +Ability: Flame Body +Held Item: None +TID: 03016 +SID: 00150 +OT: ?????? +Met: a lovely place +Nature: Random +Ribbon: Classic + + Relearn Moves: +Games: XY/ORAS - Sky Attack +Method: Serial code - Heat Wave +Region: JPN - Sunny Day +Duration: Mar 1 to Aug 31, 2016 - Safeguard \ No newline at end of file diff --git a/assets/romfs/database/1503.txt b/assets/romfs/database/1503.txt new file mode 100644 index 000000000..efdad46a6 --- /dev/null +++ b/assets/romfs/database/1503.txt @@ -0,0 +1,18 @@ +1503 - GTS Fancy Vivillon + +Pokemon: Vivillon +Level: 12 +Ability: Shield Dust/Compound Eyes +Held Item: None +TID: 00108 +SID: 01503 +OT: GTS +Met: an online Present +Nature: Any Nature +Ribbon: Souvenir + + Relearn Moves: +Games: XY - Hold Hands +Method: WiFi Connection - Gust +Region: All - Light Screen +Duration: July 8 to 31, 2014 - Struggle Bug \ No newline at end of file diff --git a/assets/romfs/database/1504.txt b/assets/romfs/database/1504.txt new file mode 100644 index 000000000..cab9a5b9c --- /dev/null +++ b/assets/romfs/database/1504.txt @@ -0,0 +1,18 @@ +1504 - Shiny Beldum/Steven's Beldum + +Pokemon: Beldum +Level: 5 +Ability: Clear Body +Held Item: Metagrossite +TID: 11214 +SID: 01504 +OT: Maximo, Pierre, Steven +Met: an online Present +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: ORAS - Hold Back +Method: Nintendo Network +Region: All +Duration: Nov 21 '14 to Jan 14 '15 \ No newline at end of file diff --git a/assets/romfs/database/1505.txt b/assets/romfs/database/1505.txt new file mode 100644 index 000000000..71e815247 --- /dev/null +++ b/assets/romfs/database/1505.txt @@ -0,0 +1,18 @@ +1505 - HA Serperior + +Pokemon: Serperior +Level: 50 +Ability: Contrary +Held Item: None +TID: 01225 +SID: 01505 +OT: Cadeau, Present, Regalo +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: ORAS - Hold Back +Method: Serial Code +Region: All +Duration: Jan 22 to Nov 30, 2015 \ No newline at end of file diff --git a/assets/romfs/database/1506.txt b/assets/romfs/database/1506.txt new file mode 100644 index 000000000..12cc27d8b --- /dev/null +++ b/assets/romfs/database/1506.txt @@ -0,0 +1,18 @@ +1506 - HA Emboar + +Pokemon: Emboar +Level: 50 +Ability: Reckless +Held Item: None +TID: 01295 +SID: 01506 +OT: Cadeau, Present, Regalo +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: ORAS - Hold Back +Method: Serial Code +Region: All +Duration: Jan 29 to Nov 30, 2015 \ No newline at end of file diff --git a/assets/romfs/database/1507.txt b/assets/romfs/database/1507.txt new file mode 100644 index 000000000..bc34b9b2f --- /dev/null +++ b/assets/romfs/database/1507.txt @@ -0,0 +1,18 @@ +1507 - HA Samurott + +Pokemon: Samurott +Level: 50 +Ability: Shell Armor +Held Item: None +TID: 02105 +SID: 01507 +OT: Cadeau, Present, Regalo +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: ORAS - Hold Back +Method: Serial Code +Region: All +Duration: Feb 9 to Nov 30, 2015 \ No newline at end of file diff --git a/assets/romfs/database/1515.txt b/assets/romfs/database/1515.txt new file mode 100644 index 000000000..aacabf5ff --- /dev/null +++ b/assets/romfs/database/1515.txt @@ -0,0 +1,18 @@ +1515 - PGL Cynthia's Garchomp + +Pokemon: Garchomp +Level: 66 +Ability: Sand Veil +Held Item: Sitrus Berry +TID: 07226 +SID: 00011 +OT: ??? +Met: Pokemon League +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: ORAS - Dragon Rush +Method: Serial Code - Earthquake +Region: JPN - Brick Break +Duration: Aug 2 to Sep 29, 2016 - Giga Impact \ No newline at end of file diff --git a/assets/romfs/database/167.txt b/assets/romfs/database/167.txt new file mode 100644 index 000000000..b88c79490 --- /dev/null +++ b/assets/romfs/database/167.txt @@ -0,0 +1,18 @@ +0167 - Hyadain's Landorus + +Pokemon: Landorus +Level: 50 +Ability: Sand Force +Held Item: Assault Vest +TID: 14818 +SID: 00167 +OT: ????? +Met: a Pokemon TV program +Nature: Adamant +Ribbon: Classic + + Relearn Moves: +Games: ORAS - Earthquake +Method: Serial Code - Knock Off +Region: JPN - U-Turn +Duration: 24 May to 30 June 2016 - Rock Tomb \ No newline at end of file diff --git a/assets/romfs/database/168.txt b/assets/romfs/database/168.txt new file mode 100644 index 000000000..b7813f094 --- /dev/null +++ b/assets/romfs/database/168.txt @@ -0,0 +1,18 @@ +0168 - Chymia's Gardevoir + +Pokemon: Gardevoir +Level: 50 +Ability: Synchronize +Held Item: Gardevoirite +TID: 06176 +SID: 00168 +OT: ??? +Met: Pokemon Movie 16 +Nature: Any Nature +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY/ORAS - Dazzling Gleam +Method: Serial Code - Moonblast +Region: JAP - Stored Power +Duration: Jun 17 to Aug 31, 2016 - Calm Mind \ No newline at end of file diff --git a/assets/romfs/database/2.txt b/assets/romfs/database/2.txt new file mode 100644 index 000000000..3aa9846c2 --- /dev/null +++ b/assets/romfs/database/2.txt @@ -0,0 +1,18 @@ +0002 - CoroCoro Garchomp - X&Y + +Pokemon: Garchomp +Level: 48 +Ability: Sand Veil +Held Item: Dragon Fang +TID: 11153 +SID: 00002 +OT: ???? +Met: a lovely place +Nature: Random +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY +Method: Serial Code +Region: JAP +Duration: Nov 15 '13 to Aug 29 '14 \ No newline at end of file diff --git a/assets/romfs/database/3.txt b/assets/romfs/database/3.txt new file mode 100644 index 000000000..acecc6829 --- /dev/null +++ b/assets/romfs/database/3.txt @@ -0,0 +1,19 @@ +0003 - Pokemon Center Tokyo Bay Inkay + +Pokemon: Inkay +Level: 10 +Ability: Contrary, Suction Cups +Held Item: Aspear Berry +TID: 11223 +SID: 00003 +OT: PCTB +Met: PC Tokyo Bay +Nature: Random +Ribbon: Premier Ribbon + + Relearn Moves: +Games: XY - Happy Hour +Method: local wireless +Region: all +Duration: Nov 22 '13 to Jan 26 '14 + \ No newline at end of file diff --git a/assets/romfs/database/4.txt b/assets/romfs/database/4.txt new file mode 100644 index 000000000..1d3844824 --- /dev/null +++ b/assets/romfs/database/4.txt @@ -0,0 +1,19 @@ +0004 - Nuketta Wobbuffet + +Pokemon: Wobbuffet +Level: 10 +Ability: Shadow Tag +Held Item: None +TID: 12063 +SID: 00004 +OT: ? +Met: a Pokemon event +Nature: Random +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY +Method: Infrared +Region: All +Duration: December 15, 2013 + \ No newline at end of file diff --git a/assets/romfs/database/43.txt b/assets/romfs/database/43.txt new file mode 100644 index 000000000..ead4f01fe --- /dev/null +++ b/assets/romfs/database/43.txt @@ -0,0 +1,18 @@ +0043 - Charizard got Charizardite Y! + +Pokemon: Charizard +Level: 36 +Ability: Blaze +Held Item: Charizardite Y +TID: 07274 +SID: 00043 +OT: XY +Met: a lovely place +Nature: Random +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY - +Method: Serial Code +Region: All +Duration: Jul 29 '14 to Oct 31 '14 \ No newline at end of file diff --git a/assets/romfs/database/46.txt b/assets/romfs/database/46.txt new file mode 100644 index 000000000..ac9d56dd4 --- /dev/null +++ b/assets/romfs/database/46.txt @@ -0,0 +1,18 @@ +0046 - Darkrai Present + +Pokemon: Darkrai +Level: 50 +Ability: Bad Dream +Held Item: Enigma Berry +TID: 08074 +SID: 00046 +OT: Wonderland +Met: Pokemon Movie 14 +Nature: Random +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY - Phantom Force +Method: Serial Code +Region: All +Duration: Aug 7 '14 to Sep 30 '14 \ No newline at end of file diff --git a/assets/romfs/database/47.txt b/assets/romfs/database/47.txt new file mode 100644 index 000000000..5c1249a82 --- /dev/null +++ b/assets/romfs/database/47.txt @@ -0,0 +1,18 @@ +0047 - Diancie Present + +Pokemon: Diancie +Level: 50 +Ability: Clear Body +Held Item: Normal Gem +TID: 08274 +SID: 00047 +OT: MovieTheater +Met: Pokémon Movie 14 +Nature: Random +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY - +Method: Serial Code +Region: All +Duration: Aug 29 '14 to Oct 15 '14 \ No newline at end of file diff --git a/assets/romfs/database/501.txt b/assets/romfs/database/501.txt new file mode 100644 index 000000000..96147a26b --- /dev/null +++ b/assets/romfs/database/501.txt @@ -0,0 +1,18 @@ +0501 - Winter2013 Garchomp + +Pokemon: Garchomp +Level: 50 +Ability: Sand Veil +Held Item: Dragon Fang +TID: 11153 +SID: 00501 +OT: WINTER2013 +Met: a lovely place +Nature: Random +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY - +Method: Serial code +Region: All +Duration: Nov 27 '13 to Jun 30 '14 \ No newline at end of file diff --git a/assets/romfs/database/502.txt b/assets/romfs/database/502.txt new file mode 100644 index 000000000..b2c4635f9 --- /dev/null +++ b/assets/romfs/database/502.txt @@ -0,0 +1,18 @@ +0502 - Winter2013 Scizor + +Pokemon: Scizor +Level: 50 +Ability: Swarm or Technician +Held Item: Silver Powder +TID: 11153 +SID: 00502 +OT: WINTER2013 +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY - +Method: Serial Code +Region: All +Duration: Nov 27 '13 to Jun 30 '14 diff --git a/assets/romfs/database/510.txt b/assets/romfs/database/510.txt new file mode 100644 index 000000000..0cc3e252f --- /dev/null +++ b/assets/romfs/database/510.txt @@ -0,0 +1,18 @@ +0510 - Arash's Mamoswine + +Pokemon: Mamoswine +Level: 50 +Ability: Sand Force +Held Item: Choice Scarf +TID: 05034 +SID: 00510 +OT: Arash +Met: a Pokemon event +Nature: Adamant +Ribbon: Event + + Relearn Moves: +Games: XY - Earthquake +Method: Local - Icicle Crash +Region: EUR USA AUS - Icicle Spear +Duration: May 3 to July 13, 2014 - Rock Slide \ No newline at end of file diff --git a/assets/romfs/database/511.txt b/assets/romfs/database/511.txt new file mode 100644 index 000000000..378d2948e --- /dev/null +++ b/assets/romfs/database/511.txt @@ -0,0 +1,18 @@ +0511 - Paris Vivillon + +Pokemon: Vivillon +Level: 12 +Ability: Shield Dust/Compound Eyes +Held Item: None +TID: 06014 +SID: 00511 +OT: Paris +Met: a Pokemon Center +Nature: Any Nature +Ribbon: Classic + + Relearn Moves: +Games: XY - Stun Spore +Method: Local - Gust +Region: FRA - Light Screen +Duration: 4 June 4 to 21, 2014 - Struggle Bug \ No newline at end of file diff --git a/assets/romfs/database/515.txt b/assets/romfs/database/515.txt new file mode 100644 index 000000000..d271f3214 --- /dev/null +++ b/assets/romfs/database/515.txt @@ -0,0 +1,18 @@ +0515 - Heracross/Pinsir + +Pokemon: Heracross/Pinsir +Level: 50 +Ability: Various +Held Item: None +TID: 08134 +SID: 00515 +OT: SUM2014 +Met: a lovely place +Nature: Adamant +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY +Method: Nintendo Network +Region: All +Duration: Aug 13 to Sep 17, 2014 diff --git a/assets/romfs/database/523.txt b/assets/romfs/database/523.txt new file mode 100644 index 000000000..b99383f77 --- /dev/null +++ b/assets/romfs/database/523.txt @@ -0,0 +1,18 @@ +0523 - Halloween 2014 Pumpkaboo + +Pokemon: Pumpkaboo +Level: 50 +Ability: Various +Held Item: Rocky Helmet +TID: 10014 +SID: 0523 +OT: Spooky2014 +Met: a lovely place +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY - +Method: Nintendo Network +Region: All +Duration: October 1 to 31, 2014 diff --git a/assets/romfs/database/525.txt b/assets/romfs/database/525.txt new file mode 100644 index 000000000..59242e2e9 --- /dev/null +++ b/assets/romfs/database/525.txt @@ -0,0 +1,18 @@ +0525 - NOVEMBRE2014 Diancie + +Pokemon: Diancie +Level: 50 +Ability: Clear Body +Held Item: Normal Gem +TID: 11064 +SID: 00525 +OT: NOVEMBRE14 +Met: a lovely place +Nature: Any Nature +Ribbon: Wishing + + Relearn Moves: +Games: XY - Diamond Storm +Method: Serial Code - Moonblast +Region: ITA - Reflect +Duration: Oct 23 '14 to Feb 25 '15 - Return \ No newline at end of file diff --git a/assets/romfs/database/546.txt b/assets/romfs/database/546.txt new file mode 100644 index 000000000..f7e5f7c64 --- /dev/null +++ b/assets/romfs/database/546.txt @@ -0,0 +1,18 @@ +0546 - Hope Diancie + +Pokemon: Diancie +Level: 50 +Ability: Various +Held Item: None +TID: 07245 +SID: 00546 +OT: Hope +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: ORAS - +Method: Nintendo Network +Region: All +Duration: July 24 to 27, 2015 diff --git a/assets/romfs/database/547.txt b/assets/romfs/database/547.txt new file mode 100644 index 000000000..19c871de9 --- /dev/null +++ b/assets/romfs/database/547.txt @@ -0,0 +1,18 @@ +0547 - Galileo Rayquaza + +Pokemon: Rayquaza +Level: 70 +Ability: Air Lock +Held Item: Dragon Fang +TID: 08055 +SID: 00547 +OT: Galilee, Galileo +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: ORAS - +Method: Nintendo Network +Region: EUR +Duration: Aug 12 to Sep 14, 2015 diff --git a/assets/romfs/database/557.txt b/assets/romfs/database/557.txt new file mode 100644 index 000000000..5b40bd4c3 --- /dev/null +++ b/assets/romfs/database/557.txt @@ -0,0 +1,18 @@ +0557 - GF Mew + +Pokemon: Mew +Level: 100 +Ability: Synchronize +Held Item: None +TID: 02016 +SID: 00557 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Pound +Method: Serial Code +Region: USA +Duration: Jan 27 to Aug 31, 2016 diff --git a/assets/romfs/database/558.txt b/assets/romfs/database/558.txt new file mode 100644 index 000000000..4a3c9b548 --- /dev/null +++ b/assets/romfs/database/558.txt @@ -0,0 +1,18 @@ +0558 - GF Celebi + +Pokemon: Celebi +Level: 100 +Ability: Natural Cure +Held Item: None +TID: 03016 +SID: 00558 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Confusion +Method: Nintendo Network - Recover +Region: USA - Heal Bell +Duration: March 1 to 24, 2016 - Safeguard \ No newline at end of file diff --git a/assets/romfs/database/559.txt b/assets/romfs/database/559.txt new file mode 100644 index 000000000..481274db4 --- /dev/null +++ b/assets/romfs/database/559.txt @@ -0,0 +1,18 @@ +0559 - GF Jirachi + +Pokemon: Jirachi +Level: 100 +Ability: Serene Grace +Held Item: Salac Berry +TID: 04016 +SID: 00559 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Wish +Method: Nintendo Network - Confusion +Region: USA - Rest +Duration: April 1 to 24, 2016 \ No newline at end of file diff --git a/assets/romfs/database/560.txt b/assets/romfs/database/560.txt new file mode 100644 index 000000000..03742e610 --- /dev/null +++ b/assets/romfs/database/560.txt @@ -0,0 +1,18 @@ +0560 - GF Darkrai + +Pokemon: Darkrai +Level: 100 +Ability: Bad Dreams +Held Item: Enigma Berry +TID: 05016 +SID: 00560 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Dark Void +Method: Nintendo Network - Ominous Wind +Region: USA - Nightmare +Duration: May 1 to Nov 30, 2016 - Feint Attack diff --git a/assets/romfs/database/561.txt b/assets/romfs/database/561.txt new file mode 100644 index 000000000..69fa61bd0 --- /dev/null +++ b/assets/romfs/database/561.txt @@ -0,0 +1,18 @@ +0561 - GF Manaphy + +Pokemon: Manaphy +Level: 100 +Ability: Hydration +Held Item: King's Rock +TID: 06016 +SID: 00561 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Tail Glow +Method: Nintendo Network - Bubble +Region: USA - Water Sport +Duration: June 1 to 24, 2016 \ No newline at end of file diff --git a/assets/romfs/database/562.txt b/assets/romfs/database/562.txt new file mode 100644 index 000000000..9ea67dcfc --- /dev/null +++ b/assets/romfs/database/562.txt @@ -0,0 +1,18 @@ +0562 - GF Shaymin + +Pokemon: Shaymin +Level: 100 +Ability: Natural Cure +Held Item: Micle Berry +TID: 07016 +SID: 00562 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Seed Flare +Method: Nintendo Network - Aromatherapy +Region: USA - Substitute +Duration: July 1 to 24, 2016 - Energy Ball \ No newline at end of file diff --git a/assets/romfs/database/563.txt b/assets/romfs/database/563.txt new file mode 100644 index 000000000..cfa921f82 --- /dev/null +++ b/assets/romfs/database/563.txt @@ -0,0 +1,20 @@ +0563 - GF Arceus + +Pokemon: Arceus +Level: 100 +Ability: Multitype +Held Item: None +TID: 08016 +SID: 00563 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Judgment +Method: Serial Code - Recover +Region: USA - Hyper Beam +Duration: Jul 30 to Nov 30, 2016 - Perish Song + + diff --git a/assets/romfs/database/564.txt b/assets/romfs/database/564.txt new file mode 100644 index 000000000..baac6bb60 --- /dev/null +++ b/assets/romfs/database/564.txt @@ -0,0 +1,18 @@ +0564 - GF Victini + +Pokemon: Victini +Level: 100 +Ability: Victory Star +Held Item: None +TID: 09016 +SID: 00564 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Incinerate +Method: Nintendo Network - Quick Attack +Region: USA - Endure +Duration: September 1 to 24, 2016 - Confusion \ No newline at end of file diff --git a/assets/romfs/database/565.txt b/assets/romfs/database/565.txt new file mode 100644 index 000000000..22404754d --- /dev/null +++ b/assets/romfs/database/565.txt @@ -0,0 +1,18 @@ +0565 - GF Keldeo + +Pokemon: Keldeo +Level: 100 +Ability: Justified +Held Item: PP Max +TID: 10016 +SID: 00565 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Aqua Jet +Method: Nintendo Network - Leer +Region: USA - Double Kick +Duration: October 1 to 24, 2016 diff --git a/assets/romfs/database/566.txt b/assets/romfs/database/566.txt new file mode 100644 index 000000000..86f3cdf40 --- /dev/null +++ b/assets/romfs/database/566.txt @@ -0,0 +1,18 @@ +0566 - GF Genesect + +Pokemon: Genesect +Level: 100 +Ability: Download +Held Item: None +TID: 11016 +SID: 00566 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Techno Blast +Method: Serial Code - Magnet Bomb +Region: USA - Solar Beam +Duration: Nov 1 '16 to Feb 28 '17 - Signal Beam diff --git a/assets/romfs/database/567.txt b/assets/romfs/database/567.txt new file mode 100644 index 000000000..895782275 --- /dev/null +++ b/assets/romfs/database/567.txt @@ -0,0 +1,18 @@ +0567 - GF Meloetta + +Pokemon: Meloetta +Level: 100 +Ability: Serene Grace +Held Item: PP Max +TID: 12016 +SID: 00567 +OT: GF +Met: a lovely place +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Quick Attack +Method: Nintendo Network - Confusion +Region: USA - Round +Duration: December 1 to 24, 2016 diff --git a/assets/romfs/database/576.txt b/assets/romfs/database/576.txt new file mode 100644 index 000000000..95aa8d6ea --- /dev/null +++ b/assets/romfs/database/576.txt @@ -0,0 +1,18 @@ +0576 - XYZ Xerneas + +Pokemon: Xerneas +Level: 100 +Ability: Fairy Aura +Held Item: None +TID: 5116 +SID: 00578 +OT: XYZ +Met: the Pokemon cartoon +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Geomancy +Method: Nintendo Network - Moonblast +Region: All - Aromatherapy +Duration: May 11 to 17, 2016 - Focus Blast diff --git a/assets/romfs/database/577.txt b/assets/romfs/database/577.txt new file mode 100644 index 000000000..4676cfd52 --- /dev/null +++ b/assets/romfs/database/577.txt @@ -0,0 +1,18 @@ +0577 - XYZ Yveltal + +Pokemon: Yveltal +Level: 100 +Ability: Dark Aura +Held Item: None +TID: 5206 +SID: 00577 +OT: XYZ +Met: the Pokemon cartoon +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Oblivion Wing +Method: Nintendo Network - Sucker Punch +Region: All - Dark Pulse +Duration: May 20 to 26, 2016 - Foul Play diff --git a/assets/romfs/database/578.txt b/assets/romfs/database/578.txt new file mode 100644 index 000000000..5cec50045 --- /dev/null +++ b/assets/romfs/database/578.txt @@ -0,0 +1,18 @@ +0578 - XYZ Zygarde + +Pokemon: Zygarde +Level: 100 +Ability: Aura Break +Held Item: None +TID: 05026 +SID: 00578 +OT: XYZ +Met: the Pokemon cartoon +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY ORAS - Land's Wrath +Method: Nintendo Network - Extreme Speed +Region: All - Glare +Duration: April 30 to May 8, 2016 - Outrage diff --git a/assets/romfs/database/78.txt b/assets/romfs/database/78.txt new file mode 100644 index 000000000..7026079e9 --- /dev/null +++ b/assets/romfs/database/78.txt @@ -0,0 +1,19 @@ +0078 - Shiny Rayquaza + +Pokemon: Rayquaza +Level: 70 +Ability: Air Lock +Held Item: No Item +TID: 01185 +SID: 00078 +OT: WHF15 +Met: an event site +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY/ORAS - Dragon Pulse +Method: Local Wireless - Twister +Region: JPN - Thunder +Duration: Jan 18 to 24/25 '15 - Extreme Speed + \ No newline at end of file diff --git a/assets/romfs/database/79.txt b/assets/romfs/database/79.txt new file mode 100644 index 000000000..340025eec --- /dev/null +++ b/assets/romfs/database/79.txt @@ -0,0 +1,18 @@ +0079 - P-Cafe Pikachu + +Pokemon: Pikachu +Level: 10 +Ability: Static +Held Item: Sweet Heart +TID: 01095 +SID: 00079 +OT: P-Cafe +Met: a lovely place +Nature: Any Nature +Ribbon: Special Ribbon + + Relearn Moves: +Games: ORAS - Play Nice +Method: Local Wireless - Charm +Region: JPN - Nuzzle +Duration: Jan 9 to Mar 15 '15 - Sweet Kiss \ No newline at end of file diff --git a/assets/romfs/database/81.txt b/assets/romfs/database/81.txt new file mode 100644 index 000000000..847a600c1 --- /dev/null +++ b/assets/romfs/database/81.txt @@ -0,0 +1,19 @@ +0081 - Movie Arceus + +Pokemon: Arceus +Level: 100 +Ability: Multitype +Held Item: Various +TID: 03075 +SID: 00081 +OT: ?????? +Met: Pokemon Movie 15 +Nature: Any Nature +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY/ORAS - Judgment +Method: Local Wireless - Blast Burn +Region: JPN/TWN - Hydro Cannon +Duration: Mar 7 to Aug 31, 2015 - Earth Power + \ No newline at end of file diff --git a/assets/romfs/database/83.txt b/assets/romfs/database/83.txt new file mode 100644 index 000000000..161b1e2c0 --- /dev/null +++ b/assets/romfs/database/83.txt @@ -0,0 +1,18 @@ +0083 - Movie Hoopa + +Pokemon: Hoopa +Level: 50 +Ability: Magican +Held Item: Focus Sash +TID: 07185 +SID: 00083 +OT: ????? +Met: Pokemon Movie 15 +Nature: Any Nature +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY/ORAS - Hyperspace Hole +Method: Local Wireless - Psychic +Region: JPN - Astonish +Duration: Jul 18 to Sep 30, 2015 - Nasty Plot \ No newline at end of file diff --git a/assets/romfs/database/86.txt b/assets/romfs/database/86.txt new file mode 100644 index 000000000..e85a87a91 --- /dev/null +++ b/assets/romfs/database/86.txt @@ -0,0 +1,18 @@ +0086 - Serena's Fennekin + +Pokemon: Fennekin +Level: 15 +Ability: Blaze +Held Item: Destiny Knot +TID: 02265 +SID: 00086 +OT: ??? +Met: Lumiose City +Nature: Hardy +Ribbon: Classic Ribbon + + Relearn Moves: +Games: XY/ORAS - Scratch +Method: Serial Code - Flamethrower +Region: JPN - Hidden Power +Duration: Feb 26 to Mar 31, 2015 \ No newline at end of file diff --git a/assets/romfs/database/88.txt b/assets/romfs/database/88.txt new file mode 100644 index 000000000..76bfe3775 --- /dev/null +++ b/assets/romfs/database/88.txt @@ -0,0 +1,18 @@ +0088 - CoroCoro Rayquaza + +Pokemon: Rayquaza +Level: 70 +Ability: Air Lock +Held Item: None +TID: 03145 +SID: 00088 +OT: ???? +Met: an event site +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY/ORAS - Dragon Pulse +Method: Serial Code - Twister +Region: JPN - Thunder +Duration: May 14 to May 15, 2015 - Extreme Speed \ No newline at end of file diff --git a/assets/romfs/database/89.txt b/assets/romfs/database/89.txt new file mode 100644 index 000000000..3e334dcc9 --- /dev/null +++ b/assets/romfs/database/89.txt @@ -0,0 +1,18 @@ +0089 - Spring 2015 Kangaskhan + +Pokemon: Kangaskhan +Level: 50 +Ability: Scrappy +Held Item: Kangaskhanite +TID: 04035 +SID: 00089 +OT: 2015 Spring +Met: a Pokemon Center +Nature: Any Nature +Ribbon: Classic Ribbon + + Relearn Moves: +Games: ORAS - Fake Out +Method: Serial Code - Return +Region: JPN - Earthquake +Duration: April 3 to 9, 2015 - Sucker Punch \ No newline at end of file diff --git a/assets/romfs/database/90.txt b/assets/romfs/database/90.txt new file mode 100644 index 000000000..0a2065e61 --- /dev/null +++ b/assets/romfs/database/90.txt @@ -0,0 +1,18 @@ +0090 - SG Rayquaza + +Pokemon: Rayquaza +Level: 70 +Ability: Air Lock +Held Item: None +TID: 03145 +SID: 00090 +OT: SG Summer'15 +Met: an event site +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves +Games: XY/ORAS - Dragon Pulse +Method: Serial Code - Twister +Region: JPN/USA - Thunder +Duration: May 6 to July 31, 2015 - Extreme Speed \ No newline at end of file diff --git a/assets/romfs/database/94.txt b/assets/romfs/database/94.txt new file mode 100644 index 000000000..594c67a0a --- /dev/null +++ b/assets/romfs/database/94.txt @@ -0,0 +1,18 @@ +0094 - Hiroshima PC Shiny Gyarados + +Pokemon: Gyarados +Level: 20 +Ability: Intimidate +Held Item: Gyaradosite +TID: 06265 +SID: 00094 +OT: PC???? +Met: a Pokemon Center +Nature: Any Nature +Ribbon: Premier Ribbon + + Relearn Moves: +Games: XY/ORAS - Waterfall +Method: Local Wireless - Bite +Region: JPN - Ice Fang +Duration: Jun 26 to Aug 31, '15 - Iron Head \ No newline at end of file diff --git a/assets/romfs/database/95.txt b/assets/romfs/database/95.txt new file mode 100644 index 000000000..13c8bcffc --- /dev/null +++ b/assets/romfs/database/95.txt @@ -0,0 +1,18 @@ +0095 - Hiroshima PC Shiny Magikarp + +Pokemon: Magikarp +Level: 1 +Ability: Swift Swim +Held Item: Stardust +TID: 06265 +SID: 00095 +OT: ???? +Met: a Pokemon Center +Nature: Any Nature +Ribbon: No Ribbon + + Relearn Moves: +Games: XY/ORAS - Splash +Method: Local Wireless - Celebrate +Region: JPN - Happy Hour +Duration: Jun 26 to Aug 31, '15 \ No newline at end of file diff --git a/assets/romfs/database/96.txt b/assets/romfs/database/96.txt new file mode 100644 index 000000000..23acd4d03 --- /dev/null +++ b/assets/romfs/database/96.txt @@ -0,0 +1,18 @@ +0096 - Pokelab Bulbasaur + +Pokemon: Bulbasaur +Level: 5 +Ability: Overgrow +Held Item: Venusaurite +TID: 07085 +SID: 00096 +OT: ????? +Met: a Pokemon Event +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY/ORAS - Growl +Method: Serial Code - Leech Seed +Region: JPN - Vine Whip +Duration: Jul 8 to Nov 30, 2015 - Poison Power \ No newline at end of file diff --git a/assets/romfs/database/97.txt b/assets/romfs/database/97.txt new file mode 100644 index 000000000..80af373df --- /dev/null +++ b/assets/romfs/database/97.txt @@ -0,0 +1,18 @@ +0097 - Pokelab Charmander + +Pokemon: Charmander +Level: 5 +Ability: Blaze +Held Item: Charzardite Y +TID: 07085 +SID: 00097 +OT: ????? +Met: a Pokemon Event +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY/ORAS - Growl +Method: Serial Code - Ember +Region: JPN - Smokescreen +Duration: Jul 8 to Nov 30, 2015 - Dragon Rage \ No newline at end of file diff --git a/assets/romfs/database/98.txt b/assets/romfs/database/98.txt new file mode 100644 index 000000000..45015753e --- /dev/null +++ b/assets/romfs/database/98.txt @@ -0,0 +1,18 @@ +0098 - Pokelab Squirtle + +Pokemon: Squirtle +Level: 5 +Ability: Torrent +Held Item: Blastoisinite +TID: 07085 +SID: 00098 +OT: ????? +Met: a Pokemon Event +Nature: Any Nature +Ribbon: Event Ribbon + + Relearn Moves: +Games: XY/ORAS - Tail Whip +Method: Serial Code - Water Gun +Region: JPN - Withdraw +Duration: Jul 8 to Nov 30, 2015 - Bubble \ No newline at end of file diff --git a/assets/romfs/database/99.txt b/assets/romfs/database/99.txt new file mode 100644 index 000000000..0e4817af2 --- /dev/null +++ b/assets/romfs/database/99.txt @@ -0,0 +1,18 @@ +0099 - 7/11 Pikachu (Ash) + +Pokemon: Pikachu +Level: 50 +Ability: Static +Held Item: Light Ball +TID: 00711 +SID: 00099 +OT: ??? +Met: a lovely place +Nature: Naughty +Ribbon: Wishing Ribbon + + Relearn Moves: +Games: XY/ORAS - Thunderbolt +Method: Serial Code - Quick Attack +Region: JPN - Iron Tail +Duration: Jul 18 to Sept 30, 2015 - Electro Ball \ No newline at end of file diff --git a/assets/romfs/misc/10anni.bin b/assets/romfs/misc/10anni.bin new file mode 100644 index 000000000..84b236441 Binary files /dev/null and b/assets/romfs/misc/10anni.bin differ diff --git a/assets/romfs/misc/coll_deoxysoblivia.bin b/assets/romfs/misc/coll_deoxysoblivia.bin new file mode 100644 index 000000000..ba211c3e4 Binary files /dev/null and b/assets/romfs/misc/coll_deoxysoblivia.bin differ diff --git a/assets/romfs/misc/coll_dreamradar.bin b/assets/romfs/misc/coll_dreamradar.bin new file mode 100644 index 000000000..f1c08a321 Binary files /dev/null and b/assets/romfs/misc/coll_dreamradar.bin differ diff --git a/assets/romfs/misc/coll_entreeforest.bin b/assets/romfs/misc/coll_entreeforest.bin new file mode 100644 index 000000000..eaadd200e Binary files /dev/null and b/assets/romfs/misc/coll_entreeforest.bin differ diff --git a/assets/romfs/misc/coll_n.bin b/assets/romfs/misc/coll_n.bin new file mode 100644 index 000000000..ab5c11d91 Binary files /dev/null and b/assets/romfs/misc/coll_n.bin differ diff --git a/assets/romfs/misc/coll_oskorea.bin b/assets/romfs/misc/coll_oskorea.bin new file mode 100644 index 000000000..41f4912a7 Binary files /dev/null and b/assets/romfs/misc/coll_oskorea.bin differ diff --git a/assets/romfs/misc/coll_ranch.bin b/assets/romfs/misc/coll_ranch.bin new file mode 100644 index 000000000..7acecef57 Binary files /dev/null and b/assets/romfs/misc/coll_ranch.bin differ diff --git a/assets/romfs/misc/colosseum/1.bin b/assets/romfs/misc/colosseum/1.bin new file mode 100644 index 000000000..ee1e4569b Binary files /dev/null and b/assets/romfs/misc/colosseum/1.bin differ diff --git a/assets/romfs/misc/colosseum/2.bin b/assets/romfs/misc/colosseum/2.bin new file mode 100644 index 000000000..f58f525d1 Binary files /dev/null and b/assets/romfs/misc/colosseum/2.bin differ diff --git a/assets/romfs/misc/living.bin b/assets/romfs/misc/living.bin new file mode 100644 index 000000000..d32e175a9 Binary files /dev/null and b/assets/romfs/misc/living.bin differ diff --git a/assets/romfs/misc/oras/base.bin b/assets/romfs/misc/oras/base.bin new file mode 100644 index 000000000..8e140a268 Binary files /dev/null and b/assets/romfs/misc/oras/base.bin differ diff --git a/assets/romfs/misc/oras/berries.bin b/assets/romfs/misc/oras/berries.bin new file mode 100644 index 000000000..b164ebd54 Binary files /dev/null and b/assets/romfs/misc/oras/berries.bin differ diff --git a/assets/romfs/misc/oras/heals.bin b/assets/romfs/misc/oras/heals.bin new file mode 100644 index 000000000..b6827027f Binary files /dev/null and b/assets/romfs/misc/oras/heals.bin differ diff --git a/assets/romfs/misc/oras/tm.bin b/assets/romfs/misc/oras/tm.bin new file mode 100644 index 000000000..cb586a4f8 Binary files /dev/null and b/assets/romfs/misc/oras/tm.bin differ diff --git a/assets/romfs/misc/xd/1.bin b/assets/romfs/misc/xd/1.bin new file mode 100644 index 000000000..2f46d3d54 Binary files /dev/null and b/assets/romfs/misc/xd/1.bin differ diff --git a/assets/romfs/misc/xd/2.bin b/assets/romfs/misc/xd/2.bin new file mode 100644 index 000000000..60835e878 Binary files /dev/null and b/assets/romfs/misc/xd/2.bin differ diff --git a/assets/romfs/misc/xd/3.bin b/assets/romfs/misc/xd/3.bin new file mode 100644 index 000000000..7bcb8b823 Binary files /dev/null and b/assets/romfs/misc/xd/3.bin differ diff --git a/assets/romfs/misc/xy/base.bin b/assets/romfs/misc/xy/base.bin new file mode 100644 index 000000000..406fcffed Binary files /dev/null and b/assets/romfs/misc/xy/base.bin differ diff --git a/assets/romfs/misc/xy/berries.bin b/assets/romfs/misc/xy/berries.bin new file mode 100644 index 000000000..b164ebd54 Binary files /dev/null and b/assets/romfs/misc/xy/berries.bin differ diff --git a/assets/romfs/misc/xy/heals.bin b/assets/romfs/misc/xy/heals.bin new file mode 100644 index 000000000..da946af29 Binary files /dev/null and b/assets/romfs/misc/xy/heals.bin differ diff --git a/assets/romfs/misc/xy/tm.bin b/assets/romfs/misc/xy/tm.bin new file mode 100644 index 000000000..3f04d3be1 Binary files /dev/null and b/assets/romfs/misc/xy/tm.bin differ diff --git a/assets/romfs/personal/personal.bin b/assets/romfs/personal/personal.bin new file mode 100644 index 000000000..79d9e386b Binary files /dev/null and b/assets/romfs/personal/personal.bin differ diff --git a/assets/romfs/pgf/eng/100.pgf b/assets/romfs/pgf/eng/100.pgf new file mode 100644 index 000000000..7e28332f6 Binary files /dev/null and b/assets/romfs/pgf/eng/100.pgf differ diff --git a/assets/romfs/pgf/eng/128.pgf b/assets/romfs/pgf/eng/128.pgf new file mode 100644 index 000000000..4bd1167c6 Binary files /dev/null and b/assets/romfs/pgf/eng/128.pgf differ diff --git a/assets/romfs/pgf/eng/129.pgf b/assets/romfs/pgf/eng/129.pgf new file mode 100644 index 000000000..e66873475 Binary files /dev/null and b/assets/romfs/pgf/eng/129.pgf differ diff --git a/assets/romfs/pgf/eng/130.pgf b/assets/romfs/pgf/eng/130.pgf new file mode 100644 index 000000000..d781c6527 Binary files /dev/null and b/assets/romfs/pgf/eng/130.pgf differ diff --git a/assets/romfs/pgf/eng/131.pgf b/assets/romfs/pgf/eng/131.pgf new file mode 100644 index 000000000..c394f7971 Binary files /dev/null and b/assets/romfs/pgf/eng/131.pgf differ diff --git a/assets/romfs/pgf/eng/132.pgf b/assets/romfs/pgf/eng/132.pgf new file mode 100644 index 000000000..426af0405 Binary files /dev/null and b/assets/romfs/pgf/eng/132.pgf differ diff --git a/assets/romfs/pgf/eng/133.pgf b/assets/romfs/pgf/eng/133.pgf new file mode 100644 index 000000000..726665d72 Binary files /dev/null and b/assets/romfs/pgf/eng/133.pgf differ diff --git a/assets/romfs/pgf/eng/148.pgf b/assets/romfs/pgf/eng/148.pgf new file mode 100644 index 000000000..fcee53320 Binary files /dev/null and b/assets/romfs/pgf/eng/148.pgf differ diff --git a/assets/romfs/pgf/eng/149.pgf b/assets/romfs/pgf/eng/149.pgf new file mode 100644 index 000000000..c83f8f891 Binary files /dev/null and b/assets/romfs/pgf/eng/149.pgf differ diff --git a/assets/romfs/pgf/eng/150.pgf b/assets/romfs/pgf/eng/150.pgf new file mode 100644 index 000000000..4327ab23f Binary files /dev/null and b/assets/romfs/pgf/eng/150.pgf differ diff --git a/assets/romfs/pgf/eng/155.pgf b/assets/romfs/pgf/eng/155.pgf new file mode 100644 index 000000000..6b534ff19 Binary files /dev/null and b/assets/romfs/pgf/eng/155.pgf differ diff --git a/assets/romfs/pgf/eng/2.pgf b/assets/romfs/pgf/eng/2.pgf new file mode 100644 index 000000000..fb521e6ef Binary files /dev/null and b/assets/romfs/pgf/eng/2.pgf differ diff --git a/assets/romfs/pgf/eng/28.pgf b/assets/romfs/pgf/eng/28.pgf new file mode 100644 index 000000000..d91713cf6 Binary files /dev/null and b/assets/romfs/pgf/eng/28.pgf differ diff --git a/assets/romfs/pgf/eng/29.pgf b/assets/romfs/pgf/eng/29.pgf new file mode 100644 index 000000000..61fe59257 Binary files /dev/null and b/assets/romfs/pgf/eng/29.pgf differ diff --git a/assets/romfs/pgf/eng/3.pgf b/assets/romfs/pgf/eng/3.pgf new file mode 100644 index 000000000..0fe635c9e Binary files /dev/null and b/assets/romfs/pgf/eng/3.pgf differ diff --git a/assets/romfs/pgf/eng/30.pgf b/assets/romfs/pgf/eng/30.pgf new file mode 100644 index 000000000..d98d62489 Binary files /dev/null and b/assets/romfs/pgf/eng/30.pgf differ diff --git a/assets/romfs/pgf/eng/32.pgf b/assets/romfs/pgf/eng/32.pgf new file mode 100644 index 000000000..98a2eea2f Binary files /dev/null and b/assets/romfs/pgf/eng/32.pgf differ diff --git a/assets/romfs/pgf/eng/33.pgf b/assets/romfs/pgf/eng/33.pgf new file mode 100644 index 000000000..66470768d Binary files /dev/null and b/assets/romfs/pgf/eng/33.pgf differ diff --git a/assets/romfs/pgf/eng/37.pgf b/assets/romfs/pgf/eng/37.pgf new file mode 100644 index 000000000..d525b0b4c Binary files /dev/null and b/assets/romfs/pgf/eng/37.pgf differ diff --git a/assets/romfs/pgf/eng/48.pgf b/assets/romfs/pgf/eng/48.pgf new file mode 100644 index 000000000..6b8f0ecfb Binary files /dev/null and b/assets/romfs/pgf/eng/48.pgf differ diff --git a/assets/romfs/pgf/eng/61.pgf b/assets/romfs/pgf/eng/61.pgf new file mode 100644 index 000000000..e36becb47 Binary files /dev/null and b/assets/romfs/pgf/eng/61.pgf differ diff --git a/assets/romfs/pgf/eng/69.pgf b/assets/romfs/pgf/eng/69.pgf new file mode 100644 index 000000000..ec5b8b7f0 Binary files /dev/null and b/assets/romfs/pgf/eng/69.pgf differ diff --git a/assets/romfs/pgf/eng/71.pgf b/assets/romfs/pgf/eng/71.pgf new file mode 100644 index 000000000..27a7c4416 Binary files /dev/null and b/assets/romfs/pgf/eng/71.pgf differ diff --git a/assets/romfs/pgf/eng/96.pgf b/assets/romfs/pgf/eng/96.pgf new file mode 100644 index 000000000..7a53ad9ee Binary files /dev/null and b/assets/romfs/pgf/eng/96.pgf differ diff --git a/assets/romfs/pgf/eng/99.pgf b/assets/romfs/pgf/eng/99.pgf new file mode 100644 index 000000000..f98b6d102 Binary files /dev/null and b/assets/romfs/pgf/eng/99.pgf differ diff --git a/assets/romfs/pgf/fre/128.pgf b/assets/romfs/pgf/fre/128.pgf new file mode 100644 index 000000000..a882f774f Binary files /dev/null and b/assets/romfs/pgf/fre/128.pgf differ diff --git a/assets/romfs/pgf/fre/129.pgf b/assets/romfs/pgf/fre/129.pgf new file mode 100644 index 000000000..07d2d2d08 Binary files /dev/null and b/assets/romfs/pgf/fre/129.pgf differ diff --git a/assets/romfs/pgf/fre/132.pgf b/assets/romfs/pgf/fre/132.pgf new file mode 100644 index 000000000..477f599f5 Binary files /dev/null and b/assets/romfs/pgf/fre/132.pgf differ diff --git a/assets/romfs/pgf/fre/133.pgf b/assets/romfs/pgf/fre/133.pgf new file mode 100644 index 000000000..243ceaeef Binary files /dev/null and b/assets/romfs/pgf/fre/133.pgf differ diff --git a/assets/romfs/pgf/fre/148.pgf b/assets/romfs/pgf/fre/148.pgf new file mode 100644 index 000000000..618114392 Binary files /dev/null and b/assets/romfs/pgf/fre/148.pgf differ diff --git a/assets/romfs/pgf/fre/149.pgf b/assets/romfs/pgf/fre/149.pgf new file mode 100644 index 000000000..394f911fd Binary files /dev/null and b/assets/romfs/pgf/fre/149.pgf differ diff --git a/assets/romfs/pgf/fre/150.pgf b/assets/romfs/pgf/fre/150.pgf new file mode 100644 index 000000000..bf1ad2dbf Binary files /dev/null and b/assets/romfs/pgf/fre/150.pgf differ diff --git a/assets/romfs/pgf/fre/155.pgf b/assets/romfs/pgf/fre/155.pgf new file mode 100644 index 000000000..ebbea547f Binary files /dev/null and b/assets/romfs/pgf/fre/155.pgf differ diff --git a/assets/romfs/pgf/fre/2.pgf b/assets/romfs/pgf/fre/2.pgf new file mode 100644 index 000000000..56465621a Binary files /dev/null and b/assets/romfs/pgf/fre/2.pgf differ diff --git a/assets/romfs/pgf/fre/28.pgf b/assets/romfs/pgf/fre/28.pgf new file mode 100644 index 000000000..6fcc5531d Binary files /dev/null and b/assets/romfs/pgf/fre/28.pgf differ diff --git a/assets/romfs/pgf/fre/3.pgf b/assets/romfs/pgf/fre/3.pgf new file mode 100644 index 000000000..028a3ca71 Binary files /dev/null and b/assets/romfs/pgf/fre/3.pgf differ diff --git a/assets/romfs/pgf/fre/30.pgf b/assets/romfs/pgf/fre/30.pgf new file mode 100644 index 000000000..ac973d495 Binary files /dev/null and b/assets/romfs/pgf/fre/30.pgf differ diff --git a/assets/romfs/pgf/fre/32.pgf b/assets/romfs/pgf/fre/32.pgf new file mode 100644 index 000000000..741fde487 Binary files /dev/null and b/assets/romfs/pgf/fre/32.pgf differ diff --git a/assets/romfs/pgf/fre/33.pgf b/assets/romfs/pgf/fre/33.pgf new file mode 100644 index 000000000..e3fbcfcf8 Binary files /dev/null and b/assets/romfs/pgf/fre/33.pgf differ diff --git a/assets/romfs/pgf/fre/37.pgf b/assets/romfs/pgf/fre/37.pgf new file mode 100644 index 000000000..61e819c6b Binary files /dev/null and b/assets/romfs/pgf/fre/37.pgf differ diff --git a/assets/romfs/pgf/fre/48.pgf b/assets/romfs/pgf/fre/48.pgf new file mode 100644 index 000000000..fbeb280e0 Binary files /dev/null and b/assets/romfs/pgf/fre/48.pgf differ diff --git a/assets/romfs/pgf/fre/61.pgf b/assets/romfs/pgf/fre/61.pgf new file mode 100644 index 000000000..e45397972 Binary files /dev/null and b/assets/romfs/pgf/fre/61.pgf differ diff --git a/assets/romfs/pgf/fre/69.pgf b/assets/romfs/pgf/fre/69.pgf new file mode 100644 index 000000000..cbe11987e Binary files /dev/null and b/assets/romfs/pgf/fre/69.pgf differ diff --git a/assets/romfs/pgf/fre/71.pgf b/assets/romfs/pgf/fre/71.pgf new file mode 100644 index 000000000..ca8918cfa Binary files /dev/null and b/assets/romfs/pgf/fre/71.pgf differ diff --git a/assets/romfs/pgf/fre/99.pgf b/assets/romfs/pgf/fre/99.pgf new file mode 100644 index 000000000..24f255450 Binary files /dev/null and b/assets/romfs/pgf/fre/99.pgf differ diff --git a/assets/romfs/pgf/ger/100.pgf b/assets/romfs/pgf/ger/100.pgf new file mode 100644 index 000000000..4a20e12e8 Binary files /dev/null and b/assets/romfs/pgf/ger/100.pgf differ diff --git a/assets/romfs/pgf/ger/128.pgf b/assets/romfs/pgf/ger/128.pgf new file mode 100644 index 000000000..48090987e Binary files /dev/null and b/assets/romfs/pgf/ger/128.pgf differ diff --git a/assets/romfs/pgf/ger/129.pgf b/assets/romfs/pgf/ger/129.pgf new file mode 100644 index 000000000..b4540d6d3 Binary files /dev/null and b/assets/romfs/pgf/ger/129.pgf differ diff --git a/assets/romfs/pgf/ger/132.pgf b/assets/romfs/pgf/ger/132.pgf new file mode 100644 index 000000000..77c7cc34f Binary files /dev/null and b/assets/romfs/pgf/ger/132.pgf differ diff --git a/assets/romfs/pgf/ger/133.pgf b/assets/romfs/pgf/ger/133.pgf new file mode 100644 index 000000000..8f52e1076 Binary files /dev/null and b/assets/romfs/pgf/ger/133.pgf differ diff --git a/assets/romfs/pgf/ger/148.pgf b/assets/romfs/pgf/ger/148.pgf new file mode 100644 index 000000000..331fd7608 Binary files /dev/null and b/assets/romfs/pgf/ger/148.pgf differ diff --git a/assets/romfs/pgf/ger/149.pgf b/assets/romfs/pgf/ger/149.pgf new file mode 100644 index 000000000..7c6cf4e4a Binary files /dev/null and b/assets/romfs/pgf/ger/149.pgf differ diff --git a/assets/romfs/pgf/ger/150.pgf b/assets/romfs/pgf/ger/150.pgf new file mode 100644 index 000000000..d70765e0d Binary files /dev/null and b/assets/romfs/pgf/ger/150.pgf differ diff --git a/assets/romfs/pgf/ger/155.pgf b/assets/romfs/pgf/ger/155.pgf new file mode 100644 index 000000000..1c0495142 Binary files /dev/null and b/assets/romfs/pgf/ger/155.pgf differ diff --git a/assets/romfs/pgf/ger/2.pgf b/assets/romfs/pgf/ger/2.pgf new file mode 100644 index 000000000..70204a1e7 Binary files /dev/null and b/assets/romfs/pgf/ger/2.pgf differ diff --git a/assets/romfs/pgf/ger/28.pgf b/assets/romfs/pgf/ger/28.pgf new file mode 100644 index 000000000..badfcc2e9 Binary files /dev/null and b/assets/romfs/pgf/ger/28.pgf differ diff --git a/assets/romfs/pgf/ger/3.pgf b/assets/romfs/pgf/ger/3.pgf new file mode 100644 index 000000000..3bc899631 Binary files /dev/null and b/assets/romfs/pgf/ger/3.pgf differ diff --git a/assets/romfs/pgf/ger/30.pgf b/assets/romfs/pgf/ger/30.pgf new file mode 100644 index 000000000..02a1cc5f7 Binary files /dev/null and b/assets/romfs/pgf/ger/30.pgf differ diff --git a/assets/romfs/pgf/ger/32.pgf b/assets/romfs/pgf/ger/32.pgf new file mode 100644 index 000000000..d6ffbfa1a Binary files /dev/null and b/assets/romfs/pgf/ger/32.pgf differ diff --git a/assets/romfs/pgf/ger/33.pgf b/assets/romfs/pgf/ger/33.pgf new file mode 100644 index 000000000..5c8ddacbb Binary files /dev/null and b/assets/romfs/pgf/ger/33.pgf differ diff --git a/assets/romfs/pgf/ger/37.pgf b/assets/romfs/pgf/ger/37.pgf new file mode 100644 index 000000000..c82566ea9 Binary files /dev/null and b/assets/romfs/pgf/ger/37.pgf differ diff --git a/assets/romfs/pgf/ger/48.pgf b/assets/romfs/pgf/ger/48.pgf new file mode 100644 index 000000000..a348816c9 Binary files /dev/null and b/assets/romfs/pgf/ger/48.pgf differ diff --git a/assets/romfs/pgf/ger/61.pgf b/assets/romfs/pgf/ger/61.pgf new file mode 100644 index 000000000..bd856cb3e Binary files /dev/null and b/assets/romfs/pgf/ger/61.pgf differ diff --git a/assets/romfs/pgf/ger/69.pgf b/assets/romfs/pgf/ger/69.pgf new file mode 100644 index 000000000..0dcd0f359 Binary files /dev/null and b/assets/romfs/pgf/ger/69.pgf differ diff --git a/assets/romfs/pgf/ger/71.pgf b/assets/romfs/pgf/ger/71.pgf new file mode 100644 index 000000000..b0a33b132 Binary files /dev/null and b/assets/romfs/pgf/ger/71.pgf differ diff --git a/assets/romfs/pgf/ger/99.pgf b/assets/romfs/pgf/ger/99.pgf new file mode 100644 index 000000000..dc6ef07ba Binary files /dev/null and b/assets/romfs/pgf/ger/99.pgf differ diff --git a/assets/romfs/pgf/ita/120.pgf b/assets/romfs/pgf/ita/120.pgf new file mode 100644 index 000000000..77f973f34 Binary files /dev/null and b/assets/romfs/pgf/ita/120.pgf differ diff --git a/assets/romfs/pgf/ita/128.pgf b/assets/romfs/pgf/ita/128.pgf new file mode 100644 index 000000000..965aefabd Binary files /dev/null and b/assets/romfs/pgf/ita/128.pgf differ diff --git a/assets/romfs/pgf/ita/129.pgf b/assets/romfs/pgf/ita/129.pgf new file mode 100644 index 000000000..5d3f1dc28 Binary files /dev/null and b/assets/romfs/pgf/ita/129.pgf differ diff --git a/assets/romfs/pgf/ita/132.pgf b/assets/romfs/pgf/ita/132.pgf new file mode 100644 index 000000000..8056ede0b Binary files /dev/null and b/assets/romfs/pgf/ita/132.pgf differ diff --git a/assets/romfs/pgf/ita/133.pgf b/assets/romfs/pgf/ita/133.pgf new file mode 100644 index 000000000..a0659d766 Binary files /dev/null and b/assets/romfs/pgf/ita/133.pgf differ diff --git a/assets/romfs/pgf/ita/148.pgf b/assets/romfs/pgf/ita/148.pgf new file mode 100644 index 000000000..421ffdc4a Binary files /dev/null and b/assets/romfs/pgf/ita/148.pgf differ diff --git a/assets/romfs/pgf/ita/149.pgf b/assets/romfs/pgf/ita/149.pgf new file mode 100644 index 000000000..a73febfa3 Binary files /dev/null and b/assets/romfs/pgf/ita/149.pgf differ diff --git a/assets/romfs/pgf/ita/150.pgf b/assets/romfs/pgf/ita/150.pgf new file mode 100644 index 000000000..93a3d73a6 Binary files /dev/null and b/assets/romfs/pgf/ita/150.pgf differ diff --git a/assets/romfs/pgf/ita/155.pgf b/assets/romfs/pgf/ita/155.pgf new file mode 100644 index 000000000..ce64a51a6 Binary files /dev/null and b/assets/romfs/pgf/ita/155.pgf differ diff --git a/assets/romfs/pgf/ita/2.pgf b/assets/romfs/pgf/ita/2.pgf new file mode 100644 index 000000000..eb70c238a Binary files /dev/null and b/assets/romfs/pgf/ita/2.pgf differ diff --git a/assets/romfs/pgf/ita/28.pgf b/assets/romfs/pgf/ita/28.pgf new file mode 100644 index 000000000..5a0f298ae Binary files /dev/null and b/assets/romfs/pgf/ita/28.pgf differ diff --git a/assets/romfs/pgf/ita/3.pgf b/assets/romfs/pgf/ita/3.pgf new file mode 100644 index 000000000..c6c8eecb0 Binary files /dev/null and b/assets/romfs/pgf/ita/3.pgf differ diff --git a/assets/romfs/pgf/ita/30.pgf b/assets/romfs/pgf/ita/30.pgf new file mode 100644 index 000000000..b03174674 Binary files /dev/null and b/assets/romfs/pgf/ita/30.pgf differ diff --git a/assets/romfs/pgf/ita/32.pgf b/assets/romfs/pgf/ita/32.pgf new file mode 100644 index 000000000..c31d05536 Binary files /dev/null and b/assets/romfs/pgf/ita/32.pgf differ diff --git a/assets/romfs/pgf/ita/33.pgf b/assets/romfs/pgf/ita/33.pgf new file mode 100644 index 000000000..fa767930c Binary files /dev/null and b/assets/romfs/pgf/ita/33.pgf differ diff --git a/assets/romfs/pgf/ita/37.pgf b/assets/romfs/pgf/ita/37.pgf new file mode 100644 index 000000000..157de2081 Binary files /dev/null and b/assets/romfs/pgf/ita/37.pgf differ diff --git a/assets/romfs/pgf/ita/48.pgf b/assets/romfs/pgf/ita/48.pgf new file mode 100644 index 000000000..f59c17829 Binary files /dev/null and b/assets/romfs/pgf/ita/48.pgf differ diff --git a/assets/romfs/pgf/ita/61.pgf b/assets/romfs/pgf/ita/61.pgf new file mode 100644 index 000000000..b5e15327c Binary files /dev/null and b/assets/romfs/pgf/ita/61.pgf differ diff --git a/assets/romfs/pgf/ita/69.pgf b/assets/romfs/pgf/ita/69.pgf new file mode 100644 index 000000000..525a6977c Binary files /dev/null and b/assets/romfs/pgf/ita/69.pgf differ diff --git a/assets/romfs/pgf/ita/71.pgf b/assets/romfs/pgf/ita/71.pgf new file mode 100644 index 000000000..f1e8a3032 Binary files /dev/null and b/assets/romfs/pgf/ita/71.pgf differ diff --git a/assets/romfs/pgf/ita/99.pgf b/assets/romfs/pgf/ita/99.pgf new file mode 100644 index 000000000..e9c044f75 Binary files /dev/null and b/assets/romfs/pgf/ita/99.pgf differ diff --git a/assets/romfs/pgf/jpn/1.pgf b/assets/romfs/pgf/jpn/1.pgf new file mode 100644 index 000000000..a90e2bce5 Binary files /dev/null and b/assets/romfs/pgf/jpn/1.pgf differ diff --git a/assets/romfs/pgf/jpn/10.pgf b/assets/romfs/pgf/jpn/10.pgf new file mode 100644 index 000000000..4735eb8ed Binary files /dev/null and b/assets/romfs/pgf/jpn/10.pgf differ diff --git a/assets/romfs/pgf/jpn/101.pgf b/assets/romfs/pgf/jpn/101.pgf new file mode 100644 index 000000000..94ff9a8a8 Binary files /dev/null and b/assets/romfs/pgf/jpn/101.pgf differ diff --git a/assets/romfs/pgf/jpn/102.pgf b/assets/romfs/pgf/jpn/102.pgf new file mode 100644 index 000000000..8ba58b6ad Binary files /dev/null and b/assets/romfs/pgf/jpn/102.pgf differ diff --git a/assets/romfs/pgf/jpn/103.pgf b/assets/romfs/pgf/jpn/103.pgf new file mode 100644 index 000000000..16b8429e6 Binary files /dev/null and b/assets/romfs/pgf/jpn/103.pgf differ diff --git a/assets/romfs/pgf/jpn/104.pgf b/assets/romfs/pgf/jpn/104.pgf new file mode 100644 index 000000000..8c8ec0499 Binary files /dev/null and b/assets/romfs/pgf/jpn/104.pgf differ diff --git a/assets/romfs/pgf/jpn/11.pgf b/assets/romfs/pgf/jpn/11.pgf new file mode 100644 index 000000000..f62be111e Binary files /dev/null and b/assets/romfs/pgf/jpn/11.pgf differ diff --git a/assets/romfs/pgf/jpn/111.pgf b/assets/romfs/pgf/jpn/111.pgf new file mode 100644 index 000000000..b794a1e5b Binary files /dev/null and b/assets/romfs/pgf/jpn/111.pgf differ diff --git a/assets/romfs/pgf/jpn/112.pgf b/assets/romfs/pgf/jpn/112.pgf new file mode 100644 index 000000000..42eca9668 Binary files /dev/null and b/assets/romfs/pgf/jpn/112.pgf differ diff --git a/assets/romfs/pgf/jpn/113.pgf b/assets/romfs/pgf/jpn/113.pgf new file mode 100644 index 000000000..c2e7a8e04 Binary files /dev/null and b/assets/romfs/pgf/jpn/113.pgf differ diff --git a/assets/romfs/pgf/jpn/114.pgf b/assets/romfs/pgf/jpn/114.pgf new file mode 100644 index 000000000..75b5c7326 Binary files /dev/null and b/assets/romfs/pgf/jpn/114.pgf differ diff --git a/assets/romfs/pgf/jpn/115.pgf b/assets/romfs/pgf/jpn/115.pgf new file mode 100644 index 000000000..021878ecf Binary files /dev/null and b/assets/romfs/pgf/jpn/115.pgf differ diff --git a/assets/romfs/pgf/jpn/118.pgf b/assets/romfs/pgf/jpn/118.pgf new file mode 100644 index 000000000..690c93ec8 Binary files /dev/null and b/assets/romfs/pgf/jpn/118.pgf differ diff --git a/assets/romfs/pgf/jpn/119.pgf b/assets/romfs/pgf/jpn/119.pgf new file mode 100644 index 000000000..5b26edbed Binary files /dev/null and b/assets/romfs/pgf/jpn/119.pgf differ diff --git a/assets/romfs/pgf/jpn/120.pgf b/assets/romfs/pgf/jpn/120.pgf new file mode 100644 index 000000000..147ea45ce Binary files /dev/null and b/assets/romfs/pgf/jpn/120.pgf differ diff --git a/assets/romfs/pgf/jpn/124.pgf b/assets/romfs/pgf/jpn/124.pgf new file mode 100644 index 000000000..0742a783f Binary files /dev/null and b/assets/romfs/pgf/jpn/124.pgf differ diff --git a/assets/romfs/pgf/jpn/125.pgf b/assets/romfs/pgf/jpn/125.pgf new file mode 100644 index 000000000..a853db45e Binary files /dev/null and b/assets/romfs/pgf/jpn/125.pgf differ diff --git a/assets/romfs/pgf/jpn/126.pgf b/assets/romfs/pgf/jpn/126.pgf new file mode 100644 index 000000000..b3cdadaf6 Binary files /dev/null and b/assets/romfs/pgf/jpn/126.pgf differ diff --git a/assets/romfs/pgf/jpn/127.pgf b/assets/romfs/pgf/jpn/127.pgf new file mode 100644 index 000000000..fad4b7295 Binary files /dev/null and b/assets/romfs/pgf/jpn/127.pgf differ diff --git a/assets/romfs/pgf/jpn/133.pgf b/assets/romfs/pgf/jpn/133.pgf new file mode 100644 index 000000000..f3c0cc00f Binary files /dev/null and b/assets/romfs/pgf/jpn/133.pgf differ diff --git a/assets/romfs/pgf/jpn/134.pgf b/assets/romfs/pgf/jpn/134.pgf new file mode 100644 index 000000000..4811b1746 Binary files /dev/null and b/assets/romfs/pgf/jpn/134.pgf differ diff --git a/assets/romfs/pgf/jpn/135.pgf b/assets/romfs/pgf/jpn/135.pgf new file mode 100644 index 000000000..693982128 Binary files /dev/null and b/assets/romfs/pgf/jpn/135.pgf differ diff --git a/assets/romfs/pgf/jpn/136.pgf b/assets/romfs/pgf/jpn/136.pgf new file mode 100644 index 000000000..41b32aa2a Binary files /dev/null and b/assets/romfs/pgf/jpn/136.pgf differ diff --git a/assets/romfs/pgf/jpn/137.pgf b/assets/romfs/pgf/jpn/137.pgf new file mode 100644 index 000000000..3e73d9464 Binary files /dev/null and b/assets/romfs/pgf/jpn/137.pgf differ diff --git a/assets/romfs/pgf/jpn/138.pgf b/assets/romfs/pgf/jpn/138.pgf new file mode 100644 index 000000000..78855bdea Binary files /dev/null and b/assets/romfs/pgf/jpn/138.pgf differ diff --git a/assets/romfs/pgf/jpn/139.pgf b/assets/romfs/pgf/jpn/139.pgf new file mode 100644 index 000000000..79142ca42 Binary files /dev/null and b/assets/romfs/pgf/jpn/139.pgf differ diff --git a/assets/romfs/pgf/jpn/140.pgf b/assets/romfs/pgf/jpn/140.pgf new file mode 100644 index 000000000..561bfd616 Binary files /dev/null and b/assets/romfs/pgf/jpn/140.pgf differ diff --git a/assets/romfs/pgf/jpn/141.pgf b/assets/romfs/pgf/jpn/141.pgf new file mode 100644 index 000000000..7e7e09900 Binary files /dev/null and b/assets/romfs/pgf/jpn/141.pgf differ diff --git a/assets/romfs/pgf/jpn/142.pgf b/assets/romfs/pgf/jpn/142.pgf new file mode 100644 index 000000000..9895a7e3c Binary files /dev/null and b/assets/romfs/pgf/jpn/142.pgf differ diff --git a/assets/romfs/pgf/jpn/143.pgf b/assets/romfs/pgf/jpn/143.pgf new file mode 100644 index 000000000..53fc69f77 Binary files /dev/null and b/assets/romfs/pgf/jpn/143.pgf differ diff --git a/assets/romfs/pgf/jpn/144.pgf b/assets/romfs/pgf/jpn/144.pgf new file mode 100644 index 000000000..5cc0478ca Binary files /dev/null and b/assets/romfs/pgf/jpn/144.pgf differ diff --git a/assets/romfs/pgf/jpn/145.pgf b/assets/romfs/pgf/jpn/145.pgf new file mode 100644 index 000000000..cd32cc5de Binary files /dev/null and b/assets/romfs/pgf/jpn/145.pgf differ diff --git a/assets/romfs/pgf/jpn/147.pgf b/assets/romfs/pgf/jpn/147.pgf new file mode 100644 index 000000000..49694245b Binary files /dev/null and b/assets/romfs/pgf/jpn/147.pgf differ diff --git a/assets/romfs/pgf/jpn/151.pgf b/assets/romfs/pgf/jpn/151.pgf new file mode 100644 index 000000000..a4ff1ef8f Binary files /dev/null and b/assets/romfs/pgf/jpn/151.pgf differ diff --git a/assets/romfs/pgf/jpn/152.pgf b/assets/romfs/pgf/jpn/152.pgf new file mode 100644 index 000000000..832c23fdd Binary files /dev/null and b/assets/romfs/pgf/jpn/152.pgf differ diff --git a/assets/romfs/pgf/jpn/156.pgf b/assets/romfs/pgf/jpn/156.pgf new file mode 100644 index 000000000..a31a7de09 Binary files /dev/null and b/assets/romfs/pgf/jpn/156.pgf differ diff --git a/assets/romfs/pgf/jpn/157.pgf b/assets/romfs/pgf/jpn/157.pgf new file mode 100644 index 000000000..b248a61ba Binary files /dev/null and b/assets/romfs/pgf/jpn/157.pgf differ diff --git a/assets/romfs/pgf/jpn/158.pgf b/assets/romfs/pgf/jpn/158.pgf new file mode 100644 index 000000000..fa751a18d Binary files /dev/null and b/assets/romfs/pgf/jpn/158.pgf differ diff --git a/assets/romfs/pgf/jpn/159.pgf b/assets/romfs/pgf/jpn/159.pgf new file mode 100644 index 000000000..b2924feea Binary files /dev/null and b/assets/romfs/pgf/jpn/159.pgf differ diff --git a/assets/romfs/pgf/jpn/160.pgf b/assets/romfs/pgf/jpn/160.pgf new file mode 100644 index 000000000..9a5d3cebc Binary files /dev/null and b/assets/romfs/pgf/jpn/160.pgf differ diff --git a/assets/romfs/pgf/jpn/161.pgf b/assets/romfs/pgf/jpn/161.pgf new file mode 100644 index 000000000..354e0f3a6 Binary files /dev/null and b/assets/romfs/pgf/jpn/161.pgf differ diff --git a/assets/romfs/pgf/jpn/165.pgf b/assets/romfs/pgf/jpn/165.pgf new file mode 100644 index 000000000..e4a6c0342 Binary files /dev/null and b/assets/romfs/pgf/jpn/165.pgf differ diff --git a/assets/romfs/pgf/jpn/166.pgf b/assets/romfs/pgf/jpn/166.pgf new file mode 100644 index 000000000..7ac7b8dac Binary files /dev/null and b/assets/romfs/pgf/jpn/166.pgf differ diff --git a/assets/romfs/pgf/jpn/167.pgf b/assets/romfs/pgf/jpn/167.pgf new file mode 100644 index 000000000..24e16609e Binary files /dev/null and b/assets/romfs/pgf/jpn/167.pgf differ diff --git a/assets/romfs/pgf/jpn/28.pgf b/assets/romfs/pgf/jpn/28.pgf new file mode 100644 index 000000000..09abab495 Binary files /dev/null and b/assets/romfs/pgf/jpn/28.pgf differ diff --git a/assets/romfs/pgf/jpn/29.pgf b/assets/romfs/pgf/jpn/29.pgf new file mode 100644 index 000000000..c5dd7ea1a Binary files /dev/null and b/assets/romfs/pgf/jpn/29.pgf differ diff --git a/assets/romfs/pgf/jpn/30.pgf b/assets/romfs/pgf/jpn/30.pgf new file mode 100644 index 000000000..2b793da8d Binary files /dev/null and b/assets/romfs/pgf/jpn/30.pgf differ diff --git a/assets/romfs/pgf/jpn/31.pgf b/assets/romfs/pgf/jpn/31.pgf new file mode 100644 index 000000000..165cef033 Binary files /dev/null and b/assets/romfs/pgf/jpn/31.pgf differ diff --git a/assets/romfs/pgf/jpn/32.pgf b/assets/romfs/pgf/jpn/32.pgf new file mode 100644 index 000000000..2c4fa436f Binary files /dev/null and b/assets/romfs/pgf/jpn/32.pgf differ diff --git a/assets/romfs/pgf/jpn/33.pgf b/assets/romfs/pgf/jpn/33.pgf new file mode 100644 index 000000000..bae4f5f7a Binary files /dev/null and b/assets/romfs/pgf/jpn/33.pgf differ diff --git a/assets/romfs/pgf/jpn/34.pgf b/assets/romfs/pgf/jpn/34.pgf new file mode 100644 index 000000000..4820d2295 Binary files /dev/null and b/assets/romfs/pgf/jpn/34.pgf differ diff --git a/assets/romfs/pgf/jpn/35.pgf b/assets/romfs/pgf/jpn/35.pgf new file mode 100644 index 000000000..a232f1b2a Binary files /dev/null and b/assets/romfs/pgf/jpn/35.pgf differ diff --git a/assets/romfs/pgf/jpn/36.pgf b/assets/romfs/pgf/jpn/36.pgf new file mode 100644 index 000000000..dd6f1d1a1 Binary files /dev/null and b/assets/romfs/pgf/jpn/36.pgf differ diff --git a/assets/romfs/pgf/jpn/38.pgf b/assets/romfs/pgf/jpn/38.pgf new file mode 100644 index 000000000..4623a8417 Binary files /dev/null and b/assets/romfs/pgf/jpn/38.pgf differ diff --git a/assets/romfs/pgf/jpn/39.pgf b/assets/romfs/pgf/jpn/39.pgf new file mode 100644 index 000000000..6844c456d Binary files /dev/null and b/assets/romfs/pgf/jpn/39.pgf differ diff --git a/assets/romfs/pgf/jpn/4.pgf b/assets/romfs/pgf/jpn/4.pgf new file mode 100644 index 000000000..e3bd1f34a Binary files /dev/null and b/assets/romfs/pgf/jpn/4.pgf differ diff --git a/assets/romfs/pgf/jpn/40.pgf b/assets/romfs/pgf/jpn/40.pgf new file mode 100644 index 000000000..d8363e41e Binary files /dev/null and b/assets/romfs/pgf/jpn/40.pgf differ diff --git a/assets/romfs/pgf/jpn/41.pgf b/assets/romfs/pgf/jpn/41.pgf new file mode 100644 index 000000000..6be5799cf Binary files /dev/null and b/assets/romfs/pgf/jpn/41.pgf differ diff --git a/assets/romfs/pgf/jpn/42.pgf b/assets/romfs/pgf/jpn/42.pgf new file mode 100644 index 000000000..44bcc26a0 Binary files /dev/null and b/assets/romfs/pgf/jpn/42.pgf differ diff --git a/assets/romfs/pgf/jpn/43.pgf b/assets/romfs/pgf/jpn/43.pgf new file mode 100644 index 000000000..ffc55b9d6 Binary files /dev/null and b/assets/romfs/pgf/jpn/43.pgf differ diff --git a/assets/romfs/pgf/jpn/45.pgf b/assets/romfs/pgf/jpn/45.pgf new file mode 100644 index 000000000..871e203b4 Binary files /dev/null and b/assets/romfs/pgf/jpn/45.pgf differ diff --git a/assets/romfs/pgf/jpn/48.pgf b/assets/romfs/pgf/jpn/48.pgf new file mode 100644 index 000000000..3de13fd6a Binary files /dev/null and b/assets/romfs/pgf/jpn/48.pgf differ diff --git a/assets/romfs/pgf/jpn/49.pgf b/assets/romfs/pgf/jpn/49.pgf new file mode 100644 index 000000000..ad5664a21 Binary files /dev/null and b/assets/romfs/pgf/jpn/49.pgf differ diff --git a/assets/romfs/pgf/jpn/5.pgf b/assets/romfs/pgf/jpn/5.pgf new file mode 100644 index 000000000..e86a99c74 Binary files /dev/null and b/assets/romfs/pgf/jpn/5.pgf differ diff --git a/assets/romfs/pgf/jpn/51.pgf b/assets/romfs/pgf/jpn/51.pgf new file mode 100644 index 000000000..031ddb37d Binary files /dev/null and b/assets/romfs/pgf/jpn/51.pgf differ diff --git a/assets/romfs/pgf/jpn/52.pgf b/assets/romfs/pgf/jpn/52.pgf new file mode 100644 index 000000000..a33aa5653 Binary files /dev/null and b/assets/romfs/pgf/jpn/52.pgf differ diff --git a/assets/romfs/pgf/jpn/53.pgf b/assets/romfs/pgf/jpn/53.pgf new file mode 100644 index 000000000..4cd3b36ef Binary files /dev/null and b/assets/romfs/pgf/jpn/53.pgf differ diff --git a/assets/romfs/pgf/jpn/54.pgf b/assets/romfs/pgf/jpn/54.pgf new file mode 100644 index 000000000..88092974b Binary files /dev/null and b/assets/romfs/pgf/jpn/54.pgf differ diff --git a/assets/romfs/pgf/jpn/55.pgf b/assets/romfs/pgf/jpn/55.pgf new file mode 100644 index 000000000..c49646fe6 Binary files /dev/null and b/assets/romfs/pgf/jpn/55.pgf differ diff --git a/assets/romfs/pgf/jpn/56.pgf b/assets/romfs/pgf/jpn/56.pgf new file mode 100644 index 000000000..5fe4ec37a Binary files /dev/null and b/assets/romfs/pgf/jpn/56.pgf differ diff --git a/assets/romfs/pgf/jpn/57.pgf b/assets/romfs/pgf/jpn/57.pgf new file mode 100644 index 000000000..808270c33 Binary files /dev/null and b/assets/romfs/pgf/jpn/57.pgf differ diff --git a/assets/romfs/pgf/jpn/58.pgf b/assets/romfs/pgf/jpn/58.pgf new file mode 100644 index 000000000..2de38ffa8 Binary files /dev/null and b/assets/romfs/pgf/jpn/58.pgf differ diff --git a/assets/romfs/pgf/jpn/59.pgf b/assets/romfs/pgf/jpn/59.pgf new file mode 100644 index 000000000..ded1d52c2 Binary files /dev/null and b/assets/romfs/pgf/jpn/59.pgf differ diff --git a/assets/romfs/pgf/jpn/6.pgf b/assets/romfs/pgf/jpn/6.pgf new file mode 100644 index 000000000..4f574ff61 Binary files /dev/null and b/assets/romfs/pgf/jpn/6.pgf differ diff --git a/assets/romfs/pgf/jpn/62.pgf b/assets/romfs/pgf/jpn/62.pgf new file mode 100644 index 000000000..151e848e5 Binary files /dev/null and b/assets/romfs/pgf/jpn/62.pgf differ diff --git a/assets/romfs/pgf/jpn/63.pgf b/assets/romfs/pgf/jpn/63.pgf new file mode 100644 index 000000000..518bc166d Binary files /dev/null and b/assets/romfs/pgf/jpn/63.pgf differ diff --git a/assets/romfs/pgf/jpn/64.pgf b/assets/romfs/pgf/jpn/64.pgf new file mode 100644 index 000000000..950a1ee46 Binary files /dev/null and b/assets/romfs/pgf/jpn/64.pgf differ diff --git a/assets/romfs/pgf/jpn/65.pgf b/assets/romfs/pgf/jpn/65.pgf new file mode 100644 index 000000000..21e4b665e Binary files /dev/null and b/assets/romfs/pgf/jpn/65.pgf differ diff --git a/assets/romfs/pgf/jpn/66.pgf b/assets/romfs/pgf/jpn/66.pgf new file mode 100644 index 000000000..3a1e5a4c8 Binary files /dev/null and b/assets/romfs/pgf/jpn/66.pgf differ diff --git a/assets/romfs/pgf/jpn/67.pgf b/assets/romfs/pgf/jpn/67.pgf new file mode 100644 index 000000000..9b791ebff Binary files /dev/null and b/assets/romfs/pgf/jpn/67.pgf differ diff --git a/assets/romfs/pgf/jpn/68.pgf b/assets/romfs/pgf/jpn/68.pgf new file mode 100644 index 000000000..a25e1e20c Binary files /dev/null and b/assets/romfs/pgf/jpn/68.pgf differ diff --git a/assets/romfs/pgf/jpn/69.pgf b/assets/romfs/pgf/jpn/69.pgf new file mode 100644 index 000000000..d78743aaa Binary files /dev/null and b/assets/romfs/pgf/jpn/69.pgf differ diff --git a/assets/romfs/pgf/jpn/7.pgf b/assets/romfs/pgf/jpn/7.pgf new file mode 100644 index 000000000..b400d9607 Binary files /dev/null and b/assets/romfs/pgf/jpn/7.pgf differ diff --git a/assets/romfs/pgf/jpn/70.pgf b/assets/romfs/pgf/jpn/70.pgf new file mode 100644 index 000000000..982ce154d Binary files /dev/null and b/assets/romfs/pgf/jpn/70.pgf differ diff --git a/assets/romfs/pgf/jpn/71.pgf b/assets/romfs/pgf/jpn/71.pgf new file mode 100644 index 000000000..2ed2fc7e3 Binary files /dev/null and b/assets/romfs/pgf/jpn/71.pgf differ diff --git a/assets/romfs/pgf/jpn/73.pgf b/assets/romfs/pgf/jpn/73.pgf new file mode 100644 index 000000000..c78937a6d Binary files /dev/null and b/assets/romfs/pgf/jpn/73.pgf differ diff --git a/assets/romfs/pgf/jpn/75.pgf b/assets/romfs/pgf/jpn/75.pgf new file mode 100644 index 000000000..250980999 Binary files /dev/null and b/assets/romfs/pgf/jpn/75.pgf differ diff --git a/assets/romfs/pgf/jpn/76.pgf b/assets/romfs/pgf/jpn/76.pgf new file mode 100644 index 000000000..69ce46698 Binary files /dev/null and b/assets/romfs/pgf/jpn/76.pgf differ diff --git a/assets/romfs/pgf/jpn/78.pgf b/assets/romfs/pgf/jpn/78.pgf new file mode 100644 index 000000000..f6394ef0a Binary files /dev/null and b/assets/romfs/pgf/jpn/78.pgf differ diff --git a/assets/romfs/pgf/jpn/8.pgf b/assets/romfs/pgf/jpn/8.pgf new file mode 100644 index 000000000..bc0eb4097 Binary files /dev/null and b/assets/romfs/pgf/jpn/8.pgf differ diff --git a/assets/romfs/pgf/jpn/89.pgf b/assets/romfs/pgf/jpn/89.pgf new file mode 100644 index 000000000..d96fa00c6 Binary files /dev/null and b/assets/romfs/pgf/jpn/89.pgf differ diff --git a/assets/romfs/pgf/jpn/9.pgf b/assets/romfs/pgf/jpn/9.pgf new file mode 100644 index 000000000..f6491dd3d Binary files /dev/null and b/assets/romfs/pgf/jpn/9.pgf differ diff --git a/assets/romfs/pgf/jpn/92.pgf b/assets/romfs/pgf/jpn/92.pgf new file mode 100644 index 000000000..a1430868b Binary files /dev/null and b/assets/romfs/pgf/jpn/92.pgf differ diff --git a/assets/romfs/pgf/jpn/93.pgf b/assets/romfs/pgf/jpn/93.pgf new file mode 100644 index 000000000..59278d3f4 Binary files /dev/null and b/assets/romfs/pgf/jpn/93.pgf differ diff --git a/assets/romfs/pgf/jpn/96.pgf b/assets/romfs/pgf/jpn/96.pgf new file mode 100644 index 000000000..d6ed6bf9f Binary files /dev/null and b/assets/romfs/pgf/jpn/96.pgf differ diff --git a/assets/romfs/pgf/jpn/97.pgf b/assets/romfs/pgf/jpn/97.pgf new file mode 100644 index 000000000..64f6b6d70 Binary files /dev/null and b/assets/romfs/pgf/jpn/97.pgf differ diff --git a/assets/romfs/pgf/jpn/98.pgf b/assets/romfs/pgf/jpn/98.pgf new file mode 100644 index 000000000..44667cfb6 Binary files /dev/null and b/assets/romfs/pgf/jpn/98.pgf differ diff --git a/assets/romfs/pgf/jpn/99.pgf b/assets/romfs/pgf/jpn/99.pgf new file mode 100644 index 000000000..d7166a521 Binary files /dev/null and b/assets/romfs/pgf/jpn/99.pgf differ diff --git a/assets/romfs/pgf/kor/105.pgf b/assets/romfs/pgf/kor/105.pgf new file mode 100644 index 000000000..e862a3bca Binary files /dev/null and b/assets/romfs/pgf/kor/105.pgf differ diff --git a/assets/romfs/pgf/kor/106.pgf b/assets/romfs/pgf/kor/106.pgf new file mode 100644 index 000000000..8004283c1 Binary files /dev/null and b/assets/romfs/pgf/kor/106.pgf differ diff --git a/assets/romfs/pgf/kor/120.pgf b/assets/romfs/pgf/kor/120.pgf new file mode 100644 index 000000000..65e430c83 Binary files /dev/null and b/assets/romfs/pgf/kor/120.pgf differ diff --git a/assets/romfs/pgf/kor/121.pgf b/assets/romfs/pgf/kor/121.pgf new file mode 100644 index 000000000..fa55ab5d3 Binary files /dev/null and b/assets/romfs/pgf/kor/121.pgf differ diff --git a/assets/romfs/pgf/kor/122.pgf b/assets/romfs/pgf/kor/122.pgf new file mode 100644 index 000000000..33427e7af Binary files /dev/null and b/assets/romfs/pgf/kor/122.pgf differ diff --git a/assets/romfs/pgf/kor/123.pgf b/assets/romfs/pgf/kor/123.pgf new file mode 100644 index 000000000..f7eeb5f9a Binary files /dev/null and b/assets/romfs/pgf/kor/123.pgf differ diff --git a/assets/romfs/pgf/kor/126.pgf b/assets/romfs/pgf/kor/126.pgf new file mode 100644 index 000000000..783d3f0ff Binary files /dev/null and b/assets/romfs/pgf/kor/126.pgf differ diff --git a/assets/romfs/pgf/kor/148.pgf b/assets/romfs/pgf/kor/148.pgf new file mode 100644 index 000000000..d05c3c9dc Binary files /dev/null and b/assets/romfs/pgf/kor/148.pgf differ diff --git a/assets/romfs/pgf/kor/149.pgf b/assets/romfs/pgf/kor/149.pgf new file mode 100644 index 000000000..b84319191 Binary files /dev/null and b/assets/romfs/pgf/kor/149.pgf differ diff --git a/assets/romfs/pgf/kor/150.pgf b/assets/romfs/pgf/kor/150.pgf new file mode 100644 index 000000000..ee87108f8 Binary files /dev/null and b/assets/romfs/pgf/kor/150.pgf differ diff --git a/assets/romfs/pgf/kor/153.pgf b/assets/romfs/pgf/kor/153.pgf new file mode 100644 index 000000000..ee6acea9b Binary files /dev/null and b/assets/romfs/pgf/kor/153.pgf differ diff --git a/assets/romfs/pgf/kor/154.pgf b/assets/romfs/pgf/kor/154.pgf new file mode 100644 index 000000000..355113787 Binary files /dev/null and b/assets/romfs/pgf/kor/154.pgf differ diff --git a/assets/romfs/pgf/kor/162.pgf b/assets/romfs/pgf/kor/162.pgf new file mode 100644 index 000000000..10414512f Binary files /dev/null and b/assets/romfs/pgf/kor/162.pgf differ diff --git a/assets/romfs/pgf/kor/163.pgf b/assets/romfs/pgf/kor/163.pgf new file mode 100644 index 000000000..e8280adc3 Binary files /dev/null and b/assets/romfs/pgf/kor/163.pgf differ diff --git a/assets/romfs/pgf/kor/164.pgf b/assets/romfs/pgf/kor/164.pgf new file mode 100644 index 000000000..97b22351e Binary files /dev/null and b/assets/romfs/pgf/kor/164.pgf differ diff --git a/assets/romfs/pgf/kor/28.pgf b/assets/romfs/pgf/kor/28.pgf new file mode 100644 index 000000000..9e582ef18 Binary files /dev/null and b/assets/romfs/pgf/kor/28.pgf differ diff --git a/assets/romfs/pgf/kor/29.pgf b/assets/romfs/pgf/kor/29.pgf new file mode 100644 index 000000000..0ffdeebfd Binary files /dev/null and b/assets/romfs/pgf/kor/29.pgf differ diff --git a/assets/romfs/pgf/kor/30.pgf b/assets/romfs/pgf/kor/30.pgf new file mode 100644 index 000000000..ef9fa4fbe Binary files /dev/null and b/assets/romfs/pgf/kor/30.pgf differ diff --git a/assets/romfs/pgf/kor/31.pgf b/assets/romfs/pgf/kor/31.pgf new file mode 100644 index 000000000..aac7f025e Binary files /dev/null and b/assets/romfs/pgf/kor/31.pgf differ diff --git a/assets/romfs/pgf/kor/32.pgf b/assets/romfs/pgf/kor/32.pgf new file mode 100644 index 000000000..fca296012 Binary files /dev/null and b/assets/romfs/pgf/kor/32.pgf differ diff --git a/assets/romfs/pgf/kor/33.pgf b/assets/romfs/pgf/kor/33.pgf new file mode 100644 index 000000000..7055651a5 Binary files /dev/null and b/assets/romfs/pgf/kor/33.pgf differ diff --git a/assets/romfs/pgf/kor/35.pgf b/assets/romfs/pgf/kor/35.pgf new file mode 100644 index 000000000..c5fa02a7e Binary files /dev/null and b/assets/romfs/pgf/kor/35.pgf differ diff --git a/assets/romfs/pgf/kor/48.pgf b/assets/romfs/pgf/kor/48.pgf new file mode 100644 index 000000000..105f20d18 Binary files /dev/null and b/assets/romfs/pgf/kor/48.pgf differ diff --git a/assets/romfs/pgf/kor/51.pgf b/assets/romfs/pgf/kor/51.pgf new file mode 100644 index 000000000..53d4920f8 Binary files /dev/null and b/assets/romfs/pgf/kor/51.pgf differ diff --git a/assets/romfs/pgf/kor/54.pgf b/assets/romfs/pgf/kor/54.pgf new file mode 100644 index 000000000..b7d540732 Binary files /dev/null and b/assets/romfs/pgf/kor/54.pgf differ diff --git a/assets/romfs/pgf/kor/55.pgf b/assets/romfs/pgf/kor/55.pgf new file mode 100644 index 000000000..29890c3ef Binary files /dev/null and b/assets/romfs/pgf/kor/55.pgf differ diff --git a/assets/romfs/pgf/kor/56.pgf b/assets/romfs/pgf/kor/56.pgf new file mode 100644 index 000000000..725cfa26b Binary files /dev/null and b/assets/romfs/pgf/kor/56.pgf differ diff --git a/assets/romfs/pgf/kor/57.pgf b/assets/romfs/pgf/kor/57.pgf new file mode 100644 index 000000000..dc75a69fc Binary files /dev/null and b/assets/romfs/pgf/kor/57.pgf differ diff --git a/assets/romfs/pgf/kor/69.pgf b/assets/romfs/pgf/kor/69.pgf new file mode 100644 index 000000000..fdffbaf96 Binary files /dev/null and b/assets/romfs/pgf/kor/69.pgf differ diff --git a/assets/romfs/pgf/kor/70.pgf b/assets/romfs/pgf/kor/70.pgf new file mode 100644 index 000000000..afe751a09 Binary files /dev/null and b/assets/romfs/pgf/kor/70.pgf differ diff --git a/assets/romfs/pgf/kor/71.pgf b/assets/romfs/pgf/kor/71.pgf new file mode 100644 index 000000000..9f19fd12d Binary files /dev/null and b/assets/romfs/pgf/kor/71.pgf differ diff --git a/assets/romfs/pgf/kor/94.pgf b/assets/romfs/pgf/kor/94.pgf new file mode 100644 index 000000000..6a4dfe768 Binary files /dev/null and b/assets/romfs/pgf/kor/94.pgf differ diff --git a/assets/romfs/pgf/kor/97.pgf b/assets/romfs/pgf/kor/97.pgf new file mode 100644 index 000000000..300e0aebd Binary files /dev/null and b/assets/romfs/pgf/kor/97.pgf differ diff --git a/assets/romfs/pgf/kor/99.pgf b/assets/romfs/pgf/kor/99.pgf new file mode 100644 index 000000000..0b9bb024b Binary files /dev/null and b/assets/romfs/pgf/kor/99.pgf differ diff --git a/assets/romfs/pgf/spa/128.pgf b/assets/romfs/pgf/spa/128.pgf new file mode 100644 index 000000000..a0a6260a2 Binary files /dev/null and b/assets/romfs/pgf/spa/128.pgf differ diff --git a/assets/romfs/pgf/spa/129.pgf b/assets/romfs/pgf/spa/129.pgf new file mode 100644 index 000000000..dbde444cb Binary files /dev/null and b/assets/romfs/pgf/spa/129.pgf differ diff --git a/assets/romfs/pgf/spa/132.pgf b/assets/romfs/pgf/spa/132.pgf new file mode 100644 index 000000000..139fa175a Binary files /dev/null and b/assets/romfs/pgf/spa/132.pgf differ diff --git a/assets/romfs/pgf/spa/133.pgf b/assets/romfs/pgf/spa/133.pgf new file mode 100644 index 000000000..75ced360a Binary files /dev/null and b/assets/romfs/pgf/spa/133.pgf differ diff --git a/assets/romfs/pgf/spa/148.pgf b/assets/romfs/pgf/spa/148.pgf new file mode 100644 index 000000000..2d6dde9e3 Binary files /dev/null and b/assets/romfs/pgf/spa/148.pgf differ diff --git a/assets/romfs/pgf/spa/149.pgf b/assets/romfs/pgf/spa/149.pgf new file mode 100644 index 000000000..029470bbf Binary files /dev/null and b/assets/romfs/pgf/spa/149.pgf differ diff --git a/assets/romfs/pgf/spa/150.pgf b/assets/romfs/pgf/spa/150.pgf new file mode 100644 index 000000000..1957e2ab6 Binary files /dev/null and b/assets/romfs/pgf/spa/150.pgf differ diff --git a/assets/romfs/pgf/spa/155.pgf b/assets/romfs/pgf/spa/155.pgf new file mode 100644 index 000000000..15cf17965 Binary files /dev/null and b/assets/romfs/pgf/spa/155.pgf differ diff --git a/assets/romfs/pgf/spa/2.pgf b/assets/romfs/pgf/spa/2.pgf new file mode 100644 index 000000000..f7b5af344 Binary files /dev/null and b/assets/romfs/pgf/spa/2.pgf differ diff --git a/assets/romfs/pgf/spa/28.pgf b/assets/romfs/pgf/spa/28.pgf new file mode 100644 index 000000000..b5d81a6b0 Binary files /dev/null and b/assets/romfs/pgf/spa/28.pgf differ diff --git a/assets/romfs/pgf/spa/3.pgf b/assets/romfs/pgf/spa/3.pgf new file mode 100644 index 000000000..b74fa095a Binary files /dev/null and b/assets/romfs/pgf/spa/3.pgf differ diff --git a/assets/romfs/pgf/spa/30.pgf b/assets/romfs/pgf/spa/30.pgf new file mode 100644 index 000000000..9ee69914d Binary files /dev/null and b/assets/romfs/pgf/spa/30.pgf differ diff --git a/assets/romfs/pgf/spa/32.pgf b/assets/romfs/pgf/spa/32.pgf new file mode 100644 index 000000000..1a13bd6cf Binary files /dev/null and b/assets/romfs/pgf/spa/32.pgf differ diff --git a/assets/romfs/pgf/spa/33.pgf b/assets/romfs/pgf/spa/33.pgf new file mode 100644 index 000000000..cf5d112df Binary files /dev/null and b/assets/romfs/pgf/spa/33.pgf differ diff --git a/assets/romfs/pgf/spa/37.pgf b/assets/romfs/pgf/spa/37.pgf new file mode 100644 index 000000000..d690d8f76 Binary files /dev/null and b/assets/romfs/pgf/spa/37.pgf differ diff --git a/assets/romfs/pgf/spa/48.pgf b/assets/romfs/pgf/spa/48.pgf new file mode 100644 index 000000000..05ec9a3ad Binary files /dev/null and b/assets/romfs/pgf/spa/48.pgf differ diff --git a/assets/romfs/pgf/spa/61.pgf b/assets/romfs/pgf/spa/61.pgf new file mode 100644 index 000000000..63a818df6 Binary files /dev/null and b/assets/romfs/pgf/spa/61.pgf differ diff --git a/assets/romfs/pgf/spa/69.pgf b/assets/romfs/pgf/spa/69.pgf new file mode 100644 index 000000000..d4faf9b29 Binary files /dev/null and b/assets/romfs/pgf/spa/69.pgf differ diff --git a/assets/romfs/pgf/spa/71.pgf b/assets/romfs/pgf/spa/71.pgf new file mode 100644 index 000000000..1c299b59a Binary files /dev/null and b/assets/romfs/pgf/spa/71.pgf differ diff --git a/assets/romfs/pgf/spa/99.pgf b/assets/romfs/pgf/spa/99.pgf new file mode 100644 index 000000000..da7315e64 Binary files /dev/null and b/assets/romfs/pgf/spa/99.pgf differ diff --git a/assets/romfs/pgt/eng/1.pgt b/assets/romfs/pgt/eng/1.pgt new file mode 100644 index 000000000..999c5c33c Binary files /dev/null and b/assets/romfs/pgt/eng/1.pgt differ diff --git a/assets/romfs/pgt/eng/12.pgt b/assets/romfs/pgt/eng/12.pgt new file mode 100644 index 000000000..2bdea16e2 Binary files /dev/null and b/assets/romfs/pgt/eng/12.pgt differ diff --git a/assets/romfs/pgt/eng/13.pgt b/assets/romfs/pgt/eng/13.pgt new file mode 100644 index 000000000..cc0184a80 Binary files /dev/null and b/assets/romfs/pgt/eng/13.pgt differ diff --git a/assets/romfs/pgt/eng/150.pgt b/assets/romfs/pgt/eng/150.pgt new file mode 100644 index 000000000..79a27bb4f Binary files /dev/null and b/assets/romfs/pgt/eng/150.pgt differ diff --git a/assets/romfs/pgt/eng/151.pgt b/assets/romfs/pgt/eng/151.pgt new file mode 100644 index 000000000..604502dab Binary files /dev/null and b/assets/romfs/pgt/eng/151.pgt differ diff --git a/assets/romfs/pgt/eng/152.pgt b/assets/romfs/pgt/eng/152.pgt new file mode 100644 index 000000000..ee22b4076 Binary files /dev/null and b/assets/romfs/pgt/eng/152.pgt differ diff --git a/assets/romfs/pgt/eng/153.pgt b/assets/romfs/pgt/eng/153.pgt new file mode 100644 index 000000000..894d0ead3 Binary files /dev/null and b/assets/romfs/pgt/eng/153.pgt differ diff --git a/assets/romfs/pgt/eng/154.pgt b/assets/romfs/pgt/eng/154.pgt new file mode 100644 index 000000000..ee12876c7 Binary files /dev/null and b/assets/romfs/pgt/eng/154.pgt differ diff --git a/assets/romfs/pgt/eng/16.pgt b/assets/romfs/pgt/eng/16.pgt new file mode 100644 index 000000000..08b2a0411 Binary files /dev/null and b/assets/romfs/pgt/eng/16.pgt differ diff --git a/assets/romfs/pgt/eng/17.pgt b/assets/romfs/pgt/eng/17.pgt new file mode 100644 index 000000000..b5ed8d87f Binary files /dev/null and b/assets/romfs/pgt/eng/17.pgt differ diff --git a/assets/romfs/pgt/eng/18.pgt b/assets/romfs/pgt/eng/18.pgt new file mode 100644 index 000000000..55f0a21ea Binary files /dev/null and b/assets/romfs/pgt/eng/18.pgt differ diff --git a/assets/romfs/pgt/eng/180.pgt b/assets/romfs/pgt/eng/180.pgt new file mode 100644 index 000000000..0fc4f2914 Binary files /dev/null and b/assets/romfs/pgt/eng/180.pgt differ diff --git a/assets/romfs/pgt/eng/181.pgt b/assets/romfs/pgt/eng/181.pgt new file mode 100644 index 000000000..6bd4f9241 Binary files /dev/null and b/assets/romfs/pgt/eng/181.pgt differ diff --git a/assets/romfs/pgt/eng/182.pgt b/assets/romfs/pgt/eng/182.pgt new file mode 100644 index 000000000..b6f9eea47 Binary files /dev/null and b/assets/romfs/pgt/eng/182.pgt differ diff --git a/assets/romfs/pgt/eng/183.pgt b/assets/romfs/pgt/eng/183.pgt new file mode 100644 index 000000000..e77f03db4 Binary files /dev/null and b/assets/romfs/pgt/eng/183.pgt differ diff --git a/assets/romfs/pgt/eng/184.pgt b/assets/romfs/pgt/eng/184.pgt new file mode 100644 index 000000000..1a723f818 Binary files /dev/null and b/assets/romfs/pgt/eng/184.pgt differ diff --git a/assets/romfs/pgt/eng/185.pgt b/assets/romfs/pgt/eng/185.pgt new file mode 100644 index 000000000..d1567dbf0 Binary files /dev/null and b/assets/romfs/pgt/eng/185.pgt differ diff --git a/assets/romfs/pgt/eng/186.pgt b/assets/romfs/pgt/eng/186.pgt new file mode 100644 index 000000000..4504062ec Binary files /dev/null and b/assets/romfs/pgt/eng/186.pgt differ diff --git a/assets/romfs/pgt/eng/187.pgt b/assets/romfs/pgt/eng/187.pgt new file mode 100644 index 000000000..7b5aff649 Binary files /dev/null and b/assets/romfs/pgt/eng/187.pgt differ diff --git a/assets/romfs/pgt/eng/19.pgt b/assets/romfs/pgt/eng/19.pgt new file mode 100644 index 000000000..c05ca337e Binary files /dev/null and b/assets/romfs/pgt/eng/19.pgt differ diff --git a/assets/romfs/pgt/eng/20.pgt b/assets/romfs/pgt/eng/20.pgt new file mode 100644 index 000000000..ddc674845 Binary files /dev/null and b/assets/romfs/pgt/eng/20.pgt differ diff --git a/assets/romfs/pgt/eng/21.pgt b/assets/romfs/pgt/eng/21.pgt new file mode 100644 index 000000000..c76baec57 Binary files /dev/null and b/assets/romfs/pgt/eng/21.pgt differ diff --git a/assets/romfs/pgt/eng/22.pgt b/assets/romfs/pgt/eng/22.pgt new file mode 100644 index 000000000..0a256f562 Binary files /dev/null and b/assets/romfs/pgt/eng/22.pgt differ diff --git a/assets/romfs/pgt/eng/23.pgt b/assets/romfs/pgt/eng/23.pgt new file mode 100644 index 000000000..35596c44a Binary files /dev/null and b/assets/romfs/pgt/eng/23.pgt differ diff --git a/assets/romfs/pgt/eng/24.pgt b/assets/romfs/pgt/eng/24.pgt new file mode 100644 index 000000000..8fb95ec42 Binary files /dev/null and b/assets/romfs/pgt/eng/24.pgt differ diff --git a/assets/romfs/pgt/eng/4.pgt b/assets/romfs/pgt/eng/4.pgt new file mode 100644 index 000000000..2e5ec5d3d Binary files /dev/null and b/assets/romfs/pgt/eng/4.pgt differ diff --git a/assets/romfs/pgt/eng/48.pgt b/assets/romfs/pgt/eng/48.pgt new file mode 100644 index 000000000..e0f87d172 Binary files /dev/null and b/assets/romfs/pgt/eng/48.pgt differ diff --git a/assets/romfs/pgt/eng/5.pgt b/assets/romfs/pgt/eng/5.pgt new file mode 100644 index 000000000..c4e71338a Binary files /dev/null and b/assets/romfs/pgt/eng/5.pgt differ diff --git a/assets/romfs/pgt/eng/51.pgt b/assets/romfs/pgt/eng/51.pgt new file mode 100644 index 000000000..052e8a174 Binary files /dev/null and b/assets/romfs/pgt/eng/51.pgt differ diff --git a/assets/romfs/pgt/eng/52.pgt b/assets/romfs/pgt/eng/52.pgt new file mode 100644 index 000000000..b21ce5c53 Binary files /dev/null and b/assets/romfs/pgt/eng/52.pgt differ diff --git a/assets/romfs/pgt/eng/53.pgt b/assets/romfs/pgt/eng/53.pgt new file mode 100644 index 000000000..780f34d72 Binary files /dev/null and b/assets/romfs/pgt/eng/53.pgt differ diff --git a/assets/romfs/pgt/eng/54.pgt b/assets/romfs/pgt/eng/54.pgt new file mode 100644 index 000000000..8f4bbe7da Binary files /dev/null and b/assets/romfs/pgt/eng/54.pgt differ diff --git a/assets/romfs/pgt/eng/59.pgt b/assets/romfs/pgt/eng/59.pgt new file mode 100644 index 000000000..55190f030 Binary files /dev/null and b/assets/romfs/pgt/eng/59.pgt differ diff --git a/assets/romfs/pgt/eng/6.pgt b/assets/romfs/pgt/eng/6.pgt new file mode 100644 index 000000000..d21640b9c Binary files /dev/null and b/assets/romfs/pgt/eng/6.pgt differ diff --git a/assets/romfs/pgt/eng/60.pgt b/assets/romfs/pgt/eng/60.pgt new file mode 100644 index 000000000..d79a1136b Binary files /dev/null and b/assets/romfs/pgt/eng/60.pgt differ diff --git a/assets/romfs/pgt/eng/61.pgt b/assets/romfs/pgt/eng/61.pgt new file mode 100644 index 000000000..c93e5ad79 Binary files /dev/null and b/assets/romfs/pgt/eng/61.pgt differ diff --git a/assets/romfs/pgt/eng/62.pgt b/assets/romfs/pgt/eng/62.pgt new file mode 100644 index 000000000..ab8c577dc Binary files /dev/null and b/assets/romfs/pgt/eng/62.pgt differ diff --git a/assets/romfs/pgt/eng/65.pgt b/assets/romfs/pgt/eng/65.pgt new file mode 100644 index 000000000..2d58b9aac Binary files /dev/null and b/assets/romfs/pgt/eng/65.pgt differ diff --git a/assets/romfs/pgt/eng/68.pgt b/assets/romfs/pgt/eng/68.pgt new file mode 100644 index 000000000..c92e553d9 Binary files /dev/null and b/assets/romfs/pgt/eng/68.pgt differ diff --git a/assets/romfs/pgt/eng/79.pgt b/assets/romfs/pgt/eng/79.pgt new file mode 100644 index 000000000..254c92a44 Binary files /dev/null and b/assets/romfs/pgt/eng/79.pgt differ diff --git a/assets/romfs/pgt/eng/8.pgt b/assets/romfs/pgt/eng/8.pgt new file mode 100644 index 000000000..9c19016e3 Binary files /dev/null and b/assets/romfs/pgt/eng/8.pgt differ diff --git a/assets/romfs/pgt/eng/80.pgt b/assets/romfs/pgt/eng/80.pgt new file mode 100644 index 000000000..272a6e40c Binary files /dev/null and b/assets/romfs/pgt/eng/80.pgt differ diff --git a/assets/romfs/pgt/eng/9.pgt b/assets/romfs/pgt/eng/9.pgt new file mode 100644 index 000000000..8ba80bd16 Binary files /dev/null and b/assets/romfs/pgt/eng/9.pgt differ diff --git a/assets/romfs/pgt/fre/150.pgt b/assets/romfs/pgt/fre/150.pgt new file mode 100644 index 000000000..6ce75ed3a Binary files /dev/null and b/assets/romfs/pgt/fre/150.pgt differ diff --git a/assets/romfs/pgt/fre/151.pgt b/assets/romfs/pgt/fre/151.pgt new file mode 100644 index 000000000..180160e15 Binary files /dev/null and b/assets/romfs/pgt/fre/151.pgt differ diff --git a/assets/romfs/pgt/fre/152.pgt b/assets/romfs/pgt/fre/152.pgt new file mode 100644 index 000000000..50e2eb755 Binary files /dev/null and b/assets/romfs/pgt/fre/152.pgt differ diff --git a/assets/romfs/pgt/fre/154.pgt b/assets/romfs/pgt/fre/154.pgt new file mode 100644 index 000000000..ed1ec9ef7 Binary files /dev/null and b/assets/romfs/pgt/fre/154.pgt differ diff --git a/assets/romfs/pgt/fre/16.pgt b/assets/romfs/pgt/fre/16.pgt new file mode 100644 index 000000000..a8817ffc6 Binary files /dev/null and b/assets/romfs/pgt/fre/16.pgt differ diff --git a/assets/romfs/pgt/fre/17.pgt b/assets/romfs/pgt/fre/17.pgt new file mode 100644 index 000000000..b5ed8d87f Binary files /dev/null and b/assets/romfs/pgt/fre/17.pgt differ diff --git a/assets/romfs/pgt/fre/18.pgt b/assets/romfs/pgt/fre/18.pgt new file mode 100644 index 000000000..55f0a21ea Binary files /dev/null and b/assets/romfs/pgt/fre/18.pgt differ diff --git a/assets/romfs/pgt/fre/180.pgt b/assets/romfs/pgt/fre/180.pgt new file mode 100644 index 000000000..b456009ef Binary files /dev/null and b/assets/romfs/pgt/fre/180.pgt differ diff --git a/assets/romfs/pgt/fre/182.pgt b/assets/romfs/pgt/fre/182.pgt new file mode 100644 index 000000000..5aad6e56b Binary files /dev/null and b/assets/romfs/pgt/fre/182.pgt differ diff --git a/assets/romfs/pgt/fre/183.pgt b/assets/romfs/pgt/fre/183.pgt new file mode 100644 index 000000000..169190261 Binary files /dev/null and b/assets/romfs/pgt/fre/183.pgt differ diff --git a/assets/romfs/pgt/fre/184.pgt b/assets/romfs/pgt/fre/184.pgt new file mode 100644 index 000000000..890073739 Binary files /dev/null and b/assets/romfs/pgt/fre/184.pgt differ diff --git a/assets/romfs/pgt/fre/185.pgt b/assets/romfs/pgt/fre/185.pgt new file mode 100644 index 000000000..7c780643f Binary files /dev/null and b/assets/romfs/pgt/fre/185.pgt differ diff --git a/assets/romfs/pgt/fre/186.pgt b/assets/romfs/pgt/fre/186.pgt new file mode 100644 index 000000000..7112e550e Binary files /dev/null and b/assets/romfs/pgt/fre/186.pgt differ diff --git a/assets/romfs/pgt/fre/187.pgt b/assets/romfs/pgt/fre/187.pgt new file mode 100644 index 000000000..516f8573a Binary files /dev/null and b/assets/romfs/pgt/fre/187.pgt differ diff --git a/assets/romfs/pgt/fre/19.pgt b/assets/romfs/pgt/fre/19.pgt new file mode 100644 index 000000000..71df824db Binary files /dev/null and b/assets/romfs/pgt/fre/19.pgt differ diff --git a/assets/romfs/pgt/fre/20.pgt b/assets/romfs/pgt/fre/20.pgt new file mode 100644 index 000000000..ddc674845 Binary files /dev/null and b/assets/romfs/pgt/fre/20.pgt differ diff --git a/assets/romfs/pgt/fre/21.pgt b/assets/romfs/pgt/fre/21.pgt new file mode 100644 index 000000000..aa4ca3533 Binary files /dev/null and b/assets/romfs/pgt/fre/21.pgt differ diff --git a/assets/romfs/pgt/fre/22.pgt b/assets/romfs/pgt/fre/22.pgt new file mode 100644 index 000000000..1369124dd Binary files /dev/null and b/assets/romfs/pgt/fre/22.pgt differ diff --git a/assets/romfs/pgt/fre/23.pgt b/assets/romfs/pgt/fre/23.pgt new file mode 100644 index 000000000..65f67cd3a Binary files /dev/null and b/assets/romfs/pgt/fre/23.pgt differ diff --git a/assets/romfs/pgt/fre/24.pgt b/assets/romfs/pgt/fre/24.pgt new file mode 100644 index 000000000..4dd88f13c Binary files /dev/null and b/assets/romfs/pgt/fre/24.pgt differ diff --git a/assets/romfs/pgt/fre/48.pgt b/assets/romfs/pgt/fre/48.pgt new file mode 100644 index 000000000..bcd08392b Binary files /dev/null and b/assets/romfs/pgt/fre/48.pgt differ diff --git a/assets/romfs/pgt/fre/51.pgt b/assets/romfs/pgt/fre/51.pgt new file mode 100644 index 000000000..052e8a174 Binary files /dev/null and b/assets/romfs/pgt/fre/51.pgt differ diff --git a/assets/romfs/pgt/fre/52.pgt b/assets/romfs/pgt/fre/52.pgt new file mode 100644 index 000000000..2e80f01ba Binary files /dev/null and b/assets/romfs/pgt/fre/52.pgt differ diff --git a/assets/romfs/pgt/fre/53.pgt b/assets/romfs/pgt/fre/53.pgt new file mode 100644 index 000000000..91ee667e4 Binary files /dev/null and b/assets/romfs/pgt/fre/53.pgt differ diff --git a/assets/romfs/pgt/fre/54.pgt b/assets/romfs/pgt/fre/54.pgt new file mode 100644 index 000000000..8f4bbe7da Binary files /dev/null and b/assets/romfs/pgt/fre/54.pgt differ diff --git a/assets/romfs/pgt/fre/59.pgt b/assets/romfs/pgt/fre/59.pgt new file mode 100644 index 000000000..fcec0df75 Binary files /dev/null and b/assets/romfs/pgt/fre/59.pgt differ diff --git a/assets/romfs/pgt/fre/60.pgt b/assets/romfs/pgt/fre/60.pgt new file mode 100644 index 000000000..bbd3d2eda Binary files /dev/null and b/assets/romfs/pgt/fre/60.pgt differ diff --git a/assets/romfs/pgt/fre/61.pgt b/assets/romfs/pgt/fre/61.pgt new file mode 100644 index 000000000..7495af4aa Binary files /dev/null and b/assets/romfs/pgt/fre/61.pgt differ diff --git a/assets/romfs/pgt/fre/62.pgt b/assets/romfs/pgt/fre/62.pgt new file mode 100644 index 000000000..f3c909fbb Binary files /dev/null and b/assets/romfs/pgt/fre/62.pgt differ diff --git a/assets/romfs/pgt/fre/79.pgt b/assets/romfs/pgt/fre/79.pgt new file mode 100644 index 000000000..254c92a44 Binary files /dev/null and b/assets/romfs/pgt/fre/79.pgt differ diff --git a/assets/romfs/pgt/fre/9.pgt b/assets/romfs/pgt/fre/9.pgt new file mode 100644 index 000000000..612563a50 Binary files /dev/null and b/assets/romfs/pgt/fre/9.pgt differ diff --git a/assets/romfs/pgt/ger/150.pgt b/assets/romfs/pgt/ger/150.pgt new file mode 100644 index 000000000..01d1fb9f5 Binary files /dev/null and b/assets/romfs/pgt/ger/150.pgt differ diff --git a/assets/romfs/pgt/ger/151.pgt b/assets/romfs/pgt/ger/151.pgt new file mode 100644 index 000000000..75e7b948c Binary files /dev/null and b/assets/romfs/pgt/ger/151.pgt differ diff --git a/assets/romfs/pgt/ger/152.pgt b/assets/romfs/pgt/ger/152.pgt new file mode 100644 index 000000000..c641630a0 Binary files /dev/null and b/assets/romfs/pgt/ger/152.pgt differ diff --git a/assets/romfs/pgt/ger/154.pgt b/assets/romfs/pgt/ger/154.pgt new file mode 100644 index 000000000..2f227ec5d Binary files /dev/null and b/assets/romfs/pgt/ger/154.pgt differ diff --git a/assets/romfs/pgt/ger/16.pgt b/assets/romfs/pgt/ger/16.pgt new file mode 100644 index 000000000..cc2265dab Binary files /dev/null and b/assets/romfs/pgt/ger/16.pgt differ diff --git a/assets/romfs/pgt/ger/17.pgt b/assets/romfs/pgt/ger/17.pgt new file mode 100644 index 000000000..b5ed8d87f Binary files /dev/null and b/assets/romfs/pgt/ger/17.pgt differ diff --git a/assets/romfs/pgt/ger/18.pgt b/assets/romfs/pgt/ger/18.pgt new file mode 100644 index 000000000..55f0a21ea Binary files /dev/null and b/assets/romfs/pgt/ger/18.pgt differ diff --git a/assets/romfs/pgt/ger/180.pgt b/assets/romfs/pgt/ger/180.pgt new file mode 100644 index 000000000..307b4bd6f Binary files /dev/null and b/assets/romfs/pgt/ger/180.pgt differ diff --git a/assets/romfs/pgt/ger/182.pgt b/assets/romfs/pgt/ger/182.pgt new file mode 100644 index 000000000..fda83b8e0 Binary files /dev/null and b/assets/romfs/pgt/ger/182.pgt differ diff --git a/assets/romfs/pgt/ger/183.pgt b/assets/romfs/pgt/ger/183.pgt new file mode 100644 index 000000000..3000eab80 Binary files /dev/null and b/assets/romfs/pgt/ger/183.pgt differ diff --git a/assets/romfs/pgt/ger/184.pgt b/assets/romfs/pgt/ger/184.pgt new file mode 100644 index 000000000..1d7c81106 Binary files /dev/null and b/assets/romfs/pgt/ger/184.pgt differ diff --git a/assets/romfs/pgt/ger/185.pgt b/assets/romfs/pgt/ger/185.pgt new file mode 100644 index 000000000..03c9318c6 Binary files /dev/null and b/assets/romfs/pgt/ger/185.pgt differ diff --git a/assets/romfs/pgt/ger/186.pgt b/assets/romfs/pgt/ger/186.pgt new file mode 100644 index 000000000..3ec6c0c14 Binary files /dev/null and b/assets/romfs/pgt/ger/186.pgt differ diff --git a/assets/romfs/pgt/ger/187.pgt b/assets/romfs/pgt/ger/187.pgt new file mode 100644 index 000000000..fc983384b Binary files /dev/null and b/assets/romfs/pgt/ger/187.pgt differ diff --git a/assets/romfs/pgt/ger/19.pgt b/assets/romfs/pgt/ger/19.pgt new file mode 100644 index 000000000..f2b37d98e Binary files /dev/null and b/assets/romfs/pgt/ger/19.pgt differ diff --git a/assets/romfs/pgt/ger/20.pgt b/assets/romfs/pgt/ger/20.pgt new file mode 100644 index 000000000..ddc674845 Binary files /dev/null and b/assets/romfs/pgt/ger/20.pgt differ diff --git a/assets/romfs/pgt/ger/21.pgt b/assets/romfs/pgt/ger/21.pgt new file mode 100644 index 000000000..2214f74b5 Binary files /dev/null and b/assets/romfs/pgt/ger/21.pgt differ diff --git a/assets/romfs/pgt/ger/22.pgt b/assets/romfs/pgt/ger/22.pgt new file mode 100644 index 000000000..dcf3e2e47 Binary files /dev/null and b/assets/romfs/pgt/ger/22.pgt differ diff --git a/assets/romfs/pgt/ger/23.pgt b/assets/romfs/pgt/ger/23.pgt new file mode 100644 index 000000000..ff1ce0b5a Binary files /dev/null and b/assets/romfs/pgt/ger/23.pgt differ diff --git a/assets/romfs/pgt/ger/24.pgt b/assets/romfs/pgt/ger/24.pgt new file mode 100644 index 000000000..9a21b799c Binary files /dev/null and b/assets/romfs/pgt/ger/24.pgt differ diff --git a/assets/romfs/pgt/ger/48.pgt b/assets/romfs/pgt/ger/48.pgt new file mode 100644 index 000000000..bcd08392b Binary files /dev/null and b/assets/romfs/pgt/ger/48.pgt differ diff --git a/assets/romfs/pgt/ger/51.pgt b/assets/romfs/pgt/ger/51.pgt new file mode 100644 index 000000000..052e8a174 Binary files /dev/null and b/assets/romfs/pgt/ger/51.pgt differ diff --git a/assets/romfs/pgt/ger/52.pgt b/assets/romfs/pgt/ger/52.pgt new file mode 100644 index 000000000..5a52ff8f0 Binary files /dev/null and b/assets/romfs/pgt/ger/52.pgt differ diff --git a/assets/romfs/pgt/ger/53.pgt b/assets/romfs/pgt/ger/53.pgt new file mode 100644 index 000000000..216856f8a Binary files /dev/null and b/assets/romfs/pgt/ger/53.pgt differ diff --git a/assets/romfs/pgt/ger/54.pgt b/assets/romfs/pgt/ger/54.pgt new file mode 100644 index 000000000..8f4bbe7da Binary files /dev/null and b/assets/romfs/pgt/ger/54.pgt differ diff --git a/assets/romfs/pgt/ger/59.pgt b/assets/romfs/pgt/ger/59.pgt new file mode 100644 index 000000000..b60b1d6db Binary files /dev/null and b/assets/romfs/pgt/ger/59.pgt differ diff --git a/assets/romfs/pgt/ger/60.pgt b/assets/romfs/pgt/ger/60.pgt new file mode 100644 index 000000000..d4526d879 Binary files /dev/null and b/assets/romfs/pgt/ger/60.pgt differ diff --git a/assets/romfs/pgt/ger/61.pgt b/assets/romfs/pgt/ger/61.pgt new file mode 100644 index 000000000..a48ff196b Binary files /dev/null and b/assets/romfs/pgt/ger/61.pgt differ diff --git a/assets/romfs/pgt/ger/62.pgt b/assets/romfs/pgt/ger/62.pgt new file mode 100644 index 000000000..d049ed5c8 Binary files /dev/null and b/assets/romfs/pgt/ger/62.pgt differ diff --git a/assets/romfs/pgt/ger/79.pgt b/assets/romfs/pgt/ger/79.pgt new file mode 100644 index 000000000..254c92a44 Binary files /dev/null and b/assets/romfs/pgt/ger/79.pgt differ diff --git a/assets/romfs/pgt/ger/9.pgt b/assets/romfs/pgt/ger/9.pgt new file mode 100644 index 000000000..35b636c49 Binary files /dev/null and b/assets/romfs/pgt/ger/9.pgt differ diff --git a/assets/romfs/pgt/ita/150.pgt b/assets/romfs/pgt/ita/150.pgt new file mode 100644 index 000000000..c0672236d Binary files /dev/null and b/assets/romfs/pgt/ita/150.pgt differ diff --git a/assets/romfs/pgt/ita/151.pgt b/assets/romfs/pgt/ita/151.pgt new file mode 100644 index 000000000..b5206086c Binary files /dev/null and b/assets/romfs/pgt/ita/151.pgt differ diff --git a/assets/romfs/pgt/ita/152.pgt b/assets/romfs/pgt/ita/152.pgt new file mode 100644 index 000000000..b47a79bb9 Binary files /dev/null and b/assets/romfs/pgt/ita/152.pgt differ diff --git a/assets/romfs/pgt/ita/16.pgt b/assets/romfs/pgt/ita/16.pgt new file mode 100644 index 000000000..cc2265dab Binary files /dev/null and b/assets/romfs/pgt/ita/16.pgt differ diff --git a/assets/romfs/pgt/ita/17.pgt b/assets/romfs/pgt/ita/17.pgt new file mode 100644 index 000000000..b5ed8d87f Binary files /dev/null and b/assets/romfs/pgt/ita/17.pgt differ diff --git a/assets/romfs/pgt/ita/18.pgt b/assets/romfs/pgt/ita/18.pgt new file mode 100644 index 000000000..55f0a21ea Binary files /dev/null and b/assets/romfs/pgt/ita/18.pgt differ diff --git a/assets/romfs/pgt/ita/180.pgt b/assets/romfs/pgt/ita/180.pgt new file mode 100644 index 000000000..62a91b3c8 Binary files /dev/null and b/assets/romfs/pgt/ita/180.pgt differ diff --git a/assets/romfs/pgt/ita/182.pgt b/assets/romfs/pgt/ita/182.pgt new file mode 100644 index 000000000..8a7519ca2 Binary files /dev/null and b/assets/romfs/pgt/ita/182.pgt differ diff --git a/assets/romfs/pgt/ita/183.pgt b/assets/romfs/pgt/ita/183.pgt new file mode 100644 index 000000000..b3e230ad5 Binary files /dev/null and b/assets/romfs/pgt/ita/183.pgt differ diff --git a/assets/romfs/pgt/ita/184.pgt b/assets/romfs/pgt/ita/184.pgt new file mode 100644 index 000000000..6a740dff1 Binary files /dev/null and b/assets/romfs/pgt/ita/184.pgt differ diff --git a/assets/romfs/pgt/ita/185.pgt b/assets/romfs/pgt/ita/185.pgt new file mode 100644 index 000000000..277b6dd34 Binary files /dev/null and b/assets/romfs/pgt/ita/185.pgt differ diff --git a/assets/romfs/pgt/ita/186.pgt b/assets/romfs/pgt/ita/186.pgt new file mode 100644 index 000000000..d0587d6ce Binary files /dev/null and b/assets/romfs/pgt/ita/186.pgt differ diff --git a/assets/romfs/pgt/ita/187.pgt b/assets/romfs/pgt/ita/187.pgt new file mode 100644 index 000000000..2dc06ee19 Binary files /dev/null and b/assets/romfs/pgt/ita/187.pgt differ diff --git a/assets/romfs/pgt/ita/19.pgt b/assets/romfs/pgt/ita/19.pgt new file mode 100644 index 000000000..b41b1c2f2 Binary files /dev/null and b/assets/romfs/pgt/ita/19.pgt differ diff --git a/assets/romfs/pgt/ita/20.pgt b/assets/romfs/pgt/ita/20.pgt new file mode 100644 index 000000000..ddc674845 Binary files /dev/null and b/assets/romfs/pgt/ita/20.pgt differ diff --git a/assets/romfs/pgt/ita/21.pgt b/assets/romfs/pgt/ita/21.pgt new file mode 100644 index 000000000..7d2018aa1 Binary files /dev/null and b/assets/romfs/pgt/ita/21.pgt differ diff --git a/assets/romfs/pgt/ita/22.pgt b/assets/romfs/pgt/ita/22.pgt new file mode 100644 index 000000000..0aee5abc2 Binary files /dev/null and b/assets/romfs/pgt/ita/22.pgt differ diff --git a/assets/romfs/pgt/ita/23.pgt b/assets/romfs/pgt/ita/23.pgt new file mode 100644 index 000000000..15db4f858 Binary files /dev/null and b/assets/romfs/pgt/ita/23.pgt differ diff --git a/assets/romfs/pgt/ita/24.pgt b/assets/romfs/pgt/ita/24.pgt new file mode 100644 index 000000000..59acbce85 Binary files /dev/null and b/assets/romfs/pgt/ita/24.pgt differ diff --git a/assets/romfs/pgt/ita/48.pgt b/assets/romfs/pgt/ita/48.pgt new file mode 100644 index 000000000..bcd08392b Binary files /dev/null and b/assets/romfs/pgt/ita/48.pgt differ diff --git a/assets/romfs/pgt/ita/51.pgt b/assets/romfs/pgt/ita/51.pgt new file mode 100644 index 000000000..052e8a174 Binary files /dev/null and b/assets/romfs/pgt/ita/51.pgt differ diff --git a/assets/romfs/pgt/ita/53.pgt b/assets/romfs/pgt/ita/53.pgt new file mode 100644 index 000000000..61106a5c7 Binary files /dev/null and b/assets/romfs/pgt/ita/53.pgt differ diff --git a/assets/romfs/pgt/ita/54.pgt b/assets/romfs/pgt/ita/54.pgt new file mode 100644 index 000000000..8f4bbe7da Binary files /dev/null and b/assets/romfs/pgt/ita/54.pgt differ diff --git a/assets/romfs/pgt/ita/59.pgt b/assets/romfs/pgt/ita/59.pgt new file mode 100644 index 000000000..6d844dec1 Binary files /dev/null and b/assets/romfs/pgt/ita/59.pgt differ diff --git a/assets/romfs/pgt/ita/60.pgt b/assets/romfs/pgt/ita/60.pgt new file mode 100644 index 000000000..e0ca7fc25 Binary files /dev/null and b/assets/romfs/pgt/ita/60.pgt differ diff --git a/assets/romfs/pgt/ita/61.pgt b/assets/romfs/pgt/ita/61.pgt new file mode 100644 index 000000000..820f42798 Binary files /dev/null and b/assets/romfs/pgt/ita/61.pgt differ diff --git a/assets/romfs/pgt/ita/62.pgt b/assets/romfs/pgt/ita/62.pgt new file mode 100644 index 000000000..0affaad15 Binary files /dev/null and b/assets/romfs/pgt/ita/62.pgt differ diff --git a/assets/romfs/pgt/ita/79.pgt b/assets/romfs/pgt/ita/79.pgt new file mode 100644 index 000000000..254c92a44 Binary files /dev/null and b/assets/romfs/pgt/ita/79.pgt differ diff --git a/assets/romfs/pgt/ita/9.pgt b/assets/romfs/pgt/ita/9.pgt new file mode 100644 index 000000000..4b8f8c8a6 Binary files /dev/null and b/assets/romfs/pgt/ita/9.pgt differ diff --git a/assets/romfs/pgt/jpn/10.pgt b/assets/romfs/pgt/jpn/10.pgt new file mode 100644 index 000000000..75a0333ff Binary files /dev/null and b/assets/romfs/pgt/jpn/10.pgt differ diff --git a/assets/romfs/pgt/jpn/108.pgt b/assets/romfs/pgt/jpn/108.pgt new file mode 100644 index 000000000..773107886 Binary files /dev/null and b/assets/romfs/pgt/jpn/108.pgt differ diff --git a/assets/romfs/pgt/jpn/11.pgt b/assets/romfs/pgt/jpn/11.pgt new file mode 100644 index 000000000..b5a2d19ab Binary files /dev/null and b/assets/romfs/pgt/jpn/11.pgt differ diff --git a/assets/romfs/pgt/jpn/14.pgt b/assets/romfs/pgt/jpn/14.pgt new file mode 100644 index 000000000..c727776c0 Binary files /dev/null and b/assets/romfs/pgt/jpn/14.pgt differ diff --git a/assets/romfs/pgt/jpn/15.pgt b/assets/romfs/pgt/jpn/15.pgt new file mode 100644 index 000000000..9e3e2e408 Binary files /dev/null and b/assets/romfs/pgt/jpn/15.pgt differ diff --git a/assets/romfs/pgt/jpn/150.pgt b/assets/romfs/pgt/jpn/150.pgt new file mode 100644 index 000000000..fdf72a454 Binary files /dev/null and b/assets/romfs/pgt/jpn/150.pgt differ diff --git a/assets/romfs/pgt/jpn/154.pgt b/assets/romfs/pgt/jpn/154.pgt new file mode 100644 index 000000000..f87c2746e Binary files /dev/null and b/assets/romfs/pgt/jpn/154.pgt differ diff --git a/assets/romfs/pgt/jpn/16.pgt b/assets/romfs/pgt/jpn/16.pgt new file mode 100644 index 000000000..8ea79765a Binary files /dev/null and b/assets/romfs/pgt/jpn/16.pgt differ diff --git a/assets/romfs/pgt/jpn/17.pgt b/assets/romfs/pgt/jpn/17.pgt new file mode 100644 index 000000000..b5ed8d87f Binary files /dev/null and b/assets/romfs/pgt/jpn/17.pgt differ diff --git a/assets/romfs/pgt/jpn/18.pgt b/assets/romfs/pgt/jpn/18.pgt new file mode 100644 index 000000000..55f0a21ea Binary files /dev/null and b/assets/romfs/pgt/jpn/18.pgt differ diff --git a/assets/romfs/pgt/jpn/180.pgt b/assets/romfs/pgt/jpn/180.pgt new file mode 100644 index 000000000..81dc54aff Binary files /dev/null and b/assets/romfs/pgt/jpn/180.pgt differ diff --git a/assets/romfs/pgt/jpn/182.pgt b/assets/romfs/pgt/jpn/182.pgt new file mode 100644 index 000000000..f54e833ad Binary files /dev/null and b/assets/romfs/pgt/jpn/182.pgt differ diff --git a/assets/romfs/pgt/jpn/183.pgt b/assets/romfs/pgt/jpn/183.pgt new file mode 100644 index 000000000..7e2a4af6b Binary files /dev/null and b/assets/romfs/pgt/jpn/183.pgt differ diff --git a/assets/romfs/pgt/jpn/184.pgt b/assets/romfs/pgt/jpn/184.pgt new file mode 100644 index 000000000..6e218ad28 Binary files /dev/null and b/assets/romfs/pgt/jpn/184.pgt differ diff --git a/assets/romfs/pgt/jpn/185.pgt b/assets/romfs/pgt/jpn/185.pgt new file mode 100644 index 000000000..372806ed8 Binary files /dev/null and b/assets/romfs/pgt/jpn/185.pgt differ diff --git a/assets/romfs/pgt/jpn/186.pgt b/assets/romfs/pgt/jpn/186.pgt new file mode 100644 index 000000000..a5aab77d2 Binary files /dev/null and b/assets/romfs/pgt/jpn/186.pgt differ diff --git a/assets/romfs/pgt/jpn/187.pgt b/assets/romfs/pgt/jpn/187.pgt new file mode 100644 index 000000000..a8796a412 Binary files /dev/null and b/assets/romfs/pgt/jpn/187.pgt differ diff --git a/assets/romfs/pgt/jpn/19.pgt b/assets/romfs/pgt/jpn/19.pgt new file mode 100644 index 000000000..7e97d53c8 Binary files /dev/null and b/assets/romfs/pgt/jpn/19.pgt differ diff --git a/assets/romfs/pgt/jpn/2.pgt b/assets/romfs/pgt/jpn/2.pgt new file mode 100644 index 000000000..bac120231 Binary files /dev/null and b/assets/romfs/pgt/jpn/2.pgt differ diff --git a/assets/romfs/pgt/jpn/20.pgt b/assets/romfs/pgt/jpn/20.pgt new file mode 100644 index 000000000..ddc674845 Binary files /dev/null and b/assets/romfs/pgt/jpn/20.pgt differ diff --git a/assets/romfs/pgt/jpn/21.pgt b/assets/romfs/pgt/jpn/21.pgt new file mode 100644 index 000000000..eb27bf1ae Binary files /dev/null and b/assets/romfs/pgt/jpn/21.pgt differ diff --git a/assets/romfs/pgt/jpn/22.pgt b/assets/romfs/pgt/jpn/22.pgt new file mode 100644 index 000000000..7e24c12f5 Binary files /dev/null and b/assets/romfs/pgt/jpn/22.pgt differ diff --git a/assets/romfs/pgt/jpn/23.pgt b/assets/romfs/pgt/jpn/23.pgt new file mode 100644 index 000000000..666a7acc3 Binary files /dev/null and b/assets/romfs/pgt/jpn/23.pgt differ diff --git a/assets/romfs/pgt/jpn/24.pgt b/assets/romfs/pgt/jpn/24.pgt new file mode 100644 index 000000000..7e462e1e8 Binary files /dev/null and b/assets/romfs/pgt/jpn/24.pgt differ diff --git a/assets/romfs/pgt/jpn/25.pgt b/assets/romfs/pgt/jpn/25.pgt new file mode 100644 index 000000000..2d753ac31 Binary files /dev/null and b/assets/romfs/pgt/jpn/25.pgt differ diff --git a/assets/romfs/pgt/jpn/26.pgt b/assets/romfs/pgt/jpn/26.pgt new file mode 100644 index 000000000..3add3ae1a Binary files /dev/null and b/assets/romfs/pgt/jpn/26.pgt differ diff --git a/assets/romfs/pgt/jpn/27.pgt b/assets/romfs/pgt/jpn/27.pgt new file mode 100644 index 000000000..1624ee4b0 Binary files /dev/null and b/assets/romfs/pgt/jpn/27.pgt differ diff --git a/assets/romfs/pgt/jpn/28.pgt b/assets/romfs/pgt/jpn/28.pgt new file mode 100644 index 000000000..a2857c9cb Binary files /dev/null and b/assets/romfs/pgt/jpn/28.pgt differ diff --git a/assets/romfs/pgt/jpn/29.pgt b/assets/romfs/pgt/jpn/29.pgt new file mode 100644 index 000000000..7d3572c58 Binary files /dev/null and b/assets/romfs/pgt/jpn/29.pgt differ diff --git a/assets/romfs/pgt/jpn/3.pgt b/assets/romfs/pgt/jpn/3.pgt new file mode 100644 index 000000000..49e6dea3a Binary files /dev/null and b/assets/romfs/pgt/jpn/3.pgt differ diff --git a/assets/romfs/pgt/jpn/30.pgt b/assets/romfs/pgt/jpn/30.pgt new file mode 100644 index 000000000..2e1730c69 Binary files /dev/null and b/assets/romfs/pgt/jpn/30.pgt differ diff --git a/assets/romfs/pgt/jpn/31.pgt b/assets/romfs/pgt/jpn/31.pgt new file mode 100644 index 000000000..a28b0880a Binary files /dev/null and b/assets/romfs/pgt/jpn/31.pgt differ diff --git a/assets/romfs/pgt/jpn/32.pgt b/assets/romfs/pgt/jpn/32.pgt new file mode 100644 index 000000000..c2ff18270 Binary files /dev/null and b/assets/romfs/pgt/jpn/32.pgt differ diff --git a/assets/romfs/pgt/jpn/33.pgt b/assets/romfs/pgt/jpn/33.pgt new file mode 100644 index 000000000..08ad55c86 Binary files /dev/null and b/assets/romfs/pgt/jpn/33.pgt differ diff --git a/assets/romfs/pgt/jpn/34.pgt b/assets/romfs/pgt/jpn/34.pgt new file mode 100644 index 000000000..3024b383d Binary files /dev/null and b/assets/romfs/pgt/jpn/34.pgt differ diff --git a/assets/romfs/pgt/jpn/35.pgt b/assets/romfs/pgt/jpn/35.pgt new file mode 100644 index 000000000..f58cc6279 Binary files /dev/null and b/assets/romfs/pgt/jpn/35.pgt differ diff --git a/assets/romfs/pgt/jpn/36.pgt b/assets/romfs/pgt/jpn/36.pgt new file mode 100644 index 000000000..17b7fe831 Binary files /dev/null and b/assets/romfs/pgt/jpn/36.pgt differ diff --git a/assets/romfs/pgt/jpn/37.pgt b/assets/romfs/pgt/jpn/37.pgt new file mode 100644 index 000000000..e001eafe2 Binary files /dev/null and b/assets/romfs/pgt/jpn/37.pgt differ diff --git a/assets/romfs/pgt/jpn/38.pgt b/assets/romfs/pgt/jpn/38.pgt new file mode 100644 index 000000000..a9094369d Binary files /dev/null and b/assets/romfs/pgt/jpn/38.pgt differ diff --git a/assets/romfs/pgt/jpn/39.pgt b/assets/romfs/pgt/jpn/39.pgt new file mode 100644 index 000000000..04ddc9783 Binary files /dev/null and b/assets/romfs/pgt/jpn/39.pgt differ diff --git a/assets/romfs/pgt/jpn/4.pgt b/assets/romfs/pgt/jpn/4.pgt new file mode 100644 index 000000000..60c3fc546 Binary files /dev/null and b/assets/romfs/pgt/jpn/4.pgt differ diff --git a/assets/romfs/pgt/jpn/40.pgt b/assets/romfs/pgt/jpn/40.pgt new file mode 100644 index 000000000..44247a908 Binary files /dev/null and b/assets/romfs/pgt/jpn/40.pgt differ diff --git a/assets/romfs/pgt/jpn/41.pgt b/assets/romfs/pgt/jpn/41.pgt new file mode 100644 index 000000000..a77c42c1e Binary files /dev/null and b/assets/romfs/pgt/jpn/41.pgt differ diff --git a/assets/romfs/pgt/jpn/43.pgt b/assets/romfs/pgt/jpn/43.pgt new file mode 100644 index 000000000..7d1c8ff47 Binary files /dev/null and b/assets/romfs/pgt/jpn/43.pgt differ diff --git a/assets/romfs/pgt/jpn/45.pgt b/assets/romfs/pgt/jpn/45.pgt new file mode 100644 index 000000000..e8de5f8fe Binary files /dev/null and b/assets/romfs/pgt/jpn/45.pgt differ diff --git a/assets/romfs/pgt/jpn/47.pgt b/assets/romfs/pgt/jpn/47.pgt new file mode 100644 index 000000000..e5ad7cb89 Binary files /dev/null and b/assets/romfs/pgt/jpn/47.pgt differ diff --git a/assets/romfs/pgt/jpn/48.pgt b/assets/romfs/pgt/jpn/48.pgt new file mode 100644 index 000000000..bcd08392b Binary files /dev/null and b/assets/romfs/pgt/jpn/48.pgt differ diff --git a/assets/romfs/pgt/jpn/49.pgt b/assets/romfs/pgt/jpn/49.pgt new file mode 100644 index 000000000..62a8dc657 Binary files /dev/null and b/assets/romfs/pgt/jpn/49.pgt differ diff --git a/assets/romfs/pgt/jpn/50.pgt b/assets/romfs/pgt/jpn/50.pgt new file mode 100644 index 000000000..5e906b082 Binary files /dev/null and b/assets/romfs/pgt/jpn/50.pgt differ diff --git a/assets/romfs/pgt/jpn/51.pgt b/assets/romfs/pgt/jpn/51.pgt new file mode 100644 index 000000000..052e8a174 Binary files /dev/null and b/assets/romfs/pgt/jpn/51.pgt differ diff --git a/assets/romfs/pgt/jpn/52.pgt b/assets/romfs/pgt/jpn/52.pgt new file mode 100644 index 000000000..4eb3a44bc Binary files /dev/null and b/assets/romfs/pgt/jpn/52.pgt differ diff --git a/assets/romfs/pgt/jpn/53.pgt b/assets/romfs/pgt/jpn/53.pgt new file mode 100644 index 000000000..343dbbca0 Binary files /dev/null and b/assets/romfs/pgt/jpn/53.pgt differ diff --git a/assets/romfs/pgt/jpn/54.pgt b/assets/romfs/pgt/jpn/54.pgt new file mode 100644 index 000000000..8f4bbe7da Binary files /dev/null and b/assets/romfs/pgt/jpn/54.pgt differ diff --git a/assets/romfs/pgt/jpn/55.pgt b/assets/romfs/pgt/jpn/55.pgt new file mode 100644 index 000000000..768cb0e2d Binary files /dev/null and b/assets/romfs/pgt/jpn/55.pgt differ diff --git a/assets/romfs/pgt/jpn/56.pgt b/assets/romfs/pgt/jpn/56.pgt new file mode 100644 index 000000000..7177117ce Binary files /dev/null and b/assets/romfs/pgt/jpn/56.pgt differ diff --git a/assets/romfs/pgt/jpn/57.pgt b/assets/romfs/pgt/jpn/57.pgt new file mode 100644 index 000000000..005c34087 Binary files /dev/null and b/assets/romfs/pgt/jpn/57.pgt differ diff --git a/assets/romfs/pgt/jpn/58.pgt b/assets/romfs/pgt/jpn/58.pgt new file mode 100644 index 000000000..2815ab2a4 Binary files /dev/null and b/assets/romfs/pgt/jpn/58.pgt differ diff --git a/assets/romfs/pgt/jpn/59.pgt b/assets/romfs/pgt/jpn/59.pgt new file mode 100644 index 000000000..d613205ba Binary files /dev/null and b/assets/romfs/pgt/jpn/59.pgt differ diff --git a/assets/romfs/pgt/jpn/60.pgt b/assets/romfs/pgt/jpn/60.pgt new file mode 100644 index 000000000..169bbeed5 Binary files /dev/null and b/assets/romfs/pgt/jpn/60.pgt differ diff --git a/assets/romfs/pgt/jpn/61.pgt b/assets/romfs/pgt/jpn/61.pgt new file mode 100644 index 000000000..6436bc8a1 Binary files /dev/null and b/assets/romfs/pgt/jpn/61.pgt differ diff --git a/assets/romfs/pgt/jpn/62.pgt b/assets/romfs/pgt/jpn/62.pgt new file mode 100644 index 000000000..6ee8698e7 Binary files /dev/null and b/assets/romfs/pgt/jpn/62.pgt differ diff --git a/assets/romfs/pgt/jpn/63.pgt b/assets/romfs/pgt/jpn/63.pgt new file mode 100644 index 000000000..e0d53b254 Binary files /dev/null and b/assets/romfs/pgt/jpn/63.pgt differ diff --git a/assets/romfs/pgt/jpn/64.pgt b/assets/romfs/pgt/jpn/64.pgt new file mode 100644 index 000000000..93180e4c1 Binary files /dev/null and b/assets/romfs/pgt/jpn/64.pgt differ diff --git a/assets/romfs/pgt/jpn/65.pgt b/assets/romfs/pgt/jpn/65.pgt new file mode 100644 index 000000000..bcbe878b4 Binary files /dev/null and b/assets/romfs/pgt/jpn/65.pgt differ diff --git a/assets/romfs/pgt/jpn/66.pgt b/assets/romfs/pgt/jpn/66.pgt new file mode 100644 index 000000000..4d4b50a80 Binary files /dev/null and b/assets/romfs/pgt/jpn/66.pgt differ diff --git a/assets/romfs/pgt/jpn/67.pgt b/assets/romfs/pgt/jpn/67.pgt new file mode 100644 index 000000000..297e84cf1 Binary files /dev/null and b/assets/romfs/pgt/jpn/67.pgt differ diff --git a/assets/romfs/pgt/jpn/69.pgt b/assets/romfs/pgt/jpn/69.pgt new file mode 100644 index 000000000..20708386a Binary files /dev/null and b/assets/romfs/pgt/jpn/69.pgt differ diff --git a/assets/romfs/pgt/jpn/7.pgt b/assets/romfs/pgt/jpn/7.pgt new file mode 100644 index 000000000..a10ebc4ce Binary files /dev/null and b/assets/romfs/pgt/jpn/7.pgt differ diff --git a/assets/romfs/pgt/jpn/70.pgt b/assets/romfs/pgt/jpn/70.pgt new file mode 100644 index 000000000..825590aaf Binary files /dev/null and b/assets/romfs/pgt/jpn/70.pgt differ diff --git a/assets/romfs/pgt/jpn/79.pgt b/assets/romfs/pgt/jpn/79.pgt new file mode 100644 index 000000000..254c92a44 Binary files /dev/null and b/assets/romfs/pgt/jpn/79.pgt differ diff --git a/assets/romfs/pgt/jpn/8.pgt b/assets/romfs/pgt/jpn/8.pgt new file mode 100644 index 000000000..4a9529f8e Binary files /dev/null and b/assets/romfs/pgt/jpn/8.pgt differ diff --git a/assets/romfs/pgt/jpn/9.pgt b/assets/romfs/pgt/jpn/9.pgt new file mode 100644 index 000000000..7dba0c961 Binary files /dev/null and b/assets/romfs/pgt/jpn/9.pgt differ diff --git a/assets/romfs/pgt/kor/1.pgt b/assets/romfs/pgt/kor/1.pgt new file mode 100644 index 000000000..96bb9a62e Binary files /dev/null and b/assets/romfs/pgt/kor/1.pgt differ diff --git a/assets/romfs/pgt/kor/154.pgt b/assets/romfs/pgt/kor/154.pgt new file mode 100644 index 000000000..071fa1b54 Binary files /dev/null and b/assets/romfs/pgt/kor/154.pgt differ diff --git a/assets/romfs/pgt/kor/16.pgt b/assets/romfs/pgt/kor/16.pgt new file mode 100644 index 000000000..e4b6bbc36 Binary files /dev/null and b/assets/romfs/pgt/kor/16.pgt differ diff --git a/assets/romfs/pgt/kor/17.pgt b/assets/romfs/pgt/kor/17.pgt new file mode 100644 index 000000000..b5ed8d87f Binary files /dev/null and b/assets/romfs/pgt/kor/17.pgt differ diff --git a/assets/romfs/pgt/kor/18.pgt b/assets/romfs/pgt/kor/18.pgt new file mode 100644 index 000000000..55f0a21ea Binary files /dev/null and b/assets/romfs/pgt/kor/18.pgt differ diff --git a/assets/romfs/pgt/kor/180.pgt b/assets/romfs/pgt/kor/180.pgt new file mode 100644 index 000000000..4dc59df38 Binary files /dev/null and b/assets/romfs/pgt/kor/180.pgt differ diff --git a/assets/romfs/pgt/kor/19.pgt b/assets/romfs/pgt/kor/19.pgt new file mode 100644 index 000000000..7c5f954e6 Binary files /dev/null and b/assets/romfs/pgt/kor/19.pgt differ diff --git a/assets/romfs/pgt/kor/21.pgt b/assets/romfs/pgt/kor/21.pgt new file mode 100644 index 000000000..93514a0df Binary files /dev/null and b/assets/romfs/pgt/kor/21.pgt differ diff --git a/assets/romfs/pgt/kor/24.pgt b/assets/romfs/pgt/kor/24.pgt new file mode 100644 index 000000000..d691bdc1f Binary files /dev/null and b/assets/romfs/pgt/kor/24.pgt differ diff --git a/assets/romfs/pgt/kor/27.pgt b/assets/romfs/pgt/kor/27.pgt new file mode 100644 index 000000000..f6d5586b4 Binary files /dev/null and b/assets/romfs/pgt/kor/27.pgt differ diff --git a/assets/romfs/pgt/kor/48.pgt b/assets/romfs/pgt/kor/48.pgt new file mode 100644 index 000000000..e0f87d172 Binary files /dev/null and b/assets/romfs/pgt/kor/48.pgt differ diff --git a/assets/romfs/pgt/kor/51.pgt b/assets/romfs/pgt/kor/51.pgt new file mode 100644 index 000000000..ee0874454 Binary files /dev/null and b/assets/romfs/pgt/kor/51.pgt differ diff --git a/assets/romfs/pgt/kor/54.pgt b/assets/romfs/pgt/kor/54.pgt new file mode 100644 index 000000000..8f4bbe7da Binary files /dev/null and b/assets/romfs/pgt/kor/54.pgt differ diff --git a/assets/romfs/pgt/kor/59.pgt b/assets/romfs/pgt/kor/59.pgt new file mode 100644 index 000000000..92f077c1f Binary files /dev/null and b/assets/romfs/pgt/kor/59.pgt differ diff --git a/assets/romfs/pgt/kor/60.pgt b/assets/romfs/pgt/kor/60.pgt new file mode 100644 index 000000000..9c8458800 Binary files /dev/null and b/assets/romfs/pgt/kor/60.pgt differ diff --git a/assets/romfs/pgt/kor/61.pgt b/assets/romfs/pgt/kor/61.pgt new file mode 100644 index 000000000..bc60bf98c Binary files /dev/null and b/assets/romfs/pgt/kor/61.pgt differ diff --git a/assets/romfs/pgt/kor/62.pgt b/assets/romfs/pgt/kor/62.pgt new file mode 100644 index 000000000..534fab240 Binary files /dev/null and b/assets/romfs/pgt/kor/62.pgt differ diff --git a/assets/romfs/pgt/kor/63.pgt b/assets/romfs/pgt/kor/63.pgt new file mode 100644 index 000000000..06bf307ea Binary files /dev/null and b/assets/romfs/pgt/kor/63.pgt differ diff --git a/assets/romfs/pgt/kor/65.pgt b/assets/romfs/pgt/kor/65.pgt new file mode 100644 index 000000000..902e18879 Binary files /dev/null and b/assets/romfs/pgt/kor/65.pgt differ diff --git a/assets/romfs/pgt/kor/71.pgt b/assets/romfs/pgt/kor/71.pgt new file mode 100644 index 000000000..93180e4c1 Binary files /dev/null and b/assets/romfs/pgt/kor/71.pgt differ diff --git a/assets/romfs/pgt/kor/72.pgt b/assets/romfs/pgt/kor/72.pgt new file mode 100644 index 000000000..6358592b3 Binary files /dev/null and b/assets/romfs/pgt/kor/72.pgt differ diff --git a/assets/romfs/pgt/kor/73.pgt b/assets/romfs/pgt/kor/73.pgt new file mode 100644 index 000000000..161346feb Binary files /dev/null and b/assets/romfs/pgt/kor/73.pgt differ diff --git a/assets/romfs/pgt/kor/74.pgt b/assets/romfs/pgt/kor/74.pgt new file mode 100644 index 000000000..856339bc8 Binary files /dev/null and b/assets/romfs/pgt/kor/74.pgt differ diff --git a/assets/romfs/pgt/kor/75.pgt b/assets/romfs/pgt/kor/75.pgt new file mode 100644 index 000000000..907f63f61 Binary files /dev/null and b/assets/romfs/pgt/kor/75.pgt differ diff --git a/assets/romfs/pgt/kor/76.pgt b/assets/romfs/pgt/kor/76.pgt new file mode 100644 index 000000000..95673c696 Binary files /dev/null and b/assets/romfs/pgt/kor/76.pgt differ diff --git a/assets/romfs/pgt/kor/77.pgt b/assets/romfs/pgt/kor/77.pgt new file mode 100644 index 000000000..7577fd1d0 Binary files /dev/null and b/assets/romfs/pgt/kor/77.pgt differ diff --git a/assets/romfs/pgt/kor/78.pgt b/assets/romfs/pgt/kor/78.pgt new file mode 100644 index 000000000..460db7e40 Binary files /dev/null and b/assets/romfs/pgt/kor/78.pgt differ diff --git a/assets/romfs/pgt/kor/79.pgt b/assets/romfs/pgt/kor/79.pgt new file mode 100644 index 000000000..254c92a44 Binary files /dev/null and b/assets/romfs/pgt/kor/79.pgt differ diff --git a/assets/romfs/pgt/kor/8.pgt b/assets/romfs/pgt/kor/8.pgt new file mode 100644 index 000000000..9467e6a94 Binary files /dev/null and b/assets/romfs/pgt/kor/8.pgt differ diff --git a/assets/romfs/pgt/kor/9.pgt b/assets/romfs/pgt/kor/9.pgt new file mode 100644 index 000000000..2501ce06d Binary files /dev/null and b/assets/romfs/pgt/kor/9.pgt differ diff --git a/assets/romfs/pgt/spa/150.pgt b/assets/romfs/pgt/spa/150.pgt new file mode 100644 index 000000000..4789291fc Binary files /dev/null and b/assets/romfs/pgt/spa/150.pgt differ diff --git a/assets/romfs/pgt/spa/151.pgt b/assets/romfs/pgt/spa/151.pgt new file mode 100644 index 000000000..b4f084c44 Binary files /dev/null and b/assets/romfs/pgt/spa/151.pgt differ diff --git a/assets/romfs/pgt/spa/152.pgt b/assets/romfs/pgt/spa/152.pgt new file mode 100644 index 000000000..fd4951d71 Binary files /dev/null and b/assets/romfs/pgt/spa/152.pgt differ diff --git a/assets/romfs/pgt/spa/16.pgt b/assets/romfs/pgt/spa/16.pgt new file mode 100644 index 000000000..412aa2513 Binary files /dev/null and b/assets/romfs/pgt/spa/16.pgt differ diff --git a/assets/romfs/pgt/spa/17.pgt b/assets/romfs/pgt/spa/17.pgt new file mode 100644 index 000000000..b5ed8d87f Binary files /dev/null and b/assets/romfs/pgt/spa/17.pgt differ diff --git a/assets/romfs/pgt/spa/18.pgt b/assets/romfs/pgt/spa/18.pgt new file mode 100644 index 000000000..55f0a21ea Binary files /dev/null and b/assets/romfs/pgt/spa/18.pgt differ diff --git a/assets/romfs/pgt/spa/180.pgt b/assets/romfs/pgt/spa/180.pgt new file mode 100644 index 000000000..05ee0601a Binary files /dev/null and b/assets/romfs/pgt/spa/180.pgt differ diff --git a/assets/romfs/pgt/spa/182.pgt b/assets/romfs/pgt/spa/182.pgt new file mode 100644 index 000000000..70d3f9d94 Binary files /dev/null and b/assets/romfs/pgt/spa/182.pgt differ diff --git a/assets/romfs/pgt/spa/183.pgt b/assets/romfs/pgt/spa/183.pgt new file mode 100644 index 000000000..0d8616ccc Binary files /dev/null and b/assets/romfs/pgt/spa/183.pgt differ diff --git a/assets/romfs/pgt/spa/184.pgt b/assets/romfs/pgt/spa/184.pgt new file mode 100644 index 000000000..fb4e10e0d Binary files /dev/null and b/assets/romfs/pgt/spa/184.pgt differ diff --git a/assets/romfs/pgt/spa/185.pgt b/assets/romfs/pgt/spa/185.pgt new file mode 100644 index 000000000..8ac154044 Binary files /dev/null and b/assets/romfs/pgt/spa/185.pgt differ diff --git a/assets/romfs/pgt/spa/186.pgt b/assets/romfs/pgt/spa/186.pgt new file mode 100644 index 000000000..931f4e22d Binary files /dev/null and b/assets/romfs/pgt/spa/186.pgt differ diff --git a/assets/romfs/pgt/spa/187.pgt b/assets/romfs/pgt/spa/187.pgt new file mode 100644 index 000000000..d4ddbed79 Binary files /dev/null and b/assets/romfs/pgt/spa/187.pgt differ diff --git a/assets/romfs/pgt/spa/19.pgt b/assets/romfs/pgt/spa/19.pgt new file mode 100644 index 000000000..f127f533e Binary files /dev/null and b/assets/romfs/pgt/spa/19.pgt differ diff --git a/assets/romfs/pgt/spa/20.pgt b/assets/romfs/pgt/spa/20.pgt new file mode 100644 index 000000000..ddc674845 Binary files /dev/null and b/assets/romfs/pgt/spa/20.pgt differ diff --git a/assets/romfs/pgt/spa/21.pgt b/assets/romfs/pgt/spa/21.pgt new file mode 100644 index 000000000..8807b26e9 Binary files /dev/null and b/assets/romfs/pgt/spa/21.pgt differ diff --git a/assets/romfs/pgt/spa/22.pgt b/assets/romfs/pgt/spa/22.pgt new file mode 100644 index 000000000..a5893c8a1 Binary files /dev/null and b/assets/romfs/pgt/spa/22.pgt differ diff --git a/assets/romfs/pgt/spa/23.pgt b/assets/romfs/pgt/spa/23.pgt new file mode 100644 index 000000000..dcbdbf730 Binary files /dev/null and b/assets/romfs/pgt/spa/23.pgt differ diff --git a/assets/romfs/pgt/spa/24.pgt b/assets/romfs/pgt/spa/24.pgt new file mode 100644 index 000000000..41828dc8b Binary files /dev/null and b/assets/romfs/pgt/spa/24.pgt differ diff --git a/assets/romfs/pgt/spa/48.pgt b/assets/romfs/pgt/spa/48.pgt new file mode 100644 index 000000000..e0f87d172 Binary files /dev/null and b/assets/romfs/pgt/spa/48.pgt differ diff --git a/assets/romfs/pgt/spa/51.pgt b/assets/romfs/pgt/spa/51.pgt new file mode 100644 index 000000000..052e8a174 Binary files /dev/null and b/assets/romfs/pgt/spa/51.pgt differ diff --git a/assets/romfs/pgt/spa/52.pgt b/assets/romfs/pgt/spa/52.pgt new file mode 100644 index 000000000..33c8c3fba Binary files /dev/null and b/assets/romfs/pgt/spa/52.pgt differ diff --git a/assets/romfs/pgt/spa/53.pgt b/assets/romfs/pgt/spa/53.pgt new file mode 100644 index 000000000..4fcf6a253 Binary files /dev/null and b/assets/romfs/pgt/spa/53.pgt differ diff --git a/assets/romfs/pgt/spa/54.pgt b/assets/romfs/pgt/spa/54.pgt new file mode 100644 index 000000000..8f4bbe7da Binary files /dev/null and b/assets/romfs/pgt/spa/54.pgt differ diff --git a/assets/romfs/pgt/spa/59.pgt b/assets/romfs/pgt/spa/59.pgt new file mode 100644 index 000000000..cbbe47e89 Binary files /dev/null and b/assets/romfs/pgt/spa/59.pgt differ diff --git a/assets/romfs/pgt/spa/60.pgt b/assets/romfs/pgt/spa/60.pgt new file mode 100644 index 000000000..9eed7420a Binary files /dev/null and b/assets/romfs/pgt/spa/60.pgt differ diff --git a/assets/romfs/pgt/spa/61.pgt b/assets/romfs/pgt/spa/61.pgt new file mode 100644 index 000000000..27ccf9632 Binary files /dev/null and b/assets/romfs/pgt/spa/61.pgt differ diff --git a/assets/romfs/pgt/spa/62.pgt b/assets/romfs/pgt/spa/62.pgt new file mode 100644 index 000000000..8caa2cd9c Binary files /dev/null and b/assets/romfs/pgt/spa/62.pgt differ diff --git a/assets/romfs/pgt/spa/79.pgt b/assets/romfs/pgt/spa/79.pgt new file mode 100644 index 000000000..254c92a44 Binary files /dev/null and b/assets/romfs/pgt/spa/79.pgt differ diff --git a/assets/romfs/pgt/spa/9.pgt b/assets/romfs/pgt/spa/9.pgt new file mode 100644 index 000000000..f99e2a281 Binary files /dev/null and b/assets/romfs/pgt/spa/9.pgt differ diff --git a/assets/romfs/res/3DS.png b/assets/romfs/res/3DS.png new file mode 100644 index 000000000..a4aa7096f Binary files /dev/null and b/assets/romfs/res/3DS.png differ diff --git a/assets/romfs/res/3dsborder.png b/assets/romfs/res/3dsborder.png new file mode 100644 index 000000000..6d5630c2c Binary files /dev/null and b/assets/romfs/res/3dsborder.png differ diff --git a/assets/romfs/res/Background.png b/assets/romfs/res/Background.png new file mode 100644 index 000000000..3f07f7408 Binary files /dev/null and b/assets/romfs/res/Background.png differ diff --git a/assets/romfs/res/Ball Button.png b/assets/romfs/res/Ball Button.png new file mode 100644 index 000000000..1524a1564 Binary files /dev/null and b/assets/romfs/res/Ball Button.png differ diff --git a/assets/romfs/res/BallsBG.png b/assets/romfs/res/BallsBG.png new file mode 100644 index 000000000..bbdbec6a7 Binary files /dev/null and b/assets/romfs/res/BallsBG.png differ diff --git a/assets/romfs/res/Bank Top.png b/assets/romfs/res/Bank Top.png new file mode 100644 index 000000000..439860451 Binary files /dev/null and b/assets/romfs/res/Bank Top.png differ diff --git a/assets/romfs/res/Bar Selected.png b/assets/romfs/res/Bar Selected.png new file mode 100644 index 000000000..35ee46e15 Binary files /dev/null and b/assets/romfs/res/Bar Selected.png differ diff --git a/assets/romfs/res/Bar.png b/assets/romfs/res/Bar.png new file mode 100644 index 000000000..ca67a1b0d Binary files /dev/null and b/assets/romfs/res/Bar.png differ diff --git a/assets/romfs/res/Bold.ttf b/assets/romfs/res/Bold.ttf new file mode 100644 index 000000000..055642e92 Binary files /dev/null and b/assets/romfs/res/Bold.ttf differ diff --git a/assets/romfs/res/Bottom BG.png b/assets/romfs/res/Bottom BG.png new file mode 100644 index 000000000..0c19d9745 Binary files /dev/null and b/assets/romfs/res/Bottom BG.png differ diff --git a/assets/romfs/res/Bottom Pop-Up.png b/assets/romfs/res/Bottom Pop-Up.png new file mode 100644 index 000000000..c0fb3e382 Binary files /dev/null and b/assets/romfs/res/Bottom Pop-Up.png differ diff --git a/assets/romfs/res/Button.png b/assets/romfs/res/Button.png new file mode 100644 index 000000000..37273dd3b Binary files /dev/null and b/assets/romfs/res/Button.png differ diff --git a/assets/romfs/res/Clean Top.png b/assets/romfs/res/Clean Top.png new file mode 100644 index 000000000..33279f827 Binary files /dev/null and b/assets/romfs/res/Clean Top.png differ diff --git a/assets/romfs/res/Credits Top.png b/assets/romfs/res/Credits Top.png new file mode 100644 index 000000000..87333acce Binary files /dev/null and b/assets/romfs/res/Credits Top.png differ diff --git a/assets/romfs/res/DS Menu Bottom BG.png b/assets/romfs/res/DS Menu Bottom BG.png new file mode 100644 index 000000000..0b8cad1d1 Binary files /dev/null and b/assets/romfs/res/DS Menu Bottom BG.png differ diff --git a/assets/romfs/res/DS.png b/assets/romfs/res/DS.png new file mode 100644 index 000000000..ad8d3d827 Binary files /dev/null and b/assets/romfs/res/DS.png differ diff --git a/assets/romfs/res/Dark Button.png b/assets/romfs/res/Dark Button.png new file mode 100644 index 000000000..ecf572378 Binary files /dev/null and b/assets/romfs/res/Dark Button.png differ diff --git a/assets/romfs/res/Dex Box.png b/assets/romfs/res/Dex Box.png new file mode 100644 index 000000000..6a587fbeb Binary files /dev/null and b/assets/romfs/res/Dex Box.png differ diff --git a/assets/romfs/res/Dex N.png b/assets/romfs/res/Dex N.png new file mode 100644 index 000000000..ff017be6e Binary files /dev/null and b/assets/romfs/res/Dex N.png differ diff --git a/assets/romfs/res/Editor Bottom BG.png b/assets/romfs/res/Editor Bottom BG.png new file mode 100644 index 000000000..f244f8938 Binary files /dev/null and b/assets/romfs/res/Editor Bottom BG.png differ diff --git a/assets/romfs/res/Editor Stats.png b/assets/romfs/res/Editor Stats.png new file mode 100644 index 000000000..2fa2b52ee Binary files /dev/null and b/assets/romfs/res/Editor Stats.png differ diff --git a/assets/romfs/res/Event Database BG.png b/assets/romfs/res/Event Database BG.png new file mode 100644 index 000000000..7d7c359d7 Binary files /dev/null and b/assets/romfs/res/Event Database BG.png differ diff --git a/assets/romfs/res/Event Menu Bottom Bar.png b/assets/romfs/res/Event Menu Bottom Bar.png new file mode 100644 index 000000000..dd4c9d6a7 Binary files /dev/null and b/assets/romfs/res/Event Menu Bottom Bar.png differ diff --git a/assets/romfs/res/Event Menu Top Bar Selected.png b/assets/romfs/res/Event Menu Top Bar Selected.png new file mode 100644 index 000000000..438a12ff4 Binary files /dev/null and b/assets/romfs/res/Event Menu Top Bar Selected.png differ diff --git a/assets/romfs/res/Event Menu Top Bar.png b/assets/romfs/res/Event Menu Top Bar.png new file mode 100644 index 000000000..1e5ee37be Binary files /dev/null and b/assets/romfs/res/Event Menu Top Bar.png differ diff --git a/assets/romfs/res/Event Top.png b/assets/romfs/res/Event Top.png new file mode 100644 index 000000000..ebc4ab170 Binary files /dev/null and b/assets/romfs/res/Event Top.png differ diff --git a/assets/romfs/res/Female.png b/assets/romfs/res/Female.png new file mode 100644 index 000000000..6a80fa711 Binary files /dev/null and b/assets/romfs/res/Female.png differ diff --git a/assets/romfs/res/Hidden Power BG.png b/assets/romfs/res/Hidden Power BG.png new file mode 100644 index 000000000..2c3883c9d Binary files /dev/null and b/assets/romfs/res/Hidden Power BG.png differ diff --git a/assets/romfs/res/Hidden Power Button.png b/assets/romfs/res/Hidden Power Button.png new file mode 100644 index 000000000..a2d42357c Binary files /dev/null and b/assets/romfs/res/Hidden Power Button.png differ diff --git a/assets/romfs/res/Info View.png b/assets/romfs/res/Info View.png new file mode 100644 index 000000000..c14edc950 Binary files /dev/null and b/assets/romfs/res/Info View.png differ diff --git a/assets/romfs/res/L Button.png b/assets/romfs/res/L Button.png new file mode 100644 index 000000000..870b6f815 Binary files /dev/null and b/assets/romfs/res/L Button.png differ diff --git a/assets/romfs/res/LR Bar.png b/assets/romfs/res/LR Bar.png new file mode 100644 index 000000000..959f80523 Binary files /dev/null and b/assets/romfs/res/LR Bar.png differ diff --git a/assets/romfs/res/Language Button Selected.png b/assets/romfs/res/Language Button Selected.png new file mode 100644 index 000000000..787f7b666 Binary files /dev/null and b/assets/romfs/res/Language Button Selected.png differ diff --git a/assets/romfs/res/Language Button.png b/assets/romfs/res/Language Button.png new file mode 100644 index 000000000..f46ca486a Binary files /dev/null and b/assets/romfs/res/Language Button.png differ diff --git a/assets/romfs/res/Left.png b/assets/romfs/res/Left.png new file mode 100644 index 000000000..3aeabcf9a Binary files /dev/null and b/assets/romfs/res/Left.png differ diff --git a/assets/romfs/res/Light Button.png b/assets/romfs/res/Light Button.png new file mode 100644 index 000000000..ab8c834b3 Binary files /dev/null and b/assets/romfs/res/Light Button.png differ diff --git a/assets/romfs/res/Main Menu Bottom.png b/assets/romfs/res/Main Menu Bottom.png new file mode 100644 index 000000000..e0e311e26 Binary files /dev/null and b/assets/romfs/res/Main Menu Bottom.png differ diff --git a/assets/romfs/res/Main Menu Dark Bar.png b/assets/romfs/res/Main Menu Dark Bar.png new file mode 100644 index 000000000..b004956bc Binary files /dev/null and b/assets/romfs/res/Main Menu Dark Bar.png differ diff --git a/assets/romfs/res/Main Menu Red Bar.png b/assets/romfs/res/Main Menu Red Bar.png new file mode 100644 index 000000000..2f94b26f2 Binary files /dev/null and b/assets/romfs/res/Main Menu Red Bar.png differ diff --git a/assets/romfs/res/Male.png b/assets/romfs/res/Male.png new file mode 100644 index 000000000..655f5cfca Binary files /dev/null and b/assets/romfs/res/Male.png differ diff --git a/assets/romfs/res/Mask Bottom.png b/assets/romfs/res/Mask Bottom.png new file mode 100644 index 000000000..1a14153b7 Binary files /dev/null and b/assets/romfs/res/Mask Bottom.png differ diff --git a/assets/romfs/res/Mini Box.png b/assets/romfs/res/Mini Box.png new file mode 100644 index 000000000..d3be71a33 Binary files /dev/null and b/assets/romfs/res/Mini Box.png differ diff --git a/assets/romfs/res/Minus Button.png b/assets/romfs/res/Minus Button.png new file mode 100644 index 000000000..4108e7049 Binary files /dev/null and b/assets/romfs/res/Minus Button.png differ diff --git a/assets/romfs/res/Minus.png b/assets/romfs/res/Minus.png new file mode 100644 index 000000000..f9b1bccbb Binary files /dev/null and b/assets/romfs/res/Minus.png differ diff --git a/assets/romfs/res/Moves Bottom.png b/assets/romfs/res/Moves Bottom.png new file mode 100644 index 000000000..9e75cf143 Binary files /dev/null and b/assets/romfs/res/Moves Bottom.png differ diff --git a/assets/romfs/res/Natures Button.png b/assets/romfs/res/Natures Button.png new file mode 100644 index 000000000..f56cb5ac3 Binary files /dev/null and b/assets/romfs/res/Natures Button.png differ diff --git a/assets/romfs/res/Natures.png b/assets/romfs/res/Natures.png new file mode 100644 index 000000000..9fc014c29 Binary files /dev/null and b/assets/romfs/res/Natures.png differ diff --git a/assets/romfs/res/Normal Bar.png b/assets/romfs/res/Normal Bar.png new file mode 100644 index 000000000..16b5a203b Binary files /dev/null and b/assets/romfs/res/Normal Bar.png differ diff --git a/assets/romfs/res/Normal L.png b/assets/romfs/res/Normal L.png new file mode 100644 index 000000000..0858d0903 Binary files /dev/null and b/assets/romfs/res/Normal L.png differ diff --git a/assets/romfs/res/Normal R.png b/assets/romfs/res/Normal R.png new file mode 100644 index 000000000..db5d4960f Binary files /dev/null and b/assets/romfs/res/Normal R.png differ diff --git a/assets/romfs/res/Plus Button.png b/assets/romfs/res/Plus Button.png new file mode 100644 index 000000000..23b86f123 Binary files /dev/null and b/assets/romfs/res/Plus Button.png differ diff --git a/assets/romfs/res/Plus.png b/assets/romfs/res/Plus.png new file mode 100644 index 000000000..0fb1c4812 Binary files /dev/null and b/assets/romfs/res/Plus.png differ diff --git a/assets/romfs/res/Pokeball.png b/assets/romfs/res/Pokeball.png new file mode 100644 index 000000000..c2dc44de2 Binary files /dev/null and b/assets/romfs/res/Pokeball.png differ diff --git a/assets/romfs/res/Pokemon Box.png b/assets/romfs/res/Pokemon Box.png new file mode 100644 index 000000000..fdf3cd402 Binary files /dev/null and b/assets/romfs/res/Pokemon Box.png differ diff --git a/assets/romfs/res/R Button.png b/assets/romfs/res/R Button.png new file mode 100644 index 000000000..4403a1f6f Binary files /dev/null and b/assets/romfs/res/R Button.png differ diff --git a/assets/romfs/res/Red Button.png b/assets/romfs/res/Red Button.png new file mode 100644 index 000000000..31b5bd924 Binary files /dev/null and b/assets/romfs/res/Red Button.png differ diff --git a/assets/romfs/res/Right.png b/assets/romfs/res/Right.png new file mode 100644 index 000000000..d5440c3d0 Binary files /dev/null and b/assets/romfs/res/Right.png differ diff --git a/assets/romfs/res/Selected L.png b/assets/romfs/res/Selected L.png new file mode 100644 index 000000000..6816f6489 Binary files /dev/null and b/assets/romfs/res/Selected L.png differ diff --git a/assets/romfs/res/Selected R.png b/assets/romfs/res/Selected R.png new file mode 100644 index 000000000..54bc58024 Binary files /dev/null and b/assets/romfs/res/Selected R.png differ diff --git a/assets/romfs/res/Selector (cloning).png b/assets/romfs/res/Selector (cloning).png new file mode 100644 index 000000000..b15a5fc1c Binary files /dev/null and b/assets/romfs/res/Selector (cloning).png differ diff --git a/assets/romfs/res/Selector.png b/assets/romfs/res/Selector.png new file mode 100644 index 000000000..28429aab1 Binary files /dev/null and b/assets/romfs/res/Selector.png differ diff --git a/assets/romfs/res/Setting.png b/assets/romfs/res/Setting.png new file mode 100644 index 000000000..cbf5b6fcb Binary files /dev/null and b/assets/romfs/res/Setting.png differ diff --git a/assets/romfs/res/Settings.png b/assets/romfs/res/Settings.png new file mode 100644 index 000000000..0629ada21 Binary files /dev/null and b/assets/romfs/res/Settings.png differ diff --git a/assets/romfs/res/Shiny.png b/assets/romfs/res/Shiny.png new file mode 100644 index 000000000..16ecc8af3 Binary files /dev/null and b/assets/romfs/res/Shiny.png differ diff --git a/assets/romfs/res/Sub Arrow.png b/assets/romfs/res/Sub Arrow.png new file mode 100644 index 000000000..cfd7e3d40 Binary files /dev/null and b/assets/romfs/res/Sub Arrow.png differ diff --git a/assets/romfs/res/Top BG.png b/assets/romfs/res/Top BG.png new file mode 100644 index 000000000..0e4484484 Binary files /dev/null and b/assets/romfs/res/Top BG.png differ diff --git a/assets/romfs/res/Top Moves.png b/assets/romfs/res/Top Moves.png new file mode 100644 index 000000000..5359a79ef Binary files /dev/null and b/assets/romfs/res/Top Moves.png differ diff --git a/assets/romfs/res/Top Selected Move.png b/assets/romfs/res/Top Selected Move.png new file mode 100644 index 000000000..4b45f0861 Binary files /dev/null and b/assets/romfs/res/Top Selected Move.png differ diff --git a/assets/romfs/res/Transfer Button.png b/assets/romfs/res/Transfer Button.png new file mode 100644 index 000000000..c8efecd79 Binary files /dev/null and b/assets/romfs/res/Transfer Button.png differ diff --git a/assets/romfs/res/VeraMono.ttf b/assets/romfs/res/VeraMono.ttf new file mode 100644 index 000000000..139f0b431 Binary files /dev/null and b/assets/romfs/res/VeraMono.ttf differ diff --git a/assets/romfs/res/Warning Bottom.png b/assets/romfs/res/Warning Bottom.png new file mode 100644 index 000000000..59fba7b70 Binary files /dev/null and b/assets/romfs/res/Warning Bottom.png differ diff --git a/assets/romfs/res/Warning Top.png b/assets/romfs/res/Warning Top.png new file mode 100644 index 000000000..a0634e3fd Binary files /dev/null and b/assets/romfs/res/Warning Top.png differ diff --git a/assets/romfs/res/credits.txt b/assets/romfs/res/credits.txt new file mode 100644 index 000000000..1f3afac11 --- /dev/null +++ b/assets/romfs/res/credits.txt @@ -0,0 +1,17 @@ +Smealum for ctrulib, Xerpi for sf2d +Kaphotics for PKHeX and being an awesome guy +SciresM for C-memecrypto, you rock man +J-K-D for direct save import/export and being awesome +Slashcash for PCHex++ and Strackeror for PCHex +Gocario for PKBrew +TuxSH for TWLSaveTool +MarcusD for romfs support +Nba_Yoh for received flags fix +Hamcha for cybertrust.h and digicert.h +PPorg for most of wc6/wc7 included here +Simona, Carlo, Matteo for fill.c work +Shai, Federico, YodaDaCoda, /u/SatansRoommate for tests +Alex, Immersion, Hat3Mond4ys, sgtkwol for descriptions +Paul, Kian for a few wc6 +Majickhat55 for few collections and descriptions +Poutros for N's collection \ No newline at end of file diff --git a/assets/romfs/res/dsborder.png b/assets/romfs/res/dsborder.png new file mode 100644 index 000000000..e3f1a0aaa Binary files /dev/null and b/assets/romfs/res/dsborder.png differ diff --git a/assets/romfs/res/fx/Boxes.png b/assets/romfs/res/fx/Boxes.png new file mode 100644 index 000000000..10cb98b78 Binary files /dev/null and b/assets/romfs/res/fx/Boxes.png differ diff --git a/assets/romfs/res/fx/Cubes.png b/assets/romfs/res/fx/Cubes.png new file mode 100644 index 000000000..f01a2a132 Binary files /dev/null and b/assets/romfs/res/fx/Cubes.png differ diff --git a/assets/romfs/res/item.png b/assets/romfs/res/item.png new file mode 100644 index 000000000..67903536d Binary files /dev/null and b/assets/romfs/res/item.png differ diff --git a/assets/romfs/wc6/eng/110.wc6 b/assets/romfs/wc6/eng/110.wc6 new file mode 100644 index 000000000..5a3b90dba Binary files /dev/null and b/assets/romfs/wc6/eng/110.wc6 differ diff --git a/assets/romfs/wc6/eng/119.wc6 b/assets/romfs/wc6/eng/119.wc6 new file mode 100644 index 000000000..622fbd7b7 Binary files /dev/null and b/assets/romfs/wc6/eng/119.wc6 differ diff --git a/assets/romfs/wc6/eng/146.wc6 b/assets/romfs/wc6/eng/146.wc6 new file mode 100644 index 000000000..66f0de648 Binary files /dev/null and b/assets/romfs/wc6/eng/146.wc6 differ diff --git a/assets/romfs/wc6/eng/1501.wc6 b/assets/romfs/wc6/eng/1501.wc6 new file mode 100644 index 000000000..813e5ab03 Binary files /dev/null and b/assets/romfs/wc6/eng/1501.wc6 differ diff --git a/assets/romfs/wc6/eng/1502.wc6 b/assets/romfs/wc6/eng/1502.wc6 new file mode 100644 index 000000000..d89f13b6c Binary files /dev/null and b/assets/romfs/wc6/eng/1502.wc6 differ diff --git a/assets/romfs/wc6/eng/1503.wc6 b/assets/romfs/wc6/eng/1503.wc6 new file mode 100644 index 000000000..62af04c59 Binary files /dev/null and b/assets/romfs/wc6/eng/1503.wc6 differ diff --git a/assets/romfs/wc6/eng/1504.wc6 b/assets/romfs/wc6/eng/1504.wc6 new file mode 100644 index 000000000..83fa56742 Binary files /dev/null and b/assets/romfs/wc6/eng/1504.wc6 differ diff --git a/assets/romfs/wc6/eng/1505.wc6 b/assets/romfs/wc6/eng/1505.wc6 new file mode 100644 index 000000000..53c3d8b7d Binary files /dev/null and b/assets/romfs/wc6/eng/1505.wc6 differ diff --git a/assets/romfs/wc6/eng/1506.wc6 b/assets/romfs/wc6/eng/1506.wc6 new file mode 100644 index 000000000..af8b1227a Binary files /dev/null and b/assets/romfs/wc6/eng/1506.wc6 differ diff --git a/assets/romfs/wc6/eng/1507.wc6 b/assets/romfs/wc6/eng/1507.wc6 new file mode 100644 index 000000000..f6dacfa5d Binary files /dev/null and b/assets/romfs/wc6/eng/1507.wc6 differ diff --git a/assets/romfs/wc6/eng/1508.wc6 b/assets/romfs/wc6/eng/1508.wc6 new file mode 100644 index 000000000..c9dbf8efe Binary files /dev/null and b/assets/romfs/wc6/eng/1508.wc6 differ diff --git a/assets/romfs/wc6/eng/1509.wc6 b/assets/romfs/wc6/eng/1509.wc6 new file mode 100644 index 000000000..e12185423 Binary files /dev/null and b/assets/romfs/wc6/eng/1509.wc6 differ diff --git a/assets/romfs/wc6/eng/1510.wc6 b/assets/romfs/wc6/eng/1510.wc6 new file mode 100644 index 000000000..ca871168c Binary files /dev/null and b/assets/romfs/wc6/eng/1510.wc6 differ diff --git a/assets/romfs/wc6/eng/1511.wc6 b/assets/romfs/wc6/eng/1511.wc6 new file mode 100644 index 000000000..b89169f13 Binary files /dev/null and b/assets/romfs/wc6/eng/1511.wc6 differ diff --git a/assets/romfs/wc6/eng/1512.wc6 b/assets/romfs/wc6/eng/1512.wc6 new file mode 100644 index 000000000..3bab76619 Binary files /dev/null and b/assets/romfs/wc6/eng/1512.wc6 differ diff --git a/assets/romfs/wc6/eng/1513.wc6 b/assets/romfs/wc6/eng/1513.wc6 new file mode 100644 index 000000000..41e79ecc1 Binary files /dev/null and b/assets/romfs/wc6/eng/1513.wc6 differ diff --git a/assets/romfs/wc6/eng/1514.wc6 b/assets/romfs/wc6/eng/1514.wc6 new file mode 100644 index 000000000..4bfa81798 Binary files /dev/null and b/assets/romfs/wc6/eng/1514.wc6 differ diff --git a/assets/romfs/wc6/eng/1515.wc6 b/assets/romfs/wc6/eng/1515.wc6 new file mode 100644 index 000000000..42f6f92c4 Binary files /dev/null and b/assets/romfs/wc6/eng/1515.wc6 differ diff --git a/assets/romfs/wc6/eng/1516.wc6 b/assets/romfs/wc6/eng/1516.wc6 new file mode 100644 index 000000000..2d75181c5 Binary files /dev/null and b/assets/romfs/wc6/eng/1516.wc6 differ diff --git a/assets/romfs/wc6/eng/159.wc6 b/assets/romfs/wc6/eng/159.wc6 new file mode 100644 index 000000000..ac61cfe73 Binary files /dev/null and b/assets/romfs/wc6/eng/159.wc6 differ diff --git a/assets/romfs/wc6/eng/170.wc6 b/assets/romfs/wc6/eng/170.wc6 new file mode 100644 index 000000000..e7923c4e8 Binary files /dev/null and b/assets/romfs/wc6/eng/170.wc6 differ diff --git a/assets/romfs/wc6/eng/173.wc6 b/assets/romfs/wc6/eng/173.wc6 new file mode 100644 index 000000000..11a5c5f36 Binary files /dev/null and b/assets/romfs/wc6/eng/173.wc6 differ diff --git a/assets/romfs/wc6/eng/175.wc6 b/assets/romfs/wc6/eng/175.wc6 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc6/eng/175.wc6 differ diff --git a/assets/romfs/wc6/eng/2048.wc6 b/assets/romfs/wc6/eng/2048.wc6 new file mode 100644 index 000000000..cc6f1e0b4 Binary files /dev/null and b/assets/romfs/wc6/eng/2048.wc6 differ diff --git a/assets/romfs/wc6/eng/43.wc6 b/assets/romfs/wc6/eng/43.wc6 new file mode 100644 index 000000000..0e9e25e3f Binary files /dev/null and b/assets/romfs/wc6/eng/43.wc6 differ diff --git a/assets/romfs/wc6/eng/46.wc6 b/assets/romfs/wc6/eng/46.wc6 new file mode 100644 index 000000000..9f315fcee Binary files /dev/null and b/assets/romfs/wc6/eng/46.wc6 differ diff --git a/assets/romfs/wc6/eng/47.wc6 b/assets/romfs/wc6/eng/47.wc6 new file mode 100644 index 000000000..5efb8a0d4 Binary files /dev/null and b/assets/romfs/wc6/eng/47.wc6 differ diff --git a/assets/romfs/wc6/eng/501.wc6 b/assets/romfs/wc6/eng/501.wc6 new file mode 100644 index 000000000..5fd0be4fb Binary files /dev/null and b/assets/romfs/wc6/eng/501.wc6 differ diff --git a/assets/romfs/wc6/eng/502.wc6 b/assets/romfs/wc6/eng/502.wc6 new file mode 100644 index 000000000..a5bd8c9cf Binary files /dev/null and b/assets/romfs/wc6/eng/502.wc6 differ diff --git a/assets/romfs/wc6/eng/504-1.wc6 b/assets/romfs/wc6/eng/504-1.wc6 new file mode 100644 index 000000000..db2880eb6 Binary files /dev/null and b/assets/romfs/wc6/eng/504-1.wc6 differ diff --git a/assets/romfs/wc6/eng/504-2.wc6 b/assets/romfs/wc6/eng/504-2.wc6 new file mode 100644 index 000000000..e545c46c8 Binary files /dev/null and b/assets/romfs/wc6/eng/504-2.wc6 differ diff --git a/assets/romfs/wc6/eng/510.wc6 b/assets/romfs/wc6/eng/510.wc6 new file mode 100644 index 000000000..6b3d5477d Binary files /dev/null and b/assets/romfs/wc6/eng/510.wc6 differ diff --git a/assets/romfs/wc6/eng/511.wc6 b/assets/romfs/wc6/eng/511.wc6 new file mode 100644 index 000000000..55ab00788 Binary files /dev/null and b/assets/romfs/wc6/eng/511.wc6 differ diff --git a/assets/romfs/wc6/eng/512.wc6 b/assets/romfs/wc6/eng/512.wc6 new file mode 100644 index 000000000..5c5a8140e Binary files /dev/null and b/assets/romfs/wc6/eng/512.wc6 differ diff --git a/assets/romfs/wc6/eng/515-1.wc6 b/assets/romfs/wc6/eng/515-1.wc6 new file mode 100644 index 000000000..645ce8006 Binary files /dev/null and b/assets/romfs/wc6/eng/515-1.wc6 differ diff --git a/assets/romfs/wc6/eng/515-2.wc6 b/assets/romfs/wc6/eng/515-2.wc6 new file mode 100644 index 000000000..f9f7fbc7c Binary files /dev/null and b/assets/romfs/wc6/eng/515-2.wc6 differ diff --git a/assets/romfs/wc6/eng/516.wc6 b/assets/romfs/wc6/eng/516.wc6 new file mode 100644 index 000000000..2711cc169 Binary files /dev/null and b/assets/romfs/wc6/eng/516.wc6 differ diff --git a/assets/romfs/wc6/eng/518.wc6 b/assets/romfs/wc6/eng/518.wc6 new file mode 100644 index 000000000..6a6acb81c Binary files /dev/null and b/assets/romfs/wc6/eng/518.wc6 differ diff --git a/assets/romfs/wc6/eng/523.wc6 b/assets/romfs/wc6/eng/523.wc6 new file mode 100644 index 000000000..a474a031a Binary files /dev/null and b/assets/romfs/wc6/eng/523.wc6 differ diff --git a/assets/romfs/wc6/eng/524.wc6 b/assets/romfs/wc6/eng/524.wc6 new file mode 100644 index 000000000..52bb7d2f0 Binary files /dev/null and b/assets/romfs/wc6/eng/524.wc6 differ diff --git a/assets/romfs/wc6/eng/525.wc6 b/assets/romfs/wc6/eng/525.wc6 new file mode 100644 index 000000000..9545d96a0 Binary files /dev/null and b/assets/romfs/wc6/eng/525.wc6 differ diff --git a/assets/romfs/wc6/eng/527.wc6 b/assets/romfs/wc6/eng/527.wc6 new file mode 100644 index 000000000..8f8296df6 Binary files /dev/null and b/assets/romfs/wc6/eng/527.wc6 differ diff --git a/assets/romfs/wc6/eng/535.wc6 b/assets/romfs/wc6/eng/535.wc6 new file mode 100644 index 000000000..225703bab Binary files /dev/null and b/assets/romfs/wc6/eng/535.wc6 differ diff --git a/assets/romfs/wc6/eng/536.wc6 b/assets/romfs/wc6/eng/536.wc6 new file mode 100644 index 000000000..1e98a129b Binary files /dev/null and b/assets/romfs/wc6/eng/536.wc6 differ diff --git a/assets/romfs/wc6/eng/537.wc6 b/assets/romfs/wc6/eng/537.wc6 new file mode 100644 index 000000000..7d61fab13 Binary files /dev/null and b/assets/romfs/wc6/eng/537.wc6 differ diff --git a/assets/romfs/wc6/eng/538.wc6 b/assets/romfs/wc6/eng/538.wc6 new file mode 100644 index 000000000..8e3533393 Binary files /dev/null and b/assets/romfs/wc6/eng/538.wc6 differ diff --git a/assets/romfs/wc6/eng/539.wc6 b/assets/romfs/wc6/eng/539.wc6 new file mode 100644 index 000000000..91f09a951 Binary files /dev/null and b/assets/romfs/wc6/eng/539.wc6 differ diff --git a/assets/romfs/wc6/eng/546.wc6 b/assets/romfs/wc6/eng/546.wc6 new file mode 100644 index 000000000..60d820cd0 Binary files /dev/null and b/assets/romfs/wc6/eng/546.wc6 differ diff --git a/assets/romfs/wc6/eng/547.wc6 b/assets/romfs/wc6/eng/547.wc6 new file mode 100644 index 000000000..82218f24f Binary files /dev/null and b/assets/romfs/wc6/eng/547.wc6 differ diff --git a/assets/romfs/wc6/eng/551-1.wc6 b/assets/romfs/wc6/eng/551-1.wc6 new file mode 100644 index 000000000..07ec1f012 Binary files /dev/null and b/assets/romfs/wc6/eng/551-1.wc6 differ diff --git a/assets/romfs/wc6/eng/551-2.wc6 b/assets/romfs/wc6/eng/551-2.wc6 new file mode 100644 index 000000000..9c76a9d17 Binary files /dev/null and b/assets/romfs/wc6/eng/551-2.wc6 differ diff --git a/assets/romfs/wc6/eng/552-1.wc6 b/assets/romfs/wc6/eng/552-1.wc6 new file mode 100644 index 000000000..2a5e78935 Binary files /dev/null and b/assets/romfs/wc6/eng/552-1.wc6 differ diff --git a/assets/romfs/wc6/eng/552-2.wc6 b/assets/romfs/wc6/eng/552-2.wc6 new file mode 100644 index 000000000..d2de6731d Binary files /dev/null and b/assets/romfs/wc6/eng/552-2.wc6 differ diff --git a/assets/romfs/wc6/eng/553.wc6 b/assets/romfs/wc6/eng/553.wc6 new file mode 100644 index 000000000..bf54f3cbf Binary files /dev/null and b/assets/romfs/wc6/eng/553.wc6 differ diff --git a/assets/romfs/wc6/eng/556.wc6 b/assets/romfs/wc6/eng/556.wc6 new file mode 100644 index 000000000..8e795d9b9 Binary files /dev/null and b/assets/romfs/wc6/eng/556.wc6 differ diff --git a/assets/romfs/wc6/eng/557.wc6 b/assets/romfs/wc6/eng/557.wc6 new file mode 100644 index 000000000..45e931bd4 Binary files /dev/null and b/assets/romfs/wc6/eng/557.wc6 differ diff --git a/assets/romfs/wc6/eng/558.wc6 b/assets/romfs/wc6/eng/558.wc6 new file mode 100644 index 000000000..d4e594935 Binary files /dev/null and b/assets/romfs/wc6/eng/558.wc6 differ diff --git a/assets/romfs/wc6/eng/559.wc6 b/assets/romfs/wc6/eng/559.wc6 new file mode 100644 index 000000000..63936222b Binary files /dev/null and b/assets/romfs/wc6/eng/559.wc6 differ diff --git a/assets/romfs/wc6/eng/560.wc6 b/assets/romfs/wc6/eng/560.wc6 new file mode 100644 index 000000000..5125a9b06 Binary files /dev/null and b/assets/romfs/wc6/eng/560.wc6 differ diff --git a/assets/romfs/wc6/eng/561.wc6 b/assets/romfs/wc6/eng/561.wc6 new file mode 100644 index 000000000..74cf64c45 Binary files /dev/null and b/assets/romfs/wc6/eng/561.wc6 differ diff --git a/assets/romfs/wc6/eng/562.wc6 b/assets/romfs/wc6/eng/562.wc6 new file mode 100644 index 000000000..cd7d36d09 Binary files /dev/null and b/assets/romfs/wc6/eng/562.wc6 differ diff --git a/assets/romfs/wc6/eng/563.wc6 b/assets/romfs/wc6/eng/563.wc6 new file mode 100644 index 000000000..b4ece899b Binary files /dev/null and b/assets/romfs/wc6/eng/563.wc6 differ diff --git a/assets/romfs/wc6/eng/564.wc6 b/assets/romfs/wc6/eng/564.wc6 new file mode 100644 index 000000000..f647bb48f Binary files /dev/null and b/assets/romfs/wc6/eng/564.wc6 differ diff --git a/assets/romfs/wc6/eng/565.wc6 b/assets/romfs/wc6/eng/565.wc6 new file mode 100644 index 000000000..85ec20d3c Binary files /dev/null and b/assets/romfs/wc6/eng/565.wc6 differ diff --git a/assets/romfs/wc6/eng/566.wc6 b/assets/romfs/wc6/eng/566.wc6 new file mode 100644 index 000000000..7954b7b36 Binary files /dev/null and b/assets/romfs/wc6/eng/566.wc6 differ diff --git a/assets/romfs/wc6/eng/567.wc6 b/assets/romfs/wc6/eng/567.wc6 new file mode 100644 index 000000000..3ccb93628 Binary files /dev/null and b/assets/romfs/wc6/eng/567.wc6 differ diff --git a/assets/romfs/wc6/eng/569.wc6 b/assets/romfs/wc6/eng/569.wc6 new file mode 100644 index 000000000..7d1549a27 Binary files /dev/null and b/assets/romfs/wc6/eng/569.wc6 differ diff --git a/assets/romfs/wc6/eng/570.wc6 b/assets/romfs/wc6/eng/570.wc6 new file mode 100644 index 000000000..408618944 Binary files /dev/null and b/assets/romfs/wc6/eng/570.wc6 differ diff --git a/assets/romfs/wc6/eng/571.wc6 b/assets/romfs/wc6/eng/571.wc6 new file mode 100644 index 000000000..7a277f37f Binary files /dev/null and b/assets/romfs/wc6/eng/571.wc6 differ diff --git a/assets/romfs/wc6/eng/574.wc6 b/assets/romfs/wc6/eng/574.wc6 new file mode 100644 index 000000000..15316a36b Binary files /dev/null and b/assets/romfs/wc6/eng/574.wc6 differ diff --git a/assets/romfs/wc6/eng/576.wc6 b/assets/romfs/wc6/eng/576.wc6 new file mode 100644 index 000000000..3c66a4114 Binary files /dev/null and b/assets/romfs/wc6/eng/576.wc6 differ diff --git a/assets/romfs/wc6/eng/577.wc6 b/assets/romfs/wc6/eng/577.wc6 new file mode 100644 index 000000000..80a144575 Binary files /dev/null and b/assets/romfs/wc6/eng/577.wc6 differ diff --git a/assets/romfs/wc6/eng/578.wc6 b/assets/romfs/wc6/eng/578.wc6 new file mode 100644 index 000000000..508452c5a Binary files /dev/null and b/assets/romfs/wc6/eng/578.wc6 differ diff --git a/assets/romfs/wc6/eng/580.wc6 b/assets/romfs/wc6/eng/580.wc6 new file mode 100644 index 000000000..12546fbb1 Binary files /dev/null and b/assets/romfs/wc6/eng/580.wc6 differ diff --git a/assets/romfs/wc6/eng/586.wc6 b/assets/romfs/wc6/eng/586.wc6 new file mode 100644 index 000000000..732592bae Binary files /dev/null and b/assets/romfs/wc6/eng/586.wc6 differ diff --git a/assets/romfs/wc6/eng/588.wc6 b/assets/romfs/wc6/eng/588.wc6 new file mode 100644 index 000000000..09d7cad98 Binary files /dev/null and b/assets/romfs/wc6/eng/588.wc6 differ diff --git a/assets/romfs/wc6/eng/590.wc6 b/assets/romfs/wc6/eng/590.wc6 new file mode 100644 index 000000000..8c83e49bb Binary files /dev/null and b/assets/romfs/wc6/eng/590.wc6 differ diff --git a/assets/romfs/wc6/eng/591.wc6 b/assets/romfs/wc6/eng/591.wc6 new file mode 100644 index 000000000..aa73ddc21 Binary files /dev/null and b/assets/romfs/wc6/eng/591.wc6 differ diff --git a/assets/romfs/wc6/eng/592.wc6 b/assets/romfs/wc6/eng/592.wc6 new file mode 100644 index 000000000..a3ec058be Binary files /dev/null and b/assets/romfs/wc6/eng/592.wc6 differ diff --git a/assets/romfs/wc6/eng/598.wc6 b/assets/romfs/wc6/eng/598.wc6 new file mode 100644 index 000000000..6db5a672b Binary files /dev/null and b/assets/romfs/wc6/eng/598.wc6 differ diff --git a/assets/romfs/wc6/eng/812.wc6 b/assets/romfs/wc6/eng/812.wc6 new file mode 100644 index 000000000..38e3826f0 Binary files /dev/null and b/assets/romfs/wc6/eng/812.wc6 differ diff --git a/assets/romfs/wc6/eng/90.wc6 b/assets/romfs/wc6/eng/90.wc6 new file mode 100644 index 000000000..f83e16e81 Binary files /dev/null and b/assets/romfs/wc6/eng/90.wc6 differ diff --git a/assets/romfs/wc6/fre/1501.wc6 b/assets/romfs/wc6/fre/1501.wc6 new file mode 100644 index 000000000..f8734d327 Binary files /dev/null and b/assets/romfs/wc6/fre/1501.wc6 differ diff --git a/assets/romfs/wc6/fre/1503.wc6 b/assets/romfs/wc6/fre/1503.wc6 new file mode 100644 index 000000000..a2926e0ea Binary files /dev/null and b/assets/romfs/wc6/fre/1503.wc6 differ diff --git a/assets/romfs/wc6/fre/1504.wc6 b/assets/romfs/wc6/fre/1504.wc6 new file mode 100644 index 000000000..c279c2d29 Binary files /dev/null and b/assets/romfs/wc6/fre/1504.wc6 differ diff --git a/assets/romfs/wc6/fre/1505.wc6 b/assets/romfs/wc6/fre/1505.wc6 new file mode 100644 index 000000000..15e3dab31 Binary files /dev/null and b/assets/romfs/wc6/fre/1505.wc6 differ diff --git a/assets/romfs/wc6/fre/1506.wc6 b/assets/romfs/wc6/fre/1506.wc6 new file mode 100644 index 000000000..354ede846 Binary files /dev/null and b/assets/romfs/wc6/fre/1506.wc6 differ diff --git a/assets/romfs/wc6/fre/1507.wc6 b/assets/romfs/wc6/fre/1507.wc6 new file mode 100644 index 000000000..4e4f2d58b Binary files /dev/null and b/assets/romfs/wc6/fre/1507.wc6 differ diff --git a/assets/romfs/wc6/fre/1508.wc6 b/assets/romfs/wc6/fre/1508.wc6 new file mode 100644 index 000000000..8f3ca072e Binary files /dev/null and b/assets/romfs/wc6/fre/1508.wc6 differ diff --git a/assets/romfs/wc6/fre/1509.wc6 b/assets/romfs/wc6/fre/1509.wc6 new file mode 100644 index 000000000..1ae9ae4f4 Binary files /dev/null and b/assets/romfs/wc6/fre/1509.wc6 differ diff --git a/assets/romfs/wc6/fre/1510.wc6 b/assets/romfs/wc6/fre/1510.wc6 new file mode 100644 index 000000000..a20748cb9 Binary files /dev/null and b/assets/romfs/wc6/fre/1510.wc6 differ diff --git a/assets/romfs/wc6/fre/1511.wc6 b/assets/romfs/wc6/fre/1511.wc6 new file mode 100644 index 000000000..162525686 Binary files /dev/null and b/assets/romfs/wc6/fre/1511.wc6 differ diff --git a/assets/romfs/wc6/fre/1512.wc6 b/assets/romfs/wc6/fre/1512.wc6 new file mode 100644 index 000000000..f3d2194d8 Binary files /dev/null and b/assets/romfs/wc6/fre/1512.wc6 differ diff --git a/assets/romfs/wc6/fre/1513.wc6 b/assets/romfs/wc6/fre/1513.wc6 new file mode 100644 index 000000000..350f5acf7 Binary files /dev/null and b/assets/romfs/wc6/fre/1513.wc6 differ diff --git a/assets/romfs/wc6/fre/1514.wc6 b/assets/romfs/wc6/fre/1514.wc6 new file mode 100644 index 000000000..2141acda6 Binary files /dev/null and b/assets/romfs/wc6/fre/1514.wc6 differ diff --git a/assets/romfs/wc6/fre/1515.wc6 b/assets/romfs/wc6/fre/1515.wc6 new file mode 100644 index 000000000..c908effcb Binary files /dev/null and b/assets/romfs/wc6/fre/1515.wc6 differ diff --git a/assets/romfs/wc6/fre/1516.wc6 b/assets/romfs/wc6/fre/1516.wc6 new file mode 100644 index 000000000..a5a6bb6a3 Binary files /dev/null and b/assets/romfs/wc6/fre/1516.wc6 differ diff --git a/assets/romfs/wc6/fre/175.wc6 b/assets/romfs/wc6/fre/175.wc6 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc6/fre/175.wc6 differ diff --git a/assets/romfs/wc6/fre/2048.wc6 b/assets/romfs/wc6/fre/2048.wc6 new file mode 100644 index 000000000..e0467d4a9 Binary files /dev/null and b/assets/romfs/wc6/fre/2048.wc6 differ diff --git a/assets/romfs/wc6/fre/49.wc6 b/assets/romfs/wc6/fre/49.wc6 new file mode 100644 index 000000000..8c877daaa Binary files /dev/null and b/assets/romfs/wc6/fre/49.wc6 differ diff --git a/assets/romfs/wc6/fre/504-1.wc6 b/assets/romfs/wc6/fre/504-1.wc6 new file mode 100644 index 000000000..d12f4c059 Binary files /dev/null and b/assets/romfs/wc6/fre/504-1.wc6 differ diff --git a/assets/romfs/wc6/fre/504-2.wc6 b/assets/romfs/wc6/fre/504-2.wc6 new file mode 100644 index 000000000..cec1e163f Binary files /dev/null and b/assets/romfs/wc6/fre/504-2.wc6 differ diff --git a/assets/romfs/wc6/fre/511.wc6 b/assets/romfs/wc6/fre/511.wc6 new file mode 100644 index 000000000..789edce84 Binary files /dev/null and b/assets/romfs/wc6/fre/511.wc6 differ diff --git a/assets/romfs/wc6/fre/523.wc6 b/assets/romfs/wc6/fre/523.wc6 new file mode 100644 index 000000000..7367fec69 Binary files /dev/null and b/assets/romfs/wc6/fre/523.wc6 differ diff --git a/assets/romfs/wc6/fre/524.wc6 b/assets/romfs/wc6/fre/524.wc6 new file mode 100644 index 000000000..3953dd08d Binary files /dev/null and b/assets/romfs/wc6/fre/524.wc6 differ diff --git a/assets/romfs/wc6/fre/525.wc6 b/assets/romfs/wc6/fre/525.wc6 new file mode 100644 index 000000000..226511b70 Binary files /dev/null and b/assets/romfs/wc6/fre/525.wc6 differ diff --git a/assets/romfs/wc6/fre/537.wc6 b/assets/romfs/wc6/fre/537.wc6 new file mode 100644 index 000000000..2a9b66c7f Binary files /dev/null and b/assets/romfs/wc6/fre/537.wc6 differ diff --git a/assets/romfs/wc6/fre/538.wc6 b/assets/romfs/wc6/fre/538.wc6 new file mode 100644 index 000000000..796a41933 Binary files /dev/null and b/assets/romfs/wc6/fre/538.wc6 differ diff --git a/assets/romfs/wc6/fre/546.wc6 b/assets/romfs/wc6/fre/546.wc6 new file mode 100644 index 000000000..e1fc42ef6 Binary files /dev/null and b/assets/romfs/wc6/fre/546.wc6 differ diff --git a/assets/romfs/wc6/fre/547.wc6 b/assets/romfs/wc6/fre/547.wc6 new file mode 100644 index 000000000..73467a99e Binary files /dev/null and b/assets/romfs/wc6/fre/547.wc6 differ diff --git a/assets/romfs/wc6/fre/551-1.wc6 b/assets/romfs/wc6/fre/551-1.wc6 new file mode 100644 index 000000000..f38c446c4 Binary files /dev/null and b/assets/romfs/wc6/fre/551-1.wc6 differ diff --git a/assets/romfs/wc6/fre/551-2.wc6 b/assets/romfs/wc6/fre/551-2.wc6 new file mode 100644 index 000000000..f0a8b9764 Binary files /dev/null and b/assets/romfs/wc6/fre/551-2.wc6 differ diff --git a/assets/romfs/wc6/fre/552-1.wc6 b/assets/romfs/wc6/fre/552-1.wc6 new file mode 100644 index 000000000..63586dcda Binary files /dev/null and b/assets/romfs/wc6/fre/552-1.wc6 differ diff --git a/assets/romfs/wc6/fre/552-2.wc6 b/assets/romfs/wc6/fre/552-2.wc6 new file mode 100644 index 000000000..e45556722 Binary files /dev/null and b/assets/romfs/wc6/fre/552-2.wc6 differ diff --git a/assets/romfs/wc6/fre/553.wc6 b/assets/romfs/wc6/fre/553.wc6 new file mode 100644 index 000000000..1c3963ecd Binary files /dev/null and b/assets/romfs/wc6/fre/553.wc6 differ diff --git a/assets/romfs/wc6/fre/556.wc6 b/assets/romfs/wc6/fre/556.wc6 new file mode 100644 index 000000000..4b36092c1 Binary files /dev/null and b/assets/romfs/wc6/fre/556.wc6 differ diff --git a/assets/romfs/wc6/fre/557.wc6 b/assets/romfs/wc6/fre/557.wc6 new file mode 100644 index 000000000..bb98b7def Binary files /dev/null and b/assets/romfs/wc6/fre/557.wc6 differ diff --git a/assets/romfs/wc6/fre/558.wc6 b/assets/romfs/wc6/fre/558.wc6 new file mode 100644 index 000000000..a70aab8cb Binary files /dev/null and b/assets/romfs/wc6/fre/558.wc6 differ diff --git a/assets/romfs/wc6/fre/559.wc6 b/assets/romfs/wc6/fre/559.wc6 new file mode 100644 index 000000000..9a857c0c4 Binary files /dev/null and b/assets/romfs/wc6/fre/559.wc6 differ diff --git a/assets/romfs/wc6/fre/560.wc6 b/assets/romfs/wc6/fre/560.wc6 new file mode 100644 index 000000000..1e44edd7e Binary files /dev/null and b/assets/romfs/wc6/fre/560.wc6 differ diff --git a/assets/romfs/wc6/fre/561.wc6 b/assets/romfs/wc6/fre/561.wc6 new file mode 100644 index 000000000..7eb406b3a Binary files /dev/null and b/assets/romfs/wc6/fre/561.wc6 differ diff --git a/assets/romfs/wc6/fre/562.wc6 b/assets/romfs/wc6/fre/562.wc6 new file mode 100644 index 000000000..183c81ff6 Binary files /dev/null and b/assets/romfs/wc6/fre/562.wc6 differ diff --git a/assets/romfs/wc6/fre/563.wc6 b/assets/romfs/wc6/fre/563.wc6 new file mode 100644 index 000000000..0183042d9 Binary files /dev/null and b/assets/romfs/wc6/fre/563.wc6 differ diff --git a/assets/romfs/wc6/fre/564.wc6 b/assets/romfs/wc6/fre/564.wc6 new file mode 100644 index 000000000..8033e696e Binary files /dev/null and b/assets/romfs/wc6/fre/564.wc6 differ diff --git a/assets/romfs/wc6/fre/565.wc6 b/assets/romfs/wc6/fre/565.wc6 new file mode 100644 index 000000000..150c024e6 Binary files /dev/null and b/assets/romfs/wc6/fre/565.wc6 differ diff --git a/assets/romfs/wc6/fre/566.wc6 b/assets/romfs/wc6/fre/566.wc6 new file mode 100644 index 000000000..1758fa6d7 Binary files /dev/null and b/assets/romfs/wc6/fre/566.wc6 differ diff --git a/assets/romfs/wc6/fre/567.wc6 b/assets/romfs/wc6/fre/567.wc6 new file mode 100644 index 000000000..777b3de27 Binary files /dev/null and b/assets/romfs/wc6/fre/567.wc6 differ diff --git a/assets/romfs/wc6/fre/569.wc6 b/assets/romfs/wc6/fre/569.wc6 new file mode 100644 index 000000000..f28ac0d0c Binary files /dev/null and b/assets/romfs/wc6/fre/569.wc6 differ diff --git a/assets/romfs/wc6/fre/570.wc6 b/assets/romfs/wc6/fre/570.wc6 new file mode 100644 index 000000000..66741280b Binary files /dev/null and b/assets/romfs/wc6/fre/570.wc6 differ diff --git a/assets/romfs/wc6/fre/571.wc6 b/assets/romfs/wc6/fre/571.wc6 new file mode 100644 index 000000000..8aef6d28e Binary files /dev/null and b/assets/romfs/wc6/fre/571.wc6 differ diff --git a/assets/romfs/wc6/fre/574.wc6 b/assets/romfs/wc6/fre/574.wc6 new file mode 100644 index 000000000..0bdc9e345 Binary files /dev/null and b/assets/romfs/wc6/fre/574.wc6 differ diff --git a/assets/romfs/wc6/fre/576.wc6 b/assets/romfs/wc6/fre/576.wc6 new file mode 100644 index 000000000..4e4fd084a Binary files /dev/null and b/assets/romfs/wc6/fre/576.wc6 differ diff --git a/assets/romfs/wc6/fre/577.wc6 b/assets/romfs/wc6/fre/577.wc6 new file mode 100644 index 000000000..13fbafeea Binary files /dev/null and b/assets/romfs/wc6/fre/577.wc6 differ diff --git a/assets/romfs/wc6/fre/578.wc6 b/assets/romfs/wc6/fre/578.wc6 new file mode 100644 index 000000000..cbe02600f Binary files /dev/null and b/assets/romfs/wc6/fre/578.wc6 differ diff --git a/assets/romfs/wc6/fre/586.wc6 b/assets/romfs/wc6/fre/586.wc6 new file mode 100644 index 000000000..4f369731e Binary files /dev/null and b/assets/romfs/wc6/fre/586.wc6 differ diff --git a/assets/romfs/wc6/fre/588.wc6 b/assets/romfs/wc6/fre/588.wc6 new file mode 100644 index 000000000..baa83ad3c Binary files /dev/null and b/assets/romfs/wc6/fre/588.wc6 differ diff --git a/assets/romfs/wc6/fre/598.wc6 b/assets/romfs/wc6/fre/598.wc6 new file mode 100644 index 000000000..7486273f6 Binary files /dev/null and b/assets/romfs/wc6/fre/598.wc6 differ diff --git a/assets/romfs/wc6/fre/812.wc6 b/assets/romfs/wc6/fre/812.wc6 new file mode 100644 index 000000000..0c05ad730 Binary files /dev/null and b/assets/romfs/wc6/fre/812.wc6 differ diff --git a/assets/romfs/wc6/ger/1501.wc6 b/assets/romfs/wc6/ger/1501.wc6 new file mode 100644 index 000000000..fbc8360b5 Binary files /dev/null and b/assets/romfs/wc6/ger/1501.wc6 differ diff --git a/assets/romfs/wc6/ger/1503.wc6 b/assets/romfs/wc6/ger/1503.wc6 new file mode 100644 index 000000000..c55619d93 Binary files /dev/null and b/assets/romfs/wc6/ger/1503.wc6 differ diff --git a/assets/romfs/wc6/ger/1504.wc6 b/assets/romfs/wc6/ger/1504.wc6 new file mode 100644 index 000000000..60e618e29 Binary files /dev/null and b/assets/romfs/wc6/ger/1504.wc6 differ diff --git a/assets/romfs/wc6/ger/1505.wc6 b/assets/romfs/wc6/ger/1505.wc6 new file mode 100644 index 000000000..caaf5652e Binary files /dev/null and b/assets/romfs/wc6/ger/1505.wc6 differ diff --git a/assets/romfs/wc6/ger/1506.wc6 b/assets/romfs/wc6/ger/1506.wc6 new file mode 100644 index 000000000..348053963 Binary files /dev/null and b/assets/romfs/wc6/ger/1506.wc6 differ diff --git a/assets/romfs/wc6/ger/1507.wc6 b/assets/romfs/wc6/ger/1507.wc6 new file mode 100644 index 000000000..bac63a95c Binary files /dev/null and b/assets/romfs/wc6/ger/1507.wc6 differ diff --git a/assets/romfs/wc6/ger/1508.wc6 b/assets/romfs/wc6/ger/1508.wc6 new file mode 100644 index 000000000..934df6375 Binary files /dev/null and b/assets/romfs/wc6/ger/1508.wc6 differ diff --git a/assets/romfs/wc6/ger/1509.wc6 b/assets/romfs/wc6/ger/1509.wc6 new file mode 100644 index 000000000..62ba2ad9b Binary files /dev/null and b/assets/romfs/wc6/ger/1509.wc6 differ diff --git a/assets/romfs/wc6/ger/1510.wc6 b/assets/romfs/wc6/ger/1510.wc6 new file mode 100644 index 000000000..261934692 Binary files /dev/null and b/assets/romfs/wc6/ger/1510.wc6 differ diff --git a/assets/romfs/wc6/ger/1511.wc6 b/assets/romfs/wc6/ger/1511.wc6 new file mode 100644 index 000000000..74d46e88a Binary files /dev/null and b/assets/romfs/wc6/ger/1511.wc6 differ diff --git a/assets/romfs/wc6/ger/1512.wc6 b/assets/romfs/wc6/ger/1512.wc6 new file mode 100644 index 000000000..fab00c433 Binary files /dev/null and b/assets/romfs/wc6/ger/1512.wc6 differ diff --git a/assets/romfs/wc6/ger/1513.wc6 b/assets/romfs/wc6/ger/1513.wc6 new file mode 100644 index 000000000..4defffe4c Binary files /dev/null and b/assets/romfs/wc6/ger/1513.wc6 differ diff --git a/assets/romfs/wc6/ger/1514.wc6 b/assets/romfs/wc6/ger/1514.wc6 new file mode 100644 index 000000000..4283b9eef Binary files /dev/null and b/assets/romfs/wc6/ger/1514.wc6 differ diff --git a/assets/romfs/wc6/ger/1515.wc6 b/assets/romfs/wc6/ger/1515.wc6 new file mode 100644 index 000000000..128261164 Binary files /dev/null and b/assets/romfs/wc6/ger/1515.wc6 differ diff --git a/assets/romfs/wc6/ger/1516.wc6 b/assets/romfs/wc6/ger/1516.wc6 new file mode 100644 index 000000000..d5a841062 Binary files /dev/null and b/assets/romfs/wc6/ger/1516.wc6 differ diff --git a/assets/romfs/wc6/ger/175.wc6 b/assets/romfs/wc6/ger/175.wc6 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc6/ger/175.wc6 differ diff --git a/assets/romfs/wc6/ger/2048.wc6 b/assets/romfs/wc6/ger/2048.wc6 new file mode 100644 index 000000000..b2edb39c6 Binary files /dev/null and b/assets/romfs/wc6/ger/2048.wc6 differ diff --git a/assets/romfs/wc6/ger/504-1.wc6 b/assets/romfs/wc6/ger/504-1.wc6 new file mode 100644 index 000000000..d31b53325 Binary files /dev/null and b/assets/romfs/wc6/ger/504-1.wc6 differ diff --git a/assets/romfs/wc6/ger/504-2.wc6 b/assets/romfs/wc6/ger/504-2.wc6 new file mode 100644 index 000000000..2a1ace20e Binary files /dev/null and b/assets/romfs/wc6/ger/504-2.wc6 differ diff --git a/assets/romfs/wc6/ger/510.wc6 b/assets/romfs/wc6/ger/510.wc6 new file mode 100644 index 000000000..642ad748e Binary files /dev/null and b/assets/romfs/wc6/ger/510.wc6 differ diff --git a/assets/romfs/wc6/ger/511.wc6 b/assets/romfs/wc6/ger/511.wc6 new file mode 100644 index 000000000..f45f2f3aa Binary files /dev/null and b/assets/romfs/wc6/ger/511.wc6 differ diff --git a/assets/romfs/wc6/ger/523.wc6 b/assets/romfs/wc6/ger/523.wc6 new file mode 100644 index 000000000..10f0fd704 Binary files /dev/null and b/assets/romfs/wc6/ger/523.wc6 differ diff --git a/assets/romfs/wc6/ger/524.wc6 b/assets/romfs/wc6/ger/524.wc6 new file mode 100644 index 000000000..a9f99bc42 Binary files /dev/null and b/assets/romfs/wc6/ger/524.wc6 differ diff --git a/assets/romfs/wc6/ger/525.wc6 b/assets/romfs/wc6/ger/525.wc6 new file mode 100644 index 000000000..e3bc203e7 Binary files /dev/null and b/assets/romfs/wc6/ger/525.wc6 differ diff --git a/assets/romfs/wc6/ger/537.wc6 b/assets/romfs/wc6/ger/537.wc6 new file mode 100644 index 000000000..7676586d5 Binary files /dev/null and b/assets/romfs/wc6/ger/537.wc6 differ diff --git a/assets/romfs/wc6/ger/546.wc6 b/assets/romfs/wc6/ger/546.wc6 new file mode 100644 index 000000000..79fd17157 Binary files /dev/null and b/assets/romfs/wc6/ger/546.wc6 differ diff --git a/assets/romfs/wc6/ger/547.wc6 b/assets/romfs/wc6/ger/547.wc6 new file mode 100644 index 000000000..1d4a75ceb Binary files /dev/null and b/assets/romfs/wc6/ger/547.wc6 differ diff --git a/assets/romfs/wc6/ger/551-1.wc6 b/assets/romfs/wc6/ger/551-1.wc6 new file mode 100644 index 000000000..b031e5aa8 Binary files /dev/null and b/assets/romfs/wc6/ger/551-1.wc6 differ diff --git a/assets/romfs/wc6/ger/551-2.wc6 b/assets/romfs/wc6/ger/551-2.wc6 new file mode 100644 index 000000000..bac376126 Binary files /dev/null and b/assets/romfs/wc6/ger/551-2.wc6 differ diff --git a/assets/romfs/wc6/ger/552-1.wc6 b/assets/romfs/wc6/ger/552-1.wc6 new file mode 100644 index 000000000..b419bfc70 Binary files /dev/null and b/assets/romfs/wc6/ger/552-1.wc6 differ diff --git a/assets/romfs/wc6/ger/552-2.wc6 b/assets/romfs/wc6/ger/552-2.wc6 new file mode 100644 index 000000000..47e51a531 Binary files /dev/null and b/assets/romfs/wc6/ger/552-2.wc6 differ diff --git a/assets/romfs/wc6/ger/553.wc6 b/assets/romfs/wc6/ger/553.wc6 new file mode 100644 index 000000000..db634096e Binary files /dev/null and b/assets/romfs/wc6/ger/553.wc6 differ diff --git a/assets/romfs/wc6/ger/556.wc6 b/assets/romfs/wc6/ger/556.wc6 new file mode 100644 index 000000000..8afc014c5 Binary files /dev/null and b/assets/romfs/wc6/ger/556.wc6 differ diff --git a/assets/romfs/wc6/ger/557.wc6 b/assets/romfs/wc6/ger/557.wc6 new file mode 100644 index 000000000..9d70f3f40 Binary files /dev/null and b/assets/romfs/wc6/ger/557.wc6 differ diff --git a/assets/romfs/wc6/ger/558.wc6 b/assets/romfs/wc6/ger/558.wc6 new file mode 100644 index 000000000..2a957cd7e Binary files /dev/null and b/assets/romfs/wc6/ger/558.wc6 differ diff --git a/assets/romfs/wc6/ger/559.wc6 b/assets/romfs/wc6/ger/559.wc6 new file mode 100644 index 000000000..d8da53b35 Binary files /dev/null and b/assets/romfs/wc6/ger/559.wc6 differ diff --git a/assets/romfs/wc6/ger/560.wc6 b/assets/romfs/wc6/ger/560.wc6 new file mode 100644 index 000000000..d67f4b205 Binary files /dev/null and b/assets/romfs/wc6/ger/560.wc6 differ diff --git a/assets/romfs/wc6/ger/561.wc6 b/assets/romfs/wc6/ger/561.wc6 new file mode 100644 index 000000000..74d4dd340 Binary files /dev/null and b/assets/romfs/wc6/ger/561.wc6 differ diff --git a/assets/romfs/wc6/ger/562.wc6 b/assets/romfs/wc6/ger/562.wc6 new file mode 100644 index 000000000..7f3057762 Binary files /dev/null and b/assets/romfs/wc6/ger/562.wc6 differ diff --git a/assets/romfs/wc6/ger/563.wc6 b/assets/romfs/wc6/ger/563.wc6 new file mode 100644 index 000000000..bb16cb4bf Binary files /dev/null and b/assets/romfs/wc6/ger/563.wc6 differ diff --git a/assets/romfs/wc6/ger/564.wc6 b/assets/romfs/wc6/ger/564.wc6 new file mode 100644 index 000000000..99550693b Binary files /dev/null and b/assets/romfs/wc6/ger/564.wc6 differ diff --git a/assets/romfs/wc6/ger/565.wc6 b/assets/romfs/wc6/ger/565.wc6 new file mode 100644 index 000000000..ca86d1aaf Binary files /dev/null and b/assets/romfs/wc6/ger/565.wc6 differ diff --git a/assets/romfs/wc6/ger/566.wc6 b/assets/romfs/wc6/ger/566.wc6 new file mode 100644 index 000000000..45adb9ad0 Binary files /dev/null and b/assets/romfs/wc6/ger/566.wc6 differ diff --git a/assets/romfs/wc6/ger/567.wc6 b/assets/romfs/wc6/ger/567.wc6 new file mode 100644 index 000000000..d69a32641 Binary files /dev/null and b/assets/romfs/wc6/ger/567.wc6 differ diff --git a/assets/romfs/wc6/ger/569.wc6 b/assets/romfs/wc6/ger/569.wc6 new file mode 100644 index 000000000..9b27a004f Binary files /dev/null and b/assets/romfs/wc6/ger/569.wc6 differ diff --git a/assets/romfs/wc6/ger/570.wc6 b/assets/romfs/wc6/ger/570.wc6 new file mode 100644 index 000000000..2ca965005 Binary files /dev/null and b/assets/romfs/wc6/ger/570.wc6 differ diff --git a/assets/romfs/wc6/ger/571.wc6 b/assets/romfs/wc6/ger/571.wc6 new file mode 100644 index 000000000..44a89b6aa Binary files /dev/null and b/assets/romfs/wc6/ger/571.wc6 differ diff --git a/assets/romfs/wc6/ger/574.wc6 b/assets/romfs/wc6/ger/574.wc6 new file mode 100644 index 000000000..79d2159a1 Binary files /dev/null and b/assets/romfs/wc6/ger/574.wc6 differ diff --git a/assets/romfs/wc6/ger/576.wc6 b/assets/romfs/wc6/ger/576.wc6 new file mode 100644 index 000000000..8cf09c768 Binary files /dev/null and b/assets/romfs/wc6/ger/576.wc6 differ diff --git a/assets/romfs/wc6/ger/577.wc6 b/assets/romfs/wc6/ger/577.wc6 new file mode 100644 index 000000000..550c9667e Binary files /dev/null and b/assets/romfs/wc6/ger/577.wc6 differ diff --git a/assets/romfs/wc6/ger/578.wc6 b/assets/romfs/wc6/ger/578.wc6 new file mode 100644 index 000000000..cb2168a0a Binary files /dev/null and b/assets/romfs/wc6/ger/578.wc6 differ diff --git a/assets/romfs/wc6/ger/586.wc6 b/assets/romfs/wc6/ger/586.wc6 new file mode 100644 index 000000000..06b1f1441 Binary files /dev/null and b/assets/romfs/wc6/ger/586.wc6 differ diff --git a/assets/romfs/wc6/ger/588.wc6 b/assets/romfs/wc6/ger/588.wc6 new file mode 100644 index 000000000..0bc6db72f Binary files /dev/null and b/assets/romfs/wc6/ger/588.wc6 differ diff --git a/assets/romfs/wc6/ger/812.wc6 b/assets/romfs/wc6/ger/812.wc6 new file mode 100644 index 000000000..9592c5dd5 Binary files /dev/null and b/assets/romfs/wc6/ger/812.wc6 differ diff --git a/assets/romfs/wc6/ita/1501.wc6 b/assets/romfs/wc6/ita/1501.wc6 new file mode 100644 index 000000000..f148ceb19 Binary files /dev/null and b/assets/romfs/wc6/ita/1501.wc6 differ diff --git a/assets/romfs/wc6/ita/1503.wc6 b/assets/romfs/wc6/ita/1503.wc6 new file mode 100644 index 000000000..2e1319b2f Binary files /dev/null and b/assets/romfs/wc6/ita/1503.wc6 differ diff --git a/assets/romfs/wc6/ita/1504.wc6 b/assets/romfs/wc6/ita/1504.wc6 new file mode 100644 index 000000000..92e98b6ac Binary files /dev/null and b/assets/romfs/wc6/ita/1504.wc6 differ diff --git a/assets/romfs/wc6/ita/1505.wc6 b/assets/romfs/wc6/ita/1505.wc6 new file mode 100644 index 000000000..e0c00e51e Binary files /dev/null and b/assets/romfs/wc6/ita/1505.wc6 differ diff --git a/assets/romfs/wc6/ita/1506.wc6 b/assets/romfs/wc6/ita/1506.wc6 new file mode 100644 index 000000000..4fa968586 Binary files /dev/null and b/assets/romfs/wc6/ita/1506.wc6 differ diff --git a/assets/romfs/wc6/ita/1507.wc6 b/assets/romfs/wc6/ita/1507.wc6 new file mode 100644 index 000000000..2f1869826 Binary files /dev/null and b/assets/romfs/wc6/ita/1507.wc6 differ diff --git a/assets/romfs/wc6/ita/1508.wc6 b/assets/romfs/wc6/ita/1508.wc6 new file mode 100644 index 000000000..7c7ec3d78 Binary files /dev/null and b/assets/romfs/wc6/ita/1508.wc6 differ diff --git a/assets/romfs/wc6/ita/1509.wc6 b/assets/romfs/wc6/ita/1509.wc6 new file mode 100644 index 000000000..1ec346f01 Binary files /dev/null and b/assets/romfs/wc6/ita/1509.wc6 differ diff --git a/assets/romfs/wc6/ita/1510.wc6 b/assets/romfs/wc6/ita/1510.wc6 new file mode 100644 index 000000000..a58574493 Binary files /dev/null and b/assets/romfs/wc6/ita/1510.wc6 differ diff --git a/assets/romfs/wc6/ita/1511.wc6 b/assets/romfs/wc6/ita/1511.wc6 new file mode 100644 index 000000000..2808fc536 Binary files /dev/null and b/assets/romfs/wc6/ita/1511.wc6 differ diff --git a/assets/romfs/wc6/ita/1512.wc6 b/assets/romfs/wc6/ita/1512.wc6 new file mode 100644 index 000000000..518447313 Binary files /dev/null and b/assets/romfs/wc6/ita/1512.wc6 differ diff --git a/assets/romfs/wc6/ita/1513.wc6 b/assets/romfs/wc6/ita/1513.wc6 new file mode 100644 index 000000000..016d6807a Binary files /dev/null and b/assets/romfs/wc6/ita/1513.wc6 differ diff --git a/assets/romfs/wc6/ita/1514.wc6 b/assets/romfs/wc6/ita/1514.wc6 new file mode 100644 index 000000000..d96098020 Binary files /dev/null and b/assets/romfs/wc6/ita/1514.wc6 differ diff --git a/assets/romfs/wc6/ita/1515.wc6 b/assets/romfs/wc6/ita/1515.wc6 new file mode 100644 index 000000000..1b78ba2cf Binary files /dev/null and b/assets/romfs/wc6/ita/1515.wc6 differ diff --git a/assets/romfs/wc6/ita/1516.wc6 b/assets/romfs/wc6/ita/1516.wc6 new file mode 100644 index 000000000..6bdb705b1 Binary files /dev/null and b/assets/romfs/wc6/ita/1516.wc6 differ diff --git a/assets/romfs/wc6/ita/175.wc6 b/assets/romfs/wc6/ita/175.wc6 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc6/ita/175.wc6 differ diff --git a/assets/romfs/wc6/ita/2048.wc6 b/assets/romfs/wc6/ita/2048.wc6 new file mode 100644 index 000000000..2c50b1328 Binary files /dev/null and b/assets/romfs/wc6/ita/2048.wc6 differ diff --git a/assets/romfs/wc6/ita/504-1.wc6 b/assets/romfs/wc6/ita/504-1.wc6 new file mode 100644 index 000000000..57e266b19 Binary files /dev/null and b/assets/romfs/wc6/ita/504-1.wc6 differ diff --git a/assets/romfs/wc6/ita/504-2.wc6 b/assets/romfs/wc6/ita/504-2.wc6 new file mode 100644 index 000000000..c340630d4 Binary files /dev/null and b/assets/romfs/wc6/ita/504-2.wc6 differ diff --git a/assets/romfs/wc6/ita/510.wc6 b/assets/romfs/wc6/ita/510.wc6 new file mode 100644 index 000000000..2e7193b03 Binary files /dev/null and b/assets/romfs/wc6/ita/510.wc6 differ diff --git a/assets/romfs/wc6/ita/511.wc6 b/assets/romfs/wc6/ita/511.wc6 new file mode 100644 index 000000000..d0ab304fb Binary files /dev/null and b/assets/romfs/wc6/ita/511.wc6 differ diff --git a/assets/romfs/wc6/ita/514.wc6 b/assets/romfs/wc6/ita/514.wc6 new file mode 100644 index 000000000..7d12de731 Binary files /dev/null and b/assets/romfs/wc6/ita/514.wc6 differ diff --git a/assets/romfs/wc6/ita/523.wc6 b/assets/romfs/wc6/ita/523.wc6 new file mode 100644 index 000000000..b8dbd523d Binary files /dev/null and b/assets/romfs/wc6/ita/523.wc6 differ diff --git a/assets/romfs/wc6/ita/524.wc6 b/assets/romfs/wc6/ita/524.wc6 new file mode 100644 index 000000000..52f52ab02 Binary files /dev/null and b/assets/romfs/wc6/ita/524.wc6 differ diff --git a/assets/romfs/wc6/ita/525.wc6 b/assets/romfs/wc6/ita/525.wc6 new file mode 100644 index 000000000..c399fece5 Binary files /dev/null and b/assets/romfs/wc6/ita/525.wc6 differ diff --git a/assets/romfs/wc6/ita/535.wc6 b/assets/romfs/wc6/ita/535.wc6 new file mode 100644 index 000000000..102214c74 Binary files /dev/null and b/assets/romfs/wc6/ita/535.wc6 differ diff --git a/assets/romfs/wc6/ita/537.wc6 b/assets/romfs/wc6/ita/537.wc6 new file mode 100644 index 000000000..2e6374ee9 Binary files /dev/null and b/assets/romfs/wc6/ita/537.wc6 differ diff --git a/assets/romfs/wc6/ita/546.wc6 b/assets/romfs/wc6/ita/546.wc6 new file mode 100644 index 000000000..c1c246e85 Binary files /dev/null and b/assets/romfs/wc6/ita/546.wc6 differ diff --git a/assets/romfs/wc6/ita/547.wc6 b/assets/romfs/wc6/ita/547.wc6 new file mode 100644 index 000000000..47cb86ceb Binary files /dev/null and b/assets/romfs/wc6/ita/547.wc6 differ diff --git a/assets/romfs/wc6/ita/551-1.wc6 b/assets/romfs/wc6/ita/551-1.wc6 new file mode 100644 index 000000000..c64a4d26b Binary files /dev/null and b/assets/romfs/wc6/ita/551-1.wc6 differ diff --git a/assets/romfs/wc6/ita/551-2.wc6 b/assets/romfs/wc6/ita/551-2.wc6 new file mode 100644 index 000000000..f6a911334 Binary files /dev/null and b/assets/romfs/wc6/ita/551-2.wc6 differ diff --git a/assets/romfs/wc6/ita/552-1.wc6 b/assets/romfs/wc6/ita/552-1.wc6 new file mode 100644 index 000000000..aa910903b Binary files /dev/null and b/assets/romfs/wc6/ita/552-1.wc6 differ diff --git a/assets/romfs/wc6/ita/552-2.wc6 b/assets/romfs/wc6/ita/552-2.wc6 new file mode 100644 index 000000000..3a90951b1 Binary files /dev/null and b/assets/romfs/wc6/ita/552-2.wc6 differ diff --git a/assets/romfs/wc6/ita/553.wc6 b/assets/romfs/wc6/ita/553.wc6 new file mode 100644 index 000000000..2d9f63bcb Binary files /dev/null and b/assets/romfs/wc6/ita/553.wc6 differ diff --git a/assets/romfs/wc6/ita/556.wc6 b/assets/romfs/wc6/ita/556.wc6 new file mode 100644 index 000000000..da9206494 Binary files /dev/null and b/assets/romfs/wc6/ita/556.wc6 differ diff --git a/assets/romfs/wc6/ita/557.wc6 b/assets/romfs/wc6/ita/557.wc6 new file mode 100644 index 000000000..455b0f35a Binary files /dev/null and b/assets/romfs/wc6/ita/557.wc6 differ diff --git a/assets/romfs/wc6/ita/558.wc6 b/assets/romfs/wc6/ita/558.wc6 new file mode 100644 index 000000000..f4de24efe Binary files /dev/null and b/assets/romfs/wc6/ita/558.wc6 differ diff --git a/assets/romfs/wc6/ita/559.wc6 b/assets/romfs/wc6/ita/559.wc6 new file mode 100644 index 000000000..27b03b01a Binary files /dev/null and b/assets/romfs/wc6/ita/559.wc6 differ diff --git a/assets/romfs/wc6/ita/560.wc6 b/assets/romfs/wc6/ita/560.wc6 new file mode 100644 index 000000000..8c6acea5a Binary files /dev/null and b/assets/romfs/wc6/ita/560.wc6 differ diff --git a/assets/romfs/wc6/ita/561.wc6 b/assets/romfs/wc6/ita/561.wc6 new file mode 100644 index 000000000..fdaf503d7 Binary files /dev/null and b/assets/romfs/wc6/ita/561.wc6 differ diff --git a/assets/romfs/wc6/ita/562.wc6 b/assets/romfs/wc6/ita/562.wc6 new file mode 100644 index 000000000..296b9648a Binary files /dev/null and b/assets/romfs/wc6/ita/562.wc6 differ diff --git a/assets/romfs/wc6/ita/563.wc6 b/assets/romfs/wc6/ita/563.wc6 new file mode 100644 index 000000000..87ec10c02 Binary files /dev/null and b/assets/romfs/wc6/ita/563.wc6 differ diff --git a/assets/romfs/wc6/ita/564.wc6 b/assets/romfs/wc6/ita/564.wc6 new file mode 100644 index 000000000..ac8b9ae49 Binary files /dev/null and b/assets/romfs/wc6/ita/564.wc6 differ diff --git a/assets/romfs/wc6/ita/565.wc6 b/assets/romfs/wc6/ita/565.wc6 new file mode 100644 index 000000000..991413ff2 Binary files /dev/null and b/assets/romfs/wc6/ita/565.wc6 differ diff --git a/assets/romfs/wc6/ita/566.wc6 b/assets/romfs/wc6/ita/566.wc6 new file mode 100644 index 000000000..6c24eacd9 Binary files /dev/null and b/assets/romfs/wc6/ita/566.wc6 differ diff --git a/assets/romfs/wc6/ita/567.wc6 b/assets/romfs/wc6/ita/567.wc6 new file mode 100644 index 000000000..0c1f36abd Binary files /dev/null and b/assets/romfs/wc6/ita/567.wc6 differ diff --git a/assets/romfs/wc6/ita/569.wc6 b/assets/romfs/wc6/ita/569.wc6 new file mode 100644 index 000000000..8d42a3dbf Binary files /dev/null and b/assets/romfs/wc6/ita/569.wc6 differ diff --git a/assets/romfs/wc6/ita/570.wc6 b/assets/romfs/wc6/ita/570.wc6 new file mode 100644 index 000000000..0b3c1469b Binary files /dev/null and b/assets/romfs/wc6/ita/570.wc6 differ diff --git a/assets/romfs/wc6/ita/571.wc6 b/assets/romfs/wc6/ita/571.wc6 new file mode 100644 index 000000000..0a77d30ce Binary files /dev/null and b/assets/romfs/wc6/ita/571.wc6 differ diff --git a/assets/romfs/wc6/ita/574.wc6 b/assets/romfs/wc6/ita/574.wc6 new file mode 100644 index 000000000..e9c138c2e Binary files /dev/null and b/assets/romfs/wc6/ita/574.wc6 differ diff --git a/assets/romfs/wc6/ita/576.wc6 b/assets/romfs/wc6/ita/576.wc6 new file mode 100644 index 000000000..f6363be5c Binary files /dev/null and b/assets/romfs/wc6/ita/576.wc6 differ diff --git a/assets/romfs/wc6/ita/577.wc6 b/assets/romfs/wc6/ita/577.wc6 new file mode 100644 index 000000000..2123b57cb Binary files /dev/null and b/assets/romfs/wc6/ita/577.wc6 differ diff --git a/assets/romfs/wc6/ita/578.wc6 b/assets/romfs/wc6/ita/578.wc6 new file mode 100644 index 000000000..dd4620a61 Binary files /dev/null and b/assets/romfs/wc6/ita/578.wc6 differ diff --git a/assets/romfs/wc6/ita/580.wc6 b/assets/romfs/wc6/ita/580.wc6 new file mode 100644 index 000000000..2a4bfa3a3 Binary files /dev/null and b/assets/romfs/wc6/ita/580.wc6 differ diff --git a/assets/romfs/wc6/ita/586.wc6 b/assets/romfs/wc6/ita/586.wc6 new file mode 100644 index 000000000..449a7c717 Binary files /dev/null and b/assets/romfs/wc6/ita/586.wc6 differ diff --git a/assets/romfs/wc6/ita/588.wc6 b/assets/romfs/wc6/ita/588.wc6 new file mode 100644 index 000000000..be8027fd9 Binary files /dev/null and b/assets/romfs/wc6/ita/588.wc6 differ diff --git a/assets/romfs/wc6/ita/812.wc6 b/assets/romfs/wc6/ita/812.wc6 new file mode 100644 index 000000000..45ad2165b Binary files /dev/null and b/assets/romfs/wc6/ita/812.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-1.wc6 b/assets/romfs/wc6/jpn/1-1.wc6 new file mode 100644 index 000000000..6f32ddcae Binary files /dev/null and b/assets/romfs/wc6/jpn/1-1.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-10.wc6 b/assets/romfs/wc6/jpn/1-10.wc6 new file mode 100644 index 000000000..2053b1778 Binary files /dev/null and b/assets/romfs/wc6/jpn/1-10.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-2.wc6 b/assets/romfs/wc6/jpn/1-2.wc6 new file mode 100644 index 000000000..df8761652 Binary files /dev/null and b/assets/romfs/wc6/jpn/1-2.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-3.wc6 b/assets/romfs/wc6/jpn/1-3.wc6 new file mode 100644 index 000000000..e4c184a4c Binary files /dev/null and b/assets/romfs/wc6/jpn/1-3.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-4.wc6 b/assets/romfs/wc6/jpn/1-4.wc6 new file mode 100644 index 000000000..b7fed7eac Binary files /dev/null and b/assets/romfs/wc6/jpn/1-4.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-5.wc6 b/assets/romfs/wc6/jpn/1-5.wc6 new file mode 100644 index 000000000..81da86c3a Binary files /dev/null and b/assets/romfs/wc6/jpn/1-5.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-6.wc6 b/assets/romfs/wc6/jpn/1-6.wc6 new file mode 100644 index 000000000..bd5b3fee9 Binary files /dev/null and b/assets/romfs/wc6/jpn/1-6.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-7.wc6 b/assets/romfs/wc6/jpn/1-7.wc6 new file mode 100644 index 000000000..b9baa4329 Binary files /dev/null and b/assets/romfs/wc6/jpn/1-7.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-8.wc6 b/assets/romfs/wc6/jpn/1-8.wc6 new file mode 100644 index 000000000..287824474 Binary files /dev/null and b/assets/romfs/wc6/jpn/1-8.wc6 differ diff --git a/assets/romfs/wc6/jpn/1-9.wc6 b/assets/romfs/wc6/jpn/1-9.wc6 new file mode 100644 index 000000000..5a4b661e1 Binary files /dev/null and b/assets/romfs/wc6/jpn/1-9.wc6 differ diff --git a/assets/romfs/wc6/jpn/100.wc6 b/assets/romfs/wc6/jpn/100.wc6 new file mode 100644 index 000000000..abd24824f Binary files /dev/null and b/assets/romfs/wc6/jpn/100.wc6 differ diff --git a/assets/romfs/wc6/jpn/101.wc6 b/assets/romfs/wc6/jpn/101.wc6 new file mode 100644 index 000000000..c314d48d3 Binary files /dev/null and b/assets/romfs/wc6/jpn/101.wc6 differ diff --git a/assets/romfs/wc6/jpn/102.wc6 b/assets/romfs/wc6/jpn/102.wc6 new file mode 100644 index 000000000..bf416b071 Binary files /dev/null and b/assets/romfs/wc6/jpn/102.wc6 differ diff --git a/assets/romfs/wc6/jpn/107.wc6 b/assets/romfs/wc6/jpn/107.wc6 new file mode 100644 index 000000000..4e039a8b6 Binary files /dev/null and b/assets/romfs/wc6/jpn/107.wc6 differ diff --git a/assets/romfs/wc6/jpn/108-1.wc6 b/assets/romfs/wc6/jpn/108-1.wc6 new file mode 100644 index 000000000..1570eb5d4 Binary files /dev/null and b/assets/romfs/wc6/jpn/108-1.wc6 differ diff --git a/assets/romfs/wc6/jpn/108-2.wc6 b/assets/romfs/wc6/jpn/108-2.wc6 new file mode 100644 index 000000000..623c608ed Binary files /dev/null and b/assets/romfs/wc6/jpn/108-2.wc6 differ diff --git a/assets/romfs/wc6/jpn/109.wc6 b/assets/romfs/wc6/jpn/109.wc6 new file mode 100644 index 000000000..7686877b6 Binary files /dev/null and b/assets/romfs/wc6/jpn/109.wc6 differ diff --git a/assets/romfs/wc6/jpn/110.wc6 b/assets/romfs/wc6/jpn/110.wc6 new file mode 100644 index 000000000..5a3b90dba Binary files /dev/null and b/assets/romfs/wc6/jpn/110.wc6 differ diff --git a/assets/romfs/wc6/jpn/111.wc6 b/assets/romfs/wc6/jpn/111.wc6 new file mode 100644 index 000000000..2578e0552 Binary files /dev/null and b/assets/romfs/wc6/jpn/111.wc6 differ diff --git a/assets/romfs/wc6/jpn/112.wc6 b/assets/romfs/wc6/jpn/112.wc6 new file mode 100644 index 000000000..443dcb235 Binary files /dev/null and b/assets/romfs/wc6/jpn/112.wc6 differ diff --git a/assets/romfs/wc6/jpn/113.wc6 b/assets/romfs/wc6/jpn/113.wc6 new file mode 100644 index 000000000..88f58bbb5 Binary files /dev/null and b/assets/romfs/wc6/jpn/113.wc6 differ diff --git a/assets/romfs/wc6/jpn/114.wc6 b/assets/romfs/wc6/jpn/114.wc6 new file mode 100644 index 000000000..71a8a79dc Binary files /dev/null and b/assets/romfs/wc6/jpn/114.wc6 differ diff --git a/assets/romfs/wc6/jpn/115.wc6 b/assets/romfs/wc6/jpn/115.wc6 new file mode 100644 index 000000000..c612d00fb Binary files /dev/null and b/assets/romfs/wc6/jpn/115.wc6 differ diff --git a/assets/romfs/wc6/jpn/116.wc6 b/assets/romfs/wc6/jpn/116.wc6 new file mode 100644 index 000000000..50016469d Binary files /dev/null and b/assets/romfs/wc6/jpn/116.wc6 differ diff --git a/assets/romfs/wc6/jpn/117.wc6 b/assets/romfs/wc6/jpn/117.wc6 new file mode 100644 index 000000000..8739f2b6f Binary files /dev/null and b/assets/romfs/wc6/jpn/117.wc6 differ diff --git a/assets/romfs/wc6/jpn/119.wc6 b/assets/romfs/wc6/jpn/119.wc6 new file mode 100644 index 000000000..622fbd7b7 Binary files /dev/null and b/assets/romfs/wc6/jpn/119.wc6 differ diff --git a/assets/romfs/wc6/jpn/12.wc6 b/assets/romfs/wc6/jpn/12.wc6 new file mode 100644 index 000000000..bfeb38d68 Binary files /dev/null and b/assets/romfs/wc6/jpn/12.wc6 differ diff --git a/assets/romfs/wc6/jpn/120.wc6 b/assets/romfs/wc6/jpn/120.wc6 new file mode 100644 index 000000000..de60d6fde Binary files /dev/null and b/assets/romfs/wc6/jpn/120.wc6 differ diff --git a/assets/romfs/wc6/jpn/121.wc6 b/assets/romfs/wc6/jpn/121.wc6 new file mode 100644 index 000000000..ea26a622f Binary files /dev/null and b/assets/romfs/wc6/jpn/121.wc6 differ diff --git a/assets/romfs/wc6/jpn/122.wc6 b/assets/romfs/wc6/jpn/122.wc6 new file mode 100644 index 000000000..7e82c0271 Binary files /dev/null and b/assets/romfs/wc6/jpn/122.wc6 differ diff --git a/assets/romfs/wc6/jpn/127.wc6 b/assets/romfs/wc6/jpn/127.wc6 new file mode 100644 index 000000000..f9a76c56f Binary files /dev/null and b/assets/romfs/wc6/jpn/127.wc6 differ diff --git a/assets/romfs/wc6/jpn/128.wc6 b/assets/romfs/wc6/jpn/128.wc6 new file mode 100644 index 000000000..6ed3e2c50 Binary files /dev/null and b/assets/romfs/wc6/jpn/128.wc6 differ diff --git a/assets/romfs/wc6/jpn/129.wc6 b/assets/romfs/wc6/jpn/129.wc6 new file mode 100644 index 000000000..3fa8dd223 Binary files /dev/null and b/assets/romfs/wc6/jpn/129.wc6 differ diff --git a/assets/romfs/wc6/jpn/130.wc6 b/assets/romfs/wc6/jpn/130.wc6 new file mode 100644 index 000000000..f01339627 Binary files /dev/null and b/assets/romfs/wc6/jpn/130.wc6 differ diff --git a/assets/romfs/wc6/jpn/131.wc6 b/assets/romfs/wc6/jpn/131.wc6 new file mode 100644 index 000000000..d38f2cd25 Binary files /dev/null and b/assets/romfs/wc6/jpn/131.wc6 differ diff --git a/assets/romfs/wc6/jpn/136-1.wc6 b/assets/romfs/wc6/jpn/136-1.wc6 new file mode 100644 index 000000000..ad6b1371f Binary files /dev/null and b/assets/romfs/wc6/jpn/136-1.wc6 differ diff --git a/assets/romfs/wc6/jpn/136-2.wc6 b/assets/romfs/wc6/jpn/136-2.wc6 new file mode 100644 index 000000000..3e80c1696 Binary files /dev/null and b/assets/romfs/wc6/jpn/136-2.wc6 differ diff --git a/assets/romfs/wc6/jpn/136-3.wc6 b/assets/romfs/wc6/jpn/136-3.wc6 new file mode 100644 index 000000000..a6244bdfa Binary files /dev/null and b/assets/romfs/wc6/jpn/136-3.wc6 differ diff --git a/assets/romfs/wc6/jpn/136-4.wc6 b/assets/romfs/wc6/jpn/136-4.wc6 new file mode 100644 index 000000000..8d04ff171 Binary files /dev/null and b/assets/romfs/wc6/jpn/136-4.wc6 differ diff --git a/assets/romfs/wc6/jpn/137.wc6 b/assets/romfs/wc6/jpn/137.wc6 new file mode 100644 index 000000000..706ab912f Binary files /dev/null and b/assets/romfs/wc6/jpn/137.wc6 differ diff --git a/assets/romfs/wc6/jpn/138.wc6 b/assets/romfs/wc6/jpn/138.wc6 new file mode 100644 index 000000000..5e37d483f Binary files /dev/null and b/assets/romfs/wc6/jpn/138.wc6 differ diff --git a/assets/romfs/wc6/jpn/141.wc6 b/assets/romfs/wc6/jpn/141.wc6 new file mode 100644 index 000000000..a20575c7d Binary files /dev/null and b/assets/romfs/wc6/jpn/141.wc6 differ diff --git a/assets/romfs/wc6/jpn/145.wc6 b/assets/romfs/wc6/jpn/145.wc6 new file mode 100644 index 000000000..9b8e7a8a6 Binary files /dev/null and b/assets/romfs/wc6/jpn/145.wc6 differ diff --git a/assets/romfs/wc6/jpn/146.wc6 b/assets/romfs/wc6/jpn/146.wc6 new file mode 100644 index 000000000..66f0de648 Binary files /dev/null and b/assets/romfs/wc6/jpn/146.wc6 differ diff --git a/assets/romfs/wc6/jpn/147.wc6 b/assets/romfs/wc6/jpn/147.wc6 new file mode 100644 index 000000000..12fbb9043 Binary files /dev/null and b/assets/romfs/wc6/jpn/147.wc6 differ diff --git a/assets/romfs/wc6/jpn/148.wc6 b/assets/romfs/wc6/jpn/148.wc6 new file mode 100644 index 000000000..31914e564 Binary files /dev/null and b/assets/romfs/wc6/jpn/148.wc6 differ diff --git a/assets/romfs/wc6/jpn/149.wc6 b/assets/romfs/wc6/jpn/149.wc6 new file mode 100644 index 000000000..3c6f3b293 Binary files /dev/null and b/assets/romfs/wc6/jpn/149.wc6 differ diff --git a/assets/romfs/wc6/jpn/15.wc6 b/assets/romfs/wc6/jpn/15.wc6 new file mode 100644 index 000000000..623324fd0 Binary files /dev/null and b/assets/romfs/wc6/jpn/15.wc6 differ diff --git a/assets/romfs/wc6/jpn/150.wc6 b/assets/romfs/wc6/jpn/150.wc6 new file mode 100644 index 000000000..1f8d34547 Binary files /dev/null and b/assets/romfs/wc6/jpn/150.wc6 differ diff --git a/assets/romfs/wc6/jpn/1501.wc6 b/assets/romfs/wc6/jpn/1501.wc6 new file mode 100644 index 000000000..ee0fe6c3b Binary files /dev/null and b/assets/romfs/wc6/jpn/1501.wc6 differ diff --git a/assets/romfs/wc6/jpn/1503.wc6 b/assets/romfs/wc6/jpn/1503.wc6 new file mode 100644 index 000000000..a849905c7 Binary files /dev/null and b/assets/romfs/wc6/jpn/1503.wc6 differ diff --git a/assets/romfs/wc6/jpn/1504.wc6 b/assets/romfs/wc6/jpn/1504.wc6 new file mode 100644 index 000000000..1192de29a Binary files /dev/null and b/assets/romfs/wc6/jpn/1504.wc6 differ diff --git a/assets/romfs/wc6/jpn/1505.wc6 b/assets/romfs/wc6/jpn/1505.wc6 new file mode 100644 index 000000000..6738e1d23 Binary files /dev/null and b/assets/romfs/wc6/jpn/1505.wc6 differ diff --git a/assets/romfs/wc6/jpn/1506.wc6 b/assets/romfs/wc6/jpn/1506.wc6 new file mode 100644 index 000000000..ea88f25c4 Binary files /dev/null and b/assets/romfs/wc6/jpn/1506.wc6 differ diff --git a/assets/romfs/wc6/jpn/1507.wc6 b/assets/romfs/wc6/jpn/1507.wc6 new file mode 100644 index 000000000..96fc994f6 Binary files /dev/null and b/assets/romfs/wc6/jpn/1507.wc6 differ diff --git a/assets/romfs/wc6/jpn/1508.wc6 b/assets/romfs/wc6/jpn/1508.wc6 new file mode 100644 index 000000000..175e15ddb Binary files /dev/null and b/assets/romfs/wc6/jpn/1508.wc6 differ diff --git a/assets/romfs/wc6/jpn/1509.wc6 b/assets/romfs/wc6/jpn/1509.wc6 new file mode 100644 index 000000000..7c04b012f Binary files /dev/null and b/assets/romfs/wc6/jpn/1509.wc6 differ diff --git a/assets/romfs/wc6/jpn/151.wc6 b/assets/romfs/wc6/jpn/151.wc6 new file mode 100644 index 000000000..beda91d05 Binary files /dev/null and b/assets/romfs/wc6/jpn/151.wc6 differ diff --git a/assets/romfs/wc6/jpn/1510.wc6 b/assets/romfs/wc6/jpn/1510.wc6 new file mode 100644 index 000000000..a38e24b77 Binary files /dev/null and b/assets/romfs/wc6/jpn/1510.wc6 differ diff --git a/assets/romfs/wc6/jpn/1511.wc6 b/assets/romfs/wc6/jpn/1511.wc6 new file mode 100644 index 000000000..97369ac6d Binary files /dev/null and b/assets/romfs/wc6/jpn/1511.wc6 differ diff --git a/assets/romfs/wc6/jpn/1512.wc6 b/assets/romfs/wc6/jpn/1512.wc6 new file mode 100644 index 000000000..6db491e93 Binary files /dev/null and b/assets/romfs/wc6/jpn/1512.wc6 differ diff --git a/assets/romfs/wc6/jpn/1513.wc6 b/assets/romfs/wc6/jpn/1513.wc6 new file mode 100644 index 000000000..7d8472b0a Binary files /dev/null and b/assets/romfs/wc6/jpn/1513.wc6 differ diff --git a/assets/romfs/wc6/jpn/1514.wc6 b/assets/romfs/wc6/jpn/1514.wc6 new file mode 100644 index 000000000..038f2a515 Binary files /dev/null and b/assets/romfs/wc6/jpn/1514.wc6 differ diff --git a/assets/romfs/wc6/jpn/1515.wc6 b/assets/romfs/wc6/jpn/1515.wc6 new file mode 100644 index 000000000..48e843b0e Binary files /dev/null and b/assets/romfs/wc6/jpn/1515.wc6 differ diff --git a/assets/romfs/wc6/jpn/1516.wc6 b/assets/romfs/wc6/jpn/1516.wc6 new file mode 100644 index 000000000..5e4c57721 Binary files /dev/null and b/assets/romfs/wc6/jpn/1516.wc6 differ diff --git a/assets/romfs/wc6/jpn/152.wc6 b/assets/romfs/wc6/jpn/152.wc6 new file mode 100644 index 000000000..ebc31c5b6 Binary files /dev/null and b/assets/romfs/wc6/jpn/152.wc6 differ diff --git a/assets/romfs/wc6/jpn/153.wc6 b/assets/romfs/wc6/jpn/153.wc6 new file mode 100644 index 000000000..569c07ab4 Binary files /dev/null and b/assets/romfs/wc6/jpn/153.wc6 differ diff --git a/assets/romfs/wc6/jpn/154.wc6 b/assets/romfs/wc6/jpn/154.wc6 new file mode 100644 index 000000000..7b31b83f4 Binary files /dev/null and b/assets/romfs/wc6/jpn/154.wc6 differ diff --git a/assets/romfs/wc6/jpn/155.wc6 b/assets/romfs/wc6/jpn/155.wc6 new file mode 100644 index 000000000..e545bf18b Binary files /dev/null and b/assets/romfs/wc6/jpn/155.wc6 differ diff --git a/assets/romfs/wc6/jpn/156.wc6 b/assets/romfs/wc6/jpn/156.wc6 new file mode 100644 index 000000000..cddedc39d Binary files /dev/null and b/assets/romfs/wc6/jpn/156.wc6 differ diff --git a/assets/romfs/wc6/jpn/157.wc6 b/assets/romfs/wc6/jpn/157.wc6 new file mode 100644 index 000000000..4f313b7bb Binary files /dev/null and b/assets/romfs/wc6/jpn/157.wc6 differ diff --git a/assets/romfs/wc6/jpn/158.wc6 b/assets/romfs/wc6/jpn/158.wc6 new file mode 100644 index 000000000..4bc30c043 Binary files /dev/null and b/assets/romfs/wc6/jpn/158.wc6 differ diff --git a/assets/romfs/wc6/jpn/159.wc6 b/assets/romfs/wc6/jpn/159.wc6 new file mode 100644 index 000000000..8c4b63a50 Binary files /dev/null and b/assets/romfs/wc6/jpn/159.wc6 differ diff --git a/assets/romfs/wc6/jpn/161.wc6 b/assets/romfs/wc6/jpn/161.wc6 new file mode 100644 index 000000000..5784388e1 Binary files /dev/null and b/assets/romfs/wc6/jpn/161.wc6 differ diff --git a/assets/romfs/wc6/jpn/162.wc6 b/assets/romfs/wc6/jpn/162.wc6 new file mode 100644 index 000000000..46626dac0 Binary files /dev/null and b/assets/romfs/wc6/jpn/162.wc6 differ diff --git a/assets/romfs/wc6/jpn/163.wc6 b/assets/romfs/wc6/jpn/163.wc6 new file mode 100644 index 000000000..7d26fa4ed Binary files /dev/null and b/assets/romfs/wc6/jpn/163.wc6 differ diff --git a/assets/romfs/wc6/jpn/164.wc6 b/assets/romfs/wc6/jpn/164.wc6 new file mode 100644 index 000000000..1a527ed6f Binary files /dev/null and b/assets/romfs/wc6/jpn/164.wc6 differ diff --git a/assets/romfs/wc6/jpn/165.wc6 b/assets/romfs/wc6/jpn/165.wc6 new file mode 100644 index 000000000..bcde878f3 Binary files /dev/null and b/assets/romfs/wc6/jpn/165.wc6 differ diff --git a/assets/romfs/wc6/jpn/166.wc6 b/assets/romfs/wc6/jpn/166.wc6 new file mode 100644 index 000000000..5f6ba5367 Binary files /dev/null and b/assets/romfs/wc6/jpn/166.wc6 differ diff --git a/assets/romfs/wc6/jpn/167.wc6 b/assets/romfs/wc6/jpn/167.wc6 new file mode 100644 index 000000000..a90a5505e Binary files /dev/null and b/assets/romfs/wc6/jpn/167.wc6 differ diff --git a/assets/romfs/wc6/jpn/168.wc6 b/assets/romfs/wc6/jpn/168.wc6 new file mode 100644 index 000000000..0d012925d Binary files /dev/null and b/assets/romfs/wc6/jpn/168.wc6 differ diff --git a/assets/romfs/wc6/jpn/169.wc6 b/assets/romfs/wc6/jpn/169.wc6 new file mode 100644 index 000000000..3cef6961f Binary files /dev/null and b/assets/romfs/wc6/jpn/169.wc6 differ diff --git a/assets/romfs/wc6/jpn/170.wc6 b/assets/romfs/wc6/jpn/170.wc6 new file mode 100644 index 000000000..e7923c4e8 Binary files /dev/null and b/assets/romfs/wc6/jpn/170.wc6 differ diff --git a/assets/romfs/wc6/jpn/171.wc6 b/assets/romfs/wc6/jpn/171.wc6 new file mode 100644 index 000000000..373d73f0a Binary files /dev/null and b/assets/romfs/wc6/jpn/171.wc6 differ diff --git a/assets/romfs/wc6/jpn/173.wc6 b/assets/romfs/wc6/jpn/173.wc6 new file mode 100644 index 000000000..11a5c5f36 Binary files /dev/null and b/assets/romfs/wc6/jpn/173.wc6 differ diff --git a/assets/romfs/wc6/jpn/174.pk6 b/assets/romfs/wc6/jpn/174.pk6 new file mode 100644 index 000000000..40e4e0c7c Binary files /dev/null and b/assets/romfs/wc6/jpn/174.pk6 differ diff --git a/assets/romfs/wc6/jpn/175.wc6 b/assets/romfs/wc6/jpn/175.wc6 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc6/jpn/175.wc6 differ diff --git a/assets/romfs/wc6/jpn/176.wc6 b/assets/romfs/wc6/jpn/176.wc6 new file mode 100644 index 000000000..dd341c0c8 Binary files /dev/null and b/assets/romfs/wc6/jpn/176.wc6 differ diff --git a/assets/romfs/wc6/jpn/177.wc6 b/assets/romfs/wc6/jpn/177.wc6 new file mode 100644 index 000000000..5d356dbe9 Binary files /dev/null and b/assets/romfs/wc6/jpn/177.wc6 differ diff --git a/assets/romfs/wc6/jpn/178.wc6 b/assets/romfs/wc6/jpn/178.wc6 new file mode 100644 index 000000000..33b45b078 Binary files /dev/null and b/assets/romfs/wc6/jpn/178.wc6 differ diff --git a/assets/romfs/wc6/jpn/179.wc6 b/assets/romfs/wc6/jpn/179.wc6 new file mode 100644 index 000000000..ee53fb213 Binary files /dev/null and b/assets/romfs/wc6/jpn/179.wc6 differ diff --git a/assets/romfs/wc6/jpn/180.wc6 b/assets/romfs/wc6/jpn/180.wc6 new file mode 100644 index 000000000..273df2c35 Binary files /dev/null and b/assets/romfs/wc6/jpn/180.wc6 differ diff --git a/assets/romfs/wc6/jpn/181.wc6 b/assets/romfs/wc6/jpn/181.wc6 new file mode 100644 index 000000000..9e79cd762 Binary files /dev/null and b/assets/romfs/wc6/jpn/181.wc6 differ diff --git a/assets/romfs/wc6/jpn/182.wc6 b/assets/romfs/wc6/jpn/182.wc6 new file mode 100644 index 000000000..86f3181a9 Binary files /dev/null and b/assets/romfs/wc6/jpn/182.wc6 differ diff --git a/assets/romfs/wc6/jpn/19.wc6 b/assets/romfs/wc6/jpn/19.wc6 new file mode 100644 index 000000000..95cae04f1 Binary files /dev/null and b/assets/romfs/wc6/jpn/19.wc6 differ diff --git a/assets/romfs/wc6/jpn/2.wc6 b/assets/romfs/wc6/jpn/2.wc6 new file mode 100644 index 000000000..b4db4e9a0 Binary files /dev/null and b/assets/romfs/wc6/jpn/2.wc6 differ diff --git a/assets/romfs/wc6/jpn/20.wc6 b/assets/romfs/wc6/jpn/20.wc6 new file mode 100644 index 000000000..3bc8db6f0 Binary files /dev/null and b/assets/romfs/wc6/jpn/20.wc6 differ diff --git a/assets/romfs/wc6/jpn/2048.wc6 b/assets/romfs/wc6/jpn/2048.wc6 new file mode 100644 index 000000000..eded30595 Binary files /dev/null and b/assets/romfs/wc6/jpn/2048.wc6 differ diff --git a/assets/romfs/wc6/jpn/21.wc6 b/assets/romfs/wc6/jpn/21.wc6 new file mode 100644 index 000000000..89faa1a9a Binary files /dev/null and b/assets/romfs/wc6/jpn/21.wc6 differ diff --git a/assets/romfs/wc6/jpn/22.wc6 b/assets/romfs/wc6/jpn/22.wc6 new file mode 100644 index 000000000..7f32efd9f Binary files /dev/null and b/assets/romfs/wc6/jpn/22.wc6 differ diff --git a/assets/romfs/wc6/jpn/25.wc6 b/assets/romfs/wc6/jpn/25.wc6 new file mode 100644 index 000000000..2f90bcb32 Binary files /dev/null and b/assets/romfs/wc6/jpn/25.wc6 differ diff --git a/assets/romfs/wc6/jpn/26.wc6 b/assets/romfs/wc6/jpn/26.wc6 new file mode 100644 index 000000000..189fe87b5 Binary files /dev/null and b/assets/romfs/wc6/jpn/26.wc6 differ diff --git a/assets/romfs/wc6/jpn/27.wc6 b/assets/romfs/wc6/jpn/27.wc6 new file mode 100644 index 000000000..00a8de4fd Binary files /dev/null and b/assets/romfs/wc6/jpn/27.wc6 differ diff --git a/assets/romfs/wc6/jpn/28.wc6 b/assets/romfs/wc6/jpn/28.wc6 new file mode 100644 index 000000000..3791e714a Binary files /dev/null and b/assets/romfs/wc6/jpn/28.wc6 differ diff --git a/assets/romfs/wc6/jpn/29.wc6 b/assets/romfs/wc6/jpn/29.wc6 new file mode 100644 index 000000000..5937366cc Binary files /dev/null and b/assets/romfs/wc6/jpn/29.wc6 differ diff --git a/assets/romfs/wc6/jpn/3.wc6 b/assets/romfs/wc6/jpn/3.wc6 new file mode 100644 index 000000000..d21292054 Binary files /dev/null and b/assets/romfs/wc6/jpn/3.wc6 differ diff --git a/assets/romfs/wc6/jpn/30.wc6 b/assets/romfs/wc6/jpn/30.wc6 new file mode 100644 index 000000000..db0f205dc Binary files /dev/null and b/assets/romfs/wc6/jpn/30.wc6 differ diff --git a/assets/romfs/wc6/jpn/33.wc6 b/assets/romfs/wc6/jpn/33.wc6 new file mode 100644 index 000000000..4657a0170 Binary files /dev/null and b/assets/romfs/wc6/jpn/33.wc6 differ diff --git a/assets/romfs/wc6/jpn/34.wc6 b/assets/romfs/wc6/jpn/34.wc6 new file mode 100644 index 000000000..f849258f8 Binary files /dev/null and b/assets/romfs/wc6/jpn/34.wc6 differ diff --git a/assets/romfs/wc6/jpn/37.wc6 b/assets/romfs/wc6/jpn/37.wc6 new file mode 100644 index 000000000..b9d610bd8 Binary files /dev/null and b/assets/romfs/wc6/jpn/37.wc6 differ diff --git a/assets/romfs/wc6/jpn/38.wc6 b/assets/romfs/wc6/jpn/38.wc6 new file mode 100644 index 000000000..073bedb61 Binary files /dev/null and b/assets/romfs/wc6/jpn/38.wc6 differ diff --git a/assets/romfs/wc6/jpn/39.wc6 b/assets/romfs/wc6/jpn/39.wc6 new file mode 100644 index 000000000..9c61fe1a2 Binary files /dev/null and b/assets/romfs/wc6/jpn/39.wc6 differ diff --git a/assets/romfs/wc6/jpn/4.wc6 b/assets/romfs/wc6/jpn/4.wc6 new file mode 100644 index 000000000..a36d7a5ac Binary files /dev/null and b/assets/romfs/wc6/jpn/4.wc6 differ diff --git a/assets/romfs/wc6/jpn/40.wc6 b/assets/romfs/wc6/jpn/40.wc6 new file mode 100644 index 000000000..8c3bda8ac Binary files /dev/null and b/assets/romfs/wc6/jpn/40.wc6 differ diff --git a/assets/romfs/wc6/jpn/41.wc6 b/assets/romfs/wc6/jpn/41.wc6 new file mode 100644 index 000000000..32148c1b0 Binary files /dev/null and b/assets/romfs/wc6/jpn/41.wc6 differ diff --git a/assets/romfs/wc6/jpn/42.wc6 b/assets/romfs/wc6/jpn/42.wc6 new file mode 100644 index 000000000..c95bc1fcb Binary files /dev/null and b/assets/romfs/wc6/jpn/42.wc6 differ diff --git a/assets/romfs/wc6/jpn/44.wc6 b/assets/romfs/wc6/jpn/44.wc6 new file mode 100644 index 000000000..177e6ecd4 Binary files /dev/null and b/assets/romfs/wc6/jpn/44.wc6 differ diff --git a/assets/romfs/wc6/jpn/45.wc6 b/assets/romfs/wc6/jpn/45.wc6 new file mode 100644 index 000000000..c16b784d4 Binary files /dev/null and b/assets/romfs/wc6/jpn/45.wc6 differ diff --git a/assets/romfs/wc6/jpn/48-1.wc6 b/assets/romfs/wc6/jpn/48-1.wc6 new file mode 100644 index 000000000..ef8489258 Binary files /dev/null and b/assets/romfs/wc6/jpn/48-1.wc6 differ diff --git a/assets/romfs/wc6/jpn/48-2.wc6 b/assets/romfs/wc6/jpn/48-2.wc6 new file mode 100644 index 000000000..68bbc9d52 Binary files /dev/null and b/assets/romfs/wc6/jpn/48-2.wc6 differ diff --git a/assets/romfs/wc6/jpn/48-3.wc6 b/assets/romfs/wc6/jpn/48-3.wc6 new file mode 100644 index 000000000..ffd842c75 Binary files /dev/null and b/assets/romfs/wc6/jpn/48-3.wc6 differ diff --git a/assets/romfs/wc6/jpn/48-4.wc6 b/assets/romfs/wc6/jpn/48-4.wc6 new file mode 100644 index 000000000..f2ca9fb4a Binary files /dev/null and b/assets/romfs/wc6/jpn/48-4.wc6 differ diff --git a/assets/romfs/wc6/jpn/50.wc6 b/assets/romfs/wc6/jpn/50.wc6 new file mode 100644 index 000000000..cbd2b9734 Binary files /dev/null and b/assets/romfs/wc6/jpn/50.wc6 differ diff --git a/assets/romfs/wc6/jpn/51.wc6 b/assets/romfs/wc6/jpn/51.wc6 new file mode 100644 index 000000000..631e3aeea Binary files /dev/null and b/assets/romfs/wc6/jpn/51.wc6 differ diff --git a/assets/romfs/wc6/jpn/52.wc6 b/assets/romfs/wc6/jpn/52.wc6 new file mode 100644 index 000000000..275185933 Binary files /dev/null and b/assets/romfs/wc6/jpn/52.wc6 differ diff --git a/assets/romfs/wc6/jpn/53.wc6 b/assets/romfs/wc6/jpn/53.wc6 new file mode 100644 index 000000000..05032c334 Binary files /dev/null and b/assets/romfs/wc6/jpn/53.wc6 differ diff --git a/assets/romfs/wc6/jpn/535.wc6 b/assets/romfs/wc6/jpn/535.wc6 new file mode 100644 index 000000000..102214c74 Binary files /dev/null and b/assets/romfs/wc6/jpn/535.wc6 differ diff --git a/assets/romfs/wc6/jpn/54.wc6 b/assets/romfs/wc6/jpn/54.wc6 new file mode 100644 index 000000000..31525581a Binary files /dev/null and b/assets/romfs/wc6/jpn/54.wc6 differ diff --git a/assets/romfs/wc6/jpn/55.wc6 b/assets/romfs/wc6/jpn/55.wc6 new file mode 100644 index 000000000..79638b70b Binary files /dev/null and b/assets/romfs/wc6/jpn/55.wc6 differ diff --git a/assets/romfs/wc6/jpn/56.wc6 b/assets/romfs/wc6/jpn/56.wc6 new file mode 100644 index 000000000..12ea77b5a Binary files /dev/null and b/assets/romfs/wc6/jpn/56.wc6 differ diff --git a/assets/romfs/wc6/jpn/57.wc6 b/assets/romfs/wc6/jpn/57.wc6 new file mode 100644 index 000000000..2c65ce533 Binary files /dev/null and b/assets/romfs/wc6/jpn/57.wc6 differ diff --git a/assets/romfs/wc6/jpn/58.wc6 b/assets/romfs/wc6/jpn/58.wc6 new file mode 100644 index 000000000..254201c3c Binary files /dev/null and b/assets/romfs/wc6/jpn/58.wc6 differ diff --git a/assets/romfs/wc6/jpn/588.wc6 b/assets/romfs/wc6/jpn/588.wc6 new file mode 100644 index 000000000..f034bdb4f Binary files /dev/null and b/assets/romfs/wc6/jpn/588.wc6 differ diff --git a/assets/romfs/wc6/jpn/59.wc6 b/assets/romfs/wc6/jpn/59.wc6 new file mode 100644 index 000000000..e3a90a921 Binary files /dev/null and b/assets/romfs/wc6/jpn/59.wc6 differ diff --git a/assets/romfs/wc6/jpn/60.wc6 b/assets/romfs/wc6/jpn/60.wc6 new file mode 100644 index 000000000..d626e41bc Binary files /dev/null and b/assets/romfs/wc6/jpn/60.wc6 differ diff --git a/assets/romfs/wc6/jpn/61.wc6 b/assets/romfs/wc6/jpn/61.wc6 new file mode 100644 index 000000000..f900eab95 Binary files /dev/null and b/assets/romfs/wc6/jpn/61.wc6 differ diff --git a/assets/romfs/wc6/jpn/62.wc6 b/assets/romfs/wc6/jpn/62.wc6 new file mode 100644 index 000000000..c4530b083 Binary files /dev/null and b/assets/romfs/wc6/jpn/62.wc6 differ diff --git a/assets/romfs/wc6/jpn/63.wc6 b/assets/romfs/wc6/jpn/63.wc6 new file mode 100644 index 000000000..88068f0e0 Binary files /dev/null and b/assets/romfs/wc6/jpn/63.wc6 differ diff --git a/assets/romfs/wc6/jpn/64.wc6 b/assets/romfs/wc6/jpn/64.wc6 new file mode 100644 index 000000000..44fe77af4 Binary files /dev/null and b/assets/romfs/wc6/jpn/64.wc6 differ diff --git a/assets/romfs/wc6/jpn/65.wc6 b/assets/romfs/wc6/jpn/65.wc6 new file mode 100644 index 000000000..2dfef56cf Binary files /dev/null and b/assets/romfs/wc6/jpn/65.wc6 differ diff --git a/assets/romfs/wc6/jpn/66.wc6 b/assets/romfs/wc6/jpn/66.wc6 new file mode 100644 index 000000000..d4141c850 Binary files /dev/null and b/assets/romfs/wc6/jpn/66.wc6 differ diff --git a/assets/romfs/wc6/jpn/67.wc6 b/assets/romfs/wc6/jpn/67.wc6 new file mode 100644 index 000000000..5ef6a88e7 Binary files /dev/null and b/assets/romfs/wc6/jpn/67.wc6 differ diff --git a/assets/romfs/wc6/jpn/71-1.wc6 b/assets/romfs/wc6/jpn/71-1.wc6 new file mode 100644 index 000000000..7807029ea Binary files /dev/null and b/assets/romfs/wc6/jpn/71-1.wc6 differ diff --git a/assets/romfs/wc6/jpn/71-2.wc6 b/assets/romfs/wc6/jpn/71-2.wc6 new file mode 100644 index 000000000..b6cf349ef Binary files /dev/null and b/assets/romfs/wc6/jpn/71-2.wc6 differ diff --git a/assets/romfs/wc6/jpn/71-3.wc6 b/assets/romfs/wc6/jpn/71-3.wc6 new file mode 100644 index 000000000..570d3661e Binary files /dev/null and b/assets/romfs/wc6/jpn/71-3.wc6 differ diff --git a/assets/romfs/wc6/jpn/71-4.wc6 b/assets/romfs/wc6/jpn/71-4.wc6 new file mode 100644 index 000000000..a1fff3975 Binary files /dev/null and b/assets/romfs/wc6/jpn/71-4.wc6 differ diff --git a/assets/romfs/wc6/jpn/71-5.wc6 b/assets/romfs/wc6/jpn/71-5.wc6 new file mode 100644 index 000000000..aafdff16b Binary files /dev/null and b/assets/romfs/wc6/jpn/71-5.wc6 differ diff --git a/assets/romfs/wc6/jpn/78.wc6 b/assets/romfs/wc6/jpn/78.wc6 new file mode 100644 index 000000000..d9d38fef1 Binary files /dev/null and b/assets/romfs/wc6/jpn/78.wc6 differ diff --git a/assets/romfs/wc6/jpn/79.wc6 b/assets/romfs/wc6/jpn/79.wc6 new file mode 100644 index 000000000..ec4437174 Binary files /dev/null and b/assets/romfs/wc6/jpn/79.wc6 differ diff --git a/assets/romfs/wc6/jpn/8.wc6 b/assets/romfs/wc6/jpn/8.wc6 new file mode 100644 index 000000000..9ae5f0555 Binary files /dev/null and b/assets/romfs/wc6/jpn/8.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-1.wc6 b/assets/romfs/wc6/jpn/81-1.wc6 new file mode 100644 index 000000000..989300f5c Binary files /dev/null and b/assets/romfs/wc6/jpn/81-1.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-10.wc6 b/assets/romfs/wc6/jpn/81-10.wc6 new file mode 100644 index 000000000..22ca869b7 Binary files /dev/null and b/assets/romfs/wc6/jpn/81-10.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-11.wc6 b/assets/romfs/wc6/jpn/81-11.wc6 new file mode 100644 index 000000000..b4909d1be Binary files /dev/null and b/assets/romfs/wc6/jpn/81-11.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-2.wc6 b/assets/romfs/wc6/jpn/81-2.wc6 new file mode 100644 index 000000000..8dd53b171 Binary files /dev/null and b/assets/romfs/wc6/jpn/81-2.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-3.wc6 b/assets/romfs/wc6/jpn/81-3.wc6 new file mode 100644 index 000000000..24e7247ef Binary files /dev/null and b/assets/romfs/wc6/jpn/81-3.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-4.wc6 b/assets/romfs/wc6/jpn/81-4.wc6 new file mode 100644 index 000000000..f0e18f02a Binary files /dev/null and b/assets/romfs/wc6/jpn/81-4.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-5.wc6 b/assets/romfs/wc6/jpn/81-5.wc6 new file mode 100644 index 000000000..367aeaedd Binary files /dev/null and b/assets/romfs/wc6/jpn/81-5.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-6.wc6 b/assets/romfs/wc6/jpn/81-6.wc6 new file mode 100644 index 000000000..ab11f4fab Binary files /dev/null and b/assets/romfs/wc6/jpn/81-6.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-7.wc6 b/assets/romfs/wc6/jpn/81-7.wc6 new file mode 100644 index 000000000..faa609fb1 Binary files /dev/null and b/assets/romfs/wc6/jpn/81-7.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-8.wc6 b/assets/romfs/wc6/jpn/81-8.wc6 new file mode 100644 index 000000000..c82df356f Binary files /dev/null and b/assets/romfs/wc6/jpn/81-8.wc6 differ diff --git a/assets/romfs/wc6/jpn/81-9.wc6 b/assets/romfs/wc6/jpn/81-9.wc6 new file mode 100644 index 000000000..b7257ab3d Binary files /dev/null and b/assets/romfs/wc6/jpn/81-9.wc6 differ diff --git a/assets/romfs/wc6/jpn/812.wc6 b/assets/romfs/wc6/jpn/812.wc6 new file mode 100644 index 000000000..ff7c7d08c Binary files /dev/null and b/assets/romfs/wc6/jpn/812.wc6 differ diff --git a/assets/romfs/wc6/jpn/82-1.wc6 b/assets/romfs/wc6/jpn/82-1.wc6 new file mode 100644 index 000000000..fd235c919 Binary files /dev/null and b/assets/romfs/wc6/jpn/82-1.wc6 differ diff --git a/assets/romfs/wc6/jpn/82-2.wc6 b/assets/romfs/wc6/jpn/82-2.wc6 new file mode 100644 index 000000000..8f25792f7 Binary files /dev/null and b/assets/romfs/wc6/jpn/82-2.wc6 differ diff --git a/assets/romfs/wc6/jpn/82-3.wc6 b/assets/romfs/wc6/jpn/82-3.wc6 new file mode 100644 index 000000000..52e530144 Binary files /dev/null and b/assets/romfs/wc6/jpn/82-3.wc6 differ diff --git a/assets/romfs/wc6/jpn/82-4.wc6 b/assets/romfs/wc6/jpn/82-4.wc6 new file mode 100644 index 000000000..8d89d41bb Binary files /dev/null and b/assets/romfs/wc6/jpn/82-4.wc6 differ diff --git a/assets/romfs/wc6/jpn/82-5.wc6 b/assets/romfs/wc6/jpn/82-5.wc6 new file mode 100644 index 000000000..542834882 Binary files /dev/null and b/assets/romfs/wc6/jpn/82-5.wc6 differ diff --git a/assets/romfs/wc6/jpn/82-6.wc6 b/assets/romfs/wc6/jpn/82-6.wc6 new file mode 100644 index 000000000..f7cab5523 Binary files /dev/null and b/assets/romfs/wc6/jpn/82-6.wc6 differ diff --git a/assets/romfs/wc6/jpn/83.wc6 b/assets/romfs/wc6/jpn/83.wc6 new file mode 100644 index 000000000..472a3fa0c Binary files /dev/null and b/assets/romfs/wc6/jpn/83.wc6 differ diff --git a/assets/romfs/wc6/jpn/86.wc6 b/assets/romfs/wc6/jpn/86.wc6 new file mode 100644 index 000000000..d359bffe8 Binary files /dev/null and b/assets/romfs/wc6/jpn/86.wc6 differ diff --git a/assets/romfs/wc6/jpn/88.wc6 b/assets/romfs/wc6/jpn/88.wc6 new file mode 100644 index 000000000..dfeb5f161 Binary files /dev/null and b/assets/romfs/wc6/jpn/88.wc6 differ diff --git a/assets/romfs/wc6/jpn/89.wc6 b/assets/romfs/wc6/jpn/89.wc6 new file mode 100644 index 000000000..cf4c46d23 Binary files /dev/null and b/assets/romfs/wc6/jpn/89.wc6 differ diff --git a/assets/romfs/wc6/jpn/90.wc6 b/assets/romfs/wc6/jpn/90.wc6 new file mode 100644 index 000000000..f83e16e81 Binary files /dev/null and b/assets/romfs/wc6/jpn/90.wc6 differ diff --git a/assets/romfs/wc6/jpn/94.wc6 b/assets/romfs/wc6/jpn/94.wc6 new file mode 100644 index 000000000..37467971a Binary files /dev/null and b/assets/romfs/wc6/jpn/94.wc6 differ diff --git a/assets/romfs/wc6/jpn/95.wc6 b/assets/romfs/wc6/jpn/95.wc6 new file mode 100644 index 000000000..4a97c6810 Binary files /dev/null and b/assets/romfs/wc6/jpn/95.wc6 differ diff --git a/assets/romfs/wc6/jpn/96.wc6 b/assets/romfs/wc6/jpn/96.wc6 new file mode 100644 index 000000000..77acd940d Binary files /dev/null and b/assets/romfs/wc6/jpn/96.wc6 differ diff --git a/assets/romfs/wc6/jpn/97.wc6 b/assets/romfs/wc6/jpn/97.wc6 new file mode 100644 index 000000000..0f7dedda2 Binary files /dev/null and b/assets/romfs/wc6/jpn/97.wc6 differ diff --git a/assets/romfs/wc6/jpn/98.wc6 b/assets/romfs/wc6/jpn/98.wc6 new file mode 100644 index 000000000..7bb52e7ff Binary files /dev/null and b/assets/romfs/wc6/jpn/98.wc6 differ diff --git a/assets/romfs/wc6/jpn/99.wc6 b/assets/romfs/wc6/jpn/99.wc6 new file mode 100644 index 000000000..800a9529e Binary files /dev/null and b/assets/romfs/wc6/jpn/99.wc6 differ diff --git a/assets/romfs/wc6/kor/1001.wc6 b/assets/romfs/wc6/kor/1001.wc6 new file mode 100644 index 000000000..7a36a72a8 Binary files /dev/null and b/assets/romfs/wc6/kor/1001.wc6 differ diff --git a/assets/romfs/wc6/kor/1006.wc6 b/assets/romfs/wc6/kor/1006.wc6 new file mode 100644 index 000000000..527dfdf71 Binary files /dev/null and b/assets/romfs/wc6/kor/1006.wc6 differ diff --git a/assets/romfs/wc6/kor/1007.wc6 b/assets/romfs/wc6/kor/1007.wc6 new file mode 100644 index 000000000..8985c4205 Binary files /dev/null and b/assets/romfs/wc6/kor/1007.wc6 differ diff --git a/assets/romfs/wc6/kor/1008.wc6 b/assets/romfs/wc6/kor/1008.wc6 new file mode 100644 index 000000000..eff3f370a Binary files /dev/null and b/assets/romfs/wc6/kor/1008.wc6 differ diff --git a/assets/romfs/wc6/kor/1015.wc6 b/assets/romfs/wc6/kor/1015.wc6 new file mode 100644 index 000000000..3b13eb6d5 Binary files /dev/null and b/assets/romfs/wc6/kor/1015.wc6 differ diff --git a/assets/romfs/wc6/kor/1016.wc6 b/assets/romfs/wc6/kor/1016.wc6 new file mode 100644 index 000000000..62c5db272 Binary files /dev/null and b/assets/romfs/wc6/kor/1016.wc6 differ diff --git a/assets/romfs/wc6/kor/1017.wc6 b/assets/romfs/wc6/kor/1017.wc6 new file mode 100644 index 000000000..862090d92 Binary files /dev/null and b/assets/romfs/wc6/kor/1017.wc6 differ diff --git a/assets/romfs/wc6/kor/1018.wc6 b/assets/romfs/wc6/kor/1018.wc6 new file mode 100644 index 000000000..eed23531e Binary files /dev/null and b/assets/romfs/wc6/kor/1018.wc6 differ diff --git a/assets/romfs/wc6/kor/1019.wc6 b/assets/romfs/wc6/kor/1019.wc6 new file mode 100644 index 000000000..f4fe5f455 Binary files /dev/null and b/assets/romfs/wc6/kor/1019.wc6 differ diff --git a/assets/romfs/wc6/kor/1022.wc6 b/assets/romfs/wc6/kor/1022.wc6 new file mode 100644 index 000000000..86f9744be Binary files /dev/null and b/assets/romfs/wc6/kor/1022.wc6 differ diff --git a/assets/romfs/wc6/kor/1023.wc6 b/assets/romfs/wc6/kor/1023.wc6 new file mode 100644 index 000000000..c6f85d60f Binary files /dev/null and b/assets/romfs/wc6/kor/1023.wc6 differ diff --git a/assets/romfs/wc6/kor/1024.wc6 b/assets/romfs/wc6/kor/1024.wc6 new file mode 100644 index 000000000..46db3cec9 Binary files /dev/null and b/assets/romfs/wc6/kor/1024.wc6 differ diff --git a/assets/romfs/wc6/kor/1025.wc6 b/assets/romfs/wc6/kor/1025.wc6 new file mode 100644 index 000000000..29a4cc6c2 Binary files /dev/null and b/assets/romfs/wc6/kor/1025.wc6 differ diff --git a/assets/romfs/wc6/kor/1026.wc6 b/assets/romfs/wc6/kor/1026.wc6 new file mode 100644 index 000000000..d81c8b5d5 Binary files /dev/null and b/assets/romfs/wc6/kor/1026.wc6 differ diff --git a/assets/romfs/wc6/kor/1027.wc6 b/assets/romfs/wc6/kor/1027.wc6 new file mode 100644 index 000000000..ed25fb45a Binary files /dev/null and b/assets/romfs/wc6/kor/1027.wc6 differ diff --git a/assets/romfs/wc6/kor/1029.wc6 b/assets/romfs/wc6/kor/1029.wc6 new file mode 100644 index 000000000..b9b87812a Binary files /dev/null and b/assets/romfs/wc6/kor/1029.wc6 differ diff --git a/assets/romfs/wc6/kor/1041.wc6 b/assets/romfs/wc6/kor/1041.wc6 new file mode 100644 index 000000000..82f5ab43a Binary files /dev/null and b/assets/romfs/wc6/kor/1041.wc6 differ diff --git a/assets/romfs/wc6/kor/1042.wc6 b/assets/romfs/wc6/kor/1042.wc6 new file mode 100644 index 000000000..3899c3935 Binary files /dev/null and b/assets/romfs/wc6/kor/1042.wc6 differ diff --git a/assets/romfs/wc6/kor/1043.wc6 b/assets/romfs/wc6/kor/1043.wc6 new file mode 100644 index 000000000..b672880e9 Binary files /dev/null and b/assets/romfs/wc6/kor/1043.wc6 differ diff --git a/assets/romfs/wc6/kor/1047.wc6 b/assets/romfs/wc6/kor/1047.wc6 new file mode 100644 index 000000000..21171002f Binary files /dev/null and b/assets/romfs/wc6/kor/1047.wc6 differ diff --git a/assets/romfs/wc6/kor/1048.wc6 b/assets/romfs/wc6/kor/1048.wc6 new file mode 100644 index 000000000..6500c9864 Binary files /dev/null and b/assets/romfs/wc6/kor/1048.wc6 differ diff --git a/assets/romfs/wc6/kor/1049.wc6 b/assets/romfs/wc6/kor/1049.wc6 new file mode 100644 index 000000000..b03efb631 Binary files /dev/null and b/assets/romfs/wc6/kor/1049.wc6 differ diff --git a/assets/romfs/wc6/kor/1050.wc6 b/assets/romfs/wc6/kor/1050.wc6 new file mode 100644 index 000000000..5343088de Binary files /dev/null and b/assets/romfs/wc6/kor/1050.wc6 differ diff --git a/assets/romfs/wc6/kor/1051.wc6 b/assets/romfs/wc6/kor/1051.wc6 new file mode 100644 index 000000000..29d5469e2 Binary files /dev/null and b/assets/romfs/wc6/kor/1051.wc6 differ diff --git a/assets/romfs/wc6/kor/1052.wc6 b/assets/romfs/wc6/kor/1052.wc6 new file mode 100644 index 000000000..1ec1aa981 Binary files /dev/null and b/assets/romfs/wc6/kor/1052.wc6 differ diff --git a/assets/romfs/wc6/kor/1053.wc6 b/assets/romfs/wc6/kor/1053.wc6 new file mode 100644 index 000000000..01004f802 Binary files /dev/null and b/assets/romfs/wc6/kor/1053.wc6 differ diff --git a/assets/romfs/wc6/kor/1054.wc6 b/assets/romfs/wc6/kor/1054.wc6 new file mode 100644 index 000000000..144b18571 Binary files /dev/null and b/assets/romfs/wc6/kor/1054.wc6 differ diff --git a/assets/romfs/wc6/kor/1055.wc6 b/assets/romfs/wc6/kor/1055.wc6 new file mode 100644 index 000000000..cbacbcff2 Binary files /dev/null and b/assets/romfs/wc6/kor/1055.wc6 differ diff --git a/assets/romfs/wc6/kor/1057.wc6 b/assets/romfs/wc6/kor/1057.wc6 new file mode 100644 index 000000000..c4a3e87f7 Binary files /dev/null and b/assets/romfs/wc6/kor/1057.wc6 differ diff --git a/assets/romfs/wc6/kor/1058.wc6 b/assets/romfs/wc6/kor/1058.wc6 new file mode 100644 index 000000000..47e518194 Binary files /dev/null and b/assets/romfs/wc6/kor/1058.wc6 differ diff --git a/assets/romfs/wc6/kor/1060.wc6 b/assets/romfs/wc6/kor/1060.wc6 new file mode 100644 index 000000000..de0c0def2 Binary files /dev/null and b/assets/romfs/wc6/kor/1060.wc6 differ diff --git a/assets/romfs/wc6/kor/1061.wc6 b/assets/romfs/wc6/kor/1061.wc6 new file mode 100644 index 000000000..1bfe0721d Binary files /dev/null and b/assets/romfs/wc6/kor/1061.wc6 differ diff --git a/assets/romfs/wc6/kor/1062.wc6 b/assets/romfs/wc6/kor/1062.wc6 new file mode 100644 index 000000000..3028b14a6 Binary files /dev/null and b/assets/romfs/wc6/kor/1062.wc6 differ diff --git a/assets/romfs/wc6/kor/1064.wc6 b/assets/romfs/wc6/kor/1064.wc6 new file mode 100644 index 000000000..07d2a5050 Binary files /dev/null and b/assets/romfs/wc6/kor/1064.wc6 differ diff --git a/assets/romfs/wc6/kor/1065.wc6 b/assets/romfs/wc6/kor/1065.wc6 new file mode 100644 index 000000000..d089a62f7 Binary files /dev/null and b/assets/romfs/wc6/kor/1065.wc6 differ diff --git a/assets/romfs/wc6/kor/1066.wc6 b/assets/romfs/wc6/kor/1066.wc6 new file mode 100644 index 000000000..953bc00ac Binary files /dev/null and b/assets/romfs/wc6/kor/1066.wc6 differ diff --git a/assets/romfs/wc6/kor/1067.wc6 b/assets/romfs/wc6/kor/1067.wc6 new file mode 100644 index 000000000..df28632c8 Binary files /dev/null and b/assets/romfs/wc6/kor/1067.wc6 differ diff --git a/assets/romfs/wc6/kor/1068.wc6 b/assets/romfs/wc6/kor/1068.wc6 new file mode 100644 index 000000000..bcd3c4924 Binary files /dev/null and b/assets/romfs/wc6/kor/1068.wc6 differ diff --git a/assets/romfs/wc6/kor/1070.wc6 b/assets/romfs/wc6/kor/1070.wc6 new file mode 100644 index 000000000..70be5c048 Binary files /dev/null and b/assets/romfs/wc6/kor/1070.wc6 differ diff --git a/assets/romfs/wc6/kor/1071.wc6 b/assets/romfs/wc6/kor/1071.wc6 new file mode 100644 index 000000000..055b27d26 Binary files /dev/null and b/assets/romfs/wc6/kor/1071.wc6 differ diff --git a/assets/romfs/wc6/kor/1072.wc6 b/assets/romfs/wc6/kor/1072.wc6 new file mode 100644 index 000000000..a88589d2b Binary files /dev/null and b/assets/romfs/wc6/kor/1072.wc6 differ diff --git a/assets/romfs/wc6/kor/1073.wc6 b/assets/romfs/wc6/kor/1073.wc6 new file mode 100644 index 000000000..29d4a24b3 Binary files /dev/null and b/assets/romfs/wc6/kor/1073.wc6 differ diff --git a/assets/romfs/wc6/kor/1074.wc6 b/assets/romfs/wc6/kor/1074.wc6 new file mode 100644 index 000000000..4d159bd6d Binary files /dev/null and b/assets/romfs/wc6/kor/1074.wc6 differ diff --git a/assets/romfs/wc6/kor/1075.wc6 b/assets/romfs/wc6/kor/1075.wc6 new file mode 100644 index 000000000..c84162bcd Binary files /dev/null and b/assets/romfs/wc6/kor/1075.wc6 differ diff --git a/assets/romfs/wc6/kor/1076.wc6 b/assets/romfs/wc6/kor/1076.wc6 new file mode 100644 index 000000000..47cde0f30 Binary files /dev/null and b/assets/romfs/wc6/kor/1076.wc6 differ diff --git a/assets/romfs/wc6/kor/1078.wc6 b/assets/romfs/wc6/kor/1078.wc6 new file mode 100644 index 000000000..03b99f5a5 Binary files /dev/null and b/assets/romfs/wc6/kor/1078.wc6 differ diff --git a/assets/romfs/wc6/kor/1504.wc6 b/assets/romfs/wc6/kor/1504.wc6 new file mode 100644 index 000000000..edf7f0590 Binary files /dev/null and b/assets/romfs/wc6/kor/1504.wc6 differ diff --git a/assets/romfs/wc6/kor/1508.wc6 b/assets/romfs/wc6/kor/1508.wc6 new file mode 100644 index 000000000..e510f1454 Binary files /dev/null and b/assets/romfs/wc6/kor/1508.wc6 differ diff --git a/assets/romfs/wc6/kor/1509.wc6 b/assets/romfs/wc6/kor/1509.wc6 new file mode 100644 index 000000000..c4e13a688 Binary files /dev/null and b/assets/romfs/wc6/kor/1509.wc6 differ diff --git a/assets/romfs/wc6/kor/1510.wc6 b/assets/romfs/wc6/kor/1510.wc6 new file mode 100644 index 000000000..3c7b2fb22 Binary files /dev/null and b/assets/romfs/wc6/kor/1510.wc6 differ diff --git a/assets/romfs/wc6/kor/1511.wc6 b/assets/romfs/wc6/kor/1511.wc6 new file mode 100644 index 000000000..bd7234607 Binary files /dev/null and b/assets/romfs/wc6/kor/1511.wc6 differ diff --git a/assets/romfs/wc6/kor/1512.wc6 b/assets/romfs/wc6/kor/1512.wc6 new file mode 100644 index 000000000..283f9e607 Binary files /dev/null and b/assets/romfs/wc6/kor/1512.wc6 differ diff --git a/assets/romfs/wc6/kor/1513.wc6 b/assets/romfs/wc6/kor/1513.wc6 new file mode 100644 index 000000000..131f8aef5 Binary files /dev/null and b/assets/romfs/wc6/kor/1513.wc6 differ diff --git a/assets/romfs/wc6/kor/1514.wc6 b/assets/romfs/wc6/kor/1514.wc6 new file mode 100644 index 000000000..36c7c9bbe Binary files /dev/null and b/assets/romfs/wc6/kor/1514.wc6 differ diff --git a/assets/romfs/wc6/kor/1515.wc6 b/assets/romfs/wc6/kor/1515.wc6 new file mode 100644 index 000000000..902deb542 Binary files /dev/null and b/assets/romfs/wc6/kor/1515.wc6 differ diff --git a/assets/romfs/wc6/kor/1516.wc6 b/assets/romfs/wc6/kor/1516.wc6 new file mode 100644 index 000000000..4e1840c9e Binary files /dev/null and b/assets/romfs/wc6/kor/1516.wc6 differ diff --git a/assets/romfs/wc6/kor/175.wc6 b/assets/romfs/wc6/kor/175.wc6 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc6/kor/175.wc6 differ diff --git a/assets/romfs/wc6/kor/2048.wc6 b/assets/romfs/wc6/kor/2048.wc6 new file mode 100644 index 000000000..3fa3b2a71 Binary files /dev/null and b/assets/romfs/wc6/kor/2048.wc6 differ diff --git a/assets/romfs/wc6/kor/812.wc6 b/assets/romfs/wc6/kor/812.wc6 new file mode 100644 index 000000000..743de41a6 Binary files /dev/null and b/assets/romfs/wc6/kor/812.wc6 differ diff --git a/assets/romfs/wc6/spa/1501.wc6 b/assets/romfs/wc6/spa/1501.wc6 new file mode 100644 index 000000000..8c844a844 Binary files /dev/null and b/assets/romfs/wc6/spa/1501.wc6 differ diff --git a/assets/romfs/wc6/spa/1503.wc6 b/assets/romfs/wc6/spa/1503.wc6 new file mode 100644 index 000000000..2d399dd08 Binary files /dev/null and b/assets/romfs/wc6/spa/1503.wc6 differ diff --git a/assets/romfs/wc6/spa/1504.wc6 b/assets/romfs/wc6/spa/1504.wc6 new file mode 100644 index 000000000..1a84d1eec Binary files /dev/null and b/assets/romfs/wc6/spa/1504.wc6 differ diff --git a/assets/romfs/wc6/spa/1505.wc6 b/assets/romfs/wc6/spa/1505.wc6 new file mode 100644 index 000000000..b40d0c238 Binary files /dev/null and b/assets/romfs/wc6/spa/1505.wc6 differ diff --git a/assets/romfs/wc6/spa/1506.wc6 b/assets/romfs/wc6/spa/1506.wc6 new file mode 100644 index 000000000..60d12f26b Binary files /dev/null and b/assets/romfs/wc6/spa/1506.wc6 differ diff --git a/assets/romfs/wc6/spa/1507.wc6 b/assets/romfs/wc6/spa/1507.wc6 new file mode 100644 index 000000000..3ebfe1635 Binary files /dev/null and b/assets/romfs/wc6/spa/1507.wc6 differ diff --git a/assets/romfs/wc6/spa/1508.wc6 b/assets/romfs/wc6/spa/1508.wc6 new file mode 100644 index 000000000..666408070 Binary files /dev/null and b/assets/romfs/wc6/spa/1508.wc6 differ diff --git a/assets/romfs/wc6/spa/1509.wc6 b/assets/romfs/wc6/spa/1509.wc6 new file mode 100644 index 000000000..c94fb17b4 Binary files /dev/null and b/assets/romfs/wc6/spa/1509.wc6 differ diff --git a/assets/romfs/wc6/spa/1510.wc6 b/assets/romfs/wc6/spa/1510.wc6 new file mode 100644 index 000000000..96bdf5e2c Binary files /dev/null and b/assets/romfs/wc6/spa/1510.wc6 differ diff --git a/assets/romfs/wc6/spa/1511.wc6 b/assets/romfs/wc6/spa/1511.wc6 new file mode 100644 index 000000000..e8a07dbb9 Binary files /dev/null and b/assets/romfs/wc6/spa/1511.wc6 differ diff --git a/assets/romfs/wc6/spa/1512.wc6 b/assets/romfs/wc6/spa/1512.wc6 new file mode 100644 index 000000000..232bffbdf Binary files /dev/null and b/assets/romfs/wc6/spa/1512.wc6 differ diff --git a/assets/romfs/wc6/spa/1513.wc6 b/assets/romfs/wc6/spa/1513.wc6 new file mode 100644 index 000000000..a2beca6c3 Binary files /dev/null and b/assets/romfs/wc6/spa/1513.wc6 differ diff --git a/assets/romfs/wc6/spa/1514.wc6 b/assets/romfs/wc6/spa/1514.wc6 new file mode 100644 index 000000000..8bcd45396 Binary files /dev/null and b/assets/romfs/wc6/spa/1514.wc6 differ diff --git a/assets/romfs/wc6/spa/1515.wc6 b/assets/romfs/wc6/spa/1515.wc6 new file mode 100644 index 000000000..974297d62 Binary files /dev/null and b/assets/romfs/wc6/spa/1515.wc6 differ diff --git a/assets/romfs/wc6/spa/1516.wc6 b/assets/romfs/wc6/spa/1516.wc6 new file mode 100644 index 000000000..e2c351903 Binary files /dev/null and b/assets/romfs/wc6/spa/1516.wc6 differ diff --git a/assets/romfs/wc6/spa/175.wc6 b/assets/romfs/wc6/spa/175.wc6 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc6/spa/175.wc6 differ diff --git a/assets/romfs/wc6/spa/2048.wc6 b/assets/romfs/wc6/spa/2048.wc6 new file mode 100644 index 000000000..97aed23fa Binary files /dev/null and b/assets/romfs/wc6/spa/2048.wc6 differ diff --git a/assets/romfs/wc6/spa/504-1.wc6 b/assets/romfs/wc6/spa/504-1.wc6 new file mode 100644 index 000000000..d90a09c7e Binary files /dev/null and b/assets/romfs/wc6/spa/504-1.wc6 differ diff --git a/assets/romfs/wc6/spa/504-2.wc6 b/assets/romfs/wc6/spa/504-2.wc6 new file mode 100644 index 000000000..a602ee77c Binary files /dev/null and b/assets/romfs/wc6/spa/504-2.wc6 differ diff --git a/assets/romfs/wc6/spa/511.wc6 b/assets/romfs/wc6/spa/511.wc6 new file mode 100644 index 000000000..9ae678a64 Binary files /dev/null and b/assets/romfs/wc6/spa/511.wc6 differ diff --git a/assets/romfs/wc6/spa/515-1.wc6 b/assets/romfs/wc6/spa/515-1.wc6 new file mode 100644 index 000000000..e5849c41f Binary files /dev/null and b/assets/romfs/wc6/spa/515-1.wc6 differ diff --git a/assets/romfs/wc6/spa/515-2.wc6 b/assets/romfs/wc6/spa/515-2.wc6 new file mode 100644 index 000000000..8c5c42ff5 Binary files /dev/null and b/assets/romfs/wc6/spa/515-2.wc6 differ diff --git a/assets/romfs/wc6/spa/523.wc6 b/assets/romfs/wc6/spa/523.wc6 new file mode 100644 index 000000000..f763c27e8 Binary files /dev/null and b/assets/romfs/wc6/spa/523.wc6 differ diff --git a/assets/romfs/wc6/spa/524.wc6 b/assets/romfs/wc6/spa/524.wc6 new file mode 100644 index 000000000..81cdd4d39 Binary files /dev/null and b/assets/romfs/wc6/spa/524.wc6 differ diff --git a/assets/romfs/wc6/spa/525.wc6 b/assets/romfs/wc6/spa/525.wc6 new file mode 100644 index 000000000..59de764bb Binary files /dev/null and b/assets/romfs/wc6/spa/525.wc6 differ diff --git a/assets/romfs/wc6/spa/537.wc6 b/assets/romfs/wc6/spa/537.wc6 new file mode 100644 index 000000000..0ebc70725 Binary files /dev/null and b/assets/romfs/wc6/spa/537.wc6 differ diff --git a/assets/romfs/wc6/spa/546.wc6 b/assets/romfs/wc6/spa/546.wc6 new file mode 100644 index 000000000..296a39dea Binary files /dev/null and b/assets/romfs/wc6/spa/546.wc6 differ diff --git a/assets/romfs/wc6/spa/547.wc6 b/assets/romfs/wc6/spa/547.wc6 new file mode 100644 index 000000000..2141ff24e Binary files /dev/null and b/assets/romfs/wc6/spa/547.wc6 differ diff --git a/assets/romfs/wc6/spa/551-1.wc6 b/assets/romfs/wc6/spa/551-1.wc6 new file mode 100644 index 000000000..d6771986b Binary files /dev/null and b/assets/romfs/wc6/spa/551-1.wc6 differ diff --git a/assets/romfs/wc6/spa/551-2.wc6 b/assets/romfs/wc6/spa/551-2.wc6 new file mode 100644 index 000000000..6c57c07d0 Binary files /dev/null and b/assets/romfs/wc6/spa/551-2.wc6 differ diff --git a/assets/romfs/wc6/spa/552-1.wc6 b/assets/romfs/wc6/spa/552-1.wc6 new file mode 100644 index 000000000..99e9d7c4b Binary files /dev/null and b/assets/romfs/wc6/spa/552-1.wc6 differ diff --git a/assets/romfs/wc6/spa/552-2.wc6 b/assets/romfs/wc6/spa/552-2.wc6 new file mode 100644 index 000000000..b8fcf98ff Binary files /dev/null and b/assets/romfs/wc6/spa/552-2.wc6 differ diff --git a/assets/romfs/wc6/spa/553.wc6 b/assets/romfs/wc6/spa/553.wc6 new file mode 100644 index 000000000..6ed5f5baf Binary files /dev/null and b/assets/romfs/wc6/spa/553.wc6 differ diff --git a/assets/romfs/wc6/spa/556.wc6 b/assets/romfs/wc6/spa/556.wc6 new file mode 100644 index 000000000..e970d9ba7 Binary files /dev/null and b/assets/romfs/wc6/spa/556.wc6 differ diff --git a/assets/romfs/wc6/spa/557.wc6 b/assets/romfs/wc6/spa/557.wc6 new file mode 100644 index 000000000..838704c0d Binary files /dev/null and b/assets/romfs/wc6/spa/557.wc6 differ diff --git a/assets/romfs/wc6/spa/558.wc6 b/assets/romfs/wc6/spa/558.wc6 new file mode 100644 index 000000000..491e8db2f Binary files /dev/null and b/assets/romfs/wc6/spa/558.wc6 differ diff --git a/assets/romfs/wc6/spa/559.wc6 b/assets/romfs/wc6/spa/559.wc6 new file mode 100644 index 000000000..e4e5d5d19 Binary files /dev/null and b/assets/romfs/wc6/spa/559.wc6 differ diff --git a/assets/romfs/wc6/spa/560.wc6 b/assets/romfs/wc6/spa/560.wc6 new file mode 100644 index 000000000..f061f78be Binary files /dev/null and b/assets/romfs/wc6/spa/560.wc6 differ diff --git a/assets/romfs/wc6/spa/561.wc6 b/assets/romfs/wc6/spa/561.wc6 new file mode 100644 index 000000000..393919fb5 Binary files /dev/null and b/assets/romfs/wc6/spa/561.wc6 differ diff --git a/assets/romfs/wc6/spa/562.wc6 b/assets/romfs/wc6/spa/562.wc6 new file mode 100644 index 000000000..6b0fa6d77 Binary files /dev/null and b/assets/romfs/wc6/spa/562.wc6 differ diff --git a/assets/romfs/wc6/spa/563.wc6 b/assets/romfs/wc6/spa/563.wc6 new file mode 100644 index 000000000..d6bc3f091 Binary files /dev/null and b/assets/romfs/wc6/spa/563.wc6 differ diff --git a/assets/romfs/wc6/spa/564.wc6 b/assets/romfs/wc6/spa/564.wc6 new file mode 100644 index 000000000..9d87ce5c5 Binary files /dev/null and b/assets/romfs/wc6/spa/564.wc6 differ diff --git a/assets/romfs/wc6/spa/565.wc6 b/assets/romfs/wc6/spa/565.wc6 new file mode 100644 index 000000000..7ef81e62c Binary files /dev/null and b/assets/romfs/wc6/spa/565.wc6 differ diff --git a/assets/romfs/wc6/spa/566.wc6 b/assets/romfs/wc6/spa/566.wc6 new file mode 100644 index 000000000..be748586b Binary files /dev/null and b/assets/romfs/wc6/spa/566.wc6 differ diff --git a/assets/romfs/wc6/spa/567.wc6 b/assets/romfs/wc6/spa/567.wc6 new file mode 100644 index 000000000..5b88f47ba Binary files /dev/null and b/assets/romfs/wc6/spa/567.wc6 differ diff --git a/assets/romfs/wc6/spa/569.wc6 b/assets/romfs/wc6/spa/569.wc6 new file mode 100644 index 000000000..4531980b5 Binary files /dev/null and b/assets/romfs/wc6/spa/569.wc6 differ diff --git a/assets/romfs/wc6/spa/570.wc6 b/assets/romfs/wc6/spa/570.wc6 new file mode 100644 index 000000000..8e67110a4 Binary files /dev/null and b/assets/romfs/wc6/spa/570.wc6 differ diff --git a/assets/romfs/wc6/spa/571.wc6 b/assets/romfs/wc6/spa/571.wc6 new file mode 100644 index 000000000..359eb037e Binary files /dev/null and b/assets/romfs/wc6/spa/571.wc6 differ diff --git a/assets/romfs/wc6/spa/574.wc6 b/assets/romfs/wc6/spa/574.wc6 new file mode 100644 index 000000000..ea4c817f0 Binary files /dev/null and b/assets/romfs/wc6/spa/574.wc6 differ diff --git a/assets/romfs/wc6/spa/576.wc6 b/assets/romfs/wc6/spa/576.wc6 new file mode 100644 index 000000000..406b090bd Binary files /dev/null and b/assets/romfs/wc6/spa/576.wc6 differ diff --git a/assets/romfs/wc6/spa/577.wc6 b/assets/romfs/wc6/spa/577.wc6 new file mode 100644 index 000000000..413bceba2 Binary files /dev/null and b/assets/romfs/wc6/spa/577.wc6 differ diff --git a/assets/romfs/wc6/spa/578.wc6 b/assets/romfs/wc6/spa/578.wc6 new file mode 100644 index 000000000..ca8cf8a9d Binary files /dev/null and b/assets/romfs/wc6/spa/578.wc6 differ diff --git a/assets/romfs/wc6/spa/586.wc6 b/assets/romfs/wc6/spa/586.wc6 new file mode 100644 index 000000000..3c44323db Binary files /dev/null and b/assets/romfs/wc6/spa/586.wc6 differ diff --git a/assets/romfs/wc6/spa/588.wc6 b/assets/romfs/wc6/spa/588.wc6 new file mode 100644 index 000000000..0b527848e Binary files /dev/null and b/assets/romfs/wc6/spa/588.wc6 differ diff --git a/assets/romfs/wc6/spa/598.wc6 b/assets/romfs/wc6/spa/598.wc6 new file mode 100644 index 000000000..3b554ee03 Binary files /dev/null and b/assets/romfs/wc6/spa/598.wc6 differ diff --git a/assets/romfs/wc6/spa/812.wc6 b/assets/romfs/wc6/spa/812.wc6 new file mode 100644 index 000000000..3d93f9855 Binary files /dev/null and b/assets/romfs/wc6/spa/812.wc6 differ diff --git a/assets/romfs/wc7/chs/2040.wc7 b/assets/romfs/wc7/chs/2040.wc7 new file mode 100644 index 000000000..33aee72d5 Binary files /dev/null and b/assets/romfs/wc7/chs/2040.wc7 differ diff --git a/assets/romfs/wc7/chs/2041.wc7 b/assets/romfs/wc7/chs/2041.wc7 new file mode 100644 index 000000000..d2c5fa3b8 Binary files /dev/null and b/assets/romfs/wc7/chs/2041.wc7 differ diff --git a/assets/romfs/wc7/chs/2042.wc7 b/assets/romfs/wc7/chs/2042.wc7 new file mode 100644 index 000000000..eb8cb0a63 Binary files /dev/null and b/assets/romfs/wc7/chs/2042.wc7 differ diff --git a/assets/romfs/wc7/chs/2043.wc7 b/assets/romfs/wc7/chs/2043.wc7 new file mode 100644 index 000000000..4f78d4500 Binary files /dev/null and b/assets/romfs/wc7/chs/2043.wc7 differ diff --git a/assets/romfs/wc7/chs/2044.wc7 b/assets/romfs/wc7/chs/2044.wc7 new file mode 100644 index 000000000..489b55410 Binary files /dev/null and b/assets/romfs/wc7/chs/2044.wc7 differ diff --git a/assets/romfs/wc7/chs/2045.wc7 b/assets/romfs/wc7/chs/2045.wc7 new file mode 100644 index 000000000..d8bdb8fa7 Binary files /dev/null and b/assets/romfs/wc7/chs/2045.wc7 differ diff --git a/assets/romfs/wc7/chs/2046.wc7 b/assets/romfs/wc7/chs/2046.wc7 new file mode 100644 index 000000000..98fffc3f9 Binary files /dev/null and b/assets/romfs/wc7/chs/2046.wc7 differ diff --git a/assets/romfs/wc7/cht/2040.wc7 b/assets/romfs/wc7/cht/2040.wc7 new file mode 100644 index 000000000..b1b7111b8 Binary files /dev/null and b/assets/romfs/wc7/cht/2040.wc7 differ diff --git a/assets/romfs/wc7/cht/2041.wc7 b/assets/romfs/wc7/cht/2041.wc7 new file mode 100644 index 000000000..6f4528659 Binary files /dev/null and b/assets/romfs/wc7/cht/2041.wc7 differ diff --git a/assets/romfs/wc7/cht/2042.wc7 b/assets/romfs/wc7/cht/2042.wc7 new file mode 100644 index 000000000..5ede56829 Binary files /dev/null and b/assets/romfs/wc7/cht/2042.wc7 differ diff --git a/assets/romfs/wc7/cht/2043.wc7 b/assets/romfs/wc7/cht/2043.wc7 new file mode 100644 index 000000000..b95e6e558 Binary files /dev/null and b/assets/romfs/wc7/cht/2043.wc7 differ diff --git a/assets/romfs/wc7/cht/2044.wc7 b/assets/romfs/wc7/cht/2044.wc7 new file mode 100644 index 000000000..eb799bbda Binary files /dev/null and b/assets/romfs/wc7/cht/2044.wc7 differ diff --git a/assets/romfs/wc7/cht/2045.wc7 b/assets/romfs/wc7/cht/2045.wc7 new file mode 100644 index 000000000..6d236eec2 Binary files /dev/null and b/assets/romfs/wc7/cht/2045.wc7 differ diff --git a/assets/romfs/wc7/cht/2046.wc7 b/assets/romfs/wc7/cht/2046.wc7 new file mode 100644 index 000000000..85fba2bf5 Binary files /dev/null and b/assets/romfs/wc7/cht/2046.wc7 differ diff --git a/assets/romfs/wc7/eng/110.wc7 b/assets/romfs/wc7/eng/110.wc7 new file mode 100644 index 000000000..5a3b90dba Binary files /dev/null and b/assets/romfs/wc7/eng/110.wc7 differ diff --git a/assets/romfs/wc7/eng/119.wc7 b/assets/romfs/wc7/eng/119.wc7 new file mode 100644 index 000000000..622fbd7b7 Binary files /dev/null and b/assets/romfs/wc7/eng/119.wc7 differ diff --git a/assets/romfs/wc7/eng/146.wc7 b/assets/romfs/wc7/eng/146.wc7 new file mode 100644 index 000000000..66f0de648 Binary files /dev/null and b/assets/romfs/wc7/eng/146.wc7 differ diff --git a/assets/romfs/wc7/eng/1501.wc7 b/assets/romfs/wc7/eng/1501.wc7 new file mode 100644 index 000000000..813e5ab03 Binary files /dev/null and b/assets/romfs/wc7/eng/1501.wc7 differ diff --git a/assets/romfs/wc7/eng/1502.wc7 b/assets/romfs/wc7/eng/1502.wc7 new file mode 100644 index 000000000..d89f13b6c Binary files /dev/null and b/assets/romfs/wc7/eng/1502.wc7 differ diff --git a/assets/romfs/wc7/eng/1503.wc7 b/assets/romfs/wc7/eng/1503.wc7 new file mode 100644 index 000000000..62af04c59 Binary files /dev/null and b/assets/romfs/wc7/eng/1503.wc7 differ diff --git a/assets/romfs/wc7/eng/1504.wc7 b/assets/romfs/wc7/eng/1504.wc7 new file mode 100644 index 000000000..83fa56742 Binary files /dev/null and b/assets/romfs/wc7/eng/1504.wc7 differ diff --git a/assets/romfs/wc7/eng/1505.wc7 b/assets/romfs/wc7/eng/1505.wc7 new file mode 100644 index 000000000..53c3d8b7d Binary files /dev/null and b/assets/romfs/wc7/eng/1505.wc7 differ diff --git a/assets/romfs/wc7/eng/1506.wc7 b/assets/romfs/wc7/eng/1506.wc7 new file mode 100644 index 000000000..af8b1227a Binary files /dev/null and b/assets/romfs/wc7/eng/1506.wc7 differ diff --git a/assets/romfs/wc7/eng/1507.wc7 b/assets/romfs/wc7/eng/1507.wc7 new file mode 100644 index 000000000..f6dacfa5d Binary files /dev/null and b/assets/romfs/wc7/eng/1507.wc7 differ diff --git a/assets/romfs/wc7/eng/1508.wc7 b/assets/romfs/wc7/eng/1508.wc7 new file mode 100644 index 000000000..c9dbf8efe Binary files /dev/null and b/assets/romfs/wc7/eng/1508.wc7 differ diff --git a/assets/romfs/wc7/eng/1509.wc7 b/assets/romfs/wc7/eng/1509.wc7 new file mode 100644 index 000000000..e12185423 Binary files /dev/null and b/assets/romfs/wc7/eng/1509.wc7 differ diff --git a/assets/romfs/wc7/eng/1510.wc7 b/assets/romfs/wc7/eng/1510.wc7 new file mode 100644 index 000000000..ca871168c Binary files /dev/null and b/assets/romfs/wc7/eng/1510.wc7 differ diff --git a/assets/romfs/wc7/eng/1511.wc7 b/assets/romfs/wc7/eng/1511.wc7 new file mode 100644 index 000000000..b89169f13 Binary files /dev/null and b/assets/romfs/wc7/eng/1511.wc7 differ diff --git a/assets/romfs/wc7/eng/1512.wc7 b/assets/romfs/wc7/eng/1512.wc7 new file mode 100644 index 000000000..3bab76619 Binary files /dev/null and b/assets/romfs/wc7/eng/1512.wc7 differ diff --git a/assets/romfs/wc7/eng/1513.wc7 b/assets/romfs/wc7/eng/1513.wc7 new file mode 100644 index 000000000..41e79ecc1 Binary files /dev/null and b/assets/romfs/wc7/eng/1513.wc7 differ diff --git a/assets/romfs/wc7/eng/1514.wc7 b/assets/romfs/wc7/eng/1514.wc7 new file mode 100644 index 000000000..4bfa81798 Binary files /dev/null and b/assets/romfs/wc7/eng/1514.wc7 differ diff --git a/assets/romfs/wc7/eng/1515.wc7 b/assets/romfs/wc7/eng/1515.wc7 new file mode 100644 index 000000000..42f6f92c4 Binary files /dev/null and b/assets/romfs/wc7/eng/1515.wc7 differ diff --git a/assets/romfs/wc7/eng/1516.wc7 b/assets/romfs/wc7/eng/1516.wc7 new file mode 100644 index 000000000..2d75181c5 Binary files /dev/null and b/assets/romfs/wc7/eng/1516.wc7 differ diff --git a/assets/romfs/wc7/eng/159.wc7 b/assets/romfs/wc7/eng/159.wc7 new file mode 100644 index 000000000..ac61cfe73 Binary files /dev/null and b/assets/romfs/wc7/eng/159.wc7 differ diff --git a/assets/romfs/wc7/eng/1601.wc7 b/assets/romfs/wc7/eng/1601.wc7 new file mode 100644 index 000000000..19b929f57 Binary files /dev/null and b/assets/romfs/wc7/eng/1601.wc7 differ diff --git a/assets/romfs/wc7/eng/1602.wc7 b/assets/romfs/wc7/eng/1602.wc7 new file mode 100644 index 000000000..8b10036a7 Binary files /dev/null and b/assets/romfs/wc7/eng/1602.wc7 differ diff --git a/assets/romfs/wc7/eng/1603.wc7 b/assets/romfs/wc7/eng/1603.wc7 new file mode 100644 index 000000000..1c4fcec34 Binary files /dev/null and b/assets/romfs/wc7/eng/1603.wc7 differ diff --git a/assets/romfs/wc7/eng/170.wc7 b/assets/romfs/wc7/eng/170.wc7 new file mode 100644 index 000000000..e7923c4e8 Binary files /dev/null and b/assets/romfs/wc7/eng/170.wc7 differ diff --git a/assets/romfs/wc7/eng/173.wc7 b/assets/romfs/wc7/eng/173.wc7 new file mode 100644 index 000000000..11a5c5f36 Binary files /dev/null and b/assets/romfs/wc7/eng/173.wc7 differ diff --git a/assets/romfs/wc7/eng/175.wc7 b/assets/romfs/wc7/eng/175.wc7 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc7/eng/175.wc7 differ diff --git a/assets/romfs/wc7/eng/202.wc7 b/assets/romfs/wc7/eng/202.wc7 new file mode 100644 index 000000000..d76a9369f Binary files /dev/null and b/assets/romfs/wc7/eng/202.wc7 differ diff --git a/assets/romfs/wc7/eng/2040.wc7 b/assets/romfs/wc7/eng/2040.wc7 new file mode 100644 index 000000000..61fa64718 Binary files /dev/null and b/assets/romfs/wc7/eng/2040.wc7 differ diff --git a/assets/romfs/wc7/eng/2041.wc7 b/assets/romfs/wc7/eng/2041.wc7 new file mode 100644 index 000000000..605c3d008 Binary files /dev/null and b/assets/romfs/wc7/eng/2041.wc7 differ diff --git a/assets/romfs/wc7/eng/2042.wc7 b/assets/romfs/wc7/eng/2042.wc7 new file mode 100644 index 000000000..d67e5cac3 Binary files /dev/null and b/assets/romfs/wc7/eng/2042.wc7 differ diff --git a/assets/romfs/wc7/eng/2043.wc7 b/assets/romfs/wc7/eng/2043.wc7 new file mode 100644 index 000000000..f3ac9984c Binary files /dev/null and b/assets/romfs/wc7/eng/2043.wc7 differ diff --git a/assets/romfs/wc7/eng/2044.wc7 b/assets/romfs/wc7/eng/2044.wc7 new file mode 100644 index 000000000..ec67f27d5 Binary files /dev/null and b/assets/romfs/wc7/eng/2044.wc7 differ diff --git a/assets/romfs/wc7/eng/2045.wc7 b/assets/romfs/wc7/eng/2045.wc7 new file mode 100644 index 000000000..44ac5ea50 Binary files /dev/null and b/assets/romfs/wc7/eng/2045.wc7 differ diff --git a/assets/romfs/wc7/eng/2046.wc7 b/assets/romfs/wc7/eng/2046.wc7 new file mode 100644 index 000000000..82d312592 Binary files /dev/null and b/assets/romfs/wc7/eng/2046.wc7 differ diff --git a/assets/romfs/wc7/eng/43.wc7 b/assets/romfs/wc7/eng/43.wc7 new file mode 100644 index 000000000..0e9e25e3f Binary files /dev/null and b/assets/romfs/wc7/eng/43.wc7 differ diff --git a/assets/romfs/wc7/eng/46.wc7 b/assets/romfs/wc7/eng/46.wc7 new file mode 100644 index 000000000..9f315fcee Binary files /dev/null and b/assets/romfs/wc7/eng/46.wc7 differ diff --git a/assets/romfs/wc7/eng/47.wc7 b/assets/romfs/wc7/eng/47.wc7 new file mode 100644 index 000000000..5efb8a0d4 Binary files /dev/null and b/assets/romfs/wc7/eng/47.wc7 differ diff --git a/assets/romfs/wc7/eng/501.wc7 b/assets/romfs/wc7/eng/501.wc7 new file mode 100644 index 000000000..5fd0be4fb Binary files /dev/null and b/assets/romfs/wc7/eng/501.wc7 differ diff --git a/assets/romfs/wc7/eng/502.wc7 b/assets/romfs/wc7/eng/502.wc7 new file mode 100644 index 000000000..a5bd8c9cf Binary files /dev/null and b/assets/romfs/wc7/eng/502.wc7 differ diff --git a/assets/romfs/wc7/eng/504-1.wc7 b/assets/romfs/wc7/eng/504-1.wc7 new file mode 100644 index 000000000..db2880eb6 Binary files /dev/null and b/assets/romfs/wc7/eng/504-1.wc7 differ diff --git a/assets/romfs/wc7/eng/504-2.wc7 b/assets/romfs/wc7/eng/504-2.wc7 new file mode 100644 index 000000000..e545c46c8 Binary files /dev/null and b/assets/romfs/wc7/eng/504-2.wc7 differ diff --git a/assets/romfs/wc7/eng/510.wc7 b/assets/romfs/wc7/eng/510.wc7 new file mode 100644 index 000000000..6b3d5477d Binary files /dev/null and b/assets/romfs/wc7/eng/510.wc7 differ diff --git a/assets/romfs/wc7/eng/511.wc7 b/assets/romfs/wc7/eng/511.wc7 new file mode 100644 index 000000000..55ab00788 Binary files /dev/null and b/assets/romfs/wc7/eng/511.wc7 differ diff --git a/assets/romfs/wc7/eng/512.wc7 b/assets/romfs/wc7/eng/512.wc7 new file mode 100644 index 000000000..5c5a8140e Binary files /dev/null and b/assets/romfs/wc7/eng/512.wc7 differ diff --git a/assets/romfs/wc7/eng/515-1.wc7 b/assets/romfs/wc7/eng/515-1.wc7 new file mode 100644 index 000000000..645ce8006 Binary files /dev/null and b/assets/romfs/wc7/eng/515-1.wc7 differ diff --git a/assets/romfs/wc7/eng/515-2.wc7 b/assets/romfs/wc7/eng/515-2.wc7 new file mode 100644 index 000000000..f9f7fbc7c Binary files /dev/null and b/assets/romfs/wc7/eng/515-2.wc7 differ diff --git a/assets/romfs/wc7/eng/516.wc7 b/assets/romfs/wc7/eng/516.wc7 new file mode 100644 index 000000000..2711cc169 Binary files /dev/null and b/assets/romfs/wc7/eng/516.wc7 differ diff --git a/assets/romfs/wc7/eng/518.wc7 b/assets/romfs/wc7/eng/518.wc7 new file mode 100644 index 000000000..6a6acb81c Binary files /dev/null and b/assets/romfs/wc7/eng/518.wc7 differ diff --git a/assets/romfs/wc7/eng/523.wc7 b/assets/romfs/wc7/eng/523.wc7 new file mode 100644 index 000000000..a474a031a Binary files /dev/null and b/assets/romfs/wc7/eng/523.wc7 differ diff --git a/assets/romfs/wc7/eng/524.wc7 b/assets/romfs/wc7/eng/524.wc7 new file mode 100644 index 000000000..52bb7d2f0 Binary files /dev/null and b/assets/romfs/wc7/eng/524.wc7 differ diff --git a/assets/romfs/wc7/eng/525.wc7 b/assets/romfs/wc7/eng/525.wc7 new file mode 100644 index 000000000..9545d96a0 Binary files /dev/null and b/assets/romfs/wc7/eng/525.wc7 differ diff --git a/assets/romfs/wc7/eng/527.wc7 b/assets/romfs/wc7/eng/527.wc7 new file mode 100644 index 000000000..8f8296df6 Binary files /dev/null and b/assets/romfs/wc7/eng/527.wc7 differ diff --git a/assets/romfs/wc7/eng/535.wc7 b/assets/romfs/wc7/eng/535.wc7 new file mode 100644 index 000000000..225703bab Binary files /dev/null and b/assets/romfs/wc7/eng/535.wc7 differ diff --git a/assets/romfs/wc7/eng/536.wc7 b/assets/romfs/wc7/eng/536.wc7 new file mode 100644 index 000000000..1e98a129b Binary files /dev/null and b/assets/romfs/wc7/eng/536.wc7 differ diff --git a/assets/romfs/wc7/eng/537.wc7 b/assets/romfs/wc7/eng/537.wc7 new file mode 100644 index 000000000..7d61fab13 Binary files /dev/null and b/assets/romfs/wc7/eng/537.wc7 differ diff --git a/assets/romfs/wc7/eng/538.wc7 b/assets/romfs/wc7/eng/538.wc7 new file mode 100644 index 000000000..8e3533393 Binary files /dev/null and b/assets/romfs/wc7/eng/538.wc7 differ diff --git a/assets/romfs/wc7/eng/539.wc7 b/assets/romfs/wc7/eng/539.wc7 new file mode 100644 index 000000000..91f09a951 Binary files /dev/null and b/assets/romfs/wc7/eng/539.wc7 differ diff --git a/assets/romfs/wc7/eng/546.wc7 b/assets/romfs/wc7/eng/546.wc7 new file mode 100644 index 000000000..60d820cd0 Binary files /dev/null and b/assets/romfs/wc7/eng/546.wc7 differ diff --git a/assets/romfs/wc7/eng/547.wc7 b/assets/romfs/wc7/eng/547.wc7 new file mode 100644 index 000000000..82218f24f Binary files /dev/null and b/assets/romfs/wc7/eng/547.wc7 differ diff --git a/assets/romfs/wc7/eng/551-1.wc7 b/assets/romfs/wc7/eng/551-1.wc7 new file mode 100644 index 000000000..07ec1f012 Binary files /dev/null and b/assets/romfs/wc7/eng/551-1.wc7 differ diff --git a/assets/romfs/wc7/eng/551-2.wc7 b/assets/romfs/wc7/eng/551-2.wc7 new file mode 100644 index 000000000..9c76a9d17 Binary files /dev/null and b/assets/romfs/wc7/eng/551-2.wc7 differ diff --git a/assets/romfs/wc7/eng/552-1.wc7 b/assets/romfs/wc7/eng/552-1.wc7 new file mode 100644 index 000000000..2a5e78935 Binary files /dev/null and b/assets/romfs/wc7/eng/552-1.wc7 differ diff --git a/assets/romfs/wc7/eng/552-2.wc7 b/assets/romfs/wc7/eng/552-2.wc7 new file mode 100644 index 000000000..d2de6731d Binary files /dev/null and b/assets/romfs/wc7/eng/552-2.wc7 differ diff --git a/assets/romfs/wc7/eng/553.wc7 b/assets/romfs/wc7/eng/553.wc7 new file mode 100644 index 000000000..bf54f3cbf Binary files /dev/null and b/assets/romfs/wc7/eng/553.wc7 differ diff --git a/assets/romfs/wc7/eng/556.wc7 b/assets/romfs/wc7/eng/556.wc7 new file mode 100644 index 000000000..8e795d9b9 Binary files /dev/null and b/assets/romfs/wc7/eng/556.wc7 differ diff --git a/assets/romfs/wc7/eng/557.wc7 b/assets/romfs/wc7/eng/557.wc7 new file mode 100644 index 000000000..45e931bd4 Binary files /dev/null and b/assets/romfs/wc7/eng/557.wc7 differ diff --git a/assets/romfs/wc7/eng/558.wc7 b/assets/romfs/wc7/eng/558.wc7 new file mode 100644 index 000000000..d4e594935 Binary files /dev/null and b/assets/romfs/wc7/eng/558.wc7 differ diff --git a/assets/romfs/wc7/eng/559.wc7 b/assets/romfs/wc7/eng/559.wc7 new file mode 100644 index 000000000..63936222b Binary files /dev/null and b/assets/romfs/wc7/eng/559.wc7 differ diff --git a/assets/romfs/wc7/eng/560.wc7 b/assets/romfs/wc7/eng/560.wc7 new file mode 100644 index 000000000..5125a9b06 Binary files /dev/null and b/assets/romfs/wc7/eng/560.wc7 differ diff --git a/assets/romfs/wc7/eng/561.wc7 b/assets/romfs/wc7/eng/561.wc7 new file mode 100644 index 000000000..74cf64c45 Binary files /dev/null and b/assets/romfs/wc7/eng/561.wc7 differ diff --git a/assets/romfs/wc7/eng/562.wc7 b/assets/romfs/wc7/eng/562.wc7 new file mode 100644 index 000000000..cd7d36d09 Binary files /dev/null and b/assets/romfs/wc7/eng/562.wc7 differ diff --git a/assets/romfs/wc7/eng/563.wc7 b/assets/romfs/wc7/eng/563.wc7 new file mode 100644 index 000000000..b4ece899b Binary files /dev/null and b/assets/romfs/wc7/eng/563.wc7 differ diff --git a/assets/romfs/wc7/eng/564.wc7 b/assets/romfs/wc7/eng/564.wc7 new file mode 100644 index 000000000..f647bb48f Binary files /dev/null and b/assets/romfs/wc7/eng/564.wc7 differ diff --git a/assets/romfs/wc7/eng/565.wc7 b/assets/romfs/wc7/eng/565.wc7 new file mode 100644 index 000000000..85ec20d3c Binary files /dev/null and b/assets/romfs/wc7/eng/565.wc7 differ diff --git a/assets/romfs/wc7/eng/566.wc7 b/assets/romfs/wc7/eng/566.wc7 new file mode 100644 index 000000000..7954b7b36 Binary files /dev/null and b/assets/romfs/wc7/eng/566.wc7 differ diff --git a/assets/romfs/wc7/eng/567.wc7 b/assets/romfs/wc7/eng/567.wc7 new file mode 100644 index 000000000..3ccb93628 Binary files /dev/null and b/assets/romfs/wc7/eng/567.wc7 differ diff --git a/assets/romfs/wc7/eng/569.wc7 b/assets/romfs/wc7/eng/569.wc7 new file mode 100644 index 000000000..7d1549a27 Binary files /dev/null and b/assets/romfs/wc7/eng/569.wc7 differ diff --git a/assets/romfs/wc7/eng/570.wc7 b/assets/romfs/wc7/eng/570.wc7 new file mode 100644 index 000000000..408618944 Binary files /dev/null and b/assets/romfs/wc7/eng/570.wc7 differ diff --git a/assets/romfs/wc7/eng/571.wc7 b/assets/romfs/wc7/eng/571.wc7 new file mode 100644 index 000000000..7a277f37f Binary files /dev/null and b/assets/romfs/wc7/eng/571.wc7 differ diff --git a/assets/romfs/wc7/eng/574.wc7 b/assets/romfs/wc7/eng/574.wc7 new file mode 100644 index 000000000..15316a36b Binary files /dev/null and b/assets/romfs/wc7/eng/574.wc7 differ diff --git a/assets/romfs/wc7/eng/576.wc7 b/assets/romfs/wc7/eng/576.wc7 new file mode 100644 index 000000000..3c66a4114 Binary files /dev/null and b/assets/romfs/wc7/eng/576.wc7 differ diff --git a/assets/romfs/wc7/eng/577.wc7 b/assets/romfs/wc7/eng/577.wc7 new file mode 100644 index 000000000..80a144575 Binary files /dev/null and b/assets/romfs/wc7/eng/577.wc7 differ diff --git a/assets/romfs/wc7/eng/578.wc7 b/assets/romfs/wc7/eng/578.wc7 new file mode 100644 index 000000000..508452c5a Binary files /dev/null and b/assets/romfs/wc7/eng/578.wc7 differ diff --git a/assets/romfs/wc7/eng/580.wc7 b/assets/romfs/wc7/eng/580.wc7 new file mode 100644 index 000000000..12546fbb1 Binary files /dev/null and b/assets/romfs/wc7/eng/580.wc7 differ diff --git a/assets/romfs/wc7/eng/586.wc7 b/assets/romfs/wc7/eng/586.wc7 new file mode 100644 index 000000000..732592bae Binary files /dev/null and b/assets/romfs/wc7/eng/586.wc7 differ diff --git a/assets/romfs/wc7/eng/588.wc7 b/assets/romfs/wc7/eng/588.wc7 new file mode 100644 index 000000000..09d7cad98 Binary files /dev/null and b/assets/romfs/wc7/eng/588.wc7 differ diff --git a/assets/romfs/wc7/eng/590.wc7 b/assets/romfs/wc7/eng/590.wc7 new file mode 100644 index 000000000..8c83e49bb Binary files /dev/null and b/assets/romfs/wc7/eng/590.wc7 differ diff --git a/assets/romfs/wc7/eng/591.wc7 b/assets/romfs/wc7/eng/591.wc7 new file mode 100644 index 000000000..aa73ddc21 Binary files /dev/null and b/assets/romfs/wc7/eng/591.wc7 differ diff --git a/assets/romfs/wc7/eng/592.wc7 b/assets/romfs/wc7/eng/592.wc7 new file mode 100644 index 000000000..a3ec058be Binary files /dev/null and b/assets/romfs/wc7/eng/592.wc7 differ diff --git a/assets/romfs/wc7/eng/598.wc7 b/assets/romfs/wc7/eng/598.wc7 new file mode 100644 index 000000000..6db5a672b Binary files /dev/null and b/assets/romfs/wc7/eng/598.wc7 differ diff --git a/assets/romfs/wc7/eng/812.wc7 b/assets/romfs/wc7/eng/812.wc7 new file mode 100644 index 000000000..38e3826f0 Binary files /dev/null and b/assets/romfs/wc7/eng/812.wc7 differ diff --git a/assets/romfs/wc7/eng/90.wc7 b/assets/romfs/wc7/eng/90.wc7 new file mode 100644 index 000000000..f83e16e81 Binary files /dev/null and b/assets/romfs/wc7/eng/90.wc7 differ diff --git a/assets/romfs/wc7/fre/1501.wc7 b/assets/romfs/wc7/fre/1501.wc7 new file mode 100644 index 000000000..f8734d327 Binary files /dev/null and b/assets/romfs/wc7/fre/1501.wc7 differ diff --git a/assets/romfs/wc7/fre/1503.wc7 b/assets/romfs/wc7/fre/1503.wc7 new file mode 100644 index 000000000..a2926e0ea Binary files /dev/null and b/assets/romfs/wc7/fre/1503.wc7 differ diff --git a/assets/romfs/wc7/fre/1504.wc7 b/assets/romfs/wc7/fre/1504.wc7 new file mode 100644 index 000000000..c279c2d29 Binary files /dev/null and b/assets/romfs/wc7/fre/1504.wc7 differ diff --git a/assets/romfs/wc7/fre/1505.wc7 b/assets/romfs/wc7/fre/1505.wc7 new file mode 100644 index 000000000..15e3dab31 Binary files /dev/null and b/assets/romfs/wc7/fre/1505.wc7 differ diff --git a/assets/romfs/wc7/fre/1506.wc7 b/assets/romfs/wc7/fre/1506.wc7 new file mode 100644 index 000000000..354ede846 Binary files /dev/null and b/assets/romfs/wc7/fre/1506.wc7 differ diff --git a/assets/romfs/wc7/fre/1507.wc7 b/assets/romfs/wc7/fre/1507.wc7 new file mode 100644 index 000000000..4e4f2d58b Binary files /dev/null and b/assets/romfs/wc7/fre/1507.wc7 differ diff --git a/assets/romfs/wc7/fre/1508.wc7 b/assets/romfs/wc7/fre/1508.wc7 new file mode 100644 index 000000000..8f3ca072e Binary files /dev/null and b/assets/romfs/wc7/fre/1508.wc7 differ diff --git a/assets/romfs/wc7/fre/1509.wc7 b/assets/romfs/wc7/fre/1509.wc7 new file mode 100644 index 000000000..1ae9ae4f4 Binary files /dev/null and b/assets/romfs/wc7/fre/1509.wc7 differ diff --git a/assets/romfs/wc7/fre/1510.wc7 b/assets/romfs/wc7/fre/1510.wc7 new file mode 100644 index 000000000..a20748cb9 Binary files /dev/null and b/assets/romfs/wc7/fre/1510.wc7 differ diff --git a/assets/romfs/wc7/fre/1511.wc7 b/assets/romfs/wc7/fre/1511.wc7 new file mode 100644 index 000000000..162525686 Binary files /dev/null and b/assets/romfs/wc7/fre/1511.wc7 differ diff --git a/assets/romfs/wc7/fre/1512.wc7 b/assets/romfs/wc7/fre/1512.wc7 new file mode 100644 index 000000000..f3d2194d8 Binary files /dev/null and b/assets/romfs/wc7/fre/1512.wc7 differ diff --git a/assets/romfs/wc7/fre/1513.wc7 b/assets/romfs/wc7/fre/1513.wc7 new file mode 100644 index 000000000..350f5acf7 Binary files /dev/null and b/assets/romfs/wc7/fre/1513.wc7 differ diff --git a/assets/romfs/wc7/fre/1514.wc7 b/assets/romfs/wc7/fre/1514.wc7 new file mode 100644 index 000000000..2141acda6 Binary files /dev/null and b/assets/romfs/wc7/fre/1514.wc7 differ diff --git a/assets/romfs/wc7/fre/1515.wc7 b/assets/romfs/wc7/fre/1515.wc7 new file mode 100644 index 000000000..c908effcb Binary files /dev/null and b/assets/romfs/wc7/fre/1515.wc7 differ diff --git a/assets/romfs/wc7/fre/1516.wc7 b/assets/romfs/wc7/fre/1516.wc7 new file mode 100644 index 000000000..a5a6bb6a3 Binary files /dev/null and b/assets/romfs/wc7/fre/1516.wc7 differ diff --git a/assets/romfs/wc7/fre/1601.wc7 b/assets/romfs/wc7/fre/1601.wc7 new file mode 100644 index 000000000..831a63135 Binary files /dev/null and b/assets/romfs/wc7/fre/1601.wc7 differ diff --git a/assets/romfs/wc7/fre/1602.wc7 b/assets/romfs/wc7/fre/1602.wc7 new file mode 100644 index 000000000..13d5d7f84 Binary files /dev/null and b/assets/romfs/wc7/fre/1602.wc7 differ diff --git a/assets/romfs/wc7/fre/1603.wc7 b/assets/romfs/wc7/fre/1603.wc7 new file mode 100644 index 000000000..544646d01 Binary files /dev/null and b/assets/romfs/wc7/fre/1603.wc7 differ diff --git a/assets/romfs/wc7/fre/175.wc7 b/assets/romfs/wc7/fre/175.wc7 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc7/fre/175.wc7 differ diff --git a/assets/romfs/wc7/fre/2040.wc7 b/assets/romfs/wc7/fre/2040.wc7 new file mode 100644 index 000000000..941364f15 Binary files /dev/null and b/assets/romfs/wc7/fre/2040.wc7 differ diff --git a/assets/romfs/wc7/fre/2041.wc7 b/assets/romfs/wc7/fre/2041.wc7 new file mode 100644 index 000000000..a1c2e4006 Binary files /dev/null and b/assets/romfs/wc7/fre/2041.wc7 differ diff --git a/assets/romfs/wc7/fre/2042.wc7 b/assets/romfs/wc7/fre/2042.wc7 new file mode 100644 index 000000000..020f1ecf9 Binary files /dev/null and b/assets/romfs/wc7/fre/2042.wc7 differ diff --git a/assets/romfs/wc7/fre/2043.wc7 b/assets/romfs/wc7/fre/2043.wc7 new file mode 100644 index 000000000..58df0c364 Binary files /dev/null and b/assets/romfs/wc7/fre/2043.wc7 differ diff --git a/assets/romfs/wc7/fre/2044.wc7 b/assets/romfs/wc7/fre/2044.wc7 new file mode 100644 index 000000000..f3610117a Binary files /dev/null and b/assets/romfs/wc7/fre/2044.wc7 differ diff --git a/assets/romfs/wc7/fre/2045.wc7 b/assets/romfs/wc7/fre/2045.wc7 new file mode 100644 index 000000000..7fd91ca5e Binary files /dev/null and b/assets/romfs/wc7/fre/2045.wc7 differ diff --git a/assets/romfs/wc7/fre/2046.wc7 b/assets/romfs/wc7/fre/2046.wc7 new file mode 100644 index 000000000..af4b35ed8 Binary files /dev/null and b/assets/romfs/wc7/fre/2046.wc7 differ diff --git a/assets/romfs/wc7/fre/49.wc7 b/assets/romfs/wc7/fre/49.wc7 new file mode 100644 index 000000000..8c877daaa Binary files /dev/null and b/assets/romfs/wc7/fre/49.wc7 differ diff --git a/assets/romfs/wc7/fre/504-1.wc7 b/assets/romfs/wc7/fre/504-1.wc7 new file mode 100644 index 000000000..d12f4c059 Binary files /dev/null and b/assets/romfs/wc7/fre/504-1.wc7 differ diff --git a/assets/romfs/wc7/fre/504-2.wc7 b/assets/romfs/wc7/fre/504-2.wc7 new file mode 100644 index 000000000..cec1e163f Binary files /dev/null and b/assets/romfs/wc7/fre/504-2.wc7 differ diff --git a/assets/romfs/wc7/fre/511.wc7 b/assets/romfs/wc7/fre/511.wc7 new file mode 100644 index 000000000..789edce84 Binary files /dev/null and b/assets/romfs/wc7/fre/511.wc7 differ diff --git a/assets/romfs/wc7/fre/523.wc7 b/assets/romfs/wc7/fre/523.wc7 new file mode 100644 index 000000000..7367fec69 Binary files /dev/null and b/assets/romfs/wc7/fre/523.wc7 differ diff --git a/assets/romfs/wc7/fre/524.wc7 b/assets/romfs/wc7/fre/524.wc7 new file mode 100644 index 000000000..3953dd08d Binary files /dev/null and b/assets/romfs/wc7/fre/524.wc7 differ diff --git a/assets/romfs/wc7/fre/525.wc7 b/assets/romfs/wc7/fre/525.wc7 new file mode 100644 index 000000000..226511b70 Binary files /dev/null and b/assets/romfs/wc7/fre/525.wc7 differ diff --git a/assets/romfs/wc7/fre/537.wc7 b/assets/romfs/wc7/fre/537.wc7 new file mode 100644 index 000000000..2a9b66c7f Binary files /dev/null and b/assets/romfs/wc7/fre/537.wc7 differ diff --git a/assets/romfs/wc7/fre/538.wc7 b/assets/romfs/wc7/fre/538.wc7 new file mode 100644 index 000000000..796a41933 Binary files /dev/null and b/assets/romfs/wc7/fre/538.wc7 differ diff --git a/assets/romfs/wc7/fre/546.wc7 b/assets/romfs/wc7/fre/546.wc7 new file mode 100644 index 000000000..e1fc42ef6 Binary files /dev/null and b/assets/romfs/wc7/fre/546.wc7 differ diff --git a/assets/romfs/wc7/fre/547.wc7 b/assets/romfs/wc7/fre/547.wc7 new file mode 100644 index 000000000..73467a99e Binary files /dev/null and b/assets/romfs/wc7/fre/547.wc7 differ diff --git a/assets/romfs/wc7/fre/551-1.wc7 b/assets/romfs/wc7/fre/551-1.wc7 new file mode 100644 index 000000000..f38c446c4 Binary files /dev/null and b/assets/romfs/wc7/fre/551-1.wc7 differ diff --git a/assets/romfs/wc7/fre/551-2.wc7 b/assets/romfs/wc7/fre/551-2.wc7 new file mode 100644 index 000000000..f0a8b9764 Binary files /dev/null and b/assets/romfs/wc7/fre/551-2.wc7 differ diff --git a/assets/romfs/wc7/fre/552-1.wc7 b/assets/romfs/wc7/fre/552-1.wc7 new file mode 100644 index 000000000..63586dcda Binary files /dev/null and b/assets/romfs/wc7/fre/552-1.wc7 differ diff --git a/assets/romfs/wc7/fre/552-2.wc7 b/assets/romfs/wc7/fre/552-2.wc7 new file mode 100644 index 000000000..e45556722 Binary files /dev/null and b/assets/romfs/wc7/fre/552-2.wc7 differ diff --git a/assets/romfs/wc7/fre/553.wc7 b/assets/romfs/wc7/fre/553.wc7 new file mode 100644 index 000000000..1c3963ecd Binary files /dev/null and b/assets/romfs/wc7/fre/553.wc7 differ diff --git a/assets/romfs/wc7/fre/556.wc7 b/assets/romfs/wc7/fre/556.wc7 new file mode 100644 index 000000000..4b36092c1 Binary files /dev/null and b/assets/romfs/wc7/fre/556.wc7 differ diff --git a/assets/romfs/wc7/fre/557.wc7 b/assets/romfs/wc7/fre/557.wc7 new file mode 100644 index 000000000..bb98b7def Binary files /dev/null and b/assets/romfs/wc7/fre/557.wc7 differ diff --git a/assets/romfs/wc7/fre/558.wc7 b/assets/romfs/wc7/fre/558.wc7 new file mode 100644 index 000000000..a70aab8cb Binary files /dev/null and b/assets/romfs/wc7/fre/558.wc7 differ diff --git a/assets/romfs/wc7/fre/559.wc7 b/assets/romfs/wc7/fre/559.wc7 new file mode 100644 index 000000000..9a857c0c4 Binary files /dev/null and b/assets/romfs/wc7/fre/559.wc7 differ diff --git a/assets/romfs/wc7/fre/560.wc7 b/assets/romfs/wc7/fre/560.wc7 new file mode 100644 index 000000000..1e44edd7e Binary files /dev/null and b/assets/romfs/wc7/fre/560.wc7 differ diff --git a/assets/romfs/wc7/fre/561.wc7 b/assets/romfs/wc7/fre/561.wc7 new file mode 100644 index 000000000..7eb406b3a Binary files /dev/null and b/assets/romfs/wc7/fre/561.wc7 differ diff --git a/assets/romfs/wc7/fre/562.wc7 b/assets/romfs/wc7/fre/562.wc7 new file mode 100644 index 000000000..183c81ff6 Binary files /dev/null and b/assets/romfs/wc7/fre/562.wc7 differ diff --git a/assets/romfs/wc7/fre/563.wc7 b/assets/romfs/wc7/fre/563.wc7 new file mode 100644 index 000000000..0183042d9 Binary files /dev/null and b/assets/romfs/wc7/fre/563.wc7 differ diff --git a/assets/romfs/wc7/fre/564.wc7 b/assets/romfs/wc7/fre/564.wc7 new file mode 100644 index 000000000..8033e696e Binary files /dev/null and b/assets/romfs/wc7/fre/564.wc7 differ diff --git a/assets/romfs/wc7/fre/565.wc7 b/assets/romfs/wc7/fre/565.wc7 new file mode 100644 index 000000000..150c024e6 Binary files /dev/null and b/assets/romfs/wc7/fre/565.wc7 differ diff --git a/assets/romfs/wc7/fre/566.wc7 b/assets/romfs/wc7/fre/566.wc7 new file mode 100644 index 000000000..1758fa6d7 Binary files /dev/null and b/assets/romfs/wc7/fre/566.wc7 differ diff --git a/assets/romfs/wc7/fre/567.wc7 b/assets/romfs/wc7/fre/567.wc7 new file mode 100644 index 000000000..777b3de27 Binary files /dev/null and b/assets/romfs/wc7/fre/567.wc7 differ diff --git a/assets/romfs/wc7/fre/569.wc7 b/assets/romfs/wc7/fre/569.wc7 new file mode 100644 index 000000000..f28ac0d0c Binary files /dev/null and b/assets/romfs/wc7/fre/569.wc7 differ diff --git a/assets/romfs/wc7/fre/570.wc7 b/assets/romfs/wc7/fre/570.wc7 new file mode 100644 index 000000000..66741280b Binary files /dev/null and b/assets/romfs/wc7/fre/570.wc7 differ diff --git a/assets/romfs/wc7/fre/571.wc7 b/assets/romfs/wc7/fre/571.wc7 new file mode 100644 index 000000000..8aef6d28e Binary files /dev/null and b/assets/romfs/wc7/fre/571.wc7 differ diff --git a/assets/romfs/wc7/fre/574.wc7 b/assets/romfs/wc7/fre/574.wc7 new file mode 100644 index 000000000..0bdc9e345 Binary files /dev/null and b/assets/romfs/wc7/fre/574.wc7 differ diff --git a/assets/romfs/wc7/fre/576.wc7 b/assets/romfs/wc7/fre/576.wc7 new file mode 100644 index 000000000..4e4fd084a Binary files /dev/null and b/assets/romfs/wc7/fre/576.wc7 differ diff --git a/assets/romfs/wc7/fre/577.wc7 b/assets/romfs/wc7/fre/577.wc7 new file mode 100644 index 000000000..13fbafeea Binary files /dev/null and b/assets/romfs/wc7/fre/577.wc7 differ diff --git a/assets/romfs/wc7/fre/578.wc7 b/assets/romfs/wc7/fre/578.wc7 new file mode 100644 index 000000000..cbe02600f Binary files /dev/null and b/assets/romfs/wc7/fre/578.wc7 differ diff --git a/assets/romfs/wc7/fre/586.wc7 b/assets/romfs/wc7/fre/586.wc7 new file mode 100644 index 000000000..4f369731e Binary files /dev/null and b/assets/romfs/wc7/fre/586.wc7 differ diff --git a/assets/romfs/wc7/fre/588.wc7 b/assets/romfs/wc7/fre/588.wc7 new file mode 100644 index 000000000..baa83ad3c Binary files /dev/null and b/assets/romfs/wc7/fre/588.wc7 differ diff --git a/assets/romfs/wc7/fre/598.wc7 b/assets/romfs/wc7/fre/598.wc7 new file mode 100644 index 000000000..7486273f6 Binary files /dev/null and b/assets/romfs/wc7/fre/598.wc7 differ diff --git a/assets/romfs/wc7/fre/812.wc7 b/assets/romfs/wc7/fre/812.wc7 new file mode 100644 index 000000000..0c05ad730 Binary files /dev/null and b/assets/romfs/wc7/fre/812.wc7 differ diff --git a/assets/romfs/wc7/ger/1501.wc7 b/assets/romfs/wc7/ger/1501.wc7 new file mode 100644 index 000000000..fbc8360b5 Binary files /dev/null and b/assets/romfs/wc7/ger/1501.wc7 differ diff --git a/assets/romfs/wc7/ger/1503.wc7 b/assets/romfs/wc7/ger/1503.wc7 new file mode 100644 index 000000000..c55619d93 Binary files /dev/null and b/assets/romfs/wc7/ger/1503.wc7 differ diff --git a/assets/romfs/wc7/ger/1504.wc7 b/assets/romfs/wc7/ger/1504.wc7 new file mode 100644 index 000000000..60e618e29 Binary files /dev/null and b/assets/romfs/wc7/ger/1504.wc7 differ diff --git a/assets/romfs/wc7/ger/1505.wc7 b/assets/romfs/wc7/ger/1505.wc7 new file mode 100644 index 000000000..caaf5652e Binary files /dev/null and b/assets/romfs/wc7/ger/1505.wc7 differ diff --git a/assets/romfs/wc7/ger/1506.wc7 b/assets/romfs/wc7/ger/1506.wc7 new file mode 100644 index 000000000..348053963 Binary files /dev/null and b/assets/romfs/wc7/ger/1506.wc7 differ diff --git a/assets/romfs/wc7/ger/1507.wc7 b/assets/romfs/wc7/ger/1507.wc7 new file mode 100644 index 000000000..bac63a95c Binary files /dev/null and b/assets/romfs/wc7/ger/1507.wc7 differ diff --git a/assets/romfs/wc7/ger/1508.wc7 b/assets/romfs/wc7/ger/1508.wc7 new file mode 100644 index 000000000..934df6375 Binary files /dev/null and b/assets/romfs/wc7/ger/1508.wc7 differ diff --git a/assets/romfs/wc7/ger/1509.wc7 b/assets/romfs/wc7/ger/1509.wc7 new file mode 100644 index 000000000..62ba2ad9b Binary files /dev/null and b/assets/romfs/wc7/ger/1509.wc7 differ diff --git a/assets/romfs/wc7/ger/1510.wc7 b/assets/romfs/wc7/ger/1510.wc7 new file mode 100644 index 000000000..261934692 Binary files /dev/null and b/assets/romfs/wc7/ger/1510.wc7 differ diff --git a/assets/romfs/wc7/ger/1511.wc7 b/assets/romfs/wc7/ger/1511.wc7 new file mode 100644 index 000000000..74d46e88a Binary files /dev/null and b/assets/romfs/wc7/ger/1511.wc7 differ diff --git a/assets/romfs/wc7/ger/1512.wc7 b/assets/romfs/wc7/ger/1512.wc7 new file mode 100644 index 000000000..fab00c433 Binary files /dev/null and b/assets/romfs/wc7/ger/1512.wc7 differ diff --git a/assets/romfs/wc7/ger/1513.wc7 b/assets/romfs/wc7/ger/1513.wc7 new file mode 100644 index 000000000..4defffe4c Binary files /dev/null and b/assets/romfs/wc7/ger/1513.wc7 differ diff --git a/assets/romfs/wc7/ger/1514.wc7 b/assets/romfs/wc7/ger/1514.wc7 new file mode 100644 index 000000000..4283b9eef Binary files /dev/null and b/assets/romfs/wc7/ger/1514.wc7 differ diff --git a/assets/romfs/wc7/ger/1515.wc7 b/assets/romfs/wc7/ger/1515.wc7 new file mode 100644 index 000000000..128261164 Binary files /dev/null and b/assets/romfs/wc7/ger/1515.wc7 differ diff --git a/assets/romfs/wc7/ger/1516.wc7 b/assets/romfs/wc7/ger/1516.wc7 new file mode 100644 index 000000000..d5a841062 Binary files /dev/null and b/assets/romfs/wc7/ger/1516.wc7 differ diff --git a/assets/romfs/wc7/ger/1601.wc7 b/assets/romfs/wc7/ger/1601.wc7 new file mode 100644 index 000000000..72b942b15 Binary files /dev/null and b/assets/romfs/wc7/ger/1601.wc7 differ diff --git a/assets/romfs/wc7/ger/1602.wc7 b/assets/romfs/wc7/ger/1602.wc7 new file mode 100644 index 000000000..abd982272 Binary files /dev/null and b/assets/romfs/wc7/ger/1602.wc7 differ diff --git a/assets/romfs/wc7/ger/175.wc7 b/assets/romfs/wc7/ger/175.wc7 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc7/ger/175.wc7 differ diff --git a/assets/romfs/wc7/ger/2040.wc7 b/assets/romfs/wc7/ger/2040.wc7 new file mode 100644 index 000000000..2dd6a736b Binary files /dev/null and b/assets/romfs/wc7/ger/2040.wc7 differ diff --git a/assets/romfs/wc7/ger/2041.wc7 b/assets/romfs/wc7/ger/2041.wc7 new file mode 100644 index 000000000..bdcfa8b30 Binary files /dev/null and b/assets/romfs/wc7/ger/2041.wc7 differ diff --git a/assets/romfs/wc7/ger/2042.wc7 b/assets/romfs/wc7/ger/2042.wc7 new file mode 100644 index 000000000..bb8f27433 Binary files /dev/null and b/assets/romfs/wc7/ger/2042.wc7 differ diff --git a/assets/romfs/wc7/ger/2043.wc7 b/assets/romfs/wc7/ger/2043.wc7 new file mode 100644 index 000000000..a06581619 Binary files /dev/null and b/assets/romfs/wc7/ger/2043.wc7 differ diff --git a/assets/romfs/wc7/ger/2044.wc7 b/assets/romfs/wc7/ger/2044.wc7 new file mode 100644 index 000000000..affb67ac0 Binary files /dev/null and b/assets/romfs/wc7/ger/2044.wc7 differ diff --git a/assets/romfs/wc7/ger/2045.wc7 b/assets/romfs/wc7/ger/2045.wc7 new file mode 100644 index 000000000..89ba19b01 Binary files /dev/null and b/assets/romfs/wc7/ger/2045.wc7 differ diff --git a/assets/romfs/wc7/ger/2046.wc7 b/assets/romfs/wc7/ger/2046.wc7 new file mode 100644 index 000000000..1fdb93d77 Binary files /dev/null and b/assets/romfs/wc7/ger/2046.wc7 differ diff --git a/assets/romfs/wc7/ger/504-1.wc7 b/assets/romfs/wc7/ger/504-1.wc7 new file mode 100644 index 000000000..d31b53325 Binary files /dev/null and b/assets/romfs/wc7/ger/504-1.wc7 differ diff --git a/assets/romfs/wc7/ger/504-2.wc7 b/assets/romfs/wc7/ger/504-2.wc7 new file mode 100644 index 000000000..2a1ace20e Binary files /dev/null and b/assets/romfs/wc7/ger/504-2.wc7 differ diff --git a/assets/romfs/wc7/ger/510.wc7 b/assets/romfs/wc7/ger/510.wc7 new file mode 100644 index 000000000..642ad748e Binary files /dev/null and b/assets/romfs/wc7/ger/510.wc7 differ diff --git a/assets/romfs/wc7/ger/511.wc7 b/assets/romfs/wc7/ger/511.wc7 new file mode 100644 index 000000000..f45f2f3aa Binary files /dev/null and b/assets/romfs/wc7/ger/511.wc7 differ diff --git a/assets/romfs/wc7/ger/523.wc7 b/assets/romfs/wc7/ger/523.wc7 new file mode 100644 index 000000000..10f0fd704 Binary files /dev/null and b/assets/romfs/wc7/ger/523.wc7 differ diff --git a/assets/romfs/wc7/ger/524.wc7 b/assets/romfs/wc7/ger/524.wc7 new file mode 100644 index 000000000..a9f99bc42 Binary files /dev/null and b/assets/romfs/wc7/ger/524.wc7 differ diff --git a/assets/romfs/wc7/ger/525.wc7 b/assets/romfs/wc7/ger/525.wc7 new file mode 100644 index 000000000..e3bc203e7 Binary files /dev/null and b/assets/romfs/wc7/ger/525.wc7 differ diff --git a/assets/romfs/wc7/ger/537.wc7 b/assets/romfs/wc7/ger/537.wc7 new file mode 100644 index 000000000..7676586d5 Binary files /dev/null and b/assets/romfs/wc7/ger/537.wc7 differ diff --git a/assets/romfs/wc7/ger/546.wc7 b/assets/romfs/wc7/ger/546.wc7 new file mode 100644 index 000000000..79fd17157 Binary files /dev/null and b/assets/romfs/wc7/ger/546.wc7 differ diff --git a/assets/romfs/wc7/ger/547.wc7 b/assets/romfs/wc7/ger/547.wc7 new file mode 100644 index 000000000..1d4a75ceb Binary files /dev/null and b/assets/romfs/wc7/ger/547.wc7 differ diff --git a/assets/romfs/wc7/ger/551-1.wc7 b/assets/romfs/wc7/ger/551-1.wc7 new file mode 100644 index 000000000..b031e5aa8 Binary files /dev/null and b/assets/romfs/wc7/ger/551-1.wc7 differ diff --git a/assets/romfs/wc7/ger/551-2.wc7 b/assets/romfs/wc7/ger/551-2.wc7 new file mode 100644 index 000000000..bac376126 Binary files /dev/null and b/assets/romfs/wc7/ger/551-2.wc7 differ diff --git a/assets/romfs/wc7/ger/552-1.wc7 b/assets/romfs/wc7/ger/552-1.wc7 new file mode 100644 index 000000000..b419bfc70 Binary files /dev/null and b/assets/romfs/wc7/ger/552-1.wc7 differ diff --git a/assets/romfs/wc7/ger/552-2.wc7 b/assets/romfs/wc7/ger/552-2.wc7 new file mode 100644 index 000000000..47e51a531 Binary files /dev/null and b/assets/romfs/wc7/ger/552-2.wc7 differ diff --git a/assets/romfs/wc7/ger/553.wc7 b/assets/romfs/wc7/ger/553.wc7 new file mode 100644 index 000000000..db634096e Binary files /dev/null and b/assets/romfs/wc7/ger/553.wc7 differ diff --git a/assets/romfs/wc7/ger/556.wc7 b/assets/romfs/wc7/ger/556.wc7 new file mode 100644 index 000000000..8afc014c5 Binary files /dev/null and b/assets/romfs/wc7/ger/556.wc7 differ diff --git a/assets/romfs/wc7/ger/557.wc7 b/assets/romfs/wc7/ger/557.wc7 new file mode 100644 index 000000000..9d70f3f40 Binary files /dev/null and b/assets/romfs/wc7/ger/557.wc7 differ diff --git a/assets/romfs/wc7/ger/558.wc7 b/assets/romfs/wc7/ger/558.wc7 new file mode 100644 index 000000000..2a957cd7e Binary files /dev/null and b/assets/romfs/wc7/ger/558.wc7 differ diff --git a/assets/romfs/wc7/ger/559.wc7 b/assets/romfs/wc7/ger/559.wc7 new file mode 100644 index 000000000..d8da53b35 Binary files /dev/null and b/assets/romfs/wc7/ger/559.wc7 differ diff --git a/assets/romfs/wc7/ger/560.wc7 b/assets/romfs/wc7/ger/560.wc7 new file mode 100644 index 000000000..d67f4b205 Binary files /dev/null and b/assets/romfs/wc7/ger/560.wc7 differ diff --git a/assets/romfs/wc7/ger/561.wc7 b/assets/romfs/wc7/ger/561.wc7 new file mode 100644 index 000000000..74d4dd340 Binary files /dev/null and b/assets/romfs/wc7/ger/561.wc7 differ diff --git a/assets/romfs/wc7/ger/562.wc7 b/assets/romfs/wc7/ger/562.wc7 new file mode 100644 index 000000000..7f3057762 Binary files /dev/null and b/assets/romfs/wc7/ger/562.wc7 differ diff --git a/assets/romfs/wc7/ger/563.wc7 b/assets/romfs/wc7/ger/563.wc7 new file mode 100644 index 000000000..bb16cb4bf Binary files /dev/null and b/assets/romfs/wc7/ger/563.wc7 differ diff --git a/assets/romfs/wc7/ger/564.wc7 b/assets/romfs/wc7/ger/564.wc7 new file mode 100644 index 000000000..99550693b Binary files /dev/null and b/assets/romfs/wc7/ger/564.wc7 differ diff --git a/assets/romfs/wc7/ger/565.wc7 b/assets/romfs/wc7/ger/565.wc7 new file mode 100644 index 000000000..ca86d1aaf Binary files /dev/null and b/assets/romfs/wc7/ger/565.wc7 differ diff --git a/assets/romfs/wc7/ger/566.wc7 b/assets/romfs/wc7/ger/566.wc7 new file mode 100644 index 000000000..45adb9ad0 Binary files /dev/null and b/assets/romfs/wc7/ger/566.wc7 differ diff --git a/assets/romfs/wc7/ger/567.wc7 b/assets/romfs/wc7/ger/567.wc7 new file mode 100644 index 000000000..d69a32641 Binary files /dev/null and b/assets/romfs/wc7/ger/567.wc7 differ diff --git a/assets/romfs/wc7/ger/569.wc7 b/assets/romfs/wc7/ger/569.wc7 new file mode 100644 index 000000000..9b27a004f Binary files /dev/null and b/assets/romfs/wc7/ger/569.wc7 differ diff --git a/assets/romfs/wc7/ger/570.wc7 b/assets/romfs/wc7/ger/570.wc7 new file mode 100644 index 000000000..2ca965005 Binary files /dev/null and b/assets/romfs/wc7/ger/570.wc7 differ diff --git a/assets/romfs/wc7/ger/571.wc7 b/assets/romfs/wc7/ger/571.wc7 new file mode 100644 index 000000000..44a89b6aa Binary files /dev/null and b/assets/romfs/wc7/ger/571.wc7 differ diff --git a/assets/romfs/wc7/ger/574.wc7 b/assets/romfs/wc7/ger/574.wc7 new file mode 100644 index 000000000..79d2159a1 Binary files /dev/null and b/assets/romfs/wc7/ger/574.wc7 differ diff --git a/assets/romfs/wc7/ger/576.wc7 b/assets/romfs/wc7/ger/576.wc7 new file mode 100644 index 000000000..8cf09c768 Binary files /dev/null and b/assets/romfs/wc7/ger/576.wc7 differ diff --git a/assets/romfs/wc7/ger/577.wc7 b/assets/romfs/wc7/ger/577.wc7 new file mode 100644 index 000000000..550c9667e Binary files /dev/null and b/assets/romfs/wc7/ger/577.wc7 differ diff --git a/assets/romfs/wc7/ger/578.wc7 b/assets/romfs/wc7/ger/578.wc7 new file mode 100644 index 000000000..cb2168a0a Binary files /dev/null and b/assets/romfs/wc7/ger/578.wc7 differ diff --git a/assets/romfs/wc7/ger/586.wc7 b/assets/romfs/wc7/ger/586.wc7 new file mode 100644 index 000000000..06b1f1441 Binary files /dev/null and b/assets/romfs/wc7/ger/586.wc7 differ diff --git a/assets/romfs/wc7/ger/588.wc7 b/assets/romfs/wc7/ger/588.wc7 new file mode 100644 index 000000000..0bc6db72f Binary files /dev/null and b/assets/romfs/wc7/ger/588.wc7 differ diff --git a/assets/romfs/wc7/ger/812.wc7 b/assets/romfs/wc7/ger/812.wc7 new file mode 100644 index 000000000..9592c5dd5 Binary files /dev/null and b/assets/romfs/wc7/ger/812.wc7 differ diff --git a/assets/romfs/wc7/ita/1501.wc7 b/assets/romfs/wc7/ita/1501.wc7 new file mode 100644 index 000000000..f148ceb19 Binary files /dev/null and b/assets/romfs/wc7/ita/1501.wc7 differ diff --git a/assets/romfs/wc7/ita/1503.wc7 b/assets/romfs/wc7/ita/1503.wc7 new file mode 100644 index 000000000..2e1319b2f Binary files /dev/null and b/assets/romfs/wc7/ita/1503.wc7 differ diff --git a/assets/romfs/wc7/ita/1504.wc7 b/assets/romfs/wc7/ita/1504.wc7 new file mode 100644 index 000000000..92e98b6ac Binary files /dev/null and b/assets/romfs/wc7/ita/1504.wc7 differ diff --git a/assets/romfs/wc7/ita/1505.wc7 b/assets/romfs/wc7/ita/1505.wc7 new file mode 100644 index 000000000..e0c00e51e Binary files /dev/null and b/assets/romfs/wc7/ita/1505.wc7 differ diff --git a/assets/romfs/wc7/ita/1506.wc7 b/assets/romfs/wc7/ita/1506.wc7 new file mode 100644 index 000000000..4fa968586 Binary files /dev/null and b/assets/romfs/wc7/ita/1506.wc7 differ diff --git a/assets/romfs/wc7/ita/1507.wc7 b/assets/romfs/wc7/ita/1507.wc7 new file mode 100644 index 000000000..2f1869826 Binary files /dev/null and b/assets/romfs/wc7/ita/1507.wc7 differ diff --git a/assets/romfs/wc7/ita/1508.wc7 b/assets/romfs/wc7/ita/1508.wc7 new file mode 100644 index 000000000..7c7ec3d78 Binary files /dev/null and b/assets/romfs/wc7/ita/1508.wc7 differ diff --git a/assets/romfs/wc7/ita/1509.wc7 b/assets/romfs/wc7/ita/1509.wc7 new file mode 100644 index 000000000..1ec346f01 Binary files /dev/null and b/assets/romfs/wc7/ita/1509.wc7 differ diff --git a/assets/romfs/wc7/ita/1510.wc7 b/assets/romfs/wc7/ita/1510.wc7 new file mode 100644 index 000000000..a58574493 Binary files /dev/null and b/assets/romfs/wc7/ita/1510.wc7 differ diff --git a/assets/romfs/wc7/ita/1511.wc7 b/assets/romfs/wc7/ita/1511.wc7 new file mode 100644 index 000000000..2808fc536 Binary files /dev/null and b/assets/romfs/wc7/ita/1511.wc7 differ diff --git a/assets/romfs/wc7/ita/1512.wc7 b/assets/romfs/wc7/ita/1512.wc7 new file mode 100644 index 000000000..518447313 Binary files /dev/null and b/assets/romfs/wc7/ita/1512.wc7 differ diff --git a/assets/romfs/wc7/ita/1513.wc7 b/assets/romfs/wc7/ita/1513.wc7 new file mode 100644 index 000000000..016d6807a Binary files /dev/null and b/assets/romfs/wc7/ita/1513.wc7 differ diff --git a/assets/romfs/wc7/ita/1514.wc7 b/assets/romfs/wc7/ita/1514.wc7 new file mode 100644 index 000000000..d96098020 Binary files /dev/null and b/assets/romfs/wc7/ita/1514.wc7 differ diff --git a/assets/romfs/wc7/ita/1515.wc7 b/assets/romfs/wc7/ita/1515.wc7 new file mode 100644 index 000000000..1b78ba2cf Binary files /dev/null and b/assets/romfs/wc7/ita/1515.wc7 differ diff --git a/assets/romfs/wc7/ita/1516.wc7 b/assets/romfs/wc7/ita/1516.wc7 new file mode 100644 index 000000000..6bdb705b1 Binary files /dev/null and b/assets/romfs/wc7/ita/1516.wc7 differ diff --git a/assets/romfs/wc7/ita/1601.wc7 b/assets/romfs/wc7/ita/1601.wc7 new file mode 100644 index 000000000..87e8238c3 Binary files /dev/null and b/assets/romfs/wc7/ita/1601.wc7 differ diff --git a/assets/romfs/wc7/ita/1602.wc7 b/assets/romfs/wc7/ita/1602.wc7 new file mode 100644 index 000000000..68631390a Binary files /dev/null and b/assets/romfs/wc7/ita/1602.wc7 differ diff --git a/assets/romfs/wc7/ita/175.wc7 b/assets/romfs/wc7/ita/175.wc7 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc7/ita/175.wc7 differ diff --git a/assets/romfs/wc7/ita/2040.wc7 b/assets/romfs/wc7/ita/2040.wc7 new file mode 100644 index 000000000..d51923c2e Binary files /dev/null and b/assets/romfs/wc7/ita/2040.wc7 differ diff --git a/assets/romfs/wc7/ita/2041.wc7 b/assets/romfs/wc7/ita/2041.wc7 new file mode 100644 index 000000000..86f5eca68 Binary files /dev/null and b/assets/romfs/wc7/ita/2041.wc7 differ diff --git a/assets/romfs/wc7/ita/2042.wc7 b/assets/romfs/wc7/ita/2042.wc7 new file mode 100644 index 000000000..cc7084617 Binary files /dev/null and b/assets/romfs/wc7/ita/2042.wc7 differ diff --git a/assets/romfs/wc7/ita/2043.wc7 b/assets/romfs/wc7/ita/2043.wc7 new file mode 100644 index 000000000..66e4d4723 Binary files /dev/null and b/assets/romfs/wc7/ita/2043.wc7 differ diff --git a/assets/romfs/wc7/ita/2044.wc7 b/assets/romfs/wc7/ita/2044.wc7 new file mode 100644 index 000000000..6753f11a2 Binary files /dev/null and b/assets/romfs/wc7/ita/2044.wc7 differ diff --git a/assets/romfs/wc7/ita/2045.wc7 b/assets/romfs/wc7/ita/2045.wc7 new file mode 100644 index 000000000..564c5cae0 Binary files /dev/null and b/assets/romfs/wc7/ita/2045.wc7 differ diff --git a/assets/romfs/wc7/ita/2046.wc7 b/assets/romfs/wc7/ita/2046.wc7 new file mode 100644 index 000000000..06f2d62c6 Binary files /dev/null and b/assets/romfs/wc7/ita/2046.wc7 differ diff --git a/assets/romfs/wc7/ita/504-1.wc7 b/assets/romfs/wc7/ita/504-1.wc7 new file mode 100644 index 000000000..57e266b19 Binary files /dev/null and b/assets/romfs/wc7/ita/504-1.wc7 differ diff --git a/assets/romfs/wc7/ita/504-2.wc7 b/assets/romfs/wc7/ita/504-2.wc7 new file mode 100644 index 000000000..c340630d4 Binary files /dev/null and b/assets/romfs/wc7/ita/504-2.wc7 differ diff --git a/assets/romfs/wc7/ita/510.wc7 b/assets/romfs/wc7/ita/510.wc7 new file mode 100644 index 000000000..2e7193b03 Binary files /dev/null and b/assets/romfs/wc7/ita/510.wc7 differ diff --git a/assets/romfs/wc7/ita/511.wc7 b/assets/romfs/wc7/ita/511.wc7 new file mode 100644 index 000000000..d0ab304fb Binary files /dev/null and b/assets/romfs/wc7/ita/511.wc7 differ diff --git a/assets/romfs/wc7/ita/514.wc7 b/assets/romfs/wc7/ita/514.wc7 new file mode 100644 index 000000000..7d12de731 Binary files /dev/null and b/assets/romfs/wc7/ita/514.wc7 differ diff --git a/assets/romfs/wc7/ita/523.wc7 b/assets/romfs/wc7/ita/523.wc7 new file mode 100644 index 000000000..b8dbd523d Binary files /dev/null and b/assets/romfs/wc7/ita/523.wc7 differ diff --git a/assets/romfs/wc7/ita/524.wc7 b/assets/romfs/wc7/ita/524.wc7 new file mode 100644 index 000000000..52f52ab02 Binary files /dev/null and b/assets/romfs/wc7/ita/524.wc7 differ diff --git a/assets/romfs/wc7/ita/525.wc7 b/assets/romfs/wc7/ita/525.wc7 new file mode 100644 index 000000000..c399fece5 Binary files /dev/null and b/assets/romfs/wc7/ita/525.wc7 differ diff --git a/assets/romfs/wc7/ita/535.wc7 b/assets/romfs/wc7/ita/535.wc7 new file mode 100644 index 000000000..102214c74 Binary files /dev/null and b/assets/romfs/wc7/ita/535.wc7 differ diff --git a/assets/romfs/wc7/ita/537.wc7 b/assets/romfs/wc7/ita/537.wc7 new file mode 100644 index 000000000..2e6374ee9 Binary files /dev/null and b/assets/romfs/wc7/ita/537.wc7 differ diff --git a/assets/romfs/wc7/ita/546.wc7 b/assets/romfs/wc7/ita/546.wc7 new file mode 100644 index 000000000..c1c246e85 Binary files /dev/null and b/assets/romfs/wc7/ita/546.wc7 differ diff --git a/assets/romfs/wc7/ita/547.wc7 b/assets/romfs/wc7/ita/547.wc7 new file mode 100644 index 000000000..47cb86ceb Binary files /dev/null and b/assets/romfs/wc7/ita/547.wc7 differ diff --git a/assets/romfs/wc7/ita/551-1.wc7 b/assets/romfs/wc7/ita/551-1.wc7 new file mode 100644 index 000000000..c64a4d26b Binary files /dev/null and b/assets/romfs/wc7/ita/551-1.wc7 differ diff --git a/assets/romfs/wc7/ita/551-2.wc7 b/assets/romfs/wc7/ita/551-2.wc7 new file mode 100644 index 000000000..f6a911334 Binary files /dev/null and b/assets/romfs/wc7/ita/551-2.wc7 differ diff --git a/assets/romfs/wc7/ita/552-1.wc7 b/assets/romfs/wc7/ita/552-1.wc7 new file mode 100644 index 000000000..aa910903b Binary files /dev/null and b/assets/romfs/wc7/ita/552-1.wc7 differ diff --git a/assets/romfs/wc7/ita/552-2.wc7 b/assets/romfs/wc7/ita/552-2.wc7 new file mode 100644 index 000000000..3a90951b1 Binary files /dev/null and b/assets/romfs/wc7/ita/552-2.wc7 differ diff --git a/assets/romfs/wc7/ita/553.wc7 b/assets/romfs/wc7/ita/553.wc7 new file mode 100644 index 000000000..2d9f63bcb Binary files /dev/null and b/assets/romfs/wc7/ita/553.wc7 differ diff --git a/assets/romfs/wc7/ita/556.wc7 b/assets/romfs/wc7/ita/556.wc7 new file mode 100644 index 000000000..da9206494 Binary files /dev/null and b/assets/romfs/wc7/ita/556.wc7 differ diff --git a/assets/romfs/wc7/ita/557.wc7 b/assets/romfs/wc7/ita/557.wc7 new file mode 100644 index 000000000..455b0f35a Binary files /dev/null and b/assets/romfs/wc7/ita/557.wc7 differ diff --git a/assets/romfs/wc7/ita/558.wc7 b/assets/romfs/wc7/ita/558.wc7 new file mode 100644 index 000000000..f4de24efe Binary files /dev/null and b/assets/romfs/wc7/ita/558.wc7 differ diff --git a/assets/romfs/wc7/ita/559.wc7 b/assets/romfs/wc7/ita/559.wc7 new file mode 100644 index 000000000..27b03b01a Binary files /dev/null and b/assets/romfs/wc7/ita/559.wc7 differ diff --git a/assets/romfs/wc7/ita/560.wc7 b/assets/romfs/wc7/ita/560.wc7 new file mode 100644 index 000000000..8c6acea5a Binary files /dev/null and b/assets/romfs/wc7/ita/560.wc7 differ diff --git a/assets/romfs/wc7/ita/561.wc7 b/assets/romfs/wc7/ita/561.wc7 new file mode 100644 index 000000000..fdaf503d7 Binary files /dev/null and b/assets/romfs/wc7/ita/561.wc7 differ diff --git a/assets/romfs/wc7/ita/562.wc7 b/assets/romfs/wc7/ita/562.wc7 new file mode 100644 index 000000000..296b9648a Binary files /dev/null and b/assets/romfs/wc7/ita/562.wc7 differ diff --git a/assets/romfs/wc7/ita/563.wc7 b/assets/romfs/wc7/ita/563.wc7 new file mode 100644 index 000000000..87ec10c02 Binary files /dev/null and b/assets/romfs/wc7/ita/563.wc7 differ diff --git a/assets/romfs/wc7/ita/564.wc7 b/assets/romfs/wc7/ita/564.wc7 new file mode 100644 index 000000000..ac8b9ae49 Binary files /dev/null and b/assets/romfs/wc7/ita/564.wc7 differ diff --git a/assets/romfs/wc7/ita/565.wc7 b/assets/romfs/wc7/ita/565.wc7 new file mode 100644 index 000000000..991413ff2 Binary files /dev/null and b/assets/romfs/wc7/ita/565.wc7 differ diff --git a/assets/romfs/wc7/ita/566.wc7 b/assets/romfs/wc7/ita/566.wc7 new file mode 100644 index 000000000..6c24eacd9 Binary files /dev/null and b/assets/romfs/wc7/ita/566.wc7 differ diff --git a/assets/romfs/wc7/ita/567.wc7 b/assets/romfs/wc7/ita/567.wc7 new file mode 100644 index 000000000..0c1f36abd Binary files /dev/null and b/assets/romfs/wc7/ita/567.wc7 differ diff --git a/assets/romfs/wc7/ita/569.wc7 b/assets/romfs/wc7/ita/569.wc7 new file mode 100644 index 000000000..8d42a3dbf Binary files /dev/null and b/assets/romfs/wc7/ita/569.wc7 differ diff --git a/assets/romfs/wc7/ita/570.wc7 b/assets/romfs/wc7/ita/570.wc7 new file mode 100644 index 000000000..0b3c1469b Binary files /dev/null and b/assets/romfs/wc7/ita/570.wc7 differ diff --git a/assets/romfs/wc7/ita/571.wc7 b/assets/romfs/wc7/ita/571.wc7 new file mode 100644 index 000000000..0a77d30ce Binary files /dev/null and b/assets/romfs/wc7/ita/571.wc7 differ diff --git a/assets/romfs/wc7/ita/574.wc7 b/assets/romfs/wc7/ita/574.wc7 new file mode 100644 index 000000000..e9c138c2e Binary files /dev/null and b/assets/romfs/wc7/ita/574.wc7 differ diff --git a/assets/romfs/wc7/ita/576.wc7 b/assets/romfs/wc7/ita/576.wc7 new file mode 100644 index 000000000..f6363be5c Binary files /dev/null and b/assets/romfs/wc7/ita/576.wc7 differ diff --git a/assets/romfs/wc7/ita/577.wc7 b/assets/romfs/wc7/ita/577.wc7 new file mode 100644 index 000000000..2123b57cb Binary files /dev/null and b/assets/romfs/wc7/ita/577.wc7 differ diff --git a/assets/romfs/wc7/ita/578.wc7 b/assets/romfs/wc7/ita/578.wc7 new file mode 100644 index 000000000..dd4620a61 Binary files /dev/null and b/assets/romfs/wc7/ita/578.wc7 differ diff --git a/assets/romfs/wc7/ita/580.wc7 b/assets/romfs/wc7/ita/580.wc7 new file mode 100644 index 000000000..2a4bfa3a3 Binary files /dev/null and b/assets/romfs/wc7/ita/580.wc7 differ diff --git a/assets/romfs/wc7/ita/586.wc7 b/assets/romfs/wc7/ita/586.wc7 new file mode 100644 index 000000000..449a7c717 Binary files /dev/null and b/assets/romfs/wc7/ita/586.wc7 differ diff --git a/assets/romfs/wc7/ita/588.wc7 b/assets/romfs/wc7/ita/588.wc7 new file mode 100644 index 000000000..be8027fd9 Binary files /dev/null and b/assets/romfs/wc7/ita/588.wc7 differ diff --git a/assets/romfs/wc7/ita/812.wc7 b/assets/romfs/wc7/ita/812.wc7 new file mode 100644 index 000000000..45ad2165b Binary files /dev/null and b/assets/romfs/wc7/ita/812.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-1.wc7 b/assets/romfs/wc7/jpn/1-1.wc7 new file mode 100644 index 000000000..6f32ddcae Binary files /dev/null and b/assets/romfs/wc7/jpn/1-1.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-10.wc7 b/assets/romfs/wc7/jpn/1-10.wc7 new file mode 100644 index 000000000..2053b1778 Binary files /dev/null and b/assets/romfs/wc7/jpn/1-10.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-2.wc7 b/assets/romfs/wc7/jpn/1-2.wc7 new file mode 100644 index 000000000..df8761652 Binary files /dev/null and b/assets/romfs/wc7/jpn/1-2.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-3.wc7 b/assets/romfs/wc7/jpn/1-3.wc7 new file mode 100644 index 000000000..e4c184a4c Binary files /dev/null and b/assets/romfs/wc7/jpn/1-3.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-4.wc7 b/assets/romfs/wc7/jpn/1-4.wc7 new file mode 100644 index 000000000..b7fed7eac Binary files /dev/null and b/assets/romfs/wc7/jpn/1-4.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-5.wc7 b/assets/romfs/wc7/jpn/1-5.wc7 new file mode 100644 index 000000000..81da86c3a Binary files /dev/null and b/assets/romfs/wc7/jpn/1-5.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-6.wc7 b/assets/romfs/wc7/jpn/1-6.wc7 new file mode 100644 index 000000000..bd5b3fee9 Binary files /dev/null and b/assets/romfs/wc7/jpn/1-6.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-7.wc7 b/assets/romfs/wc7/jpn/1-7.wc7 new file mode 100644 index 000000000..b9baa4329 Binary files /dev/null and b/assets/romfs/wc7/jpn/1-7.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-8.wc7 b/assets/romfs/wc7/jpn/1-8.wc7 new file mode 100644 index 000000000..287824474 Binary files /dev/null and b/assets/romfs/wc7/jpn/1-8.wc7 differ diff --git a/assets/romfs/wc7/jpn/1-9.wc7 b/assets/romfs/wc7/jpn/1-9.wc7 new file mode 100644 index 000000000..5a4b661e1 Binary files /dev/null and b/assets/romfs/wc7/jpn/1-9.wc7 differ diff --git a/assets/romfs/wc7/jpn/100.wc7 b/assets/romfs/wc7/jpn/100.wc7 new file mode 100644 index 000000000..abd24824f Binary files /dev/null and b/assets/romfs/wc7/jpn/100.wc7 differ diff --git a/assets/romfs/wc7/jpn/101.wc7 b/assets/romfs/wc7/jpn/101.wc7 new file mode 100644 index 000000000..c314d48d3 Binary files /dev/null and b/assets/romfs/wc7/jpn/101.wc7 differ diff --git a/assets/romfs/wc7/jpn/102.wc7 b/assets/romfs/wc7/jpn/102.wc7 new file mode 100644 index 000000000..bf416b071 Binary files /dev/null and b/assets/romfs/wc7/jpn/102.wc7 differ diff --git a/assets/romfs/wc7/jpn/107.wc7 b/assets/romfs/wc7/jpn/107.wc7 new file mode 100644 index 000000000..4e039a8b6 Binary files /dev/null and b/assets/romfs/wc7/jpn/107.wc7 differ diff --git a/assets/romfs/wc7/jpn/108-1.wc7 b/assets/romfs/wc7/jpn/108-1.wc7 new file mode 100644 index 000000000..1570eb5d4 Binary files /dev/null and b/assets/romfs/wc7/jpn/108-1.wc7 differ diff --git a/assets/romfs/wc7/jpn/108-2.wc7 b/assets/romfs/wc7/jpn/108-2.wc7 new file mode 100644 index 000000000..623c608ed Binary files /dev/null and b/assets/romfs/wc7/jpn/108-2.wc7 differ diff --git a/assets/romfs/wc7/jpn/109.wc7 b/assets/romfs/wc7/jpn/109.wc7 new file mode 100644 index 000000000..7686877b6 Binary files /dev/null and b/assets/romfs/wc7/jpn/109.wc7 differ diff --git a/assets/romfs/wc7/jpn/110.wc7 b/assets/romfs/wc7/jpn/110.wc7 new file mode 100644 index 000000000..5a3b90dba Binary files /dev/null and b/assets/romfs/wc7/jpn/110.wc7 differ diff --git a/assets/romfs/wc7/jpn/111.wc7 b/assets/romfs/wc7/jpn/111.wc7 new file mode 100644 index 000000000..2578e0552 Binary files /dev/null and b/assets/romfs/wc7/jpn/111.wc7 differ diff --git a/assets/romfs/wc7/jpn/112.wc7 b/assets/romfs/wc7/jpn/112.wc7 new file mode 100644 index 000000000..443dcb235 Binary files /dev/null and b/assets/romfs/wc7/jpn/112.wc7 differ diff --git a/assets/romfs/wc7/jpn/113.wc7 b/assets/romfs/wc7/jpn/113.wc7 new file mode 100644 index 000000000..88f58bbb5 Binary files /dev/null and b/assets/romfs/wc7/jpn/113.wc7 differ diff --git a/assets/romfs/wc7/jpn/114.wc7 b/assets/romfs/wc7/jpn/114.wc7 new file mode 100644 index 000000000..71a8a79dc Binary files /dev/null and b/assets/romfs/wc7/jpn/114.wc7 differ diff --git a/assets/romfs/wc7/jpn/115.wc7 b/assets/romfs/wc7/jpn/115.wc7 new file mode 100644 index 000000000..c612d00fb Binary files /dev/null and b/assets/romfs/wc7/jpn/115.wc7 differ diff --git a/assets/romfs/wc7/jpn/116.wc7 b/assets/romfs/wc7/jpn/116.wc7 new file mode 100644 index 000000000..50016469d Binary files /dev/null and b/assets/romfs/wc7/jpn/116.wc7 differ diff --git a/assets/romfs/wc7/jpn/117.wc7 b/assets/romfs/wc7/jpn/117.wc7 new file mode 100644 index 000000000..8739f2b6f Binary files /dev/null and b/assets/romfs/wc7/jpn/117.wc7 differ diff --git a/assets/romfs/wc7/jpn/119.wc7 b/assets/romfs/wc7/jpn/119.wc7 new file mode 100644 index 000000000..622fbd7b7 Binary files /dev/null and b/assets/romfs/wc7/jpn/119.wc7 differ diff --git a/assets/romfs/wc7/jpn/12.wc7 b/assets/romfs/wc7/jpn/12.wc7 new file mode 100644 index 000000000..bfeb38d68 Binary files /dev/null and b/assets/romfs/wc7/jpn/12.wc7 differ diff --git a/assets/romfs/wc7/jpn/120.wc7 b/assets/romfs/wc7/jpn/120.wc7 new file mode 100644 index 000000000..de60d6fde Binary files /dev/null and b/assets/romfs/wc7/jpn/120.wc7 differ diff --git a/assets/romfs/wc7/jpn/121.wc7 b/assets/romfs/wc7/jpn/121.wc7 new file mode 100644 index 000000000..ea26a622f Binary files /dev/null and b/assets/romfs/wc7/jpn/121.wc7 differ diff --git a/assets/romfs/wc7/jpn/122.wc7 b/assets/romfs/wc7/jpn/122.wc7 new file mode 100644 index 000000000..7e82c0271 Binary files /dev/null and b/assets/romfs/wc7/jpn/122.wc7 differ diff --git a/assets/romfs/wc7/jpn/127.wc7 b/assets/romfs/wc7/jpn/127.wc7 new file mode 100644 index 000000000..f9a76c56f Binary files /dev/null and b/assets/romfs/wc7/jpn/127.wc7 differ diff --git a/assets/romfs/wc7/jpn/128.wc7 b/assets/romfs/wc7/jpn/128.wc7 new file mode 100644 index 000000000..6ed3e2c50 Binary files /dev/null and b/assets/romfs/wc7/jpn/128.wc7 differ diff --git a/assets/romfs/wc7/jpn/129.wc7 b/assets/romfs/wc7/jpn/129.wc7 new file mode 100644 index 000000000..3fa8dd223 Binary files /dev/null and b/assets/romfs/wc7/jpn/129.wc7 differ diff --git a/assets/romfs/wc7/jpn/130.wc7 b/assets/romfs/wc7/jpn/130.wc7 new file mode 100644 index 000000000..f01339627 Binary files /dev/null and b/assets/romfs/wc7/jpn/130.wc7 differ diff --git a/assets/romfs/wc7/jpn/131.wc7 b/assets/romfs/wc7/jpn/131.wc7 new file mode 100644 index 000000000..d38f2cd25 Binary files /dev/null and b/assets/romfs/wc7/jpn/131.wc7 differ diff --git a/assets/romfs/wc7/jpn/136-1.wc7 b/assets/romfs/wc7/jpn/136-1.wc7 new file mode 100644 index 000000000..ad6b1371f Binary files /dev/null and b/assets/romfs/wc7/jpn/136-1.wc7 differ diff --git a/assets/romfs/wc7/jpn/136-2.wc7 b/assets/romfs/wc7/jpn/136-2.wc7 new file mode 100644 index 000000000..3e80c1696 Binary files /dev/null and b/assets/romfs/wc7/jpn/136-2.wc7 differ diff --git a/assets/romfs/wc7/jpn/136-3.wc7 b/assets/romfs/wc7/jpn/136-3.wc7 new file mode 100644 index 000000000..a6244bdfa Binary files /dev/null and b/assets/romfs/wc7/jpn/136-3.wc7 differ diff --git a/assets/romfs/wc7/jpn/136-4.wc7 b/assets/romfs/wc7/jpn/136-4.wc7 new file mode 100644 index 000000000..8d04ff171 Binary files /dev/null and b/assets/romfs/wc7/jpn/136-4.wc7 differ diff --git a/assets/romfs/wc7/jpn/137.wc7 b/assets/romfs/wc7/jpn/137.wc7 new file mode 100644 index 000000000..706ab912f Binary files /dev/null and b/assets/romfs/wc7/jpn/137.wc7 differ diff --git a/assets/romfs/wc7/jpn/138.wc7 b/assets/romfs/wc7/jpn/138.wc7 new file mode 100644 index 000000000..5e37d483f Binary files /dev/null and b/assets/romfs/wc7/jpn/138.wc7 differ diff --git a/assets/romfs/wc7/jpn/141.wc7 b/assets/romfs/wc7/jpn/141.wc7 new file mode 100644 index 000000000..a20575c7d Binary files /dev/null and b/assets/romfs/wc7/jpn/141.wc7 differ diff --git a/assets/romfs/wc7/jpn/145.wc7 b/assets/romfs/wc7/jpn/145.wc7 new file mode 100644 index 000000000..9b8e7a8a6 Binary files /dev/null and b/assets/romfs/wc7/jpn/145.wc7 differ diff --git a/assets/romfs/wc7/jpn/146.wc7 b/assets/romfs/wc7/jpn/146.wc7 new file mode 100644 index 000000000..66f0de648 Binary files /dev/null and b/assets/romfs/wc7/jpn/146.wc7 differ diff --git a/assets/romfs/wc7/jpn/147.wc7 b/assets/romfs/wc7/jpn/147.wc7 new file mode 100644 index 000000000..12fbb9043 Binary files /dev/null and b/assets/romfs/wc7/jpn/147.wc7 differ diff --git a/assets/romfs/wc7/jpn/148.wc7 b/assets/romfs/wc7/jpn/148.wc7 new file mode 100644 index 000000000..31914e564 Binary files /dev/null and b/assets/romfs/wc7/jpn/148.wc7 differ diff --git a/assets/romfs/wc7/jpn/149.wc7 b/assets/romfs/wc7/jpn/149.wc7 new file mode 100644 index 000000000..3c6f3b293 Binary files /dev/null and b/assets/romfs/wc7/jpn/149.wc7 differ diff --git a/assets/romfs/wc7/jpn/15.wc7 b/assets/romfs/wc7/jpn/15.wc7 new file mode 100644 index 000000000..623324fd0 Binary files /dev/null and b/assets/romfs/wc7/jpn/15.wc7 differ diff --git a/assets/romfs/wc7/jpn/150.wc7 b/assets/romfs/wc7/jpn/150.wc7 new file mode 100644 index 000000000..1f8d34547 Binary files /dev/null and b/assets/romfs/wc7/jpn/150.wc7 differ diff --git a/assets/romfs/wc7/jpn/1501.wc7 b/assets/romfs/wc7/jpn/1501.wc7 new file mode 100644 index 000000000..ee0fe6c3b Binary files /dev/null and b/assets/romfs/wc7/jpn/1501.wc7 differ diff --git a/assets/romfs/wc7/jpn/1503.wc7 b/assets/romfs/wc7/jpn/1503.wc7 new file mode 100644 index 000000000..a849905c7 Binary files /dev/null and b/assets/romfs/wc7/jpn/1503.wc7 differ diff --git a/assets/romfs/wc7/jpn/1504.wc7 b/assets/romfs/wc7/jpn/1504.wc7 new file mode 100644 index 000000000..1192de29a Binary files /dev/null and b/assets/romfs/wc7/jpn/1504.wc7 differ diff --git a/assets/romfs/wc7/jpn/1505.wc7 b/assets/romfs/wc7/jpn/1505.wc7 new file mode 100644 index 000000000..6738e1d23 Binary files /dev/null and b/assets/romfs/wc7/jpn/1505.wc7 differ diff --git a/assets/romfs/wc7/jpn/1506.wc7 b/assets/romfs/wc7/jpn/1506.wc7 new file mode 100644 index 000000000..ea88f25c4 Binary files /dev/null and b/assets/romfs/wc7/jpn/1506.wc7 differ diff --git a/assets/romfs/wc7/jpn/1507.wc7 b/assets/romfs/wc7/jpn/1507.wc7 new file mode 100644 index 000000000..96fc994f6 Binary files /dev/null and b/assets/romfs/wc7/jpn/1507.wc7 differ diff --git a/assets/romfs/wc7/jpn/1508.wc7 b/assets/romfs/wc7/jpn/1508.wc7 new file mode 100644 index 000000000..175e15ddb Binary files /dev/null and b/assets/romfs/wc7/jpn/1508.wc7 differ diff --git a/assets/romfs/wc7/jpn/1509.wc7 b/assets/romfs/wc7/jpn/1509.wc7 new file mode 100644 index 000000000..7c04b012f Binary files /dev/null and b/assets/romfs/wc7/jpn/1509.wc7 differ diff --git a/assets/romfs/wc7/jpn/151.wc7 b/assets/romfs/wc7/jpn/151.wc7 new file mode 100644 index 000000000..beda91d05 Binary files /dev/null and b/assets/romfs/wc7/jpn/151.wc7 differ diff --git a/assets/romfs/wc7/jpn/1510.wc7 b/assets/romfs/wc7/jpn/1510.wc7 new file mode 100644 index 000000000..a38e24b77 Binary files /dev/null and b/assets/romfs/wc7/jpn/1510.wc7 differ diff --git a/assets/romfs/wc7/jpn/1511.wc7 b/assets/romfs/wc7/jpn/1511.wc7 new file mode 100644 index 000000000..97369ac6d Binary files /dev/null and b/assets/romfs/wc7/jpn/1511.wc7 differ diff --git a/assets/romfs/wc7/jpn/1512.wc7 b/assets/romfs/wc7/jpn/1512.wc7 new file mode 100644 index 000000000..6db491e93 Binary files /dev/null and b/assets/romfs/wc7/jpn/1512.wc7 differ diff --git a/assets/romfs/wc7/jpn/1513.wc7 b/assets/romfs/wc7/jpn/1513.wc7 new file mode 100644 index 000000000..7d8472b0a Binary files /dev/null and b/assets/romfs/wc7/jpn/1513.wc7 differ diff --git a/assets/romfs/wc7/jpn/1514.wc7 b/assets/romfs/wc7/jpn/1514.wc7 new file mode 100644 index 000000000..038f2a515 Binary files /dev/null and b/assets/romfs/wc7/jpn/1514.wc7 differ diff --git a/assets/romfs/wc7/jpn/1515.wc7 b/assets/romfs/wc7/jpn/1515.wc7 new file mode 100644 index 000000000..48e843b0e Binary files /dev/null and b/assets/romfs/wc7/jpn/1515.wc7 differ diff --git a/assets/romfs/wc7/jpn/1516.wc7 b/assets/romfs/wc7/jpn/1516.wc7 new file mode 100644 index 000000000..5e4c57721 Binary files /dev/null and b/assets/romfs/wc7/jpn/1516.wc7 differ diff --git a/assets/romfs/wc7/jpn/152.wc7 b/assets/romfs/wc7/jpn/152.wc7 new file mode 100644 index 000000000..ebc31c5b6 Binary files /dev/null and b/assets/romfs/wc7/jpn/152.wc7 differ diff --git a/assets/romfs/wc7/jpn/153.wc7 b/assets/romfs/wc7/jpn/153.wc7 new file mode 100644 index 000000000..569c07ab4 Binary files /dev/null and b/assets/romfs/wc7/jpn/153.wc7 differ diff --git a/assets/romfs/wc7/jpn/154.wc7 b/assets/romfs/wc7/jpn/154.wc7 new file mode 100644 index 000000000..7b31b83f4 Binary files /dev/null and b/assets/romfs/wc7/jpn/154.wc7 differ diff --git a/assets/romfs/wc7/jpn/155.wc7 b/assets/romfs/wc7/jpn/155.wc7 new file mode 100644 index 000000000..e545bf18b Binary files /dev/null and b/assets/romfs/wc7/jpn/155.wc7 differ diff --git a/assets/romfs/wc7/jpn/156.wc7 b/assets/romfs/wc7/jpn/156.wc7 new file mode 100644 index 000000000..cddedc39d Binary files /dev/null and b/assets/romfs/wc7/jpn/156.wc7 differ diff --git a/assets/romfs/wc7/jpn/157.wc7 b/assets/romfs/wc7/jpn/157.wc7 new file mode 100644 index 000000000..4f313b7bb Binary files /dev/null and b/assets/romfs/wc7/jpn/157.wc7 differ diff --git a/assets/romfs/wc7/jpn/158.wc7 b/assets/romfs/wc7/jpn/158.wc7 new file mode 100644 index 000000000..4bc30c043 Binary files /dev/null and b/assets/romfs/wc7/jpn/158.wc7 differ diff --git a/assets/romfs/wc7/jpn/159.wc7 b/assets/romfs/wc7/jpn/159.wc7 new file mode 100644 index 000000000..8c4b63a50 Binary files /dev/null and b/assets/romfs/wc7/jpn/159.wc7 differ diff --git a/assets/romfs/wc7/jpn/1601.wc7 b/assets/romfs/wc7/jpn/1601.wc7 new file mode 100644 index 000000000..0e6a8083c Binary files /dev/null and b/assets/romfs/wc7/jpn/1601.wc7 differ diff --git a/assets/romfs/wc7/jpn/1602.wc7 b/assets/romfs/wc7/jpn/1602.wc7 new file mode 100644 index 000000000..f2be2008c Binary files /dev/null and b/assets/romfs/wc7/jpn/1602.wc7 differ diff --git a/assets/romfs/wc7/jpn/1603.wc7 b/assets/romfs/wc7/jpn/1603.wc7 new file mode 100644 index 000000000..1337d9003 Binary files /dev/null and b/assets/romfs/wc7/jpn/1603.wc7 differ diff --git a/assets/romfs/wc7/jpn/161.wc7 b/assets/romfs/wc7/jpn/161.wc7 new file mode 100644 index 000000000..5784388e1 Binary files /dev/null and b/assets/romfs/wc7/jpn/161.wc7 differ diff --git a/assets/romfs/wc7/jpn/162.wc7 b/assets/romfs/wc7/jpn/162.wc7 new file mode 100644 index 000000000..46626dac0 Binary files /dev/null and b/assets/romfs/wc7/jpn/162.wc7 differ diff --git a/assets/romfs/wc7/jpn/163.wc7 b/assets/romfs/wc7/jpn/163.wc7 new file mode 100644 index 000000000..7d26fa4ed Binary files /dev/null and b/assets/romfs/wc7/jpn/163.wc7 differ diff --git a/assets/romfs/wc7/jpn/164.wc7 b/assets/romfs/wc7/jpn/164.wc7 new file mode 100644 index 000000000..1a527ed6f Binary files /dev/null and b/assets/romfs/wc7/jpn/164.wc7 differ diff --git a/assets/romfs/wc7/jpn/165.wc7 b/assets/romfs/wc7/jpn/165.wc7 new file mode 100644 index 000000000..bcde878f3 Binary files /dev/null and b/assets/romfs/wc7/jpn/165.wc7 differ diff --git a/assets/romfs/wc7/jpn/166.wc7 b/assets/romfs/wc7/jpn/166.wc7 new file mode 100644 index 000000000..5f6ba5367 Binary files /dev/null and b/assets/romfs/wc7/jpn/166.wc7 differ diff --git a/assets/romfs/wc7/jpn/167.wc7 b/assets/romfs/wc7/jpn/167.wc7 new file mode 100644 index 000000000..a90a5505e Binary files /dev/null and b/assets/romfs/wc7/jpn/167.wc7 differ diff --git a/assets/romfs/wc7/jpn/168.wc7 b/assets/romfs/wc7/jpn/168.wc7 new file mode 100644 index 000000000..0d012925d Binary files /dev/null and b/assets/romfs/wc7/jpn/168.wc7 differ diff --git a/assets/romfs/wc7/jpn/169.wc7 b/assets/romfs/wc7/jpn/169.wc7 new file mode 100644 index 000000000..3cef6961f Binary files /dev/null and b/assets/romfs/wc7/jpn/169.wc7 differ diff --git a/assets/romfs/wc7/jpn/170.wc7 b/assets/romfs/wc7/jpn/170.wc7 new file mode 100644 index 000000000..e7923c4e8 Binary files /dev/null and b/assets/romfs/wc7/jpn/170.wc7 differ diff --git a/assets/romfs/wc7/jpn/171.wc7 b/assets/romfs/wc7/jpn/171.wc7 new file mode 100644 index 000000000..373d73f0a Binary files /dev/null and b/assets/romfs/wc7/jpn/171.wc7 differ diff --git a/assets/romfs/wc7/jpn/173.wc7 b/assets/romfs/wc7/jpn/173.wc7 new file mode 100644 index 000000000..11a5c5f36 Binary files /dev/null and b/assets/romfs/wc7/jpn/173.wc7 differ diff --git a/assets/romfs/wc7/jpn/174.pk6 b/assets/romfs/wc7/jpn/174.pk6 new file mode 100644 index 000000000..40e4e0c7c Binary files /dev/null and b/assets/romfs/wc7/jpn/174.pk6 differ diff --git a/assets/romfs/wc7/jpn/175.wc7 b/assets/romfs/wc7/jpn/175.wc7 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc7/jpn/175.wc7 differ diff --git a/assets/romfs/wc7/jpn/176.wc7 b/assets/romfs/wc7/jpn/176.wc7 new file mode 100644 index 000000000..dd341c0c8 Binary files /dev/null and b/assets/romfs/wc7/jpn/176.wc7 differ diff --git a/assets/romfs/wc7/jpn/177.wc7 b/assets/romfs/wc7/jpn/177.wc7 new file mode 100644 index 000000000..5d356dbe9 Binary files /dev/null and b/assets/romfs/wc7/jpn/177.wc7 differ diff --git a/assets/romfs/wc7/jpn/178.wc7 b/assets/romfs/wc7/jpn/178.wc7 new file mode 100644 index 000000000..33b45b078 Binary files /dev/null and b/assets/romfs/wc7/jpn/178.wc7 differ diff --git a/assets/romfs/wc7/jpn/179.wc7 b/assets/romfs/wc7/jpn/179.wc7 new file mode 100644 index 000000000..ee53fb213 Binary files /dev/null and b/assets/romfs/wc7/jpn/179.wc7 differ diff --git a/assets/romfs/wc7/jpn/180.wc7 b/assets/romfs/wc7/jpn/180.wc7 new file mode 100644 index 000000000..273df2c35 Binary files /dev/null and b/assets/romfs/wc7/jpn/180.wc7 differ diff --git a/assets/romfs/wc7/jpn/181.wc7 b/assets/romfs/wc7/jpn/181.wc7 new file mode 100644 index 000000000..9e79cd762 Binary files /dev/null and b/assets/romfs/wc7/jpn/181.wc7 differ diff --git a/assets/romfs/wc7/jpn/182.wc7 b/assets/romfs/wc7/jpn/182.wc7 new file mode 100644 index 000000000..86f3181a9 Binary files /dev/null and b/assets/romfs/wc7/jpn/182.wc7 differ diff --git a/assets/romfs/wc7/jpn/19.wc7 b/assets/romfs/wc7/jpn/19.wc7 new file mode 100644 index 000000000..95cae04f1 Binary files /dev/null and b/assets/romfs/wc7/jpn/19.wc7 differ diff --git a/assets/romfs/wc7/jpn/2.wc7 b/assets/romfs/wc7/jpn/2.wc7 new file mode 100644 index 000000000..b4db4e9a0 Binary files /dev/null and b/assets/romfs/wc7/jpn/2.wc7 differ diff --git a/assets/romfs/wc7/jpn/20.wc7 b/assets/romfs/wc7/jpn/20.wc7 new file mode 100644 index 000000000..3bc8db6f0 Binary files /dev/null and b/assets/romfs/wc7/jpn/20.wc7 differ diff --git a/assets/romfs/wc7/jpn/2040.wc7 b/assets/romfs/wc7/jpn/2040.wc7 new file mode 100644 index 000000000..f3fca8318 Binary files /dev/null and b/assets/romfs/wc7/jpn/2040.wc7 differ diff --git a/assets/romfs/wc7/jpn/2041.wc7 b/assets/romfs/wc7/jpn/2041.wc7 new file mode 100644 index 000000000..2b0fc9073 Binary files /dev/null and b/assets/romfs/wc7/jpn/2041.wc7 differ diff --git a/assets/romfs/wc7/jpn/2042.wc7 b/assets/romfs/wc7/jpn/2042.wc7 new file mode 100644 index 000000000..c44371cf4 Binary files /dev/null and b/assets/romfs/wc7/jpn/2042.wc7 differ diff --git a/assets/romfs/wc7/jpn/2043.wc7 b/assets/romfs/wc7/jpn/2043.wc7 new file mode 100644 index 000000000..1f972d783 Binary files /dev/null and b/assets/romfs/wc7/jpn/2043.wc7 differ diff --git a/assets/romfs/wc7/jpn/2044.wc7 b/assets/romfs/wc7/jpn/2044.wc7 new file mode 100644 index 000000000..6d469f53e Binary files /dev/null and b/assets/romfs/wc7/jpn/2044.wc7 differ diff --git a/assets/romfs/wc7/jpn/2045.wc7 b/assets/romfs/wc7/jpn/2045.wc7 new file mode 100644 index 000000000..2e426887b Binary files /dev/null and b/assets/romfs/wc7/jpn/2045.wc7 differ diff --git a/assets/romfs/wc7/jpn/2046.wc7 b/assets/romfs/wc7/jpn/2046.wc7 new file mode 100644 index 000000000..6370de281 Binary files /dev/null and b/assets/romfs/wc7/jpn/2046.wc7 differ diff --git a/assets/romfs/wc7/jpn/205-1.wc7 b/assets/romfs/wc7/jpn/205-1.wc7 new file mode 100644 index 000000000..31d5ee79a Binary files /dev/null and b/assets/romfs/wc7/jpn/205-1.wc7 differ diff --git a/assets/romfs/wc7/jpn/205-2.wc7 b/assets/romfs/wc7/jpn/205-2.wc7 new file mode 100644 index 000000000..6f760b5f1 Binary files /dev/null and b/assets/romfs/wc7/jpn/205-2.wc7 differ diff --git a/assets/romfs/wc7/jpn/21.wc7 b/assets/romfs/wc7/jpn/21.wc7 new file mode 100644 index 000000000..89faa1a9a Binary files /dev/null and b/assets/romfs/wc7/jpn/21.wc7 differ diff --git a/assets/romfs/wc7/jpn/210.wc7 b/assets/romfs/wc7/jpn/210.wc7 new file mode 100644 index 000000000..7bb89804f Binary files /dev/null and b/assets/romfs/wc7/jpn/210.wc7 differ diff --git a/assets/romfs/wc7/jpn/22.wc7 b/assets/romfs/wc7/jpn/22.wc7 new file mode 100644 index 000000000..7f32efd9f Binary files /dev/null and b/assets/romfs/wc7/jpn/22.wc7 differ diff --git a/assets/romfs/wc7/jpn/25.wc7 b/assets/romfs/wc7/jpn/25.wc7 new file mode 100644 index 000000000..2f90bcb32 Binary files /dev/null and b/assets/romfs/wc7/jpn/25.wc7 differ diff --git a/assets/romfs/wc7/jpn/26.wc7 b/assets/romfs/wc7/jpn/26.wc7 new file mode 100644 index 000000000..189fe87b5 Binary files /dev/null and b/assets/romfs/wc7/jpn/26.wc7 differ diff --git a/assets/romfs/wc7/jpn/27.wc7 b/assets/romfs/wc7/jpn/27.wc7 new file mode 100644 index 000000000..00a8de4fd Binary files /dev/null and b/assets/romfs/wc7/jpn/27.wc7 differ diff --git a/assets/romfs/wc7/jpn/28.wc7 b/assets/romfs/wc7/jpn/28.wc7 new file mode 100644 index 000000000..3791e714a Binary files /dev/null and b/assets/romfs/wc7/jpn/28.wc7 differ diff --git a/assets/romfs/wc7/jpn/29.wc7 b/assets/romfs/wc7/jpn/29.wc7 new file mode 100644 index 000000000..5937366cc Binary files /dev/null and b/assets/romfs/wc7/jpn/29.wc7 differ diff --git a/assets/romfs/wc7/jpn/3.wc7 b/assets/romfs/wc7/jpn/3.wc7 new file mode 100644 index 000000000..d21292054 Binary files /dev/null and b/assets/romfs/wc7/jpn/3.wc7 differ diff --git a/assets/romfs/wc7/jpn/30.wc7 b/assets/romfs/wc7/jpn/30.wc7 new file mode 100644 index 000000000..db0f205dc Binary files /dev/null and b/assets/romfs/wc7/jpn/30.wc7 differ diff --git a/assets/romfs/wc7/jpn/33.wc7 b/assets/romfs/wc7/jpn/33.wc7 new file mode 100644 index 000000000..4657a0170 Binary files /dev/null and b/assets/romfs/wc7/jpn/33.wc7 differ diff --git a/assets/romfs/wc7/jpn/34.wc7 b/assets/romfs/wc7/jpn/34.wc7 new file mode 100644 index 000000000..f849258f8 Binary files /dev/null and b/assets/romfs/wc7/jpn/34.wc7 differ diff --git a/assets/romfs/wc7/jpn/37.wc7 b/assets/romfs/wc7/jpn/37.wc7 new file mode 100644 index 000000000..b9d610bd8 Binary files /dev/null and b/assets/romfs/wc7/jpn/37.wc7 differ diff --git a/assets/romfs/wc7/jpn/38.wc7 b/assets/romfs/wc7/jpn/38.wc7 new file mode 100644 index 000000000..073bedb61 Binary files /dev/null and b/assets/romfs/wc7/jpn/38.wc7 differ diff --git a/assets/romfs/wc7/jpn/39.wc7 b/assets/romfs/wc7/jpn/39.wc7 new file mode 100644 index 000000000..9c61fe1a2 Binary files /dev/null and b/assets/romfs/wc7/jpn/39.wc7 differ diff --git a/assets/romfs/wc7/jpn/4.wc7 b/assets/romfs/wc7/jpn/4.wc7 new file mode 100644 index 000000000..a36d7a5ac Binary files /dev/null and b/assets/romfs/wc7/jpn/4.wc7 differ diff --git a/assets/romfs/wc7/jpn/40.wc7 b/assets/romfs/wc7/jpn/40.wc7 new file mode 100644 index 000000000..8c3bda8ac Binary files /dev/null and b/assets/romfs/wc7/jpn/40.wc7 differ diff --git a/assets/romfs/wc7/jpn/41.wc7 b/assets/romfs/wc7/jpn/41.wc7 new file mode 100644 index 000000000..32148c1b0 Binary files /dev/null and b/assets/romfs/wc7/jpn/41.wc7 differ diff --git a/assets/romfs/wc7/jpn/42.wc7 b/assets/romfs/wc7/jpn/42.wc7 new file mode 100644 index 000000000..c95bc1fcb Binary files /dev/null and b/assets/romfs/wc7/jpn/42.wc7 differ diff --git a/assets/romfs/wc7/jpn/44.wc7 b/assets/romfs/wc7/jpn/44.wc7 new file mode 100644 index 000000000..177e6ecd4 Binary files /dev/null and b/assets/romfs/wc7/jpn/44.wc7 differ diff --git a/assets/romfs/wc7/jpn/45.wc7 b/assets/romfs/wc7/jpn/45.wc7 new file mode 100644 index 000000000..c16b784d4 Binary files /dev/null and b/assets/romfs/wc7/jpn/45.wc7 differ diff --git a/assets/romfs/wc7/jpn/48-1.wc7 b/assets/romfs/wc7/jpn/48-1.wc7 new file mode 100644 index 000000000..ef8489258 Binary files /dev/null and b/assets/romfs/wc7/jpn/48-1.wc7 differ diff --git a/assets/romfs/wc7/jpn/48-2.wc7 b/assets/romfs/wc7/jpn/48-2.wc7 new file mode 100644 index 000000000..68bbc9d52 Binary files /dev/null and b/assets/romfs/wc7/jpn/48-2.wc7 differ diff --git a/assets/romfs/wc7/jpn/48-3.wc7 b/assets/romfs/wc7/jpn/48-3.wc7 new file mode 100644 index 000000000..ffd842c75 Binary files /dev/null and b/assets/romfs/wc7/jpn/48-3.wc7 differ diff --git a/assets/romfs/wc7/jpn/48-4.wc7 b/assets/romfs/wc7/jpn/48-4.wc7 new file mode 100644 index 000000000..f2ca9fb4a Binary files /dev/null and b/assets/romfs/wc7/jpn/48-4.wc7 differ diff --git a/assets/romfs/wc7/jpn/50.wc7 b/assets/romfs/wc7/jpn/50.wc7 new file mode 100644 index 000000000..cbd2b9734 Binary files /dev/null and b/assets/romfs/wc7/jpn/50.wc7 differ diff --git a/assets/romfs/wc7/jpn/51.wc7 b/assets/romfs/wc7/jpn/51.wc7 new file mode 100644 index 000000000..631e3aeea Binary files /dev/null and b/assets/romfs/wc7/jpn/51.wc7 differ diff --git a/assets/romfs/wc7/jpn/52.wc7 b/assets/romfs/wc7/jpn/52.wc7 new file mode 100644 index 000000000..275185933 Binary files /dev/null and b/assets/romfs/wc7/jpn/52.wc7 differ diff --git a/assets/romfs/wc7/jpn/53.wc7 b/assets/romfs/wc7/jpn/53.wc7 new file mode 100644 index 000000000..05032c334 Binary files /dev/null and b/assets/romfs/wc7/jpn/53.wc7 differ diff --git a/assets/romfs/wc7/jpn/535.wc7 b/assets/romfs/wc7/jpn/535.wc7 new file mode 100644 index 000000000..102214c74 Binary files /dev/null and b/assets/romfs/wc7/jpn/535.wc7 differ diff --git a/assets/romfs/wc7/jpn/54.wc7 b/assets/romfs/wc7/jpn/54.wc7 new file mode 100644 index 000000000..31525581a Binary files /dev/null and b/assets/romfs/wc7/jpn/54.wc7 differ diff --git a/assets/romfs/wc7/jpn/55.wc7 b/assets/romfs/wc7/jpn/55.wc7 new file mode 100644 index 000000000..79638b70b Binary files /dev/null and b/assets/romfs/wc7/jpn/55.wc7 differ diff --git a/assets/romfs/wc7/jpn/56.wc7 b/assets/romfs/wc7/jpn/56.wc7 new file mode 100644 index 000000000..12ea77b5a Binary files /dev/null and b/assets/romfs/wc7/jpn/56.wc7 differ diff --git a/assets/romfs/wc7/jpn/57.wc7 b/assets/romfs/wc7/jpn/57.wc7 new file mode 100644 index 000000000..2c65ce533 Binary files /dev/null and b/assets/romfs/wc7/jpn/57.wc7 differ diff --git a/assets/romfs/wc7/jpn/58.wc7 b/assets/romfs/wc7/jpn/58.wc7 new file mode 100644 index 000000000..254201c3c Binary files /dev/null and b/assets/romfs/wc7/jpn/58.wc7 differ diff --git a/assets/romfs/wc7/jpn/588.wc7 b/assets/romfs/wc7/jpn/588.wc7 new file mode 100644 index 000000000..f034bdb4f Binary files /dev/null and b/assets/romfs/wc7/jpn/588.wc7 differ diff --git a/assets/romfs/wc7/jpn/59.wc7 b/assets/romfs/wc7/jpn/59.wc7 new file mode 100644 index 000000000..e3a90a921 Binary files /dev/null and b/assets/romfs/wc7/jpn/59.wc7 differ diff --git a/assets/romfs/wc7/jpn/60.wc7 b/assets/romfs/wc7/jpn/60.wc7 new file mode 100644 index 000000000..d626e41bc Binary files /dev/null and b/assets/romfs/wc7/jpn/60.wc7 differ diff --git a/assets/romfs/wc7/jpn/61.wc7 b/assets/romfs/wc7/jpn/61.wc7 new file mode 100644 index 000000000..f900eab95 Binary files /dev/null and b/assets/romfs/wc7/jpn/61.wc7 differ diff --git a/assets/romfs/wc7/jpn/62.wc7 b/assets/romfs/wc7/jpn/62.wc7 new file mode 100644 index 000000000..c4530b083 Binary files /dev/null and b/assets/romfs/wc7/jpn/62.wc7 differ diff --git a/assets/romfs/wc7/jpn/63.wc7 b/assets/romfs/wc7/jpn/63.wc7 new file mode 100644 index 000000000..88068f0e0 Binary files /dev/null and b/assets/romfs/wc7/jpn/63.wc7 differ diff --git a/assets/romfs/wc7/jpn/64.wc7 b/assets/romfs/wc7/jpn/64.wc7 new file mode 100644 index 000000000..44fe77af4 Binary files /dev/null and b/assets/romfs/wc7/jpn/64.wc7 differ diff --git a/assets/romfs/wc7/jpn/65.wc7 b/assets/romfs/wc7/jpn/65.wc7 new file mode 100644 index 000000000..2dfef56cf Binary files /dev/null and b/assets/romfs/wc7/jpn/65.wc7 differ diff --git a/assets/romfs/wc7/jpn/66.wc7 b/assets/romfs/wc7/jpn/66.wc7 new file mode 100644 index 000000000..d4141c850 Binary files /dev/null and b/assets/romfs/wc7/jpn/66.wc7 differ diff --git a/assets/romfs/wc7/jpn/67.wc7 b/assets/romfs/wc7/jpn/67.wc7 new file mode 100644 index 000000000..5ef6a88e7 Binary files /dev/null and b/assets/romfs/wc7/jpn/67.wc7 differ diff --git a/assets/romfs/wc7/jpn/71-1.wc7 b/assets/romfs/wc7/jpn/71-1.wc7 new file mode 100644 index 000000000..7807029ea Binary files /dev/null and b/assets/romfs/wc7/jpn/71-1.wc7 differ diff --git a/assets/romfs/wc7/jpn/71-2.wc7 b/assets/romfs/wc7/jpn/71-2.wc7 new file mode 100644 index 000000000..b6cf349ef Binary files /dev/null and b/assets/romfs/wc7/jpn/71-2.wc7 differ diff --git a/assets/romfs/wc7/jpn/71-3.wc7 b/assets/romfs/wc7/jpn/71-3.wc7 new file mode 100644 index 000000000..570d3661e Binary files /dev/null and b/assets/romfs/wc7/jpn/71-3.wc7 differ diff --git a/assets/romfs/wc7/jpn/71-4.wc7 b/assets/romfs/wc7/jpn/71-4.wc7 new file mode 100644 index 000000000..a1fff3975 Binary files /dev/null and b/assets/romfs/wc7/jpn/71-4.wc7 differ diff --git a/assets/romfs/wc7/jpn/71-5.wc7 b/assets/romfs/wc7/jpn/71-5.wc7 new file mode 100644 index 000000000..aafdff16b Binary files /dev/null and b/assets/romfs/wc7/jpn/71-5.wc7 differ diff --git a/assets/romfs/wc7/jpn/78.wc7 b/assets/romfs/wc7/jpn/78.wc7 new file mode 100644 index 000000000..d9d38fef1 Binary files /dev/null and b/assets/romfs/wc7/jpn/78.wc7 differ diff --git a/assets/romfs/wc7/jpn/79.wc7 b/assets/romfs/wc7/jpn/79.wc7 new file mode 100644 index 000000000..ec4437174 Binary files /dev/null and b/assets/romfs/wc7/jpn/79.wc7 differ diff --git a/assets/romfs/wc7/jpn/8.wc7 b/assets/romfs/wc7/jpn/8.wc7 new file mode 100644 index 000000000..9ae5f0555 Binary files /dev/null and b/assets/romfs/wc7/jpn/8.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-1.wc7 b/assets/romfs/wc7/jpn/81-1.wc7 new file mode 100644 index 000000000..989300f5c Binary files /dev/null and b/assets/romfs/wc7/jpn/81-1.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-10.wc7 b/assets/romfs/wc7/jpn/81-10.wc7 new file mode 100644 index 000000000..22ca869b7 Binary files /dev/null and b/assets/romfs/wc7/jpn/81-10.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-11.wc7 b/assets/romfs/wc7/jpn/81-11.wc7 new file mode 100644 index 000000000..b4909d1be Binary files /dev/null and b/assets/romfs/wc7/jpn/81-11.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-2.wc7 b/assets/romfs/wc7/jpn/81-2.wc7 new file mode 100644 index 000000000..8dd53b171 Binary files /dev/null and b/assets/romfs/wc7/jpn/81-2.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-3.wc7 b/assets/romfs/wc7/jpn/81-3.wc7 new file mode 100644 index 000000000..24e7247ef Binary files /dev/null and b/assets/romfs/wc7/jpn/81-3.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-4.wc7 b/assets/romfs/wc7/jpn/81-4.wc7 new file mode 100644 index 000000000..f0e18f02a Binary files /dev/null and b/assets/romfs/wc7/jpn/81-4.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-5.wc7 b/assets/romfs/wc7/jpn/81-5.wc7 new file mode 100644 index 000000000..367aeaedd Binary files /dev/null and b/assets/romfs/wc7/jpn/81-5.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-6.wc7 b/assets/romfs/wc7/jpn/81-6.wc7 new file mode 100644 index 000000000..ab11f4fab Binary files /dev/null and b/assets/romfs/wc7/jpn/81-6.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-7.wc7 b/assets/romfs/wc7/jpn/81-7.wc7 new file mode 100644 index 000000000..faa609fb1 Binary files /dev/null and b/assets/romfs/wc7/jpn/81-7.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-8.wc7 b/assets/romfs/wc7/jpn/81-8.wc7 new file mode 100644 index 000000000..c82df356f Binary files /dev/null and b/assets/romfs/wc7/jpn/81-8.wc7 differ diff --git a/assets/romfs/wc7/jpn/81-9.wc7 b/assets/romfs/wc7/jpn/81-9.wc7 new file mode 100644 index 000000000..b7257ab3d Binary files /dev/null and b/assets/romfs/wc7/jpn/81-9.wc7 differ diff --git a/assets/romfs/wc7/jpn/812.wc7 b/assets/romfs/wc7/jpn/812.wc7 new file mode 100644 index 000000000..ff7c7d08c Binary files /dev/null and b/assets/romfs/wc7/jpn/812.wc7 differ diff --git a/assets/romfs/wc7/jpn/82-1.wc7 b/assets/romfs/wc7/jpn/82-1.wc7 new file mode 100644 index 000000000..fd235c919 Binary files /dev/null and b/assets/romfs/wc7/jpn/82-1.wc7 differ diff --git a/assets/romfs/wc7/jpn/82-2.wc7 b/assets/romfs/wc7/jpn/82-2.wc7 new file mode 100644 index 000000000..8f25792f7 Binary files /dev/null and b/assets/romfs/wc7/jpn/82-2.wc7 differ diff --git a/assets/romfs/wc7/jpn/82-3.wc7 b/assets/romfs/wc7/jpn/82-3.wc7 new file mode 100644 index 000000000..52e530144 Binary files /dev/null and b/assets/romfs/wc7/jpn/82-3.wc7 differ diff --git a/assets/romfs/wc7/jpn/82-4.wc7 b/assets/romfs/wc7/jpn/82-4.wc7 new file mode 100644 index 000000000..8d89d41bb Binary files /dev/null and b/assets/romfs/wc7/jpn/82-4.wc7 differ diff --git a/assets/romfs/wc7/jpn/82-5.wc7 b/assets/romfs/wc7/jpn/82-5.wc7 new file mode 100644 index 000000000..542834882 Binary files /dev/null and b/assets/romfs/wc7/jpn/82-5.wc7 differ diff --git a/assets/romfs/wc7/jpn/82-6.wc7 b/assets/romfs/wc7/jpn/82-6.wc7 new file mode 100644 index 000000000..f7cab5523 Binary files /dev/null and b/assets/romfs/wc7/jpn/82-6.wc7 differ diff --git a/assets/romfs/wc7/jpn/83.wc7 b/assets/romfs/wc7/jpn/83.wc7 new file mode 100644 index 000000000..472a3fa0c Binary files /dev/null and b/assets/romfs/wc7/jpn/83.wc7 differ diff --git a/assets/romfs/wc7/jpn/86.wc7 b/assets/romfs/wc7/jpn/86.wc7 new file mode 100644 index 000000000..d359bffe8 Binary files /dev/null and b/assets/romfs/wc7/jpn/86.wc7 differ diff --git a/assets/romfs/wc7/jpn/88.wc7 b/assets/romfs/wc7/jpn/88.wc7 new file mode 100644 index 000000000..dfeb5f161 Binary files /dev/null and b/assets/romfs/wc7/jpn/88.wc7 differ diff --git a/assets/romfs/wc7/jpn/89.wc7 b/assets/romfs/wc7/jpn/89.wc7 new file mode 100644 index 000000000..cf4c46d23 Binary files /dev/null and b/assets/romfs/wc7/jpn/89.wc7 differ diff --git a/assets/romfs/wc7/jpn/90.wc7 b/assets/romfs/wc7/jpn/90.wc7 new file mode 100644 index 000000000..f83e16e81 Binary files /dev/null and b/assets/romfs/wc7/jpn/90.wc7 differ diff --git a/assets/romfs/wc7/jpn/94.wc7 b/assets/romfs/wc7/jpn/94.wc7 new file mode 100644 index 000000000..37467971a Binary files /dev/null and b/assets/romfs/wc7/jpn/94.wc7 differ diff --git a/assets/romfs/wc7/jpn/95.wc7 b/assets/romfs/wc7/jpn/95.wc7 new file mode 100644 index 000000000..4a97c6810 Binary files /dev/null and b/assets/romfs/wc7/jpn/95.wc7 differ diff --git a/assets/romfs/wc7/jpn/96.wc7 b/assets/romfs/wc7/jpn/96.wc7 new file mode 100644 index 000000000..77acd940d Binary files /dev/null and b/assets/romfs/wc7/jpn/96.wc7 differ diff --git a/assets/romfs/wc7/jpn/97.wc7 b/assets/romfs/wc7/jpn/97.wc7 new file mode 100644 index 000000000..0f7dedda2 Binary files /dev/null and b/assets/romfs/wc7/jpn/97.wc7 differ diff --git a/assets/romfs/wc7/jpn/98.wc7 b/assets/romfs/wc7/jpn/98.wc7 new file mode 100644 index 000000000..7bb52e7ff Binary files /dev/null and b/assets/romfs/wc7/jpn/98.wc7 differ diff --git a/assets/romfs/wc7/jpn/99.wc7 b/assets/romfs/wc7/jpn/99.wc7 new file mode 100644 index 000000000..800a9529e Binary files /dev/null and b/assets/romfs/wc7/jpn/99.wc7 differ diff --git a/assets/romfs/wc7/kor/1001.wc7 b/assets/romfs/wc7/kor/1001.wc7 new file mode 100644 index 000000000..7a36a72a8 Binary files /dev/null and b/assets/romfs/wc7/kor/1001.wc7 differ diff --git a/assets/romfs/wc7/kor/1006.wc7 b/assets/romfs/wc7/kor/1006.wc7 new file mode 100644 index 000000000..527dfdf71 Binary files /dev/null and b/assets/romfs/wc7/kor/1006.wc7 differ diff --git a/assets/romfs/wc7/kor/1007.wc7 b/assets/romfs/wc7/kor/1007.wc7 new file mode 100644 index 000000000..8985c4205 Binary files /dev/null and b/assets/romfs/wc7/kor/1007.wc7 differ diff --git a/assets/romfs/wc7/kor/1008.wc7 b/assets/romfs/wc7/kor/1008.wc7 new file mode 100644 index 000000000..eff3f370a Binary files /dev/null and b/assets/romfs/wc7/kor/1008.wc7 differ diff --git a/assets/romfs/wc7/kor/1015.wc7 b/assets/romfs/wc7/kor/1015.wc7 new file mode 100644 index 000000000..3b13eb6d5 Binary files /dev/null and b/assets/romfs/wc7/kor/1015.wc7 differ diff --git a/assets/romfs/wc7/kor/1016.wc7 b/assets/romfs/wc7/kor/1016.wc7 new file mode 100644 index 000000000..62c5db272 Binary files /dev/null and b/assets/romfs/wc7/kor/1016.wc7 differ diff --git a/assets/romfs/wc7/kor/1017.wc7 b/assets/romfs/wc7/kor/1017.wc7 new file mode 100644 index 000000000..862090d92 Binary files /dev/null and b/assets/romfs/wc7/kor/1017.wc7 differ diff --git a/assets/romfs/wc7/kor/1018.wc7 b/assets/romfs/wc7/kor/1018.wc7 new file mode 100644 index 000000000..eed23531e Binary files /dev/null and b/assets/romfs/wc7/kor/1018.wc7 differ diff --git a/assets/romfs/wc7/kor/1019.wc7 b/assets/romfs/wc7/kor/1019.wc7 new file mode 100644 index 000000000..f4fe5f455 Binary files /dev/null and b/assets/romfs/wc7/kor/1019.wc7 differ diff --git a/assets/romfs/wc7/kor/1022.wc7 b/assets/romfs/wc7/kor/1022.wc7 new file mode 100644 index 000000000..86f9744be Binary files /dev/null and b/assets/romfs/wc7/kor/1022.wc7 differ diff --git a/assets/romfs/wc7/kor/1023.wc7 b/assets/romfs/wc7/kor/1023.wc7 new file mode 100644 index 000000000..c6f85d60f Binary files /dev/null and b/assets/romfs/wc7/kor/1023.wc7 differ diff --git a/assets/romfs/wc7/kor/1024.wc7 b/assets/romfs/wc7/kor/1024.wc7 new file mode 100644 index 000000000..46db3cec9 Binary files /dev/null and b/assets/romfs/wc7/kor/1024.wc7 differ diff --git a/assets/romfs/wc7/kor/1025.wc7 b/assets/romfs/wc7/kor/1025.wc7 new file mode 100644 index 000000000..29a4cc6c2 Binary files /dev/null and b/assets/romfs/wc7/kor/1025.wc7 differ diff --git a/assets/romfs/wc7/kor/1026.wc7 b/assets/romfs/wc7/kor/1026.wc7 new file mode 100644 index 000000000..d81c8b5d5 Binary files /dev/null and b/assets/romfs/wc7/kor/1026.wc7 differ diff --git a/assets/romfs/wc7/kor/1027.wc7 b/assets/romfs/wc7/kor/1027.wc7 new file mode 100644 index 000000000..ed25fb45a Binary files /dev/null and b/assets/romfs/wc7/kor/1027.wc7 differ diff --git a/assets/romfs/wc7/kor/1029.wc7 b/assets/romfs/wc7/kor/1029.wc7 new file mode 100644 index 000000000..b9b87812a Binary files /dev/null and b/assets/romfs/wc7/kor/1029.wc7 differ diff --git a/assets/romfs/wc7/kor/1041.wc7 b/assets/romfs/wc7/kor/1041.wc7 new file mode 100644 index 000000000..82f5ab43a Binary files /dev/null and b/assets/romfs/wc7/kor/1041.wc7 differ diff --git a/assets/romfs/wc7/kor/1042.wc7 b/assets/romfs/wc7/kor/1042.wc7 new file mode 100644 index 000000000..3899c3935 Binary files /dev/null and b/assets/romfs/wc7/kor/1042.wc7 differ diff --git a/assets/romfs/wc7/kor/1043.wc7 b/assets/romfs/wc7/kor/1043.wc7 new file mode 100644 index 000000000..b672880e9 Binary files /dev/null and b/assets/romfs/wc7/kor/1043.wc7 differ diff --git a/assets/romfs/wc7/kor/1047.wc7 b/assets/romfs/wc7/kor/1047.wc7 new file mode 100644 index 000000000..21171002f Binary files /dev/null and b/assets/romfs/wc7/kor/1047.wc7 differ diff --git a/assets/romfs/wc7/kor/1048.wc7 b/assets/romfs/wc7/kor/1048.wc7 new file mode 100644 index 000000000..6500c9864 Binary files /dev/null and b/assets/romfs/wc7/kor/1048.wc7 differ diff --git a/assets/romfs/wc7/kor/1049.wc7 b/assets/romfs/wc7/kor/1049.wc7 new file mode 100644 index 000000000..b03efb631 Binary files /dev/null and b/assets/romfs/wc7/kor/1049.wc7 differ diff --git a/assets/romfs/wc7/kor/1050.wc7 b/assets/romfs/wc7/kor/1050.wc7 new file mode 100644 index 000000000..5343088de Binary files /dev/null and b/assets/romfs/wc7/kor/1050.wc7 differ diff --git a/assets/romfs/wc7/kor/1051.wc7 b/assets/romfs/wc7/kor/1051.wc7 new file mode 100644 index 000000000..29d5469e2 Binary files /dev/null and b/assets/romfs/wc7/kor/1051.wc7 differ diff --git a/assets/romfs/wc7/kor/1052.wc7 b/assets/romfs/wc7/kor/1052.wc7 new file mode 100644 index 000000000..1ec1aa981 Binary files /dev/null and b/assets/romfs/wc7/kor/1052.wc7 differ diff --git a/assets/romfs/wc7/kor/1053.wc7 b/assets/romfs/wc7/kor/1053.wc7 new file mode 100644 index 000000000..01004f802 Binary files /dev/null and b/assets/romfs/wc7/kor/1053.wc7 differ diff --git a/assets/romfs/wc7/kor/1054.wc7 b/assets/romfs/wc7/kor/1054.wc7 new file mode 100644 index 000000000..144b18571 Binary files /dev/null and b/assets/romfs/wc7/kor/1054.wc7 differ diff --git a/assets/romfs/wc7/kor/1055.wc7 b/assets/romfs/wc7/kor/1055.wc7 new file mode 100644 index 000000000..cbacbcff2 Binary files /dev/null and b/assets/romfs/wc7/kor/1055.wc7 differ diff --git a/assets/romfs/wc7/kor/1057.wc7 b/assets/romfs/wc7/kor/1057.wc7 new file mode 100644 index 000000000..c4a3e87f7 Binary files /dev/null and b/assets/romfs/wc7/kor/1057.wc7 differ diff --git a/assets/romfs/wc7/kor/1058.wc7 b/assets/romfs/wc7/kor/1058.wc7 new file mode 100644 index 000000000..47e518194 Binary files /dev/null and b/assets/romfs/wc7/kor/1058.wc7 differ diff --git a/assets/romfs/wc7/kor/1060.wc7 b/assets/romfs/wc7/kor/1060.wc7 new file mode 100644 index 000000000..de0c0def2 Binary files /dev/null and b/assets/romfs/wc7/kor/1060.wc7 differ diff --git a/assets/romfs/wc7/kor/1061.wc7 b/assets/romfs/wc7/kor/1061.wc7 new file mode 100644 index 000000000..1bfe0721d Binary files /dev/null and b/assets/romfs/wc7/kor/1061.wc7 differ diff --git a/assets/romfs/wc7/kor/1062.wc7 b/assets/romfs/wc7/kor/1062.wc7 new file mode 100644 index 000000000..3028b14a6 Binary files /dev/null and b/assets/romfs/wc7/kor/1062.wc7 differ diff --git a/assets/romfs/wc7/kor/1064.wc7 b/assets/romfs/wc7/kor/1064.wc7 new file mode 100644 index 000000000..07d2a5050 Binary files /dev/null and b/assets/romfs/wc7/kor/1064.wc7 differ diff --git a/assets/romfs/wc7/kor/1065.wc7 b/assets/romfs/wc7/kor/1065.wc7 new file mode 100644 index 000000000..d089a62f7 Binary files /dev/null and b/assets/romfs/wc7/kor/1065.wc7 differ diff --git a/assets/romfs/wc7/kor/1066.wc7 b/assets/romfs/wc7/kor/1066.wc7 new file mode 100644 index 000000000..953bc00ac Binary files /dev/null and b/assets/romfs/wc7/kor/1066.wc7 differ diff --git a/assets/romfs/wc7/kor/1067.wc7 b/assets/romfs/wc7/kor/1067.wc7 new file mode 100644 index 000000000..df28632c8 Binary files /dev/null and b/assets/romfs/wc7/kor/1067.wc7 differ diff --git a/assets/romfs/wc7/kor/1068.wc7 b/assets/romfs/wc7/kor/1068.wc7 new file mode 100644 index 000000000..bcd3c4924 Binary files /dev/null and b/assets/romfs/wc7/kor/1068.wc7 differ diff --git a/assets/romfs/wc7/kor/1070.wc7 b/assets/romfs/wc7/kor/1070.wc7 new file mode 100644 index 000000000..70be5c048 Binary files /dev/null and b/assets/romfs/wc7/kor/1070.wc7 differ diff --git a/assets/romfs/wc7/kor/1071.wc7 b/assets/romfs/wc7/kor/1071.wc7 new file mode 100644 index 000000000..055b27d26 Binary files /dev/null and b/assets/romfs/wc7/kor/1071.wc7 differ diff --git a/assets/romfs/wc7/kor/1072.wc7 b/assets/romfs/wc7/kor/1072.wc7 new file mode 100644 index 000000000..a88589d2b Binary files /dev/null and b/assets/romfs/wc7/kor/1072.wc7 differ diff --git a/assets/romfs/wc7/kor/1073.wc7 b/assets/romfs/wc7/kor/1073.wc7 new file mode 100644 index 000000000..29d4a24b3 Binary files /dev/null and b/assets/romfs/wc7/kor/1073.wc7 differ diff --git a/assets/romfs/wc7/kor/1074.wc7 b/assets/romfs/wc7/kor/1074.wc7 new file mode 100644 index 000000000..4d159bd6d Binary files /dev/null and b/assets/romfs/wc7/kor/1074.wc7 differ diff --git a/assets/romfs/wc7/kor/1075.wc7 b/assets/romfs/wc7/kor/1075.wc7 new file mode 100644 index 000000000..c84162bcd Binary files /dev/null and b/assets/romfs/wc7/kor/1075.wc7 differ diff --git a/assets/romfs/wc7/kor/1076.wc7 b/assets/romfs/wc7/kor/1076.wc7 new file mode 100644 index 000000000..47cde0f30 Binary files /dev/null and b/assets/romfs/wc7/kor/1076.wc7 differ diff --git a/assets/romfs/wc7/kor/1078.wc7 b/assets/romfs/wc7/kor/1078.wc7 new file mode 100644 index 000000000..03b99f5a5 Binary files /dev/null and b/assets/romfs/wc7/kor/1078.wc7 differ diff --git a/assets/romfs/wc7/kor/1504.wc7 b/assets/romfs/wc7/kor/1504.wc7 new file mode 100644 index 000000000..edf7f0590 Binary files /dev/null and b/assets/romfs/wc7/kor/1504.wc7 differ diff --git a/assets/romfs/wc7/kor/1508.wc7 b/assets/romfs/wc7/kor/1508.wc7 new file mode 100644 index 000000000..e510f1454 Binary files /dev/null and b/assets/romfs/wc7/kor/1508.wc7 differ diff --git a/assets/romfs/wc7/kor/1509.wc7 b/assets/romfs/wc7/kor/1509.wc7 new file mode 100644 index 000000000..c4e13a688 Binary files /dev/null and b/assets/romfs/wc7/kor/1509.wc7 differ diff --git a/assets/romfs/wc7/kor/1510.wc7 b/assets/romfs/wc7/kor/1510.wc7 new file mode 100644 index 000000000..3c7b2fb22 Binary files /dev/null and b/assets/romfs/wc7/kor/1510.wc7 differ diff --git a/assets/romfs/wc7/kor/1511.wc7 b/assets/romfs/wc7/kor/1511.wc7 new file mode 100644 index 000000000..bd7234607 Binary files /dev/null and b/assets/romfs/wc7/kor/1511.wc7 differ diff --git a/assets/romfs/wc7/kor/1512.wc7 b/assets/romfs/wc7/kor/1512.wc7 new file mode 100644 index 000000000..283f9e607 Binary files /dev/null and b/assets/romfs/wc7/kor/1512.wc7 differ diff --git a/assets/romfs/wc7/kor/1513.wc7 b/assets/romfs/wc7/kor/1513.wc7 new file mode 100644 index 000000000..131f8aef5 Binary files /dev/null and b/assets/romfs/wc7/kor/1513.wc7 differ diff --git a/assets/romfs/wc7/kor/1514.wc7 b/assets/romfs/wc7/kor/1514.wc7 new file mode 100644 index 000000000..36c7c9bbe Binary files /dev/null and b/assets/romfs/wc7/kor/1514.wc7 differ diff --git a/assets/romfs/wc7/kor/1515.wc7 b/assets/romfs/wc7/kor/1515.wc7 new file mode 100644 index 000000000..902deb542 Binary files /dev/null and b/assets/romfs/wc7/kor/1515.wc7 differ diff --git a/assets/romfs/wc7/kor/1516.wc7 b/assets/romfs/wc7/kor/1516.wc7 new file mode 100644 index 000000000..4e1840c9e Binary files /dev/null and b/assets/romfs/wc7/kor/1516.wc7 differ diff --git a/assets/romfs/wc7/kor/1601.wc7 b/assets/romfs/wc7/kor/1601.wc7 new file mode 100644 index 000000000..3cc6c1186 Binary files /dev/null and b/assets/romfs/wc7/kor/1601.wc7 differ diff --git a/assets/romfs/wc7/kor/1603.wc7 b/assets/romfs/wc7/kor/1603.wc7 new file mode 100644 index 000000000..6b227a1be Binary files /dev/null and b/assets/romfs/wc7/kor/1603.wc7 differ diff --git a/assets/romfs/wc7/kor/175.wc7 b/assets/romfs/wc7/kor/175.wc7 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc7/kor/175.wc7 differ diff --git a/assets/romfs/wc7/kor/2040.wc7 b/assets/romfs/wc7/kor/2040.wc7 new file mode 100644 index 000000000..fb5733e84 Binary files /dev/null and b/assets/romfs/wc7/kor/2040.wc7 differ diff --git a/assets/romfs/wc7/kor/2041.wc7 b/assets/romfs/wc7/kor/2041.wc7 new file mode 100644 index 000000000..810633781 Binary files /dev/null and b/assets/romfs/wc7/kor/2041.wc7 differ diff --git a/assets/romfs/wc7/kor/2042.wc7 b/assets/romfs/wc7/kor/2042.wc7 new file mode 100644 index 000000000..c138e8e10 Binary files /dev/null and b/assets/romfs/wc7/kor/2042.wc7 differ diff --git a/assets/romfs/wc7/kor/2043.wc7 b/assets/romfs/wc7/kor/2043.wc7 new file mode 100644 index 000000000..2428b0a44 Binary files /dev/null and b/assets/romfs/wc7/kor/2043.wc7 differ diff --git a/assets/romfs/wc7/kor/2044.wc7 b/assets/romfs/wc7/kor/2044.wc7 new file mode 100644 index 000000000..bd55df1db Binary files /dev/null and b/assets/romfs/wc7/kor/2044.wc7 differ diff --git a/assets/romfs/wc7/kor/2045.wc7 b/assets/romfs/wc7/kor/2045.wc7 new file mode 100644 index 000000000..3d72edac1 Binary files /dev/null and b/assets/romfs/wc7/kor/2045.wc7 differ diff --git a/assets/romfs/wc7/kor/2046.wc7 b/assets/romfs/wc7/kor/2046.wc7 new file mode 100644 index 000000000..2728884d4 Binary files /dev/null and b/assets/romfs/wc7/kor/2046.wc7 differ diff --git a/assets/romfs/wc7/kor/812.wc7 b/assets/romfs/wc7/kor/812.wc7 new file mode 100644 index 000000000..743de41a6 Binary files /dev/null and b/assets/romfs/wc7/kor/812.wc7 differ diff --git a/assets/romfs/wc7/spa/1501.wc7 b/assets/romfs/wc7/spa/1501.wc7 new file mode 100644 index 000000000..8c844a844 Binary files /dev/null and b/assets/romfs/wc7/spa/1501.wc7 differ diff --git a/assets/romfs/wc7/spa/1503.wc7 b/assets/romfs/wc7/spa/1503.wc7 new file mode 100644 index 000000000..2d399dd08 Binary files /dev/null and b/assets/romfs/wc7/spa/1503.wc7 differ diff --git a/assets/romfs/wc7/spa/1504.wc7 b/assets/romfs/wc7/spa/1504.wc7 new file mode 100644 index 000000000..1a84d1eec Binary files /dev/null and b/assets/romfs/wc7/spa/1504.wc7 differ diff --git a/assets/romfs/wc7/spa/1505.wc7 b/assets/romfs/wc7/spa/1505.wc7 new file mode 100644 index 000000000..b40d0c238 Binary files /dev/null and b/assets/romfs/wc7/spa/1505.wc7 differ diff --git a/assets/romfs/wc7/spa/1506.wc7 b/assets/romfs/wc7/spa/1506.wc7 new file mode 100644 index 000000000..60d12f26b Binary files /dev/null and b/assets/romfs/wc7/spa/1506.wc7 differ diff --git a/assets/romfs/wc7/spa/1507.wc7 b/assets/romfs/wc7/spa/1507.wc7 new file mode 100644 index 000000000..3ebfe1635 Binary files /dev/null and b/assets/romfs/wc7/spa/1507.wc7 differ diff --git a/assets/romfs/wc7/spa/1508.wc7 b/assets/romfs/wc7/spa/1508.wc7 new file mode 100644 index 000000000..666408070 Binary files /dev/null and b/assets/romfs/wc7/spa/1508.wc7 differ diff --git a/assets/romfs/wc7/spa/1509.wc7 b/assets/romfs/wc7/spa/1509.wc7 new file mode 100644 index 000000000..c94fb17b4 Binary files /dev/null and b/assets/romfs/wc7/spa/1509.wc7 differ diff --git a/assets/romfs/wc7/spa/1510.wc7 b/assets/romfs/wc7/spa/1510.wc7 new file mode 100644 index 000000000..96bdf5e2c Binary files /dev/null and b/assets/romfs/wc7/spa/1510.wc7 differ diff --git a/assets/romfs/wc7/spa/1511.wc7 b/assets/romfs/wc7/spa/1511.wc7 new file mode 100644 index 000000000..e8a07dbb9 Binary files /dev/null and b/assets/romfs/wc7/spa/1511.wc7 differ diff --git a/assets/romfs/wc7/spa/1512.wc7 b/assets/romfs/wc7/spa/1512.wc7 new file mode 100644 index 000000000..232bffbdf Binary files /dev/null and b/assets/romfs/wc7/spa/1512.wc7 differ diff --git a/assets/romfs/wc7/spa/1513.wc7 b/assets/romfs/wc7/spa/1513.wc7 new file mode 100644 index 000000000..a2beca6c3 Binary files /dev/null and b/assets/romfs/wc7/spa/1513.wc7 differ diff --git a/assets/romfs/wc7/spa/1514.wc7 b/assets/romfs/wc7/spa/1514.wc7 new file mode 100644 index 000000000..8bcd45396 Binary files /dev/null and b/assets/romfs/wc7/spa/1514.wc7 differ diff --git a/assets/romfs/wc7/spa/1515.wc7 b/assets/romfs/wc7/spa/1515.wc7 new file mode 100644 index 000000000..974297d62 Binary files /dev/null and b/assets/romfs/wc7/spa/1515.wc7 differ diff --git a/assets/romfs/wc7/spa/1516.wc7 b/assets/romfs/wc7/spa/1516.wc7 new file mode 100644 index 000000000..e2c351903 Binary files /dev/null and b/assets/romfs/wc7/spa/1516.wc7 differ diff --git a/assets/romfs/wc7/spa/1601.wc7 b/assets/romfs/wc7/spa/1601.wc7 new file mode 100644 index 000000000..08fbd6fa8 Binary files /dev/null and b/assets/romfs/wc7/spa/1601.wc7 differ diff --git a/assets/romfs/wc7/spa/1602.wc7 b/assets/romfs/wc7/spa/1602.wc7 new file mode 100644 index 000000000..26ee251de Binary files /dev/null and b/assets/romfs/wc7/spa/1602.wc7 differ diff --git a/assets/romfs/wc7/spa/1603.wc7 b/assets/romfs/wc7/spa/1603.wc7 new file mode 100644 index 000000000..6e585e9e0 Binary files /dev/null and b/assets/romfs/wc7/spa/1603.wc7 differ diff --git a/assets/romfs/wc7/spa/175.wc7 b/assets/romfs/wc7/spa/175.wc7 new file mode 100644 index 000000000..822584d6d Binary files /dev/null and b/assets/romfs/wc7/spa/175.wc7 differ diff --git a/assets/romfs/wc7/spa/2040.wc7 b/assets/romfs/wc7/spa/2040.wc7 new file mode 100644 index 000000000..e3caa6deb Binary files /dev/null and b/assets/romfs/wc7/spa/2040.wc7 differ diff --git a/assets/romfs/wc7/spa/2041.wc7 b/assets/romfs/wc7/spa/2041.wc7 new file mode 100644 index 000000000..9735b0a98 Binary files /dev/null and b/assets/romfs/wc7/spa/2041.wc7 differ diff --git a/assets/romfs/wc7/spa/2042.wc7 b/assets/romfs/wc7/spa/2042.wc7 new file mode 100644 index 000000000..382e65cc9 Binary files /dev/null and b/assets/romfs/wc7/spa/2042.wc7 differ diff --git a/assets/romfs/wc7/spa/2043.wc7 b/assets/romfs/wc7/spa/2043.wc7 new file mode 100644 index 000000000..7fb150ad3 Binary files /dev/null and b/assets/romfs/wc7/spa/2043.wc7 differ diff --git a/assets/romfs/wc7/spa/2044.wc7 b/assets/romfs/wc7/spa/2044.wc7 new file mode 100644 index 000000000..813174179 Binary files /dev/null and b/assets/romfs/wc7/spa/2044.wc7 differ diff --git a/assets/romfs/wc7/spa/2045.wc7 b/assets/romfs/wc7/spa/2045.wc7 new file mode 100644 index 000000000..f488dea7b Binary files /dev/null and b/assets/romfs/wc7/spa/2045.wc7 differ diff --git a/assets/romfs/wc7/spa/2046.wc7 b/assets/romfs/wc7/spa/2046.wc7 new file mode 100644 index 000000000..ee340819c Binary files /dev/null and b/assets/romfs/wc7/spa/2046.wc7 differ diff --git a/assets/romfs/wc7/spa/504-1.wc7 b/assets/romfs/wc7/spa/504-1.wc7 new file mode 100644 index 000000000..d90a09c7e Binary files /dev/null and b/assets/romfs/wc7/spa/504-1.wc7 differ diff --git a/assets/romfs/wc7/spa/504-2.wc7 b/assets/romfs/wc7/spa/504-2.wc7 new file mode 100644 index 000000000..a602ee77c Binary files /dev/null and b/assets/romfs/wc7/spa/504-2.wc7 differ diff --git a/assets/romfs/wc7/spa/511.wc7 b/assets/romfs/wc7/spa/511.wc7 new file mode 100644 index 000000000..9ae678a64 Binary files /dev/null and b/assets/romfs/wc7/spa/511.wc7 differ diff --git a/assets/romfs/wc7/spa/515-1.wc7 b/assets/romfs/wc7/spa/515-1.wc7 new file mode 100644 index 000000000..e5849c41f Binary files /dev/null and b/assets/romfs/wc7/spa/515-1.wc7 differ diff --git a/assets/romfs/wc7/spa/515-2.wc7 b/assets/romfs/wc7/spa/515-2.wc7 new file mode 100644 index 000000000..8c5c42ff5 Binary files /dev/null and b/assets/romfs/wc7/spa/515-2.wc7 differ diff --git a/assets/romfs/wc7/spa/523.wc7 b/assets/romfs/wc7/spa/523.wc7 new file mode 100644 index 000000000..f763c27e8 Binary files /dev/null and b/assets/romfs/wc7/spa/523.wc7 differ diff --git a/assets/romfs/wc7/spa/524.wc7 b/assets/romfs/wc7/spa/524.wc7 new file mode 100644 index 000000000..81cdd4d39 Binary files /dev/null and b/assets/romfs/wc7/spa/524.wc7 differ diff --git a/assets/romfs/wc7/spa/525.wc7 b/assets/romfs/wc7/spa/525.wc7 new file mode 100644 index 000000000..59de764bb Binary files /dev/null and b/assets/romfs/wc7/spa/525.wc7 differ diff --git a/assets/romfs/wc7/spa/537.wc7 b/assets/romfs/wc7/spa/537.wc7 new file mode 100644 index 000000000..0ebc70725 Binary files /dev/null and b/assets/romfs/wc7/spa/537.wc7 differ diff --git a/assets/romfs/wc7/spa/546.wc7 b/assets/romfs/wc7/spa/546.wc7 new file mode 100644 index 000000000..296a39dea Binary files /dev/null and b/assets/romfs/wc7/spa/546.wc7 differ diff --git a/assets/romfs/wc7/spa/547.wc7 b/assets/romfs/wc7/spa/547.wc7 new file mode 100644 index 000000000..2141ff24e Binary files /dev/null and b/assets/romfs/wc7/spa/547.wc7 differ diff --git a/assets/romfs/wc7/spa/551-1.wc7 b/assets/romfs/wc7/spa/551-1.wc7 new file mode 100644 index 000000000..d6771986b Binary files /dev/null and b/assets/romfs/wc7/spa/551-1.wc7 differ diff --git a/assets/romfs/wc7/spa/551-2.wc7 b/assets/romfs/wc7/spa/551-2.wc7 new file mode 100644 index 000000000..6c57c07d0 Binary files /dev/null and b/assets/romfs/wc7/spa/551-2.wc7 differ diff --git a/assets/romfs/wc7/spa/552-1.wc7 b/assets/romfs/wc7/spa/552-1.wc7 new file mode 100644 index 000000000..99e9d7c4b Binary files /dev/null and b/assets/romfs/wc7/spa/552-1.wc7 differ diff --git a/assets/romfs/wc7/spa/552-2.wc7 b/assets/romfs/wc7/spa/552-2.wc7 new file mode 100644 index 000000000..b8fcf98ff Binary files /dev/null and b/assets/romfs/wc7/spa/552-2.wc7 differ diff --git a/assets/romfs/wc7/spa/553.wc7 b/assets/romfs/wc7/spa/553.wc7 new file mode 100644 index 000000000..6ed5f5baf Binary files /dev/null and b/assets/romfs/wc7/spa/553.wc7 differ diff --git a/assets/romfs/wc7/spa/556.wc7 b/assets/romfs/wc7/spa/556.wc7 new file mode 100644 index 000000000..e970d9ba7 Binary files /dev/null and b/assets/romfs/wc7/spa/556.wc7 differ diff --git a/assets/romfs/wc7/spa/557.wc7 b/assets/romfs/wc7/spa/557.wc7 new file mode 100644 index 000000000..838704c0d Binary files /dev/null and b/assets/romfs/wc7/spa/557.wc7 differ diff --git a/assets/romfs/wc7/spa/558.wc7 b/assets/romfs/wc7/spa/558.wc7 new file mode 100644 index 000000000..491e8db2f Binary files /dev/null and b/assets/romfs/wc7/spa/558.wc7 differ diff --git a/assets/romfs/wc7/spa/559.wc7 b/assets/romfs/wc7/spa/559.wc7 new file mode 100644 index 000000000..e4e5d5d19 Binary files /dev/null and b/assets/romfs/wc7/spa/559.wc7 differ diff --git a/assets/romfs/wc7/spa/560.wc7 b/assets/romfs/wc7/spa/560.wc7 new file mode 100644 index 000000000..f061f78be Binary files /dev/null and b/assets/romfs/wc7/spa/560.wc7 differ diff --git a/assets/romfs/wc7/spa/561.wc7 b/assets/romfs/wc7/spa/561.wc7 new file mode 100644 index 000000000..393919fb5 Binary files /dev/null and b/assets/romfs/wc7/spa/561.wc7 differ diff --git a/assets/romfs/wc7/spa/562.wc7 b/assets/romfs/wc7/spa/562.wc7 new file mode 100644 index 000000000..6b0fa6d77 Binary files /dev/null and b/assets/romfs/wc7/spa/562.wc7 differ diff --git a/assets/romfs/wc7/spa/563.wc7 b/assets/romfs/wc7/spa/563.wc7 new file mode 100644 index 000000000..d6bc3f091 Binary files /dev/null and b/assets/romfs/wc7/spa/563.wc7 differ diff --git a/assets/romfs/wc7/spa/564.wc7 b/assets/romfs/wc7/spa/564.wc7 new file mode 100644 index 000000000..9d87ce5c5 Binary files /dev/null and b/assets/romfs/wc7/spa/564.wc7 differ diff --git a/assets/romfs/wc7/spa/565.wc7 b/assets/romfs/wc7/spa/565.wc7 new file mode 100644 index 000000000..7ef81e62c Binary files /dev/null and b/assets/romfs/wc7/spa/565.wc7 differ diff --git a/assets/romfs/wc7/spa/566.wc7 b/assets/romfs/wc7/spa/566.wc7 new file mode 100644 index 000000000..be748586b Binary files /dev/null and b/assets/romfs/wc7/spa/566.wc7 differ diff --git a/assets/romfs/wc7/spa/567.wc7 b/assets/romfs/wc7/spa/567.wc7 new file mode 100644 index 000000000..5b88f47ba Binary files /dev/null and b/assets/romfs/wc7/spa/567.wc7 differ diff --git a/assets/romfs/wc7/spa/569.wc7 b/assets/romfs/wc7/spa/569.wc7 new file mode 100644 index 000000000..4531980b5 Binary files /dev/null and b/assets/romfs/wc7/spa/569.wc7 differ diff --git a/assets/romfs/wc7/spa/570.wc7 b/assets/romfs/wc7/spa/570.wc7 new file mode 100644 index 000000000..8e67110a4 Binary files /dev/null and b/assets/romfs/wc7/spa/570.wc7 differ diff --git a/assets/romfs/wc7/spa/571.wc7 b/assets/romfs/wc7/spa/571.wc7 new file mode 100644 index 000000000..359eb037e Binary files /dev/null and b/assets/romfs/wc7/spa/571.wc7 differ diff --git a/assets/romfs/wc7/spa/574.wc7 b/assets/romfs/wc7/spa/574.wc7 new file mode 100644 index 000000000..ea4c817f0 Binary files /dev/null and b/assets/romfs/wc7/spa/574.wc7 differ diff --git a/assets/romfs/wc7/spa/576.wc7 b/assets/romfs/wc7/spa/576.wc7 new file mode 100644 index 000000000..406b090bd Binary files /dev/null and b/assets/romfs/wc7/spa/576.wc7 differ diff --git a/assets/romfs/wc7/spa/577.wc7 b/assets/romfs/wc7/spa/577.wc7 new file mode 100644 index 000000000..413bceba2 Binary files /dev/null and b/assets/romfs/wc7/spa/577.wc7 differ diff --git a/assets/romfs/wc7/spa/578.wc7 b/assets/romfs/wc7/spa/578.wc7 new file mode 100644 index 000000000..ca8cf8a9d Binary files /dev/null and b/assets/romfs/wc7/spa/578.wc7 differ diff --git a/assets/romfs/wc7/spa/586.wc7 b/assets/romfs/wc7/spa/586.wc7 new file mode 100644 index 000000000..3c44323db Binary files /dev/null and b/assets/romfs/wc7/spa/586.wc7 differ diff --git a/assets/romfs/wc7/spa/588.wc7 b/assets/romfs/wc7/spa/588.wc7 new file mode 100644 index 000000000..0b527848e Binary files /dev/null and b/assets/romfs/wc7/spa/588.wc7 differ diff --git a/assets/romfs/wc7/spa/598.wc7 b/assets/romfs/wc7/spa/598.wc7 new file mode 100644 index 000000000..3b554ee03 Binary files /dev/null and b/assets/romfs/wc7/spa/598.wc7 differ diff --git a/assets/romfs/wc7/spa/812.wc7 b/assets/romfs/wc7/spa/812.wc7 new file mode 100644 index 000000000..3d93f9855 Binary files /dev/null and b/assets/romfs/wc7/spa/812.wc7 differ diff --git a/resources/01.png b/resources/01.png new file mode 100644 index 000000000..a3e2acbec Binary files /dev/null and b/resources/01.png differ diff --git a/resources/02.png b/resources/02.png new file mode 100644 index 000000000..219c5f048 Binary files /dev/null and b/resources/02.png differ diff --git a/resources/03.png b/resources/03.png new file mode 100644 index 000000000..4f65830f2 Binary files /dev/null and b/resources/03.png differ diff --git a/resources/04.png b/resources/04.png new file mode 100644 index 000000000..e15a53173 Binary files /dev/null and b/resources/04.png differ diff --git a/resources/05.png b/resources/05.png new file mode 100644 index 000000000..374dabe05 Binary files /dev/null and b/resources/05.png differ diff --git a/resources/06.png b/resources/06.png new file mode 100644 index 000000000..ebe27aa10 Binary files /dev/null and b/resources/06.png differ diff --git a/resources/07.png b/resources/07.png new file mode 100644 index 000000000..a64a497f2 Binary files /dev/null and b/resources/07.png differ diff --git a/resources/08.png b/resources/08.png new file mode 100644 index 000000000..f64bcb0e2 Binary files /dev/null and b/resources/08.png differ diff --git a/resources/09.png b/resources/09.png new file mode 100644 index 000000000..aa213d38c Binary files /dev/null and b/resources/09.png differ diff --git a/resources/10.png b/resources/10.png new file mode 100644 index 000000000..72449cde0 Binary files /dev/null and b/resources/10.png differ diff --git a/resources/11.png b/resources/11.png new file mode 100644 index 000000000..e3c324e26 Binary files /dev/null and b/resources/11.png differ diff --git a/resources/12.png b/resources/12.png new file mode 100644 index 000000000..fc03a69b8 Binary files /dev/null and b/resources/12.png differ diff --git a/resources/13.png b/resources/13.png new file mode 100644 index 000000000..afe4a488f Binary files /dev/null and b/resources/13.png differ diff --git a/resources/ver.ver b/resources/ver.ver new file mode 100644 index 000000000..0c89fc927 --- /dev/null +++ b/resources/ver.ver @@ -0,0 +1 @@ +4.0.0 \ No newline at end of file diff --git a/source/aes.c b/source/aes.c new file mode 100644 index 000000000..38ec1324f --- /dev/null +++ b/source/aes.c @@ -0,0 +1,583 @@ +/* + +This is an implementation of the AES128 algorithm, specifically ECB and CBC mode. + +The implementation is verified against the test vectors in: + National Institute of Standards and Technology Special Publication 800-38A 2001 ED + +ECB-AES128 +---------- + + plain-text: + 6bc1bee22e409f96e93d7e117393172a + ae2d8a571e03ac9c9eb76fac45af8e51 + 30c81c46a35ce411e5fbc1191a0a52ef + f69f2445df4f9b17ad2b417be66c3710 + + key: + 2b7e151628aed2a6abf7158809cf4f3c + + resulting cipher + 3ad77bb40d7a3660a89ecaf32466ef97 + f5d3d58503b9699de785895a96fdbaaf + 43b1cd7f598ece23881b00e3ed030688 + 7b0c785e27e8ad3f8223207104725dd4 + + +NOTE: String length must be evenly divisible by 16byte (str_len % 16 == 0) + You should pad the end of the string with zeros if this is not the case. + +*/ + + +/*****************************************************************************/ +/* Includes: */ +/*****************************************************************************/ +#include +#include // CBC mode, for memset +#include "aes.h" + + +/*****************************************************************************/ +/* Defines: */ +/*****************************************************************************/ +// The number of columns comprising a state in AES. This is a constant in AES. Value=4 +#define Nb 4 +// The number of 32 bit words in a key. +#define Nk 4 +// Key length in bytes [128 bit] +#define KEYLEN 16 +// The number of rounds in AES Cipher. +#define Nr 10 + +// jcallan@github points out that declaring Multiply as a function +// reduces code size considerably with the Keil ARM compiler. +// See this link for more information: https://github.com/kokke/tiny-AES128-C/pull/3 +#ifndef MULTIPLY_AS_A_FUNCTION + #define MULTIPLY_AS_A_FUNCTION 0 +#endif + + +/*****************************************************************************/ +/* Private variables: */ +/*****************************************************************************/ +// state - array holding the intermediate results during decryption. +typedef uint8_t state_t[4][4]; +static state_t* state; + +// The array that stores the round keys. +static uint8_t RoundKey[176]; + +// The Key input to the AES Program +static const uint8_t* Key; + +#if defined(CBC) && CBC + // Initial Vector used only for CBC mode + static uint8_t* Iv; +#endif + +// The lookup-tables are marked const so they can be placed in read-only storage instead of RAM +// The numbers below can be computed dynamically trading ROM for RAM - +// This can be useful in (embedded) bootloader applications, where ROM is often limited. +static const uint8_t sbox[256] = { + //0 1 2 3 4 5 6 7 8 9 A B C D E F + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; + +static const uint8_t rsbox[256] = +{ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, + 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, + 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, + 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, + 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, + 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, + 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, + 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, + 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, + 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d }; + + +// The round constant word array, Rcon[i], contains the values given by +// x to th e power (i-1) being powers of x (x is denoted as {02}) in the field GF(2^8) +// Note that i starts at 1, not 0). +static const uint8_t Rcon[255] = { + 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, + 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, + 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, + 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, + 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, + 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, + 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, + 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, + 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, + 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, + 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, + 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, + 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, + 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, + 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, + 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb }; + + +/*****************************************************************************/ +/* Private functions: */ +/*****************************************************************************/ +static uint8_t getSBoxValue(uint8_t num) +{ + return sbox[num]; +} + +static uint8_t getSBoxInvert(uint8_t num) +{ + return rsbox[num]; +} + +// This function produces Nb(Nr+1) round keys. The round keys are used in each round to decrypt the states. +static void KeyExpansion(void) +{ + uint32_t i, j, k; + uint8_t tempa[4]; // Used for the column/row operations + + // The first round key is the key itself. + for(i = 0; i < Nk; ++i) + { + RoundKey[(i * 4) + 0] = Key[(i * 4) + 0]; + RoundKey[(i * 4) + 1] = Key[(i * 4) + 1]; + RoundKey[(i * 4) + 2] = Key[(i * 4) + 2]; + RoundKey[(i * 4) + 3] = Key[(i * 4) + 3]; + } + + // All other round keys are found from the previous round keys. + for(; (i < (Nb * (Nr + 1))); ++i) + { + for(j = 0; j < 4; ++j) + { + tempa[j]=RoundKey[(i-1) * 4 + j]; + } + if (i % Nk == 0) + { + // This function rotates the 4 bytes in a word to the left once. + // [a0,a1,a2,a3] becomes [a1,a2,a3,a0] + + // Function RotWord() + { + k = tempa[0]; + tempa[0] = tempa[1]; + tempa[1] = tempa[2]; + tempa[2] = tempa[3]; + tempa[3] = k; + } + + // SubWord() is a function that takes a four-byte input word and + // applies the S-box to each of the four bytes to produce an output word. + + // Function Subword() + { + tempa[0] = getSBoxValue(tempa[0]); + tempa[1] = getSBoxValue(tempa[1]); + tempa[2] = getSBoxValue(tempa[2]); + tempa[3] = getSBoxValue(tempa[3]); + } + + tempa[0] = tempa[0] ^ Rcon[i/Nk]; + } + else if (Nk > 6 && i % Nk == 4) + { + // Function Subword() + { + tempa[0] = getSBoxValue(tempa[0]); + tempa[1] = getSBoxValue(tempa[1]); + tempa[2] = getSBoxValue(tempa[2]); + tempa[3] = getSBoxValue(tempa[3]); + } + } + RoundKey[i * 4 + 0] = RoundKey[(i - Nk) * 4 + 0] ^ tempa[0]; + RoundKey[i * 4 + 1] = RoundKey[(i - Nk) * 4 + 1] ^ tempa[1]; + RoundKey[i * 4 + 2] = RoundKey[(i - Nk) * 4 + 2] ^ tempa[2]; + RoundKey[i * 4 + 3] = RoundKey[(i - Nk) * 4 + 3] ^ tempa[3]; + } +} + +// This function adds the round key to state. +// The round key is added to the state by an XOR function. +static void AddRoundKey(uint8_t round) +{ + uint8_t i,j; + for(i=0;i<4;++i) + { + for(j = 0; j < 4; ++j) + { + (*state)[i][j] ^= RoundKey[round * Nb * 4 + i * Nb + j]; + } + } +} + +// The SubBytes Function Substitutes the values in the +// state matrix with values in an S-box. +static void SubBytes(void) +{ + uint8_t i, j; + for(i = 0; i < 4; ++i) + { + for(j = 0; j < 4; ++j) + { + (*state)[j][i] = getSBoxValue((*state)[j][i]); + } + } +} + +// The ShiftRows() function shifts the rows in the state to the left. +// Each row is shifted with different offset. +// Offset = Row number. So the first row is not shifted. +static void ShiftRows(void) +{ + uint8_t temp; + + // Rotate first row 1 columns to left + temp = (*state)[0][1]; + (*state)[0][1] = (*state)[1][1]; + (*state)[1][1] = (*state)[2][1]; + (*state)[2][1] = (*state)[3][1]; + (*state)[3][1] = temp; + + // Rotate second row 2 columns to left + temp = (*state)[0][2]; + (*state)[0][2] = (*state)[2][2]; + (*state)[2][2] = temp; + + temp = (*state)[1][2]; + (*state)[1][2] = (*state)[3][2]; + (*state)[3][2] = temp; + + // Rotate third row 3 columns to left + temp = (*state)[0][3]; + (*state)[0][3] = (*state)[3][3]; + (*state)[3][3] = (*state)[2][3]; + (*state)[2][3] = (*state)[1][3]; + (*state)[1][3] = temp; +} + +static uint8_t xtime(uint8_t x) +{ + return ((x<<1) ^ (((x>>7) & 1) * 0x1b)); +} + +// MixColumns function mixes the columns of the state matrix +static void MixColumns(void) +{ + uint8_t i; + uint8_t Tmp,Tm,t; + for(i = 0; i < 4; ++i) + { + t = (*state)[i][0]; + Tmp = (*state)[i][0] ^ (*state)[i][1] ^ (*state)[i][2] ^ (*state)[i][3] ; + Tm = (*state)[i][0] ^ (*state)[i][1] ; Tm = xtime(Tm); (*state)[i][0] ^= Tm ^ Tmp ; + Tm = (*state)[i][1] ^ (*state)[i][2] ; Tm = xtime(Tm); (*state)[i][1] ^= Tm ^ Tmp ; + Tm = (*state)[i][2] ^ (*state)[i][3] ; Tm = xtime(Tm); (*state)[i][2] ^= Tm ^ Tmp ; + Tm = (*state)[i][3] ^ t ; Tm = xtime(Tm); (*state)[i][3] ^= Tm ^ Tmp ; + } +} + +// Multiply is used to multiply numbers in the field GF(2^8) +#if MULTIPLY_AS_A_FUNCTION +static uint8_t Multiply(uint8_t x, uint8_t y) +{ + return (((y & 1) * x) ^ + ((y>>1 & 1) * xtime(x)) ^ + ((y>>2 & 1) * xtime(xtime(x))) ^ + ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ + ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))); + } +#else +#define Multiply(x, y) \ + ( ((y & 1) * x) ^ \ + ((y>>1 & 1) * xtime(x)) ^ \ + ((y>>2 & 1) * xtime(xtime(x))) ^ \ + ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ \ + ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))) \ + +#endif + +// MixColumns function mixes the columns of the state matrix. +// The method used to multiply may be difficult to understand for the inexperienced. +// Please use the references to gain more information. +static void InvMixColumns(void) +{ + int i; + uint8_t a,b,c,d; + for(i=0;i<4;++i) + { + a = (*state)[i][0]; + b = (*state)[i][1]; + c = (*state)[i][2]; + d = (*state)[i][3]; + + (*state)[i][0] = Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0x09); + (*state)[i][1] = Multiply(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d); + (*state)[i][2] = Multiply(a, 0x0d) ^ Multiply(b, 0x09) ^ Multiply(c, 0x0e) ^ Multiply(d, 0x0b); + (*state)[i][3] = Multiply(a, 0x0b) ^ Multiply(b, 0x0d) ^ Multiply(c, 0x09) ^ Multiply(d, 0x0e); + } +} + + +// The SubBytes Function Substitutes the values in the +// state matrix with values in an S-box. +static void InvSubBytes(void) +{ + uint8_t i,j; + for(i=0;i<4;++i) + { + for(j=0;j<4;++j) + { + (*state)[j][i] = getSBoxInvert((*state)[j][i]); + } + } +} + +static void InvShiftRows(void) +{ + uint8_t temp; + + // Rotate first row 1 columns to right + temp=(*state)[3][1]; + (*state)[3][1]=(*state)[2][1]; + (*state)[2][1]=(*state)[1][1]; + (*state)[1][1]=(*state)[0][1]; + (*state)[0][1]=temp; + + // Rotate second row 2 columns to right + temp=(*state)[0][2]; + (*state)[0][2]=(*state)[2][2]; + (*state)[2][2]=temp; + + temp=(*state)[1][2]; + (*state)[1][2]=(*state)[3][2]; + (*state)[3][2]=temp; + + // Rotate third row 3 columns to right + temp=(*state)[0][3]; + (*state)[0][3]=(*state)[1][3]; + (*state)[1][3]=(*state)[2][3]; + (*state)[2][3]=(*state)[3][3]; + (*state)[3][3]=temp; +} + + +// Cipher is the main function that encrypts the PlainText. +static void Cipher(void) +{ + uint8_t round = 0; + + // Add the First round key to the state before starting the rounds. + AddRoundKey(0); + + // There will be Nr rounds. + // The first Nr-1 rounds are identical. + // These Nr-1 rounds are executed in the loop below. + for(round = 1; round < Nr; ++round) + { + SubBytes(); + ShiftRows(); + MixColumns(); + AddRoundKey(round); + } + + // The last round is given below. + // The MixColumns function is not here in the last round. + SubBytes(); + ShiftRows(); + AddRoundKey(Nr); +} + +static void InvCipher(void) +{ + uint8_t round=0; + + // Add the First round key to the state before starting the rounds. + AddRoundKey(Nr); + + // There will be Nr rounds. + // The first Nr-1 rounds are identical. + // These Nr-1 rounds are executed in the loop below. + for(round=Nr-1;round>0;round--) + { + InvShiftRows(); + InvSubBytes(); + AddRoundKey(round); + InvMixColumns(); + } + + // The last round is given below. + // The MixColumns function is not here in the last round. + InvShiftRows(); + InvSubBytes(); + AddRoundKey(0); +} + +static void BlockCopy(uint8_t* output, uint8_t* input) +{ + uint8_t i; + for (i=0;i + + +// #define the macros below to 1/0 to enable/disable the mode of operation. +// +// CBC enables AES128 encryption in CBC-mode of operation and handles 0-padding. +// ECB enables the basic ECB 16-byte block algorithm. Both can be enabled simultaneously. + +// The #ifndef-guard allows it to be configured before #include'ing or at compile time. +#ifndef CBC + #define CBC 1 +#endif + +#ifndef ECB + #define ECB 1 +#endif + + + +#if defined(ECB) && ECB + +void AES128_ECB_encrypt(uint8_t* input, const uint8_t* key, uint8_t *output); +void AES128_ECB_decrypt(uint8_t* input, const uint8_t* key, uint8_t *output); + +#endif // #if defined(ECB) && ECB + + +#if defined(CBC) && CBC + +void AES128_CBC_encrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv); +void AES128_CBC_decrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv); + +#endif // #if defined(CBC) && CBC + + + +#endif //_AES_H_ diff --git a/source/bank.c b/source/bank.c new file mode 100644 index 000000000..63544e04c --- /dev/null +++ b/source/bank.c @@ -0,0 +1,305 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include <3ds.h> +#include +#include "graphic.h" +#include "editor.h" +#include "bank.h" +#include "dex.h" + +void bank(u8* mainbuf, int game) { + FILE *fptr = fopen("/3ds/data/PKSM/bank/bank.bin", "rt"); + fseek(fptr, 0, SEEK_END); + u32 size = ftell(fptr); + + if (size % (30 * PKMNLENGTH)) { + fclose(fptr); + infoDisp("Bank.bin has a bad size!"); + return; + } + u8 *bankbuf = (u8*)malloc(size * sizeof(u8)); + if (bankbuf == NULL) { + fclose(fptr); + free(bankbuf); + return; + } + rewind(fptr); + fread(bankbuf, size, 1, fptr); + fclose(fptr); + + bool isSeen = false; + bool bufferizedfrombank = false; + bool isBufferized = false; + int saveBox = 0, bankBox = 0; + int currentEntry = 30; + int coordinate[2] = {0, 0}; + + u8* pkmn = (u8*)malloc(PKMNLENGTH * sizeof(u8)); + memset(pkmn, 0, PKMNLENGTH); + + while (aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) { + if (isBufferized) { + if (bufferizedfrombank) + memcpy(&bankbuf[coordinate[0] * 30 * PKMNLENGTH + coordinate[1] * PKMNLENGTH], pkmn, PKMNLENGTH); + else + setPkmn(mainbuf, coordinate[0], coordinate[1], pkmn, game); + + memset(pkmn, 0, PKMNLENGTH); + isBufferized = false; + } else + break; + } + + if (hidKeysDown() & KEY_DRIGHT) + if (currentEntry < 59) + currentEntry++; + + if (hidKeysDown() & KEY_DLEFT) + if (currentEntry > 0) + currentEntry--; + + if (hidKeysDown() & KEY_DUP) + if (currentEntry >= 6) + currentEntry -= 6; + + if (hidKeysDown() & KEY_DDOWN) + if (currentEntry <= 53) + currentEntry += 6; + + if (hidKeysDown() & KEY_R) { + if (currentEntry < 30) { + if (bankBox < size / (30 * PKMNLENGTH) - 1) + bankBox++; + else if (bankBox == size / (30 * PKMNLENGTH) - 1) + bankBox = 0; + } else { + if (saveBox < ((game < 4) ? 30 : 31)) + saveBox++; + else if (saveBox == ((game < 4) ? 30 : 31)) + saveBox = 0; + } + } + + if (hidKeysDown() & KEY_L) { + if (currentEntry < 30) { + if (bankBox > 0) + bankBox--; + else if (bankBox == 0) + bankBox = size / (30 * PKMNLENGTH) - 1; + } else { + if (saveBox > 0) + saveBox--; + else if (saveBox == 0) + saveBox = (game < 4) ? 30 : 31; + } + } + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 7 && touch.px < 23 && touch.py > 17 && touch.py < 37) { + if (saveBox > 0) + saveBox--; + else if (saveBox == 0) + saveBox = (game < 4) ? 30 : 31; + } + + if (touch.px > 185 && touch.px < 201 && touch.py > 17 && touch.py < 37) { + if (saveBox < ((game < 4) ? 30 : 31)) + saveBox++; + else if (saveBox == ((game < 4) ? 30 : 31)) + saveBox = 0; + } + + if ((touch.px > 208 && touch.px < 317 && touch.py > 70 && touch.py < 97) && !(isBufferized)) { + if (confirmDisp("Erase the selected box?")) { + u8 tmp[PKMNLENGTH]; + memset(tmp, 0, PKMNLENGTH); + for (u32 i = 0; i < 30; i++) { + if (currentEntry < 30) + memcpy(&bankbuf[bankBox * 30 * PKMNLENGTH + i * PKMNLENGTH], tmp, PKMNLENGTH); + else + setPkmn(mainbuf, saveBox, i, tmp, game); + } + } + } + + if (touch.px > 242 && touch.px < 285 && touch.py > 5 && touch.py < 25) { + u8 buffer[PKMNLENGTH]; + u8 temp[PKMNLENGTH]; + memset(buffer, 0, PKMNLENGTH); + memset(temp, 0, PKMNLENGTH); + + for (u32 i = 0; i < 30; i++) { + getPkmn(mainbuf, saveBox, i, buffer, game); // getpkmn -> buffer + memcpy(temp, &bankbuf[bankBox * 30 * PKMNLENGTH + i * PKMNLENGTH], PKMNLENGTH); // memcpy bank -> temp + setPkmn(mainbuf, saveBox, i, temp, game); // setpkmn -> temp + memcpy(&bankbuf[bankBox * 30 * PKMNLENGTH + i * PKMNLENGTH], buffer, PKMNLENGTH); // memcpy bank -> buffer + } + } + + if ((touch.px > 208 && touch.px < 317 && touch.py > 97 && touch.py < 124) && !(isBufferized)) { + u8 tmp[PKMNLENGTH]; + memset(tmp, 0, PKMNLENGTH); + if (currentEntry < 30) + memcpy(&bankbuf[bankBox * 30 * PKMNLENGTH + currentEntry * PKMNLENGTH], tmp, PKMNLENGTH); + else + setPkmn(mainbuf, saveBox, currentEntry - 30, tmp, game); + } + + if (touch.px > 280 && touch.px < 318 && touch.py > 210 && touch.py < 240) break; + } + + if (hidKeysHeld() & KEY_TOUCH) { + if (touch.px > 4 && touch.px < 38 && touch.py > 45 && touch.py < 75) currentEntry = 30; + if (touch.px > 38 && touch.px < 72 && touch.py > 45 && touch.py < 75) currentEntry = 31; + if (touch.px > 72 && touch.px < 106 && touch.py > 45 && touch.py < 75) currentEntry = 32; + if (touch.px > 106 && touch.px < 140 && touch.py > 45 && touch.py < 75) currentEntry = 33; + if (touch.px > 140 && touch.px < 174 && touch.py > 45 && touch.py < 75) currentEntry = 34; + if (touch.px > 174 && touch.px < 208 && touch.py > 45 && touch.py < 75) currentEntry = 35; + if (touch.px > 4 && touch.px < 38 && touch.py > 75 && touch.py < 105) currentEntry = 36; + if (touch.px > 38 && touch.px < 72 && touch.py > 75 && touch.py < 105) currentEntry = 37; + if (touch.px > 72 && touch.px < 106 && touch.py > 75 && touch.py < 105) currentEntry = 38; + if (touch.px > 106 && touch.px < 140 && touch.py > 75 && touch.py < 105) currentEntry = 39; + if (touch.px > 140 && touch.px < 174 && touch.py > 75 && touch.py < 105) currentEntry = 40; + if (touch.px > 174 && touch.px < 208 && touch.py > 75 && touch.py < 105) currentEntry = 41; + if (touch.px > 4 && touch.px < 38 && touch.py > 105 && touch.py < 135) currentEntry = 42; + if (touch.px > 38 && touch.px < 72 && touch.py > 105 && touch.py < 135) currentEntry = 43; + if (touch.px > 72 && touch.px < 106 && touch.py > 105 && touch.py < 135) currentEntry = 44; + if (touch.px > 106 && touch.px < 140 && touch.py > 105 && touch.py < 135) currentEntry = 45; + if (touch.px > 140 && touch.px < 174 && touch.py > 105 && touch.py < 135) currentEntry = 46; + if (touch.px > 174 && touch.px < 208 && touch.py > 105 && touch.py < 135) currentEntry = 47; + if (touch.px > 4 && touch.px < 38 && touch.py > 135 && touch.py < 165) currentEntry = 48; + if (touch.px > 38 && touch.px < 72 && touch.py > 135 && touch.py < 165) currentEntry = 49; + if (touch.px > 72 && touch.px < 106 && touch.py > 135 && touch.py < 165) currentEntry = 50; + if (touch.px > 106 && touch.px < 140 && touch.py > 135 && touch.py < 165) currentEntry = 51; + if (touch.px > 140 && touch.px < 174 && touch.py > 135 && touch.py < 165) currentEntry = 52; + if (touch.px > 174 && touch.px < 208 && touch.py > 135 && touch.py < 165) currentEntry = 53; + if (touch.px > 4 && touch.px < 38 && touch.py > 165 && touch.py < 195) currentEntry = 54; + if (touch.px > 38 && touch.px < 72 && touch.py > 165 && touch.py < 195) currentEntry = 55; + if (touch.px > 72 && touch.px < 106 && touch.py > 165 && touch.py < 195) currentEntry = 56; + if (touch.px > 106 && touch.px < 140 && touch.py > 165 && touch.py < 195) currentEntry = 57; + if (touch.px > 140 && touch.px < 174 && touch.py > 165 && touch.py < 195) currentEntry = 58; + if (touch.px > 174 && touch.px < 208 && touch.py > 165 && touch.py < 195) currentEntry = 59; + } + + if (((hidKeysDown() & KEY_Y) || (hidKeysDown() & KEY_TOUCH && touch.px > 208 && touch.px < 317 && touch.py > 43 && touch.py < 74)) && !isBufferized) { + isSeen = true; + u8 tmp[PKMNLENGTH]; + memset(tmp, 0, PKMNLENGTH); + + if (currentEntry < 30) + memcpy(tmp, &bankbuf[bankBox * 30 * PKMNLENGTH + currentEntry * PKMNLENGTH], PKMNLENGTH); + else + getPkmn(mainbuf, saveBox, currentEntry - 30, tmp, game); + + while (aptMainLoop() && getPokedexNumber(tmp)) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if ((hidKeysDown() & KEY_B) || (hidKeysDown() & KEY_TOUCH && touch.px > 280 && touch.px < 318 && touch.py > 210 && touch.py < 240)) + break; + + printPKBank(bankbuf, mainbuf, tmp, game, currentEntry, saveBox, bankBox, isBufferized, isSeen); + } + + isSeen = false; + } + + if (hidKeysDown() & KEY_A) { + if (isBufferized) { + if (!(game < 4 && getPokedexNumber(pkmn) > 721 && currentEntry > 29)) { // prevent that gen7 stuff goes into gen6 save + u8 tmp[PKMNLENGTH]; + + if ((bufferizedfrombank == (currentEntry < 30)) && (coordinate[0] == ((currentEntry < 30) ? bankBox : saveBox)) && (coordinate[1] == currentEntry)) + memcpy(&bankbuf[bankBox * 30 * PKMNLENGTH + currentEntry * PKMNLENGTH], pkmn, PKMNLENGTH); + else if ((!bufferizedfrombank == (currentEntry > 29)) && (coordinate[0] == ((currentEntry < 30) ? bankBox : saveBox)) && (coordinate[1] == currentEntry - 30)) + setPkmn(mainbuf, saveBox, currentEntry - 30, pkmn, game); + else if (currentEntry < 30) { + memcpy(tmp, &bankbuf[bankBox * 30 * PKMNLENGTH + currentEntry * PKMNLENGTH], PKMNLENGTH); + memcpy(&bankbuf[bankBox * 30 * PKMNLENGTH + currentEntry * PKMNLENGTH], pkmn, PKMNLENGTH); + if (bufferizedfrombank) + memcpy(&bankbuf[coordinate[0] * 30 * PKMNLENGTH + coordinate[1] * PKMNLENGTH], tmp, PKMNLENGTH); + else + setPkmn(mainbuf, coordinate[0], coordinate[1], tmp, game); + } + else { + getPkmn(mainbuf, saveBox, currentEntry - 30, tmp, game); + setPkmn(mainbuf, saveBox, currentEntry - 30, pkmn, game); + if (bufferizedfrombank) + memcpy(&bankbuf[coordinate[0] * 30 * PKMNLENGTH + coordinate[1] * PKMNLENGTH], tmp, PKMNLENGTH); + else + setPkmn(mainbuf, coordinate[0], coordinate[1], tmp, game); + } + memset(pkmn, 0, PKMNLENGTH); + isBufferized = false; + } + } + else { + u8 tmp[PKMNLENGTH]; + memset(tmp, 0, PKMNLENGTH); + + coordinate[0] = (currentEntry < 30) ? bankBox : saveBox; + coordinate[1] = (currentEntry > 29) ? (currentEntry - 30) : currentEntry; + + if (currentEntry < 30) { + memcpy(pkmn, &bankbuf[bankBox * 30 * PKMNLENGTH + currentEntry * PKMNLENGTH], PKMNLENGTH); + memcpy(&bankbuf[bankBox * 30 * PKMNLENGTH + currentEntry * PKMNLENGTH], tmp, PKMNLENGTH); + } else { + getPkmn(mainbuf, saveBox, currentEntry - 30, pkmn, game); + setPkmn(mainbuf, saveBox, currentEntry - 30, tmp, game); + } + + isBufferized = true; + bufferizedfrombank = (currentEntry < 30) ? true : false; + } + } + printPKBank(bankbuf, mainbuf, pkmn, game, currentEntry, saveBox, bankBox, isBufferized, isSeen); + } + + if (confirmDisp("Save bank.bin changes?")) { + FILE *new = fopen("/3ds/data/PKSM/bank/bank.bin", "wb"); + fwrite(bankbuf, 1, size, new); + fclose(new); + } + free(bankbuf); + + if (game == GAME_SUN || game == GAME_MOON) { + if (confirmDisp("Save PokeDex flags?")) { + int end = (game < 4) ? 31 : 32; + char* step = (char*)malloc(20); + + for (u32 i = 0; i < end; i++) { + for (u32 j = 0; j < 30; j++) { + snprintf(step, 20, "Box %lu / Slot %lu", i + 1, j + 1); + freezeMsg(step); + getPkmn(mainbuf, i, j, pkmn, game); + setDex(mainbuf, pkmn, game); + } + } + free(step); + } + } + free(pkmn); +} \ No newline at end of file diff --git a/source/bank.h b/source/bank.h new file mode 100644 index 000000000..ff357d920 --- /dev/null +++ b/source/bank.h @@ -0,0 +1,25 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#pragma once +#include <3ds.h> + +#define BANKBOXMAX 150 + +void bank(u8* mainbuf, int game); \ No newline at end of file diff --git a/source/certs/cybertrust.h b/source/certs/cybertrust.h new file mode 100644 index 000000000..1df955e71 --- /dev/null +++ b/source/certs/cybertrust.h @@ -0,0 +1,78 @@ +unsigned char cybertrust_cer[] = { + 0x30, 0x82, 0x03, 0x77, 0x30, 0x82, 0x02, 0x5f, 0xa0, 0x03, 0x02, 0x01, + 0x02, 0x02, 0x04, 0x02, 0x00, 0x00, 0xb9, 0x30, 0x0d, 0x06, 0x09, 0x2a, + 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x5a, + 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x49, + 0x45, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x09, + 0x42, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x6f, 0x72, 0x65, 0x31, 0x13, 0x30, + 0x11, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0a, 0x43, 0x79, 0x62, 0x65, + 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x31, 0x22, 0x30, 0x20, 0x06, 0x03, + 0x55, 0x04, 0x03, 0x13, 0x19, 0x42, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x6f, + 0x72, 0x65, 0x20, 0x43, 0x79, 0x62, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, + 0x74, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x30, 0x30, + 0x30, 0x35, 0x31, 0x32, 0x31, 0x38, 0x34, 0x36, 0x30, 0x30, 0x5a, 0x17, + 0x0d, 0x32, 0x35, 0x30, 0x35, 0x31, 0x32, 0x32, 0x33, 0x35, 0x39, 0x30, + 0x30, 0x5a, 0x30, 0x5a, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, + 0x06, 0x13, 0x02, 0x49, 0x45, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, + 0x04, 0x0a, 0x13, 0x09, 0x42, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x6f, 0x72, + 0x65, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0a, + 0x43, 0x79, 0x62, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x31, 0x22, + 0x30, 0x20, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x19, 0x42, 0x61, 0x6c, + 0x74, 0x69, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x43, 0x79, 0x62, 0x65, 0x72, + 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x30, 0x82, + 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, + 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, + 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xa3, 0x04, 0xbb, 0x22, 0xab, + 0x98, 0x3d, 0x57, 0xe8, 0x26, 0x72, 0x9a, 0xb5, 0x79, 0xd4, 0x29, 0xe2, + 0xe1, 0xe8, 0x95, 0x80, 0xb1, 0xb0, 0xe3, 0x5b, 0x8e, 0x2b, 0x29, 0x9a, + 0x64, 0xdf, 0xa1, 0x5d, 0xed, 0xb0, 0x09, 0x05, 0x6d, 0xdb, 0x28, 0x2e, + 0xce, 0x62, 0xa2, 0x62, 0xfe, 0xb4, 0x88, 0xda, 0x12, 0xeb, 0x38, 0xeb, + 0x21, 0x9d, 0xc0, 0x41, 0x2b, 0x01, 0x52, 0x7b, 0x88, 0x77, 0xd3, 0x1c, + 0x8f, 0xc7, 0xba, 0xb9, 0x88, 0xb5, 0x6a, 0x09, 0xe7, 0x73, 0xe8, 0x11, + 0x40, 0xa7, 0xd1, 0xcc, 0xca, 0x62, 0x8d, 0x2d, 0xe5, 0x8f, 0x0b, 0xa6, + 0x50, 0xd2, 0xa8, 0x50, 0xc3, 0x28, 0xea, 0xf5, 0xab, 0x25, 0x87, 0x8a, + 0x9a, 0x96, 0x1c, 0xa9, 0x67, 0xb8, 0x3f, 0x0c, 0xd5, 0xf7, 0xf9, 0x52, + 0x13, 0x2f, 0xc2, 0x1b, 0xd5, 0x70, 0x70, 0xf0, 0x8f, 0xc0, 0x12, 0xca, + 0x06, 0xcb, 0x9a, 0xe1, 0xd9, 0xca, 0x33, 0x7a, 0x77, 0xd6, 0xf8, 0xec, + 0xb9, 0xf1, 0x68, 0x44, 0x42, 0x48, 0x13, 0xd2, 0xc0, 0xc2, 0xa4, 0xae, + 0x5e, 0x60, 0xfe, 0xb6, 0xa6, 0x05, 0xfc, 0xb4, 0xdd, 0x07, 0x59, 0x02, + 0xd4, 0x59, 0x18, 0x98, 0x63, 0xf5, 0xa5, 0x63, 0xe0, 0x90, 0x0c, 0x7d, + 0x5d, 0xb2, 0x06, 0x7a, 0xf3, 0x85, 0xea, 0xeb, 0xd4, 0x03, 0xae, 0x5e, + 0x84, 0x3e, 0x5f, 0xff, 0x15, 0xed, 0x69, 0xbc, 0xf9, 0x39, 0x36, 0x72, + 0x75, 0xcf, 0x77, 0x52, 0x4d, 0xf3, 0xc9, 0x90, 0x2c, 0xb9, 0x3d, 0xe5, + 0xc9, 0x23, 0x53, 0x3f, 0x1f, 0x24, 0x98, 0x21, 0x5c, 0x07, 0x99, 0x29, + 0xbd, 0xc6, 0x3a, 0xec, 0xe7, 0x6e, 0x86, 0x3a, 0x6b, 0x97, 0x74, 0x63, + 0x33, 0xbd, 0x68, 0x18, 0x31, 0xf0, 0x78, 0x8d, 0x76, 0xbf, 0xfc, 0x9e, + 0x8e, 0x5d, 0x2a, 0x86, 0xa7, 0x4d, 0x90, 0xdc, 0x27, 0x1a, 0x39, 0x02, + 0x03, 0x01, 0x00, 0x01, 0xa3, 0x45, 0x30, 0x43, 0x30, 0x1d, 0x06, 0x03, + 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xe5, 0x9d, 0x59, 0x30, 0x82, + 0x47, 0x58, 0xcc, 0xac, 0xfa, 0x08, 0x54, 0x36, 0x86, 0x7b, 0x3a, 0xb5, + 0x04, 0x4d, 0xf0, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, + 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x03, 0x30, + 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, + 0x02, 0x01, 0x06, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, + 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x85, + 0x0c, 0x5d, 0x8e, 0xe4, 0x6f, 0x51, 0x68, 0x42, 0x05, 0xa0, 0xdd, 0xbb, + 0x4f, 0x27, 0x25, 0x84, 0x03, 0xbd, 0xf7, 0x64, 0xfd, 0x2d, 0xd7, 0x30, + 0xe3, 0xa4, 0x10, 0x17, 0xeb, 0xda, 0x29, 0x29, 0xb6, 0x79, 0x3f, 0x76, + 0xf6, 0x19, 0x13, 0x23, 0xb8, 0x10, 0x0a, 0xf9, 0x58, 0xa4, 0xd4, 0x61, + 0x70, 0xbd, 0x04, 0x61, 0x6a, 0x12, 0x8a, 0x17, 0xd5, 0x0a, 0xbd, 0xc5, + 0xbc, 0x30, 0x7c, 0xd6, 0xe9, 0x0c, 0x25, 0x8d, 0x86, 0x40, 0x4f, 0xec, + 0xcc, 0xa3, 0x7e, 0x38, 0xc6, 0x37, 0x11, 0x4f, 0xed, 0xdd, 0x68, 0x31, + 0x8e, 0x4c, 0xd2, 0xb3, 0x01, 0x74, 0xee, 0xbe, 0x75, 0x5e, 0x07, 0x48, + 0x1a, 0x7f, 0x70, 0xff, 0x16, 0x5c, 0x84, 0xc0, 0x79, 0x85, 0xb8, 0x05, + 0xfd, 0x7f, 0xbe, 0x65, 0x11, 0xa3, 0x0f, 0xc0, 0x02, 0xb4, 0xf8, 0x52, + 0x37, 0x39, 0x04, 0xd5, 0xa9, 0x31, 0x7a, 0x18, 0xbf, 0xa0, 0x2a, 0xf4, + 0x12, 0x99, 0xf7, 0xa3, 0x45, 0x82, 0xe3, 0x3c, 0x5e, 0xf5, 0x9d, 0x9e, + 0xb5, 0xc8, 0x9e, 0x7c, 0x2e, 0xc8, 0xa4, 0x9e, 0x4e, 0x08, 0x14, 0x4b, + 0x6d, 0xfd, 0x70, 0x6d, 0x6b, 0x1a, 0x63, 0xbd, 0x64, 0xe6, 0x1f, 0xb7, + 0xce, 0xf0, 0xf2, 0x9f, 0x2e, 0xbb, 0x1b, 0xb7, 0xf2, 0x50, 0x88, 0x73, + 0x92, 0xc2, 0xe2, 0xe3, 0x16, 0x8d, 0x9a, 0x32, 0x02, 0xab, 0x8e, 0x18, + 0xdd, 0xe9, 0x10, 0x11, 0xee, 0x7e, 0x35, 0xab, 0x90, 0xaf, 0x3e, 0x30, + 0x94, 0x7a, 0xd0, 0x33, 0x3d, 0xa7, 0x65, 0x0f, 0xf5, 0xfc, 0x8e, 0x9e, + 0x62, 0xcf, 0x47, 0x44, 0x2c, 0x01, 0x5d, 0xbb, 0x1d, 0xb5, 0x32, 0xd2, + 0x47, 0xd2, 0x38, 0x2e, 0xd0, 0xfe, 0x81, 0xdc, 0x32, 0x6a, 0x1e, 0xb5, + 0xee, 0x3c, 0xd5, 0xfc, 0xe7, 0x81, 0x1d, 0x19, 0xc3, 0x24, 0x42, 0xea, + 0x63, 0x39, 0xa9 +}; +unsigned int cybertrust_cer_len = 891; diff --git a/source/certs/digicert.h b/source/certs/digicert.h new file mode 100644 index 000000000..cbdad944e --- /dev/null +++ b/source/certs/digicert.h @@ -0,0 +1,84 @@ +unsigned char digicert_cer[] = { + 0x30, 0x82, 0x03, 0xc5, 0x30, 0x82, 0x02, 0xad, 0xa0, 0x03, 0x02, 0x01, + 0x02, 0x02, 0x10, 0x02, 0xac, 0x5c, 0x26, 0x6a, 0x0b, 0x40, 0x9b, 0x8f, + 0x0b, 0x79, 0xf2, 0xae, 0x46, 0x25, 0x77, 0x30, 0x0d, 0x06, 0x09, 0x2a, + 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x6c, + 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, + 0x53, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0c, + 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x49, 0x6e, 0x63, + 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x10, 0x77, + 0x77, 0x77, 0x2e, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72, 0x74, 0x2e, + 0x63, 0x6f, 0x6d, 0x31, 0x2b, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x13, 0x22, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x48, + 0x69, 0x67, 0x68, 0x20, 0x41, 0x73, 0x73, 0x75, 0x72, 0x61, 0x6e, 0x63, + 0x65, 0x20, 0x45, 0x56, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, + 0x30, 0x1e, 0x17, 0x0d, 0x30, 0x36, 0x31, 0x31, 0x31, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x33, 0x31, 0x31, 0x31, 0x31, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x6c, 0x31, 0x0b, + 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0c, 0x44, 0x69, + 0x67, 0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x49, 0x6e, 0x63, 0x31, 0x19, + 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x10, 0x77, 0x77, 0x77, + 0x2e, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72, 0x74, 0x2e, 0x63, 0x6f, + 0x6d, 0x31, 0x2b, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x22, + 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x48, 0x69, 0x67, + 0x68, 0x20, 0x41, 0x73, 0x73, 0x75, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x20, + 0x45, 0x56, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x30, 0x82, + 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, + 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, + 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc6, 0xcc, 0xe5, 0x73, 0xe6, + 0xfb, 0xd4, 0xbb, 0xe5, 0x2d, 0x2d, 0x32, 0xa6, 0xdf, 0xe5, 0x81, 0x3f, + 0xc9, 0xcd, 0x25, 0x49, 0xb6, 0x71, 0x2a, 0xc3, 0xd5, 0x94, 0x34, 0x67, + 0xa2, 0x0a, 0x1c, 0xb0, 0x5f, 0x69, 0xa6, 0x40, 0xb1, 0xc4, 0xb7, 0xb2, + 0x8f, 0xd0, 0x98, 0xa4, 0xa9, 0x41, 0x59, 0x3a, 0xd3, 0xdc, 0x94, 0xd6, + 0x3c, 0xdb, 0x74, 0x38, 0xa4, 0x4a, 0xcc, 0x4d, 0x25, 0x82, 0xf7, 0x4a, + 0xa5, 0x53, 0x12, 0x38, 0xee, 0xf3, 0x49, 0x6d, 0x71, 0x91, 0x7e, 0x63, + 0xb6, 0xab, 0xa6, 0x5f, 0xc3, 0xa4, 0x84, 0xf8, 0x4f, 0x62, 0x51, 0xbe, + 0xf8, 0xc5, 0xec, 0xdb, 0x38, 0x92, 0xe3, 0x06, 0xe5, 0x08, 0x91, 0x0c, + 0xc4, 0x28, 0x41, 0x55, 0xfb, 0xcb, 0x5a, 0x89, 0x15, 0x7e, 0x71, 0xe8, + 0x35, 0xbf, 0x4d, 0x72, 0x09, 0x3d, 0xbe, 0x3a, 0x38, 0x50, 0x5b, 0x77, + 0x31, 0x1b, 0x8d, 0xb3, 0xc7, 0x24, 0x45, 0x9a, 0xa7, 0xac, 0x6d, 0x00, + 0x14, 0x5a, 0x04, 0xb7, 0xba, 0x13, 0xeb, 0x51, 0x0a, 0x98, 0x41, 0x41, + 0x22, 0x4e, 0x65, 0x61, 0x87, 0x81, 0x41, 0x50, 0xa6, 0x79, 0x5c, 0x89, + 0xde, 0x19, 0x4a, 0x57, 0xd5, 0x2e, 0xe6, 0x5d, 0x1c, 0x53, 0x2c, 0x7e, + 0x98, 0xcd, 0x1a, 0x06, 0x16, 0xa4, 0x68, 0x73, 0xd0, 0x34, 0x04, 0x13, + 0x5c, 0xa1, 0x71, 0xd3, 0x5a, 0x7c, 0x55, 0xdb, 0x5e, 0x64, 0xe1, 0x37, + 0x87, 0x30, 0x56, 0x04, 0xe5, 0x11, 0xb4, 0x29, 0x80, 0x12, 0xf1, 0x79, + 0x39, 0x88, 0xa2, 0x02, 0x11, 0x7c, 0x27, 0x66, 0xb7, 0x88, 0xb7, 0x78, + 0xf2, 0xca, 0x0a, 0xa8, 0x38, 0xab, 0x0a, 0x64, 0xc2, 0xbf, 0x66, 0x5d, + 0x95, 0x84, 0xc1, 0xa1, 0x25, 0x1e, 0x87, 0x5d, 0x1a, 0x50, 0x0b, 0x20, + 0x12, 0xcc, 0x41, 0xbb, 0x6e, 0x0b, 0x51, 0x38, 0xb8, 0x4b, 0xcb, 0x02, + 0x03, 0x01, 0x00, 0x01, 0xa3, 0x63, 0x30, 0x61, 0x30, 0x0e, 0x06, 0x03, + 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, + 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, + 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, + 0x04, 0x16, 0x04, 0x14, 0xb1, 0x3e, 0xc3, 0x69, 0x03, 0xf8, 0xbf, 0x47, + 0x01, 0xd4, 0x98, 0x26, 0x1a, 0x08, 0x02, 0xef, 0x63, 0x64, 0x2b, 0xc3, + 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, + 0x14, 0xb1, 0x3e, 0xc3, 0x69, 0x03, 0xf8, 0xbf, 0x47, 0x01, 0xd4, 0x98, + 0x26, 0x1a, 0x08, 0x02, 0xef, 0x63, 0x64, 0x2b, 0xc3, 0x30, 0x0d, 0x06, + 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, + 0x03, 0x82, 0x01, 0x01, 0x00, 0x1c, 0x1a, 0x06, 0x97, 0xdc, 0xd7, 0x9c, + 0x9f, 0x3c, 0x88, 0x66, 0x06, 0x08, 0x57, 0x21, 0xdb, 0x21, 0x47, 0xf8, + 0x2a, 0x67, 0xaa, 0xbf, 0x18, 0x32, 0x76, 0x40, 0x10, 0x57, 0xc1, 0x8a, + 0xf3, 0x7a, 0xd9, 0x11, 0x65, 0x8e, 0x35, 0xfa, 0x9e, 0xfc, 0x45, 0xb5, + 0x9e, 0xd9, 0x4c, 0x31, 0x4b, 0xb8, 0x91, 0xe8, 0x43, 0x2c, 0x8e, 0xb3, + 0x78, 0xce, 0xdb, 0xe3, 0x53, 0x79, 0x71, 0xd6, 0xe5, 0x21, 0x94, 0x01, + 0xda, 0x55, 0x87, 0x9a, 0x24, 0x64, 0xf6, 0x8a, 0x66, 0xcc, 0xde, 0x9c, + 0x37, 0xcd, 0xa8, 0x34, 0xb1, 0x69, 0x9b, 0x23, 0xc8, 0x9e, 0x78, 0x22, + 0x2b, 0x70, 0x43, 0xe3, 0x55, 0x47, 0x31, 0x61, 0x19, 0xef, 0x58, 0xc5, + 0x85, 0x2f, 0x4e, 0x30, 0xf6, 0xa0, 0x31, 0x16, 0x23, 0xc8, 0xe7, 0xe2, + 0x65, 0x16, 0x33, 0xcb, 0xbf, 0x1a, 0x1b, 0xa0, 0x3d, 0xf8, 0xca, 0x5e, + 0x8b, 0x31, 0x8b, 0x60, 0x08, 0x89, 0x2d, 0x0c, 0x06, 0x5c, 0x52, 0xb7, + 0xc4, 0xf9, 0x0a, 0x98, 0xd1, 0x15, 0x5f, 0x9f, 0x12, 0xbe, 0x7c, 0x36, + 0x63, 0x38, 0xbd, 0x44, 0xa4, 0x7f, 0xe4, 0x26, 0x2b, 0x0a, 0xc4, 0x97, + 0x69, 0x0d, 0xe9, 0x8c, 0xe2, 0xc0, 0x10, 0x57, 0xb8, 0xc8, 0x76, 0x12, + 0x91, 0x55, 0xf2, 0x48, 0x69, 0xd8, 0xbc, 0x2a, 0x02, 0x5b, 0x0f, 0x44, + 0xd4, 0x20, 0x31, 0xdb, 0xf4, 0xba, 0x70, 0x26, 0x5d, 0x90, 0x60, 0x9e, + 0xbc, 0x4b, 0x17, 0x09, 0x2f, 0xb4, 0xcb, 0x1e, 0x43, 0x68, 0xc9, 0x07, + 0x27, 0xc1, 0xd2, 0x5c, 0xf7, 0xea, 0x21, 0xb9, 0x68, 0x12, 0x9c, 0x3c, + 0x9c, 0xbf, 0x9e, 0xfc, 0x80, 0x5c, 0x9b, 0x63, 0xcd, 0xec, 0x47, 0xaa, + 0x25, 0x27, 0x67, 0xa0, 0x37, 0xf3, 0x00, 0x82, 0x7d, 0x54, 0xd7, 0xa9, + 0xf8, 0xe9, 0x2e, 0x13, 0xa3, 0x77, 0xe8, 0x1f, 0x4a +}; +unsigned int digicert_cer_len = 969; diff --git a/source/database.c b/source/database.c new file mode 100644 index 000000000..8fc1bb766 --- /dev/null +++ b/source/database.c @@ -0,0 +1,1527 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include +#include +#include <3ds.h> +#include "graphic.h" +#include "database.h" +#include "editor.h" +#include "util.h" +#include "fill.h" +#include "dex.h" + +void findFreeLocationWC(u8 *mainbuf, int game, int nInjected[]) { + nInjected[0] = 0; + int len = (game < 4) ? 24 : 48; + int temp; + int offset = 0; + if (game == GAME_X || game == GAME_Y) + offset = 0x1BD00; + else if (game == GAME_OR || game == GAME_AS) + offset = 0x1CD00; + else if (game == GAME_SUN || game == GAME_MOON) + offset = 0x65C00 + 0x100; + + for (int t = 0; t < len; t++) { + temp = 0; + for (int j = 0; j < WC6LENGTH; j++) + if (*(mainbuf + offset + t * WC6LENGTH + j) == 0x00) + temp++; + + if (temp == WC6LENGTH) { + nInjected[0] = t; + break; + } + } +} + +int getN(int i) { + switch (i) { + case 1 : return 10; + case 48 : return 4; + case 71 : return 5; + case 81 : return 11; + case 82 : return 6; + case 108 : return 2; + case 136 : return 4; + case 205 : return 2; + case 504 : return 2; + case 515 : return 2; + case 551 : return 2; + case 552 : return 2; + case 2016 : return 3; + } + return 0; +} + +void setBoxBin(u8* mainbuf, int game, int NBOXES, int N, char* path[]) { + for (int i = 0; i < NBOXES; i++) { + FILE *fptr = fopen(path[i], "rt"); + if (fptr == NULL) + return; + fseek(fptr, 0, SEEK_END); + u32 contentsize = ftell(fptr); + u8 *buf = (u8*)malloc(contentsize); + if (buf == NULL) + return; + rewind(fptr); + fread(buf, contentsize, 1, fptr); + fclose(fptr); + + int boxpos = 0; + if (game == GAME_X || game == GAME_Y) + boxpos = 0x27A00 - 0x5400; + + if (game == GAME_OR || game == GAME_AS) + boxpos = 0x38400 - 0x5400; + + if (game == GAME_SUN || game == GAME_MOON) + boxpos = 0x04E00; + + memcpy((void*)(mainbuf + boxpos + PKMNLENGTH * 30 * i), (const void*)buf, PKMNLENGTH * N); + + free(buf); + } +} + +int checkMultipleWC7(u8* mainbuf, int game, int i, int langCont, int nInjected[], int adapt) { + int n = getN(i); + if (n == 0) + return 0; + + for (int j = 0; j < n; j++) { + char *wc7path = (char*)malloc(40 * sizeof(char)); + switch (langCont) { + case 0 : { + snprintf(wc7path, 40, "romfs:/wc7/jpn/%d-%d.wc7", i, j + 1); + break; + } + case 1 : { + snprintf(wc7path, 40, "romfs:/wc7/eng/%d-%d.wc7", i, j + 1); + break; + } + case 2 : { + snprintf(wc7path, 40, "romfs:/wc7/fre/%d-%d.wc7", i, j + 1); + break; + } + case 3 : { + snprintf(wc7path, 40, "romfs:/wc7/ita/%d-%d.wc7", i, j + 1); + break; + } + case 4 : { + snprintf(wc7path, 40, "romfs:/wc7/ger/%d-%d.wc7", i, j + 1); + break; + } + case 5 : { + snprintf(wc7path, 40, "romfs:/wc7/spa/%d-%d.wc7", i, j + 1); + break; + } + case 6 : { + snprintf(wc7path, 40, "romfs:/wc7/kor/%d-%d.wc7", i, j + 1); + break; + } + case 7 : { + snprintf(wc7path, 40, "romfs:/wc7/chs/%d-%d.wc7", i, j + 1); + break; + } + case 8 : { + snprintf(wc7path, 40, "romfs:/wc7/cht/%d-%d.wc7", i, j + 1); + break; + } + } + + FILE *fptr = fopen(wc7path, "rt"); + if (fptr == NULL) { + fclose(fptr); + free(wc7path); + return 15; + } + fseek(fptr, 0, SEEK_END); + u32 contentsize = ftell(fptr); + u8 *wc7buf = (u8*)malloc(contentsize); + if (wc7buf == NULL) { + fclose(fptr); + free(wc7buf); + free(wc7path); + return 8; + } + rewind(fptr); + fread(wc7buf, contentsize, 1, fptr); + fclose(fptr); + + if (adapt) + setLanguage(mainbuf, game, langCont); + + setWC(mainbuf, wc7buf, game, i, nInjected); + + free(wc7path); + free(wc7buf); + } + return 1; +} + +int checkMultipleWC6(u8* mainbuf, int game, int i, int langCont, int nInjected[], int adapt) { + int n = getN(i); + if (n == 0) + return 0; + + for (int j = 0; j < n; j++) { + char *wc6path = (char*)malloc(40 * sizeof(char)); + switch (langCont) { + case 0 : { + snprintf(wc6path, 40, "romfs:/wc6/jpn/%d-%d.wc6", i, j + 1); + break; + } + case 1 : { + snprintf(wc6path, 40, "romfs:/wc6/eng/%d-%d.wc6", i, j + 1); + break; + } + case 2 : { + snprintf(wc6path, 40, "romfs:/wc6/fre/%d-%d.wc6", i, j + 1); + break; + } + case 3 : { + snprintf(wc6path, 40, "romfs:/wc6/ita/%d-%d.wc6", i, j + 1); + break; + } + case 4 : { + snprintf(wc6path, 40, "romfs:/wc6/ger/%d-%d.wc6", i, j + 1); + break; + } + case 5 : { + snprintf(wc6path, 40, "romfs:/wc6/spa/%d-%d.wc6", i, j + 1); + break; + } + case 6 : { + snprintf(wc6path, 40, "romfs:/wc6/kor/%d-%d.wc6", i, j + 1); + break; + } + } + + FILE *fptr = fopen(wc6path, "rt"); + if (fptr == NULL) { + fclose(fptr); + free(wc6path); + return 15; + } + fseek(fptr, 0, SEEK_END); + u32 contentsize = ftell(fptr); + u8 *wc6buf = (u8*)malloc(contentsize); + if (wc6buf == NULL) { + fclose(fptr); + free(wc6buf); + free(wc6path); + return 8; + } + rewind(fptr); + fread(wc6buf, contentsize, 1, fptr); + fclose(fptr); + + if (adapt) + setLanguage(mainbuf, game, langCont); + + setWC(mainbuf, wc6buf, game, i, nInjected); + + free(wc6path); + free(wc6buf); + } + return 1; +} + +void eventDatabase7(u8* mainbuf, int game) { + char *database[SMCOUNT]; + int *spriteArray = (int*)malloc(SMCOUNT * sizeof(int)); + filldatabase7(database, spriteArray); + + int currentEntry = 0; + int page = 0; + + bool adapt = false; + bool langVett[9]; + bool overwrite = false; + int nInjected[1] = {0}; + int langSelected = -1; + + findFreeLocationWC(mainbuf, game, nInjected); + + while(aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + if ((hidKeysDown() & KEY_TOUCH) && touch.px > 298 && touch.px < 320 && touch.py > 207 && touch.py < 225) break; + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_L) { + if (page > 0) { + int temp; + do { + page--; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page--; + } while (temp == 10); + } + else if (page == 0) page = SMCOUNT / 10 - 1; + } + + if (hidKeysDown() & KEY_R) { + if (page < SMCOUNT / 10 - 1) { + int temp; + do { + page++; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page++; + } while (temp == 10); + } + else if (page == SMCOUNT / 10 - 1) page = 0; + } + + if (hidKeysDown() & KEY_DUP) { + if (currentEntry > 0) currentEntry--; + else if (currentEntry == 0) currentEntry = 9; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (currentEntry < 9) currentEntry++; + else if (currentEntry == 9) currentEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (currentEntry <= 4) { + int temp; + do { + page--; + if (page < 0) page = SMCOUNT / 10 - 1; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page--; + } while (temp == 10); + } + else if (currentEntry >= 5) currentEntry -= 5; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (currentEntry <= 4) currentEntry += 5; + else if (currentEntry >= 5) { + int temp; + do { + page++; + if (page > SMCOUNT / 10 - 1) page = 0; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page++; + } while (temp == 10); + } + } + + if (hidKeysDown() & KEY_A && spriteArray[page*10+currentEntry] != -1) { + int i = page * 10 + currentEntry; + // check for single wc7 events + char *testpath = (char*)malloc(40 * sizeof(char)); + for (int j = 0; j < 9; j++) { + switch (j) { + case 0 : { + snprintf(testpath, 40, "romfs:/wc7/jpn/%d.wc7", i); + break; + } + case 1 : { + snprintf(testpath, 40, "romfs:/wc7/eng/%d.wc7", i); + break; + } + case 2 : { + snprintf(testpath, 40, "romfs:/wc7/fre/%d.wc7", i); + break; + } + case 3 : { + snprintf(testpath, 40, "romfs:/wc7/ita/%d.wc7", i); + break; + } + case 4 : { + snprintf(testpath, 40, "romfs:/wc7/ger/%d.wc7", i); + break; + } + case 5 : { + snprintf(testpath, 40, "romfs:/wc7/spa/%d.wc7", i); + break; + } + case 6 : { + snprintf(testpath, 40, "romfs:/wc7/kor/%d.wc7", i); + break; + } + case 7 : { + snprintf(testpath, 40, "romfs:/wc7/chs/%d.wc7", i); + break; + } + case 8 : { + snprintf(testpath, 40, "romfs:/wc7/cht/%d.wc7", i); + break; + } + } + FILE* f = fopen(testpath, "r"); + if (f) { langVett[j] = true; fclose(f); } + else { langVett[j] = false; fclose(f); } + } + + //check for multiple wc7 events + int k, n = getN(i); + if (n != 0) { + for (int j = 0; j < 9; j++) { + k = 0; + for (int t = 0; t < n; t++) { + switch (j) { + case 0 : { + snprintf(testpath, 40, "romfs:/wc7/jpn/%d-%d.wc7", i, t + 1); + break; + } + case 1 : { + snprintf(testpath, 40, "romfs:/wc7/eng/%d-%d.wc7", i, t + 1); + break; + } + case 2 : { + snprintf(testpath, 40, "romfs:/wc7/fre/%d-%d.wc7", i, t + 1); + break; + } + case 3 : { + snprintf(testpath, 40, "romfs:/wc7/ita/%d-%d.wc7", i, t + 1); + break; + } + case 4 : { + snprintf(testpath, 40, "romfs:/wc7/ger/%d-%d.wc7", i, t + 1); + break; + } + case 5 : { + snprintf(testpath, 40, "romfs:/wc7/spa/%d-%d.wc7", i, t + 1); + break; + } + case 6 : { + snprintf(testpath, 40, "romfs:/wc7/kor/%d-%d.wc7", i, t + 1); + break; + } + case 7 : { + snprintf(testpath, 40, "romfs:/wc7/chs/%d-%d.wc7", i, t + 1); + break; + } + case 8 : { + snprintf(testpath, 40, "romfs:/wc7/cht/%d-%d.wc7", i, t + 1); + break; + } + } + FILE* f = fopen(testpath, "r"); + if (f) { k++; fclose(f); } + } + if (k == n) langVett[j] = true; + else langVett[j] = false; + } + } + + // set first lang selected + langSelected = -1; + for (int i = 0; i < 9; i++) { + if (langVett[i]) { + langSelected = i; + break; + } + } + + while (aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) break; + + if (hidKeysHeld() & KEY_TOUCH) { + if (touch.px > 114 && touch.px < 150 && touch.py > 50 && touch.py < 71 && langVett[0]) langSelected = 0; + if (touch.px > 153 && touch.px < 189 && touch.py > 50 && touch.py < 71 && langVett[1]) langSelected = 1; + if (touch.px > 192 && touch.px < 228 && touch.py > 50 && touch.py < 71 && langVett[2]) langSelected = 2; + if (touch.px > 231 && touch.px < 267 && touch.py > 50 && touch.py < 71 && langVett[3]) langSelected = 3; + if (touch.px > 270 && touch.px < 306 && touch.py > 50 && touch.py < 71 && langVett[4]) langSelected = 4; + if (touch.px > 133 && touch.px < 169 && touch.py > 74 && touch.py < 95 && langVett[5]) langSelected = 5; + if (touch.px > 172 && touch.px < 208 && touch.py > 74 && touch.py < 95 && langVett[6]) langSelected = 6; + if (touch.px > 211 && touch.px < 247 && touch.py > 74 && touch.py < 95 && langVett[7]) langSelected = 7; + if (touch.px > 250 && touch.px < 286 && touch.py > 74 && touch.py < 95 && langVett[8]) langSelected = 8; + + if (touch.px > 210 && touch.px < 246 && touch.py > 110 && touch.py < 131) { + overwrite = true; + nInjected[0] = 0; + } + if (touch.px > 249 && touch.px < 285 && touch.py > 110 && touch.py < 131) { + overwrite = false; + findFreeLocationWC(mainbuf, game, nInjected); + } + + if (touch.px > 210 && touch.px < 246 && touch.py > 138 && touch.py < 159) adapt = true; + if (touch.px > 249 && touch.px < 285 && touch.py > 138 && touch.py < 159) adapt = false; + } + + if (hidKeysDown() & KEY_START) { + if (nInjected[0] >= 48) + nInjected[0] = 0; + + int ret = checkMultipleWC7(mainbuf, game, i, langSelected, nInjected, adapt); + if (ret != 0 && ret != 1) { + infoDisp("Error during injection!"); + break; + } + else if (ret == 1) { + infoDisp("Injection succeeded!"); + break; + } + + char *wc7path = (char*)malloc(30 * sizeof(char)); + switch (langSelected) { + case 0 : { + snprintf(wc7path, 30, "romfs:/wc7/jpn/%d.wc7", i); + break; + } + case 1 : { + snprintf(wc7path, 30, "romfs:/wc7/eng/%d.wc7", i); + break; + } + case 2 : { + snprintf(wc7path, 30, "romfs:/wc7/fre/%d.wc7", i); + break; + } + case 3 : { + snprintf(wc7path, 30, "romfs:/wc7/ita/%d.wc7", i); + break; + } + case 4 : { + snprintf(wc7path, 30, "romfs:/wc7/ger/%d.wc7", i); + break; + } + case 5 : { + snprintf(wc7path, 30, "romfs:/wc7/spa/%d.wc7", i); + break; + } + case 6 : { + snprintf(wc7path, 30, "romfs:/wc7/kor/%d.wc7", i); + break; + } + case 7 : { + snprintf(wc7path, 30, "romfs:/wc7/chs/%d.wc7", i); + break; + } + case 8 : { + snprintf(wc7path, 30, "romfs:/wc7/cht/%d.wc7", i); + break; + } + } + + FILE *fptr = fopen(wc7path, "rt"); + if (fptr == NULL) { + fclose(fptr); + free(wc7path); + infoDisp("Error during injection!"); + break; + } + fseek(fptr, 0, SEEK_END); + u32 contentsize = ftell(fptr); + u8 *wc7buf = (u8*)malloc(contentsize); + if (wc7buf == NULL) { + fclose(fptr); + free(wc7buf); + free(wc7path); + infoDisp("Error during injection!"); + break; + } + rewind(fptr); + fread(wc7buf, contentsize, 1, fptr); + fclose(fptr); + + if (!(overwrite)) + findFreeLocationWC(mainbuf, game, nInjected); + + if (adapt) + setLanguage(mainbuf, game, langSelected); + + setWC(mainbuf, wc7buf, game, i, nInjected); + + free(wc7path); + free(wc7buf); + infoDisp("Injection succeeded!"); + break; + } + + printDB7(spriteArray[i], i, langVett, adapt, overwrite, langSelected, nInjected[0]); + } + + free(testpath); + } + + printDatabase6(database, currentEntry, page, spriteArray); + } + + free(spriteArray); +} + +void eventDatabase6(u8* mainbuf, int game) { + char *database[2050]; + int *spriteArray = (int*)malloc(2050 * sizeof(int)); + filldatabase6(database, spriteArray); + + int currentEntry = 0; + int page = 0; + + bool adapt = false; + bool langVett[7]; + bool overwrite = false; + int nInjected[1] = {0}; + int langSelected = -1; + + findFreeLocationWC(mainbuf, game, nInjected); + + while(aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + if ((hidKeysDown() & KEY_TOUCH) && touch.px > 298 && touch.px < 320 && touch.py > 207 && touch.py < 225) break; + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_L) { + if (page > 0) { + int temp; + do { + page--; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page--; + } while (temp == 10); + } + else if (page == 0) page = 204; + } + + if (hidKeysDown() & KEY_R) { + if (page < 204) { + int temp; + do { + page++; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page++; + } while (temp == 10); + } + else if (page == 204) page = 0; + } + + if (hidKeysDown() & KEY_DUP) { + if (currentEntry > 0) currentEntry--; + else if (currentEntry == 0) currentEntry = 9; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (currentEntry < 9) currentEntry++; + else if (currentEntry == 9) currentEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (currentEntry <= 4) { + int temp; + do { + page--; + if (page < 0) page = 204; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page--; + } while (temp == 10); + } + else if (currentEntry >= 5) currentEntry -= 5; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (currentEntry <= 4) currentEntry += 5; + else if (currentEntry >= 5) { + int temp; + do { + page++; + if (page > 204) page = 0; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page++; + } while (temp == 10); + } + } + + if (hidKeysDown() & KEY_A && spriteArray[page*10+currentEntry] != -1) { + int i = page * 10 + currentEntry; + // check for single wc6 events + char *testpath = (char*)malloc(40 * sizeof(char)); + for (int j = 0; j < 7; j++) { + switch (j) { + case 0 : { + snprintf(testpath, 40, "romfs:/wc6/jpn/%d.wc6", i); + break; + } + case 1 : { + snprintf(testpath, 40, "romfs:/wc6/eng/%d.wc6", i); + break; + } + case 2 : { + snprintf(testpath, 40, "romfs:/wc6/fre/%d.wc6", i); + break; + } + case 3 : { + snprintf(testpath, 40, "romfs:/wc6/ita/%d.wc6", i); + break; + } + case 4 : { + snprintf(testpath, 40, "romfs:/wc6/ger/%d.wc6", i); + break; + } + case 5 : { + snprintf(testpath, 40, "romfs:/wc6/spa/%d.wc6", i); + break; + } + case 6 : { + snprintf(testpath, 40, "romfs:/wc6/kor/%d.wc6", i); + break; + } + } + FILE* f = fopen(testpath, "r"); + if (f) { langVett[j] = true; fclose(f); } + else { langVett[j] = false; fclose(f); } + } + + //check for multiple wc6 events + int k, n = getN(i); + if (n != 0) { + for (int j = 0; j < 7; j++) { + k = 0; + for (int t = 0; t < n; t++) { + switch (j) { + case 0 : { + snprintf(testpath, 40, "romfs:/wc6/jpn/%d-%d.wc6", i, t + 1); + break; + } + case 1 : { + snprintf(testpath, 40, "romfs:/wc6/eng/%d-%d.wc6", i, t + 1); + break; + } + case 2 : { + snprintf(testpath, 40, "romfs:/wc6/fre/%d-%d.wc6", i, t + 1); + break; + } + case 3 : { + snprintf(testpath, 40, "romfs:/wc6/ita/%d-%d.wc6", i, t + 1); + break; + } + case 4 : { + snprintf(testpath, 40, "romfs:/wc6/ger/%d-%d.wc6", i, t + 1); + break; + } + case 5 : { + snprintf(testpath, 40, "romfs:/wc6/spa/%d-%d.wc6", i, t + 1); + break; + } + case 6 : { + snprintf(testpath, 40, "romfs:/wc6/kor/%d-%d.wc6", i, t + 1); + break; + } + } + FILE* f = fopen(testpath, "r"); + if (f) { k++; fclose(f); } + } + if (k == n) langVett[j] = true; + else langVett[j] = false; + } + } + + // set first lang selected + langSelected = -1; + for (int i = 0; i < 7; i++) { + if (langVett[i]) { + langSelected = i; + break; + } + } + + while (aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) break; + + if (hidKeysHeld() & KEY_TOUCH) { + if (touch.px > 132 && touch.px < 168 && touch.py > 50 && touch.py < 71 && langVett[0]) langSelected = 0; + if (touch.px > 171 && touch.px < 207 && touch.py > 50 && touch.py < 71 && langVett[1]) langSelected = 1; + if (touch.px > 210 && touch.px < 246 && touch.py > 50 && touch.py < 71 && langVett[2]) langSelected = 2; + if (touch.px > 249 && touch.px < 285 && touch.py > 50 && touch.py < 71 && langVett[3]) langSelected = 3; + if (touch.px > 151 && touch.px < 187 && touch.py > 74 && touch.py < 95 && langVett[4]) langSelected = 4; + if (touch.px > 190 && touch.px < 226 && touch.py > 74 && touch.py < 95 && langVett[5]) langSelected = 5; + if (touch.px > 229 && touch.px < 265 && touch.py > 74 && touch.py < 95 && langVett[6]) langSelected = 6; + + if (touch.px > 210 && touch.px < 246 && touch.py > 110 && touch.py < 131) { + overwrite = true; + nInjected[0] = 0; + } + if (touch.px > 249 && touch.px < 285 && touch.py > 110 && touch.py < 131) { + overwrite = false; + findFreeLocationWC(mainbuf, game, nInjected); + } + + if (touch.px > 210 && touch.px < 246 && touch.py > 138 && touch.py < 159) adapt = true; + if (touch.px > 249 && touch.px < 285 && touch.py > 138 && touch.py < 159) adapt = false; + } + + if (hidKeysDown() & KEY_START) { + if (nInjected[0] >= 24) + nInjected[0] = 0; + + if ((game == GAME_X || game == GAME_Y) && i == 2048) { + infoDisp("Item not available in XY!"); + break; + } + + int ret = checkMultipleWC6(mainbuf, game, i, langSelected, nInjected, adapt); + if (ret != 0 && ret != 1) { + infoDisp("Error during injection!"); + break; + } + else if (ret == 1) { + infoDisp("Injection succeeded!"); + break; + } + + char *wc6path = (char*)malloc(30 * sizeof(char)); + switch (langSelected) { + case 0 : { + snprintf(wc6path, 30, "romfs:/wc6/jpn/%d.wc6", i); + break; + } + case 1 : { + snprintf(wc6path, 30, "romfs:/wc6/eng/%d.wc6", i); + break; + } + case 2 : { + snprintf(wc6path, 30, "romfs:/wc6/fre/%d.wc6", i); + break; + } + case 3 : { + snprintf(wc6path, 30, "romfs:/wc6/ita/%d.wc6", i); + break; + } + case 4 : { + snprintf(wc6path, 30, "romfs:/wc6/ger/%d.wc6", i); + break; + } + case 5 : { + snprintf(wc6path, 30, "romfs:/wc6/spa/%d.wc6", i); + break; + } + case 6 : { + snprintf(wc6path, 30, "romfs:/wc6/kor/%d.wc6", i); + break; + } + } + + FILE *fptr = fopen(wc6path, "rt"); + if (fptr == NULL) { + fclose(fptr); + free(wc6path); + infoDisp("Error during injection!"); + break; + } + fseek(fptr, 0, SEEK_END); + u32 contentsize = ftell(fptr); + u8 *wc6buf = (u8*)malloc(contentsize); + if (wc6buf == NULL) { + fclose(fptr); + free(wc6buf); + free(wc6path); + infoDisp("Error during injection!"); + break; + } + rewind(fptr); + fread(wc6buf, contentsize, 1, fptr); + fclose(fptr); + + if (!(overwrite)) + findFreeLocationWC(mainbuf, game, nInjected); + + if (adapt) + setLanguage(mainbuf, game, langSelected); + + setWC(mainbuf, wc6buf, game, i, nInjected); + + free(wc6path); + free(wc6buf); + infoDisp("Injection succeeded!"); + break; + } + + printDB6(spriteArray[i], i, langVett, adapt, overwrite, langSelected, nInjected[0]); + } + + free(testpath); + } + + printDatabase6(database, currentEntry, page, spriteArray); + } + + free(spriteArray); +} + +void eventDatabase5(u8* mainbuf, int game) { + char *database[170]; + int *spriteArray = (int*)malloc(170 * sizeof(int)); + filldatabase5(database, spriteArray); + + int currentEntry = 0; + int page = 0; + + int nInjected[1] = {0}; + bool langVett[7]; + bool isSelected = false; + int langSelected = -1; + + while(aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_L) { + if (page > 0) { + int temp; + do { + page--; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page--; + } while (temp == 10); + } + else if (page == 0) page = 16; + } + + if (hidKeysDown() & KEY_R) { + if (page < 16) { + int temp; + do { + page++; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page++; + } while (temp == 10); + } + else if (page == 16) page = 0; + } + + if (hidKeysDown() & KEY_DUP) { + if (currentEntry > 0) currentEntry--; + else if (currentEntry == 0) currentEntry = 9; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (currentEntry < 9) currentEntry++; + else if (currentEntry == 9) currentEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (currentEntry <= 4) { + int temp; + do { + page--; + if (page < 0) page = 16; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page--; + } while (temp == 10); + } + else if (currentEntry >= 5) currentEntry -= 5; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (currentEntry <= 4) currentEntry += 5; + else if (currentEntry >= 5) { + int temp; + do { + page++; + if (page > 16) page = 0; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page++; + } while (temp == 10); + } + } + + if (hidKeysDown() & KEY_A && spriteArray[page*10+currentEntry] != -1) { + isSelected = true; + int i = page * 10 + currentEntry; + + char *testpath = (char*)malloc(40 * sizeof(char)); + for (int j = 0; j < 7; j++) { + switch (j) { + case 0 : { + snprintf(testpath, 40, "romfs:/pgf/jpn/%d.pgf", i); + break; + } + case 1 : { + snprintf(testpath, 40, "romfs:/pgf/eng/%d.pgf", i); + break; + } + case 2 : { + snprintf(testpath, 40, "romfs:/pgf/fre/%d.pgf", i); + break; + } + case 3 : { + snprintf(testpath, 40, "romfs:/pgf/ita/%d.pgf", i); + break; + } + case 4 : { + snprintf(testpath, 40, "romfs:/pgf/ger/%d.pgf", i); + break; + } + case 5 : { + snprintf(testpath, 40, "romfs:/pgf/spa/%d.pgf", i); + break; + } + case 6 : { + snprintf(testpath, 40, "romfs:/pgf/kor/%d.pgf", i); + break; + } + } + FILE* f = fopen(testpath, "r"); + if (f) { langVett[j] = true; fclose(f); } + else { langVett[j] = false; fclose(f); } + } + + // set first lang selected + langSelected = -1; + for (int i = 0; i < 7; i++) { + if (langVett[i]) { + langSelected = i; + break; + } + } + + while (aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) break; + + if (hidKeysHeld() & KEY_TOUCH) { + if (touch.px > 25 && touch.px < 61 && touch.py > 178 && touch.py < 202 && langVett[0]) langSelected = 0; + if (touch.px > 63 && touch.px < 99 && touch.py > 178 && touch.py < 202 && langVett[1]) langSelected = 1; + if (touch.px > 101 && touch.px < 137 && touch.py > 178 && touch.py < 202 && langVett[2]) langSelected = 2; + if (touch.px > 139 && touch.px < 175 && touch.py > 178 && touch.py < 202 && langVett[3]) langSelected = 3; + if (touch.px > 177 && touch.px < 213 && touch.py > 178 && touch.py < 202 && langVett[4]) langSelected = 4; + if (touch.px > 215 && touch.px < 251 && touch.py > 178 && touch.py < 202 && langVett[5]) langSelected = 5; + if (touch.px > 253 && touch.px < 289 && touch.py > 178 && touch.py < 202 && langVett[6]) langSelected = 6; + } + + if (hidKeysDown() & KEY_START) { + if (nInjected[0] >= 12) + nInjected[0] = 0; + + char *pgfpath = (char*)malloc(30 * sizeof(char)); + switch (langSelected) { + case 0 : { + snprintf(pgfpath, 30, "romfs:/pgf/jpn/%d.pgf", i); + break; + } + case 1 : { + snprintf(pgfpath, 30, "romfs:/pgf/eng/%d.pgf", i); + break; + } + case 2 : { + snprintf(pgfpath, 30, "romfs:/pgf/fre/%d.pgf", i); + break; + } + case 3 : { + snprintf(pgfpath, 30, "romfs:/pgf/ita/%d.pgf", i); + break; + } + case 4 : { + snprintf(pgfpath, 30, "romfs:/pgf/ger/%d.pgf", i); + break; + } + case 5 : { + snprintf(pgfpath, 30, "romfs:/pgf/spa/%d.pgf", i); + break; + } + case 6 : { + snprintf(pgfpath, 30, "romfs:/pgf/kor/%d.pgf", i); + break; + } + } + + FILE *fptr = fopen(pgfpath, "rt"); + if (fptr == NULL) { + fclose(fptr); + free(pgfpath); + infoDisp("Error during injection!"); + break; + } + fseek(fptr, 0, SEEK_END); + u32 contentsize = ftell(fptr); + u8 *pgfbuf = (u8*)malloc(contentsize); + if (pgfbuf == NULL) { + fclose(fptr); + free(pgfbuf); + free(pgfpath); + infoDisp("Error during injection!"); + break; + } + rewind(fptr); + fread(pgfbuf, contentsize, 1, fptr); + fclose(fptr); + + setWC(mainbuf, pgfbuf, game, i, nInjected); + + free(pgfpath); + free(pgfbuf); + infoDisp("Injection succeeded!"); + break; + } + + printDatabase5(database, currentEntry, page, spriteArray, isSelected, langSelected, langVett); + } + + isSelected = false; + free(testpath); + } + + printDatabase5(database, currentEntry, page, spriteArray, isSelected, langSelected, langVett); + } + + free(spriteArray); +} + +void eventDatabase4(u8* mainbuf, int game, int GBO, int SBO) { + char *database[190]; + int *spriteArray = (int*)malloc(190 * sizeof(int)); + filldatabase4(database, spriteArray); + + int currentEntry = 0; + int page = 0; + + int nInjected[1] = {0}; + bool langVett[7]; + bool isSelected = false; + int langSelected = -1; + + while(aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_L) { + if (page > 0) { + int temp; + do { + page--; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page--; + } while (temp == 10); + } + else if (page == 0) page = 18; + } + + if (hidKeysDown() & KEY_R) { + if (page < 18) { + int temp; + do { + page++; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page++; + } while (temp == 10); + } + else if (page == 18) page = 0; + } + + if (hidKeysDown() & KEY_DUP) { + if (currentEntry > 0) currentEntry--; + else if (currentEntry == 0) currentEntry = 9; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (currentEntry < 9) currentEntry++; + else if (currentEntry == 9) currentEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (currentEntry <= 4) { + int temp; + do { + page--; + if (page < 0) page = 18; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page--; + } while (temp == 10); + } + else if (currentEntry >= 5) currentEntry -= 5; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (currentEntry <= 4) currentEntry += 5; + else if (currentEntry >= 5) { + int temp; + do { + page++; + if (page > 18) page = 0; + temp = 0; + for (int i = 0; i < 10; i++) + if (strcmp(database[page*10+i], " ") == 0) + temp++; + + if (temp == 10) + page++; + } while (temp == 10); + } + } + + if (hidKeysDown() & KEY_A && spriteArray[page*10+currentEntry] != -1) { + isSelected = true; + int i = page * 10 + currentEntry; + + char *testpath = (char*)malloc(40 * sizeof(char)); + for (int j = 0; j < 7; j++) { + switch (j) { + case 0 : { + snprintf(testpath, 40, "romfs:/pgt/jpn/%d.pgt", i); + break; + } + case 1 : { + snprintf(testpath, 40, "romfs:/pgt/eng/%d.pgt", i); + break; + } + case 2 : { + snprintf(testpath, 40, "romfs:/pgt/fre/%d.pgt", i); + break; + } + case 3 : { + snprintf(testpath, 40, "romfs:/pgt/ita/%d.pgt", i); + break; + } + case 4 : { + snprintf(testpath, 40, "romfs:/pgt/ger/%d.pgt", i); + break; + } + case 5 : { + snprintf(testpath, 40, "romfs:/pgt/spa/%d.pgt", i); + break; + } + case 6 : { + snprintf(testpath, 40, "romfs:/pgt/kor/%d.pgt", i); + break; + } + } + FILE* f = fopen(testpath, "r"); + if (f) { langVett[j] = true; fclose(f); } + else { langVett[j] = false; fclose(f); } + } + + // set first lang selected + langSelected = -1; + for (int i = 0; i < 7; i++) { + if (langVett[i]) { + langSelected = i; + break; + } + } + + while (aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) break; + + if (hidKeysHeld() & KEY_TOUCH) { + if (touch.px > 25 && touch.px < 61 && touch.py > 178 && touch.py < 202 && langVett[0]) langSelected = 0; + if (touch.px > 63 && touch.px < 99 && touch.py > 178 && touch.py < 202 && langVett[1]) langSelected = 1; + if (touch.px > 101 && touch.px < 137 && touch.py > 178 && touch.py < 202 && langVett[2]) langSelected = 2; + if (touch.px > 139 && touch.px < 175 && touch.py > 178 && touch.py < 202 && langVett[3]) langSelected = 3; + if (touch.px > 177 && touch.px < 213 && touch.py > 178 && touch.py < 202 && langVett[4]) langSelected = 4; + if (touch.px > 215 && touch.px < 251 && touch.py > 178 && touch.py < 202 && langVett[5]) langSelected = 5; + if (touch.px > 253 && touch.px < 289 && touch.py > 178 && touch.py < 202 && langVett[6]) langSelected = 6; + } + + if (hidKeysDown() & KEY_START) { + if (nInjected[0] >= 8) + nInjected[0] = 0; + + char *pgtpath = (char*)malloc(30 * sizeof(char)); + switch (langSelected) { + case 0 : { + snprintf(pgtpath, 30, "romfs:/pgt/jpn/%d.pgt", i); + break; + } + case 1 : { + snprintf(pgtpath, 30, "romfs:/pgt/eng/%d.pgt", i); + break; + } + case 2 : { + snprintf(pgtpath, 30, "romfs:/pgt/fre/%d.pgt", i); + break; + } + case 3 : { + snprintf(pgtpath, 30, "romfs:/pgt/ita/%d.pgt", i); + break; + } + case 4 : { + snprintf(pgtpath, 30, "romfs:/pgt/ger/%d.pgt", i); + break; + } + case 5 : { + snprintf(pgtpath, 30, "romfs:/pgt/spa/%d.pgt", i); + break; + } + case 6 : { + snprintf(pgtpath, 30, "romfs:/pgt/kor/%d.pgt", i); + break; + } + } + + FILE *fptr = fopen(pgtpath, "rt"); + if (fptr == NULL) { + fclose(fptr); + free(pgtpath); + infoDisp("Error during injection!"); + break; + } + fseek(fptr, 0, SEEK_END); + u32 contentsize = ftell(fptr); + u8 *pgtbuf = (u8*)malloc(contentsize); + if (pgtbuf == NULL) { + fclose(fptr); + free(pgtbuf); + free(pgtpath); + infoDisp("Error during injection!"); + break; + } + rewind(fptr); + fread(pgtbuf, contentsize, 1, fptr); + fclose(fptr); + + setWC4(mainbuf, pgtbuf, game, i, nInjected, GBO); + + free(pgtpath); + free(pgtbuf); + infoDisp("Injection succeeded!"); + break; + } + + printDatabase4(database, currentEntry, page, spriteArray, isSelected, langSelected, langVett); + } + + isSelected = false; + free(testpath); + } + + printDatabase4(database, currentEntry, page, spriteArray, isSelected, langSelected, langVett); + } + + free(spriteArray); +} + +void massInjector(u8* mainbuf, int game) { + int currentEntry = 0; + + while(aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_B) { + if (game == GAME_SUN || game == GAME_MOON) { + if (confirmDisp("Save PokeDex flags?")) { + u8 pkmn[PKMNLENGTH]; + int end = (game < 4) ? 31 : 32; + char* step = (char*)malloc(20); + + for (u32 i = 0; i < end; i++) { + for (u32 j = 0; j < 30; j++) { + snprintf(step, 20, "Box %lu / Slot %lu", i + 1, j + 1); + freezeMsg(step); + getPkmn(mainbuf, i, j, pkmn, game); + setDex(mainbuf, pkmn, game); + } + } + free(step); + } + } + break; + } + + if (hidKeysDown() & KEY_DUP) { + if (currentEntry > 0) currentEntry--; + else if (currentEntry == 0) currentEntry = 9; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (currentEntry < 9) currentEntry++; + else if (currentEntry == 9) currentEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (currentEntry >= 5) currentEntry -= 5; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (currentEntry <= 4) currentEntry += 5; + } + + if (hidKeysDown() & KEY_START) { + switch (currentEntry) { + case 0 : { + char *path[3] = {"romfs:/misc/xd/1.bin", "romfs:/misc/xd/2.bin", "romfs:/misc/xd/3.bin"}; + setBoxBin(mainbuf, game, 3, 30, path); + infoDisp("XD collection set successfully!"); + break; + } + case 1 : { + char *path[2] = {"romfs:/misc/colosseum/1.bin", "romfs:/misc/colosseum/2.bin"}; + setBoxBin(mainbuf, game, 2, 30, path); + infoDisp("Colosseum col. set successfully!"); + break; + } + case 2 : { + char *path[1] = {"romfs:/misc/10anni.bin"}; + setBoxBin(mainbuf, game, 1, 30, path); + infoDisp("10th Anniversary set successfully!"); + break; + } + case 3 : { + char *path[1] = {"romfs:/misc/coll_n.bin"}; + setBoxBin(mainbuf, game, 1, 15, path); + infoDisp("N's collection injected successfully!"); + break; + } + case 4 : { + char *path[1] = {"romfs:/misc/coll_entreeforest.bin"}; + setBoxBin(mainbuf, game, 1, 30, path); + infoDisp("Entree Forest col. set successfully!"); + break; + } + case 5 : { + char *path[1] = {"romfs:/misc/coll_dreamradar.bin"}; + setBoxBin(mainbuf, game, 1, 30, path); + infoDisp("Dream Radar col. set successfully!"); + break; + } + case 6 : { + FILE *fptr = fopen("romfs:/misc/living.bin", "rt"); + fseek(fptr, 0, SEEK_END); + u32 size = ftell(fptr); + u8* livingbuf = (u8*)malloc(size); + memset(livingbuf, 0, size); + rewind(fptr); + fread(livingbuf, size, 1, fptr); + fclose(fptr); + memcpy(&mainbuf[getPkmnAddress(0, 0, game)], &livingbuf[0], (game < 4) ? 167272 : 186064); + free(livingbuf); + infoDisp("Living dex set successfully!"); + break; + } + case 7 : { + char *path[] = {"romfs:/misc/coll_deoxysoblivia.bin"}; + setBoxBin(mainbuf, game, 1, 30, path); + infoDisp("Deoxys collection set successfully!"); + break; + } + case 8 : { + char *path[] = {"romfs:/misc/coll_ranch.bin"}; + setBoxBin(mainbuf, game, 1, 30, path); + infoDisp("My Pokemon Ranch set successfully!"); + break; + } + case 9 : { + char *path[] = {"romfs:/misc/coll_oskorea.bin"}; + setBoxBin(mainbuf, game, 1, 30, path); + infoDisp("Korean collection set successfully!"); + break; + } + } + } + + printMassInjector(currentEntry); + } +} \ No newline at end of file diff --git a/source/database.h b/source/database.h new file mode 100644 index 000000000..bacb88c49 --- /dev/null +++ b/source/database.h @@ -0,0 +1,36 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#pragma once + +#include +#include <3ds.h> + +#define SMCOUNT 2050 + +void findFreeLocationWC(u8 *mainbuf, int game, int nInjected[]); +int getN(int i); +void setBoxBin(u8* mainbuf, int game, int NBOXES, int N, char* path[]); +int checkMultipleWC6(u8* mainbuf, int game, int i, int langCont, int nInjected[], int adapt); +int checkMultipleWC7(u8* mainbuf, int game, int i, int langCont, int nInjected[], int adapt); +void eventDatabase7(u8* mainbuf, int game); +void eventDatabase6(u8* mainbuf, int game); +void eventDatabase5(u8* mainbuf, int game); +void eventDatabase4(u8* mainbuf, int game, int GBO, int SBO); +void massInjector(u8* mainbuf, int game); \ No newline at end of file diff --git a/source/dex.c b/source/dex.c new file mode 100644 index 000000000..a6e01009b --- /dev/null +++ b/source/dex.c @@ -0,0 +1,209 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include <3ds.h> +#include +#include "util.h" +#include "editor.h" +#include "dex.h" + +int getDexFormIndexSM(int species, int formct, int start) { + u16 formtable[] = { // u16 species, u16 formcount + 0x0003, 0x0002, 0x0006, 0x0003, 0x0009, 0x0002, 0x000F, 0x0002, + 0x0012, 0x0002, 0x0013, 0x0002, 0x0014, 0x0003, 0x0019, 0x0007, + 0x001A, 0x0002, 0x001B, 0x0002, 0x001C, 0x0002, 0x0025, 0x0002, + 0x0026, 0x0002, 0x0032, 0x0002, 0x0033, 0x0002, 0x0034, 0x0002, + 0x0035, 0x0002, 0x0041, 0x0002, 0x004A, 0x0002, 0x004B, 0x0002, + 0x004C, 0x0002, 0x0050, 0x0002, 0x0058, 0x0002, 0x0059, 0x0002, + 0x005E, 0x0002, 0x0067, 0x0002, 0x0069, 0x0002, 0x0073, 0x0002, + 0x007F, 0x0002, 0x0082, 0x0002, 0x008E, 0x0002, 0x0096, 0x0003, + 0x00B5, 0x0002, 0x00C9, 0x001C, 0x00D0, 0x0002, 0x00D4, 0x0002, + 0x00D6, 0x0002, 0x00E5, 0x0002, 0x00F8, 0x0002, 0x00FE, 0x0002, + 0x0101, 0x0002, 0x0104, 0x0002, 0x011A, 0x0002, 0x012E, 0x0002, + 0x012F, 0x0002, 0x0132, 0x0002, 0x0134, 0x0002, 0x0136, 0x0002, + 0x013F, 0x0002, 0x0143, 0x0002, 0x014E, 0x0002, 0x015F, 0x0004, + 0x0162, 0x0002, 0x0167, 0x0002, 0x016A, 0x0002, 0x0175, 0x0002, + 0x0178, 0x0002, 0x017C, 0x0002, 0x017D, 0x0002, 0x017E, 0x0002, + 0x017F, 0x0002, 0x0180, 0x0002, 0x0182, 0x0004, 0x019C, 0x0003, + 0x019D, 0x0003, 0x01A5, 0x0002, 0x01A6, 0x0002, 0x01A7, 0x0002, + 0x01AC, 0x0002, 0x01BD, 0x0002, 0x01C0, 0x0002, 0x01CC, 0x0002, + 0x01DB, 0x0002, 0x01DF, 0x0006, 0x01E7, 0x0002, 0x01EC, 0x0002, + 0x01ED, 0x0012, 0x0213, 0x0002, 0x0226, 0x0002, 0x022B, 0x0002, + 0x0249, 0x0004, 0x024A, 0x0004, 0x0281, 0x0002, 0x0282, 0x0002, + 0x0285, 0x0002, 0x0286, 0x0003, 0x0287, 0x0002, 0x0288, 0x0002, + 0x0289, 0x0005, 0x0292, 0x0003, 0x029A, 0x0014, 0x029D, 0x0005, + 0x029E, 0x0006, 0x029F, 0x0005, 0x02A4, 0x000A, 0x02A6, 0x0002, + 0x02A9, 0x0002, 0x02C6, 0x0004, 0x02C7, 0x0004, 0x02CC, 0x0002, + 0x02CE, 0x0005, 0x02CF, 0x0002, 0x02D0, 0x0002, 0x02DF, 0x0002, + 0x02E2, 0x0002, 0x02E5, 0x0004, 0x02E9, 0x0002, 0x02EA, 0x0002, + 0x02F2, 0x0002, 0x02F6, 0x0002, 0x0305, 0x0012, 0x0306, 0x000E, + 0x030A, 0x0004, 0x0310, 0x0002, 0x0321, 0x0002, + }; + int formindex = start; + int f = 0; + + for (int i = 0; i < 70; i += 2) { + if (formtable[i] == species) + break; + f = formtable[i + 1]; + formindex += f - 1; + } + if (f > formct) + return -1; + return formindex; +} + +void setDexFlags(u8 mainbuf[], int index, int gender, int shiny, int baseSpecies, int game) { + int PokeDex; + + if (game == GAME_SUN || game == GAME_MOON) { + PokeDex = 0x02A00; + } + const int brSize = 0x8C; + int shift = gender | (shiny << 1); + int ofs = PokeDex + 0x08 + 0x80 + 0x68; + int bd = index >> 3; + int bm = index & 7; + int bd1 = baseSpecies >> 3; + int bm1 = baseSpecies & 7; + + int brSeen = shift * brSize; + mainbuf[ofs + brSeen + bd] |= (u8)(1 << bm); + + bool displayed = false; + for (int i = 0; i < 4; i++) { + int brDisplayed = (4 + i) * brSize; + displayed |= (mainbuf[ofs + brDisplayed + bd1] & (u8)(1 << bm1)) != 0; + } + + if (!displayed && baseSpecies != index) { + for (int i = 0; i < 4; i++) { + int brDisplayed = (4 + i) * brSize; + displayed |= (mainbuf[ofs + brDisplayed + bd] & (u8)(1 << bm)) != 0; + } + } + if (displayed) + return; + + mainbuf[ofs + (4 + shift) * brSize + bd] |= (u8)(1 << bm); +} + +bool sanitizeFormsToIterate(int species, int fsfe[], int formIn) { + switch (species) { + case 351: { // Castform + fsfe[0] = 0; + fsfe[1] = 3; + return true; + } + case 778: { // Mimikyu + fsfe[0] = 0; + fsfe[1] = 1; + return true; + } + case 774: { // Minior + return formIn > 6; + } + + case 718: { + if (formIn == 3) // complete + return true; // 0/0 + if (formIn != 2) // give + return false; + + fsfe[0] = 1; + fsfe[1] = 1; + return true; + } + } + return false; +} + +void setDex(u8 mainbuf[], u8* pkmn, int game) { + int n = getPokedexNumber(pkmn); + int MaxSpeciesID; + int PokeDex; + int PokeDexLanguageFlags; + + if (game == GAME_SUN || game == GAME_MOON) { + MaxSpeciesID = 802; + PokeDex = 0x02A00; + PokeDexLanguageFlags = PokeDex + 0x550; + } + + if (n == 0 || n > MaxSpeciesID) + return; + if (isEgg(pkmn)) + return; + + int bit = n - 1; + int bd = bit >> 3; + int bm = bit & 7; + int gender = getGender(pkmn) % 2; + int shiny = isShiny(pkmn) ? 1 : 0; + if (n == 351) + shiny = 0; + int shift = gender | (shiny << 1); + if (n == 327) { // Spinda + if ((mainbuf[PokeDex + 0x84] & (1 << (shift + 4))) != 0) { // Already 2 + u32 encryptionkey; + memcpy(&encryptionkey, &pkmn[0x0], 4); + memcpy(&mainbuf[PokeDex + 0x8E8 + shift * 4], &encryptionkey, 4); + mainbuf[PokeDex + 0x84] |= (u8)(1 << shift); + } else if ((mainbuf[PokeDex + 0x84] & (1 << shift)) == 0) // Not yet 1 + mainbuf[PokeDex + 0x84] |= (u8)(1 << shift); // 1 + } + + int ofs = PokeDex + 0x08 + 0x80; + mainbuf[ofs + bd] |= (u8)(1 << bm); + + int formstart = getForm(pkmn); + int formend = formstart; + int fsfe[2] = {0, 0}; + + if (sanitizeFormsToIterate(getPokedexNumber(pkmn), fsfe, formstart)) { + formstart = fsfe[0]; + formend = fsfe[1]; + } + + for (int form = formstart; form <= formend; form++) { + int bitIndex = bit; + if (form > 0) { + u8 temp; + memcpy(&temp, &personal.pkmData[getPokedexNumber(pkmn)][0x1C], 1); + if ((int)temp > 1) { // actually has forms + int f = getDexFormIndexSM(getPokedexNumber(pkmn), (int)temp, MaxSpeciesID - 1); + if (f >= 0) // bit index valid + bitIndex = f + form; + } + } + setDexFlags(mainbuf, bitIndex, gender, shiny, getPokedexNumber(pkmn) - 1, game); + } + + int lang = getLanguage(pkmn); + const int langCount = 9; + if (lang <= 10 && lang != 6 && lang != 0) { + if (lang >= 7) + lang--; + lang--; + if (lang < 0) lang = 1; + int lbit = bit * langCount + lang; + if (lbit >> 3 < 920) + mainbuf[PokeDexLanguageFlags + (lbit >> 3)] |= (u8)(1 << (lbit & 7)); + } +} \ No newline at end of file diff --git a/source/dex.h b/source/dex.h new file mode 100644 index 000000000..c9c48c8f2 --- /dev/null +++ b/source/dex.h @@ -0,0 +1,25 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include <3ds.h> + +int getDexFormIndexSM(int species, int formct, int start); +void setDexFlags(u8 mainbuf[], int index, int gender, int shiny, int baseSpecies, int game); +bool sanitizeFormsToIterate(int species, int fsfe[], int formIn); +void setDex(u8 mainbuf[], u8* pkmn, int game); \ No newline at end of file diff --git a/source/editor.c b/source/editor.c new file mode 100644 index 000000000..9a9a6e375 --- /dev/null +++ b/source/editor.c @@ -0,0 +1,1784 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include <3ds.h> +#include +#include "graphic.h" +#include "editor.h" +#include "util.h" +#include "save.h" + +/* ************************ local variables ************************ */ + +const int SMWC7FLAGPOS = 0x65C00; +const int SMWC7POS = 0x65C00 + 0x100; +const int ORASWC6FLAGPOS = 0x1CC00; +const int ORASWC6POS = 0x1CD00; +const int XYWC6FLAGPOS = 0x1BC00; +const int XYWC6POS = 0x1BD00; +const int DPPGTFLAGPOS = 0xA6D0; +const int DPPGTPOS = 0xA7FC; +const int PTPGTFLAGPOS = 0xB4C0; +const int PTPGTPOS = 0xB5C0; +const int HGSSPGTFLAGPOS = 0x9D3C; +const int HGSSPGTPOS = 0x9E3C; +const int EONFLAGPOS = 0x319B8; +const int LANGUAGEPOS = 0x1402D; +const int MONEYPOS = 0x4208; +const int BADGEPOS = 0x420C; +const int TMSTARTPOS = 0xBC0; +const int OFFSET = 0x5400; +const int MOVEPOS = 0x5A; +const int EGGMOVEPOS = 0x6A; +const int EVPOS = 0x1E; +const int PIDPOS = 0x18; +const int IVPOS = 0x74; +const int OTIDPOS = 0x0C; +const int SOTIDPOS = 0x0E; +const int OTNAMELENGTH = 0x17; +const int OTNAMEPOS = 0xB0; +const int NICKNAMEPOS = 0x40; +const int POKEDEXNUMBERPOS = 0x08; +const int NATUREPOS = 0x1C; +const int ITEMPOS = 0x0A; +const int EXPPOINTPOS = 0x10; +const int ABILITYPOS = 0x14; +const int ABILITYNUMPOS = 0x15; +const int GENDERPOS = 0x1D; +const int POKERUS = 0x11; +const int PGFSTARTPOS = 0x1C800; +const int BWSEEDPOS = 0x1D290; + +u32 expTable[100][6] = { + {0, 0, 0, 0, 0, 0}, + {8, 15, 4, 9, 6, 10}, + {27, 52, 13, 57, 21, 33}, + {64, 122, 32, 96, 51, 80}, + {125, 237, 65, 135, 100, 156}, + {216, 406, 112, 179, 172, 270}, + {343, 637, 178, 236, 274, 428}, + {512, 942, 276, 314, 409, 640}, + {729, 1326, 393, 419, 583, 911}, + {1000, 1800, 540, 560, 800, 1250}, + {1331, 2369, 745, 742, 1064, 1663}, + {1728, 3041, 967, 973, 1382, 2160}, + {2197, 3822, 1230, 1261, 1757, 2746}, + {2744, 4719, 1591, 1612, 2195, 3430}, + {3375, 5737, 1957, 2035, 2700, 4218}, + {4096, 6881, 2457, 2535, 3276, 5120}, + {4913, 8155, 3046, 3120, 3930, 6141}, + {5832, 9564, 3732, 3798, 4665, 7290}, + {6859, 11111, 4526, 4575, 5487, 8573}, + {8000, 12800, 5440, 5460, 6400, 10000}, + {9261, 14632, 6482, 6458, 7408, 11576}, + {10648, 16610, 7666, 7577, 8518, 13310}, + {12167, 18737, 9003, 8825, 9733, 15208}, + {13824, 21012, 10506, 10208, 11059, 17280}, + {15625, 23437, 12187, 11735, 12500, 19531}, + {17576, 26012, 14060, 13411, 14060, 21970}, + {19683, 28737, 16140, 15244, 15746, 24603}, + {21952, 31610, 18439, 17242, 17561, 27440}, + {24389, 34632, 20974, 19411, 19511, 30486}, + {27000, 37800, 23760, 21760, 21600, 33750}, + {29791, 41111, 26811, 24294, 23832, 37238}, + {32768, 44564, 30146, 27021, 26214, 40960}, + {35937, 48155, 33780, 29949, 28749, 44921}, + {39304, 51881, 37731, 33084, 31443, 49130}, + {42875, 55737, 42017, 36435, 34300, 53593}, + {46656, 59719, 46656, 40007, 37324, 58320}, + {50653, 63822, 50653, 43808, 40522, 63316}, + {54872, 68041, 55969, 47846, 43897, 68590}, + {59319, 72369, 60505, 52127, 47455, 74148}, + {64000, 76800, 66560, 56660, 51200, 80000}, + {68921, 81326, 71677, 61450, 55136, 86151}, + {74088, 85942, 78533, 66505, 59270, 92610}, + {79507, 90637, 84277, 71833, 63605, 99383}, + {85184, 95406, 91998, 77440, 68147, 106480}, + {91125, 100237, 98415, 83335, 72900, 113906}, + {97336, 105122, 107069, 89523, 77868, 121670}, + {103823, 110052, 114205, 96012, 83058, 129778}, + {110592, 115015, 123863, 102810, 88473, 138240}, + {117649, 120001, 131766, 109923, 94119, 147061}, + {125000, 125000, 142500, 117360, 100000, 156250}, + {132651, 131324, 151222, 125126, 106120, 165813}, + {140608, 137795, 163105, 133229, 112486, 175760}, + {148877, 144410, 172697, 141677, 119101, 186096}, + {157464, 151165, 185807, 150476, 125971, 196830}, + {166375, 158056, 196322, 159635, 133100, 207968}, + {175616, 165079, 210739, 169159, 140492, 219520}, + {185193, 172229, 222231, 179056, 148154, 231491}, + {195112, 179503, 238036, 189334, 156089, 243890}, + {205379, 186894, 250562, 199999, 164303, 256723}, + {216000, 194400, 267840, 211060, 172800, 270000}, + {226981, 202013, 281456, 222522, 181584, 283726}, + {238328, 209728, 300293, 234393, 190662, 297910}, + {250047, 217540, 315059, 246681, 200037, 312558}, + {262144, 225443, 335544, 259392, 209715, 327680}, + {274625, 233431, 351520, 272535, 219700, 343281}, + {287496, 241496, 373744, 286115, 229996, 359370}, + {300763, 249633, 390991, 300140, 240610, 375953}, + {314432, 257834, 415050, 314618, 251545, 393040}, + {328509, 267406, 433631, 329555, 262807, 410636}, + {343000, 276458, 459620, 344960, 274400, 428750}, + {357911, 286328, 479600, 360838, 286328, 447388}, + {373248, 296358, 507617, 377197, 298598, 466560}, + {389017, 305767, 529063, 394045, 311213, 486271}, + {405224, 316074, 559209, 411388, 324179, 506530}, + {421875, 326531, 582187, 429235, 337500, 527343}, + {438976, 336255, 614566, 447591, 351180, 548720}, + {456533, 346965, 639146, 466464, 365226, 570666}, + {474552, 357812, 673863, 485862, 379641, 593190}, + {493039, 367807, 700115, 505791, 394431, 616298}, + {512000, 378880, 737280, 526260, 409600, 640000}, + {531441, 390077, 765275, 547274, 425152, 664301}, + {551368, 400293, 804997, 568841, 441094, 689210}, + {571787, 411686, 834809, 590969, 457429, 714733}, + {592704, 423190, 877201, 613664, 474163, 740880}, + {614125, 433572, 908905, 636935, 491300, 767656}, + {636056, 445239, 954084, 660787, 508844, 795070}, + {658503, 457001, 987754, 685228, 526802, 823128}, + {681472, 467489, 1035837, 710266, 545177, 851840}, + {704969, 479378, 1071552, 735907, 563975, 881211}, + {729000, 491346, 1122660, 762160, 583200, 911250}, + {753571, 501878, 1160499, 789030, 602856, 941963}, + {778688, 513934, 1214753, 816525, 622950, 973360}, + {804357, 526049, 1254796, 844653, 643485, 1005446}, + {830584, 536557, 1312322, 873420, 664467, 1038230}, + {857375, 548720, 1354652, 902835, 685900, 1071718}, + {884736, 560922, 1415577, 932903, 707788, 1105920}, + {912673, 571333, 1460276, 963632, 730138, 1140841}, + {941192, 583539, 1524731, 995030, 752953, 1176490}, + {970299, 591882, 1571884, 1027103, 776239, 1212873}, + {1000000, 600000, 1640000, 1059860, 800000, 1250000} +}; + +/* ************************ utilities ************************ */ + +u32 seedStep(const u32 seed) { return (seed * 0x41C64E6D + 0x00006073) & 0xFFFFFFFF; } +u32 LCRNG(u32 seed) { return seed * 0x41C64E6D + 0x00006073; } + +void shuffleArray(u8* pkmn, const u32 encryptionkey) { + const int BLOCKLENGHT = 56; + + u8 seed = (((encryptionkey & 0x3E000) >> 0xD) % 24); + + int aloc[24] = { 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 2, 3, 1, 1, 2, 3, 2, 3, 1, 1, 2, 3, 2, 3 }; + int bloc[24] = { 1, 1, 2, 3, 2, 3, 0, 0, 0, 0, 0, 0, 2, 3, 1, 1, 3, 2, 2, 3, 1, 1, 3, 2 }; + int cloc[24] = { 2, 3, 1, 1, 3, 2, 2, 3, 1, 1, 3, 2, 0, 0, 0, 0, 0, 0, 3, 2, 3, 2, 1, 1 }; + int dloc[24] = { 3, 2, 3, 2, 1, 1, 3, 2, 3, 2, 1, 1, 3, 2, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0 }; + int ord[4] = {aloc[seed], bloc[seed], cloc[seed], dloc[seed]}; + + char pkmncpy[PKMNLENGTH]; + char tmp[BLOCKLENGHT]; + + memcpy(&pkmncpy, pkmn, PKMNLENGTH); + + for (int i = 0; i < 4; i++) { + memcpy(tmp, pkmncpy + 8 + BLOCKLENGHT * ord[i], BLOCKLENGHT); + memcpy(pkmn + 8 + BLOCKLENGHT * i, tmp, BLOCKLENGHT); + } +} + +void decryptPkmn(u8* pkmn) { + const int ENCRYPTIONKEYPOS = 0x0; + const int ENCRYPTIONKEYLENGHT = 4; + const int CRYPTEDAREAPOS = 0x08; + + u32 encryptionkey; + memcpy(&encryptionkey, &pkmn[ENCRYPTIONKEYPOS], ENCRYPTIONKEYLENGHT); + u32 seed = encryptionkey; + + u16 temp; + for (int i = CRYPTEDAREAPOS; i < PKMNLENGTH; i += 2) { + memcpy(&temp, &pkmn[i], 2); + temp ^= (seedStep(seed) >> 16); + seed = seedStep(seed); + memcpy(&pkmn[i], &temp, 2); + } + + shuffleArray(pkmn, encryptionkey); +} + +int getPkmnAddress(const int boxnumber, const int indexnumber, int game) { + int boxpos = 0; + if (game == GAME_X || game == GAME_Y) { + if (boxnumber < 33) + boxpos = 0x22600; + else + boxpos = 0x14200; + } else if (game == GAME_OR || game == GAME_AS) { + if (boxnumber < 33) + boxpos = 0x33000; + else + boxpos = 0x14200; + } else if (game == GAME_SUN || game == GAME_MOON) { + if (boxnumber < 33) + boxpos = 0x04E00; + else + boxpos = 0x01400; + } + + if (boxnumber < 33) + return boxpos + (PKMNLENGTH * 30 * boxnumber) + (indexnumber * PKMNLENGTH); + + return boxpos + indexnumber * 260; +} + +void calculatePKMNChecksum(u8* data) { + u16 chk = 0; + + for (int i = 8; i < PKMNLENGTH; i += 2) + chk += *(u16*)(data + i); + + memcpy(data + 6, &chk, 2); +} + +void encryptPkmn(u8* pkmn) { + const int ENCRYPTIONKEYPOS = 0x0; + const int ENCRYPTIONKEYLENGHT = 4; + const int CRYPTEDAREAPOS = 0x08; + + u32 encryptionkey; + memcpy(&encryptionkey, &pkmn[ENCRYPTIONKEYPOS], ENCRYPTIONKEYLENGHT); + u32 seed = encryptionkey; + + for(int i = 0; i < 11; i++) + shuffleArray(pkmn, encryptionkey); + + u16 temp; + for(int i = CRYPTEDAREAPOS; i < PKMNLENGTH; i += 2) { + memcpy(&temp, &pkmn[i], 2); + temp ^= (seedStep(seed) >> 16); + seed = seedStep(seed); + memcpy(&pkmn[i], &temp, 2); + } +} + +void encryptBattleSection(u8* mainbuf, u8* pkmn, int game, int currentEntry) { + int boxpos = 0; + if (game == GAME_X || game == GAME_Y) + boxpos = 0x14200; + else if (game == GAME_OR || game == GAME_AS) + boxpos = 0x14200; + else if (game == GAME_SUN || game == GAME_MOON) + boxpos = 0x01400; + + const int ENCRYPTIONKEYPOS = 0x0; + const int ENCRYPTIONKEYLENGHT = 4; + + u32 encryptionkey; + memcpy(&encryptionkey, &pkmn[ENCRYPTIONKEYPOS], ENCRYPTIONKEYLENGHT); + u32 seed = encryptionkey; + + u16 temp; + for (int i = 232; i < 260; i += 2) { + memcpy(&temp, &mainbuf[boxpos + 260 * currentEntry + i], 2); + temp ^= (seedStep(seed) >> 16); + seed = seedStep(seed); + memcpy(&mainbuf[boxpos + 260 * currentEntry + i], &temp, 2); + } +} + +void fillBattleSection(u8* mainbuf, u8* pkmn, int game, int currentEntry) { + int boxpos = 0; + if (game == GAME_X || game == GAME_Y) + boxpos = 0x14200; + else if (game == GAME_OR || game == GAME_AS) + boxpos = 0x14200; + else if (game == GAME_SUN || game == GAME_MOON) + boxpos = 0x01400; + + u8 battle = 0; + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xE8], &battle, 1); + + u8 level = getLevel(pkmn); + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xEC], &level, 1); + + u16 currenthp = getStat(pkmn, 0); + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xF0], ¤thp, 2); + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xF2], ¤thp, 2); + + u16 atk = getStat(pkmn, 1); + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xF4], &atk, 2); + + u16 def = getStat(pkmn, 2); + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xF6], &def, 2); + + u16 spe = getStat(pkmn, 3); + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xF8], &spe, 2); + + u16 satk = getStat(pkmn, 4); + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xFA], &satk, 2); + + u16 sdef = getStat(pkmn, 5); + memcpy(&mainbuf[boxpos + 260 * currentEntry + 0xFC], &sdef, 2); +} + +void getPkmn(u8* mainbuf, const int boxnumber, const int indexnumber, u8* pkmn, int game) { + memcpy(pkmn, &mainbuf[getPkmnAddress(boxnumber, indexnumber, game)], PKMNLENGTH); + decryptPkmn(pkmn); +} + +void setPkmn(u8* mainbuf, const int boxnumber, const int indexnumber, u8* pkmn, int game) { + calculatePKMNChecksum(pkmn); + if (boxnumber == 33) { + fillBattleSection(mainbuf, pkmn, game, indexnumber); + encryptBattleSection(mainbuf, pkmn, game, indexnumber); + } + encryptPkmn(pkmn); + + memcpy(&mainbuf[getPkmnAddress(boxnumber, indexnumber, game)], pkmn, PKMNLENGTH); +} + +bool isShiny(u8* pkmn) { + u16 trainersv = (getOTID(pkmn) ^ getSOTID(pkmn)) >> 4; + u16 pkmnv = ((getPID(pkmn) >> 16) ^ (getPID(pkmn) & 0xFFFF)) >> 4; + + if (trainersv == pkmnv) return true; + else return false; +} + +void rerollPID(u8* pkmn) { + srand(getPID(pkmn)); + u32 pidbuffer = rand(); + + memcpy(&pkmn[PIDPOS], &pidbuffer, PIDLENGTH); +} + +bool isEgg(u8* pkmn) { + u32 eggbuffer; + memcpy(&eggbuffer, &pkmn[IVPOS], IVLENGTH); + eggbuffer = eggbuffer >> 30; + eggbuffer = eggbuffer & 0x1; + if (eggbuffer == 1) return true; + else return false; +} + +/* ************************ get ************************ */ + +u8 getGender(u8* pkmn) { return ((*(u8*)(pkmn + 0x1D)) >> 1) & 0x3; } +void setGender(u8* pkmn, u8 val) { pkmn[0x1D] = (u8)((pkmn[0x1D] & ~0x06) | (val << 1)); } +u8 getLanguage(u8* pkmn) { return *(u8*)(pkmn + 0xE3); } +u8 getAbility(u8* pkmn) { return *(u8*)(pkmn + 0x14); } +u8 getForm(u8* pkmn) { return ((*(u8*)(pkmn + 0x1D)) >> 3); } +u16 getItem(u8* pkmn) { return *(u16*)(pkmn + 0x0A); } +void setBall(u8* pkmn, u8 val) { pkmn[0xDC] = val; } +u8 getHPType(u8* pkmn) { return 15 * ((getIV(pkmn, 0)& 1) + 2 * (getIV(pkmn, 1) & 1) + 4 * (getIV(pkmn, 2) & 1) + 8 * (getIV(pkmn, 3) & 1) + 16 * (getIV(pkmn, 4) & 1) + 32 * (getIV(pkmn, 5) & 1)) / 63; } + +u16 getEggMove(u8 *pkmn, const int nmove) { + u16 eggmovebuffer[4]; + memcpy(&eggmovebuffer, &pkmn[EGGMOVEPOS], EGGMOVELENGTH*4); + return eggmovebuffer[nmove]; +} + +u16 getStat(u8* pkmn, const int stat) { + u8 vett[] = {0x0, 0x1, 0x2, 0x4, 0x5, 0x3}; + u16 tempspecies = getPokedexNumber(pkmn); + if (getForm(pkmn)) + memcpy(&tempspecies, &personal.pkmData[getPokedexNumber(pkmn)][0x1C], 2); + + u16 final; + u8 mult = 10; + u8 basestat = personal.pkmData[tempspecies][vett[stat]]; + + if (stat == 0) final = 10 + ((2 * basestat) + getIV(pkmn, stat) + getEV(pkmn, stat) / 4 + 100) * getLevel(pkmn) / 100; + else final = 5 + (2 * basestat + getIV(pkmn, stat) + getEV(pkmn, stat) / 4) * getLevel(pkmn) / 100; + + if (getNature(pkmn) / 5 + 1 == stat) mult++; + if (getNature(pkmn) % 5 + 1 == stat) mult--; + + final = final * mult / 10; + return final; +} + +bool isInfected (u8* pkmn) { + u8 pkrs; + memcpy(&pkrs, &pkmn[0x2B], 1); + pkrs = pkrs >> 4; + return pkrs > 0; +} + +char *getOT(u8* pkmn, char* dst) { + u16 src[OTNAMELENGTH]; + memcpy(src, &pkmn[OTNAMEPOS], OTNAMELENGTH); + + int cnt = 0; + while (src[cnt] && cnt < 24) { + dst[cnt] = src[cnt]; + cnt += 1; + } + dst[cnt] = 0; + return dst; +} + +char *getNickname(u8* pkmn, char* dst) { + u16 src[NICKNAMELENGTH]; + memcpy(src, &pkmn[NICKNAMEPOS], NICKNAMELENGTH); + + int cnt = 0; + while (src[cnt] && cnt < NICKNAMELENGTH) { + dst[cnt] = src[cnt]; + cnt += 1; + } + dst[cnt] = 0; + return dst; +} + +u8 getLevel(u8* pkmn) { + u32 exp; + u8 xpType = personal.pkmData[getPokedexNumber(pkmn)][0x15]; + u8 iterLevel = 1; + memcpy(&exp, &pkmn[EXPPOINTPOS], EXPPOINTLENGTH); + + while (iterLevel < 100 && exp >= expTable[iterLevel][xpType]) iterLevel++; + return iterLevel; +} + +u16 getMove(u8* pkmn, int nmove) { + u16 movebuffer[4]; + memcpy(&movebuffer, &pkmn[MOVEPOS], MOVELENGTH*4); + return movebuffer[nmove]; +} + +u16 getOTID(u8* pkmn) { + u16 otidbuffer; + memcpy(&otidbuffer, &pkmn[OTIDPOS], OTIDLENGTH); + return otidbuffer; +} + +u16 getSOTID(u8* pkmn) { + u16 sotidbuffer; + memcpy(&sotidbuffer, &pkmn[SOTIDPOS], SOTIDLENGTH); + return sotidbuffer; +} + +u32 getPID(u8* pkmn) { + u32 pidbuffer; + memcpy(&pidbuffer, &pkmn[PIDPOS], PIDLENGTH); + return pidbuffer; +} + +u16 getTSV(u8* pkmn) { + u16 TID = getOTID(pkmn); + u16 SID = getSOTID(pkmn); + return (TID ^ SID) >> 4; +} + +u16 getPokedexNumber(u8* pkmn) { + u16 pokedexnumber; + memcpy(&pokedexnumber, &pkmn[POKEDEXNUMBERPOS], POKEDEXNUMBERLENGTH); + return pokedexnumber; +} + +u8 getFriendship(u8* pkmn) { + u8 friendship; + memcpy(&friendship, &pkmn[0xA2], 1); + return friendship; +} + +u8 getNature(u8* pkmn) { + u8 nature; + memcpy(&nature, &pkmn[NATUREPOS], NATURELENGTH); + return nature; +} + +u8 getEV(u8* pkmn, const int stat) { + u8 evbuffer[6]; + memcpy(evbuffer, &pkmn[EVPOS], EVLENGTH * 6); + return evbuffer[stat]; +} + +u8 getIV(u8* pkmn, const int stat) { + u32 buffer; + u8 toreturn; + + memcpy(&buffer, &pkmn[IVPOS], IVLENGTH); + buffer = buffer >> 5 * stat; + buffer = buffer & 0x1F; + memcpy(&toreturn, &buffer, 1); + return toreturn; +} + +bool getPokerus(u8* pkmn) { + u8 pkrs; + memcpy(&pkrs, &pkmn[0x2B], 1); + return pkrs; +} + +u32 getMoney(u8* mainbuf, int game) { + u32 money; + memcpy(&money, &mainbuf[(game < 4) ? 0x4208 : 0x4004], sizeof(u32)); + return money; +} + +u16 getBP(u8* mainbuf, int game) { + u16 bp; + memcpy(&bp, &mainbuf[(game == GAME_X || game == GAME_Y) ? 0x423C : (game == GAME_OR || game == GAME_AS) ? 0x4230 : 0x411D], sizeof(u16)); + return bp; +} + +u8 getBall(u8* pkmn) { + u8 ballbuffer; + memcpy(&ballbuffer, &pkmn[0xDC], 1); + + return ballbuffer; +} + +/* ************************ set ************************ */ + +void setItemEditor(u8* pkmn, u16 item) { + memcpy(&pkmn[ITEMPOS], &item, ITEMLENGTH); +} + +void setAbility(u8* pkmn, const u8 ability) { + u16 tempspecies = getPokedexNumber(pkmn); + if (getForm(pkmn)) + memcpy(&tempspecies, &personal.pkmData[getPokedexNumber(pkmn)][0x1C], 2); + + u8 abilitynum = 0; + if (ability == 0) abilitynum = 1; + else if (ability == 1) abilitynum = 2; + else abilitynum = 4; + + memcpy(&pkmn[ABILITYNUMPOS], &abilitynum, ABILITYNUMLENGTH); + memcpy(&pkmn[ABILITYPOS], &personal.pkmData[tempspecies][0x18 + ability], ABILITYLENGTH); +} + +void setMove(u8* pkmn, const u16 move, const int nmove) { + memcpy(&pkmn[MOVEPOS + (MOVELENGTH * nmove)], &move, MOVELENGTH); +} + +void setEggMove(u8* pkmn, const u16 move, const int nmove) { + memcpy(&pkmn[EGGMOVEPOS + (EGGMOVELENGTH * nmove)], &move, EGGMOVELENGTH); +} + +void setNickname(u8* pkmn, char* nick) { + u8 toinsert[NICKNAMELENGTH]; + memset(toinsert, 0, NICKNAMELENGTH); + + for (u16 i = 0, nicklen = strlen(nick); i < nicklen; i++) + toinsert[i * 2] = *(nick + i); + + memcpy(&pkmn[NICKNAMEPOS], toinsert, NICKNAMELENGTH); +} + +void setOT(u8* pkmn, char* nick) { + u8 toinsert[NICKNAMELENGTH]; + memset(toinsert, 0, NICKNAMELENGTH); + + for (u16 i = 0, nicklen = strlen(nick); i < nicklen; i++) + toinsert[i * 2] = *(nick + i); + + memcpy(&pkmn[OTNAMEPOS], toinsert, NICKNAMELENGTH); +} + +void setNature(u8* pkmn, const u8 nature) { + memcpy(&pkmn[NATUREPOS], &nature, NATURELENGTH); +} + +void setFriendship(u8* pkmn, const int val) { + memcpy(&pkmn[0xA2], &val, 1); + memcpy(&pkmn[0xCA], &val, 1); +} + +void setEV(u8* pkmn, u8 val, const int stat) { + memcpy(&pkmn[EVPOS+(EVLENGTH*stat)], &val, EVLENGTH); +} + +void setIV(u8* pkmn, u8 val, const int stat) { + u32 nval = val; + u32 mask = 0xFFFFFFFF; + mask ^= 0x1F << (5 * stat); + + u32 buffer; + memcpy(&buffer, &pkmn[IVPOS], IVLENGTH); + + buffer &= mask; + buffer ^= ((nval & 0x1F) << (5 * stat)); + memcpy(&pkmn[IVPOS], &buffer, IVLENGTH); +} + +void setHPType(u8* pkmn, const int val) { + u8 ivstat[6]; + for (int i = 0; i < 6; i++) + ivstat[i] = getIV(pkmn, i); + + u8 hpivs[16][6] = { + { 1, 1, 0, 0, 0, 0 }, // Fighting + { 0, 0, 0, 1, 0, 0 }, // Flying + { 1, 1, 0, 1, 0, 0 }, // Poison + { 1, 1, 1, 1, 0, 0 }, // Ground + { 1, 1, 0, 0, 1, 0 }, // Rock + { 1, 0, 0, 1, 1, 0 }, // Bug + { 1, 0, 1, 1, 1, 0 }, // Ghost + { 1, 1, 1, 1, 1, 0 }, // Steel + { 1, 0, 1, 0, 0, 1 }, // Fire + { 1, 0, 0, 1, 0, 1 }, // Water + { 1, 0, 1, 1, 0, 1 }, // Grass + { 1, 1, 1, 1, 0, 1 }, // Electric + { 1, 0, 1, 0, 1, 1 }, // Psychic + { 1, 0, 0, 1, 1, 1 }, // Ice + { 1, 0, 1, 1, 1, 1 }, // Dragon + { 1, 1, 1, 1, 1, 1 }, // Dark + }; + + for (int i = 0; i < 6; i++) + ivstat[i] = (ivstat[i] & 0x1E) + hpivs[val][i]; + + for (int i = 0; i < 6; i++) + setIV(pkmn, ivstat[i], i); +} + +void setShiny(u8* pkmn, const bool shiny) { + while(isShiny(pkmn) != shiny) + rerollPID(pkmn); +} + +void setLevel(u8* pkmn, int lv) { + u32 towrite = expTable[lv - 1][personal.pkmData[getPokedexNumber(pkmn)][0x15]]; + memcpy(&pkmn[EXPPOINTPOS], &towrite, EXPPOINTLENGTH); +} + +void setWC(u8* mainbuf, u8* wcbuf, int game, int i, int nInjected[]) { + if (game == GAME_X || game == GAME_Y) { + *(mainbuf + XYWC6FLAGPOS + i / 8) |= 0x1 << (i % 8); + memcpy((void*)(mainbuf + XYWC6POS + nInjected[0] * WC6LENGTH), (const void*)wcbuf, WC6LENGTH); + } + + if (game == GAME_OR || game == GAME_AS) { + *(mainbuf + ORASWC6FLAGPOS + i / 8) |= 0x1 << (i % 8); + memcpy((void*)(mainbuf + ORASWC6POS + nInjected[0] * WC6LENGTH), (const void*)wcbuf, WC6LENGTH); + + if (i == 2048) { + *(mainbuf + EONFLAGPOS) = 0xC2; + *(mainbuf + EONFLAGPOS + 1) = 0x73; + *(mainbuf + EONFLAGPOS + 2) = 0x5D; + *(mainbuf + EONFLAGPOS + 3) = 0x22; + } + } + + if (game == GAME_SUN || game == GAME_MOON) { + *(mainbuf + SMWC7FLAGPOS + i / 8) |= 0x1 << (i % 8); + memcpy((void*)(mainbuf + SMWC7POS + nInjected[0] * WC6LENGTH), (const void*)wcbuf, WC6LENGTH); + } + + if (game == GAME_B1 || game == GAME_W1 || game == GAME_B2 || game == GAME_W2) { + u32 seed; + memcpy(&seed, &mainbuf[BWSEEDPOS], sizeof(u32)); + + //decrypt + u16 temp; + for (int i = 0; i < 0xA90; i += 2) { + memcpy(&temp, &mainbuf[PGFSTARTPOS + i], 2); + temp ^= (LCRNG(seed) >> 16); + seed = LCRNG(seed); + memcpy(&mainbuf[PGFSTARTPOS + i], &temp, 2); + } + + *(mainbuf + PGFSTARTPOS + i / 8) |= 0x1 << (i & 7); + memcpy((void*)(mainbuf + 0x1C900 + nInjected[0] * PGFLENGTH), (const void*)wcbuf, PGFLENGTH); + + //encrypt + memcpy(&seed, &mainbuf[BWSEEDPOS], sizeof(u32)); + for (int i = 0; i < 0xA90; i += 2) { + memcpy(&temp, &mainbuf[PGFSTARTPOS + i], 2); + temp ^= (LCRNG(seed) >> 16); + seed = LCRNG(seed); + memcpy(&mainbuf[PGFSTARTPOS + i], &temp, 2); + } + } + + nInjected[0] += 1; + if (game < 4) { + if (nInjected[0] >= 24) + nInjected[0] = 0; + } else if (nInjected[0] >= 48) + nInjected[0] = 0; +} + +void setWC4(u8* mainbuf, u8* wcbuf, int game, int i, int nInjected[], int GBO) { + if (game == GAME_HG || game == GAME_SS) { + *(mainbuf + HGSSPGTFLAGPOS + GBO + (i >> 3)) |= 0x1 << (i & 7); + memcpy((void*)(mainbuf + HGSSPGTPOS + GBO + nInjected[0] * PGTLENGTH), (const void*)wcbuf, PGTLENGTH); + } + else if (game == GAME_PLATINUM) { + *(mainbuf + PTPGTFLAGPOS + GBO + (i >> 3)) |= 0x1 << (i & 7); + memcpy((void*)(mainbuf + PTPGTPOS + GBO + nInjected[0] * PGTLENGTH), (const void*)wcbuf, PGTLENGTH); + } + else if (game == GAME_DIAMOND || game == GAME_PEARL) { + *(mainbuf + DPPGTFLAGPOS + GBO + (i >> 3)) |= 0x1 << (i & 7); + memcpy((void*)(mainbuf + DPPGTPOS + GBO + nInjected[0] * PGTLENGTH), (const void*)wcbuf, PGTLENGTH); + } + + nInjected[0] += 1; + if (nInjected[0] >= 8) + nInjected[0] = 0; +} + +void setLanguage(u8* mainbuf, int game, int i) { + u8 langValues[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x07, 0x08, 0x09, 0x0A}; + memcpy(&mainbuf[(game < 4) ? 0x1402D : 0x1235], &langValues[i], sizeof(u8)); +} + +void setMoney(u8* mainbuf, int game, u32 money) { + memcpy(&mainbuf[(game < 4) ? 0x4208 : 0x4004], &money, sizeof(u32)); +} + +void setItem(u8* mainbuf, int type, int game) { + if (game == GAME_OR || game == GAME_AS) { + char* paths[] = {"romfs:/misc/oras/base.bin", "romfs:/misc/oras/heals.bin", "romfs:/misc/oras/berries.bin"}; + u32 offset[] = { 0x400, 0xD72, 0xE70 }; + injectFromFile(mainbuf, paths[type], offset[type]); + } else if (game == GAME_X || game == GAME_Y) { + char* paths[] = {"romfs:/misc/xy/base.bin", "romfs:/misc/xy/heals.bin", "romfs:/misc/xy/berries.bin"}; + u32 offset[] = { 0x400, 0xD6A, 0xE68 }; + injectFromFile(mainbuf, paths[type], offset[type]); + } else if (game == GAME_SUN || game == GAME_MOON) { + + } +} + +void setBP(u8* mainbuf, int i, int game) { + const u32 offset[] = {0x423C, 0x423D, 0x4230, 0x4231, 0x411C, 0x411D}; + int type = 0; + + if (game == GAME_OR || game == GAME_AS) + type = 2; + else if (game == GAME_SUN || game == GAME_MOON) + type = 4; + + switch (i) { + case 0 : { + *(mainbuf + offset[type]) = 0x00; + *(mainbuf + offset[type + 1]) = 0x00; + break; + } + case 9999 : { + *(mainbuf + offset[type]) = 0x0F; + *(mainbuf + offset[type + 1]) = 0x27; + break; + } + } +} + +void setPokerus(u8* pkmn) { + *(pkmn + 0x2B) = POKERUS; +} + +void setTM(u8* mainbuf, int game) { + if (game == GAME_OR || game == GAME_AS) + injectFromFile(mainbuf, "romfs:/misc/oras/tm.bin", 0xBC0); + else if (game == GAME_X || game == GAME_Y) + injectFromFile(mainbuf, "romfs:/misc/xy/tm.bin", 0xBC0); + else if (game == GAME_SUN || game == GAME_MOON) + injectFromFile(mainbuf, "romfs:/misc/sm/tm.bin", 0x0); +} + +void saveFileEditor(u8* mainbuf, int game) { + int currentEntry = 0; + int langCont = 0; + + while(aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_DUP) { + if (currentEntry > 0) + currentEntry--; + else if (currentEntry == 0) + currentEntry = 9; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (currentEntry < 9) + currentEntry++; + else if (currentEntry == 9) + currentEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (currentEntry >= 5) + currentEntry -= 5; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (currentEntry <= 4) + currentEntry += 5; + } + + if (hidKeysDown() & KEY_A) { + switch (currentEntry) { + case 0 : { + int langMax = (game < 4) ? 6 : 8; + if (langCont < langMax) langCont++; + else if (langCont == langMax) langCont = 0; + break; + } + } + } + + if (hidKeysDown() & KEY_START) { + switch (currentEntry) { + case 0 : { + setLanguage(mainbuf, game, langCont); + infoDisp("Language set successfully!"); + break; + } + case 1 : { + if (game < 4) { + setItem(mainbuf, 1, game); + infoDisp("Heals injected successfully!"); + } else + infoDisp("Not currently available for SM"); + break; + } + case 2 : { + if (game < 4) { + setItem(mainbuf, 0, game); + infoDisp("Items injected successfully!"); + } else + infoDisp("Not currently available for SM"); + break; + } + case 3 : { + if (game < 4) { + setItem(mainbuf, 2, game); + infoDisp("Berries set successfully!"); + } else + infoDisp("Not currently available for SM"); + break; + } + case 4 : { + if (game < 4) { + setTM(mainbuf, game); + infoDisp("TMs set successfully!"); + } else + infoDisp("Not currently available for SM"); + break; + } + case 5 : { + int start = 0; + int wcmax = (game < 4) ? 24 : 48; + if (game == GAME_X || game == GAME_Y) + start = XYWC6FLAGPOS; + else if (game == GAME_OR || game == GAME_AS) + start = ORASWC6FLAGPOS; + else if (game == GAME_SUN || game == GAME_MOON) + start = SMWC7FLAGPOS; + + for (int i = 0; i < (0x100 + wcmax * WC6LENGTH); i++) + *(mainbuf + start + i) = 0x00; + infoDisp("Mistery Gift box cleaned!"); + break; + } + } + } + + printEditor(mainbuf, game, currentEntry, langCont); + } +} + +void pokemonEditor(u8* mainbuf, int game) { + int lookup[] = {0, 1, 2, 4, 5, 3}; + + bool isTeam = false; + bool speedy = false; + int box = 0; + int currentEntry = 0; + int menuEntry = 0; + int boxmax = (game < 4) ? 30 : 31; + int ability = 2; + + u8* pkmn = (u8*)malloc(PKMNLENGTH * sizeof(u8)); + + while (aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_R) { + if (box < boxmax) + box++; + else if (box == boxmax) + box = 0; + } + + if (hidKeysDown() & KEY_L) { + if (box > 0) + box--; + else if (box == 0) + box = boxmax; + } + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 210 && touch.px < 320 && touch.py > 0 && touch.py < 210) { + currentEntry = 0; + isTeam = true; + } + if (touch.px > 0 && touch.px < 210 && touch.py > 0 && touch.py < 210) { + currentEntry = 0; + isTeam = false; + } + + if (touch.px > 7 && touch.px < 23 && touch.py > 17 && touch.py < 37) { + if (box > 0) + box--; + else if (box == 0) + box = boxmax; + } + if (touch.px > 185 && touch.px < 201 && touch.py > 17 && touch.py < 37) { + if (box < boxmax) + box++; + else if (box == boxmax) + box = 0; + } + if (touch.px > 280 && touch.px < 318 && touch.py > 210 && touch.py < 240) + break; + } + + if (hidKeysDown() & KEY_DRIGHT && !isTeam) { + if (currentEntry < 29) + currentEntry++; + else if (currentEntry == 29) + currentEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT && !isTeam) { + if (currentEntry > 0) + currentEntry--; + else if (currentEntry == 0) + currentEntry = 29; + } + + if (hidKeysDown() & KEY_DUP) { + if (!isTeam) { + if (currentEntry >= 6) + currentEntry -= 6; + } else if (currentEntry > 0) + currentEntry--; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (!isTeam) { + if (currentEntry <= 23) + currentEntry += 6; + } else if (currentEntry < 5) + currentEntry++; + } + + if (hidKeysHeld() & KEY_TOUCH) { + if (!isTeam) { + if (touch.px > 4 && touch.px < 38 && touch.py > 45 && touch.py < 75) currentEntry = 0; + if (touch.px > 38 && touch.px < 72 && touch.py > 45 && touch.py < 75) currentEntry = 1; + if (touch.px > 72 && touch.px < 106 && touch.py > 45 && touch.py < 75) currentEntry = 2; + if (touch.px > 106 && touch.px < 140 && touch.py > 45 && touch.py < 75) currentEntry = 3; + if (touch.px > 140 && touch.px < 174 && touch.py > 45 && touch.py < 75) currentEntry = 4; + if (touch.px > 174 && touch.px < 208 && touch.py > 45 && touch.py < 75) currentEntry = 5; + if (touch.px > 4 && touch.px < 38 && touch.py > 75 && touch.py < 105) currentEntry = 6; + if (touch.px > 38 && touch.px < 72 && touch.py > 75 && touch.py < 105) currentEntry = 7; + if (touch.px > 72 && touch.px < 106 && touch.py > 75 && touch.py < 105) currentEntry = 8; + if (touch.px > 106 && touch.px < 140 && touch.py > 75 && touch.py < 105) currentEntry = 9; + if (touch.px > 140 && touch.px < 174 && touch.py > 75 && touch.py < 105) currentEntry = 10; + if (touch.px > 174 && touch.px < 208 && touch.py > 75 && touch.py < 105) currentEntry = 11; + if (touch.px > 4 && touch.px < 38 && touch.py > 105 && touch.py < 135) currentEntry = 12; + if (touch.px > 38 && touch.px < 72 && touch.py > 105 && touch.py < 135) currentEntry = 13; + if (touch.px > 72 && touch.px < 106 && touch.py > 105 && touch.py < 135) currentEntry = 14; + if (touch.px > 106 && touch.px < 140 && touch.py > 105 && touch.py < 135) currentEntry = 15; + if (touch.px > 140 && touch.px < 174 && touch.py > 105 && touch.py < 135) currentEntry = 16; + if (touch.px > 174 && touch.px < 208 && touch.py > 105 && touch.py < 135) currentEntry = 17; + if (touch.px > 4 && touch.px < 38 && touch.py > 135 && touch.py < 165) currentEntry = 18; + if (touch.px > 38 && touch.px < 72 && touch.py > 135 && touch.py < 165) currentEntry = 19; + if (touch.px > 72 && touch.px < 106 && touch.py > 135 && touch.py < 165) currentEntry = 20; + if (touch.px > 106 && touch.px < 140 && touch.py > 135 && touch.py < 165) currentEntry = 21; + if (touch.px > 140 && touch.px < 174 && touch.py > 135 && touch.py < 165) currentEntry = 22; + if (touch.px > 174 && touch.px < 208 && touch.py > 135 && touch.py < 165) currentEntry = 23; + if (touch.px > 4 && touch.px < 38 && touch.py > 165 && touch.py < 195) currentEntry = 24; + if (touch.px > 38 && touch.px < 72 && touch.py > 165 && touch.py < 195) currentEntry = 25; + if (touch.px > 72 && touch.px < 106 && touch.py > 165 && touch.py < 195) currentEntry = 26; + if (touch.px > 106 && touch.px < 140 && touch.py > 165 && touch.py < 195) currentEntry = 27; + if (touch.px > 140 && touch.px < 174 && touch.py > 165 && touch.py < 195) currentEntry = 28; + if (touch.px > 174 && touch.px < 208 && touch.py > 165 && touch.py < 195) currentEntry = 29; + } else { + if (touch.px > 214 && touch.px < 265 && touch.py > 40 && touch.py < 85) currentEntry = 0; + if (touch.px > 266 && touch.px < 317 && touch.py > 60 && touch.py < 105) currentEntry = 1; + if (touch.px > 214 && touch.px < 265 && touch.py > 85 && touch.py < 130) currentEntry = 2; + if (touch.px > 266 && touch.px < 317 && touch.py > 105 && touch.py < 150) currentEntry = 3; + if (touch.px > 214 && touch.px < 265 && touch.py > 130 && touch.py < 175) currentEntry = 4; + if (touch.px > 266 && touch.px < 317 && touch.py > 150 && touch.py < 195) currentEntry = 5; + } + } + + if (hidKeysDown() & KEY_A) { + getPkmn(mainbuf, (isTeam) ? 33 : box, currentEntry, pkmn, game); + bool operationDone = false; + + while (aptMainLoop() && getPokedexNumber(pkmn) && !operationDone) { + hidScanInput(); + hidTouchRead(&touch); + + printPKViewer(mainbuf, pkmn, isTeam, game, currentEntry, menuEntry, box, ED_MENU, speedy, 0); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_DUP) { + if (menuEntry > 0) + menuEntry--; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (menuEntry < 4) + menuEntry++; + } + + if (hidKeysHeld() & KEY_TOUCH) { + if (touch.px > 208 && touch.px < 317) { + if (touch.py > 42 && touch.py < 69) menuEntry = 0; + if (touch.py > 69 && touch.py < 96) menuEntry = 1; + if (touch.py > 96 && touch.py < 123) menuEntry = 2; + if (touch.py > 123 && touch.py < 150) menuEntry = 3; + if (touch.py > 150 && touch.py < 177) menuEntry = 4; + } + } + + if (hidKeysDown() & KEY_A) { + switch(menuEntry) { + case 0 : { + while(aptMainLoop() && !operationDone) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) { + operationDone = true; + break; + } + + if (hidKeysDown() & KEY_L) + speedy = false; + + if (hidKeysDown() & KEY_R) + speedy = true; + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 280 && touch.px < 318 && touch.py > 210 && touch.py < 240) + break; + + if (touch.px > 206 && touch.px < 317 && touch.py > 116 && touch.py < 143) { + while(aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_L) + speedy = false; + + if (hidKeysDown() & KEY_R) + speedy = true; + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 280 && touch.px < 318 && touch.py > 210 && touch.py < 240) + break; + if (touch.px > 291 && touch.px < 316 && touch.py > 175 && touch.py < 187) { + int hpEntry = 0; + while(aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_DRIGHT) + if (hpEntry < 15) + hpEntry++; + + if (hidKeysDown() & KEY_DLEFT) + if (hpEntry > 0) + hpEntry--; + + if (hidKeysDown() & KEY_DUP) + if (hpEntry >= 4) + hpEntry -= 4; + + if (hidKeysDown() & KEY_DDOWN) + if (hpEntry <= 11) + hpEntry += 4; + + if (hidKeysDown() & KEY_A) + setHPType(pkmn, (u8)hpEntry); + + printPKEditor(pkmn, game, speedy, hpEntry, 0, 0, ED_HIDDENPOWER); + } + } + } + + if (hidKeysDown() & KEY_TOUCH && !(speedy)) { + for (int i = 0; i < 6; i++) { + if (touch.px > 96 && touch.px < 109 && touch.py > 49 + i * 20 && touch.py < 62 + i * 20) + if (getIV(pkmn, lookup[i]) > 0) + setIV(pkmn, getIV(pkmn, lookup[i]) - 1, lookup[i]); + if (touch.px > 139 && touch.px < 152 && touch.py > 49 + i * 20 && touch.py < 62 + i * 20) + if (getIV(pkmn, lookup[i]) < 31) + setIV(pkmn, getIV(pkmn, lookup[i]) + 1, lookup[i]); + if (touch.px > 177 && touch.px < 190 && touch.py > 49 + i * 20 && touch.py < 62 + i * 20) + if (getEV(pkmn, lookup[i]) > 0) + setEV(pkmn, getEV(pkmn, lookup[i]) - 1, lookup[i]); + if (touch.px > 218 && touch.px < 231 && touch.py > 49 + i * 20 && touch.py < 62 + i * 20) { + if (getEV(pkmn, lookup[i]) < 252) { + int tot = 0; + for (int i = 0; i < 6; i++) + tot += getEV(pkmn, i); + if (tot < 508) + setEV(pkmn, getEV(pkmn, lookup[i]) + 1, lookup[i]); + } + } + } + } + + else if (hidKeysHeld() & KEY_TOUCH && speedy) { + for (int i = 0; i < 6; i++) { + if (touch.px > 96 && touch.px < 109 && touch.py > 49 + i * 20 && touch.py < 62 + i * 20) + if (getIV(pkmn, lookup[i]) > 0) + setIV(pkmn, getIV(pkmn, lookup[i]) - 1, lookup[i]); + if (touch.px > 139 && touch.px < 152 && touch.py > 49 + i * 20 && touch.py < 62 + i * 20) + if (getIV(pkmn, lookup[i]) < 31) + setIV(pkmn, getIV(pkmn, lookup[i]) + 1, lookup[i]); + if (touch.px > 177 && touch.px < 190 && touch.py > 49 + i * 20 && touch.py < 62 + i * 20) + if (getEV(pkmn, lookup[i]) > 0) + setEV(pkmn, getEV(pkmn, lookup[i]) - 1, lookup[i]); + if (touch.px > 218 && touch.px < 231 && touch.py > 49 + i * 20 && touch.py < 62 + i * 20) { + if (getEV(pkmn, lookup[i]) < 252) { + int tot = 0; + for (int i = 0; i < 6; i++) + tot += getEV(pkmn, i); + if (tot < 508) + setEV(pkmn, getEV(pkmn, lookup[i]) + 1, lookup[i]); + } + } + } + } + + printPKEditor(pkmn, game, speedy, 0, 0, 0, ED_STATS); + } + } + + if (touch.px > 180 && touch.px < 195 && touch.py > 51 && touch.py < 63) { + int natureEntry = 0; + while(aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_DRIGHT) + if (natureEntry < 24) + natureEntry++; + + if (hidKeysDown() & KEY_DLEFT) + if (natureEntry > 0) + natureEntry--; + + if (hidKeysDown() & KEY_DUP) + if (natureEntry >= 5) + natureEntry -= 5; + + if (hidKeysDown() & KEY_DDOWN) + if (natureEntry <= 19) + natureEntry += 5; + + if (hidKeysDown() & KEY_A) + setNature(pkmn, natureEntry); + + printPKEditor(pkmn, game, speedy, natureEntry, 0, 0, ED_NATURES); + } + } + + if (touch.px > 0 && touch.px < 26 && touch.py > 0 && touch.py < 20) { + int ballEntry = 0; + while(aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_DRIGHT) + if (ballEntry < 25) + ballEntry++; + + if (hidKeysDown() & KEY_DLEFT) + if (ballEntry > 0) + ballEntry--; + + if (hidKeysDown() & KEY_DUP) + if (ballEntry >= 6) + ballEntry -= 6; + + if (hidKeysDown() & KEY_DDOWN) + if (ballEntry <= 19) + ballEntry += 6; + + if (hidKeysDown() & KEY_A) + setBall(pkmn, (u8)ballEntry + 1); + + printPKEditor(pkmn, game, speedy, ballEntry, 0, 0, ED_BALLS); + } + } + + if (touch.px > 180 && touch.px < 195 && touch.py > 71 && touch.py < 83) { + if (ability < 2) + ability++; + else if (ability == 2) + ability = 0; + setAbility(pkmn, ability); + } + + if (touch.px > 156 && touch.px < 174 && touch.py > 0 && touch.py < 20) { + if (getGender(pkmn) != 2) + setGender(pkmn, ((getGender(pkmn) == 0) ? 1 : 0)); + } + + if (touch.px > 180 && touch.px < 195 && touch.py > 111 && touch.py < 123) { + if (isShiny(pkmn)) + setShiny(pkmn, false); + else + setShiny(pkmn, true); + } + + if (touch.px > 180 && touch.px < 195 && touch.py > 131 && touch.py < 143) { + if (!(getPokerus(pkmn))) + setPokerus(pkmn); + else + *(pkmn + 0x2B) = 0x00; + } + + if (touch.px > 180 && touch.px < 195 && touch.py > 171 && touch.py < 183) { + static SwkbdState swkbd; + static char buf[60]; + + SwkbdButton button = SWKBD_BUTTON_NONE; + swkbdInit(&swkbd, SWKBD_TYPE_NORMAL, 2, (NICKNAMELENGTH / 2) - 1); + swkbdSetButton(&swkbd, SWKBD_BUTTON_LEFT, "Cancel", false); + swkbdSetButton(&swkbd, SWKBD_BUTTON_RIGHT, "Set", true); + swkbdSetValidation(&swkbd, SWKBD_NOTEMPTY_NOTBLANK, SWKBD_FILTER_DIGITS | SWKBD_FILTER_AT | SWKBD_FILTER_PERCENT | SWKBD_FILTER_BACKSLASH | SWKBD_FILTER_PROFANITY, 2); + swkbdSetFeatures(&swkbd, SWKBD_MULTILINE); + swkbdSetHintText(&swkbd, "Enter your nickname"); + button = swkbdInputText(&swkbd, buf, sizeof(buf)); + + static char nick[NICKNAMELENGTH]; + for (int i = 0; i < NICKNAMELENGTH; i++) + nick[i] = 0; + memcpy(nick, buf, NICKNAMELENGTH); + nick[NICKNAMELENGTH - 1] = '\0'; + + if (button != SWKBD_BUTTON_NONE) + setNickname(pkmn, nick); + } + + if (touch.px > 180 && touch.px < 195 && touch.py > 151 && touch.py < 163) { + static SwkbdState swkbd; + static char buf[60]; + + SwkbdButton button = SWKBD_BUTTON_NONE; + swkbdInit(&swkbd, SWKBD_TYPE_NORMAL, 2, (NICKNAMELENGTH / 2) - 1); + swkbdSetButton(&swkbd, SWKBD_BUTTON_LEFT, "Cancel", false); + swkbdSetButton(&swkbd, SWKBD_BUTTON_RIGHT, "Set", true); + swkbdSetValidation(&swkbd, SWKBD_NOTEMPTY_NOTBLANK, SWKBD_FILTER_DIGITS | SWKBD_FILTER_AT | SWKBD_FILTER_PERCENT | SWKBD_FILTER_BACKSLASH | SWKBD_FILTER_PROFANITY, 2); + swkbdSetFeatures(&swkbd, SWKBD_MULTILINE); + swkbdSetHintText(&swkbd, "Enter your OT name"); + button = swkbdInputText(&swkbd, buf, sizeof(buf)); + + static char nick[NICKNAMELENGTH]; + for (int i = 0; i < NICKNAMELENGTH; i++) + nick[i] = 0; + memcpy(nick, buf, NICKNAMELENGTH); + nick[NICKNAMELENGTH - 1] = '\0'; + + if (button != SWKBD_BUTTON_NONE) + setOT(pkmn, nick); + } + + if (touch.px > 206 && touch.px < 315 && touch.py > 170 && touch.py < 197) { + setPkmn(mainbuf, (isTeam) ? 33 : box, currentEntry, pkmn, game); + operationDone = true; + break; + } + + if (touch.px > 206 && touch.px < 317 && touch.py > 143 && touch.py < 170) { + int movesSorted[] = {0, 71, 709, 51, 151, 628, 629, 491, 512, 367, 332, 177, 495, 97, 314, 403, 624, 625, 502, 133, 677, 246, 453, 392, 401, 292, 312, 597, 274, 372, 310, 454, 213, 396, 62, 694, 475, 419, 608, 661, 140, 112, 226, 690, 251, 562, 187, 516, 117, 20, 44, 654, 655, 307, 299, 59, 335, 644, 645, 551, 34, 550, 125, 198, 155, 586, 340, 413, 622, 623, 280, 362, 693, 145, 61, 450, 405, 339, 523, 418, 331, 682, 347, 293, 445, 658, 606, 268, 451, 204, 448, 498, 509, 128, 691, 499, 370, 489, 4, 590, 109, 93, 132, 632, 633, 160, 176, 383, 687, 638, 639, 322, 538, 178, 68, 343, 152, 578, 238, 440, 242, 306, 462, 174, 15, 399, 464, 663, 605, 455, 111, 432, 194, 197, 652, 653, 591, 91, 50, 574, 435, 291, 146, 353, 458, 24, 3, 104, 38, 434, 620, 225, 337, 349, 692, 406, 82, 407, 525, 409, 577, 138, 65, 529, 530, 223, 414, 89, 497, 598, 121, 604, 582, 486, 527, 373, 52, 227, 283, 203, 412, 494, 284, 153, 326, 702, 245, 263, 587, 584, 252, 313, 206, 297, 364, 185, 565, 552, 515, 126, 424, 680, 519, 7, 83, 660, 90, 175, 481, 488, 172, 53, 394, 148, 430, 260, 705, 374, 666, 579, 19, 560, 411, 116, 264, 266, 395, 193, 571, 492, 553, 573, 338, 524, 218, 31, 210, 154, 559, 558, 248, 380, 544, 674, 703, 601, 202, 416, 646, 647, 549, 137, 447, 520, 320, 580, 356, 45, 74, 288, 470, 385, 698, 12, 441, 16, 360, 258, 359, 603, 106, 114, 543, 457, 29, 215, 377, 456, 505, 361, 531, 391, 535, 257, 484, 270, 506, 237, 667, 136, 610, 607, 468, 30, 32, 532, 336, 542, 308, 56, 642, 643, 63, 158, 304, 621, 593, 95, 301, 58, 554, 423, 665, 8, 420, 556, 333, 196, 286, 510, 517, 640, 641, 611, 275, 689, 569, 334, 442, 231, 449, 26, 2, 134, 588, 282, 616, 673, 387, 436, 348, 437, 536, 670, 141, 73, 43, 122, 617, 113, 710, 199, 142, 67, 490, 381, 461, 679, 295, 183, 277, 478, 345, 463, 443, 393, 602, 222, 696, 561, 382, 212, 96, 72, 25, 5, 224, 262, 368, 232, 319, 309, 118, 208, 102, 170, 107, 357, 243, 119, 429, 54, 296, 581, 585, 714, 236, 234, 426, 341, 300, 189, 330, 718, 595, 417, 363, 267, 717, 302, 636, 637, 539, 101, 400, 171, 568, 609, 613, 697, 190, 316, 466, 618, 200, 315, 220, 570, 575, 6, 371, 64, 195, 572, 80, 566, 42, 589, 583, 365, 305, 139, 398, 77, 40, 342, 676, 1, 600, 181, 408, 471, 384, 379, 681, 438, 612, 619, 217, 711, 182, 60, 244, 94, 706, 678, 354, 427, 375, 473, 540, 149, 701, 386, 685, 228, 511, 98, 501, 483, 99, 476, 240, 229, 75, 534, 13, 105, 278, 115, 513, 287, 547, 156, 514, 216, 686, 279, 179, 46, 459, 350, 431, 397, 157, 249, 88, 317, 439, 272, 27, 205, 355, 563, 496, 221, 533, 219, 28, 328, 201, 634, 635, 503, 184, 10, 103, 545, 290, 548, 402, 465, 69, 120, 247, 708, 421, 467, 325, 425, 159, 648, 649, 329, 504, 704, 508, 351, 659, 324, 318, 493, 47, 695, 166, 285, 130, 143, 507, 327, 303, 21, 163, 79, 214, 124, 188, 482, 479, 684, 265, 123, 108, 555, 289, 173, 487, 135, 76, 669, 49, 699, 460, 209, 664, 712, 683, 169, 131, 191, 596, 662, 255, 180, 150, 147, 671, 446, 592, 537, 211, 564, 254, 700, 23, 707, 444, 500, 480, 70, 668, 81, 165, 522, 78, 66, 164, 650, 651, 389, 241, 713, 162, 276, 48, 626, 627, 57, 207, 256, 186, 230, 129, 415, 14, 485, 235, 33, 294, 541, 39, 366, 36, 269, 715, 546, 630, 631, 298, 477, 100, 168, 614, 615, 37, 675, 87, 422, 9, 84, 86, 85, 321, 576, 259, 92, 390, 672, 144, 161, 271, 433, 567, 167, 688, 376, 41, 656, 657, 239, 369, 253, 557, 410, 599, 474, 11, 22, 233, 521, 344, 358, 55, 518, 352, 594, 346, 323, 127, 311, 250, 18, 469, 528, 261, 17, 273, 110, 472, 452, 526, 388, 35, 378, 404, 281, 192, 428, 716, 719}; + int moveEntry = 0; + int entryBottom = 0; + int page = 0, maxpages = 18; + + while (aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) break; + + if (hidKeysDown() & KEY_L) { + if (page > 0) page--; + else if (page == 0) page = maxpages - 1; + } + + if (hidKeysDown() & KEY_R) { + if (page < maxpages - 1) page++; + else if (page == maxpages - 1) page = 0; + } + + if (hidKeysDown() & KEY_DUP) { + if (moveEntry > 0) moveEntry--; + else if (moveEntry == 0) moveEntry = 39; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (moveEntry < 39) moveEntry++; + else if (moveEntry == 39) moveEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (moveEntry <= 19) { + page--; + if (page < 0) + page = maxpages - 1; + } + else if (moveEntry >= 20) moveEntry -= 20; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (moveEntry <= 19) moveEntry += 20; + else if (moveEntry >= 20) { + page++; + if (page > maxpages - 1) + page = 0; + } + } + + if (hidKeysHeld() & KEY_TOUCH) { + if (touch.px > 0 && touch.px < 198 && touch.py > 25 && touch.py < 45) entryBottom = 0; + if (touch.px > 0 && touch.px < 198 && touch.py > 45 && touch.py < 65) entryBottom = 1; + if (touch.px > 0 && touch.px < 198 && touch.py > 65 && touch.py < 85) entryBottom = 2; + if (touch.px > 0 && touch.px < 198 && touch.py > 85 && touch.py < 105) entryBottom = 3; + if (touch.px > 0 && touch.px < 198 && touch.py > 129 && touch.py < 149) entryBottom = 4; + if (touch.px > 0 && touch.px < 198 && touch.py > 149 && touch.py < 169) entryBottom = 5; + if (touch.px > 0 && touch.px < 198 && touch.py > 169 && touch.py < 189) entryBottom = 6; + if (touch.px > 0 && touch.px < 198 && touch.py > 189 && touch.py < 209) entryBottom = 7; + + if (touch.px > 280 && touch.px < 318 && touch.py > 210 && touch.py < 240) + break; + } + + if (hidKeysDown() & KEY_A) { + if (entryBottom < 4) + setMove(pkmn, movesSorted[moveEntry + page * 40], entryBottom); + else + setEggMove(pkmn, movesSorted[moveEntry + page * 40], entryBottom - 4); + } + + printPKEditor(pkmn, game, speedy, moveEntry, page, entryBottom, ED_MOVES); + } + } + + if (touch.px > 180 && touch.px < 195 && touch.py > 90 && touch.py < 102) { + int itemsSorted[] = {0, 645, 611, 674, 677, 545, 719, 135, 846, 703, 672, 667, 162, 541, 679, 803, 831, 755, 655, 658, 223, 18, 205, 468, 742, 104, 153, 640, 757, 21, 455, 199, 580, 668, 476, 723, 851, 770, 183, 43, 470, 852, 87, 581, 89, 296, 450, 713, 544, 491, 241, 68, 240, 281, 661, 664, 486, 472, 65, 535, 261, 73, 165, 654, 795, 145, 148, 144, 146, 147, 213, 558, 909, 787, 818, 118, 19, 49, 767, 48, 475, 591, 546, 249, 660, 678, 195, 149, 16, 150, 200, 119, 220, 287, 297, 189, 100, 224, 474, 569, 192, 444, 198, 635, 583, 698, 739, 740, 457, 175, 460, 461, 462, 572, 210, 96, 285, 562, 919, 617, 791, 822, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 109, 798, 826, 227, 226, 280, 721, 735, 738, 764, 56, 592, 615, 699, 7, 628, 629, 102, 116, 471, 311, 250, 561, 918, 235, 579, 790, 821, 312, 576, 636, 637, 324, 182, 13, 108, 305, 805, 833, 547, 322, 550, 915, 881, 779, 810, 700, 40, 34, 35, 208, 536, 860, 775, 726, 78, 38, 229, 538, 216, 268, 428, 793, 824, 715, 920, 435, 492, 138, 844, 553, 904, 782, 813, 159, 548, 912, 82, 777, 808, 842, 303, 273, 298, 539, 64, 556, 905, 785, 816, 230, 275, 841, 30, 497, 27, 316, 23, 440, 756, 202, 683, 657, 502, 656, 568, 560, 910, 789, 820, 763, 728, 796, 446, 98, 466, 623, 624, 625, 551, 914, 780, 811, 884, 3, 488, 263, 75, 137, 173, 286, 112, 555, 907, 784, 815, 95, 634, 55, 676, 197, 238, 14, 36, 565, 93, 284, 495, 101, 680, 420, 421, 422, 423, 424, 425, 737, 641, 714, 172, 94, 702, 666, 45, 25, 163, 552, 20, 917, 849, 302, 781, 812, 282, 799, 827, 141, 308, 697, 47, 278, 313, 612, 613, 211, 532, 710, 433, 675, 196, 190, 687, 170, 773, 730, 731, 732, 733, 221, 279, 206, 684, 685, 42, 255, 85, 234, 32, 705, 154, 725, 493, 574, 201, 270, 236, 269, 616, 142, 533, 712, 429, 768, 479, 496, 673, 319, 231, 256, 157, 648, 708, 453, 494, 136, 11, 718, 481, 215, 458, 741, 323, 242, 161, 176, 706, 682, 688, 802, 830, 1, 681, 41, 39, 24, 77, 29, 301, 627, 665, 747, 750, 744, 716, 766, 746, 717, 745, 696, 748, 749, 454, 219, 758, 233, 257, 729, 751, 771, 772, 774, 277, 806, 834, 662, 663, 209, 307, 239, 883, 33, 498, 858, 81, 266, 566, 484, 243, 166, 8, 6, 246, 178, 564, 776, 807, 92, 452, 184, 314, 111, 103, 439, 54, 445, 155, 631, 110, 743, 437, 180, 22, 459, 500, 480, 575, 185, 193, 88, 582, 151, 630, 156, 204, 501, 762, 794, 825, 835, 836, 168, 489, 855, 262, 671, 644, 633, 573, 449, 432, 245, 554, 906, 783, 814, 4, 63, 651, 431, 577, 724, 169, 17, 293, 292, 290, 289, 271, 291, 695, 294, 53, 51, 12, 571, 800, 828, 537, 765, 642, 843, 578, 880, 321, 46, 557, 916, 882, 786, 817, 320, 856, 171, 15, 217, 274, 177, 504, 483, 106, 50, 152, 326, 327, 164, 325, 485, 542, 441, 67, 853, 534, 478, 260, 72, 588, 584, 590, 586, 585, 589, 587, 9, 79, 143, 614, 567, 638, 37, 28, 652, 850, 187, 543, 559, 315, 908, 788, 819, 540, 643, 99, 318, 686, 212, 139, 430, 456, 736, 754, 647, 44, 5, 650, 711, 203, 769, 727, 753, 670, 232, 254, 436, 434, 467, 464, 709, 244, 759, 295, 253, 632, 107, 70, 71, 117, 191, 251, 222, 482, 158, 105, 306, 760, 473, 228, 283, 804, 832, 649, 31, 237, 722, 218, 225, 845, 247, 179, 299, 310, 499, 448, 689, 477, 97, 91, 90, 207, 563, 911, 792, 823, 761, 259, 288, 309, 463, 734, 704, 451, 857, 80, 26, 76, 447, 653, 752, 134, 570, 174, 194, 801, 829, 879, 140, 258, 83, 503, 10, 86, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 694, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 618, 619, 620, 690, 691, 692, 693, 701, 442, 272, 304, 707, 248, 669, 2, 469, 252, 659, 465, 443, 186, 720, 549, 913, 84, 778, 809, 181, 317, 639, 167, 646, 490, 69, 214, 265, 160, 267, 438, 60, 598, 604, 610, 57, 597, 603, 609, 58, 596, 602, 608, 61, 594, 600, 606, 62, 595, 601, 607, 59, 593, 599, 605, 621, 626, 188, 487, 66, 854, 264, 74, 797, 300, 52, 276, 847, 113, 114, 115, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 426, 427, 622, 837, 838, 839, 840, 848, 859, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903}; + int itemEntry = 0; + int page = 0, maxpages = 23; + + while (aptMainLoop()) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_TOUCH && touch.px > 280 && touch.px < 318 && touch.py > 210 && touch.py < 240) + break; + + if (hidKeysDown() & KEY_B) break; + + if (hidKeysDown() & KEY_L) { + if (page > 0) page--; + else if (page == 0) page = maxpages - 1; + } + + if (hidKeysDown() & KEY_R) { + if (page < maxpages - 1) page++; + else if (page == maxpages - 1) page = 0; + } + + if (hidKeysDown() & KEY_DUP) { + if (itemEntry > 0) itemEntry--; + else if (itemEntry == 0) itemEntry = 39; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (itemEntry < 39) itemEntry++; + else if (itemEntry == 39) itemEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (itemEntry <= 19) { + page--; + if (page < 0) + page = maxpages - 1; + } + else if (itemEntry >= 20) itemEntry -= 20; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (itemEntry <= 19) itemEntry += 20; + else if (itemEntry >= 20) { + page++; + if (page > maxpages - 1) + page = 0; + } + } + + if (hidKeysDown() & KEY_A) + setItemEditor(pkmn, itemsSorted[itemEntry + page * 40]); + + printPKEditor(pkmn, game, speedy, itemEntry, page, 0, ED_ITEMS); + } + } + } + + if ((hidKeysDown() & KEY_TOUCH) && !(speedy)) { + if (touch.px > 180 && touch.px < 193 && touch.py > 29 && touch.py < 42) { + if (getLevel(pkmn) < 100) + setLevel(pkmn, getLevel(pkmn) + 1); + else if (getLevel(pkmn) == 100) + setLevel(pkmn, 1); + } + + if (touch.px > 137 && touch.px < 150 && touch.py > 29 && touch.py < 42) { + if (getLevel(pkmn) > 1) + setLevel(pkmn, getLevel(pkmn) - 1); + else if (getLevel(pkmn) == 1) + setLevel(pkmn, 100); + } + + if (touch.px > 137 && touch.px < 150 && touch.py > 189 && touch.py < 202) { + if (getFriendship(pkmn) > 0) + setFriendship(pkmn, getFriendship(pkmn) - 1); + } + + if (touch.px > 180&& touch.px < 193 && touch.py > 189 && touch.py < 202) { + if (getFriendship(pkmn) < 255) + setFriendship(pkmn, getFriendship(pkmn) + 1); + } + } + + if ((hidKeysHeld() & KEY_TOUCH) && speedy) { + if (touch.px > 180 && touch.px < 193 && touch.py > 29 && touch.py < 42) { + if (getLevel(pkmn) < 100) + setLevel(pkmn, getLevel(pkmn) + 1); + else if (getLevel(pkmn) == 100) + setLevel(pkmn, 1); + } + + if (touch.px > 137 && touch.px < 150 && touch.py > 29 && touch.py < 42) { + if (getLevel(pkmn) > 1) + setLevel(pkmn, getLevel(pkmn) - 1); + else if (getLevel(pkmn) == 1) + setLevel(pkmn, 100); + } + + if (touch.px > 137 && touch.px < 150 && touch.py > 189 && touch.py < 202) { + if (getFriendship(pkmn) > 0) + setFriendship(pkmn, getFriendship(pkmn) - 1); + } + + if (touch.px > 180&& touch.px < 193 && touch.py > 189 && touch.py < 202) { + if (getFriendship(pkmn) < 255) + setFriendship(pkmn, getFriendship(pkmn) + 1); + } + } + + printPKEditor(pkmn, game, speedy, 0, 0, 0, ED_BASE); + } + break; + } + case 1 : { + isTeam = false; + currentEntry = 0; + while(aptMainLoop() && !operationDone) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_R) { + if (box < boxmax) + box++; + else if (box == boxmax) + box = 0; + } + + if (hidKeysDown() & KEY_L) { + if (box > 0) + box--; + else if (box == 0) + box = boxmax; + } + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 210 && touch.px < 320 && touch.py > 0 && touch.py < 210) { + currentEntry = 0; + isTeam = true; + } + if (touch.px > 0 && touch.px < 210 && touch.py > 0 && touch.py < 210) { + currentEntry = 0; + isTeam = false; + } + + if (touch.px > 7 && touch.px < 23 && touch.py > 17 && touch.py < 37) { + if (box > 0) + box--; + else if (box == 0) + box = boxmax; + } + if (touch.px > 185 && touch.px < 201 && touch.py > 17 && touch.py < 37) { + if (box < boxmax) + box++; + else if (box == boxmax) + box = 0; + } + if (touch.px > 280 && touch.px < 318 && touch.py > 210 && touch.py < 240) + break; + } + + if (hidKeysDown() & KEY_DRIGHT && !isTeam) { + if (currentEntry < 29) + currentEntry++; + else if (currentEntry == 29) + currentEntry = 0; + } + + if (hidKeysDown() & KEY_DLEFT && !isTeam) { + if (currentEntry > 0) + currentEntry--; + else if (currentEntry == 0) + currentEntry = 29; + } + + if (hidKeysDown() & KEY_DUP) { + if (!isTeam) { + if (currentEntry >= 6) + currentEntry -= 6; + } else if (currentEntry > 0) + currentEntry--; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (!isTeam) { + if (currentEntry <= 23) + currentEntry += 6; + } else if (currentEntry < 5) + currentEntry++; + } + + if (hidKeysHeld() & KEY_TOUCH) { + if (!isTeam) { + if (touch.px > 4 && touch.px < 38 && touch.py > 45 && touch.py < 75) currentEntry = 0; + if (touch.px > 38 && touch.px < 72 && touch.py > 45 && touch.py < 75) currentEntry = 1; + if (touch.px > 72 && touch.px < 106 && touch.py > 45 && touch.py < 75) currentEntry = 2; + if (touch.px > 106 && touch.px < 140 && touch.py > 45 && touch.py < 75) currentEntry = 3; + if (touch.px > 140 && touch.px < 174 && touch.py > 45 && touch.py < 75) currentEntry = 4; + if (touch.px > 174 && touch.px < 208 && touch.py > 45 && touch.py < 75) currentEntry = 5; + if (touch.px > 4 && touch.px < 38 && touch.py > 75 && touch.py < 105) currentEntry = 6; + if (touch.px > 38 && touch.px < 72 && touch.py > 75 && touch.py < 105) currentEntry = 7; + if (touch.px > 72 && touch.px < 106 && touch.py > 75 && touch.py < 105) currentEntry = 8; + if (touch.px > 106 && touch.px < 140 && touch.py > 75 && touch.py < 105) currentEntry = 9; + if (touch.px > 140 && touch.px < 174 && touch.py > 75 && touch.py < 105) currentEntry = 10; + if (touch.px > 174 && touch.px < 208 && touch.py > 75 && touch.py < 105) currentEntry = 11; + if (touch.px > 4 && touch.px < 38 && touch.py > 105 && touch.py < 135) currentEntry = 12; + if (touch.px > 38 && touch.px < 72 && touch.py > 105 && touch.py < 135) currentEntry = 13; + if (touch.px > 72 && touch.px < 106 && touch.py > 105 && touch.py < 135) currentEntry = 14; + if (touch.px > 106 && touch.px < 140 && touch.py > 105 && touch.py < 135) currentEntry = 15; + if (touch.px > 140 && touch.px < 174 && touch.py > 105 && touch.py < 135) currentEntry = 16; + if (touch.px > 174 && touch.px < 208 && touch.py > 105 && touch.py < 135) currentEntry = 17; + if (touch.px > 4 && touch.px < 38 && touch.py > 135 && touch.py < 165) currentEntry = 18; + if (touch.px > 38 && touch.px < 72 && touch.py > 135 && touch.py < 165) currentEntry = 19; + if (touch.px > 72 && touch.px < 106 && touch.py > 135 && touch.py < 165) currentEntry = 20; + if (touch.px > 106 && touch.px < 140 && touch.py > 135 && touch.py < 165) currentEntry = 21; + if (touch.px > 140 && touch.px < 174 && touch.py > 135 && touch.py < 165) currentEntry = 22; + if (touch.px > 174 && touch.px < 208 && touch.py > 135 && touch.py < 165) currentEntry = 23; + if (touch.px > 4 && touch.px < 38 && touch.py > 165 && touch.py < 195) currentEntry = 24; + if (touch.px > 38 && touch.px < 72 && touch.py > 165 && touch.py < 195) currentEntry = 25; + if (touch.px > 72 && touch.px < 106 && touch.py > 165 && touch.py < 195) currentEntry = 26; + if (touch.px > 106 && touch.px < 140 && touch.py > 165 && touch.py < 195) currentEntry = 27; + if (touch.px > 140 && touch.px < 174 && touch.py > 165 && touch.py < 195) currentEntry = 28; + if (touch.px > 174 && touch.px < 208 && touch.py > 165 && touch.py < 195) currentEntry = 29; + } else { + if (touch.px > 214 && touch.px < 265 && touch.py > 40 && touch.py < 85) currentEntry = 0; + if (touch.px > 266 && touch.px < 317 && touch.py > 60 && touch.py < 105) currentEntry = 1; + if (touch.px > 214 && touch.px < 265 && touch.py > 85 && touch.py < 130) currentEntry = 2; + if (touch.px > 266 && touch.px < 317 && touch.py > 105 && touch.py < 150) currentEntry = 3; + if (touch.px > 214 && touch.px < 265 && touch.py > 130 && touch.py < 175) currentEntry = 4; + if (touch.px > 266 && touch.px < 317 && touch.py > 150 && touch.py < 195) currentEntry = 5; + } + } + if (hidKeysDown() & KEY_A) { + setPkmn(mainbuf, (isTeam) ? 33 : box, currentEntry, pkmn, game); + operationDone = true; + break; + } + + printPKViewer(mainbuf, pkmn, isTeam, game, currentEntry, menuEntry, box, ED_CLONE, speedy, 0); + } + break; + } + case 2 : { + if (isTeam) { + infoDisp("You can't release a team member!"); + break; + } + memset(pkmn, 0, PKMNLENGTH); + setPkmn(mainbuf, box, currentEntry, pkmn, game); + infoDisp("Changes applied!"); + operationDone = true; + break; + } + case 3 : { + int index = (int)getPokedexNumber(pkmn); + while(aptMainLoop() && !operationDone) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_L) + speedy = false; + + if (hidKeysDown() & KEY_R) + speedy = true; + + if (hidKeysDown() & KEY_TOUCH && !speedy) { + if (touch.px > 48 && touch.px < 64 && touch.py > 91 && touch.py < 210) + if (index > 1) + index--; + + if (touch.px > 145 && touch.px < 161 && touch.py > 91 && touch.py < 210) + if (index < ((game < 4) ? 721 : 802)) + index++; + } + + if (hidKeysHeld() & KEY_TOUCH && speedy) { + if (touch.px > 48 && touch.px < 64 && touch.py > 91 && touch.py < 210) + if (index > 1) + index--; + + if (touch.px > 145 && touch.px < 161 && touch.py > 91 && touch.py < 210) + if (index < ((game < 4) ? 721 : 802)) + index++; + } + + if (hidKeysDown() & KEY_A) { + FILE *fptr = fopen("romfs:/misc/living.bin", "rt"); + fseek(fptr, 0, SEEK_END); + u32 size = ftell(fptr); + u8* livingbuf = (u8*)malloc(size); + memset(livingbuf, 0, size); + rewind(fptr); + fread(livingbuf, size, 1, fptr); + fclose(fptr); + memcpy(&mainbuf[getPkmnAddress((isTeam)? 33 : box, currentEntry, game)], &livingbuf[(index - 1) * 232], 232); + free(livingbuf); + operationDone = true; + break; + } + + printPKViewer(mainbuf, pkmn, isTeam, game, currentEntry, menuEntry, box, ED_GENERATE, speedy, index); + } + break; + } + } + } + + if (hidKeysDown() & KEY_A && menuEntry == 4) + break; + } + if (!getPokedexNumber(pkmn)) { + int index = 1; + while(aptMainLoop() && !operationDone) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) + break; + + if (hidKeysDown() & KEY_L) + speedy = false; + + if (hidKeysDown() & KEY_R) + speedy = true; + + if (hidKeysDown() & KEY_TOUCH && !speedy) { + if (touch.px > 48 && touch.px < 64 && touch.py > 91 && touch.py < 210) + if (index > 1) + index--; + + if (touch.px > 145 && touch.px < 161 && touch.py > 91 && touch.py < 210) + if (index < ((game < 4) ? 721 : 802)) + index++; + } + + if (hidKeysHeld() & KEY_TOUCH && speedy) { + if (touch.px > 48 && touch.px < 64 && touch.py > 91 && touch.py < 210) + if (index > 1) + index--; + + if (touch.px > 145 && touch.px < 161 && touch.py > 91 && touch.py < 210) + if (index < ((game < 4) ? 721 : 802)) + index++; + } + + if (hidKeysDown() & KEY_A) { + FILE *fptr = fopen("romfs:/misc/living.bin", "rt"); + fseek(fptr, 0, SEEK_END); + u32 size = ftell(fptr); + u8* livingbuf = (u8*)malloc(size); + memset(livingbuf, 0, size); + rewind(fptr); + fread(livingbuf, size, 1, fptr); + fclose(fptr); + memcpy(&mainbuf[getPkmnAddress((isTeam)? 33 : box, currentEntry, game)], &livingbuf[(index - 1) * 232], 232); + free(livingbuf); + operationDone = true; + break; + } + + printPKViewer(mainbuf, pkmn, isTeam, game, currentEntry, menuEntry, box, ED_GENERATE, speedy, index); + } + } + } + printPKViewer(mainbuf, pkmn, isTeam, game, currentEntry, menuEntry, box, ED_STANDARD, speedy, 0); + } + free(pkmn); +} \ No newline at end of file diff --git a/source/editor.h b/source/editor.h new file mode 100644 index 000000000..cb4277e23 --- /dev/null +++ b/source/editor.h @@ -0,0 +1,130 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#pragma once + +#include <3ds.h> +#include + +#define PGTLENGTH 260 +#define PGFLENGTH 204 +#define WC6LENGTH 264 +#define PKMNLENGTH 232 +#define BOXMAX 31 +#define MOVELENGTH 2 +#define EGGMOVELENGTH 2 +#define EVLENGTH 1 +#define PIDLENGTH 4 +#define IVLENGTH 4 +#define OTIDLENGTH 2 +#define SOTIDLENGTH 2 +#define NICKNAMELENGTH 26 +#define POKEDEXNUMBERLENGTH 2 +#define ABILITYLENGTH 1 +#define ABILITYNUMLENGTH 1 +#define NATURELENGTH 1 +#define GENDERLENGTH 1 +#define ITEMLENGTH 2 +#define EXPPOINTLENGTH 4 + +#define ED_STANDARD 0 +#define ED_MENU 1 +#define ED_CLONE 2 +#define ED_GENERATE 3 + +#define ED_BASE 0 +#define ED_STATS 1 +#define ED_MOVES 2 +#define ED_ITEMS 3 +#define ED_NATURES 4 +#define ED_BALLS 5 +#define ED_HIDDENPOWER 6 + +struct { + u8 pkmData[961][56]; +} personal; + +u32 seedStep(const u32 seed); +u32 LCRNG(u32 seed); +void shuffleArray(u8* pkmn, const u32 encryptionkey); +void decryptPkmn(u8* pkmn); +int getPkmnAddress(const int boxnumber, const int indexnumber, int game); +void calculatePKMNChecksum(u8* data); +void encryptPkmn(u8* pkmn); +void getPkmn(u8* mainbuf, const int boxnumber, const int indexnumber, u8* pkmn, int game); +void setPkmn(u8* mainbuf, const int boxnumber, const int indexnumber, u8* pkmn, int game); +bool isShiny(u8* pkmn); +bool isEgg(u8* pkmn); +void rerollPID(u8* pkmn); +void encryptBattleSection(u8* mainbuf, u8* pkmn, int game, int currentEntry); +void fillBattleSection(u8* mainbuf, u8* pkmn, int game, int currentEntry); + +u8 getGender(u8* pkmn); +u8 getLanguage(u8* pkmn); +u16 getPokedexNumber(u8* pkmn); +u8 getNature(u8* pkmn); +u8 getEV(u8* pkmn, const int stat); +u8 getFriendship(u8* pkmn); +u8 getIV(u8* pkmn, const int stat); +u16 getOTID(u8* pkmn); +u16 getSOTID(u8* pkmn); +u32 getPID(u8* pkmn); +u16 getTSV(u8* pkmn); +u16 getMove(u8* pkmn, int nmove); +u16 getItem(u8* pkmn); +u8 getHPType(u8* pkmn); +u8 getLevel(u8* pkmn); +bool isInfected (u8* pkmn); +u8 getForm(u8* pkmn); +u16 getStat(u8* pkmn, const int stat); +bool getPokerus(u8* pkmn); +u8 getAbility(u8* pkmn); +char *getOT(u8* pkmn, char* dst); +char *getNickname(u8* pkmn, char* dst); +u16 getEggMove(u8 *pkmn, const int nmove); +u8 getBall(u8* pkmn); + +u32 getMoney(u8* mainbuf, int game); +u16 getBP(u8* mainbuf, int game); + +void setGender(u8* pkmn, u8 val); +void setOT(u8* pkmn, char* nick); +void setNature(u8* pkmn, const u8 nature); +void setNickname(u8* pkmn, char* nick); +void setShiny(u8* pkmn, const bool shiny); +void setWC(u8* mainbuf, u8* wc6buf, int game, int i, int nInjected[]); +void setWC4(u8* mainbuf, u8* wc6buf, int game, int i, int nInjected[], int GBO); +void setLanguage(u8* mainbuf, int game, int i); +void setMoney(u8* mainbuf, int game, u32 i); +void setItem(u8* mainbuf, int type, int game); +void setBP(u8* mainbuf, int i, int game); +void setTM(u8* mainbuf, int game); +void setFriendship(u8* pkmn, const int value); +void setEV(u8* pkmn, u8 val, const int stat); +void setHPType(u8* pkmn, const int val); +void setIV(u8* pkmn, u8 val, const int stat); +void setPokerus(u8* pkmn); +void setLevel(u8* pkmn, int lv); +void setMove(u8* pkmn, const u16 move, const int nmove); +void setEggMove(u8* pkmn, const u16 move, const int nmove); +void setItemEditor(u8* pkmn, u16 item); +void setBall(u8* pkmn, u8 val); + +void saveFileEditor(u8* mainbuf, int game); +void pokemonEditor(u8* mainbuf, int game); \ No newline at end of file diff --git a/source/fill.c b/source/fill.c new file mode 100644 index 000000000..386f57f2a --- /dev/null +++ b/source/fill.c @@ -0,0 +1,793 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include +#include "database.h" + +void filldatabase7(char *database[], int spriteArray[]) { + for (int j = 0; j < SMCOUNT; j++) { + database[j] = " "; + spriteArray[j] = -1; + } + + database[8] = "0008 - Lucky Egg"; spriteArray[8] = 0; + database[53] = "0053 - Nugget"; spriteArray[53] = 0; + database[54] = "0054 - Super Potions"; spriteArray[54] = 0; + database[55] = "0055 - Luxury Ball"; spriteArray[55] = 0; + database[56] = "0056 - Rare Candy"; spriteArray[56] = 0; + database[57] = "0057 - Master Ball"; spriteArray[57] = 0; + database[58] = "0058 - 12 Quick Balls"; spriteArray[58] = 0; + database[59] = "0059 - 100 Potions"; spriteArray[59] = 0; + database[60] = "0060 - 2 Master Balls"; spriteArray[60] = 0; + database[151] = "0151 - Scrap 5 Rare Candy"; spriteArray[151] = 0; + database[152] = "0152 - Scrap Masterball"; spriteArray[152] = 0; + database[157] = "0157 - Max Revive"; spriteArray[157] = 0; + database[158] = "0158 - Masterball"; spriteArray[158] = 0; + database[190] = "Placeholder"; + database[202] = "0202 - SM Revival Herb"; spriteArray[202] = 0; + database[205] = "0205 - SM Choice Band/Scarf"; spriteArray[205] = 0; + database[210] = "0210 - Gold Bottle Cap"; spriteArray[210] = 0; + database[518] = "0518 - Heracronite"; spriteArray[518] = 0; + database[527] = "0527 - 100 Potions"; spriteArray[527] = 0; + database[1022] = "1022 - 100 Potions"; spriteArray[1022] = 0; + database[1057] = "1057 - 50 Quick Balls"; spriteArray[1057] = 0; + database[1502] = "1502 - Quickballs"; spriteArray[1502] = 0; + database[1511] = "1511 - Rare Candy"; spriteArray[1511] = 0; + database[1602] = "1602 - SM Quick Balls"; spriteArray[1602] = 0; + database[1603] = "1603 - SM Poke Balls"; spriteArray[1603] = 0; + database[2040] = "2040 - SM Stardust"; spriteArray[2040] = 0; + database[2041] = "2041 - SM Star Piece"; spriteArray[2041] = 0; + database[2042] = "2042 - SM Nugget"; spriteArray[2042] = 0; + database[2043] = "2043 - SM Pretty Wings"; spriteArray[2043] = 0; + database[2044] = "2044 - SM Balm Mushroom"; spriteArray[2044] = 0; + database[2045] = "2045 - SM Comet Shard"; spriteArray[2045] = 0; + + + database[1] = "0001 - Birthday events"; spriteArray[1] = 133; + database[2] = "0002 - CoroCoro Garchomp"; spriteArray[2] = 445; + database[3] = "0003 - PC Tokyo Bay Inkay"; spriteArray[3] = 686; + database[4] = "0004 - Nuketta Wobbuffet"; spriteArray[4] = 202; + database[11] = "0011 - Alternate Event Garchomp"; spriteArray[11] = 445; + database[12] = "0012 - Eevee House Sylveon"; spriteArray[12] = 133; + database[15] = "0015 - CoroCoro Charizard X/Y"; spriteArray[15] = 6; + database[17] = "0017 - Garchomp"; spriteArray[17] = 445; + database[19] = "0019 - PC Scizor"; spriteArray[19] = 212; + database[20] = "0020 - PC Gengar"; spriteArray[20] = 94; + database[21] = "0021 - Darkrai"; spriteArray[21] = 491; + database[22] = "0022 - Diancie"; spriteArray[22] = 719; + database[25] = "0025 - M-Gyarados"; spriteArray[25] = 130; + database[26] = "0026 - M-Scizor"; spriteArray[26] = 212; + database[27] = "0027 - M-Kangaskhan"; spriteArray[27] = 115; + database[28] = "0028 - M-Gengar"; spriteArray[28] = 94; + database[29] = "0029 - M-Tyranitar"; spriteArray[29] = 248; + database[30] = "0030 - M-Mawile"; spriteArray[30] = 303; + database[33] = "0033 - Mega Kick Pikachu"; spriteArray[33] = 25; + database[34] = "0034 - Shiny Jirachi"; spriteArray[34] = 385; + database[37] = "0037 - Surf Incense Pikachu"; spriteArray[37] = 25; + database[38] = "0038 - Surf Air Balloon Pikachu"; spriteArray[38] = 25; + database[39] = "0039 - Surf, Shard Pikachu"; spriteArray[39] = 25; + database[40] = "0040 - Surf Focus Band Pikachu"; spriteArray[40] = 25; + database[41] = "0041 - Surf Silk Scarf Pikachu"; spriteArray[41] = 25; + database[42] = "0042 - Heart Stamp Pikachu"; spriteArray[42] = 25; + database[43] = "0043 - Charizard X/Y"; spriteArray[43] = 6; + database[44] = "0044 - Shiny Gengar"; spriteArray[44] = 94; + database[45] = "0045 - Tretta Rotom"; spriteArray[45] = 479; + database[46] = "0046 - Darkrai"; spriteArray[46] = 491; + database[47] = "0047 - Diancie"; spriteArray[47] = 719; + database[48] = "0048 - Birthday Events"; spriteArray[48] = 133; + database[49] = "0049 - Shiny Gengar"; spriteArray[49] = 94; + database[50] = "0050 - Pokescrap Shaymin"; spriteArray[50] = 492; + database[51] = "0051 - Pokescrap Keldeo"; spriteArray[51] = 647; + database[52] = "0052 - Pokescrap Victini"; spriteArray[52] = 494; + database[61] = "0061 - Shiny Jirachi"; spriteArray[61] = 385; + database[62] = "0062 - SSB4 Greninja"; spriteArray[62] = 658; + database[63] = "0063 - PC Piplup"; spriteArray[63] = 393; + database[64] = "0064 - PC Froakie"; spriteArray[64] = 656; + database[65] = "0065 - Shiny Charizard"; spriteArray[65] = 6; + database[66] = "0066 - Shiny Pikachu"; spriteArray[66] = 25; + database[67] = "0067 - Extremespeed Linoone"; spriteArray[67] = 264; + database[71] = "0071 - PC Eggs"; spriteArray[71] = 322; + database[78] = "0078 - Shiny Rayquaza"; spriteArray[78] = 384; + database[79] = "0079 - P-Cafe Pikachu"; spriteArray[79] = 25; + database[81] = "0081 - Movie Arceus"; spriteArray[81] = 493; + database[82] = "0082 - Movie Legends HA"; spriteArray[82] = 383; + database[83] = "0083 - Movie Hoopa"; spriteArray[83] = 720; + database[86] = "0086 - Serena's Fennekin"; spriteArray[86] = 653; + database[88] = "0088 - CoroCoro Rayquaza"; spriteArray[88] = 384; + database[89] = "0089 - Spring15 Kangaskhan"; spriteArray[89] = 115; + database[90] = "0090 - SG Shiny Rayquaza"; spriteArray[90] = 384; + database[94] = "0094 - PC Shiny Gyarados"; spriteArray[94] = 130; + database[95] = "0095 - Hiroshima PC Magikarp"; spriteArray[95] = 129; + database[96] = "0096 - Pokelab Bulbasaur"; spriteArray[96] = 1; + database[97] = "0097 - Pokelab Charmander"; spriteArray[97] = 4; + database[98] = "0098 - Pokelab Squirtle"; spriteArray[98] = 7; + database[99] = "0099 - 7/11 Pikachu"; spriteArray[99] = 25; + database[100] = "0100 - 7/11 Pancham"; spriteArray[100] = 674; + database[101] = "0101 - 7/11 Lugia"; spriteArray[101] = 249; + database[102] = "0102 - 7/11 Latios"; spriteArray[102] = 381; + database[107] = "0107 - Y.ama Shiny Pikachu"; spriteArray[107] = 25; + database[108] = "0108 - Tanabata 15 Jirachi"; spriteArray[108] = 385; + database[109] = "0109 - Satay King Pikachu"; spriteArray[109] = 25; + database[110] = "0110 - Manesh Hoopa"; spriteArray[110] = 720; + database[111] = "0111 - Shiny Xerneas, Yveltal"; spriteArray[111] = 716; + database[113] = "0113 - Zygarde"; spriteArray[113] = 718; + database[114] = "0114 - Expo Charizard"; spriteArray[114] = 6; + database[115] = "0115 - Expo Machamp"; spriteArray[115] = 68; + database[116] = "0116 - Expo Smeargle"; spriteArray[116] = 235; + database[117] = "0117 - Expo Zoroark"; spriteArray[117] = 571; + database[119] = "0119 - Nintendo HK Rayquaza"; spriteArray[119] = 384; + database[120] = "0120 - Universe Diancie"; spriteArray[120] = 719; + database[121] = "0121 - Birthday events"; spriteArray[121] = 133; + database[122] = "0122 - Halloween 2015 Pumpkaboo"; spriteArray[122] = 710; + database[127] = "0127 - Pokelab Chikorita"; spriteArray[127] = 152; + database[128] = "0128 - Pokelab Cyndaquil"; spriteArray[128] = 155; + database[129] = "0129 - Pokelab Totodile"; spriteArray[129] = 158; + database[130] = "0130 - WCS 2015 Shiny Tyranitar"; spriteArray[130] = 248; + database[131] = "0131 - PC Shiny Diancie"; spriteArray[131] = 719; + database[132] = "0132 - PC Al/Au/Sa/Lu/Sl"; spriteArray[132] = 334; + database[133] = "0133 - PC Al/Au/Sa/Lu/Sl"; spriteArray[133] = 531; + database[134] = "0134 - PC Al/Au/Sa/Lu/Sl"; spriteArray[134] = 448; + database[135] = "0135 - PC Al/Au/Sa/Lu/Sl"; spriteArray[135] = 80; + database[136] = "0136 - PC Al/Au/Sa/Lu/Sl"; spriteArray[136] = 302; + database[137] = "0137 - VC Mew"; spriteArray[137] = 151; + database[138] = "0138 - Happy Hour Pikachu"; spriteArray[138] = 25; + database[141] = "0141 - Repeat Halloween Gengar"; spriteArray[141] = 94; + database[145] = "0145 - HK Shiny Jirachi"; spriteArray[145] = 385; + database[146] = "0146 - SG Arceus"; spriteArray[146] = 493; + database[147] = "0147 - Scrap Eevee"; spriteArray[147] = 133; + database[148] = "0148 - Scrap Articuno"; spriteArray[148] = 144; + database[149] = "0149 - Scrap Zapdos"; spriteArray[149] = 145; + database[150] = "0150 - Scrap Moltres"; spriteArray[150] = 146; + database[153] = "0153 - Scrap Venusaur"; spriteArray[153] = 3; + database[154] = "0154 - Scrap Charizard"; spriteArray[154] = 6; + database[155] = "0155 - Scrap Blastoise"; spriteArray[155] = 9; + database[156] = "0156 - Scrap Mewtwo"; spriteArray[156] = 150; + database[159] = "0159 - Jade Infernape"; spriteArray[159] = 392; + database[161] = "0161 - Movie Volcanion"; spriteArray[161] = 721; + database[162] = "0162 - 720 Poll Greninja"; spriteArray[162] = 658; + database[163] = "0163 - Surf and Fly Pikachu"; spriteArray[163] = 25; + database[164] = "0164 - PC Shiny Ho-Oh"; spriteArray[164] = 250; + database[165] = "0165 - Masuda's Psyduck"; spriteArray[165] = 54; + database[166] = "0166 - Bestow Pikachu"; spriteArray[166] = 25; + database[167] = "0167 - Hyadain Landorus"; spriteArray[167] = 645; + database[168] = "0168 - Chymia's Gardevoir"; spriteArray[168] = 282; + database[169] = "0169 - Jarvis's Gengar"; spriteArray[169] = 94; + database[170] = "0170 - P-Cafe Pikachu (SG)"; spriteArray[170] = 25; + database[171] = "0171 - Skytree Shiny Rayquaza"; spriteArray[171] = 384; + database[173] = "0173 - HKTW VGC16 Shiny Mewtwo"; spriteArray[173] = 150; + database[174] = "0174 - Tanabata 2016 Jirachi"; spriteArray[174] = 385; + database[175] = "0175 - HKTW Mew"; spriteArray[175] = 151; + database[176] = "0176 - Poll Simisear"; spriteArray[176] = 514; + database[177] = "0177 - Giovanni's Nidoqueen"; spriteArray[177] = 31; + database[178] = "0178 - Maxie's Camerupt"; spriteArray[178] = 323; + database[179] = "0179 - Archie's Sharpedo"; spriteArray[179] = 319; + database[180] = "0180 - Cyrus' Weavile"; spriteArray[180] = 461; + database[181] = "0181 - Ghetsis' Hydreigon"; spriteArray[181] = 635; + database[182] = "0182 - Lysandre's Pyroar"; spriteArray[182] = 668; + database[501] = "0501 - Winter2013 Garchomp"; spriteArray[501] = 445; + database[502] = "0502 - Winter2013 Scizor"; spriteArray[502] = 212; + database[504] = "0504 - Magmar, Electabuzz"; spriteArray[504] = 125; + database[510] = "0510 - Arash's Mamoswine"; spriteArray[510] = 473; + database[511] = "0511 - Paris Vivillon"; spriteArray[511] = 666; + database[512] = "0512 - WORLD14 Aegislash"; spriteArray[512] = 681; + database[514] = "0514 - Tretta Wobbuffet"; spriteArray[514] = 202; + database[515] = "0515 - Heracross - Pinsir"; spriteArray[515] = 214; + database[516] = "0516 - Charizard X/Y"; spriteArray[516] = 6; + database[523] = "0523 - Halloween 2014 Pumpkaboo"; spriteArray[523] = 710; + database[524] = "0524 - Halloween Shiny Gengar"; spriteArray[524] = 94; + database[525] = "0525 - November Diancie"; spriteArray[525] = 719; + database[535] = "0535 - WC14 Pachirisu"; spriteArray[535] = 417; + database[536] = "0536 - Phantom Force Darkrai"; spriteArray[536] = 491; + database[537] = "0537 - Shiny Charizard"; spriteArray[537] = 6; + database[538] = "0538 - GS Dragonite"; spriteArray[538] = 149; + database[539] = "0539 - World15 Sharpedo"; spriteArray[539] = 319; + database[546] = "0546 - Hope Diancie"; spriteArray[546] = 719; + database[547] = "0547 - Galileo Rayquaza"; spriteArray[547] = 384; + database[551] = "0551 - Gamescom Aromatisse/Sableye"; spriteArray[551] = 683; + database[552] = "0552 - Gamescom Bouffalant/Malamar"; spriteArray[552] = 626; + database[553] = "0553 - Harry Hoopa"; spriteArray[553] = 720; + database[557] = "0557 - GF Mew"; spriteArray[557] = 151; + database[558] = "0558 - GF Celebi"; spriteArray[558] = 251; + database[559] = "0559 - GF Jirachi"; spriteArray[559] = 385; + database[560] = "0560 - GF Darkrai"; spriteArray[560] = 491; + database[561] = "0561 - GF Manaphy"; spriteArray[561] = 490; + database[562] = "0562 - GF Shaymin"; spriteArray[562] = 492; + database[563] = "0563 - GF Arceus"; spriteArray[563] = 493; + database[564] = "0564 - GF Victini"; spriteArray[564] = 494; + database[565] = "0565 - GF Keldeo"; spriteArray[565] = 647; + database[566] = "0566 - GF Genesect"; spriteArray[566] = 649; + database[567] = "0567 - GF Meloetta"; spriteArray[567] = 648; + database[569] = "0569 - Aldora Articuno"; spriteArray[569] = 144; + database[570] = "0570 - Aldora Zapdos"; spriteArray[570] = 145; + database[571] = "0571 - Aldora Moltres"; spriteArray[571] = 146; + database[574] = "0574 - Happy Meowth"; spriteArray[574] = 50; + database[576] = "0576 - Descartes/XYZ Xerneas"; spriteArray[576] = 716; + database[577] = "0577 - Descartes/XYZ Yveltal"; spriteArray[577] = 717; + database[578] = "0578 - Descartes/XYZ Zygarde"; spriteArray[578] = 718; + database[580] = "0580 - Screenpeekaz Shiny Machamp"; spriteArray[580] = 68; + database[586] = "0586 - Play! Mewtwo"; spriteArray[586] = 150; + database[588] = "0588 - Helen Volcanion"; spriteArray[588] = 721; + database[590] = "0590 - Worlds 2016 Bulbasaur"; spriteArray[590] = 1; + database[591] = "0591 - Worlds 2016 Charmander"; spriteArray[591] = 4; + database[592] = "0592 - Worlds 2016 Squirtle"; spriteArray[592] = 7; + database[598] = "0598 - Alexander Hoopa"; spriteArray[598] = 720; + database[812] = "0812 - Christmas Stantler"; spriteArray[812] = 234; + database[1001] = "1001 - Eevee House Sylveon"; spriteArray[1001] = 700; + database[1004] = "1004 - Olleh TV Charizard X/Y"; spriteArray[1004] = 6; + database[1005] = "1005 - Alt. Event Garchomp"; spriteArray[1005] = 445; + database[1006] = "1006 - WCS14K Heracross"; spriteArray[1006] = 214; + database[1007] = "1007 - WCS14K Manectric"; spriteArray[1007] = 310; + database[1008] = "1008 - WCS14K Tyranitar"; spriteArray[1008] = 248; + database[1012] = "1012 - WCS14K Pinsir"; spriteArray[1012] = 127; + database[1013] = "1013 - WCS14K Houndoom"; spriteArray[1013] = 229; + database[1014] = "1014 - WCS14K Aggron"; spriteArray[1014] = 306; + database[1015] = "1015 - Wishing Star Jirachi"; spriteArray[1015] = 385; + database[1016] = "1016 - Shiny Gengar"; spriteArray[1016] = 94; + database[1017] = "1017 - Movie Darkrai"; spriteArray[1017] = 491; + database[1018] = "1018 - Movie Diancie"; spriteArray[1018] = 719; + database[1019] = "1019 - Se Jun Park Pachirisu"; spriteArray[1019] = 417; + database[1023] = "1023 - Guidebook Keldeo"; spriteArray[1023] = 647; + database[1024] = "1024 - Guidebook Shaymin"; spriteArray[1024] = 492; + database[1025] = "1025 - Guidebook Mareep"; spriteArray[1025] = 179; + database[1026] = "1026 - Extremespeed Linoone"; spriteArray[1026] = 264; + database[1027] = "1027 - Shiny Charizard"; spriteArray[1027] = 6; + database[1029] = "1029 - Shiny Rayquaza"; spriteArray[1029] = 384; + database[1030] = "Placeholder"; + database[1041] = "1041 - Water Tribe Manaphy"; spriteArray[1041] = 490; + database[1042] = "1042 - Mega Battle 2015 Charizard"; spriteArray[1042] = 6; + database[1043] = "1043 - Shiny Pikachu"; spriteArray[1043] = 25; + database[1047] = "1047 - Movie Kyogre"; spriteArray[1047] = 382; + database[1048] = "1048 - Movie Groudon"; spriteArray[1048] = 383; + database[1049] = "1049 - Movie Dialga"; spriteArray[1049] = 483; + database[1050] = "1050 - Movie Palkia"; spriteArray[1050] = 484; + database[1051] = "1051 - Movie Giratina"; spriteArray[1051] = 487; + database[1052] = "1052 - Movie Kyurem"; spriteArray[1052] = 646; + database[1053] = "1053 - Movie Arceus"; spriteArray[1053] = 493; + database[1054] = "1054 - Movie Hoopa"; spriteArray[1054] = 720; + database[1055] = "1055 - Shiny Gyarados"; spriteArray[1055] = 130; + database[1058] = "1058 - Gamefreak Mew (22796)"; spriteArray[1058] = 151; + database[1060] = "1060 - XYZ Xerneas"; spriteArray[1060] = 716; + database[1061] = "1061 - XYZ Yveltal"; spriteArray[1061] = 717; + database[1062] = "1062 - Korean Premiere XYZ Zygarde"; spriteArray[1062] = 718; + database[1064] = "1064 - XYZ Zygarde"; spriteArray[1064] = 718; + database[1065] = "1065 - KOR HA Articuno"; spriteArray[1065] = 144; + database[1066] = "1066 - KOR HA Zapdos"; spriteArray[1066] = 145; + database[1067] = "1067 - KOR HA Moltres"; spriteArray[1067] = 146; + database[1068] = "1068 - WCS16K HA Mewtwo"; spriteArray[1068] = 150; + database[1070] = "1070 - KOR Naminori Pikachu"; spriteArray[1070] = 25; + database[1071] = "1071 - KOR All Stars Diancie"; spriteArray[1071] = 719; + database[1072] = "1072 - KOR Gardevoir"; spriteArray[1072] = 282; + database[1073] = "1073 - KOR Gengar"; spriteArray[1073] = 94; + database[1074] = "1074 - KOR Tyranitar"; spriteArray[1074] = 248; + database[1075] = "1075 - KOR Mawile"; spriteArray[1075] = 303; + database[1076] = "1076 - KOR Victini"; spriteArray[1076] = 494; + database[1078] = "1078 - KOR Volcanion"; spriteArray[1078] = 721; + database[1501] = "1501 - HA Torchic"; spriteArray[1501] = 255; + database[1503] = "1503 - Fancy Vivillon"; spriteArray[1503] = 666; + database[1504] = "1504 - Shiny Beldum"; spriteArray[1504] = 374; + database[1505] = "1505 - HA Serperior"; spriteArray[1505] = 497; + database[1506] = "1506 - HA Emboar"; spriteArray[1506] = 500; + database[1507] = "1507 - HA Samurott"; spriteArray[1507] = 503; + database[1508] = "1508 - PGL Tyrunt"; spriteArray[1508] = 696; + database[1509] = "1509 - PGL Amaura"; spriteArray[1509] = 698; + database[1510] = "1510 - PGL Pikachu"; spriteArray[1510] = 25; + database[1512] = "1512 - PGL Delibird"; spriteArray[1512] = 225; + database[1513] = "1513 - PGL Dragonite"; spriteArray[1513] = 149; + database[1514] = "1514 - PGL Miltank"; spriteArray[1514] = 241; + database[1515] = "1515 - PGL Garchomp"; spriteArray[1515] = 445; + database[1516] = "1516 - PGL N's Darmanitan"; spriteArray[1516] = 555; + database[1601] = "1601 - Z-stone Munchlax"; spriteArray[1601] = 446; + database[1610] = "Placeholder"; + database[2046] = "2046 - Ash Greninja"; spriteArray[2046] = 658; +} + +void filldatabase6(char *database[], int spriteArray[]) { + for (int j = 0; j < 2050; j++) { + database[j] = " "; + spriteArray[j] = -1; + } + + database[8] = "0008 - Lucky Egg"; spriteArray[8] = 0; + database[53] = "0053 - Nugget"; spriteArray[53] = 0; + database[54] = "0054 - Super Potions"; spriteArray[54] = 0; + database[55] = "0055 - Luxury Ball"; spriteArray[55] = 0; + database[56] = "0056 - Rare Candy"; spriteArray[56] = 0; + database[57] = "0057 - Master Ball"; spriteArray[57] = 0; + database[58] = "0058 - 12 Quick Balls"; spriteArray[58] = 0; + database[59] = "0059 - 100 Potions"; spriteArray[59] = 0; + database[60] = "0060 - 2 Master Balls"; spriteArray[60] = 0; + database[151] = "0151 - Scrap 5 Rare Candy"; spriteArray[151] = 0; + database[152] = "0152 - Scrap Masterball"; spriteArray[152] = 0; + database[157] = "0157 - Max Revive"; spriteArray[157] = 0; + database[158] = "0158 - Masterball"; spriteArray[158] = 0; + database[518] = "0518 - Heracronite"; spriteArray[518] = 0; + database[527] = "0527 - 100 Potions"; spriteArray[527] = 0; + database[1022] = "1022 - 100 Potions"; spriteArray[1022] = 0; + database[1057] = "1057 - 50 Quick Balls"; spriteArray[1057] = 0; + database[1502] = "1502 - Quickballs"; spriteArray[1502] = 0; + database[1511] = "1511 - Rare Candy"; spriteArray[1511] = 0; + database[2048] = "2048 - Eon Ticket"; spriteArray[2048] = 0; + + database[1] = "0001 - Birthday events"; spriteArray[1] = 133; + database[2] = "0002 - CoroCoro Garchomp"; spriteArray[2] = 445; + database[3] = "0003 - PC Tokyo Bay Inkay"; spriteArray[3] = 686; + database[4] = "0004 - Nuketta Wobbuffet"; spriteArray[4] = 202; + database[11] = "0011 - Alternate Event Garchomp"; spriteArray[11] = 445; + database[12] = "0012 - Eevee House Sylveon"; spriteArray[12] = 133; + database[15] = "0015 - CoroCoro Charizard X/Y"; spriteArray[15] = 6; + database[17] = "0017 - Garchomp"; spriteArray[17] = 445; + database[19] = "0019 - PC Scizor"; spriteArray[19] = 212; + database[20] = "0020 - PC Gengar"; spriteArray[20] = 94; + database[21] = "0021 - Darkrai"; spriteArray[21] = 491; + database[22] = "0022 - Diancie"; spriteArray[22] = 719; + database[25] = "0025 - M-Gyarados"; spriteArray[25] = 130; + database[26] = "0026 - M-Scizor"; spriteArray[26] = 212; + database[27] = "0027 - M-Kangaskhan"; spriteArray[27] = 115; + database[28] = "0028 - M-Gengar"; spriteArray[28] = 94; + database[29] = "0029 - M-Tyranitar"; spriteArray[29] = 248; + database[30] = "0030 - M-Mawile"; spriteArray[30] = 303; + database[33] = "0033 - Mega Kick Pikachu"; spriteArray[33] = 25; + database[34] = "0034 - Shiny Jirachi"; spriteArray[34] = 385; + database[37] = "0037 - Surf Incense Pikachu"; spriteArray[37] = 25; + database[38] = "0038 - Surf Air Balloon Pikachu"; spriteArray[38] = 25; + database[39] = "0039 - Surf, Shard Pikachu"; spriteArray[39] = 25; + database[40] = "0040 - Surf Focus Band Pikachu"; spriteArray[40] = 25; + database[41] = "0041 - Surf Silk Scarf Pikachu"; spriteArray[41] = 25; + database[42] = "0042 - Heart Stamp Pikachu"; spriteArray[42] = 25; + database[43] = "0043 - Charizard X/Y"; spriteArray[43] = 6; + database[44] = "0044 - Shiny Gengar"; spriteArray[44] = 94; + database[45] = "0045 - Tretta Rotom"; spriteArray[45] = 479; + database[46] = "0046 - Darkrai"; spriteArray[46] = 491; + database[47] = "0047 - Diancie"; spriteArray[47] = 719; + database[48] = "0048 - Birthday Events"; spriteArray[48] = 133; + database[49] = "0049 - Shiny Gengar"; spriteArray[49] = 94; + database[50] = "0050 - Pokescrap Shaymin"; spriteArray[50] = 492; + database[51] = "0051 - Pokescrap Keldeo"; spriteArray[51] = 647; + database[52] = "0052 - Pokescrap Victini"; spriteArray[52] = 494; + database[61] = "0061 - Shiny Jirachi"; spriteArray[61] = 385; + database[62] = "0062 - SSB4 Greninja"; spriteArray[62] = 658; + database[63] = "0063 - PC Piplup"; spriteArray[63] = 393; + database[64] = "0064 - PC Froakie"; spriteArray[64] = 656; + database[65] = "0065 - Shiny Charizard"; spriteArray[65] = 6; + database[66] = "0066 - Shiny Pikachu"; spriteArray[66] = 25; + database[67] = "0067 - Extremespeed Linoone"; spriteArray[67] = 264; + database[71] = "0071 - PC Eggs"; spriteArray[71] = 322; + database[78] = "0078 - Shiny Rayquaza"; spriteArray[78] = 384; + database[79] = "0079 - P-Cafe Pikachu"; spriteArray[79] = 25; + database[81] = "0081 - Movie Arceus"; spriteArray[81] = 493; + database[82] = "0082 - Movie Legends HA"; spriteArray[82] = 383; + database[83] = "0083 - Movie Hoopa"; spriteArray[83] = 720; + database[86] = "0086 - Serena's Fennekin"; spriteArray[86] = 653; + database[88] = "0088 - CoroCoro Rayquaza"; spriteArray[88] = 384; + database[89] = "0089 - Spring15 Kangaskhan"; spriteArray[89] = 115; + database[90] = "0090 - SG Shiny Rayquaza"; spriteArray[90] = 384; + database[94] = "0094 - PC Shiny Gyarados"; spriteArray[94] = 130; + database[95] = "0095 - Hiroshima PC Magikarp"; spriteArray[95] = 129; + database[96] = "0096 - Pokelab Bulbasaur"; spriteArray[96] = 1; + database[97] = "0097 - Pokelab Charmander"; spriteArray[97] = 4; + database[98] = "0098 - Pokelab Squirtle"; spriteArray[98] = 7; + database[99] = "0099 - 7/11 Pikachu"; spriteArray[99] = 25; + database[100] = "0100 - 7/11 Pancham"; spriteArray[100] = 674; + database[101] = "0101 - 7/11 Lugia"; spriteArray[101] = 249; + database[102] = "0102 - 7/11 Latios"; spriteArray[102] = 381; + database[107] = "0107 - Y.ama Shiny Pikachu"; spriteArray[107] = 25; + database[108] = "0108 - Tanabata 15 Jirachi"; spriteArray[108] = 385; + database[109] = "0109 - Satay King Pikachu"; spriteArray[109] = 25; + database[110] = "0110 - Manesh Hoopa"; spriteArray[110] = 720; + database[111] = "0111 - Shiny Xerneas, Yveltal"; spriteArray[111] = 716; + database[113] = "0113 - Zygarde"; spriteArray[113] = 718; + database[114] = "0114 - Expo Charizard"; spriteArray[114] = 6; + database[115] = "0115 - Expo Machamp"; spriteArray[115] = 68; + database[116] = "0116 - Expo Smeargle"; spriteArray[116] = 235; + database[117] = "0117 - Expo Zoroark"; spriteArray[117] = 571; + database[119] = "0119 - Nintendo HK Rayquaza"; spriteArray[119] = 384; + database[120] = "0120 - Universe Diancie"; spriteArray[120] = 719; + database[121] = "0121 - Birthday events"; spriteArray[121] = 133; + database[122] = "0122 - Halloween 2015 Pumpkaboo"; spriteArray[122] = 710; + database[127] = "0127 - Pokelab Chikorita"; spriteArray[127] = 152; + database[128] = "0128 - Pokelab Cyndaquil"; spriteArray[128] = 155; + database[129] = "0129 - Pokelab Totodile"; spriteArray[129] = 158; + database[130] = "0130 - WCS 2015 Shiny Tyranitar"; spriteArray[130] = 248; + database[131] = "0131 - PC Shiny Diancie"; spriteArray[131] = 719; + database[132] = "0132 - PC Al/Au/Sa/Lu/Sl"; spriteArray[132] = 334; + database[133] = "0133 - PC Al/Au/Sa/Lu/Sl"; spriteArray[133] = 531; + database[134] = "0134 - PC Al/Au/Sa/Lu/Sl"; spriteArray[134] = 448; + database[135] = "0135 - PC Al/Au/Sa/Lu/Sl"; spriteArray[135] = 80; + database[136] = "0136 - PC Al/Au/Sa/Lu/Sl"; spriteArray[136] = 302; + database[137] = "0137 - VC Mew"; spriteArray[137] = 151; + database[138] = "0138 - Happy Hour Pikachu"; spriteArray[138] = 25; + database[141] = "0141 - Repeat Halloween Gengar"; spriteArray[141] = 94; + database[145] = "0145 - HK Shiny Jirachi"; spriteArray[145] = 385; + database[146] = "0146 - SG Arceus"; spriteArray[146] = 493; + database[147] = "0147 - Scrap Eevee"; spriteArray[147] = 133; + database[148] = "0148 - Scrap Articuno"; spriteArray[148] = 144; + database[149] = "0149 - Scrap Zapdos"; spriteArray[149] = 145; + database[150] = "0150 - Scrap Moltres"; spriteArray[150] = 146; + database[153] = "0153 - Scrap Venusaur"; spriteArray[153] = 3; + database[154] = "0154 - Scrap Charizard"; spriteArray[154] = 6; + database[155] = "0155 - Scrap Blastoise"; spriteArray[155] = 9; + database[156] = "0156 - Scrap Mewtwo"; spriteArray[156] = 150; + database[159] = "0159 - Jade Infernape"; spriteArray[159] = 392; + database[161] = "0161 - Movie Volcanion"; spriteArray[161] = 721; + database[162] = "0162 - 720 Poll Greninja"; spriteArray[162] = 658; + database[163] = "0163 - Surf and Fly Pikachu"; spriteArray[163] = 25; + database[164] = "0164 - PC Shiny Ho-Oh"; spriteArray[164] = 250; + database[165] = "0165 - Masuda's Psyduck"; spriteArray[165] = 54; + database[166] = "0166 - Bestow Pikachu"; spriteArray[166] = 25; + database[167] = "0167 - Hyadain Landorus"; spriteArray[167] = 645; + database[168] = "0168 - Chymia's Gardevoir"; spriteArray[168] = 282; + database[169] = "0169 - Jarvis's Gengar"; spriteArray[169] = 94; + database[170] = "0170 - P-Cafe Pikachu (SG)"; spriteArray[170] = 25; + database[171] = "0171 - Skytree Shiny Rayquaza"; spriteArray[171] = 384; + database[173] = "0173 - HKTW VGC16 Shiny Mewtwo"; spriteArray[173] = 150; + database[174] = "0174 - Tanabata 2016 Jirachi"; spriteArray[174] = 385; + database[175] = "0175 - HKTW Mew"; spriteArray[175] = 151; + database[176] = "0176 - Poll Simisear"; spriteArray[176] = 514; + database[177] = "0177 - Giovanni's Nidoqueen"; spriteArray[177] = 31; + database[178] = "0178 - Maxie's Camerupt"; spriteArray[178] = 323; + database[179] = "0179 - Archie's Sharpedo"; spriteArray[179] = 319; + database[180] = "0180 - Cyrus' Weavile"; spriteArray[180] = 461; + database[181] = "0181 - Ghetsis' Hydreigon"; spriteArray[181] = 635; + database[182] = "0182 - Lysandre's Pyroar"; spriteArray[182] = 668; + database[501] = "0501 - Winter2013 Garchomp"; spriteArray[501] = 445; + database[502] = "0502 - Winter2013 Scizor"; spriteArray[502] = 212; + database[504] = "0504 - Magmar, Electabuzz"; spriteArray[504] = 125; + database[510] = "0510 - Arash's Mamoswine"; spriteArray[510] = 473; + database[511] = "0511 - Paris Vivillon"; spriteArray[511] = 666; + database[512] = "0512 - WORLD14 Aegislash"; spriteArray[512] = 681; + database[514] = "0514 - Tretta Wobbuffet"; spriteArray[514] = 202; + database[515] = "0515 - Heracross - Pinsir"; spriteArray[515] = 214; + database[516] = "0516 - Charizard X/Y"; spriteArray[516] = 6; + database[523] = "0523 - Halloween 2014 Pumpkaboo"; spriteArray[523] = 710; + database[524] = "0524 - Halloween Shiny Gengar"; spriteArray[524] = 94; + database[525] = "0525 - November Diancie"; spriteArray[525] = 719; + database[535] = "0535 - WC14 Pachirisu"; spriteArray[535] = 417; + database[536] = "0536 - Phantom Force Darkrai"; spriteArray[536] = 491; + database[537] = "0537 - Shiny Charizard"; spriteArray[537] = 6; + database[538] = "0538 - GS Dragonite"; spriteArray[538] = 149; + database[539] = "0539 - World15 Sharpedo"; spriteArray[539] = 319; + database[546] = "0546 - Hope Diancie"; spriteArray[546] = 719; + database[547] = "0547 - Galileo Rayquaza"; spriteArray[547] = 384; + database[551] = "0551 - Gamescom Aromatisse/Sableye"; spriteArray[551] = 683; + database[552] = "0552 - Gamescom Bouffalant/Malamar"; spriteArray[552] = 626; + database[553] = "0553 - Harry Hoopa"; spriteArray[553] = 720; + database[557] = "0557 - GF Mew"; spriteArray[557] = 151; + database[558] = "0558 - GF Celebi"; spriteArray[558] = 251; + database[559] = "0559 - GF Jirachi"; spriteArray[559] = 385; + database[560] = "0560 - GF Darkrai"; spriteArray[560] = 491; + database[561] = "0561 - GF Manaphy"; spriteArray[561] = 490; + database[562] = "0562 - GF Shaymin"; spriteArray[562] = 492; + database[563] = "0563 - GF Arceus"; spriteArray[563] = 493; + database[564] = "0564 - GF Victini"; spriteArray[564] = 494; + database[565] = "0565 - GF Keldeo"; spriteArray[565] = 647; + database[566] = "0566 - GF Genesect"; spriteArray[566] = 649; + database[567] = "0567 - GF Meloetta"; spriteArray[567] = 648; + database[569] = "0569 - Aldora Articuno"; spriteArray[569] = 144; + database[570] = "0570 - Aldora Zapdos"; spriteArray[570] = 145; + database[571] = "0571 - Aldora Moltres"; spriteArray[571] = 146; + database[574] = "0574 - Happy Meowth"; spriteArray[574] = 50; + database[576] = "0576 - Descartes/XYZ Xerneas"; spriteArray[576] = 716; + database[577] = "0577 - Descartes/XYZ Yveltal"; spriteArray[577] = 717; + database[578] = "0578 - Descartes/XYZ Zygarde"; spriteArray[578] = 718; + database[580] = "0580 - Screenpeekaz Shiny Machamp"; spriteArray[580] = 68; + database[586] = "0586 - Play! Mewtwo"; spriteArray[586] = 150; + database[588] = "0588 - Helen Volcanion"; spriteArray[588] = 721; + database[590] = "0590 - Worlds 2016 Bulbasaur"; spriteArray[590] = 1; + database[591] = "0591 - Worlds 2016 Charmander"; spriteArray[591] = 4; + database[592] = "0592 - Worlds 2016 Squirtle"; spriteArray[592] = 7; + database[598] = "0598 - Alexander Hoopa"; spriteArray[598] = 720; + database[812] = "0812 - Christmas Stantler"; spriteArray[812] = 234; + database[1001] = "1001 - Eevee House Sylveon"; spriteArray[1001] = 700; + database[1004] = "1004 - Olleh TV Charizard X/Y"; spriteArray[1004] = 6; + database[1005] = "1005 - Alt. Event Garchomp"; spriteArray[1005] = 445; + database[1006] = "1006 - WCS14K Heracross"; spriteArray[1006] = 214; + database[1007] = "1007 - WCS14K Manectric"; spriteArray[1007] = 310; + database[1008] = "1008 - WCS14K Tyranitar"; spriteArray[1008] = 248; + database[1012] = "1012 - WCS14K Pinsir"; spriteArray[1012] = 127; + database[1013] = "1013 - WCS14K Houndoom"; spriteArray[1013] = 229; + database[1014] = "1014 - WCS14K Aggron"; spriteArray[1014] = 306; + database[1015] = "1015 - Wishing Star Jirachi"; spriteArray[1015] = 385; + database[1016] = "1016 - Shiny Gengar"; spriteArray[1016] = 94; + database[1017] = "1017 - Movie Darkrai"; spriteArray[1017] = 491; + database[1018] = "1018 - Movie Diancie"; spriteArray[1018] = 719; + database[1019] = "1019 - Se Jun Park Pachirisu"; spriteArray[1019] = 417; + database[1023] = "1023 - Guidebook Keldeo"; spriteArray[1023] = 647; + database[1024] = "1024 - Guidebook Shaymin"; spriteArray[1024] = 492; + database[1025] = "1025 - Guidebook Mareep"; spriteArray[1025] = 179; + database[1026] = "1026 - Extremespeed Linoone"; spriteArray[1026] = 264; + database[1027] = "1027 - Shiny Charizard"; spriteArray[1027] = 6; + database[1029] = "1029 - Shiny Rayquaza"; spriteArray[1029] = 384; + database[1030] = "Placeholder"; + database[1041] = "1041 - Water Tribe Manaphy"; spriteArray[1041] = 490; + database[1042] = "1042 - Mega Battle 2015 Charizard"; spriteArray[1042] = 6; + database[1043] = "1043 - Shiny Pikachu"; spriteArray[1043] = 25; + database[1047] = "1047 - Movie Kyogre"; spriteArray[1047] = 382; + database[1048] = "1048 - Movie Groudon"; spriteArray[1048] = 383; + database[1049] = "1049 - Movie Dialga"; spriteArray[1049] = 483; + database[1050] = "1050 - Movie Palkia"; spriteArray[1050] = 484; + database[1051] = "1051 - Movie Giratina"; spriteArray[1051] = 487; + database[1052] = "1052 - Movie Kyurem"; spriteArray[1052] = 646; + database[1053] = "1053 - Movie Arceus"; spriteArray[1053] = 493; + database[1054] = "1054 - Movie Hoopa"; spriteArray[1054] = 720; + database[1055] = "1055 - Shiny Gyarados"; spriteArray[1055] = 130; + database[1058] = "1058 - Gamefreak Mew (22796)"; spriteArray[1058] = 151; + database[1060] = "1060 - XYZ Xerneas"; spriteArray[1060] = 716; + database[1061] = "1061 - XYZ Yveltal"; spriteArray[1061] = 717; + database[1062] = "1062 - Korean Premiere XYZ Zygarde"; spriteArray[1062] = 718; + database[1064] = "1064 - XYZ Zygarde"; spriteArray[1064] = 718; + database[1065] = "1065 - KOR HA Articuno"; spriteArray[1065] = 144; + database[1066] = "1066 - KOR HA Zapdos"; spriteArray[1066] = 145; + database[1067] = "1067 - KOR HA Moltres"; spriteArray[1067] = 146; + database[1068] = "1068 - WCS16K HA Mewtwo"; spriteArray[1068] = 150; + database[1070] = "1070 - KOR Naminori Pikachu"; spriteArray[1070] = 25; + database[1071] = "1071 - KOR All Stars Diancie"; spriteArray[1071] = 719; + database[1072] = "1072 - KOR Gardevoir"; spriteArray[1072] = 282; + database[1073] = "1073 - KOR Gengar"; spriteArray[1073] = 94; + database[1074] = "1074 - KOR Tyranitar"; spriteArray[1074] = 248; + database[1075] = "1075 - KOR Mawile"; spriteArray[1075] = 303; + database[1076] = "1076 - KOR Victini"; spriteArray[1076] = 494; + database[1078] = "1078 - KOR Volcanion"; spriteArray[1078] = 721; + database[1501] = "1501 - HA Torchic"; spriteArray[1501] = 255; + database[1503] = "1503 - Fancy Vivillon"; spriteArray[1503] = 666; + database[1504] = "1504 - Shiny Beldum"; spriteArray[1504] = 374; + database[1505] = "1505 - HA Serperior"; spriteArray[1505] = 497; + database[1506] = "1506 - HA Emboar"; spriteArray[1506] = 500; + database[1507] = "1507 - HA Samurott"; spriteArray[1507] = 503; + database[1508] = "1508 - PGL Tyrunt"; spriteArray[1508] = 696; + database[1509] = "1509 - PGL Amaura"; spriteArray[1509] = 698; + database[1510] = "1510 - PGL Pikachu"; spriteArray[1510] = 25; + database[1512] = "1512 - PGL Delibird"; spriteArray[1512] = 225; + database[1513] = "1513 - PGL Dragonite"; spriteArray[1513] = 149; + database[1514] = "1514 - PGL Miltank"; spriteArray[1514] = 241; + database[1515] = "1515 - PGL Garchomp"; spriteArray[1515] = 445; + database[1516] = "1516 - PGL N's Darmanitan"; spriteArray[1516] = 555; +} + +void filldatabase5(char *database[], int spriteArray[]) { + for (int j = 0; j < 170; j++) { + database[j] = " "; + spriteArray[j] = -1; + } + + database[1] = "001 - Helpful Cubchoo"; spriteArray[1] = 613; + database[2] = "002 - Summer Karrablast"; spriteArray[2] = 588; + database[3] = "003 - Summer Shelmet"; spriteArray[3] = 617; + database[4] = "004 - TFE Electabuzz"; spriteArray[4] = 125; + database[5] = "005 - TFE Haunter"; spriteArray[5] = 93; + database[6] = "006 - TFE Machoke"; spriteArray[6] = 67; + database[7] = "007 - TFE Magmar"; spriteArray[7] = 126; + database[8] = "008 - TFE Scyther"; spriteArray[8] = 123; + database[9] = "009 - TFE Slowpoke"; spriteArray[9] = 79; + database[10] = "010 - TFE Karrablast"; spriteArray[10] = 588; + database[11] = "011 - TFE Shelmet"; spriteArray[11] = 616; + database[28] = "028 - Darkrai"; spriteArray[28] = 491; + database[29] = "029 - Mysterious Egg Pidove"; spriteArray[29] = 519; + database[30] = "030 - Snarl Zoroark"; spriteArray[30] = 571; + database[31] = "031 - Satoshi's Scraggy"; spriteArray[31] = 559; + database[32] = "032 - Movie 2011 Victini"; spriteArray[32] = 494; + database[33] = "033 - Movie 2011 Reshiram"; spriteArray[33] = 643; + database[34] = "034 - Searcher Axew"; spriteArray[34] = 610; + database[35] = "035 - Janta's Golurk"; spriteArray[35] = 623; + database[36] = "036 - ANA Flying Pikachu"; spriteArray[36] = 25; + database[37] = "037 - Worlds 2011 Scrafty"; spriteArray[37] = 560; + database[38] = "038 - ELT Pikachu"; spriteArray[38] = 25; + database[39] = "039 - AAA Pikachu"; spriteArray[39] = 25; + database[40] = "040 - Chisa Pikachu"; spriteArray[40] = 25; + database[41] = "041 - Amigo Pikachu"; spriteArray[41] = 25; + database[42] = "042 - SKE48 Pikachu"; spriteArray[42] = 25; + database[43] = "043 - Wasshoi Pikachu"; spriteArray[43] = 25; + database[45] = "045 - Churuno Pikachu"; spriteArray[45] = 25; + database[48] = "048 - Mighty Mewtwo"; spriteArray[48] = 150; + database[49] = "049 - Tohoku Snivy"; spriteArray[49] = 495; + database[50] = "050 - BDay Audino 2011"; spriteArray[50] = 531; + database[51] = "051 - Milos Island Thundurus"; spriteArray[51] = 642; + database[52] = "052 - Master Ball"; spriteArray[52] = 0; + database[53] = "053 - Gratitude Shaymin"; spriteArray[53] = 492; + database[54] = "054 - YOTD egg Bagon"; spriteArray[54] = 371; + database[55] = "055 - YOTD Deino"; spriteArray[55] = 633; + database[56] = "056 - YOTD Druddigon"; spriteArray[56] = 621; + database[57] = "057 - YOTD Swablu"; spriteArray[57] = 333; + database[58] = "058 - Game Rayquaza"; spriteArray[58] = 384; + database[59] = "059 - Nobunaga Rayquaza"; spriteArray[59] = 384; + database[61] = "061 - Nationals 2012 Larvitar"; spriteArray[61] = 246; + database[62] = "062 - Nagasaki Blaziken"; spriteArray[62] = 257; + database[63] = "063 - Nagasaki Walrein"; spriteArray[63] = 365; + database[64] = "064 - Nagasaki Gardevoir"; spriteArray[64] = 282; + database[65] = "065 - Fukuoka Groudon"; spriteArray[65] = 383; + database[66] = "066 - Fukuoka Kyogre"; spriteArray[66] = 382; + database[67] = "067 - Sakura Pikachu"; spriteArray[67] = 25; + database[68] = "068 - Master Ball"; spriteArray[68] = 0; + database[69] = "069 - Summer Keldeo"; spriteArray[69] = 647; + database[70] = "070 - Movie 2012 Meloetta"; spriteArray[70] = 648; + database[71] = "071 - Strongest Pikachu"; spriteArray[71] = 25; + database[73] = "073 - Sasebo Ludicolo"; spriteArray[73] = 272; + database[75] = "075 - Saga Sceptile"; spriteArray[75] = 254; + database[76] = "076 - Saga Milotic"; spriteArray[76] = 350; + database[78] = "078 - Kumamoto Swampert"; spriteArray[78] = 260; + database[89] = "089 - SP Miyazaki Metagross"; spriteArray[89] = 376; + database[92] = "092 - Kokura Salamence"; spriteArray[92] = 373; + database[93] = "093 - Searcher Piplup"; spriteArray[93] = 393; + database[94] = "094 - Nats 2012 Volcarona"; spriteArray[94] = 637; + database[95] = "095 - Kanto Starter eggs"; spriteArray[95] = 1; + database[96] = "096 - Carnival Pikachu"; spriteArray[96] = 25; + database[97] = "097 - Singing Piplup"; spriteArray[97] = 393; + database[98] = "098 - Camp Aerodactyl"; spriteArray[98] = 142; + database[99] = "099 - Plasma Genesect"; spriteArray[99] = 649; + database[100] = "100 - Worlds 2012 Fly Pikachu"; spriteArray[100] = 25; + database[101] = "101 - Tag Ninetails"; spriteArray[101] = 38; + database[102] = "102 - Tag Chandelure"; spriteArray[102] = 609; + database[103] = "103 - Tag Whimsicott"; spriteArray[103] = 547; + database[104] = "104 - Tag Lucario"; spriteArray[104] = 448; + database[105] = "105 - YOTD Horsea"; spriteArray[105] = 116; + database[106] = "106 - YOTD Trapinch"; spriteArray[106] = 328; + database[111] = "111 - Single Battle Strongest Dragonite"; spriteArray[111] = 149; + database[112] = "112 - Single Battle Strongest Garchomp"; spriteArray[112] = 445; + database[113] = "113 - Single Battle Strongest Metagross"; spriteArray[113] = 376; + database[114] = "114 - Single Battle Strongest Scizor"; spriteArray[114] = 212; + database[115] = "115 - Single Battle Strongest Tyranitar"; spriteArray[115] = 248; + database[118] = "118 - Anniversary Groudon"; spriteArray[118] = 383; + database[119] = "119 - Anniversary Kyogre"; spriteArray[119] = 382; + database[120] = "120 - Team Rocket Meowth"; spriteArray[120] = 52; + database[121] = "121 - Kanto egg Bulbasaur"; spriteArray[121] = 1; + database[122] = "122 - Kanto egg Charmander"; spriteArray[122] = 4; + database[123] = "123 - Kanto egg Squirtle"; spriteArray[123] = 7; + database[124] = "124 - Fukuoka BDay Audino"; spriteArray[124] = 531; + database[125] = "125 - Tohoku Victini"; spriteArray[125] = 494; + database[126] = "126 - Masuda Deoxys"; spriteArray[126] = 386; + database[127] = "127 - P2 Lab Genesect"; spriteArray[127] = 649; + database[128] = "128 - Winter Keldeo"; spriteArray[128] = 647; + database[129] = "129 - Spring Meloetta"; spriteArray[129] = 648; + database[130] = "130 - Abram's Cloyster"; spriteArray[130] = 91; + database[131] = "131 - Toler's Ludicolo"; spriteArray[131] = 272; + database[132] = "132 - Ray's Metagross"; spriteArray[132] = 376; + database[133] = "133 - Plasma Deoxys"; spriteArray[133] = 386; + database[134] = "134 - Nagoya Magikarp"; spriteArray[134] = 129; + database[135] = "135 - Movie 2013 Mewtwo"; spriteArray[135] = 150; + database[136] = "136 - Movie 2013 Genesect"; spriteArray[136] = 649; + database[137] = "137 - Decolora Jirachi"; spriteArray[137] = 385; + database[138] = "138 - Singing Eevee"; spriteArray[138] = 133; + database[139] = "139 - PCS Empoleon"; spriteArray[139] = 395; + database[140] = "140 - PCTH Serperior"; spriteArray[140] = 497; + database[141] = "141 - PCT Pikachu"; spriteArray[141] = 25; + database[142] = "142 - PCY Torterra"; spriteArray[142] = 389; + database[143] = "143 - PCN Infernape"; spriteArray[143] = 392; + database[144] = "144 - PCO Emboar"; spriteArray[144] = 500; + database[145] = "145 - PCF Samurott"; spriteArray[145] = 503; + database[147] = "147 - Singing Eevee"; spriteArray[147] = 133; + database[148] = "148 - Summer Shiny Dialga"; spriteArray[148] = 483; + database[149] = "149 - Summer Shiny Palkia"; spriteArray[149] = 484; + database[150] = "150 - Summer Shiny Giratina"; spriteArray[150] = 487; + database[151] = "151 - Tanabata Jirachi"; spriteArray[151] = 385; + database[152] = "152 - Strongest Pikachu"; spriteArray[152] = 25; + database[153] = "153 - Character Fair Jirachi"; spriteArray[153] = 385; + database[154] = "154 - Chilseok Jirachi"; spriteArray[154] = 385; + database[155] = "155 - Worlds 2013 Smeargle"; spriteArray[155] = 235; + database[156] = "156 - Alder's Volcarona"; spriteArray[156] = 637; + database[157] = "157 - Cynthia's Spiritomb"; spriteArray[157] = 442; + database[158] = "158 - Dento's Pansage"; spriteArray[158] = 511; + database[159] = "159 - Iris's Axew"; spriteArray[159] = 610; + database[160] = "160 - Prof Okido's Rotom"; spriteArray[160] = 479; + database[161] = "161 - Satoshi's Pikachu"; spriteArray[161] = 25; + database[162] = "162 - Do Heun's Hitmontop"; spriteArray[162] = 237; + database[163] = "163 - Seung Heon's Cresselia"; spriteArray[163] = 488; + database[164] = "164 - Sejun's Liepard"; spriteArray[164] = 510; + database[165] = "165 - Chief's Sableye"; spriteArray[165] = 302; + database[166] = "166 - Yamamoto's Politoed"; spriteArray[166] = 186; + database[167] = "167 - Tamamoto's Kingdra"; spriteArray[167] = 230; +} + +void filldatabase4(char *database[], int spriteArray[]) { + for (int j = 0; j < 190; j++) { + database[j] = " "; + spriteArray[j] = -1; + } + + database[1] = "001 - TRU Manaphy"; spriteArray[1] = 490; + database[2] = "002 - Festa Electabuzz"; spriteArray[2] = 125; + database[3] = "003 - Festa Magmar"; spriteArray[3] = 126; + database[4] = "004 - NWS Manaphy"; spriteArray[4] = 490; + database[5] = "005 - JBHF Manaphy"; spriteArray[5] = 490; + database[6] = "006 - E4ALL Manaphy"; spriteArray[6] = 490; + database[7] = "007 - Sunday Tropius"; spriteArray[7] = 357; + database[8] = "008 - GameStop Deoxys"; spriteArray[8] = 386; + database[9] = "009 - Movie Darkrai"; spriteArray[9] = 491; + database[10] = "010 - Sunday Whiscash"; spriteArray[10] = 340; + database[11] = "011 - Pal City Lucario"; spriteArray[11] = 448; + database[12] = "012 - TRU Dragonite"; spriteArray[12] = 149; + database[13] = "013 - Nzone Pikachu"; spriteArray[13] = 25; + database[14] = "014 - Tanabata Jirachi 2007"; spriteArray[14] = 385; + database[15] = "015 - Bday Charmander"; spriteArray[15] = 4; + database[16] = "016 - Movie Shaymin"; spriteArray[16] = 492; + database[17] = "017 - Secret Key"; spriteArray[17] = 0; + database[18] = "018 - Member Card"; spriteArray[18] = 0; + database[19] = "019 - Movie Arceus"; spriteArray[19] = 0; + database[20] = "020 - Oak's Letter"; spriteArray[20] = 0; + database[21] = "021 - Pikachu-Colored Pichu"; spriteArray[21] = 172; + database[22] = "022 - Almia Darkrai"; spriteArray[22] = 491; + database[23] = "023 - Kyle Riolu"; spriteArray[23] = 447; + database[24] = "024 - Night Sky Jirachi"; spriteArray[24] = 385; + database[25] = "025 - Concert Chatot"; spriteArray[25] = 441; + database[26] = "026 - Pal City Manaphy"; spriteArray[26] = 490; + database[27] = "027 - Pal City Mew"; spriteArray[27] = 151; + database[28] = "028 - Matchup Checker"; spriteArray[28] = 0; + database[29] = "029 - Sunday Octillery"; spriteArray[29] = 224; + database[30] = "030 - Strongest Electivire"; spriteArray[30] = 466; + database[31] = "031 - Strongest Magmortar"; spriteArray[31] = 467; + database[32] = "032 - Strongest Milotic"; spriteArray[32] = 350; + database[33] = "033 - Strongest Dragonite"; spriteArray[33] = 149; + database[34] = "034 - Strongest Salamence"; spriteArray[34] = 373; + database[35] = "035 - McDonald's Pikachu"; spriteArray[35] = 25; + database[36] = "036 - Bday Charmander"; spriteArray[36] = 4; + database[37] = "037 - Tanabata Jirachi 2008"; spriteArray[37] = 385; + database[38] = "038 - PC Yokohama Pikachu"; spriteArray[38] = 25; + database[39] = "039 - Bday Pikachu 2008"; spriteArray[39] = 25; + database[40] = "040 - Eevee Collection"; spriteArray[40] = 133; + database[41] = "041 - Onemuri Pikachu"; spriteArray[41] = 25; + database[43] = "043 - Osaka Meowth"; spriteArray[43] = 52; + database[45] = "045 - Lucario Doll"; spriteArray[45] = 0; + database[47] = "047 - Bday Charmander 2009"; spriteArray[47] = 4; + database[48] = "048 - Yellow Forest Course"; spriteArray[48] = 0; + database[49] = "049 - Bday Chimchar 2009"; spriteArray[49] = 390; + database[50] = "050 - Kyoto Pikachu"; spriteArray[50] = 25; + database[51] = "051 - Winner's Path Course"; spriteArray[51] = 0; + database[52] = "052 - VGC10 Eevee"; spriteArray[52] = 133; + database[53] = "053 - Anniversary Mew"; spriteArray[53] = 151; + database[54] = "054 - Enigma Stone"; spriteArray[54] = 0; + database[55] = "055 - Shopping Course"; spriteArray[55] = 0; + database[56] = "056 - Ario Pikachu"; spriteArray[56] = 25; + database[57] = "057 - Bday Pikachu"; spriteArray[57] = 25; + database[58] = "058 - Event Course"; spriteArray[58] = 0; + database[59] = "059 - Winter Raikou"; spriteArray[59] = 243; + database[60] = "060 - Winter Entei"; spriteArray[60] = 244; + database[61] = "061 - Winter Suicune"; spriteArray[61] = 245; + database[62] = "062 - GameStop Celebi"; spriteArray[62] = 251; + database[63] = "063 - Goon's Scizor"; spriteArray[63] = 212; + database[64] = "064 - Amity Field Course"; spriteArray[64] = 0; + database[65] = "065 - Ash's Pikachu"; spriteArray[65] = 25; + database[66] = "066 - NZ Manaphy"; spriteArray[66] = 490; + database[67] = "067 - Bday Charmander 2010"; spriteArray[67] = 4; + database[68] = "068 - Worlds 2010 Crobat"; spriteArray[68] = 169; + database[69] = "069 - 7-Eleven Pikachu"; spriteArray[69] = 25; + database[70] = "070 - Bday Chimchar 2010"; spriteArray[70] = 390; + database[71] = "071 - Amity Field Course"; spriteArray[71] = 0; + database[72] = "072 - Battle Series Arcanine"; spriteArray[72] = 59; + database[73] = "073 - Hanguk Rayquaza"; spriteArray[73] = 384; + database[74] = "074 - Shinsegae Munchlax"; spriteArray[74] = 446; + database[75] = "075 - Shinsegae Feebas"; spriteArray[75] = 349; + database[76] = "076 - Character Fair Shaymin"; spriteArray[76] = 492; + database[77] = "077 - Character Fair Pikachu"; spriteArray[77] = 25; + database[78] = "078 - Sightseeing Course"; spriteArray[78] = 0; + database[79] = "079 - Manaphy Egg"; spriteArray[79] = 490; + database[80] = "080 - TCGWC Pikachu"; spriteArray[80] = 25; + database[90] = "Placeholder"; + database[108] = "108 - Apicot Berry"; spriteArray[108] = 0; + database[150] = "150 - Poketopia Pikachu"; spriteArray[150] = 25; + database[151] = "151 - Poketopia Electivire"; spriteArray[151] = 466; + database[152] = "152 - Poketopia Magmortar"; spriteArray[152] = 467; + database[153] = "153 - Worlds 2008 Lucario"; spriteArray[153] = 448; + database[154] = "154 - VGC09 Milotic"; spriteArray[154] = 350; + database[180] = "180 - Movie Regigigas"; spriteArray[180] = 486; + database[181] = "181 - Worlds 2009 Weavile"; spriteArray[181] = 461; + database[182] = "182 - Oblivia Deoxys (Attack)"; spriteArray[182] = 386; + database[183] = "183 - Oblivia Heatran"; spriteArray[183] = 485; + database[184] = "184 - Oblivia Shaymin"; spriteArray[184] = 492; + database[185] = "185 - Oblivia Deoxys (Defense)"; spriteArray[185] = 386; + database[186] = "186 - Oblivia Deoxys (Normal)"; spriteArray[186] = 386; + database[187] = "187 - Oblivia Deoxys (Speed)"; spriteArray[187] = 386; +} \ No newline at end of file diff --git a/source/fill.h b/source/fill.h new file mode 100644 index 000000000..c44ece61c --- /dev/null +++ b/source/fill.h @@ -0,0 +1,28 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#pragma once + +#include +#include + +void filldatabase7(char *database[], int spriteArray[]); +void filldatabase6(char *database[], int spriteArray[]); +void filldatabase5(char *database[], int spriteArray[]); +void filldatabase4(char *database[], int spriteArray[]); \ No newline at end of file diff --git a/source/fx.c b/source/fx.c new file mode 100644 index 000000000..02dbd226d --- /dev/null +++ b/source/fx.c @@ -0,0 +1,94 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include "graphic.h" +#include "fx.h" + +sf2d_texture *cubesSheet, *boxesSheet; + +int movementLong = 0; +int movementSlow = 0; +int trasp = 254; +bool vanish = true; +bool up = true; + +int x[11] = {0, 50, 186, 244, 484, 660, 10, 572, 128, 272, 300}; +float rad = 0.0f; + +void FXElementsInit() { + cubesSheet = sfil_load_PNG_file("romfs:/res/fx/Cubes.png", SF2D_PLACE_RAM); + boxesSheet = sfil_load_PNG_file("romfs:/res/fx/Boxes.png", SF2D_PLACE_RAM); +} + +void FXElementsExit() { + sf2d_free_texture(boxesSheet); + sf2d_free_texture(cubesSheet); +} + +int movementOffsetLong(int maxrange) { + if (up && movementLong > - maxrange * MOVEMENTSPEED) movementLong -= 1; + if (movementLong == - maxrange * MOVEMENTSPEED) up = false; + if (!up && movementLong < maxrange * MOVEMENTSPEED) movementLong += 1; + if (movementLong == maxrange * MOVEMENTSPEED) up = true; + + return movementLong / MOVEMENTSPEED; +} + +int movementOffsetSlow(int maxrange) { + if (up && movementSlow > - maxrange * MOVEMENTSPEED) movementSlow -= 1; + if (movementSlow == - maxrange * MOVEMENTSPEED) up = false; + if (!up && movementSlow < maxrange * MOVEMENTSPEED) movementSlow += 1; + if (movementSlow == maxrange * MOVEMENTSPEED) up = true; + + return movementSlow / MOVEMENTSPEED; +} + +int giveTransparence() { + if (vanish && trasp > 126) trasp -= 1; + if (trasp == 126) vanish = false; + if (!(vanish) && trasp < 254) trasp += 1; + if (trasp == 254) vanish = true; + + return trasp; +} + +void animateBG(bool isUp) { + int maxrange = (isUp) ? 400 : 320; + sf2d_draw_texture_part(boxesSheet, 0, 0, maxrange - x[0] / 2, 0, maxrange, 240); + + sf2d_draw_texture_part(cubesSheet, x[1] / 2, 50, 0, 6, 66, 56); //cube1 + sf2d_draw_texture_part_rotate_scale(cubesSheet, x[2] / 2, 180, rad, 67, 11, 56, 51, 1, 1); //cube2rotate + sf2d_draw_texture_part(cubesSheet, x[3] / 2, 82, 124, 0, 57, 62); //cube3 + sf2d_draw_texture_part_rotate_scale(cubesSheet, x[4] / 2, 60, rad, 182, 6, 58, 56, 1, 1); //cube4rotate + sf2d_draw_texture_part(cubesSheet, x[5] / 2, 85, 241, 24, 41, 38); //cube5 + sf2d_draw_texture_part(cubesSheet, x[6] / 2, 126, 283, 36, 27, 26); //cube6 + + //rep + sf2d_draw_texture_part_rotate_scale(cubesSheet, x[7] / 2, 140, rad, 67, 11, 56, 51, 1, 1); //cube2rotate + sf2d_draw_texture_part(cubesSheet, x[8] / 2, 66, 283, 36, 27, 26); //cube6 + sf2d_draw_texture_part(cubesSheet, x[9] / 2, 78, 311, 47, 14, 15); //cube7 + sf2d_draw_texture_part(cubesSheet, x[10] / 2, 48, 311, 47, 14, 15); //cube7 + + x[0] = (x[0] > maxrange * 2) ? 0 : (x[0] + 1); + + for (int i = 1; i < 11; i++) + x[i] = (x[i] >= maxrange * 2 + 45) ? (x[i] - (181 + maxrange * 2)) : (x[i] + 1); + + rad = (rad >= 360) ? 0.0f : (rad + 0.005f); +} \ No newline at end of file diff --git a/source/fx.h b/source/fx.h new file mode 100644 index 000000000..61bd77300 --- /dev/null +++ b/source/fx.h @@ -0,0 +1,29 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#pragma once + +#include "graphic.h" + +void FXElementsInit(); +void FXElementsExit(); +int movementOffsetLong(int maxrange); +int movementOffsetSlow(int maxrange); +int giveTransparence(); +void animateBG(bool isUp); \ No newline at end of file diff --git a/source/graphic.c b/source/graphic.c new file mode 100644 index 000000000..abeae2415 --- /dev/null +++ b/source/graphic.c @@ -0,0 +1,1668 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include +#include +#include +#include +#include +#include "graphic.h" +#include "fx.h" +#include "editor.h" +#include "http.h" + +int lookup[] = {0, 1, 2, 4, 5, 3}; + +sftd_font *fontBold18, *fontBold15, *fontBold14, *fontBold12, *fontBold11, *fontBold9, *fontFixed; +sf2d_texture *upperTextGS, *lowerTextGS, *dexBox, *dexN, *hiddenPowerBG, *hiddenPowerButton, *selectBoxButton, *ballsBG, *ballButton, *male, *female, *naturesButton, *naturestx, *movesBottom, *topMovesBG, *editorBar, *editorStatsBG, *subArrow, *backgroundTop, *miniBox, *plusButton, *minusButton, *balls, *typesSheet, *bottomMask, *transferButton, *bankTop, *shinyStar, *normalBar, *LButton, *RButton, *creditsTop, *pokeball, *topBorder, *bottomBorder, *gameSelectorBottom, *gameSelectorTop, *mainMenuBottom, *menuBar, *menuSelectedBar, *darkButton, *eventTop, *left, *lightButton, *redButton, *right, *spritesSmall, *eventMenuBottomBar, *eventMenuTopBarSelected, *eventMenuTopBar, *warningTop, *warningBottom, *boxView, *infoView, *LRBar, *selector, *editorBG, *plus, *minus, *back, *setting, *selectorCloning, *button, *bottomPopUp, *pokemonBufferBox, *cleanTop, *DSBottomBG, *DSTopBG, *DSBarSelected, *DSBar, *DSEventBottom, *DSLangSelected, *DSLang, *DSEventTop, *DSNormalBarL, *DSNormalBarR, *DSSelectedBarL, *DSSelectedBarR, *topSelectedMove, *settings, *item, *alternativeSpritesSmall; + +char *gamesList[] = {"X", "Y", "OR", "AS", "S", "M", "D", "P", "PL", "HG", "SS", "B", "W", "W2", "B2"}; + +static char *abilities[] = {"None", "Stench", "Drizzle", "Speed Boost", "Battle Armor", "Sturdy", "Damp", "Limber", "Sand Veil", "Static", "Volt Absorb", "Water Absorb", "Oblivious", "Cloud Nine", "Compound Eyes", "Insomnia", "Color Change", "Immunity", "Flash Fire", "Shield Dust", "Own Tempo", "Suction Cups", "Intimidate", "Shadow Tag", "Rough Skin", "Wonder Guard", "Levitate", "Effect Spore", "Synchronize", "Clear Body", "Natural Cure", "Lightning Rod", "Serene Grace", "Swift Swim", "Chlorophyll", "Illuminate", "Trace", "Huge Power", "Poison Point", "Inner Focus", "Magma Armor", "Water Veil", "Magnet Pull", "Soundproof", "Rain Dish", "Sand Stream", "Pressure", "Thick Fat", "Early Bird", "Flame Body", "Run Away", "Keen Eye", "Hyper Cutter", "Pickup", "Truant", "Hustle", "Cute Charm", "Plus", "Minus", "Forecast", "Sticky Hold", "Shed Skin", "Guts", "Marvel Scale", "Liquid Ooze", "Overgrow", "Blaze", "Torrent", "Swarm", "Rock Head", "Drought", "Arena Trap", "Vital Spirit", "White Smoke", "Pure Power", "Shell Armor", "Air Lock", "Tangled Feet", "Motor Drive", "Rivalry", "Steadfast", "Snow Cloak", "Gluttony", "Anger Point", "Unburden", "Heatproof", "Simple", "Dry Skin", "Download", "Iron Fist", "Poison Heal", "Adaptability", "Skill Link", "Hydration", "Solar Power", "Quick Feet", "Normalize", "Sniper", "Magic Guard", "No Guard", "Stall", "Technician", "Leaf Guard", "Klutz", "Mold Breaker", "Super Luck", "Aftermath", "Anticipation", "Forewarn", "Unaware", "Tinted Lens", "Filter", "Slow Start", "Scrappy", "Storm Drain", "Ice Body", "Solid Rock", "Snow Warning", "Honey Gather", "Frisk", "Reckless", "Multitype", "Flower Gift", "Bad Dreams", "Pickpocket", "Sheer Force", "Contrary", "Unnerve", "Defiant", "Defeatist", "Cursed Body", "Healer", "Friend Guard", "Weak Armor", "Heavy Metal", "Light Metal", "Multiscale", "Toxic Boost", "Flare Boost", "Harvest", "Telepathy", "Moody", "Overcoat", "Poison Touch", "Regenerator", "Big Pecks", "Sand Rush", "Wonder Skin", "Analytic", "Illusion", "Imposter", "Infiltrator", "Mummy", "Moxie", "Justified", "Rattled", "Magic Bounce", "Sap Sipper", "Prankster", "Sand Force", "Iron Barbs", "Zen Mode", "Victory Star", "Turboblaze", "Teravolt", "Aroma Veil", "Flower Veil", "Cheek Pouch", "Protean", "Fur Coat", "Magician", "Bulletproof", "Competitive", "Strong Jaw", "Refrigerate", "Sweet Veil", "Stance Change", "Gale Wings", "Mega Launcher", "Grass Pelt", "Symbiosis", "Tough Claws", "Pixilate", "Gooey", "Aerilate", "Parental Bond", "Dark Aura", "Fairy Aura", "Aura Break", "Primordial Sea", "Desolate Land", "Delta Stream", "Stamina", "Wimp Out", "Emergency Exit", "Water Compaction", "Merciless", "Shields Down", "Stakeout", "Water Bubble", "Steelworker", "Berserk", "Slush Rush", "Long Reach", "Liquid Voice", "Triage", "Galvanize", "Surge Surfer", "Schooling", "Disguise", "Battle Bond", "Power Construct", "Corrosion", "Comatose", "Queenly Majesty", "Innards Out", "Dancer", "Battery", "Fluffy", "Dazzling", "Soul-Heart", "Tangling Hair", "Receiver", "Power of Alchemy", "Beast Boost", "RKS System", "Electric Surge", "Psychic Surge", "Misty Surge", "Grassy Surge", "Full Metal Body", "Shadow Shield", "Prism Armor"}; +static char *moves[] = {"None", "Pound", "Karate Chop", "Double Slap", "Comet Punch", "Mega Punch", "Pay Day", "Fire Punch", "Ice Punch", "Thunder Punch", "Scratch", "Vice Grip", "Guillotine", "Razor Wind", "Swords Dance", "Cut", "Gust", "Wing Attack", "Whirlwind", "Fly", "Bind", "Slam", "Vine Whip", "Stomp", "Double Kick", "Mega Kick", "Jump Kick", "Rolling Kick", "Sand Attack", "Headbutt", "Horn Attack", "Fury Attack", "Horn Drill", "Tackle", "Body Slam", "Wrap", "Take Down", "Thrash", "Double-Edge", "Tail Whip", "Poison Sting", "Twineedle", "Pin Missile", "Leer", "Bite", "Growl", "Roar", "Sing", "Supersonic", "Sonic Boom", "Disable", "Acid", "Ember", "Flamethrower", "Mist", "Water Gun", "Hydro Pump", "Surf", "Ice Beam", "Blizzard", "Psybeam", "Bubble Beam", "Aurora Beam", "Hyper Beam", "Peck", "Drill Peck", "Submission", "Low Kick", "Counter", "Seismic Toss", "Strength", "Absorb", "Mega Drain", "Leech Seed", "Growth", "Razor Leaf", "Solar Beam", "Poison Powder", "Stun Spore", "Sleep Powder", "Petal Dance", "String Shot", "Dragon Rage", "Fire Spin", "Thunder Shock", "Thunderbolt", "Thunder Wave", "Thunder", "Rock Throw", "Earthquake", "Fissure", "Dig", "Toxic", "Confusion", "Psychic", "Hypnosis", "Meditate", "Agility", "Quick Attack", "Rage", "Teleport", "Night Shade", "Mimic", "Screech", "Double Team", "Recover", "Harden", "Minimize", "Smokescreen", "Confuse Ray", "Withdraw", "Defense Curl", "Barrier", "Light Screen", "Haze", "Reflect", "Focus Energy", "Bide", "Metronome", "Mirror Move", "Self-Destruct", "Egg Bomb", "Lick", "Smog", "Sludge", "Bone Club", "Fire Blast", "Waterfall", "Clamp", "Swift", "Skull Bash", "Spike Cannon", "Constrict", "Amnesia", "Kinesis", "Soft-Boiled", "High Jump Kick", "Glare", "Dream Eater", "Poison Gas", "Barrage", "Leech Life", "Lovely Kiss", "Sky Attack", "Transform", "Bubble", "Dizzy Punch", "Spore", "Flash", "Psywave", "Splash", "Acid Armor", "Crabhammer", "Explosion", "Fury Swipes", "Bonemerang", "Rest", "Rock Slide", "Hyper Fang", "Sharpen", "Conversion", "Tri Attack", "Super Fang", "Slash", "Substitute", "Struggle", "Sketch", "Triple Kick", "Thief", "Spider Web", "Mind Reader", "Nightmare", "Flame Wheel", "Snore", "Curse", "Flail", "Conversion 2", "Aeroblast", "Cotton Spore", "Reversal", "Spite", "Powder Snow", "Protect", "Mach Punch", "Scary Face", "Feint Attack", "Sweet Kiss", "Belly Drum", "Sludge Bomb", "Mud-Slap", "Octazooka", "Spikes", "Zap Cannon", "Foresight", "Destiny Bond", "Perish Song", "Icy Wind", "Detect", "Bone Rush", "Lock-On", "Outrage", "Sandstorm", "Giga Drain", "Endure", "Charm", "Rollout", "False Swipe", "Swagger", "Milk Drink", "Spark", "Fury Cutter", "Steel Wing", "Mean Look", "Attract", "Sleep Talk", "Heal Bell", "Return", "Present", "Frustration", "Safeguard", "Pain Split", "Sacred Fire", "Magnitude", "Dynamic Punch", "Megahorn", "Dragon Breath", "Baton Pass", "Encore", "Pursuit", "Rapid Spin", "Sweet Scent", "Iron Tail", "Metal Claw", "Vital Throw", "Morning Sun", "Synthesis", "Moonlight", "Hidden Power", "Cross Chop", "Twister", "Rain Dance", "Sunny Day", "Crunch", "Mirror Coat", "Psych Up", "Extreme Speed", "Ancient Power", "Shadow Ball", "Future Sight", "Rock Smash", "Whirlpool", "Beat Up", "Fake Out", "Uproar", "Stockpile", "Spit Up", "Swallow", "Heat Wave", "Hail", "Torment", "Flatter", "Will-O-Wisp", "Memento", "Facade", "Focus Punch", "Smelling Salts", "Follow Me", "Nature Power", "Charge", "Taunt", "Helping Hand", "Trick", "Role Play", "Wish", "Assist", "Ingrain", "Superpower", "Magic Coat", "Recycle", "Revenge", "Brick Break", "Yawn", "Knock Off", "Endeavor", "Eruption", "Skill Swap", "Imprison", "Refresh", "Grudge", "Snatch", "Secret Power", "Dive", "Arm Thrust", "Camouflage", "Tail Glow", "Luster Purge", "Mist Ball", "Feather Dance", "Teeter Dance", "Blaze Kick", "Mud Sport", "Ice Ball", "Needle Arm", "Slack Off", "Hyper Voice", "Poison Fang", "Crush Claw", "Blast Burn", "Hydro Cannon", "Meteor Mash", "Astonish", "Weather Ball", "Aromatherapy", "Fake Tears", "Air Cutter", "Overheat", "Odor Sleuth", "Rock Tomb", "Silver Wind", "Metal Sound", "Grass Whistle", "Tickle", "Cosmic Power", "Water Spout", "Signal Beam", "Shadow Punch", "Extrasensory", "Sky Uppercut", "Sand Tomb", "Sheer Cold", "Muddy Water", "Bullet Seed", "Aerial Ace", "Icicle Spear", "Iron Defense", "Block", "Howl", "Dragon Claw", "Frenzy Plant", "Bulk Up", "Bounce", "Mud Shot", "Poison Tail", "Covet", "Volt Tackle", "Magical Leaf", "Water Sport", "Calm Mind", "Leaf Blade", "Dragon Dance", "Rock Blast", "Shock Wave", "Water Pulse", "Doom Desire", "Psycho Boost", "Roost", "Gravity", "Miracle Eye", "Wake-Up Slap", "Hammer Arm", "Gyro Ball", "Healing Wish", "Brine", "Natural Gift", "Feint", "Pluck", "Tailwind", "Acupressure", "Metal Burst", "U-turn", "Close Combat", "Payback", "Assurance", "Embargo", "Fling", "Psycho Shift", "Trump Card", "Heal Block", "Wring Out", "Power Trick", "Gastro Acid", "Lucky Chant", "Me First", "Copycat", "Power Swap", "Guard Swap", "Punishment", "Last Resort", "Worry Seed", "Sucker Punch", "Toxic Spikes", "Heart Swap", "Aqua Ring", "Magnet Rise", "Flare Blitz", "Force Palm", "Aura Sphere", "Rock Polish", "Poison Jab", "Dark Pulse", "Night Slash", "Aqua Tail", "Seed Bomb", "Air Slash", "X-Scissor", "Bug Buzz", "Dragon Pulse", "Dragon Rush", "Power Gem", "Drain Punch", "Vacuum Wave", "Focus Blast", "Energy Ball", "Brave Bird", "Earth Power", "Switcheroo", "Giga Impact", "Nasty Plot", "Bullet Punch", "Avalanche", "Ice Shard", "Shadow Claw", "Thunder Fang", "Ice Fang", "Fire Fang", "Shadow Sneak", "Mud Bomb", "Psycho Cut", "Zen Headbutt", "Mirror Shot", "Flash Cannon", "Rock Climb", "Defog", "Trick Room", "Draco Meteor", "Discharge", "Lava Plume", "Leaf Storm", "Power Whip", "Rock Wrecker", "Cross Poison", "Gunk Shot", "Iron Head", "Magnet Bomb", "Stone Edge", "Captivate", "Stealth Rock", "Grass Knot", "Chatter", "Judgment", "Bug Bite", "Charge Beam", "Wood Hammer", "Aqua Jet", "Attack Order", "Defend Order", "Heal Order", "Head Smash", "Double Hit", "Roar of Time", "Spacial Rend", "Lunar Dance", "Crush Grip", "Magma Storm", "Dark Void", "Seed Flare", "Ominous Wind", "Shadow Force", "Hone Claws", "Wide Guard", "Guard Split", "Power Split", "Wonder Room", "Psyshock", "Venoshock", "Autotomize", "Rage Powder", "Telekinesis", "Magic Room", "Smack Down", "Storm Throw", "Flame Burst", "Sludge Wave", "Quiver Dance", "Heavy Slam", "Synchronoise", "Electro Ball", "Soak", "Flame Charge", "Coil", "Low Sweep", "Acid Spray", "Foul Play", "Simple Beam", "Entrainment", "After You", "Round", "Echoed Voice", "Chip Away", "Clear Smog", "Stored Power", "Quick Guard", "Ally Switch", "Scald", "Shell Smash", "Heal Pulse", "Hex", "Sky Drop", "Shift Gear", "Circle Throw", "Incinerate", "Quash", "Acrobatics", "Reflect Type", "Retaliate", "Final Gambit", "Bestow", "Inferno", "Water Pledge", "Fire Pledge", "Grass Pledge", "Volt Switch", "Struggle Bug", "Bulldoze", "Frost Breath", "Dragon Tail", "Work Up", "Electroweb", "Wild Charge", "Drill Run", "Dual Chop", "Heart Stamp", "Horn Leech", "Sacred Sword", "Razor Shell", "Heat Crash", "Leaf Tornado", "Steamroller", "Cotton Guard", "Night Daze", "Psystrike", "Tail Slap", "Hurricane", "Head Charge", "Gear Grind", "Searing Shot", "Techno Blast", "Relic Song", "Secret Sword", "Glaciate", "Bolt Strike", "Blue Flare", "Fiery Dance", "Freeze Shock", "Ice Burn", "Snarl", "Icicle Crash", "V-create", "Fusion Flare", "Fusion Bolt", "Flying Press", "Mat Block", "Belch", "Rototiller", "Sticky Web", "Fell Stinger", "Phantom Force", "Trick-or-Treat", "Noble Roar", "Ion Deluge", "Parabolic Charge", "Forest’s Curse", "Petal Blizzard", "Freeze-Dry", "Disarming Voice", "Parting Shot", "Topsy-Turvy", "Draining Kiss", "Crafty Shield", "Flower Shield", "Grassy Terrain", "Misty Terrain", "Electrify", "Play Rough", "Fairy Wind", "Moonblast", "Boomburst", "Fairy Lock", "King’s Shield", "Play Nice", "Confide", "Diamond Storm", "Steam Eruption", "Hyperspace Hole", "Water Shuriken", "Mystical Fire", "Spiky Shield", "Aromatic Mist", "Eerie Impulse", "Venom Drench", "Powder", "Geomancy", "Magnetic Flux", "Happy Hour", "Electric Terrain", "Dazzling Gleam", "Celebrate", "Hold Hands", "Baby-Doll Eyes", "Nuzzle", "Hold Back", "Infestation", "Power-Up Punch", "Oblivion Wing", "Thousand Arrows", "Thousand Waves", "Land’s Wrath", "Light of Ruin", "Origin Pulse", "Precipice Blades", "Dragon Ascent", "Hyperspace Fury", "Breakneck Blitz", "Breakneck Blitz", "All-Out Pummeling", "All-Out Pummeling", "Supersonic Skystrike", "Supersonic Skystrike", "Acid Downpour", "Acid Downpour", "Tectonic Rage", "Tectonic Rage", "Continental Crush", "Continental Crush", "Savage Spin-Out", "Savage Spin-Out", "Never-Ending Nightmare", "Never-Ending Nightmare", "Corkscrew Crash", "Corkscrew Crash", "Inferno Overdrive", "Inferno Overdrive", "Hydro Vortex", "Hydro Vortex", "Bloom Doom", "Bloom Doom", "Gigavolt Havoc", "Gigavolt Havoc", "Shattered Psyche", "Shattered Psyche", "Subzero Slammer", "Subzero Slammer", "Devastating Drake", "Devastating Drake", "Black Hole Eclipse", "Black Hole Eclipse", "Twinkle Tackle", "Twinkle Tackle", "Catastropika", "Shore Up", "First Impression", "Baneful Bunker", "Spirit Shackle", "Darkest Lariat", "Sparkling Aria", "Ice Hammer", "Floral Healing", "High Horsepower", "Strength Sap", "Solar Blade", "Leafage", "Spotlight", "Toxic Thread", "Laser Focus", "Gear Up", "Throat Chop", "Pollen Puff", "Anchor Shot", "Psychic Terrain", "Lunge", "Fire Lash", "Power Trip", "Burn Up", "Speed Swap", "Smart Strike", "Purify", "Revelation Dance", "Core Enforcer", "Trop Kick", "Instruct", "Beak Blast", "Clanging Scales", "Dragon Hammer", "Brutal Swing", "Aurora Veil", "Sinister Arrow Raid", "Malicious Moonsault", "Oceanic Operetta", "Guardian of Alola", "Soul-Stealing 7-Star Strike", "Stoked Sparksurfer", "Pulverizing Pancake", "Extreme Evoboost", "Genesis Supernova", "Shell Trap", "Fleur Cannon", "Psychic Fangs", "Stomping Tantrum", "Shadow Bone", "Accelerock", "Liquidation", "Prismatic Laser", "Spectral Thief", "Sunsteel Strike", "Moongeist Beam", "Tearful Look", "Zing Zap", "Nature’s Madness", "Multi-Attack", "10,000,000 Volt Thunderbolt"}; +static char *movesSorted[] = {"None", "Absorb", "Accelerock", "Acid", "Acid Armor", "Acid Downpour", "Acid Downpour", "Acid Spray", "Acrobatics", "Acupressure", "Aerial Ace", "Aeroblast", "After You", "Agility", "Air Cutter", "Air Slash", "All-Out Pummeling", "All-Out Pummeling", "Ally Switch", "Amnesia", "Anchor Shot", "Ancient Power", "Aqua Jet", "Aqua Ring", "Aqua Tail", "Arm Thrust", "Aromatherapy", "Aromatic Mist", "Assist", "Assurance", "Astonish", "Attack Order", "Attract", "Aura Sphere", "Aurora Beam", "Aurora Veil", "Autotomize", "Avalanche", "Baby-Doll Eyes", "Baneful Bunker", "Barrage", "Barrier", "Baton Pass", "Beak Blast", "Beat Up", "Belch", "Belly Drum", "Bestow", "Bide", "Bind", "Bite", "Black Hole Eclipse", "Black Hole Eclipse", "Blast Burn", "Blaze Kick", "Blizzard", "Block", "Bloom Doom", "Bloom Doom", "Blue Flare", "Body Slam", "Bolt Strike", "Bone Club", "Bone Rush", "Bonemerang", "Boomburst", "Bounce", "Brave Bird", "Breakneck Blitz", "Breakneck Blitz", "Brick Break", "Brine", "Brutal Swing", "Bubble", "Bubble Beam", "Bug Bite", "Bug Buzz", "Bulk Up", "Bulldoze", "Bullet Punch", "Bullet Seed", "Burn Up", "Calm Mind", "Camouflage", "Captivate", "Catastropika", "Celebrate", "Charge", "Charge Beam", "Charm", "Chatter", "Chip Away", "Circle Throw", "Clamp", "Clanging Scales", "Clear Smog", "Close Combat", "Coil", "Comet Punch", "Confide", "Confuse Ray", "Confusion", "Constrict", "Continental Crush", "Continental Crush", "Conversion", "Conversion 2", "Copycat", "Core Enforcer", "Corkscrew Crash", "Corkscrew Crash", "Cosmic Power", "Cotton Guard", "Cotton Spore", "Counter", "Covet", "Crabhammer", "Crafty Shield", "Cross Chop", "Cross Poison", "Crunch", "Crush Claw", "Crush Grip", "Curse", "Cut", "Dark Pulse", "Dark Void", "Darkest Lariat", "Dazzling Gleam", "Defend Order", "Defense Curl", "Defog", "Destiny Bond", "Detect", "Devastating Drake", "Devastating Drake", "Diamond Storm", "Dig", "Disable", "Disarming Voice", "Discharge", "Dive", "Dizzy Punch", "Doom Desire", "Double Hit", "Double Kick", "Double Slap", "Double Team", "Double-Edge", "Draco Meteor", "Dragon Ascent", "Dragon Breath", "Dragon Claw", "Dragon Dance", "Dragon Hammer", "Dragon Pulse", "Dragon Rage", "Dragon Rush", "Dragon Tail", "Drain Punch", "Draining Kiss", "Dream Eater", "Drill Peck", "Drill Run", "Dual Chop", "Dynamic Punch", "Earth Power", "Earthquake", "Echoed Voice", "Eerie Impulse", "Egg Bomb", "Electric Terrain", "Electrify", "Electro Ball", "Electroweb", "Embargo", "Ember", "Encore", "Endeavor", "Endure", "Energy Ball", "Entrainment", "Eruption", "Explosion", "Extrasensory", "Extreme Evoboost", "Extreme Speed", "Facade", "Fairy Lock", "Fairy Wind", "Fake Out", "Fake Tears", "False Swipe", "Feather Dance", "Feint", "Feint Attack", "Fell Stinger", "Fiery Dance", "Final Gambit", "Fire Blast", "Fire Fang", "Fire Lash", "Fire Pledge", "Fire Punch", "Fire Spin", "First Impression", "Fissure", "Flail", "Flame Burst", "Flame Charge", "Flame Wheel", "Flamethrower", "Flare Blitz", "Flash", "Flash Cannon", "Flatter", "Fleur Cannon", "Fling", "Floral Healing", "Flower Shield", "Fly", "Flying Press", "Focus Blast", "Focus Energy", "Focus Punch", "Follow Me", "Force Palm", "Foresight", "Forest’s Curse", "Foul Play", "Freeze Shock", "Freeze-Dry", "Frenzy Plant", "Frost Breath", "Frustration", "Fury Attack", "Fury Cutter", "Fury Swipes", "Fusion Bolt", "Fusion Flare", "Future Sight", "Gastro Acid", "Gear Grind", "Gear Up", "Genesis Supernova", "Geomancy", "Giga Drain", "Giga Impact", "Gigavolt Havoc", "Gigavolt Havoc", "Glaciate", "Glare", "Grass Knot", "Grass Pledge", "Grass Whistle", "Grassy Terrain", "Gravity", "Growl", "Growth", "Grudge", "Guard Split", "Guard Swap", "Guardian of Alola", "Guillotine", "Gunk Shot", "Gust", "Gyro Ball", "Hail", "Hammer Arm", "Happy Hour", "Harden", "Haze", "Head Charge", "Head Smash", "Headbutt", "Heal Bell", "Heal Block", "Heal Order", "Heal Pulse", "Healing Wish", "Heart Stamp", "Heart Swap", "Heat Crash", "Heat Wave", "Heavy Slam", "Helping Hand", "Hex", "Hidden Power", "High Horsepower", "High Jump Kick", "Hold Back", "Hold Hands", "Hone Claws", "Horn Attack", "Horn Drill", "Horn Leech", "Howl", "Hurricane", "Hydro Cannon", "Hydro Pump", "Hydro Vortex", "Hydro Vortex", "Hyper Beam", "Hyper Fang", "Hyper Voice", "Hyperspace Fury", "Hyperspace Hole", "Hypnosis", "Ice Ball", "Ice Beam", "Ice Burn", "Ice Fang", "Ice Hammer", "Ice Punch", "Ice Shard", "Icicle Crash", "Icicle Spear", "Icy Wind", "Imprison", "Incinerate", "Inferno", "Inferno Overdrive", "Inferno Overdrive", "Infestation", "Ingrain", "Instruct", "Ion Deluge", "Iron Defense", "Iron Head", "Iron Tail", "Judgment", "Jump Kick", "Karate Chop", "Kinesis", "King’s Shield", "Knock Off", "Land’s Wrath", "Laser Focus", "Last Resort", "Lava Plume", "Leaf Blade", "Leaf Storm", "Leaf Tornado", "Leafage", "Leech Life", "Leech Seed", "Leer", "Lick", "Light of Ruin", "Light Screen", "Liquidation", "Lock-On", "Lovely Kiss", "Low Kick", "Low Sweep", "Lucky Chant", "Lunar Dance", "Lunge", "Luster Purge", "Mach Punch", "Magic Coat", "Magic Room", "Magical Leaf", "Magma Storm", "Magnet Bomb", "Magnet Rise", "Magnetic Flux", "Magnitude", "Malicious Moonsault", "Mat Block", "Me First", "Mean Look", "Meditate", "Mega Drain", "Mega Kick", "Mega Punch", "Megahorn", "Memento", "Metal Burst", "Metal Claw", "Metal Sound", "Meteor Mash", "Metronome", "Milk Drink", "Mimic", "Mind Reader", "Minimize", "Miracle Eye", "Mirror Coat", "Mirror Move", "Mirror Shot", "Mist", "Mist Ball", "Misty Terrain", "Moonblast", "Moongeist Beam", "Moonlight", "Morning Sun", "Mud Bomb", "Mud Shot", "Mud Sport", "Mud-Slap", "Muddy Water", "Multi-Attack", "Mystical Fire", "Nasty Plot", "Natural Gift", "Nature Power", "Nature’s Madness", "Needle Arm", "Never-Ending Nightmare", "Never-Ending Nightmare", "Night Daze", "Night Shade", "Night Slash", "Nightmare", "Noble Roar", "Nuzzle", "Oblivion Wing", "Oceanic Operetta", "Octazooka", "Odor Sleuth", "Ominous Wind", "Origin Pulse", "Outrage", "Overheat", "Pain Split", "Parabolic Charge", "Parting Shot", "Pay Day", "Payback", "Peck", "Perish Song", "Petal Blizzard", "Petal Dance", "Phantom Force", "Pin Missile", "Play Nice", "Play Rough", "Pluck", "Poison Fang", "Poison Gas", "Poison Jab", "Poison Powder", "Poison Sting", "Poison Tail", "Pollen Puff", "Pound", "Powder", "Powder Snow", "Power Gem", "Power Split", "Power Swap", "Power Trick", "Power Trip", "Power Whip", "Power-Up Punch", "Precipice Blades", "Present", "Prismatic Laser", "Protect", "Psybeam", "Psych Up", "Psychic", "Psychic Fangs", "Psychic Terrain", "Psycho Boost", "Psycho Cut", "Psycho Shift", "Psyshock", "Psystrike", "Psywave", "Pulverizing Pancake", "Punishment", "Purify", "Pursuit", "Quash", "Quick Attack", "Quick Guard", "Quiver Dance", "Rage", "Rage Powder", "Rain Dance", "Rapid Spin", "Razor Leaf", "Razor Shell", "Razor Wind", "Recover", "Recycle", "Reflect", "Reflect Type", "Refresh", "Relic Song", "Rest", "Retaliate", "Return", "Revelation Dance", "Revenge", "Reversal", "Roar", "Roar of Time", "Rock Blast", "Rock Climb", "Rock Polish", "Rock Slide", "Rock Smash", "Rock Throw", "Rock Tomb", "Rock Wrecker", "Role Play", "Rolling Kick", "Rollout", "Roost", "Rototiller", "Round", "Sacred Fire", "Sacred Sword", "Safeguard", "Sand Attack", "Sand Tomb", "Sandstorm", "Savage Spin-Out", "Savage Spin-Out", "Scald", "Scary Face", "Scratch", "Screech", "Searing Shot", "Secret Power", "Secret Sword", "Seed Bomb", "Seed Flare", "Seismic Toss", "Self-Destruct", "Shadow Ball", "Shadow Bone", "Shadow Claw", "Shadow Force", "Shadow Punch", "Shadow Sneak", "Sharpen", "Shattered Psyche", "Shattered Psyche", "Sheer Cold", "Shell Smash", "Shell Trap", "Shift Gear", "Shock Wave", "Shore Up", "Signal Beam", "Silver Wind", "Simple Beam", "Sing", "Sinister Arrow Raid", "Sketch", "Skill Swap", "Skull Bash", "Sky Attack", "Sky Drop", "Sky Uppercut", "Slack Off", "Slam", "Slash", "Sleep Powder", "Sleep Talk", "Sludge", "Sludge Bomb", "Sludge Wave", "Smack Down", "Smart Strike", "Smelling Salts", "Smog", "Smokescreen", "Snarl", "Snatch", "Snore", "Soak", "Soft-Boiled", "Solar Beam", "Solar Blade", "Sonic Boom", "Soul-Stealing 7-Star Strike", "Spacial Rend", "Spark", "Sparkling Aria", "Spectral Thief", "Speed Swap", "Spider Web", "Spike Cannon", "Spikes", "Spiky Shield", "Spirit Shackle", "Spit Up", "Spite", "Splash", "Spore", "Spotlight", "Stealth Rock", "Steam Eruption", "Steamroller", "Steel Wing", "Sticky Web", "Stockpile", "Stoked Sparksurfer", "Stomp", "Stomping Tantrum", "Stone Edge", "Stored Power", "Storm Throw", "Strength", "Strength Sap", "String Shot", "Struggle", "Struggle Bug", "Stun Spore", "Submission", "Substitute", "Subzero Slammer", "Subzero Slammer", "Sucker Punch", "Sunny Day", "Sunsteel Strike", "Super Fang", "Superpower", "Supersonic", "Supersonic Skystrike", "Supersonic Skystrike", "Surf", "Swagger", "Swallow", "Sweet Kiss", "Sweet Scent", "Swift", "Switcheroo", "Swords Dance", "Synchronoise", "Synthesis", "Tackle", "Tail Glow", "Tail Slap", "Tail Whip", "Tailwind", "Take Down", "Taunt", "Tearful Look", "Techno Blast", "Tectonic Rage", "Tectonic Rage", "Teeter Dance", "Telekinesis", "Teleport", "Thief", "Thousand Arrows", "Thousand Waves", "Thrash", "Throat Chop", "Thunder", "Thunder Fang", "Thunder Punch", "Thunder Shock", "Thunder Wave", "Thunderbolt", "Tickle", "Topsy-Turvy", "Torment", "Toxic", "Toxic Spikes", "Toxic Thread", "Transform", "Tri Attack", "Trick", "Trick Room", "Trick-or-Treat", "Triple Kick", "Trop Kick", "Trump Card", "Twineedle", "Twinkle Tackle", "Twinkle Tackle", "Twister", "U-turn", "Uproar", "V-create", "Vacuum Wave", "Venom Drench", "Venoshock", "Vice Grip", "Vine Whip", "Vital Throw", "Volt Switch", "Volt Tackle", "Wake-Up Slap", "Water Gun", "Water Pledge", "Water Pulse", "Water Shuriken", "Water Sport", "Water Spout", "Waterfall", "Weather Ball", "Whirlpool", "Whirlwind", "Wide Guard", "Wild Charge", "Will-O-Wisp", "Wing Attack", "Wish", "Withdraw", "Wonder Room", "Wood Hammer", "Work Up", "Worry Seed", "Wrap", "Wring Out", "X-Scissor", "Yawn", "Zap Cannon", "Zen Headbutt", "Zing Zap", "10,000,000 Volt Thunderbolt"}; +static char *natures[] = {"Hardy", "Lonely", "Brave", "Adamant", "Naughty", "Bold", "Docile", "Relaxed", "Impish", "Lax", "Timid", "Hasty", "Serious", "Jolly", "Naive", "Modest", "Mild", "Quiet", "Bashful", "Rash", "Calm", "Gentle", "Sassy", "Careful", "Quirky"}; +static char *items[] = {"None", "Master Ball", "Ultra Ball", "Great Ball", "Poke Ball", "Safari Ball", "Net Ball", "Dive Ball", "Nest Ball", "Repeat Ball", "Timer Ball", "Luxury Ball", "Premier Ball", "Dusk Ball", "Heal Ball", "Quick Ball", "Cherish Ball", "Potion", "Antidote", "Burn Heal", "Ice Heal", "Awakening", "Paralyze Heal", "Full Restore", "Max Potion", "Hyper Potion", "Super Potion", "Full Heal", "Revive", "Max Revive", "Fresh Water", "Soda Pop", "Lemonade", "Moomoo Milk", "Energy Powder", "Energy Root", "Heal Powder", "Revival Herb", "Ether", "Max Ether", "Elixir", "Max Elixir", "Lava Cookie", "Berry Juice", "Sacred Ash", "HP Up", "Protein", "Iron", "Carbos", "Calcium", "Rare Candy", "PP Up", "Zinc", "PP Max", "Old Gateau", "Guard Spec.", "Dire Hit", "X Attack", "X Defense", "X Speed", "X Accuracy", "X Sp. Atk", "X Sp. Def", "Poké Doll", "Fluffy Tail", "Blue Flute", "Yellow Flute", "Red Flute", "Black Flute", "White Flute", "Shoal Salt", "Shoal Shell", "Red Shard", "Blue Shard", "Yellow Shard", "Green Shard", "Super Repel", "Max Repel", "Escape Rope", "Repel", "Sun Stone", "Moon Stone", "Fire Stone", "Thunder Stone", "Water Stone", "Leaf Stone", "Tiny Mushroom", "Big Mushroom", "Pearl", "Big Pearl", "Stardust", "Star Piece", "Nugget", "Heart Scale", "Honey", "Growth Mulch", "Damp Mulch", "Stable Mulch", "Gooey Mulch", "Root Fossil", "Claw Fossil", "Helix Fossil", "Dome Fossil", "Old Amber", "Armor Fossil", "Skull Fossil", "Rare Bone", "Shiny Stone", "Dusk Stone", "Dawn Stone", "Oval Stone", "Odd Keystone", "Griseous Orb", "???", "???", "???", "Douse Drive", "Shock Drive", "Burn Drive", "Chill Drive", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "Sweet Heart", "Adamant Orb", "Lustrous Orb", "Greet Mail", "Favored Mail", "RSVP Mail", "Thanks Mail", "Inquiry Mail", "Like Mail", "Reply Mail", "Bridge Mail S", "Bridge Mail D", "Bridge Mail T", "Bridge Mail V", "Bridge Mail M", "Cheri Berry", "Chesto Berry", "Pecha Berry", "Rawst Berry", "Aspear Berry", "Leppa Berry", "Oran Berry", "Persim Berry", "Lum Berry", "Sitrus Berry", "Figy Berry", "Wiki Berry", "Mago Berry", "Aguav Berry", "Iapapa Berry", "Razz Berry", "Bluk Berry", "Nanab Berry", "Wepear Berry", "Pinap Berry", "Pomeg Berry", "Kelpsy Berry", "Qualot Berry", "Hondew Berry", "Grepa Berry", "Tamato Berry", "Cornn Berry", "Magost Berry", "Rabuta Berry", "Nomel Berry", "Spelon Berry", "Pamtre Berry", "Watmel Berry", "Durin Berry", "Belue Berry", "Occa Berry", "Passho Berry", "Wacan Berry", "Rindo Berry", "Yache Berry", "Chople Berry", "Kebia Berry", "Shuca Berry", "Coba Berry", "Payapa Berry", "Tanga Berry", "Charti Berry", "Kasib Berry", "Haban Berry", "Colbur Berry", "Babiri Berry", "Chilan Berry", "Liechi Berry", "Ganlon Berry", "Salac Berry", "Petaya Berry", "Apicot Berry", "Lansat Berry", "Starf Berry", "Enigma Berry", "Micle Berry", "Custap Berry", "Jaboca Berry", "Rowap Berry", "Bright Powder", "White Herb", "Macho Brace", "Exp. Share", "Quick Claw", "Soothe Bell", "Mental Herb", "Choice Band", "King’s Rock", "Silver Powder", "Amulet Coin", "Cleanse Tag", "Soul Dew", "Deep Sea Tooth", "Deep Sea Scale", "Smoke Ball", "Everstone", "Focus Band", "Lucky Egg", "Scope Lens", "Metal Coat", "Leftovers", "Dragon Scale", "Light Ball", "Soft Sand", "Hard Stone", "Miracle Seed", "Black Glasses", "Black Belt", "Magnet", "Mystic Water", "Sharp Beak", "Poison Barb", "Never-Melt Ice", "Spell Tag", "Twisted Spoon", "Charcoal", "Dragon Fang", "Silk Scarf", "Up-Grade", "Shell Bell", "Sea Incense", "Lax Incense", "Lucky Punch", "Metal Powder", "Thick Club", "Stick", "Red Scarf", "Blue Scarf", "Pink Scarf", "Green Scarf", "Yellow Scarf", "Wide Lens", "Muscle Band", "Wise Glasses", "Expert Belt", "Light Clay", "Life Orb", "Power Herb", "Toxic Orb", "Flame Orb", "Quick Powder", "Focus Sash", "Zoom Lens", "Metronome", "Iron Ball", "Lagging Tail", "Destiny Knot", "Black Sludge", "Icy Rock", "Smooth Rock", "Heat Rock", "Damp Rock", "Grip Claw", "Choice Scarf", "Sticky Barb", "Power Bracer", "Power Belt", "Power Lens", "Power Band", "Power Anklet", "Power Weight", "Shed Shell", "Big Root", "Choice Specs", "Flame Plate", "Splash Plate", "Zap Plate", "Meadow Plate", "Icicle Plate", "Fist Plate", "Toxic Plate", "Earth Plate", "Sky Plate", "Mind Plate", "Insect Plate", "Stone Plate", "Spooky Plate", "Draco Plate", "Dread Plate", "Iron Plate", "Odd Incense", "Rock Incense", "Full Incense", "Wave Incense", "Rose Incense", "Luck Incense", "Pure Incense", "Protector", "Electirizer", "Magmarizer", "Dubious Disc", "Reaper Cloth", "Razor Claw", "Razor Fang", "TM01", "TM02", "TM03", "TM04", "TM05", "TM06", "TM07", "TM08", "TM09", "TM10", "TM11", "TM12", "TM13", "TM14", "TM15", "TM16", "TM17", "TM18", "TM19", "TM20", "TM21", "TM22", "TM23", "TM24", "TM25", "TM26", "TM27", "TM28", "TM29", "TM30", "TM31", "TM32", "TM33", "TM34", "TM35", "TM36", "TM37", "TM38", "TM39", "TM40", "TM41", "TM42", "TM43", "TM44", "TM45", "TM46", "TM47", "TM48", "TM49", "TM50", "TM51", "TM52", "TM53", "TM54", "TM55", "TM56", "TM57", "TM58", "TM59", "TM60", "TM61", "TM62", "TM63", "TM64", "TM65", "TM66", "TM67", "TM68", "TM69", "TM70", "TM71", "TM72", "TM73", "TM74", "TM75", "TM76", "TM77", "TM78", "TM79", "TM80", "TM81", "TM82", "TM83", "TM84", "TM85", "TM86", "TM87", "TM88", "TM89", "TM90", "TM91", "TM92", "HM01", "HM02", "HM03", "HM04", "HM05", "HM06", "???", "???", "Explorer Kit", "Loot Sack", "Rule Book", "Poké Radar", "Point Card", "Journal", "Seal Case", "Fashion Case", "Seal Bag", "Pal Pad", "Works Key", "Old Charm", "Galactic Key", "Red Chain", "Town Map", "Vs. Seeker", "Coin Case", "Old Rod", "Good Rod", "Super Rod", "Sprayduck", "Poffin Case", "Bike", "Suite Key", "Oak’s Letter", "Lunar Wing", "Member Card", "Azure Flute", "S.S. Ticket", "Contest Pass", "Magma Stone", "Parcel", "Coupon 1", "Coupon 2", "Coupon 3", "Storage Key", "Secret Potion", "Vs. Recorder", "Gracidea", "Secret Key", "Apricorn Box", "Unown Report", "Berry Pots", "Dowsing Machine", "Blue Card", "Slowpoke Tail", "Clear Bell", "Card Key", "Basement Key", "Squirt Bottle", "Red Scale", "Lost Item", "Pass", "Machine Part", "Silver Wing", "Rainbow Wing", "Mystery Egg", "Red Apricorn", "Blue Apricorn", "Yellow Apricorn", "Green Apricorn", "Pink Apricorn", "White Apricorn", "Black Apricorn", "Fast Ball", "Level Ball", "Lure Ball", "Heavy Ball", "Love Ball", "Friend Ball", "Moon Ball", "Sport Ball", "Park Ball", "Photo Album", "GB Sounds", "Tidal Bell", "Rage Candy Bar", "Data Card 01", "Data Card 02", "Data Card 03", "Data Card 04", "Data Card 05", "Data Card 06", "Data Card 07", "Data Card 08", "Data Card 09", "Data Card 10", "Data Card 11", "Data Card 12", "Data Card 13", "Data Card 14", "Data Card 15", "Data Card 16", "Data Card 17", "Data Card 18", "Data Card 19", "Data Card 20", "Data Card 21", "Data Card 22", "Data Card 23", "Data Card 24", "Data Card 25", "Data Card 26", "Data Card 27", "Jade Orb", "Lock Capsule", "Red Orb", "Blue Orb", "Enigma Stone", "Prism Scale", "Eviolite", "Float Stone", "Rocky Helmet", "Air Balloon", "Red Card", "Ring Target", "Binding Band", "Absorb Bulb", "Cell Battery", "Eject Button", "Fire Gem", "Water Gem", "Electric Gem", "Grass Gem", "Ice Gem", "Fighting Gem", "Poison Gem", "Ground Gem", "Flying Gem", "Psychic Gem", "Bug Gem", "Rock Gem", "Ghost Gem", "Dragon Gem", "Dark Gem", "Steel Gem", "Normal Gem", "Health Wing", "Muscle Wing", "Resist Wing", "Genius Wing", "Clever Wing", "Swift Wing", "Pretty Wing", "Cover Fossil", "Plume Fossil", "Liberty Pass", "Pass Orb", "Dream Ball", "Poké Toy", "Prop Case", "Dragon Skull", "Balm Mushroom", "Big Nugget", "Pearl String", "Comet Shard", "Relic Copper", "Relic Silver", "Relic Gold", "Relic Vase", "Relic Band", "Relic Statue", "Relic Crown", "Casteliacone", "Dire Hit 2", "X Speed 2", "X Sp. Atk 2", "X Sp. Def 2", "X Defense 2", "X Attack 2", "X Accuracy 2", "X Speed 3", "X Sp. Atk 3", "X Sp. Def 3", "X Defense 3", "X Attack 3", "X Accuracy 3", "X Speed 6", "X Sp. Atk 6", "X Sp. Def 6", "X Defense 6", "X Attack 6", "X Accuracy 6", "Ability Urge", "Item Drop", "Item Urge", "Reset Urge", "Dire Hit 3", "Light Stone", "Dark Stone", "TM93", "TM94", "TM95", "Xtransceiver", "???", "Gram 1", "Gram 2", "Gram 3", "Xtransceiver", "Medal Box", "DNA Splicers", "DNA Splicers", "Permit", "Oval Charm", "Shiny Charm", "Plasma Card", "Grubby Hanky", "Colress Machine", "Dropped Item", "Dropped Item", "Reveal Glass", "Weakness Policy", "Assault Vest", "Holo Caster", "Prof’s Letter", "Roller Skates", "Pixie Plate", "Ability Capsule", "Whipped Dream", "Sachet", "Luminous Moss", "Snowball", "Safety Goggles", "Poké Flute", "Rich Mulch", "Surprise Mulch", "Boost Mulch", "Amaze Mulch", "Gengarite", "Gardevoirite", "Ampharosite", "Venusaurite", "Charizardite X", "Blastoisinite", "Mewtwonite X", "Mewtwonite Y", "Blazikenite", "Medichamite", "Houndoominite", "Aggronite", "Banettite", "Tyranitarite", "Scizorite", "Pinsirite", "Aerodactylite", "Lucarionite", "Abomasite", "Kangaskhanite", "Gyaradosite", "Absolite", "Charizardite Y", "Alakazite", "Heracronite", "Mawilite", "Manectite", "Garchompite", "Latiasite", "Latiosite", "Roseli Berry", "Kee Berry", "Maranga Berry", "Sprinklotad", "TM96", "TM97", "TM98", "TM99", "TM100", "Power Plant Pass", "Mega Ring", "Intriguing Stone", "Common Stone", "Discount Coupon", "Elevator Key", "TMV Pass", "Honor of Kalos", "Adventure Rules", "Strange Souvenir", "Lens Case", "Makeup Bag", "Travel Trunk", "Lumiose Galette", "Shalour Sable", "Jaw Fossil", "Sail Fossil", "Looker Ticket", "Bike", "Holo Caster", "Fairy Gem", "Mega Charm", "Mega Glove", "Mach Bike", "Acro Bike", "Wailmer Pail", "Devon Parts", "Soot Sack", "Basement Key", "Pokéblock Kit", "Letter", "Eon Ticket", "Scanner", "Go-Goggles", "Meteorite", "Key to Room 1", "Key to Room 2", "Key to Room 4", "Key to Room 6", "Storage Key", "Devon Scope", "S.S. Ticket", "HM07", "Devon Scuba Gear", "Contest Costume", "Contest Costume", "Magma Suit", "Aqua Suit", "Pair of Tickets", "Mega Bracelet", "Mega Pendant", "Mega Glasses", "Mega Anchor", "Mega Stickpin", "Mega Tiara", "Mega Anklet", "Meteorite", "Swampertite", "Sceptilite", "Sablenite", "Altarianite", "Galladite", "Audinite", "Metagrossite", "Sharpedonite", "Slowbronite", "Steelixite", "Pidgeotite", "Glalitite", "Diancite", "Prison Bottle", "Mega Cuff", "Cameruptite", "Lopunnite", "Salamencite", "Beedrillite", "Meteorite", "Meteorite", "Key Stone", "Meteorite Shard", "Eon Flute", "Normalium Z", "Firium Z", "Waterium Z", "Electrium Z", "Grassium Z", "Icium Z", "Fightinium Z", "Poisonium Z", "Groundium Z", "Flyinium Z", "Psychium Z", "Buginium Z", "Rockium Z", "Ghostium Z", "Dragonium Z", "Darkinium Z", "Steelium Z", "Fairium Z", "Pikanium Z", "Bottle Cap", "Gold Bottle Cap", "Z-Ring", "Decidium Z", "Incinium Z", "Primarium Z", "Tapunium Z", "Marshadium Z", "Aloraichium Z", "Snorlium Z", "Eevium Z", "Mewnium Z", "Normalium Z", "Firium Z", "Waterium Z", "Electrium Z", "Grassium Z", "Icium Z", "Fightinium Z", "Poisonium Z", "Groundium Z", "Flyinium Z", "Psychium Z", "Buginium Z", "Rockium Z", "Ghostium Z", "Dragonium Z", "Darkinium Z", "Steelium Z", "Fairium Z", "Pikanium Z", "Decidium Z", "Incinium Z", "Primarium Z", "Tapunium Z", "Marshadium Z", "Aloraichium Z", "Snorlium Z", "Eevium Z", "Mewnium Z", "Pikashunium Z", "Pikashunium Z", "???", "???", "???", "???", "Forage Bag", "Fishing Rod", "Professor’s Mask", "Festival Ticket", "Sparkling Stone", "Adrenaline Orb", "Zygarde Cube", "???", "Ice Stone", "Ride Pager", "Beast Ball", "Big Malasada", "Red Nectar", "Yellow Nectar", "Pink Nectar", "Purple Nectar", "Sun Flute", "Moon Flute", "???", "Enigmatic Card", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "Terrain Extender", "Protective Pads", "Electric Seed", "Psychic Seed", "Misty Seed", "Grassy Seed", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "Fighting Memory", "Flying Memory", "Poison Memory", "Ground Memory", "Rock Memory", "Bug Memory", "Ghost Memory", "Steel Memory", "Fire Memory", "Water Memory", "Grass Memory", "Electric Memory", "Psychic Memory", "Ice Memory", "Dragon Memory", "Dark Memory", "Fairy Memory"}; +static char *itemsSorted[] = {"None", "Ability Capsule", "Ability Urge", "Abomasite", "Absolite", "Absorb Bulb", "Acro Bike", "Adamant Orb", "Adrenaline Orb", "Adventure Rules", "Aerodactylite", "Aggronite", "Aguav Berry", "Air Balloon", "Alakazite", "Aloraichium Z", "Aloraichium Z", "Altarianite", "Amaze Mulch", "Ampharosite", "Amulet Coin", "Antidote", "Apicot Berry", "Apricorn Box", "Aqua Suit", "Armor Fossil", "Aspear Berry", "Assault Vest", "Audinite", "Awakening", "Azure Flute", "Babiri Berry", "Balm Mushroom", "Banettite", "Basement Key", "Basement Key", "Beast Ball", "Beedrillite", "Belue Berry", "Berry Juice", "Berry Pots", "Big Malasada", "Big Mushroom", "Big Nugget", "Big Pearl", "Big Root", "Bike", "Bike", "Binding Band", "Black Apricorn", "Black Belt", "Black Flute", "Black Glasses", "Black Sludge", "Blastoisinite", "Blazikenite", "Blue Apricorn", "Blue Card", "Blue Flute", "Blue Orb", "Blue Scarf", "Blue Shard", "Bluk Berry", "Boost Mulch", "Bottle Cap", "Bridge Mail D", "Bridge Mail M", "Bridge Mail S", "Bridge Mail T", "Bridge Mail V", "Bright Powder", "Bug Gem", "Bug Memory", "Buginium Z", "Buginium Z", "Burn Drive", "Burn Heal", "Calcium", "Cameruptite", "Carbos", "Card Key", "Casteliacone", "Cell Battery", "Charcoal", "Charizardite X", "Charizardite Y", "Charti Berry", "Cheri Berry", "Cherish Ball", "Chesto Berry", "Chilan Berry", "Chill Drive", "Choice Band", "Choice Scarf", "Choice Specs", "Chople Berry", "Claw Fossil", "Cleanse Tag", "Clear Bell", "Clever Wing", "Coba Berry", "Coin Case", "Colbur Berry", "Colress Machine", "Comet Shard", "Common Stone", "Contest Costume", "Contest Costume", "Contest Pass", "Cornn Berry", "Coupon 1", "Coupon 2", "Coupon 3", "Cover Fossil", "Custap Berry", "Damp Mulch", "Damp Rock", "Dark Gem", "Dark Memory", "Dark Stone", "Darkinium Z", "Darkinium Z", "Data Card 01", "Data Card 02", "Data Card 03", "Data Card 04", "Data Card 05", "Data Card 06", "Data Card 07", "Data Card 08", "Data Card 09", "Data Card 10", "Data Card 11", "Data Card 12", "Data Card 13", "Data Card 14", "Data Card 15", "Data Card 16", "Data Card 17", "Data Card 18", "Data Card 19", "Data Card 20", "Data Card 21", "Data Card 22", "Data Card 23", "Data Card 24", "Data Card 25", "Data Card 26", "Data Card 27", "Dawn Stone", "Decidium Z", "Decidium Z", "Deep Sea Scale", "Deep Sea Tooth", "Destiny Knot", "Devon Parts", "Devon Scope", "Devon Scuba Gear", "Diancite", "Dire Hit", "Dire Hit 2", "Dire Hit 3", "Discount Coupon", "Dive Ball", "DNA Splicers", "DNA Splicers", "Dome Fossil", "Douse Drive", "Dowsing Machine", "Draco Plate", "Dragon Fang", "Dragon Gem", "Dragon Memory", "Dragon Scale", "Dragon Skull", "Dragonium Z", "Dragonium Z", "Dread Plate", "Dream Ball", "Dropped Item", "Dropped Item", "Dubious Disc", "Durin Berry", "Dusk Ball", "Dusk Stone", "Earth Plate", "Eevium Z", "Eevium Z", "Eject Button", "Electirizer", "Electric Gem", "Electric Memory", "Electric Seed", "Electrium Z", "Electrium Z", "Elevator Key", "Elixir", "Energy Powder", "Energy Root", "Enigma Berry", "Enigma Stone", "Enigmatic Card", "Eon Flute", "Eon Ticket", "Escape Rope", "Ether", "Everstone", "Eviolite", "Exp. Share", "Expert Belt", "Explorer Kit", "Fairium Z", "Fairium Z", "Fairy Gem", "Fairy Memory", "Fashion Case", "Fast Ball", "Favored Mail", "Festival Ticket", "Fighting Gem", "Fighting Memory", "Fightinium Z", "Fightinium Z", "Figy Berry", "Fire Gem", "Fire Memory", "Fire Stone", "Firium Z", "Firium Z", "Fishing Rod", "Fist Plate", "Flame Orb", "Flame Plate", "Float Stone", "Fluffy Tail", "Flying Gem", "Flying Memory", "Flyinium Z", "Flyinium Z", "Focus Band", "Focus Sash", "Forage Bag", "Fresh Water", "Friend Ball", "Full Heal", "Full Incense", "Full Restore", "Galactic Key", "Galladite", "Ganlon Berry", "Garchompite", "Gardevoirite", "GB Sounds", "Gengarite", "Genius Wing", "Ghost Gem", "Ghost Memory", "Ghostium Z", "Ghostium Z", "Glalitite", "Go-Goggles", "Gold Bottle Cap", "Good Rod", "Gooey Mulch", "Gracidea", "Gram 1", "Gram 2", "Gram 3", "Grass Gem", "Grass Memory", "Grassium Z", "Grassium Z", "Grassy Seed", "Great Ball", "Green Apricorn", "Green Scarf", "Green Shard", "Greet Mail", "Grepa Berry", "Grip Claw", "Griseous Orb", "Ground Gem", "Ground Memory", "Groundium Z", "Groundium Z", "Growth Mulch", "Grubby Hanky", "Guard Spec.", "Gyaradosite", "Haban Berry", "Hard Stone", "Heal Ball", "Heal Powder", "Health Wing", "Heart Scale", "Heat Rock", "Heavy Ball", "Helix Fossil", "Heracronite", "HM01", "HM02", "HM03", "HM04", "HM05", "HM06", "HM07", "Holo Caster", "Holo Caster", "Hondew Berry", "Honey", "Honor of Kalos", "Houndoominite", "HP Up", "Hyper Potion", "Iapapa Berry", "Ice Gem", "Ice Heal", "Ice Memory", "Ice Stone", "Icicle Plate", "Icium Z", "Icium Z", "Icy Rock", "Incinium Z", "Incinium Z", "Inquiry Mail", "Insect Plate", "Intriguing Stone", "Iron", "Iron Ball", "Iron Plate", "Item Drop", "Item Urge", "Jaboca Berry", "Jade Orb", "Jaw Fossil", "Journal", "Kangaskhanite", "Kasib Berry", "Kebia Berry", "Kee Berry", "Kelpsy Berry", "Key Stone", "Key to Room 1", "Key to Room 2", "Key to Room 4", "Key to Room 6", "King’s Rock", "Lagging Tail", "Lansat Berry", "Latiasite", "Latiosite", "Lava Cookie", "Lax Incense", "Leaf Stone", "Leftovers", "Lemonade", "Lens Case", "Leppa Berry", "Letter", "Level Ball", "Liberty Pass", "Liechi Berry", "Life Orb", "Light Ball", "Light Clay", "Light Stone", "Like Mail", "Lock Capsule", "Looker Ticket", "Loot Sack", "Lopunnite", "Lost Item", "Love Ball", "Lucarionite", "Luck Incense", "Lucky Egg", "Lucky Punch", "Lum Berry", "Luminous Moss", "Lumiose Galette", "Lunar Wing", "Lure Ball", "Lustrous Orb", "Luxury Ball", "Mach Bike", "Machine Part", "Macho Brace", "Magma Stone", "Magma Suit", "Magmarizer", "Magnet", "Mago Berry", "Magost Berry", "Makeup Bag", "Manectite", "Maranga Berry", "Marshadium Z", "Marshadium Z", "Master Ball", "Mawilite", "Max Elixir", "Max Ether", "Max Potion", "Max Repel", "Max Revive", "Meadow Plate", "Medal Box", "Medichamite", "Mega Anchor", "Mega Anklet", "Mega Bracelet", "Mega Charm", "Mega Cuff", "Mega Glasses", "Mega Glove", "Mega Pendant", "Mega Ring", "Mega Stickpin", "Mega Tiara", "Member Card", "Mental Herb", "Metagrossite", "Metal Coat", "Metal Powder", "Meteorite", "Meteorite", "Meteorite", "Meteorite", "Meteorite Shard", "Metronome", "Mewnium Z", "Mewnium Z", "Mewtwonite X", "Mewtwonite Y", "Micle Berry", "Mind Plate", "Miracle Seed", "Misty Seed", "Moomoo Milk", "Moon Ball", "Moon Flute", "Moon Stone", "Muscle Band", "Muscle Wing", "Mystery Egg", "Mystic Water", "Nanab Berry", "Nest Ball", "Net Ball", "Never-Melt Ice", "Nomel Berry", "Normal Gem", "Normalium Z", "Normalium Z", "Nugget", "Oak’s Letter", "Occa Berry", "Odd Incense", "Odd Keystone", "Old Amber", "Old Charm", "Old Gateau", "Old Rod", "Oran Berry", "Oval Charm", "Oval Stone", "Pair of Tickets", "Pal Pad", "Pamtre Berry", "Paralyze Heal", "Parcel", "Park Ball", "Pass", "Pass Orb", "Passho Berry", "Payapa Berry", "Pearl", "Pearl String", "Pecha Berry", "Permit", "Persim Berry", "Petaya Berry", "Photo Album", "Pidgeotite", "Pikanium Z", "Pikanium Z", "Pikashunium Z", "Pikashunium Z", "Pinap Berry", "Pink Apricorn", "Pink Nectar", "Pink Scarf", "Pinsirite", "Pixie Plate", "Plasma Card", "Plume Fossil", "Poffin Case", "Point Card", "Poison Barb", "Poison Gem", "Poison Memory", "Poisonium Z", "Poisonium Z", "Poké Ball", "Poké Doll", "Poké Flute", "Poké Radar", "Poké Toy", "Pokéblock Kit", "Pomeg Berry", "Potion", "Power Anklet", "Power Band", "Power Belt", "Power Bracer", "Power Herb", "Power Lens", "Power Plant Pass", "Power Weight", "PP Max", "PP Up", "Premier Ball", "Pretty Wing", "Primarium Z", "Primarium Z", "Prism Scale", "Prison Bottle", "Prof’s Letter", "Professor’s Mask", "Prop Case", "Protective Pads", "Protector", "Protein", "Psychic Gem", "Psychic Memory", "Psychic Seed", "Psychium Z", "Psychium Z", "Pure Incense", "Purple Nectar", "Qualot Berry", "Quick Ball", "Quick Claw", "Quick Powder", "Rabuta Berry", "Rage Candy Bar", "Rainbow Wing", "Rare Bone", "Rare Candy", "Rawst Berry", "Razor Claw", "Razor Fang", "Razz Berry", "Reaper Cloth", "Red Apricorn", "Red Card", "Red Chain", "Red Flute", "Red Nectar", "Red Orb", "Red Scale", "Red Scarf", "Red Shard", "Relic Band", "Relic Copper", "Relic Crown", "Relic Gold", "Relic Silver", "Relic Statue", "Relic Vase", "Repeat Ball", "Repel", "Reply Mail", "Reset Urge", "Resist Wing", "Reveal Glass", "Revival Herb", "Revive", "Rich Mulch", "Ride Pager", "Rindo Berry", "Ring Target", "Rock Gem", "Rock Incense", "Rock Memory", "Rockium Z", "Rockium Z", "Rocky Helmet", "Roller Skates", "Root Fossil", "Rose Incense", "Roseli Berry", "Rowap Berry", "RSVP Mail", "Rule Book", "S.S. Ticket", "S.S. Ticket", "Sablenite", "Sachet", "Sacred Ash", "Safari Ball", "Safety Goggles", "Sail Fossil", "Salac Berry", "Salamencite", "Scanner", "Sceptilite", "Scizorite", "Scope Lens", "Sea Incense", "Seal Bag", "Seal Case", "Secret Key", "Secret Potion", "Shalour Sable", "Sharp Beak", "Sharpedonite", "Shed Shell", "Shell Bell", "Shiny Charm", "Shiny Stone", "Shoal Salt", "Shoal Shell", "Shock Drive", "Shuca Berry", "Silk Scarf", "Silver Powder", "Silver Wing", "Sitrus Berry", "Skull Fossil", "Sky Plate", "Slowbronite", "Slowpoke Tail", "Smoke Ball", "Smooth Rock", "Snorlium Z", "Snorlium Z", "Snowball", "Soda Pop", "Soft Sand", "Soot Sack", "Soothe Bell", "Soul Dew", "Sparkling Stone", "Spell Tag", "Spelon Berry", "Splash Plate", "Spooky Plate", "Sport Ball", "Sprayduck", "Sprinklotad", "Squirt Bottle", "Stable Mulch", "Star Piece", "Stardust", "Starf Berry", "Steel Gem", "Steel Memory", "Steelium Z", "Steelium Z", "Steelixite", "Stick", "Sticky Barb", "Stone Plate", "Storage Key", "Storage Key", "Strange Souvenir", "Suite Key", "Sun Flute", "Sun Stone", "Super Potion", "Super Repel", "Super Rod", "Surprise Mulch", "Swampertite", "Sweet Heart", "Swift Wing", "Tamato Berry", "Tanga Berry", "Tapunium Z", "Tapunium Z", "Terrain Extender", "Thanks Mail", "Thick Club", "Thunder Stone", "Tidal Bell", "Timer Ball", "Tiny Mushroom", "TM01", "TM02", "TM03", "TM04", "TM05", "TM06", "TM07", "TM08", "TM09", "TM10", "TM100", "TM11", "TM12", "TM13", "TM14", "TM15", "TM16", "TM17", "TM18", "TM19", "TM20", "TM21", "TM22", "TM23", "TM24", "TM25", "TM26", "TM27", "TM28", "TM29", "TM30", "TM31", "TM32", "TM33", "TM34", "TM35", "TM36", "TM37", "TM38", "TM39", "TM40", "TM41", "TM42", "TM43", "TM44", "TM45", "TM46", "TM47", "TM48", "TM49", "TM50", "TM51", "TM52", "TM53", "TM54", "TM55", "TM56", "TM57", "TM58", "TM59", "TM60", "TM61", "TM62", "TM63", "TM64", "TM65", "TM66", "TM67", "TM68", "TM69", "TM70", "TM71", "TM72", "TM73", "TM74", "TM75", "TM76", "TM77", "TM78", "TM79", "TM80", "TM81", "TM82", "TM83", "TM84", "TM85", "TM86", "TM87", "TM88", "TM89", "TM90", "TM91", "TM92", "TM93", "TM94", "TM95", "TM96", "TM97", "TM98", "TM99", "TMV Pass", "Town Map", "Toxic Orb", "Toxic Plate", "Travel Trunk", "Twisted Spoon", "Tyranitarite", "Ultra Ball", "Unown Report", "Up-Grade", "Venusaurite", "Vs. Recorder", "Vs. Seeker", "Wacan Berry", "Wailmer Pail", "Water Gem", "Water Memory", "Water Stone", "Waterium Z", "Waterium Z", "Watmel Berry", "Wave Incense", "Weakness Policy", "Wepear Berry", "Whipped Dream", "White Apricorn", "White Flute", "White Herb", "Wide Lens", "Wiki Berry", "Wise Glasses", "Works Key", "X Accuracy", "X Accuracy 2", "X Accuracy 3", "X Accuracy 6", "X Attack", "X Attack 2", "X Attack 3", "X Attack 6", "X Defense", "X Defense 2", "X Defense 3", "X Defense 6", "X Sp. Atk", "X Sp. Atk 2", "X Sp. Atk 3", "X Sp. Atk 6", "X Sp. Def", "X Sp. Def 2", "X Sp. Def 3", "X Sp. Def 6", "X Speed", "X Speed 2", "X Speed 3", "X Speed 6", "Xtransceiver", "Xtransceiver", "Yache Berry", "Yellow Apricorn", "Yellow Flute", "Yellow Nectar", "Yellow Scarf", "Yellow Shard", "Z-Ring", "Zap Plate", "Zinc", "Zoom Lens", "Zygarde Cube", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???"}; +char *hpList[] = {"Fighting", "Flying", "Poison", "Ground", "Rock", "Bug", "Ghost", "Steel", "Fire", "Water", "Grass", "Electric", "Psychic", "Ice", "Dragon", "Dark", " ", " "}; + +void GUIElementsInit() { + fontBold18 = sftd_load_font_file("romfs:/res/Bold.ttf"); + fontBold15 = sftd_load_font_file("romfs:/res/Bold.ttf"); + fontBold14 = sftd_load_font_file("romfs:/res/Bold.ttf"); + fontBold12 = sftd_load_font_file("romfs:/res/Bold.ttf"); + fontBold11 = sftd_load_font_file("romfs:/res/Bold.ttf"); + fontBold9 = sftd_load_font_file("romfs:/res/Bold.ttf"); + fontFixed = sftd_load_font_file("romfs:/res/VeraMono.ttf"); + warningTop = sfil_load_PNG_file("romfs:/res/Warning Top.png", SF2D_PLACE_RAM); + warningBottom = sfil_load_PNG_file("romfs:/res/Warning Bottom.png", SF2D_PLACE_RAM); + freezeMsg("Loading graphics..."); + + init_font_cache(); + cleanTop = sfil_load_PNG_file("romfs:/res/Clean Top.png", SF2D_PLACE_RAM); + mainMenuBottom = sfil_load_PNG_file("romfs:/res/Main Menu Bottom.png", SF2D_PLACE_RAM); +} + +void GUIElementsSpecify(int game) { + freezeMsg("Loading graphics..."); + alternativeSpritesSmall = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/alternative_icons_spritesheet.png", SF2D_PLACE_RAM); + spritesSmall = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/pokemon_icons_spritesheet.png", SF2D_PLACE_RAM); + balls = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/balls_spritesheet.png", SF2D_PLACE_RAM); + settings = sfil_load_PNG_file("romfs:/res/Settings.png", SF2D_PLACE_RAM); + + if (game < 6) { + editorBar = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/editor_bar.png", SF2D_PLACE_RAM); + typesSheet = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/types_sheet.png", SF2D_PLACE_RAM); + boxView = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/editor_bottom.png", SF2D_PLACE_RAM); + back = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/back_button.png", SF2D_PLACE_RAM); + + dexBox = sfil_load_PNG_file("romfs:/res/Dex Box.png", SF2D_PLACE_RAM); + dexN = sfil_load_PNG_file("romfs:/res/Dex N.png", SF2D_PLACE_RAM); + hiddenPowerBG = sfil_load_PNG_file("romfs:/res/Hidden Power BG.png", SF2D_PLACE_RAM); + hiddenPowerButton = sfil_load_PNG_file("romfs:/res/Hidden Power Button.png", SF2D_PLACE_RAM); + selectBoxButton = sfil_load_PNG_file("romfs:/res/Select Box Button.png", SF2D_PLACE_RAM); + selectBoxButton = sfil_load_PNG_file("romfs:/res/Select Box Button.png", SF2D_PLACE_RAM); + ballsBG = sfil_load_PNG_file("romfs:/res/BallsBG.png", SF2D_PLACE_RAM); + ballButton = sfil_load_PNG_file("romfs:/res/Ball Button.png", SF2D_PLACE_RAM); + male = sfil_load_PNG_file("romfs:/res/Male.png", SF2D_PLACE_RAM); + female = sfil_load_PNG_file("romfs:/res/Female.png", SF2D_PLACE_RAM); + naturesButton = sfil_load_PNG_file("romfs:/res/Natures Button.png", SF2D_PLACE_RAM); + naturestx = sfil_load_PNG_file("romfs:/res/Natures.png", SF2D_PLACE_RAM); + movesBottom = sfil_load_PNG_file("romfs:/res/Moves Bottom.png", SF2D_PLACE_RAM); + topMovesBG = sfil_load_PNG_file("romfs:/res/Top Moves.png", SF2D_PLACE_RAM); + editorStatsBG = sfil_load_PNG_file("romfs:/res/Editor Stats.png", SF2D_PLACE_RAM); + subArrow = sfil_load_PNG_file("romfs:/res/Sub Arrow.png", SF2D_PLACE_RAM); + backgroundTop = sfil_load_PNG_file("romfs:/res/Background.png", SF2D_PLACE_RAM); + miniBox = sfil_load_PNG_file("romfs:/res/Mini Box.png", SF2D_PLACE_RAM); + minusButton = sfil_load_PNG_file("romfs:/res/Minus Button.png", SF2D_PLACE_RAM); + plusButton = sfil_load_PNG_file("romfs:/res/Plus Button.png", SF2D_PLACE_RAM); + bottomMask = sfil_load_PNG_file("romfs:/res/Mask Bottom.png", SF2D_PLACE_RAM); + transferButton = sfil_load_PNG_file("romfs:/res/Transfer Button.png", SF2D_PLACE_RAM); + bankTop = sfil_load_PNG_file("romfs:/res/Bank Top.png", SF2D_PLACE_RAM); + shinyStar = sfil_load_PNG_file("romfs:/res/Shiny.png", SF2D_PLACE_RAM); + normalBar = sfil_load_PNG_file("romfs:/res/Normal Bar.png", SF2D_PLACE_RAM); + RButton = sfil_load_PNG_file("romfs:/res/R Button.png", SF2D_PLACE_RAM); + LButton = sfil_load_PNG_file("romfs:/res/L Button.png", SF2D_PLACE_RAM); + creditsTop = sfil_load_PNG_file("romfs:/res/Credits Top.png", SF2D_PLACE_RAM); + pokeball = sfil_load_PNG_file("romfs:/res/Pokeball.png", SF2D_PLACE_RAM); + menuBar = sfil_load_PNG_file("romfs:/res/Main Menu Dark Bar.png", SF2D_PLACE_RAM); + menuSelectedBar = sfil_load_PNG_file("romfs:/res/Main Menu Red Bar.png", SF2D_PLACE_RAM); + darkButton = sfil_load_PNG_file("romfs:/res/Dark Button.png", SF2D_PLACE_RAM); + eventTop = sfil_load_PNG_file("romfs:/res/Event Top.png", SF2D_PLACE_RAM); + left = sfil_load_PNG_file("romfs:/res/Left.png", SF2D_PLACE_RAM); + lightButton = sfil_load_PNG_file("romfs:/res/Light Button.png", SF2D_PLACE_RAM); + redButton = sfil_load_PNG_file("romfs:/res/Red Button.png", SF2D_PLACE_RAM); + right = sfil_load_PNG_file("romfs:/res/Right.png", SF2D_PLACE_RAM); + eventMenuBottomBar = sfil_load_PNG_file("romfs:/res/Event Menu Bottom Bar.png", SF2D_PLACE_RAM); + eventMenuTopBarSelected = sfil_load_PNG_file("romfs:/res/Event Menu Top Bar Selected.png", SF2D_PLACE_RAM); + eventMenuTopBar = sfil_load_PNG_file("romfs:/res/Event Menu Top Bar.png", SF2D_PLACE_RAM); + infoView = sfil_load_PNG_file("romfs:/res/Info View.png", SF2D_PLACE_RAM); + LRBar = sfil_load_PNG_file("romfs:/res/LR Bar.png", SF2D_PLACE_RAM); + selector = sfil_load_PNG_file("romfs:/res/Selector.png", SF2D_PLACE_RAM); + selectorCloning = sfil_load_PNG_file("romfs:/res/Selector (cloning).png", SF2D_PLACE_RAM); + editorBG = sfil_load_PNG_file("romfs:/res/Editor Bottom BG.png", SF2D_PLACE_RAM); + plus = sfil_load_PNG_file("romfs:/res/Plus.png", SF2D_PLACE_RAM); + minus = sfil_load_PNG_file("romfs:/res/Minus.png", SF2D_PLACE_RAM); + button = sfil_load_PNG_file("romfs:/res/Button.png", SF2D_PLACE_RAM); + setting = sfil_load_PNG_file("romfs:/res/Setting.png", SF2D_PLACE_RAM); + bottomPopUp = sfil_load_PNG_file("romfs:/res/Bottom Pop-Up.png", SF2D_PLACE_RAM); + pokemonBufferBox = sfil_load_PNG_file("romfs:/res/Pokemon Box.png", SF2D_PLACE_RAM); + topSelectedMove = sfil_load_PNG_file("romfs:/res/Top Selected Move.png", SF2D_PLACE_RAM); + item = sfil_load_PNG_file("romfs:/res/item.png", SF2D_PLACE_RAM); + } else { + DSBottomBG = sfil_load_PNG_file("romfs:/res/Bottom BG.png", SF2D_PLACE_RAM); + DSTopBG = sfil_load_PNG_file("romfs:/res/Top BG.png", SF2D_PLACE_RAM); + DSBarSelected = sfil_load_PNG_file("romfs:/res/Bar Selected.png", SF2D_PLACE_RAM); + DSBar = sfil_load_PNG_file("romfs:/res/Bar.png", SF2D_PLACE_RAM); + DSEventBottom = sfil_load_PNG_file("romfs:/res/DS Menu Bottom BG.png", SF2D_PLACE_RAM); + DSLangSelected = sfil_load_PNG_file("romfs:/res/Language Button Selected.png", SF2D_PLACE_RAM); + DSLang = sfil_load_PNG_file("romfs:/res/Language Button.png", SF2D_PLACE_RAM); + DSEventTop = sfil_load_PNG_file("romfs:/res/Event Database BG.png", SF2D_PLACE_RAM); + DSNormalBarL = sfil_load_PNG_file("romfs:/res/Normal L.png", SF2D_PLACE_RAM); + DSNormalBarR = sfil_load_PNG_file("romfs:/res/Normal R.png", SF2D_PLACE_RAM); + DSSelectedBarL = sfil_load_PNG_file("romfs:/res/Selected L.png", SF2D_PLACE_RAM); + DSSelectedBarR = sfil_load_PNG_file("romfs:/res/Selected R.png", SF2D_PLACE_RAM); + } +} + +void GUIGameElementsInit() { + upperTextGS = sfil_load_PNG_file("romfs:/res/3DS.png", SF2D_PLACE_RAM); + lowerTextGS = sfil_load_PNG_file("romfs:/res/DS.png", SF2D_PLACE_RAM); + topBorder = sfil_load_PNG_file("romfs:/res/3dsborder.png", SF2D_PLACE_RAM); + bottomBorder = sfil_load_PNG_file("romfs:/res/dsborder.png", SF2D_PLACE_RAM); + gameSelectorBottom = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/dsicons.png", SF2D_PLACE_RAM); + gameSelectorTop = sfil_load_PNG_file("/3ds/data/PKSM/additionalassets/3dsicons.png", SF2D_PLACE_RAM); +} + +void GUIGameElementsExit() { + sf2d_free_texture(upperTextGS); + sf2d_free_texture(lowerTextGS); + sf2d_free_texture(gameSelectorBottom); + sf2d_free_texture(gameSelectorTop); + sf2d_free_texture(topBorder); + sf2d_free_texture(bottomBorder); +} + +void GUIElementsExit() { + sf2d_free_texture(dexBox); + sf2d_free_texture(dexN); + sf2d_free_texture(hiddenPowerBG); + sf2d_free_texture(hiddenPowerButton); + sf2d_free_texture(selectBoxButton); + sf2d_free_texture(ballsBG); + sf2d_free_texture(ballButton); + sf2d_free_texture(male); + sf2d_free_texture(female); + sf2d_free_texture(naturesButton); + sf2d_free_texture(naturestx); + sf2d_free_texture(movesBottom); + sf2d_free_texture(topMovesBG); + sf2d_free_texture(editorBar); + sf2d_free_texture(editorStatsBG); + sf2d_free_texture(subArrow); + sf2d_free_texture(backgroundTop); + sf2d_free_texture(miniBox); + sf2d_free_texture(minusButton); + sf2d_free_texture(plusButton); + sf2d_free_texture(balls); + sf2d_free_texture(typesSheet); + sf2d_free_texture(bottomMask); + sf2d_free_texture(transferButton); + sf2d_free_texture(bankTop); + sf2d_free_texture(shinyStar); + sf2d_free_texture(normalBar); + sf2d_free_texture(RButton); + sf2d_free_texture(LButton); + sf2d_free_texture(creditsTop); + sf2d_free_texture(pokeball); + sf2d_free_texture(alternativeSpritesSmall); + sf2d_free_texture(item); + sf2d_free_texture(settings); + sf2d_free_texture(topSelectedMove); + sf2d_free_texture(DSEventBottom); + sf2d_free_texture(DSLangSelected); + sf2d_free_texture(DSLang); + sf2d_free_texture(DSEventTop); + sf2d_free_texture(DSNormalBarL); + sf2d_free_texture(DSNormalBarR); + sf2d_free_texture(DSSelectedBarL); + sf2d_free_texture(DSSelectedBarR); + sf2d_free_texture(DSBottomBG); + sf2d_free_texture(DSTopBG); + sf2d_free_texture(DSBarSelected); + sf2d_free_texture(DSBar); + sf2d_free_texture(cleanTop); + sf2d_free_texture(bottomPopUp); + sf2d_free_texture(pokemonBufferBox); + sf2d_free_texture(selectorCloning); + sf2d_free_texture(back); + sf2d_free_texture(setting); + sf2d_free_texture(editorBG); + sf2d_free_texture(plus); + sf2d_free_texture(minus); + sf2d_free_texture(button); + sf2d_free_texture(boxView); + sf2d_free_texture(infoView); + sf2d_free_texture(LRBar); + sf2d_free_texture(selector); + sf2d_free_texture(warningTop); + sf2d_free_texture(warningBottom); + sf2d_free_texture(eventMenuBottomBar); + sf2d_free_texture(eventMenuTopBarSelected); + sf2d_free_texture(eventMenuTopBar); + sf2d_free_texture(spritesSmall); + sf2d_free_texture(darkButton); + sf2d_free_texture(eventTop); + sf2d_free_texture(left); + sf2d_free_texture(lightButton); + sf2d_free_texture(redButton); + sf2d_free_texture(right); + sf2d_free_texture(mainMenuBottom); + sf2d_free_texture(menuBar); + sf2d_free_texture(menuSelectedBar); + sftd_free_font(fontBold9); + sftd_free_font(fontBold11); + sftd_free_font(fontBold12); + sftd_free_font(fontBold14); + sftd_free_font(fontBold15); + sftd_free_font(fontBold18); + sftd_free_font(fontFixed); +} + +void init_font_cache() { + sftd_draw_text(fontBold18, 0, 0, RGBA8(0, 0, 0, 0), 18, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:-.'!?()\"end"); + sftd_draw_text(fontBold14, 0, 0, RGBA8(0, 0, 0, 0), 14, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:-.'!?()\"end"); + sftd_draw_text(fontBold15, 0, 0, RGBA8(0, 0, 0, 0), 15, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:-.'!?()\"end"); + sftd_draw_text(fontBold12, 0, 0, RGBA8(0, 0, 0, 0), 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:-.'!?()\"end"); + sftd_draw_text(fontBold11, 0, 0, RGBA8(0, 0, 0, 0), 11, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:-.'!?()\"end"); + sftd_draw_text(fontBold9, 0, 0, RGBA8(0, 0, 0, 0), 9, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:-.'!?()\"end"); + sftd_draw_text(fontFixed, 0, 0, RGBA8(0, 0, 0, 0), 10, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:-.'!?()\"end"); +} + +void infoDisp(char* message) { + while (aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_A) break; + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(warningTop, 0, 0); + sftd_draw_text(fontBold15, (400 - sftd_get_text_width(fontBold15, 15, message)) / 2, 95, RGBA8(255, 255, 255, giveTransparence()), 15, message); + sftd_draw_text(fontBold12, (400 - sftd_get_text_width(fontBold12, 12, "Press A to continue.")) / 2, 130, WHITE, 12, "Press A to continue."); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(warningBottom, 0, 0); + sf2d_end_frame(); + sf2d_swapbuffers(); + } +} + +int confirmDisp(char* message) { + while (aptMainLoop()) { + hidScanInput(); + + if (hidKeysDown() & KEY_A) return 1; + if (hidKeysDown() & KEY_B) return 0; + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(warningTop, 0, 0); + sftd_draw_text(fontBold15, (400 - sftd_get_text_width(fontBold15, 15, message)) / 2, 95, RGBA8(255, 255, 255, giveTransparence()), 15, message); + sftd_draw_text(fontBold12, (400 - sftd_get_text_width(fontBold12, 12, "Press A to continue, B to cancel.")) / 2, 130, WHITE, 12, "Press A to continue, B to cancel."); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(warningBottom, 0, 0); + sf2d_end_frame(); + sf2d_swapbuffers(); + } + return 0; +} + +void freezeMsg(char* message) { + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(warningTop, 0, 0); + sftd_draw_text(fontBold15, (400 - sftd_get_text_width(fontBold15, 15, message)) / 2, 95, WHITE, 15, message); + sftd_draw_text(fontBold12, (400 - sftd_get_text_width(fontBold12, 12, "Please wait.")) / 2, 130, WHITE, 12, "Please wait."); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(warningBottom, 0, 0); + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void progressBar(char* message, u32 current, u32 sz) { + char* progress = (char*)malloc(40 * sizeof(char)); + snprintf(progress, 40, "Progress: %lu/%lu bytes", current, sz); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(warningTop, 0, 0); + sftd_draw_text(fontBold15, (400 - sftd_get_text_width(fontBold15, 15, message)) / 2, 95, WHITE, 15, message); + sftd_draw_text(fontBold12, (400 - sftd_get_text_width(fontBold12, 12, progress)) / 2, 130, WHITE, 12, progress); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(warningBottom, 0, 0); + sf2d_end_frame(); + sf2d_swapbuffers(); + + free(progress); +} + +void drawMenuTop(int game) { + char* version = (char*)malloc(12 * sizeof(char)); + snprintf(version, 12, "v%d.%d.%d", V1, V2, V3); + + if (game < 6) { + sf2d_draw_texture(cleanTop, 0, 0); + printTitle("PKSM"); + sf2d_draw_texture(pokeball, (400 - pokeball->width) / 2 + 5, (240 - pokeball->height) / 2 + 10); + } + else + sf2d_draw_texture(DSTopBG, 0, 0); + + sftd_draw_text(fontBold9, (398 - sftd_get_text_width(fontBold9, 9, version)), 229, LIGHTBLUE, 9, version); + + free(version); +} + +void printAnimatedBG(bool isUp) { + sf2d_draw_texture(backgroundTop, 0, 0); + animateBG(isUp); +} + +void printTitle(const char* title) { + sftd_draw_text(fontBold14, (400 - sftd_get_text_width(fontBold14, 14, title)) / 2, 4, BLUE, 14, title); +} + +void printBottomIndications(const char* message) { + sftd_draw_text(fontBold9, (320 - sftd_get_text_width(fontBold9, 9, message)) / 2, 225, LIGHTBLUE, 9, message); +} + +void gameSelectorMenu(int n) { + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(cleanTop, 0, 0); + sf2d_draw_texture(upperTextGS, 172, 65); + + sftd_draw_text(fontBold9, (400 - sftd_get_text_width(fontBold9, 9, "Cart has priority over digital copy.")) / 2, 6, BLUE, 9, "Cart has priority over digital copy."); + if (n < 6) + sf2d_draw_texture(topBorder, 21 + 60 * n, 112); + sf2d_draw_texture(gameSelectorTop, 26, 117); + + for (int i = 0; i < 6; i++) + sftd_draw_text(fontBold18, 17 + 60 * i + (68 - sftd_get_text_width(fontBold18, 18, gamesList[i])) / 2, 170, LIGHTBLUE, 18, gamesList[i]); + + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + sf2d_draw_texture(lowerTextGS, 142, 25); + switch (n) { + case GAME_DIAMOND : { sf2d_draw_texture(bottomBorder, 56, 64); break; } + case GAME_PEARL : { sf2d_draw_texture(bottomBorder, 98, 64); break; } + case GAME_PLATINUM : { sf2d_draw_texture(bottomBorder, 140, 64); break; } + case GAME_HG : { sf2d_draw_texture(bottomBorder, 182, 64); break; } + case GAME_SS : { sf2d_draw_texture(bottomBorder, 224, 64); break; } + case GAME_B1 : { sf2d_draw_texture(bottomBorder, 77, 123); break; } + case GAME_W1 : { sf2d_draw_texture(bottomBorder, 119, 123); break; } + case GAME_B2 : { sf2d_draw_texture(bottomBorder, 161, 123); break; } + case GAME_W2 : { sf2d_draw_texture(bottomBorder, 203, 123); break; } + } + sf2d_draw_texture(gameSelectorBottom, 60, 68); + + for (int i = 6; i < 11; i++) + sftd_draw_text(fontBold15, 61 + 42 * (i - 6) + (32 - sftd_get_text_width(fontBold15, 15, gamesList[i])) / 2, 104, LIGHTBLUE, 15, gamesList[i]); + + for (int i = 11; i < 15; i++) + sftd_draw_text(fontBold15, 82 + 42 * (i - 11) + (32 - sftd_get_text_width(fontBold15, 15, gamesList[i])) / 2, 163, LIGHTBLUE, 15, gamesList[i]); + + sf2d_draw_rectangle(60, 68, 32, 32, RGBA8(0, 0, 0, 210)); + sf2d_draw_rectangle(102, 68, 32, 32, RGBA8(0, 0, 0, 210)); + sf2d_draw_rectangle(144, 68, 32, 32, RGBA8(0, 0, 0, 210)); + printBottomIndications("Press A continue, B to exit."); + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void mainMenu(int currentEntry) { + char* menu[3] = {"EVENTS", "MANAGEMENT", "OTHER"}; + sf2d_start_frame(GFX_TOP, GFX_LEFT); + drawMenuTop(0); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + sf2d_draw_texture(settings, 292, 194); + for (int i = 0; i < 3; i++) { + if (i == currentEntry) + sf2d_draw_texture(menuSelectedBar, (320 - menuSelectedBar->width) / 2, 60 + i * (menuSelectedBar->height)); + else + sf2d_draw_texture(menuBar, (320 - menuBar->width) / 2, 60 + i * (menuBar->height)); + sftd_draw_text(fontBold18, (320 - sftd_get_text_width(fontBold18, 18, menu[i])) / 2 - 4, 53 + (menuBar->height - 18) / 2 + i * (menuBar->height), (i == currentEntry) ? DARKBLUE : YELLOW, 18, menu[i]); + } + printBottomIndications("Press START to save, X to exit."); + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void mainMenuDS(int currentEntry) { + char* menu[2] = {"EVENTS", "OTHER"}; + sf2d_start_frame(GFX_TOP, GFX_LEFT); + drawMenuTop(7); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(DSBottomBG, 0, 0); + for (int i = 0; i < 2; i++) { + if (i == currentEntry) + sf2d_draw_texture(DSBarSelected, (320 - DSBarSelected->width) / 2, 66 + i * (DSBarSelected->height + 16) + i + 1); + else + sf2d_draw_texture(DSBar, (320 - DSBar->width) / 2, 66 + i * (DSBar->height + 16)); + sftd_draw_text(fontBold18, (320 - sftd_get_text_width(fontBold18, 18, menu[i])) / 2, 67 + (DSBar->height - 18) / 2 + i * (DSBar->height + 16), WHITE, 18, menu[i]); + } + printBottomIndications("Press START to save, X to exit."); + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void menu4(int currentEntry, char* menu[], int n) { + sf2d_start_frame(GFX_TOP, GFX_LEFT); + drawMenuTop(0); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + + for (int i = 0; i < n; i++) { + if (i == currentEntry) + sf2d_draw_texture(menuSelectedBar, (320 - menuSelectedBar->width) / 2, 40 + i * (menuSelectedBar->height)); + else + sf2d_draw_texture(menuBar, (320 - menuBar->width) / 2, 40 + i * (menuBar->height)); + sftd_draw_text(fontBold18, (320 - sftd_get_text_width(fontBold18, 18, menu[i])) / 2 - 4, 44 + i * (menuBar->height), (i == currentEntry) ? DARKBLUE : YELLOW, 18, menu[i]); + } + printBottomIndications("Press A to select an option."); + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void menu3(int currentEntry, char* menu[], int n) { + sf2d_start_frame(GFX_TOP, GFX_LEFT); + drawMenuTop(0); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + + for (int i = 0; i < 3; i++) { + if (i == currentEntry) + sf2d_draw_texture(menuSelectedBar, (320 - menuSelectedBar->width) / 2, 60 + i * (menuSelectedBar->height)); + else + sf2d_draw_texture(menuBar, (320 - menuBar->width) / 2, 60 + i * (menuBar->height)); + sftd_draw_text(fontBold18, (320 - sftd_get_text_width(fontBold18, 18, menu[i])) / 2 - 4, 53 + (menuBar->height - 18) / 2 + i * (menuBar->height), (i == currentEntry) ? DARKBLUE : YELLOW, 18, menu[i]); + } + printBottomIndications("Press A to select an option."); + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void printCredits() { + u8* buf = (u8*)malloc(1500 * sizeof(u8)); + loadFile(buf, "romfs:/res/credits.txt"); + + while (aptMainLoop() && !(hidKeysUp() & KEY_B)) { + hidScanInput(); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(cleanTop, 0, 0); + printTitle("Credits"); + sf2d_draw_texture(creditsTop, 0, 45); + sftd_draw_text(fontBold15, 18, 77, LIGHTBLUE, 15, "Bernardo Giordano"); + sftd_draw_text(fontBold15, 64, 174, LIGHTBLUE, 15, "dsoldier for the complete GUI design"); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + sftd_draw_text(fontBold9, 20, 35, LIGHTBLUE, 9, (char*)buf); + printBottomIndications("Press B to return."); + sf2d_end_frame(); + sf2d_swapbuffers(); + } + + free(buf); +} + +void printDatabase6(char *database[], int currentEntry, int page, int spriteArray[]) { + int pk, y = 41; + char *pages = (char*)malloc(10 * sizeof(char)); + snprintf(pages, 10, "%d/%d", page + 1, 205); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(cleanTop, 0, 0); + printTitle("Event Database"); + + for (int i = 0; i < 5; i++) { + pk = spriteArray[page * 10 + i]; + if (i == currentEntry) + sf2d_draw_texture(eventMenuTopBarSelected, 18, y); + else + sf2d_draw_texture(eventMenuTopBar, 18, y); + + if (pk != -1) + sf2d_draw_texture_part(spritesSmall, 20, y - ((i == currentEntry) ? movementOffsetSlow(2) : 0), 40 * (pk % 25) + 4, 30 * (pk / 25), 34, 30); + if (sftd_get_text_width(fontBold9, 9, database[page * 10 + i]) <= 148) + sftd_draw_text(fontBold9, 54, y + 14, (i == currentEntry) ? HIGHBLUE : YELLOW, 9, database[page * 10 + i]); + else + sftd_draw_text_wrap(fontBold9, 54, y + 3, (i == currentEntry) ? HIGHBLUE : YELLOW, 9, 148, database[page * 10 + i]); + + y += 37; + } + + y = 41; + for (int i = 5; i < 10; i++) { + pk = spriteArray[page * 10 + i]; + if (i == currentEntry) + sf2d_draw_texture(eventMenuTopBarSelected, 200, y); + else + sf2d_draw_texture(eventMenuTopBar, 200, y); + + if (pk != -1) + sf2d_draw_texture_part(spritesSmall, 202, y - ((i == currentEntry) ? movementOffsetSlow(2) : 0), 40 * (pk % 25) + 4, 30 * (pk / 25), 34, 30); + if (sftd_get_text_width(fontBold9, 9, database[page * 10 + i]) <= 148) + sftd_draw_text(fontBold9, 235, y + 14, (i == currentEntry) ? HIGHBLUE : YELLOW, 9, database[page * 10 + i]); + else + sftd_draw_text_wrap(fontBold9, 235, y + 3, (i == currentEntry) ? HIGHBLUE : YELLOW, 9, 148, database[page * 10 + i]); + + y += 37; + } + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + sf2d_draw_texture(eventMenuBottomBar, (320 - eventMenuBottomBar->width) / 2, 45); + sf2d_draw_texture(LButton, 83, 52); + sf2d_draw_texture(RButton, 221, 52); + sftd_draw_text(fontBold12, (320 - sftd_get_text_width(fontBold12, 12, pages)) / 2, 52, WHITE, 12, pages); + printBottomIndications("Press A to continue, B to return."); + sf2d_end_frame(); + sf2d_swapbuffers(); + + free(pages); +} + +void printDatabase5(char *database[], int currentEntry, int page, int spriteArray[], bool isSelected, int langSelected, bool langVett[]) { + int pk, y = 41; + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(DSEventTop, 0, 0); + + for (int i = 0; i < 5; i++) { + pk = spriteArray[page * 10 + i]; + if (i == currentEntry) + sf2d_draw_texture(DSSelectedBarL, 18, y); + else + sf2d_draw_texture(DSNormalBarL, 18, y); + + if (pk != -1) + sf2d_draw_texture_part(spritesSmall, 22, y + 2, 40 * (pk % 25) + 4, 30 * (pk / 25), 34, 30); + if (sftd_get_text_width(fontBold9, 9, database[page * 10 + i]) <= 148) + sftd_draw_text(fontBold9, 55, y + 14, WHITE, 9, database[page * 10 + i]); + else + sftd_draw_text_wrap(fontBold9, 55, y + 3, WHITE, 9, 148, database[page * 10 + i]); + + y += DSSelectedBarL->height; + } + + y = 41; + for (int i = 5; i < 10; i++) { + pk = spriteArray[page * 10 + i]; + if (i == currentEntry) + sf2d_draw_texture(DSSelectedBarR, 200, y); + else + sf2d_draw_texture(DSNormalBarR, 200, y); + + if (pk != -1) + sf2d_draw_texture_part(spritesSmall, 204, y + 2, 40 * (pk % 25) + 4, 30 * (pk / 25), 34, 30); + if (sftd_get_text_width(fontBold9, 9, database[page * 10 + i]) <= 148) + sftd_draw_text(fontBold9, 235, y + 14, WHITE, 9, database[page * 10 + i]); + else + sftd_draw_text_wrap(fontBold9, 235, y + 3, WHITE, 9, 148, database[page * 10 + i]); + + y += DSSelectedBarR->height; + } + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(DSEventBottom, 0, 0); + sftd_draw_text(fontBold9, (320 - sftd_get_text_width(fontBold9, 9, isSelected ? "Press START to inject, B to return" : "Press A to select, B to return.")) / 2, 222, RGBA8(255, 255, 255, 130), 9, isSelected ? "Press START to inject, B to return" : "Press A to select, B to return."); + + if (isSelected) { + char *languages[7] = {"JPN", "ENG", "FRE", "ITA", "GER", "SPA", "KOR"}; + char *path = (char*)malloc(40 * sizeof(char)); + u8* buf = (u8*)malloc(1500 * sizeof(u8)); + memset(buf, 0, 1500); + snprintf(path, 40, "romfs:/database/gen5/%d.txt", page * 10 + currentEntry); + loadFile(buf, path); + + sftd_draw_text(fontFixed, 8, 2, WHITE, 10, (char*)buf); + + for (int t = 0; t < 7; t++) { + int x = 0, y = 178; + switch (t) { + case 0 : { x = 25; break; } + case 1 : { x = 63; break; } + case 2 : { x = 101; break; } + case 3 : { x = 139; break; } + case 4 : { x = 177; break; } + case 5 : { x = 215; break; } + case 6 : { x = 253; break; } + } + + sf2d_draw_texture(DSLang, x, y); + if (langVett[t]) { + if (t == langSelected) sf2d_draw_texture(DSLangSelected, x, y); + sftd_draw_text(fontBold12, x + (36 - sftd_get_text_width(fontBold12, 12, languages[t])) / 2, y + 4, WHITE, 12, languages[t]); + } + else { + if (t == langSelected) sf2d_draw_texture(DSLangSelected, x, y); + sftd_draw_text(fontBold12, x + (36 - sftd_get_text_width(fontBold12, 12, languages[t])) / 2, y + 4, RGBA8(255, 255, 255, 100), 12, languages[t]); + } + } + + free(path); + free(buf); + } + + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void printDatabase4(char *database[], int currentEntry, int page, int spriteArray[], bool isSelected, int langSelected, bool langVett[]) { + int pk, y = 41; + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(DSEventTop, 0, 0); + + for (int i = 0; i < 5; i++) { + pk = spriteArray[page * 10 + i]; + if (i == currentEntry) + sf2d_draw_texture(DSSelectedBarL, 18, y); + else + sf2d_draw_texture(DSNormalBarL, 18, y); + + if (pk != -1) + sf2d_draw_texture_part(spritesSmall, 22, y + 2, 40 * (pk % 25) + 4, 30 * (pk / 25), 34, 30); + if (sftd_get_text_width(fontBold9, 9, database[page * 10 + i]) <= 148) + sftd_draw_text(fontBold9, 55, y + 14, WHITE, 9, database[page * 10 + i]); + else + sftd_draw_text_wrap(fontBold9, 55, y + 3, WHITE, 9, 148, database[page * 10 + i]); + + y += DSSelectedBarL->height; + } + + y = 41; + for (int i = 5; i < 10; i++) { + pk = spriteArray[page * 10 + i]; + if (i == currentEntry) + sf2d_draw_texture(DSSelectedBarR, 200, y); + else + sf2d_draw_texture(DSNormalBarR, 200, y); + + if (pk != -1) + sf2d_draw_texture_part(spritesSmall, 204, y + 2, 40 * (pk % 25) + 4, 30 * (pk / 25), 34, 30); + if (sftd_get_text_width(fontBold9, 9, database[page * 10 + i]) <= 148) + sftd_draw_text(fontBold9, 235, y + 14, WHITE, 9, database[page * 10 + i]); + else + sftd_draw_text_wrap(fontBold9, 235, y + 3, WHITE, 9, 148, database[page * 10 + i]); + + y += DSSelectedBarR->height; + } + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(DSEventBottom, 0, 0); + sftd_draw_text(fontBold9, (320 - sftd_get_text_width(fontBold9, 9, isSelected ? "Press START to inject, B to return" : "Press A to select, B to return.")) / 2, 222, RGBA8(255, 255, 255, 130), 9, isSelected ? "Press START to inject, B to return" : "Press A to select, B to return."); + + if (isSelected) { + char *languages[7] = {"JPN", "ENG", "FRE", "ITA", "GER", "SPA", "KOR"}; + char *path = (char*)malloc(40 * sizeof(char)); + u8* buf = (u8*)malloc(1500 * sizeof(u8)); + memset(buf, 0, 1500); + snprintf(path, 40, "romfs:/database/gen4/%d.txt", page * 10 + currentEntry); + loadFile(buf, path); + + sftd_draw_text(fontFixed, 8, 2, WHITE, 10, (char*)buf); + + for (int t = 0; t < 7; t++) { + int x = 0, y = 178; + switch (t) { + case 0 : { x = 25; break; } + case 1 : { x = 63; break; } + case 2 : { x = 101; break; } + case 3 : { x = 139; break; } + case 4 : { x = 177; break; } + case 5 : { x = 215; break; } + case 6 : { x = 253; break; } + } + + sf2d_draw_texture(DSLang, x, y); + if (langVett[t]) { + if (t == langSelected) sf2d_draw_texture(DSLangSelected, x, y); + sftd_draw_text(fontBold12, x + (36 - sftd_get_text_width(fontBold12, 12, languages[t])) / 2, y + 4, WHITE, 12, languages[t]); + } + else { + if (t == langSelected) sf2d_draw_texture(DSLangSelected, x, y); + sftd_draw_text(fontBold12, x + (36 - sftd_get_text_width(fontBold12, 12, languages[t])) / 2, y + 4, RGBA8(255, 255, 255, 100), 12, languages[t]); + } + } + + free(path); + free(buf); + } + + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void printDB7(int sprite, int i, bool langVett[], bool adapt, bool overwrite, int langSelected, int nInjected) { + char *languages[] = {"JPN", "ENG", "FRE", "ITA", "GER", "SPA", "KOR", "CHS", "CHT"}; + char *path = (char*)malloc(30 * sizeof(char)); + char *cont = (char*)malloc(3 * sizeof(char)); + u8* buf = (u8*)malloc(1500 * sizeof(u8)); + memset(buf, 0, 1499); + snprintf(path, 30, "romfs:/database/%d.txt", i); + snprintf(cont, 3, "%d", nInjected + 1); + loadFile(buf, path); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + printAnimatedBG(true); + sf2d_draw_texture(eventTop, 0, 24); + if (sprite != -1) + sf2d_draw_texture_part_scale(spritesSmall, 282, 46 - movementOffsetLong(6), 40 * (sprite % 25) + 4, 30 * (sprite / 25), 34, 30, 2, 2); + sftd_draw_text(fontFixed, 5, 28, WHITE, 10, (char*)buf); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + sftd_draw_text(fontBold14, 16, 50, LIGHTBLUE, 14, "Languages:"); + sftd_draw_text(fontBold14, 33, 112, LIGHTBLUE, 14, "Overwrite Wondercard:"); + sftd_draw_text(fontBold14, 33, 140, LIGHTBLUE, 14, "Adapt language to WC:"); + sftd_draw_text(fontBold14, 33, 170, LIGHTBLUE, 14, "Inject WC in slot:"); + + for (int t = 0; t < 9; t++) { + int x = 0, y = 0; + switch (t) { + case 0 : { x = 114; y = 50; break; } + case 1 : { x = 153; y = 50; break; } + case 2 : { x = 192; y = 50; break; } + case 3 : { x = 231; y = 50; break; } + case 4 : { x = 270; y = 50; break; } + case 5 : { x = 133; y = 74; break; } + case 6 : { x = 172; y = 74; break; } + case 7 : { x = 211; y = 74; break; } + case 8 : { x = 250; y = 74; break; } + } + if (langVett[t]) { + if (t == langSelected) { + sf2d_draw_texture(redButton, x, y); + sftd_draw_text(fontBold14, x + (36 - sftd_get_text_width(fontBold14, 14, languages[t])) / 2, y + 2, DARKBLUE, 14, languages[t]); + } else { + sf2d_draw_texture(darkButton, x, y); + sftd_draw_text(fontBold14, x + (36 - sftd_get_text_width(fontBold14, 14, languages[t])) / 2, y + 2, YELLOW, 14, languages[t]); + } + } + else { + sf2d_draw_texture(lightButton, x, y); + sftd_draw_text(fontBold14, x + (36 - sftd_get_text_width(fontBold14, 14, languages[t])) / 2, y + 2, DARKBLUE, 14, languages[t]); + } + } + + if (overwrite) { + sf2d_draw_texture(redButton, 210, 110); + sf2d_draw_texture(darkButton, 249, 110); + } + else { + sf2d_draw_texture(darkButton, 210, 110); + sf2d_draw_texture(redButton, 249, 110); + } + + if (adapt) { + sf2d_draw_texture(redButton, 210, 138); + sf2d_draw_texture(darkButton, 249, 138); + } + else { + sf2d_draw_texture(darkButton, 210, 138); + sf2d_draw_texture(redButton, 249, 138); + } + + sf2d_draw_texture(darkButton, 229, 168); + + sftd_draw_text(fontBold14, 210 + (36 - sftd_get_text_width(fontBold14, 14, "Yes")) / 2, 112, (overwrite) ? DARKBLUE : YELLOW, 14, "Yes"); + sftd_draw_text(fontBold14, 249 + (36 - sftd_get_text_width(fontBold14, 14, "No")) / 2, 112, (!overwrite) ? DARKBLUE : YELLOW, 14, "No"); + sftd_draw_text(fontBold14, 210 + (36 - sftd_get_text_width(fontBold14, 14, "Yes")) / 2, 140, (adapt) ? DARKBLUE : YELLOW, 14, "Yes"); + sftd_draw_text(fontBold14, 249 + (36 - sftd_get_text_width(fontBold14, 14, "No")) / 2, 140, (!adapt) ? DARKBLUE : YELLOW, 14, "No"); + sftd_draw_text(fontBold14, 229 + (36 - sftd_get_text_width(fontBold14, 14, cont)) / 2, 170, YELLOW, 14, cont); + + printBottomIndications("Press START to inject, B to return."); + sf2d_end_frame(); + sf2d_swapbuffers(); + + free(buf); + free(cont); + free(path); +} + +void printDB6(int sprite, int i, bool langVett[], bool adapt, bool overwrite, int langSelected, int nInjected) { + char *languages[7] = {"JPN", "ENG", "FRE", "ITA", "GER", "SPA", "KOR"}; + char *path = (char*)malloc(30 * sizeof(char)); + char *cont = (char*)malloc(3 * sizeof(char)); + u8* buf = (u8*)malloc(1500 * sizeof(u8)); + memset(buf, 0, 1499); + snprintf(path, 30, "romfs:/database/%d.txt", i); + snprintf(cont, 3, "%d", nInjected + 1); + loadFile(buf, path); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(eventTop, 0, 24); + if (sprite != -1) + sf2d_draw_texture_part_scale(spritesSmall, 282, 46 - movementOffsetLong(6), 40 * (sprite % 25) + 4, 30 * (sprite / 25), 34, 30, 2, 2); + sftd_draw_text(fontFixed, 5, 28, WHITE, 10, (char*)buf); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + sftd_draw_text(fontBold14, 33, 50, LIGHTBLUE, 14, "Languages:"); + sftd_draw_text(fontBold14, 33, 112, LIGHTBLUE, 14, "Overwrite Wondercard:"); + sftd_draw_text(fontBold14, 33, 140, LIGHTBLUE, 14, "Adapt language to WC:"); + sftd_draw_text(fontBold14, 33, 170, LIGHTBLUE, 14, "Inject WC in slot:"); + + for (int t = 0; t < 7; t++) { + int x = 0, y = 0; + switch (t) { + case 0 : { x = 132; y = 50; break; } + case 1 : { x = 171; y = 50; break; } + case 2 : { x = 210; y = 50; break; } + case 3 : { x = 249; y = 50; break; } + case 4 : { x = 151; y = 74; break; } + case 5 : { x = 190; y = 74; break; } + case 6 : { x = 229; y = 74; break; } + } + if (langVett[t]) { + if (t == langSelected) { + sf2d_draw_texture(redButton, x, y); + sftd_draw_text(fontBold14, x + (36 - sftd_get_text_width(fontBold14, 14, languages[t])) / 2, y + 2, DARKBLUE, 14, languages[t]); + } else { + sf2d_draw_texture(darkButton, x, y); + sftd_draw_text(fontBold14, x + (36 - sftd_get_text_width(fontBold14, 14, languages[t])) / 2, y + 2, YELLOW, 14, languages[t]); + } + } + else { + sf2d_draw_texture(lightButton, x, y); + sftd_draw_text(fontBold14, x + (36 - sftd_get_text_width(fontBold14, 14, languages[t])) / 2, y + 2, DARKBLUE, 14, languages[t]); + } + } + + if (overwrite) { + sf2d_draw_texture(redButton, 210, 110); + sf2d_draw_texture(darkButton, 249, 110); + } + else { + sf2d_draw_texture(darkButton, 210, 110); + sf2d_draw_texture(redButton, 249, 110); + } + + if (adapt) { + sf2d_draw_texture(redButton, 210, 138); + sf2d_draw_texture(darkButton, 249, 138); + } + else { + sf2d_draw_texture(darkButton, 210, 138); + sf2d_draw_texture(redButton, 249, 138); + } + + sf2d_draw_texture(darkButton, 229, 168); + + sftd_draw_text(fontBold14, 210 + (36 - sftd_get_text_width(fontBold14, 14, "Yes")) / 2, 112, (overwrite) ? DARKBLUE : YELLOW, 14, "Yes"); + sftd_draw_text(fontBold14, 249 + (36 - sftd_get_text_width(fontBold14, 14, "No")) / 2, 112, (!overwrite) ? DARKBLUE : YELLOW, 14, "No"); + sftd_draw_text(fontBold14, 210 + (36 - sftd_get_text_width(fontBold14, 14, "Yes")) / 2, 140, (adapt) ? DARKBLUE : YELLOW, 14, "Yes"); + sftd_draw_text(fontBold14, 249 + (36 - sftd_get_text_width(fontBold14, 14, "No")) / 2, 140, (!adapt) ? DARKBLUE : YELLOW, 14, "No"); + sftd_draw_text(fontBold14, 229 + (36 - sftd_get_text_width(fontBold14, 14, cont)) / 2, 170, YELLOW, 14, cont); + + printBottomIndications("Press START to inject, B to return."); + sf2d_end_frame(); + sf2d_swapbuffers(); + + free(buf); + free(cont); + free(path); +} + +void printEditor(u8* mainbuf, int game, int currentEntry, int langCont) { + int y = 41; + char *languages[] = {"JPN", "ENG", "FRE", "ITA", "GER", "SPA", "KOR", "CHS", "CHT"}; + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(cleanTop, 0, 0); + printTitle("Save File Editor"); + + for (int i = 0; i < 5; i++) { + if (i == currentEntry) + sf2d_draw_texture(eventMenuTopBarSelected, 18, y); + else + sf2d_draw_texture(eventMenuTopBar, 18, y); + + switch (i) { + case 0 : { + int x = 140; + sftd_draw_text(fontBold12, 40, y + 10, DARKGREY, 12, "Language:"); + sf2d_draw_texture(miniBox, x, y + 7); + sftd_draw_text(fontBold12, x + (36 - sftd_get_text_width(fontBold12, 12, languages[langCont])) / 2, y + 10, YELLOW, 12, languages[langCont]); + break; + } + case 1 : { sftd_draw_text(fontBold12, 18 + (182 - sftd_get_text_width(fontBold12, 12, "Set Heals to max")) / 2, y + 10, (i == currentEntry) ? DARKBLUE : YELLOW, 12, "Set Heals to max"); break; } + case 2 : { sftd_draw_text(fontBold12, 18 + (182 - sftd_get_text_width(fontBold12, 12, "Set Items to max")) / 2, y + 10, (i == currentEntry) ? DARKBLUE : YELLOW, 12, "Set Items to max"); break; } + case 3 : { sftd_draw_text(fontBold12, 18 + (182 - sftd_get_text_width(fontBold12, 12, "Set Berries to max")) / 2, y + 10, (i == currentEntry) ? DARKBLUE : YELLOW, 12, "Set Berries to max"); break; } + case 4 : { sftd_draw_text(fontBold12, 18 + (182 - sftd_get_text_width(fontBold12, 12, "Set all TMs")) / 2, y + 10, (i == currentEntry) ? DARKBLUE : YELLOW, 12, "Set all TMs"); break; } + } + y += 37; + } + + y = 41; + for (int i = 5; i < 10; i++) { + if (i == currentEntry) + sf2d_draw_texture(eventMenuTopBarSelected, 200, y); + else + sf2d_draw_texture(eventMenuTopBar, 200, y); + + switch (i) { + case 5 : { sftd_draw_text(fontBold12, 200 + (182 - sftd_get_text_width(fontBold12, 12, "Clear Mystery Gift box")) / 2, y + 10, (i == currentEntry) ? DARKBLUE : YELLOW, 12, "Clear Mistery Gift box"); break; } + } + y += 37; + } + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + printBottomIndications("Press START to edit, A to toggle, B to exit."); + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +u16 getAlternativeSprite(u8* pkmn) { + u16 tempspecies; + if (getForm(pkmn)) { + memcpy(&tempspecies, &personal.pkmData[getPokedexNumber(pkmn)][0x1C], 2); + + switch (tempspecies) { + case 829 : return 2; + case 922 : return 3; + case 828 : return 4; + case 827 : return 5; + case 945 : return 6; + case 917 : return 7; + case 916 : return 8; + case 921 : return 10; + case 920 : return 11; + case 826 : return 12; + case 919 : return 13; + case 907 : return 14; + case 823 : return 15; + case 918 : return 16; + case 898 : return 17; + case 944 : return 18; + case 913 : return 19; + case 912 : return 20; + case 808 : return 21; + case 911 : return 22; + case 909 : return 23; + case 923 : return 24; + case 908 : return 25; + case 924 : return 26; + case 914 : return 27; + case 915 : return 28; + case 809 : return 30; + } + } + + return 0; +} + +void printElement(u8* pkmn, u16 n, int x, int y) { + u16 t = getAlternativeSprite(pkmn); + if (t) { + t -= 1; + sf2d_draw_texture_part(alternativeSpritesSmall, x, y, 40 * (t % 6) + 4, 30 * (t / 6), 34, 30); + } else + sf2d_draw_texture_part(spritesSmall, x, y, 40 * (n % 25) + 4, 30 * (n / 25), 34, 30); + if (isEgg(pkmn)) + sf2d_draw_texture_part(spritesSmall, x + 6, y + 6, 40 * (EGGSPRITEPOS % 25) + 4, 30 * (EGGSPRITEPOS / 25), 34, 30); + if (getItem(pkmn)) + sf2d_draw_texture(item, x + 3, y + 21); +} +void printElementBlend(u8* pkmn, u16 n, int x, int y) { + u16 t = getAlternativeSprite(pkmn); + if (t) { + t -= 1; + sf2d_draw_texture_part_blend(alternativeSpritesSmall, x, y, 40 * (t % 6) + 4, 30 * (t / 6), 34, 30, RGBA8(0x0, 0x0, 0x0, 100)); + } else + sf2d_draw_texture_part_blend(spritesSmall, x, y, 40 * (n % 25) + 4, 30 * (n / 25), 34, 30, RGBA8(0x0, 0x0, 0x0, 100)); + if (isEgg(pkmn)) + sf2d_draw_texture_part_blend(spritesSmall, x + 6, y + 6, 40 * (EGGSPRITEPOS % 25) + 4, 30 * (EGGSPRITEPOS / 25), 34, 30, RGBA8(0x0, 0x0, 0x0, 100)); + if (getItem(pkmn)) + sf2d_draw_texture_blend(item, x + 3, y + 21, RGBA8(0x0, 0x0, 0x0, 100)); +} + +void infoViewer(u8* pkmn) { + int y_desc = 29; + char* entries[] = {"Nickname:", "OT:", "Pokerus:", "Nature", "Ability:", "Item:", "TID:", "SID:", "Friendship:", "Hidden Power:"}; + char* values[] = {"HP", "Attack", "Defence", "Sp. Atk", "Sp. Def", "Speed"}; + + printAnimatedBG(true); + sf2d_draw_texture(infoView, 0, 0); + + sf2d_draw_texture(normalBar, 252, 155); + sf2d_draw_texture(normalBar, 252, 176); + sf2d_draw_texture(normalBar, 252, 197); + sf2d_draw_texture(normalBar, 252, 218); + + sftd_draw_text(fontBold12, 251, 138, WHITE, 12, "Moves"); + for (int i = 0; i < 10; i++) { + sftd_draw_text(fontBold12, 2, y_desc, BLUE, 12, entries[i]); + y_desc += 20; + if (i == 2) y_desc += 5; + if (i == 5) y_desc += 6; + } + + y_desc = 8; + for (int i = 0; i < 6; i++) { + sftd_draw_text(fontBold12, 225, y_desc, LIGHTBLUE, 12, values[i]); + y_desc += 20; + } + + if (getPokedexNumber(pkmn)) { + sf2d_draw_texture_part(balls, -2, -5, 32 * (getBall(pkmn) % 8), 32 * (getBall(pkmn) / 8), 32, 32); + sftd_draw_text(fontBold12, 30, 6, WHITE, 12, pokemon[getPokedexNumber(pkmn)]); + + if (getGender(pkmn) == 0) + sf2d_draw_texture(male, 146, 7); + else if (getGender(pkmn) == 1) + sf2d_draw_texture(female, 148, 7); + + char* level = (char*)malloc(8 * sizeof(char)); + snprintf(level, 8, "Lv.%u", getLevel(pkmn)); + sftd_draw_text(fontBold12, 160, 6, WHITE, 12, level); + free(level); + + char *nick = (char*)malloc(26 * sizeof(char)); + getNickname(pkmn, nick); + sftd_draw_text(fontBold12, 215 - (sftd_get_text_width(fontBold12, 12, nick)), 29, WHITE, 12, nick); + free(nick); + + char *ot_name = (char*)malloc(0x17 * sizeof(char)); + getOT(pkmn, ot_name); + sftd_draw_text(fontBold12, 215 - (sftd_get_text_width(fontBold12, 12, ot_name)), 49, WHITE, 12, ot_name); + free(ot_name); + + sftd_draw_text(fontBold12, 215 - sftd_get_text_width(fontBold12, 12, (isInfected(pkmn) ? "Yes" : "No")), 69, WHITE, 12, isInfected(pkmn) ? "Yes" : "No"); + sftd_draw_text(fontBold12, 215 - sftd_get_text_width(fontBold12, 12, natures[getNature(pkmn)]), 94, WHITE, 12, natures[getNature(pkmn)]); + sftd_draw_text(fontBold12, 215 - sftd_get_text_width(fontBold12, 12, abilities[getAbility(pkmn)]), 114, WHITE, 12, abilities[getAbility(pkmn)]); + sftd_draw_text(fontBold12, 215 - sftd_get_text_width(fontBold12, 12, items[getItem(pkmn)]), 134, WHITE, 12, items[getItem(pkmn)]); + + if (isShiny(pkmn)) + sf2d_draw_texture(shinyStar, 205, 9); + + char* friendship = (char*)malloc(4 * sizeof(char)); + snprintf(friendship, 4, "%u", getFriendship(pkmn)); + sftd_draw_text(fontBold12, 215 - sftd_get_text_width(fontBold12, 12, friendship), 200, WHITE, 12, friendship); + free(friendship); + + char* otid = (char*)malloc(7 * sizeof(char)); + snprintf(otid, 7, "%u", getOTID(pkmn)); + sftd_draw_text(fontBold12, 215 - sftd_get_text_width(fontBold12, 12, otid), 160, WHITE, 12, otid); + snprintf(otid, 7, "%u", getSOTID(pkmn)); + sftd_draw_text(fontBold12, 215 - sftd_get_text_width(fontBold12, 12, otid), 180, WHITE, 12, otid); + free(otid); + + sftd_draw_text(fontBold12, 215 - sftd_get_text_width(fontBold12, 12, hpList[getHPType(pkmn)]), 220, WHITE, 12, hpList[getHPType(pkmn)]); + + int max = sftd_get_text_width(fontBold12, 12, "252"); + int y_moves = 159; + for (int i = 0; i < 4; i++) { + if (getMove(pkmn, i)) + sftd_draw_text(fontBold12, 396 - sftd_get_text_width(fontBold12, 12, moves[getMove(pkmn, i)]), y_moves, WHITE, 12, moves[getMove(pkmn, i)]); + y_moves += 21; + } + + char* tmp = (char*)malloc(4); + for (int i = 0; i < 6; i++) { + snprintf(tmp, 4, "%d", getIV(pkmn, lookup[i])); + sftd_draw_text(fontBold12, 289 + (max - sftd_get_text_width(fontBold12, 12, tmp)) / 2, 8 + i * 20, WHITE, 12, tmp); + snprintf(tmp, 4, "%d", getEV(pkmn, lookup[i])); + sftd_draw_text(fontBold12, 328 + (max - sftd_get_text_width(fontBold12, 12, tmp)) / 2, 8 + i * 20, WHITE, 12, tmp); + snprintf(tmp, 4, "%d", getStat(pkmn, lookup[i])); + sftd_draw_text(fontBold12, 369 + (max - sftd_get_text_width(fontBold12, 12, tmp)) / 2, 8 + i * 20, WHITE, 12, tmp); + } + free(tmp); + } +} + +void printPKViewer(u8* mainbuf, u8* tmp, bool isTeam, int game, int currentEntry, int menuEntry, int box, int mode, bool speedy, int additional1) { + char* menuEntries[] = {"EDIT", "CLONE", "RELEASE", "GENERATE", "EXIT"}; + int x; + char* page = (char*)malloc(7 * sizeof(char)); + snprintf(page, 7, "Box %d", box + 1); + + u8* pkmn = (u8*)malloc(PKMNLENGTH * sizeof(u8)); + getPkmn(mainbuf, (isTeam) ? 33 : box, currentEntry, pkmn, game); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + infoViewer(pkmn); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(boxView, 0, 0); + sf2d_draw_texture(editorBar, 0, 210); + sftd_draw_text(fontBold12, 12 + (LRBar->width - sftd_get_text_width(fontBold12, 12, page)) / 2, 19, WHITE, 12, page); + sf2d_draw_texture(left, 7, 17); + sf2d_draw_texture(right, 185, 17); + sf2d_draw_texture(back, 280, 210); + sftd_draw_text(fontBold12, 247, 7, WHITE, 12, "Team"); + + int y = 45; + int pointer[2] = {0, 0}; + for (int i = 0; i < 5; i++) { + x = 4; + for (int j = 0; j < 6; j++) { + getPkmn(mainbuf, box, i * 6 + j, pkmn, game); + u16 n = getPokedexNumber(pkmn); + if (n) + printElement(pkmn, n, x, y); + + if ((currentEntry == (i * 6 + j)) && !isTeam) { + pointer[0] = x + 18; + pointer[1] = y - 8; + } + x += 34; + } + y += 30; + } + + for (int i = 0; i < 3; i++) { + sf2d_draw_texture(pokemonBufferBox, 214, 40 + i * 45); + sf2d_draw_texture(pokemonBufferBox, 266, 60 + i * 45); + } + + y = 45; + for (int i = 0; i < 3; i++) { + x = 222; + for (int j = 0; j < 2; j++) { + getPkmn(mainbuf, 33, i * 2 + j, pkmn, game); + u16 n = getPokedexNumber(pkmn); + if (n) + printElement(pkmn, n, x, (j == 1) ? y + 20 : y); + + if ((currentEntry == (i * 2 + j)) && isTeam) { + pointer[0] = x + 18; + pointer[1] = y - 8 + ((j == 1) ? 20 : 0); + } + x += 52; + } + y += 45; + } + + if (mode != ED_CLONE) + sf2d_draw_texture(selector, pointer[0], pointer[1] - ((mode == ED_STANDARD) ? movementOffsetSlow(3) : 0)); + else { + sf2d_draw_texture(selectorCloning, pointer[0], pointer[1] - movementOffsetSlow(3)); + sf2d_draw_texture(bottomPopUp, 1, 214); + sftd_draw_text(fontBold11, 8, 220, WHITE, 11, "Press A to clone in selected slot, B to cancel"); + } + + if (mode == ED_MENU) { + sf2d_draw_texture(bottomMask, 0, 0); + sf2d_draw_texture(bottomPopUp, 1, 214); + sftd_draw_textf(fontBold11, 8, 220, WHITE, 11, "%s has been selected.", pokemon[getPokedexNumber(tmp)]); + for (int i = 0; i < 5; i++) { + sf2d_draw_texture(button, 208, 42 + i * 27); + if (i == menuEntry) + sf2d_draw_texture(subArrow, 203 - movementOffsetSlow(3), 46 + i * 27); + sftd_draw_text(fontBold12, 208 + (109 - sftd_get_text_width(fontBold12, 12, menuEntries[i])) / 2, 49 + i * 27, BLACK, 12, menuEntries[i]); + } + } else if (mode == ED_GENERATE) { + sf2d_draw_texture(bottomMask, 0, 0); + sf2d_draw_texture(bottomPopUp, 1, 214); + sftd_draw_textf(fontBold11, 8, 220, WHITE, 11, "You can switch speed with L/R: %s", (speedy) ? "FAST" : "SLOW"); + sf2d_draw_texture(left, 48, 91); + sf2d_draw_texture(right, 145, 91); + sf2d_draw_texture(dexBox, 79, 82); + //sf2d_draw_texture(dexN, 50, 147); + sf2d_draw_texture_part(spritesSmall, 87, 89, 40 * (additional1 % 25) + 4, 30 * (additional1 / 25), 34, 30); + //sftd_draw_text(fontBold12, 50 + (109 - sftd_get_text_width(fontBold12, 12, "DEX N.")) / 2, 156, BLACK, 12, "DEX N."); + } + + sf2d_end_frame(); + sf2d_swapbuffers(); + + free(pkmn); + free(page); +} + +void printPKEditor(u8* pkmn, int game, bool speedy, int additional1, int additional2, int additional3, int mode) { + int max = sftd_get_text_width(fontBold12, 12, "252"); + char* entries[] = {"Level:", "Nature:", "Ability:", "Item:", "Shiny:", "Pokerus:", "OT:", "Nickname:", "Friendship:"}; + char* options[] = {"STATS", "MOVES", "SAVE"}; + + char* values[6] = {"HP:", "Attack:", "Defense:", "Sp. Attack:", "Sp. Defence:", "Speed:"}; + u16 n = getPokedexNumber(pkmn); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + if (mode == ED_BASE || mode == ED_STATS) { + sftd_draw_text(fontBold15, (400 - sftd_get_text_width(fontBold15, 15, "Edit your Pokemon in the bottom screen")) / 2, 95, RGBA8(255, 255, 255, giveTransparence()), 15, "Edit your Pokemon in the bottom screen"); + sftd_draw_text(fontBold15, (400 - sftd_get_text_width(fontBold15, 15, "Tap SAVE when you're done")) / 2, 115, RGBA8(255, 255, 255, giveTransparence()), 15, "Tap SAVE when you're done"); + } else if (mode == ED_ITEMS) { + int y = 0, x = 0; + sf2d_draw_texture(topMovesBG, 0, 0); + for (int i = 0; i < 20; i++) { + if (i == additional1) + sf2d_draw_texture(topSelectedMove, x + 2, y); + sftd_draw_textf(fontBold9, x + 2, y, WHITE, 9, "%d - %s", 40 * additional2 + i, itemsSorted[40 * additional2 + i]); + y += (topSelectedMove->height + 1); + } + y = 0; x = 200; + for (int i = 20; i < 40; i++) { + if (i == additional1) sf2d_draw_texture(topSelectedMove, x, y); + sftd_draw_textf(fontBold9, x + 2, y, WHITE, 9, "%d - %s", 40 * additional2 + i, itemsSorted[40 * additional2 + i]); + y += (topSelectedMove->height + 1); + } + } else if (mode == ED_MOVES) { + int y = 0, x = 0; + sf2d_draw_texture(topMovesBG, 0, 0); + for (int i = 0; i < 20; i++) { + if (i == additional1) sf2d_draw_texture(topSelectedMove, x + 2, y); + sftd_draw_textf(fontBold9, x + 2, y, WHITE, 9, "%d - %s", 40 * additional2 + i, movesSorted[40 * additional2 + i]); + y += (topSelectedMove->height + 1); + } + y = 0; x = 200; + for (int i = 20; i < 40; i++) { + if (i == additional1) sf2d_draw_texture(topSelectedMove, x, y); + sftd_draw_textf(fontBold9, x + 2, y, WHITE, 9, "%d - %s", 40 * additional2 + i, movesSorted[40 * additional2 + i]); + y += (topSelectedMove->height + 1); + } + } else if (mode == ED_NATURES) { + char* hor[] = {"Neutral", "-Attack", "-Defence", "-Speed", "-Sp. Atk.", "-Sp. Def."}; + char* ver[] = {"+Attack", "+Defence", "+Speed", "+Sp. Atk.", "+Sp. Def."}; + + sf2d_draw_texture(naturestx, 0, 0); + for (int i = 0; i < 6; i++) + sftd_draw_text(fontBold12, 66 * i + (66 - sftd_get_text_width(fontBold12, 12, hor[i])) / 2, 13, (i == 0) ? YELLOW : BLUE, 12, hor[i]); + for (int i = 0; i < 5; i++) + sftd_draw_text(fontBold12, (66 - sftd_get_text_width(fontBold12, 12, ver[i])) / 2, 53 + i * 40, BLUE, 12, ver[i]); + + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 5; j++) { + if (additional1 == i * 5 + j) + sf2d_draw_texture(naturesButton, 66 + j * 66 + j, 40 + i * 40); + sftd_draw_text(fontBold12, 66 + 66 * j + (66 - sftd_get_text_width(fontBold12, 12, natures[i * 5 + j])) / 2 + j, 53 + i * 40, (i == j) ? YELLOW : WHITE, 12, natures[i * 5 + j]); + } + } + } else if (mode == ED_BALLS) { + char* entries[] = {"Master Ball", "Ultra Ball", "Great Ball", "Poke Ball", "Safari Ball", "Net Ball", "Dive Ball", "Nest Ball", "Repeat Ball", "Timer Ball", "Luxury Ball", "Premier Ball", "Dusk Ball", "Heal Ball", "Quick Ball", "Cherish Ball", "Fast Ball", "Level Ball", "Lure Ball", "Heavy Ball", "Love Ball", "Friend Ball", "Moon Ball", "Sport Ball", "Dream Ball", "Beast Ball", " ", " ", " ", " "}; + sf2d_draw_texture(ballsBG, 0, 0); + + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 6; j++) { + if (additional1 == i * 6 + j) + sf2d_draw_texture(ballButton, j * 66 + j, i * 47 + i); + sf2d_draw_texture_part(balls, 17 + 66 * j + j, 2 + i * 47, 32 * ((i * 6 + j + 1) % 8), 32 * ((i * 6 + j + 1) / 8), 32, 32); + sftd_draw_text(fontBold9, 66 * j + (66 - sftd_get_text_width(fontBold9, 9, entries[i * 6 + j])) / 2 + j, 30 + i * 47 + i, WHITE, 9, entries[i * 6 + j]); + } + } + } else if (mode == ED_HIDDENPOWER) { + sf2d_draw_texture(hiddenPowerBG, 0, 0); + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + if (additional1 == i * 4 + j) + sf2d_draw_texture(hiddenPowerButton, j * 99 + j, + i * 59+ i); + sf2d_draw_texture_part(typesSheet, 24 + 99 * j + j, 20 + 59 * i + i, 50 * (i * 4 + j + 1), 0, 50, 18); + } + } + } + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + printAnimatedBG(false); + if (mode == ED_BASE || mode == ED_ITEMS || mode == ED_NATURES || mode == ED_BALLS) { + sf2d_draw_texture(editorBG, 0, 1); + sf2d_draw_texture(editorBar, 0, 210); + + sftd_draw_text(fontBold12, 27, 4, WHITE, 12, pokemon[n]); + sf2d_draw_texture_part(balls, -2, -6, 32 * (getBall(pkmn) % 8), 32 * (getBall(pkmn) / 8), 32, 32); + + u16 t = getAlternativeSprite(pkmn); + int ofs = movementOffsetSlow(3); + if (t) { + t -= 1; + sf2d_draw_texture_part_scale_blend(alternativeSpritesSmall, 232, 32 - ofs, 40 * (t % 6) + 4, 30 * (t / 6), 34, 30, 2, 2, RGBA8(0x0, 0x0, 0x0, 100)); + sf2d_draw_texture_part_scale(alternativeSpritesSmall, 227, 27 - ofs, 40 * (t % 6) + 4, 30 * (t / 6), 34, 30, 2, 2); + } else { + sf2d_draw_texture_part_scale_blend(spritesSmall, 232, 32 - ofs, 40 * (n % 25) + 4, 30 * (n / 25), 34, 30, 2, 2, RGBA8(0x0, 0x0, 0x0, 100)); + sf2d_draw_texture_part_scale(spritesSmall, 227, 27 - ofs, 40 * (n % 25) + 4, 30 * (n / 25), 34, 30, 2, 2); + } + + if (getGender(pkmn) == 0) + sf2d_draw_texture(male, 159, 6); + else if (getGender(pkmn) == 1) + sf2d_draw_texture(female, 161, 6); + + for (int i = 0; i < 3; i++) { + sf2d_draw_texture(button, 206, 116 + i * 27); + sftd_draw_text(fontBold12, 206 + (109 - sftd_get_text_width(fontBold12, 12, options[i])) / 2, 123 + i * 27, BLACK, 12, options[i]); + } + + for (int i = 0; i < 9; i++) + sftd_draw_text(fontBold12, 2, 29 + i * 20, LIGHTBLUE, 12, entries[i]); + + for (int i = 0; i < 7; i++) + sf2d_draw_texture(setting, 180, 51 + i * 20); + + sf2d_draw_texture(minus, 180 - max - 6 - minus->width, 29); + sf2d_draw_texture(plus, 180, 29); + sf2d_draw_texture(minus, 180 - max - 6 - minus->width, 189); + sf2d_draw_texture(plus, 180, 189); + + char* level = (char*)malloc(4 * sizeof(char)); + snprintf(level, 4, "%u", getLevel(pkmn)); + sftd_draw_text(fontBold12, 180 - max - 3 + (max - sftd_get_text_width(fontBold12, 12, level)) / 2, 29, WHITE, 12, level); + free(level); + + sftd_draw_text(fontBold12, 178 - sftd_get_text_width(fontBold12, 12, natures[getNature(pkmn)]), 49, WHITE, 12, natures[getNature(pkmn)]); + sftd_draw_text(fontBold12, 178 - sftd_get_text_width(fontBold12, 12, abilities[getAbility(pkmn)]), 69, WHITE, 12, abilities[getAbility(pkmn)]); + sftd_draw_text(fontBold12, 178 - sftd_get_text_width(fontBold12, 12, items[getItem(pkmn)]), 89, WHITE, 12, items[getItem(pkmn)]); + sftd_draw_text(fontBold12, 178 - sftd_get_text_width(fontBold12, 12, isShiny(pkmn) ? "Yes" : "No"), 109, WHITE, 12, isShiny(pkmn) ? "Yes" : "No"); + sftd_draw_text(fontBold12, 178 - sftd_get_text_width(fontBold12, 12, isInfected(pkmn) ? "Yes" : "No"), 129, WHITE, 12, isInfected(pkmn) ? "Yes" : "No"); + + char* friendship = (char*)malloc(4 * sizeof(char)); + snprintf(friendship, 4, "%u", getFriendship(pkmn)); + sftd_draw_text(fontBold12, 180 - max - 3 + (max - sftd_get_text_width(fontBold12, 12, friendship)) / 2, 189, WHITE, 12, friendship); + free(friendship); + + char *nick = (char*)malloc(26 * sizeof(char)); + getNickname(pkmn, nick); + sftd_draw_text(fontBold12, 178 - (sftd_get_text_width(fontBold12, 12, nick)), 169, WHITE, 12, nick); + free(nick); + + char *ot_name = (char*)malloc(0x17 * sizeof(char)); + getOT(pkmn, ot_name); + sftd_draw_text(fontBold12, 178 - (sftd_get_text_width(fontBold12, 12, ot_name)), 149, WHITE, 12, ot_name); + free(ot_name); + } + if (mode == ED_STATS || mode == ED_HIDDENPOWER) { + sf2d_draw_texture(editorStatsBG, 0, 1); + sf2d_draw_texture(editorBar, 0, 210); + sf2d_draw_texture(setting, 291, 175); + sftd_draw_text(fontBold12, 2, 28, LIGHTBLUE, 12, "STATS"); + sftd_draw_text(fontBold12, 118, 28, DARKBLUE, 12, "IV"); + sftd_draw_text(fontBold12, 197, 28, DARKBLUE, 12, "EV"); + sftd_draw_text(fontBold12, 256, 28, DARKBLUE, 12, "TOTAL"); + sftd_draw_text(fontBold12, 2, 173, LIGHTBLUE, 12, "Hidden Power:"); + + sftd_draw_text(fontBold12, 27, 4, WHITE, 12, pokemon[n]); + sf2d_draw_texture_part(balls, -2, -6, 32 * (getBall(pkmn) % 8), 32 * (getBall(pkmn) / 8), 32, 32); + + if (getGender(pkmn) == 0) + sf2d_draw_texture(male, 159, 6); + else if (getGender(pkmn) == 1) + sf2d_draw_texture(female, 161, 6); + + for (int i = 0; i < 6; i++) + sftd_draw_text(fontBold12, 2, 49 + i * 20, LIGHTBLUE, 12, values[i]); + + char* tmp = (char*)malloc(4); + for (int i = 0; i < 6; i++) { + snprintf(tmp, 4, "%d", getIV(pkmn, lookup[i])); + sftd_draw_text(fontBold12, 112 + (max - sftd_get_text_width(fontBold12, 12, tmp)) / 2, 49 + i * 20, WHITE, 12, tmp); + snprintf(tmp, 4, "%d", getEV(pkmn, lookup[i])); + sftd_draw_text(fontBold12, 192 + (max - sftd_get_text_width(fontBold12, 12, tmp)) / 2, 49 + i * 20, WHITE, 12, tmp); + snprintf(tmp, 4, "%d", getStat(pkmn, lookup[i])); + sftd_draw_text(fontBold12, 263 + (max - sftd_get_text_width(fontBold12, 12, tmp)) / 2, 49 + i * 20, WHITE, 12, tmp); + } + free(tmp); + + sftd_draw_text(fontBold12, 288 - sftd_get_text_width(fontBold12, 12, hpList[getHPType(pkmn)]), 173, WHITE, 12, hpList[getHPType(pkmn)]); + + for (int i = 0; i < 6; i++) { + sf2d_draw_texture(minus, 96, 49 + i * 20); + sf2d_draw_texture(plus, 139, 49 + i * 20); + sf2d_draw_texture(minus, 177, 49 + i * 20); + sf2d_draw_texture(plus, 218, 49 + i * 20); + } + } + if (mode == ED_MOVES) { + sf2d_draw_texture(movesBottom, 0, 1); + sf2d_draw_texture(movesBottom, 0, 2 + movesBottom->height); + sf2d_draw_texture(editorBar, 0, 210); + sftd_draw_text(fontBold12, 2, 5, LIGHTBLUE, 12, "Moves"); + sftd_draw_text(fontBold12, 2, 110, LIGHTBLUE, 12, "Relearn Moves"); + + for (int i = 0; i < 4; i++) { + sftd_draw_text(fontBold12, 2, 28 + i * 20, (i == additional3) ? YELLOW : WHITE, 12, moves[getMove(pkmn, i)]); + sftd_draw_text(fontBold12, 2, 132 + i * 20, (i == additional3 - 4) ? YELLOW: WHITE, 12, moves[getEggMove(pkmn, i)]); + if (i == additional3) + sf2d_draw_texture_rotate(subArrow, 198 - movementOffsetSlow(3), 33 + i * 20, 3.1415f); + else if (i == additional3 - 4) + sf2d_draw_texture_rotate(subArrow, 198 - movementOffsetSlow(3), 137 + i * 20, 3.1415f); + } + } + + sf2d_draw_texture(back, 280, 210); + sftd_draw_textf(fontBold9, 55, 220, WHITE, 9, "You can switch speed using (L/R): %s", speedy ? "FAST" : "SLOW"); + + // apply masks + if (mode == ED_ITEMS) { + sf2d_draw_texture(bottomMask, 0, 0); + sftd_draw_text(fontBold14, (320 - sftd_get_text_width(fontBold14, 14, "Select an item with A in the top screen.")) / 2, 105, WHITE, 14, "Select an item with A in the top screen."); + } else if (mode == ED_NATURES) { + sf2d_draw_texture(bottomMask, 0, 0); + sftd_draw_text(fontBold14, (320 - sftd_get_text_width(fontBold14, 14, "Select a nature with A in the top screen.")) / 2, 105, WHITE, 14, "Select a nature with A in the top screen."); + } else if (mode == ED_BALLS) { + sf2d_draw_texture(bottomMask, 0, 0); + sftd_draw_text(fontBold14, (320 - sftd_get_text_width(fontBold14, 14, "Select a ball with A in the top screen.")) / 2, 105, WHITE, 14, "Select a ball with A in the top screen."); + } else if (mode == ED_HIDDENPOWER) { + sf2d_draw_texture(bottomMask, 0, 0); + sftd_draw_text(fontBold14, (320 - sftd_get_text_width(fontBold14, 14, "Select a HP type with A in the top screen.")) / 2, 105, WHITE, 14, "Select a HP type with A in the top screen."); + } + + sf2d_end_frame(); + sf2d_swapbuffers(); +} + +void printPKBank(u8* bankbuf, u8* mainbuf, u8* pkmnbuf, int game, int currentEntry, int saveBox, int bankBox, bool isBufferized, bool isSeen) { + int x, y; + int pointer[2] = {0, 0}; + char* page = (char*)malloc(10 * sizeof(char)); + + u8* pkmn = (u8*)malloc(PKMNLENGTH * sizeof(u8)); + if (currentEntry < 30) + memcpy(pkmn, &bankbuf[bankBox * 30 * PKMNLENGTH + currentEntry * PKMNLENGTH], PKMNLENGTH); + else + getPkmn(mainbuf, saveBox, currentEntry - 30, pkmn, game); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + if (isSeen) { + infoViewer(pkmnbuf); + } else { + printAnimatedBG(true); + sf2d_draw_texture(bankTop, 34, 5); + snprintf(page, 10, "Bank %d", bankBox + 1); + sftd_draw_text(fontBold12, 55 + (LRBar->width - sftd_get_text_width(fontBold12, 12, page)) / 2, 9, WHITE, 12, page); + + if (getPokedexNumber(pkmn)) { + u16 tempspecies = getPokedexNumber(pkmn); + if (getForm(pkmn)) + memcpy(&tempspecies, &personal.pkmData[getPokedexNumber(pkmn)][0x1C], 2); + u8 type1 = personal.pkmData[tempspecies][0x6]; + u8 type2 = personal.pkmData[tempspecies][0x7]; + + sf2d_draw_texture_part(typesSheet, 273, 120, 50 * type1, 0, 50, 18); + if (type1 != type2) + sf2d_draw_texture_part(typesSheet, 325, 120, 50 * type2, 0, 50, 18); + + char *nick = (char*)malloc(26 * sizeof(char)); + getNickname(pkmn, nick); + sftd_draw_text(fontBold12, 273, 69, WHITE, 12, nick); + free(nick); + + char* level = (char*)malloc(8 * sizeof(char)); + snprintf(level, 8, "Lv.%u", getLevel(pkmn)); + sftd_draw_text(fontBold12, 372 - sftd_get_text_width(fontBold12, 12, level), 86, WHITE, 12, level); + + if (getGender(pkmn) == 0) + sf2d_draw_texture(male, 358 - sftd_get_text_width(fontBold12, 12, level), 86); + else if (getGender(pkmn) == 1) + sf2d_draw_texture(female, 360 - sftd_get_text_width(fontBold12, 12, level), 86); + if (isShiny(pkmn)) + sf2d_draw_texture(shinyStar, 360 - sftd_get_text_width(fontBold12, 12, level) - 14, 88); + + free(level); + + char *ot_name = (char*)malloc(0x17 * sizeof(char)); + getOT(pkmn, ot_name); + sftd_draw_text(fontBold12, 273, 146, WHITE, 12, ot_name); + free(ot_name); + + char* otid = (char*)malloc(12 * sizeof(char)); + snprintf(otid, 12, "ID. %u", getOTID(pkmn)); + sftd_draw_text(fontBold12, 372 - sftd_get_text_width(fontBold12, 12, otid), 163, WHITE, 12, otid); + free(otid); + + sftd_draw_text(fontBold12, 273, 104, WHITE, 12, pokemon[getPokedexNumber(pkmn)]); + } + y = 45; + for (int i = 0; i < 5; i++) { + x = 44; + for (int j = 0; j < 6; j++) { + memcpy(pkmn, &bankbuf[bankBox * 30 * PKMNLENGTH + (i * 6 + j) * PKMNLENGTH], PKMNLENGTH); + u16 n = getPokedexNumber(pkmn); + if (n) + printElement(pkmn, n, x, y); + + if (currentEntry == (i * 6 + j)) { + pointer[0] = x + 18; + pointer[1] = y - 8; + } + x += 34; + } + y += 30; + } + + if (currentEntry < 30) { + u16 n = getPokedexNumber(pkmnbuf); + if (n) printElementBlend(pkmnbuf, n, pointer[0] - 14, pointer[1] + 8); + if (n) printElement(pkmnbuf, n, pointer[0] - 18, pointer[1] + 3); + sf2d_draw_texture(selector, pointer[0], pointer[1] - 2 - ((!isBufferized) ? movementOffsetSlow(3) : 0)); + } + } + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(boxView, 0, 0); + sf2d_draw_texture(editorBar, 0, 210); + snprintf(page, 10, "Save %d", saveBox + 1); + sftd_draw_text(fontBold12, 12 + (LRBar->width - sftd_get_text_width(fontBold12, 12, page)) / 2, 19, WHITE, 12, page); + sf2d_draw_texture(left, 7, 17); + sf2d_draw_texture(right, 185, 17); + sf2d_draw_texture(transferButton, 242, 5); + sf2d_draw_texture(back, 280, 210); + sf2d_draw_texture(button, 208, 43); + sf2d_draw_texture(button, 208, 70); + sf2d_draw_texture(button, 208, 97); + sftd_draw_text(fontBold12, 208 + (109 - sftd_get_text_width(fontBold12, 12, "Y: VIEW")) / 2, 50, BLACK, 12, "Y: VIEW"); + sftd_draw_text(fontBold12, 208 + (109 - sftd_get_text_width(fontBold12, 12, "CLEAR BOX")) / 2, 77, BLACK, 12, "CLEAR BOX"); + sftd_draw_text(fontBold12, 208 + (109 - sftd_get_text_width(fontBold12, 12, "RELEASE")) / 2, 104, BLACK, 12, "RELEASE"); + + y = 45; + for (int i = 0; i < 5; i++) { + x = 4; + for (int j = 0; j < 6; j++) { + getPkmn(mainbuf, saveBox, i*6+j, pkmn, game); + u16 n = getPokedexNumber(pkmn); + if (n) + printElement(pkmn, n, x, y); + + if ((currentEntry - 30) == (i * 6 + j)) { + pointer[0] = x + 18; + pointer[1] = y - 8; + } + x += 34; + } + y += 30; + } + + if (currentEntry > 29) { + if (!isSeen) { + u16 n = getPokedexNumber(pkmnbuf); + if (n) printElementBlend(pkmnbuf, n, pointer[0] - 14, pointer[1] + 8); + if (n) printElement(pkmnbuf, n, pointer[0] - 18, pointer[1] + 3); + sf2d_draw_texture(selector, pointer[0], pointer[1] - 2 - ((!isBufferized) ? movementOffsetSlow(3) : 0)); + } else + sf2d_draw_texture(selector, pointer[0], pointer[1] - 2); + } + + if (isSeen) + sf2d_draw_texture(bottomMask, 0, -30); + sf2d_end_frame(); + sf2d_swapbuffers(); + + free(pkmn); + free(page); +} + +void printMassInjector(int currentEntry) { + int y = 41; + char* entries[] = {"XD Collection", "Colosseum Collection", "10th Anniversary Collection", "N's Collection", "Entree Forest Collection", "Dream Radar Collection", "Living Dex", "Oblivia Deoxys Collection", "Pokemon Ranch Collection", "KOR Events Collection"}; + int boxes[] = {3, 2, 1, 1, 1, 1, 27, 1, 1, 1}; + + char* message = (char*)malloc(30 * sizeof(char)); + snprintf(message, 30, "%d boxes will be replaced.", boxes[currentEntry]); + + sf2d_start_frame(GFX_TOP, GFX_LEFT); + sf2d_draw_texture(cleanTop, 0, 0); + printTitle("Mass Injector"); + + for (int i = 0; i < 5; i++) { + if (i == currentEntry) + sf2d_draw_texture(eventMenuTopBarSelected, 18, y); + else + sf2d_draw_texture(eventMenuTopBar, 18, y); + + sftd_draw_text(fontBold12, 18 + (182 - sftd_get_text_width(fontBold12, 12, entries[i])) / 2, y + 10, (i == currentEntry) ? DARKBLUE : YELLOW, 12, entries[i]); + + y += 37; + } + + y = 41; + for (int i = 5; i < 10; i++) { + if (i == currentEntry) + sf2d_draw_texture(eventMenuTopBarSelected, 200, y); + else + sf2d_draw_texture(eventMenuTopBar, 200, y); + + sftd_draw_text(fontBold12, 200 + (182 - sftd_get_text_width(fontBold12, 12, entries[i])) / 2, y + 10, (i == currentEntry) ? DARKBLUE : YELLOW, 12, entries[i]); + + y += 37; + } + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + sftd_draw_text(fontBold12, (320 - sftd_get_text_width(fontBold12, 12, message)) / 2, 12, LIGHTBLUE, 12, message); + printBottomIndications("Press START to inject, B to exit."); + sf2d_end_frame(); + sf2d_swapbuffers(); + + free(message); +} + +void printSettings(int box, bool speedy) { + char *menu[] = {"Bank Size: ", "Backup Save", "Backup Bank"}; + sf2d_start_frame(GFX_TOP, GFX_LEFT); + drawMenuTop(0); + sf2d_end_frame(); + + sf2d_start_frame(GFX_BOTTOM, GFX_LEFT); + sf2d_draw_texture(mainMenuBottom, 0, 0); + + for (int i = 0; i < 3; i++) { + sf2d_draw_texture(menuBar, (320 - menuBar->width) / 2, 60 + i * (menuBar->height)); + sftd_draw_text(fontBold15, (320 - sftd_get_text_width(fontBold15, 15, menu[i])) / 2 - 4, 55 + (menuBar->height - 18) / 2 + i * (menuBar->height), DARKBLUE, 15, menu[i]); + } + + sf2d_draw_texture(miniBox, 189, 64); + sf2d_draw_texture(minusButton, 169, 65); + sf2d_draw_texture(plusButton, 228, 65); + + char* size = (char*)malloc(5); + snprintf(size, 5, "%d", box); + sftd_draw_text(fontBold11, 189 + (36 - (sftd_get_text_width(fontBold11, 11, size))) / 2, 68, WHITE, 11, size); + free(size); + + sftd_draw_textf(fontBold9, 60, 225, LIGHTBLUE, 9, "You can switch speed using (L/R): %s", speedy ? "FAST" : "SLOW"); + sf2d_end_frame(); + sf2d_swapbuffers(); +} \ No newline at end of file diff --git a/source/graphic.h b/source/graphic.h new file mode 100644 index 000000000..969d93577 --- /dev/null +++ b/source/graphic.h @@ -0,0 +1,81 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ +#pragma once + +#include +#include +#include +#include "util.h" + +#define BLUE RGBA8(104, 137, 205, 255) +#define YELLOW RGBA8(237, 247, 157, 255) +#define LIGHTBLUE RGBA8(187, 208, 254, 255) +#define DARKBLUE RGBA8( 35, 69, 167, 255) +#define HIGHBLUE RGBA8( 28, 45, 86, 255) + +#define BLACK RGBA8(0, 0, 0, 255) +#define RED RGBA8(255, 0, 0, 255) +#define GREY RGBA8(0xF0, 0xF0, 0xF0, 0xFF) +#define DARKGREY RGBA8(0x0, 0x0, 0x0, 150) +#define WHITE RGBA8(255, 255, 255, 255) +#define AZZURRO RGBA8(0x33, 0x99, 0xFF, 0xFF) +#define TRASPWHITE RGBA8(255,255,255,170) +#define DS RGBA8(48, 48, 48, 255) +#define GOLD RGBA8(254, 234, 60, 255) + +#define EGGSPRITEPOS 803 + +#define MOVEMENTSPEED 4 + +static char* species[802]; + +void GUIElementsInit(); +void GUIElementsSpecify(int game); +void GUIGameElementsInit(); +void GUIGameElementsExit(); +void GUIElementsExit(); +void init_font_cache(); +void infoDisp(char* message); +int confirmDisp(char* message); +void freezeMsg(char* message); +void progressBar(char* message, u32 pagesize, u32 sz); +void autoupdaterMenu(); +void printPSDates(); +void printCredits(); +void printTitle(const char* title); +void gameSelectorMenu(int n); +void mainMenu(int currentEntry); +void mainMenuDS(int currentEntry); +void menu4(int currentEntry, char* menu[], int n); +void menu3(int currentEntry, char* menu[], int n); +void printDatabase6(char *database[], int currentEntry, int page, int spriteArray[]); +void printDatabase5(char *database[], int currentEntry, int page, int spriteArray[], bool isSelected, int langSelected, bool langVett[]); +void printDatabase4(char *database[], int currentEntry, int page, int spriteArray[], bool isSelected, int langSelected, bool langVett[]); +void printDB7(int sprite, int i, bool langVett[], bool adapt, bool overwrite, int langSelected, int nInjected); +void printDB6(int sprite, int i, bool langVett[], bool adapt, bool overwrite, int langSelected, int nInjected); +void printEditor(u8* mainbuf, int game, int currentEntry, int langCont); +void printPKEditor(u8* pkmn, int game, bool speedy, int additional1, int additional2, int additional3, int mode); +void printPKViewer(u8* mainbuf, u8* pkmn, bool isTeam, int game, int currentEntry, int menuEntry, int box, int mode, bool speedy, int additional); +void printPKBank(u8* bankbuf, u8* mainbuf, u8* pkmnbuf, int game, int currentEntry, int saveBox, int bankBox, bool isBufferized, bool isSeen); +void printMassInjector(int currentEntry); +void printElement(u8* pkmn, u16 n, int x, int y); +void printMoves(u8* pkmn, int currentEntry, int entryBottom, int page); +void printItems(u8* pkmn, int currentEntry, int page); +void printSettings(int box, bool speedy); +void infoViewer(u8* pkmn); \ No newline at end of file diff --git a/source/http.c b/source/http.c new file mode 100644 index 000000000..53bc5c950 --- /dev/null +++ b/source/http.c @@ -0,0 +1,122 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include +#include +#include +#include <3ds.h> +#include "http.h" +#include "graphic.h" +#include "certs/cybertrust.h" +#include "certs/digicert.h" + +Result downloadFile(char* url, char* path, bool install) { + httpcInit(0); + httpcContext context; + u32 statuscode = 0; + u32 contentsize = 0; + u8 *buf; + + if (httpcOpenContext(&context, HTTPC_METHOD_GET, url, 0)) { + infoDisp("Failed to open http context!"); + return -1; + } + + if (httpcAddRequestHeaderField(&context, "User-Agent", "EventAssistant")) { + infoDisp("Failed to add a request header field!"); + return -1; + } + + if (httpcSetSSLOpt(&context, 1 << 9)) { + infoDisp("Failed to set SSLOpt!"); + return -1; + } + + httpcAddTrustedRootCA(&context, cybertrust_cer, cybertrust_cer_len); + httpcAddTrustedRootCA(&context, digicert_cer, digicert_cer_len); + + if (httpcBeginRequest(&context)) { + infoDisp("Failed to begin a http request!"); + return -1; + } + + if (httpcGetResponseStatusCode(&context, &statuscode)) { + infoDisp("Failed to receive a status code!"); + httpcCloseContext(&context); + return -1; + } + + if (statuscode != 200) { + if (statuscode >= 300 && statuscode < 400) { + char newUrl[1024]; + if (httpcGetResponseHeader(&context, (char*)"Location", newUrl, 1024)) { + infoDisp("Redirection failed!"); + return -1; + } + httpcCloseContext(&context); + downloadFile(newUrl, path, install); + return -1; + } else { + infoDisp("Redirection failed!"); + httpcCloseContext(&context); + return -1; + } + } + + if (httpcGetDownloadSizeState(&context, NULL, &contentsize)) { + infoDisp("Failed to receive download size!"); + httpcCloseContext(&context); + return -1; + } + + buf = (u8*)malloc(contentsize); + if (buf == NULL) { + free(buf); + infoDisp("Failed to alloc memory!"); + return -1; + } + memset(buf, 0, contentsize); + + if (httpcDownloadData(&context, buf, contentsize, NULL)) { + free(buf); + infoDisp("Failed to download file!"); + httpcCloseContext(&context); + return -1; + } + + if (install) { + amInit(); + Handle handle; + AM_QueryAvailableExternalTitleDatabase(NULL); + AM_StartCiaInstall(MEDIATYPE_SD, &handle); + FSFILE_Write(handle, NULL, 0, buf, contentsize, 0); + AM_FinishCiaInstall(handle); + amExit(); + } + + remove(path); + FILE *fptr = fopen(path, "wb"); + fwrite(buf, 1, contentsize, fptr); + fclose(fptr); + free(buf); + + httpcCloseContext(&context); + httpcExit(); + return 0; +} \ No newline at end of file diff --git a/source/http.h b/source/http.h new file mode 100644 index 000000000..a785ba2c2 --- /dev/null +++ b/source/http.h @@ -0,0 +1,25 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#pragma once + +#include +#include <3ds.h> + +Result downloadFile(char* url, char* path, bool install); \ No newline at end of file diff --git a/source/main.c b/source/main.c new file mode 100644 index 000000000..e1a7a264b --- /dev/null +++ b/source/main.c @@ -0,0 +1,515 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include +#include +#include <3ds.h> +#include +#include +#include +#include "spi.h" +#include "http.h" +#include "util.h" +#include "database.h" +#include "editor.h" +#include "graphic.h" +#include "fx.h" +#include "bank.h" +#include "save.h" + +#define GAMES 15 + +char* path[] = { "/3ds/data/PKSM/additionalassets/3dsicons.png", + "/3ds/data/PKSM/additionalassets/alternative_icons_spritesheet.png", + "/3ds/data/PKSM/additionalassets/back_button.png", + "/3ds/data/PKSM/additionalassets/balls_spritesheet.png", + "/3ds/data/PKSM/additionalassets/dsicons.png", + "/3ds/data/PKSM/additionalassets/editor_bar.png", + "/3ds/data/PKSM/additionalassets/editor_bottom.png", + "/3ds/data/PKSM/additionalassets/pokemon_icons_spritesheet.png", + "/3ds/data/PKSM/additionalassets/types_sheet.png", + /* */, +}; +char* url[] = { "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/3dsicons.png", + "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/alternative_icons_spritesheet.png", + "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/back_button.png", + "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/balls_spritesheet.png", + "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/dsicons.png", + "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/editor_bar.png", + "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/editor_bottom.png", + "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/pokemon_icons_spritesheet.png", + "https://raw.githubusercontent.com/dsoldier/PKResources/master/additionalassets/types_sheet.png", + /* */, +}; + +void exitServices() { + FXElementsExit(); + GUIElementsExit(); + pxiDevExit(); + hidExit(); + srvExit(); + fsEnd(); + sdmcExit(); + aptExit(); + romfsExit(); + sftd_fini(); + sf2d_fini(); +} + +bool initServices() { + bool isDownloaded = false; + sf2d_init(); + sftd_init(); + sf2d_set_clear_color(BLACK); + sf2d_set_vblank_wait(1); + aptInit(); + sdmcInit(); + romfsInit(); + fsStart(); + srvInit(); + hidInit(); + pxiDevInit(); + GUIElementsInit(); + FXElementsInit(); + GUIGameElementsInit(); + + mkdir("sdmc:/3ds", 0777); + mkdir("sdmc:/3ds/data", 0777); + mkdir("sdmc:/3ds/data/PKSM", 0777); + mkdir("sdmc:/3ds/data/PKSM/builds", 0777); + mkdir("sdmc:/3ds/data/PKSM/bank", 0777); + mkdir("sdmc:/3ds/data/PKSM/backup", 0777); + mkdir("sdmc:/3ds/data/PKSM/additionalassets", 0777); + + char* str = (char*)malloc(30); + for (int i = 0; i < 10; i++) { + FILE *temp1 = fopen(path[i], "rt"); + if (temp1 == NULL) { + fclose(temp1); + snprintf(str, 30, "Downloading assets #%d...", i + 1); + freezeMsg(str); + downloadFile(url[i], path[i], false); + isDownloaded = true; + } else + fclose(temp1); + } + free(str); + + loadPersonal(); + + u32 defaultSize = BANKBOXMAX * 30 * PKMNLENGTH; + u32 size = 0; + u8* bankbuf, *defaultBank; + + FILE *bank = fopen("/3ds/data/PKSM/bank/bank.bin", "rt"); + if (bank == NULL) { + freezeMsg("Creating a default bank..."); + fclose(bank); + + size = defaultSize; + defaultBank = (u8*)malloc(size * sizeof(u8)); + memset(defaultBank, 0, size); + + FILE *new = fopen("/3ds/data/PKSM/bank/bank.bin", "wb"); + fwrite(defaultBank, 1, size, new); + fclose(new); + + free(defaultBank); + } + + freezeMsg("Backing up bank..."); + FILE *bak = fopen("/3ds/data/PKSM/bank/bank.bin", "rt"); + fseek(bak, 0, SEEK_END); + size = ftell(bak); + bankbuf = (u8*)malloc(size * sizeof(u8)); + + rewind(bak); + fread(bankbuf, size, 1, bak); + fclose(bak); + + FILE *new = fopen("/3ds/data/PKSM/bank/bank.bak", "wb"); + fwrite(bankbuf, 1, size, new); + fclose(new); + + free(bankbuf); + return isDownloaded; +} + +int main() { + if (initServices()) { + infoDisp("Restart the application!"); + exitServices(); + return 0; + } + + for (int i = 0; i < 10; i++) { + if(!checkFile(path[i])) { + infoDisp("You're missing a few assets!"); + exitServices(); + return -1; + } + } + + u8* mainbuf; + u64 mainSize = 0; + + int game = 0, GBO = 0, SBO = 0; + int currentEntry = 0; + + bool save = true; + Handle mainHandle; + FS_Archive saveArch; + + //X, Y, OR, AS, SUN, MOON + const u64 ids[] = {0x0004000000055D00, 0x0004000000055E00, 0x000400000011C400, 0x000400000011C500, 0x0004000000164800, 0x0004000000175E00}; + char *gamesList[] = {"X", "Y", "OR", "AS", "S", "M", "D", "P", "PL", "HG", "SS", "B", "W", "W2", "B2"}; + + while (aptMainLoop() && !(hidKeysDown() & KEY_A && (!(game == GAME_DIAMOND || game == GAME_PEARL || game == GAME_PLATINUM)))) { + hidScanInput(); + + if (hidKeysDown() & KEY_B) { + exitServices(); + return 0; + } + + if (hidKeysDown() & KEY_DLEFT) { + if (game == 0) game = GAMES - 1; + else if (game > 0) game--; + } + + if (hidKeysDown() & KEY_DRIGHT) { + if (game == GAMES - 1) game = 0; + else if (game < GAMES - 1) game++; + } + + gameSelectorMenu(game); + } + + GUIGameElementsExit(); + freezeMsg("Loading save..."); + + if (game == GAME_X || game == GAME_Y || game == GAME_OR || game == GAME_AS || game == GAME_SUN || game == GAME_MOON) { + if (!(openSaveArch(&saveArch, ids[game]))) { + infoDisp("Game not found!"); + exitServices(); + return -1; + } + + FSUSER_OpenFile(&mainHandle, saveArch, fsMakePath(PATH_ASCII, "/main"), FS_OPEN_READ | FS_OPEN_WRITE, 0); + FSFILE_GetSize(mainHandle, &mainSize); + + switch(game) { + case GAME_X : { if (mainSize != 415232) infoDisp("Incorrect size for this game!"); break; } + case GAME_Y : { if (mainSize != 415232) infoDisp("Incorrect size for this game!"); break; } + case GAME_OR : { if (mainSize != 483328) infoDisp("Incorrect size for this game!"); break; } + case GAME_AS : { if (mainSize != 483328) infoDisp("Incorrect size for this game!"); break; } + case GAME_SUN : { if (mainSize != 441856) infoDisp("Incorrect size for this game!"); break; } + case GAME_MOON : { if (mainSize != 441856) infoDisp("Incorrect size for this game!"); break; } + exitServices(); + return -1; + } + + mainbuf = malloc(mainSize); + FSFILE_Read(mainHandle, NULL, 0, mainbuf, mainSize); + } + + else if (game == GAME_DIAMOND || game == GAME_PEARL || game == GAME_PLATINUM || game == GAME_HG || game == GAME_SS || game == GAME_B1 || game == GAME_W1 || game == GAME_B2 || game == GAME_W2) { + FS_CardType t; + Result res = FSUSER_GetCardType(&t); + if (res != 0) { + infoDisp("No cartridge inserted!"); + exitServices(); + return -1; + } + u8 data[0x3B4]; + res = FSUSER_GetLegacyRomHeader(MEDIATYPE_GAME_CARD, 0LL, data); + + CardType cardType_; + res = SPIGetCardType(&cardType_, (*(data + 12) == 'I') ? 1 : 0); + + mainSize = SPIGetCapacity(cardType_); + + switch(game) { + case GAME_DIAMOND : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + case GAME_PEARL : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + case GAME_PLATINUM : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + case GAME_HG : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + case GAME_SS : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + case GAME_W1 : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + case GAME_B1 : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + case GAME_W2 : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + case GAME_B2 : { if (mainSize != 524288) infoDisp("Incorrect size for this game!"); break; } + exitServices(); + return -1; + } + mainbuf = malloc(mainSize); + + TWLstoreSaveFile(mainbuf, cardType_); + if (game == GAME_DIAMOND || game == GAME_PEARL || game == GAME_PLATINUM || game == GAME_HG || game == GAME_SS) { + GBO = 0x40000 * getActiveGBO(mainbuf, game); + SBO = 0x40000 * getActiveSBO(mainbuf, game); + } + } + + char *bakpath = (char*)malloc(80 * sizeof(char)); + + time_t unixTime = time(NULL); + struct tm* timeStruct = gmtime((const time_t *)&unixTime); + snprintf(bakpath, 80, "/3ds/data/PKSM/backup/main_%s_%i%i%i%02i%02i%02i", gamesList[game], timeStruct->tm_mday, timeStruct->tm_mon + 1, timeStruct->tm_year + 1900, timeStruct->tm_hour, timeStruct->tm_min, timeStruct->tm_sec); + + FILE *f = fopen(bakpath, "wb"); + fwrite(mainbuf, 1, mainSize, f); + fclose(f); + + free(bakpath); + + bool touchPressed = false; + + GUIElementsSpecify(game); + if (game < 6) { + while (aptMainLoop() && !(hidKeysDown() & KEY_START)) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_X) { + save = false; + break; + } + + if (hidKeysDown() & KEY_DUP) { + if (currentEntry == 0) currentEntry = 2; + else if (currentEntry > 0) currentEntry--; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (currentEntry == 2) currentEntry = 0; + else if (currentEntry < 2) currentEntry++; + } + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 60 && touch.px < 260) { + if (touch.py > 60 && touch.py < 100) { currentEntry = 0; touchPressed = true; } + if (touch.py > 100 && touch.py < 140) { currentEntry = 1; touchPressed = true; } + if (touch.py > 140 && touch.py < 180) { currentEntry = 2; touchPressed = true; } + } + + if (touch.px > 292 && touch.px < 314 && touch.py > 194 && touch.py < 216) + settingsMenu(mainbuf, game); + } + + if ((hidKeysDown() & KEY_A) || touchPressed) { + touchPressed = false; + switch (currentEntry) { + case 0 : { + if (game == GAME_X || game == GAME_Y || game == GAME_OR || game == GAME_AS) + eventDatabase6(mainbuf, game); + else if (game == GAME_SUN || game == GAME_MOON) + eventDatabase7(mainbuf, game); + break; + } + case 1 : { + int option = 0; + char* menu[4] = {"POKEMON EDITOR", "SAVE INFO", "EXTRA STORAGE", "MASS INJECTOR"}; + while (aptMainLoop()) { + hidScanInput(); + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) break; + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 60 && touch.px < 260) { + if (touch.py > 40 && touch.py < 80) { option = 0; touchPressed = true; } + if (touch.py > 80 && touch.py < 120) { option = 1; touchPressed = true; } + if (touch.py > 120 && touch.py < 160) { option = 2; touchPressed = true; } + if (touch.py > 160 && touch.py < 200) { option = 3; touchPressed = true; } + } + } + + if (hidKeysDown() & KEY_DUP) { + if (option == 0) option = 3; + else if (option > 0) option--; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (option == 3) option = 0; + else if (option < 3) option++; + } + + if ((hidKeysDown() & KEY_A) || touchPressed) { + touchPressed = false; + switch (option) { + case 0 : { + pokemonEditor(mainbuf, game); + break; + } + case 1 : { + saveFileEditor(mainbuf, game); + break; + } + case 2 : { + bank(mainbuf, game); + break; + } + case 3 : { + massInjector(mainbuf, game); + break; + } + } + } + menu4(option, menu, 4); + } + break; + } + case 2 : { + int option = 0; + char* menu[3] = {"(TBA)", "CREDITS", "UPDATE"}; + while (aptMainLoop() && !(hidKeysDown() & KEY_B)) { + hidScanInput(); + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 60 && touch.px < 260) { + if (touch.py > 60 && touch.py < 100) { currentEntry = 0; touchPressed = true; } + if (touch.py > 100 && touch.py < 140) { currentEntry = 1; touchPressed = true; } + if (touch.py > 140 && touch.py < 180) { currentEntry = 2; touchPressed = true; } + } + } + + if (hidKeysDown() & KEY_DUP) { + if (option == 0) option = 3; + else if (option > 0) option--; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (option == 3) option = 0; + else if (option < 3) option++; + } + + if ((hidKeysDown() & KEY_A) || touchPressed) { + touchPressed = false; + switch (option) { + case 0 : { + break; + } + case 1 : { + printCredits(); + break; + } + case 2 : { + if (!isHBL()) { + int temp = autoupdater(); + if (temp != 0) { + free(mainbuf); + exitServices(); + return 0; + } + } + break; + } + } + } + menu3(option, menu, 3); + } + + break; + } + } + } + + mainMenu(currentEntry); + } + } else { + while (aptMainLoop() && !(hidKeysDown() & KEY_START)) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_X) { + save = false; + break; + } + + if (hidKeysDown() & KEY_DUP) { + if (currentEntry == 0) currentEntry = 1; + else if (currentEntry > 0) currentEntry--; + } + + if (hidKeysDown() & KEY_DDOWN) { + if (currentEntry == 1) currentEntry = 0; + else if (currentEntry < 1) currentEntry++; + } + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 97 && touch.px < 222) { + if (touch.py > 66 && touch.py < 105) { currentEntry = 0; touchPressed = true; } + if (touch.py > 123 && touch.py < 164) { currentEntry = 1; touchPressed = true; } + } + } + + if ((hidKeysDown() & KEY_A) || touchPressed) { + touchPressed = false; + switch (currentEntry) { + case 0 : { + if (game == GAME_W1 || game == GAME_B1 || game == GAME_W2 || game == GAME_B2) + eventDatabase5(mainbuf, game); + if (game == GAME_DIAMOND || game == GAME_PEARL || game == GAME_PLATINUM || game == GAME_HG || game == GAME_SS) + eventDatabase4(mainbuf, game, GBO, SBO); + break; + } + case 1 : { + break; + } + } + } + + mainMenuDS(currentEntry); + } + } + + if (save) { + if (game == GAME_X || game == GAME_Y || game == GAME_OR || game == GAME_AS || game == GAME_SUN || game == GAME_MOON) + infoDisp("Save game."); + else if (game == GAME_DIAMOND || game == GAME_PEARL || game == GAME_PLATINUM || game == GAME_HG || game == GAME_SS || game == GAME_B1 || game == GAME_W1 || game == GAME_B2 || game == GAME_W2) + infoDisp("Save game. It will take time..."); + + if (game == GAME_X || game == GAME_Y || game == GAME_OR || game == GAME_AS || game == GAME_SUN || game == GAME_MOON || game == GAME_B1 || game == GAME_W1 || game == GAME_B2 || game == GAME_W2) + rewriteCHK(mainbuf, game); + else if (game == GAME_DIAMOND || game == GAME_PEARL || game == GAME_PLATINUM || game == GAME_HG || game == GAME_SS) + rewriteCHK4(mainbuf, game, GBO, SBO); + } + + if (game == GAME_X || game == GAME_Y || game == GAME_OR || game == GAME_AS || game == GAME_SUN || game == GAME_MOON) { + FSFILE_Write(mainHandle, NULL, 0, mainbuf, mainSize, FS_WRITE_FLUSH); + FSFILE_Close(mainHandle); + if (save) + FSUSER_ControlArchive(saveArch, ARCHIVE_ACTION_COMMIT_SAVE_DATA, NULL, 0, NULL, 0); + FSUSER_CloseArchive(saveArch); + } + else if ((game == GAME_DIAMOND || game == GAME_PEARL || game == GAME_PLATINUM || game == GAME_HG || game == GAME_SS || game == GAME_B1 || game == GAME_W1 || game == GAME_B2 || game == GAME_W2) && save) + TWLinjectSave(mainbuf, mainSize); + + free(mainbuf); + + if (!(save)) + infoDisp("Exit without saving."); + + exitServices(); + return 0; +} diff --git a/source/memecrypto.c b/source/memecrypto.c new file mode 100644 index 000000000..0ac87414f --- /dev/null +++ b/source/memecrypto.c @@ -0,0 +1,256 @@ +#include "memecrypto.h" + +#define PUBKEYDER_LEN 0x7E + +void sha256(u8 hash[], u8 data[], size_t len) { + SHA256_CTX ctx; + sha256_init(&ctx); + sha256_update(&ctx, data, len); + sha256_final(&ctx,hash); +} + +static unsigned char pubkeyder[] = { + 0x30, 0x7C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, + 0x00, 0x03, 0x6B, 0x00, 0x30, 0x68, 0x02, 0x61, 0x00, 0xB6, 0x1E, 0x19, 0x20, 0x91, 0xF9, 0x0A, + 0x8F, 0x76, 0xA6, 0xEA, 0xAA, 0x9A, 0x3C, 0xE5, 0x8C, 0x86, 0x3F, 0x39, 0xAE, 0x25, 0x3F, 0x03, + 0x78, 0x16, 0xF5, 0x97, 0x58, 0x54, 0xE0, 0x7A, 0x9A, 0x45, 0x66, 0x01, 0xE7, 0xC9, 0x4C, 0x29, + 0x75, 0x9F, 0xE1, 0x55, 0xC0, 0x64, 0xED, 0xDF, 0xA1, 0x11, 0x44, 0x3F, 0x81, 0xEF, 0x1A, 0x42, + 0x8C, 0xF6, 0xCD, 0x32, 0xF9, 0xDA, 0xC9, 0xD4, 0x8E, 0x94, 0xCF, 0xB3, 0xF6, 0x90, 0x12, 0x0E, + 0x8E, 0x6B, 0x91, 0x11, 0xAD, 0xDA, 0xF1, 0x1E, 0x7C, 0x96, 0x20, 0x8C, 0x37, 0xC0, 0x14, 0x3F, + 0xF2, 0xBF, 0x3D, 0x7E, 0x83, 0x11, 0x41, 0xA9, 0x73, 0x02, 0x03, 0x01, 0x00, 0x01 +}; + +void xor(unsigned char *in, unsigned char *b, int len) +{ + for (int i = 0; i < len; i++) + in[i] ^= b[i]; +} + +void memecrypto_aes_encrypt(unsigned char *buf, unsigned char * output, unsigned char *key) +{ + unsigned char temp[0x10]; + unsigned char temp2[0x10]; + unsigned char subkey[0x10]; + + unsigned char block[0x10]; + + for (int i = 0; i < 0x10; i++) + temp[i] = 0; + + for (int i = 0; i < MEME_LEN/0x10; i++) // CBC + { + memcpy(block, buf+i*0x10, 0x10); + xor(block, temp, 0x10); + AES128_ECB_encrypt(block, key, temp); + memcpy(output+i*0x10, temp, 0x10); + } + + // CMAC + xor(temp, output, 0x10); + for (int i = 0; i < 0x10; i += 2) + { + unsigned char b1 = temp[i]; + unsigned char b2 = temp[i+1]; + subkey[i] = (b1 << 1) | (b2 >> 7); + subkey[i+1] = (b2 << 1); + if (i + 2 < 0x10) + subkey[i+1] |= temp[i+2] >> 7; + } + if (temp[0] & 0x80) + subkey[0xF] ^= 0x87; + + for (int i = 0; i < 0x10; i++) + temp[i] = 0; + + for (int i = 0; i < MEME_LEN/0x10; i++) // PBC + { + memcpy(block, output + ((MEME_LEN/0x10 - i - 1) * 0x10), 0x10); + xor(block, subkey, 0x10); + AES128_ECB_encrypt(block, key, temp2); + xor(temp2, temp, 0x10); + memcpy(output + ((MEME_LEN/0x10 - i - 1) * 0x10), temp2, 0x10); + memcpy(temp, block, 0x10); + } +} + +void memecrypto_aes_decrypt(unsigned char *buf, unsigned char *output, unsigned char *key) +{ + unsigned char temp[0x10]; + unsigned char subkey[0x10]; + unsigned char block[0x10]; + + for (int i = 0; i < 0x10; i++) + temp[i] = 0; + + for (int i = 0; i < MEME_LEN/0x10; i++) // PBC + { + memcpy(block, buf + ((MEME_LEN/0x10 - i - 1) * 0x10), 0x10); + xor(block, temp, 0x10); + AES128_ECB_decrypt(block, key, temp); + memcpy(output + ((MEME_LEN/0x10 - i - 1) * 0x10), temp, 0x10); + } + + memcpy(temp, output + ((MEME_LEN/0x10 - 1) * 0x10), 0x10); + + // CMAC + xor(temp, output, 0x10); + for (int i = 0; i < 0x10; i += 2) + { + unsigned char b1 = temp[i]; + unsigned char b2 = temp[i+1]; + subkey[i] = (b1 << 1) | (b2 >> 7); + subkey[i+1] = (b2 << 1); + if (i + 2 < 0x10) + subkey[i+1] |= temp[i+2] >> 7; + } + if (temp[0] & 0x80) + subkey[0xF] ^= 0x87; + + for (int i = 0; i < MEME_LEN/0x10; i++) + { + xor(output + i * 0x10, subkey, 0x10); + } + + for (int i = 0; i < 0x10; i++) + temp[i] = 0; + + for (int i = 0; i < MEME_LEN/0x10; i++) // CBC + { + memcpy(block, output+i*0x10, 0x10); + AES128_ECB_decrypt(block, key, output + i*0x10); + xor(output + i*0x10, temp, 0x10); + memcpy(temp, block, 0x10); + } +} + +int memecrypto_sign(unsigned char *input, unsigned char *output, int len) +{ + if (len < MEME_LEN) + return 0; + + unsigned char memebuf[MEME_LEN]; + + unsigned char hash[0x14]; + sha1_ctx sha1[1]; + + memcpy(output, input, len - MEME_LEN); + + sha1_begin(sha1); + sha1_hash(input, len - 8, sha1); + sha1_end(hash, sha1); + memcpy(input + len - 8, hash, 8); // Update SHA1 hash + + sha1_begin(sha1); + sha1_hash(pubkeyder, PUBKEYDER_LEN, sha1); + if (len > MEME_LEN) + sha1_hash(input, len - MEME_LEN, sha1); + sha1_end(hash, sha1); // Hash is now aes key + + memcpy(memebuf, input + (len - MEME_LEN), MEME_LEN); + memecrypto_aes_encrypt(memebuf, memebuf, hash); + memebuf[0x0] &= 0x7F; + rsa_decrypt(memebuf, output + (len - MEME_LEN)); + + return 1; +} + +int memecrypto_verify(unsigned char *input, unsigned char *output, int len) +{ + if (len < MEME_LEN) + return 0; + + unsigned char memebuf_1[MEME_LEN]; + unsigned char memebuf_2[MEME_LEN]; + unsigned char hash[0x14]; + sha1_ctx sha1[1]; + + memcpy(output, input, len - MEME_LEN); + + sha1_begin(sha1); + sha1_hash(pubkeyder, PUBKEYDER_LEN, sha1); + if (len > MEME_LEN) + sha1_hash(input, len - MEME_LEN, sha1); + sha1_end(hash, sha1); // Hash is now aes key + + rsa_encrypt(input + (len - MEME_LEN), memebuf_1); + memcpy(memebuf_2, memebuf_1, MEME_LEN); + memebuf_2[0] |= 0x80; + + memecrypto_aes_decrypt(memebuf_1, memebuf_1, hash); + memecrypto_aes_decrypt(memebuf_2, memebuf_2, hash); + + memcpy(output + (len - MEME_LEN), memebuf_1, MEME_LEN); + sha1_begin(sha1); + sha1_hash(output, len - 8, sha1); + sha1_end(hash, sha1); + + if (!memcmp(hash, output + len - 8, 8)) + return 1; + + memcpy(output + (len - MEME_LEN), memebuf_2, MEME_LEN); + sha1_begin(sha1); + sha1_hash(output, len - 8, sha1); + sha1_end(hash, sha1); + + if (!memcmp(hash, output + len - 8, 8)) + return 1; + + return 0; +} + +void reverseCrypt(u8 input[], u8 output[]) { + u8 enc[0x60]; + memcpy(enc, &input[0x20], 0x60); + + u8 keybuf[PUBKEYDER_LEN + 0x20]; + memcpy(keybuf, pubkeyder, PUBKEYDER_LEN); + memcpy(&keybuf[PUBKEYDER_LEN], input, 0x20); + + u8 hash[0x14]; + u8 key[0x10]; + sha1(hash, keybuf, 0x20 + PUBKEYDER_LEN); + memcpy(key, hash, 0x10); + + u8 RSA[RSA_BYTES]; + rsa_encrypt(enc, RSA); + u8 dec[0x80]; + memecrypto_aes_decrypt(RSA, dec, key); + + u8 temp1[0x8]; + u8 temp2[0x8]; + sha1(hash, dec, 0x80); + memcpy(temp1, hash, 0x8); + memcpy(temp2, &dec[0x58], 0x8); + if (!memcmp(temp1, temp2, 0x8)) { + memcpy(output, dec, 0x80); + return; + } + + RSA[0] |= 0x80; + memecrypto_aes_decrypt(RSA, dec, key); + sha1(hash, dec, 0x80); + memcpy(temp1, hash, 0x8); + memcpy(temp2, &dec[0x58], 0x8); + if (!memcmp(temp1, temp2, 0x8)) { + memcpy(output, dec, 0x80); + return; + } +} + +void resign(u8 *mainbuf) { + u8 CurSig[0x80]; + memcpy(CurSig, &mainbuf[0x6BB00], 0x80); + + u8 ChecksumTable[0x140]; + memcpy(ChecksumTable, &mainbuf[0x6BC00], 0x140); + + u8 Hash[SHA256_BLOCK_SIZE]; + sha256(Hash, ChecksumTable, 0x140); + + u8 DecSig[0x80]; + reverseCrypt(CurSig, DecSig); + memcpy(DecSig, Hash, SHA256_BLOCK_SIZE); + + int k = memecrypto_sign(DecSig, CurSig, 0x80); + memcpy(&mainbuf[0x6BB00], CurSig, 0x80); +} \ No newline at end of file diff --git a/source/memecrypto.h b/source/memecrypto.h new file mode 100644 index 000000000..bbc334404 --- /dev/null +++ b/source/memecrypto.h @@ -0,0 +1,21 @@ +#ifndef _MEMECRYPTO_H_ +#define _MEMECRYPTO_H_ + +#include +#include <3ds.h> +#include "aes.h" +#include "rsa.h" +#include "sha1.h" +#include "sha256.h" + +#define MEME_LEN 0x60 + +void memecrypto_aes_encrypt(unsigned char *buf, unsigned char *output, unsigned char *key); +void memecrypto_aes_decrypt(unsigned char *buf, unsigned char *output, unsigned char *key); + +int memecrypto_sign(unsigned char *input, unsigned char *output, int len); +int memecrypto_verify(unsigned char *input, unsigned char *output, int len); + +void resign(u8 *mainbuf); + +#endif //_MEMECRYPTO_H_ \ No newline at end of file diff --git a/source/mini-gmp.c b/source/mini-gmp.c new file mode 100644 index 000000000..7300614dd --- /dev/null +++ b/source/mini-gmp.c @@ -0,0 +1,4374 @@ +/* mini-gmp, a minimalistic implementation of a GNU GMP subset. + + Contributed to the GNU project by Niels Möller + +Copyright 1991-1997, 1999-2015 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + +or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + +or both in parallel, as here. + +The GNU MP Library 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 copies of the GNU General Public License and the +GNU Lesser General Public License along with the GNU MP Library. If not, +see https://www.gnu.org/licenses/. */ + +/* NOTE: All functions in this file which are not declared in + mini-gmp.h are internal, and are not intended to be compatible + neither with GMP nor with future versions of mini-gmp. */ + +/* Much of the material copied from GMP files, including: gmp-impl.h, + longlong.h, mpn/generic/add_n.c, mpn/generic/addmul_1.c, + mpn/generic/lshift.c, mpn/generic/mul_1.c, + mpn/generic/mul_basecase.c, mpn/generic/rshift.c, + mpn/generic/sbpi1_div_qr.c, mpn/generic/sub_n.c, + mpn/generic/submul_1.c. */ + +#include +#include +#include +#include +#include +#include + +#include "mini-gmp.h" + + +/* Macros */ +#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT) + +#define GMP_LIMB_MAX (~ (mp_limb_t) 0) +#define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1)) + +#define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2)) +#define GMP_LLIMB_MASK (GMP_HLIMB_BIT - 1) + +#define GMP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT) +#define GMP_ULONG_HIGHBIT ((unsigned long) 1 << (GMP_ULONG_BITS - 1)) + +#define GMP_ABS(x) ((x) >= 0 ? (x) : -(x)) +#define GMP_NEG_CAST(T,x) (-((T)((x) + 1) - 1)) + +#define GMP_MIN(a, b) ((a) < (b) ? (a) : (b)) +#define GMP_MAX(a, b) ((a) > (b) ? (a) : (b)) + +#define gmp_assert_nocarry(x) do { \ + mp_limb_t __cy = x; \ + assert (__cy == 0); \ + } while (0) + +#define gmp_clz(count, x) do { \ + mp_limb_t __clz_x = (x); \ + unsigned __clz_c; \ + for (__clz_c = 0; \ + (__clz_x & ((mp_limb_t) 0xff << (GMP_LIMB_BITS - 8))) == 0; \ + __clz_c += 8) \ + __clz_x <<= 8; \ + for (; (__clz_x & GMP_LIMB_HIGHBIT) == 0; __clz_c++) \ + __clz_x <<= 1; \ + (count) = __clz_c; \ + } while (0) + +#define gmp_ctz(count, x) do { \ + mp_limb_t __ctz_x = (x); \ + unsigned __ctz_c = 0; \ + gmp_clz (__ctz_c, __ctz_x & - __ctz_x); \ + (count) = GMP_LIMB_BITS - 1 - __ctz_c; \ + } while (0) + +#define gmp_add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do { \ + mp_limb_t __x; \ + __x = (al) + (bl); \ + (sh) = (ah) + (bh) + (__x < (al)); \ + (sl) = __x; \ + } while (0) + +#define gmp_sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ + mp_limb_t __x; \ + __x = (al) - (bl); \ + (sh) = (ah) - (bh) - ((al) < (bl)); \ + (sl) = __x; \ + } while (0) + +#define gmp_umul_ppmm(w1, w0, u, v) \ + do { \ + mp_limb_t __x0, __x1, __x2, __x3; \ + unsigned __ul, __vl, __uh, __vh; \ + mp_limb_t __u = (u), __v = (v); \ + \ + __ul = __u & GMP_LLIMB_MASK; \ + __uh = __u >> (GMP_LIMB_BITS / 2); \ + __vl = __v & GMP_LLIMB_MASK; \ + __vh = __v >> (GMP_LIMB_BITS / 2); \ + \ + __x0 = (mp_limb_t) __ul * __vl; \ + __x1 = (mp_limb_t) __ul * __vh; \ + __x2 = (mp_limb_t) __uh * __vl; \ + __x3 = (mp_limb_t) __uh * __vh; \ + \ + __x1 += __x0 >> (GMP_LIMB_BITS / 2);/* this can't give carry */ \ + __x1 += __x2; /* but this indeed can */ \ + if (__x1 < __x2) /* did we get it? */ \ + __x3 += GMP_HLIMB_BIT; /* yes, add it in the proper pos. */ \ + \ + (w1) = __x3 + (__x1 >> (GMP_LIMB_BITS / 2)); \ + (w0) = (__x1 << (GMP_LIMB_BITS / 2)) + (__x0 & GMP_LLIMB_MASK); \ + } while (0) + +#define gmp_udiv_qrnnd_preinv(q, r, nh, nl, d, di) \ + do { \ + mp_limb_t _qh, _ql, _r, _mask; \ + gmp_umul_ppmm (_qh, _ql, (nh), (di)); \ + gmp_add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \ + _r = (nl) - _qh * (d); \ + _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \ + _qh += _mask; \ + _r += _mask & (d); \ + if (_r >= (d)) \ + { \ + _r -= (d); \ + _qh++; \ + } \ + \ + (r) = _r; \ + (q) = _qh; \ + } while (0) + +#define gmp_udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv) \ + do { \ + mp_limb_t _q0, _t1, _t0, _mask; \ + gmp_umul_ppmm ((q), _q0, (n2), (dinv)); \ + gmp_add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1)); \ + \ + /* Compute the two most significant limbs of n - q'd */ \ + (r1) = (n1) - (d1) * (q); \ + gmp_sub_ddmmss ((r1), (r0), (r1), (n0), (d1), (d0)); \ + gmp_umul_ppmm (_t1, _t0, (d0), (q)); \ + gmp_sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0); \ + (q)++; \ + \ + /* Conditionally adjust q and the remainders */ \ + _mask = - (mp_limb_t) ((r1) >= _q0); \ + (q) += _mask; \ + gmp_add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \ + if ((r1) >= (d1)) \ + { \ + if ((r1) > (d1) || (r0) >= (d0)) \ + { \ + (q)++; \ + gmp_sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \ + } \ + } \ + } while (0) + +/* Swap macros. */ +#define MP_LIMB_T_SWAP(x, y) \ + do { \ + mp_limb_t __mp_limb_t_swap__tmp = (x); \ + (x) = (y); \ + (y) = __mp_limb_t_swap__tmp; \ + } while (0) +#define MP_SIZE_T_SWAP(x, y) \ + do { \ + mp_size_t __mp_size_t_swap__tmp = (x); \ + (x) = (y); \ + (y) = __mp_size_t_swap__tmp; \ + } while (0) +#define MP_BITCNT_T_SWAP(x,y) \ + do { \ + mp_bitcnt_t __mp_bitcnt_t_swap__tmp = (x); \ + (x) = (y); \ + (y) = __mp_bitcnt_t_swap__tmp; \ + } while (0) +#define MP_PTR_SWAP(x, y) \ + do { \ + mp_ptr __mp_ptr_swap__tmp = (x); \ + (x) = (y); \ + (y) = __mp_ptr_swap__tmp; \ + } while (0) +#define MP_SRCPTR_SWAP(x, y) \ + do { \ + mp_srcptr __mp_srcptr_swap__tmp = (x); \ + (x) = (y); \ + (y) = __mp_srcptr_swap__tmp; \ + } while (0) + +#define MPN_PTR_SWAP(xp,xs, yp,ys) \ + do { \ + MP_PTR_SWAP (xp, yp); \ + MP_SIZE_T_SWAP (xs, ys); \ + } while(0) +#define MPN_SRCPTR_SWAP(xp,xs, yp,ys) \ + do { \ + MP_SRCPTR_SWAP (xp, yp); \ + MP_SIZE_T_SWAP (xs, ys); \ + } while(0) + +#define MPZ_PTR_SWAP(x, y) \ + do { \ + mpz_ptr __mpz_ptr_swap__tmp = (x); \ + (x) = (y); \ + (y) = __mpz_ptr_swap__tmp; \ + } while (0) +#define MPZ_SRCPTR_SWAP(x, y) \ + do { \ + mpz_srcptr __mpz_srcptr_swap__tmp = (x); \ + (x) = (y); \ + (y) = __mpz_srcptr_swap__tmp; \ + } while (0) + +const int mp_bits_per_limb = GMP_LIMB_BITS; + + +/* Memory allocation and other helper functions. */ +static void +gmp_die (const char *msg) +{ + fprintf (stderr, "%s\n", msg); + abort(); +} + +static void * +gmp_default_alloc (size_t size) +{ + void *p; + + assert (size > 0); + + p = malloc (size); + if (!p) + gmp_die("gmp_default_alloc: Virtual memory exhausted."); + + return p; +} + +static void * +gmp_default_realloc (void *old, size_t old_size, size_t new_size) +{ + void * p; + + p = realloc (old, new_size); + + if (!p) + gmp_die("gmp_default_realloc: Virtual memory exhausted."); + + return p; +} + +static void +gmp_default_free (void *p, size_t size) +{ + free (p); +} + +static void * (*gmp_allocate_func) (size_t) = gmp_default_alloc; +static void * (*gmp_reallocate_func) (void *, size_t, size_t) = gmp_default_realloc; +static void (*gmp_free_func) (void *, size_t) = gmp_default_free; + +void +mp_get_memory_functions (void *(**alloc_func) (size_t), + void *(**realloc_func) (void *, size_t, size_t), + void (**free_func) (void *, size_t)) +{ + if (alloc_func) + *alloc_func = gmp_allocate_func; + + if (realloc_func) + *realloc_func = gmp_reallocate_func; + + if (free_func) + *free_func = gmp_free_func; +} + +void +mp_set_memory_functions (void *(*alloc_func) (size_t), + void *(*realloc_func) (void *, size_t, size_t), + void (*free_func) (void *, size_t)) +{ + if (!alloc_func) + alloc_func = gmp_default_alloc; + if (!realloc_func) + realloc_func = gmp_default_realloc; + if (!free_func) + free_func = gmp_default_free; + + gmp_allocate_func = alloc_func; + gmp_reallocate_func = realloc_func; + gmp_free_func = free_func; +} + +#define gmp_xalloc(size) ((*gmp_allocate_func)((size))) +#define gmp_free(p) ((*gmp_free_func) ((p), 0)) + +static mp_ptr +gmp_xalloc_limbs (mp_size_t size) +{ + return (mp_ptr) gmp_xalloc (size * sizeof (mp_limb_t)); +} + +static mp_ptr +gmp_xrealloc_limbs (mp_ptr old, mp_size_t size) +{ + assert (size > 0); + return (mp_ptr) (*gmp_reallocate_func) (old, 0, size * sizeof (mp_limb_t)); +} + + +/* MPN interface */ + +void +mpn_copyi (mp_ptr d, mp_srcptr s, mp_size_t n) +{ + mp_size_t i; + for (i = 0; i < n; i++) + d[i] = s[i]; +} + +void +mpn_copyd (mp_ptr d, mp_srcptr s, mp_size_t n) +{ + while (--n >= 0) + d[n] = s[n]; +} + +int +mpn_cmp (mp_srcptr ap, mp_srcptr bp, mp_size_t n) +{ + while (--n >= 0) + { + if (ap[n] != bp[n]) + return ap[n] > bp[n] ? 1 : -1; + } + return 0; +} + +static int +mpn_cmp4 (mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn) +{ + if (an != bn) + return an < bn ? -1 : 1; + else + return mpn_cmp (ap, bp, an); +} + +static mp_size_t +mpn_normalized_size (mp_srcptr xp, mp_size_t n) +{ + while (n > 0 && xp[n-1] == 0) + --n; + return n; +} + +int +mpn_zero_p(mp_srcptr rp, mp_size_t n) +{ + return mpn_normalized_size (rp, n) == 0; +} + +void +mpn_zero (mp_ptr rp, mp_size_t n) +{ + while (--n >= 0) + rp[n] = 0; +} + +mp_limb_t +mpn_add_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b) +{ + mp_size_t i; + + assert (n > 0); + i = 0; + do + { + mp_limb_t r = ap[i] + b; + /* Carry out */ + b = (r < b); + rp[i] = r; + } + while (++i < n); + + return b; +} + +mp_limb_t +mpn_add_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n) +{ + mp_size_t i; + mp_limb_t cy; + + for (i = 0, cy = 0; i < n; i++) + { + mp_limb_t a, b, r; + a = ap[i]; b = bp[i]; + r = a + cy; + cy = (r < cy); + r += b; + cy += (r < b); + rp[i] = r; + } + return cy; +} + +mp_limb_t +mpn_add (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn) +{ + mp_limb_t cy; + + assert (an >= bn); + + cy = mpn_add_n (rp, ap, bp, bn); + if (an > bn) + cy = mpn_add_1 (rp + bn, ap + bn, an - bn, cy); + return cy; +} + +mp_limb_t +mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b) +{ + mp_size_t i; + + assert (n > 0); + + i = 0; + do + { + mp_limb_t a = ap[i]; + /* Carry out */ + mp_limb_t cy = a < b;; + rp[i] = a - b; + b = cy; + } + while (++i < n); + + return b; +} + +mp_limb_t +mpn_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n) +{ + mp_size_t i; + mp_limb_t cy; + + for (i = 0, cy = 0; i < n; i++) + { + mp_limb_t a, b; + a = ap[i]; b = bp[i]; + b += cy; + cy = (b < cy); + cy += (a < b); + rp[i] = a - b; + } + return cy; +} + +mp_limb_t +mpn_sub (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn) +{ + mp_limb_t cy; + + assert (an >= bn); + + cy = mpn_sub_n (rp, ap, bp, bn); + if (an > bn) + cy = mpn_sub_1 (rp + bn, ap + bn, an - bn, cy); + return cy; +} + +mp_limb_t +mpn_mul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl) +{ + mp_limb_t ul, cl, hpl, lpl; + + assert (n >= 1); + + cl = 0; + do + { + ul = *up++; + gmp_umul_ppmm (hpl, lpl, ul, vl); + + lpl += cl; + cl = (lpl < cl) + hpl; + + *rp++ = lpl; + } + while (--n != 0); + + return cl; +} + +mp_limb_t +mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl) +{ + mp_limb_t ul, cl, hpl, lpl, rl; + + assert (n >= 1); + + cl = 0; + do + { + ul = *up++; + gmp_umul_ppmm (hpl, lpl, ul, vl); + + lpl += cl; + cl = (lpl < cl) + hpl; + + rl = *rp; + lpl = rl + lpl; + cl += lpl < rl; + *rp++ = lpl; + } + while (--n != 0); + + return cl; +} + +mp_limb_t +mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl) +{ + mp_limb_t ul, cl, hpl, lpl, rl; + + assert (n >= 1); + + cl = 0; + do + { + ul = *up++; + gmp_umul_ppmm (hpl, lpl, ul, vl); + + lpl += cl; + cl = (lpl < cl) + hpl; + + rl = *rp; + lpl = rl - lpl; + cl += lpl > rl; + *rp++ = lpl; + } + while (--n != 0); + + return cl; +} + +mp_limb_t +mpn_mul (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn) +{ + assert (un >= vn); + assert (vn >= 1); + + /* We first multiply by the low order limb. This result can be + stored, not added, to rp. We also avoid a loop for zeroing this + way. */ + + rp[un] = mpn_mul_1 (rp, up, un, vp[0]); + + /* Now accumulate the product of up[] and the next higher limb from + vp[]. */ + + while (--vn >= 1) + { + rp += 1, vp += 1; + rp[un] = mpn_addmul_1 (rp, up, un, vp[0]); + } + return rp[un]; +} + +void +mpn_mul_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n) +{ + mpn_mul (rp, ap, n, bp, n); +} + +void +mpn_sqr (mp_ptr rp, mp_srcptr ap, mp_size_t n) +{ + mpn_mul (rp, ap, n, ap, n); +} + +mp_limb_t +mpn_lshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt) +{ + mp_limb_t high_limb, low_limb; + unsigned int tnc; + mp_limb_t retval; + + assert (n >= 1); + assert (cnt >= 1); + assert (cnt < GMP_LIMB_BITS); + + up += n; + rp += n; + + tnc = GMP_LIMB_BITS - cnt; + low_limb = *--up; + retval = low_limb >> tnc; + high_limb = (low_limb << cnt); + + while (--n != 0) + { + low_limb = *--up; + *--rp = high_limb | (low_limb >> tnc); + high_limb = (low_limb << cnt); + } + *--rp = high_limb; + + return retval; +} + +mp_limb_t +mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt) +{ + mp_limb_t high_limb, low_limb; + unsigned int tnc; + mp_limb_t retval; + + assert (n >= 1); + assert (cnt >= 1); + assert (cnt < GMP_LIMB_BITS); + + tnc = GMP_LIMB_BITS - cnt; + high_limb = *up++; + retval = (high_limb << tnc); + low_limb = high_limb >> cnt; + + while (--n != 0) + { + high_limb = *up++; + *rp++ = low_limb | (high_limb << tnc); + low_limb = high_limb >> cnt; + } + *rp = low_limb; + + return retval; +} + +static mp_bitcnt_t +mpn_common_scan (mp_limb_t limb, mp_size_t i, mp_srcptr up, mp_size_t un, + mp_limb_t ux) +{ + unsigned cnt; + + assert (ux == 0 || ux == GMP_LIMB_MAX); + assert (0 <= i && i <= un ); + + while (limb == 0) + { + i++; + if (i == un) + return (ux == 0 ? ~(mp_bitcnt_t) 0 : un * GMP_LIMB_BITS); + limb = ux ^ up[i]; + } + gmp_ctz (cnt, limb); + return (mp_bitcnt_t) i * GMP_LIMB_BITS + cnt; +} + +mp_bitcnt_t +mpn_scan1 (mp_srcptr ptr, mp_bitcnt_t bit) +{ + mp_size_t i; + i = bit / GMP_LIMB_BITS; + + return mpn_common_scan ( ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)), + i, ptr, i, 0); +} + +mp_bitcnt_t +mpn_scan0 (mp_srcptr ptr, mp_bitcnt_t bit) +{ + mp_size_t i; + i = bit / GMP_LIMB_BITS; + + return mpn_common_scan (~ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)), + i, ptr, i, GMP_LIMB_MAX); +} + + +/* MPN division interface. */ +mp_limb_t +mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0) +{ + mp_limb_t r, p, m; + unsigned ul, uh; + unsigned ql, qh; + + /* First, do a 2/1 inverse. */ + /* The inverse m is defined as floor( (B^2 - 1 - u1)/u1 ), so that 0 < + * B^2 - (B + m) u1 <= u1 */ + assert (u1 >= GMP_LIMB_HIGHBIT); + + ul = u1 & GMP_LLIMB_MASK; + uh = u1 >> (GMP_LIMB_BITS / 2); + + qh = ~u1 / uh; + r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK; + + p = (mp_limb_t) qh * ul; + /* Adjustment steps taken from udiv_qrnnd_c */ + if (r < p) + { + qh--; + r += u1; + if (r >= u1) /* i.e. we didn't get carry when adding to r */ + if (r < p) + { + qh--; + r += u1; + } + } + r -= p; + + /* Do a 3/2 division (with half limb size) */ + p = (r >> (GMP_LIMB_BITS / 2)) * qh + r; + ql = (p >> (GMP_LIMB_BITS / 2)) + 1; + + /* By the 3/2 method, we don't need the high half limb. */ + r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1; + + if (r >= (p << (GMP_LIMB_BITS / 2))) + { + ql--; + r += u1; + } + m = ((mp_limb_t) qh << (GMP_LIMB_BITS / 2)) + ql; + if (r >= u1) + { + m++; + r -= u1; + } + + if (u0 > 0) + { + mp_limb_t th, tl; + r = ~r; + r += u0; + if (r < u0) + { + m--; + if (r >= u1) + { + m--; + r -= u1; + } + r -= u1; + } + gmp_umul_ppmm (th, tl, u0, m); + r += th; + if (r < th) + { + m--; + m -= ((r > u1) | ((r == u1) & (tl > u0))); + } + } + + return m; +} + +struct gmp_div_inverse +{ + /* Normalization shift count. */ + unsigned shift; + /* Normalized divisor (d0 unused for mpn_div_qr_1) */ + mp_limb_t d1, d0; + /* Inverse, for 2/1 or 3/2. */ + mp_limb_t di; +}; + +static void +mpn_div_qr_1_invert (struct gmp_div_inverse *inv, mp_limb_t d) +{ + unsigned shift; + + assert (d > 0); + gmp_clz (shift, d); + inv->shift = shift; + inv->d1 = d << shift; + inv->di = mpn_invert_limb (inv->d1); +} + +static void +mpn_div_qr_2_invert (struct gmp_div_inverse *inv, + mp_limb_t d1, mp_limb_t d0) +{ + unsigned shift; + + assert (d1 > 0); + gmp_clz (shift, d1); + inv->shift = shift; + if (shift > 0) + { + d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift)); + d0 <<= shift; + } + inv->d1 = d1; + inv->d0 = d0; + inv->di = mpn_invert_3by2 (d1, d0); +} + +static void +mpn_div_qr_invert (struct gmp_div_inverse *inv, + mp_srcptr dp, mp_size_t dn) +{ + assert (dn > 0); + + if (dn == 1) + mpn_div_qr_1_invert (inv, dp[0]); + else if (dn == 2) + mpn_div_qr_2_invert (inv, dp[1], dp[0]); + else + { + unsigned shift; + mp_limb_t d1, d0; + + d1 = dp[dn-1]; + d0 = dp[dn-2]; + assert (d1 > 0); + gmp_clz (shift, d1); + inv->shift = shift; + if (shift > 0) + { + d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift)); + d0 = (d0 << shift) | (dp[dn-3] >> (GMP_LIMB_BITS - shift)); + } + inv->d1 = d1; + inv->d0 = d0; + inv->di = mpn_invert_3by2 (d1, d0); + } +} + +/* Not matching current public gmp interface, rather corresponding to + the sbpi1_div_* functions. */ +static mp_limb_t +mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn, + const struct gmp_div_inverse *inv) +{ + mp_limb_t d, di; + mp_limb_t r; + mp_ptr tp = NULL; + + if (inv->shift > 0) + { + tp = gmp_xalloc_limbs (nn); + r = mpn_lshift (tp, np, nn, inv->shift); + np = tp; + } + else + r = 0; + + d = inv->d1; + di = inv->di; + while (--nn >= 0) + { + mp_limb_t q; + + gmp_udiv_qrnnd_preinv (q, r, r, np[nn], d, di); + if (qp) + qp[nn] = q; + } + if (inv->shift > 0) + gmp_free (tp); + + return r >> inv->shift; +} + +static mp_limb_t +mpn_div_qr_1 (mp_ptr qp, mp_srcptr np, mp_size_t nn, mp_limb_t d) +{ + assert (d > 0); + + /* Special case for powers of two. */ + if ((d & (d-1)) == 0) + { + mp_limb_t r = np[0] & (d-1); + if (qp) + { + if (d <= 1) + mpn_copyi (qp, np, nn); + else + { + unsigned shift; + gmp_ctz (shift, d); + mpn_rshift (qp, np, nn, shift); + } + } + return r; + } + else + { + struct gmp_div_inverse inv; + mpn_div_qr_1_invert (&inv, d); + return mpn_div_qr_1_preinv (qp, np, nn, &inv); + } +} + +static void +mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn, + const struct gmp_div_inverse *inv) +{ + unsigned shift; + mp_size_t i; + mp_limb_t d1, d0, di, r1, r0; + mp_ptr tp; + + assert (nn >= 2); + shift = inv->shift; + d1 = inv->d1; + d0 = inv->d0; + di = inv->di; + + if (shift > 0) + { + tp = gmp_xalloc_limbs (nn); + r1 = mpn_lshift (tp, np, nn, shift); + np = tp; + } + else + r1 = 0; + + r0 = np[nn - 1]; + + i = nn - 2; + do + { + mp_limb_t n0, q; + n0 = np[i]; + gmp_udiv_qr_3by2 (q, r1, r0, r1, r0, n0, d1, d0, di); + + if (qp) + qp[i] = q; + } + while (--i >= 0); + + if (shift > 0) + { + assert ((r0 << (GMP_LIMB_BITS - shift)) == 0); + r0 = (r0 >> shift) | (r1 << (GMP_LIMB_BITS - shift)); + r1 >>= shift; + + gmp_free (tp); + } + + rp[1] = r1; + rp[0] = r0; +} + +#if 0 +static void +mpn_div_qr_2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn, + mp_limb_t d1, mp_limb_t d0) +{ + struct gmp_div_inverse inv; + assert (nn >= 2); + + mpn_div_qr_2_invert (&inv, d1, d0); + mpn_div_qr_2_preinv (qp, rp, np, nn, &inv); +} +#endif + +static void +mpn_div_qr_pi1 (mp_ptr qp, + mp_ptr np, mp_size_t nn, mp_limb_t n1, + mp_srcptr dp, mp_size_t dn, + mp_limb_t dinv) +{ + mp_size_t i; + + mp_limb_t d1, d0; + mp_limb_t cy, cy1; + mp_limb_t q; + + assert (dn > 2); + assert (nn >= dn); + + d1 = dp[dn - 1]; + d0 = dp[dn - 2]; + + assert ((d1 & GMP_LIMB_HIGHBIT) != 0); + /* Iteration variable is the index of the q limb. + * + * We divide + * by + */ + + i = nn - dn; + do + { + mp_limb_t n0 = np[dn-1+i]; + + if (n1 == d1 && n0 == d0) + { + q = GMP_LIMB_MAX; + mpn_submul_1 (np+i, dp, dn, q); + n1 = np[dn-1+i]; /* update n1, last loop's value will now be invalid */ + } + else + { + gmp_udiv_qr_3by2 (q, n1, n0, n1, n0, np[dn-2+i], d1, d0, dinv); + + cy = mpn_submul_1 (np + i, dp, dn-2, q); + + cy1 = n0 < cy; + n0 = n0 - cy; + cy = n1 < cy1; + n1 = n1 - cy1; + np[dn-2+i] = n0; + + if (cy != 0) + { + n1 += d1 + mpn_add_n (np + i, np + i, dp, dn - 1); + q--; + } + } + + if (qp) + qp[i] = q; + } + while (--i >= 0); + + np[dn - 1] = n1; +} + +static void +mpn_div_qr_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + const struct gmp_div_inverse *inv) +{ + assert (dn > 0); + assert (nn >= dn); + + if (dn == 1) + np[0] = mpn_div_qr_1_preinv (qp, np, nn, inv); + else if (dn == 2) + mpn_div_qr_2_preinv (qp, np, np, nn, inv); + else + { + mp_limb_t nh; + unsigned shift; + + assert (inv->d1 == dp[dn-1]); + assert (inv->d0 == dp[dn-2]); + assert ((inv->d1 & GMP_LIMB_HIGHBIT) != 0); + + shift = inv->shift; + if (shift > 0) + nh = mpn_lshift (np, np, nn, shift); + else + nh = 0; + + mpn_div_qr_pi1 (qp, np, nn, nh, dp, dn, inv->di); + + if (shift > 0) + gmp_assert_nocarry (mpn_rshift (np, np, dn, shift)); + } +} + +static void +mpn_div_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn) +{ + struct gmp_div_inverse inv; + mp_ptr tp = NULL; + + assert (dn > 0); + assert (nn >= dn); + + mpn_div_qr_invert (&inv, dp, dn); + if (dn > 2 && inv.shift > 0) + { + tp = gmp_xalloc_limbs (dn); + gmp_assert_nocarry (mpn_lshift (tp, dp, dn, inv.shift)); + dp = tp; + } + mpn_div_qr_preinv (qp, np, nn, dp, dn, &inv); + if (tp) + gmp_free (tp); +} + + +/* MPN base conversion. */ +static unsigned +mpn_base_power_of_two_p (unsigned b) +{ + switch (b) + { + case 2: return 1; + case 4: return 2; + case 8: return 3; + case 16: return 4; + case 32: return 5; + case 64: return 6; + case 128: return 7; + case 256: return 8; + default: return 0; + } +} + +struct mpn_base_info +{ + /* bb is the largest power of the base which fits in one limb, and + exp is the corresponding exponent. */ + unsigned exp; + mp_limb_t bb; +}; + +static void +mpn_get_base_info (struct mpn_base_info *info, mp_limb_t b) +{ + mp_limb_t m; + mp_limb_t p; + unsigned exp; + + m = GMP_LIMB_MAX / b; + for (exp = 1, p = b; p <= m; exp++) + p *= b; + + info->exp = exp; + info->bb = p; +} + +static mp_bitcnt_t +mpn_limb_size_in_base_2 (mp_limb_t u) +{ + unsigned shift; + + assert (u > 0); + gmp_clz (shift, u); + return GMP_LIMB_BITS - shift; +} + +static size_t +mpn_get_str_bits (unsigned char *sp, unsigned bits, mp_srcptr up, mp_size_t un) +{ + unsigned char mask; + size_t sn, j; + mp_size_t i; + int shift; + + sn = ((un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1]) + + bits - 1) / bits; + + mask = (1U << bits) - 1; + + for (i = 0, j = sn, shift = 0; j-- > 0;) + { + unsigned char digit = up[i] >> shift; + + shift += bits; + + if (shift >= GMP_LIMB_BITS && ++i < un) + { + shift -= GMP_LIMB_BITS; + digit |= up[i] << (bits - shift); + } + sp[j] = digit & mask; + } + return sn; +} + +/* We generate digits from the least significant end, and reverse at + the end. */ +static size_t +mpn_limb_get_str (unsigned char *sp, mp_limb_t w, + const struct gmp_div_inverse *binv) +{ + mp_size_t i; + for (i = 0; w > 0; i++) + { + mp_limb_t h, l, r; + + h = w >> (GMP_LIMB_BITS - binv->shift); + l = w << binv->shift; + + gmp_udiv_qrnnd_preinv (w, r, h, l, binv->d1, binv->di); + assert ( (r << (GMP_LIMB_BITS - binv->shift)) == 0); + r >>= binv->shift; + + sp[i] = r; + } + return i; +} + +static size_t +mpn_get_str_other (unsigned char *sp, + int base, const struct mpn_base_info *info, + mp_ptr up, mp_size_t un) +{ + struct gmp_div_inverse binv; + size_t sn; + size_t i; + + mpn_div_qr_1_invert (&binv, base); + + sn = 0; + + if (un > 1) + { + struct gmp_div_inverse bbinv; + mpn_div_qr_1_invert (&bbinv, info->bb); + + do + { + mp_limb_t w; + size_t done; + w = mpn_div_qr_1_preinv (up, up, un, &bbinv); + un -= (up[un-1] == 0); + done = mpn_limb_get_str (sp + sn, w, &binv); + + for (sn += done; done < info->exp; done++) + sp[sn++] = 0; + } + while (un > 1); + } + sn += mpn_limb_get_str (sp + sn, up[0], &binv); + + /* Reverse order */ + for (i = 0; 2*i + 1 < sn; i++) + { + unsigned char t = sp[i]; + sp[i] = sp[sn - i - 1]; + sp[sn - i - 1] = t; + } + + return sn; +} + +size_t +mpn_get_str (unsigned char *sp, int base, mp_ptr up, mp_size_t un) +{ + unsigned bits; + + assert (un > 0); + assert (up[un-1] > 0); + + bits = mpn_base_power_of_two_p (base); + if (bits) + return mpn_get_str_bits (sp, bits, up, un); + else + { + struct mpn_base_info info; + + mpn_get_base_info (&info, base); + return mpn_get_str_other (sp, base, &info, up, un); + } +} + +static mp_size_t +mpn_set_str_bits (mp_ptr rp, const unsigned char *sp, size_t sn, + unsigned bits) +{ + mp_size_t rn; + size_t j; + unsigned shift; + + for (j = sn, rn = 0, shift = 0; j-- > 0; ) + { + if (shift == 0) + { + rp[rn++] = sp[j]; + shift += bits; + } + else + { + rp[rn-1] |= (mp_limb_t) sp[j] << shift; + shift += bits; + if (shift >= GMP_LIMB_BITS) + { + shift -= GMP_LIMB_BITS; + if (shift > 0) + rp[rn++] = (mp_limb_t) sp[j] >> (bits - shift); + } + } + } + rn = mpn_normalized_size (rp, rn); + return rn; +} + +static mp_size_t +mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn, + mp_limb_t b, const struct mpn_base_info *info) +{ + mp_size_t rn; + mp_limb_t w; + unsigned k; + size_t j; + + k = 1 + (sn - 1) % info->exp; + + j = 0; + w = sp[j++]; + while (--k != 0) + w = w * b + sp[j++]; + + rp[0] = w; + + for (rn = (w > 0); j < sn;) + { + mp_limb_t cy; + + w = sp[j++]; + for (k = 1; k < info->exp; k++) + w = w * b + sp[j++]; + + cy = mpn_mul_1 (rp, rp, rn, info->bb); + cy += mpn_add_1 (rp, rp, rn, w); + if (cy > 0) + rp[rn++] = cy; + } + assert (j == sn); + + return rn; +} + +mp_size_t +mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t sn, int base) +{ + unsigned bits; + + if (sn == 0) + return 0; + + bits = mpn_base_power_of_two_p (base); + if (bits) + return mpn_set_str_bits (rp, sp, sn, bits); + else + { + struct mpn_base_info info; + + mpn_get_base_info (&info, base); + return mpn_set_str_other (rp, sp, sn, base, &info); + } +} + + +/* MPZ interface */ +void +mpz_init (mpz_t r) +{ + r->_mp_alloc = 1; + r->_mp_size = 0; + r->_mp_d = gmp_xalloc_limbs (1); +} + +/* The utility of this function is a bit limited, since many functions + assigns the result variable using mpz_swap. */ +void +mpz_init2 (mpz_t r, mp_bitcnt_t bits) +{ + mp_size_t rn; + + bits -= (bits != 0); /* Round down, except if 0 */ + rn = 1 + bits / GMP_LIMB_BITS; + + r->_mp_alloc = rn; + r->_mp_size = 0; + r->_mp_d = gmp_xalloc_limbs (rn); +} + +void +mpz_clear (mpz_t r) +{ + gmp_free (r->_mp_d); +} + +static mp_ptr +mpz_realloc (mpz_t r, mp_size_t size) +{ + size = GMP_MAX (size, 1); + + r->_mp_d = gmp_xrealloc_limbs (r->_mp_d, size); + r->_mp_alloc = size; + + if (GMP_ABS (r->_mp_size) > size) + r->_mp_size = 0; + + return r->_mp_d; +} + +/* Realloc for an mpz_t WHAT if it has less than NEEDED limbs. */ +#define MPZ_REALLOC(z,n) ((n) > (z)->_mp_alloc \ + ? mpz_realloc(z,n) \ + : (z)->_mp_d) + +/* MPZ assignment and basic conversions. */ +void +mpz_set_si (mpz_t r, signed long int x) +{ + if (x >= 0) + mpz_set_ui (r, x); + else /* (x < 0) */ + { + r->_mp_size = -1; + r->_mp_d[0] = GMP_NEG_CAST (unsigned long int, x); + } +} + +void +mpz_set_ui (mpz_t r, unsigned long int x) +{ + if (x > 0) + { + r->_mp_size = 1; + r->_mp_d[0] = x; + } + else + r->_mp_size = 0; +} + +void +mpz_set (mpz_t r, const mpz_t x) +{ + /* Allow the NOP r == x */ + if (r != x) + { + mp_size_t n; + mp_ptr rp; + + n = GMP_ABS (x->_mp_size); + rp = MPZ_REALLOC (r, n); + + mpn_copyi (rp, x->_mp_d, n); + r->_mp_size = x->_mp_size; + } +} + +void +mpz_init_set_si (mpz_t r, signed long int x) +{ + mpz_init (r); + mpz_set_si (r, x); +} + +void +mpz_init_set_ui (mpz_t r, unsigned long int x) +{ + mpz_init (r); + mpz_set_ui (r, x); +} + +void +mpz_init_set (mpz_t r, const mpz_t x) +{ + mpz_init (r); + mpz_set (r, x); +} + +int +mpz_fits_slong_p (const mpz_t u) +{ + mp_size_t us = u->_mp_size; + + if (us == 1) + return u->_mp_d[0] < GMP_LIMB_HIGHBIT; + else if (us == -1) + return u->_mp_d[0] <= GMP_LIMB_HIGHBIT; + else + return (us == 0); +} + +int +mpz_fits_ulong_p (const mpz_t u) +{ + mp_size_t us = u->_mp_size; + + return (us == (us > 0)); +} + +long int +mpz_get_si (const mpz_t u) +{ + mp_size_t us = u->_mp_size; + + if (us > 0) + return (long) (u->_mp_d[0] & ~GMP_LIMB_HIGHBIT); + else if (us < 0) + return (long) (- u->_mp_d[0] | GMP_LIMB_HIGHBIT); + else + return 0; +} + +unsigned long int +mpz_get_ui (const mpz_t u) +{ + return u->_mp_size == 0 ? 0 : u->_mp_d[0]; +} + +size_t +mpz_size (const mpz_t u) +{ + return GMP_ABS (u->_mp_size); +} + +mp_limb_t +mpz_getlimbn (const mpz_t u, mp_size_t n) +{ + if (n >= 0 && n < GMP_ABS (u->_mp_size)) + return u->_mp_d[n]; + else + return 0; +} + +void +mpz_realloc2 (mpz_t x, mp_bitcnt_t n) +{ + mpz_realloc (x, 1 + (n - (n != 0)) / GMP_LIMB_BITS); +} + +mp_srcptr +mpz_limbs_read (mpz_srcptr x) +{ + return x->_mp_d;; +} + +mp_ptr +mpz_limbs_modify (mpz_t x, mp_size_t n) +{ + assert (n > 0); + return MPZ_REALLOC (x, n); +} + +mp_ptr +mpz_limbs_write (mpz_t x, mp_size_t n) +{ + return mpz_limbs_modify (x, n); +} + +void +mpz_limbs_finish (mpz_t x, mp_size_t xs) +{ + mp_size_t xn; + xn = mpn_normalized_size (x->_mp_d, GMP_ABS (xs)); + x->_mp_size = xs < 0 ? -xn : xn; +} + +mpz_srcptr +mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs) +{ + x->_mp_alloc = 0; + x->_mp_d = (mp_ptr) xp; + mpz_limbs_finish (x, xs); + return x; +} + + +/* Conversions and comparison to double. */ +void +mpz_set_d (mpz_t r, double x) +{ + int sign; + mp_ptr rp; + mp_size_t rn, i; + double B; + double Bi; + mp_limb_t f; + + /* x != x is true when x is a NaN, and x == x * 0.5 is true when x is + zero or infinity. */ + if (x != x || x == x * 0.5) + { + r->_mp_size = 0; + return; + } + + sign = x < 0.0 ; + if (sign) + x = - x; + + if (x < 1.0) + { + r->_mp_size = 0; + return; + } + B = 2.0 * (double) GMP_LIMB_HIGHBIT; + Bi = 1.0 / B; + for (rn = 1; x >= B; rn++) + x *= Bi; + + rp = MPZ_REALLOC (r, rn); + + f = (mp_limb_t) x; + x -= f; + assert (x < 1.0); + i = rn-1; + rp[i] = f; + while (--i >= 0) + { + x = B * x; + f = (mp_limb_t) x; + x -= f; + assert (x < 1.0); + rp[i] = f; + } + + r->_mp_size = sign ? - rn : rn; +} + +void +mpz_init_set_d (mpz_t r, double x) +{ + mpz_init (r); + mpz_set_d (r, x); +} + +double +mpz_get_d (const mpz_t u) +{ + mp_size_t un; + double x; + double B = 2.0 * (double) GMP_LIMB_HIGHBIT; + + un = GMP_ABS (u->_mp_size); + + if (un == 0) + return 0.0; + + x = u->_mp_d[--un]; + while (un > 0) + x = B*x + u->_mp_d[--un]; + + if (u->_mp_size < 0) + x = -x; + + return x; +} + +int +mpz_cmpabs_d (const mpz_t x, double d) +{ + mp_size_t xn; + double B, Bi; + mp_size_t i; + + xn = x->_mp_size; + d = GMP_ABS (d); + + if (xn != 0) + { + xn = GMP_ABS (xn); + + B = 2.0 * (double) GMP_LIMB_HIGHBIT; + Bi = 1.0 / B; + + /* Scale d so it can be compared with the top limb. */ + for (i = 1; i < xn; i++) + d *= Bi; + + if (d >= B) + return -1; + + /* Compare floor(d) to top limb, subtract and cancel when equal. */ + for (i = xn; i-- > 0;) + { + mp_limb_t f, xl; + + f = (mp_limb_t) d; + xl = x->_mp_d[i]; + if (xl > f) + return 1; + else if (xl < f) + return -1; + d = B * (d - f); + } + } + return - (d > 0.0); +} + +int +mpz_cmp_d (const mpz_t x, double d) +{ + if (x->_mp_size < 0) + { + if (d >= 0.0) + return -1; + else + return -mpz_cmpabs_d (x, d); + } + else + { + if (d < 0.0) + return 1; + else + return mpz_cmpabs_d (x, d); + } +} + + +/* MPZ comparisons and the like. */ +int +mpz_sgn (const mpz_t u) +{ + mp_size_t usize = u->_mp_size; + + return (usize > 0) - (usize < 0); +} + +int +mpz_cmp_si (const mpz_t u, long v) +{ + mp_size_t usize = u->_mp_size; + + if (usize < -1) + return -1; + else if (v >= 0) + return mpz_cmp_ui (u, v); + else if (usize >= 0) + return 1; + else /* usize == -1 */ + { + mp_limb_t ul = u->_mp_d[0]; + if ((mp_limb_t)GMP_NEG_CAST (unsigned long int, v) < ul) + return -1; + else + return (mp_limb_t)GMP_NEG_CAST (unsigned long int, v) > ul; + } +} + +int +mpz_cmp_ui (const mpz_t u, unsigned long v) +{ + mp_size_t usize = u->_mp_size; + + if (usize > 1) + return 1; + else if (usize < 0) + return -1; + else + { + mp_limb_t ul = (usize > 0) ? u->_mp_d[0] : 0; + return (ul > v) - (ul < v); + } +} + +int +mpz_cmp (const mpz_t a, const mpz_t b) +{ + mp_size_t asize = a->_mp_size; + mp_size_t bsize = b->_mp_size; + + if (asize != bsize) + return (asize < bsize) ? -1 : 1; + else if (asize >= 0) + return mpn_cmp (a->_mp_d, b->_mp_d, asize); + else + return mpn_cmp (b->_mp_d, a->_mp_d, -asize); +} + +int +mpz_cmpabs_ui (const mpz_t u, unsigned long v) +{ + mp_size_t un = GMP_ABS (u->_mp_size); + mp_limb_t ul; + + if (un > 1) + return 1; + + ul = (un == 1) ? u->_mp_d[0] : 0; + + return (ul > v) - (ul < v); +} + +int +mpz_cmpabs (const mpz_t u, const mpz_t v) +{ + return mpn_cmp4 (u->_mp_d, GMP_ABS (u->_mp_size), + v->_mp_d, GMP_ABS (v->_mp_size)); +} + +void +mpz_abs (mpz_t r, const mpz_t u) +{ + mpz_set (r, u); + r->_mp_size = GMP_ABS (r->_mp_size); +} + +void +mpz_neg (mpz_t r, const mpz_t u) +{ + mpz_set (r, u); + r->_mp_size = -r->_mp_size; +} + +void +mpz_swap (mpz_t u, mpz_t v) +{ + MP_SIZE_T_SWAP (u->_mp_size, v->_mp_size); + MP_SIZE_T_SWAP (u->_mp_alloc, v->_mp_alloc); + MP_PTR_SWAP (u->_mp_d, v->_mp_d); +} + + +/* MPZ addition and subtraction */ + +/* Adds to the absolute value. Returns new size, but doesn't store it. */ +static mp_size_t +mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b) +{ + mp_size_t an; + mp_ptr rp; + mp_limb_t cy; + + an = GMP_ABS (a->_mp_size); + if (an == 0) + { + r->_mp_d[0] = b; + return b > 0; + } + + rp = MPZ_REALLOC (r, an + 1); + + cy = mpn_add_1 (rp, a->_mp_d, an, b); + rp[an] = cy; + an += cy; + + return an; +} + +/* Subtract from the absolute value. Returns new size, (or -1 on underflow), + but doesn't store it. */ +static mp_size_t +mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b) +{ + mp_size_t an = GMP_ABS (a->_mp_size); + mp_ptr rp = MPZ_REALLOC (r, an); + + if (an == 0) + { + rp[0] = b; + return -(b > 0); + } + else if (an == 1 && a->_mp_d[0] < b) + { + rp[0] = b - a->_mp_d[0]; + return -1; + } + else + { + gmp_assert_nocarry (mpn_sub_1 (rp, a->_mp_d, an, b)); + return mpn_normalized_size (rp, an); + } +} + +void +mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b) +{ + if (a->_mp_size >= 0) + r->_mp_size = mpz_abs_add_ui (r, a, b); + else + r->_mp_size = -mpz_abs_sub_ui (r, a, b); +} + +void +mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b) +{ + if (a->_mp_size < 0) + r->_mp_size = -mpz_abs_add_ui (r, a, b); + else + r->_mp_size = mpz_abs_sub_ui (r, a, b); +} + +void +mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b) +{ + if (b->_mp_size < 0) + r->_mp_size = mpz_abs_add_ui (r, b, a); + else + r->_mp_size = -mpz_abs_sub_ui (r, b, a); +} + +static mp_size_t +mpz_abs_add (mpz_t r, const mpz_t a, const mpz_t b) +{ + mp_size_t an = GMP_ABS (a->_mp_size); + mp_size_t bn = GMP_ABS (b->_mp_size); + mp_ptr rp; + mp_limb_t cy; + + if (an < bn) + { + MPZ_SRCPTR_SWAP (a, b); + MP_SIZE_T_SWAP (an, bn); + } + + rp = MPZ_REALLOC (r, an + 1); + cy = mpn_add (rp, a->_mp_d, an, b->_mp_d, bn); + + rp[an] = cy; + + return an + cy; +} + +static mp_size_t +mpz_abs_sub (mpz_t r, const mpz_t a, const mpz_t b) +{ + mp_size_t an = GMP_ABS (a->_mp_size); + mp_size_t bn = GMP_ABS (b->_mp_size); + int cmp; + mp_ptr rp; + + cmp = mpn_cmp4 (a->_mp_d, an, b->_mp_d, bn); + if (cmp > 0) + { + rp = MPZ_REALLOC (r, an); + gmp_assert_nocarry (mpn_sub (rp, a->_mp_d, an, b->_mp_d, bn)); + return mpn_normalized_size (rp, an); + } + else if (cmp < 0) + { + rp = MPZ_REALLOC (r, bn); + gmp_assert_nocarry (mpn_sub (rp, b->_mp_d, bn, a->_mp_d, an)); + return -mpn_normalized_size (rp, bn); + } + else + return 0; +} + +void +mpz_add (mpz_t r, const mpz_t a, const mpz_t b) +{ + mp_size_t rn; + + if ( (a->_mp_size ^ b->_mp_size) >= 0) + rn = mpz_abs_add (r, a, b); + else + rn = mpz_abs_sub (r, a, b); + + r->_mp_size = a->_mp_size >= 0 ? rn : - rn; +} + +void +mpz_sub (mpz_t r, const mpz_t a, const mpz_t b) +{ + mp_size_t rn; + + if ( (a->_mp_size ^ b->_mp_size) >= 0) + rn = mpz_abs_sub (r, a, b); + else + rn = mpz_abs_add (r, a, b); + + r->_mp_size = a->_mp_size >= 0 ? rn : - rn; +} + + +/* MPZ multiplication */ +void +mpz_mul_si (mpz_t r, const mpz_t u, long int v) +{ + if (v < 0) + { + mpz_mul_ui (r, u, GMP_NEG_CAST (unsigned long int, v)); + mpz_neg (r, r); + } + else + mpz_mul_ui (r, u, (unsigned long int) v); +} + +void +mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v) +{ + mp_size_t un, us; + mp_ptr tp; + mp_limb_t cy; + + us = u->_mp_size; + + if (us == 0 || v == 0) + { + r->_mp_size = 0; + return; + } + + un = GMP_ABS (us); + + tp = MPZ_REALLOC (r, un + 1); + cy = mpn_mul_1 (tp, u->_mp_d, un, v); + tp[un] = cy; + + un += (cy > 0); + r->_mp_size = (us < 0) ? - un : un; +} + +void +mpz_mul (mpz_t r, const mpz_t u, const mpz_t v) +{ + int sign; + mp_size_t un, vn, rn; + mpz_t t; + mp_ptr tp; + + un = u->_mp_size; + vn = v->_mp_size; + + if (un == 0 || vn == 0) + { + r->_mp_size = 0; + return; + } + + sign = (un ^ vn) < 0; + + un = GMP_ABS (un); + vn = GMP_ABS (vn); + + mpz_init2 (t, (un + vn) * GMP_LIMB_BITS); + + tp = t->_mp_d; + if (un >= vn) + mpn_mul (tp, u->_mp_d, un, v->_mp_d, vn); + else + mpn_mul (tp, v->_mp_d, vn, u->_mp_d, un); + + rn = un + vn; + rn -= tp[rn-1] == 0; + + t->_mp_size = sign ? - rn : rn; + mpz_swap (r, t); + mpz_clear (t); +} + +void +mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits) +{ + mp_size_t un, rn; + mp_size_t limbs; + unsigned shift; + mp_ptr rp; + + un = GMP_ABS (u->_mp_size); + if (un == 0) + { + r->_mp_size = 0; + return; + } + + limbs = bits / GMP_LIMB_BITS; + shift = bits % GMP_LIMB_BITS; + + rn = un + limbs + (shift > 0); + rp = MPZ_REALLOC (r, rn); + if (shift > 0) + { + mp_limb_t cy = mpn_lshift (rp + limbs, u->_mp_d, un, shift); + rp[rn-1] = cy; + rn -= (cy == 0); + } + else + mpn_copyd (rp + limbs, u->_mp_d, un); + + mpn_zero (rp, limbs); + + r->_mp_size = (u->_mp_size < 0) ? - rn : rn; +} + +void +mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v) +{ + mpz_t t; + mpz_init (t); + mpz_mul_ui (t, u, v); + mpz_add (r, r, t); + mpz_clear (t); +} + +void +mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v) +{ + mpz_t t; + mpz_init (t); + mpz_mul_ui (t, u, v); + mpz_sub (r, r, t); + mpz_clear (t); +} + +void +mpz_addmul (mpz_t r, const mpz_t u, const mpz_t v) +{ + mpz_t t; + mpz_init (t); + mpz_mul (t, u, v); + mpz_add (r, r, t); + mpz_clear (t); +} + +void +mpz_submul (mpz_t r, const mpz_t u, const mpz_t v) +{ + mpz_t t; + mpz_init (t); + mpz_mul (t, u, v); + mpz_sub (r, r, t); + mpz_clear (t); +} + + +/* MPZ division */ +enum mpz_div_round_mode { GMP_DIV_FLOOR, GMP_DIV_CEIL, GMP_DIV_TRUNC }; + +/* Allows q or r to be zero. Returns 1 iff remainder is non-zero. */ +static int +mpz_div_qr (mpz_t q, mpz_t r, + const mpz_t n, const mpz_t d, enum mpz_div_round_mode mode) +{ + mp_size_t ns, ds, nn, dn, qs; + ns = n->_mp_size; + ds = d->_mp_size; + + if (ds == 0) + gmp_die("mpz_div_qr: Divide by zero."); + + if (ns == 0) + { + if (q) + q->_mp_size = 0; + if (r) + r->_mp_size = 0; + return 0; + } + + nn = GMP_ABS (ns); + dn = GMP_ABS (ds); + + qs = ds ^ ns; + + if (nn < dn) + { + if (mode == GMP_DIV_CEIL && qs >= 0) + { + /* q = 1, r = n - d */ + if (r) + mpz_sub (r, n, d); + if (q) + mpz_set_ui (q, 1); + } + else if (mode == GMP_DIV_FLOOR && qs < 0) + { + /* q = -1, r = n + d */ + if (r) + mpz_add (r, n, d); + if (q) + mpz_set_si (q, -1); + } + else + { + /* q = 0, r = d */ + if (r) + mpz_set (r, n); + if (q) + q->_mp_size = 0; + } + return 1; + } + else + { + mp_ptr np, qp; + mp_size_t qn, rn; + mpz_t tq, tr; + + mpz_init_set (tr, n); + np = tr->_mp_d; + + qn = nn - dn + 1; + + if (q) + { + mpz_init2 (tq, qn * GMP_LIMB_BITS); + qp = tq->_mp_d; + } + else + qp = NULL; + + mpn_div_qr (qp, np, nn, d->_mp_d, dn); + + if (qp) + { + qn -= (qp[qn-1] == 0); + + tq->_mp_size = qs < 0 ? -qn : qn; + } + rn = mpn_normalized_size (np, dn); + tr->_mp_size = ns < 0 ? - rn : rn; + + if (mode == GMP_DIV_FLOOR && qs < 0 && rn != 0) + { + if (q) + mpz_sub_ui (tq, tq, 1); + if (r) + mpz_add (tr, tr, d); + } + else if (mode == GMP_DIV_CEIL && qs >= 0 && rn != 0) + { + if (q) + mpz_add_ui (tq, tq, 1); + if (r) + mpz_sub (tr, tr, d); + } + + if (q) + { + mpz_swap (tq, q); + mpz_clear (tq); + } + if (r) + mpz_swap (tr, r); + + mpz_clear (tr); + + return rn != 0; + } +} + +void +mpz_cdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (q, r, n, d, GMP_DIV_CEIL); +} + +void +mpz_fdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (q, r, n, d, GMP_DIV_FLOOR); +} + +void +mpz_tdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (q, r, n, d, GMP_DIV_TRUNC); +} + +void +mpz_cdiv_q (mpz_t q, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (q, NULL, n, d, GMP_DIV_CEIL); +} + +void +mpz_fdiv_q (mpz_t q, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (q, NULL, n, d, GMP_DIV_FLOOR); +} + +void +mpz_tdiv_q (mpz_t q, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC); +} + +void +mpz_cdiv_r (mpz_t r, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (NULL, r, n, d, GMP_DIV_CEIL); +} + +void +mpz_fdiv_r (mpz_t r, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (NULL, r, n, d, GMP_DIV_FLOOR); +} + +void +mpz_tdiv_r (mpz_t r, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (NULL, r, n, d, GMP_DIV_TRUNC); +} + +void +mpz_mod (mpz_t r, const mpz_t n, const mpz_t d) +{ + mpz_div_qr (NULL, r, n, d, d->_mp_size >= 0 ? GMP_DIV_FLOOR : GMP_DIV_CEIL); +} + +static void +mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index, + enum mpz_div_round_mode mode) +{ + mp_size_t un, qn; + mp_size_t limb_cnt; + mp_ptr qp; + int adjust; + + un = u->_mp_size; + if (un == 0) + { + q->_mp_size = 0; + return; + } + limb_cnt = bit_index / GMP_LIMB_BITS; + qn = GMP_ABS (un) - limb_cnt; + bit_index %= GMP_LIMB_BITS; + + if (mode == ((un > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* un != 0 here. */ + /* Note: Below, the final indexing at limb_cnt is valid because at + that point we have qn > 0. */ + adjust = (qn <= 0 + || !mpn_zero_p (u->_mp_d, limb_cnt) + || (u->_mp_d[limb_cnt] + & (((mp_limb_t) 1 << bit_index) - 1))); + else + adjust = 0; + + if (qn <= 0) + qn = 0; + + else + { + qp = MPZ_REALLOC (q, qn); + + if (bit_index != 0) + { + mpn_rshift (qp, u->_mp_d + limb_cnt, qn, bit_index); + qn -= qp[qn - 1] == 0; + } + else + { + mpn_copyi (qp, u->_mp_d + limb_cnt, qn); + } + } + + q->_mp_size = qn; + + if (adjust) + mpz_add_ui (q, q, 1); + if (un < 0) + mpz_neg (q, q); +} + +static void +mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index, + enum mpz_div_round_mode mode) +{ + mp_size_t us, un, rn; + mp_ptr rp; + mp_limb_t mask; + + us = u->_mp_size; + if (us == 0 || bit_index == 0) + { + r->_mp_size = 0; + return; + } + rn = (bit_index + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; + assert (rn > 0); + + rp = MPZ_REALLOC (r, rn); + un = GMP_ABS (us); + + mask = GMP_LIMB_MAX >> (rn * GMP_LIMB_BITS - bit_index); + + if (rn > un) + { + /* Quotient (with truncation) is zero, and remainder is + non-zero */ + if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */ + { + /* Have to negate and sign extend. */ + mp_size_t i; + mp_limb_t cy; + + for (cy = 1, i = 0; i < un; i++) + { + mp_limb_t s = ~u->_mp_d[i] + cy; + cy = s < cy; + rp[i] = s; + } + assert (cy == 0); + for (; i < rn - 1; i++) + rp[i] = GMP_LIMB_MAX; + + rp[rn-1] = mask; + us = -us; + } + else + { + /* Just copy */ + if (r != u) + mpn_copyi (rp, u->_mp_d, un); + + rn = un; + } + } + else + { + if (r != u) + mpn_copyi (rp, u->_mp_d, rn - 1); + + rp[rn-1] = u->_mp_d[rn-1] & mask; + + if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */ + { + /* If r != 0, compute 2^{bit_count} - r. */ + mp_size_t i; + + for (i = 0; i < rn && rp[i] == 0; i++) + ; + if (i < rn) + { + /* r > 0, need to flip sign. */ + rp[i] = ~rp[i] + 1; + while (++i < rn) + rp[i] = ~rp[i]; + + rp[rn-1] &= mask; + + /* us is not used for anything else, so we can modify it + here to indicate flipped sign. */ + us = -us; + } + } + } + rn = mpn_normalized_size (rp, rn); + r->_mp_size = us < 0 ? -rn : rn; +} + +void +mpz_cdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt) +{ + mpz_div_q_2exp (r, u, cnt, GMP_DIV_CEIL); +} + +void +mpz_fdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt) +{ + mpz_div_q_2exp (r, u, cnt, GMP_DIV_FLOOR); +} + +void +mpz_tdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt) +{ + mpz_div_q_2exp (r, u, cnt, GMP_DIV_TRUNC); +} + +void +mpz_cdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt) +{ + mpz_div_r_2exp (r, u, cnt, GMP_DIV_CEIL); +} + +void +mpz_fdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt) +{ + mpz_div_r_2exp (r, u, cnt, GMP_DIV_FLOOR); +} + +void +mpz_tdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt) +{ + mpz_div_r_2exp (r, u, cnt, GMP_DIV_TRUNC); +} + +void +mpz_divexact (mpz_t q, const mpz_t n, const mpz_t d) +{ + gmp_assert_nocarry (mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC)); +} + +int +mpz_divisible_p (const mpz_t n, const mpz_t d) +{ + return mpz_div_qr (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0; +} + +int +mpz_congruent_p (const mpz_t a, const mpz_t b, const mpz_t m) +{ + mpz_t t; + int res; + + /* a == b (mod 0) iff a == b */ + if (mpz_sgn (m) == 0) + return (mpz_cmp (a, b) == 0); + + mpz_init (t); + mpz_sub (t, a, b); + res = mpz_divisible_p (t, m); + mpz_clear (t); + + return res; +} + +static unsigned long +mpz_div_qr_ui (mpz_t q, mpz_t r, + const mpz_t n, unsigned long d, enum mpz_div_round_mode mode) +{ + mp_size_t ns, qn; + mp_ptr qp; + mp_limb_t rl; + mp_size_t rs; + + ns = n->_mp_size; + if (ns == 0) + { + if (q) + q->_mp_size = 0; + if (r) + r->_mp_size = 0; + return 0; + } + + qn = GMP_ABS (ns); + if (q) + qp = MPZ_REALLOC (q, qn); + else + qp = NULL; + + rl = mpn_div_qr_1 (qp, n->_mp_d, qn, d); + assert (rl < d); + + rs = rl > 0; + rs = (ns < 0) ? -rs : rs; + + if (rl > 0 && ( (mode == GMP_DIV_FLOOR && ns < 0) + || (mode == GMP_DIV_CEIL && ns >= 0))) + { + if (q) + gmp_assert_nocarry (mpn_add_1 (qp, qp, qn, 1)); + rl = d - rl; + rs = -rs; + } + + if (r) + { + r->_mp_d[0] = rl; + r->_mp_size = rs; + } + if (q) + { + qn -= (qp[qn-1] == 0); + assert (qn == 0 || qp[qn-1] > 0); + + q->_mp_size = (ns < 0) ? - qn : qn; + } + + return rl; +} + +unsigned long +mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (q, r, n, d, GMP_DIV_CEIL); +} + +unsigned long +mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (q, r, n, d, GMP_DIV_FLOOR); +} + +unsigned long +mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (q, r, n, d, GMP_DIV_TRUNC); +} + +unsigned long +mpz_cdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_CEIL); +} + +unsigned long +mpz_fdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_FLOOR); +} + +unsigned long +mpz_tdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC); +} + +unsigned long +mpz_cdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_CEIL); +} +unsigned long +mpz_fdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR); +} +unsigned long +mpz_tdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_TRUNC); +} + +unsigned long +mpz_cdiv_ui (const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_CEIL); +} + +unsigned long +mpz_fdiv_ui (const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_FLOOR); +} + +unsigned long +mpz_tdiv_ui (const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC); +} + +unsigned long +mpz_mod_ui (mpz_t r, const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR); +} + +void +mpz_divexact_ui (mpz_t q, const mpz_t n, unsigned long d) +{ + gmp_assert_nocarry (mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC)); +} + +int +mpz_divisible_ui_p (const mpz_t n, unsigned long d) +{ + return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0; +} + + +/* GCD */ +static mp_limb_t +mpn_gcd_11 (mp_limb_t u, mp_limb_t v) +{ + unsigned shift; + + assert ( (u | v) > 0); + + if (u == 0) + return v; + else if (v == 0) + return u; + + gmp_ctz (shift, u | v); + + u >>= shift; + v >>= shift; + + if ( (u & 1) == 0) + MP_LIMB_T_SWAP (u, v); + + while ( (v & 1) == 0) + v >>= 1; + + while (u != v) + { + if (u > v) + { + u -= v; + do + u >>= 1; + while ( (u & 1) == 0); + } + else + { + v -= u; + do + v >>= 1; + while ( (v & 1) == 0); + } + } + return u << shift; +} + +unsigned long +mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v) +{ + mp_size_t un; + + if (v == 0) + { + if (g) + mpz_abs (g, u); + } + else + { + un = GMP_ABS (u->_mp_size); + if (un != 0) + v = mpn_gcd_11 (mpn_div_qr_1 (NULL, u->_mp_d, un, v), v); + + if (g) + mpz_set_ui (g, v); + } + + return v; +} + +static mp_bitcnt_t +mpz_make_odd (mpz_t r) +{ + mp_bitcnt_t shift; + + assert (r->_mp_size > 0); + /* Count trailing zeros, equivalent to mpn_scan1, because we know that there is a 1 */ + shift = mpn_common_scan (r->_mp_d[0], 0, r->_mp_d, 0, 0); + mpz_tdiv_q_2exp (r, r, shift); + + return shift; +} + +void +mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v) +{ + mpz_t tu, tv; + mp_bitcnt_t uz, vz, gz; + + if (u->_mp_size == 0) + { + mpz_abs (g, v); + return; + } + if (v->_mp_size == 0) + { + mpz_abs (g, u); + return; + } + + mpz_init (tu); + mpz_init (tv); + + mpz_abs (tu, u); + uz = mpz_make_odd (tu); + mpz_abs (tv, v); + vz = mpz_make_odd (tv); + gz = GMP_MIN (uz, vz); + + if (tu->_mp_size < tv->_mp_size) + mpz_swap (tu, tv); + + mpz_tdiv_r (tu, tu, tv); + if (tu->_mp_size == 0) + { + mpz_swap (g, tv); + } + else + for (;;) + { + int c; + + mpz_make_odd (tu); + c = mpz_cmp (tu, tv); + if (c == 0) + { + mpz_swap (g, tu); + break; + } + if (c < 0) + mpz_swap (tu, tv); + + if (tv->_mp_size == 1) + { + mp_limb_t vl = tv->_mp_d[0]; + mp_limb_t ul = mpz_tdiv_ui (tu, vl); + mpz_set_ui (g, mpn_gcd_11 (ul, vl)); + break; + } + mpz_sub (tu, tu, tv); + } + mpz_clear (tu); + mpz_clear (tv); + mpz_mul_2exp (g, g, gz); +} + +void +mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v) +{ + mpz_t tu, tv, s0, s1, t0, t1; + mp_bitcnt_t uz, vz, gz; + mp_bitcnt_t power; + + if (u->_mp_size == 0) + { + /* g = 0 u + sgn(v) v */ + signed long sign = mpz_sgn (v); + mpz_abs (g, v); + if (s) + mpz_set_ui (s, 0); + if (t) + mpz_set_si (t, sign); + return; + } + + if (v->_mp_size == 0) + { + /* g = sgn(u) u + 0 v */ + signed long sign = mpz_sgn (u); + mpz_abs (g, u); + if (s) + mpz_set_si (s, sign); + if (t) + mpz_set_ui (t, 0); + return; + } + + mpz_init (tu); + mpz_init (tv); + mpz_init (s0); + mpz_init (s1); + mpz_init (t0); + mpz_init (t1); + + mpz_abs (tu, u); + uz = mpz_make_odd (tu); + mpz_abs (tv, v); + vz = mpz_make_odd (tv); + gz = GMP_MIN (uz, vz); + + uz -= gz; + vz -= gz; + + /* Cofactors corresponding to odd gcd. gz handled later. */ + if (tu->_mp_size < tv->_mp_size) + { + mpz_swap (tu, tv); + MPZ_SRCPTR_SWAP (u, v); + MPZ_PTR_SWAP (s, t); + MP_BITCNT_T_SWAP (uz, vz); + } + + /* Maintain + * + * u = t0 tu + t1 tv + * v = s0 tu + s1 tv + * + * where u and v denote the inputs with common factors of two + * eliminated, and det (s0, t0; s1, t1) = 2^p. Then + * + * 2^p tu = s1 u - t1 v + * 2^p tv = -s0 u + t0 v + */ + + /* After initial division, tu = q tv + tu', we have + * + * u = 2^uz (tu' + q tv) + * v = 2^vz tv + * + * or + * + * t0 = 2^uz, t1 = 2^uz q + * s0 = 0, s1 = 2^vz + */ + + mpz_setbit (t0, uz); + mpz_tdiv_qr (t1, tu, tu, tv); + mpz_mul_2exp (t1, t1, uz); + + mpz_setbit (s1, vz); + power = uz + vz; + + if (tu->_mp_size > 0) + { + mp_bitcnt_t shift; + shift = mpz_make_odd (tu); + mpz_mul_2exp (t0, t0, shift); + mpz_mul_2exp (s0, s0, shift); + power += shift; + + for (;;) + { + int c; + c = mpz_cmp (tu, tv); + if (c == 0) + break; + + if (c < 0) + { + /* tv = tv' + tu + * + * u = t0 tu + t1 (tv' + tu) = (t0 + t1) tu + t1 tv' + * v = s0 tu + s1 (tv' + tu) = (s0 + s1) tu + s1 tv' */ + + mpz_sub (tv, tv, tu); + mpz_add (t0, t0, t1); + mpz_add (s0, s0, s1); + + shift = mpz_make_odd (tv); + mpz_mul_2exp (t1, t1, shift); + mpz_mul_2exp (s1, s1, shift); + } + else + { + mpz_sub (tu, tu, tv); + mpz_add (t1, t0, t1); + mpz_add (s1, s0, s1); + + shift = mpz_make_odd (tu); + mpz_mul_2exp (t0, t0, shift); + mpz_mul_2exp (s0, s0, shift); + } + power += shift; + } + } + + /* Now tv = odd part of gcd, and -s0 and t0 are corresponding + cofactors. */ + + mpz_mul_2exp (tv, tv, gz); + mpz_neg (s0, s0); + + /* 2^p g = s0 u + t0 v. Eliminate one factor of two at a time. To + adjust cofactors, we need u / g and v / g */ + + mpz_divexact (s1, v, tv); + mpz_abs (s1, s1); + mpz_divexact (t1, u, tv); + mpz_abs (t1, t1); + + while (power-- > 0) + { + /* s0 u + t0 v = (s0 - v/g) u - (t0 + u/g) v */ + if (mpz_odd_p (s0) || mpz_odd_p (t0)) + { + mpz_sub (s0, s0, s1); + mpz_add (t0, t0, t1); + } + mpz_divexact_ui (s0, s0, 2); + mpz_divexact_ui (t0, t0, 2); + } + + /* Arrange so that |s| < |u| / 2g */ + mpz_add (s1, s0, s1); + if (mpz_cmpabs (s0, s1) > 0) + { + mpz_swap (s0, s1); + mpz_sub (t0, t0, t1); + } + if (u->_mp_size < 0) + mpz_neg (s0, s0); + if (v->_mp_size < 0) + mpz_neg (t0, t0); + + mpz_swap (g, tv); + if (s) + mpz_swap (s, s0); + if (t) + mpz_swap (t, t0); + + mpz_clear (tu); + mpz_clear (tv); + mpz_clear (s0); + mpz_clear (s1); + mpz_clear (t0); + mpz_clear (t1); +} + +void +mpz_lcm (mpz_t r, const mpz_t u, const mpz_t v) +{ + mpz_t g; + + if (u->_mp_size == 0 || v->_mp_size == 0) + { + r->_mp_size = 0; + return; + } + + mpz_init (g); + + mpz_gcd (g, u, v); + mpz_divexact (g, u, g); + mpz_mul (r, g, v); + + mpz_clear (g); + mpz_abs (r, r); +} + +void +mpz_lcm_ui (mpz_t r, const mpz_t u, unsigned long v) +{ + if (v == 0 || u->_mp_size == 0) + { + r->_mp_size = 0; + return; + } + + v /= mpz_gcd_ui (NULL, u, v); + mpz_mul_ui (r, u, v); + + mpz_abs (r, r); +} + +int +mpz_invert (mpz_t r, const mpz_t u, const mpz_t m) +{ + mpz_t g, tr; + int invertible; + + if (u->_mp_size == 0 || mpz_cmpabs_ui (m, 1) <= 0) + return 0; + + mpz_init (g); + mpz_init (tr); + + mpz_gcdext (g, tr, NULL, u, m); + invertible = (mpz_cmp_ui (g, 1) == 0); + + if (invertible) + { + if (tr->_mp_size < 0) + { + if (m->_mp_size >= 0) + mpz_add (tr, tr, m); + else + mpz_sub (tr, tr, m); + } + mpz_swap (r, tr); + } + + mpz_clear (g); + mpz_clear (tr); + return invertible; +} + + +/* Higher level operations (sqrt, pow and root) */ + +void +mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e) +{ + unsigned long bit; + mpz_t tr; + mpz_init_set_ui (tr, 1); + + bit = GMP_ULONG_HIGHBIT; + do + { + mpz_mul (tr, tr, tr); + if (e & bit) + mpz_mul (tr, tr, b); + bit >>= 1; + } + while (bit > 0); + + mpz_swap (r, tr); + mpz_clear (tr); +} + +void +mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e) +{ + mpz_t b; + mpz_pow_ui (r, mpz_roinit_n (b, &blimb, 1), e); +} + +void +mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m) +{ + mpz_t tr; + mpz_t base; + mp_size_t en, mn; + mp_srcptr mp; + struct gmp_div_inverse minv; + unsigned shift; + mp_ptr tp = NULL; + + en = GMP_ABS (e->_mp_size); + mn = GMP_ABS (m->_mp_size); + if (mn == 0) + gmp_die ("mpz_powm: Zero modulo."); + + if (en == 0) + { + mpz_set_ui (r, 1); + return; + } + + mp = m->_mp_d; + mpn_div_qr_invert (&minv, mp, mn); + shift = minv.shift; + + if (shift > 0) + { + /* To avoid shifts, we do all our reductions, except the final + one, using a *normalized* m. */ + minv.shift = 0; + + tp = gmp_xalloc_limbs (mn); + gmp_assert_nocarry (mpn_lshift (tp, mp, mn, shift)); + mp = tp; + } + + mpz_init (base); + + if (e->_mp_size < 0) + { + if (!mpz_invert (base, b, m)) + gmp_die ("mpz_powm: Negative exponent and non-invertible base."); + } + else + { + mp_size_t bn; + mpz_abs (base, b); + + bn = base->_mp_size; + if (bn >= mn) + { + mpn_div_qr_preinv (NULL, base->_mp_d, base->_mp_size, mp, mn, &minv); + bn = mn; + } + + /* We have reduced the absolute value. Now take care of the + sign. Note that we get zero represented non-canonically as + m. */ + if (b->_mp_size < 0) + { + mp_ptr bp = MPZ_REALLOC (base, mn); + gmp_assert_nocarry (mpn_sub (bp, mp, mn, bp, bn)); + bn = mn; + } + base->_mp_size = mpn_normalized_size (base->_mp_d, bn); + } + mpz_init_set_ui (tr, 1); + + while (--en >= 0) + { + mp_limb_t w = e->_mp_d[en]; + mp_limb_t bit; + + bit = GMP_LIMB_HIGHBIT; + do + { + mpz_mul (tr, tr, tr); + if (w & bit) + mpz_mul (tr, tr, base); + if (tr->_mp_size > mn) + { + mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv); + tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn); + } + bit >>= 1; + } + while (bit > 0); + } + + /* Final reduction */ + if (tr->_mp_size >= mn) + { + minv.shift = shift; + mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv); + tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn); + } + if (tp) + gmp_free (tp); + + mpz_swap (r, tr); + mpz_clear (tr); + mpz_clear (base); +} + +void +mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m) +{ + mpz_t e; + mpz_powm (r, b, mpz_roinit_n (e, &elimb, 1), m); +} + +/* x=trunc(y^(1/z)), r=y-x^z */ +void +mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z) +{ + int sgn; + mpz_t t, u; + + sgn = y->_mp_size < 0; + if ((~z & sgn) != 0) + gmp_die ("mpz_rootrem: Negative argument, with even root."); + if (z == 0) + gmp_die ("mpz_rootrem: Zeroth root."); + + if (mpz_cmpabs_ui (y, 1) <= 0) { + if (x) + mpz_set (x, y); + if (r) + r->_mp_size = 0; + return; + } + + mpz_init (u); + { + mp_bitcnt_t tb; + tb = mpz_sizeinbase (y, 2) / z + 1; + mpz_init2 (t, tb + 1); + mpz_setbit (t, tb); + } + + if (z == 2) /* simplify sqrt loop: z-1 == 1 */ + do { + mpz_swap (u, t); /* u = x */ + mpz_tdiv_q (t, y, u); /* t = y/x */ + mpz_add (t, t, u); /* t = y/x + x */ + mpz_tdiv_q_2exp (t, t, 1); /* x'= (y/x + x)/2 */ + } while (mpz_cmpabs (t, u) < 0); /* |x'| < |x| */ + else /* z != 2 */ { + mpz_t v; + + mpz_init (v); + if (sgn) + mpz_neg (t, t); + + do { + mpz_swap (u, t); /* u = x */ + mpz_pow_ui (t, u, z - 1); /* t = x^(z-1) */ + mpz_tdiv_q (t, y, t); /* t = y/x^(z-1) */ + mpz_mul_ui (v, u, z - 1); /* v = x*(z-1) */ + mpz_add (t, t, v); /* t = y/x^(z-1) + x*(z-1) */ + mpz_tdiv_q_ui (t, t, z); /* x'=(y/x^(z-1) + x*(z-1))/z */ + } while (mpz_cmpabs (t, u) < 0); /* |x'| < |x| */ + + mpz_clear (v); + } + + if (r) { + mpz_pow_ui (t, u, z); + mpz_sub (r, y, t); + } + if (x) + mpz_swap (x, u); + mpz_clear (u); + mpz_clear (t); +} + +int +mpz_root (mpz_t x, const mpz_t y, unsigned long z) +{ + int res; + mpz_t r; + + mpz_init (r); + mpz_rootrem (x, r, y, z); + res = r->_mp_size == 0; + mpz_clear (r); + + return res; +} + +/* Compute s = floor(sqrt(u)) and r = u - s^2. Allows r == NULL */ +void +mpz_sqrtrem (mpz_t s, mpz_t r, const mpz_t u) +{ + mpz_rootrem (s, r, u, 2); +} + +void +mpz_sqrt (mpz_t s, const mpz_t u) +{ + mpz_rootrem (s, NULL, u, 2); +} + +int +mpz_perfect_square_p (const mpz_t u) +{ + if (u->_mp_size <= 0) + return (u->_mp_size == 0); + else + return mpz_root (NULL, u, 2); +} + +int +mpn_perfect_square_p (mp_srcptr p, mp_size_t n) +{ + mpz_t t; + + assert (n > 0); + assert (p [n-1] != 0); + return mpz_root (NULL, mpz_roinit_n (t, p, n), 2); +} + +mp_size_t +mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n) +{ + mpz_t s, r, u; + mp_size_t res; + + assert (n > 0); + assert (p [n-1] != 0); + + mpz_init (r); + mpz_init (s); + mpz_rootrem (s, r, mpz_roinit_n (u, p, n), 2); + + assert (s->_mp_size == (n+1)/2); + mpn_copyd (sp, s->_mp_d, s->_mp_size); + mpz_clear (s); + res = r->_mp_size; + if (rp) + mpn_copyd (rp, r->_mp_d, res); + mpz_clear (r); + return res; +} + +/* Combinatorics */ + +void +mpz_fac_ui (mpz_t x, unsigned long n) +{ + mpz_set_ui (x, n + (n == 0)); + while (n > 2) + mpz_mul_ui (x, x, --n); +} + +void +mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k) +{ + mpz_t t; + + mpz_set_ui (r, k <= n); + + if (k > (n >> 1)) + k = (k <= n) ? n - k : 0; + + mpz_init (t); + mpz_fac_ui (t, k); + + for (; k > 0; k--) + mpz_mul_ui (r, r, n--); + + mpz_divexact (r, r, t); + mpz_clear (t); +} + + +/* Primality testing */ +static int +gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y, + const mpz_t q, mp_bitcnt_t k) +{ + assert (k > 0); + + /* Caller must initialize y to the base. */ + mpz_powm (y, y, q, n); + + if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0) + return 1; + + while (--k > 0) + { + mpz_powm_ui (y, y, 2, n); + if (mpz_cmp (y, nm1) == 0) + return 1; + /* y == 1 means that the previous y was a non-trivial square root + of 1 (mod n). y == 0 means that n is a power of the base. + In either case, n is not prime. */ + if (mpz_cmp_ui (y, 1) <= 0) + return 0; + } + return 0; +} + +/* This product is 0xc0cfd797, and fits in 32 bits. */ +#define GMP_PRIME_PRODUCT \ + (3UL*5UL*7UL*11UL*13UL*17UL*19UL*23UL*29UL) + +/* Bit (p+1)/2 is set, for each odd prime <= 61 */ +#define GMP_PRIME_MASK 0xc96996dcUL + +int +mpz_probab_prime_p (const mpz_t n, int reps) +{ + mpz_t nm1; + mpz_t q; + mpz_t y; + mp_bitcnt_t k; + int is_prime; + int j; + + /* Note that we use the absolute value of n only, for compatibility + with the real GMP. */ + if (mpz_even_p (n)) + return (mpz_cmpabs_ui (n, 2) == 0) ? 2 : 0; + + /* Above test excludes n == 0 */ + assert (n->_mp_size != 0); + + if (mpz_cmpabs_ui (n, 64) < 0) + return (GMP_PRIME_MASK >> (n->_mp_d[0] >> 1)) & 2; + + if (mpz_gcd_ui (NULL, n, GMP_PRIME_PRODUCT) != 1) + return 0; + + /* All prime factors are >= 31. */ + if (mpz_cmpabs_ui (n, 31*31) < 0) + return 2; + + /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] = + j^2 + j + 41 using Euler's polynomial. We potentially stop early, + if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps > + 30 (a[30] == 971 > 31*31 == 961). */ + + mpz_init (nm1); + mpz_init (q); + mpz_init (y); + + /* Find q and k, where q is odd and n = 1 + 2**k * q. */ + nm1->_mp_size = mpz_abs_sub_ui (nm1, n, 1); + k = mpz_scan1 (nm1, 0); + mpz_tdiv_q_2exp (q, nm1, k); + + for (j = 0, is_prime = 1; is_prime & (j < reps); j++) + { + mpz_set_ui (y, (unsigned long) j*j+j+41); + if (mpz_cmp (y, nm1) >= 0) + { + /* Don't try any further bases. This "early" break does not affect + the result for any reasonable reps value (<=5000 was tested) */ + assert (j >= 30); + break; + } + is_prime = gmp_millerrabin (n, nm1, y, q, k); + } + mpz_clear (nm1); + mpz_clear (q); + mpz_clear (y); + + return is_prime; +} + + +/* Logical operations and bit manipulation. */ + +/* Numbers are treated as if represented in two's complement (and + infinitely sign extended). For a negative values we get the two's + complement from -x = ~x + 1, where ~ is bitwise complement. + Negation transforms + + xxxx10...0 + + into + + yyyy10...0 + + where yyyy is the bitwise complement of xxxx. So least significant + bits, up to and including the first one bit, are unchanged, and + the more significant bits are all complemented. + + To change a bit from zero to one in a negative number, subtract the + corresponding power of two from the absolute value. This can never + underflow. To change a bit from one to zero, add the corresponding + power of two, and this might overflow. E.g., if x = -001111, the + two's complement is 110001. Clearing the least significant bit, we + get two's complement 110000, and -010000. */ + +int +mpz_tstbit (const mpz_t d, mp_bitcnt_t bit_index) +{ + mp_size_t limb_index; + unsigned shift; + mp_size_t ds; + mp_size_t dn; + mp_limb_t w; + int bit; + + ds = d->_mp_size; + dn = GMP_ABS (ds); + limb_index = bit_index / GMP_LIMB_BITS; + if (limb_index >= dn) + return ds < 0; + + shift = bit_index % GMP_LIMB_BITS; + w = d->_mp_d[limb_index]; + bit = (w >> shift) & 1; + + if (ds < 0) + { + /* d < 0. Check if any of the bits below is set: If so, our bit + must be complemented. */ + if (shift > 0 && (w << (GMP_LIMB_BITS - shift)) > 0) + return bit ^ 1; + while (--limb_index >= 0) + if (d->_mp_d[limb_index] > 0) + return bit ^ 1; + } + return bit; +} + +static void +mpz_abs_add_bit (mpz_t d, mp_bitcnt_t bit_index) +{ + mp_size_t dn, limb_index; + mp_limb_t bit; + mp_ptr dp; + + dn = GMP_ABS (d->_mp_size); + + limb_index = bit_index / GMP_LIMB_BITS; + bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS); + + if (limb_index >= dn) + { + mp_size_t i; + /* The bit should be set outside of the end of the number. + We have to increase the size of the number. */ + dp = MPZ_REALLOC (d, limb_index + 1); + + dp[limb_index] = bit; + for (i = dn; i < limb_index; i++) + dp[i] = 0; + dn = limb_index + 1; + } + else + { + mp_limb_t cy; + + dp = d->_mp_d; + + cy = mpn_add_1 (dp + limb_index, dp + limb_index, dn - limb_index, bit); + if (cy > 0) + { + dp = MPZ_REALLOC (d, dn + 1); + dp[dn++] = cy; + } + } + + d->_mp_size = (d->_mp_size < 0) ? - dn : dn; +} + +static void +mpz_abs_sub_bit (mpz_t d, mp_bitcnt_t bit_index) +{ + mp_size_t dn, limb_index; + mp_ptr dp; + mp_limb_t bit; + + dn = GMP_ABS (d->_mp_size); + dp = d->_mp_d; + + limb_index = bit_index / GMP_LIMB_BITS; + bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS); + + assert (limb_index < dn); + + gmp_assert_nocarry (mpn_sub_1 (dp + limb_index, dp + limb_index, + dn - limb_index, bit)); + dn = mpn_normalized_size (dp, dn); + d->_mp_size = (d->_mp_size < 0) ? - dn : dn; +} + +void +mpz_setbit (mpz_t d, mp_bitcnt_t bit_index) +{ + if (!mpz_tstbit (d, bit_index)) + { + if (d->_mp_size >= 0) + mpz_abs_add_bit (d, bit_index); + else + mpz_abs_sub_bit (d, bit_index); + } +} + +void +mpz_clrbit (mpz_t d, mp_bitcnt_t bit_index) +{ + if (mpz_tstbit (d, bit_index)) + { + if (d->_mp_size >= 0) + mpz_abs_sub_bit (d, bit_index); + else + mpz_abs_add_bit (d, bit_index); + } +} + +void +mpz_combit (mpz_t d, mp_bitcnt_t bit_index) +{ + if (mpz_tstbit (d, bit_index) ^ (d->_mp_size < 0)) + mpz_abs_sub_bit (d, bit_index); + else + mpz_abs_add_bit (d, bit_index); +} + +void +mpz_com (mpz_t r, const mpz_t u) +{ + mpz_neg (r, u); + mpz_sub_ui (r, r, 1); +} + +void +mpz_and (mpz_t r, const mpz_t u, const mpz_t v) +{ + mp_size_t un, vn, rn, i; + mp_ptr up, vp, rp; + + mp_limb_t ux, vx, rx; + mp_limb_t uc, vc, rc; + mp_limb_t ul, vl, rl; + + un = GMP_ABS (u->_mp_size); + vn = GMP_ABS (v->_mp_size); + if (un < vn) + { + MPZ_SRCPTR_SWAP (u, v); + MP_SIZE_T_SWAP (un, vn); + } + if (vn == 0) + { + r->_mp_size = 0; + return; + } + + uc = u->_mp_size < 0; + vc = v->_mp_size < 0; + rc = uc & vc; + + ux = -uc; + vx = -vc; + rx = -rc; + + /* If the smaller input is positive, higher limbs don't matter. */ + rn = vx ? un : vn; + + rp = MPZ_REALLOC (r, rn + rc); + + up = u->_mp_d; + vp = v->_mp_d; + + i = 0; + do + { + ul = (up[i] ^ ux) + uc; + uc = ul < uc; + + vl = (vp[i] ^ vx) + vc; + vc = vl < vc; + + rl = ( (ul & vl) ^ rx) + rc; + rc = rl < rc; + rp[i] = rl; + } + while (++i < vn); + assert (vc == 0); + + for (; i < rn; i++) + { + ul = (up[i] ^ ux) + uc; + uc = ul < uc; + + rl = ( (ul & vx) ^ rx) + rc; + rc = rl < rc; + rp[i] = rl; + } + if (rc) + rp[rn++] = rc; + else + rn = mpn_normalized_size (rp, rn); + + r->_mp_size = rx ? -rn : rn; +} + +void +mpz_ior (mpz_t r, const mpz_t u, const mpz_t v) +{ + mp_size_t un, vn, rn, i; + mp_ptr up, vp, rp; + + mp_limb_t ux, vx, rx; + mp_limb_t uc, vc, rc; + mp_limb_t ul, vl, rl; + + un = GMP_ABS (u->_mp_size); + vn = GMP_ABS (v->_mp_size); + if (un < vn) + { + MPZ_SRCPTR_SWAP (u, v); + MP_SIZE_T_SWAP (un, vn); + } + if (vn == 0) + { + mpz_set (r, u); + return; + } + + uc = u->_mp_size < 0; + vc = v->_mp_size < 0; + rc = uc | vc; + + ux = -uc; + vx = -vc; + rx = -rc; + + /* If the smaller input is negative, by sign extension higher limbs + don't matter. */ + rn = vx ? vn : un; + + rp = MPZ_REALLOC (r, rn + rc); + + up = u->_mp_d; + vp = v->_mp_d; + + i = 0; + do + { + ul = (up[i] ^ ux) + uc; + uc = ul < uc; + + vl = (vp[i] ^ vx) + vc; + vc = vl < vc; + + rl = ( (ul | vl) ^ rx) + rc; + rc = rl < rc; + rp[i] = rl; + } + while (++i < vn); + assert (vc == 0); + + for (; i < rn; i++) + { + ul = (up[i] ^ ux) + uc; + uc = ul < uc; + + rl = ( (ul | vx) ^ rx) + rc; + rc = rl < rc; + rp[i] = rl; + } + if (rc) + rp[rn++] = rc; + else + rn = mpn_normalized_size (rp, rn); + + r->_mp_size = rx ? -rn : rn; +} + +void +mpz_xor (mpz_t r, const mpz_t u, const mpz_t v) +{ + mp_size_t un, vn, i; + mp_ptr up, vp, rp; + + mp_limb_t ux, vx, rx; + mp_limb_t uc, vc, rc; + mp_limb_t ul, vl, rl; + + un = GMP_ABS (u->_mp_size); + vn = GMP_ABS (v->_mp_size); + if (un < vn) + { + MPZ_SRCPTR_SWAP (u, v); + MP_SIZE_T_SWAP (un, vn); + } + if (vn == 0) + { + mpz_set (r, u); + return; + } + + uc = u->_mp_size < 0; + vc = v->_mp_size < 0; + rc = uc ^ vc; + + ux = -uc; + vx = -vc; + rx = -rc; + + rp = MPZ_REALLOC (r, un + rc); + + up = u->_mp_d; + vp = v->_mp_d; + + i = 0; + do + { + ul = (up[i] ^ ux) + uc; + uc = ul < uc; + + vl = (vp[i] ^ vx) + vc; + vc = vl < vc; + + rl = (ul ^ vl ^ rx) + rc; + rc = rl < rc; + rp[i] = rl; + } + while (++i < vn); + assert (vc == 0); + + for (; i < un; i++) + { + ul = (up[i] ^ ux) + uc; + uc = ul < uc; + + rl = (ul ^ ux) + rc; + rc = rl < rc; + rp[i] = rl; + } + if (rc) + rp[un++] = rc; + else + un = mpn_normalized_size (rp, un); + + r->_mp_size = rx ? -un : un; +} + +static unsigned +gmp_popcount_limb (mp_limb_t x) +{ + unsigned c; + + /* Do 16 bits at a time, to avoid limb-sized constants. */ + for (c = 0; x > 0; x >>= 16) + { + unsigned w = ((x >> 1) & 0x5555) + (x & 0x5555); + w = ((w >> 2) & 0x3333) + (w & 0x3333); + w = ((w >> 4) & 0x0f0f) + (w & 0x0f0f); + w = (w >> 8) + (w & 0x00ff); + c += w; + } + return c; +} + +mp_bitcnt_t +mpn_popcount (mp_srcptr p, mp_size_t n) +{ + mp_size_t i; + mp_bitcnt_t c; + + for (c = 0, i = 0; i < n; i++) + c += gmp_popcount_limb (p[i]); + + return c; +} + +mp_bitcnt_t +mpz_popcount (const mpz_t u) +{ + mp_size_t un; + + un = u->_mp_size; + + if (un < 0) + return ~(mp_bitcnt_t) 0; + + return mpn_popcount (u->_mp_d, un); +} + +mp_bitcnt_t +mpz_hamdist (const mpz_t u, const mpz_t v) +{ + mp_size_t un, vn, i; + mp_limb_t uc, vc, ul, vl, comp; + mp_srcptr up, vp; + mp_bitcnt_t c; + + un = u->_mp_size; + vn = v->_mp_size; + + if ( (un ^ vn) < 0) + return ~(mp_bitcnt_t) 0; + + comp = - (uc = vc = (un < 0)); + if (uc) + { + assert (vn < 0); + un = -un; + vn = -vn; + } + + up = u->_mp_d; + vp = v->_mp_d; + + if (un < vn) + MPN_SRCPTR_SWAP (up, un, vp, vn); + + for (i = 0, c = 0; i < vn; i++) + { + ul = (up[i] ^ comp) + uc; + uc = ul < uc; + + vl = (vp[i] ^ comp) + vc; + vc = vl < vc; + + c += gmp_popcount_limb (ul ^ vl); + } + assert (vc == 0); + + for (; i < un; i++) + { + ul = (up[i] ^ comp) + uc; + uc = ul < uc; + + c += gmp_popcount_limb (ul ^ comp); + } + + return c; +} + +mp_bitcnt_t +mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit) +{ + mp_ptr up; + mp_size_t us, un, i; + mp_limb_t limb, ux; + + us = u->_mp_size; + un = GMP_ABS (us); + i = starting_bit / GMP_LIMB_BITS; + + /* Past the end there's no 1 bits for u>=0, or an immediate 1 bit + for u<0. Notice this test picks up any u==0 too. */ + if (i >= un) + return (us >= 0 ? ~(mp_bitcnt_t) 0 : starting_bit); + + up = u->_mp_d; + ux = 0; + limb = up[i]; + + if (starting_bit != 0) + { + if (us < 0) + { + ux = mpn_zero_p (up, i); + limb = ~ limb + ux; + ux = - (mp_limb_t) (limb >= ux); + } + + /* Mask to 0 all bits before starting_bit, thus ignoring them. */ + limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS)); + } + + return mpn_common_scan (limb, i, up, un, ux); +} + +mp_bitcnt_t +mpz_scan0 (const mpz_t u, mp_bitcnt_t starting_bit) +{ + mp_ptr up; + mp_size_t us, un, i; + mp_limb_t limb, ux; + + us = u->_mp_size; + ux = - (mp_limb_t) (us >= 0); + un = GMP_ABS (us); + i = starting_bit / GMP_LIMB_BITS; + + /* When past end, there's an immediate 0 bit for u>=0, or no 0 bits for + u<0. Notice this test picks up all cases of u==0 too. */ + if (i >= un) + return (ux ? starting_bit : ~(mp_bitcnt_t) 0); + + up = u->_mp_d; + limb = up[i] ^ ux; + + if (ux == 0) + limb -= mpn_zero_p (up, i); /* limb = ~(~limb + zero_p) */ + + /* Mask all bits before starting_bit, thus ignoring them. */ + limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS)); + + return mpn_common_scan (limb, i, up, un, ux); +} + + +/* MPZ base conversion. */ + +size_t +mpz_sizeinbase (const mpz_t u, int base) +{ + mp_size_t un; + mp_srcptr up; + mp_ptr tp; + mp_bitcnt_t bits; + struct gmp_div_inverse bi; + size_t ndigits; + + assert (base >= 2); + assert (base <= 36); + + un = GMP_ABS (u->_mp_size); + if (un == 0) + return 1; + + up = u->_mp_d; + + bits = (un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1]); + switch (base) + { + case 2: + return bits; + case 4: + return (bits + 1) / 2; + case 8: + return (bits + 2) / 3; + case 16: + return (bits + 3) / 4; + case 32: + return (bits + 4) / 5; + /* FIXME: Do something more clever for the common case of base + 10. */ + } + + tp = gmp_xalloc_limbs (un); + mpn_copyi (tp, up, un); + mpn_div_qr_1_invert (&bi, base); + + ndigits = 0; + do + { + ndigits++; + mpn_div_qr_1_preinv (tp, tp, un, &bi); + un -= (tp[un-1] == 0); + } + while (un > 0); + + gmp_free (tp); + return ndigits; +} + +char * +mpz_get_str (char *sp, int base, const mpz_t u) +{ + unsigned bits; + const char *digits; + mp_size_t un; + size_t i, sn; + + if (base >= 0) + { + digits = "0123456789abcdefghijklmnopqrstuvwxyz"; + } + else + { + base = -base; + digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + } + if (base <= 1) + base = 10; + if (base > 36) + return NULL; + + sn = 1 + mpz_sizeinbase (u, base); + if (!sp) + sp = (char *) gmp_xalloc (1 + sn); + + un = GMP_ABS (u->_mp_size); + + if (un == 0) + { + sp[0] = '0'; + sp[1] = '\0'; + return sp; + } + + i = 0; + + if (u->_mp_size < 0) + sp[i++] = '-'; + + bits = mpn_base_power_of_two_p (base); + + if (bits) + /* Not modified in this case. */ + sn = i + mpn_get_str_bits ((unsigned char *) sp + i, bits, u->_mp_d, un); + else + { + struct mpn_base_info info; + mp_ptr tp; + + mpn_get_base_info (&info, base); + tp = gmp_xalloc_limbs (un); + mpn_copyi (tp, u->_mp_d, un); + + sn = i + mpn_get_str_other ((unsigned char *) sp + i, base, &info, tp, un); + gmp_free (tp); + } + + for (; i < sn; i++) + sp[i] = digits[(unsigned char) sp[i]]; + + sp[sn] = '\0'; + return sp; +} + +int +mpz_set_str (mpz_t r, const char *sp, int base) +{ + unsigned bits; + mp_size_t rn, alloc; + mp_ptr rp; + size_t sn; + int sign; + unsigned char *dp; + + assert (base == 0 || (base >= 2 && base <= 36)); + + while (isspace( (unsigned char) *sp)) + sp++; + + sign = (*sp == '-'); + sp += sign; + + if (base == 0) + { + if (*sp == '0') + { + sp++; + if (*sp == 'x' || *sp == 'X') + { + base = 16; + sp++; + } + else if (*sp == 'b' || *sp == 'B') + { + base = 2; + sp++; + } + else + base = 8; + } + else + base = 10; + } + + sn = strlen (sp); + dp = (unsigned char *) gmp_xalloc (sn + (sn == 0)); + + for (sn = 0; *sp; sp++) + { + unsigned digit; + + if (isspace ((unsigned char) *sp)) + continue; + if (*sp >= '0' && *sp <= '9') + digit = *sp - '0'; + else if (*sp >= 'a' && *sp <= 'z') + digit = *sp - 'a' + 10; + else if (*sp >= 'A' && *sp <= 'Z') + digit = *sp - 'A' + 10; + else + digit = base; /* fail */ + + if (digit >= base) + { + gmp_free (dp); + r->_mp_size = 0; + return -1; + } + + dp[sn++] = digit; + } + + bits = mpn_base_power_of_two_p (base); + + if (bits > 0) + { + alloc = (sn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; + rp = MPZ_REALLOC (r, alloc); + rn = mpn_set_str_bits (rp, dp, sn, bits); + } + else + { + struct mpn_base_info info; + mpn_get_base_info (&info, base); + alloc = (sn + info.exp - 1) / info.exp; + rp = MPZ_REALLOC (r, alloc); + rn = mpn_set_str_other (rp, dp, sn, base, &info); + } + assert (rn <= alloc); + gmp_free (dp); + + r->_mp_size = sign ? - rn : rn; + + return 0; +} + +int +mpz_init_set_str (mpz_t r, const char *sp, int base) +{ + mpz_init (r); + return mpz_set_str (r, sp, base); +} + +size_t +mpz_out_str (FILE *stream, int base, const mpz_t x) +{ + char *str; + size_t len; + + str = mpz_get_str (NULL, base, x); + len = strlen (str); + len = fwrite (str, 1, len, stream); + gmp_free (str); + return len; +} + + +static int +gmp_detect_endian (void) +{ + static const int i = 2; + const unsigned char *p = (const unsigned char *) &i; + return 1 - *p; +} + +/* Import and export. Does not support nails. */ +void +mpz_import (mpz_t r, size_t count, int order, size_t size, int endian, + size_t nails, const void *src) +{ + const unsigned char *p; + ptrdiff_t word_step; + mp_ptr rp; + mp_size_t rn; + + /* The current (partial) limb. */ + mp_limb_t limb; + /* The number of bytes already copied to this limb (starting from + the low end). */ + size_t bytes; + /* The index where the limb should be stored, when completed. */ + mp_size_t i; + + if (nails != 0) + gmp_die ("mpz_import: Nails not supported."); + + assert (order == 1 || order == -1); + assert (endian >= -1 && endian <= 1); + + if (endian == 0) + endian = gmp_detect_endian (); + + p = (unsigned char *) src; + + word_step = (order != endian) ? 2 * size : 0; + + /* Process bytes from the least significant end, so point p at the + least significant word. */ + if (order == 1) + { + p += size * (count - 1); + word_step = - word_step; + } + + /* And at least significant byte of that word. */ + if (endian == 1) + p += (size - 1); + + rn = (size * count + sizeof(mp_limb_t) - 1) / sizeof(mp_limb_t); + rp = MPZ_REALLOC (r, rn); + + for (limb = 0, bytes = 0, i = 0; count > 0; count--, p += word_step) + { + size_t j; + for (j = 0; j < size; j++, p -= (ptrdiff_t) endian) + { + limb |= (mp_limb_t) *p << (bytes++ * CHAR_BIT); + if (bytes == sizeof(mp_limb_t)) + { + rp[i++] = limb; + bytes = 0; + limb = 0; + } + } + } + assert (i + (bytes > 0) == rn); + if (limb != 0) + rp[i++] = limb; + else + i = mpn_normalized_size (rp, i); + + r->_mp_size = i; +} + +void * +mpz_export (void *r, size_t *countp, int order, size_t size, int endian, + size_t nails, const mpz_t u) +{ + size_t count; + mp_size_t un; + + if (nails != 0) + gmp_die ("mpz_import: Nails not supported."); + + assert (order == 1 || order == -1); + assert (endian >= -1 && endian <= 1); + assert (size > 0 || u->_mp_size == 0); + + un = u->_mp_size; + count = 0; + if (un != 0) + { + size_t k; + unsigned char *p; + ptrdiff_t word_step; + /* The current (partial) limb. */ + mp_limb_t limb; + /* The number of bytes left to to in this limb. */ + size_t bytes; + /* The index where the limb was read. */ + mp_size_t i; + + un = GMP_ABS (un); + + /* Count bytes in top limb. */ + limb = u->_mp_d[un-1]; + assert (limb != 0); + + k = 0; + do { + k++; limb >>= CHAR_BIT; + } while (limb != 0); + + count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size; + + if (!r) + r = gmp_xalloc (count * size); + + if (endian == 0) + endian = gmp_detect_endian (); + + p = (unsigned char *) r; + + word_step = (order != endian) ? 2 * size : 0; + + /* Process bytes from the least significant end, so point p at the + least significant word. */ + if (order == 1) + { + p += size * (count - 1); + word_step = - word_step; + } + + /* And at least significant byte of that word. */ + if (endian == 1) + p += (size - 1); + + for (bytes = 0, i = 0, k = 0; k < count; k++, p += word_step) + { + size_t j; + for (j = 0; j < size; j++, p -= (ptrdiff_t) endian) + { + if (bytes == 0) + { + if (i < un) + limb = u->_mp_d[i++]; + bytes = sizeof (mp_limb_t); + } + *p = limb; + limb >>= CHAR_BIT; + bytes--; + } + } + assert (i == un); + assert (k == count); + } + + if (countp) + *countp = count; + + return r; +} diff --git a/source/mini-gmp.h b/source/mini-gmp.h new file mode 100644 index 000000000..450c3e561 --- /dev/null +++ b/source/mini-gmp.h @@ -0,0 +1,295 @@ +/* mini-gmp, a minimalistic implementation of a GNU GMP subset. + +Copyright 2011-2015 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + +or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + +or both in parallel, as here. + +The GNU MP Library 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 copies of the GNU General Public License and the +GNU Lesser General Public License along with the GNU MP Library. If not, +see https://www.gnu.org/licenses/. */ + +/* About mini-gmp: This is a minimal implementation of a subset of the + GMP interface. It is intended for inclusion into applications which + have modest bignums needs, as a fallback when the real GMP library + is not installed. + + This file defines the public interface. */ + +#ifndef __MINI_GMP_H__ +#define __MINI_GMP_H__ + +/* For size_t */ +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +void mp_set_memory_functions (void *(*) (size_t), + void *(*) (void *, size_t, size_t), + void (*) (void *, size_t)); + +void mp_get_memory_functions (void *(**) (size_t), + void *(**) (void *, size_t, size_t), + void (**) (void *, size_t)); + +typedef unsigned long mp_limb_t; +typedef long mp_size_t; +typedef unsigned long mp_bitcnt_t; + +typedef mp_limb_t *mp_ptr; +typedef const mp_limb_t *mp_srcptr; + +typedef struct +{ + int _mp_alloc; /* Number of *limbs* allocated and pointed + to by the _mp_d field. */ + int _mp_size; /* abs(_mp_size) is the number of limbs the + last field points to. If _mp_size is + negative this is a negative number. */ + mp_limb_t *_mp_d; /* Pointer to the limbs. */ +} __mpz_struct; + +typedef __mpz_struct mpz_t[1]; + +typedef __mpz_struct *mpz_ptr; +typedef const __mpz_struct *mpz_srcptr; + +extern const int mp_bits_per_limb; + +void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t); +void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t); +void mpn_zero (mp_ptr, mp_size_t); + +int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t); +int mpn_zero_p (mp_srcptr, mp_size_t); + +mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); +mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); + +mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); +mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); + +mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); +mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); +mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); + +mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); +void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t); +int mpn_perfect_square_p (mp_srcptr, mp_size_t); +mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t); + +mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int); +mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int); + +mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t); +mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t); + +mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t); + +mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t); +#define mpn_invert_limb(x) mpn_invert_3by2 ((x), 0) + +size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t); +mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int); + +void mpz_init (mpz_t); +void mpz_init2 (mpz_t, mp_bitcnt_t); +void mpz_clear (mpz_t); + +#define mpz_odd_p(z) (((z)->_mp_size != 0) & (int) (z)->_mp_d[0]) +#define mpz_even_p(z) (! mpz_odd_p (z)) + +int mpz_sgn (const mpz_t); +int mpz_cmp_si (const mpz_t, long); +int mpz_cmp_ui (const mpz_t, unsigned long); +int mpz_cmp (const mpz_t, const mpz_t); +int mpz_cmpabs_ui (const mpz_t, unsigned long); +int mpz_cmpabs (const mpz_t, const mpz_t); +int mpz_cmp_d (const mpz_t, double); +int mpz_cmpabs_d (const mpz_t, double); + +void mpz_abs (mpz_t, const mpz_t); +void mpz_neg (mpz_t, const mpz_t); +void mpz_swap (mpz_t, mpz_t); + +void mpz_add_ui (mpz_t, const mpz_t, unsigned long); +void mpz_add (mpz_t, const mpz_t, const mpz_t); +void mpz_sub_ui (mpz_t, const mpz_t, unsigned long); +void mpz_ui_sub (mpz_t, unsigned long, const mpz_t); +void mpz_sub (mpz_t, const mpz_t, const mpz_t); + +void mpz_mul_si (mpz_t, const mpz_t, long int); +void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_mul (mpz_t, const mpz_t, const mpz_t); +void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_addmul (mpz_t, const mpz_t, const mpz_t); +void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_submul (mpz_t, const mpz_t, const mpz_t); + +void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t); +void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t); +void mpz_tdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t); +void mpz_cdiv_q (mpz_t, const mpz_t, const mpz_t); +void mpz_fdiv_q (mpz_t, const mpz_t, const mpz_t); +void mpz_tdiv_q (mpz_t, const mpz_t, const mpz_t); +void mpz_cdiv_r (mpz_t, const mpz_t, const mpz_t); +void mpz_fdiv_r (mpz_t, const mpz_t, const mpz_t); +void mpz_tdiv_r (mpz_t, const mpz_t, const mpz_t); + +void mpz_cdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_fdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_tdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_cdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_fdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_tdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t); + +void mpz_mod (mpz_t, const mpz_t, const mpz_t); + +void mpz_divexact (mpz_t, const mpz_t, const mpz_t); + +int mpz_divisible_p (const mpz_t, const mpz_t); +int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t); + +unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); +unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); +unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); +unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_cdiv_ui (const mpz_t, unsigned long); +unsigned long mpz_fdiv_ui (const mpz_t, unsigned long); +unsigned long mpz_tdiv_ui (const mpz_t, unsigned long); + +unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long); + +void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long); + +int mpz_divisible_ui_p (const mpz_t, unsigned long); + +unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long); +void mpz_gcd (mpz_t, const mpz_t, const mpz_t); +void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t); +void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long); +void mpz_lcm (mpz_t, const mpz_t, const mpz_t); +int mpz_invert (mpz_t, const mpz_t, const mpz_t); + +void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t); +void mpz_sqrt (mpz_t, const mpz_t); +int mpz_perfect_square_p (const mpz_t); + +void mpz_pow_ui (mpz_t, const mpz_t, unsigned long); +void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long); +void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t); +void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t); + +void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long); +int mpz_root (mpz_t, const mpz_t, unsigned long); + +void mpz_fac_ui (mpz_t, unsigned long); +void mpz_bin_uiui (mpz_t, unsigned long, unsigned long); + +int mpz_probab_prime_p (const mpz_t, int); + +int mpz_tstbit (const mpz_t, mp_bitcnt_t); +void mpz_setbit (mpz_t, mp_bitcnt_t); +void mpz_clrbit (mpz_t, mp_bitcnt_t); +void mpz_combit (mpz_t, mp_bitcnt_t); + +void mpz_com (mpz_t, const mpz_t); +void mpz_and (mpz_t, const mpz_t, const mpz_t); +void mpz_ior (mpz_t, const mpz_t, const mpz_t); +void mpz_xor (mpz_t, const mpz_t, const mpz_t); + +mp_bitcnt_t mpz_popcount (const mpz_t); +mp_bitcnt_t mpz_hamdist (const mpz_t, const mpz_t); +mp_bitcnt_t mpz_scan0 (const mpz_t, mp_bitcnt_t); +mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t); + +int mpz_fits_slong_p (const mpz_t); +int mpz_fits_ulong_p (const mpz_t); +long int mpz_get_si (const mpz_t); +unsigned long int mpz_get_ui (const mpz_t); +double mpz_get_d (const mpz_t); +size_t mpz_size (const mpz_t); +mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t); + +void mpz_realloc2 (mpz_t, mp_bitcnt_t); +mp_srcptr mpz_limbs_read (mpz_srcptr); +mp_ptr mpz_limbs_modify (mpz_t, mp_size_t); +mp_ptr mpz_limbs_write (mpz_t, mp_size_t); +void mpz_limbs_finish (mpz_t, mp_size_t); +mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t); + +#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }} + +void mpz_set_si (mpz_t, signed long int); +void mpz_set_ui (mpz_t, unsigned long int); +void mpz_set (mpz_t, const mpz_t); +void mpz_set_d (mpz_t, double); + +void mpz_init_set_si (mpz_t, signed long int); +void mpz_init_set_ui (mpz_t, unsigned long int); +void mpz_init_set (mpz_t, const mpz_t); +void mpz_init_set_d (mpz_t, double); + +size_t mpz_sizeinbase (const mpz_t, int); +char *mpz_get_str (char *, int, const mpz_t); +int mpz_set_str (mpz_t, const char *, int); +int mpz_init_set_str (mpz_t, const char *, int); + +/* This long list taken from gmp.h. */ +/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4, + defines EOF but not FILE. */ +#if defined (FILE) \ + || defined (H_STDIO) \ + || defined (_H_STDIO) /* AIX */ \ + || defined (_STDIO_H) /* glibc, Sun, SCO */ \ + || defined (_STDIO_H_) /* BSD, OSF */ \ + || defined (__STDIO_H) /* Borland */ \ + || defined (__STDIO_H__) /* IRIX */ \ + || defined (_STDIO_INCLUDED) /* HPUX */ \ + || defined (__dj_include_stdio_h_) /* DJGPP */ \ + || defined (_FILE_DEFINED) /* Microsoft */ \ + || defined (__STDIO__) /* Apple MPW MrC */ \ + || defined (_MSL_STDIO_H) /* Metrowerks */ \ + || defined (_STDIO_H_INCLUDED) /* QNX4 */ \ + || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \ + || defined (__STDIO_LOADED) /* VMS */ +size_t mpz_out_str (FILE *, int, const mpz_t); +#endif + +void mpz_import (mpz_t, size_t, int, size_t, int, size_t, const void *); +void *mpz_export (void *, size_t *, int, size_t, int, size_t, const mpz_t); + +#if defined (__cplusplus) +} +#endif +#endif /* __MINI_GMP_H__ */ diff --git a/source/rsa.c b/source/rsa.c new file mode 100644 index 000000000..73a4b0a29 --- /dev/null +++ b/source/rsa.c @@ -0,0 +1,69 @@ +#include "rsa.h" + +static unsigned char modulus[] = { + 0xb6, 0x1e, 0x19, 0x20, 0x91, 0xf9, 0x0a, 0x8f, 0x76, 0xa6, 0xea, 0xaa, 0x9a, 0x3c, 0xe5, 0x8c, 0x86, 0x3f, + 0x39, 0xae, 0x25, 0x3f, 0x03, 0x78, 0x16, 0xf5, 0x97, 0x58, 0x54, 0xe0, 0x7a, 0x9a, 0x45, 0x66, 0x01, + 0xe7, 0xc9, 0x4c, 0x29, 0x75, 0x9f, 0xe1, 0x55, 0xc0, 0x64, 0xed, 0xdf, 0xa1, 0x11, 0x44, 0x3f, 0x81, + 0xef, 0x1a, 0x42, 0x8c, 0xf6, 0xcd, 0x32, 0xf9, 0xda, 0xc9, 0xd4, 0x8e, 0x94, 0xcf, 0xb3, 0xf6, 0x90, + 0x12, 0x0e, 0x8e, 0x6b, 0x91, 0x11, 0xad, 0xda, 0xf1, 0x1e, 0x7c, 0x96, 0x20, 0x8c, 0x37, 0xc0, 0x14, + 0x3f, 0xf2, 0xbf, 0x3d, 0x7e, 0x83, 0x11, 0x41, 0xa9, 0x73 +}; + +static unsigned char privkey[] = { + 0x77, 0x54, 0x55, 0x66, 0x8f, 0xff, 0x3c, 0xba, 0x30, 0x26, 0xc2, 0xd0, 0xb2, 0x6b, 0x80, + 0x85, 0x89, 0x59, 0x58, 0x34, 0x11, 0x57, 0xae, 0xb0, 0x3b, 0x6b, 0x04, 0x95, 0xee, 0x57, 0x80, 0x3e, + 0x21, 0x86, 0xeb, 0x6c, 0xb2, 0xeb, 0x62, 0xa7, 0x1d, 0xf1, 0x8a, 0x3c, 0x9c, 0x65, 0x79, 0x07, 0x76, + 0x70, 0x96, 0x1b, 0x3a, 0x61, 0x02, 0xda, 0xbe, 0x5a, 0x19, 0x4a, 0xb5, 0x8c, 0x32, 0x50, 0xae, 0xd5, + 0x97, 0xfc, 0x78, 0x97, 0x8a, 0x32, 0x6d, 0xb1, 0xd7, 0xb2, 0x8d, 0xcc, 0xcb, 0x2a, 0x3e, 0x01, 0x4e, + 0xdb, 0xd3, 0x97, 0xad, 0x33, 0xb8, 0xf2, 0x8c, 0xd5, 0x25, 0x05, 0x42, 0x51 +}; + +void rsa_decrypt(unsigned char *input, unsigned char *output) +{ + unsigned char buf[RSA_BYTES]; + size_t outlen; + + mpz_t N; mpz_init(N); + mpz_t D; mpz_init(D); + mpz_t in_mpz; mpz_init(in_mpz); + mpz_t out_mpz; mpz_init(out_mpz); + + mpz_import(N, RSA_BYTES, 1, 1, 1, 0, modulus); + mpz_import(D, RSA_BYTES, 1, 1, 1, 0, privkey); + mpz_import(in_mpz, RSA_BYTES, 1, 1, 1, 0, input); + + mpz_powm(out_mpz, in_mpz, D, N); + + + mpz_export(buf, &outlen, 1, 1, 1, 0, out_mpz); + + for (int i = 0; i < RSA_BYTES - outlen; i++) + { + output[i] = 0x00; + } + memcpy(output + (RSA_BYTES - outlen), buf, outlen); +} + +void rsa_encrypt(unsigned char *input, unsigned char *output) +{ + unsigned char buf[RSA_BYTES]; + size_t outlen; + + mpz_t N; mpz_init(N); + mpz_t in_mpz; mpz_init(in_mpz); + mpz_t out_mpz; mpz_init(out_mpz); + + mpz_import(N, RSA_BYTES, 1, 1, 1, 0, modulus); + mpz_import(in_mpz, RSA_BYTES, 1, 1, 1, 0, input); + + mpz_powm_ui(out_mpz, in_mpz, 0x10001, N); + + + mpz_export(buf, &outlen, 1, 1, 1, 0, out_mpz); + + for (int i = 0; i < RSA_BYTES - outlen; i++) + { + output[i] = 0x00; + } + memcpy(output + (RSA_BYTES - outlen), buf, outlen); +} \ No newline at end of file diff --git a/source/rsa.h b/source/rsa.h new file mode 100644 index 000000000..54b2f980e --- /dev/null +++ b/source/rsa.h @@ -0,0 +1,14 @@ +#ifndef _RSA_H_ +#define _RSA_H_ + +#include "mini-gmp.h" +#include + +#define RSA_BITS 768 + +#define RSA_BYTES (RSA_BITS/8) + +void rsa_decrypt(unsigned char *input, unsigned char *output); +void rsa_encrypt(unsigned char *input, unsigned char *output); + +#endif //_RSA_H_ \ No newline at end of file diff --git a/source/save.c b/source/save.c new file mode 100644 index 000000000..6587a4b37 --- /dev/null +++ b/source/save.c @@ -0,0 +1,350 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include <3ds.h> +#include +#include "graphic.h" +#include "editor.h" +#include "util.h" +#include "memecrypto.h" +#include "save.h" + +u16 crc16[] = { + 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, + 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, + 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, + 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, + 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, + 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, + 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, + 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, + 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, + 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, + 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, + 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, + 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, + 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, + 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, + 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, + 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, + 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, + 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, + 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, + 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, + 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, + 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, + 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, + 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, + 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, + 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, + 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, + 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, + 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, + 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, + 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 +}; + +int getActiveGBO(u8* mainbuf, int game) { + int ofs = 0; + int generalBlock = -1; + + int k = 0; + u8 temp[10]; + + memcpy(&temp, mainbuf, 10); + for (int t = 0; t < 10; t++) + if (temp[t] == 0xFF) + k++; + if (k == 10) + return 1; + + k = 0; + memcpy(&temp, &mainbuf[0x40000], 10); + for (int t = 0; t < 10; t++) + if (temp[t] == 0xFF) + k++; + if (k == 10) + return 1; + + if (game == GAME_HG || game == GAME_SS) + ofs = 0xF618; + else if (game == GAME_PLATINUM) + ofs = 0xCF1C; + else if (game == GAME_DIAMOND || game == GAME_PEARL) + ofs = 0xC0F0; + + u16 c1; + u16 c2; + memcpy(&c1, &mainbuf[ofs], 2); + memcpy(&c2, &mainbuf[ofs + 0x40000], 2); + + generalBlock = (c1 >= c2) ? 0 : 1; + + return generalBlock; +} + +int getActiveSBO(u8* mainbuf, int game) { + int ofs = 0; + int storageBlock = -1; + + if (game == GAME_HG || game == GAME_SS) + ofs = 0x21A00; + else if (game == GAME_PLATINUM) + ofs = 0x1F100; + else if (game == GAME_DIAMOND || game == GAME_PEARL) + ofs = 0x1E2D0; + + int k = 0; + u8 temp[10]; + + memcpy(&temp, &mainbuf[ofs], 10); + for (int t = 0; t < 10; t++) + if (temp[t] == 0xFF) + k++; + if (k == 10) + return 1; + + k = 0; + memcpy(&temp, &mainbuf[ofs + 0x40000], 10); + for (int t = 0; t < 10; t++) + if (temp[t] == 0xFF) + k++; + if (k == 10) + return 0; + + u16 c1; + u16 c2; + memcpy(&c1, &mainbuf[ofs], 2); + memcpy(&c2, &mainbuf[ofs + 0x40000], 2); + + storageBlock = (c1 >= c2) ? 0 : 1; + + return storageBlock; +} + +u32 CHKOffset(u32 i, int game) { + if (game == GAME_X || game == GAME_Y) { + const u32 _xy[] = { 0x05400, 0x05800, 0x06400, 0x06600, 0x06800, 0x06A00, 0x06C00, 0x06E00, 0x07000, 0x07200, 0x07400, 0x09600, 0x09800, 0x09E00, 0x0A400, 0x0F400, 0x14400, 0x19400, 0x19600, 0x19E00, 0x1A400, 0x1AC00, 0x1B400, 0x1B600, 0x1B800, 0x1BE00, 0x1C000, 0x1C400, 0x1CC00, 0x1CE00, 0x1D000, 0x1D200, 0x1D400, 0x1D600, 0x1DE00, 0x1E400, 0x1E800, 0x20400, 0x20600, 0x20800, 0x20C00, 0x21000, 0x22C00, 0x23000, 0x23800, 0x23C00, 0x24600, 0x24A00, 0x25200, 0x26000, 0x26200, 0x26400, 0x27200, 0x27A00, 0x5C600, }; + return _xy[i] - 0x5400; + } + else if (game == GAME_OR || game == GAME_AS) { + const u32 _oras[] = { 0x05400, 0x05800, 0x06400, 0x06600, 0x06800, 0x06A00, 0x06C00, 0x06E00, 0x07000, 0x07200, 0x07400, 0x09600, 0x09800, 0x09E00, 0x0A400, 0x0F400, 0x14400, 0x19400, 0x19600, 0x19E00, 0x1A400, 0x1B600, 0x1BE00, 0x1C000, 0x1C200, 0x1C800, 0x1CA00, 0x1CE00, 0x1D600, 0x1D800, 0x1DA00, 0x1DC00, 0x1DE00, 0x1E000, 0x1E800, 0x1EE00, 0x1F200, 0x20E00, 0x21000, 0x21400, 0x21800, 0x22000, 0x23C00, 0x24000, 0x24800, 0x24C00, 0x25600, 0x25A00, 0x26200, 0x27000, 0x27200, 0x27400, 0x28200, 0x28A00, 0x28E00, 0x30A00, 0x38400, 0x6D000, }; + return _oras[i] - 0x5400; + } + else if (game == GAME_SUN || game == GAME_MOON) { + const u32 _sm[] = { 0x00000, 0x00E00, 0x01000, 0x01200, 0x01400, 0x01C00, 0x02A00, 0x03A00, 0x03E00, 0x04000, 0x04200, 0x04400, 0x04600, 0x04800, 0x04E00, 0x3B400, 0x40C00, 0x40E00, 0x42000, 0x43C00, 0x4A200, 0x50800, 0x54200, 0x54400, 0x54600, 0x64C00, 0x65000, 0x65C00, 0x69C00, 0x6A000, 0x6A800, 0x6AA00, 0x6B200, 0x6B400, 0x6B600, 0x6B800, 0x6BA00 }; + return _sm[i]; + } + else if (game == GAME_B1 || game == GAME_W1) { + const u32 _bw[] = { 0x1C800, 0x23F00 }; + return _bw[i]; + } + else if (game == GAME_B2 || game == GAME_W2) { + const u32 _b2w2[] = { 0x1C800, 0x25F00 }; + return _b2w2[i]; + } + else return 0; +} + +u32 CHKLength(u32 i, int game) { + if (game == GAME_X || game == GAME_Y) { + const u32 _xy[] = { 0x002C8, 0x00B88, 0x0002C, 0x00038, 0x00150, 0x00004, 0x00008, 0x001C0, 0x000BE, 0x00024, 0x02100, 0x00140, 0x00440, 0x00574, 0x04E28, 0x04E28, 0x04E28, 0x00170, 0x0061C, 0x00504, 0x006A0, 0x00644, 0x00104, 0x00004, 0x00420, 0x00064, 0x003F0, 0x0070C, 0x00180, 0x00004, 0x0000C, 0x00048, 0x00054, 0x00644, 0x005C8, 0x002F8, 0x01B40, 0x001F4, 0x001F0, 0x00216, 0x00390, 0x01A90, 0x00308, 0x00618, 0x0025C, 0x00834, 0x00318, 0x007D0, 0x00C48, 0x00078, 0x00200, 0x00C84, 0x00628, 0x34AD0, 0x0E058, }; + return _xy[i]; + } + else if (game == GAME_OR || game == GAME_AS) { + const u32 _oras[] = { 0x002C8, 0x00B90, 0x0002C, 0x00038, 0x00150, 0x00004, 0x00008, 0x001C0, 0x000BE, 0x00024, 0x02100, 0x00130, 0x00440, 0x00574, 0x04E28, 0x04E28, 0x04E28, 0x00170, 0x0061C, 0x00504, 0x011CC, 0x00644, 0x00104, 0x00004, 0x00420, 0x00064, 0x003F0, 0x0070C, 0x00180, 0x00004, 0x0000C, 0x00048, 0x00054, 0x00644, 0x005C8, 0x002F8, 0x01B40, 0x001F4, 0x003E0, 0x00216, 0x00640, 0x01A90, 0x00400, 0x00618, 0x0025C, 0x00834, 0x00318, 0x007D0, 0x00C48, 0x00078, 0x00200, 0x00C84, 0x00628, 0x00400, 0x07AD0, 0x078B0, 0x34AD0, 0x0E058, }; + return _oras[i]; + } + else if (game == GAME_SUN || game == GAME_MOON) { + const u32 _sm[] = { 0xDE0, 0x07C, 0x014, 0x0C0, 0x61C, 0xE00, 0xF78, 0x228, 0x104, 0x200, 0x020, 0x004, 0x058, 0x5E6, 0x36600, 0x572C, 0x008, 0x1080, 0x1A08, 0x6408, 0x6408, 0x3998, 0x100, 0x100, 0x10528, 0x204, 0xB60, 0x3F50, 0x358, 0x728, 0x200, 0x718, 0x1FC, 0x200, 0x120, 0x1C8, 0x200 }; + return _sm[i]; + } + else if (game == GAME_W1 || game == GAME_B1) { + const u32 _bw[] = { 0x0A94, 0x008C }; + return _bw[i]; + } + else if (game == GAME_W2 || game == GAME_B2) { + const u32 _b2w2[] = { 0x0A94, 0x0094 }; + return _b2w2[i]; + } + else return 0; +} + +u16 getBlockID(u8* mainbuf, int csoff, u32 i) { + u16 id; + memcpy(&id, &mainbuf[csoff + 8 * i - 2], sizeof(u16)); + return id; +} + +u32 BWCHKOff(u32 i, int game) { + if (game == GAME_B1 || game == GAME_W1) { + const u32 _bw[] = { 0x1D296, 0x23F9A }; + return _bw[i]; + } + else if (game == GAME_B2 || game == GAME_W2) { + const u32 _b2w2[]= { 0x1D296, 0x25FA2 }; + return _b2w2[i]; + } + else return 0; +} + +u32 BWCHKMirr(u32 i, int game) { + if (game == GAME_B1 || game == GAME_W1) { + const u32 _bw[] = { 0x23F44, 0x23F9A }; + return _bw[i]; + } + + else if (game == GAME_W2 || game == GAME_B2) { + const u32 _b2w2[] = { 0x25F44, 0x25FA2 }; + return _b2w2[i]; + } + + else return 0; +} + +u16 ccitt16(u8* data, u32 len) { + u16 crc = 0xFFFF; + + for (u32 i = 0; i < len; i++) { + crc ^= (u16) (data[i] << 8); + + for (u32 j = 0; j < 0x8; j++) { + if ((crc & 0x8000) > 0) + crc = (u16) ((crc << 1) ^ 0x1021); + else + crc <<= 1; + } + } + + return crc; +} + +u16 check16(u8 data[], u32 blockID, u32 len) { + u16 initial = 0; + + if (blockID == 36) { + u8 tmp[0x80]; + memset(tmp, 0, 0x80); + memcpy(&data[0x100], tmp, 0x80); + } + + u16 chk = ~initial; + + if (len > 1) { + int ofs = -1; + if (len % 2 == 0) { + ofs = 0; + chk = (crc16[(data[0] ^ chk) & 0xFF] ^ chk >> 8); + } + + for (int i = (len - 1) / 2; i != 0; i--, ofs += 2) { + u16 temp = crc16[(data[ofs + 1] ^ chk) & 0xFF]; + chk = (crc16[(data[ofs + 2] ^ temp ^ chk >> 8) & 0xFF] ^ (temp ^ chk >> 8) >> 8); + } + } + if (len > 0) + chk = (crc16[(data[len - 1] ^ chk) & 0xFF] ^ chk >> 8); + + return ~chk; +} + +void rewriteCHK(u8 *mainbuf, int game) { + u8 blockCount = 0; + u8* tmp = (u8*)malloc(0x36600 * sizeof(u8)); + u16 cs; + u32 csoff = 0; + + if (game == GAME_X || game == GAME_Y) { + blockCount = 55; + csoff = 0x6A81A - 0x5400; + } + + else if (game == GAME_OR || game == GAME_AS) { + blockCount = 58; + csoff = 0x7B21A - 0x5400; + } + + else if (game == GAME_SUN || game == GAME_MOON) { + blockCount = 37; + csoff = 0x6BE00 - 0x200 + 0x10 + 0x0A; + } + + if (game == GAME_X || game == GAME_Y || game == GAME_OR || game == GAME_AS) + for (u32 i = 0; i < blockCount; i++) { + memcpy(tmp, mainbuf + CHKOffset(i, game), CHKLength(i, game)); + cs = ccitt16(tmp, CHKLength(i, game)); + memcpy(mainbuf + csoff + i * 8, &cs, 2); + } + + else if (game == GAME_SUN || game == GAME_MOON) { + for (u32 i = 0; i < blockCount; i++) { + memcpy(tmp, mainbuf + CHKOffset(i, game), CHKLength(i, game)); + cs = check16(tmp, getBlockID(mainbuf, csoff, i), CHKLength(i, game)); + memcpy(mainbuf + csoff + i * 8, &cs, 2); + } + + resign(mainbuf); + } + + else if (game == GAME_B1 || game == GAME_W1 || game == GAME_B2 || game == GAME_W2) { + blockCount = 2; + for (u32 i = 0; i < blockCount; i++) { + memcpy(tmp, mainbuf + CHKOffset(i, game), CHKLength(i, game)); + cs = ccitt16(tmp, CHKLength(i, game)); + memcpy(mainbuf + BWCHKOff(i, game), &cs, 2); + memcpy(mainbuf + BWCHKMirr(i, game), &cs, 2); + } + } + + free(tmp); +} + +void rewriteCHK4(u8 *mainbuf, int game, int GBO, int SBO) { + u8* tmp = (u8*)malloc(0x35000 * sizeof(u8)); + u16 cs; + + if (game == GAME_DIAMOND || game == GAME_PEARL) { + memcpy(tmp, mainbuf + GBO, 0xC0EC); + cs = ccitt16(tmp, 0xC0EC); + memcpy(mainbuf + GBO + 0xC0FE, &cs, 2); + + memcpy(tmp, mainbuf + SBO + 0xC100, 0x121CC); + cs = ccitt16(tmp, 0x121CC); + memcpy(mainbuf + SBO + 0x1E2DE, &cs, 2); + } + else if (game == GAME_PLATINUM) { + memcpy(tmp, mainbuf + GBO, 0xCF18); + cs = ccitt16(tmp, 0xCF18); + memcpy(mainbuf + GBO + 0xCF2A, &cs, 2); + + memcpy(tmp, mainbuf + SBO + 0xCF2C, 0x121D0); + cs = ccitt16(tmp, 0x121D0); + memcpy(mainbuf + SBO + 0x1F10E, &cs, 2); + } + else if (game == GAME_HG || game == GAME_SS) { + memcpy(tmp, mainbuf + GBO, 0xF618); + cs = ccitt16(tmp, 0xF618); + memcpy(mainbuf + GBO + 0xF626, &cs, 2); + + memcpy(tmp, mainbuf + SBO + 0xF700, 0x12300); + cs = ccitt16(tmp, 0x12300); + memcpy(mainbuf + SBO + 0x21A0E, &cs, 2); + } + free(tmp); +} \ No newline at end of file diff --git a/source/save.h b/source/save.h new file mode 100644 index 000000000..812a6e186 --- /dev/null +++ b/source/save.h @@ -0,0 +1,32 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include <3ds.h> + +int getActiveGBO(u8* mainbuf, int game); +int getActiveSBO(u8* mainbuf, int game); +u32 CHKOffset(u32 i, int game); +u32 CHKLength(u32 i, int game); +u16 getBlockID(u8* mainbuf, int csoff, u32 i); +u16 ccitt16(u8* data, u32 len); +u16 check16(u8 data[], u32 blockID, u32 len); +u32 BWCHKOff(u32 i, int game); +u32 BWCHKMirr(u32 i, int game); +void rewriteCHK(u8 *mainbuf, int game); +void rewriteCHK4(u8 *mainbuf, int game, int GBO, int SBO); \ No newline at end of file diff --git a/source/sha1.c b/source/sha1.c new file mode 100644 index 000000000..48bef2b1c --- /dev/null +++ b/source/sha1.c @@ -0,0 +1,242 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 01/08/2005 + + This is a byte oriented version of SHA1 that operates on arrays of bytes + stored in memory. +*/ + +#include /* for memcpy() etc. */ + +#include "sha1.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#define SHA1_BLOCK_SIZE 64 + +#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) +#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) + +#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) + +#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) +#define bsw_32(p,n) \ + { int _i = (n); while(_i--) ((uint32_t*)p)[_i] = bswap_32(((uint32_t*)p)[_i]); } +#else +#define bsw_32(p,n) +#endif + +#define SHA1_MASK (SHA1_BLOCK_SIZE - 1) + +#if 0 + +#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define parity(x,y,z) ((x) ^ (y) ^ (z)) +#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +#else /* Discovered by Rich Schroeppel and Colin Plumb */ + +#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) +#define parity(x,y,z) ((x) ^ (y) ^ (z)) +#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) + +#endif + +/* Compile 64 bytes of hash data into SHA1 context. Note */ +/* that this routine assumes that the byte order in the */ +/* ctx->wbuf[] at this point is in such an order that low */ +/* address bytes in the ORIGINAL byte stream will go in */ +/* this buffer to the high end of 32-bit words on BOTH big */ +/* and little endian systems */ + +#ifdef ARRAY +#define q(v,n) v[n] +#else +#define q(v,n) v##n +#endif + +#define one_cycle(v,a,b,c,d,e,f,k,h) \ + q(v,e) += rotr32(q(v,a),27) + \ + f(q(v,b),q(v,c),q(v,d)) + k + h; \ + q(v,b) = rotr32(q(v,b), 2) + +#define five_cycle(v,f,k,i) \ + one_cycle(v, 0,1,2,3,4, f,k,hf(i )); \ + one_cycle(v, 4,0,1,2,3, f,k,hf(i+1)); \ + one_cycle(v, 3,4,0,1,2, f,k,hf(i+2)); \ + one_cycle(v, 2,3,4,0,1, f,k,hf(i+3)); \ + one_cycle(v, 1,2,3,4,0, f,k,hf(i+4)) + +static void sha1_compile(sha1_ctx ctx[1]) +{ uint32_t *w = ctx->wbuf; + +#ifdef ARRAY + uint32_t v[5]; + memcpy(v, ctx->hash, 5 * sizeof(uint32_t)); +#else + uint32_t v0, v1, v2, v3, v4; + v0 = ctx->hash[0]; v1 = ctx->hash[1]; + v2 = ctx->hash[2]; v3 = ctx->hash[3]; + v4 = ctx->hash[4]; +#endif + +#define hf(i) w[i] + + five_cycle(v, ch, 0x5a827999, 0); + five_cycle(v, ch, 0x5a827999, 5); + five_cycle(v, ch, 0x5a827999, 10); + one_cycle(v,0,1,2,3,4, ch, 0x5a827999, hf(15)); \ + +#undef hf +#define hf(i) (w[(i) & 15] = rotl32( \ + w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \ + ^ w[((i) + 2) & 15] ^ w[(i) & 15], 1)) + + one_cycle(v,4,0,1,2,3, ch, 0x5a827999, hf(16)); + one_cycle(v,3,4,0,1,2, ch, 0x5a827999, hf(17)); + one_cycle(v,2,3,4,0,1, ch, 0x5a827999, hf(18)); + one_cycle(v,1,2,3,4,0, ch, 0x5a827999, hf(19)); + + five_cycle(v, parity, 0x6ed9eba1, 20); + five_cycle(v, parity, 0x6ed9eba1, 25); + five_cycle(v, parity, 0x6ed9eba1, 30); + five_cycle(v, parity, 0x6ed9eba1, 35); + + five_cycle(v, maj, 0x8f1bbcdc, 40); + five_cycle(v, maj, 0x8f1bbcdc, 45); + five_cycle(v, maj, 0x8f1bbcdc, 50); + five_cycle(v, maj, 0x8f1bbcdc, 55); + + five_cycle(v, parity, 0xca62c1d6, 60); + five_cycle(v, parity, 0xca62c1d6, 65); + five_cycle(v, parity, 0xca62c1d6, 70); + five_cycle(v, parity, 0xca62c1d6, 75); + +#ifdef ARRAY + ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; + ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; + ctx->hash[4] += v[4]; +#else + ctx->hash[0] += v0; ctx->hash[1] += v1; + ctx->hash[2] += v2; ctx->hash[3] += v3; + ctx->hash[4] += v4; +#endif +} + +void sha1_begin(sha1_ctx ctx[1]) +{ + ctx->count[0] = ctx->count[1] = 0; + ctx->hash[0] = 0x67452301; + ctx->hash[1] = 0xefcdab89; + ctx->hash[2] = 0x98badcfe; + ctx->hash[3] = 0x10325476; + ctx->hash[4] = 0xc3d2e1f0; +} + +/* SHA1 hash data in an array of bytes into hash buffer and */ +/* call the hash_compile function as required. */ + +void sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1]) +{ uint32_t pos = (uint32_t)(ctx->count[0] & SHA1_MASK), + space = SHA1_BLOCK_SIZE - pos; + const unsigned char *sp = data; + + if((ctx->count[0] += len) < len) + ++(ctx->count[1]); + + while(len >= space) /* tranfer whole blocks if possible */ + { + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); + sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0; + bsw_32(ctx->wbuf, SHA1_BLOCK_SIZE >> 2); + sha1_compile(ctx); + } + + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); +} + +/* SHA1 final padding and digest calculation */ + +void sha1_end(unsigned char hval[], sha1_ctx ctx[1]) +{ uint32_t i = (uint32_t)(ctx->count[0] & SHA1_MASK); + + /* put bytes in the buffer in an order in which references to */ + /* 32-bit words will put bytes with lower addresses into the */ + /* top of 32 bit words on BOTH big and little endian machines */ + bsw_32(ctx->wbuf, (i + 3) >> 2); + + /* we now need to mask valid bytes and add the padding which is */ + /* a single 1 bit and as many zero bits as necessary. Note that */ + /* we can always add the first padding byte here because the */ + /* buffer always has at least one empty slot */ + ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); + ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); + + /* we need 9 or more empty positions, one for the padding byte */ + /* (above) and eight for the length count. If there is not */ + /* enough space, pad and empty the buffer */ + if(i > SHA1_BLOCK_SIZE - 9) + { + if(i < 60) ctx->wbuf[15] = 0; + sha1_compile(ctx); + i = 0; + } + else /* compute a word index for the empty buffer positions */ + i = (i >> 2) + 1; + + while(i < 14) /* and zero pad all but last two positions */ + ctx->wbuf[i++] = 0; + + /* the following 32-bit length fields are assembled in the */ + /* wrong byte order on little endian machines but this is */ + /* corrected later since they are only ever used as 32-bit */ + /* word values. */ + ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); + ctx->wbuf[15] = ctx->count[0] << 3; + sha1_compile(ctx); + + /* extract the hash value as bytes in case the hash buffer is */ + /* misaligned for 32-bit words */ + for(i = 0; i < SHA1_DIGEST_SIZE; ++i) + hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); +} + +void sha1(unsigned char hval[], const unsigned char data[], unsigned long len) +{ sha1_ctx cx[1]; + + sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx); +} + +#if defined(__cplusplus) +} +#endif diff --git a/source/sha1.h b/source/sha1.h new file mode 100644 index 000000000..b4dca93ba --- /dev/null +++ b/source/sha1.h @@ -0,0 +1,67 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 01/08/2005 +*/ + +#ifndef _SHA1_H +#define _SHA1_H + +#if defined(__cplusplus) +extern "C" +{ +#endif +#if 0 +} /* Appleasing Emacs */ +#endif + +#include + +/* Size of SHA1 digest */ + +#define SHA1_DIGEST_SIZE 20 + +/* type to hold the SHA1 context */ + +typedef struct +{ uint32_t count[2]; + uint32_t hash[5]; + uint32_t wbuf[16]; +} sha1_ctx; + +void sha1_begin(sha1_ctx ctx[1]); +void sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1]); +void sha1_end(unsigned char hval[], sha1_ctx ctx[1]); +void sha1(unsigned char hval[], const unsigned char data[], unsigned long len); + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/source/sha256.c b/source/sha256.c new file mode 100644 index 000000000..8b410b3fa --- /dev/null +++ b/source/sha256.c @@ -0,0 +1,158 @@ +/********************************************************************* +* Filename: sha256.c +* Author: Brad Conte (brad AT bradconte.com) +* Copyright: +* Disclaimer: This code is presented "as is" without any guarantees. +* Details: Implementation of the SHA-256 hashing algorithm. + SHA-256 is one of the three algorithms in the SHA2 + specification. The others, SHA-384 and SHA-512, are not + offered in this implementation. + Algorithm specification can be found here: + * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf + This implementation uses little endian byte order. +*********************************************************************/ + +/*************************** HEADER FILES ***************************/ +#include +#include +#include "sha256.h" + +/****************************** MACROS ******************************/ +#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b)))) +#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b)))) + +#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +#define EP0(x) (ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22)) +#define EP1(x) (ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,25)) +#define SIG0(x) (ROTRIGHT(x,7) ^ ROTRIGHT(x,18) ^ ((x) >> 3)) +#define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10)) + +/**************************** VARIABLES *****************************/ +static const WORD k[64] = { + 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, + 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174, + 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da, + 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967, + 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, + 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070, + 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3, + 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 +}; + +/*********************** FUNCTION DEFINITIONS ***********************/ +void sha256_transform(SHA256_CTX *ctx, const BYTE data[]) +{ + WORD a, b, c, d, e, f, g, h, i, j, t1, t2, m[64]; + + for (i = 0, j = 0; i < 16; ++i, j += 4) + m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]); + for ( ; i < 64; ++i) + m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16]; + + a = ctx->state[0]; + b = ctx->state[1]; + c = ctx->state[2]; + d = ctx->state[3]; + e = ctx->state[4]; + f = ctx->state[5]; + g = ctx->state[6]; + h = ctx->state[7]; + + for (i = 0; i < 64; ++i) { + t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i]; + t2 = EP0(a) + MAJ(a,b,c); + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + ctx->state[0] += a; + ctx->state[1] += b; + ctx->state[2] += c; + ctx->state[3] += d; + ctx->state[4] += e; + ctx->state[5] += f; + ctx->state[6] += g; + ctx->state[7] += h; +} + +void sha256_init(SHA256_CTX *ctx) +{ + ctx->datalen = 0; + ctx->bitlen = 0; + ctx->state[0] = 0x6a09e667; + ctx->state[1] = 0xbb67ae85; + ctx->state[2] = 0x3c6ef372; + ctx->state[3] = 0xa54ff53a; + ctx->state[4] = 0x510e527f; + ctx->state[5] = 0x9b05688c; + ctx->state[6] = 0x1f83d9ab; + ctx->state[7] = 0x5be0cd19; +} + +void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len) +{ + WORD i; + + for (i = 0; i < len; ++i) { + ctx->data[ctx->datalen] = data[i]; + ctx->datalen++; + if (ctx->datalen == 64) { + sha256_transform(ctx, ctx->data); + ctx->bitlen += 512; + ctx->datalen = 0; + } + } +} + +void sha256_final(SHA256_CTX *ctx, BYTE hash[]) +{ + WORD i; + + i = ctx->datalen; + + // Pad whatever data is left in the buffer. + if (ctx->datalen < 56) { + ctx->data[i++] = 0x80; + while (i < 56) + ctx->data[i++] = 0x00; + } + else { + ctx->data[i++] = 0x80; + while (i < 64) + ctx->data[i++] = 0x00; + sha256_transform(ctx, ctx->data); + memset(ctx->data, 0, 56); + } + + // Append to the padding the total message's length in bits and transform. + ctx->bitlen += ctx->datalen * 8; + ctx->data[63] = ctx->bitlen; + ctx->data[62] = ctx->bitlen >> 8; + ctx->data[61] = ctx->bitlen >> 16; + ctx->data[60] = ctx->bitlen >> 24; + ctx->data[59] = ctx->bitlen >> 32; + ctx->data[58] = ctx->bitlen >> 40; + ctx->data[57] = ctx->bitlen >> 48; + ctx->data[56] = ctx->bitlen >> 56; + sha256_transform(ctx, ctx->data); + + // Since this implementation uses little endian byte ordering and SHA uses big endian, + // reverse all the bytes when copying the final state to the output hash. + for (i = 0; i < 4; ++i) { + hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff; + hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff; + hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff; + hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff; + hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff; + hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff; + hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff; + hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff; + } +} \ No newline at end of file diff --git a/source/sha256.h b/source/sha256.h new file mode 100644 index 000000000..55e272e7f --- /dev/null +++ b/source/sha256.h @@ -0,0 +1,34 @@ +/********************************************************************* +* Filename: sha256.h +* Author: Brad Conte (brad AT bradconte.com) +* Copyright: +* Disclaimer: This code is presented "as is" without any guarantees. +* Details: Defines the API for the corresponding SHA1 implementation. +*********************************************************************/ + +#ifndef SHA256_H +#define SHA256_H + +/*************************** HEADER FILES ***************************/ +#include + +/****************************** MACROS ******************************/ +#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest + +/**************************** DATA TYPES ****************************/ +typedef unsigned char BYTE; // 8-bit byte +typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines + +typedef struct { + BYTE data[64]; + WORD datalen; + unsigned long long bitlen; + WORD state[8]; +} SHA256_CTX; + +/*********************** FUNCTION DECLARATIONS **********************/ +void sha256_init(SHA256_CTX *ctx); +void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len); +void sha256_final(SHA256_CTX *ctx, BYTE hash[]); + +#endif // SHA256_H \ No newline at end of file diff --git a/source/spi.c b/source/spi.c new file mode 100644 index 000000000..1b60a4ee7 --- /dev/null +++ b/source/spi.c @@ -0,0 +1,409 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include +#include +#include "spi.h" +#include "graphic.h" + +u8* fill_buf = NULL; + +u32 TWLsaveSize(CardType cardType_) { + return SPIGetCapacity(cardType_); +} + +void TWLstoreSaveFile(u8* out, CardType cardType_) { + u32 sz = TWLsaveSize(cardType_); + u32 sectorSize = (sz < 0x10000) ? sz : 0x10000; + + for (u32 i = 0; i < sz / sectorSize; ++i) { + SPIReadSaveData(cardType_, sectorSize * i, out + sectorSize * i, sectorSize); + } +} + +void TWLrestoreSaveFile(u8* in, CardType cardType_, u64 sz) { + u32 pageSize = SPIGetPageSize(cardType_); + + for (u32 i = 0; i < sz / pageSize; ++i) { + SPIWriteSaveData(cardType_, pageSize * i, in + pageSize * i, pageSize); + progressBar("Saving...", pageSize * (i + 1), sz); + } +} + +void TWLinjectSave(u8* mainbuf, u64 mainSize) { + u8 data[0x3B4]; + FSUSER_GetLegacyRomHeader(MEDIATYPE_GAME_CARD, 0LL, data); + CardType cardType_; + SPIGetCardType(&cardType_, (*(data + 12) == 'I') ? 1 : 0); + + TWLrestoreSaveFile(mainbuf, cardType_, mainSize); +} + +/* + * Lines under this were part of TWLSaveTool. + * Copyright (C) 2015-2016 TuxSH + * + * TWLSaveTool 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 2 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 + */ + +Result SPIWriteRead(CardType type, void* cmd, u32 cmdSize, void* answer, u32 answerSize, void* data, u32 dataSize) { + u8 transferOp = pxiDevMakeTransferOption(BAUDRATE_4MHZ, BUSMODE_1BIT), transferOp2 = pxiDevMakeTransferOption(BAUDRATE_1MHZ, BUSMODE_1BIT); + u64 waitOp = pxiDevMakeWaitOperation(WAIT_NONE, DEASSERT_NONE, 0LL); + u64 headerFooterVal = 0; + bool b = type == FLASH_512KB_INFRARED || type == FLASH_256KB_INFRARED; + + PXIDEV_SPIBuffer headerBuffer = { &headerFooterVal, (b) ? 1U : 0U, (b) ? transferOp2 : transferOp, waitOp }; + PXIDEV_SPIBuffer cmdBuffer = { cmd, cmdSize, transferOp, waitOp }; + PXIDEV_SPIBuffer answerBuffer = { answer, answerSize, transferOp, waitOp }; + PXIDEV_SPIBuffer dataBuffer = { data, dataSize, transferOp, waitOp }; + PXIDEV_SPIBuffer nullBuffer = { NULL, 0U, transferOp, waitOp }; + PXIDEV_SPIBuffer footerBuffer = { &headerFooterVal, 0U, transferOp, waitOp }; + + return PXIDEV_SPIMultiWriteRead(&headerBuffer, &cmdBuffer, &answerBuffer, &dataBuffer, &nullBuffer, &footerBuffer); +} + +Result SPIWaitWriteEnd(CardType type) { + u8 cmd = SPI_CMD_RDSR, statusReg = 0; + Result res = 0; + + do { + res = SPIWriteRead(type, &cmd, 1, &statusReg, 1, 0, 0); + if(res) return res; + } while(statusReg & SPI_FLG_WIP); + + return 0; +} + +Result SPIEnableWriting(CardType type) { + u8 cmd = SPI_CMD_WREN, statusReg = 0; + Result res = SPIWriteRead(type, &cmd, 1, NULL, 0, 0, 0); + + if(res || type == EEPROM_512B) return res; // Weird, but works (otherwise we're getting an infinite loop for that chip type). + cmd = SPI_CMD_RDSR; + + do { + res = SPIWriteRead(type, &cmd, 1, &statusReg, 1, 0, 0); + if(res) return res; + } while(statusReg & ~SPI_FLG_WEL); + + return 0; +} + +Result SPIReadJEDECIDAndStatusReg(CardType type, u32* id, u8* statusReg) { + u8 cmd = SPI_FLASH_CMD_RDID; + u8 reg = 0; + u8 idbuf[3] = { 0 }; + u32 id_ = 0; + Result res = SPIWaitWriteEnd(type); + if(res) return res; + + if((res = SPIWriteRead(type, &cmd, 1, idbuf, 3, 0, 0))) return res; + + id_ = (idbuf[0] << 16) | (idbuf[1] << 8) | idbuf[2]; + cmd = SPI_CMD_RDSR; + + if((res = SPIWriteRead(type, &cmd, 1, ®, 1, 0, 0))) return res; + + if(id) *id = id_; + if(statusReg) *statusReg = reg; + + return 0; +} + +u32 SPIGetPageSize(CardType type) { + u32 EEPROMSizes[] = { 16, 32, 128, 256 }; + if(type == NO_CHIP || type > CHIP_LAST) return 0; + else if(type < FLASH_256KB_1) return EEPROMSizes[(int) type]; + else return 256; +} + +u32 SPIGetCapacity(CardType type) { + u32 sz[] = { 9, 13, 16, 17, 18, 18, 19, 19, 20, 23, 19, 19 }; + + if(type == NO_CHIP || type > CHIP_LAST) return 0; + else return 1 << sz[(int) type]; +} + +Result SPIWriteSaveData(CardType type, u32 offset, void* data, u32 size) { + u8 cmd[4] = { 0 }; + u32 cmdSize = 4; + + u32 end = offset + size; + u32 pos = offset; + if(size == 0) return 0; + u32 pageSize = SPIGetPageSize(type); + if(pageSize == 0) return 0xC8E13404; + + Result res = SPIWaitWriteEnd(type); + if(res) return res; + + size = (size <= SPIGetCapacity(type) - offset) ? size : SPIGetCapacity(type) - offset; + + while(pos < end) { + switch(type) { + case EEPROM_512B: + cmdSize = 2; + cmd[0] = (pos >= 0x100) ? SPI_512B_EEPROM_CMD_WRHI : SPI_512B_EEPROM_CMD_WRLO; + cmd[1] = (u8) pos; + break; + case EEPROM_8KB: + case EEPROM_64KB: + cmdSize = 3; + cmd[0] = SPI_EEPROM_CMD_WRITE; + cmd[1] = (u8)(pos >> 8); + cmd[2] = (u8) pos; + break; + case EEPROM_128KB: + cmdSize = 4; + cmd[0] = SPI_EEPROM_CMD_WRITE; + cmd[1] = (u8)(pos >> 16); + cmd[2] = (u8)(pos >> 8); + cmd[3] = (u8) pos; + break; + case FLASH_256KB_1: + case FLASH_256KB_2: + case FLASH_512KB_1: + case FLASH_512KB_2: + case FLASH_1MB: + case FLASH_512KB_INFRARED: + case FLASH_256KB_INFRARED: + cmdSize = 4; + cmd[0] = SPI_FLASH_CMD_PW; + cmd[1] = (u8)(pos >> 16); + cmd[2] = (u8)(pos >> 8); + cmd[3] = (u8) pos; + break; + case FLASH_8MB: + return 0xC8E13404; // writing is unsupported (so is reading? need to test) + default: + return 0; // never happens + } + + u32 remaining = end - pos; + u32 nb = pageSize - (pos % pageSize); + + u32 dataSize = (remaining < nb) ? remaining : nb; + + if( (res = SPIEnableWriting(type)) ) return res; + if( (res = SPIWriteRead(type, cmd, cmdSize, NULL, 0, (void*) ((u8*) data - offset + pos), dataSize)) ) return res; + if( (res = SPIWaitWriteEnd(type)) ) return res; + + pos = ((pos / pageSize) + 1) * pageSize; // truncate + } + return 0; +} + +Result _SPIReadSaveData_512B_impl(u32 pos, void* data, u32 size) { + u8 cmd[4]; + u32 cmdSize = 2; + + u32 end = pos + size; + + u32 read = 0; + if(pos < 0x100) { + u32 len = 0x100 - pos; + cmd[0] = SPI_512B_EEPROM_CMD_RDLO; + cmd[1] = (u8) pos; + + Result res = SPIWriteRead(EEPROM_512B, cmd, cmdSize, data, len, NULL, 0); + if(res) return res; + + read += len; + } + + if(end >= 0x100) { + u32 len = end - 0x100; + + cmd[0] = SPI_512B_EEPROM_CMD_RDHI; + cmd[1] = (u8)(pos + read); + + Result res = SPIWriteRead(EEPROM_512B, cmd, cmdSize, (void*)((u8*)data + read), len, NULL, 0); + + if(res) return res; + } + return 0; +} + +Result SPIReadSaveData(CardType type, u32 offset, void* data, u32 size) { + u8 cmd[4] = { SPI_CMD_READ }; + u32 cmdSize = 4; + if(size == 0) return 0; + if(type == NO_CHIP) return 0xC8E13404; + + Result res = SPIWaitWriteEnd(type); + if(res) return res; + + size = (size <= SPIGetCapacity(type) - offset) ? size : SPIGetCapacity(type) - offset; + u32 pos = offset; + switch(type) { + case EEPROM_512B: + return _SPIReadSaveData_512B_impl(offset, data, size); + break; + case EEPROM_8KB: + case EEPROM_64KB: + cmdSize = 3; + cmd[1] = (u8)(pos >> 8); + cmd[2] = (u8) pos; + break; + case EEPROM_128KB: + cmdSize = 4; + cmd[1] = (u8)(pos >> 16); + cmd[2] = (u8)(pos >> 8); + cmd[3] = (u8) pos; + break; + case FLASH_256KB_1: + case FLASH_256KB_2: + case FLASH_512KB_1: + case FLASH_512KB_2: + case FLASH_1MB: + case FLASH_8MB: + case FLASH_512KB_INFRARED: + case FLASH_256KB_INFRARED: + cmdSize = 4; + cmd[1] = (u8)(pos >> 16); + cmd[2] = (u8)(pos >> 8); + cmd[3] = (u8) pos; + break; + default: + return 0; // never happens + } + + return SPIWriteRead(type, cmd, cmdSize, data, size, NULL, 0); +} + +// The following routine use code from savegame-manager: +/* + * savegame_manager: a tool to backup and restore savegames from Nintendo + * DS cartridges. Nintendo DS and all derivative names are trademarks + * by Nintendo. EZFlash 3-in-1 is a trademark by EZFlash. + * + * auxspi.cpp: A thin reimplementation of the AUXSPI protocol + * (high level functions) + * + * Copyright (C) Pokedoc (2010) + */ +/* + * 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 2 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +Result _SPIIsDataMirrored(CardType type, int size, bool* mirrored) { + u32 offset0 = (size-1); // n KB + u32 offset1 = (2*size-1); // 2n KB + + u8 buf1; // +0k data read -> write + u8 buf2; // +n k data read -> read + u8 buf3; // +0k ~data write + u8 buf4; // +n k data new comp buf2 + + Result res; + + if( (res = SPIReadSaveData(type, offset0, &buf1, 1)) ) return res; + if( (res = SPIReadSaveData(type, offset1, &buf2, 1)) ) return res; + buf3=~buf1; + if( (res = SPIWriteSaveData(type, offset0, &buf3, 1)) ) return res; + if( (res = SPIReadSaveData(type, offset1, &buf4, 1)) ) return res; + if( (res = SPIWriteSaveData(type, offset0, &buf1, 1)) ) return res; + + *mirrored = buf2 != buf4; + return 0; +} + +Result SPIGetCardType(CardType* type, int infrared) { + u8 sr = 0; + u32 jedec = 0; + u32 tries = 0; + CardType t = (infrared == 1) ? FLASH_INFRARED_DUMMY : FLASH_STD_DUMMY; + Result res; + u32 jedecOrderedList[] = { 0x204012, 0x621600, 0x204013, 0x621100, 0x204014, 0x202017}; + + u32 maxTries = (infrared == -1) ? 2 : 1; // note: infrared = -1 fails 1/3 of the time + while(tries < maxTries){ + res = SPIReadJEDECIDAndStatusReg(t, &jedec, &sr); // dummy + if(res) return res; + + if ((sr & 0xfd) == 0x00 && (jedec != 0x00ffffff)) { break; } + if ((sr & 0xfd) == 0xF0 && (jedec == 0x00ffffff)) { t = EEPROM_512B; break; } + if ((sr & 0xfd) == 0x00 && (jedec == 0x00ffffff)) { t = EEPROM_STD_DUMMY; break; } + + ++tries; + t = FLASH_INFRARED_DUMMY; + } + + if(t == EEPROM_512B) { *type = t; return 0; } + else if(t == EEPROM_STD_DUMMY) { + bool mirrored = false; + + if( (res = _SPIIsDataMirrored(t, 8192, &mirrored)) ) return res; + if(mirrored) t = EEPROM_8KB; + else{ + if( (res = _SPIIsDataMirrored(t, 65536, &mirrored)) ) return res; + if(mirrored) t = EEPROM_64KB; + else t = EEPROM_128KB; + } + + *type = t; + return 0; + } + + else if(t == FLASH_INFRARED_DUMMY) { + if(infrared == 0) *type = NO_CHIP; // did anything go wrong? + + if(jedec == jedecOrderedList[0] || jedec == jedecOrderedList[1]) *type = FLASH_256KB_INFRARED; + else *type = FLASH_512KB_INFRARED; + + return 0; + } + + else { + if(infrared == 1) *type = NO_CHIP; // did anything go wrong? + if(jedec == 0x204017) { *type = FLASH_8MB; return 0; } // 8MB. savegame-manager: which one? (more work is required to unlock this save chip!) + + int i; + + for(i = 0; i < 6; ++i) { + if(jedec == jedecOrderedList[i]) { *type = (CardType)((int) FLASH_256KB_1 + i); return 0; } + } + + *type = NO_CHIP; + return 0; + } +} \ No newline at end of file diff --git a/source/spi.h b/source/spi.h new file mode 100644 index 000000000..4316dcc13 --- /dev/null +++ b/source/spi.h @@ -0,0 +1,96 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +/* + * This file was part of TWLSaveTool. + * Copyright (C) 2015-2016 TuxSH + * + * TWLSaveTool 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +#pragma once +#include <3ds.h> + +#define SPI_CMD_RDSR 5 +#define SPI_CMD_WREN 6 +#define SPI_512B_EEPROM_CMD_WRLO 2 +#define SPI_512B_EEPROM_CMD_WRHI 10 +#define SPI_512B_EEPROM_CMD_RDLO 3 +#define SPI_512B_EEPROM_CMD_RDHI 11 +#define SPI_EEPROM_CMD_WRITE 2 +#define SPI_CMD_READ 3 +#define SPI_CMD_PP 2 +#define SPI_FLASH_CMD_PW 10 +#define SPI_FLASH_CMD_RDID 0x9f +#define SPI_FLASH_CMD_SE 0xd8 +#define SPI_FLG_WIP 1 +#define SPI_FLG_WEL 2 + +extern u8* fill_buf; + +typedef enum { + NO_CHIP = -1, + + EEPROM_512B = 0, + + EEPROM_8KB = 1, + EEPROM_64KB = 2, + EEPROM_128KB = 3, + EEPROM_STD_DUMMY = 1, + + FLASH_256KB_1 = 4, + FLASH_256KB_2 = 5, + FLASH_512KB_1 = 6, + FLASH_512KB_2 = 7, + FLASH_1MB = 8, + FLASH_8MB = 9, // <- can't restore savegames, and maybe not read them atm + FLASH_STD_DUMMY = 4, + + FLASH_512KB_INFRARED = 10, + FLASH_256KB_INFRARED = 11, // AFAIK, only "Active Health with Carol Vorderman" has such a flash save memory + FLASH_INFRARED_DUMMY = 9, + + CHIP_LAST = 11, +} CardType; + +u32 TWLsaveSize(CardType cardType_); +void TWLstoreSaveFile(u8* out, CardType cardType_); +void TWLrestoreSaveFile(u8* in, CardType cardType_, u64 mainSize); +void TWLinjectSave(u8* mainbuf, u64 mainSize); + +Result SPIWriteRead(CardType type, void* cmd, u32 cmdSize, void* answer, u32 answerSize, void* data, u32 dataSize); +Result SPIWaitWriteEnd(CardType type); +Result SPIEnableWriting(CardType type); +Result SPIReadJEDECIDAndStatusReg(CardType type, u32* id, u8* statusReg); +Result SPIGetCardType(CardType* type, int infrared); +u32 SPIGetPageSize(CardType type); +u32 SPIGetCapacity(CardType type); +Result SPIWriteSaveData(CardType type, u32 offset, void* data, u32 size); +Result SPIReadSaveData(CardType type, u32 offset, void* data, u32 size); \ No newline at end of file diff --git a/source/util.c b/source/util.c new file mode 100644 index 000000000..178d0e9d6 --- /dev/null +++ b/source/util.c @@ -0,0 +1,345 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#include +#include +#include <3ds.h> +#include +#include +#include +#include "editor.h" +#include "http.h" +#include "util.h" +#include "graphic.h" + +bool checkFile(char* path) { + FILE *temp = fopen(path, "rt"); + if (temp == NULL) { + fclose(temp); + return false; + } + fclose(temp); + return true; +} + +void loadPersonal() { + FILE *fptr = fopen("romfs:/personal/personal.bin", "rt"); + if (fptr == NULL) { + fclose(fptr); + return; + } + fseek(fptr, 0, SEEK_END); + u32 size = ftell(fptr); + u8 *buf = (u8*)malloc(size); + if (buf == NULL) { + fclose(fptr); + free(buf); + return; + } + rewind(fptr); + fread(buf, size, 1, fptr); + fclose(fptr); + memcpy(personal.pkmData, buf, size); + free(buf); +} + +void loadFile(u8* buf, char* path) { + FILE *fptr = fopen(path, "rt"); + if (fptr == NULL) + return; + fseek(fptr, 0, SEEK_END); + u32 size = ftell(fptr); + memset(buf, 0, 1499); + rewind(fptr); + fread(buf, size, 1, fptr); + fclose(fptr); +} + +void injectFromFile(u8* mainbuf, char* path, u32 offset) { + FILE *fptr = fopen(path, "rt"); + if (fptr == NULL) { + fclose(fptr); + return; + } + fseek(fptr, 0, SEEK_END); + u32 size = ftell(fptr); + u8 *buf = (u8*)malloc(size); + if (buf == NULL) { + fclose(fptr); + free(buf); + return; + } + rewind(fptr); + fread(buf, size, 1, fptr); + fclose(fptr); + + memcpy(&mainbuf[offset], buf, size); + free(buf); +} + +int autoupdater() { + int temp = 0; + char* ver = (char*)malloc(6 * sizeof(u8)); + snprintf(ver, 6, "%d.%d.%d", V1, V2, V3); + + Result ret = downloadFile("https://raw.githubusercontent.com/BernardoGiordano/PKSM/master/resources/ver.ver", "/3ds/data/PKSM/builds/ver.ver", false); + if (ret != 0) { + free(ver); + return 1; + } + + FILE *fptr = fopen("3ds/data/PKSM/builds/ver.ver", "rt"); + if (fptr == NULL) { + fclose(fptr); + free(ver); + return 15; + } + fseek(fptr, 0, SEEK_END); + u32 contentsize = ftell(fptr); + char *verbuf = (char*)malloc(contentsize); + if (verbuf == NULL) { + fclose(fptr); + free(verbuf); + free(ver); + return 8; + } + rewind(fptr); + fread(verbuf, contentsize, 1, fptr); + fclose(fptr); + + remove("/3ds/data/PKSM/builds/ver.ver"); + + for (int i = 0; i < 5; i++) + if (*(ver + i) == *(verbuf + i)) + temp++; + + free(ver); + free(verbuf); + + if (temp < 5) { + update(); + return 1; + } + return 0; +} + +void update() { + char *ciaUrl = "https://raw.githubusercontent.com/BernardoGiordano/PKSM/master/PKSM/PKSM.cia"; + char *ciaPath = (char*)malloc(100 * sizeof(char)); + + time_t unixTime = time(NULL); + struct tm* timeStruct = gmtime((const time_t *)&unixTime); + + snprintf(ciaPath, 100, "/3ds/data/PKSM/builds/PKSM_%i-%i-%i-%02i%02i%02i.cia", timeStruct->tm_mday, timeStruct->tm_mon + 1, timeStruct->tm_year + 1900, timeStruct->tm_hour, timeStruct->tm_min, timeStruct->tm_sec); + + freezeMsg("Downloading latest build..."); + Result ret = downloadFile(ciaUrl, ciaPath, true); + + if (ret == 0) infoDisp("Installation succeeded!"); + else infoDisp("Download failed!"); + + free(ciaPath); + infoDisp("Restart the application!"); +} + +bool isHBL() { + u64 id; + APT_GetProgramID(&id); + + return id != 0x000400000EC10000; +} + +void fsStart() { + if(isHBL()) { + Handle fsHandle; + srvGetServiceHandleDirect(&fsHandle, "fs:USER"); + FSUSER_Initialize(fsHandle); + fsUseSession(fsHandle); + } +} + +void fsEnd() { + if(isHBL()) + fsEndUseSession(); +} + +bool openSaveArch(FS_Archive *out, u64 id) { + if (id == POKEBANK || !isHBL()) { //If we're using Pokebank or CIA + u32 cardPath[3] = {MEDIATYPE_GAME_CARD, id, id >> 32}; //Card + if (R_FAILED(FSUSER_OpenArchive(out, ARCHIVE_USER_SAVEDATA, (FS_Path){PATH_BINARY, 0xC, cardPath}))) { //If that fails, try digital + u32 sdPath[3] = {MEDIATYPE_SD, id, id >> 32}; + if (R_FAILED(FSUSER_OpenArchive(out, ARCHIVE_USER_SAVEDATA, (FS_Path){PATH_BINARY, 0xC, sdPath}))) + return false; + else + return true; + } + else + return true; + } + else { + if (R_SUCCEEDED(FSUSER_OpenArchive(out, ARCHIVE_SAVEDATA, fsMakePath(PATH_EMPTY, "")))) + return true; + else + return false; + } + + return false; +} + +void settingsMenu(u8* mainbuf, int game) { + char *gamesList[] = {"X", "Y", "OR", "AS", "S", "M", "D", "P", "PL", "HG", "SS", "B", "W", "W2", "B2"}; + + bool speedy = false; + bool operationDone = false; + FILE *bank = fopen("/3ds/data/PKSM/bank/bank.bin", "rt"); + fseek(bank, 0, SEEK_END); + u32 size = ftell(bank); + fclose(bank); + + u32 box = size / (30 * PKMNLENGTH); + u32 boxmax = 1000; + + while (aptMainLoop() && !operationDone) { + hidScanInput(); + touchPosition touch; + hidTouchRead(&touch); + + if (hidKeysDown() & KEY_B) break; + + if (hidKeysDown() & KEY_L) + speedy = false; + + if (hidKeysDown() & KEY_R) + speedy = true; + + if ((hidKeysDown() & KEY_TOUCH) && !speedy) { + if (touch.px > 169 && touch.px < 186 && touch.py > 65 && touch.py < 83) { + if (box > 2) box--; + else if (box == 2) box = boxmax; + } + + if (touch.px > 228 && touch.px < 245 && touch.py > 65 && touch.py < 83) { + if (box < boxmax) box++; + else if (box == boxmax) box = 2; + } + } + + if ((hidKeysHeld() & KEY_TOUCH) && speedy) { + if (touch.px > 169 && touch.px < 186 && touch.py > 65 && touch.py < 83) { + if (box > 2) box--; + else if (box == 2) box = boxmax; + } + + if (touch.px > 228 && touch.px < 245 && touch.py > 65 && touch.py < 83) { + if (box < boxmax) box++; + else if (box == boxmax) box = 2; + } + } + + if (hidKeysDown() & KEY_TOUCH) { + if (touch.px > 189 && touch.px < 225 && touch.py > 64 && touch.py < 85) { + if (size < box * 30 * PKMNLENGTH) { // i box sono maggiori + FILE *buf = fopen("/3ds/data/PKSM/bank/bank.bin", "rt"); + fseek(buf, 0, SEEK_END); + u32 size_temp = ftell(buf); + u8 *bankbuf = (u8*)malloc(size_temp * sizeof(u8)); + rewind(buf); + fread(bankbuf, size_temp, 1, buf); + fclose(buf); + + FILE *bak = fopen("/3ds/data/PKSM/bank/bank.bak", "wb"); + fwrite(bankbuf, 1, size_temp, bak); + fclose(bak); + + u8* newbank = (u8*)malloc(box * 30 * PKMNLENGTH); + memset(newbank, 0, box * 30 * PKMNLENGTH); + memcpy(newbank, bankbuf, size_temp); + + FILE *newbankfile = fopen("/3ds/data/PKSM/bank/bank.bin", "wb"); + fwrite(newbank, 1, box * 30 * PKMNLENGTH, newbankfile); + fclose(newbankfile); + + free(bankbuf); + free(newbank); + } + else if (size > box * 30 * PKMNLENGTH) { // i box sono minori + FILE *buf = fopen("/3ds/data/PKSM/bank/bank.bin", "rt"); + fseek(buf, 0, SEEK_END); + u32 size_temp = ftell(buf); + u8 *bankbuf = (u8*)malloc(size_temp * sizeof(u8)); + rewind(buf); + fread(bankbuf, size_temp, 1, buf); + fclose(buf); + + FILE *bak = fopen("/3ds/data/PKSM/bank/bank.bak", "wb"); + fwrite(bankbuf, 1, size_temp, bak); + fclose(bak); + + u8* newbank = (u8*)malloc(box * 30 * PKMNLENGTH); + memset(newbank, 0, box * 30 * PKMNLENGTH); + memcpy(newbank, bankbuf, box * 30 * PKMNLENGTH); + + FILE *newbankfile = fopen("/3ds/data/PKSM/bank/bank.bin", "wb"); + fwrite(newbank, 1, box * 30 * PKMNLENGTH, newbankfile); + fclose(newbankfile); + + free(bankbuf); + free(newbank); + } + operationDone = true; + infoDisp("Bank size changed!"); + } + if (touch.px > 60 && touch.px < 260 && touch.py > 100 && touch.py < 140) { + char *bakpath = (char*)malloc(80 * sizeof(char)); + + time_t unixTime = time(NULL); + struct tm* timeStruct = gmtime((const time_t *)&unixTime); + snprintf(bakpath, 80, "/3ds/data/PKSM/backup/main_%s_%i%i%i%02i%02i%02i", gamesList[game], timeStruct->tm_mday, timeStruct->tm_mon + 1, timeStruct->tm_year + 1900, timeStruct->tm_hour, timeStruct->tm_min, timeStruct->tm_sec); + + FILE *f = fopen(bakpath, "wb"); + fwrite(mainbuf, 1, sizeof(&mainbuf), f); + fclose(f); + + free(bakpath); + operationDone = true; + infoDisp("Save backup created!"); + } + if (touch.px > 60 && touch.px < 260 && touch.py > 140 && touch.py < 180) { + FILE *bak = fopen("/3ds/data/PKSM/bank/bank.bin", "rt"); + fseek(bak, 0, SEEK_END); + size = ftell(bak); + u8* bankbuf = (u8*)malloc(size * sizeof(u8)); + + rewind(bak); + fread(bankbuf, size, 1, bak); + fclose(bak); + + FILE *new = fopen("/3ds/data/PKSM/bank/bank.bak", "wb"); + fwrite(bankbuf, 1, size, new); + fclose(new); + + free(bankbuf); + + infoDisp("Bank backup created!"); + operationDone = true; + } + } + printSettings(box, speedy); + } +} \ No newline at end of file diff --git a/source/util.h b/source/util.h new file mode 100644 index 000000000..e1d5edff2 --- /dev/null +++ b/source/util.h @@ -0,0 +1,62 @@ +/* This file is part of PKSM + +Copyright (C) 2016 Bernardo Giordano + +> 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 . +> See LICENSE for information. +*/ + +#pragma once + +#include +#include <3ds.h> + +#define POKEBANK 0x00040000000C9B00 + +#define V1 4 +#define V2 0 +#define V3 0 + +#define DAY 12 +#define MONTH 9 +#define YEAR 16 + +#define GAME_X 0 +#define GAME_Y 1 +#define GAME_OR 2 +#define GAME_AS 3 +#define GAME_SUN 4 +#define GAME_MOON 5 +#define GAME_DIAMOND 6 +#define GAME_PEARL 7 +#define GAME_PLATINUM 8 +#define GAME_HG 9 +#define GAME_SS 10 +#define GAME_B1 11 +#define GAME_W1 12 +#define GAME_B2 13 +#define GAME_W2 14 + +bool checkFile(char* path); +void loadPersonal(); +void loadFile(u8* buf, char* path); +void injectFromFile(u8* mainbuf, char* path, u32 offset); +int autoupdater(); +void update(); +void printfile(char* path); +bool isHBL(); +void fsStart(); +void fsEnd(); +bool openSaveArch(FS_Archive *out, u64 id); +void settingsMenu(u8* mainbuf, int game); \ No newline at end of file