Homebrew [Release] {beta} sf2dlib - Simple and Fast 2D library (using the GPU)

McHueHue

Member
Newcomer
Joined
Sep 6, 2015
Messages
6
Trophies
0
Age
34
XP
64
Country
United States
Had tons of errors running make, GPU_DrawArray too few arguments. I literary just downloaded this and the devkit+libctru a few moments ago so maybe this hasn't updated to libctru new parameters. I fixed it and complied fine now.
Is this what the sample supposed to look like http://i.imgur.com/AHbZ4vl.png just so I know I didn't mess something up.
Thanks.
 

Davideesk

Well-Known Member
Newcomer
Joined
Aug 19, 2015
Messages
67
Trophies
0
Age
27
XP
395
Country
United States
Does anyone know how to use stencils with sf2d? The code below just shows the circle and no square, and I'm trying to get the exact opposite of that.
Code:
    GPU_SetStencilTest(true, GPU_ALWAYS, 1, 0xFF, 0xFF); // enable stencil test
    GPU_SetStencilOp(GPU_STENCIL_REPLACE, GPU_STENCIL_REPLACE, GPU_STENCIL_REPLACE); // set the stencil value of the circle pixels to 1.
    sf2d_draw_fill_circle(50,50,10,0x7F);
  
    GPU_SetStencilTest(true, GPU_NOTEQUAL, 1, 0xFF, 0xFF);//draw wherever not 1
    GPU_SetStencilOp(GPU_STENCIL_KEEP , GPU_STENCIL_KEEP , GPU_STENCIL_KEEP);
    sf2d_draw_rectangle(20,20,100,100,0xFF);
  
    GPU_SetStencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00); // disable stencil test

The code is between sf2d_start_frame and sf2d_end_frame.
 

Hansausage

Member
Newcomer
Joined
Jun 16, 2014
Messages
11
Trophies
0
Age
28
Location
McBain, Michigan
XP
96
Country
United States
Hey, can someone help me set up sf2dlib in Ubuntu? Currently whenever I try and build the sample I get the following terminal output:

Code:
gabe@gabe-110-243w:/opt/devkitpro/sf2dlib-master/sample$ make
linking sf2d_sample.elf
/opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: cannot find -lsf2d
collect2: error: ld returned 1 exit status
/opt/devkitpro/devkitARM/3ds_rules:39: recipe for target '/opt/devkitpro/sf2dlib-master/sample/sf2d_sample.elf' failed
make[1]: *** [/opt/devkitpro/sf2dlib-master/sample/sf2d_sample.elf] Error 1
Makefile:130: recipe for target 'build' failed
make: *** [build] Error 2

Currently I just have the sf2dlib folder set up like this: https://gyazo.com/2b2610dc3d09f19ffb50fdcebd2104ea

Any help is greatly appreciated.
 

Garcia98

Hey! Listen!
Member
Joined
Sep 8, 2015
Messages
361
Trophies
0
Location
Salamanca
Website
github.com
XP
267
Country
Hey, can someone help me set up sf2dlib in Ubuntu? Currently whenever I try and build the sample I get the following terminal output:

Code:
gabe@gabe-110-243w:/opt/devkitpro/sf2dlib-master/sample$ make
linking sf2d_sample.elf
/opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: cannot find -lsf2d
collect2: error: ld returned 1 exit status
/opt/devkitpro/devkitARM/3ds_rules:39: recipe for target '/opt/devkitpro/sf2dlib-master/sample/sf2d_sample.elf' failed
make[1]: *** [/opt/devkitpro/sf2dlib-master/sample/sf2d_sample.elf] Error 1
Makefile:130: recipe for target 'build' failed
make: *** [build] Error 2

Currently I just have the sf2dlib folder set up like this: https://gyazo.com/2b2610dc3d09f19ffb50fdcebd2104ea

Any help is greatly appreciated.

Lel, you have to run make in libsf2d folder
 

Hansausage

Member
Newcomer
Joined
Jun 16, 2014
Messages
11
Trophies
0
Age
28
Location
McBain, Michigan
XP
96
Country
United States
OK I fixed the issue, after running it from the sf2dlib folder I found out I wasn't pointing to the aemstro_as.py script in the makefile. I did that and ran make and nothing really happened, just a flood of terminal output. I did the same to the makefile in the sample folder and ran make and everything works fine now. Thanks for your help :)
 

Rusb

