Skip to content

Commit

Permalink
4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BernardoGiordano committed Dec 31, 2016
0 parents commit 2a329a3
Show file tree
Hide file tree
Showing 1,899 changed files with 17,171 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

207 changes: 207 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
#---------------------------------------------------------------------------------
.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
DATA := data
INCLUDES := inc
ROMFS := assets/romfs
APP_TITLE := "PKSM"
APP_DESCRIPTION := "AIO tool for Pokemon games"
APP_AUTHOR := "Bernardo Giordano"
APP_PRODUCT_CODE:= CTR-HB-PKSM
APP_UNIQUE_ID := 0xEC100
ICON := assets/icon.png

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)

#---------------------------------------------------------------------------------
# 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 := -lsfil -lsftd -lfreetype -lpng -lz -lsf2d -lcitro3d -lctru -lm

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


#---------------------------------------------------------------------------------
# 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 := $(shell find $(SOURCES) -name '*.c' -printf "%P\n")
CPPFILES := $(shell find $(SOURCES) -name '*.cpp' -printf "%P\n")
SFILES := $(shell find $(SOURCES) -name '*.s' -printf "%P\n")
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)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) \
-I-$(CURDIR)/$(SOURCES)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
$(foreach dir,$(INCLUDES),-L$(CURDIR)/$(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

export _3DSXFLAGS += --smdh=$(OUTPUT).smdh

ifneq ($(ROMFS),)
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
endif

.PHONY: $(BUILD) clean all

#---------------------------------------------------------------------------------
all: $(BUILD)

$(BUILD):
@[ -d $@ ] || mkdir -p $@
@find $(SOURCES) -type d -printf "%P\0" | xargs -0 -I {} mkdir -p $(BUILD)/{}
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -rf $(BUILD) $(OUTPUT).3dsx $(OUTPUT).smdh $(OUTPUT).elf $(OUTPUT).cia

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

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
ifeq ($(strip $(NO_SMDH)),)
.PHONY: all
all : $(OUTPUT).3dsx $(OUTPUT).smdh $(OUTPUT).cia
endif

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

$(OUTPUT).elf : $(OFILES)

#$(TOPDIR)/assets/banner.bin: $(TOPDIR)/assets/banner.png $(TOPDIR)/assets/banner.wav
# @bannertool makebanner -i $(TOPDIR)/assets/banner.png -a $(TOPDIR)/assets/banner.wav -o $(TOPDIR)/assets/banner.bin

#$(TOPDIR)/assets/icon.bin: $(TOPDIR)/assets/icon.png
# @bannertool makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i $(TOPDIR)/assets/icon.png -o $(TOPDIR)/assets/icon.bin

$(OUTPUT)_stripped.elf: $(OUTPUT).elf
@cp $(OUTPUT).elf $(OUTPUT)_stripped.elf
@$(PREFIX)strip $(OUTPUT)_stripped.elf

$(OUTPUT).cia: $(OUTPUT)_stripped.elf $(TOPDIR)/assets/banner.bin $(TOPDIR)/assets/icon.icn
@makerom -f cia -o $(OUTPUT).cia -rsf $(TOPDIR)/assets/cia.rsf -target t -exefslogo -elf $(OUTPUT)_stripped.elf -icon $(TOPDIR)/assets/icon.icn -banner $(TOPDIR)/assets/banner.bin -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(APP_UNIQUE_ID)" -DAPP_ROMFS="$(TOPDIR)/$(ROMFS)"
@echo "built ... $(notdir $@)"

#---------------------------------------------------------------------------------
# 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 $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin
@bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
@echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
@rm ../$(notdir $<).shbin

-include $(DEPENDS)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
Binary file added PKSM/3ds/PKSM/PKSM.3dsx
Binary file not shown.
Binary file added PKSM/3ds/PKSM/PKSM.smdh
Binary file not shown.
1 change: 1 addition & 0 deletions PKSM/3ds/PKSM/PKSM.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<targets selectable="true"></targets>
Binary file added PKSM/PKSM.cia
Binary file not shown.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ![pksm](assets/bannersite.png) ![pksm](assets/banner.png)

**Editor**, **wondercard injector** and **offline homebrew bank**.

## Installation

**If you already installed the 4.0.0alpha**: remove your ` /3ds/data/PKSM/additionalassets/ ` folder before installing, in order to avoid edge-case graphic glitches.

Download and install the latest release (4.0.0) with your favourite installation method. When booted, the application will download automatically the required additional assets from a third party source. You can provide your own assets, if you want.

If you're using Homebrew Launcher, make sure you have it updated to the [latest version](https://smealum.github.io/ninjhax2/starter.zip).

If you're using Homebrew Launcher and you don't have the latest firmware on your console, you may want to use **ctr-httpwn** to get internet access and let the application download everything correctly. If you can't still download them through the application, you can put them manually in the SD card, putting the external [additionalassets](https://github.com/dsoldier/PKResources) folder in your SD card, located at ` /3ds/data/PKSM/ `. To avoid troubles, the final result should be a folder filled with assets, located at ` /3ds/data/PKSM/additionalassets/ `.

## Compiling

You need devKitPro, ctrulib, sf2d, sfil, sftd and Xerpi's portlibs to be able to compile this.

## Screenshots

![pksm](resources/01.png) ![pksm](resources/02.png)
![pksm](resources/03.png) ![pksm](resources/04.png)
![pksm](resources/05.png) ![pksm](resources/06.png)
![pksm](resources/07.png) ![pksm](resources/08.png)
![pksm](resources/09.png) ![pksm](resources/10.png)
![pksm](resources/11.png) ![pksm](resources/12.png)
![pksm](resources/13.png)

## Credits

* @dsoldier for the gorgeous graphic work
* Smealum for ctrulib, Xerpi for sf2d
* Kaphotics for PKHeX and being an awesome guy
* SciresM for C-memecrypto, you rock man
* J-K-D for direct save import/export and being awesome
* Slashcash for PCHex++ and Strackeror for PCHex
* Gocario for PKBrew
* TuxSH for TWLSaveTool
* MarcusD for romfs support
* Nba_Yoh for received flags fix
* Hamcha for cybertrust.h and digicert.h
* PPorg for most of wc6/wc7 included here
* Simona, Carlo, Matteo for fill.c work
* Shai, Federico, YodaDaCoda, /u/SatansRoommate for tests
* Alex, Immersion, Hat3Mond4ys, sgtkwol for descriptions
* Paul, Kian for a few wc6
* Majickhat55 for few collections and descriptions
* Poutros for N's collection

## License

This file is part of PKSM

Copyright (C) 2016 Bernardo Giordano

> This program is free software: you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> the Free Software Foundation, either version 3 of the License, or
> (at your option) any later version.
>
> This program is distributed in the hope that it will be useful,
> but WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> GNU General Public License for more details.
>
> You should have received a copy of the GNU General Public License
> along with this program. If not, see <http://www.gnu.org/licenses/>.
> See LICENSE for information.
Binary file added assets/audio.wav
Binary file not shown.
Binary file added assets/banner.bin
Binary file not shown.
Binary file added assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/bannersite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/buildbd.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@bannertool makebanner -i banner.png -a audio.wav -o banner.bin
@bannertool makesmdh -s "PKSM" -l "AIO tool for Pokemon games" -p "Bernardo Giordano" -i icon.png -o icon.icn
pause
Binary file added assets/icon.icn
Binary file not shown.
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions assets/romfs/database/1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
0001 - Birthday Pokemon

Pokemon: Pikachu & Eevolutions
Level: 10
Ability: Various
Held Item: None
TID: 10123, 10014, 10015
SID: 00001
OT: ?????
Met: a Pokemon Center
Nature: Random
Ribbon: Birthday Ribbon

Relearn Moves:
Games: XY ORAS - Celebrate
Method: Infrared
Region: All
Duration:
18 changes: 18 additions & 0 deletions assets/romfs/database/100.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
0100 - 7/11 Pancham (Serena)

Pokemon: Pancham
Level: 30
Ability: Mold Breaker
Held Item: Black Glasses
TID: 00711
SID: 00100
OT: ???
Met: a lovely place
Nature: Adamant
Ribbon: Wishing Ribbon

Relearn Moves:
Games: XY/ORAS - Arm Thrust
Method: Serial Code - Stone Edge
Region: JPN - Dark Pulse
Duration: Jul 18 to Sep 30, 2015
18 changes: 18 additions & 0 deletions assets/romfs/database/101.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
0101 - 7/11 Lugia

Pokemon: Lugia
Level: 50
Ability: Pressure
Held Item: Leftovers
TID: 00711
SID: 00101
OT: 7 SPOT
Met: a lovely place
Nature: Timid
Ribbon: Wishing Ribbon

Relearn Moves:
Games: XY/ORAS - Aeroblast
Method: Serial Code - Hydro Pump
Region: JPN - Dragon Rush
Duration: Aug 1 to Sep 30, 2015 - Ice Beam
18 changes: 18 additions & 0 deletions assets/romfs/database/102.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
0102 - 7/11 Latios

Pokemon: Latios
Level: 50
Ability: Levitate
Held Item: Latiosite
TID: 00711
SID: 00102
OT: 7 SPOT
Met: a lovely place
Nature: Modest
Ribbon: Wishing Ribbon

Relearn Moves:
Games: XY/ORAS - Dragon Pulse
Method: Serial Code - Luster Purge
Region: JPN - Psychic
Duration: Aug 1 to Sep 30, 2015 - Heal Pulse
18 changes: 18 additions & 0 deletions assets/romfs/database/1060.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
1060 - XY&Z Xerneas

Pokemon: Xerneas
Level: 100
Ability: Fairy Aura
Held Item: No Item
TID: 03226
SID: 01060
OT: XY&Z
Met: a Pokemon Event
Nature: Any Nature
Ribbon: Classic

Relearn Moves:
Games: ORAS - Geomancy
Method: Universal Serial Code - Moonblast
Region: KOR - Aromatherapy
Duration: Mar 22 to Jun 30, 2016 - Focus Blast
Loading

0 comments on commit 2a329a3

Please sign in to comment.