├── .gitattributes ├── .gitignore ├── 3ds.ld ├── Includes ├── common.h ├── configs.h ├── hid.h ├── plugin.h ├── result.h └── types.h ├── MonsterHunter.plg ├── README.md ├── Sources ├── bootloader.s ├── cheats.c ├── cheats.h ├── config.c ├── config.h ├── menu.c └── notes.h ├── build.bat ├── build.py ├── lib ├── libShark2NTR_dev.a ├── libc.a ├── libctr.a ├── libg.a ├── libgcc.a ├── libntr.a └── libsysbase.a ├── ofiles ├── cheats_logo.o ├── credit_logo.o ├── hotkeys_logo.o ├── main.o ├── note.o ├── speed_logo.o └── zelda_split.o └── plugin └── plugin ├── 0004000000033500 └── ZeldaOOT3D_USA.plg └── 0004000000033600 └── ZeldaOOT3D_EUR.plg /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.ko 3 | *.obj 4 | *.elf 5 | 6 | # Precompiled Headers 7 | *.gch 8 | *.pch 9 | 10 | # Libraries 11 | *.lib 12 | *.la 13 | *.lo 14 | 15 | # Shared objects (inc. Windows DLLs) 16 | *.dll 17 | *.so 18 | *.so.* 19 | *.dylib 20 | 21 | # Executables 22 | *.exe 23 | *.out 24 | *.app 25 | *.i*86 26 | *.x86_64 27 | *.hex 28 | 29 | # Debug files 30 | *.dSYM/ 31 | 32 | # ========================= 33 | # Operating System Files 34 | # ========================= 35 | 36 | # OSX 37 | # ========================= 38 | 39 | .DS_Store 40 | .AppleDouble 41 | .LSOverride 42 | 43 | # Thumbnails 44 | ._* 45 | 46 | # Files that might appear in the root of a volume 47 | .DocumentRevisions-V100 48 | .fseventsd 49 | .Spotlight-V100 50 | .TemporaryItems 51 | .Trashes 52 | .VolumeIcon.icns 53 | 54 | # Directories potentially created on remote AFP share 55 | .AppleDB 56 | .AppleDesktop 57 | Network Trash Folder 58 | Temporary Items 59 | .apdisk 60 | 61 | # Windows 62 | # ========================= 63 | 64 | # Windows image file caches 65 | Thumbs.db 66 | ehthumbs.db 67 | 68 | # Folder config file 69 | Desktop.ini 70 | 71 | # Recycle Bin used on file shares 72 | $RECYCLE.BIN/ 73 | 74 | # Windows Installer files 75 | *.cab 76 | *.msi 77 | *.msm 78 | *.msp 79 | 80 | # Windows shortcuts 81 | *.lnk 82 | -------------------------------------------------------------------------------- /3ds.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") 3 | OUTPUT_ARCH(arm) 4 | ENTRY(_Reset) 5 | SECTIONS 6 | { 7 | . = 0x00100000; 8 | 9 | . = ALIGN(4); 10 | .text : 11 | { 12 | __text_start = .; 13 | bootloader.o (.text*) 14 | *(.text*) 15 | } 16 | 17 | . = ALIGN(4); 18 | .data : 19 | { 20 | *(.data) 21 | } 22 | 23 | . = ALIGN(4); 24 | .rel.dyn : 25 | { 26 | *(.__rel_dyn_start) 27 | *(.rel*) 28 | *(.rel.*) 29 | *(.__rel_dyn_end) 30 | } 31 | 32 | __code_end = .; 33 | 34 | . = ALIGN(4); 35 | .bss : 36 | { 37 | *(.__bss_start) 38 | *(.bss COMMON) 39 | *(.__bss_end) 40 | } 41 | __end__ = .; 42 | } 43 | -------------------------------------------------------------------------------- /Includes/common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_H 2 | #define COMMON_H 3 | #include "plugin.h" 4 | #include "hid.h" 5 | 6 | extern u32 IoBasePad; 7 | extern vu32 *pad_base; 8 | 9 | void set_hid_address(u32 address); 10 | 11 | static inline int is_pressed(u32 keys) 12 | { 13 | if (pad_base != NULL) 14 | { 15 | if (((hidKeysDown() & keys) == keys)) 16 | return (1); 17 | } 18 | else 19 | if (((((*(vu32*)(IoBasePad) ^ 0xFFF) & 0xFFF) & keys) == keys)) 20 | return (1); 21 | return (0); 22 | } 23 | 24 | static inline int any_is_pressed(u32 keys) 25 | { 26 | if (pad_base != NULL) 27 | { 28 | if (((hidKeysDown() & keys))) 29 | return (1); 30 | } 31 | else 32 | if (((((*(vu32*)(IoBasePad) ^ 0xFFF) & 0xFFF) & keys))) 33 | return (1); 34 | return (0); 35 | } 36 | 37 | static inline int wait_keys(u32 keys) 38 | { 39 | while (!(any_is_pressed(keys))) 40 | continue; 41 | } 42 | 43 | static inline void wait_keys_released(u32 keys) 44 | { 45 | while (1) 46 | if (!(any_is_pressed(keys))) 47 | return; 48 | } 49 | 50 | static inline void wait_all_released(void) 51 | { 52 | while (1) 53 | if (((*(vu32*)(IoBasePad) ^ 0xFFF) & 0xFFF) == 0) 54 | return; 55 | } 56 | 57 | static inline int upper_left_touched(void) 58 | { 59 | if (is_pressed(KEY_TOUCH)) 60 | if (hidTouchPos().px < 160 && hidTouchPos().py < 120) 61 | return (1); 62 | return (0); 63 | } 64 | 65 | static inline int upper_right_touched(void) 66 | { 67 | if (is_pressed(KEY_TOUCH)) 68 | if (hidTouchPos().px >= 160 && hidTouchPos().py < 120) 69 | return (1); 70 | return (0); 71 | } 72 | 73 | static inline int lower_left_touched(void) 74 | { 75 | if (is_pressed(KEY_TOUCH)) 76 | if (hidTouchPos().px < 160 && hidTouchPos().py >= 120) 77 | return (1); 78 | return (0); 79 | } 80 | 81 | static inline int lower_right_touched(void) 82 | { 83 | if (is_pressed(KEY_TOUCH)) 84 | if (hidTouchPos().px >= 160 && hidTouchPos().py >= 120) 85 | return (1); 86 | return (0); 87 | } 88 | 89 | static inline int range_touched(int start_x, int end_x, int start_y, int end_y) 90 | { 91 | u16 px; 92 | u16 py; 93 | 94 | px = hidTouchPos().px; 95 | py = hidTouchPos().py; 96 | if (is_pressed(KEY_TOUCH)) 97 | if (px >= start_x && px <= end_x) 98 | if (py >= start_y && py <= end_y) 99 | return (1); 100 | return (0); 101 | } 102 | 103 | #endif -------------------------------------------------------------------------------- /Includes/configs.h: -------------------------------------------------------------------------------- 1 | #ifndef WRITEU8 2 | # define WRITEU8(addr, data) *(vu8*)(addr) = data 3 | #endif 4 | #ifndef WRITEU16 5 | # define WRITEU16(addr, data) *(vu16*)(addr) = data 6 | #endif 7 | #ifndef WRITEU32 8 | # define WRITEU32(addr, data) *(vu32*)(addr) = data 9 | #endif 10 | #ifndef READU8 11 | # define READU8(addr) *(volatile unsigned char*)(addr) 12 | #endif 13 | #ifndef READU16 14 | # define READU16(addr) *(volatile unsigned short*)(addr) 15 | #endif 16 | #ifndef READU32 17 | # define READU32(addr) *(volatile unsigned int*)(addr) 18 | #endif 19 | 20 | #ifndef IO_BASE_PAD 21 | # define IO_BASE_PAD 1 22 | #endif 23 | #ifndef IO_BASE_LCD 24 | # define IO_BASE_LCD 2 25 | #endif 26 | #ifndef IO_BASE_PDC 27 | # define IO_BASE_PDC 3 28 | #endif 29 | #ifndef IO_BASE_GSPHEAP 30 | # define IO_BASE_GSPHEAP 4 31 | #endif 32 | #ifndef BUTTON_A 33 | # define BUTTON_A 0x00000001 34 | #endif 35 | #ifndef BUTTON_B 36 | # define BUTTON_B 0x00000002 37 | #endif 38 | #ifndef BUTTON_SE 39 | # define BUTTON_SE 0x00000004 40 | #endif 41 | #ifndef BUTTON_ST 42 | # define BUTTON_ST 0x00000008 43 | #endif 44 | #ifndef BUTTON_DR 45 | # define BUTTON_DR 0x00000010 46 | #endif 47 | #ifndef BUTTON_DL 48 | # define BUTTON_DL 0x00000020 49 | #endif 50 | #ifndef BUTTON_DU 51 | # define BUTTON_DU 0x00000040 52 | #endif 53 | #ifndef BUTTON_DD 54 | # define BUTTON_DD 0x00000080 55 | #endif 56 | #ifndef BUTTON_R 57 | # define BUTTON_R 0x00000100 58 | #endif 59 | #ifndef BUTTON_L 60 | # define BUTTON_L 0x00000200 61 | #endif 62 | #ifndef BUTTON_ZR 63 | # define BUTTON_ZR 0x00008000 64 | #endif 65 | #ifndef BUTTON_ZL 66 | # define BUTTON_ZL 0x00004000 67 | #endif 68 | #ifndef BUTTON_X 69 | # define BUTTON_X 0x00000400 70 | #endif 71 | #ifndef BUTTON_Y 72 | # define BUTTON_Y 0x00000800 73 | #endif 74 | 75 | #ifndef A 76 | # define A BUTTON_A 77 | #endif 78 | #ifndef B 79 | # define B BUTTON_B 80 | #endif 81 | #ifndef X 82 | # define X BUTTON_X 83 | #endif 84 | #ifndef Y 85 | # define Y BUTTON_Y 86 | #endif 87 | #ifndef L 88 | # define L BUTTON_L 89 | #endif 90 | #ifndef R 91 | # define R BUTTON_R 92 | #endif 93 | #ifndef ZL 94 | # define ZL BUTTON_ZL 95 | #endif 96 | #ifndef ZR 97 | # define ZR BUTTON_ZR 98 | #endif 99 | #ifndef ST 100 | # define ST BUTTON_ST 101 | #endif 102 | #ifndef SE 103 | # define SE BUTTON_SE 104 | #endif 105 | #ifndef DU 106 | # define DU BUTTON_DU 107 | #endif 108 | #ifndef DD 109 | # define DD BUTTON_DD 110 | #endif 111 | #ifndef DL 112 | # define DL BUTTON_DL 113 | #endif 114 | #ifndef DR 115 | # define DR BUTTON_DR 116 | #endif -------------------------------------------------------------------------------- /Includes/hid.h: -------------------------------------------------------------------------------- 1 | #ifndef MYHID_H 2 | #define MYHID_H 3 | 4 | #include "types.h" 5 | 6 | #define BIT(x) (1U << x) 7 | enum 8 | { 9 | KEY_A = BIT(0), ///< A 10 | KEY_B = BIT(1), ///< B 11 | KEY_SELECT = BIT(2), ///< Select 12 | KEY_START = BIT(3), ///< Start 13 | KEY_DRIGHT = BIT(4), ///< D-Pad Right 14 | KEY_DLEFT = BIT(5), ///< D-Pad Left 15 | KEY_DUP = BIT(6), ///< D-Pad Up 16 | KEY_DDOWN = BIT(7), ///< D-Pad Down 17 | KEY_R = BIT(8), ///< R 18 | KEY_L = BIT(9), ///< L 19 | KEY_X = BIT(10), ///< X 20 | KEY_Y = BIT(11), ///< Y 21 | KEY_ZL = BIT(14), ///< ZL (New 3DS only) 22 | KEY_ZR = BIT(15), ///< ZR (New 3DS only) 23 | KEY_TOUCH = BIT(20), ///< Touch (Not actually provided by HID) 24 | KEY_CSTICK_RIGHT = BIT(24), ///< C-Stick Right (New 3DS only) 25 | KEY_CSTICK_LEFT = BIT(25), ///< C-Stick Left (New 3DS only) 26 | KEY_CSTICK_UP = BIT(26), ///< C-Stick Up (New 3DS only) 27 | KEY_CSTICK_DOWN = BIT(27), ///< C-Stick Down (New 3DS only) 28 | KEY_CPAD_RIGHT = BIT(28), ///< Circle Pad Right 29 | KEY_CPAD_LEFT = BIT(29), ///< Circle Pad Left 30 | KEY_CPAD_UP = BIT(30), ///< Circle Pad Up 31 | KEY_CPAD_DOWN = BIT(31), ///< Circle Pad Down 32 | 33 | // Generic catch-all directions 34 | KEY_UP = KEY_DUP | KEY_CPAD_UP, ///< D-Pad Up or Circle Pad Up 35 | KEY_DOWN = KEY_DDOWN | KEY_CPAD_DOWN, ///< D-Pad Down or Circle Pad Down 36 | KEY_LEFT = KEY_DLEFT | KEY_CPAD_LEFT, ///< D-Pad Left or Circle Pad Left 37 | KEY_RIGHT = KEY_DRIGHT | KEY_CPAD_RIGHT, ///< D-Pad Right or Circle Pad Right 38 | KEY_CPAD = KEY_CPAD_DOWN | KEY_CPAD_UP | KEY_CPAD_LEFT | KEY_CPAD_RIGHT 39 | }; 40 | 41 | typedef struct s_touch 42 | { 43 | u16 px; ///< Touch X 44 | u16 py; ///< Touch Y 45 | } t_touch; 46 | 47 | u32 hidKeysDown(void); 48 | t_touch hidTouchPos(void); 49 | void setHID(u32 keys); 50 | 51 | #endif -------------------------------------------------------------------------------- /Includes/plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef PLUGIN_H 2 | #define PLUGIN_H 3 | 4 | #include "types.h" 5 | #include "configs.h" 6 | #include "result.h" 7 | #include "common.h" 8 | #include "hid.h" 9 | 10 | #define MAX(x, y) (x > y ? x : y) 11 | 12 | #define ABS(x) MAX(x, -x) 13 | 14 | u32 plgGetIoBase(u32 IoType); 15 | Handle getCurrentProcessHandle(void); 16 | u32 getCurrentProcessId(void); 17 | void onCheatItemChanged(int id); 18 | 19 | enum 20 | { 21 | SLOW = 0, 22 | NORMAL = 1, 23 | FAST = 2 24 | }; 25 | 26 | typedef enum 27 | { 28 | INFO = BIT(0), 29 | WARNING = BIT(1), 30 | DEBUG = BIT(2), 31 | ERROR = BIT(3) 32 | } log_type; 33 | 34 | typedef union u_ib 35 | { 36 | u32 i; 37 | u8 b[4]; 38 | } t_ib; 39 | 40 | /* 41 | ** void init_img(void) 42 | ** Initialize the graphics components of the plugin 43 | */ 44 | void init_img(void); 45 | 46 | /* 47 | ** cheats.c 48 | */ 49 | /* void menu(void) 50 | ** Initialize the menu 51 | */ 52 | void menu(void); 53 | 54 | /* 55 | ** void set_default_speed(int speed) 56 | ** speed: can be SLOW, NORMAL or FAST 57 | ** Define the speed of the plugin to the specified mode 58 | */ 59 | void set_default_speed(int speed); 60 | 61 | /* 62 | ** u32 get_tid_high(void) 63 | ** Return the high value of the current process's title id 64 | */ 65 | u32 get_tid_high(void); 66 | 67 | /* 68 | ** u32 get_tid_lo(void) 69 | ** Return the low value of the current process's title id 70 | */ 71 | u32 get_tid_low(void); 72 | 73 | /* 74 | ** u8 *get_title_id(void) 75 | ** Return a pointer to a string with the full title id value 76 | */ 77 | u8 *get_title_id(void); 78 | 79 | /* 80 | ** int new_entry(char *text, void (*f)()) 81 | ** *text: a pointer to the entry's text 82 | ** *f: the function you want to execute when the entry is active 83 | ** can be NULL 84 | ** Return value: the index of the entry in the menu 85 | ** Create a new entry in the menu 86 | ** If a spoiler is open, the entry will be created in the spoiler 87 | */ 88 | int new_entry(char *text, void(*f)()); 89 | 90 | /* 91 | ** int new_spoiler(char *text) 92 | ** *text: a pointer to the spoiler's text 93 | ** Return value: the index of the spoiler in the menu 94 | ** Create a new spoiler and define it as the default location 95 | ** for the nexts new_entry calls 96 | */ 97 | int new_spoiler(char *text); 98 | 99 | /* 100 | ** exit_spoiler(void) 101 | ** Close a spoiler and redefine the default location of 102 | ** the next new_entry call outside of the spoiler 103 | */ 104 | void exit_spoiler(void); 105 | 106 | /* 107 | ** int new_radio_entry(char *text, void (*f)()) 108 | ** *text: a pointer to the entry's text 109 | ** *f: the function to execute when the entry is active 110 | ** can be NULL 111 | ** Return value: the index of the entry in the menu 112 | ** Create a new menu entry but with a radio mode: 113 | ** Only one radio entry can be activated at a time 114 | ** The range of the radio mode is the spoiler range 115 | */ 116 | int new_radio_entry(char *text, void(*f)()); 117 | 118 | /* 119 | ** int new_unselectable_entry(char *text) 120 | ** *text: a pointer to the entry's text 121 | ** Return value: the index of the entry 122 | ** Create an entry in the menu which can't be selected by the cursor 123 | */ 124 | int new_unselectable_entry(char *text); 125 | 126 | /* 127 | ** int new_spearator(void) 128 | ** Return value: the index of the entry 129 | ** Create a separator in the menu which can't be selected 130 | */ 131 | int new_separator(void); 132 | 133 | /* 134 | ** int new_line(void) 135 | ** Return value: the index of the entry 136 | ** Create an empty and unselectable entry in the menu 137 | */ 138 | int new_line(void); 139 | 140 | /* 141 | ** void set_note(const char *text, int index) 142 | ** *text: a pointer to the text note 143 | ** index: the index of the entry 144 | ** Define the text note printed when pressing Y in the menu 145 | */ 146 | void set_note(const char *text, int index); 147 | 148 | /* 149 | ** void disableCheat(int index) 150 | ** index: the index of the entry to disable 151 | ** Disable an entry 152 | */ 153 | void disableCheat(int index); 154 | void new_log(int log_type, char *text, ...); 155 | 156 | #endif 157 | -------------------------------------------------------------------------------- /Includes/result.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file result.h 3 | * @brief 3DS result code tools 4 | */ 5 | #pragma once 6 | #ifndef RESULT_H 7 | #define RESULT_H 8 | #include "plugin.h" 9 | 10 | /// Checks whether a result code indicates success. 11 | #define R_SUCCEEDED(res) ((res)>=0) 12 | /// Checks whether a result code indicates failure. 13 | #define R_FAILED(res) ((res)<0) 14 | /// Returns the level of a result code. 15 | #define R_LEVEL(res) (((res)>>27)&0x1F) 16 | /// Returns the summary of a result code. 17 | #define R_SUMMARY(res) (((res)>>21)&0x3F) 18 | /// Returns the module ID of a result code. 19 | #define R_MODULE(res) (((res)>>10)&0xFF) 20 | /// Returns the description of a result code. 21 | #define R_DESCRIPTION(res) ((res)&0x3FF) 22 | 23 | /// Builds a result code from its constituent components. 24 | #define MAKERESULT(level,summary,module,description) \ 25 | ((((level)&0x1F)<<27) | (((summary)&0x3F)<<21) | (((module)&0xFF)<<10) | ((description)&0x3FF)) 26 | 27 | /// Result code level values. 28 | enum 29 | { 30 | // >= 0 31 | RL_SUCCESS = 0, 32 | RL_INFO = 1, 33 | 34 | // < 0 35 | RL_FATAL = 0x1F, 36 | RL_RESET = RL_FATAL - 1, 37 | RL_REINITIALIZE = RL_FATAL - 2, 38 | RL_USAGE = RL_FATAL - 3, 39 | RL_PERMANENT = RL_FATAL - 4, 40 | RL_TEMPORARY = RL_FATAL - 5, 41 | RL_STATUS = RL_FATAL - 6, 42 | }; 43 | 44 | /// Result code summary values. 45 | enum 46 | { 47 | RS_SUCCESS = 0, 48 | RS_NOP = 1, 49 | RS_WOULDBLOCK = 2, 50 | RS_OUTOFRESOURCE = 3, 51 | RS_NOTFOUND = 4, 52 | RS_INVALIDSTATE = 5, 53 | RS_NOTSUPPORTED = 6, 54 | RS_INVALIDARG = 7, 55 | RS_WRONGARG = 8, 56 | RS_CANCELED = 9, 57 | RS_STATUSCHANGED = 10, 58 | RS_INTERNAL = 11, 59 | RS_INVALIDRESVAL = 63, 60 | }; 61 | 62 | /// Result code generic description values. 63 | enum 64 | { 65 | RD_SUCCESS = 0, 66 | RD_INVALID_RESULT_VALUE = 0x3FF, 67 | RD_TIMEOUT = RD_INVALID_RESULT_VALUE - 1, 68 | RD_OUT_OF_RANGE = RD_INVALID_RESULT_VALUE - 2, 69 | RD_ALREADY_EXISTS = RD_INVALID_RESULT_VALUE - 3, 70 | RD_CANCEL_REQUESTED = RD_INVALID_RESULT_VALUE - 4, 71 | RD_NOT_FOUND = RD_INVALID_RESULT_VALUE - 5, 72 | RD_ALREADY_INITIALIZED = RD_INVALID_RESULT_VALUE - 6, 73 | RD_NOT_INITIALIZED = RD_INVALID_RESULT_VALUE - 7, 74 | RD_INVALID_HANDLE = RD_INVALID_RESULT_VALUE - 8, 75 | RD_INVALID_POINTER = RD_INVALID_RESULT_VALUE - 9, 76 | RD_INVALID_ADDRESS = RD_INVALID_RESULT_VALUE - 10, 77 | RD_NOT_IMPLEMENTED = RD_INVALID_RESULT_VALUE - 11, 78 | RD_OUT_OF_MEMORY = RD_INVALID_RESULT_VALUE - 12, 79 | RD_MISALIGNED_SIZE = RD_INVALID_RESULT_VALUE - 13, 80 | RD_MISALIGNED_ADDRESS = RD_INVALID_RESULT_VALUE - 14, 81 | RD_BUSY = RD_INVALID_RESULT_VALUE - 15, 82 | RD_NO_DATA = RD_INVALID_RESULT_VALUE - 16, 83 | RD_INVALID_COMBINATION = RD_INVALID_RESULT_VALUE - 17, 84 | RD_INVALID_ENUM_VALUE = RD_INVALID_RESULT_VALUE - 18, 85 | RD_INVALID_SIZE = RD_INVALID_RESULT_VALUE - 19, 86 | RD_ALREADY_DONE = RD_INVALID_RESULT_VALUE - 20, 87 | RD_NOT_AUTHORIZED = RD_INVALID_RESULT_VALUE - 21, 88 | RD_TOO_LARGE = RD_INVALID_RESULT_VALUE - 22, 89 | RD_INVALID_SELECTION = RD_INVALID_RESULT_VALUE - 23, 90 | }; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /Includes/types.h: -------------------------------------------------------------------------------- 1 | #ifndef TYPES_H 2 | #define TYPES_H 3 | 4 | #include 5 | #include 6 | 7 | #define U64_MAX UINT64_MAX 8 | 9 | #define NULL (void *)0x0 10 | 11 | typedef uint8_t u8; 12 | typedef uint16_t u16; 13 | typedef uint32_t u32; 14 | typedef uint64_t u64; 15 | 16 | typedef int8_t s8; 17 | typedef int16_t s16; 18 | typedef int32_t s32; 19 | typedef int64_t s64; 20 | 21 | typedef volatile u8 vu8; 22 | typedef volatile u16 vu16; 23 | typedef volatile u32 vu32; 24 | typedef volatile u64 vu64; 25 | 26 | typedef volatile s8 vs8; 27 | typedef volatile s16 vs16; 28 | typedef volatile s32 vs32; 29 | typedef volatile s64 vs64; 30 | 31 | typedef u32 Handle; 32 | typedef s32 Result; 33 | typedef void (*ThreadFunc)(u32); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /MonsterHunter.plg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/MonsterHunter.plg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Monster Hunter Cheat Example 2 | A cheats plugin for NTR CFW 3 | 4 | Using this source is a great back end for your own cheat menu, and I'll be teaching others how to create their own codes from Gateway codes. 5 | All credits goes to Nanquitas for this 6 | -------------------------------------------------------------------------------- /Sources/bootloader.s: -------------------------------------------------------------------------------- 1 | .arm 2 | .align(4); 3 | .section .text 4 | .global _Reset 5 | _Reset: 6 | 7 | STMFD SP!, {R0-R12, LR}; 8 | MRS R0, CPSR 9 | STMFD SP!, {R0} 10 | 11 | LDR R6, =_Reset 12 | ADR R5, _Reset 13 | sub r5, r5, r6 /* r5 = realAddress - baseAddress */ 14 | ldr r6, = __rel_dyn_start 15 | ldr r7, = __rel_dyn_end 16 | add r6, r6, r5 17 | add r7, r7, r5 18 | relocNotFinished: 19 | ldmia r6!, {r3, r4} 20 | cmp r4, #0x17 21 | bne notRelativeEntry 22 | add r3, r3, r5 23 | ldr r4, [r3] 24 | add r4, r4, r5 25 | str r4, [r3] 26 | notRelativeEntry: 27 | cmp r6, r7 28 | bcc relocNotFinished 29 | ldr r0, =0xffff8001 30 | adr r1, _Reset 31 | ldr r2, =__rel_dyn_end 32 | sub r2, r2, r1 /* r2 = codesize */ 33 | svc 0x54 /* flush instruction cache */ 34 | nop 35 | nop 36 | 37 | mov r0, sp 38 | bl c_entry 39 | 40 | ldmfd sp!, {r0} 41 | msr cpsr, r0 42 | ldmfd SP!, {R0-R12, LR}; 43 | 44 | .global _ReturnToUser 45 | _ReturnToUser: 46 | bx lr 47 | nop 48 | nop 49 | nop 50 | msr cpsr, r0 51 | 52 | .global plgGetIoBase; 53 | .type plgGetIoBase, %function; 54 | plgGetIoBase: 55 | nop 56 | nop 57 | 58 | .global copyRemoteMemory; 59 | .type copyRemoteMemory, %function; 60 | copyRemoteMemory: 61 | nop 62 | nop 63 | 64 | 65 | 66 | .section .__rel_dyn_start 67 | __rel_dyn_start: 68 | 69 | .section .__rel_dyn_end 70 | __rel_dyn_end: 71 | 72 | .section .__bss_start 73 | .global __c_bss_start 74 | __c_bss_start: 75 | 76 | .section .__bss_end 77 | .global __c_bss_end 78 | __c_bss_end: 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /Sources/cheats.c: -------------------------------------------------------------------------------- 1 | #include "cheats.h" 2 | #include "hid.h" 3 | 4 | 5 | char *builder_name = "itsRyan"; 6 | 7 | void exceptSharpness(void) 8 | { 9 | WRITEU32(0xC1EDC4, 0xE3510053); 10 | WRITEU32(0xC1EDC8, 0x3A00001); 11 | WRITEU32(0xC1EDCC, 0xE12FFF1E); 12 | WRITEU32(0xAF334C, 0xEA04AE9C); 13 | WRITEU32(0x4F79A8, 0xE1A00000); 14 | WRITEU32(0x4F79B4, 0xE3A00001); 15 | } 16 | 17 | void code2(void) 18 | { 19 | //do_something 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Sources/cheats.h: -------------------------------------------------------------------------------- 1 | #ifndef CHEATS_H 2 | #define CHEATS_H 3 | 4 | #include "plugin.h" 5 | 6 | void exceptSharpness(void); 7 | void code2(void); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /Sources/config.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #define NULL (void *)0 4 | 5 | #define POS(x, y) (x | (y << 16)) 6 | #define DIM(w, h) (w | (h << 16)) 7 | 8 | typedef struct s_img_infos 9 | { 10 | int pos; 11 | int dimension; 12 | int rgb; 13 | } t_img_infos; 14 | 15 | extern unsigned int ui_offset; 16 | extern unsigned char *BACKGROUND; 17 | //extern unsigned char *SPLASH; 18 | extern unsigned char *NOTE_BACKGROUND; 19 | extern unsigned char *CHEATS_LABEL; 20 | extern unsigned char *SPEED_LABEL; 21 | extern unsigned char *HOTKEY_LABEL; 22 | extern unsigned char *CREDIT_LABEL; 23 | unsigned char *background_img = NULL; 24 | unsigned char *credit_label = NULL; 25 | unsigned char *splash_img = NULL; 26 | unsigned char *cheats_label = NULL; 27 | unsigned char *speed_label = NULL; 28 | unsigned char *hotkey_label = NULL; 29 | unsigned char *note_background = NULL; 30 | t_img_infos background_infos = { 0, 0, 0}; 31 | t_img_infos cheats_label_infos = { 0, 0, 0 }; 32 | t_img_infos speed_label_infos = { 0, 0, 0 }; 33 | t_img_infos hotkey_label_infos = { 0, 0, 0 }; 34 | t_img_infos credit_label_infos = { 0, 0, 0 }; 35 | t_img_infos note_background_infos = { 0, 0, 0 }; 36 | 37 | 38 | void init_img(void) 39 | { 40 | ui_offset = UI_OFFSET; 41 | background_img = (unsigned char *)BACKGROUND; 42 | //splash_img = SPLASH; 43 | note_background = (unsigned char *)NOTE_BACKGROUND; 44 | cheats_label = CHEATS_LABEL; 45 | speed_label = SPEED_LABEL; 46 | hotkey_label = HOTKEY_LABEL; 47 | credit_label = CREDIT_LABEL; 48 | background_infos = (t_img_infos) { POS(BACKGROUND_POS_X, BACKGROUND_POS_Y), DIM(BACKGROUND_WIDTH, BACKGROUND_HEIGHT), BACKGROUND_RGB }; 49 | cheats_label_infos = (t_img_infos) { POS(CHEATS_LABEL_POS_X, CHEATS_LABEL_POS_Y), DIM(CHEATS_LABEL_WIDTH, CHEATS_LABEL_HEIGHT), CHEATS_LABEL_RGB }; 50 | speed_label_infos = (t_img_infos) { POS(SPEED_LABEL_POS_X, SPEED_LABEL_POS_Y), DIM(SPEED_LABEL_WIDTH, SPEED_LABEL_HEIGHT), SPEED_LABEL_RGB }; 51 | hotkey_label_infos = (t_img_infos) { POS(HOTKEY_LABEL_POS_X, HOTKEY_LABEL_POS_Y), DIM(HOTKEY_LABEL_WIDTH, HOTKEY_LABEL_HEIGHT), HOTKEY_LABEL_RGB }; 52 | credit_label_infos = (t_img_infos) { POS(CREDIT_LABEL_POS_X, CREDIT_LABEL_POS_Y), DIM(CREDIT_LABEL_WIDTH, CREDIT_LABEL_HEIGHT), CREDIT_LABEL_RGB }; 53 | note_background_infos = (t_img_infos) { POS(NOTE_BACKGROUND_POS_X, NOTE_BACKGROUND_POS_Y), DIM(NOTE_BACKGROUND_WIDTH, NOTE_BACKGROUND_HEIGHT), NOTE_BACKGROUND_RGB }; 54 | } -------------------------------------------------------------------------------- /Sources/config.h: -------------------------------------------------------------------------------- 1 | unsigned char *fill_img = "Don't edit this."; 2 | unsigned char *null_img = (void *)0x0; 3 | //unsigned char *gateshark_label = "Don't edit this."; 4 | 5 | #define BACKGROUND zelda_split 6 | #define BACKGROUND_POS_X 0 7 | #define BACKGROUND_POS_Y 42 8 | #define BACKGROUND_WIDTH 320 9 | #define BACKGROUND_HEIGHT 198 10 | #define BACKGROUND_RGB 1 11 | 12 | #define SPLASH BACKGROUND 13 | 14 | #define UI_OFFSET 15 15 | 16 | #define CREDIT_LABEL credit_logo 17 | #define CREDIT_LABEL_POS_X 0 18 | #define CREDIT_LABEL_POS_Y 0 19 | #define CREDIT_LABEL_WIDTH 320 20 | #define CREDIT_LABEL_HEIGHT 42 21 | #define CREDIT_LABEL_RGB 1 22 | 23 | #define CHEATS_LABEL cheats_logo 24 | #define CHEATS_LABEL_POS_X 0 25 | #define CHEATS_LABEL_POS_Y 0 26 | #define CHEATS_LABEL_WIDTH 320 27 | #define CHEATS_LABEL_HEIGHT 42 28 | #define CHEATS_LABEL_RGB 1 29 | 30 | #define SPEED_LABEL speed_logo 31 | #define SPEED_LABEL_POS_X 0 32 | #define SPEED_LABEL_POS_Y 0 33 | #define SPEED_LABEL_WIDTH 320 34 | #define SPEED_LABEL_HEIGHT 42 35 | #define SPEED_LABEL_RGB 1 36 | 37 | #define HOTKEY_LABEL hotkeys_logo 38 | #define HOTKEY_LABEL_POS_X 0 39 | #define HOTKEY_LABEL_POS_Y 0 40 | #define HOTKEY_LABEL_WIDTH 320 41 | #define HOTKEY_LABEL_HEIGHT 42 42 | #define HOTKEY_LABEL_RGB 1 43 | 44 | #define NOTE_BACKGROUND note_back2 45 | #define NOTE_BACKGROUND_POS_X 30 46 | #define NOTE_BACKGROUND_POS_Y 47 47 | #define NOTE_BACKGROUND_WIDTH 260 48 | #define NOTE_BACKGROUND_HEIGHT 145 49 | #define NOTE_BACKGROUND_RGB 0 50 | -------------------------------------------------------------------------------- /Sources/menu.c: -------------------------------------------------------------------------------- 1 | #include "cheats.h" 2 | #include "notes.h" 3 | #include 4 | 5 | void my_menus(void) 6 | { 7 | int index; 8 | int i; 9 | 10 | set_hid_address(0x10002000); 11 | 12 | new_spoiler("Item Codes"); 13 | new_entry("Except Sharpness + 2", exceptSharpness); 14 | new_entry("Code 2", code2); 15 | exit_spoiler(); 16 | 17 | for (i = 2; i <= index; i++) 18 | set_note(notes[i - 2], i); 19 | } 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Sources/notes.h: -------------------------------------------------------------------------------- 1 | #ifndef NOTES_H 2 | #define NOTES_H 3 | 4 | static const char * const notes[] = 5 | { 6 | "Combat codes", 7 | "Refill your heart.\n\nPress the upper side of the touchscreen to execute this code.", 8 | "Refill your magic.\n\nPress the lower side of the touchscreen to execute this code.", 9 | "No more spin attack charge time with this code !", 10 | "Your sword will shine.\n\nThe game can be laggy", 11 | "Put your sticks in fire", 12 | "Moonjump:\n\nPress A to jump.\n\nYou can easily toogle this cheat in-game with DPAD Right.", 13 | "Move fast:\n\nPress X with any Stick direction to move fastly.\n\nYou can easily toogle this cheat in-game with DPAD Left.", 14 | "Endless carrots to bait your horse !", 15 | "New and untested !!!", 16 | "Moonjump:\n\nPress X + A to jump.\n\nNew and untested !!!", 17 | "New and untested !!!", 18 | "New and untested !!!", 19 | "Dungeon", 20 | "New and untested !!!", 21 | "New and untested !!!", 22 | "Inventory codes", 23 | "Misc.", 24 | "No more out of ammo with this infinite arrows code !", 25 | "Love the deku nuts ?\n\nTake some more then !", 26 | "Me too, when I was 5yo I loved having a stick in my hand to discover the world", 27 | "Make this building explode !", 28 | "What the hell is that design ?\n\nIt's war outside !", 29 | "Take this in your face !!", 30 | "I don't like spider man !", 31 | "Yeah !!!\n\nMake me rich !", 32 | "New and untested !!!", 33 | "New and untested !!!", 34 | "New and untested !!!", 35 | "Environment", 36 | "Time codes", 37 | "I wanna sleep some more !", 38 | "It's to hot to work !", 39 | "Wanna have a beer ?", 40 | "I don't wanna sleep...\n\nAlone ! :p", 41 | "New and untested !!!", 42 | "For the lazy guys", 43 | "Combat codes", 44 | "Be a wizard", 45 | "Be a great wizard", 46 | "Be a cat and get your 9 lifes", 47 | "Don't search arounf the world for what you can have in 5 seconds", 48 | "Be a really tough guy", 49 | "Equipment codes", 50 | "Get you kokiri's sword", 51 | "Be a legend !", 52 | "Want a broken sword ?", 53 | "Get you burnable shield", 54 | "For the love of Hyrule !!", 55 | "Whoaaa !!\n\nWhat a shiny shield you got !", 56 | "Be a lutin with this cheap suit\n\n#Tingle", 57 | "Be a demineur with this fire proof suit !", 58 | "Always wanted to be a fishman ?\n\n Be my guest !", 59 | "Unlock all", 60 | "Get 2,5 swords for the price of 1 !", 61 | "Get 3 shields for the price of 1", 62 | "Need some clothes ?", 63 | "Be god on earth and go defeat the evil Ganondorf", 64 | "Story codes", 65 | "Unlock all stones", 66 | "Unlock all medallions", 67 | "Fun codes", 68 | "Link's size", 69 | "Be a giant which crush everything under is feet", 70 | "Tired of being a laughable man ?", 71 | "Wanna see what's under the girl's skirt ?", 72 | "Jealous of mario ?", 73 | "New and untested !!!", 74 | "New and untested !!!", 75 | }; 76 | 77 | #endif -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | set PATH=%PATH%;C:\devkitPro\devkitARM\bin;C:\devkitPro\msys\bin 2 | build.py 3 | 4 | 5 | pause 6 | -------------------------------------------------------------------------------- /build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys 3 | import os 4 | import ftplib 5 | import glob 6 | import datetime 7 | import shutil 8 | from ftplib import FTP 9 | 10 | def allFile(pattern): 11 | s = ""; 12 | for file in glob.glob(pattern): 13 | s += file + " "; 14 | return s; 15 | 16 | def allFolderFile(pattern, ext): 17 | s = ""; 18 | for dirpath, dirnames, filenames in os.walk(pattern): 19 | for filename in [f for f in filenames if f.endswith(ext)]: 20 | s+= os.path.join(dirpath, filename) + ' ' 21 | return s; 22 | 23 | USA_TID = "0004000000187000" 24 | NAME = "MonsterHunter" 25 | HOST = "192.168.1.99" 26 | PORT = "5000" 27 | COPYTOPATH = "%s.plg" % NAME 28 | CC = "arm-none-eabi-gcc" 29 | CP = "arm-none-eabi-g++" 30 | OC = "arm-none-eabi-objcopy" 31 | LD = "arm-none-eabi-ld" 32 | CTRULIB = "../libctru" 33 | DEVKITARM = "c:/devkitPro/devkitARM" 34 | LIBPATH = "-L ./lib " 35 | ARCH = " -march=armv6k -mlittle-endian -mtune=mpcore -mfloat-abi=hard " 36 | CFLAGS = " -Os -c " + ARCH 37 | ASFLAGS = " -Os -c -s " + ARCH 38 | LIBFLAGS = " -lntr -lShark2NTR_dev -lctr -lg -lsysbase -lc -lgcc " 39 | LDFLAGS = " -pie --gc-sections -T 3ds.ld -Map=%s.map " % NAME 40 | INCLUDES = " -I Includes -I Sources -I Includes/libntrplg " 41 | CFILES = allFolderFile(".\\Sources\\", ".c") 42 | ASFILES = allFolderFile(".\\Sources\\", ".s") 43 | OFILES = allFolderFile(".\\ofiles\\", ".o") 44 | ftp = FTP() 45 | FILE = COPYTOPATH 46 | 47 | def connect(host, port): 48 | ftp.connect(host, port); 49 | 50 | def disconnect(): 51 | ftp.quit(); 52 | 53 | def ls(): 54 | ftp.dir(); 55 | 56 | def send(): 57 | file = open(FILE, 'rb'); 58 | ftp.cwd(FTP_FOLDER); 59 | ftp.storbinary('STOR '+ FILE, file); 60 | file.close(); 61 | 62 | def printf(string): 63 | print(datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S') + " : " + string); 64 | 65 | def run(cmd): 66 | #print(cmd); 67 | return (os.system(cmd)); 68 | 69 | def error(): 70 | print("\n\n"); 71 | printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); 72 | printf("There's some errors on your code."); 73 | printf("Correct them and try again, for now I'm exiting the compilation.\n"); 74 | printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"); 75 | sys.exit(); 76 | 77 | cwd = os.getcwd() 78 | print("\n\n"); 79 | printf("Hello!\n"); 80 | printf("How are you ?\n"); 81 | printf("Preparing to compile the plugin: %s\n " % COPYTOPATH); 82 | printf("Please just wait a second...\n"); 83 | if (os.path.isfile("obj/cheats.o")): 84 | run("rm obj/*.o") 85 | if (os.path.isfile(COPYTOPATH)): 86 | run("rm *.plg") 87 | printf("Compiling C files"); 88 | result = run(CC + CFLAGS + INCLUDES + CFILES); 89 | if (result != 0): 90 | error(); 91 | 92 | printf("Compiling S files"); 93 | result = run(CC + ASFLAGS + ASFILES); 94 | if (result != 0): 95 | error(); 96 | 97 | OFILES += allFile("*.o") + " " + allFile("lib/*.o") 98 | printf("Linking all files into " + COPYTOPATH); 99 | result = run(LD + LDFLAGS + ' ' + LIBPATH + OFILES + LIBFLAGS ) 100 | if (result != 0): 101 | error(); 102 | 103 | if (os.path.isfile("config.o")): 104 | run("cp -r *.o obj/ ") 105 | run("rm *.o") 106 | if (os.path.isfile("a.out")): 107 | run(OC +" -O binary a.out payload.bin -S") 108 | if (os.path.isfile("a.out")): 109 | run("rm *.out") 110 | if (os.path.isfile("payload.bin")): 111 | shutil.copy2("payload.bin", COPYTOPATH); 112 | run("rm payload.bin"); 113 | if (os.path.isfile(NAME + ".map")): 114 | run("rm *.map"); 115 | 116 | printf("Done, enjoy your plugin !\n\n"); 117 | 118 | -------------------------------------------------------------------------------- /lib/libShark2NTR_dev.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/lib/libShark2NTR_dev.a -------------------------------------------------------------------------------- /lib/libc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/lib/libc.a -------------------------------------------------------------------------------- /lib/libctr.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/lib/libctr.a -------------------------------------------------------------------------------- /lib/libg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/lib/libg.a -------------------------------------------------------------------------------- /lib/libgcc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/lib/libgcc.a -------------------------------------------------------------------------------- /lib/libntr.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/lib/libntr.a -------------------------------------------------------------------------------- /lib/libsysbase.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/lib/libsysbase.a -------------------------------------------------------------------------------- /ofiles/cheats_logo.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/ofiles/cheats_logo.o -------------------------------------------------------------------------------- /ofiles/credit_logo.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/ofiles/credit_logo.o -------------------------------------------------------------------------------- /ofiles/hotkeys_logo.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/ofiles/hotkeys_logo.o -------------------------------------------------------------------------------- /ofiles/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/ofiles/main.o -------------------------------------------------------------------------------- /ofiles/note.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/ofiles/note.o -------------------------------------------------------------------------------- /ofiles/speed_logo.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/ofiles/speed_logo.o -------------------------------------------------------------------------------- /ofiles/zelda_split.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/ofiles/zelda_split.o -------------------------------------------------------------------------------- /plugin/plugin/0004000000033500/ZeldaOOT3D_USA.plg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/plugin/plugin/0004000000033500/ZeldaOOT3D_USA.plg -------------------------------------------------------------------------------- /plugin/plugin/0004000000033600/ZeldaOOT3D_EUR.plg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydoginator/blankCheatMenu/9e6e770721bcc5e83b577193d62aff0cc9990572/plugin/plugin/0004000000033600/ZeldaOOT3D_EUR.plg --------------------------------------------------------------------------------