Homebrew Homebrew Development

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica

spinal_cord

Knows his stuff
Member
Joined
Jul 21, 2007
Messages
3,225
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,382
Country
The 3ds audio streaming example is a good place to start. https://github.com/devkitPro/3ds-examples/tree/master/audio/streaming

You may want to play with the buffer size and count to suit your need. Fewer large buffers for streaming music and more small buffers for software mixing sound effects. Either way the principle is the same - keep a fixed number of buffers submitted/playing and as they get marked as done then fill more buffers to keep the submitted/playing count constant.

Cool, got ndsp working, the only problem is that it kills my home button integration.
 

TarableCode

Well-Known Member
Member
Joined
Mar 2, 2016
Messages
184
Trophies
0
Age
37
XP
319
Country
Canada
Might have a solution to my latest problem with keeping 0x01-0x7F. I'd do the following texture combiner sequence

SUB(CONST[0.5], TEX[src])
ADD(PREV[src], PREV[src])
MODULATE(PREV[src], PREV[1-src])

Assuming with each stage it saturates between 0.0 and 1.0, this would cause entry 0x00 and 0x80-0xFF to result in a value of 0, with 0x01-0x7F to range between 0.0 (exclusive) and 0.25 (inclusive). Also assuming that when the alpha test is done, the reference value is converted into a float and then compared, as entries like 0x01 and 0x7F with these texture combiner stages results in extremely small values. So, after this, I'd set the alpha test to be "greater than 0", and then I'd force all passing tests to be fully solid. Guess it's time to test.

Did the color LUT stuff end up working?
 

DiscostewSM

Well-Known Member
Member
Joined
Feb 10, 2009
Messages
5,484
Trophies
2
Location
Sacramento, California
Website
lazerlight.x10.mx
XP
5,496
Country
United States
Did the color LUT stuff end up working?

Yes, but to use it as-is, you can't use linear filtering, normals/lighting, and you would have to adjust the texture itself and set up alpha blending info for it to work. This can be worked around by making a cache render for the texture, then using that as the actual output, but it's an additional step and separate render.
 

TarableCode

Well-Known Member
Member
Joined
Mar 2, 2016
Messages
184
Trophies
0
Age
37
XP
319
Country
Canada
I'm not sure if ffmpeg and such will compile or be usable but libmpeg2 should as I and several other DS devs had it working decently.
I haven't tried it on the 3ds yet though but I don't see why it wouldn't work.
 

Somebody Whoisbored

it's all okeydokey
Member
Joined
May 12, 2016
Messages
478
Trophies
0
Age
22
Location
hypeland
XP
227
Country
United States
So I've have a compile problem.

I have installed devkitPro, sf2dlib, sfillib, and a few others that I can't remember.

This is the console
Code:
Png load/decode error.
make[1]: *** [/b/project/output/game.smdh] Error 1
make: *** [all] Error 2
This is the only code written by me:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <3ds.h>
#include <sf2d.h>
#include <sfil.h>
#include <sftd.h>

#include "icon_png.h"

sf2d_texture* tex;

int main() {
    // Set the random seed based on the time
    sf2d_init();
    sf2d_set_clear_color(RGBA8(0, 0, 0, 255));
    sf2d_set_vblank_wait(0);

    sftd_init();

    srand(time(0));

    tex = sfill_load_PNG_file("data/icon.png", SF2D_PLACE_RAM);

    while (aptMainLoop()) {

        hidScanInput();

        if (hidKeysHeld() & KEY_START) {
            break;
        }

        sf2d_start_frame(GFX_TOP, GFX_LEFT);

        sf2d_draw_texture(tex, 0, 0);

        sf2d_end_frame();
        sf2d_swapbuffers();
    }

    sf2d_free_texture(tex);

    sf2d_fini();
    sftd_fini();

    return 0;
}
and this is my Makefile:

Code:
.SUFFIXES:

#---------------------------------------------------------------------------------
# Environment Setup
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
endif

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/3ds_rules

#---------------------------------------------------------------------------------
# Directory Setup
#---------------------------------------------------------------------------------
BUILD := build
OUTPUT := output
RESOURCES := resources
DATA :=data
ROMFS := romfs
SOURCES := source
INCLUDES := $(SOURCES) include
BUILDTOOLS := $(TOPDIR)/buildtools
#---------------------------------------------------------------------------------
# Resource Setup
#---------------------------------------------------------------------------------
APP_INFO := $(RESOURCES)/AppInfo
BANNER_AUDIO := $(RESOURCES)/audio
BANNER_IMAGE := $(RESOURCES)/banner
ICON := $(RESOURCES)/icon.png
RSF := $(TOPDIR)/$(RESOURCES)/template.rsf

#---------------------------------------------------------------------------------
# Build Setup
#---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard

COMMON_FLAGS := -g -Wall -Wno-strict-aliasing -O3 -mword-relocations -fomit-frame-pointer -ffast-math $(ARCH) $(INCLUDE) -DARM11 -D_3DS $(BUILD_FLAGS)
CFLAGS := $(COMMON_FLAGS) -std=gnu99
CXXFLAGS := $(COMMON_FLAGS) -std=gnu++11
ifeq ($(ENABLE_EXCEPTIONS),)
    CXXFLAGS += -fno-rtti -fno-exceptions
endif

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)


LIBS    := -lsfil -lpng -lsftd -lfreetype -lz -lsf2d -lctru -lm
LIBDIRS    := $(CTRULIB) $(PORTLIBS)
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# Build Variable Setup
#---------------------------------------------------------------------------------
recurse = $(shell find $2 -type $1 -name '$3' 2> /dev/null)

CFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.s)))
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.pica)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(call recurse,f,$(dir),*.*)))

export OFILES := $(addsuffix .o,$(BINFILES)) $(PICAFILES:.pica=.shbin.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) $(DATA:.png=.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 $(CPPFILES)),)
    export LD := $(CC)
else
    export LD := $(CXX)
endif

export DEPSDIR := $(CURDIR)/$(BUILD)
export VPATH    :=    $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
            $(foreach dir,$(DATA),$(CURDIR)/$(dir))
export TOPDIR := $(CURDIR)
OUTPUT_DIR := $(TOPDIR)/$(OUTPUT)

.PHONY: $(BUILD) clean all

#---------------------------------------------------------------------------------
# Initial Targets
#---------------------------------------------------------------------------------
all: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

3dsx: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@

citra: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@

cia: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@

3ds: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@

elf: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@
send: $(BUILD)
    @$(BUILDTOOLS)/3dslink $(TARGET).3dsx
$(BUILD):
    @[ -d $@ ] || mkdir -p $@

$(OUTPUT_DIR):
    @[ -d $@ ] || mkdir -p $@

clean:
    @echo clean ...
    @rm -fr $(BUILD) $(OUTPUT)

#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# Build Information Setup
#---------------------------------------------------------------------------------
DEPENDS := $(OFILES:.o=.d)

include $(TOPDIR)/$(APP_INFO)
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16)
APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7)
ifneq ("$(wildcard $(TOPDIR)/$(BANNER_IMAGE).cgfx)","")
    BANNER_IMAGE_FILE := $(TOPDIR)/$(BANNER_IMAGE).cgfx
    BANNER_IMAGE_ARG := -ci $(BANNER_IMAGE_FILE)
else
    BANNER_IMAGE_FILE := $(TOPDIR)/$(BANNER_IMAGE).png
    BANNER_IMAGE_ARG := -i $(BANNER_IMAGE_FILE)
endif

ifneq ("$(wildcard $(TOPDIR)/$(BANNER_AUDIO).cwav)","")
    BANNER_AUDIO_FILE := $(TOPDIR)/$(BANNER_AUDIO).cwav
    BANNER_AUDIO_ARG := -ca $(BANNER_AUDIO_FILE)