Well-Known Member
Member
Joined
Apr 17, 2014
Messages
178
Trophies
0
XP
958
Country
Hello. I'm having some troubles trying to build the libraries. I think thay they are related with not having well installed ctrulib:
Code:
jorge@jorge-XubuntuBox:/opt/devkitpro/sf2dlib/libsf2d$ make
sf2d.c
arm-none-eabi-gcc -MMD -MP -MF /opt/devkitpro/sf2dlib/libsf2d/build/sf2d.d -g -Wall -O2 -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/opt/devkitpro/sf2dlib/libsf2d/include -I/opt/devkitpro/libctru/include -I/opt/devkitpro/sf2dlib/libsf2d/build -DARM11 -D_3DS -c /opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c -o sf2d.o
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:36:8: error: unknown type name 'aptHookCookie'
static aptHookCookie apt_hook_cookie;
        ^
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c: In function 'sf2d_init_advanced':
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:79:2: warning: implicit declaration of function 'aptHook' [-Wimplicit-function-declaration]
  aptHook(&apt_hook_cookie, apt_hook_func, NULL);
  ^
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c: In function 'sf2d_fini':
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:104:2: warning: implicit declaration of function 'aptUnhook' [-Wimplicit-function-declaration]
  aptUnhook(&apt_hook_cookie);
  ^
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c: In function 'apt_hook_func':
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:284:14: error: 'APTHOOK_ONRESTORE' undeclared (first use in this function)
  if (hook == APTHOOK_ONRESTORE) {
              ^
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:284:14: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [sf2d.o] Error 1
make: *** [build] Error 2

I have this exports:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/devkitpro/devkitARM/bin
echo $DEVKITPRO
/opt/devkitpro
echo $DEVKITARM
/opt/devkitpro/devkitARM
echo $CTRULIB
/libctru/

Do you know what am I doing wrong !?

I know it's too late to a response, but can be useful for other people.

Your problem is that you're using devkitARM libctru, you need to fetch last version of libctru and replace it.
 

Hansausage

Member
Newcomer
Joined
Jun 16, 2014
Messages
11
Trophies
0
Age
28
Location
McBain, Michigan
XP
96
Country
United States
I have another question

Yesterday I tried compiling my own sf2dlib application and got the following error:

Code:
gabe@gabe-110-243w:/opt/devkitpro/projects/sf2dlib_template$ make
linking sf2dlib_template.elf
/opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: cannot find -lsf2d
collect2: error: ld returned 1 exit status
/opt/devkitpro/devkitARM/3ds_rules:39: recipe for target '/opt/devkitpro/projects/sf2dlib_template/sf2dlib_template.elf' failed
make[1]: *** [/opt/devkitpro/projects/sf2dlib_template/sf2dlib_template.elf] Error 1
Makefile:130: recipe for target 'build' failed
make: *** [build] Error 2

I don't get this error with any other application i have tried compiling besides the other sf2dlib sample.
 

geocool

Well-Known Member
Newcomer
Joined
Jul 31, 2008
Messages
57
Trophies
0
Age
32
Location
Athens
XP
528
Country
Greece
What do you mean when you say you have sf2d installed ?
I saw your screenshot above with a sf2d_master folder inside devkitpro.
Did you copy libsf2d.a to ../devkitpro/libctru/lib/
and sf2d.h to ../devkitpro/libctru/include ?

The right way to install the sf2d is to navigate to the sf2d's folder
and run "make install". This will "make"/compile your library and then copy
the libsf2d.a and sf2d.h inside libctru directory in devkitpro.
 

Hansausage

Member
Newcomer
Joined
Jun 16, 2014
Messages
11
Trophies
0
Age
28
Location
McBain, Michigan
XP
96
Country
United States
I copied sf2d.h to the libctru include folder, but there wasn't a libsf2d anywhere (that i saw) Running make install resulted in a ton of errors about a bunch of functions with too few arguments. It's honestly a mess.

Code:
gabe@gabe-110-243w:/opt/devkitpro/sf2dlib-master/libsf2d$ make install
sf2d_texture.c
arm-none-eabi-gcc -MMD -MP -MF /opt/devkitpro/sf2dlib-master/libsf2d/build/sf2d_texture.d -g -Wall -O2 -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/opt/devkitpro/sf2dlib-master/libsf2d/include -I/opt/devkitpro/libctru/include -I/opt/devkitpro/sf2dlib-master/libsf2d/build -DARM11 -D_3DS -c /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c -o sf2d_texture.o
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_texture':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:229:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_texture_rotate':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:277:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_texture_part':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:314:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_texture_scale':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:352:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_texture_rotate_cut_scale':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:405:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_texture_blend':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:443:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_texture_part_blend':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:480:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_texture_depth':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:519:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c: In function 'sf2d_draw_quad_uv':
/opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:551:2: error: too few arguments to function 'GPU_DrawArray'
  GPU_DrawArray(GPU_TRIANGLE_STRIP, 4);
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:44:0,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/include/sf2d.h:11,
                 from /opt/devkitpro/sf2dlib-master/libsf2d/source/sf2d_texture.c:3:
/opt/devkitpro/libctru/include/3ds/gpu/gpu.h:297:6: note: declared here
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count);
      ^
/opt/devkitpro/devkitARM/base_rules:84: recipe for target 'sf2d_texture.o' failed
make[1]: *** [sf2d_texture.o] Error 1
Makefile:92: recipe for target 'build' failed
make: *** [build] Error 2

Honestly thinking about completely reinstalling Devkitpro, my entire installation is a mess and almost nothing works properly.
 

geocool

Well-Known Member
Newcomer
Joined
Jul 31, 2008
Messages
57
Trophies
0
Age
32
Location
Athens
XP
528
Country
Greece
You have these errors because you don't have the latest sf2d from the master branch.
Redownload the sf2d to any directory from github and then try again to navigate inside this directory and run "make install"
 

Hansausage

Member
Newcomer
Joined
Jun 16, 2014
Messages
11
Trophies
0
Age
28
Location
McBain, Michigan
XP
96
Country
United States
OK, after downloading the latest source and running make install. It installed. Running make on my program however still gave me the same error.

Code:
gabe@gabe-110-243w:/opt/devkitpro/projects/sf2dlib_template$ make
linking sf2dlib_template.elf
/opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: cannot find -lsf2d
collect2: error: ld returned 1 exit status
/opt/devkitpro/devkitARM/3ds_rules:39: recipe for target '/opt/devkitpro/projects/sf2dlib_template/sf2dlib_template.elf' failed
make[1]: *** [/opt/devkitpro/projects/sf2dlib_template/sf2dlib_template.elf] Error 1
Makefile:130: recipe for target 'build' failed
make: *** [build] Error 2
 

Hansausage

Member
Newcomer
Joined
Jun 16, 2014
Messages
11
Trophies
0
Age
28
Location
McBain, Michigan
XP
96
Country
United States
EDIT: No, libsf2d.a isn't there. After putting it there my program built. Thanks for your help, a ton.

Code:
#---------------------------------------------------------------------------------
.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.
# 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 source/textures
DATA        :=    data
INCLUDES    :=    include

APP_TITLE        := draw image
APP_DESCRIPTION    := just draws an image
APP_AUTHOR        := gabe warfield

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH    :=    -march=armv6k -mtune=mpcore -mfloat-abi=hard

CFLAGS    :=    -g -Wall -O2 -mword-relocations \
            -fomit-frame-pointer -ffast-math \
            $(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    := -lsf2d -lctru -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS    := $(CTRULIB) $(CURDIR)/../libsf2d


#---------------------------------------------------------------------------------
# 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)))
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)

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

.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 $(TARGET)-strip.elf $(TARGET).cia $(TARGET).3ds
#---------------------------------------------------------------------------------
$(TARGET)-strip.elf: $(BUILD)
    @$(STRIP) --strip-all $(TARGET).elf -o $(TARGET)-strip.elf
#---------------------------------------------------------------------------------
cci: $(TARGET)-strip.elf
    @makerom -f cci -rsf resources/$(TARGET).rsf -target d -exefslogo -elf $(TARGET)-strip.elf -o $(TARGET).3ds
    @echo "built ... sf2d_sample.3ds"
#---------------------------------------------------------------------------------
cia: $(TARGET)-strip.elf
    @makerom -f cia -o $(TARGET).cia -elf $(TARGET)-strip.elf -rsf resources/$(TARGET).rsf -icon resources/icon.icn -banner resources/banner.bnr -exefslogo -target t
    @echo "built ... sf2d_sample.cia"
#---------------------------------------------------------------------------------
send: $(BUILD)
    @3dslink $(TARGET).3dsx
#---------------------------------------------------------------------------------
run: $(BUILD)
    @citra $(TARGET).3dsx
#---------------------------------------------------------------------------------
copy_cia: $(TARGET).cia
    @cp $(TARGET).cia /mnt/GATEWAYNAND
    sync

#---------------------------------------------------------------------------------
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)

# WARNING: This is not the right way to do this! TODO: Do it right!
#---------------------------------------------------------------------------------
%.vsh.o    :    %.vsh
#---------------------------------------------------------------------------------
    @echo $(notdir $<)
    @python /opt/devkitpro/sf2dlib-master/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
#---------------------------------------------------------------------------------------
 
Last edited by Hansausage,

geocool

Well-Known Member
Newcomer
Joined
Jul 31, 2008
Messages
57
Trophies
0
Age
32
Location
Athens
XP
528
Country
Greece
Hmm seems ok, you dont need the
"$(CURDIR)/../libsf2d" anymore as the sf2d now exists inside $(CTRULIB).

Inside your project run: "make clean" and then try again "make"

::Edit::
Glad I could help. It's weird that libsf2d.a wasn't in the directory after the make install.
 
Last edited by geocool,

BurningDesire

Well-Known Member
Member
Joined
Jan 27, 2015
Messages
4,999
Trophies
1
Location
Behind a screen reading news
XP
4,885
Country
United States
I've been having some problem about shader.vsh when i try to compile. I have the most recent verson of ctrulib and devkitpro i don't know why it won't work.

Edit:

capture_by_bronzeflames-d992ffy.png
 

ElyosOfTheAbyss

Well-Known Member
Member
Joined
Aug 20, 2015
Messages
2,225
Trophies
1
XP
1,911
Country
I get this when i try to compile

Code:
C:\Users\GAVIN\Desktop\sf2dlib-master\libsf2d>make
shader.vsh
make[1]: python: Command not found
make[1]: *** [shader.vsh.o] Error 127
make: *** [build] Error 2

C:\Users\GAVIN\Desktop\sf2dlib-master\libsf2d>
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Sonic Angel Knight @ Sonic Angel Knight: DAYTONAAAAAAAA!!!!!!!!!!