This repository has been archived by the owner on Jan 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
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
44
committed
Nov 9, 2017
1 parent
ea1aad4
commit c764c0f
Showing
146 changed files
with
42,613 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
*.bin | ||
|
||
# Prerequisites | ||
*.d | ||
|
||
|
||
|
||
# Object files | ||
*.o | ||
*.ko | ||
|
@@ -18,7 +22,6 @@ | |
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
|
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,37 @@ | ||
|
||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") | ||
OUTPUT_ARCH(arm) | ||
ENTRY(_Reset) | ||
SECTIONS | ||
{ | ||
. = 0x00100100; | ||
. = ALIGN(4); | ||
.text : { | ||
__text_start = .; | ||
bootloader.o (.text*) | ||
*(.text*) | ||
} | ||
. = ALIGN(4); | ||
.data : { | ||
*(.data) | ||
} | ||
. = ALIGN(4); | ||
|
||
. = ALIGN(4); | ||
.rel.dyn : { | ||
*(.__rel_dyn_start) | ||
*(.rel*) | ||
*(.rel.*) | ||
*(.__rel_dyn_end) | ||
} | ||
|
||
__code_end = .; | ||
|
||
. = ALIGN(4); | ||
.bss : { | ||
*(.__bss_start) | ||
*(.bss COMMON) | ||
*(.__bss_end) | ||
} | ||
__end__ = .; | ||
} |
Empty file.
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,42 @@ | ||
#!/usr/bin/python | ||
import sys | ||
import os | ||
import ftplib | ||
import glob | ||
|
||
|
||
BASE_ADDRESS = 0x080C3EE0 | ||
CC = "arm-none-eabi-gcc" | ||
CP = "arm-none-eabi-g++" | ||
OC = "arm-none-eabi-objcopy" | ||
LD = "arm-none-eabi-ld" | ||
CTRULIB = '../libctru' | ||
DEVKITARM = 'c:/devkitPro/devkitARM' | ||
LIBPATH = '-L .' | ||
|
||
with open('include/gen.h', 'w') as f: | ||
f.write('#define HAS_JPEG (1)'); | ||
|
||
def allFile(pattern): | ||
s = ""; | ||
for file in glob.glob(pattern): | ||
s += file + " "; | ||
return s; | ||
|
||
def run(cmd): | ||
os.system(cmd) | ||
|
||
cwd = os.getcwd() | ||
run("rm obj/*.o") | ||
run("rm bin/*.elf") | ||
run(CC+ " -O3 -s -g -I include -I include/jpeg -I/c/devkitPro/portlibs/armv6k/include " + allFile('source/dsp/*.c') + allFile('source/jpeg/*.c') + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/libctru/*.c') + " -c -march=armv6 -mlittle-endian -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard "); | ||
run(CC+" -O3 " + allFile('source/ns/*.s') + allFile('source/*.s') + allFile('source/libctru/*.s') + " -c -s -march=armv6 -mlittle-endian -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard "); | ||
|
||
run(LD + ' ' + LIBPATH + " -g -A armv6k -pie --print-gc-sections -T 3ds.ld -Map=test.map " + allFile("*.o") + " -lc -lm -lgcc --nostdlib" ) | ||
run("cp -r *.o obj/ ") | ||
run("cp a.out bin/homebrew.elf ") | ||
run(OC+" -O binary a.out payload.bin -S") | ||
run("rm *.o") | ||
run("rm *.out") | ||
# run('copy payload.bin \\\\3DS-8141\\microSD\\ntr.bin'); | ||
run('copy payload.bin release\\ntr.n3ds.bin'); |
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,2 @@ | ||
set PATH=%PATH%;C:\devkitPro\devkitARM\bin | ||
build-jpeg.py |
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,43 @@ | ||
#!/usr/bin/python | ||
import sys | ||
import os | ||
import ftplib | ||
import glob | ||
|
||
|
||
BASE_ADDRESS = 0x080C3EE0 | ||
CC = "arm-none-eabi-gcc" | ||
CP = "arm-none-eabi-g++" | ||
OC = "arm-none-eabi-objcopy" | ||
LD = "arm-none-eabi-ld" | ||
CTRULIB = '../libctru' | ||
DEVKITARM = 'c:/devkitPro/devkitARM' | ||
LIBPATH = '-L .' | ||
|
||
def allFile(pattern): | ||
s = ""; | ||
for file in glob.glob(pattern): | ||
s += file + " "; | ||
return s; | ||
|
||
def run(cmd): | ||
os.system(cmd) | ||
|
||
with open('include/gen.h', 'w') as f: | ||
f.write(''); | ||
|
||
cwd = os.getcwd() | ||
run("rm obj/*.o") | ||
run("rm bin/*.elf") | ||
run(CC+ " -O3 -s -g -I include -I include/jpeg -I/c/devkitPro/portlibs/armv6k/include " + allFile('source/dsp/*.c') + " -c -march=armv6 -mlittle-endian -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard "); | ||
run(CC+ " -Os -s -g -I include -I include/jpeg -I/c/devkitPro/portlibs/armv6k/include " + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/libctru/*.c') + " -c -march=armv6 -mlittle-endian -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard "); | ||
run(CC+" -Os " + allFile('source/ns/*.s') + allFile('source/*.s') + allFile('source/libctru/*.s') + " -c -s -march=armv6 -mlittle-endian -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard "); | ||
|
||
run(LD + ' ' + LIBPATH + " -g -A armv6k -pie --print-gc-sections -T 3ds.ld -Map=test.map " + allFile("*.o") + " -lc -lm -lgcc --nostdlib" ) | ||
run("cp -r *.o obj/ ") | ||
run("cp a.out bin/homebrew.elf ") | ||
run(OC+" -O binary a.out payload.bin -S") | ||
run("rm *.o") | ||
run("rm *.out") | ||
# run('copy payload.bin \\\\3DS-8141\\microSD\\ntr.bin'); | ||
run('copy payload.bin release\\ntr.o3ds.bin'); |
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,38 @@ | ||
#ifndef D2_H | ||
#define D2_H | ||
|
||
/* | ||
#define FCRAM_BASE 0x20000000 | ||
#define TOP_ASPECT_X 0x5 | ||
#define TOP_ASPECT_Y 0x3 | ||
#define TOP_HEIGHT 240 | ||
#define TOP_WIDTH 400 | ||
*/ | ||
|
||
#define BOTTOM_HEIGHT 240 | ||
#define BOTTOM_WIDTH 320 | ||
|
||
#define BOTTOM_FRAME1 bottomFrameBuffer | ||
#define BOTTOM_FRAME2 bottomFrameBuffer | ||
#define BOTTOM_FRAME_SIZE (320 * 240 * 3) | ||
|
||
|
||
|
||
#include "3dstypes.h" | ||
#include "math.h" | ||
|
||
void paint_pixel(u32 x, u32 y, char r, char g, char b, int screen); | ||
void paint_word(char* word, int x,int y, char r, char g, char b, int screen); | ||
void paint_word_vert(char* word, int x,int y, char r, char g, char b, int screen); | ||
void paint_buffer(u8* file, point f_dim, point offset, int screen); | ||
void paint_byte_pixel(unsigned char byte, int x, int y, int screen); | ||
void paint_sprite(unsigned char* sheet, point f_dim, point offset, int screen, int height, int width, int xstart, int ystart); | ||
void paint_square(int x, int y, char r, char g, char b, int h, int w, int screen); | ||
|
||
|
||
//DLH | ||
void blank(int x, int y, int xs, int ys); | ||
void square(int x, int y, int xs, int ys); | ||
|
||
extern u32 bottomFrameBuffer; | ||
#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,191 @@ | ||
/*--------------------------------------------------------------------------------- | ||
ndstypes.h -- Common types (and a few useful macros) | ||
Copyright (C) 2005 - 2008 | ||
Michael Noland (joat) | ||
Jason Rogers (dovoto) | ||
Dave Murphy (WinterMute) | ||
Chris Double (doublec) | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any | ||
damages arising from the use of this software. | ||
Permission is granted to anyone to use this software for any | ||
purpose, including commercial applications, and to alter it and | ||
redistribute it freely, subject to the following restrictions: | ||
1. The origin of this software must not be misrepresented; you | ||
must not claim that you wrote the original software. If you use | ||
this software in a product, an acknowledgment in the product | ||
documentation would be appreciated but is not required. | ||
2. Altered source versions must be plainly marked as such, and | ||
must not be misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source | ||
distribution. | ||
---------------------------------------------------------------------------------*/ | ||
/*! \file ndstypes.h | ||
\brief Custom types employed by libnds | ||
*/ | ||
|
||
/// Note by Kane49: I kept in stuff i dont use to not mess with stuff i dont understand, this provides some convenient stuff though ! | ||
|
||
#ifndef _3DSTYPES_INCLUDE | ||
#define _3DSTYPES_INCLUDE | ||
//--------------------------------------------------------------------------------- | ||
// define libnds types in terms of stdint | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
|
||
|
||
//--------------------------------------------------------------------------------- | ||
// libgba compatible section macros | ||
//--------------------------------------------------------------------------------- | ||
#define ITCM_CODE __attribute__((section(".itcm"), long_call)) | ||
|
||
#define DTCM_DATA __attribute__((section(".dtcm"))) | ||
#define DTCM_BSS __attribute__((section(".sbss"))) | ||
|
||
//! aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m. | ||
#define ALIGN(m) __attribute__((aligned (m))) | ||
|
||
//! packs a struct (and other types?) so it won't include padding bytes. | ||
#define PACKED __attribute__ ((packed)) | ||
#define packed_struct struct PACKED | ||
|
||
//--------------------------------------------------------------------------------- | ||
// These are linked to the bin2o macro in the Makefile | ||
//--------------------------------------------------------------------------------- | ||
#define GETRAW(name) (name) | ||
#define GETRAWSIZE(name) ((int)name##_size) | ||
#define GETRAWEND(name) ((int)name##_end) | ||
|
||
|
||
/*! | ||
\brief returns a number with the nth bit set. | ||
*/ | ||
#define BIT(n) (1 << (n)) | ||
|
||
//! 8 bit unsigned integer. | ||
typedef uint8_t uint8; | ||
//! 16 bit unsigned integer. | ||
typedef uint16_t uint16; | ||
//! 32 bit unsigned integer. | ||
typedef uint32_t uint32; | ||
//! 64 bit unsigned integer. | ||
typedef uint64_t uint64; | ||
|
||
//! 8 bit signed integer. | ||
typedef int8_t int8; | ||
//! 16 bit signed integer. | ||
typedef int16_t int16; | ||
//! 32 bit signed integer. | ||
typedef int32_t int32; | ||
//! 64 bit signed integer. | ||
typedef int64_t int64; | ||
|
||
//! 32 bit signed floating point number. | ||
typedef float float32; | ||
//! 64 bit signed floating point number. | ||
typedef double float64; | ||
|
||
//! 8 bit volatile unsigned integer. | ||
typedef volatile uint8_t vuint8; | ||
//! 16 bit volatile unsigned integer. | ||
typedef volatile uint16_t vuint16; | ||
//! 32 bit volatile unsigned integer. | ||
typedef volatile uint32_t vuint32; | ||
//! 64 bit volatile unsigned integer. | ||
typedef volatile uint64_t vuint64; | ||
|
||
//! 8 bit volatile signed integer. | ||
typedef volatile int8_t vint8; | ||
//! 16 bit volatile signed integer. | ||
typedef volatile int16_t vint16; | ||
//! 32 bit volatile signed integer. | ||
typedef volatile int32_t vint32; | ||
//! 64 bit volatile signed integer. | ||
typedef volatile int64_t vint64; | ||
|
||
//! 32 bit volatile signed floating point number. | ||
typedef volatile float32 vfloat32; | ||
//! 64 bit volatile signed floating point number. | ||
typedef volatile float64 vfloat64; | ||
|
||
//! 8 bit unsigned integer. | ||
typedef uint8_t byte; | ||
|
||
//! 8 bit unsigned integer. | ||
typedef uint8_t u8; | ||
//! 16 bit unsigned integer. | ||
typedef uint16_t u16; | ||
//! 32 bit unsigned integer. | ||
typedef uint32_t u32; | ||
//! 64 bit unsigned integer. | ||
typedef uint64_t u64; | ||
|
||
//! 8 bit signed integer. | ||
typedef int8_t s8; | ||
//! 16 bit signed integer. | ||
typedef int16_t s16; | ||
//! 32 bit signed integer. | ||
typedef int32_t s32; | ||
//! 64 bit signed integer. | ||
typedef int64_t s64; | ||
|
||
//! 8 bit volatile unsigned integer. | ||
typedef volatile u8 vu8; | ||
//! 16 bit volatile unsigned integer. | ||
typedef volatile u16 vu16; | ||
//! 32 bit volatile unsigned integer. | ||
typedef volatile u32 vu32; | ||
//! 64 bit volatile unsigned integer. | ||
typedef volatile u64 vu64; | ||
|
||
//! 8 bit volatile signed integer. | ||
typedef volatile s8 vs8; | ||
//! 16 bit volatile signed integer. | ||
typedef volatile s16 vs16; | ||
//! 32 bit volatile signed integer. | ||
typedef volatile s32 vs32; | ||
//! 64 bit volatile signed integer. | ||
typedef volatile s64 vs64; | ||
|
||
struct RECT { | ||
int x, y, w, h; | ||
}; | ||
|
||
typedef struct RECT rect; | ||
|
||
struct POINT { | ||
int x, y; | ||
}; | ||
|
||
typedef struct POINT point; | ||
|
||
struct COLOR { | ||
u8 r, g, b; | ||
}; | ||
|
||
typedef struct COLOR color; | ||
|
||
|
||
#ifndef TRUE | ||
#define TRUE 1 | ||
#define FALSE 0 | ||
#endif | ||
|
||
|
||
// Handy function pointer typedefs | ||
//! a function pointer that takes no arguments and doesn't return anything. | ||
typedef void (* VoidFn)(void); | ||
|
||
typedef void (* IntFn)(void); | ||
typedef void (* fp)(void); | ||
|
||
//--------------------------------------------------------------------------------- | ||
#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,12 @@ | ||
#ifndef BMP_FILE_H | ||
#define BMP_FILE_H | ||
struct img_file { | ||
|
||
int width; | ||
int height; | ||
unsigned char data[]; | ||
|
||
}; | ||
|
||
typedef struct img_file bmp_file; | ||
#endif |
Oops, something went wrong.