├── CtrRGBPATTY.cia ├── Source ├── build │ ├── main.o │ └── main.d ├── resources │ ├── audio.wav │ ├── banner.bnr │ ├── banner.png │ ├── icon.icn │ ├── icon.png │ ├── ctrtool.exe │ ├── makerom.exe │ ├── CtrRGBPATTY.cia │ ├── CtrRGBPATTY.elf │ ├── bannertool.exe │ ├── AppInfo │ ├── Build.bat │ └── CtrRGBPATTY.rsf ├── output │ ├── CtrRGBPATTY.elf │ ├── CtrRGBPATTY.zip │ ├── CtrRGBPATTY.3dsx │ └── CtrRGBPATTY.smdh ├── .project ├── README.md ├── License ├── .settings │ ├── language.settings.xml │ └── org.eclipse.cdt.core.prefs ├── .cproject ├── Makefile └── source │ └── main.cpp └── README.md /CtrRGBPATTY.cia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/CtrRGBPATTY.cia -------------------------------------------------------------------------------- /Source/build/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/build/main.o -------------------------------------------------------------------------------- /Source/resources/audio.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/audio.wav -------------------------------------------------------------------------------- /Source/resources/banner.bnr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/banner.bnr -------------------------------------------------------------------------------- /Source/resources/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/banner.png -------------------------------------------------------------------------------- /Source/resources/icon.icn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/icon.icn -------------------------------------------------------------------------------- /Source/resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/icon.png -------------------------------------------------------------------------------- /Source/output/CtrRGBPATTY.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/output/CtrRGBPATTY.elf -------------------------------------------------------------------------------- /Source/output/CtrRGBPATTY.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/output/CtrRGBPATTY.zip -------------------------------------------------------------------------------- /Source/resources/ctrtool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/ctrtool.exe -------------------------------------------------------------------------------- /Source/resources/makerom.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/makerom.exe -------------------------------------------------------------------------------- /Source/output/CtrRGBPATTY.3dsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/output/CtrRGBPATTY.3dsx -------------------------------------------------------------------------------- /Source/output/CtrRGBPATTY.smdh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/output/CtrRGBPATTY.smdh -------------------------------------------------------------------------------- /Source/resources/CtrRGBPATTY.cia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/CtrRGBPATTY.cia -------------------------------------------------------------------------------- /Source/resources/CtrRGBPATTY.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/CtrRGBPATTY.elf -------------------------------------------------------------------------------- /Source/resources/bannertool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CPunch/CtrRGBPATTY/HEAD/Source/resources/bannertool.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CtrRGBPATTY 2 | This 3DS application allows the LED color to be changed. In order for this to work, Luma CFW (custom firmware) needs to be installed. 3 | -------------------------------------------------------------------------------- /Source/resources/AppInfo: -------------------------------------------------------------------------------- 1 | APP_TITLE = CtrRGBPATTY 2 | APP_DESCRIPTION = Set LED patch for Luma CFW 3 | APP_AUTHOR = CPunch 4 | APP_PRODUCT_CODE = Your-Code 5 | APP_UNIQUE_ID = 0x0276206B33F 6 | -------------------------------------------------------------------------------- /Source/resources/Build.bat: -------------------------------------------------------------------------------- 1 | bannertool.exe makebanner -i banner.png -a audio.wav -o banner.bnr 2 | bannertool.exe makesmdh -s "CtrRGBPATTY" -l "CtrRGBPATTY" -p "CPunch" -i icon.png -o icon.icn 3 | makerom -f cia -o CtrRGBPATTY.cia -DAPP_ENCRYPTED=false -rsf CtrRGBPATTY.rsf -target t -exefslogo -elf CtrRGBPATTY.elf -icon icon.icn -banner banner.bnr -------------------------------------------------------------------------------- /Source/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | eclipse-3ds-template 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.core.ccnature 24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | -------------------------------------------------------------------------------- /Source/README.md: -------------------------------------------------------------------------------- 1 | #eclipse-3ds-template 2 | 3 | This template is basically a fork of [TricksterGuy's 3ds-template](https://github.com/TricksterGuy/3ds-template) which is essentially a fork of two other templates, which I'm not going to ramble on about. 4 | 5 | ##Modifications: 6 | 1) Supports eclipse now. 7 | 2) Eclipse also has build targets. 8 | 9 | ##To set up in eclipse: 10 | 11 | Open eclipse and import a project into the workspace. Select the root of the folder (or select the ZIP of this repository). You must have devkitPro installed to /opt/devkitPro and thus devkitARM installed to /opt/devkitPro/devkitARM. 12 | 13 | Atop this, you also need buildtools. 14 | 15 | As a result, all build targets and includes should be added. If you'd like auto-corrections on libraries other than ctrulib. 16 | 17 | ##To set up for elsewhere (or windows.) 18 | 19 | Modify the eclipse environment variables, C includes, and C++ includes to be where your install of devkitPro and CTRUlib is. 20 | -------------------------------------------------------------------------------- /Source/License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Adele Lynn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Source/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Source/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1002373664/DEVKITARM/delimiter=\: 3 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1002373664/DEVKITARM/operation=append 4 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1002373664/DEVKITARM/value=/opt/devkitPro/devkitARM 5 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1002373664/DEVKITPRO/delimiter=\: 6 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1002373664/DEVKITPRO/operation=append 7 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1002373664/DEVKITPRO/value=/opt/devkitPro/ 8 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1002373664/append=true 9 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1002373664/appendContributed=true 10 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1089705841/DEVKITARM/delimiter=\: 11 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1089705841/DEVKITARM/operation=append 12 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1089705841/DEVKITARM/value=/opt/devkitPro/devkitARM 13 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1089705841/DEVKITPRO/delimiter=\: 14 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1089705841/DEVKITPRO/operation=append 15 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1089705841/DEVKITPRO/value=/opt/devkitPro/ 16 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1089705841/append=true 17 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1089705841/appendContributed=true 18 | -------------------------------------------------------------------------------- /Source/build/main.d: -------------------------------------------------------------------------------- 1 | main.o: c:/3dsBrew/CtrRBGPATTY/source/main.cpp \ 2 | c:/devkitPro/libctru/include/3ds.h \ 3 | c:/devkitPro/libctru/include/3ds/types.h \ 4 | c:/devkitPro/libctru/include/3ds/result.h \ 5 | c:/devkitPro/libctru/include/3ds/ipc.h \ 6 | c:/devkitPro/libctru/include/3ds/svc.h \ 7 | c:/devkitPro/libctru/include/3ds/srv.h \ 8 | c:/devkitPro/libctru/include/3ds/errf.h \ 9 | c:/devkitPro/libctru/include/3ds/os.h \ 10 | c:/devkitPro/libctru/include/3ds/synchronization.h \ 11 | c:/devkitPro/libctru/include/3ds/thread.h \ 12 | c:/devkitPro/libctru/include/3ds/gfx.h \ 13 | c:/devkitPro/libctru/include/3ds/services/gspgpu.h \ 14 | c:/devkitPro/libctru/include/3ds/console.h \ 15 | c:/devkitPro/libctru/include/3ds/env.h \ 16 | c:/devkitPro/libctru/include/3ds/util/utf.h \ 17 | c:/devkitPro/libctru/include/3ds/allocator/linear.h \ 18 | c:/devkitPro/libctru/include/3ds/allocator/mappable.h \ 19 | c:/devkitPro/libctru/include/3ds/allocator/vram.h \ 20 | c:/devkitPro/libctru/include/3ds/services/ac.h \ 21 | c:/devkitPro/libctru/include/3ds/services/am.h \ 22 | c:/devkitPro/libctru/include/3ds/services/fs.h \ 23 | c:/devkitPro/libctru/include/3ds/services/ampxi.h \ 24 | c:/devkitPro/libctru/include/3ds/services/apt.h \ 25 | c:/devkitPro/libctru/include/3ds/services/boss.h \ 26 | c:/devkitPro/libctru/include/3ds/services/cam.h \ 27 | c:/devkitPro/libctru/include/3ds/services/y2r.h \ 28 | c:/devkitPro/libctru/include/3ds/services/cfgnor.h \ 29 | c:/devkitPro/libctru/include/3ds/services/cfgu.h \ 30 | c:/devkitPro/libctru/include/3ds/services/csnd.h \ 31 | c:/devkitPro/libctru/include/3ds/services/dsp.h \ 32 | c:/devkitPro/libctru/include/3ds/services/gsplcd.h \ 33 | c:/devkitPro/libctru/include/3ds/services/hid.h \ 34 | c:/devkitPro/libctru/include/3ds/services/irrst.h \ 35 | c:/devkitPro/libctru/include/3ds/services/sslc.h \ 36 | c:/devkitPro/libctru/include/3ds/services/httpc.h \ 37 | c:/devkitPro/libctru/include/3ds/services/uds.h \ 38 | c:/devkitPro/libctru/include/3ds/services/ndm.h \ 39 | c:/devkitPro/libctru/include/3ds/services/nim.h \ 40 | c:/devkitPro/libctru/include/3ds/services/nwmext.h \ 41 | c:/devkitPro/libctru/include/3ds/services/ir.h \ 42 | c:/devkitPro/libctru/include/3ds/services/ns.h \ 43 | c:/devkitPro/libctru/include/3ds/services/pm.h \ 44 | c:/devkitPro/libctru/include/3ds/services/ps.h \ 45 | c:/devkitPro/libctru/include/3ds/services/ptmu.h \ 46 | c:/devkitPro/libctru/include/3ds/services/ptmsysm.h \ 47 | c:/devkitPro/libctru/include/3ds/services/pxidev.h \ 48 | c:/devkitPro/libctru/include/3ds/services/soc.h \ 49 | c:/devkitPro/libctru/include/netinet/in.h \ 50 | c:/devkitPro/libctru/include/sys/socket.h \ 51 | c:/devkitPro/libctru/include/3ds/services/mic.h \ 52 | c:/devkitPro/libctru/include/3ds/services/mvd.h \ 53 | c:/devkitPro/libctru/include/3ds/services/nfc.h \ 54 | c:/devkitPro/libctru/include/3ds/services/news.h \ 55 | c:/devkitPro/libctru/include/3ds/services/qtm.h \ 56 | c:/devkitPro/libctru/include/3ds/services/srvpm.h \ 57 | c:/devkitPro/libctru/include/3ds/services/hb.h \ 58 | c:/devkitPro/libctru/include/3ds/gpu/gx.h \ 59 | c:/devkitPro/libctru/include/3ds/gpu/gpu.h \ 60 | c:/devkitPro/libctru/include/3ds/gpu/registers.h \ 61 | c:/devkitPro/libctru/include/3ds/gpu/enums.h \ 62 | c:/devkitPro/libctru/include/3ds/gpu/shbin.h \ 63 | c:/devkitPro/libctru/include/3ds/gpu/shaderProgram.h \ 64 | c:/devkitPro/libctru/include/3ds/ndsp/ndsp.h \ 65 | c:/devkitPro/libctru/include/3ds/ndsp/channel.h \ 66 | c:/devkitPro/libctru/include/3ds/applets/swkbd.h \ 67 | c:/devkitPro/libctru/include/3ds/sdmc.h \ 68 | c:/devkitPro/libctru/include/3ds/romfs.h \ 69 | c:/devkitPro/libctru/include/3ds/font.h 70 | 71 | c:/devkitPro/libctru/include/3ds.h: 72 | 73 | c:/devkitPro/libctru/include/3ds/types.h: 74 | 75 | c:/devkitPro/libctru/include/3ds/result.h: 76 | 77 | c:/devkitPro/libctru/include/3ds/ipc.h: 78 | 79 | c:/devkitPro/libctru/include/3ds/svc.h: 80 | 81 | c:/devkitPro/libctru/include/3ds/srv.h: 82 | 83 | c:/devkitPro/libctru/include/3ds/errf.h: 84 | 85 | c:/devkitPro/libctru/include/3ds/os.h: 86 | 87 | c:/devkitPro/libctru/include/3ds/synchronization.h: 88 | 89 | c:/devkitPro/libctru/include/3ds/thread.h: 90 | 91 | c:/devkitPro/libctru/include/3ds/gfx.h: 92 | 93 | c:/devkitPro/libctru/include/3ds/services/gspgpu.h: 94 | 95 | c:/devkitPro/libctru/include/3ds/console.h: 96 | 97 | c:/devkitPro/libctru/include/3ds/env.h: 98 | 99 | c:/devkitPro/libctru/include/3ds/util/utf.h: 100 | 101 | c:/devkitPro/libctru/include/3ds/allocator/linear.h: 102 | 103 | c:/devkitPro/libctru/include/3ds/allocator/mappable.h: 104 | 105 | c:/devkitPro/libctru/include/3ds/allocator/vram.h: 106 | 107 | c:/devkitPro/libctru/include/3ds/services/ac.h: 108 | 109 | c:/devkitPro/libctru/include/3ds/services/am.h: 110 | 111 | c:/devkitPro/libctru/include/3ds/services/fs.h: 112 | 113 | c:/devkitPro/libctru/include/3ds/services/ampxi.h: 114 | 115 | c:/devkitPro/libctru/include/3ds/services/apt.h: 116 | 117 | c:/devkitPro/libctru/include/3ds/services/boss.h: 118 | 119 | c:/devkitPro/libctru/include/3ds/services/cam.h: 120 | 121 | c:/devkitPro/libctru/include/3ds/services/y2r.h: 122 | 123 | c:/devkitPro/libctru/include/3ds/services/cfgnor.h: 124 | 125 | c:/devkitPro/libctru/include/3ds/services/cfgu.h: 126 | 127 | c:/devkitPro/libctru/include/3ds/services/csnd.h: 128 | 129 | c:/devkitPro/libctru/include/3ds/services/dsp.h: 130 | 131 | c:/devkitPro/libctru/include/3ds/services/gsplcd.h: 132 | 133 | c:/devkitPro/libctru/include/3ds/services/hid.h: 134 | 135 | c:/devkitPro/libctru/include/3ds/services/irrst.h: 136 | 137 | c:/devkitPro/libctru/include/3ds/services/sslc.h: 138 | 139 | c:/devkitPro/libctru/include/3ds/services/httpc.h: 140 | 141 | c:/devkitPro/libctru/include/3ds/services/uds.h: 142 | 143 | c:/devkitPro/libctru/include/3ds/services/ndm.h: 144 | 145 | c:/devkitPro/libctru/include/3ds/services/nim.h: 146 | 147 | c:/devkitPro/libctru/include/3ds/services/nwmext.h: 148 | 149 | c:/devkitPro/libctru/include/3ds/services/ir.h: 150 | 151 | c:/devkitPro/libctru/include/3ds/services/ns.h: 152 | 153 | c:/devkitPro/libctru/include/3ds/services/pm.h: 154 | 155 | c:/devkitPro/libctru/include/3ds/services/ps.h: 156 | 157 | c:/devkitPro/libctru/include/3ds/services/ptmu.h: 158 | 159 | c:/devkitPro/libctru/include/3ds/services/ptmsysm.h: 160 | 161 | c:/devkitPro/libctru/include/3ds/services/pxidev.h: 162 | 163 | c:/devkitPro/libctru/include/3ds/services/soc.h: 164 | 165 | c:/devkitPro/libctru/include/netinet/in.h: 166 | 167 | c:/devkitPro/libctru/include/sys/socket.h: 168 | 169 | c:/devkitPro/libctru/include/3ds/services/mic.h: 170 | 171 | c:/devkitPro/libctru/include/3ds/services/mvd.h: 172 | 173 | c:/devkitPro/libctru/include/3ds/services/nfc.h: 174 | 175 | c:/devkitPro/libctru/include/3ds/services/news.h: 176 | 177 | c:/devkitPro/libctru/include/3ds/services/qtm.h: 178 | 179 | c:/devkitPro/libctru/include/3ds/services/srvpm.h: 180 | 181 | c:/devkitPro/libctru/include/3ds/services/hb.h: 182 | 183 | c:/devkitPro/libctru/include/3ds/gpu/gx.h: 184 | 185 | c:/devkitPro/libctru/include/3ds/gpu/gpu.h: 186 | 187 | c:/devkitPro/libctru/include/3ds/gpu/registers.h: 188 | 189 | c:/devkitPro/libctru/include/3ds/gpu/enums.h: 190 | 191 | c:/devkitPro/libctru/include/3ds/gpu/shbin.h: 192 | 193 | c:/devkitPro/libctru/include/3ds/gpu/shaderProgram.h: 194 | 195 | c:/devkitPro/libctru/include/3ds/ndsp/ndsp.h: 196 | 197 | c:/devkitPro/libctru/include/3ds/ndsp/channel.h: 198 | 199 | c:/devkitPro/libctru/include/3ds/applets/swkbd.h: 200 | 201 | c:/devkitPro/libctru/include/3ds/sdmc.h: 202 | 203 | c:/devkitPro/libctru/include/3ds/romfs.h: 204 | 205 | c:/devkitPro/libctru/include/3ds/font.h: 206 | -------------------------------------------------------------------------------- /Source/resources/CtrRGBPATTY.rsf: -------------------------------------------------------------------------------- 1 | BasicInfo: 2 | Title : $(APP_TITLE) 3 | ProductCode : $(APP_PRODUCT_CODE) 4 | Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem 5 | 6 | RomFs: 7 | RootPath: $(APP_ROMFS) 8 | 9 | TitleInfo: 10 | Category : Application 11 | UniqueId : $(APP_UNIQUE_ID) 12 | 13 | Option: 14 | UseOnSD : true # true if App is to be installed to SD 15 | FreeProductCode : true # Removes limitations on ProductCode 16 | MediaFootPadding : false # If true CCI files are created with padding 17 | EnableCrypt : false # Enables encryption for NCCH and CIA 18 | EnableCompress : false # Compresses where applicable (currently only exefs:/.code) 19 | 20 | AccessControlInfo: 21 | CoreVersion : 2 22 | 23 | # Exheader Format Version 24 | DescVersion : 2 25 | 26 | # Minimum Required Kernel Version (below is for 4.5.0) 27 | ReleaseKernelMajor : "02" 28 | ReleaseKernelMinor : "33" 29 | 30 | # ExtData 31 | UseExtSaveData : false # enables ExtData 32 | #ExtSaveDataId : 0x300 # only set this when the ID is different to the UniqueId 33 | 34 | # FS:USER Archive Access Permissions 35 | # Uncomment as required 36 | FileSystemAccess: 37 | - CategorySystemApplication 38 | - CategoryHardwareCheck 39 | - CategoryFileSystemTool 40 | - Debug 41 | - TwlCardBackup 42 | - TwlNandData 43 | - Boss 44 | - DirectSdmc 45 | - Core 46 | - CtrNandRo 47 | - CtrNandRw 48 | - CtrNandRoWrite 49 | - CategorySystemSettings 50 | - CardBoard 51 | - ExportImportIvs 52 | - DirectSdmcWrite 53 | - SwitchCleanup 54 | - SaveDataMove 55 | - Shop 56 | - Shell 57 | - CategoryHomeMenu 58 | IoAccessControl: 59 | - FsMountNand 60 | - FsMountNandRoWrite 61 | - FsMountTwln 62 | - FsMountWnand 63 | - FsMountCardSpi 64 | - UseSdif3 65 | - CreateSeed 66 | - UseCardSpi 67 | 68 | # Process Settings 69 | MemoryType : Application # Application/System/Base 70 | SystemMode : 64MB # 64MB(Default)/96MB/80MB/72MB/32MB 71 | IdealProcessor : 0 72 | AffinityMask : 1 73 | Priority : 16 74 | MaxCpu : 0x9E # Default 75 | HandleTableSize : 0x200 76 | DisableDebug : false 77 | EnableForceDebug : false 78 | CanWriteSharedPage : true 79 | CanUsePrivilegedPriority : false 80 | CanUseNonAlphabetAndNumber : true 81 | PermitMainFunctionArgument : true 82 | CanShareDeviceMemory : true 83 | RunnableOnSleep : false 84 | SpecialMemoryArrange : true 85 | 86 | # New3DS Exclusive Process Settings 87 | SystemModeExt : 124MB # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode 88 | CpuSpeed : 804MHz # 256MHz(Default)/804MHz 89 | EnableL2Cache : true # false(default)/true 90 | CanAccessCore2 : true 91 | 92 | # Virtual Address Mappings 93 | IORegisterMapping: 94 | - 1ff00000-1ff7ffff # DSP memory 95 | MemoryMapping: 96 | - 1f000000-1f5fffff:r # VRAM 97 | 98 | # Accessible SVCs, : 99 | SystemCallAccess: 100 | ControlMemory: 1 101 | QueryMemory: 2 102 | ExitProcess: 3 103 | GetProcessAffinityMask: 4 104 | SetProcessAffinityMask: 5 105 | GetProcessIdealProcessor: 6 106 | SetProcessIdealProcessor: 7 107 | CreateThread: 8 108 | ExitThread: 9 109 | SleepThread: 10 110 | GetThreadPriority: 11 111 | SetThreadPriority: 12 112 | GetThreadAffinityMask: 13 113 | SetThreadAffinityMask: 14 114 | GetThreadIdealProcessor: 15 115 | SetThreadIdealProcessor: 16 116 | GetCurrentProcessorNumber: 17 117 | Run: 18 118 | CreateMutex: 19 119 | ReleaseMutex: 20 120 | CreateSemaphore: 21 121 | ReleaseSemaphore: 22 122 | CreateEvent: 23 123 | SignalEvent: 24 124 | ClearEvent: 25 125 | CreateTimer: 26 126 | SetTimer: 27 127 | CancelTimer: 28 128 | ClearTimer: 29 129 | CreateMemoryBlock: 30 130 | MapMemoryBlock: 31 131 | UnmapMemoryBlock: 32 132 | CreateAddressArbiter: 33 133 | ArbitrateAddress: 34 134 | CloseHandle: 35 135 | WaitSynchronization1: 36 136 | WaitSynchronizationN: 37 137 | SignalAndWait: 38 138 | DuplicateHandle: 39 139 | GetSystemTick: 40 140 | GetHandleInfo: 41 141 | GetSystemInfo: 42 142 | GetProcessInfo: 43 143 | GetThreadInfo: 44 144 | ConnectToPort: 45 145 | SendSyncRequest1: 46 146 | SendSyncRequest2: 47 147 | SendSyncRequest3: 48 148 | SendSyncRequest4: 49 149 | SendSyncRequest: 50 150 | OpenProcess: 51 151 | OpenThread: 52 152 | GetProcessId: 53 153 | GetProcessIdOfThread: 54 154 | GetThreadId: 55 155 | GetResourceLimit: 56 156 | GetResourceLimitLimitValues: 57 157 | GetResourceLimitCurrentValues: 58 158 | GetThreadContext: 59 159 | Break: 60 160 | OutputDebugString: 61 161 | ControlPerformanceCounter: 62 162 | CreatePort: 71 163 | CreateSessionToPort: 72 164 | CreateSession: 73 165 | AcceptSession: 74 166 | ReplyAndReceive1: 75 167 | ReplyAndReceive2: 76 168 | ReplyAndReceive3: 77 169 | ReplyAndReceive4: 78 170 | ReplyAndReceive: 79 171 | BindInterrupt: 80 172 | UnbindInterrupt: 81 173 | InvalidateProcessDataCache: 82 174 | StoreProcessDataCache: 83 175 | FlushProcessDataCache: 84 176 | StartInterProcessDma: 85 177 | StopDma: 86 178 | GetDmaState: 87 179 | RestartDma: 88 180 | DebugActiveProcess: 96 181 | BreakDebugProcess: 97 182 | TerminateDebugProcess: 98 183 | GetProcessDebugEvent: 99 184 | ContinueDebugEvent: 100 185 | GetProcessList: 101 186 | GetThreadList: 102 187 | GetDebugThreadContext: 103 188 | SetDebugThreadContext: 104 189 | QueryDebugProcessMemory: 105 190 | ReadProcessMemory: 106 191 | WriteProcessMemory: 107 192 | SetHardwareBreakPoint: 108 193 | GetDebugThreadParam: 109 194 | ControlProcessMemory: 112 195 | MapProcessMemory: 113 196 | UnmapProcessMemory: 114 197 | CreateCodeSet: 115 198 | CreateProcess: 117 199 | TerminateProcess: 118 200 | SetProcessResourceLimits: 119 201 | CreateResourceLimit: 120 202 | SetResourceLimitValues: 121 203 | AddCodeSegment: 122 204 | Backdoor: 123 205 | KernelSetState: 124 206 | QueryProcessMemory: 125 207 | 208 | # Service List 209 | # Maximum 34 services (32 if firmware is prior to 9.6.0) 210 | ServiceAccessControl: 211 | - APT:U 212 | - ac:u 213 | - am:net 214 | - boss:U 215 | - cam:u 216 | - cecd:u 217 | - cfg:nor 218 | - cfg:u 219 | - csnd:SND 220 | - dsp::DSP 221 | - frd:u 222 | - fs:USER 223 | - gsp::Gpu 224 | - hid:USER 225 | - http:C 226 | - ir:rst 227 | - ir:u 228 | - ir:USER 229 | - mic:u 230 | - ndm:u 231 | - nwm::UDS 232 | - nwm::EXT 233 | - ptm:u 234 | - ptm:sysm 235 | - pxi:dev 236 | - soc:U 237 | - ssl:C 238 | - y2r:u 239 | 240 | 241 | SystemControlInfo: 242 | SaveDataSize: 0KB # Change if the app uses savedata 243 | RemasterVersion: 2 244 | StackSize: 0x40000 245 | 246 | # Modules that run services listed above should be included below 247 | # Maximum 48 dependencies 248 | # : 249 | Dependency: 250 | ac: 0x0004013000002402 251 | #act: 0x0004013000003802 252 | am: 0x0004013000001502 253 | boss: 0x0004013000003402 254 | camera: 0x0004013000001602 255 | cecd: 0x0004013000002602 256 | cfg: 0x0004013000001702 257 | codec: 0x0004013000001802 258 | csnd: 0x0004013000002702 259 | dlp: 0x0004013000002802 260 | dsp: 0x0004013000001a02 261 | friends: 0x0004013000003202 262 | gpio: 0x0004013000001b02 263 | gsp: 0x0004013000001c02 264 | hid: 0x0004013000001d02 265 | http: 0x0004013000002902 266 | i2c: 0x0004013000001e02 267 | ir: 0x0004013000003302 268 | mcu: 0x0004013000001f02 269 | mic: 0x0004013000002002 270 | ndm: 0x0004013000002b02 271 | news: 0x0004013000003502 272 | #nfc: 0x0004013000004002 273 | nim: 0x0004013000002c02 274 | nwm: 0x0004013000002d02 275 | pdn: 0x0004013000002102 276 | ps: 0x0004013000003102 277 | ptm: 0x0004013000002202 278 | #qtm: 0x0004013020004202 279 | ro: 0x0004013000003702 280 | socket: 0x0004013000002e02 281 | spi: 0x0004013000002302 282 | ssl: 0x0004013000002f02 283 | -------------------------------------------------------------------------------- /Source/.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | make 62 | 63 | all 64 | true 65 | true 66 | true 67 | 68 | 69 | make 70 | 71 | 3dsx 72 | true 73 | true 74 | true 75 | 76 | 77 | make 78 | 79 | cia 80 | true 81 | true 82 | true 83 | 84 | 85 | make 86 | 87 | 3ds 88 | true 89 | true 90 | true 91 | 92 | 93 | make 94 | 95 | elf 96 | true 97 | true 98 | true 99 | 100 | 101 | make 102 | 103 | citra 104 | true 105 | true 106 | true 107 | 108 | 109 | make 110 | 111 | 3dsxlink 112 | true 113 | true 114 | true 115 | 116 | 117 | make 118 | 119 | spunch 120 | true 121 | true 122 | true 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /Source/Makefile: -------------------------------------------------------------------------------- 1 | .SUFFIXES: 2 | 3 | #--------------------------------------------------------------------------------- 4 | # Environment Setup 5 | #--------------------------------------------------------------------------------- 6 | ifeq ($(strip $(DEVKITPRO)),) 7 | $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPRO") 8 | endif 9 | 10 | ifeq ($(strip $(DEVKITARM)),) 11 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 12 | endif 13 | 14 | include $(DEVKITARM)/3ds_rules 15 | 16 | # ip address of 3ds for spunch/3dsxlink target. 17 | IP3DS := 127.0.0.1 18 | 19 | #--------------------------------------------------------------------------------- 20 | # Directory Setup 21 | #--------------------------------------------------------------------------------- 22 | BUILD := build 23 | OUTPUT := output 24 | RESOURCES := resources 25 | DATA := data 26 | ROMFS := romfs 27 | SOURCES := source 28 | INCLUDES := $(SOURCES) include 29 | 30 | #--------------------------------------------------------------------------------- 31 | # Resource Setup 32 | #--------------------------------------------------------------------------------- 33 | APP_INFO := $(RESOURCES)/AppInfo 34 | BANNER_AUDIO := $(RESOURCES)/audio 35 | BANNER_IMAGE := $(RESOURCES)/banner 36 | ICON := $(RESOURCES)/icon.png 37 | RSF := $(TOPDIR)/$(RESOURCES)/template.rsf 38 | 39 | #--------------------------------------------------------------------------------- 40 | # Build Setup 41 | #--------------------------------------------------------------------------------- 42 | ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard 43 | 44 | COMMON_FLAGS := -g -Wall -Wno-strict-aliasing -O3 -mword-relocations -fomit-frame-pointer -ffast-math $(ARCH) $(INCLUDE) -DARM11 -D_3DS $(BUILD_FLAGS) 45 | CFLAGS := $(COMMON_FLAGS) -std=gnu99 46 | CXXFLAGS := $(COMMON_FLAGS) -std=gnu++11 47 | ifeq ($(ENABLE_EXCEPTIONS),) 48 | CXXFLAGS += -fno-rtti -fno-exceptions 49 | endif 50 | 51 | ASFLAGS := -g $(ARCH) 52 | LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) 53 | 54 | LIBS := -lctru -lm 55 | LIBDIRS := $(PORTLIBS) $(CTRULIB) ./lib 56 | 57 | #--------------------------------------------------------------------------------- 58 | ifneq ($(BUILD),$(notdir $(CURDIR))) 59 | #--------------------------------------------------------------------------------- 60 | 61 | #--------------------------------------------------------------------------------- 62 | # Build Variable Setup 63 | #--------------------------------------------------------------------------------- 64 | recurse = $(shell find $2 -type $1 -name '$3' 2> /dev/null) 65 | 66 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.c))) 67 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.cpp))) 68 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.s))) 69 | PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.pica))) 70 | BINFILES := $(foreach dir,$(DATA),$(notdir $(call recurse,f,$(dir),*.*))) 71 | 72 | export OFILES := $(addsuffix .o,$(BINFILES)) $(PICAFILES:.pica=.shbin.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 73 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) $(foreach dir,$(LIBDIRS),-I$(dir)/include) -I$(CURDIR)/$(BUILD) 74 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) 75 | 76 | ifeq ($(strip $(CPPFILES)),) 77 | export LD := $(CC) 78 | else 79 | export LD := $(CXX) 80 | endif 81 | 82 | export DEPSDIR := $(CURDIR)/$(BUILD) 83 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir) $(call recurse,d,$(CURDIR)/$(dir),*)) $(foreach dir,$(DATA),$(CURDIR)/$(dir) $(call recurse,d,$(CURDIR)/$(dir),*)) 84 | 85 | export TOPDIR := $(CURDIR) 86 | OUTPUT_DIR := $(TOPDIR)/$(OUTPUT) 87 | 88 | .PHONY: $(BUILD) clean all 89 | 90 | #--------------------------------------------------------------------------------- 91 | # Initial Targets 92 | #--------------------------------------------------------------------------------- 93 | all: $(BUILD) $(OUTPUT_DIR) 94 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 95 | 96 | 3dsx: $(BUILD) $(OUTPUT_DIR) 97 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ 98 | 99 | cia: $(BUILD) $(OUTPUT_DIR) 100 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ 101 | 102 | 3ds: $(BUILD) $(OUTPUT_DIR) 103 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ 104 | 105 | elf: $(BUILD) $(OUTPUT_DIR) 106 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ 107 | 108 | citra: $(BUILD) $(OUTPUT_DIR) 109 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ 110 | 111 | 3dsxlink: $(BUILD) $(OUTPUT_DIR) 112 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ 113 | 114 | spunch: $(BUILD) $(OUTPUT_DIR) 115 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ 116 | 117 | $(BUILD): 118 | @[ -d $@ ] || mkdir -p $@ 119 | 120 | $(OUTPUT_DIR): 121 | @[ -d $@ ] || mkdir -p $@ 122 | 123 | clean: 124 | @echo clean ... 125 | @rm -fr $(BUILD) $(OUTPUT) 126 | 127 | #--------------------------------------------------------------------------------- 128 | else 129 | #--------------------------------------------------------------------------------- 130 | 131 | #--------------------------------------------------------------------------------- 132 | # Build Information Setup 133 | #--------------------------------------------------------------------------------- 134 | DEPENDS := $(OFILES:.o=.d) 135 | 136 | include $(TOPDIR)/$(APP_INFO) 137 | APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128) 138 | APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256) 139 | APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128) 140 | APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16) 141 | APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7) 142 | ifneq ("$(wildcard $(TOPDIR)/$(BANNER_IMAGE).cgfx)","") 143 | BANNER_IMAGE_FILE := $(TOPDIR)/$(BANNER_IMAGE).cgfx 144 | BANNER_IMAGE_ARG := -ci $(BANNER_IMAGE_FILE) 145 | else 146 | BANNER_IMAGE_FILE := $(TOPDIR)/$(BANNER_IMAGE).png 147 | BANNER_IMAGE_ARG := -i $(BANNER_IMAGE_FILE) 148 | endif 149 | 150 | ifneq ("$(wildcard $(TOPDIR)/$(BANNER_AUDIO).cwav)","") 151 | BANNER_AUDIO_FILE := $(TOPDIR)/$(BANNER_AUDIO).cwav 152 | BANNER_AUDIO_ARG := -ca $(BANNER_AUDIO_FILE) 153 | else 154 | BANNER_AUDIO_FILE := $(TOPDIR)/$(BANNER_AUDIO).wav 155 | BANNER_AUDIO_ARG := -a $(BANNER_AUDIO_FILE) 156 | endif 157 | 158 | EMPTY := 159 | SPACE := $(EMPTY) $(EMPTY) 160 | OUTPUT_NAME := $(subst $(SPACE),,$(APP_TITLE)) 161 | OUTPUT_DIR := $(TOPDIR)/$(OUTPUT) 162 | OUTPUT_FILE := $(OUTPUT_DIR)/$(OUTPUT_NAME) 163 | 164 | APP_ICON := $(TOPDIR)/$(ICON) 165 | APP_ROMFS := $(TOPDIR)/$(ROMFS) 166 | 167 | COMMON_MAKEROM_PARAMS := -rsf $(RSF) -target t -exefslogo -elf $(OUTPUT_FILE).elf -icon icon.icn -banner banner.bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(APP_UNIQUE_ID)" -DAPP_ROMFS="$(APP_ROMFS)" -DAPP_SYSTEM_MODE="64MB" -DAPP_SYSTEM_MODE_EXT="Legacy" 168 | 169 | ifeq ($(OS),Windows_NT) 170 | MAKEROM = makerom.exe 171 | BANNERTOOL = bannertool.exe 172 | else 173 | MAKEROM = makerom 174 | BANNERTOOL = bannertool 175 | endif 176 | 177 | _3DSXFLAGS += --smdh=$(OUTPUT_FILE).smdh 178 | ifneq ("$(wildcard $(TOPDIR)/$(ROMFS))","") 179 | _3DSXFLAGS += --romfs=$(TOPDIR)/$(ROMFS) 180 | endif 181 | 182 | #--------------------------------------------------------------------------------- 183 | # Main Targets 184 | #--------------------------------------------------------------------------------- 185 | .PHONY: all 3dsx cia elf 3ds citra spunch 3dsxlink 186 | all: $(OUTPUT_FILE).zip $(OUTPUT_FILE).3ds $(OUTPUT_FILE).cia 187 | 188 | banner.bnr: $(BANNER_IMAGE_FILE) $(BANNER_AUDIO_FILE) 189 | @$(BANNERTOOL) makebanner $(BANNER_IMAGE_ARG) $(BANNER_AUDIO_ARG) -o banner.bnr > /dev/null 190 | 191 | icon.icn: $(TOPDIR)/$(ICON) 192 | @$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(TOPDIR)/$(ICON) -o icon.icn > /dev/null 193 | 194 | $(OUTPUT_FILE).elf: $(OFILES) 195 | 196 | $(OUTPUT_FILE).3dsx: $(OUTPUT_FILE).elf $(OUTPUT_FILE).smdh 197 | 198 | $(OUTPUT_FILE).3ds: $(OUTPUT_FILE).elf banner.bnr icon.icn 199 | @$(MAKEROM) -f cci -o $(OUTPUT_FILE).3ds -DAPP_ENCRYPTED=true $(COMMON_MAKEROM_PARAMS) 200 | @echo "built ... $(notdir $@)" 201 | 202 | $(OUTPUT_FILE).cia: $(OUTPUT_FILE).elf banner.bnr icon.icn 203 | @$(MAKEROM) -f cia -o $(OUTPUT_FILE).cia -DAPP_ENCRYPTED=false $(COMMON_MAKEROM_PARAMS) 204 | @echo "built ... $(notdir $@)" 205 | 206 | $(OUTPUT_FILE).zip: $(OUTPUT_FILE).smdh $(OUTPUT_FILE).3dsx 207 | @cd $(OUTPUT_DIR); \ 208 | mkdir -p 3ds/$(OUTPUT_NAME); \ 209 | cp $(OUTPUT_FILE).3dsx 3ds/$(OUTPUT_NAME); \ 210 | cp $(OUTPUT_FILE).smdh 3ds/$(OUTPUT_NAME); \ 211 | zip -r $(OUTPUT_FILE).zip 3ds > /dev/null; \ 212 | rm -r 3ds 213 | @echo "built ... $(notdir $@)" 214 | 215 | 3dsx : $(OUTPUT_FILE).3dsx 216 | 217 | cia : $(OUTPUT_FILE).cia 218 | 219 | 3ds : $(OUTPUT_FILE).3ds 220 | 221 | elf : $(OUTPUT_FILE).elf 222 | 223 | citra : $(OUTPUT_FILE).3dsx 224 | citra $(OUTPUT_FILE).3dsx 225 | 226 | spunch : $(OUTPUT_FILE).cia 227 | java -jar ../sockfile-2.0.jar $(IP3DS) $(OUTPUT_FILE).cia 228 | 229 | 3dsxlink : $(OUTPUT_FILE).3dsx 230 | 3dslink -a $(IP3DS) $(OUTPUT_FILE).3dsx 231 | 232 | #--------------------------------------------------------------------------------- 233 | # Binary Data Rules 234 | #--------------------------------------------------------------------------------- 235 | %.bin.o: %.bin 236 | @echo $(notdir $<) 237 | @$(bin2o) 238 | 239 | %.shbin.o: %.pica 240 | @echo $(notdir $<) 241 | $(eval CURBIN := $(patsubst %.pica,%.shbin,$(notdir $<))) 242 | $(eval CURH := $(patsubst %.pica,%.psh.h,$(notdir $<))) 243 | @picasso -h $(CURH) -o $(CURBIN) $< 244 | @bin2s $(CURBIN) | $(AS) -o $@ 245 | @echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h 246 | @echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h 247 | @echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h 248 | 249 | -include $(DEPENDS) 250 | 251 | #--------------------------------------------------------------------------------- 252 | endif 253 | #--------------------------------------------------------------------------------- 254 | -------------------------------------------------------------------------------- /Source/source/main.cpp: -------------------------------------------------------------------------------- 1 | #include // Basic functions 2 | #include // malloc and free 3 | #include // String manipulation 4 | #include // For opendir() and readdir() 5 | #include // rmdir() 6 | #include 7 | #include 8 | #include <3ds.h> // Main 3ds lib (libctru) 9 | #include 10 | #include 11 | #include 12 | 13 | typedef struct { 14 | uint8_t r[32]; 15 | uint8_t g[32]; 16 | uint8_t b[32]; 17 | } LED; 18 | 19 | typedef struct { 20 | uint8_t ani[3]; // animation settings 21 | 22 | // colors 23 | uint8_t r[32]; 24 | uint8_t g[32]; 25 | uint8_t b[32]; 26 | } LED_MCU; 27 | 28 | std::string menu[7]={ 29 | "Set Notification RGB Hex Color", 30 | "Change pattern for LED", 31 | "Trigger Static ending", 32 | "Trigger Loop ending", 33 | "Install IPS Patch", 34 | "Test LED with pattern", 35 | "Shutdown 3DS" 36 | }; 37 | 38 | int selected, CMDS = 7; 39 | 40 | std::string paterns[4]={ 41 | "Blink ", 42 | "Explode", 43 | "Rainbow", 44 | "Static " 45 | }; 46 | 47 | int selectedpat, PATS = 4; 48 | 49 | // defaults 50 | char color_HEX[] = "910b0b"; 51 | 52 | bool staticend = false; 53 | uint8_t LOOPBYTE = 0xFF; // no loop 54 | 55 | /* Documentation: 56 | LED struct has RGB patterns for 32 itterations. With this you can make an animation with the LED. (like the one MCU BRICKER does). 57 | */ 58 | 59 | void createLED(LED* patern, std::string hexCode, bool staticEND, int selcpat) 60 | { 61 | // LED datastruct we will be returning 62 | int r, g, b; 63 | 64 | // Remove the hashtag ... 65 | if(hexCode.at(0) == '#') 66 | { 67 | hexCode = hexCode.erase(0, 1); 68 | } 69 | 70 | // ... and extract the rgb values. 71 | std::istringstream(hexCode.substr(0,2)) >> std::hex >> r; 72 | std::istringstream(hexCode.substr(2,2)) >> std::hex >> g; 73 | std::istringstream(hexCode.substr(4,2)) >> std::hex >> b; 74 | 75 | printf("(%d, %d, %d)\n", r, g ,b); 76 | printf("writing to RGB struct...\n"); 77 | 78 | memset(&patern->r[0], 0, 32); 79 | memset(&patern->g[0], 0, 32); 80 | memset(&patern->b[0], 0, 32); 81 | 82 | switch(selcpat) 83 | { 84 | case 0: // Blink 85 | for (int i = 1; i<31; i+=10) 86 | { 87 | memset(&patern->r[i], r, 5); 88 | memset(&patern->g[i], g, 5); 89 | memset(&patern->b[i], b, 5); 90 | } 91 | break; 92 | case 1: // Explode 93 | for (int i = 1; i<=31; i+=10) 94 | { 95 | patern->r[i] = r/i; 96 | patern->g[i] = g/i; 97 | patern->b[i] = b/i; 98 | } 99 | break; 100 | case 2: // Rainbow (AKA MCU bricker lol) 101 | patern->r[0] = 128; 102 | patern->r[1] = 103; 103 | patern->r[2] = 79; 104 | patern->r[3] = 57; 105 | patern->r[4] = 38; 106 | patern->r[5] = 22; 107 | patern->r[6] = 11; 108 | patern->r[7] = 3; 109 | patern->r[8] = 1; 110 | patern->r[9] = 3; 111 | patern->r[10] = 11; 112 | patern->r[11] = 22; 113 | patern->r[12] = 38; 114 | patern->r[13] = 57; 115 | patern->r[14] = 79; 116 | patern->r[15] = 103; 117 | patern->r[16] = 128; 118 | patern->r[17] = 153; 119 | patern->r[18] = 177; 120 | patern->r[19] = 199; 121 | patern->r[20] = 218; 122 | patern->r[21] = 234; 123 | patern->r[22] = 245; 124 | patern->r[23] = 253; 125 | patern->r[24] = 255; 126 | patern->r[25] = 253; 127 | patern->r[26] = 245; 128 | patern->r[27] = 234; 129 | patern->r[28] = 218; 130 | patern->r[29] = 199; 131 | patern->r[30] = 177; 132 | patern->r[31] = 153; 133 | patern->g[0] = 238; 134 | patern->g[1] = 248; 135 | patern->g[2] = 254; 136 | patern->g[3] = 255; 137 | patern->g[4] = 251; 138 | patern->g[5] = 242; 139 | patern->g[6] = 229; 140 | patern->g[7] = 212; 141 | patern->g[8] = 192; 142 | patern->g[9] = 169; 143 | patern->g[10] = 145; 144 | patern->g[11] = 120; 145 | patern->g[12] = 95; 146 | patern->g[13] = 72; 147 | patern->g[14] = 51; 148 | patern->g[15] = 33; 149 | patern->g[16] = 18; 150 | patern->g[17] = 8; 151 | patern->g[18] = 2; 152 | patern->g[19] = 1; 153 | patern->g[20] = 5; 154 | patern->g[21] = 14; 155 | patern->g[22] = 27; 156 | patern->g[23] = 44; 157 | patern->g[24] = 65; 158 | patern->g[25] = 87; 159 | patern->g[26] = 111; 160 | patern->g[27] = 136; 161 | patern->g[28] = 161; 162 | patern->g[29] = 184; 163 | patern->g[30] = 205; 164 | patern->g[31] = 223; 165 | patern->b[0] = 18; 166 | patern->b[1] = 33; 167 | patern->b[2] = 51; 168 | patern->b[3] = 72; 169 | patern->b[4] = 95; 170 | patern->b[5] = 120; 171 | patern->b[6] = 145; 172 | patern->b[7] = 169; 173 | patern->b[8] = 192; 174 | patern->b[9] = 212; 175 | patern->b[10] = 229; 176 | patern->b[11] = 242; 177 | patern->b[12] = 251; 178 | patern->b[13] = 255; 179 | patern->b[14] = 254; 180 | patern->b[15] = 248; 181 | patern->b[16] = 238; 182 | patern->b[17] = 223; 183 | patern->b[18] = 205; 184 | patern->b[19] = 184; 185 | patern->b[20] = 161; 186 | patern->b[21] = 136; 187 | patern->b[22] = 111; 188 | patern->b[23] = 87; 189 | patern->b[24] = 64; 190 | patern->b[25] = 44; 191 | patern->b[26] = 27; 192 | patern->b[27] = 14; 193 | patern->b[28] = 5; 194 | patern->b[29] = 1; 195 | patern->b[30] = 2; 196 | patern->b[31] = 8; 197 | break; 198 | case 3: 199 | memset(&patern->r[0], r, 31); 200 | memset(&patern->g[0], g, 31); 201 | memset(&patern->b[0], b, 31); 202 | break; 203 | } 204 | 205 | if (staticEND) 206 | { 207 | patern->r[31] = r; 208 | patern->g[31] = g; 209 | patern->b[31] = b; 210 | } 211 | } 212 | 213 | void writepatch(LED note) 214 | { 215 | printf("making directory...\n"); 216 | mkdir("/luma", 0777); 217 | mkdir("/luma/titles", 0777); 218 | mkdir("/luma/titles/0004013000003502", 0777); 219 | 220 | DIR* dir = opendir("/luma/titles/0004013000003502"); 221 | if (dir) 222 | { 223 | // was copied/pasted from https://github.com/Pirater12/CustomRGBPattern/blob/master/main.c and then edited 224 | printf("writing IPS patch file...\n"); 225 | 226 | FILE *file = fopen("/luma/titles/0004013000003502/code.ips", "wb+"); 227 | 228 | // https://zerosoft.zophar.net/ips.php for documentation of the IPS file format 229 | 230 | // HEADER (5 BYTES) 231 | fwrite("PATCH", 5, 1, file); 232 | 233 | // PATCH #1 234 | 235 | // OFFSET (3 BYTES) 0x00A193 real address is 0x10A193 236 | fputc(0x00, file); 237 | fputc(0xA1, file); 238 | fputc(0x93, file); 239 | 240 | // SIZE (2 BYTES) 241 | fputc(0x00, file); 242 | fputc(0xC4, file); // 196 BYTES 243 | 244 | // DATA (196 BYTES) 245 | 246 | // 96 BYTES 247 | fputc(LOOPBYTE, file); 248 | fwrite(¬e, sizeof(note), 1, file); 249 | // 3 BYTES 250 | fputc(0xFF, file); // 0x50 251 | fputc(0xFF, file); // 0x3C 252 | fputc(LOOPBYTE, file); 253 | // 96 BYTES 254 | fwrite(¬e, sizeof(note), 1, file); 255 | 256 | // END OF PATCH #1 257 | // PATCH #2 258 | 259 | // OFFSET (3 BYTES) 0x00A1F7 real address is 0x10A1F7 260 | fputc(0x00, file); 261 | fputc(0xA1, file); 262 | fputc(0xF7, file); 263 | 264 | // SIZE (2 BYTES) 265 | fputc(0x00, file); 266 | fputc(0xC4, file); // 196 BYTES 267 | 268 | // DATA (196 BYTES) 269 | 270 | // 96 BYTES 271 | fputc(LOOPBYTE, file); 272 | fwrite(¬e, sizeof(note), 1, file); 273 | // 3 BYTES 274 | fputc(0xFF, file); 275 | fputc(0xFF, file); 276 | fputc(LOOPBYTE, file); 277 | // 96 BYTES 278 | fwrite(¬e, sizeof(note), 1, file); 279 | 280 | // EOF MARKER (3 BYTES) 281 | fwrite("EOF", 3, 1, file); 282 | 283 | // close file 284 | fclose(file); 285 | 286 | // check if our file was written 287 | if( access("/luma/titles/0004013000003502/code.ips", F_OK) != -1 ) 288 | { 289 | printf("success!\n"); 290 | } 291 | else 292 | { 293 | printf("failed!\n"); 294 | } 295 | 296 | closedir(dir); 297 | } 298 | else if (ENOENT == errno) 299 | { 300 | printf("directory failed...\n"); 301 | } 302 | } 303 | 304 | void ptmsysmSetInfoLedPattern(LED_MCU pattern) 305 | { 306 | Handle serviceHandle = 0; 307 | Result result = srvGetServiceHandle(&serviceHandle, "ptm:sysm"); 308 | if (result != 0) 309 | { 310 | printf("failed to get service ptm:sysm :("); 311 | return; 312 | } 313 | 314 | u32* ipc = getThreadCommandBuffer(); 315 | ipc[0] = 0x8010640; 316 | memcpy(&ipc[1], &pattern, 0x64); 317 | svcSendSyncRequest(serviceHandle); 318 | svcCloseHandle(serviceHandle); 319 | } 320 | 321 | void test_LED(LED patern, uint8_t lp) 322 | { 323 | LED_MCU MCU_PAT; 324 | 325 | for (int i = 0; i<=31; i++) 326 | { 327 | MCU_PAT.r[i] = patern.r[i]; 328 | MCU_PAT.g[i] = patern.g[i]; 329 | MCU_PAT.b[i] = patern.b[i]; 330 | } 331 | 332 | MCU_PAT.ani[0] = 0x50; 333 | MCU_PAT.ani[1] = 0xFF; 334 | MCU_PAT.ani[2] = lp; 335 | 336 | ptmsysmSetInfoLedPattern(MCU_PAT); 337 | } 338 | 339 | // when done we want LUMA to reload so it can patch with our ips patches 340 | // https://www.3dbrew.org/wiki/PTMSYSM:LaunchFIRMRebootSystem 341 | void PTM_RebootAsync() 342 | { 343 | 344 | ptmSysmInit(); 345 | 346 | Handle serviceHandle = 0; 347 | Result result = srvGetServiceHandle(&serviceHandle, "ptm:sysm"); 348 | if (result != 0) { 349 | return; 350 | } 351 | 352 | u32 *commandBuffer = getThreadCommandBuffer(); 353 | commandBuffer[0] = 0x04090080; 354 | commandBuffer[1] = 0x00000000; 355 | commandBuffer[2] = 0x00000000; 356 | 357 | svcSendSyncRequest(serviceHandle); 358 | svcCloseHandle(serviceHandle); 359 | 360 | ptmSysmExit(); 361 | } 362 | 363 | void listMenu() 364 | { 365 | iprintf("\x1b[2J"); 366 | printf("\x1b[0;0H\x1b[30;0m"); 367 | printf("===CtrRGBPATTY===\n"); 368 | for (int i = 0; i <= CMDS-1; i++) 369 | { 370 | if (i == selected) 371 | printf("\x1b[47;30m* %s\x1b[30;0m\n", menu[i].c_str()); 372 | else 373 | printf("\x1b[30;0m* %s\n", menu[i].c_str()); 374 | } 375 | printf("=================\n"); 376 | 377 | printf("COLOR : %s\n", color_HEX); 378 | printf("PATERN : %s\n", paterns[selectedpat].c_str()); 379 | 380 | if (staticend) 381 | { 382 | printf("STATIC : FALSE\n"); 383 | } 384 | else 385 | { 386 | printf("STATIC : TRUE\n"); 387 | } 388 | 389 | if (LOOPBYTE == 0xFF) 390 | { 391 | printf("REPEAT : FALSE\n"); 392 | } 393 | else 394 | { 395 | printf("REPEAT : TRUE\n"); 396 | } 397 | } 398 | 399 | int main(int argc, char **argv) 400 | { 401 | srvInit(); 402 | aptInit(); 403 | gfxInitDefault(); 404 | 405 | // Init console for text output 406 | consoleInit(GFX_TOP, NULL); 407 | 408 | selected = 0; 409 | listMenu(); 410 | 411 | while (aptMainLoop()) 412 | { 413 | hidScanInput(); 414 | 415 | u32 kDown = hidKeysDown(); 416 | 417 | if (kDown & KEY_START) 418 | { 419 | PTM_RebootAsync(); 420 | break; 421 | } 422 | 423 | static SwkbdState swkbd; 424 | static SwkbdStatusData swkbdStatus; 425 | static SwkbdLearningData swkbdLearning; 426 | 427 | if (kDown & KEY_DDOWN) 428 | { 429 | selected=selected+1; 430 | if (selected>CMDS-1) 431 | selected = 0; 432 | listMenu(); 433 | } 434 | 435 | if (kDown & KEY_DUP) 436 | { 437 | selected=selected-1; 438 | if (selected<0) 439 | selected = CMDS-1; 440 | listMenu(); 441 | } 442 | 443 | if (kDown & KEY_A) 444 | { 445 | switch(selected) 446 | { 447 | case 0: 448 | swkbdInit(&swkbd, SWKBD_TYPE_NORMAL, 3, -1); 449 | swkbdSetInitialText(&swkbd, color_HEX); 450 | swkbdSetHintText(&swkbd, "Color Hex Code"); 451 | swkbdSetStatusData(&swkbd, &swkbdStatus, false, true); 452 | swkbdSetLearningData(&swkbd, &swkbdLearning, false, true); 453 | swkbdInputText(&swkbd, (char*)color_HEX, sizeof(color_HEX)); 454 | listMenu(); 455 | break; 456 | case 1: 457 | selectedpat=selectedpat+1; 458 | if (selectedpat>PATS-1) 459 | selectedpat = 0; 460 | listMenu(); 461 | break; 462 | case 2: 463 | staticend = !staticend; 464 | listMenu(); 465 | break; 466 | case 3: 467 | if (LOOPBYTE == 0xFF) 468 | LOOPBYTE = 0x00; 469 | else 470 | LOOPBYTE = 0xFF; 471 | listMenu(); 472 | break; 473 | case 4: 474 | LED notification; 475 | createLED(¬ification, std::string(color_HEX), false, selectedpat); 476 | writepatch(notification); 477 | break; 478 | case 5: 479 | LED test_notification; 480 | createLED(&test_notification, std::string(color_HEX), false, selectedpat); 481 | test_LED(test_notification, LOOPBYTE); 482 | break; 483 | case 6: 484 | ptmSysmInit(); 485 | PTMSYSM_ShutdownAsync(0); 486 | ptmSysmExit(); 487 | break; 488 | default: 489 | printf("err\n"); 490 | } 491 | } 492 | 493 | 494 | gfxFlushBuffers(); 495 | gfxSwapBuffers(); 496 | gspWaitForVBlank(); 497 | } 498 | 499 | gfxExit(); 500 | aptExit(); 501 | srvExit(); 502 | return 0; 503 | } 504 | --------------------------------------------------------------------------------