Skip to content

Commit

Permalink
Initial Release
Browse files Browse the repository at this point in the history
I don't know what to write
  • Loading branch information
Jpe230 committed Jun 21, 2018
1 parent 45e94a1 commit a218c59
Show file tree
Hide file tree
Showing 219 changed files with 2,067 additions and 1 deletion.
200 changes: 200 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

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

TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_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
# EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm".
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
#
# NO_ICON: if set to anything, do not use icon.
# NO_NACP: if set to anything, no .nacp file is generated.
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
# ICON is the filename of the icon (.jpg), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.jpg
# - icon.jpg
# - <libnx folder>/default_icon.jpg
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
EXEFS_SRC := exefs_src
ROMFS := romfs

APP_TITLE := BOTW UI
APP_AUTHOR := Jpe230
APP_VERSION := 0.2
ICON := meta/icon.jpg

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE

CFLAGS := -g -Wall -O2 -ffunction-sections \
$(ARCH) $(DEFINES)

CFLAGS += $(INCLUDE) -D__SWITCH__

CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11

ASFLAGS := -g $(ARCH)

LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map)

LIBS := -lSDL2_ttf -lSDL2_gfx -lSDL2_image \
-lpng -ljpeg `sdl2-config --libs` `freetype-config --libs` -lnx

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


#---------------------------------------------------------------------------------
# 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_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))

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)

export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC)

ifeq ($(strip $(ICON)),)
icons := $(wildcard *.jpg)
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
else
ifneq (,$(findstring icon.jpg,$(icons)))
export APP_ICON := $(TOPDIR)/icon.jpg
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif

ifeq ($(strip $(NO_ICON)),)
export NROFLAGS += --icon=$(APP_ICON)
endif

ifeq ($(strip $(NO_NACP)),)
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
endif

ifneq ($(APP_TITLEID),)
export NACPFLAGS += --titleid=$(APP_TITLEID)
endif

ifneq ($(ROMFS),)
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
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).pfs0 $(TARGET).nso $(TARGET).nro $(TARGET).nacp $(TARGET).elf


#---------------------------------------------------------------------------------
else
.PHONY: all

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

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
all : $(OUTPUT).pfs0 $(OUTPUT).nro

$(OUTPUT).pfs0 : $(OUTPUT).nso

$(OUTPUT).nso : $(OUTPUT).elf

ifeq ($(strip $(NO_NACP)),)
$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
else
$(OUTPUT).nro : $(OUTPUT).elf
endif

$(OUTPUT).elf : $(OFILES)

$(OFILES_SRC) : $(HFILES_BIN)

#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
# BOTW Save Editor GUI
# Legend of Zelda Breath of the Wild Save File Editor GUI (WIP)

<img style="float: right;" src="meta/icon.jpg">

A Work in Progress Save Editor, currently it only to modifies rupees, durability of weapons, arrows and modifiers.


# Intructions

- Open BOTW with your current user. Wait until the title screen, then exit it. (Close the game, too).
- Open the Save Editor and select your save file slot. (DPAD Left/Right, A to Enter) .
- Use DPAD to navigate between the items. (Press A to select an item, B to deselect it).
- When a keyboard shows up, press A to select an input, B to close the Keyboard.
- Press + to exit the program.


# Compile

- Use LibNX.

# Disclaimer

- Please always make a backup before editing your save file; I'm not responsible for any lost save file.
- This is a WIP, it contains bugs.
- Your Switch can catch on fire by using this.

# To Do

- Make backups for the save files.
- Add more items.
- Add buttons hints at the bottom of the screen.

# Credits

- Starbucks: For having free internet
- Marcrobledo: For the amazing work reverse-engineering the save file (also for the assets used jeje)
- Joel-16: For the SDL Helper code






66 changes: 66 additions & 0 deletions include/MainMenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#ifndef _MAINMENU_H_
#define _MAINMENU_H_

#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL_image.h>
#include "translations.h"
#include "botw_backend.h"

SDL_Window* window;
SDL_Surface* screenSurface;
SDL_Renderer* renderer;
TTF_Font *Arial, *Arial_S, *Arial_M;
SDL_Texture *sprites[200];
SDL_Texture *GreenRupee;
SDL_Texture *back;
SDL_Texture *bbutton;
SDL_Texture *okbutton;
SDL_Texture *bbuttonp;
SDL_Texture *okbuttonp;
SDL_Texture *check;

int isArrow;


static inline SDL_Color SDL_MakeColor(Uint8 r, Uint8 g, Uint8 b)
{
SDL_Color colour = {r, g, b};
return colour;
}


#define TOPBAR_COLOR SDL_MakeColor(45,45,45)
#define ALERT_COLOR SDL_MakeColor(32,32,32)
#define LEFTBAR_COLOR SDL_MakeColor(50,50,50)
#define BACKGROUND_COLOR SDL_MakeColor(45,45,45)
#define ITEM_COLOR SDL_MakeColor(47,47,47)
#define WHITE_TEXT_COLOR SDL_MakeColor(235,235,235)
#define WHITE_COLOR SDL_MakeColor(254, 254, 254)
#define BLACK_COLOR SDL_MakeColor(1,1,1)
#define BLUE_TEXT_COLOR SDL_MakeColor(1,254,203)



void SDL_ClearScreen(SDL_Renderer* renderer, SDL_Color colour);
void SDL_DrawRect(SDL_Renderer* renderer, int x, int y, int w, int h, SDL_Color colour);
void SDL_DrawText(TTF_Font *font, int x, int y, SDL_Color colour, const char *text);
void setMenuItems(int x, int page);
void setPageBar(int page, int mPage);
void mainUI(int x, int currentPage, int MaxPage,int showBox, int BoxPos);
SDL_Surface *SDL_LoadImage(SDL_Renderer* renderer, SDL_Texture **texture, char *path);
void SDL_DrawImage(SDL_Renderer* renderer, SDL_Texture *texture, int x, int y, int w, int h);
void showItemSDL(int currentItem, int arrow);
void selectSlotMenu(int slotchar);
void showKeyboard(int currentKey);
void errorScreen();
void showKeyboard();
void showCurrentRup();
void KeyboardScreen();
void showBoxSelect(int pos);
void Show_DropDownMenu(int pos);
void Show_DropDownMenuMod(int pos);
void printText(int textNum);
void exitMenu(int pos);

#endif
51 changes: 51 additions & 0 deletions include/botw_backend.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef _BOTW_BACKEND_H_
#define _BOTW_BACKEND_H_

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "mount.h"



char itemName[60][40];
long int quantItems[60];
long int newQuantItems[60];
int numberOfItems;

long int rupeeValue;
long int rupees;

int rupID[7];
int itemsID[7];
int itemsQuant[7];
int header[7];
char versionArray[7][5];

int FLAGS_WEAPON[7];
int FLAGSV_WEAPON[7];
int FLAGS_BOW[7];
int FLAGSV_BOW[7];
int FLAGS_SHIELD[7];
int FLAGSV_SHIELD[7];

int numberOfWeapons;
int numberOfBows;
int numberOfShields;

long int quantMod[60];
long int new_quantMod[60];
long int modNames[60];
long int new_modNames[60];


int maxArrows;
int version;

FILE *fp;

int setFile();
void getData();
void writeFile();

#endif
Loading

0 comments on commit a218c59

Please sign in to comment.