else
    BANNER_AUDIO_FILE := $(TOPDIR)/$(BANNER_AUDIO).wav
    BANNER_AUDIO_ARG := -a $(BANNER_AUDIO_FILE)
endif

EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
OUTPUT_NAME := $(subst $(SPACE),,$(APP_TITLE))
OUTPUT_DIR := $(TOPDIR)/$(OUTPUT)
OUTPUT_FILE := $(OUTPUT_DIR)/$(OUTPUT_NAME)

APP_ICON := $(TOPDIR)/$(ICON)
APP_ROMFS := $(TOPDIR)/$(ROMFS)

COMMON_MAKEROM_PARAMS := -rsf $(RSF) -target t -exefslogo -elf $(OUTPUT_FILE).elf -icon icon.icn -banner banner.bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(APP_UNIQUE_ID)" -DAPP_ROMFS="$(APP_ROMFS)" -DAPP_SYSTEM_MODE="64MB" -DAPP_SYSTEM_MODE_EXT="Legacy"

ifeq ($(OS),Windows_NT)
    MAKEROM = $(BUILDTOOLS)/makerom.exe
    BANNERTOOL = $(BUILDTOOLS)/bannertool.exe
else
    MAKEROM = $(BUILDTOOLS)/makerom
    BANNERTOOL = $(BUILDTOOLS)/bannertool
endif

_3DSXFLAGS += --smdh=$(OUTPUT_FILE).smdh
ifneq ("$(wildcard $(TOPDIR)/$(ROMFS))","")
    _3DSXFLAGS += --romfs=$(TOPDIR)/$(ROMFS)
endif

#---------------------------------------------------------------------------------
# Main Targets
#---------------------------------------------------------------------------------
.PHONY: all 3dsx cia 3ds citra
all: $(OUTPUT_FILE).zip $(OUTPUT_FILE).3ds $(OUTPUT_FILE).cia

banner.bnr: $(BANNER_IMAGE_FILE) $(BANNER_AUDIO_FILE)
    @$(BANNERTOOL) makebanner $(BANNER_IMAGE_ARG) $(BANNER_AUDIO_ARG) -o banner.bnr > /dev/null

icon.icn: $(TOPDIR)/$(ICON)
    @$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(TOPDIR)/$(ICON) -o icon.icn > /dev/null

$(OUTPUT_FILE).elf: $(OFILES)

$(OUTPUT_FILE).3dsx: $(OUTPUT_FILE).elf $(OUTPUT_FILE).smdh

$(OUTPUT_FILE).3ds: $(OUTPUT_FILE).elf banner.bnr icon.icn
    @$(MAKEROM) -f cci -o $(OUTPUT_FILE).3ds -DAPP_ENCRYPTED=true $(COMMON_MAKEROM_PARAMS)
    @echo "built ... $(notdir $@)"

$(OUTPUT_FILE).cia: $(OUTPUT_FILE).elf banner.bnr icon.icn
    @$(MAKEROM) -f cia -o $(OUTPUT_FILE).cia -DAPP_ENCRYPTED=false $(COMMON_MAKEROM_PARAMS)
    @echo "built ... $(notdir $@)"

$(OUTPUT_FILE).zip: $(OUTPUT_FILE).smdh $(OUTPUT_FILE).3dsx
    @cd $(OUTPUT_DIR); \
    mkdir -p 3ds/$(OUTPUT_NAME); \
    cp $(OUTPUT_FILE).3dsx 3ds/$(OUTPUT_NAME); \
    cp $(OUTPUT_FILE).smdh 3ds/$(OUTPUT_NAME); \
    $(BUILDTOOLS)/zip -r $(OUTPUT_FILE).zip 3ds > /dev/null; \
    rm -r 3ds
    @echo "built ... $(notdir $@)"

3dsx : $(OUTPUT_FILE).3dsx

