mirror of
https://github.com/CTurt/dsgmLib.git
synced 2025-06-18 14:45:43 -04:00
Directory structure refactor
This commit is contained in:
parent
22d40171c4
commit
b410ee4e07
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
dsgmLib/build/
|
||||
build/
|
||||
template/build/
|
||||
template/*.elf
|
||||
examples/*/build/
|
||||
|
135
Makefile
135
Makefile
@ -1,6 +1,131 @@
|
||||
.PHONY: all
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
all:
|
||||
make -C dsgmLib
|
||||
make -C template
|
||||
make -C examples
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
# Uncomment for debug mode
|
||||
#DSGMDEBUG := -DDEBUG
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := libdsgm
|
||||
BUILD := build
|
||||
SOURCES := gfx source data
|
||||
INCLUDES := include build
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -O2 -fms-extensions\
|
||||
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM9 -DBUILDINGLIB $(DSGMDEBUG)
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
#LIBS := -lnds9
|
||||
LIBS := -lnds
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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)/lib/$(TARGET).a
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(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,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES := $(BINFILES:.bin=.o) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).ds.gba
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
#$(OUTPUT).nds : $(OUTPUT).elf
|
||||
#$(OUTPUT).elf : $(OFILES)
|
||||
$(OUTPUT) : $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
131
dsgmLib/Makefile
131
dsgmLib/Makefile
@ -1,131 +0,0 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
# Uncomment for debug mode
|
||||
#DSGMDEBUG := -DDEBUG
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := gfx source data
|
||||
INCLUDES := include build
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -O2 -fms-extensions\
|
||||
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM9 -DBUILDINGLIB $(DSGMDEBUG)
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
#LIBS := -lnds9
|
||||
LIBS := -lnds
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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).a
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(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,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES := $(BINFILES:.bin=.o) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).ds.gba
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
#$(OUTPUT).nds : $(OUTPUT).elf
|
||||
#$(OUTPUT).elf : $(OFILES)
|
||||
$(OUTPUT) : $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
Binary file not shown.
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -77,8 +77,13 @@ DSGM_ObjectGroup *DSGM_GetObjectGroupFull(DSGM_Room *room, u8 screen, DSGM_Objec
|
||||
#define DSGM_CreateObjectInstance(screen, x, y, object) DSGM_CreateObjectInstanceFull(&DSGM_Rooms[DSGM_currentRoom], (DSGM_ObjectInstance **)&me, screen, x, y, object)
|
||||
DSGM_ObjectInstance *DSGM_CreateObjectInstanceFull(DSGM_Room *room, DSGM_ObjectInstance **meP, u8 screen, int x, int y, DSGM_Object *object);
|
||||
|
||||
#define DSGM_DeleteObjectInstance(objectInstance) DSGM_DeleteObjectInstanceFull(&DSGM_Rooms[DSGM_currentRoom], (DSGM_ObjectInstance *)objectInstance)
|
||||
void DSGM_DeleteObjectInstanceFull(DSGM_Room *room, DSGM_ObjectInstance *objectInstance);
|
||||
#define DSGM_DeleteObjectInstance(objectInstance) do {\
|
||||
bool kill = false;\
|
||||
if((DSGM_ObjectInstance *)objectInstance == (DSGM_ObjectInstance *)me) kill = true;\
|
||||
DSGM_DeleteObjectInstanceFull(&DSGM_Rooms[DSGM_currentRoom], (DSGM_ObjectInstance **)&me, (DSGM_ObjectInstance *)objectInstance);\
|
||||
if(kill) return;\
|
||||
} while(0)
|
||||
void DSGM_DeleteObjectInstanceFull(DSGM_Room *room, DSGM_ObjectInstance **meP, DSGM_ObjectInstance *objectInstance);
|
||||
|
||||
#define DSGM_GetObjectInstanceRelation(me) DSGM_GetObjectInstanceRelationFull(&DSGM_Rooms[DSGM_currentRoom], (DSGM_ObjectInstance *)me)
|
||||
DSGM_ObjectInstanceRelation DSGM_GetObjectInstanceRelationFull(DSGM_Room *room, DSGM_ObjectInstance *me);
|
Binary file not shown.
@ -210,7 +210,18 @@ DSGM_ObjectInstance *DSGM_CreateObjectInstanceFull(DSGM_Room *room, DSGM_ObjectI
|
||||
}
|
||||
}
|
||||
|
||||
void DSGM_DeleteObjectInstanceFull(DSGM_Room *room, DSGM_ObjectInstance *objectInstance) {
|
||||
void DSGM_DeleteObjectInstanceFull(DSGM_Room *room, DSGM_ObjectInstance **meP, DSGM_ObjectInstance *objectInstance) {
|
||||
printf("full\n");
|
||||
swiWaitForVBlank();
|
||||
|
||||
if(objectInstance->object->destroy) {
|
||||
printf("destr i[ here\n");
|
||||
swiWaitForVBlank();
|
||||
}
|
||||
|
||||
DSGM_ObjectInstanceRelation relation = { 0, 0 };
|
||||
if(meP && *meP) relation = DSGM_GetObjectInstanceRelationFull(room, *meP);
|
||||
|
||||
DSGM_ObjectGroup *group = DSGM_GetObjectGroupFull(room, objectInstance->screen, objectInstance->object);
|
||||
|
||||
if(!group) {
|
||||
@ -228,16 +239,37 @@ void DSGM_DeleteObjectInstanceFull(DSGM_Room *room, DSGM_ObjectInstance *objectI
|
||||
int ID = DSGM_GetObjectInstanceIDFull(room, objectInstance);
|
||||
DSGM_Debug("Deleting object instance with ID %d\n", ID);
|
||||
|
||||
if(objectInstance->object->destroy) objectInstance->object->destroy(objectInstance);
|
||||
printf("got ID\n");
|
||||
swiWaitForVBlank();
|
||||
|
||||
if(objectInstance->object->destroy) {
|
||||
printf("destr part 1\n");
|
||||
swiWaitForVBlank();
|
||||
|
||||
objectInstance->object->destroy(objectInstance);
|
||||
}
|
||||
|
||||
printf("destr\n");
|
||||
swiWaitForVBlank();
|
||||
|
||||
DSGM_DeinitObjectInstanceRotScale(objectInstance);
|
||||
|
||||
printf("rotscaled\n");
|
||||
swiWaitForVBlank();
|
||||
|
||||
if(ID < group->objectInstanceCount - 1) {
|
||||
DSGM_Debug("Shifting %d object instances for deletion\n", (group->objectInstanceCount - ID - 1));
|
||||
memcpy(&group->objectInstances[ID], &group->objectInstances[ID + 1], (group->objectInstanceCount - ID - 1) * sizeof(DSGM_ObjectInstance));
|
||||
}
|
||||
|
||||
printf("shifted\n");
|
||||
swiWaitForVBlank();
|
||||
|
||||
group->objectInstances = realloc(group->objectInstances, --group->objectInstanceCount * sizeof(DSGM_ObjectInstance));
|
||||
|
||||
printf("re\n");
|
||||
swiWaitForVBlank();
|
||||
|
||||
if(spriteNumbersChange) {
|
||||
int i;
|
||||
for(i = 0; i < 128; i++) {
|
||||
@ -245,6 +277,8 @@ void DSGM_DeleteObjectInstanceFull(DSGM_Room *room, DSGM_ObjectInstance *objectI
|
||||
}
|
||||
DSGM_RedistributeSpriteNumbers(room, screen);
|
||||
}
|
||||
|
||||
if(meP && *meP) *meP = DSGM_GetMeFromObjectInstanceRelationFull(room, &relation);
|
||||
}
|
||||
|
||||
DSGM_ObjectInstanceRelation DSGM_GetObjectInstanceRelationFull(DSGM_Room *room, DSGM_ObjectInstance *me) {
|
@ -8,9 +8,7 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
ifeq ($(strip $(DSGMLIB)),)
|
||||
$(error "Please set in your environment. export DSGMLIB=<path to dsgmLib>")
|
||||
endif
|
||||
DSGMLIB := $(DEVKITPRO)/dsgmLib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
@ -46,7 +44,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := $(DSGMLIB)/dsgmLib.a -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
LIBS := -ldsgm -ldsgmdswifi9 -lfilesystem -lfat -lnds9 -lmm9
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user