]> Chaos Git - corbenik/ctrulib.git/commitdiff
Makefile updated, added another note to the README.md file andremoved the svcSleepThr...
authorprofi200 <fd3194@gmx.de>
Mon, 10 Nov 2014 21:30:07 +0000 (22:30 +0100)
committerprofi200 <fd3194@gmx.de>
Mon, 10 Nov 2014 21:30:07 +0000 (22:30 +0100)
examples/app_launch/Makefile
examples/app_launch/README.md
examples/app_launch/source/main.c

index c850c224282b604809cac7e24e8c29bf69896e06..568eda299b0dbb765ebd030c04d84b282878625e 100644 (file)
@@ -20,21 +20,29 @@ include $(DEVKITARM)/3ds_rules
 # 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
-# SPECS is the directory containing the important build and link files
-#---------------------------------------------------------------------------------
-export TARGET          :=      $(shell basename $(CURDIR))
+#
+# NO_SMDH: if set to anything, no SMDH file is generated.
+# 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       :=      include
 
-
 #---------------------------------------------------------------------------------
 # options for code generation
 #---------------------------------------------------------------------------------
-ARCH   :=      -march=armv6k -mtune=mpcore
+ARCH   :=      -march=armv6k -mtune=mpcore -mfloat-abi=softfp
 
-CFLAGS :=      -g -Wall -O3 -mword-relocations -save-temps \
+CFLAGS :=      -g -Wall -O2 -mword-relocations \
                        -fomit-frame-pointer -ffast-math \
                        $(ARCH)
 
@@ -43,8 +51,7 @@ 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,$(TARGET).map
+LDFLAGS        =       -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
 
 LIBS   := -lctru -lm
 
@@ -53,15 +60,15 @@ LIBS        := -lctru -lm
 # 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)
 
@@ -98,42 +105,71 @@ export INCLUDE     :=      $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
 
 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
+
 .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 $(TARGET).elf
+       @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
+
+
 #---------------------------------------------------------------------------------
 else
+
 DEPENDS        :=      $(OFILES:.o=.d)
+
 #---------------------------------------------------------------------------------
 # main targets
 #---------------------------------------------------------------------------------
+ifeq ($(strip $(NO_SMDH)),)
+.PHONY: all
+all    :       $(OUTPUT).3dsx $(OUTPUT).smdh
+endif
 $(OUTPUT).3dsx :       $(OUTPUT).elf
 $(OUTPUT).elf  :       $(OFILES)
 
 #---------------------------------------------------------------------------------
-# you need a rule like this for each extension you use as binary data 
+# you need a rule like this for each extension you use as binary data
 #---------------------------------------------------------------------------------
 %.bin.o        :       %.bin
 #---------------------------------------------------------------------------------
        @echo $(notdir $<)
-       $(bin2o)
+       @$(bin2o)
+
+# WARNING: This is not the right way to do this! TODO: Do it right!
+#---------------------------------------------------------------------------------
+%.vsh.o        :       %.vsh
+#---------------------------------------------------------------------------------
+       @echo $(notdir $<)
+       @python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin
+       @bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@
+       @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
+       @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
+       @echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
+       @rm ../$(notdir $<).shbin
 
 -include $(DEPENDS)
+
 #---------------------------------------------------------------------------------------
 endif
 #---------------------------------------------------------------------------------------
index f3f2c0827110c3a46c6d86070c3a9c9d148395b6..2fa1986bbf43e6e66c849c1b49f5df1d2d4fb6db 100644 (file)
@@ -3,5 +3,7 @@ app_launch
 
 Example for launching other apps/applets with ctrulib. Press the A button to launch the app or applet specified in the source.
 
+
 Note: The title ID of the EUR Nintendo 3DS Camera app is hardcoded and you need to change it if your 3DS is not an european one. See here for title IDs: http://3dbrew.org/wiki/Title_list#00040010_-_System_Applications
+This example only works if launched as regular app by the home menu. It will not work with the homebrew menu.
 
index 1c4dcdc085b4be6f4b62c345a6aed5241c7ce486..0077c6cc6328b79dc89d95ab35d53e8634c2432c 100644 (file)
@@ -19,7 +19,6 @@ int main()
        while(aptMainLoop())
        {
                hidScanInput();
-               svcSleepThread(100000000LL);
 
                if(hidKeysDown() & KEY_A)
                {