cia : $(OUTPUT_FILE).cia

3ds : $(OUTPUT_FILE).3ds

elf : $(OUTPUT_FILE).elf

citra : $(OUTPUT_FILE).elf
    citra $(OUTPUT_FILE).elf

#---------------------------------------------------------------------------------
# Binary Data Rules
%.png.o    :    %.png
#---------------------------------------------------------------------------------
    @echo $(notdir $<)
    @$(bin2o)

%.bin.o: %.bin
    @echo $(notdir $<)
    @$(bin2o)

%.shbin.o: %.pica
    @echo $(notdir $<)
    $(eval CURBIN := $(patsubst %.pica,%.shbin,$(notdir $<)))
    $(eval CURH := $(patsubst %.pica,%.psh.h,$(notdir $<)))
    @picasso -h $(CURH) -o $(CURBIN) $<
    @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

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
Any ideas of a fix?
 
Last edited by Somebody Whoisbored,

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
So I've have a compile problem.

I have installed devkitPro, sf2dlib, sfillib, and a few others that I can't remember.

This is the console
Code:
Png load/decode error.
make[1]: *** [/b/project/output/game.smdh] Error 1
make: *** [all] Error 2
This is the only code written by me:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <3ds.h>
#include <sf2d.h>
#include <sfil.h>
#include <sftd.h>

#include "icon_png.h"

sf2d_texture* tex;

int main() {
    // Set the random seed based on the time
    sf2d_init();
    sf2d_set_clear_color(RGBA8(0, 0, 0, 255));
    sf2d_set_vblank_wait(0);

    sftd_init();

    srand(time(0));

    tex = sfill_load_PNG_file("data/icon.png", SF2D_PLACE_RAM);

    while (aptMainLoop()) {

        hidScanInput();

        if (hidKeysHeld() & KEY_START) {
            break;
        }

        sf2d_start_frame(GFX_TOP, GFX_LEFT);

        sf2d_draw_texture(tex, 0, 0);

        sf2d_end_frame();
        sf2d_swapbuffers();
    }

    sf2d_free_texture(tex);

    sf2d_fini();
    sftd_fini();

    return 0;
}
and this is my Makefile:

Code:
.SUFFIXES:

#---------------------------------------------------------------------------------
# Environment Setup
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
endif

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/3ds_rules

#---------------------------------------------------------------------------------
# Directory Setup
#---------------------------------------------------------------------------------
BUILD := build
OUTPUT := output
RESOURCES := resources
DATA :=data
ROMFS := romfs
SOURCES := source
INCLUDES := $(SOURCES) include
BUILDTOOLS := $(TOPDIR)/buildtools
#---------------------------------------------------------------------------------
# Resource Setup
#---------------------------------------------------------------------------------
APP_INFO := $(RESOURCES)/AppInfo
BANNER_AUDIO := $(RESOURCES)/audio
BANNER_IMAGE := $(RESOURCES)/banner
ICON := $(RESOURCES)/icon.png
RSF := $(TOPDIR)/$(RESOURCES)/template.rsf

#---------------------------------------------------------------------------------
# Build Setup
#---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard

COMMON_FLAGS := -g -Wall -Wno-strict-aliasing -O3 -mword-relocations -fomit-frame-pointer -ffast-math $(ARCH) $(INCLUDE) -DARM11 -D_3DS $(BUILD_FLAGS)
CFLAGS := $(COMMON_FLAGS) -std=gnu99
CXXFLAGS := $(COMMON_FLAGS) -std=gnu++11
ifeq ($(ENABLE_EXCEPTIONS),)
    CXXFLAGS += -fno-rtti -fno-exceptions
endif

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)


LIBS    := -lsfil -lpng -lsftd -lfreetype -lz -lsf2d -lctru -lm
LIBDIRS    := $(CTRULIB) $(PORTLIBS)
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# Build Variable Setup
#---------------------------------------------------------------------------------
recurse = $(shell find $2 -type $1 -name '$3' 2> /dev/null)

CFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.s)))
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.pica)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(call recurse,f,$(dir),*.*)))

export OFILES := $(addsuffix .o,$(BINFILES)) $(PICAFILES:.pica=.shbin.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) $(DATA:.png=.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 $(CPPFILES)),)
    export LD := $(CC)
else
    export LD := $(CXX)
endif

export DEPSDIR := $(CURDIR)/$(BUILD)
export VPATH    :=    $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
            $(foreach dir,$(DATA),$(CURDIR)/$(dir))
export TOPDIR := $(CURDIR)
OUTPUT_DIR := $(TOPDIR)/$(OUTPUT)

.PHONY: $(BUILD) clean all

#---------------------------------------------------------------------------------
# Initial Targets
#---------------------------------------------------------------------------------
all: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

3dsx: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@

citra: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@

cia: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@

3ds: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@

elf: $(BUILD) $(OUTPUT_DIR)
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@
send: $(BUILD)
    @$(BUILDTOOLS)/3dslink $(TARGET).3dsx
$(BUILD):
    @[ -d $@ ] || mkdir -p $@

$(OUTPUT_DIR):
    @[ -d $@ ] || mkdir -p $@

clean:
    @echo clean ...
    @rm -fr $(BUILD) $(OUTPUT)

#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# Build Information Setup
#---------------------------------------------------------------------------------
DEPENDS := $(OFILES:.o=.d)

include $(TOPDIR)/$(APP_INFO)
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16)
APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7)
ifneq ("$(wildcard $(TOPDIR)/$(BANNER_IMAGE).cgfx)","")
    BANNER_IMAGE_FILE := $(TOPDIR)/$(BANNER_IMAGE).cgfx
    BANNER_IMAGE_ARG := -ci $(BANNER_IMAGE_FILE)
else
    BANNER_IMAGE_FILE := $(TOPDIR)/$(BANNER_IMAGE).png
    BANNER_IMAGE_ARG := -i $(BANNER_IMAGE_FILE)
endif

ifneq ("$(wildcard $(TOPDIR)/$(BANNER_AUDIO).cwav)","")
    BANNER_AUDIO_FILE := $(TOPDIR)/$(BANNER_AUDIO).cwav
    BANNER_AUDIO_ARG := -ca $(BANNER_AUDIO_FILE)
else
    BANNER_AUDIO_FILE := $(TOPDIR)/$(BANNER_AUDIO).wav
    BANNER_AUDIO_ARG := -a $(BANNER_AUDIO_FILE)
endif

EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
OUTPUT_NAME := $(subst $(SPACE),,$(APP_TITLE))
OUTPUT_DIR := $(TOPDIR)/$(OUTPUT)
OUTPUT_FILE := $(OUTPUT_DIR)/$(OUTPUT_NAME)

APP_ICON := $(TOPDIR)/$(ICON)
APP_ROMFS := $(TOPDIR)/$(ROMFS)

COMMON_MAKEROM_PARAMS := -rsf $(RSF) -target t -exefslogo -elf $(OUTPUT_FILE).elf -icon icon.icn -banner banner.bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(APP_UNIQUE_ID)" -DAPP_ROMFS="$(APP_ROMFS)" -DAPP_SYSTEM_MODE="64MB" -DAPP_SYSTEM_MODE_EXT="Legacy"

ifeq ($(OS),Windows_NT)
    MAKEROM = $(BUILDTOOLS)/makerom.exe
    BANNERTOOL = $(BUILDTOOLS)/bannertool.exe
else
    MAKEROM = $(BUILDTOOLS)/makerom
    BANNERTOOL = $(BUILDTOOLS)/bannertool
endif

_3DSXFLAGS += --smdh=$(OUTPUT_FILE).smdh
ifneq ("$(wildcard $(TOPDIR)/$(ROMFS))","")
    _3DSXFLAGS += --romfs=$(TOPDIR)/$(ROMFS)
