├── Makefile ├── README.md └── source └── main.c /Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | 5 | ifeq ($(strip $(DEVKITARM)),) 6 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 7 | endif 8 | 9 | TOPDIR ?= $(CURDIR) 10 | include $(DEVKITARM)/3ds_rules 11 | 12 | #--------------------------------------------------------------------------------- 13 | # TARGET is the name of the output 14 | # BUILD is the directory where object files & intermediate files will be placed 15 | # SOURCES is a list of directories containing source code 16 | # DATA is a list of directories containing data files 17 | # INCLUDES is a list of directories containing header files 18 | # 19 | # NO_SMDH: if set to anything, no SMDH file is generated. 20 | # ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional) 21 | # APP_TITLE is the name of the app stored in the SMDH file (Optional) 22 | # APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional) 23 | # APP_AUTHOR is the author of the app stored in the SMDH file (Optional) 24 | # ICON is the filename of the icon (.png), relative to the project folder. 25 | # If not set, it attempts to use one of the following (in this order): 26 | # - .png 27 | # - icon.png 28 | # - /default_icon.png 29 | #--------------------------------------------------------------------------------- 30 | TARGET := $(notdir $(CURDIR)) 31 | BUILD := build 32 | SOURCES := source 33 | DATA := data 34 | INCLUDES := include 35 | 36 | APP_TITLE := ScreenInfo 37 | APP_DESCRIPTION := Gets your N3DS's screen vendors! 38 | APP_AUTHOR := SciresM 39 | 40 | #--------------------------------------------------------------------------------- 41 | # options for code generation 42 | #--------------------------------------------------------------------------------- 43 | ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft 44 | 45 | CFLAGS := -g -Wall -O2 -mword-relocations \ 46 | -fomit-frame-pointer -ffunction-sections \ 47 | $(ARCH) 48 | 49 | CFLAGS += $(INCLUDE) -DARM11 -D_3DS 50 | 51 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 52 | 53 | ASFLAGS := -g $(ARCH) 54 | LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) 55 | 56 | LIBS := -lctru -lm 57 | 58 | #--------------------------------------------------------------------------------- 59 | # list of directories containing libraries, this must be the top level containing 60 | # include and lib 61 | #--------------------------------------------------------------------------------- 62 | LIBDIRS := $(CTRULIB) 63 | 64 | 65 | #--------------------------------------------------------------------------------- 66 | # no real need to edit anything past this point unless you need to add additional 67 | # rules for different file extensions 68 | #--------------------------------------------------------------------------------- 69 | ifneq ($(BUILD),$(notdir $(CURDIR))) 70 | #--------------------------------------------------------------------------------- 71 | 72 | export OUTPUT := $(CURDIR)/$(TARGET) 73 | export TOPDIR := $(CURDIR) 74 | 75 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 76 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 77 | 78 | export DEPSDIR := $(CURDIR)/$(BUILD) 79 | 80 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 81 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 82 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 83 | PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica))) 84 | SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist))) 85 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 86 | 87 | #--------------------------------------------------------------------------------- 88 | # use CXX for linking C++ projects, CC for standard C 89 | #--------------------------------------------------------------------------------- 90 | ifeq ($(strip $(CPPFILES)),) 91 | #--------------------------------------------------------------------------------- 92 | export LD := $(CC) 93 | #--------------------------------------------------------------------------------- 94 | else 95 | #--------------------------------------------------------------------------------- 96 | export LD := $(CXX) 97 | #--------------------------------------------------------------------------------- 98 | endif 99 | #--------------------------------------------------------------------------------- 100 | 101 | export OFILES := $(addsuffix .o,$(BINFILES)) \ 102 | $(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \ 103 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 104 | 105 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 106 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 107 | -I$(CURDIR)/$(BUILD) 108 | 109 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) 110 | 111 | ifeq ($(strip $(ICON)),) 112 | icons := $(wildcard *.png) 113 | ifneq (,$(findstring $(TARGET).png,$(icons))) 114 | export APP_ICON := $(TOPDIR)/$(TARGET).png 115 | else 116 | ifneq (,$(findstring icon.png,$(icons))) 117 | export APP_ICON := $(TOPDIR)/icon.png 118 | endif 119 | endif 120 | else 121 | export APP_ICON := $(TOPDIR)/$(ICON) 122 | endif 123 | 124 | ifeq ($(strip $(NO_SMDH)),) 125 | export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh 126 | endif 127 | 128 | ifneq ($(ROMFS),) 129 | export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) 130 | endif 131 | 132 | .PHONY: $(BUILD) clean all 133 | 134 | #--------------------------------------------------------------------------------- 135 | all: $(BUILD) 136 | 137 | $(BUILD): 138 | @[ -d $@ ] || mkdir -p $@ 139 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 140 | 141 | #--------------------------------------------------------------------------------- 142 | clean: 143 | @echo clean ... 144 | @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf 145 | 146 | 147 | #--------------------------------------------------------------------------------- 148 | else 149 | 150 | DEPENDS := $(OFILES:.o=.d) 151 | 152 | #--------------------------------------------------------------------------------- 153 | # main targets 154 | #--------------------------------------------------------------------------------- 155 | ifeq ($(strip $(NO_SMDH)),) 156 | $(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh 157 | else 158 | $(OUTPUT).3dsx : $(OUTPUT).elf 159 | endif 160 | 161 | $(OUTPUT).elf : $(OFILES) 162 | 163 | #--------------------------------------------------------------------------------- 164 | # you need a rule like this for each extension you use as binary data 165 | #--------------------------------------------------------------------------------- 166 | %.bin.o : %.bin 167 | #--------------------------------------------------------------------------------- 168 | @echo $(notdir $<) 169 | @$(bin2o) 170 | 171 | #--------------------------------------------------------------------------------- 172 | # rules for assembling GPU shaders 173 | #--------------------------------------------------------------------------------- 174 | define shader-as 175 | $(eval CURBIN := $(patsubst %.shbin.o,%.shbin,$(notdir $@))) 176 | picasso -o $(CURBIN) $1 177 | bin2s $(CURBIN) | $(AS) -o $@ 178 | echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h 179 | echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h 180 | echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h 181 | endef 182 | 183 | %.shbin.o : %.v.pica %.g.pica 184 | @echo $(notdir $^) 185 | @$(call shader-as,$^) 186 | 187 | %.shbin.o : %.v.pica 188 | @echo $(notdir $<) 189 | @$(call shader-as,$<) 190 | 191 | %.shbin.o : %.shlist 192 | @echo $(notdir $<) 193 | @$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file))) 194 | 195 | -include $(DEPENDS) 196 | 197 | #--------------------------------------------------------------------------------------- 198 | endif 199 | #--------------------------------------------------------------------------------------- 200 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Homebrew to display which type of screens (IPS or TN) your N3DS has. 2 | 3 | Does not work on O3DS. 4 | 5 | Building will require you to add GSPLCD_GetVendors to libctru. 6 | -------------------------------------------------------------------------------- /source/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include <3ds.h> 5 | 6 | int main(int argc, char **argv) 7 | { 8 | // Initialize services 9 | aptInit(); 10 | gfxInitDefault(); 11 | hidInit(); 12 | gspLcdInit(); 13 | 14 | consoleInit(GFX_TOP, NULL); 15 | 16 | bool isNew3DS = 0; 17 | APT_CheckNew3DS(&isNew3DS); 18 | if (isNew3DS) 19 | { 20 | u8 Screens = 0; 21 | GSPLCD_GetVendors(&Screens); 22 | printf("\nScreen Info:\n\n"); 23 | switch ((Screens >> 4) & 0xF) 24 | { 25 | case 1: 26 | printf("Upper screen: IPS\n"); 27 | break; 28 | case 0xC: 29 | printf("Upper screen: TN\n"); 30 | break; 31 | default: 32 | printf("Upper screen: Unknown\n"); 33 | break; 34 | } 35 | switch (Screens & 0xF) 36 | { 37 | case 1: 38 | printf("Lower screen: IPS\n"); 39 | break; 40 | case 0xC: 41 | printf("Lower screen: TN\n"); 42 | break; 43 | default: 44 | printf("Lower screen: Unknown\n"); 45 | break; 46 | } 47 | } 48 | else 49 | { 50 | printf("\nCan't check O3DS Screen vendors.\n"); 51 | } 52 | 53 | printf("\nPress START to exit.\n"); 54 | 55 | while(aptMainLoop()) //Always have the main code loop in here 56 | { 57 | hidScanInput(); //Checks which keys are pressed 58 | 59 | u32 button = hidKeysDown(); // Checks which keys are up and which ones are down 60 | if (button & KEY_START) 61 | { 62 | break; 63 | } 64 | } 65 | 66 | // Exit services 67 | aptExit(); 68 | gfxExit(); 69 | hidExit(); 70 | gspLcdExit(); 71 | return 0; 72 | } 73 | --------------------------------------------------------------------------------