Skip to content

Commit

Permalink
Updated code with TwilightMenu PicodriveDS version
Browse files Browse the repository at this point in the history
  • Loading branch information
xonn83 committed Sep 8, 2020
1 parent 8d4ad49 commit 72bae0b
Show file tree
Hide file tree
Showing 46 changed files with 3,307 additions and 1,012 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Binary File
*.nds
*.NDS
*.cdc
*.cia
*.app
*.srldr
*.elf
*.arm7
*.arm9
*.DS_Store
*.exe
*.dll

# Build Directory
build/
data/

# Project Files
.idea/
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: assembly

os: linux
sudo: false
dist: trusty

env:
global:
- DEVKITPRO=/opt/devkitpro
- DEVKITARM=/opt/devkitpro/devkitARM

cache:
directories:
- "$HOME/.local"
- "$DEVKITPRO"

before_install:
- curl -L https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb -o pacman.deb

install:
- sudo dpkg -i pacman.deb
- sudo dkp-pacman -Sy
- sudo dkp-pacman -S devkitARM general-tools dstools ndstool libnds libfat-nds --noconfirm
- export DEVKITPRO=/opt/devkitpro
- export DEVKITARM=${DEVKITPRO}/devkitARM

script:
- make

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9
- libstdc++6
Binary file removed Compile/devkitARM_r20-win32.exe
Binary file not shown.
Binary file removed Compile/libfat-nds-20070127.tar.bz2
Binary file not shown.
Binary file removed Compile/libnds-20071023.tar.bz2
Binary file not shown.
188 changes: 163 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,57 +1,195 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
.SECONDARY:

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

include $(DEVKITARM)/ds_rules

export TARGET := PicodriveGBMacro
export TOPDIR := $(CURDIR)
export VERSION_MAJOR := 2
export VERSION_MINOR := 0
export VERSION_PATCH := 2


VERSION := $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
#---------------------------------------------------------------------------------
# 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
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
#---------------------------------------------------------------------------------
TARGET := PicoDrive_GBMacro
BUILD := build
SOURCES := source
DATA := data gfx_bin

#---------------------------------------------------------------------------------
# path to tools - this can be deleted if you set the path in windows
# options for code generation
#---------------------------------------------------------------------------------
export PATH := $(DEVKITARM)/bin:$(PATH)
ARCH := -mthumb -mthumb-interwork

CFLAGS := -g -Wall -O2 \
-ffunction-sections -fdata-sections \
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=c++1z

.PHONY: $(TARGET).arm7 $(TARGET).arm9
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g -Wl,--gc-sections $(ARCH) -Wl,-Map,$(notdir $*.map)

#---------------------------------------------------------------------------------
# version number
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
export VERSION := 0.1.8
LIBS := -lfat -lmm9 -lnds9


#---------------------------------------------------------------------------------
# main targets
# 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
#---------------------------------------------------------------------------------
all: $(TARGET).ds.gba
padbin 256 $(TARGET).nds
padbin 256 $(TARGET).ds.gba
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export TOPDIR := $(CURDIR)

$(TARGET).ds.gba : $(TARGET).nds
export OUTPUT := $(CURDIR)/$(TARGET)

wmb: $(TARGET).nds
sudo $(DEVKITPRO)/devkitARM/bin/beacontest $(TARGET).nds ninusb0
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))

#---------------------------------------------------------------------------------
$(TARGET).nds : $(TARGET).arm7 $(TARGET).arm9
ndstool -o segalogo.bmp -b genesis-32x32.bmp "PicoDriveDS;Version $(VERSION);by Ryan FB" -c $(TARGET).nds -7 $(TARGET).arm7 -9 $(TARGET).arm9
export DEPSDIR := $(CURDIR)/$(BUILD)

ifneq ($(strip $(NITRODATA)),)
export NITRO_FILES := $(CURDIR)/$(NITRODATA)
endif

CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
BMPFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := load.bin bootstub.bin

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
$(TARGET).arm7 : arm7/$(TARGET).elf
$(TARGET).arm9 : arm9/$(TARGET).elf
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

icons := $(wildcard *.bmp)

ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif

export GAME_TITLE := $(TARGET)

.PHONY: bootloader bootstub clean arm7/$(TARGET).elf arm9/$(TARGET).elf

all: $(TARGET).nds

dist: all
@rm -fr hbmenu
@mkdir hbmenu
@cp $(TARGET).nds hbmenu/BOOT.NDS
@cp BootStrap/_BOOT_MP.NDS BootStrap/TTMENU.DAT BootStrap/_DS_MENU.DAT BootStrap/ez5sys.bin BootStrap/akmenu4.nds hbmenu
@tar -cvjf $(TARGET)-$(VERSION).tar.bz2 hbmenu testfiles README.html COPYING hbmenu -X exclude.lst

$(TARGET).nds: $(TARGET).arm7 $(TARGET).arm9
ndstool -o segalogo.bmp -b genesis-32x32.bmp "PicoDriveDS;Version $(VERSION);by Ryan FB" -c $(TARGET).nds -7 $(TARGET).arm7.elf -9 $(TARGET).arm9.elf
# ndstool -u 00030004 -g EPDA 00 "PICODRIVE" -c $(TARGET).nds -7 $(TARGET).arm7.elf -9 $(TARGET).arm9.elf \
# -b genesis-32x32.bmp "PicoDrive TWL; GBMacro Version"
# python27 fix_ndsheader.py $(CURDIR)/$(TARGET).nds

$(TARGET).arm7: arm7/$(TARGET).elf
cp arm7/$(TARGET).elf $(TARGET).arm7.elf

$(TARGET).arm9: arm9/$(TARGET).elf
cp arm9/$(TARGET).elf $(TARGET).arm9.elf

#---------------------------------------------------------------------------------
arm7/$(TARGET).elf:
$(MAKE) -C arm7
@$(MAKE) -C arm7

#---------------------------------------------------------------------------------
arm9/$(TARGET).elf:
$(MAKE) -C arm9
@$(MAKE) -C arm9

#---------------------------------------------------------------------------------
#$(BUILD):
#@[ -d $@ ] || mkdir -p $@
#@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
$(MAKE) -C arm9 clean
$(MAKE) -C arm7 clean
rm -f $(TARGET).ds.gba $(TARGET).nds $(TARGET).arm7 $(TARGET).arm9
@echo clean ...
@rm -fr data
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
@rm -fr $(TARGET).arm7.elf
@rm -fr $(TARGET).arm9.elf
@$(MAKE) -C arm9 clean
@$(MAKE) -C arm7 clean

data:
@mkdir -p data

bootloader: data
@$(MAKE) -C bootloader

bootstub: data
@$(MAKE) -C bootstub

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

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
#$(OUTPUT).nds : $(OUTPUT).elf
#$(OUTPUT).elf : $(OFILES)

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

-include $(DEPSDIR)/*.d

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
Binary file removed PicodriveGBMacro.nds
Binary file not shown.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# PicoDriveTWL (GBMacro edition)

SEGA Genesis emulator for the Nintendo DSi to be used only in lower screen. Only can be launched using TWL in a DSi.
ROM path is /roms/md by default. If it hasn't been created, file explorer starts in root (/)
Loading

0 comments on commit 72bae0b

Please sign in to comment.