endif

#---------------------------------------------------------------------------------
# Main Targets
#---------------------------------------------------------------------------------
.PHONY: all 3dsx cia 3ds citra
all: $(OUTPUT_FILE).zip $(OUTPUT_FILE).3ds $(OUTPUT_FILE).cia

banner.bnr: $(BANNER_IMAGE_FILE) $(BANNER_AUDIO_FILE)
    @$(BANNERTOOL) makebanner $(BANNER_IMAGE_ARG) $(BANNER_AUDIO_ARG) -o banner.bnr > /dev/null

icon.icn: $(TOPDIR)/$(ICON)
    @$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(TOPDIR)/$(ICON) -o icon.icn > /dev/null

$(OUTPUT_FILE).elf: $(OFILES)

$(OUTPUT_FILE).3dsx: $(OUTPUT_FILE).elf $(OUTPUT_FILE).smdh

$(OUTPUT_FILE).3ds: $(OUTPUT_FILE).elf banner.bnr icon.icn
    @$(MAKEROM) -f cci -o $(OUTPUT_FILE).3ds -DAPP_ENCRYPTED=true $(COMMON_MAKEROM_PARAMS)
    @echo "built ... $(notdir $@)"

$(OUTPUT_FILE).cia: $(OUTPUT_FILE).elf banner.bnr icon.icn
    @$(MAKEROM) -f cia -o $(OUTPUT_FILE).cia -DAPP_ENCRYPTED=false $(COMMON_MAKEROM_PARAMS)
    @echo "built ... $(notdir $@)"

$(OUTPUT_FILE).zip: $(OUTPUT_FILE).smdh $(OUTPUT_FILE).3dsx
    @cd $(OUTPUT_DIR); \
    mkdir -p 3ds/$(OUTPUT_NAME); \
    cp $(OUTPUT_FILE).3dsx 3ds/$(OUTPUT_NAME); \
    cp $(OUTPUT_FILE).smdh 3ds/$(OUTPUT_NAME); \
    $(BUILDTOOLS)/zip -r $(OUTPUT_FILE).zip 3ds > /dev/null; \
    rm -r 3ds
    @echo "built ... $(notdir $@)"

3dsx : $(OUTPUT_FILE).3dsx

cia : $(OUTPUT_FILE).cia

3ds : $(OUTPUT_FILE).3ds

elf : $(OUTPUT_FILE).elf

citra : $(OUTPUT_FILE).elf
    citra $(OUTPUT_FILE).elf

#---------------------------------------------------------------------------------
# Binary Data Rules
%.png.o    :    %.png
#---------------------------------------------------------------------------------
    @echo $(notdir $<)
    @$(bin2o)

%.bin.o: %.bin
    @echo $(notdir $<)
    @$(bin2o)

%.shbin.o: %.pica
    @echo $(notdir $<)
    $(eval CURBIN := $(patsubst %.pica,%.shbin,$(notdir $<)))
    $(eval CURH := $(patsubst %.pica,%.psh.h,$(notdir $<)))
    @picasso -h $(CURH) -o $(CURBIN) $<
    @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

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
Any ideas of a fix?
Looks like the png file you supplied for the icon is not using a supported format. I want to say that it needs to be 24bpp. Just remove it and let it use the default icon and see if you get a successful build.

--------------------- MERGED ---------------------------

Does anyone have a hardware procedural texture example or code that they are willing to share? It doesn't need to be perfect or do anything specific - just something that uses texture 3.
 

Somebody Whoisbored

it's all okeydokey
Member
Joined
May 12, 2016
Messages
478
Trophies
0
Age
22
Location
hypeland
XP
227
Country
United States
Looks like the png file you supplied for the icon is not using a supported format. I want to say that it needs to be 24bpp. Just remove it and let it use the default icon and see if you get a successful build.

