├── .gitignore
├── LICENSE
├── Makefile
├── PCHex.png
├── PCHex.xml
├── README.md
├── data
├── personal
└── text
│ ├── text_Abilities_en.txt
│ ├── text_Balls_en.txt
│ ├── text_Character_en.txt
│ ├── text_Items_en.txt
│ ├── text_Moves_en.txt
│ ├── text_Natures_en.txt
│ └── text_Species_en.txt
├── export.sh
└── source
├── UI.c
├── fs.c
├── main.c
├── overlay.c
├── overlay.h
├── pchex.h
├── pkx.c
├── pkx.h
├── sav.c
└── state
├── pkmCombat.c
├── pkmCombatFields.c
├── pkmGeneral.c
├── pkmGeneralFields.c
├── pkmManage.c
├── pkmSelect.c
├── state.h
└── utils.c
/.gitignore:
--------------------------------------------------------------------------------
1 | *.smdh
2 | *.3dsx
3 | build/
4 | .ycm*
5 | *.elf
6 | *.swp
7 | export/
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | .SUFFIXES:
3 | #---------------------------------------------------------------------------------
4 | $(warning $(DEVKITARM))
5 |
6 | ifeq ($(strip $(DEVKITARM)),)
7 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM")
8 | endif
9 |
10 | TOPDIR ?= $(CURDIR)
11 | include $(DEVKITARM)/3ds_rules
12 |
13 | #---------------------------------------------------------------------------------
14 | # TARGET is the name of the output
15 | # BUILD is the directory where object files & intermediate files will be placed
16 | # SOURCES is a list of directories containing source code
17 | # DATA is a list of directories containing data files
18 | # INCLUDES is a list of directories containing header files
19 | #
20 | # NO_SMDH: if set to anything, no SMDH file is generated.
21 | # APP_TITLE is the name of the app stored in the SMDH file (Optional)
22 | # APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
23 | # APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
24 | # ICON is the filename of the icon (.png), relative to the project folder.
25 | # If not set, it attempts to use one of the following (in this order):
26 | # - .png
27 | # - icon.png
28 | # - /default_icon.png
29 | #---------------------------------------------------------------------------------
30 | TARGET := $(notdir $(CURDIR))
31 | BUILD := build
32 | SOURCES := source source/state
33 | DATA := data
34 | INCLUDES := include
35 |
36 | APP_TITLE := PCHex
37 | APP_DESCRIPTION := A Gen6 save editor
38 | APP_AUTHOR := Stracker
39 |
40 | #---------------------------------------------------------------------------------
41 | # options for code generation
42 | #---------------------------------------------------------------------------------
43 | ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard
44 |
45 | CFLAGS := -g -Wall -O2 -mword-relocations \
46 | -fomit-frame-pointer -ffast-math \
47 | $(ARCH)
48 |
49 | CFLAGS += $(INCLUDE) -DARM11 -D_3DS -std=c99
50 |
51 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
52 |
53 | ASFLAGS := -g $(ARCH)
54 | LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
55 |
56 | LIBS := -lctru -lm
57 |
58 | #---------------------------------------------------------------------------------
59 | # list of directories containing libraries, this must be the top level containing
60 | # include and lib
61 | #---------------------------------------------------------------------------------
62 | LIBDIRS := $(CTRULIB)
63 |
64 |
65 | #---------------------------------------------------------------------------------
66 | # no real need to edit anything past this point unless you need to add additional
67 | # rules for different file extensions
68 | #---------------------------------------------------------------------------------
69 | ifneq ($(BUILD),$(notdir $(CURDIR)))
70 | #---------------------------------------------------------------------------------
71 |
72 | export OUTPUT := $(CURDIR)/$(TARGET)
73 | export TOPDIR := $(CURDIR)
74 |
75 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
76 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
77 |
78 | export DEPSDIR := $(CURDIR)/$(BUILD)
79 |
80 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
81 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
82 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
83 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
84 |
85 | #---------------------------------------------------------------------------------
86 | # use CXX for linking C++ projects, CC for standard C
87 | #---------------------------------------------------------------------------------
88 | ifeq ($(strip $(CPPFILES)),)
89 | #---------------------------------------------------------------------------------
90 | export LD := $(CC)
91 | #---------------------------------------------------------------------------------
92 | else
93 | #---------------------------------------------------------------------------------
94 | export LD := $(CXX)
95 | #---------------------------------------------------------------------------------
96 | endif
97 | #---------------------------------------------------------------------------------
98 |
99 | export OFILES := $(addsuffix .o,$(BINFILES)) \
100 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
101 |
102 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
103 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
104 | -I$(CURDIR)/$(BUILD)
105 |
106 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
107 |
108 | ifeq ($(strip $(ICON)),)
109 | icons := $(wildcard *.png)
110 | ifneq (,$(findstring $(TARGET).png,$(icons)))
111 | export APP_ICON := $(TOPDIR)/$(TARGET).png
112 | else
113 | ifneq (,$(findstring icon.png,$(icons)))
114 | export APP_ICON := $(TOPDIR)/icon.png
115 | endif
116 | endif
117 | else
118 | export APP_ICON := $(TOPDIR)/$(ICON)
119 | endif
120 |
121 | ifeq ($(strip $(NO_SMDH)),)
122 | export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
123 | endif
124 |
125 | .PHONY: $(BUILD) clean all
126 |
127 | #---------------------------------------------------------------------------------
128 | all: $(BUILD)
129 |
130 | $(BUILD):
131 | @[ -d $@ ] || mkdir -p $@
132 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
133 |
134 | #---------------------------------------------------------------------------------
135 | clean:
136 | @echo clean ...
137 | @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
138 |
139 |
140 | #---------------------------------------------------------------------------------
141 | else
142 |
143 | DEPENDS := $(OFILES:.o=.d)
144 |
145 | #---------------------------------------------------------------------------------
146 | # main targets
147 | #---------------------------------------------------------------------------------
148 | ifeq ($(strip $(NO_SMDH)),)
149 | $(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
150 | else
151 | $(OUTPUT).3dsx : $(OUTPUT).elf
152 | endif
153 | $(OUTPUT).elf : $(OFILES)
154 |
155 | #---------------------------------------------------------------------------------
156 | # you need a rule like this for each extension you use as binary data
157 | #---------------------------------------------------------------------------------
158 | %.bin.o : %.bin
159 | #---------------------------------------------------------------------------------
160 | @echo $(notdir $<)
161 | @$(bin2o)
162 |
163 | # WARNING: This is not the right way to do this! TODO: Do it right!
164 | #---------------------------------------------------------------------------------
165 | %.vsh.o : %.vsh
166 | #---------------------------------------------------------------------------------
167 | @echo $(notdir $<)
168 | @python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin
169 | @bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@
170 | @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
171 | @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
172 | @echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
173 | @rm ../$(notdir $<).shbin
174 |
175 | -include $(DEPENDS)
176 |
177 | #---------------------------------------------------------------------------------------
178 | endif
179 | #---------------------------------------------------------------------------------------
180 |
--------------------------------------------------------------------------------
/PCHex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Strackeror/PCHex/347dee758209bf1119fa548a2b84d6f4cdcf8e15/PCHex.png
--------------------------------------------------------------------------------
/PCHex.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PCHex
2 | 3DS Homebrew port of PKHex, A Pokémon save editor.
3 |
4 | Currently just proof of concept.
5 |
6 | # Build
7 | You need the latest git version of ctrulib, found here: https://github.com/smealum/ctrulib
8 | as this will NOT work with devkitPro's base ctrulib.
9 |
10 | # Install
11 | Copy the content of the "export" folder in your "homebrew" or "3ds" folder.
12 |
13 | # Use
14 | * Choose PCHex from the homebrew browser
15 | * Choose your Pokémon game as the target game
16 | * Follow Instructions
17 | * Select to export your changes
18 |
19 | # Known Issues
20 |
21 | * ?
22 |
23 | # Todo
24 |
25 | * ?
26 |
--------------------------------------------------------------------------------
/data/personal:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Strackeror/PCHex/347dee758209bf1119fa548a2b84d6f4cdcf8e15/data/personal
--------------------------------------------------------------------------------
/data/text/text_Abilities_en.txt:
--------------------------------------------------------------------------------
1 | —
2 | Stench
3 | Drizzle
4 | Speed Boost
5 | Battle Armor
6 | Sturdy
7 | Damp
8 | Limber
9 | Sand Veil
10 | Static
11 | Volt Absorb
12 | Water Absorb
13 | Oblivious
14 | Cloud Nine
15 | Compound Eyes
16 | Insomnia
17 | Color Change
18 | Immunity
19 | Flash Fire
20 | Shield Dust
21 | Own Tempo
22 | Suction Cups
23 | Intimidate
24 | Shadow Tag
25 | Rough Skin
26 | Wonder Guard
27 | Levitate
28 | Effect Spore
29 | Synchronize
30 | Clear Body
31 | Natural Cure
32 | Lightning Rod
33 | Serene Grace
34 | Swift Swim
35 | Chlorophyll
36 | Illuminate
37 | Trace
38 | Huge Power
39 | Poison Point
40 | Inner Focus
41 | Magma Armor
42 | Water Veil
43 | Magnet Pull
44 | Soundproof
45 | Rain Dish
46 | Sand Stream
47 | Pressure
48 | Thick Fat
49 | Early Bird
50 | Flame Body
51 | Run Away
52 | Keen Eye
53 | Hyper Cutter
54 | Pickup
55 | Truant
56 | Hustle
57 | Cute Charm
58 | Plus
59 | Minus
60 | Forecast
61 | Sticky Hold
62 | Shed Skin
63 | Guts
64 | Marvel Scale
65 | Liquid Ooze
66 | Overgrow
67 | Blaze
68 | Torrent
69 | Swarm
70 | Rock Head
71 | Drought
72 | Arena Trap
73 | Vital Spirit
74 | White Smoke
75 | Pure Power
76 | Shell Armor
77 | Air Lock
78 | Tangled Feet
79 | Motor Drive
80 | Rivalry
81 | Steadfast
82 | Snow Cloak
83 | Gluttony
84 | Anger Point
85 | Unburden
86 | Heatproof
87 | Simple
88 | Dry Skin
89 | Download
90 | Iron Fist
91 | Poison Heal
92 | Adaptability
93 | Skill Link
94 | Hydration
95 | Solar Power
96 | Quick Feet
97 | Normalize
98 | Sniper
99 | Magic Guard
100 | No Guard
101 | Stall
102 | Technician
103 | Leaf Guard
104 | Klutz
105 | Mold Breaker
106 | Super Luck
107 | Aftermath
108 | Anticipation
109 | Forewarn
110 | Unaware
111 | Tinted Lens
112 | Filter
113 | Slow Start
114 | Scrappy
115 | Storm Drain
116 | Ice Body
117 | Solid Rock
118 | Snow Warning
119 | Honey Gather
120 | Frisk
121 | Reckless
122 | Multitype
123 | Flower Gift
124 | Bad Dreams
125 | Pickpocket
126 | Sheer Force
127 | Contrary
128 | Unnerve
129 | Defiant
130 | Defeatist
131 | Cursed Body
132 | Healer
133 | Friend Guard
134 | Weak Armor
135 | Heavy Metal
136 | Light Metal
137 | Multiscale
138 | Toxic Boost
139 | Flare Boost
140 | Harvest
141 | Telepathy
142 | Moody
143 | Overcoat
144 | Poison Touch
145 | Regenerator
146 | Big Pecks
147 | Sand Rush
148 | Wonder Skin
149 | Analytic
150 | Illusion
151 | Imposter
152 | Infiltrator
153 | Mummy
154 | Moxie
155 | Justified
156 | Rattled
157 | Magic Bounce
158 | Sap Sipper
159 | Prankster
160 | Sand Force
161 | Iron Barbs
162 | Zen Mode
163 | Victory Star
164 | Turboblaze
165 | Teravolt
166 | Aroma Veil
167 | Flower Veil
168 | Cheek Pouch
169 | Protean
170 | Fur Coat
171 | Magician
172 | Bulletproof
173 | Competitive
174 | Strong Jaw
175 | Refrigerate
176 | Sweet Veil
177 | Stance Change
178 | Gale Wings
179 | Mega Launcher
180 | Grass Pelt
181 | Symbiosis
182 | Tough Claws
183 | Pixilate
184 | Gooey
185 | Aerilate
186 | Parental Bond
187 | Dark Aura
188 | Fairy Aura
189 | Aura Break
190 | Primordial Sea
191 | Desolate Land
192 | Delta Stream
193 |
--------------------------------------------------------------------------------
/data/text/text_Balls_en.txt:
--------------------------------------------------------------------------------
1 | -
2 | Master Ball
3 | Ultra Ball
4 | Great Ball
5 | Poke Ball
6 | Safari Ball
7 | Net Ball
8 | Dive Ball
9 | Nest Ball
10 | Repeat Ball
11 | Timer Ball
12 | Luxury Ball
13 | Premier Ball
14 | Dusk Ball
15 | Heal Ball
16 | Quick Ball
17 | Cherish Ball
18 | Fast Ball
19 | Level Ball
20 | Lure Ball
21 | Heavy Ball
22 | Love Ball
23 | Friend Ball
24 | Moon Ball
25 | Sport Ball
26 | Dream Ball
27 |
--------------------------------------------------------------------------------
/data/text/text_Character_en.txt:
--------------------------------------------------------------------------------
1 | Loves to eat.
2 | Takes plenty of siestas.
3 | Nods off a lot.
4 | Scatters things often.
5 | Likes to relax.
6 | Proud of its power.
7 | Likes to thrash about.
8 | A little quick tempered.
9 | Likes to fight.
10 | Quick tempered.
11 | Sturdy body.
12 | Capable of taking hits.
13 | Highly persistent.
14 | Good endurance.
15 | Good perseverance.
16 | Likes to run.
17 | Alert to sounds.
18 | Impetuous and silly.
19 | Somewhat of a clown.
20 | Quick to flee.
21 | Highly curious.
22 | Mischievous.
23 | Thoroughly cunning.
24 | Often lost in thought.
25 | Very finicky.
26 | Strong willed.
27 | Somewhat vain.
28 | Strongly defiant.
29 | Hates to lose.
30 | Somewhat stubborn
--------------------------------------------------------------------------------
/data/text/text_Items_en.txt:
--------------------------------------------------------------------------------
1 | None
2 | Master Ball
3 | Ultra Ball
4 | Great Ball
5 | Poke Ball
6 | Safari Ball
7 | Net Ball
8 | Dive Ball
9 | Nest Ball
10 | Repeat Ball
11 | Timer Ball
12 | Luxury Ball
13 | Premier Ball
14 | Dusk Ball
15 | Heal Ball
16 | Quick Ball
17 | Cherish Ball
18 | Potion
19 | Antidote
20 | Burn Heal
21 | Ice Heal
22 | Awakening
23 | Paralyze Heal
24 | Full Restore
25 | Max Potion
26 | Hyper Potion
27 | Super Potion
28 | Full Heal
29 | Revive
30 | Max Revive
31 | Fresh Water
32 | Soda Pop
33 | Lemonade
34 | Moomoo Milk
35 | Energy Powder
36 | Energy Root
37 | Heal Powder
38 | Revival Herb
39 | Ether
40 | Max Ether
41 | Elixir
42 | Max Elixir
43 | Lava Cookie
44 | Berry Juice
45 | Sacred Ash
46 | HP Up
47 | Protein
48 | Iron
49 | Carbos
50 | Calcium
51 | Rare Candy
52 | PP Up
53 | Zinc
54 | PP Max
55 | Old Gateau
56 | Guard Spec.
57 | Dire Hit
58 | X Attack
59 | X Defense
60 | X Speed
61 | X Accuracy
62 | X Sp. Atk
63 | X Sp. Def
64 | Poke Doll
65 | Fluffy Tail
66 | Blue Flute
67 | Yellow Flute
68 | Red Flute
69 | Black Flute
70 | White Flute
71 | Shoal Salt
72 | Shoal Shell
73 | Red Shard
74 | Blue Shard
75 | Yellow Shard
76 | Green Shard
77 | Super Repel
78 | Max Repel
79 | Escape Rope
80 | Repel
81 | Sun Stone
82 | Moon Stone
83 | Fire Stone
84 | Thunder Stone
85 | Water Stone
86 | Leaf Stone
87 | Tiny Mushroom
88 | Big Mushroom
89 | Pearl
90 | Big Pearl
91 | Stardust
92 | Star Piece
93 | Nugget
94 | Heart Scale
95 | Honey
96 | Growth Mulch
97 | Damp Mulch
98 | Stable Mulch
99 | Gooey Mulch
100 | Root Fossil
101 | Claw Fossil
102 | Helix Fossil
103 | Dome Fossil
104 | Old Amber
105 | Armor Fossil
106 | Skull Fossil
107 | Rare Bone
108 | Shiny Stone
109 | Dusk Stone
110 | Dawn Stone
111 | Oval Stone
112 | Odd Keystone
113 | Griseous Orb
114 | ???
115 | ???
116 | ???
117 | Douse Drive
118 | Shock Drive
119 | Burn Drive
120 | Chill Drive
121 | ???
122 | ???
123 | ???
124 | ???
125 | ???
126 | ???
127 | ???
128 | ???
129 | ???
130 | ???
131 | ???
132 | ???
133 | ???
134 | ???
135 | Sweet Heart
136 | Adamant Orb
137 | Lustrous Orb
138 | Greet Mail
139 | Favored Mail
140 | RSVP Mail
141 | Thanks Mail
142 | Inquiry Mail
143 | Like Mail
144 | Reply Mail
145 | Bridge Mail S
146 | Bridge Mail D
147 | Bridge Mail T
148 | Bridge Mail V
149 | Bridge Mail M
150 | Cheri Berry
151 | Chesto Berry
152 | Pecha Berry
153 | Rawst Berry
154 | Aspear Berry
155 | Leppa Berry
156 | Oran Berry
157 | Persim Berry
158 | Lum Berry
159 | Sitrus Berry
160 | Figy Berry
161 | Wiki Berry
162 | Mago Berry
163 | Aguav Berry
164 | Iapapa Berry
165 | Razz Berry
166 | Bluk Berry
167 | Nanab Berry
168 | Wepear Berry
169 | Pinap Berry
170 | Pomeg Berry
171 | Kelpsy Berry
172 | Qualot Berry
173 | Hondew Berry
174 | Grepa Berry
175 | Tamato Berry
176 | Cornn Berry
177 | Magost Berry
178 | Rabuta Berry
179 | Nomel Berry
180 | Spelon Berry
181 | Pamtre Berry
182 | Watmel Berry
183 | Durin Berry
184 | Belue Berry
185 | Occa Berry
186 | Passho Berry
187 | Wacan Berry
188 | Rindo Berry
189 | Yache Berry
190 | Chople Berry
191 | Kebia Berry
192 | Shuca Berry
193 | Coba Berry
194 | Payapa Berry
195 | Tanga Berry
196 | Charti Berry
197 | Kasib Berry
198 | Haban Berry
199 | Colbur Berry
200 | Babiri Berry
201 | Chilan Berry
202 | Liechi Berry
203 | Ganlon Berry
204 | Salac Berry
205 | Petaya Berry
206 | Apicot Berry
207 | Lansat Berry
208 | Starf Berry
209 | Enigma Berry
210 | Micle Berry
211 | Custap Berry
212 | Jaboca Berry
213 | Rowap Berry
214 | Bright Powder
215 | White Herb
216 | Macho Brace
217 | Exp. Share
218 | Quick Claw
219 | Soothe Bell
220 | Mental Herb
221 | Choice Band
222 | King’s Rock
223 | Silver Powder
224 | Amulet Coin
225 | Cleanse Tag
226 | Soul Dew
227 | Deep Sea Tooth
228 | Deep Sea Scale
229 | Smoke Ball
230 | Everstone
231 | Focus Band
232 | Lucky Egg
233 | Scope Lens
234 | Metal Coat
235 | Leftovers
236 | Dragon Scale
237 | Light Ball
238 | Soft Sand
239 | Hard Stone
240 | Miracle Seed
241 | Black Glasses
242 | Black Belt
243 | Magnet
244 | Mystic Water
245 | Sharp Beak
246 | Poison Barb
247 | Never-Melt Ice
248 | Spell Tag
249 | Twisted Spoon
250 | Charcoal
251 | Dragon Fang
252 | Silk Scarf
253 | Up-Grade
254 | Shell Bell
255 | Sea Incense
256 | Lax Incense
257 | Lucky Punch
258 | Metal Powder
259 | Thick Club
260 | Stick
261 | Red Scarf
262 | Blue Scarf
263 | Pink Scarf
264 | Green Scarf
265 | Yellow Scarf
266 | Wide Lens
267 | Muscle Band
268 | Wise Glasses
269 | Expert Belt
270 | Light Clay
271 | Life Orb
272 | Power Herb
273 | Toxic Orb
274 | Flame Orb
275 | Quick Powder
276 | Focus Sash
277 | Zoom Lens
278 | Metronome
279 | Iron Ball
280 | Lagging Tail
281 | Destiny Knot
282 | Black Sludge
283 | Icy Rock
284 | Smooth Rock
285 | Heat Rock
286 | Damp Rock
287 | Grip Claw
288 | Choice Scarf
289 | Sticky Barb
290 | Power Bracer
291 | Power Belt
292 | Power Lens
293 | Power Band
294 | Power Anklet
295 | Power Weight
296 | Shed Shell
297 | Big Root
298 | Choice Specs
299 | Flame Plate
300 | Splash Plate
301 | Zap Plate
302 | Meadow Plate
303 | Icicle Plate
304 | Fist Plate
305 | Toxic Plate
306 | Earth Plate
307 | Sky Plate
308 | Mind Plate
309 | Insect Plate
310 | Stone Plate
311 | Spooky Plate
312 | Draco Plate
313 | Dread Plate
314 | Iron Plate
315 | Odd Incense
316 | Rock Incense
317 | Full Incense
318 | Wave Incense
319 | Rose Incense
320 | Luck Incense
321 | Pure Incense
322 | Protector
323 | Electirizer
324 | Magmarizer
325 | Dubious Disc
326 | Reaper Cloth
327 | Razor Claw
328 | Razor Fang
329 | TM01
330 | TM02
331 | TM03
332 | TM04
333 | TM05
334 | TM06
335 | TM07
336 | TM08
337 | TM09
338 | TM10
339 | TM11
340 | TM12
341 | TM13
342 | TM14
343 | TM15
344 | TM16
345 | TM17
346 | TM18
347 | TM19
348 | TM20
349 | TM21
350 | TM22
351 | TM23
352 | TM24
353 | TM25
354 | TM26
355 | TM27
356 | TM28
357 | TM29
358 | TM30
359 | TM31
360 | TM32
361 | TM33
362 | TM34
363 | TM35
364 | TM36
365 | TM37
366 | TM38
367 | TM39
368 | TM40
369 | TM41
370 | TM42
371 | TM43
372 | TM44
373 | TM45
374 | TM46
375 | TM47
376 | TM48
377 | TM49
378 | TM50
379 | TM51
380 | TM52
381 | TM53
382 | TM54
383 | TM55
384 | TM56
385 | TM57
386 | TM58
387 | TM59
388 | TM60
389 | TM61
390 | TM62
391 | TM63
392 | TM64
393 | TM65
394 | TM66
395 | TM67
396 | TM68
397 | TM69
398 | TM70
399 | TM71
400 | TM72
401 | TM73
402 | TM74
403 | TM75
404 | TM76
405 | TM77
406 | TM78
407 | TM79
408 | TM80
409 | TM81
410 | TM82
411 | TM83
412 | TM84
413 | TM85
414 | TM86
415 | TM87
416 | TM88
417 | TM89
418 | TM90
419 | TM91
420 | TM92
421 | HM01
422 | HM02
423 | HM03
424 | HM04
425 | HM05
426 | HM06
427 | ???
428 | ???
429 | Explorer Kit
430 | Loot Sack
431 | Rule Book
432 | Poke Radar
433 | Point Card
434 | Journal
435 | Seal Case
436 | Fashion Case
437 | Seal Bag
438 | Pal Pad
439 | Works Key
440 | Old Charm
441 | Galactic Key
442 | Red Chain
443 | Town Map
444 | Vs. Seeker
445 | Coin Case
446 | Old Rod
447 | Good Rod
448 | Super Rod
449 | Sprayduck
450 | Poffin Case
451 | Bike
452 | Suite Key
453 | Oak’s Letter
454 | Lunar Wing
455 | Member Card
456 | Azure Flute
457 | S.S. Ticket
458 | Contest Pass
459 | Magma Stone
460 | Parcel
461 | Coupon 1
462 | Coupon 2
463 | Coupon 3
464 | Storage Key
465 | Secret Potion
466 | Vs. Recorder
467 | Gracidea
468 | Secret Key
469 | Apricorn Box
470 | Unown Report
471 | Berry Pots
472 | Dowsing Machine
473 | Blue Card
474 | Slowpoke Tail
475 | Clear Bell
476 | Card Key
477 | Basement Key
478 | Squirt Bottle
479 | Red Scale
480 | Lost Item
481 | Pass
482 | Machine Part
483 | Silver Wing
484 | Rainbow Wing
485 | Mystery Egg
486 | Red Apricorn
487 | Blue Apricorn
488 | Yellow Apricorn
489 | Green Apricorn
490 | Pink Apricorn
491 | White Apricorn
492 | Black Apricorn
493 | Fast Ball
494 | Level Ball
495 | Lure Ball
496 | Heavy Ball
497 | Love Ball
498 | Friend Ball
499 | Moon Ball
500 | Sport Ball
501 | Park Ball
502 | Photo Album
503 | GB Sounds
504 | Tidal Bell
505 | Rage Candy Bar
506 | Data Card 01
507 | Data Card 02
508 | Data Card 03
509 | Data Card 04
510 | Data Card 05
511 | Data Card 06
512 | Data Card 07
513 | Data Card 08
514 | Data Card 09
515 | Data Card 10
516 | Data Card 11
517 | Data Card 12
518 | Data Card 13
519 | Data Card 14
520 | Data Card 15
521 | Data Card 16
522 | Data Card 17
523 | Data Card 18
524 | Data Card 19
525 | Data Card 20
526 | Data Card 21
527 | Data Card 22
528 | Data Card 23
529 | Data Card 24
530 | Data Card 25
531 | Data Card 26
532 | Data Card 27
533 | Jade Orb
534 | Lock Capsule
535 | Red Orb
536 | Blue Orb
537 | Enigma Stone
538 | Prism Scale
539 | Eviolite
540 | Float Stone
541 | Rocky Helmet
542 | Air Balloon
543 | Red Card
544 | Ring Target
545 | Binding Band
546 | Absorb Bulb
547 | Cell Battery
548 | Eject Button
549 | Fire Gem
550 | Water Gem
551 | Electric Gem
552 | Grass Gem
553 | Ice Gem
554 | Fighting Gem
555 | Poison Gem
556 | Ground Gem
557 | Flying Gem
558 | Psychic Gem
559 | Bug Gem
560 | Rock Gem
561 | Ghost Gem
562 | Dragon Gem
563 | Dark Gem
564 | Steel Gem
565 | Normal Gem
566 | Health Wing
567 | Muscle Wing
568 | Resist Wing
569 | Genius Wing
570 | Clever Wing
571 | Swift Wing
572 | Pretty Wing
573 | Cover Fossil
574 | Plume Fossil
575 | Liberty Pass
576 | Pass Orb
577 | Dream Ball
578 | Poke Toy
579 | Prop Case
580 | Dragon Skull
581 | Balm Mushroom
582 | Big Nugget
583 | Pearl String
584 | Comet Shard
585 | Relic Copper
586 | Relic Silver
587 | Relic Gold
588 | Relic Vase
589 | Relic Band
590 | Relic Statue
591 | Relic Crown
592 | Casteliacone
593 | Dire Hit 2
594 | X Speed 2
595 | X Sp. Atk 2
596 | X Sp. Def 2
597 | X Defense 2
598 | X Attack 2
599 | X Accuracy 2
600 | X Speed 3
601 | X Sp. Atk 3
602 | X Sp. Def 3
603 | X Defense 3
604 | X Attack 3
605 | X Accuracy 3
606 | X Speed 6
607 | X Sp. Atk 6
608 | X Sp. Def 6
609 | X Defense 6
610 | X Attack 6
611 | X Accuracy 6
612 | Ability Urge
613 | Item Drop
614 | Item Urge
615 | Reset Urge
616 | Dire Hit 3
617 | Light Stone
618 | Dark Stone
619 | TM93
620 | TM94
621 | TM95
622 | Xtransceiver
623 | ???
624 | Gram 1
625 | Gram 2
626 | Gram 3
627 | Xtransceiver
628 | Medal Box
629 | DNA Splicers
630 | DNA Splicers
631 | Permit
632 | Oval Charm
633 | Shiny Charm
634 | Plasma Card
635 | Grubby Hanky
636 | Colress Machine
637 | Dropped Item
638 | Dropped Item
639 | Reveal Glass
640 | Weakness Policy
641 | Assault Vest
642 | Holo Caster
643 | Prof’s Letter
644 | Roller Skates
645 | Pixie Plate
646 | Ability Capsule
647 | Whipped Dream
648 | Sachet
649 | Luminous Moss
650 | Snowball
651 | Safety Goggles
652 | Poke Flute
653 | Rich Mulch
654 | Surprise Mulch
655 | Boost Mulch
656 | Amaze Mulch
657 | Gengarite
658 | Gardevoirite
659 | Ampharosite
660 | Venusaurite
661 | Charizardite X
662 | Blastoisinite
663 | Mewtwonite X
664 | Mewtwonite Y
665 | Blazikenite
666 | Medichamite
667 | Houndoominite
668 | Aggronite
669 | Banettite
670 | Tyranitarite
671 | Scizorite
672 | Pinsirite
673 | Aerodactylite
674 | Lucarionite
675 | Abomasite
676 | Kangaskhanite
677 | Gyaradosite
678 | Absolite
679 | Charizardite Y
680 | Alakazite
681 | Heracronite
682 | Mawilite
683 | Manectite
684 | Garchompite
685 | Latiasite
686 | Latiosite
687 | Roseli Berry
688 | Kee Berry
689 | Maranga Berry
690 | Sprinklotad
691 | TM96
692 | TM97
693 | TM98
694 | TM99
695 | TM100
696 | Power Plant Pass
697 | Mega Ring
698 | Intriguing Stone
699 | Common Stone
700 | Discount Coupon
701 | Elevator Key
702 | TMV Pass
703 | Honor of Kalos
704 | Adventure Rules
705 | Strange Souvenir
706 | Lens Case
707 | Travel Trunk
708 | Travel Trunk
709 | Lumiose Galette
710 | Shalour Sable
711 | Jaw Fossil
712 | Sail Fossil
713 | Looker Ticket
714 | Bike
715 | Holo Caster
716 | Fairy Gem
717 | Mega Charm
718 | Mega Glove
719 | Mach Bike
720 | Acro Bike
721 | Wailmer Pail
722 | Devon Parts
723 | Soot Sack
724 | Basement Key
725 | Pokeblock Kit
726 | Letter
727 | Eon Ticket
728 | Scanner
729 | Go-Goggles
730 | Meteorite
731 | Key to Room 1
732 | Key to Room 2
733 | Key to Room 4
734 | Key to Room 6
735 | Storage Key
736 | Devon Scope
737 | S.S. Ticket
738 | HM07
739 | Devon Scuba Gear
740 | Contest Costume
741 | Contest Costume
742 | Magma Suit
743 | Aqua Suit
744 | Pair of Tickets
745 | Mega Bracelet
746 | Mega Pendant
747 | Mega Glasses
748 | Mega Anchor
749 | Mega Stickpin
750 | Mega Tiara
751 | Mega Anklet
752 | Meteorite
753 | Swampertite
754 | Sceptilite
755 | Sablenite
756 | Altarianite
757 | Galladite
758 | Audinite
759 | Metagrossite
760 | Sharpedonite
761 | Slowbronite
762 | Steelixite
763 | Pidgeotite
764 | Glalitite
765 | Diancite
766 | Prison Bottle
767 | Mega Cuff
768 | Cameruptite
769 | Lopunnite
770 | Salamencite
771 | Beedrillite
772 | Meteorite
773 | Meteorite
774 | Key Stone
775 | Meteorite Shard
776 | Eon Flute
777 |
--------------------------------------------------------------------------------
/data/text/text_Moves_en.txt:
--------------------------------------------------------------------------------
1 | -
2 | Pound
3 | Karate Chop
4 | Double Slap
5 | Comet Punch
6 | Mega Punch
7 | Pay Day
8 | Fire Punch
9 | Ice Punch
10 | Thunder Punch
11 | Scratch
12 | Vice Grip
13 | Guillotine
14 | Razor Wind
15 | Swords Dance
16 | Cut
17 | Gust
18 | Wing Attack
19 | Whirlwind
20 | Fly
21 | Bind
22 | Slam
23 | Vine Whip
24 | Stomp
25 | Double Kick
26 | Mega Kick
27 | Jump Kick
28 | Rolling Kick
29 | Sand Attack
30 | Headbutt
31 | Horn Attack
32 | Fury Attack
33 | Horn Drill
34 | Tackle
35 | Body Slam
36 | Wrap
37 | Take Down
38 | Thrash
39 | Double-Edge
40 | Tail Whip
41 | Poison Sting
42 | Twineedle
43 | Pin Missile
44 | Leer
45 | Bite
46 | Growl
47 | Roar
48 | Sing
49 | Supersonic
50 | Sonic Boom
51 | Disable
52 | Acid
53 | Ember
54 | Flamethrower
55 | Mist
56 | Water Gun
57 | Hydro Pump
58 | Surf
59 | Ice Beam
60 | Blizzard
61 | Psybeam
62 | Bubble Beam
63 | Aurora Beam
64 | Hyper Beam
65 | Peck
66 | Drill Peck
67 | Submission
68 | Low Kick
69 | Counter
70 | Seismic Toss
71 | Strength
72 | Absorb
73 | Mega Drain
74 | Leech Seed
75 | Growth
76 | Razor Leaf
77 | Solar Beam
78 | Poison Powder
79 | Stun Spore
80 | Sleep Powder
81 | Petal Dance
82 | String Shot
83 | Dragon Rage
84 | Fire Spin
85 | Thunder Shock
86 | Thunderbolt
87 | Thunder Wave
88 | Thunder
89 | Rock Throw
90 | Earthquake
91 | Fissure
92 | Dig
93 | Toxic
94 | Confusion
95 | Psychic
96 | Hypnosis
97 | Meditate
98 | Agility
99 | Quick Attack
100 | Rage
101 | Teleport
102 | Night Shade
103 | Mimic
104 | Screech
105 | Double Team
106 | Recover
107 | Harden
108 | Minimize
109 | Smokescreen
110 | Confuse Ray
111 | Withdraw
112 | Defense Curl
113 | Barrier
114 | Light Screen
115 | Haze
116 | Reflect
117 | Focus Energy
118 | Bide
119 | Metronome
120 | Mirror Move
121 | Self-Destruct
122 | Egg Bomb
123 | Lick
124 | Smog
125 | Sludge
126 | Bone Club
127 | Fire Blast
128 | Waterfall
129 | Clamp
130 | Swift
131 | Skull Bash
132 | Spike Cannon
133 | Constrict
134 | Amnesia
135 | Kinesis
136 | Soft-Boiled
137 | High Jump Kick
138 | Glare
139 | Dream Eater
140 | Poison Gas
141 | Barrage
142 | Leech Life
143 | Lovely Kiss
144 | Sky Attack
145 | Transform
146 | Bubble
147 | Dizzy Punch
148 | Spore
149 | Flash
150 | Psywave
151 | Splash
152 | Acid Armor
153 | Crabhammer
154 | Explosion
155 | Fury Swipes
156 | Bonemerang
157 | Rest
158 | Rock Slide
159 | Hyper Fang
160 | Sharpen
161 | Conversion
162 | Tri Attack
163 | Super Fang
164 | Slash
165 | Substitute
166 | Struggle
167 | Sketch
168 | Triple Kick
169 | Thief
170 | Spider Web
171 | Mind Reader
172 | Nightmare
173 | Flame Wheel
174 | Snore
175 | Curse
176 | Flail
177 | Conversion 2
178 | Aeroblast
179 | Cotton Spore
180 | Reversal
181 | Spite
182 | Powder Snow
183 | Protect
184 | Mach Punch
185 | Scary Face
186 | Feint Attack
187 | Sweet Kiss
188 | Belly Drum
189 | Sludge Bomb
190 | Mud-Slap
191 | Octazooka
192 | Spikes
193 | Zap Cannon
194 | Foresight
195 | Destiny Bond
196 | Perish Song
197 | Icy Wind
198 | Detect
199 | Bone Rush
200 | Lock-On
201 | Outrage
202 | Sandstorm
203 | Giga Drain
204 | Endure
205 | Charm
206 | Rollout
207 | False Swipe
208 | Swagger
209 | Milk Drink
210 | Spark
211 | Fury Cutter
212 | Steel Wing
213 | Mean Look
214 | Attract
215 | Sleep Talk
216 | Heal Bell
217 | Return
218 | Present
219 | Frustration
220 | Safeguard
221 | Pain Split
222 | Sacred Fire
223 | Magnitude
224 | Dynamic Punch
225 | Megahorn
226 | Dragon Breath
227 | Baton Pass
228 | Encore
229 | Pursuit
230 | Rapid Spin
231 | Sweet Scent
232 | Iron Tail
233 | Metal Claw
234 | Vital Throw
235 | Morning Sun
236 | Synthesis
237 | Moonlight
238 | Hidden Power
239 | Cross Chop
240 | Twister
241 | Rain Dance
242 | Sunny Day
243 | Crunch
244 | Mirror Coat
245 | Psych Up
246 | Extreme Speed
247 | Ancient Power
248 | Shadow Ball
249 | Future Sight
250 | Rock Smash
251 | Whirlpool
252 | Beat Up
253 | Fake Out
254 | Uproar
255 | Stockpile
256 | Spit Up
257 | Swallow
258 | Heat Wave
259 | Hail
260 | Torment
261 | Flatter
262 | Will-O-Wisp
263 | Memento
264 | Facade
265 | Focus Punch
266 | Smelling Salts
267 | Follow Me
268 | Nature Power
269 | Charge
270 | Taunt
271 | Helping Hand
272 | Trick
273 | Role Play
274 | Wish
275 | Assist
276 | Ingrain
277 | Superpower
278 | Magic Coat
279 | Recycle
280 | Revenge
281 | Brick Break
282 | Yawn
283 | Knock Off
284 | Endeavor
285 | Eruption
286 | Skill Swap
287 | Imprison
288 | Refresh
289 | Grudge
290 | Snatch
291 | Secret Power
292 | Dive
293 | Arm Thrust
294 | Camouflage
295 | Tail Glow
296 | Luster Purge
297 | Mist Ball
298 | Feather Dance
299 | Teeter Dance
300 | Blaze Kick
301 | Mud Sport
302 | Ice Ball
303 | Needle Arm
304 | Slack Off
305 | Hyper Voice
306 | Poison Fang
307 | Crush Claw
308 | Blast Burn
309 | Hydro Cannon
310 | Meteor Mash
311 | Astonish
312 | Weather Ball
313 | Aromatherapy
314 | Fake Tears
315 | Air Cutter
316 | Overheat
317 | Odor Sleuth
318 | Rock Tomb
319 | Silver Wind
320 | Metal Sound
321 | Grass Whistle
322 | Tickle
323 | Cosmic Power
324 | Water Spout
325 | Signal Beam
326 | Shadow Punch
327 | Extrasensory
328 | Sky Uppercut
329 | Sand Tomb
330 | Sheer Cold
331 | Muddy Water
332 | Bullet Seed
333 | Aerial Ace
334 | Icicle Spear
335 | Iron Defense
336 | Block
337 | Howl
338 | Dragon Claw
339 | Frenzy Plant
340 | Bulk Up
341 | Bounce
342 | Mud Shot
343 | Poison Tail
344 | Covet
345 | Volt Tackle
346 | Magical Leaf
347 | Water Sport
348 | Calm Mind
349 | Leaf Blade
350 | Dragon Dance
351 | Rock Blast
352 | Shock Wave
353 | Water Pulse
354 | Doom Desire
355 | Psycho Boost
356 | Roost
357 | Gravity
358 | Miracle Eye
359 | Wake-Up Slap
360 | Hammer Arm
361 | Gyro Ball
362 | Healing Wish
363 | Brine
364 | Natural Gift
365 | Feint
366 | Pluck
367 | Tailwind
368 | Acupressure
369 | Metal Burst
370 | U-turn
371 | Close Combat
372 | Payback
373 | Assurance
374 | Embargo
375 | Fling
376 | Psycho Shift
377 | Trump Card
378 | Heal Block
379 | Wring Out
380 | Power Trick
381 | Gastro Acid
382 | Lucky Chant
383 | Me First
384 | Copycat
385 | Power Swap
386 | Guard Swap
387 | Punishment
388 | Last Resort
389 | Worry Seed
390 | Sucker Punch
391 | Toxic Spikes
392 | Heart Swap
393 | Aqua Ring
394 | Magnet Rise
395 | Flare Blitz
396 | Force Palm
397 | Aura Sphere
398 | Rock Polish
399 | Poison Jab
400 | Dark Pulse
401 | Night Slash
402 | Aqua Tail
403 | Seed Bomb
404 | Air Slash
405 | X-Scissor
406 | Bug Buzz
407 | Dragon Pulse
408 | Dragon Rush
409 | Power Gem
410 | Drain Punch
411 | Vacuum Wave
412 | Focus Blast
413 | Energy Ball
414 | Brave Bird
415 | Earth Power
416 | Switcheroo
417 | Giga Impact
418 | Nasty Plot
419 | Bullet Punch
420 | Avalanche
421 | Ice Shard
422 | Shadow Claw
423 | Thunder Fang
424 | Ice Fang
425 | Fire Fang
426 | Shadow Sneak
427 | Mud Bomb
428 | Psycho Cut
429 | Zen Headbutt
430 | Mirror Shot
431 | Flash Cannon
432 | Rock Climb
433 | Defog
434 | Trick Room
435 | Draco Meteor
436 | Discharge
437 | Lava Plume
438 | Leaf Storm
439 | Power Whip
440 | Rock Wrecker
441 | Cross Poison
442 | Gunk Shot
443 | Iron Head
444 | Magnet Bomb
445 | Stone Edge
446 | Captivate
447 | Stealth Rock
448 | Grass Knot
449 | Chatter
450 | Judgment
451 | Bug Bite
452 | Charge Beam
453 | Wood Hammer
454 | Aqua Jet
455 | Attack Order
456 | Defend Order
457 | Heal Order
458 | Head Smash
459 | Double Hit
460 | Roar of Time
461 | Spacial Rend
462 | Lunar Dance
463 | Crush Grip
464 | Magma Storm
465 | Dark Void
466 | Seed Flare
467 | Ominous Wind
468 | Shadow Force
469 | Hone Claws
470 | Wide Guard
471 | Guard Split
472 | Power Split
473 | Wonder Room
474 | Psyshock
475 | Venoshock
476 | Autotomize
477 | Rage Powder
478 | Telekinesis
479 | Magic Room
480 | Smack Down
481 | Storm Throw
482 | Flame Burst
483 | Sludge Wave
484 | Quiver Dance
485 | Heavy Slam
486 | Synchronoise
487 | Electro Ball
488 | Soak
489 | Flame Charge
490 | Coil
491 | Low Sweep
492 | Acid Spray
493 | Foul Play
494 | Simple Beam
495 | Entrainment
496 | After You
497 | Round
498 | Echoed Voice
499 | Chip Away
500 | Clear Smog
501 | Stored Power
502 | Quick Guard
503 | Ally Switch
504 | Scald
505 | Shell Smash
506 | Heal Pulse
507 | Hex
508 | Sky Drop
509 | Shift Gear
510 | Circle Throw
511 | Incinerate
512 | Quash
513 | Acrobatics
514 | Reflect Type
515 | Retaliate
516 | Final Gambit
517 | Bestow
518 | Inferno
519 | Water Pledge
520 | Fire Pledge
521 | Grass Pledge
522 | Volt Switch
523 | Struggle Bug
524 | Bulldoze
525 | Frost Breath
526 | Dragon Tail
527 | Work Up
528 | Electroweb
529 | Wild Charge
530 | Drill Run
531 | Dual Chop
532 | Heart Stamp
533 | Horn Leech
534 | Sacred Sword
535 | Razor Shell
536 | Heat Crash
537 | Leaf Tornado
538 | Steamroller
539 | Cotton Guard
540 | Night Daze
541 | Psystrike
542 | Tail Slap
543 | Hurricane
544 | Head Charge
545 | Gear Grind
546 | Searing Shot
547 | Techno Blast
548 | Relic Song
549 | Secret Sword
550 | Glaciate
551 | Bolt Strike
552 | Blue Flare
553 | Fiery Dance
554 | Freeze Shock
555 | Ice Burn
556 | Snarl
557 | Icicle Crash
558 | V-create
559 | Fusion Flare
560 | Fusion Bolt
561 | Flying Press
562 | Mat Block
563 | Belch
564 | Rototiller
565 | Sticky Web
566 | Fell Stinger
567 | Phantom Force
568 | Trick-or-Treat
569 | Noble Roar
570 | Ion Deluge
571 | Parabolic Charge
572 | Forest’s Curse
573 | Petal Blizzard
574 | Freeze-Dry
575 | Disarming Voice
576 | Parting Shot
577 | Topsy-Turvy
578 | Draining Kiss
579 | Crafty Shield
580 | Flower Shield
581 | Grassy Terrain
582 | Misty Terrain
583 | Electrify
584 | Play Rough
585 | Fairy Wind
586 | Moonblast
587 | Boomburst
588 | Fairy Lock
589 | King’s Shield
590 | Play Nice
591 | Confide
592 | Diamond Storm
593 | Steam Eruption
594 | Hyperspace Hole
595 | Water Shuriken
596 | Mystical Fire
597 | Spiky Shield
598 | Aromatic Mist
599 | Eerie Impulse
600 | Venom Drench
601 | Powder
602 | Geomancy
603 | Magnetic Flux
604 | Happy Hour
605 | Electric Terrain
606 | Dazzling Gleam
607 | Celebrate
608 | Hold Hands
609 | Baby-Doll Eyes
610 | Nuzzle
611 | Hold Back
612 | Infestation
613 | Power-Up Punch
614 | Oblivion Wing
615 | Thousand Arrows
616 | Thousand Waves
617 | Land’s Wrath
618 | Light of Ruin
619 | Origin Pulse
620 | Precipice Blades
621 | Dragon Ascent
622 | Hyperspace Fury
623 |
--------------------------------------------------------------------------------
/data/text/text_Natures_en.txt:
--------------------------------------------------------------------------------
1 | Hardy
2 | Lonely
3 | Brave
4 | Adamant
5 | Naughty
6 | Bold
7 | Docile
8 | Relaxed
9 | Impish
10 | Lax
11 | Timid
12 | Hasty
13 | Serious
14 | Jolly
15 | Naive
16 | Modest
17 | Mild
18 | Quiet
19 | Bashful
20 | Rash
21 | Calm
22 | Gentle
23 | Sassy
24 | Careful
25 | Quirky
--------------------------------------------------------------------------------
/data/text/text_Species_en.txt:
--------------------------------------------------------------------------------
1 | Egg
2 | Bulbasaur
3 | Ivysaur
4 | Venusaur
5 | Charmander
6 | Charmeleon
7 | Charizard
8 | Squirtle
9 | Wartortle
10 | Blastoise
11 | Caterpie
12 | Metapod
13 | Butterfree
14 | Weedle
15 | Kakuna
16 | Beedrill
17 | Pidgey
18 | Pidgeotto
19 | Pidgeot
20 | Rattata
21 | Raticate
22 | Spearow
23 | Fearow
24 | Ekans
25 | Arbok
26 | Pikachu
27 | Raichu
28 | Sandshrew
29 | Sandslash
30 | NidoranM
31 | Nidorina
32 | Nidoqueen
33 | NidoranF
34 | Nidorino
35 | Nidoking
36 | Clefairy
37 | Clefable
38 | Vulpix
39 | Ninetales
40 | Jigglypuff
41 | Wigglytuff
42 | Zubat
43 | Golbat
44 | Oddish
45 | Gloom
46 | Vileplume
47 | Paras
48 | Parasect
49 | Venonat
50 | Venomoth
51 | Diglett
52 | Dugtrio
53 | Meowth
54 | Persian
55 | Psyduck
56 | Golduck
57 | Mankey
58 | Primeape
59 | Growlithe
60 | Arcanine
61 | Poliwag
62 | Poliwhirl
63 | Poliwrath
64 | Abra
65 | Kadabra
66 | Alakazam
67 | Machop
68 | Machoke
69 | Machamp
70 | Bellsprout
71 | Weepinbell
72 | Victreebel
73 | Tentacool
74 | Tentacruel
75 | Geodude
76 | Graveler
77 | Golem
78 | Ponyta
79 | Rapidash
80 | Slowpoke
81 | Slowbro
82 | Magnemite
83 | Magneton
84 | Farfetch'd
85 | Doduo
86 | Dodrio
87 | Seel
88 | Dewgong
89 | Grimer
90 | Muk
91 | Shellder
92 | Cloyster
93 | Gastly
94 | Haunter
95 | Gengar
96 | Onix
97 | Drowzee
98 | Hypno
99 | Krabby
100 | Kingler
101 | Voltorb
102 | Electrode
103 | Exeggcute
104 | Exeggutor
105 | Cubone
106 | Marowak
107 | Hitmonlee
108 | Hitmonchan
109 | Lickitung
110 | Koffing
111 | Weezing
112 | Rhyhorn
113 | Rhydon
114 | Chansey
115 | Tangela
116 | Kangaskhan
117 | Horsea
118 | Seadra
119 | Goldeen
120 | Seaking
121 | Staryu
122 | Starmie
123 | Mr. Mime
124 | Scyther
125 | Jynx
126 | Electabuzz
127 | Magmar
128 | Pinsir
129 | Tauros
130 | Magikarp
131 | Gyarados
132 | Lapras
133 | Ditto
134 | Eevee
135 | Vaporeon
136 | Jolteon
137 | Flareon
138 | Porygon
139 | Omanyte
140 | Omastar
141 | Kabuto
142 | Kabutops
143 | Aerodactyl
144 | Snorlax
145 | Articuno
146 | Zapdos
147 | Moltres
148 | Dratini
149 | Dragonair
150 | Dragonite
151 | Mewtwo
152 | Mew
153 | Chikorita
154 | Bayleef
155 | Meganium
156 | Cyndaquil
157 | Quilava
158 | Typhlosion
159 | Totodile
160 | Croconaw
161 | Feraligatr
162 | Sentret
163 | Furret
164 | Hoothoot
165 | Noctowl
166 | Ledyba
167 | Ledian
168 | Spinarak
169 | Ariados
170 | Crobat
171 | Chinchou
172 | Lanturn
173 | Pichu
174 | Cleffa
175 | Igglybuff
176 | Togepi
177 | Togetic
178 | Natu
179 | Xatu
180 | Mareep
181 | Flaaffy
182 | Ampharos
183 | Bellossom
184 | Marill
185 | Azumarill
186 | Sudowoodo
187 | Politoed
188 | Hoppip
189 | Skiploom
190 | Jumpluff
191 | Aipom
192 | Sunkern
193 | Sunflora
194 | Yanma
195 | Wooper
196 | Quagsire
197 | Espeon
198 | Umbreon
199 | Murkrow
200 | Slowking
201 | Misdreavus
202 | Unown
203 | Wobbuffet
204 | Girafarig
205 | Pineco
206 | Forretress
207 | Dunsparce
208 | Gligar
209 | Steelix
210 | Snubbull
211 | Granbull
212 | Qwilfish
213 | Scizor
214 | Shuckle
215 | Heracross
216 | Sneasel
217 | Teddiursa
218 | Ursaring
219 | Slugma
220 | Magcargo
221 | Swinub
222 | Piloswine
223 | Corsola
224 | Remoraid
225 | Octillery
226 | Delibird
227 | Mantine
228 | Skarmory
229 | Houndour
230 | Houndoom
231 | Kingdra
232 | Phanpy
233 | Donphan
234 | Porygon2
235 | Stantler
236 | Smeargle
237 | Tyrogue
238 | Hitmontop
239 | Smoochum
240 | Elekid
241 | Magby
242 | Miltank
243 | Blissey
244 | Raikou
245 | Entei
246 | Suicune
247 | Larvitar
248 | Pupitar
249 | Tyranitar
250 | Lugia
251 | Ho-Oh
252 | Celebi
253 | Treecko
254 | Grovyle
255 | Sceptile
256 | Torchic
257 | Combusken
258 | Blaziken
259 | Mudkip
260 | Marshtomp
261 | Swampert
262 | Poochyena
263 | Mightyena
264 | Zigzagoon
265 | Linoone
266 | Wurmple
267 | Silcoon
268 | Beautifly
269 | Cascoon
270 | Dustox
271 | Lotad
272 | Lombre
273 | Ludicolo
274 | Seedot
275 | Nuzleaf
276 | Shiftry
277 | Taillow
278 | Swellow
279 | Wingull
280 | Pelipper
281 | Ralts
282 | Kirlia
283 | Gardevoir
284 | Surskit
285 | Masquerain
286 | Shroomish
287 | Breloom
288 | Slakoth
289 | Vigoroth
290 | Slaking
291 | Nincada
292 | Ninjask
293 | Shedinja
294 | Whismur
295 | Loudred
296 | Exploud
297 | Makuhita
298 | Hariyama
299 | Azurill
300 | Nosepass
301 | Skitty
302 | Delcatty
303 | Sableye
304 | Mawile
305 | Aron
306 | Lairon
307 | Aggron
308 | Meditite
309 | Medicham
310 | Electrike
311 | Manectric
312 | Plusle
313 | Minun
314 | Volbeat
315 | Illumise
316 | Roselia
317 | Gulpin
318 | Swalot
319 | Carvanha
320 | Sharpedo
321 | Wailmer
322 | Wailord
323 | Numel
324 | Camerupt
325 | Torkoal
326 | Spoink
327 | Grumpig
328 | Spinda
329 | Trapinch
330 | Vibrava
331 | Flygon
332 | Cacnea
333 | Cacturne
334 | Swablu
335 | Altaria
336 | Zangoose
337 | Seviper
338 | Lunatone
339 | Solrock
340 | Barboach
341 | Whiscash
342 | Corphish
343 | Crawdaunt
344 | Baltoy
345 | Claydol
346 | Lileep
347 | Cradily
348 | Anorith
349 | Armaldo
350 | Feebas
351 | Milotic
352 | Castform
353 | Kecleon
354 | Shuppet
355 | Banette
356 | Duskull
357 | Dusclops
358 | Tropius
359 | Chimecho
360 | Absol
361 | Wynaut
362 | Snorunt
363 | Glalie
364 | Spheal
365 | Sealeo
366 | Walrein
367 | Clamperl
368 | Huntail
369 | Gorebyss
370 | Relicanth
371 | Luvdisc
372 | Bagon
373 | Shelgon
374 | Salamence
375 | Beldum
376 | Metang
377 | Metagross
378 | Regirock
379 | Regice
380 | Registeel
381 | Latias
382 | Latios
383 | Kyogre
384 | Groudon
385 | Rayquaza
386 | Jirachi
387 | Deoxys
388 | Turtwig
389 | Grotle
390 | Torterra
391 | Chimchar
392 | Monferno
393 | Infernape
394 | Piplup
395 | Prinplup
396 | Empoleon
397 | Starly
398 | Staravia
399 | Staraptor
400 | Bidoof
401 | Bibarel
402 | Kricketot
403 | Kricketune
404 | Shinx
405 | Luxio
406 | Luxray
407 | Budew
408 | Roserade
409 | Cranidos
410 | Rampardos
411 | Shieldon
412 | Bastiodon
413 | Burmy
414 | Wormadam
415 | Mothim
416 | Combee
417 | Vespiquen
418 | Pachirisu
419 | Buizel
420 | Floatzel
421 | Cherubi
422 | Cherrim
423 | Shellos
424 | Gastrodon
425 | Ambipom
426 | Drifloon
427 | Drifblim
428 | Buneary
429 | Lopunny
430 | Mismagius
431 | Honchkrow
432 | Glameow
433 | Purugly
434 | Chingling
435 | Stunky
436 | Skuntank
437 | Bronzor
438 | Bronzong
439 | Bonsly
440 | Mime Jr.
441 | Happiny
442 | Chatot
443 | Spiritomb
444 | Gible
445 | Gabite
446 | Garchomp
447 | Munchlax
448 | Riolu
449 | Lucario
450 | Hippopotas
451 | Hippowdon
452 | Skorupi
453 | Drapion
454 | Croagunk
455 | Toxicroak
456 | Carnivine
457 | Finneon
458 | Lumineon
459 | Mantyke
460 | Snover
461 | Abomasnow
462 | Weavile
463 | Magnezone
464 | Lickilicky
465 | Rhyperior
466 | Tangrowth
467 | Electivire
468 | Magmortar
469 | Togekiss
470 | Yanmega
471 | Leafeon
472 | Glaceon
473 | Gliscor
474 | Mamoswine
475 | Porygon-Z
476 | Gallade
477 | Probopass
478 | Dusknoir
479 | Froslass
480 | Rotom
481 | Uxie
482 | Mesprit
483 | Azelf
484 | Dialga
485 | Palkia
486 | Heatran
487 | Regigigas
488 | Giratina
489 | Cresselia
490 | Phione
491 | Manaphy
492 | Darkrai
493 | Shaymin
494 | Arceus
495 | Victini
496 | Snivy
497 | Servine
498 | Serperior
499 | Tepig
500 | Pignite
501 | Emboar
502 | Oshawott
503 | Dewott
504 | Samurott
505 | Patrat
506 | Watchog
507 | Lillipup
508 | Herdier
509 | Stoutland
510 | Purrloin
511 | Liepard
512 | Pansage
513 | Simisage
514 | Pansear
515 | Simisear
516 | Panpour
517 | Simipour
518 | Munna
519 | Musharna
520 | Pidove
521 | Tranquill
522 | Unfezant
523 | Blitzle
524 | Zebstrika
525 | Roggenrola
526 | Boldore
527 | Gigalith
528 | Woobat
529 | Swoobat
530 | Drilbur
531 | Excadrill
532 | Audino
533 | Timburr
534 | Gurdurr
535 | Conkeldurr
536 | Tympole
537 | Palpitoad
538 | Seismitoad
539 | Throh
540 | Sawk
541 | Sewaddle
542 | Swadloon
543 | Leavanny
544 | Venipede
545 | Whirlipede
546 | Scolipede
547 | Cottonee
548 | Whimsicott
549 | Petilil
550 | Lilligant
551 | Basculin
552 | Sandile
553 | Krokorok
554 | Krookodile
555 | Darumaka
556 | Darmanitan
557 | Maractus
558 | Dwebble
559 | Crustle
560 | Scraggy
561 | Scrafty
562 | Sigilyph
563 | Yamask
564 | Cofagrigus
565 | Tirtouga
566 | Carracosta
567 | Archen
568 | Archeops
569 | Trubbish
570 | Garbodor
571 | Zorua
572 | Zoroark
573 | Minccino
574 | Cinccino
575 | Gothita
576 | Gothorita
577 | Gothitelle
578 | Solosis
579 | Duosion
580 | Reuniclus
581 | Ducklett
582 | Swanna
583 | Vanillite
584 | Vanillish
585 | Vanilluxe
586 | Deerling
587 | Sawsbuck
588 | Emolga
589 | Karrablast
590 | Escavalier
591 | Foongus
592 | Amoonguss
593 | Frillish
594 | Jellicent
595 | Alomomola
596 | Joltik
597 | Galvantula
598 | Ferroseed
599 | Ferrothorn
600 | Klink
601 | Klang
602 | Klinklang
603 | Tynamo
604 | Eelektrik
605 | Eelektross
606 | Elgyem
607 | Beheeyem
608 | Litwick
609 | Lampent
610 | Chandelure
611 | Axew
612 | Fraxure
613 | Haxorus
614 | Cubchoo
615 | Beartic
616 | Cryogonal
617 | Shelmet
618 | Accelgor
619 | Stunfisk
620 | Mienfoo
621 | Mienshao
622 | Druddigon
623 | Golett
624 | Golurk
625 | Pawniard
626 | Bisharp
627 | Bouffalant
628 | Rufflet
629 | Braviary
630 | Vullaby
631 | Mandibuzz
632 | Heatmor
633 | Durant
634 | Deino
635 | Zweilous
636 | Hydreigon
637 | Larvesta
638 | Volcarona
639 | Cobalion
640 | Terrakion
641 | Virizion
642 | Tornadus
643 | Thundurus
644 | Reshiram
645 | Zekrom
646 | Landorus
647 | Kyurem
648 | Keldeo
649 | Meloetta
650 | Genesect
651 | Chespin
652 | Quilladin
653 | Chesnaught
654 | Fennekin
655 | Braixen
656 | Delphox
657 | Froakie
658 | Frogadier
659 | Greninja
660 | Bunnelby
661 | Diggersby
662 | Fletchling
663 | Fletchinder
664 | Talonflame
665 | Scatterbug
666 | Spewpa
667 | Vivillon
668 | Litleo
669 | Pyroar
670 | Flabebe
671 | Floette
672 | Florges
673 | Skiddo
674 | Gogoat
675 | Pancham
676 | Pangoro
677 | Furfrou
678 | Espurr
679 | Meowstic
680 | Honedge
681 | Doublade
682 | Aegislash
683 | Spritzee
684 | Aromatisse
685 | Swirlix
686 | Slurpuff
687 | Inkay
688 | Malamar
689 | Binacle
690 | Barbaracle
691 | Skrelp
692 | Dragalge
693 | Clauncher
694 | Clawitzer
695 | Helioptile
696 | Heliolisk
697 | Tyrunt
698 | Tyrantrum
699 | Amaura
700 | Aurorus
701 | Sylveon
702 | Hawlucha
703 | Dedenne
704 | Carbink
705 | Goomy
706 | Sliggoo
707 | Goodra
708 | Klefki
709 | Phantump
710 | Trevenant
711 | Pumpkaboo
712 | Gourgeist
713 | Bergmite
714 | Avalugg
715 | Noibat
716 | Noivern
717 | Xerneas
718 | Yveltal
719 | Zygarde
720 | Diancie
721 | Hoopa
722 | Volcanion
723 |
--------------------------------------------------------------------------------
/export.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir -p export/PCHex
4 | cp -rf data PCHex.3dsx PCHex.smdh PCHex.xml export/PCHex
5 |
6 |
--------------------------------------------------------------------------------
/source/UI.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include <3ds.h>
6 |
7 | #include "pchex.h"
8 |
9 | //load a pokemon from a given slot in the save to the 'dest' array
10 | s32 loadPokemon(t_stinf *state, u16 slot, u8 *dest)
11 | {
12 | u8 tmp[232];
13 | u32 offs = state->pch->game ? 0x33000 : 0x22600;
14 |
15 | memcpy(tmp, state->pch->save + offs + 232 * slot, 232);
16 | decryptPokemon(tmp, dest);
17 | return 0;
18 | }
19 |
20 | s32 rewritechk(u8 *dec)
21 | {
22 | u16 chk = 0;
23 |
24 | for (int i = 8; i < 232; i += 2)
25 | chk += *(u16 *)(dec + i);
26 | memcpy(dec + 6, &chk, 2);
27 | return 0;
28 | }
29 |
30 | //save a pokemon from the 'src' array to a given slot in the save
31 | s32 savePokemon(t_stinf *state, u16 slot, u8 *src)
32 | {
33 | u8 enc[232];
34 | u32 offs = state->pch->game ? 0x33000 : 0x22600;
35 |
36 | rewritechk(src); //rewrite the pokemon's checksum, otherwise bad egg
37 | encryptPokemon(src, enc);
38 | memcpy(state->pch->save + offs + 232 * slot, enc, 232);
39 | return 0;
40 | }
41 |
42 | //switch to a given state
43 | s32 switchState(t_stinf *state, struct s_UIState newst)
44 | {
45 | state->curState = newst;
46 | state->curState.initf(state);
47 | return (0);
48 | }
49 |
50 | //Main loop : Executes the current state's functions
51 | //initf : 'init' function
52 | //dispf : 'display' function
53 | //inputf : 'input' function
54 | s32 startLoop(struct s_pchex *pch)
55 | {
56 | t_stinf state;
57 |
58 | state.pch = pch;
59 | //Default state settings
60 | state.pkmSlot = 0;
61 | state.cont = 1;
62 | state.inState = 1;
63 |
64 | //First state is pokemon slot selection
65 | state.curState = pkmSelectState;
66 | state.curState.initf(&state);
67 | memset(&state.cpy, 0, sizeof(state.cpy));
68 |
69 | //main loop
70 | while (state.cont > 0 && aptMainLoop())
71 | {
72 | hidScanInput();
73 | state.kPressed = hidKeysDown();
74 | state.curState.dispf(&state);
75 | state.curState.inputf(&state);
76 |
77 | gfxFlushBuffers();
78 | gfxSwapBuffers();
79 | gspWaitForVBlank();
80 | }
81 | if (state.cont == -1)
82 | return 1;
83 | return 0;
84 | }
85 |
--------------------------------------------------------------------------------
/source/fs.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include <3ds.h>
4 |
5 | #include "pchex.h"
6 |
7 | Result _srvGetServiceHandle(Handle* out, const char* name)
8 | {
9 | Result rc = 0;
10 |
11 | u32* cmdbuf = getThreadCommandBuffer();
12 | cmdbuf[0] = 0x50100;
13 | strcpy((char*) &cmdbuf[1], name);
14 | cmdbuf[3] = strlen(name);
15 | cmdbuf[4] = 0x0;
16 |
17 | if((rc = svcSendSyncRequest(*srvGetSessionHandle())))return rc;
18 |
19 | *out = cmdbuf[3];
20 | return cmdbuf[1];
21 | }
22 |
23 | Result loadFile(char* path, void* dst, FS_archive* archive, Handle* fsHandle, u64 maxSize, u32 *bytesRead)
24 | {
25 | // must malloc first! (and memset, if you'd like)
26 | if(!path || !dst || !archive)return -1;
27 |
28 | u64 size;
29 | Result ret;
30 | Handle fileHandle;
31 |
32 | ret=FSUSER_OpenFile(fsHandle, &fileHandle, *archive, FS_makePath(PATH_CHAR, path), FS_OPEN_READ, FS_ATTRIBUTE_NONE);
33 | if(ret!=0)return ret;
34 |
35 | ret=FSFILE_GetSize(fileHandle, &size);
36 | if(ret!=0)goto loadFileExit;
37 | if(size>maxSize){ret=-2; goto loadFileExit;}
38 |
39 | ret=FSFILE_Read(fileHandle, bytesRead, 0x0, dst, size);
40 | if(ret!=0)goto loadFileExit;
41 | if(*bytesRead
2 | #include
3 | #include
4 | #include
5 | #include <3ds.h>
6 |
7 | #include "pchex.h"
8 |
9 | //Basic line separation to array of strings
10 | s8 loadLines(u8 *src, u8 *dst, u8 strlen, u32 size)
11 | {
12 | u16 readnum = 3;
13 | u16 line = 0, chr;
14 |
15 | while (readnum < size)
16 | {
17 | chr = 0;
18 | while (readnum < size && src[readnum] != '\n')
19 | {
20 | dst[line * strlen + chr] = src[readnum];
21 | readnum++;
22 | chr++;
23 | }
24 | dst[line * strlen + chr] = 0;
25 | readnum++;
26 | line++;
27 | }
28 | return 0;
29 | }
30 |
31 | /*
32 | * loads general pokemon data like names and species data
33 | */
34 | s8 loadData(Handle *sdHandle, FS_archive *sdArchive)
35 | {
36 | u8 tmp[12000];
37 | u32 bytesRead;
38 | Result ret;
39 |
40 | printf("Loading species data...");
41 | ret = loadFile("/3ds/PCHex/data/personal", tmp, sdArchive, sdHandle, 12000, &bytesRead);
42 | if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
43 | memcpy(pkData.pkmData, tmp, bytesRead);
44 | printf(" OK\n");
45 |
46 | printf("Loading species names...");
47 | ret = loadFile("/3ds/PCHex/data/text/text_Species_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
48 | if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
49 | loadLines(tmp, pkData.species[0], 12, bytesRead);
50 | printf(" OK\n");
51 |
52 | printf("Loading move names...");
53 | ret = loadFile("/3ds/PCHex/data/text/text_Moves_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
54 | if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
55 | loadLines(tmp, pkData.moves[0], 17, bytesRead);
56 | printf(" OK\n");
57 |
58 | printf("Loading ability names...");
59 | ret = loadFile("/3ds/PCHex/data/text/text_Abilities_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
60 | if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
61 | loadLines(tmp, pkData.abilities[0], 15, bytesRead);
62 | printf(" OK\n");
63 |
64 | printf("Loading item names...");
65 | ret = loadFile("/3ds/PCHex/data/text/text_Items_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
66 | if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
67 | loadLines(tmp, pkData.items[0], 17, bytesRead);
68 | printf(" OK\n");
69 |
70 | printf("Loading ball names...");
71 | ret = loadFile("/3ds/PCHex/data/text/text_Balls_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
72 | if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
73 | loadLines(tmp, pkData.balls[0], 13, bytesRead);
74 | printf(" OK\n");
75 |
76 | printf("Loading nature names...");
77 | ret = loadFile("/3ds/PCHex/data/text/text_Natures_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
78 | if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
79 | loadLines(tmp, pkData.natures[0], 8, bytesRead);
80 | printf(" OK\n");
81 | return 0;
82 | }
83 |
84 | void waitKey(u32 keyWait)
85 | {
86 | while (aptMainLoop())
87 | {
88 | hidScanInput();
89 |
90 | u32 kPressed = hidKeysDown();
91 | if (kPressed & keyWait) break;
92 |
93 | gfxFlushBuffers();
94 | gfxSwapBuffers();
95 | gspWaitForVBlank();
96 | }
97 | }
98 |
99 | int pchexinit(struct s_pchex *pch)
100 | {
101 | int fs;
102 |
103 | //General Init
104 | srand(time(NULL));
105 | gfxInitDefault();
106 | consoleInit(GFX_BOTTOM, &pch->bot);
107 | consoleInit(GFX_TOP, &pch->top);
108 |
109 | //Filesystem Init
110 | printf("Init Filesystem...\n");
111 | fs = filesysInit(&pch->sd.handle, &pch->sav.handle, &pch->sd.arch, &pch->sav.arch);
112 | if (fs)
113 | printf("Init FS Failed\n");
114 | else
115 | printf("Init FS OK\n");
116 |
117 | //Load Pokemon Data
118 | if (loadData(&pch->sd.handle, &pch->sd.arch))
119 | return -1;
120 |
121 | //save loading, save is loaded into the array 'save'
122 | pch->save = malloc(0xEB000);
123 | pch->game = loadSave(pch->save, &pch->sav.handle, &pch->sav.arch);
124 | if (pch->game < 0)
125 | pch->game = loadSave(pch->save, &pch->sd.handle, &pch->sd.arch);
126 | if (pch->game < 0)
127 | return -1;
128 |
129 | if (backupSave(pch->save, pch->game, &pch->sd.handle, &pch->sd.arch))
130 | {
131 | printf("Backup Failed, Exiting\n");
132 | return -1;
133 | }
134 | return 0;
135 | }
136 |
137 | int pchexexit(struct s_pchex *pch)
138 | {
139 | consoleSelect(&pch->bot);
140 | consoleClear();
141 | printf("\x1B[15;2H");
142 | printf("Program ended, press A to finish\n");
143 | waitKey(KEY_A);
144 | free(pch->save);
145 | gfxExit();
146 | filesysExit(&pch->sd.handle, &pch->sav.handle, &pch->sd.arch, &pch->sav.arch);
147 | return (0);
148 | }
149 |
150 | int main()
151 | {
152 | struct s_pchex pch;
153 |
154 | if (pchexinit(&pch) >= 0)
155 | startLoop(&pch); //main loop
156 | //exportSave(save, game, &saveHandle, &saveArchive);
157 | return pchexexit(&pch);
158 | }
159 |
--------------------------------------------------------------------------------
/source/overlay.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | #include <3ds.h>
7 | #include "pchex.h"
8 | #include "overlay.h"
9 |
10 | void miniConsoleInit(u32 screen, PrintConsole *console)
11 | {
12 | console->consoleInitialised = 1;
13 |
14 | gfxSetScreenFormat(screen,GSP_RGB565_OES);
15 | gfxSetDoubleBuffering(screen, 0);
16 | gfxSwapBuffers();
17 | gspWaitForVBlank();
18 |
19 | console->frameBuffer = (u16*)gfxGetFramebuffer(screen, GFX_LEFT, NULL, NULL);
20 | consoleSelect(console);
21 | consoleClear();
22 | }
23 |
24 |
25 | void drawBox(PrintConsole *console, int width, int height)
26 | {
27 | console->cursorX = 0;
28 | console->cursorY = 0;
29 | printf("+");
30 | for (int i = 0; i < width - 2; i++)
31 | printf("-");
32 | printf("+");
33 | for (int i = 0; i < height - 2; i++)
34 | {
35 | printf("|");
36 | for (int j = 0; j < width - 2; j++)
37 | printf(" ");
38 | printf("|");
39 | }
40 | printf("+");
41 | for (int i = 0; i < width - 2; i++)
42 | printf("-");
43 | printf("+");
44 | }
45 |
46 | void printEditable(struct s_overlay *over)
47 | {
48 | printf("\x1B[1;1H");
49 | printf("%s", over->title);
50 |
51 | if (over->dataIndex < 0)
52 | printf("\x1B[2;%dH^", over->offs + 1);
53 | printf("\x1B[3;1H%s", over->dst);
54 | if (over->dataIndex < 0)
55 | {
56 | printf("\x1B[2m%c\x1B[0m", over->list[over->index]);
57 | printf("\x1B[4;%dHv", over->offs + 1);
58 | }
59 |
60 | for (int i = 0; i < 10; i++)
61 | {
62 | if (over->foundIndex[i] < 0)
63 | break;
64 | if (over->dataIndex == i)
65 | printf("\x1B[7m");
66 | printf("\x1B[%d;1H%s", i + 5, over->data + over->foundIndex[i] * over->entrylen);
67 | printf("\x1B[0m");
68 | }
69 | printf("\x1B[15;1H\x1B[2m");
70 | if (over->dataIndex < 0)
71 | {
72 | printf("U/D:Change Start:List\n");
73 | printf("\x1B[16;1HA:Add char B:Rem Char");
74 | } else {
75 | printf("U/D:Change A:Choose\n");
76 | printf("\x1B[16;1HB:Back");
77 | }
78 | printf("\x1B[0m");
79 | }
80 |
81 | s8 inputOverlay(struct s_overlay *over)
82 | {
83 | u32 kPressed;
84 |
85 | hidScanInput();
86 | kPressed = hidKeysDown();
87 |
88 | if (kPressed & KEY_DOWN)
89 | if (over->list[over->index + 1])
90 | over->index++;
91 | if (kPressed & KEY_UP)
92 | if (over->index)
93 | over->index--;
94 | if (kPressed & KEY_A)
95 | {
96 | if (over->offs < over->maxlen)
97 | {
98 | over->dst[over->offs++] = over->list[over->index];
99 | over->dst[over->offs] = 0;
100 | }
101 | return 1;
102 | }
103 | if (kPressed & KEY_B)
104 | {
105 | if (over->offs > 0)
106 | over->dst[--over->offs] = 0;
107 | else
108 | return -1;
109 | return 1;
110 | }
111 | if (kPressed & KEY_START)
112 | {
113 | drawBox(&over->win, 28, 18);
114 | if (over->data && over->foundIndex[0] >= 0)
115 | over->dataIndex = 0;
116 | }
117 | if (kPressed & KEY_SELECT)
118 | return -1;
119 | return 0;
120 | }
121 |
122 | s8 doSearch(struct s_overlay *over)
123 | {
124 | s16 cur = 0;
125 | u16 found = 0;
126 |
127 | while (cur < over->datacount && found < 10)
128 | {
129 | if (!strncasecmp(over->dst, (char *)over->data + cur * over->entrylen, over->offs))
130 | over->foundIndex[found++] = cur;
131 | cur++;
132 | }
133 | over->foundIndex[found] = -1;
134 | return 0;
135 | }
136 |
137 | s8 inputDataSelect(struct s_overlay *over)
138 | {
139 | u32 kPressed;
140 |
141 | hidScanInput();
142 | kPressed = hidKeysDown();
143 |
144 | if (kPressed & KEY_UP && over->dataIndex > 0)
145 | over->dataIndex--;
146 | if (kPressed & KEY_DOWN && over->dataIndex < 9 && over->foundIndex[over->dataIndex + 1] >= 0)
147 | over->dataIndex++;
148 | if (kPressed & KEY_A)
149 | return -1;
150 | if (kPressed & KEY_B)
151 | over->dataIndex = -1;
152 | return 0;
153 | }
154 |
155 | void launchOverlay(struct s_overlay *over)
156 | {
157 | PrintConsole *old;
158 | s8 ret;
159 |
160 | old = consoleSelect(NULL);
161 | consoleSetWindow(&over->win, 5, 5, 28, 18);
162 | miniConsoleInit(GFX_BOTTOM, &over->win);
163 | over->dst[0] = 0;
164 | drawBox(&over->win, 28, 18);
165 | while (aptMainLoop())
166 | {
167 | printEditable(over);
168 | if (over->dataIndex >= 0)
169 | ret = inputDataSelect(over);
170 | else
171 | ret = inputOverlay(over);
172 | if (ret > 0)
173 | {
174 | drawBox(&over->win, 28, 18);
175 | if (over->data)
176 | doSearch(over);
177 |
178 | }
179 | if (ret < 0)
180 | break;
181 | gfxFlushBuffers();
182 | gfxSwapBuffers();
183 | gspWaitForVBlank();
184 | }
185 | consoleClear();
186 | consoleSelect(old);
187 | }
188 |
189 | char *getstr(char *dst, int maxlen)
190 | {
191 | struct s_overlay over;
192 |
193 | if (!dst || !maxlen)
194 | return NULL;
195 |
196 | strcpy(over.list, "abcdefghijklmnopqrstuvwxyz0123456789");
197 | strcpy(over.title, "Type something");
198 | over.dst = dst;
199 | over.maxlen = maxlen;
200 | over.offs = 0;
201 | over.index = 0;
202 | over.dataIndex = -1;
203 | over.data = NULL;
204 | over.foundIndex[0] = -1;
205 | memset(dst, 0, maxlen);
206 | launchOverlay(&over);
207 | return dst;
208 | }
209 |
210 | //Calls an overlay to select a pokemon
211 | s16 overlayGetpkm()
212 | {
213 | struct s_overlay over;
214 | char tmp[12];
215 |
216 | strcpy(over.list, "abcdefghijklmnopqrstuvwxyz' ");
217 | strcpy(over.title, "Choose a pokemon");
218 | over.dst = tmp;
219 | over.maxlen = 12;
220 | over.offs = 0;
221 | over.index = 0;
222 | over.dataIndex = -1;
223 | over.data = pkData.species[0];
224 | over.entrylen = 12;
225 | over.datacount = 722;
226 | over.foundIndex[0] = -1;
227 | memcpy(&over.win, consoleGetDefault(), sizeof(PrintConsole));
228 | doSearch(&over);
229 | launchOverlay(&over);
230 | if (over.dataIndex < 0)
231 | return -1;
232 | return over.foundIndex[over.dataIndex];
233 | }
234 |
235 | s16 overlayGetMove()
236 | {
237 | struct s_overlay over;
238 | char tmp[12];
239 |
240 | strcpy(over.list, "abcdefghijklmnopqrstuvwxyz- ");
241 | strcpy(over.title, "Choose a move");
242 | over.dst = tmp;
243 | over.maxlen = 12;
244 | over.offs = 0;
245 | over.index = 0;
246 | over.dataIndex = -1;
247 | over.data = pkData.moves[0];
248 | over.entrylen = 17;
249 | over.datacount = 622;
250 | over.foundIndex[0] = -1;
251 | memcpy(&over.win, consoleGetDefault(), sizeof(PrintConsole));
252 | doSearch(&over);
253 | launchOverlay(&over);
254 | if (over.dataIndex < 0)
255 | return -1;
256 | return over.foundIndex[over.dataIndex];
257 | }
258 |
259 | s16 overlayGetAbility()
260 | {
261 | struct s_overlay over;
262 | char tmp[12];
263 |
264 | strcpy(over.list, "abcdefghijklmnopqrstuvwxyz ");
265 | strcpy(over.title, "Choose an ability");
266 | over.dst = tmp;
267 | over.maxlen = 12;
268 | over.offs = 0;
269 | over.index = 0;
270 | over.dataIndex = -1;
271 | over.data = pkData.abilities[0];
272 | over.entrylen = 15;
273 | over.datacount = 192;
274 | over.foundIndex[0] = -1;
275 | memcpy(&over.win, consoleGetDefault(), sizeof(PrintConsole));
276 | doSearch(&over);
277 | launchOverlay(&over);
278 | if (over.dataIndex < 0)
279 | return -1;
280 | return over.foundIndex[over.dataIndex];
281 | }
282 |
283 | s16 overlayGetItems()
284 | {
285 | struct s_overlay over;
286 | char tmp[12];
287 |
288 | strcpy(over.list, "abcdefghijklmnopqrstuvwxyz ");
289 | strcpy(over.title, "Choose an item");
290 | over.dst = tmp;
291 | over.maxlen = 12;
292 | over.offs = 0;
293 | over.index = 0;
294 | over.dataIndex = -1;
295 | over.data = pkData.items[0];
296 | over.entrylen = 17;
297 | over.datacount = 775;
298 | over.foundIndex[0] = -1;
299 | memcpy(&over.win, consoleGetDefault(), sizeof(PrintConsole));
300 | doSearch(&over);
301 | launchOverlay(&over);
302 | if (over.dataIndex < 0)
303 | return -1;
304 | return over.foundIndex[over.dataIndex];
305 | }
306 |
307 | s16 overlayGetBalls()
308 | {
309 | struct s_overlay over;
310 | char tmp[12];
311 |
312 | strcpy(over.list, "abcdefghijklmnopqrstuvwxyz ");
313 | strcpy(over.title, "Choose a Pokeball");
314 | over.dst = tmp;
315 | over.maxlen = 12;
316 | over.offs = 0;
317 | over.index = 0;
318 | over.dataIndex = -1;
319 | over.data = pkData.balls[0];
320 | over.entrylen = 13;
321 | over.datacount = 26;
322 | over.foundIndex[0] = -1;
323 | memcpy(&over.win, consoleGetDefault(), sizeof(PrintConsole));
324 | doSearch(&over);
325 | launchOverlay(&over);
326 | if (over.dataIndex < 0)
327 | return -1;
328 | return over.foundIndex[over.dataIndex];
329 | }
330 |
331 | s16 overlayGetNature()
332 | {
333 | struct s_overlay over;
334 | char tmp[12];
335 |
336 | strcpy(over.list, "abcdefghijklmnopqrstuvwxyz");
337 | strcpy(over.title, "Choose a Nature");
338 | over.dst = tmp;
339 | over.maxlen = 12;
340 | over.offs = 0;
341 | over.index = 0;
342 | over.dataIndex = -1;
343 | over.data = pkData.natures[0];
344 | over.entrylen = 8;
345 | over.datacount = 25;
346 | over.foundIndex[0] = -1;
347 | memcpy(&over.win, consoleGetDefault(), sizeof(PrintConsole));
348 | doSearch(&over);
349 | launchOverlay(&over);
350 | if (over.dataIndex < 0)
351 | return -1;
352 | return over.foundIndex[over.dataIndex];
353 | }
354 |
--------------------------------------------------------------------------------
/source/overlay.h:
--------------------------------------------------------------------------------
1 | #ifndef OVERLAY_H
2 | #define OVERLAY_H
3 |
4 | #include <3ds.h>
5 |
6 | struct s_overlay
7 | {
8 | char title[17]; //title of the overlay
9 | char *dst; //string to write in
10 | u16 maxlen; //maximum length of the string
11 | char list[128]; //list of chars to use
12 | u16 offs; //current edited character
13 | s8 index; //index of the edited character in 'list'
14 |
15 | PrintConsole win; //console to print in for the overlay
16 |
17 | s8 dataIndex; //-1 if typing, 0+ if choosing a result
18 | u8 *data; //data to search results in
19 | s16 datacount; //number of entries in data
20 | s16 entrylen; //length of an entry in data
21 | s16 foundIndex[11]; //Index of the results found in data
22 | };
23 |
24 | #endif /* end of include guard: OVERLAY_H */
25 |
--------------------------------------------------------------------------------
/source/pchex.h:
--------------------------------------------------------------------------------
1 | #ifndef PCHEX_H
2 | #define PCHEX_H
3 |
4 | #include <3ds.h>
5 | #include "pkx.h"
6 |
7 | struct s_3fs
8 | {
9 | Handle handle;
10 | FS_archive arch;
11 | };
12 |
13 | struct s_pchex
14 | {
15 | PrintConsole top;
16 | PrintConsole bot;
17 | struct s_3fs sav;
18 | struct s_3fs sd;
19 | s8 game;
20 | u8 *save;
21 | };
22 |
23 |
24 | struct s_stateInfo;
25 |
26 | struct s_UIState
27 | {
28 | void (*initf)(struct s_stateInfo *);
29 | void (*dispf)(struct s_stateInfo *);
30 | void (*inputf)(struct s_stateInfo *);
31 | };
32 |
33 | //General state structure
34 | struct s_stateInfo
35 | {
36 | u32 kPressed; //stores what keys are pressed
37 | struct s_pchex *pch;
38 |
39 | struct s_pkm pkm; //the currently edited pokemon
40 | struct s_pkm cpy; //the pokemon in the clipboard
41 | s16 pkmSlot; //the current box slot which is edited
42 |
43 | struct s_UIState curState; //current state
44 | s8 inState; //ID of what is selected
45 | u8 inSel; //0 if we're editing a value, 1 if we're not
46 | u8 modded; //1 if the pokemon has been modified, 0 if not
47 | s8 cont; //if 0, terminate the program, if 1, terminate the program and export the savefile
48 | };
49 |
50 | typedef struct s_stateInfo t_stinf;
51 |
52 | extern struct s_UIState pkmSelectState;
53 | extern struct s_UIState pkmGeneralState;
54 | extern struct s_UIState pkmCombatState;
55 | extern struct s_UIState pkmManageState;
56 |
57 | s32 saveFile(char *path, void *src, u64 size, FS_archive *archive, Handle *fsHandle, u32 *bytesWritten);
58 | s32 saveSFile(char *path, void *src, u64 size, FS_archive *archive, Handle *fsHandle, u32 *bytesWritten);
59 | s32 loadFile(char *path, void *dst, FS_archive *fsarch, Handle *fshdl, u64 maxSize, u32 *bytesRead);
60 | s32 deleteFile(char *path, Handle *fshdl, FS_archive *fsarch);
61 | s32 filesysInit(Handle *, Handle *, FS_archive *, FS_archive *);
62 | s32 filesysExit(Handle *, Handle *, FS_archive *, FS_archive *);
63 |
64 | s32 backupSave(u8 *save, u8 game, Handle *fshdl, FS_archive *fsarch);
65 | s32 exportSave(u8 *save, u8 game, Handle *fshdl, FS_archive *fsarch);
66 | s32 loadSave(u8 *save, Handle *fshdl, FS_archive *fsarch);
67 |
68 | s32 loadPokemon(t_stinf *state, u16 slot, u8 *dest);
69 | s32 savePokemon(t_stinf *state, u16 slot, u8 *src);
70 | u32 getCHKOffset(u8 game, u8 type, u8 index);
71 | s32 switchState(t_stinf *state, struct s_UIState newst);
72 | s32 startLoop(struct s_pchex *);
73 |
74 | s16 overlayGetpkm();
75 | s16 overlayGetMove();
76 | s16 overlayGetAbility();
77 | s16 overlayGetItems();
78 | s16 overlayGetBalls();
79 | s16 overlayGetNature();
80 |
81 | #endif /* end of include guard: PCHEX_H */
82 |
--------------------------------------------------------------------------------
/source/pkx.c:
--------------------------------------------------------------------------------
1 | #include <3ds.h>
2 | #include
3 | #include
4 | #include
5 |
6 | #include "pkx.h"
7 |
8 | u32 expTable[100][6] = {
9 | {0, 0, 0, 0, 0, 0},
10 | {8, 15, 4, 9, 6, 10},
11 | {27, 52, 13, 57, 21, 33},
12 | {64, 122, 32, 96, 51, 80},
13 | {125, 237, 65, 135, 100, 156},
14 | {216, 406, 112, 179, 172, 270},
15 | {343, 637, 178, 236, 274, 428},
16 | {512, 942, 276, 314, 409, 640},
17 | {729, 1326, 393, 419, 583, 911},
18 | {1000, 1800, 540, 560, 800, 1250},
19 | {1331, 2369, 745, 742, 1064, 1663},
20 | {1728, 3041, 967, 973, 1382, 2160},
21 | {2197, 3822, 1230, 1261, 1757, 2746},
22 | {2744, 4719, 1591, 1612, 2195, 3430},
23 | {3375, 5737, 1957, 2035, 2700, 4218},
24 | {4096, 6881, 2457, 2535, 3276, 5120},
25 | {4913, 8155, 3046, 3120, 3930, 6141},
26 | {5832, 9564, 3732, 3798, 4665, 7290},
27 | {6859, 11111, 4526, 4575, 5487, 8573},
28 | {8000, 12800, 5440, 5460, 6400, 10000},
29 | {9261, 14632, 6482, 6458, 7408, 11576},
30 | {10648, 16610, 7666, 7577, 8518, 13310},
31 | {12167, 18737, 9003, 8825, 9733, 15208},
32 | {13824, 21012, 10506, 10208, 11059, 17280},
33 | {15625, 23437, 12187, 11735, 12500, 19531},
34 | {17576, 26012, 14060, 13411, 14060, 21970},
35 | {19683, 28737, 16140, 15244, 15746, 24603},
36 | {21952, 31610, 18439, 17242, 17561, 27440},
37 | {24389, 34632, 20974, 19411, 19511, 30486},
38 | {27000, 37800, 23760, 21760, 21600, 33750},
39 | {29791, 41111, 26811, 24294, 23832, 37238},
40 | {32768, 44564, 30146, 27021, 26214, 40960},
41 | {35937, 48155, 33780, 29949, 28749, 44921},
42 | {39304, 51881, 37731, 33084, 31443, 49130},
43 | {42875, 55737, 42017, 36435, 34300, 53593},
44 | {46656, 59719, 46656, 40007, 37324, 58320},
45 | {50653, 63822, 50653, 43808, 40522, 63316},
46 | {54872, 68041, 55969, 47846, 43897, 68590},
47 | {59319, 72369, 60505, 52127, 47455, 74148},
48 | {64000, 76800, 66560, 56660, 51200, 80000},
49 | {68921, 81326, 71677, 61450, 55136, 86151},
50 | {74088, 85942, 78533, 66505, 59270, 92610},
51 | {79507, 90637, 84277, 71833, 63605, 99383},
52 | {85184, 95406, 91998, 77440, 68147, 106480},
53 | {91125, 100237, 98415, 83335, 72900, 113906},
54 | {97336, 105122, 107069, 89523, 77868, 121670},
55 | {103823, 110052, 114205, 96012, 83058, 129778},
56 | {110592, 115015, 123863, 102810, 88473, 138240},
57 | {117649, 120001, 131766, 109923, 94119, 147061},
58 | {125000, 125000, 142500, 117360, 100000, 156250},
59 | {132651, 131324, 151222, 125126, 106120, 165813},
60 | {140608, 137795, 163105, 133229, 112486, 175760},
61 | {148877, 144410, 172697, 141677, 119101, 186096},
62 | {157464, 151165, 185807, 150476, 125971, 196830},
63 | {166375, 158056, 196322, 159635, 133100, 207968},
64 | {175616, 165079, 210739, 169159, 140492, 219520},
65 | {185193, 172229, 222231, 179056, 148154, 231491},
66 | {195112, 179503, 238036, 189334, 156089, 243890},
67 | {205379, 186894, 250562, 199999, 164303, 256723},
68 | {216000, 194400, 267840, 211060, 172800, 270000},
69 | {226981, 202013, 281456, 222522, 181584, 283726},
70 | {238328, 209728, 300293, 234393, 190662, 297910},
71 | {250047, 217540, 315059, 246681, 200037, 312558},
72 | {262144, 225443, 335544, 259392, 209715, 327680},
73 | {274625, 233431, 351520, 272535, 219700, 343281},
74 | {287496, 241496, 373744, 286115, 229996, 359370},
75 | {300763, 249633, 390991, 300140, 240610, 375953},
76 | {314432, 257834, 415050, 314618, 251545, 393040},
77 | {328509, 267406, 433631, 329555, 262807, 410636},
78 | {343000, 276458, 459620, 344960, 274400, 428750},
79 | {357911, 286328, 479600, 360838, 286328, 447388},
80 | {373248, 296358, 507617, 377197, 298598, 466560},
81 | {389017, 305767, 529063, 394045, 311213, 486271},
82 | {405224, 316074, 559209, 411388, 324179, 506530},
83 | {421875, 326531, 582187, 429235, 337500, 527343},
84 | {438976, 336255, 614566, 447591, 351180, 548720},
85 | {456533, 346965, 639146, 466464, 365226, 570666},
86 | {474552, 357812, 673863, 485862, 379641, 593190},
87 | {493039, 367807, 700115, 505791, 394431, 616298},
88 | {512000, 378880, 737280, 526260, 409600, 640000},
89 | {531441, 390077, 765275, 547274, 425152, 664301},
90 | {551368, 400293, 804997, 568841, 441094, 689210},
91 | {571787, 411686, 834809, 590969, 457429, 714733},
92 | {592704, 423190, 877201, 613664, 474163, 740880},
93 | {614125, 433572, 908905, 636935, 491300, 767656},
94 | {636056, 445239, 954084, 660787, 508844, 795070},
95 | {658503, 457001, 987754, 685228, 526802, 823128},
96 | {681472, 467489, 1035837, 710266, 545177, 851840},
97 | {704969, 479378, 1071552, 735907, 563975, 881211},
98 | {729000, 491346, 1122660, 762160, 583200, 911250},
99 | {753571, 501878, 1160499, 789030, 602856, 941963},
100 | {778688, 513934, 1214753, 816525, 622950, 973360},
101 | {804357, 526049, 1254796, 844653, 643485, 1005446},
102 | {830584, 536557, 1312322, 873420, 664467, 1038230},
103 | {857375, 548720, 1354652, 902835, 685900, 1071718},
104 | {884736, 560922, 1415577, 932903, 707788, 1105920},
105 | {912673, 571333, 1460276, 963632, 730138, 1140841},
106 | {941192, 583539, 1524731, 995030, 752953, 1176490},
107 | {970299, 591882, 1571884, 1027103, 776239, 1212873},
108 | {1000000, 600000, 1640000, 1059860, 800000, 1250000}
109 | };
110 |
111 | u8 calcPkmLevel(u16 species, u32 exp)
112 | {
113 | u8 xpType = pkData.pkmData[species][11];
114 | u8 iterLevel = 1;
115 |
116 | while (iterLevel < 100 && exp >= expTable[iterLevel][xpType])
117 | iterLevel++;
118 | return iterLevel;
119 | }
120 |
121 | s8 getPIDGender(struct s_pkm *pkm)
122 | {
123 | u8 gratio = pkData.pkmData[pkm->pkx.species][0xA];
124 |
125 | if (gratio == 255)
126 | return 2;
127 | if (gratio == 254)
128 | gratio++;
129 |
130 | if ((pkm->pkx.personalityID & 0xFF) <= gratio)
131 | return 1;
132 | else
133 | return 0;
134 | }
135 |
136 |
137 | s8 setPkmLevel(struct s_pkm *pkm, u8 level)
138 | {
139 | u8 xpType = pkData.pkmData[pkm->pkx.species][11];
140 |
141 | if (level < 1 || level > 100)
142 | return -1;
143 | pkm->pkx.expPoints = expTable[level - 1][xpType];
144 | pkmRecalc(pkm);
145 | return 0;
146 | }
147 |
148 | s8 setPkmForm(struct s_pkm *pkm, u8 form)
149 | {
150 | pkm->pkx.formFlags &= 0x7;
151 | pkm->pkx.formFlags ^= form << 3;
152 | pkmRecalc(pkm);
153 | return 0;
154 | }
155 |
156 | s8 setPkmSpecies(struct s_pkm *pkm, u16 species)
157 | {
158 | if (species > 721)
159 | return -1;
160 | pkm->pkx.species = species;
161 | setPkmLevel(pkm, pkm->level);
162 | setPkmAbilityNum(pkm, pkm->pkx.abilityNum);
163 | setPkmGender(pkm, getPIDGender(pkm));
164 |
165 | if (!(pkm->pkx.individualValues >> 31))
166 | setNickname((char *)pkData.species[species], pkm);
167 | pkmRecalc(pkm);
168 | return 0;
169 | }
170 |
171 | s8 rerollPID(struct s_pkm *pkm)
172 | {
173 | pkm->pkx.personalityID = rand();
174 | pkmRecalc(pkm);
175 | return 0;
176 | }
177 |
178 | s8 rerollPIDspe(struct s_pkm *pkm, u8 shiny, u8 gender)
179 | {
180 | u8 gendercond;
181 | u8 shinycond;
182 | for (int i = 0; i < 80000; i++)
183 | {
184 | rerollPID(pkm);
185 | shinycond = 0;
186 | if (shiny == 2 || pkm->isShiny == shiny)
187 | shinycond = 1;
188 | gendercond = 0;
189 | if (gender == 2 || pkm->gender == gender)
190 | gendercond = 1;
191 | if (shinycond && gendercond)
192 | return 0;
193 | }
194 | return -1;
195 | }
196 |
197 | s8 isShiny(struct s_pkm *pkm)
198 | {
199 | u16 trainerSV = (pkm->pkx.trainerID ^ pkm->pkx.trainerSecretID) >> 4;
200 | u16 pkmSV = ((pkm->pkx.personalityID >> 16) ^ (pkm->pkx.personalityID & 0xFFFF)) >> 4;
201 |
202 | return (pkmSV == trainerSV);
203 | }
204 |
205 | s8 setPkmAbilityNum(struct s_pkm *pkm, u8 abilNum)
206 | {
207 | if (abilNum > 4 || abilNum == 3 || !abilNum)
208 | return -1;
209 | u8 offs = abilNum == 4 ? 3 : abilNum;
210 | pkm->pkx.abilityNum = abilNum;
211 | pkm->pkx.ability = pkData.pkmData[pkm->pkx.species][5 + offs];
212 | return 0;
213 | }
214 |
215 | s8 getPkmGender(struct s_pkm *pkm)
216 | {
217 | return (pkm->pkx.formFlags >> 1) & 0x3;
218 | }
219 |
220 | s8 setPkmGender(struct s_pkm *pkm, u8 gender)
221 | {
222 | pkm->pkx.formFlags &= 0xF9;
223 | pkm->pkx.formFlags ^= (gender & 0x3) << 1;
224 | pkmRecalc(pkm);
225 | return 0;
226 | }
227 |
228 | s8 setu16Name(char *src, u8 *dest)
229 | {
230 | int cnt = 0;
231 |
232 | while (src[cnt] && cnt < 12)
233 | {
234 | dest[cnt * 2] = src[cnt];
235 | dest[cnt * 2 + 1] = 0;
236 | cnt++;
237 | }
238 | while (cnt <= 12)
239 | {
240 | dest[cnt * 2] = 0;
241 | dest[cnt * 2 + 1] = 0;
242 | cnt++;
243 | }
244 | return 0;
245 | }
246 |
247 | s8 setNickname(char *src, struct s_pkm *pkm)
248 | {
249 | return setu16Name(src, pkm->pkx.nickname);
250 | }
251 |
252 | char *getu16Name(char *dst, u8 *src)
253 | {
254 | int cnt = 0;
255 |
256 | while (src[cnt] && cnt < 24)
257 | {
258 | dst[cnt / 2] = src[cnt];
259 | cnt += 2;
260 | }
261 | dst[cnt / 2] = 0;
262 | return dst;
263 | }
264 |
265 | char *getNickname(char *dst, struct s_pkm *pkm)
266 | {
267 | return getu16Name(dst, pkm->pkx.nickname);
268 | }
269 |
270 | char *getOTName(char *dst, struct s_pkm *pkm)
271 | {
272 | return (getu16Name(dst, pkm->pkx.trainerName));
273 | }
274 |
275 | char *getHdlName(char *dst, struct s_pkm *pkm)
276 | {
277 | return (getu16Name(dst, pkm->pkx.handlerName));
278 | }
279 |
280 | s8 setPkmIV(u8 val, u8 stat, struct s_pkm *pkm)
281 | {
282 | u32 nval = val;
283 | u32 mask = 0xFFFFFFFF;
284 | mask ^= 0x1F << (5 * stat);
285 |
286 | u32 iv32 = pkm->pkx.individualValues;
287 | iv32 &= mask;
288 | iv32 ^= ((nval & 0x1F) << (5 * stat));
289 | pkm->pkx.individualValues = iv32;
290 | return 0;
291 | }
292 |
293 | u8 getPkmIV(u32 individualValues, u8 stat)
294 | {
295 | return (individualValues >> (5 * stat)) & 0x1F;
296 | }
297 |
298 | u16 calcPkmStat(u16 species, u8 IV, u8 EV, u8 nature, u8 level, u8 stat, u8 form)
299 | {
300 | if (form && form <= pkData.pkmData[species][0xC])
301 | species = 721 + pkData.pkmData[species][0xD] + form - 1;
302 | u8 baseStat = pkData.pkmData[species][stat];
303 | u8 mult = 10;
304 | u16 final;
305 |
306 | if (stat == HP)
307 | final = 10 + ((2 * baseStat) + IV + EV / 4 + 100) * level / 100;
308 | else if (stat <= SPD)
309 | final = 5 + (2 * baseStat + IV + EV / 4) * level / 100;
310 | else
311 | final = 0;
312 |
313 | if (nature / 5 + 1 == stat)
314 | mult++;
315 | if (nature % 5 + 1 == stat)
316 | mult--;
317 | final = final * mult / 10;
318 | return final;
319 | }
320 |
321 | s8 pkmRecalc(struct s_pkm *pkm)
322 | {
323 | pkm->level = calcPkmLevel(pkm->pkx.species, pkm->pkx.expPoints);
324 | for (int i = 0; i < 6; i++)
325 | pkm->stat[i] = calcPkmStat(pkm->pkx.species, getPkmIV(pkm->pkx.individualValues, i),
326 | pkm->pkx.effortValues[i], pkm->pkx.nature, pkm->level, i,
327 | pkm->pkx.formFlags >> 3);
328 | pkm->isShiny = isShiny(pkm);
329 | pkm->gender = getPkmGender(pkm);
330 | return 0;
331 | }
332 |
333 | //Encryption
334 |
335 | Result shuffleArray(u8 *array, u8 sv)
336 | {
337 | u8 aloc[] = { 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 2, 3, 1, 1, 2, 3, 2, 3, 1, 1, 2, 3, 2, 3 };
338 | u8 bloc[] = { 1, 1, 2, 3, 2, 3, 0, 0, 0, 0, 0, 0, 2, 3, 1, 1, 3, 2, 2, 3, 1, 1, 3, 2 };
339 | u8 cloc[] = { 2, 3, 1, 1, 3, 2, 2, 3, 1, 1, 3, 2, 0, 0, 0, 0, 0, 0, 3, 2, 3, 2, 1, 1 };
340 | u8 dloc[] = { 3, 2, 3, 2, 1, 1, 3, 2, 3, 2, 1, 1, 3, 2, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0 };
341 |
342 | u8 ord[] = {aloc[sv], bloc[sv], cloc[sv], dloc[sv]};
343 | u8 pkmcpy[232];
344 | u8 tmp[56];
345 |
346 | memcpy(pkmcpy, array, 232);
347 | for (int b = 0; b < 4; b++)
348 | {
349 | memcpy(tmp, pkmcpy + 8 + 56 * ord[b], 56);
350 | memcpy(array + 8 + 56 * b, tmp, 56);
351 | }
352 | return 0;
353 | }
354 |
355 | u32 seedStep(u32 seed)
356 | {
357 | u32 a = 0x41C64E6D;
358 | u32 c = 0x00006073;
359 |
360 | return ((seed * a + c) & 0xFFFFFFFF);
361 | }
362 |
363 | Result decryptPokemon(u8 *enc, u8 *dec)
364 | {
365 | memcpy(dec, enc, 232);
366 |
367 | u32 pv = *(u32 *)dec;
368 | u8 sv = (((pv & 0x3E000) >> 0xD) % 24);
369 |
370 | u32 seed = pv;
371 | u16 tmp;
372 | for (int i = 8; i < 232; i += 2)
373 | {
374 | memcpy(&tmp, dec + i, 2);
375 | tmp ^= (seedStep(seed) >> 16);
376 | seed = seedStep(seed);
377 | memcpy(dec + i, &tmp, 2);
378 | }
379 | shuffleArray(dec, sv);
380 | return (0);
381 | }
382 |
383 | Result encryptPokemon(u8 *dec, u8 *enc)
384 | {
385 | u32 pv = *(u32 *)dec;
386 | u32 sv = (((pv & 0x3E000) >> 0xD) % 24);
387 | u16 tmp;
388 |
389 | memcpy(enc, dec, 232);
390 | for (int i = 0; i < 11; i++)
391 | shuffleArray(enc, sv);
392 |
393 | u32 seed = pv;
394 | for (int i = 8; i < 232; i += 2)
395 | {
396 | memcpy(&tmp, enc + i, 2);
397 | tmp ^= (seedStep(seed) >> 16);
398 | seed = seedStep(seed);
399 | memcpy(enc + i, &tmp, 2);
400 | }
401 | return 0;
402 | }
403 |
--------------------------------------------------------------------------------
/source/pkx.h:
--------------------------------------------------------------------------------
1 | #ifndef PKX_H
2 | #define PKX_H
3 |
4 | #include <3ds.h>
5 |
6 | enum STAT
7 | {
8 | HP,
9 | ATK,
10 | DEF,
11 | SPE,
12 | SPA,
13 | SPD
14 | };
15 |
16 | struct s_pkxcalc
17 | {
18 | u8 level;
19 | u16 finalStats[6];
20 | };
21 |
22 | struct __attribute__((__packed__)) s_pkx
23 | {
24 | u32 encryptKey;
25 | u16 sanity;
26 | u16 checksum;
27 |
28 | //Block A
29 | u16 species; //0x8
30 | u16 item;
31 | u16 trainerID;
32 | u16 trainerSecretID; //0xE
33 | u32 expPoints; //12
34 | u8 ability;
35 | u8 abilityNum; //14
36 | u16 trainingBagHitsLeft;
37 | u32 personalityID;
38 | u8 nature;
39 | u8 formFlags; //22
40 | u8 effortValues[6]; //28
41 | u8 contestStats[6]; //34
42 | u8 markings;
43 | u8 pokerus;
44 | u32 superTrainingFlags; //40
45 | u8 ribbonFlags[6]; //46
46 | u16 unused1; //48
47 | u8 contestMemoryRibbon; //49
48 | u8 battleMemoryRibbon; //50
49 | u8 superTrainingDistributionFlags; //51
50 | u8 unused2[5]; //56
51 |
52 | //Block B
53 | u8 nickname[26]; //26
54 | u16 moves[4]; //34
55 | u8 movePP[4]; //38
56 | u8 movePPUps[4]; //42
57 | u16 relearnMoves[4]; //50
58 | u8 secretSuperTrainingFlag; //51
59 | u8 unused3; //52
60 | u32 individualValues; //56
61 |
62 | //Block C
63 | u8 handlerName[26]; //26
64 | u8 handlerGender; //27
65 | u8 currentHandler; //28
66 | u16 geolocation[5]; //38
67 | u32 unused4; //42
68 | u8 handlerFriendship;
69 | u8 handlerAffection;
70 | u8 handlerMemoryIntensity;
71 | u8 handlerMemoryLine;
72 | u8 handlerMemoryFeel;
73 | u8 unused5; //48
74 | u16 handlerTextVar; //50
75 | u32 unused6; //54
76 | u8 fullness; //55
77 | u8 enjoyment; //56
78 |
79 | //Block D
80 | u8 trainerName[26]; //26
81 | u8 trainerFriendship;
82 | u8 trainerAffection;
83 | u8 trainerMemoryIntensity;
84 | u8 trainerMemoryLine; //30
85 | u16 trainerTextVar;
86 | u8 trainerMemoryFeel; //33
87 | u8 eggDate[3]; //36
88 | u8 metDate[3]; //39
89 | u8 unused7;
90 | u16 eggLocation;
91 | u16 metLocation; //44
92 | u8 ballType;
93 | u8 encounterLevel;
94 | u8 encounterType;
95 | u8 gameID;
96 | u8 countryID;
97 | u8 regionID;
98 | u8 region3DSID;
99 | u8 languageID; //52
100 | u32 unused8; //56
101 | };
102 |
103 | struct s_data
104 | {
105 | u8 pkmData[826][14];
106 | u8 abilities[192][15];
107 | u8 moves[622][17];
108 | u8 species[722][12];
109 | u8 items[775][17];
110 | u8 balls[26][13];
111 | u8 natures[25][8];
112 | } pkData;
113 |
114 | struct s_pkm
115 | {
116 | struct s_pkx pkx;
117 | u8 level;
118 | u16 stat[6];
119 | u8 isShiny;
120 | u8 gender;
121 | };
122 |
123 | s8 setPkmSpecies(struct s_pkm *pkm, u16 species);
124 | s32 decryptPokemon(u8 *enc, u8 *dec);
125 | s32 encryptPokemon(u8 *dec, u8 *enc);
126 | u8 getPkmIV(u32 individualValues, u8 stat);
127 | s8 setPkmIV(u8 val, u8 stat, struct s_pkm *pkm);
128 | s8 setPkmLevel(struct s_pkm *, u8 level);
129 | s8 pkmRecalc(struct s_pkm *);
130 |
131 | s8 setPkmForm(struct s_pkm *pkm, u8 form);
132 |
133 | s8 setPkmAbilityNum(struct s_pkm *pkm, u8 abilum);
134 |
135 | s8 getPkmGender(struct s_pkm *);
136 | s8 setPkmGender(struct s_pkm *pkm, u8 gender);
137 |
138 | s8 rerollPID(struct s_pkm *);
139 | s8 rerollPIDspe(struct s_pkm *, u8 shiny, u8 gender);
140 |
141 | s8 isShiny(struct s_pkm *);
142 |
143 | s8 setNickname(char *src, struct s_pkm *pkm);
144 | char *getNickname(char *dst, struct s_pkm *pkm);
145 | char *getOTName(char *dst, struct s_pkm *pkm);
146 | char *getHdlName(char *dst, struct s_pkm *pkm);
147 |
148 | #endif /* end of include guard: PKX_H */
149 |
--------------------------------------------------------------------------------
/source/sav.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include <3ds.h>
6 | #include "pchex.h"
7 |
8 | u32 getCHKOffset(u8 game, u8 type, u8 index)
9 | {
10 | u32 startoras[] = { 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, };
11 | u32 startxy[] = { 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, };
12 | u32 lengthoras[] = { 0x000002C8, 0x00000B90, 0x0000002C, 0x00000038, 0x00000150, 0x00000004, 0x00000008, 0x000001C0, 0x000000BE, 0x00000024, 0x00002100, 0x00000130, 0x00000440, 0x00000574, 0x00004E28, 0x00004E28, 0x00004E28, 0x00000170, 0x0000061C, 0x00000504, 0x000011CC, 0x00000644, 0x00000104, 0x00000004, 0x00000420, 0x00000064, 0x000003F0, 0x0000070C, 0x00000180, 0x00000004, 0x0000000C, 0x00000048, 0x00000054, 0x00000644, 0x000005C8, 0x000002F8, 0x00001B40, 0x000001F4, 0x000003E0, 0x00000216, 0x00000640, 0x00001A90, 0x00000400, 0x00000618, 0x0000025C, 0x00000834, 0x00000318, 0x000007D0, 0x00000C48, 0x00000078, 0x00000200, 0x00000C84, 0x00000628, 0x00000400, 0x00007AD0, 0x000078B0, 0x00034AD0, 0x0000E058, };
13 | u32 lengthxy[] = { 0x000002C8, 0x00000B88, 0x0000002C, 0x00000038, 0x00000150, 0x00000004, 0x00000008, 0x000001C0, 0x000000BE, 0x00000024, 0x00002100, 0x00000140, 0x00000440, 0x00000574, 0x00004E28, 0x00004E28, 0x00004E28, 0x00000170, 0x0000061C, 0x00000504, 0x000006A0, 0x00000644, 0x00000104, 0x00000004, 0x00000420, 0x00000064, 0x000003F0, 0x0000070C, 0x00000180, 0x00000004, 0x0000000C, 0x00000048, 0x00000054, 0x00000644, 0x000005C8, 0x000002F8, 0x00001B40, 0x000001F4, 0x000001F0, 0x00000216, 0x00000390, 0x00001A90, 0x00000308, 0x00000618, 0x0000025C, 0x00000834, 0x00000318, 0x000007D0, 0x00000C48, 0x00000078, 0x00000200, 0x00000C84, 0x00000628, 0x00034AD0, 0x0000E058, };
14 | if (game)
15 | {
16 | if (type)
17 | return lengthoras[index];
18 | else
19 | return startoras[index] - 0x5400;
20 | }
21 | else
22 | {
23 | if (type)
24 | return lengthxy[index];
25 | else
26 | return startxy[index] - 0x5400;
27 | }
28 | }
29 |
30 | s8 getGame(u32 bytesRead)
31 | {
32 | u8 game = -1;
33 | if (bytesRead == 0x76000)
34 | {
35 | printf("found OR/AS save\n");
36 | game = 1;
37 | }
38 | else if (bytesRead == 0x65600)
39 | {
40 | printf("found X/Y save\n");
41 | game = 0;
42 | }
43 | else
44 | printf("found no suitable save\n");
45 | return game;
46 | }
47 |
48 | u16 ccitt16(u8 *data, u32 len)
49 | {
50 | u16 crc = 0xFFFF;
51 | for (u32 i = 0; i < len; i++)
52 | {
53 | crc ^= (u16)data[i] << 8;
54 | for (int j = 0; j < 8; j++)
55 | if (crc & 0x8000)
56 | crc = crc << 1 ^ 0x1021;
57 | else
58 | crc = crc << 1;
59 | }
60 | return crc;
61 | }
62 |
63 | s32 rewriteSaveCHK(u8 *save, u8 game)
64 | {
65 | u8 blockCount = (game) ? 58 : 55;
66 | u32 csoff = (game ? 0x7B21A : 0x6A81A) - 0x5400;
67 | u8 *tmp = malloc(0x35000);
68 | u16 cs;
69 |
70 | if (!tmp)
71 | return -1;
72 | for (int i = 0; i < blockCount; i++)
73 | {
74 | memcpy(tmp, save + getCHKOffset(game, 0, i), getCHKOffset(game, 1, i));
75 | cs = ccitt16(tmp, getCHKOffset(game, 1, i));
76 | memcpy(save + csoff + i * 8, &cs, 2);
77 | }
78 | free(tmp);
79 | return (0);
80 | }
81 |
82 | s32 backupSave(u8 *save, u8 game, Handle *fshdl, FS_archive *fsarch)
83 | {
84 | char dir[] = "/3ds/PCHex/";
85 | char path[100];
86 | u32 len = game ? 0x76000 : 0x65600;
87 | u32 bytesWritten;
88 | s32 ret;
89 |
90 | printf("Backing save up...");
91 | sprintf(path, "%smain_%d", dir,(int) time(NULL));
92 | ret = saveFile(path, save, len, fsarch, fshdl, &bytesWritten); //actually write the file
93 | if (ret) return ret;
94 | printf(" OK\n");
95 | printf("backed save up to %s\n", path);
96 | return 0;
97 | }
98 |
99 | s32 exportSave(u8 *save, u8 game, Handle *fshdl, FS_archive *fsarch)
100 | {
101 | char path[] = "/main";
102 | u32 len = game ? 0x76000 : 0x65600;
103 | u32 bytesWritten;
104 | s32 ret;
105 |
106 | printf("Exporting save...");
107 | rewriteSaveCHK(save, game); //rewrite checksum, necessary or the save is considered corrupted
108 | deleteFile(path, fshdl, fsarch);
109 | ret = saveSFile(path, save, len, fsarch, fshdl, &bytesWritten); //actually write the file
110 | if (ret) return ret;
111 | printf(" OK\n");
112 | return 0;
113 | }
114 |
115 | s32 loadSave(u8 *save, Handle *fshdl, FS_archive *fsarch)
116 | {
117 | char path[] = "/main";
118 | u32 bytesRead;
119 | s32 ret;
120 |
121 | printf("Loading savefile...");
122 | ret = loadFile(path, save, fsarch, fshdl, 0xEB000, &bytesRead); //actually loading the file
123 | if (ret) return -1;
124 | printf(" OK, read %ld bytes\n", bytesRead);
125 | return (getGame(bytesRead)); //we return the which game was found
126 | }
127 |
--------------------------------------------------------------------------------
/source/state/pkmCombat.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include <3ds.h>
4 |
5 | #include "../pchex.h"
6 | #include "state.h"
7 |
8 | /*
9 | * Combat tab state
10 | */
11 |
12 | char helpstringsCom[30][3][50] = {
13 | { "Up/Down/Left/Right : Choose field",
14 | "A : Select field ",
15 | "Start : Back" },
16 | {"","Up/Down : Previous/Next Ability","B : Leave field"},
17 | {"","Up/Down : +/- 1 | Left/Right : Min/Max","B : Leave field"},
18 | {"X : +1","Up/Down : +/- 4 | Left/Right : Min/Max","B : Leave field"},
19 | {"","Up/Down : +/- 1 | Left/Right : Min/Max","B : Leave field"},
20 | {"X : +1","Up/Down : +/- 4 | Left/Right : Min/Max","B : Leave field"},
21 | {"","Up/Down : +/- 1 | Left/Right : Min/Max","B : Leave field"},
22 | {"X : +1","Up/Down : +/- 4 | Left/Right : Min/Max","B : Leave field"},
23 | {"","Up/Down : +/- 1 | Left/Right : Min/Max","B : Leave field"},
24 | {"X : +1","Up/Down : +/- 4 | Left/Right : Min/Max","B : Leave field"},
25 | {"","Up/Down : +/- 1 | Left/Right : Min/Max","B : Leave field"},
26 | {"X : +1","Up/Down : +/- 4 | Left/Right : Min/Max","B : Leave field"},
27 | {"","Up/Down : +/- 1 | Left/Right : Min/Max","B : Leave field"},
28 | {"X : +1","Up/Down : +/- 4 | Left/Right : Min/Max","B : Leave field"},
29 | {"","A : Choose Move","B : Leave field"},
30 | {"","A : Choose Move","B : Leave field"},
31 | {"","A : Choose Move","B : Leave field"},
32 | {"","A : Choose Move","B : Leave field"},
33 | {"","A : Choose Move","B : Leave field"},
34 | {"","A : Choose Move","B : Leave field"},
35 | {"","A : Choose Move","B : Leave field"},
36 | {"","A : Choose Move","B : Leave field"},
37 | {"","A : Choose Nature","B : Leave field"},
38 | };
39 |
40 | void pkmCombatHelp(t_stinf *state)
41 | {
42 | u8 sel = state->inState;
43 |
44 | for (int i = 0; i < 40; i++)
45 | printf("-");
46 | if (!state->inSel)
47 | sel = 0;
48 | printf("%-40s", helpstringsCom[sel][0]);
49 | printf("%-40s", helpstringsCom[sel][1]);
50 | printf("%-40s", helpstringsCom[sel][2]);
51 | }
52 |
53 | void pkmCombatInit(t_stinf *state)
54 | {
55 | state->inState = 1;
56 | state->inSel = 0;
57 | consoleClear();
58 | }
59 |
60 | void moveField(t_stinf *state, s8 tstate, s8 move)
61 | {
62 | if (move > 7)
63 | return;
64 | selectColor(tstate, state->inState, state->inSel);
65 | if (move <= 3)
66 | printf("Move %d:%-16s\n", move + 1, pkData.moves[state->pkm.pkx.moves[move]]);
67 | else
68 | printf("Egg Move %d:%-16s\n", move - 3, pkData.moves[state->pkm.pkx.relearnMoves[move - 4]]);
69 | }
70 |
71 | void statField(t_stinf *state, s8 tstate, s8 stat)
72 | {
73 | char str[6][4] = {"HP", "ATK", "DEF", "SPE", "SPA", "SPD"};
74 |
75 | resetColor();
76 | printf("%-3s: %-3d\n", str[stat], state->pkm.stat[stat]);
77 | printf(" ");
78 | selectColor(tstate, state->inState, state->inSel);
79 | printf("IV : %-2d", getPkmIV(state->pkm.pkx.individualValues, stat));
80 |
81 | resetColor();printf(" ");
82 | selectColor(tstate + 1, state->inState, state->inSel);
83 | printf("EV : %-3d\n", state->pkm.pkx.effortValues[stat]);
84 | }
85 |
86 |
87 | void pkmCombatDisplay(t_stinf *state)
88 | {
89 | struct s_pkx *pkx = &state->pkm.pkx;
90 | u8 ist = state->inState, sel = state->inSel;
91 | char tmp[9];
92 |
93 | pkmHeader(state);
94 | printf("\n");
95 |
96 | selectColor(1, ist, sel);
97 | pkx->abilityNum == 4 ? sprintf(tmp, "(H)") : sprintf(tmp, "(%d)", pkx->abilityNum);
98 | printf("Ability : %14s %s\n", pkData.abilities[pkx->ability], tmp);
99 | selectColor(22, ist, sel);
100 | printf("Nature : %8s\n", pkData.natures[pkx->nature]);
101 |
102 | int EVTot = 0;
103 | for (int i = 0; i < 6; i++)
104 | {
105 | statField(state, (i + 1) * 2, i);
106 | EVTot += pkx->effortValues[i];
107 | }
108 | resetColor();
109 | printf("%-20sEV Total:%-3d\n", "", EVTot);
110 |
111 | for (int i = 0; i < 8; i++)
112 | moveField(state, 14 + i, i);
113 |
114 | resetColor();
115 | printf("\x1B[26;0H");
116 | pkmCombatHelp(state);
117 | }
118 |
119 | void pkmCombatInput(t_stinf *state)
120 | {
121 | u32 kPressed = state->kPressed;
122 |
123 | if (kPressed & KEY_START)
124 | {
125 | switchState(state, pkmSelectState);
126 | return;
127 | }
128 | if (kPressed & KEY_L)
129 | {
130 | switchState(state, pkmGeneralState);
131 | return;
132 | }
133 | if (kPressed & KEY_R)
134 | {
135 | switchState(state, pkmManageState);
136 | return;
137 | }
138 | pkmComInputField(state);
139 | }
140 |
141 | struct s_UIState pkmCombatState = {&pkmCombatInit, &pkmCombatDisplay, &pkmCombatInput};
142 |
--------------------------------------------------------------------------------
/source/state/pkmCombatFields.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include <3ds.h>
5 |
6 | #include "state.h"
7 |
8 | void pkmComAbility(t_stinf *state)
9 | {
10 | if (dirInputField(state, 0, 22, 0, 0)) return;
11 |
12 | u32 kPressed = state->kPressed;
13 | s8 abilNum = state->pkm.pkx.abilityNum;
14 | if (kPressed & KEY_UP)
15 | {
16 | if (abilNum == 2)
17 | abilNum = 4;
18 | else if (abilNum < 4)
19 | abilNum++;
20 | }
21 | if (kPressed & KEY_DOWN)
22 | {
23 | if (abilNum == 4)
24 | abilNum = 2;
25 | else if (abilNum > 0)
26 | abilNum--;
27 | }
28 | if (abilNum != state->pkm.pkx.abilityNum)
29 | {
30 | setPkmAbilityNum(&state->pkm, abilNum);
31 | state->modded = 1;
32 | }
33 | }
34 |
35 | void pkmComNature(t_stinf *state)
36 | {
37 | if (dirInputField(state, 1, 2, 0, 0)) return;
38 | if (state->kPressed & KEY_A)
39 | {
40 | s16 target = overlayGetNature();
41 | if (target >= 0 && target != state->pkm.pkx.nature)
42 | {
43 | state->pkm.pkx.nature = target;
44 | state->modded = 1;
45 | }
46 | state->inSel = 0;
47 | }
48 | }
49 |
50 | void pkmComStatIV(t_stinf *state, u8 stat)
51 | {
52 | s8 up = stat * 2;
53 | if (stat == 0)
54 | up = 22;
55 | if (dirInputField(state, up, 4 + stat * 2, 0, 3 + stat * 2)) return;
56 |
57 | u32 kPressed = state->kPressed;
58 | s8 IV = getPkmIV(state->pkm.pkx.individualValues, stat);
59 | if (kPressed & KEY_UP)
60 | IV++;
61 | if (kPressed & KEY_DOWN)
62 | IV--;
63 | if (kPressed & KEY_LEFT)
64 | IV = 0;
65 | if (kPressed & KEY_RIGHT)
66 | IV = 31;
67 | if (IV < 0)
68 | IV = 0;
69 | if (IV > 31)
70 | IV = 31;
71 | if (IV != getPkmIV(state->pkm.pkx.individualValues, stat))
72 | {
73 | setPkmIV(IV, stat, &state->pkm);
74 | pkmRecalc(&state->pkm);
75 | state->modded = 1;
76 | }
77 | }
78 |
79 | void pkmComStatEV(t_stinf *state, u8 stat)
80 | {
81 | s8 down = 2;
82 | if (stat == 5)
83 | down = 1;
84 | if (stdInputField(state, -2, down, -1, 0)) return;
85 |
86 | u32 kPressed = state->kPressed;
87 | s16 EV = state->pkm.pkx.effortValues[stat];
88 |
89 | if (kPressed & KEY_UP)
90 | EV += 4;
91 | if (kPressed & KEY_DOWN)
92 | EV -= 4;
93 | if (kPressed & KEY_LEFT)
94 | EV = 0;
95 | if (kPressed & KEY_RIGHT)
96 | EV = 252;
97 | if (kPressed & KEY_X)
98 | EV++;
99 | if (EV < 0)
100 | EV = 0;
101 | if (EV > 252)
102 | EV = 252;
103 | if (EV != state->pkm.pkx.effortValues[stat])
104 | {
105 | state->pkm.pkx.effortValues[stat] = EV;
106 | pkmRecalc(&state->pkm);
107 | state->modded = 1;
108 | }
109 | }
110 |
111 |
112 | void pkmComMove(t_stinf *state, u8 move)
113 | {
114 | s8 up = -1;
115 | if (!move)
116 | up = -2;
117 | if (stdInputField(state, up, 1, 0, 0)) return;
118 | if (state->kPressed & KEY_A)
119 | {
120 | s8 relearn = 0;
121 | s16 target;
122 | if (move > 3)
123 | {
124 | move -= 4;
125 | relearn = 1;
126 | }
127 | target = overlayGetMove();
128 | if (target >= 0)
129 | {
130 | if (relearn)
131 | state->pkm.pkx.relearnMoves[move] = target;
132 | else
133 | state->pkm.pkx.moves[move] = target;
134 | state->modded = 1;
135 | }
136 | state->inSel = 0;
137 | }
138 | }
139 |
140 | void pkmComInputField(t_stinf *state)
141 | {
142 | if (state->inState < 14 && state->inState >= 2)
143 | {
144 | if (state->inState % 2)
145 | pkmComStatEV(state, (state->inState - 2) / 2);
146 | else
147 | pkmComStatIV(state, (state->inState - 2) / 2);
148 | return;
149 | }
150 | if (state->inState >= 14 && state->inState <= 21)
151 | pkmComMove(state, state->inState - 14);
152 | switch (state->inState)
153 | {
154 | case 1:
155 | pkmComAbility(state); break;
156 | case 22:
157 | pkmComNature(state); break;
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/source/state/pkmGeneral.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include <3ds.h>
6 |
7 | #include "../pchex.h"
8 | #include "state.h"
9 |
10 | /*
11 | * General tab state
12 | */
13 |
14 | char helpstringsGen[20][3][50] = {
15 | { "Up/Down/Left/Right : Choose field",
16 | "A : Select field ",
17 | "Start : Back" },
18 | {"","A : Choose Species","B : Leave field"},
19 | { "", "X : Set Species as Nickname", "B : Leave field" },
20 | {"X : Reroll","Y : Shinify","B : Leave field"},
21 | {"","Up/Down : Add/Substract a level","B : Leave field"},
22 | {"","","B : Leave field"},
23 | {"","","B : Leave field"},
24 | {"","Up/Down/Left/Right : Modify value","B : Leave field"},
25 | {"","Up/Down/Left/Right : Modify value","B : Leave field"},
26 | {"","","B : Leave field"},
27 | {"","","B : Leave field"},
28 | {"","","B : Leave field"},
29 | {"","","B : Leave field"},
30 | {"","","B : Leave field"},
31 | {"","A : Choose Item","B : Leave field"},
32 | {"","A : Choose Item","B : Leave field"},
33 | {"","X : Switch gender","B : Leave field"},
34 | {"0 : Not Infected","Up/Down : Add/Substract","B : Leave field"},
35 | {"0 : Cured / Not Infected","Up/Down : Add/Substract","B : Leave field"},
36 | {"","Up/Down : Add/Substract","B : Leave field"},
37 | };
38 |
39 | void pkmGeneralInit(t_stinf *state)
40 | {
41 | state->inState = 1;
42 | state->inSel = 0;
43 | consoleClear();
44 | }
45 |
46 | void pkmGeneralHelp(t_stinf *state)
47 | {
48 | u8 sel = state->inState;
49 |
50 | for (int i = 0; i < 40; i++)
51 | printf("-");
52 | if (!state->inSel)
53 | sel = 0;
54 | printf("%-40s", helpstringsGen[sel][0]);
55 | printf("%-40s", helpstringsGen[sel][1]);
56 | printf("%-40s", helpstringsGen[sel][2]);
57 | }
58 |
59 | void pkmGeneralTrainerDisplay(t_stinf *state)
60 | {
61 | struct s_pkx *pkx = &state->pkm.pkx;
62 | u8 ist = state->inState, sel = state->inSel;
63 | char tmp[50];
64 |
65 | selectColor(5, ist, sel);
66 | printf("OT:%-12s", getOTName(tmp, &state->pkm));
67 | resetColor(); printf(" ");
68 | selectColor(6, ist, sel);
69 | printf("Handler:%-12s", getHdlName(tmp, &state->pkm));
70 |
71 | selectColor(7, ist, sel);
72 | printf("Friendship:%-3d", pkx->trainerFriendship);
73 | resetColor(); printf("%-6s", "");
74 | selectColor(8, ist, sel);
75 | printf("Friendship:%-3d\n", pkx->handlerFriendship);
76 |
77 | selectColor(9, ist, sel);
78 | printf("ID :%05d\n", pkx->trainerID);
79 |
80 | selectColor(10, ist, sel);
81 | printf("SID:%05d\n", pkx->trainerSecretID);
82 |
83 | printf("\n");
84 | }
85 |
86 | void pkmGeneralOrigDisplay(t_stinf *state)
87 | {
88 | struct s_pkx *pkx = &state->pkm.pkx;
89 | u8 ist = state->inState, sel = state->inSel;
90 |
91 | selectColor(11, ist, sel);
92 | printf("Met Location ID: %-5d\n", pkx->metLocation);
93 |
94 | selectColor(12, ist, sel);
95 | printf("Met Date: %02d/%02d/%04d\n", pkx->metDate[1], pkx->metDate[2], 2000 + pkx->metDate[0]);
96 |
97 | selectColor(13, ist, sel);
98 | printf("Original Game ID: %-3d\n", pkx->gameID);
99 |
100 | printf("\n");
101 | }
102 |
103 | void pkmGeneralItemDisplay(t_stinf *state)
104 | {
105 | struct s_pkx *pkx = &state->pkm.pkx;
106 | u8 ist = state->inState, sel = state->inSel;
107 |
108 | selectColor(14, ist, sel);
109 | printf("Held Item:%-16s\n", pkData.items[pkx->item]);
110 |
111 | selectColor(15, ist, sel);
112 | printf("Pokeball:%-16s\n", pkData.balls[pkx->ballType]);
113 |
114 | }
115 |
116 | void pkmGeneralDisplay(t_stinf *state)
117 | {
118 | struct s_pkx *pkx = &state->pkm.pkx;
119 | u8 ist = state->inState, sel = state->inSel;
120 | char tmp[50];
121 |
122 | pkmHeader(state);
123 | printf("\n");
124 |
125 | printf("Box %-2d Slot %-2d\n", state->pkmSlot / 30 + 1, state->pkmSlot % 30 + 1);
126 | printf("\n");
127 |
128 | selectColor(1, ist, sel);
129 | printf("Dex No. %3d : %-12s ", pkx->species, pkData.species[pkx->species]);
130 |
131 | selectColor(19, ist, sel);
132 | printf("Form ID:%d\n", pkx->formFlags >> 3);
133 | selectColor(2, ist, sel);
134 | printf("Nickname : %-12s", getNickname(tmp, &state->pkm));
135 | printf("\n");
136 |
137 | selectColor(3, ist, sel);
138 | printf("PID : %08lx", pkx->personalityID);
139 | printf(" Shiny : %-3s\n", state->pkm.isShiny ? "Yes" : "No");
140 | resetColor();
141 |
142 | selectColor(16, ist, sel);
143 | char genderstr[3][8] = {"Male", "Female", "None"};
144 | printf("Gender: %-8s\n", genderstr[state->pkm.gender]);
145 | printf("\n");
146 |
147 | resetColor();
148 | printf("PKRS: ");
149 | selectColor(17, ist, sel);
150 | printf("Strain:%-2d", state->pkm.pkx.pokerus >> 4);
151 | resetColor(); printf(" ");
152 | selectColor(18, ist, sel);
153 | printf("Left:%-2d\n", state->pkm.pkx.pokerus % 0x10);
154 | selectColor(4, ist, sel);
155 |
156 | printf("\n");
157 | printf("EXP : %-7ld\nLevel : %-3d\n\n", pkx->expPoints, state->pkm.level);
158 |
159 | pkmGeneralTrainerDisplay(state);
160 | pkmGeneralOrigDisplay(state);
161 | pkmGeneralItemDisplay(state);
162 |
163 | resetColor();
164 | printf("\x1B[26;0H");
165 | pkmGeneralHelp(state);
166 | }
167 |
168 | void pkmGeneralInput(t_stinf *state)
169 | {
170 | u32 kPressed = state->kPressed;
171 |
172 | if (kPressed & KEY_START)
173 | {
174 | switchState(state, pkmSelectState);
175 | return;
176 | }
177 | if (kPressed & KEY_R)
178 | {
179 | switchState(state, pkmCombatState);
180 | return;
181 | }
182 | pkmGenInputField(state);
183 | }
184 |
185 | struct s_UIState pkmGeneralState = {&pkmGeneralInit, &pkmGeneralDisplay, &pkmGeneralInput};
186 |
187 |
--------------------------------------------------------------------------------
/source/state/pkmGeneralFields.c:
--------------------------------------------------------------------------------
1 | #include <3ds.h>
2 | #include "state.h"
3 |
4 | void pkmGenSpecies(t_stinf *state)
5 | {
6 | if (dirInputField(state, 0, 2, 0, 19)) return;
7 | if (state->kPressed & KEY_A)
8 | {
9 | u16 target = overlayGetpkm();
10 | if (target < 0)
11 | return;
12 | setPkmSpecies(&state->pkm, target);
13 | state->modded = 1;
14 | state->inSel = 0;
15 | }
16 | }
17 |
18 | void pkmGenForm(t_stinf *state)
19 | {
20 | if (dirInputField(state, 0, 2, 1, 0)) return;
21 |
22 | s8 add = 0;
23 | s8 form = state->pkm.pkx.formFlags >> 3;
24 | if (state->kPressed & KEY_UP)
25 | add = 1;
26 | if (state->kPressed & KEY_DOWN)
27 | add = -1;
28 | form += add;
29 | if (form < 0)
30 | form = 0;
31 | if (form > pkData.pkmData[state->pkm.pkx.species][0xC])
32 | form = pkData.pkmData[state->pkm.pkx.species][0xC];
33 | if (form != state->pkm.pkx.formFlags >> 3)
34 | {
35 | setPkmForm(&state->pkm, form);
36 | state->modded = 1;
37 | }
38 | }
39 |
40 | void pkmGenNickname(t_stinf *state)
41 | {
42 | u32 kPressed = state->kPressed;
43 |
44 | if (stdInputField(state, -1, 1, 0, 0)) return;
45 | if (kPressed & KEY_X) {setNickname((char *) pkData.species[state->pkm.pkx.species], &state->pkm); state->modded = 1;}
46 | }
47 |
48 | void pkmGenPID(t_stinf *state)
49 | {
50 | if (dirInputField(state, 2, 16, 0, 0)) return;
51 |
52 | u32 kPressed = state->kPressed;
53 | if (kPressed & KEY_X) {rerollPIDspe(&state->pkm, 2, state->pkm.gender); state->modded = 1;}
54 | if (kPressed & KEY_Y) {rerollPIDspe(&state->pkm, 1, state->pkm.gender); state->modded = 1;}
55 | }
56 |
57 | void pkmGenGender(t_stinf *state) //16
58 | {
59 | if (dirInputField(state, 3, 17, 0, 0)) return;
60 |
61 | u32 kPressed = state->kPressed;
62 | if (kPressed & KEY_X)
63 | {
64 | if (state->pkm.gender == 2)
65 | return;
66 | if (pkData.pkmData[state->pkm.pkx.species][0xA] == 0 ||
67 | pkData.pkmData[state->pkm.pkx.species][0xA] >= 254)
68 | return;
69 | setPkmGender(&state->pkm, !state->pkm.gender);
70 | state->modded = 1;
71 | }
72 | }
73 |
74 | void pkmGenPKRSStrain(t_stinf *state) //17
75 | {
76 | if (dirInputField(state, 16, 4, 0, 18)) return;
77 |
78 | u32 kPressed = state->kPressed;
79 | s8 strain = state->pkm.pkx.pokerus >> 4;
80 |
81 | if (kPressed & KEY_UP)
82 | strain += 1;
83 | if (kPressed & KEY_DOWN)
84 | strain -= 1;
85 | if (strain < 0)
86 | strain = 0;
87 | if (strain > 15)
88 | strain = 15;
89 | if (strain != state->pkm.pkx.pokerus >> 4)
90 | {
91 | state->pkm.pkx.pokerus &= 0xF;
92 | state->pkm.pkx.pokerus ^= strain << 4;
93 | state->modded = 1;
94 | }
95 | }
96 |
97 | void pkmGenPKRSLeft(t_stinf *state) //18
98 | {
99 | if (dirInputField(state, 16, 4, 17, 0)) return;
100 |
101 | u32 kPressed = state->kPressed;
102 | s8 strain = state->pkm.pkx.pokerus & 0xF;
103 |
104 | if (kPressed & KEY_UP)
105 | strain += 1;
106 | if (kPressed & KEY_DOWN)
107 | strain -= 1;
108 | if (strain < 0)
109 | strain = 0;
110 | if (strain > 15)
111 | strain = 15;
112 | if (strain != (state->pkm.pkx.pokerus & 0xF))
113 | {
114 | state->pkm.pkx.pokerus &= 0xF0;
115 | state->pkm.pkx.pokerus ^= strain;
116 | state->modded = 1;
117 | }
118 | }
119 |
120 | void pkmGenEXP(t_stinf *state)
121 | {
122 | u32 kPressed = state->kPressed;
123 | if (dirInputField(state, 17, 5, 0, 0)) return;
124 |
125 | s8 addLevel = 0;
126 | if (kPressed & KEY_UP)
127 | addLevel += 1;
128 | if (kPressed & KEY_DOWN)
129 | addLevel -= 1;
130 | if (addLevel)
131 | {
132 | setPkmLevel(&state->pkm, state->pkm.level + addLevel);
133 | state->modded = 1;
134 | }
135 | }
136 |
137 | void pkmGenOT(t_stinf *state)
138 | {
139 | if (stdInputField(state, -1, 2, 0, 1)) return;
140 | }
141 |
142 | void pkmGenHandler(t_stinf *state)
143 | {
144 | if (stdInputField(state, -2, 2, -1, 0)) return;
145 | }
146 |
147 | void pkmGenTrainerFrd(t_stinf *state)
148 | {
149 | if (stdInputField(state, -2, 2, 0, 1)) return;
150 |
151 | s8 addFrd = 0;
152 | u32 kPressed = state->kPressed;
153 |
154 | if (kPressed & KEY_RIGHT) addFrd += 10;
155 | if (kPressed & KEY_LEFT) addFrd -= 10;
156 | if (kPressed & KEY_UP) addFrd++;
157 | if (kPressed & KEY_DOWN) addFrd--;
158 | if (addFrd) state->modded = 1;
159 | state->pkm.pkx.trainerFriendship = (s8)state->pkm.pkx.trainerFriendship + addFrd;
160 | }
161 |
162 | void pkmGenHandlerFrd(t_stinf *state)
163 | {
164 | if (stdInputField(state, -2, 1, -1, 0)) return;
165 |
166 | s8 addFrd = 0;
167 | u32 kPressed = state->kPressed;
168 |
169 | if (kPressed & KEY_RIGHT) addFrd += 10;
170 | if (kPressed & KEY_LEFT) addFrd -= 10;
171 | if (kPressed & KEY_UP) addFrd++;
172 | if (kPressed & KEY_DOWN) addFrd--;
173 | if (addFrd) state->modded = 1;
174 | state->pkm.pkx.handlerFriendship = (s8)state->pkm.pkx.handlerFriendship + addFrd;
175 | }
176 |
177 | void pkmGenTrainerID(t_stinf *state)
178 | {
179 | if (stdInputField(state, -2, 1, 0, 0)) return;
180 | }
181 |
182 | void pkmGenSID(t_stinf *state)
183 | {
184 | if (stdInputField(state, -1, 1, 0, 0)) return;
185 | }
186 |
187 | void pkmGenMetLocation(t_stinf *state)
188 | {
189 | if (stdInputField(state, -1, 1, 0, 0)) return;
190 | }
191 |
192 | void pkmGenMetDate(t_stinf *state)
193 | {
194 | if (stdInputField(state, -1, 1, 0, 0)) return;
195 | }
196 |
197 | void pkmGenOrigGame(t_stinf *state)
198 | {
199 | if (stdInputField(state, -1, 1, 0, 0)) return;
200 | }
201 |
202 | void pkmGenHeldItem(t_stinf *state)
203 | {
204 | if (stdInputField(state, -1, 1, 0, 0)) return;
205 | if (state->kPressed & KEY_A)
206 | {
207 | s16 target = overlayGetItems();
208 | if (target < 0)
209 | return;
210 | state->pkm.pkx.item = target;
211 | state->modded = 1;
212 | state->inSel = 0;
213 | }
214 | }
215 |
216 | void pkmGenPokeball(t_stinf *state)
217 | {
218 | if (stdInputField(state, -1, 0, 0, 0)) return;
219 | if (state->kPressed & KEY_A)
220 | {
221 | s8 target = overlayGetBalls();
222 | if (target < 0)
223 | return;
224 | state->pkm.pkx.ballType = target;
225 | state->modded = 1;
226 | state->inSel = 0;
227 | }
228 | }
229 |
230 | void pkmGenInputField(t_stinf *state)
231 | {
232 | switch (state->inState){
233 | case 1: pkmGenSpecies(state); break;
234 | case 2: pkmGenNickname(state); break;
235 | case 3: pkmGenPID(state); break;
236 | case 4: pkmGenEXP(state); break;
237 | case 5: pkmGenOT(state); break;
238 | case 6: pkmGenHandler(state); break;
239 | case 7: pkmGenTrainerFrd(state); break;
240 | case 8: pkmGenHandlerFrd(state); break;
241 | case 9: pkmGenTrainerID(state); break;
242 | case 10: pkmGenSID(state); break;
243 | case 11: pkmGenMetLocation(state); break;
244 | case 12: pkmGenMetDate(state); break;
245 | case 13: pkmGenOrigGame(state); break;
246 | case 14: pkmGenHeldItem(state); break;
247 | case 15: pkmGenPokeball(state); break;
248 | case 16: pkmGenGender(state); break;
249 | case 17: pkmGenPKRSStrain(state); break;
250 | case 18: pkmGenPKRSLeft(state); break;
251 | case 19: pkmGenForm(state); break;
252 | }
253 | }
254 |
--------------------------------------------------------------------------------
/source/state/pkmManage.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include <3ds.h>
5 |
6 | #include "state.h"
7 |
8 | /*
9 | * Manage tab state
10 | */
11 |
12 | char helpstringsMan[10][3][40] = {
13 | {"Up/Down : Select Field","A : Use Field", "Start : Back"},
14 | {"","","B : Leave field"},
15 | {"","","B : Leave field"},
16 | {"","","B : Leave field"},
17 | {"","","B : Leave field"},
18 | };
19 |
20 | void pkmManageInit(t_stinf *state)
21 | {
22 | state->inSel = 0;
23 | state->inState = 1;
24 | consoleClear();
25 | }
26 |
27 | void pkmManageHelp(t_stinf *state)
28 | {
29 | u8 sel = state->inState;
30 |
31 | printf("\x1B[26;0H");
32 | for (int i = 0; i < 40; i++)
33 | printf("-");
34 | if (!state->inSel)
35 | sel = 0;
36 | printf("%-40s", helpstringsMan[sel][0]);
37 | printf("%-40s", helpstringsMan[sel][1]);
38 | printf("%-40s", helpstringsMan[sel][2]);
39 | }
40 |
41 | void pkmManageDisplay(t_stinf *state)
42 | {
43 | u8 ist = state->inState;
44 | u8 sel = state->inSel;
45 |
46 | pkmHeader(state);
47 |
48 | printf("\n\n\n");
49 | selectColor(1, ist, sel);
50 | printf("Save\n");
51 |
52 | printf("\n");
53 |
54 | selectColor(2, ist, sel);
55 | printf("Copy\n");
56 | selectColor(3, ist, sel);
57 | printf("Paste\n");
58 | resetColor();
59 | printf("In clipboard : ");
60 | if (state->cpy.pkx.species == 0)
61 | printf("%-12s", "Empty");
62 | else
63 | printf("%-12s", pkData.species[state->cpy.pkx.species]);
64 | pkmManageHelp(state);
65 | }
66 |
67 | void pkmManageInput(t_stinf *state)
68 | {
69 | u32 kPressed = state->kPressed;
70 |
71 | if (kPressed & KEY_START)
72 | {
73 | switchState(state, pkmSelectState);
74 | return;
75 | }
76 | if (kPressed & KEY_L)
77 | {
78 | switchState(state, pkmCombatState);
79 | return;
80 | }
81 | if (kPressed & KEY_UP && state->inState > 1)
82 | state->inState--;
83 | if (kPressed & KEY_DOWN && state->inState < 3)
84 | state->inState++;
85 | if (kPressed & KEY_A)
86 | {
87 | switch(state->inState)
88 | {
89 | case 1:
90 | savePokemon(state, state->pkmSlot, (u8 *) &state->pkm.pkx);
91 | state->modded = 0;
92 | break;
93 | case 2:
94 | state->cpy = state->pkm;
95 | break;
96 | case 3:
97 | state->pkm = state->cpy;
98 | state->modded = 1;
99 | break;
100 | }
101 | }
102 | }
103 |
104 | struct s_UIState pkmManageState = {&pkmManageInit, &pkmManageDisplay, &pkmManageInput};
105 |
--------------------------------------------------------------------------------
/source/state/pkmSelect.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include <3ds.h>
5 |
6 | #include "../pchex.h"
7 |
8 | /*
9 | * Pokemon slot selection state
10 | */
11 |
12 | void reloadPokemon(t_stinf *state)
13 | {
14 | loadPokemon(state, state->pkmSlot, (u8 *) &state->pkm.pkx);
15 | pkmRecalc(&state->pkm);
16 | }
17 |
18 | void pkmSelectInit(t_stinf *state)
19 | {
20 | consoleSelect(&state->pch->bot);
21 | consoleClear();
22 |
23 | if (state->inState)
24 | {
25 | state->inState = 0;
26 | reloadPokemon(state);
27 | }
28 | }
29 |
30 | void pkmSelectDisplay(t_stinf *state)
31 | {
32 | printf("\x1B[0;0H"); //cursor home
33 |
34 | printf("Select a slot :\n");
35 | printf("Box %-2d Slot %-2d\n", state->pkmSlot / 30 + 1, state->pkmSlot % 30 + 1);
36 | if (state->pkm.pkx.species)
37 | printf("%-12s\n", pkData.species[state->pkm.pkx.species]);
38 | else
39 | printf("Empty \n");
40 | for (int i = 0; i < 22; i++)
41 | printf("\n");
42 | for (int i = 0; i < 40; i++)
43 | printf("-");
44 | printf("DPad Left/Right : Previous/Next Slot\n");
45 | printf("DPad Up/Down : Previous/Next Box\n");
46 | printf("A : Select Slot | Start : Quit\n");
47 | printf("Select : Export Save");
48 | }
49 |
50 | void pkmSelectInput(t_stinf *state)
51 | {
52 | u32 kPressed = state->kPressed;
53 | s8 slotChange = 0;
54 |
55 | if (kPressed & KEY_START)
56 | {
57 | state->cont = 0;
58 | return;
59 | }
60 | if (kPressed & KEY_SELECT)
61 | {
62 | consoleSelect(&state->pch->top);
63 | exportSave(state->pch->save, state->pch->game, &state->pch->sav.handle, &state->pch->sav.arch);
64 | consoleSelect(&state->pch->bot);
65 | return;
66 | }
67 | if (kPressed & KEY_A)
68 | { switchState(state, pkmGeneralState); state->modded = 0; return;}
69 | if (kPressed & KEY_LEFT)
70 | slotChange -= 1;
71 | if (kPressed & KEY_RIGHT)
72 | slotChange += 1;
73 | if (kPressed & KEY_UP)
74 | slotChange += 30;
75 | if (kPressed & KEY_DOWN)
76 | slotChange -= 30;
77 | if (slotChange)
78 | {
79 | state->pkmSlot += slotChange;
80 | if (state->pkmSlot < 0)
81 | state->pkmSlot = 0;
82 | if (state->pkmSlot >= 930)
83 | state->pkmSlot = 929;
84 | reloadPokemon(state);
85 | }
86 | }
87 |
88 | struct s_UIState pkmSelectState = {&pkmSelectInit, &pkmSelectDisplay, &pkmSelectInput};
89 |
--------------------------------------------------------------------------------
/source/state/state.h:
--------------------------------------------------------------------------------
1 | #ifndef STATE_H
2 | #define STATE_H
3 |
4 | #include "../pchex.h"
5 |
6 | void resetColor();
7 | void selectColor(u8, u8, u8);
8 | void pkmGenInputField(t_stinf *);
9 | void pkmComInputField(t_stinf *);
10 |
11 | s8 stdInputField(t_stinf *state, s8 up, s8 down, s8 left, s8 right);
12 | s8 dirInputField(t_stinf *state, s8 up, s8 down, s8 left, s8 right);
13 |
14 | void debugPrint(t_stinf *, char *);
15 | void pkmHeader(t_stinf *);
16 | #endif /* end of include guard: STATE_H */
17 |
--------------------------------------------------------------------------------
/source/state/utils.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include <3ds.h>
4 | #include "state.h"
5 |
6 | s8 stdInputField(t_stinf *state, s8 up, s8 down, s8 left, s8 right)
7 | {
8 | u32 kPressed = state->kPressed;
9 | if (state->inSel)
10 | if (kPressed & KEY_B) {state->inSel = 0; return 1;}
11 | if (!state->inSel)
12 | {
13 | if (kPressed & KEY_A) {state->inSel = 1; return 1;}
14 | if (kPressed & KEY_UP && up) state->inState += up;
15 | if (kPressed & KEY_DOWN && down) state->inState += down;
16 | if (kPressed & KEY_LEFT && left) state->inState += left;
17 | if (kPressed & KEY_RIGHT && right) state->inState += right;
18 | return 1;
19 | }
20 | return 0;
21 | }
22 |
23 | s8 dirInputField(t_stinf *state, s8 up, s8 down, s8 left, s8 right)
24 | {
25 | u32 kPressed = state->kPressed;
26 | if (state->inSel)
27 | if (kPressed & KEY_B) {state->inSel = 0; return 1;}
28 | if (!state->inSel)
29 | {
30 | if (kPressed & KEY_A) {state->inSel = 1; return 1;}
31 | if (kPressed & KEY_UP && up) state->inState = up;
32 | if (kPressed & KEY_DOWN && down) state->inState = down;
33 | if (kPressed & KEY_LEFT && left) state->inState = left;
34 | if (kPressed & KEY_RIGHT && right) state->inState = right;
35 | return 1;
36 | }
37 | return 0;
38 | }
39 |
40 | void resetColor()
41 | {
42 | printf("\x1B[0m");
43 | }
44 |
45 | void selectColor(u8 tState, u8 curState, u8 selected)
46 | {
47 | if (tState == curState)
48 | if (selected)
49 | printf("\x1B[7m");
50 | else
51 | printf("\x1B[4m");
52 | else
53 | printf("\x1B[0m");
54 | return;
55 | }
56 |
57 | void pkmHeader(t_stinf *state)
58 | {
59 | state->pch->bot.cursorX = 0;
60 | state->pch->bot.cursorY = 0;
61 |
62 | if (state->curState.dispf == pkmGeneralState.dispf)
63 | printf("\x1B[0m");
64 | else
65 | printf("\x1B[2m");
66 | printf("General");
67 |
68 | state->pch->bot.cursorX = 16;
69 |
70 | if (state->curState.dispf == pkmCombatState.dispf)
71 | printf("\x1B[0m");
72 | else
73 | printf("\x1B[2m");
74 | printf("Combat");
75 |
76 | state->pch->bot.cursorX = 33;
77 |
78 | if (state->curState.dispf == pkmManageState.dispf)
79 | printf("\x1B[0m");
80 | else
81 | printf("\x1B[2m");
82 | printf("Manage");
83 |
84 | printf("\n");
85 | if (state->curState.dispf == pkmGeneralState.dispf)
86 | state->pch->bot.cursorX = 0;
87 | if (state->curState.dispf == pkmCombatState.dispf)
88 | state->pch->bot.cursorX = 16;
89 | if (state->curState.dispf == pkmManageState.dispf)
90 | state->pch->bot.cursorX = 33;
91 | printf("\x1B[0m<>");
92 |
93 | state->pch->bot.cursorX = 0;
94 | state->pch->bot.cursorY = 2;
95 | if (state->modded)
96 | printf("\x1B[31mModified");
97 | else
98 | printf("%-8s", "");
99 | printf("\x1B[0m");
100 | }
101 |
--------------------------------------------------------------------------------