Skip to content

Instantly share code, notes, and snippets.

@Azure-Agst
Last active August 19, 2017 16:24
Show Gist options
  • Save Azure-Agst/df669260064125fbf76d6c6c21eb45a9 to your computer and use it in GitHub Desktop.
Save Azure-Agst/df669260064125fbf76d6c6c21eb45a9 to your computer and use it in GitHub Desktop.
3ds homebrew dev. (problem solved. make sure b9s is updated, kiddies!)
C:\Users\Admin\projects\test3ds>C:\Users\Admin\projects\test3ds\exception_dump_p
arser.py C:\Users\Admin\projects\test3ds\crash_dump_00000017.dmp
Processor: ARM11 (core 0)
Exception type: data abort
Current process: 3dsx_app (000400000d921e00)
Register dump:
r0 00000000 r1 00000000
r2 00000fe4 r3 00000000
r4 00000fd4 r5 00000000
r6 08007dac r7 00000000
r8 00000000 r9 0800f910
r10 001643ec r11 0010224c
r12 00000010 sp 08007cf0
lr 00000000 pc 0011d77c
cpsr 20080010 dfsr 00000805
ifsr 00000008 far 00000000
fpexc 40000700 fpinst eeb09b48
fpinst2 eeb09b48
Code dump:
11d750: 9a000029 bls 0x11d7fc
11d754: e92d4010 push {r4, lr}
11d758: e6efe071 uxtb lr, r1
11d75c: e18ee40e orr lr, lr, lr, lsl #8
11d760: e352000f cmp r2, #15
11d764: e18ee80e orr lr, lr, lr, lsl #16
11d768: 9a000010 bls 0x11d7b0
11d76c: e1a04002 mov r4, r2
11d770: e283c010 add r12, r3, #16
11d774: e2444010 sub r4, r4, #16
11d778: e354000f cmp r4, #15
11d77c: e50ce010 str lr, [r12, #-16]
Stack dump:
08007cf0: 71 1f 01 08 e4 56 10 00 70 1f 01 08 48 7d 00 08 |q....V..p...H}..|
08007d00: e8 7d 00 08 00 00 00 00 48 31 17 00 69 1f 01 08 |.}......H1..i...|
08007d10: 74 00 00 00 10 f9 00 08 4c 7d 00 08 00 00 00 00 |t.......L}......|
08007d20: 48 31 17 00 ff 03 00 00 50 4d 18 00 88 58 10 00 |H1......PM...X..|
08007d30: 24 58 10 00 00 00 00 00 68 1f 01 08 ac 7d 00 08 |$X......h....}..|
08007d40: 00 00 00 00 88 4c 10 00 10 f9 00 08 00 00 00 00 |.....L..........|
08007d50: 00 00 00 00 00 00 00 00 58 1b 01 08 ac 7d 00 08 |........X....}..|
08007d60: 29 00 00 00 00 00 00 00 d8 40 18 00 48 31 17 00 |)........@..H1..|
08007d70: ff 03 00 00 3c 66 10 00 00 00 00 00 00 00 01 00 |....<f..........|
08007d80: 00 da 17 00 ac 7d 00 08 58 1b 01 08 00 da 17 00 |.....}..X.......|
08007d90: 78 4f 18 00 74 66 10 00 d0 d9 17 00 00 da 17 00 |xO..tf..........|
08007da0: 88 cb 18 00 1c 1a 10 00 f8 2e 18 00 3c 17 16 00 |............<...|
08007db0: ac 7d 00 08 00 00 00 00 00 00 00 00 00 00 00 00 |.}..............|
08007dc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
08007dd0: 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 |................|
08007de0: 00 00 00 00 68 1f 01 08 fc 43 16 00 f0 7d 00 08 |....h....C...}..|
08007df0: 10 f9 00 08 00 00 00 00 00 01 00 00 00 00 00 00 |................|
08007e00: 00 00 00 00 00 00 00 00 fc 43 16 00 10 7e 00 08 |.........C...~..|
08007e10: 00 00 00 00 00 00 00 00 0a 00 00 00 01 00 00 00 |................|
08007e20: 44 f9 00 08 01 00 00 00 01 00 00 00 01 00 00 00 |D...............|
08007e30: 01 00 00 00 20 44 16 00 3c 7e 00 08 00 00 00 00 |.... D..<~......|
08007e40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
08007e50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
08007e60: 00 00 00 00 0a 00 00 00 00 00 00 00 00 00 00 00 |................|
08007e70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
08007e80: 44 44 16 00 88 7e 00 08 00 da 17 00 c0 5a 17 00 |DD...~.......Z..|
08007e90: 78 4f 18 00 d8 40 18 00 48 31 17 00 ff 03 00 00 |xO...@..H1......|
08007ea0: 50 4d 18 00 58 e6 11 00 cd be 17 00 3c 7f 00 08 |PM..X.......<...|
08007eb0: 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
08007ec0: 00 00 00 00 00 00 00 00 00 00 00 00 68 44 16 00 |............hD..|
08007ed0: d4 7e 00 08 01 00 00 00 c0 36 00 00 18 80 6e 00 |.~.......6....n.|
08007ee0: 03 00 00 00 24 00 00 00 c8 bb 17 00 33 44 53 58 |....$.......3DSX|
08007ef0: 00 00 00 00 78 4f 18 00 13 19 00 00 0a 00 00 00 |....xO..........|
08007f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
08007f10: 00 00 00 00 00 00 00 00 00 00 00 00 7d 4f 18 00 |............}O..|
08007f20: 78 4f 18 00 88 cb 18 00 78 4f 18 00 d8 40 18 00 |xO......xO...@..|
08007f30: 48 31 17 00 ff 03 00 00 50 4d 18 00 24 c1 10 00 |H1......PM..$...|
08007f40: 7d 4f 18 00 9c 87 13 00 00 00 00 00 48 4d 18 00 |}O..........HM..|
08007f50: 00 00 00 00 48 4d 18 00 88 cb 18 00 4c c6 10 00 |....HM......L...|
08007f60: 03 00 00 00 06 00 00 00 48 31 17 00 d8 cb 18 00 |........H1......|
08007f70: ff 00 00 00 15 00 50 00 01 00 00 00 03 00 00 00 |......P.........|
08007f80: 06 00 00 00 48 31 17 00 06 76 17 00 00 00 00 00 |....H1...v......|
08007f90: 0c 00 10 00 00 00 00 00 b4 5a 14 08 ec 75 17 00 |.........Z...u..|
08007fa0: 00 81 17 00 01 00 00 00 06 76 17 00 cc 8d 10 00 |.........v......|
08007fb0: 14 4b 16 00 00 00 00 00 00 00 00 00 00 00 00 00 |.K..............|
08007fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
08007fd0: 00 00 00 00 00 00 00 00 02 00 00 00 ec 94 10 00 |................|
08007fe0: 9c 63 17 00 a0 63 17 00 b4 5a 14 08 00 00 00 00 |.c...c...Z......|
08007ff0: 00 81 17 00 ec 94 10 00 0c 00 10 00 00 00 00 00 |................|
#include <string.h>
#include <stdio.h>
#include <3ds.h>
// void displaymessage_waitbutton()
// {
// printf("\nPress the A button to continue.\n");
// while(1)
// {
// gspWaitForVBlank();
// hidScanInput();
// if(hidKeysDown() & KEY_A)break;
// }
// }
int main(int argc, char **argv)
{
//init
gfxInitDefault();
consoleInit(GFX_TOP, NULL);
printf("wow");
// Main loop
// while (aptMainLoop())
// {
// //Scan all the inputs. This should be done once for each frame
// hidScanInput();
// //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame)
// u32 kDown = hidKeysDown();
// if (kDown & KEY_START) break; // break in order to return to hbmenu
// // Flush and swap framebuffers
// gfxFlushBuffers();
// gfxSwapBuffers();
// //Wait for VBlank
// gspWaitForVBlank();
// }
while (aptMainLoop())
{
gspWaitForVBlank();
hidScanInput();
u32 kDown = hidKeysDown();
if (kDown & KEY_START)
break; // break in order to return to hbmenu
}
//me no like
gfxExit();
return 0;
}
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITARM)/3ds_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
#
# NO_SMDH: if set to anything, no SMDH file is generated.
# ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional)
# APP_TITLE is the name of the app stored in the SMDH file (Optional)
# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
# APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
# ICON is the filename of the icon (.png), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.png
# - icon.png
# - <libctru folder>/default_icon.png
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := /c/devkitPro/libctru/include /c/devkitPro/devkitARM/arm-none-eabi/include
#ROMFS := romfs
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS := -g -Wall -O2 -mword-relocations \
-fomit-frame-pointer -ffunction-sections \
$(ARCH)
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lctru -lm
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CTRULIB)
#---------------------------------------------------------------------------------
# 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)/$(TARGET)
export TOPDIR := $(CURDIR)
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)))
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica)))
SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist)))
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)) \
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \
$(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)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.png)
ifneq (,$(findstring $(TARGET).png,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).png
else
ifneq (,$(findstring icon.png,$(icons)))
export APP_ICON := $(TOPDIR)/icon.png
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif
ifeq ($(strip $(NO_SMDH)),)
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
endif
ifneq ($(ROMFS),)
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
endif
.PHONY: $(BUILD) clean all
#---------------------------------------------------------------------------------
all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
ifeq ($(strip $(NO_SMDH)),)
$(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
else
$(OUTPUT).3dsx : $(OUTPUT).elf
endif
$(OUTPUT).elf : $(OFILES)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# rules for assembling GPU shaders
#---------------------------------------------------------------------------------
define shader-as
$(eval CURBIN := $(patsubst %.shbin.o,%.shbin,$(notdir $@)))
picasso -o $(CURBIN) $1
bin2s $(CURBIN) | $(AS) -o $@
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h
echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h
endef
%.shbin.o : %.v.pica %.g.pica
@echo $(notdir $^)
@$(call shader-as,$^)
%.shbin.o : %.v.pica
@echo $(notdir $<)
@$(call shader-as,$<)
%.shbin.o : %.shlist
@echo $(notdir $<)
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file)))
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment