-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8bac078
Showing
52 changed files
with
10,768 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ntrboot_flasher/build | ||
ntrboot_flasher/*.bin | ||
libelm/build | ||
libelm/lib | ||
*.firm | ||
*.firm.sha | ||
*.o | ||
*.elf | ||
*.d | ||
|
||
*.gch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "ntrboot_flasher/source/flashcart_core"] | ||
path = ntrboot_flasher/source/flashcart_core | ||
url = https://github.com/kitling/flashcart_core.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2)) | ||
|
||
ifeq ($(strip $(DEVKITARM)),) | ||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") | ||
endif | ||
|
||
include $(DEVKITARM)/base_tools | ||
|
||
name := ntrboot_flasher | ||
|
||
dir_libelm := libelm | ||
dir_ntrboot_flasher := ntrboot_flasher | ||
|
||
.PHONY: $(dir_libelm) | ||
.PHONY: $(dir_ntrboot_flasher) | ||
|
||
.PHONY: all | ||
.PHONY: firm | ||
|
||
all: ntrboot_flasher.firm | ||
ntrboot_flasher.firm: $(dir_ntrboot_flasher)/ntrboot_flasher.firm | ||
@cp $< $(@D) | ||
|
||
$(dir_libelm)/libelm.a: $(dir_libelm) | ||
@$(MAKE) -C $< | ||
|
||
$(dir_ntrboot_flasher)/ntrboot_flasher.firm: $(dir_ntrboot_flasher) $(dir_libelm)/libelm.a | ||
@$(MAKE) -C $< | ||
|
||
.PHONY: clean | ||
clean: | ||
@$(MAKE) -C $(dir_libelm) clean | ||
@$(MAKE) -C $(dir_ntrboot_flasher) clean | ||
rm -rf ntrboot_flasher.firm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# ntrboot_flasher | ||
_A tool to flash that bootrom-hax goodness to your flashcart._ | ||
|
||
## Supported Cards | ||
- Acekard 2i HW-44 | ||
- Acekard 2i HW-81 | ||
- R4i Gold 3DS RTS | ||
|
||
Note that in some rare circumstances, it may be possible for the flashing | ||
process to **brick** a counterfeit flashcart and render it permanently | ||
unusable. This is unlikely, but nevertheless only original flashcarts on the | ||
list are supported. There is not a good way to test for this, unfortunately, | ||
and its more likely to receive counterfeit R4s than AK2i's, though most have a | ||
high chance of working. There's just too much variance in these devices to | ||
gurantee any chance of certainty. As such, use at your own risk. | ||
|
||
## Installation/Usage | ||
Instructions are documented at 3ds.guide and are heavily recommended. | ||
|
||
## Planned support/Community involvement | ||
Initially we planned to have more cards supported on release, but have not been | ||
able to implement due to lack of time/energy. If you have a cart you would like | ||
supported and have the knowhow for debugging/reverse engineering a flashcart, | ||
please come find one of the devs in #Cakey on freenode or submit a feature | ||
request. Ideally, this toolset is extensible towards any updatable nintendo ds/ | ||
dsi flashcart. See [flashcart_core](https://github.com/kitling/flashcart_core) | ||
for more flashcart details. | ||
|
||
## Credits | ||
@Normmatt for initial implementation, bug squashing, expertiese... etc. | ||
@SciresM for sighax/boot9strap and flashcart RE. | ||
@hedgeberg for testing and flashcart RE. | ||
stuckpixel for testing. | ||
Myria for testing. | ||
|
||
Huge props to @d3m3vilurr for figuring this out on their own! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#--------------------------------------------------------------------------------- | ||
.SUFFIXES: | ||
#--------------------------------------------------------------------------------- | ||
|
||
ifeq ($(strip $(DEVKITARM)),) | ||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") | ||
endif | ||
|
||
include $(DEVKITARM)/ds_rules | ||
|
||
#--------------------------------------------------------------------------------- | ||
# TARGET is the name of the output | ||
# BUILD is the directory where object files & intermediate files will be placed | ||
# SOURCES is a list of directories containing source code | ||
# DATA is a list of directories containing data files | ||
# INCLUDES is a list of directories containing header files | ||
#--------------------------------------------------------------------------------- | ||
TARGET := $(shell basename $(CURDIR)) | ||
BUILD := build | ||
SOURCES := source source/sdmmc | ||
DATA := data | ||
INCLUDES := include | ||
|
||
#--------------------------------------------------------------------------------- | ||
# options for code generation | ||
#--------------------------------------------------------------------------------- | ||
ARCH := -mthumb -mthumb-interwork | ||
|
||
CFLAGS := -g -Wall -Os -std=c11\ | ||
-march=armv5te -mtune=arm946e-s \ | ||
-fomit-frame-pointer -ffast-math \ | ||
$(ARCH) | ||
|
||
CFLAGS += $(INCLUDE) -DARM9 -fno-dwarf2-cfi-asm | ||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions | ||
|
||
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s | ||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) | ||
|
||
LIBS := -lnds9 | ||
|
||
LIBDIRS := $(LIBNDS) | ||
|
||
#--------------------------------------------------------------------------------- | ||
# no real need to edit anything past this point unless you need to add additional | ||
# rules for different file extensions | ||
#--------------------------------------------------------------------------------- | ||
ifneq ($(BUILD),$(notdir $(CURDIR))) | ||
#--------------------------------------------------------------------------------- | ||
|
||
export OUTPUT := $(CURDIR)/lib/$(TARGET).a | ||
|
||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ | ||
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) | ||
|
||
export DEPSDIR := $(CURDIR)/$(BUILD) | ||
|
||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) | ||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) | ||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) | ||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) | ||
|
||
#--------------------------------------------------------------------------------- | ||
# use CXX for linking C++ projects, CC for standard C | ||
#--------------------------------------------------------------------------------- | ||
ifeq ($(strip $(CPPFILES)),) | ||
#--------------------------------------------------------------------------------- | ||
export LD := $(CC) | ||
#--------------------------------------------------------------------------------- | ||
else | ||
#--------------------------------------------------------------------------------- | ||
export LD := $(CXX) | ||
#--------------------------------------------------------------------------------- | ||
endif | ||
#--------------------------------------------------------------------------------- | ||
|
||
export OFILES := $(addsuffix .o,$(BINFILES)) \ | ||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) | ||
|
||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ | ||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ | ||
-I$(CURDIR)/$(BUILD) | ||
|
||
.PHONY: $(BUILD) clean all | ||
|
||
#--------------------------------------------------------------------------------- | ||
all: $(BUILD) | ||
|
||
lib: | ||
@[ -d $@ ] || mkdir -p $@ | ||
|
||
$(BUILD): lib | ||
@[ -d $@ ] || mkdir -p $@ | ||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile | ||
|
||
#--------------------------------------------------------------------------------- | ||
clean: | ||
@echo clean ... | ||
@rm -fr $(BUILD) lib | ||
|
||
#--------------------------------------------------------------------------------- | ||
else | ||
|
||
DEPENDS := $(OFILES:.o=.d) | ||
|
||
#--------------------------------------------------------------------------------- | ||
# main targets | ||
#--------------------------------------------------------------------------------- | ||
$(OUTPUT) : $(OFILES) | ||
|
||
#--------------------------------------------------------------------------------- | ||
%.bin.o : %.bin | ||
#--------------------------------------------------------------------------------- | ||
@echo $(notdir $<) | ||
@$(bin2o) | ||
|
||
|
||
-include $(DEPENDS) | ||
|
||
#--------------------------------------------------------------------------------------- | ||
endif | ||
#--------------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
disk_type.h | ||
Copyright (C) 2010 yellow wood goblin | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __DISK_TYPE_H__ | ||
#define __DISK_TYPE_H__ | ||
|
||
//#define USE_DLDI | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/*----------------------------------------------------------------------- | ||
/ Low level disk interface modlue include file (C)ChaN, 2010 | ||
/-----------------------------------------------------------------------*/ | ||
|
||
#ifndef _DISKIO | ||
|
||
#define _READONLY 0 /* 1: Remove write functions */ | ||
#define _USE_IOCTL 1 /* 1: Use disk_ioctl fucntion */ | ||
|
||
#include "integer.h" | ||
|
||
|
||
/* Status of Disk Functions */ | ||
typedef BYTE DSTATUS; | ||
|
||
/* Results of Disk Functions */ | ||
typedef enum { | ||
RES_OK = 0, /* 0: Successful */ | ||
RES_ERROR, /* 1: R/W Error */ | ||
RES_WRPRT, /* 2: Write Protected */ | ||
RES_NOTRDY, /* 3: Not Ready */ | ||
RES_PARERR /* 4: Invalid Parameter */ | ||
} DRESULT; | ||
|
||
|
||
/*---------------------------------------*/ | ||
/* Prototypes for disk control functions */ | ||
|
||
int assign_drives (int, int); | ||
DSTATUS disk_initialize (BYTE); | ||
DSTATUS disk_status (BYTE); | ||
DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); | ||
#if _READONLY == 0 | ||
DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); | ||
#endif | ||
DRESULT disk_ioctl (BYTE, BYTE, void*); | ||
|
||
|
||
|
||
/* Disk Status Bits (DSTATUS) */ | ||
|
||
#define STA_NOINIT 0x01 /* Drive not initialized */ | ||
#define STA_NODISK 0x02 /* No medium in the drive */ | ||
#define STA_PROTECT 0x04 /* Write protected */ | ||
|
||
|
||
/* Command code for disk_ioctrl fucntion */ | ||
|
||
/* Generic command (defined for FatFs) */ | ||
#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */ | ||
#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */ | ||
#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */ | ||
#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */ | ||
#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */ | ||
|
||
/* Generic command */ | ||
#define CTRL_POWER 5 /* Get/Set power status */ | ||
#define CTRL_LOCK 6 /* Lock/Unlock media removal */ | ||
#define CTRL_EJECT 7 /* Eject media */ | ||
|
||
/* MMC/SDC specific ioctl command */ | ||
#define MMC_GET_TYPE 10 /* Get card type */ | ||
#define MMC_GET_CSD 11 /* Get CSD */ | ||
#define MMC_GET_CID 12 /* Get CID */ | ||
#define MMC_GET_OCR 13 /* Get OCR */ | ||
#define MMC_GET_SDSTAT 14 /* Get SD status */ | ||
|
||
/* ATA/CF specific ioctl command */ | ||
#define ATA_GET_REV 20 /* Get F/W revision */ | ||
#define ATA_GET_MODEL 21 /* Get model name */ | ||
#define ATA_GET_SN 22 /* Get serial number */ | ||
|
||
/* NAND specific ioctl command */ | ||
#define NAND_FORMAT 30 /* Create physical format */ | ||
|
||
|
||
#define _DISKIO | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
elm.h | ||
Copyright (C) 2009 yellow wood goblin | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __ELM_H__ | ||
#define __ELM_H__ | ||
|
||
#include <stdint.h> | ||
#include <sys/iosupport.h> | ||
#include <sys/types.h> | ||
#include <sys/syslimits.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
int ELM_Mount(void); | ||
void ELM_Unmount(void); | ||
int ELM_ClusterSizeFromHandle(int fildes,uint32_t* size); | ||
int ELM_SectorsPerClusterFromHandle(int fildes,uint32_t* per); | ||
int ELM_ClusterSizeFromDisk(int disk,uint32_t* size); | ||
int ELM_ClustersFromDisk(int disk,uint32_t* clusters); | ||
int ELM_FreeClustersFromDisk(int disk,uint32_t* clusters); | ||
int ELM_SectorsFromDisk(int disk,uint32_t* sectors); | ||
uint32_t ELM_GetFAT(int fildes,uint32_t cluster,uint32_t* sector); | ||
int ELM_DirEntry(int fildes,uint64_t* entry); | ||
int ELM_FormatFAT(uint32_t priv_sectors); | ||
uint32_t ELM_GetSectorCount(unsigned char aDrive); | ||
|
||
|
||
void NandFast(void); | ||
void NandFlush(void); | ||
|
||
int dirnext (DIR_ITER *dirState, char *filename, struct stat *filestat); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#define MAX_FILENAME_LENGTH 768 // 256 UCS-2 characters encoded into UTF-8 can use up to 768 UTF-8 chars | ||
|
||
#endif |
Oops, something went wrong.