--------------------- MERGED ---------------------------

Does anyone have a hardware procedural texture example or code that they are willing to share? It doesn't need to be perfect or do anything specific - just something that uses texture 3.
So, that error did not pop up, so thank you. Unfortunately, another error popped up.

This is the console:

Code:
icon_3ds.png
make[1]: *** No rule to make target `data', needed by `/b/project/output/game.elf'.  Stop.
make: *** [all] Error 2

Seems to be more the setup of the makefile than an actual error.

Any ideas?
 
Last edited by Somebody Whoisbored,

zoogie

playing around in the end of life
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
Please help me to look at what is the mistake, I really don't understand
Code:
./arm-none-eabi/bin/ld.exe: cannot find -lsfil
e:/nintendo3ds/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/5.3.0/../../../.
./arm-none-eabi/bin/ld.exe: cannot find -lsf2d
those 2 things starting with -l are libraries that you lack.

@xerpi is this author, check out his Github to download and install them. "make && make install" although it might end up being a wild goose chase for nested libraries. Welcome to programming. :P
So, that error did not pop up, so thank you. Unfortunately, another error popped up.

This is the console:

Code:
icon_3ds.png
make[1]: *** No rule to make target `data', needed by `/b/project/output/game.elf'.  Stop.
make: *** [all] Error 2

Seems to be more the setup of the makefile than an actual error.

Any ideas?
Seems like you lack a "data" folder in the project's root. Just a wild guess.
 
  • Like
Reactions: -Wzjian-

-Wzjian-

Member
Newcomer
Joined
Apr 24, 2016
Messages
16
Trophies
0
Age
29
XP
52
Country
Switzerland
Code:
./arm-none-eabi/bin/ld.exe: cannot find -lsfil
e:/nintendo3ds/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/5.3.0/../../../.
./arm-none-eabi/bin/ld.exe: cannot find -lsf2d
those 2 things starting with -l are libraries that you lack.

@xerpi is this author, check out his Github to download and install them. "make && make install" although it might end up being a wild goose chase for nested libraries. Welcome to programming. :P

Seems like you lack a "data" folder in the project's root. Just a wild guess.
thank you.
 

Somebody Whoisbored

it's all okeydokey
Member
Joined
May 12, 2016
Messages
478
Trophies
0
Age
22
Location
hypeland
XP
227
Country
United States
Code:
./arm-none-eabi/bin/ld.exe: cannot find -lsfil
e:/nintendo3ds/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/5.3.0/../../../.
./arm-none-eabi/bin/ld.exe: cannot find -lsf2d
those 2 things starting with -l are libraries that you lack.

@xerpi is this author, check out his Github to download and install them. "make && make install" although it might end up being a wild goose chase for nested libraries. Welcome to programming. :P

Seems like you lack a "data" folder in the project's root. Just a wild guess.
I do have data in my root. It's where "icon_3ds.png" is.
 

Pokéidiot

Well-Known Member
Member
Joined
Dec 6, 2015
Messages
244
Trophies
0
Location
\n?
XP
209
Country
Brazil
Any ideas about how to use ACU_GetWifiStatus properly?
Code:
    u32 enabled = 0;
    ACU_GetWifiStatus(&enabled);

    if (enabled == 0)
    {
        drawErr_btm("WiFi is disabled. \nPlease enable it by pulling the wifi switch.\n\nPress A button when done.");
        while (aptMainLoop())
        {
            hidScanInput();
            if (hidKeysUp() & KEY_A)
            {
                    checkWifi();
            }           
        }
    }
This is the code of the function on my homebrew that uses ACU_GetWifiStatus. According to ctrulib doxygen, ACU_GetWifiStatus feeds the pointed u32 with 0 if wifi is disabled. But when I run it, the code on if block is executed even if Wifi is enabled. I tested on both Citra and on real hardware. Any ideas?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
    ZeroT21 @ ZeroT21: :lol: