First
@@ -0,0 +1,11 @@
|
||||
*.bin
|
||||
*.d
|
||||
*.o
|
||||
*.smdh
|
||||
*.elf
|
||||
*.cia
|
||||
*.3dsx
|
||||
*/build
|
||||
build/sprites.h
|
||||
*.map
|
||||
*.lst
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"*.tcc": "cpp",
|
||||
"cctype": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"cstdarg": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cstring": "cpp",
|
||||
"ctime": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"exception": "cpp",
|
||||
"fstream": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"memory": "cpp",
|
||||
"new": "cpp",
|
||||
"ostream": "cpp",
|
||||
"sstream": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"valarray": "cpp",
|
||||
"array": "cpp",
|
||||
"atomic": "cpp",
|
||||
"bit": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"deque": "cpp",
|
||||
"forward_list": "cpp",
|
||||
"map": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"functional": "cpp",
|
||||
"iterator": "cpp",
|
||||
"memory_resource": "cpp",
|
||||
"numeric": "cpp",
|
||||
"optional": "cpp",
|
||||
"random": "cpp",
|
||||
"string": "cpp",
|
||||
"string_view": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"utility": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"bitset": "cpp",
|
||||
"chrono": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"ratio": "cpp",
|
||||
"regex": "cpp",
|
||||
"shared_mutex": "cpp"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Make",
|
||||
"command": "make",
|
||||
"args": ["-s"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "silent"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Veuillez régler DEVKITARM dans votre environnement. export DEVKITARM = <chemin vers> devkitARM")
|
||||
endif
|
||||
|
||||
TOPDIR ?= $(CURDIR)
|
||||
include $(DEVKITARM)/3ds_rules
|
||||
|
||||
# ------------------------------------------------- --------------------------------
|
||||
# TARGET est le nom de la sortie
|
||||
# BUILD est le répertoire dans lequel les fichiers objets et les fichiers intermédiaires seront placés
|
||||
# SOURCES est une liste de répertoires contenant le code source
|
||||
# DATA est une liste de répertoires contenant des fichiers de données
|
||||
# INCLUDES est une liste de répertoires contenant des fichiers d'en-tête
|
||||
# GRAPHICS est une liste de répertoires contenant des fichiers graphiques
|
||||
# GFXBUILD est le répertoire dans lequel les fichiers graphiques convertis seront placés
|
||||
# S'il est défini sur $ (BUILD), il sera lié statiquement dans le fichier converti
|
||||
# fichiers comme s'il s'agissait de fichiers de données.
|
||||
#
|
||||
# NO_SMDH: s'il est défini sur quelque chose, aucun fichier SMDH n'est généré.
|
||||
# ROMFS est le répertoire qui contient le RomFS, relatif au Makefile (facultatif)
|
||||
# APP_TITLE est le nom de l'application stockée dans le fichier SMDH (facultatif)
|
||||
# APP_DESCRIPTION est la description de l'application stockée dans le fichier SMDH (facultatif)
|
||||
# APP_AUTHOR est l'auteur de l'application stockée dans le fichier SMDH (facultatif)
|
||||
# ICON est le nom de fichier de l'icône (.png), relatif au dossier du projet.
|
||||
# S'il n'est pas défini, il tente d'utiliser l'un des éléments suivants (dans cet ordre):
|
||||
# - <Nom du projet> .png
|
||||
# - icon.png
|
||||
# - <dossier libctru> /default_icon.png
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Outils externes
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(OS),Windows_NT)
|
||||
MAKEROM ?= ../makerom.exe
|
||||
BANNERTOOL ?= ../bannertool.exe
|
||||
|
||||
else
|
||||
MAKEROM ?= makerom
|
||||
BANNERTOOL ?= bannertool
|
||||
|
||||
endif
|
||||
|
||||
CURRENT_VERSION := $(shell git describe --abbrev=0 --tags)
|
||||
|
||||
# Si sur un commit taggé, utilisez le tag au lieu du commit
|
||||
ifneq ($(shell echo $(shell git tag -l --points-at HEAD) | head -c 1),)
|
||||
GIT_VER := $(shell git tag -l --points-at HEAD)
|
||||
else
|
||||
GIT_VER := $(shell git describe --abbrev=0 --tags)-$(shell git rev-parse --short HEAD)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Version number
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(shell echo $(shell git describe --tags) | head -c 2 | tail -c 1),)
|
||||
VERSION_MAJOR := $(shell echo $(shell git describe --tags) | head -c 2 | tail -c 1)
|
||||
else
|
||||
VERSION_MAJOR := 0
|
||||
endif
|
||||
|
||||
ifneq ($(shell echo $(shell git describe --tags) | head -c 4 | tail -c 1),)
|
||||
VERSION_MINOR := $(shell echo $(shell git describe --tags) | head -c 4 | tail -c 1)
|
||||
else
|
||||
VERSION_MINOR := 0
|
||||
endif
|
||||
|
||||
ifneq ($(shell echo $(shell git describe --tags) | head -c 6 | tail -c 1),)
|
||||
VERSION_MICRO := $(shell echo $(shell git describe --tags) | head -c 6 | tail -c 1)
|
||||
else
|
||||
VERSION_MICRO := 0
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := GhostEshop
|
||||
BUILD := build
|
||||
UNIVCORE := Universal-Core
|
||||
SOURCES := $(UNIVCORE) source source/download source/gui source/lang source/menu source/overlays \
|
||||
source/qr source/screens source/store source/utils
|
||||
DATA := data
|
||||
INCLUDES := $(UNIVCORE) include include/download include/gui include/lang include/overlays include/qr include/screens \
|
||||
include/store include/utils
|
||||
GRAPHICS := assets/gfx
|
||||
ROMFS := romfs
|
||||
GFXBUILD := $(ROMFS)/gfx
|
||||
APP_AUTHOR := Ghost Eshop Team's
|
||||
APP_DESCRIPTION := An Alternative eShop for Nintendo 3DS
|
||||
ICON := app/icon.png
|
||||
BNR_IMAGE := app/banner.png
|
||||
BNR_AUDIO := app/BannerAudio.wav
|
||||
RSF_FILE := app/build-cia.rsf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options de génération de code
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
|
||||
|
||||
CFLAGS := -g -Wall -Wno-psabi -O2 -mword-relocations \
|
||||
-DV_STRING=\"$(GIT_VER)\" \
|
||||
-DC_V=\"$(CURRENT_VERSION)\" \
|
||||
-fomit-frame-pointer -ffunction-sections \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -D_GNU_SOURCE=1
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
LIBS := -lcurl -lmbedtls -lmbedx509 -lmbedcrypto -larchive -lbz2 -llzma -lm -lz -lcitro2d -lcitro3d -lctru -lstdc++
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# liste de répertoires contenant des bibliothèques, ce doit être le niveau supérieur contenant
|
||||
# include et lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(PORTLIBS) $(CTRULIB)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# pas vraiment besoin de modifier quoi que ce soit au-delà de ce point, sauf si vous devez ajouter des
|
||||
# règles pour différentes extensions de fichiers
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export TOPDIR := $(CURDIR)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(GRAPHICS),$(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)))
|
||||
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica)))
|
||||
SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist)))
|
||||
GFXFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.t3s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# utiliser CXX pour lier des projets C ++, CC pour le C standard
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(GFXBUILD),$(BUILD))
|
||||
#---------------------------------------------------------------------------------
|
||||
export T3XFILES := $(GFXFILES:.t3s=.t3x)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export ROMFS_T3XFILES := $(patsubst %.t3s, $(GFXBUILD)/%.t3x, $(GFXFILES))
|
||||
export T3XHFILES := $(patsubst %.t3s, $(BUILD)/%.h, $(GFXFILES))
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \
|
||||
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o)
|
||||
|
||||
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
|
||||
|
||||
export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(SHLISTFILES:.shlist=_shbin.h) \
|
||||
$(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 _3DSXDEPS := $(if $(NO_SMDH),,$(OUTPUT).smdh)
|
||||
|
||||
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
|
||||
|
||||
ifeq ($(strip $(NO_SMDH)),)
|
||||
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
|
||||
endif
|
||||
|
||||
ifneq ($(ROMFS),)
|
||||
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
|
||||
endif
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES)
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf
|
||||
@rm -fr $(OUTDIR)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
cia: $(BUILD)
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile cia
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
3dsx: $(BUILD)
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 3dsx
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(GFXBUILD)/%.t3x $(BUILD)/%.h : %.t3s
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(DEVKITPRO)/tools/bin/tex3ds -i $< -H $(BUILD)/$*.h -d $(DEPSDIR)/$*.d -o $(GFXBUILD)/$*.t3x
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# cibles principales
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(OUTPUT).cia $(OUTPUT).elf $(OUTPUT).3dsx
|
||||
|
||||
$(OUTPUT).elf : $(OFILES)
|
||||
|
||||
$(OUTPUT).cia : $(OUTPUT).elf $(OUTPUT).smdh
|
||||
$(BANNERTOOL) makebanner -i "../app/banner.png" -a "../app/BannerAudio.wav" -o "../app/banner.bin"
|
||||
|
||||
$(BANNERTOOL) makesmdh -i "../app/icon.png" -s "$(TARGET)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -o "../app/icon.bin" \
|
||||
--flags visible,ratingrequired,recordusage --cero 153 --esrb 153 --usk 153 --pegigen 153 --pegiptr 153 --pegibbfc 153 --cob 153 --grb 153 --cgsrr 153
|
||||
|
||||
$(MAKEROM) -f cia -target t -exefslogo -o "../$(TARGET).cia" -elf "../$(TARGET).elf" -rsf "../app/build-cia.rsf" -banner "../app/banner.bin" -icon "../app/icon.bin" -logo "../app/logo.bcma.lz" -DAPP_ROMFS="$(TOPDIR)/$(ROMFS)" -major $(VERSION_MAJOR) -minor $(VERSION_MINOR) -DAPP_VERSION_MAJOR="$(VERSION_MAJOR)"
|
||||
#---------------------------------------------------------------------------------
|
||||
# vous avez besoin d'une règle comme celle-ci pour chaque extension que vous utilisez comme données binaires
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
.PRECIOUS : %.t3x
|
||||
#---------------------------------------------------------------------------------
|
||||
%.t3x.o %_t3x.h : %.t3x
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# règles d'assemblage de shaders GPU
|
||||
#---------------------------------------------------------------------------------
|
||||
define shader-as
|
||||
$(eval CURBIN := $*.shbin)
|
||||
$(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d)
|
||||
echo "$(CURBIN).o: $< $1" > $(DEPSFILE)
|
||||
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
|
||||
picasso -o $(CURBIN) $1
|
||||
bin2s $(CURBIN) | $(AS) -o $*.shbin.o
|
||||
endef
|
||||
|
||||
%.shbin.o %_shbin.h : %.v.pica %.g.pica
|
||||
@echo $(notdir $^)
|
||||
@$(call shader-as,$^)
|
||||
|
||||
%.shbin.o %_shbin.h : %.v.pica
|
||||
@echo $(notdir $<)
|
||||
@$(call shader-as,$<)
|
||||
|
||||
%.shbin.o %_shbin.h : %.shlist
|
||||
@echo $(notdir $<)
|
||||
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.t3x %.h : %.t3s
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@tex3ds -i $< -H $*.h -d $*.d -o $*.t3x
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"string": "cpp"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Universal-Core by Universal-Team
|
||||
This contains the GUI & Core part for our 3DS Applications.
|
||||
|
||||
Logo created by: [TotallyNotGuy](https://github.com/TotallyNotGuy).
|
||||
|
||||

|
||||
|
||||
Licensing:
|
||||
This software is licensed under the terms of the GPLv3. You can find a copy of the license in the LICENSE file.
|
||||
@@ -0,0 +1,501 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#include "gui.hpp"
|
||||
#include "screenCommon.hpp"
|
||||
|
||||
#include <3ds.h>
|
||||
#include <stack>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
C3D_RenderTarget *Top, *TopRight, *Bottom;
|
||||
|
||||
C2D_TextBuf TextBuf;
|
||||
C2D_Font Font;
|
||||
std::unique_ptr<Screen> usedScreen, tempScreen; // tempScreen used for "fade" effects.
|
||||
std::stack<std::unique_ptr<Screen>> screens;
|
||||
bool currentScreen = false;
|
||||
bool fadeout = false, fadein = false, fadeout2 = false, fadein2 = false;
|
||||
int fadealpha = 0;
|
||||
int fadecolor = 0;
|
||||
|
||||
/*
|
||||
Clear the Text Buffer.
|
||||
*/
|
||||
void Gui::clearTextBufs(void) { C2D_TextBufClear(TextBuf); };
|
||||
|
||||
/*
|
||||
Draw a sprite from the sheet.
|
||||
|
||||
C2D_SpriteSheet sheet: The SpriteSheet.
|
||||
size_t imgindex: The image index.
|
||||
int x: The X-Position where to draw the sprite.
|
||||
int y: The Y-Position where to draw the sprite.
|
||||
float ScaleX: The X-Scale of the sprite.
|
||||
float ScaleY: The Y-Scale of the sprite.
|
||||
|
||||
If the spritesheet is nullptr or image index goes out of scope, this doesn't do anything.
|
||||
*/
|
||||
void Gui::DrawSprite(C2D_SpriteSheet sheet, size_t imgindex, int x, int y, float ScaleX, float ScaleY) {
|
||||
if (sheet) {
|
||||
if (C2D_SpriteSheetCount(sheet) >= imgindex) {
|
||||
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sheet, imgindex), x, y, 0.5f, nullptr, ScaleX, ScaleY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Initialize the GUI.
|
||||
|
||||
Contains initializing Citro2D, Citro3D and the screen targets.
|
||||
Call this when initing the app.
|
||||
*/
|
||||
Result Gui::init(void) {
|
||||
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
|
||||
C2D_Init(C2D_DEFAULT_MAX_OBJECTS);
|
||||
C2D_Prepare();
|
||||
|
||||
/* Create Screen Targets. */
|
||||
Top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
|
||||
TopRight = C2D_CreateScreenTarget(GFX_TOP, GFX_RIGHT);
|
||||
Bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT);
|
||||
|
||||
/* Load Textbuffer. */
|
||||
TextBuf = C2D_TextBufNew(4096);
|
||||
Font = C2D_FontLoadSystem(CFG_REGION_USA); // Load System font.
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Load a bcfnt font.
|
||||
|
||||
C2D_Font &fnt: The reference to the C2D_Font variable.
|
||||
const char *Path: The path to the file.
|
||||
*/
|
||||
Result Gui::loadFont(C2D_Font &fnt, const char *Path) {
|
||||
if (access(Path, F_OK) == 0) fnt = C2D_FontLoad(Path); // Only load if found.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Unload a Font.
|
||||
|
||||
C2D_Font &fnt: The reference to the C2D_Font variable.
|
||||
*/
|
||||
Result Gui::unloadFont(C2D_Font &fnt) {
|
||||
if (fnt) C2D_FontFree(fnt); // Make sure to only unload if not nullptr.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Load a t3x SpriteSheet.
|
||||
|
||||
const char *Path: The path to the file.
|
||||
C2D_SpriteSheet &sheet: The reference to the C2D_SpriteSheet variable.
|
||||
*/
|
||||
Result Gui::loadSheet(const char *Path, C2D_SpriteSheet &sheet) {
|
||||
if (access(Path, F_OK) == 0) sheet = C2D_SpriteSheetLoad(Path); // Only load if found.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Unload a SpriteSheet.
|
||||
|
||||
C2D_SpriteSheet &sheet: The reference to the C2D_SpriteSheet variable.
|
||||
*/
|
||||
Result Gui::unloadSheet(C2D_SpriteSheet &sheet) {
|
||||
if (sheet) C2D_SpriteSheetFree(sheet); // Make sure to only unload if not nullptr.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Exit the GUI.
|
||||
|
||||
Contains deinitializing Citro2D, Citro3D and clearing the textbuffer.
|
||||
Call this when exiting the app.
|
||||
*/
|
||||
void Gui::exit(void) {
|
||||
C2D_TextBufDelete(TextBuf);
|
||||
C2D_Fini();
|
||||
C3D_Fini();
|
||||
if (usedScreen) usedScreen = nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
Reinitialize the GUI.
|
||||
*/
|
||||
Result Gui::reinit(void) {
|
||||
C2D_TextBufDelete(TextBuf);
|
||||
C2D_Fini();
|
||||
C3D_Fini();
|
||||
|
||||
return Gui::init();
|
||||
}
|
||||
|
||||
/*
|
||||
Draw a Centered String.
|
||||
|
||||
float x: The X-Addition offset for the position from 200 (top) or 160 (bottom).
|
||||
float y: The Y-Position where to draw.
|
||||
float size: The size for the Font.
|
||||
u32 color: The Text Color.
|
||||
std::string Text: The Text which should be drawn.
|
||||
int maxWidth: (Optional) The max width of the Text.
|
||||
int maxHeight: (Optional) The max height of the Text.
|
||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||
int flags: (Optional) C2D text flags to use.
|
||||
*/
|
||||
void Gui::DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight, C2D_Font fnt, int flags) {
|
||||
Gui::DrawString(x +(currentScreen ? 200 : 160), y, size, color, Text, maxWidth, maxHeight, fnt, flags | C2D_AlignCenter);
|
||||
}
|
||||
|
||||
/*
|
||||
Draw a String.
|
||||
|
||||
float x: The X-Position where to draw.
|
||||
float y: The Y-Position where to draw.
|
||||
float size: The size for the Font.
|
||||
u32 color: The Text Color.
|
||||
std::string Text: The Text which should be drawn.
|
||||
int maxWidth: (Optional) The max width of the Text.
|
||||
int maxHeight: (Optional) The max height of the Text.
|
||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||
int flags: (Optional) C2D text flags to use.
|
||||
*/
|
||||
void Gui::DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight, C2D_Font fnt, int flags) {
|
||||
C2D_Text c2d_text;
|
||||
|
||||
if (fnt) C2D_TextFontParse(&c2d_text, fnt, TextBuf, Text.c_str());
|
||||
else C2D_TextFontParse(&c2d_text, Font, TextBuf, Text.c_str());
|
||||
|
||||
C2D_TextOptimize(&c2d_text);
|
||||
|
||||
float heightScale;
|
||||
|
||||
if (maxHeight == 0) {
|
||||
heightScale = size;
|
||||
|
||||
} else {
|
||||
if (fnt) heightScale = std::min(size, size*(maxHeight/Gui::GetStringHeight(size, Text, fnt)));
|
||||
else heightScale = std::min(size, size*(maxHeight/Gui::GetStringHeight(size, Text)));
|
||||
}
|
||||
|
||||
if (maxWidth == 0) {
|
||||
C2D_DrawText(&c2d_text, C2D_WithColor | flags, x, y, 0.5f, size, heightScale, color);
|
||||
} else if (flags & C2D_WordWrap) {
|
||||
C2D_DrawText(&c2d_text, C2D_WithColor | flags, x, y, 0.5f, size, heightScale, color, (float)maxWidth);
|
||||
} else {
|
||||
if (fnt) C2D_DrawText(&c2d_text, C2D_WithColor | flags, x, y, 0.5f, std::min(size, size*(maxWidth/Gui::GetStringWidth(size, Text, fnt))), heightScale, color);
|
||||
else C2D_DrawText(&c2d_text, C2D_WithColor | flags, x, y, 0.5f, std::min(size, size*(maxWidth/Gui::GetStringWidth(size, Text))), heightScale, color);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Get String or Text Width.
|
||||
|
||||
float size: The Textsize.
|
||||
std::string Text: The Text.
|
||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||
*/
|
||||
float Gui::GetStringWidth(float size, std::string Text, C2D_Font fnt) {
|
||||
float width = 0;
|
||||
|
||||
if (fnt) GetStringSize(size, &width, NULL, Text, fnt);
|
||||
else GetStringSize(size, &width, NULL, Text);
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
/*
|
||||
Get String or Text Size.
|
||||
|
||||
float size: The Textsize.
|
||||
float *width: Pointer where to store the width.
|
||||
float *height: Pointer where to store the height.
|
||||
std::string Text: The Text.
|
||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||
*/
|
||||
void Gui::GetStringSize(float size, float *width, float *height, std::string Text, C2D_Font fnt) {
|
||||
C2D_Text c2d_text;
|
||||
|
||||
if (fnt) C2D_TextFontParse(&c2d_text, fnt, TextBuf, Text.c_str());
|
||||
else C2D_TextFontParse(&c2d_text, Font, TextBuf, Text.c_str());
|
||||
|
||||
C2D_TextGetDimensions(&c2d_text, size, size, width, height);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get String or Text Height.
|
||||
|
||||
float size: The Textsize.
|
||||
std::string Text: The Text.
|
||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||
*/
|
||||
float Gui::GetStringHeight(float size, std::string Text, C2D_Font fnt) {
|
||||
float height = 0;
|
||||
|
||||
if (fnt) GetStringSize(size, NULL, &height, Text.c_str(), fnt);
|
||||
else GetStringSize(size, NULL, &height, Text.c_str());
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
/*
|
||||
Draw a Rectangle.
|
||||
|
||||
float x: The X-Position where to draw.
|
||||
float y: The Y-Position where to draw.
|
||||
float w: The width of the rectangle.
|
||||
float h: The height of the rectangle.
|
||||
u32 color: The color.
|
||||
*/
|
||||
bool Gui::Draw_Rect(float x, float y, float w, float h, u32 color) {
|
||||
return C2D_DrawRectSolid(x, y, 0.5f, w, h, color);
|
||||
}
|
||||
|
||||
/*
|
||||
Draw's the current screen's draw.
|
||||
|
||||
bool stack: If using the stack-screens or not.
|
||||
*/
|
||||
void Gui::DrawScreen(bool stack) {
|
||||
if (!stack) {
|
||||
if (usedScreen) usedScreen->Draw();
|
||||
|
||||
} else {
|
||||
if (!screens.empty()) screens.top()->Draw();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Do the current screen's logic.
|
||||
|
||||
u32 hDown: The hidKeysDown() variable.
|
||||
u32 hHeld: The hidKeysHeld() variable.
|
||||
touchPosition touch: The touchPosition variable.
|
||||
bool waitFade: If waiting for the fade until control of the screen or not.
|
||||
bool stack: If using the stack-screens.
|
||||
*/
|
||||
void Gui::ScreenLogic(u32 hDown, u32 hHeld, touchPosition touch, bool waitFade, bool stack) {
|
||||
if (waitFade) {
|
||||
if (!fadein && !fadeout && !fadein2 && !fadeout2) {
|
||||
if (!stack) if (usedScreen) usedScreen->Logic(hDown, hHeld, touch);
|
||||
|
||||
} else {
|
||||
if (!screens.empty()) screens.top()->Logic(hDown, hHeld, touch);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!stack) {
|
||||
if (usedScreen) usedScreen->Logic(hDown, hHeld, touch);
|
||||
|
||||
} else {
|
||||
if (!screens.empty()) screens.top()->Logic(hDown, hHeld, touch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Move's the tempScreen to the used one.
|
||||
|
||||
bool stack: If using the stack-screens or not.
|
||||
*/
|
||||
void Gui::transferScreen(bool stack) {
|
||||
if (!stack) {
|
||||
if (tempScreen) usedScreen = std::move(tempScreen);
|
||||
|
||||
} else {
|
||||
if (tempScreen) screens.push(std::move(tempScreen));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Set the current Screen.
|
||||
|
||||
std::unique_ptr<Screen> screen: The screen class.
|
||||
bool fade: If doing a fade effect or not.
|
||||
bool stack: If using the stack-screens or not.
|
||||
*/
|
||||
void Gui::setScreen(std::unique_ptr<Screen> screen, bool fade, bool stack) {
|
||||
tempScreen = std::move(screen);
|
||||
|
||||
/* Switch screen without fade. */
|
||||
if (!fade) {
|
||||
Gui::transferScreen(stack);
|
||||
|
||||
} else {
|
||||
/* Fade, then switch. */
|
||||
fadeout = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Fade's the screen in and out and transfer the screen.
|
||||
Credits goes to RocketRobz & SavvyManager.
|
||||
|
||||
int fadeoutFrames: The fadeout frames.
|
||||
int fadeinFrames: The fadein frames.
|
||||
bool stack: If using the stack-screens or not. (Used to properly transfer screens).
|
||||
*/
|
||||
void Gui::fadeEffects(int fadeoutFrames, int fadeinFrames, bool stack) {
|
||||
if (fadein) {
|
||||
fadealpha -= fadeinFrames;
|
||||
|
||||
if (fadealpha < 0) {
|
||||
fadealpha = 0;
|
||||
fadecolor = 255;
|
||||
fadein = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (stack) {
|
||||
if (fadein2) {
|
||||
fadealpha -= fadeinFrames;
|
||||
|
||||
if (fadealpha < 0) {
|
||||
fadealpha = 0;
|
||||
fadecolor = 255;
|
||||
fadein2 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fadeout) {
|
||||
fadealpha += fadeoutFrames;
|
||||
|
||||
if (fadealpha > 255) {
|
||||
fadealpha = 255;
|
||||
Gui::transferScreen(stack); // Transfer Temp screen to the stack / used one.
|
||||
fadein = true;
|
||||
fadeout = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (stack) {
|
||||
if (fadeout2) {
|
||||
fadealpha += fadeoutFrames;
|
||||
|
||||
if (fadealpha > 255) {
|
||||
fadealpha = 255;
|
||||
Gui::screenBack2(); // Go screen back.
|
||||
fadein2 = true;
|
||||
fadeout2 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Go a screen back. (Stack only!)
|
||||
|
||||
bool fade: If doing a fade or not.
|
||||
*/
|
||||
void Gui::screenBack(bool fade) {
|
||||
if (!fade) {
|
||||
if (screens.size() > 0) screens.pop();
|
||||
|
||||
} else {
|
||||
if (screens.size() > 0) fadeout2 = true;
|
||||
}
|
||||
}
|
||||
void Gui::screenBack2() { if (screens.size() > 0) screens.pop(); };
|
||||
|
||||
/*
|
||||
Select, on which Screen should be drawn.
|
||||
|
||||
C3D_RenderTarget *screen: The render target.
|
||||
*/
|
||||
void Gui::ScreenDraw(C3D_RenderTarget *screen) {
|
||||
C2D_SceneBegin(screen);
|
||||
currentScreen = (screen == Top || screen == TopRight) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Draw a grid.
|
||||
|
||||
float xPos: The X-Position of the grid.
|
||||
float yPos: The Y-Position of the grid.
|
||||
float Width: The width of the grid.
|
||||
float Height: The height of the grid.
|
||||
u32 color: The color of the grid.
|
||||
u32 bgColor: The BG Color of the grid.
|
||||
*/
|
||||
void Gui::drawGrid(float xPos, float yPos, float Width, float Height, u32 color, u32 bgColor) {
|
||||
static constexpr int w = 1;
|
||||
|
||||
/* BG Color for the Grid. (Transparent by default.) */
|
||||
Gui::Draw_Rect(xPos, yPos, Width, Height, bgColor);
|
||||
|
||||
/* Grid part, Top. */
|
||||
Gui::Draw_Rect(xPos, yPos, Width, w, color);
|
||||
/* Left. */
|
||||
Gui::Draw_Rect(xPos, yPos + w, w, Height - 2 * w, color);
|
||||
/* Right. */
|
||||
Gui::Draw_Rect(xPos + Width - w, yPos + w, w, Height - 2 * w, color);
|
||||
/* Bottom. */
|
||||
Gui::Draw_Rect(xPos, yPos + Height - w, Width, w, color);
|
||||
}
|
||||
|
||||
/*
|
||||
Draw an animated selector.
|
||||
|
||||
float xPos: The X-Position of the selector.
|
||||
float yPos: The Y-Position of the selector.
|
||||
float Width: The width of the selector.
|
||||
float Height: The height of the selector.
|
||||
float speed: The selector animation speed. Use .030f or so.
|
||||
u32 SelectorColor: The selector fade color.
|
||||
u32 bgColor: The selector BG color.
|
||||
*/
|
||||
void Gui::drawAnimatedSelector(float xPos, float yPos, float Width, float Height, float speed, u32 SelectorColor, u32 bgColor) {
|
||||
static constexpr int w = 2;
|
||||
static float timer = 0.0f;
|
||||
float highlight_multiplier = fmax(0.0, fabs(fmod(timer, 1.0) - 0.5) / 0.5);
|
||||
u8 r = SelectorColor & 0xFF;
|
||||
u8 g = (SelectorColor >> 8) & 0xFF;
|
||||
u8 b = (SelectorColor >> 16) & 0xFF;
|
||||
u32 color = C2D_Color32(r + (255 - r) * highlight_multiplier, g + (255 - g) * highlight_multiplier, b + (255 - b) * highlight_multiplier, 255);
|
||||
|
||||
/* BG Color for the Selector. */
|
||||
Gui::Draw_Rect(xPos, yPos, Width, Height, bgColor);
|
||||
|
||||
/* Selector part, Top. */
|
||||
Gui::Draw_Rect(xPos, yPos, Width, w, color);
|
||||
/* Left. */
|
||||
Gui::Draw_Rect(xPos, yPos + w, w, Height - 2 * w, color);
|
||||
/* Right. */
|
||||
Gui::Draw_Rect(xPos + Width - w, yPos + w, w, Height - 2 * w, color);
|
||||
/* Bottom. */
|
||||
Gui::Draw_Rect(xPos, yPos + Height - w, Width, w, color);
|
||||
|
||||
timer += speed;
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_CORE_GUI_HPP
|
||||
#define _UNIVERSAL_CORE_GUI_HPP
|
||||
|
||||
#include "screen.hpp"
|
||||
|
||||
#include <3ds.h>
|
||||
#include <citro2d.h>
|
||||
#include <citro3d.h>
|
||||
|
||||
namespace Gui {
|
||||
/*
|
||||
Clear the Text Buffer.
|
||||
*/
|
||||
void clearTextBufs(void);
|
||||
|
||||
/*
|
||||
Draw a sprite from a SpriteSheet.
|
||||
sheet: The SpriteSheet which should be used.
|
||||
imgIndex: The index of the sprite from the sheet which should be drawn.
|
||||
x: The X Position where the sprite should be drawn.
|
||||
y: The Y Position where the sprite should be drawn.
|
||||
ScaleX: The X-Scale for the sprite. (Optional!)
|
||||
ScaleY: The Y-Scale for the sprite. (Optional!)
|
||||
*/
|
||||
void DrawSprite(C2D_SpriteSheet sheet, size_t imgindex, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
|
||||
/*
|
||||
Initialize the GUI with Citro2D & Citro3D and initialize the Textbuffer.
|
||||
call this when initializing.
|
||||
*/
|
||||
Result init(void);
|
||||
|
||||
/*
|
||||
Load a Font. (BCFNT)
|
||||
|
||||
fnt: The C2D_Font variable which should be initialized.
|
||||
Path: Path to the BCFNT file.
|
||||
if you're unsure, just call 'Gui::init();' and it will load the system font.
|
||||
*/
|
||||
Result loadFont(C2D_Font &fnt, const char *Path = "");
|
||||
|
||||
/*
|
||||
Unload a Font. (BCFNT)
|
||||
|
||||
fnt: The C2D_Font variable which should be unloaded.
|
||||
*/
|
||||
Result unloadFont(C2D_Font &fnt);
|
||||
|
||||
/*
|
||||
Load a spritesheet.
|
||||
|
||||
Path: Path to the SpriteSheet file. (T3X)
|
||||
sheet: Reference to the C2D_SpriteSheet declaration.
|
||||
*/
|
||||
Result loadSheet(const char *Path, C2D_SpriteSheet &sheet);
|
||||
|
||||
/*
|
||||
Unload a spritesheet.
|
||||
|
||||
sheet: Reference to the C2D_SpriteSheet which should be free'd.
|
||||
*/
|
||||
Result unloadSheet(C2D_SpriteSheet &sheet);
|
||||
|
||||
/*
|
||||
Exit the GUI.
|
||||
Call this at exit.
|
||||
*/
|
||||
void exit(void);
|
||||
|
||||
/*
|
||||
Reinit the GUI.
|
||||
*/
|
||||
Result reinit(void);
|
||||
|
||||
/*
|
||||
Draws a centered String.
|
||||
x: The X Offset from center. (Center: 200 px on top, 160 px on Bottom.)
|
||||
y: The Y Position of the Text.
|
||||
size: The size of the Text.
|
||||
color: The Color of the Text.
|
||||
Text: The Text which should be displayed.
|
||||
maxWidth: The maxWidth for the Text. (Optional!)
|
||||
maxHeight: The maxHeight of the Text. (Optional!)
|
||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
int flags: C2D text flags to use. (Optional!)
|
||||
*/
|
||||
void DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr, int flags = 0);
|
||||
|
||||
/*
|
||||
Draws a String.
|
||||
|
||||
x: The X Position where the Text should be drawn.
|
||||
y: The Y Position where the Text should be drawn.
|
||||
size: The size of the Text.
|
||||
color: The Color of the Text.
|
||||
Text: The Text which should be displayed.
|
||||
maxWidth: The maxWidth for the Text. (Optional!)
|
||||
maxHeight: The maxHeight of the Text. (Optional!)
|
||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
flags: C2D text flags to use.
|
||||
*/
|
||||
void DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr, int flags = 0);
|
||||
|
||||
/*
|
||||
Get the width of a String.
|
||||
|
||||
size: The size of the Text.
|
||||
Text: The Text where the width should be getted from.
|
||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
*/
|
||||
float GetStringWidth(float size, std::string Text, C2D_Font fnt = nullptr);
|
||||
|
||||
/*
|
||||
Get the size of a String.
|
||||
|
||||
size: The size of the Text.
|
||||
width: The width of the Text.
|
||||
height: The height of the Text.
|
||||
Text: The Text where the size should be getted from.
|
||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
*/
|
||||
void GetStringSize(float size, float *width, float *height, std::string Text, C2D_Font fnt = nullptr);
|
||||
|
||||
/*
|
||||
Get the height of a String.
|
||||
|
||||
size: The size of the Text.
|
||||
Text: The Text where the height should be getted from.
|
||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
*/
|
||||
float GetStringHeight(float size, std::string Text, C2D_Font fnt = nullptr);
|
||||
|
||||
/*
|
||||
Draw a Rectangle.
|
||||
|
||||
x: X Position of the Rectangle.
|
||||
y: Y Position of the Rectangle.
|
||||
w: The width of the rectangle.
|
||||
h: The height of the rectangle.
|
||||
color: The color of the rectangle.
|
||||
*/
|
||||
bool Draw_Rect(float x, float y, float w, float h, u32 color);
|
||||
|
||||
/*
|
||||
Used for the current Screen's Draw. (Optional!)
|
||||
stack: Is it the stack variant?
|
||||
*/
|
||||
void DrawScreen(bool stack = false);
|
||||
|
||||
/*
|
||||
Used for the current Screen's Logic. (Optional!)
|
||||
|
||||
hDown: the hidKeysDown() variable.
|
||||
hHeld: the HidKeysHeld() variable.
|
||||
touch: The TouchPosition variable.
|
||||
waitFade: Wheter to wait until the fade ends.
|
||||
stack: Is it the stack variant?
|
||||
*/
|
||||
void ScreenLogic(u32 hDown, u32 hHeld, touchPosition touch, bool waitFade = true, bool stack = false);
|
||||
|
||||
/*
|
||||
Transfer the Temp Screen to the used one. (Optional!)
|
||||
|
||||
stack: Is it the stack variant?
|
||||
It will check, if the tempScreen variable is not nullptr, so don't worry.
|
||||
*/
|
||||
void transferScreen(bool stack = false);
|
||||
|
||||
/*
|
||||
Set a specific Screen with switch function. (Optional!)
|
||||
|
||||
screen: unique_ptr of the screen. (Optional by using the screen class.)
|
||||
screenSwitch: Wheter to switch to the current screen.
|
||||
stack: Is it the stack variant?
|
||||
*/
|
||||
void setScreen(std::unique_ptr<Screen> screen, bool fade = false, bool stack = false);
|
||||
|
||||
/*
|
||||
Fades into screens and calls the constructor after it. (Optional!)
|
||||
fadeoutFrames: Amount of frames for fadeout.
|
||||
fadeinFrames: Amount of frames for fadein.
|
||||
stack: Is it the stack variant?
|
||||
*/
|
||||
void fadeEffects(int fadeoutFrames = 6, int fadeinFrames = 6, bool stack = false);
|
||||
|
||||
void screenBack(bool fade = false); // Goes a screen back. (Set!) (Stack only!)
|
||||
void screenBack2(); // Goes a screen back.(Action!) (Stack only!)
|
||||
|
||||
/*
|
||||
Set on which screen to draw.
|
||||
|
||||
screen: The render target. (Targets are inside the screenCommon.hpp file.)
|
||||
*/
|
||||
void ScreenDraw(C3D_RenderTarget * screen);
|
||||
|
||||
/*
|
||||
Draws a grid.
|
||||
xPos: X Position of the grid.
|
||||
yPos: Y Position of the grid.
|
||||
Width: Width of the grid.
|
||||
Height: Height of the grid.
|
||||
color: Color of the grid.
|
||||
bgColor: The BG Color from the grid. (Optional! It's transparent by default.)
|
||||
*/
|
||||
void drawGrid(float xPos, float yPos, float Width, float Height, u32 color, u32 bgColor = C2D_Color32(0, 0, 0, 0));
|
||||
|
||||
/*
|
||||
Draws an animated selector.
|
||||
xPos: X Position of the selector.
|
||||
yPos: Y Position of the Selector.
|
||||
Width: Width of the Selector.
|
||||
Height: Height of the Selector.
|
||||
speed: The speed of the animation. (Use .030f or something by default.)
|
||||
SelectorColor: The Color of the Selector outline.
|
||||
bgColor: The BG Color from the selector. (Optional! It's transparent by default.)
|
||||
*/
|
||||
void drawAnimatedSelector(float xPos, float yPos, float Width, float Height, float speed, u32 SelectorColor, u32 bgColor = C2D_Color32(0, 0, 0, 0));
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_CORE_SCREEN_HPP
|
||||
#define _UNIVERSAL_CORE_SCREEN_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include <memory>
|
||||
|
||||
class Screen {
|
||||
public:
|
||||
virtual ~Screen() {}
|
||||
virtual void Logic(u32 hDown, u32 hHeld, touchPosition touch) = 0;
|
||||
virtual void Draw() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_CORE_SCREENCOMMON_HPP
|
||||
#define _UNIVERSAL_CORE_SCREENCOMMON_HPP
|
||||
|
||||
#include "gui.hpp"
|
||||
#include "structs.hpp"
|
||||
|
||||
extern C3D_RenderTarget *Top, *TopRight, *Bottom;
|
||||
extern bool fadeout, fadein, fadeout2, fadein2;
|
||||
extern int fadealpha, fadecolor;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_CORE_STRUCTS_HPP
|
||||
#define _UNIVERSAL_CORE_STRUCTS_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
class Structs {
|
||||
public:
|
||||
struct ButtonPos {
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
};
|
||||
|
||||
struct Key {
|
||||
std::string character;
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
After Width: | Height: | Size: 156 KiB |
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,285 @@
|
||||
BasicInfo:
|
||||
Title : "GHOST-HBGEGET"
|
||||
ProductCode : "CTR-H-GHOST"
|
||||
Logo : Homebrew # Nintendo / Licensed / Distributed / iQue / iQueForSystem
|
||||
|
||||
RomFs:
|
||||
RootPath: "../romfs"
|
||||
|
||||
TitleInfo:
|
||||
Category : Application
|
||||
UniqueId : 0x73926
|
||||
|
||||
Option:
|
||||
UseOnSD : true # true si l'application doit être installée sur SD
|
||||
FreeProductCode : true # Supprime les limitations sur ProductCode
|
||||
MediaFootPadding : false # Si de vrais fichiers CCI sont créés avec un remplissage
|
||||
EnableCrypt : false # Active le cryptage pour NCCH et CIA
|
||||
EnableCompress : true # Compresse le cas échéant (actuellement uniquement exefs: /. Code)
|
||||
|
||||
AccessControlInfo:
|
||||
CoreVersion : 2
|
||||
|
||||
# Version du format Exheader
|
||||
DescVersion : 2
|
||||
|
||||
# Version minimale requise du noyau (ci-dessous est pour 4.5.0)
|
||||
ReleaseKernelMajor : "02"
|
||||
ReleaseKernelMinor : "33"
|
||||
|
||||
# ExtData
|
||||
UseExtSaveData : false # active ExtData
|
||||
#ExtSaveDataId : 0x300 # définissez ceci uniquement lorsque l'ID est différent de UniqueId
|
||||
|
||||
# FS: autorisations d'accès aux archives USER
|
||||
# Décommenter si nécessaire
|
||||
FileSystemAccess:
|
||||
- CategorySystemApplication
|
||||
- CategoryHardwareCheck
|
||||
- CategoryFileSystemTool
|
||||
- Debug
|
||||
- TwlCardBackup
|
||||
- TwlNandData
|
||||
#- Boss
|
||||
- DirectSdmc
|
||||
- Core
|
||||
#- CtrNandRo
|
||||
#- CtrNandRw
|
||||
#- CtrNandRoWrite
|
||||
- CategorySystemSettings
|
||||
#- CardBoard
|
||||
#- ExportImportIvs
|
||||
- DirectSdmcWrite
|
||||
#- SwitchCleanup
|
||||
#- SaveDataMove
|
||||
#- Shop
|
||||
#- Shell
|
||||
#- CategoryHomeMenu
|
||||
#- SeedDB
|
||||
IoAccessControl:
|
||||
#- FsMountNand
|
||||
#- FsMountNandRoWrite
|
||||
- FsMountTwln
|
||||
#- FsMountWnand
|
||||
- FsMountCardSpi
|
||||
- UseSdif3
|
||||
#- CreateSeed
|
||||
- UseCardSpi
|
||||
|
||||
# Paramètres de processus
|
||||
MemoryType : Application # Application/System/Base
|
||||
SystemMode : 64MB # 64MB(Defaut)/96MB/80MB/72MB/32MB
|
||||
IdealProcessor : 0
|
||||
AffinityMask : 1
|
||||
Priority : 16
|
||||
MaxCpu : 0x9E # Defaut
|
||||
HandleTableSize : 0x200
|
||||
DisableDebug : false
|
||||
EnableForceDebug : false
|
||||
CanWriteSharedPage : true
|
||||
CanUsePrivilegedPriority : false
|
||||
CanUseNonAlphabetAndNumber : true
|
||||
PermitMainFunctionArgument : true
|
||||
CanShareDeviceMemory : true
|
||||
RunnableOnSleep : false
|
||||
SpecialMemoryArrange : true
|
||||
|
||||
# Paramètres de processus exclusifs New3DS
|
||||
SystemModeExt : Legacy # Legacy (par défaut) / 124 Mo / 178 Mo Legacy: utilisez le mode système Old3DS
|
||||
CpuSpeed : 804MHz # 268MHz(Defaut)/804MHz
|
||||
EnableL2Cache : true # false (par défaut) / true
|
||||
CanAccessCore2 : true
|
||||
|
||||
# Correspondances d’adresses virtuelles
|
||||
IORegisterMapping:
|
||||
- 1ff00000-1ff7ffff # DSP memory
|
||||
MemoryMapping:
|
||||
- 1f000000-1f5fffff:r # VRAM
|
||||
|
||||
# SVC accessibles, <Name>:<ID>
|
||||
SystemCallAccess:
|
||||
ControlMemory: 1
|
||||
QueryMemory: 2
|
||||
ExitProcess: 3
|
||||
GetProcessAffinityMask: 4
|
||||
SetProcessAffinityMask: 5
|
||||
GetProcessIdealProcessor: 6
|
||||
SetProcessIdealProcessor: 7
|
||||
CreateThread: 8
|
||||
ExitThread: 9
|
||||
SleepThread: 10
|
||||
GetThreadPriority: 11
|
||||
SetThreadPriority: 12
|
||||
GetThreadAffinityMask: 13
|
||||
SetThreadAffinityMask: 14
|
||||
GetThreadIdealProcessor: 15
|
||||
SetThreadIdealProcessor: 16
|
||||
GetCurrentProcessorNumber: 17
|
||||
Run: 18
|
||||
CreateMutex: 19
|
||||
ReleaseMutex: 20
|
||||
CreateSemaphore: 21
|
||||
ReleaseSemaphore: 22
|
||||
CreateEvent: 23
|
||||
SignalEvent: 24
|
||||
ClearEvent: 25
|
||||
CreateTimer: 26
|
||||
SetTimer: 27
|
||||
CancelTimer: 28
|
||||
ClearTimer: 29
|
||||
CreateMemoryBlock: 30
|
||||
MapMemoryBlock: 31
|
||||
UnmapMemoryBlock: 32
|
||||
CreateAddressArbiter: 33
|
||||
ArbitrateAddress: 34
|
||||
CloseHandle: 35
|
||||
WaitSynchronization1: 36
|
||||
WaitSynchronizationN: 37
|
||||
SignalAndWait: 38
|
||||
DuplicateHandle: 39
|
||||
GetSystemTick: 40
|
||||
GetHandleInfo: 41
|
||||
GetSystemInfo: 42
|
||||
GetProcessInfo: 43
|
||||
GetThreadInfo: 44
|
||||
ConnectToPort: 45
|
||||
SendSyncRequest1: 46
|
||||
SendSyncRequest2: 47
|
||||
SendSyncRequest3: 48
|
||||
SendSyncRequest4: 49
|
||||
SendSyncRequest: 50
|
||||
OpenProcess: 51
|
||||
OpenThread: 52
|
||||
GetProcessId: 53
|
||||
GetProcessIdOfThread: 54
|
||||
GetThreadId: 55
|
||||
GetResourceLimit: 56
|
||||
GetResourceLimitLimitValues: 57
|
||||
GetResourceLimitCurrentValues: 58
|
||||
GetThreadContext: 59
|
||||
Break: 60
|
||||
OutputDebugString: 61
|
||||
ControlPerformanceCounter: 62
|
||||
CreatePort: 71
|
||||
CreateSessionToPort: 72
|
||||
CreateSession: 73
|
||||
AcceptSession: 74
|
||||
ReplyAndReceive1: 75
|
||||
ReplyAndReceive2: 76
|
||||
ReplyAndReceive3: 77
|
||||
ReplyAndReceive4: 78
|
||||
ReplyAndReceive: 79
|
||||
BindInterrupt: 80
|
||||
UnbindInterrupt: 81
|
||||
InvalidateProcessDataCache: 82
|
||||
StoreProcessDataCache: 83
|
||||
FlushProcessDataCache: 84
|
||||
StartInterProcessDma: 85
|
||||
StopDma: 86
|
||||
GetDmaState: 87
|
||||
RestartDma: 88
|
||||
DebugActiveProcess: 96
|
||||
BreakDebugProcess: 97
|
||||
TerminateDebugProcess: 98
|
||||
GetProcessDebugEvent: 99
|
||||
ContinueDebugEvent: 100
|
||||
GetProcessList: 101
|
||||
GetThreadList: 102
|
||||
GetDebugThreadContext: 103
|
||||
SetDebugThreadContext: 104
|
||||
QueryDebugProcessMemory: 105
|
||||
ReadProcessMemory: 106
|
||||
WriteProcessMemory: 107
|
||||
SetHardwareBreakPoint: 108
|
||||
GetDebugThreadParam: 109
|
||||
ControlProcessMemory: 112
|
||||
MapProcessMemory: 113
|
||||
UnmapProcessMemory: 114
|
||||
CreateCodeSet: 115
|
||||
CreateProcess: 117
|
||||
TerminateProcess: 118
|
||||
SetProcessResourceLimits: 119
|
||||
CreateResourceLimit: 120
|
||||
SetResourceLimitValues: 121
|
||||
AddCodeSegment: 122
|
||||
Backdoor: 123
|
||||
KernelSetState: 124
|
||||
QueryProcessMemory: 125
|
||||
|
||||
# Liste des services
|
||||
# 34 services maximum (32 si le micrologiciel est antérieur à la version 9.6.0)
|
||||
ServiceAccessControl:
|
||||
- APT:U
|
||||
- ac:u
|
||||
- am:net
|
||||
#- boss:U
|
||||
#- cam:u
|
||||
#- cecd:u
|
||||
#- cfg:nor
|
||||
- cfg:u
|
||||
#- csnd:SND
|
||||
- dsp::DSP
|
||||
#- frd:u
|
||||
- fs:USER
|
||||
- gsp::Gpu
|
||||
- gsp::Lcd
|
||||
- hid:USER
|
||||
- http:C
|
||||
#- ir:rst
|
||||
#- ir:u
|
||||
#- ir:USER
|
||||
#- mic:u
|
||||
#- ndm:u
|
||||
#- news:s
|
||||
- nwm::EXT
|
||||
- nwm::UDS
|
||||
- ptm:sysm
|
||||
- ptm:u
|
||||
- pxi:dev
|
||||
- soc:U
|
||||
- ssl:C
|
||||
#- y2r:u
|
||||
|
||||
|
||||
SystemControlInfo:
|
||||
SaveDataSize: 0KB # Change if the app uses savedata
|
||||
RemasterVersion: $(APP_VERSION_MAJOR)
|
||||
StackSize: 0x40000
|
||||
|
||||
# Les modules qui exécutent les services énumérés ci-dessus doivent être inclus sous
|
||||
# 48 dépendances maximum
|
||||
# <module name>:<module titleid>
|
||||
Dependency:
|
||||
ac: 0x0004013000002402
|
||||
#act: 0x0004013000003802
|
||||
am: 0x0004013000001502
|
||||
boss: 0x0004013000003402
|
||||
camera: 0x0004013000001602
|
||||
cecd: 0x0004013000002602
|
||||
cfg: 0x0004013000001702
|
||||
codec: 0x0004013000001802
|
||||
csnd: 0x0004013000002702
|
||||
dlp: 0x0004013000002802
|
||||
dsp: 0x0004013000001a02
|
||||
friends: 0x0004013000003202
|
||||
gpio: 0x0004013000001b02
|
||||
gsp: 0x0004013000001c02
|
||||
hid: 0x0004013000001d02
|
||||
http: 0x0004013000002902
|
||||
i2c: 0x0004013000001e02
|
||||
ir: 0x0004013000003302
|
||||
mcu: 0x0004013000001f02
|
||||
mic: 0x0004013000002002
|
||||
ndm: 0x0004013000002b02
|
||||
news: 0x0004013000003502
|
||||
#nfc: 0x0004013000004002
|
||||
nim: 0x0004013000002c02
|
||||
nwm: 0x0004013000002d02
|
||||
pdn: 0x0004013000002102
|
||||
ps: 0x0004013000003102
|
||||
ptm: 0x0004013000002202
|
||||
#qtm: 0x0004013020004202
|
||||
ro: 0x0004013000003702
|
||||
socket: 0x0004013000002e02
|
||||
spi: 0x0004013000002302
|
||||
ssl: 0x0004013000002f02
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,37 @@
|
||||
--atlas -f rgba -z auto
|
||||
|
||||
sprites/add.png
|
||||
sprites/add_font.png
|
||||
sprites/arrow.png
|
||||
sprites/checked.png
|
||||
sprites/delete.png
|
||||
sprites/download.png
|
||||
sprites/info.png
|
||||
sprites/keyboard.png
|
||||
sprites/list.png
|
||||
sprites/noIcon.png
|
||||
sprites/notes.png
|
||||
sprites/qr_code.png
|
||||
sprites/queue0.png
|
||||
sprites/queue1.png
|
||||
sprites/queue2.png
|
||||
sprites/queue3.png
|
||||
sprites/queue4.png
|
||||
sprites/queue5.png
|
||||
sprites/queue6.png
|
||||
sprites/queue7.png
|
||||
sprites/screenshot.png
|
||||
sprites/search.png
|
||||
sprites/settings.png
|
||||
sprites/shortcut.png
|
||||
sprites/sort.png
|
||||
sprites/sort_checked.png
|
||||
sprites/sort_unchecked.png
|
||||
sprites/toggle_off.png
|
||||
sprites/toggle_on.png
|
||||
sprites/unchecked.png
|
||||
sprites/GhosteShop.png
|
||||
sprites/GhosteShop-core.png
|
||||
sprites/update.png
|
||||
sprites/update_app.png
|
||||
sprites/update_filter.png
|
||||
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 310 B |
|
After Width: | Height: | Size: 338 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 250 B |
|
After Width: | Height: | Size: 395 B |
|
After Width: | Height: | Size: 951 B |
|
After Width: | Height: | Size: 894 B |
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 187 B |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 311 B |
|
After Width: | Height: | Size: 377 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 459 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 287 B |
|
After Width: | Height: | Size: 978 B |
|
After Width: | Height: | Size: 245 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 436 B |
|
After Width: | Height: | Size: 593 B |
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 336 B |
|
After Width: | Height: | Size: 427 B |
|
After Width: | Height: | Size: 260 B |
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
make clean
|
||||
del ghosteshop.cia
|
||||
del ghosteshop.3dsx
|
||||
del ghosteshop.smdh
|
||||
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
make
|
||||
pause
|
||||
@@ -0,0 +1,3 @@
|
||||
files:
|
||||
- source: /romfs/lang/en/app.json
|
||||
translation: /romfs/lang/%two_letters_code%/app.json
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_COMMON_HPP
|
||||
#define _GHOST_ESHOP_COMMON_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include "config.hpp"
|
||||
#include "gfx.hpp"
|
||||
#include "lang.hpp"
|
||||
#include "msg.hpp"
|
||||
#include "screenCommon.hpp"
|
||||
|
||||
#define _STORE_PATH "sdmc:/3ds/GhosteShop/stores/"
|
||||
#define _META_PATH "sdmc:/3ds/GhosteShop/MetaData.json"
|
||||
#define _ESHOP_VERSION 4
|
||||
|
||||
inline std::unique_ptr<Config> config;
|
||||
inline uint32_t hRepeat, hDown, hHeld;
|
||||
inline touchPosition touch;
|
||||
inline C2D_Font font;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_GFX_HPP
|
||||
#define _GHOST_ESHOP_GFX_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "sprites.h"
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
|
||||
/*
|
||||
Définissez toutes les couleurs utilisées, pour des changements plus faciles.
|
||||
*/
|
||||
|
||||
/* Couleurs Standard. */
|
||||
#define WHITE C2D_Color32(255, 255, 255, 255)
|
||||
#define BLACK C2D_Color32(0, 0, 0, 255)
|
||||
#define TRANSPARENT C2D_Color32(0, 0, 0, 0)
|
||||
#define DIM_COLOR C2D_Color32(0, 0, 0, 190)
|
||||
|
||||
/* Barres, Textes, BG Couleurs. */
|
||||
#define TEXT_COLOR WHITE
|
||||
#define BAR_COLOR C2D_Color32(50, 73, 98, 255)
|
||||
#define BAR_OUTL_COLOR C2D_Color32(25, 30, 53, 255)
|
||||
#define BG_COLOR C2D_Color32(255, 125, 0, 255)
|
||||
|
||||
/* Entrée Des Couleurs. */
|
||||
#define ENTRY_BAR_COLOR BAR_COLOR
|
||||
#define ENTRY_BAR_OUTL_COLOR BAR_OUTL_COLOR
|
||||
|
||||
/* Entrée Des Couleurs De La Boîte. */
|
||||
#define BOX_INSIDE_COLOR C2D_Color32(28, 33, 58, 255)
|
||||
#define BOX_SELECTED_COLOR C2D_Color32(108, 130, 155, 255)
|
||||
#define BOX_UNSELECTED_COLOR BLACK
|
||||
|
||||
/* Couleurs De La Barre De Progression. */
|
||||
#define PROGRESSBAR_OUT_COLOR BOX_INSIDE_COLOR
|
||||
#define PROGRESSBAR_IN_COLOR SIDEBAR_UNSELECTED_COLOR
|
||||
|
||||
/* Couleurs du menu de recherche. */
|
||||
#define SEARCH_BAR_COLOR C2D_Color32(51, 75, 102, 255)
|
||||
#define SEARCH_BAR_OUTL_COLOR BAR_OUTL_COLOR
|
||||
|
||||
/* Sidebar Couleurs. */
|
||||
#define SIDEBAR_SELECTED_COLOR C2D_Color32(108, 130, 155, 255)
|
||||
#define SIDEBAR_UNSELECTED_COLOR C2D_Color32(77, 101, 128, 255)
|
||||
|
||||
namespace GFX {
|
||||
void DrawTop(void);
|
||||
void DrawBottom();
|
||||
void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
void DrawBox(float xPos, float yPos, float width = 50, float height = 50, bool selected = false, uint32_t clr = BOX_INSIDE_COLOR);
|
||||
void DrawCheckbox(float xPos, float yPos, bool selected);
|
||||
void DrawToggle(float xPos, float yPos, bool toggled);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_MSG_HPP
|
||||
#define _GHOST_ESHOP_MSG_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Msg {
|
||||
void DisplayMsg(const std::string &Text);
|
||||
void DisplayWarnMsg(const std::string &Text);
|
||||
bool promptMsg(const std::string &promptMsg);
|
||||
void waitMsg(const std::string &msg);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_INIT_HPP
|
||||
#define _GHOST_ESHOP_INIT_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
namespace Init {
|
||||
Result Initialize();
|
||||
Result MainLoop();
|
||||
Result Exit();
|
||||
|
||||
void LoadFont();
|
||||
void UnloadFont();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_KEYBOARD_HPP
|
||||
#define _GHOST_ESHOP_KEYBOARD_HPP
|
||||
|
||||
#include "storeEntry.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace Input {
|
||||
std::string setkbdString(uint maxLength, const std::string &Text, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_OVERLAY_HPP
|
||||
#define _GHOST_ESHOP_OVERLAY_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "store.hpp"
|
||||
#include "storeEntry.hpp"
|
||||
#include <3ds.h>
|
||||
|
||||
namespace Overlays {
|
||||
void SelectStore(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta);
|
||||
void SelectLanguage(const std::unique_ptr<Store> &store);
|
||||
void ShowCredits();
|
||||
std::string SelectDir(const std::string &oldDir, const std::string &msg, const std::unique_ptr<Store> &store);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of PKSM
|
||||
* Copyright (C) 2016-2020 Bernardo Giordano, Admiral Fish, piepie62
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_QR_CODE_HPP
|
||||
#define _GHOST_ESHOP_QR_CODE_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "quirc.hpp"
|
||||
#include <atomic>
|
||||
#include <3ds.h>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
class QRCode {
|
||||
public:
|
||||
QRCode();
|
||||
~QRCode();
|
||||
|
||||
void drawThread();
|
||||
void captureThread();
|
||||
void handler(std::string &result);
|
||||
bool done() const { return this->finished; };
|
||||
bool cancelled() const { return this->cancel; };
|
||||
void List(bool v) { this->displayList = v; };
|
||||
private:
|
||||
void buffToImage();
|
||||
void finish();
|
||||
std::array<u16, 400 * 240> cameraBuffer;
|
||||
LightLock bufferLock;
|
||||
C2D_Image image;
|
||||
LightLock imageLock;
|
||||
quirc *qrData;
|
||||
Handle exitEvent;
|
||||
static constexpr Tex3DS_SubTexture subtex = { 512, 256, 0.0f, 1.0f, 1.0f, 0.0f };
|
||||
std::atomic<bool> finished = false;
|
||||
bool capturing = false;
|
||||
bool cancel = false;
|
||||
bool displayList = false;
|
||||
int selectedStore = 0, sPos = 0;
|
||||
std::vector<StoreList> stores = { };
|
||||
std::vector<u8> out;
|
||||
};
|
||||
|
||||
/*
|
||||
This is, what should get called.
|
||||
*/
|
||||
namespace QR_Scanner {
|
||||
std::string StoreHandle();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
/* quirc -- QR-code recognition library
|
||||
* Copyright (C) 2010-2012 Daniel Beer <dlbeer@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QUIRC_HPP
|
||||
#define QUIRC_HPP
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct quirc;
|
||||
|
||||
/* Obtain the library version string. */
|
||||
const char *quirc_version(void);
|
||||
|
||||
/* Construct a new QR-code recognizer. This function will return NULL
|
||||
* if sufficient memory could not be allocated.
|
||||
*/
|
||||
struct quirc *quirc_new(void);
|
||||
|
||||
/* Destroy a QR-code recognizer. */
|
||||
void quirc_destroy(struct quirc *q);
|
||||
|
||||
/* Resize the QR-code recognizer. The size of an image must be
|
||||
* specified before codes can be analyzed.
|
||||
*
|
||||
* This function returns 0 on success, or -1 if sufficient memory could
|
||||
* not be allocated.
|
||||
*/
|
||||
int quirc_resize(struct quirc *q, int w, int h);
|
||||
|
||||
/* These functions are used to process images for QR-code recognition.
|
||||
* quirc_begin() must first be called to obtain access to a buffer into
|
||||
* which the input image should be placed. Optionally, the current
|
||||
* width and height may be returned.
|
||||
*
|
||||
* After filling the buffer, quirc_end() should be called to process
|
||||
* the image for QR-code recognition. The locations and content of each
|
||||
* code may be obtained using accessor functions described below.
|
||||
*/
|
||||
uint8_t *quirc_begin(struct quirc *q, int *w, int *h);
|
||||
void quirc_end(struct quirc *q);
|
||||
|
||||
/* This structure describes a location in the input image buffer. */
|
||||
struct quirc_point {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
/* This enum describes the various decoder errors which may occur. */
|
||||
typedef enum {
|
||||
QUIRC_SUCCESS = 0,
|
||||
QUIRC_ERROR_INVALID_GRID_SIZE,
|
||||
QUIRC_ERROR_INVALID_VERSION,
|
||||
QUIRC_ERROR_FORMAT_ECC,
|
||||
QUIRC_ERROR_DATA_ECC,
|
||||
QUIRC_ERROR_UNKNOWN_DATA_TYPE,
|
||||
QUIRC_ERROR_DATA_OVERFLOW,
|
||||
QUIRC_ERROR_DATA_UNDERFLOW
|
||||
} quirc_decode_error_t;
|
||||
|
||||
/* Return a string error message for an error code. */
|
||||
const char *quirc_strerror(quirc_decode_error_t err);
|
||||
|
||||
/* Limits on the maximum size of QR-codes and their content. */
|
||||
#define QUIRC_MAX_BITMAP 3917
|
||||
#define QUIRC_MAX_PAYLOAD 8896
|
||||
|
||||
/* QR-code ECC types. */
|
||||
#define QUIRC_ECC_LEVEL_M 0
|
||||
#define QUIRC_ECC_LEVEL_L 1
|
||||
#define QUIRC_ECC_LEVEL_H 2
|
||||
#define QUIRC_ECC_LEVEL_Q 3
|
||||
|
||||
/* QR-code data types. */
|
||||
#define QUIRC_DATA_TYPE_NUMERIC 1
|
||||
#define QUIRC_DATA_TYPE_ALPHA 2
|
||||
#define QUIRC_DATA_TYPE_BYTE 4
|
||||
#define QUIRC_DATA_TYPE_KANJI 8
|
||||
|
||||
/* Common character encodings */
|
||||
#define QUIRC_ECI_ISO_8859_1 1
|
||||
#define QUIRC_ECI_IBM437 2
|
||||
#define QUIRC_ECI_ISO_8859_2 4
|
||||
#define QUIRC_ECI_ISO_8859_3 5
|
||||
#define QUIRC_ECI_ISO_8859_4 6
|
||||
#define QUIRC_ECI_ISO_8859_5 7
|
||||
#define QUIRC_ECI_ISO_8859_6 8
|
||||
#define QUIRC_ECI_ISO_8859_7 9
|
||||
#define QUIRC_ECI_ISO_8859_8 10
|
||||
#define QUIRC_ECI_ISO_8859_9 11
|
||||
#define QUIRC_ECI_WINDOWS_874 13
|
||||
#define QUIRC_ECI_ISO_8859_13 15
|
||||
#define QUIRC_ECI_ISO_8859_15 17
|
||||
#define QUIRC_ECI_SHIFT_JIS 20
|
||||
#define QUIRC_ECI_UTF_8 26
|
||||
|
||||
/* This structure is used to return information about detected QR codes
|
||||
* in the input image.
|
||||
*/
|
||||
struct quirc_code {
|
||||
/* The four corners of the QR-code, from top left, clockwise */
|
||||
struct quirc_point corners[4];
|
||||
|
||||
/* The number of cells across in the QR-code. The cell bitmap
|
||||
* is a bitmask giving the actual values of cells. If the cell
|
||||
* at (x, y) is black, then the following bit is set:
|
||||
*
|
||||
* cell_bitmap[i << 3] & (1 << (i & 7))
|
||||
*
|
||||
* where i = (y * size) + x.
|
||||
*/
|
||||
int size;
|
||||
uint8_t cell_bitmap[QUIRC_MAX_BITMAP];
|
||||
};
|
||||
|
||||
/* This structure holds the decoded QR-code data */
|
||||
struct quirc_data {
|
||||
/* Various parameters of the QR-code. These can mostly be
|
||||
* ignored if you only care about the data.
|
||||
*/
|
||||
int version;
|
||||
int ecc_level;
|
||||
int mask;
|
||||
|
||||
/* This field is the highest-valued data type found in the QR
|
||||
* code.
|
||||
*/
|
||||
int data_type;
|
||||
|
||||
/* Data payload. For the Kanji datatype, payload is encoded as
|
||||
* Shift-JIS. For all other datatypes, payload is ASCII text.
|
||||
*/
|
||||
uint8_t payload[QUIRC_MAX_PAYLOAD];
|
||||
int payload_len;
|
||||
|
||||
/* ECI assignment number */
|
||||
uint32_t eci;
|
||||
};
|
||||
|
||||
/* Return the number of QR-codes identified in the last processed
|
||||
* image.
|
||||
*/
|
||||
int quirc_count(const struct quirc *q);
|
||||
|
||||
/* Extract the QR-code specified by the given index. */
|
||||
void quirc_extract(const struct quirc *q, int index,
|
||||
struct quirc_code *code);
|
||||
|
||||
/* Decode a QR-code, returning the payload data. */
|
||||
quirc_decode_error_t quirc_decode(const struct quirc_code *code,
|
||||
struct quirc_data *data);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
/* quirc -- QR-code recognition library
|
||||
* Copyright (C) 2010-2012 Daniel Beer <dlbeer@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QUIRC_INTERNAL_HPP
|
||||
#define QUIRC_INTERNAL_HPP
|
||||
|
||||
#include "quirc.hpp"
|
||||
|
||||
#define QUIRC_PIXEL_WHITE 0
|
||||
#define QUIRC_PIXEL_BLACK 1
|
||||
#define QUIRC_PIXEL_REGION 2
|
||||
|
||||
#ifndef QUIRC_MAX_REGIONS
|
||||
#define QUIRC_MAX_REGIONS 254
|
||||
#endif
|
||||
#define QUIRC_MAX_CAPSTONES 32
|
||||
#define QUIRC_MAX_GRIDS 8
|
||||
|
||||
#define QUIRC_PERSPECTIVE_PARAMS 8
|
||||
|
||||
#if QUIRC_MAX_REGIONS < UINT8_MAX
|
||||
typedef uint8_t quirc_pixel_t;
|
||||
#elif QUIRC_MAX_REGIONS < UINT16_MAX
|
||||
typedef uint16_t quirc_pixel_t;
|
||||
#else
|
||||
#error "QUIRC_MAX_REGIONS > 65534 is not supported"
|
||||
#endif
|
||||
|
||||
struct quirc_region {
|
||||
struct quirc_point seed;
|
||||
int count;
|
||||
int capstone;
|
||||
};
|
||||
|
||||
struct quirc_capstone {
|
||||
int ring;
|
||||
int stone;
|
||||
|
||||
struct quirc_point corners[4];
|
||||
struct quirc_point center;
|
||||
double c[QUIRC_PERSPECTIVE_PARAMS];
|
||||
|
||||
int qr_grid;
|
||||
};
|
||||
|
||||
struct quirc_grid {
|
||||
/* Capstone indices */
|
||||
int caps[3];
|
||||
|
||||
/* Alignment pattern region and corner */
|
||||
int align_region;
|
||||
struct quirc_point align;
|
||||
|
||||
/* Timing pattern endpoints */
|
||||
struct quirc_point tpep[3];
|
||||
int hscan;
|
||||
int vscan;
|
||||
|
||||
/* Grid size and perspective transform */
|
||||
int grid_size;
|
||||
double c[QUIRC_PERSPECTIVE_PARAMS];
|
||||
};
|
||||
|
||||
struct quirc {
|
||||
uint8_t *image;
|
||||
quirc_pixel_t *pixels;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
int num_regions;
|
||||
struct quirc_region regions[QUIRC_MAX_REGIONS];
|
||||
|
||||
int num_capstones;
|
||||
struct quirc_capstone capstones[QUIRC_MAX_CAPSTONES];
|
||||
|
||||
int num_grids;
|
||||
struct quirc_grid grids[QUIRC_MAX_GRIDS];
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* QR-code version information database
|
||||
*/
|
||||
|
||||
#define QUIRC_MAX_VERSION 40
|
||||
#define QUIRC_MAX_ALIGNMENT 7
|
||||
|
||||
struct quirc_rs_params {
|
||||
int bs; /* Block size */
|
||||
int dw; /* Data words */
|
||||
int ce; /* Correctable errors */
|
||||
};
|
||||
|
||||
struct quirc_version_info {
|
||||
int data_bytes;
|
||||
int apat[QUIRC_MAX_ALIGNMENT];
|
||||
struct quirc_rs_params ecc[4];
|
||||
};
|
||||
|
||||
extern const struct quirc_version_info quirc_version_db[QUIRC_MAX_VERSION + 1];
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_MAIN_SCREEN_HPP
|
||||
#define _GHOST_ESHOP_MAIN_SCREEN_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "store.hpp"
|
||||
#include "storeEntry.hpp"
|
||||
#include "storeUtils.hpp"
|
||||
|
||||
/*
|
||||
Modes:
|
||||
|
||||
0: Entry Info.
|
||||
1: Download List.
|
||||
2: Queue.
|
||||
3: Search + Favorites.
|
||||
4: Sorting.
|
||||
5: Settings / Credits(?).
|
||||
6: Screenshot Menu.
|
||||
7: Release Notes.
|
||||
*/
|
||||
|
||||
class MainScreen : public Screen {
|
||||
public:
|
||||
MainScreen();
|
||||
void Draw(void) const override;
|
||||
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
||||
private:
|
||||
std::unique_ptr<Store> store = nullptr;
|
||||
std::unique_ptr<Meta> meta = nullptr;
|
||||
std::vector<std::unique_ptr<StoreEntry>> entries;
|
||||
std::vector<std::string> dwnldList, dwnldSizes;
|
||||
|
||||
bool initialized = false, fetchDown = false, showMarks = false, showSettings = false,
|
||||
ascending = false, updateFilter = false, screenshotFetch = false, canDisplay = false;
|
||||
|
||||
int storeMode = 0, marks = 0, markIndex = 0, sPage = 0, lMode = 0, sSelection = 0,
|
||||
lastMode = 0, smallDelay = 0, sPos = 0, screenshotIndex = 0, sSize = 0, zoom = 0, scrollIndex = 0, queueIndex = 0;
|
||||
|
||||
SortType sorttype = SortType::LAST_UPDATED;
|
||||
|
||||
/* Titre, Auteur, Catégorie, Console. */
|
||||
std::vector<bool> searchIncludes = { false, false, false, false };
|
||||
std::string searchResult = "", screenshotName = "";
|
||||
|
||||
C2D_Image Screenshot = { nullptr, nullptr };
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_META_HPP
|
||||
#define _GHOST_ESHOP_META_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <string>
|
||||
|
||||
enum favoriteMarks {
|
||||
STAR = 1 << 0,
|
||||
HEART = 1 << 1,
|
||||
DIAMOND = 1 << 2,
|
||||
CLUBS = 1 << 3,
|
||||
SPADE = 1 << 4
|
||||
};
|
||||
|
||||
class Meta {
|
||||
public:
|
||||
Meta();
|
||||
~Meta() { this->SaveCall(); };
|
||||
|
||||
std::string GetUpdated(const std::string &EshopName, const std::string &entry) const;
|
||||
int GetMarks(const std::string &EshopName, const std::string &entry) const;
|
||||
bool UpdateAvailable(const std::string &EshopName, const std::string &entry, const std::string &updated) const;
|
||||
|
||||
void SetUpdated(const std::string &EshopName, const std::string &entry, const std::string &updated) {
|
||||
this->metadataJson[EshopName][entry]["updated"] = updated;
|
||||
};
|
||||
|
||||
void SetMarks(const std::string &EshopName, const std::string &entry, int marks) {
|
||||
this->metadataJson[EshopName][entry]["marks"] = marks;
|
||||
};
|
||||
|
||||
void ImportMetadata();
|
||||
void SaveCall();
|
||||
private:
|
||||
nlohmann::json metadataJson = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_STORE_HPP
|
||||
#define _GHOST_ESHOP_STORE_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
|
||||
class Store {
|
||||
public:
|
||||
Store(const std::string &file, const std::string &file2, bool ARGMode = false);
|
||||
~Store();
|
||||
void LoadFromFile(const std::string &file);
|
||||
void loadSheets();
|
||||
void unloadSheets();
|
||||
void update(const std::string &file);
|
||||
|
||||
/* Obtenir des informations sur l’eShop lui-même. */
|
||||
std::string GetEshopTitle() const;
|
||||
std::string GetEshopAuthor() const;
|
||||
|
||||
/* Obtenir des informations sur les entrées eShop. */
|
||||
std::string GetTitleEntry(int index) const;
|
||||
std::string GetAuthorEntry(int index) const;
|
||||
std::string GetDescriptionEntry(int index) const;
|
||||
std::vector<std::string> GetCategoryIndex(int index) const;
|
||||
std::string GetVersionEntry(int index) const;
|
||||
std::vector<std::string> GetConsoleEntry(int index) const;
|
||||
std::string GetLastUpdatedEntry(int index) const;
|
||||
std::string GetSizeEntry(int index) const;
|
||||
std::string GetAdditionalcontentEntry(int index) const;
|
||||
C2D_Image GetIconEntry(int index) const;
|
||||
std::string GetFileSizes(int index, const std::string &entry) const;
|
||||
std::vector<std::string> GetScreenshotList(int index) const;
|
||||
std::vector<std::string> GetScreenshotNames(int index) const;
|
||||
std::string GetReleaseNotes(int index) const;
|
||||
|
||||
std::vector<std::string> GetDownloadList(int index) const;
|
||||
|
||||
int GetStoreSize() const { return (int)this->storeJson["storeContent"].size(); };
|
||||
|
||||
int GetScreenIndx() const { return this->screenIndex; };
|
||||
void SetScreenIndx(int v) { this->screenIndex = v; };
|
||||
|
||||
int GetEntry() const { return this->entry; };
|
||||
void SetEntry(int v) { this->entry = v; };
|
||||
|
||||
int GetBox() const { return this->box; };
|
||||
void SetBox(int v) { this->box = v; };
|
||||
|
||||
int GetDownloadSIndex() const { return this->downIndex; };
|
||||
void SetDownloadSIndex(int v) { this->downIndex = v; };
|
||||
|
||||
int GetDownloadIndex() const { return this->downEntry; };
|
||||
void SetDownloadIndex(int v) { this->downEntry = v; };
|
||||
|
||||
nlohmann::json &GetJson() { return this->storeJson; };
|
||||
bool GetValid() const { return this->valid; };
|
||||
|
||||
/* Ces deux choses sont utilisées pour le support BG personnalisé. */
|
||||
C2D_Image GetStoreImg() const { return this->storeBG; };
|
||||
bool customBG() const { return this->hasCustomBG; };
|
||||
|
||||
/* Renvoie le nom du fichier eShop. */
|
||||
std::string GetFileName() const { return this->fileName; };
|
||||
private:
|
||||
void SetC2DBGImage();
|
||||
nlohmann::json storeJson = nullptr;
|
||||
std::vector<C2D_SpriteSheet> sheets;
|
||||
C2D_Image storeBG = { nullptr };
|
||||
bool valid = false, hasSheet = false, hasCustomBG = false;
|
||||
int screenIndex = 0, entry = 0, box = 0, downEntry = 0, downIndex = 0;
|
||||
std::string fileName = "";
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_STORE_ENTRY_HPP
|
||||
#define _GHOST_ESHOP_STORE_ENTRY_HPP
|
||||
|
||||
#include "meta.hpp"
|
||||
#include "store.hpp"
|
||||
#include "stringutils.hpp"
|
||||
|
||||
class StoreEntry {
|
||||
public:
|
||||
StoreEntry(const std::unique_ptr<Store> &store, const std::unique_ptr<Meta> &meta, int index);
|
||||
|
||||
std::string GetTitle() const { return this->Title; };
|
||||
std::string GetAuthor() const { return this->Author; };
|
||||
std::string GetDescription() const { return this->Description; };
|
||||
std::string GetCategory() const { return this->Category; };
|
||||
std::string GetVersion() const { return this->Version; };
|
||||
std::string GetConsole() const { return this->Console; };
|
||||
std::string GetLastUpdated() const { return this->LastUpdated; };
|
||||
std::string GetSize() const { return this->Size; };
|
||||
std::string GetAdditionalcontent() const { return this->Additional; };
|
||||
int GetMarks() const { return this->Marks; };
|
||||
|
||||
C2D_Image GetIcon() const { return this->Icon; };
|
||||
|
||||
int GetSheetIndex() const { return this->SheetIndex; };
|
||||
int GetEntryIndex() const { return this->EntryIndex; };
|
||||
|
||||
std::vector<std::string> GetCategoryFull() const { return this->FullCategory; };
|
||||
std::vector<std::string> GetConsoleFull() const { return this->FullConsole; };
|
||||
std::vector<std::string> GetSizes() const { return this->Sizes; };
|
||||
std::vector<std::string> GetScreenshots() const { return this->Screenshots; };
|
||||
std::vector<std::string> GetScreenshotNames() const { return this->ScreenshotNames; };
|
||||
std::string GetReleaseNotes() const { return this->ReleaseNotes; };
|
||||
|
||||
bool GetUpdateAvl() const { return this->UpdateAvailable; };
|
||||
void SetUpdateAvl(bool v) { this->UpdateAvailable = v; };
|
||||
|
||||
void SetMark(int marks) {
|
||||
this->Marks = marks;
|
||||
this->MarkString = StringUtils::GetMarkString(this->Marks);
|
||||
};
|
||||
|
||||
private:
|
||||
std::string Title, Author, Description, Category, Version, Console, LastUpdated, Size, MarkString, Additional, ReleaseNotes;
|
||||
C2D_Image Icon;
|
||||
int SheetIndex, EntryIndex, Marks;
|
||||
std::vector<std::string> FullCategory, FullConsole, Sizes, Screenshots, ScreenshotNames;
|
||||
bool UpdateAvailable;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_STORE_UTILS_HPP
|
||||
#define _GHOST_ESHOP_STORE_UTILS_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "store.hpp"
|
||||
#include "storeEntry.hpp"
|
||||
#include <vector>
|
||||
|
||||
enum class SortType : uint8_t {
|
||||
TITLE,
|
||||
AUTHOR,
|
||||
LAST_UPDATED
|
||||
};
|
||||
|
||||
namespace StoreUtils {
|
||||
/* Grille. */
|
||||
void DrawGrid(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void GridLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
|
||||
/* Top Liste. */
|
||||
void DrawList(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void ListLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
|
||||
/* Infos Sur L'Entrée. */
|
||||
void DrawEntryInfo(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry);
|
||||
void EntryHandle(bool &showMark, bool &fetch, bool &sFetch, int &mode, const std::unique_ptr<StoreEntry> &entry);
|
||||
|
||||
/* Menu Latéral. */
|
||||
void DrawSideMenu(int currentMenu);
|
||||
void SideMenuHandle(int ¤tMenu, bool &fetch, int &lastMenu);
|
||||
|
||||
/* Entrées Des Téléchargements. */
|
||||
void DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, bool fetch, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &sizes);
|
||||
void DownloadHandle(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int ¤tMenu, std::unique_ptr<Meta> &meta, const int &lastMode, int &smallDelay);
|
||||
|
||||
/* Queue System. */
|
||||
void DrawQueueMenu(const int queueIndex);
|
||||
void QueueMenuHandle(int &queueIndex);
|
||||
|
||||
/* Recherche + Menu Favoris. */
|
||||
void DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, int marks, bool updateFilter);
|
||||
void SearchHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::vector<bool> &searchIncludes, std::unique_ptr<Meta> &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype);
|
||||
|
||||
/* Menu Marquer. */
|
||||
void DisplayMarkBox(int marks);
|
||||
void MarkHandle(std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store, bool &showMark, std::unique_ptr<Meta> &meta);
|
||||
|
||||
/* Crédits. */
|
||||
void DrawCredits();
|
||||
|
||||
/* Screenshot menu. */
|
||||
void DrawScreenshotMenu(const C2D_Image &img, const int sIndex, const bool sFetch, const int screenshotSize, const std::string &name, const int zoom, const bool canDisplay);
|
||||
void ScreenshotMenu(C2D_Image &img, int &sIndex, bool &sFetch, int &storeMode, const int screenshotSize, int &zoom, bool &canDisplay);
|
||||
|
||||
/* Paramètres. */
|
||||
void DrawSettings(int page, int selection, int sPos);
|
||||
void SettingsHandle(int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta, int &sPos);
|
||||
|
||||
/* Trie. */
|
||||
void DrawSorting(bool asc, SortType st);
|
||||
void SortHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, bool &asc, SortType &st);
|
||||
|
||||
/* Release Notes. */
|
||||
void DrawReleaseNotes(const int &scrollIndex, const std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store);
|
||||
void ReleaseNotesLogic(int &scrollIndex, int &storeMode);
|
||||
|
||||
bool compareTitleDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
bool compareTitleAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
|
||||
bool compareAuthorDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
bool compareAuthorAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
|
||||
bool compareUpdateDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
bool compareUpdateAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
|
||||
void SortEntries(bool Ascending, SortType sorttype, std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
|
||||
void search(std::vector<std::unique_ptr<StoreEntry>> &entries, const std::string &query, bool title, bool author, bool category, bool console, int selectedMarks, bool updateAvl);
|
||||
|
||||
void FilterUpdateAvailable(std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
|
||||
void ResetAll(const std::unique_ptr<Store> &store, const std::unique_ptr<Meta> &meta, std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_ANIMATION_HPP
|
||||
#define _GHOST_ESHOP_ANIMATION_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
enum class ProgressBar {
|
||||
Downloading,
|
||||
Extracting,
|
||||
Installing,
|
||||
Copying
|
||||
};
|
||||
|
||||
namespace Animation {
|
||||
void DrawProgressBar(u64 currentProgress, u64 totalProgress);
|
||||
void displayProgressBar();
|
||||
|
||||
void DrawQueue(int x, int y);
|
||||
void QueueAnimHandle();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_ARGUMENT_PARSER_HPP
|
||||
#define _GHOST_ESHOP_ARGUMENT_PARSER_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include "store.hpp"
|
||||
#include <string>
|
||||
|
||||
class ArgumentParser {
|
||||
public:
|
||||
ArgumentParser(const std::string &file, const std::string &entry, int dlIndex);
|
||||
void Load();
|
||||
void Execute();
|
||||
bool GetValid() const { return this->isValid; };
|
||||
private:
|
||||
std::unique_ptr<Store> store = nullptr;
|
||||
bool isValid = false;
|
||||
std::string file = "", executeEntry = "", entry = "";
|
||||
int dlIndex = -1, entryIndex = -1;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_CIA_HPP
|
||||
#define _GHOST_ESHOP_CIA_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
namespace Title {
|
||||
Result Launch(u64 titleId, FS_MediaType mediaType);
|
||||
Result DeletePrevious(u64 titleid, FS_MediaType media);
|
||||
Result Install(const char *ciaPath, bool updateSelf);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_CONFIG_HPP
|
||||
#define _GHOST_ESHOP_CONFIG_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
class Config {
|
||||
public:
|
||||
Config();
|
||||
void save();
|
||||
void initialize();
|
||||
void sysLang();
|
||||
|
||||
/* Language. */
|
||||
std::string language() const { return this->v_language; };
|
||||
void language(const std::string &v) { this->v_language = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Dernier Magasin. */
|
||||
std::string lastStore() const { return this->v_lastStore; };
|
||||
void lastStore(const std::string &v) { this->v_lastStore = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Utilisation De La Liste Supérieure. */
|
||||
bool list() const { return this->v_list; };
|
||||
void list(bool v) { this->v_list = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Mise à Jour Automatique Au Démarrage. */
|
||||
bool autoupdate() const { return this->v_autoUpdate; };
|
||||
void autoupdate(bool v) { this->v_autoUpdate = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
std::string _3dsxPath() const { return this->v_3dsxPath; };
|
||||
void _3dsxPath(const std::string &v) { this->v_3dsxPath = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
std::string ndsPath() const { return this->v_ndsPath; };
|
||||
void ndsPath(const std::string &v) { this->v_ndsPath = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
std::string archPath() const { return this->v_archivePath; };
|
||||
void archPath(const std::string &v) { this->v_archivePath = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Récupération d'anciennes métadonnées. */
|
||||
bool metadata() const { return this->v_metadata; };
|
||||
void metadata(bool v) { this->v_metadata = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Vérification des Mises à Jour de Ghost eShop au Démarrage. */
|
||||
bool updatecheck() const { return this->v_updateCheck; };
|
||||
void updatecheck(bool v) { this->v_updateCheck = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Vérification des Mises à Jour de Ghost eShop au Démarrage. */
|
||||
bool usebg() const { return this->v_showBg; };
|
||||
void usebg(bool v) { this->v_showBg = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Si vous utilisez une police personnalisée. */
|
||||
bool customfont() const { return this->v_customFont; };
|
||||
void customfont(bool v) { this->v_customFont = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Le chemin du raccourci. */
|
||||
std::string shortcut() const { return this->v_shortcutPath; };
|
||||
void shortcut(const std::string &v) { this->v_shortcutPath = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* If displaying changelog. */
|
||||
bool changelog() const { return this->v_changelog; };
|
||||
void changelog(bool v) { this->v_changelog = v; if (!this->changesMade) this->changesMade = true; };
|
||||
private:
|
||||
/* Principalement aide. */
|
||||
bool getBool(const std::string &key);
|
||||
void setBool(const std::string &key, bool v);
|
||||
int getInt(const std::string &key);
|
||||
void setInt(const std::string &key, int v);
|
||||
std::string getString(const std::string &key);
|
||||
void setString(const std::string &key, const std::string &v);
|
||||
|
||||
nlohmann::json json;
|
||||
bool changesMade = false;
|
||||
|
||||
std::string v_language = "en", v_lastStore = "ghosteshop.eshop",
|
||||
v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:",
|
||||
v_shortcutPath = "sdmc:/3ds/GhosteShop/shortcuts";
|
||||
|
||||
bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true,
|
||||
v_showBg = false, v_customFont = false, v_changelog = true;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_DOWNLOAD_HPP
|
||||
#define _GHOST_ESHOP_DOWNLOAD_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#define APP_TITLE "Ghost eShop"
|
||||
#define VERSION_STRING "12.0"
|
||||
|
||||
enum DownloadError {
|
||||
DL_ERROR_NONE = 0,
|
||||
DL_ERROR_WRITEFILE,
|
||||
DL_ERROR_ALLOC,
|
||||
DL_ERROR_STATUSCODE,
|
||||
DL_ERROR_GIT,
|
||||
DL_CANCEL, // Aucune idée si c’est nécessaire.
|
||||
};
|
||||
|
||||
struct StoreList {
|
||||
std::string Title;
|
||||
std::string Author;
|
||||
std::string URL;
|
||||
std::string Description;
|
||||
};
|
||||
|
||||
struct GEUpdate {
|
||||
bool Available = false;
|
||||
std::string Notes = "";
|
||||
std::string Version = "";
|
||||
};
|
||||
|
||||
Result downloadToFile(const std::string &url, const std::string &path);
|
||||
Result downloadFromRelease(const std::string &url, const std::string &asset, const std::string &path, bool includePrereleases);
|
||||
|
||||
/*
|
||||
Vérifiez l’état du Wi-Fi.
|
||||
@return True si le Wi-Fi est connecté ; false si non.
|
||||
*/
|
||||
bool checkWifiStatus(void);
|
||||
|
||||
/*
|
||||
Afficher "Veuillez vous connecter au Wi-Fi" pour 2s.
|
||||
*/
|
||||
void notConnectedMsg(void);
|
||||
|
||||
/*
|
||||
Affiche "Not Implemented Yet" pour 2s.
|
||||
*/
|
||||
void notImplemented(void);
|
||||
|
||||
/*
|
||||
Afficher le msg done.
|
||||
*/
|
||||
void doneMsg(void);
|
||||
|
||||
bool IsUpdateAvailable(const std::string &URL, int revCurrent);
|
||||
bool DownloadEshop(const std::string &URL, int currentRev, std::string &fl, bool isDownload = false, bool isUDB = false);
|
||||
bool DownloadSpriteSheet(const std::string &URL, const std::string &file);
|
||||
GEUpdate IsGEUpdateAvailable();
|
||||
void UpdateAction();
|
||||
std::vector<StoreList> FetchStores();
|
||||
C2D_Image FetchScreenshot(const std::string &URL);
|
||||
std::string GetChangelog();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_EXTRACT_HPP
|
||||
#define _GHOST_ESHOP_EXTRACT_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
enum ExtractError {
|
||||
EXTRACT_ERROR_NONE = 0,
|
||||
EXTRACT_ERROR_ARCHIVE,
|
||||
EXTRACT_ERROR_ALLOC,
|
||||
EXTRACT_ERROR_FIND,
|
||||
EXTRACT_ERROR_READFILE,
|
||||
EXTRACT_ERROR_OPENFILE,
|
||||
EXTRACT_ERROR_WRITEFILE,
|
||||
};
|
||||
|
||||
Result getExtractedSize(const std::string &archivePath, const std::string &wantedFile);
|
||||
|
||||
Result extractArchive(const std::string &archivePath, const std::string &wantedFile, const std::string &outputPath);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_FILE_BROWSE_HPP
|
||||
#define _GHOST_ESHOP_FILE_BROWSE_HPP
|
||||
|
||||
#include <dirent.h>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
struct DirEntry {
|
||||
std::string name;
|
||||
std::string path;
|
||||
bool isDirectory;
|
||||
};
|
||||
|
||||
/*
|
||||
Information de la structure de l'eShop
|
||||
*/
|
||||
struct EshopInfo {
|
||||
std::string Title;
|
||||
std::string Author;
|
||||
std::string URL;
|
||||
std::string File; // Permet de vérifier si le fichier ne contient PAS de barre oblique.
|
||||
std::string FileName;
|
||||
std::string Description;
|
||||
int Version;
|
||||
int Revision;
|
||||
int StoreSize;
|
||||
};
|
||||
|
||||
bool nameEndsWith(const std::string &name, const std::vector<std::string> &extensionList);
|
||||
void getDirectoryContents(std::vector<DirEntry> &dirContents, const std::vector<std::string> &extensionList);
|
||||
void getDirectoryContents(std::vector<DirEntry> &dirContents);
|
||||
std::vector<std::string> getContents(const std::string &name, const std::vector<std::string> &extensionList);
|
||||
|
||||
std::vector<EshopInfo> GetEshopInfo(const std::string &path);
|
||||
|
||||
void dirCopy(DirEntry *entry, const char *destinationPath, const char *sourcePath);
|
||||
int fcopy(const char *sourcePath, const char *destinationPath);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_FILES_HPP
|
||||
#define _GHOST_ESHOP_FILES_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
Result makeDirs(const char *path);
|
||||
Result openFile(Handle *fileHandle, const char *path, bool write);
|
||||
Result deleteFile(const char *path);
|
||||
Result removeDir(const char *path);
|
||||
Result removeDirRecursive(const char *path);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_LANG_HPP
|
||||
#define _GHOST_ESHOP_LANG_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace Lang {
|
||||
std::string get(const std::string &key);
|
||||
void load(const std::string &lang);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_QUEUE_SYSTEM_HPP
|
||||
#define _GHOST_ESHOP_QUEUE_SYSTEM_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <citro2d.h>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
|
||||
/*
|
||||
Extend this, if more statuses are neccessary.
|
||||
*/
|
||||
enum class QueueStatus {
|
||||
None,
|
||||
Downloading,
|
||||
Extracting,
|
||||
Installing,
|
||||
Failed,
|
||||
Done
|
||||
};
|
||||
|
||||
class Queue {
|
||||
public:
|
||||
Queue(nlohmann::json object, C2D_Image img, std::string name) : obj(object), icn(img), name(name) { };
|
||||
QueueStatus status = QueueStatus::None;
|
||||
nlohmann::json obj;
|
||||
C2D_Image icn;
|
||||
int total, current;
|
||||
std::string name = "";
|
||||
};
|
||||
|
||||
/*
|
||||
Of course also a namespace to that part, so we can do that in a Thread.
|
||||
*/
|
||||
namespace QueueSystem {
|
||||
void QueueHandle(); // Handles the Queue.
|
||||
void AddToQueue(nlohmann::json obj, C2D_Image icn, std::string name); // Adds to Queue.
|
||||
void ClearQueue(); // Clears the Queue.
|
||||
|
||||
extern LightLock lock;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_SCREENSHOT_HPP
|
||||
#define _GHOST_ESHOP_SCREENSHOT_HPP
|
||||
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Screenshot {
|
||||
C2D_Image Convert(const std::string &filename);
|
||||
C2D_Image ConvertFromBuffer(const std::vector<u8> &buffer);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_SCRIPT_UTILS_HPP
|
||||
#define _GHOST_ESHOP_SCRIPT_UTILS_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
enum ScriptState {
|
||||
NONE = 0,
|
||||
FAILED_DOWNLOAD,
|
||||
SCRIPT_CANCELED,
|
||||
SYNTAX_ERROR,
|
||||
COPY_ERROR,
|
||||
MOVE_ERROR,
|
||||
DELETE_ERROR
|
||||
};
|
||||
|
||||
namespace ScriptUtils {
|
||||
bool matchPattern(const std::string &pattern, const std::string &tested);
|
||||
|
||||
Result removeFile(const std::string &file, const std::string &message);
|
||||
void bootTitle(const std::string &TitleID, bool isNAND, const std::string &message);
|
||||
Result prompt(const std::string &message);
|
||||
Result copyFile(const std::string &source, const std::string &destination, const std::string &message, bool isARG = false);
|
||||
Result renameFile(const std::string &oldName, const std::string &newName, const std::string &message);
|
||||
Result downloadRelease(const std::string &repo, const std::string &file, const std::string &output, bool includePrereleases, const std::string &message, bool isARG = false);
|
||||
Result downloadFile(const std::string &file, const std::string &output, const std::string &message, bool isARG = false);
|
||||
void installFile(const std::string &file, bool updatingSelf, const std::string &message, bool isARG = false);
|
||||
void extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message, bool isARG = false);
|
||||
|
||||
Result runFunctions(nlohmann::json storeJson, int selection, const std::string &entry);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_SOUND_HPP
|
||||
#define _GHOST_ESHOP_SOUND_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
class Sound {
|
||||
public:
|
||||
Sound(const std::string &path, const int channel = 1, const bool toloop = true);
|
||||
~Sound();
|
||||
void play();
|
||||
void stop();
|
||||
private:
|
||||
u32 dataSize;
|
||||
bool good = true;
|
||||
ndspWaveBuf waveBuf;
|
||||
u8 *data = nullptr;
|
||||
int chnl;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _GHOST_ESHOP_STRING_UTILS_HPP
|
||||
#define _GHOST_ESHOP_STRING_UTILS_HPP
|
||||
|
||||
#include "meta.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace StringUtils {
|
||||
std::string lower_case(const std::string &str);
|
||||
std::string FetchStringsFromVector(const std::vector<std::string> &fetch);
|
||||
std::string formatBytes(int bytes);
|
||||
std::string GetMarkString(int marks);
|
||||
std::vector<std::string> GetMarks(int marks);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,721 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2008 Tim Kientzle
|
||||
* Copyright (c) 2016 Martin Matuska
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $
|
||||
*/
|
||||
|
||||
#ifndef ARCHIVE_ENTRY_H_INCLUDED
|
||||
#define ARCHIVE_ENTRY_H_INCLUDED
|
||||
|
||||
/* Note: Compiler will complain if this does not match archive.h! */
|
||||
#define ARCHIVE_VERSION_NUMBER 3005001
|
||||
|
||||
/*
|
||||
* Note: archive_entry.h is for use outside of libarchive; the
|
||||
* configuration headers (config.h, archive_platform.h, etc.) are
|
||||
* purely internal. Do NOT use HAVE_XXX configuration macros to
|
||||
* control the behavior of this header! If you must conditionalize,
|
||||
* use predefined compiler and/or platform macros.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h> /* for wchar_t */
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/* Get a suitable 64-bit integer type. */
|
||||
#if !defined(__LA_INT64_T_DEFINED)
|
||||
# if ARCHIVE_VERSION_NUMBER < 4000000
|
||||
#define __LA_INT64_T la_int64_t
|
||||
# endif
|
||||
#define __LA_INT64_T_DEFINED
|
||||
# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
|
||||
typedef __int64 la_int64_t;
|
||||
# else
|
||||
#include <unistd.h>
|
||||
# if defined(_SCO_DS) || defined(__osf__)
|
||||
typedef long long la_int64_t;
|
||||
# else
|
||||
typedef int64_t la_int64_t;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The la_ssize_t should match the type used in 'struct stat' */
|
||||
#if !defined(__LA_SSIZE_T_DEFINED)
|
||||
/* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */
|
||||
# if ARCHIVE_VERSION_NUMBER < 4000000
|
||||
#define __LA_SSIZE_T la_ssize_t
|
||||
# endif
|
||||
#define __LA_SSIZE_T_DEFINED
|
||||
# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
|
||||
# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_)
|
||||
typedef ssize_t la_ssize_t;
|
||||
# elif defined(_WIN64)
|
||||
typedef __int64 la_ssize_t;
|
||||
# else
|
||||
typedef long la_ssize_t;
|
||||
# endif
|
||||
# else
|
||||
# include <unistd.h> /* ssize_t */
|
||||
typedef ssize_t la_ssize_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Get a suitable definition for mode_t */
|
||||
#if ARCHIVE_VERSION_NUMBER >= 3999000
|
||||
/* Switch to plain 'int' for libarchive 4.0. It's less broken than 'mode_t' */
|
||||
# define __LA_MODE_T int
|
||||
#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
|
||||
# define __LA_MODE_T unsigned short
|
||||
#else
|
||||
# define __LA_MODE_T mode_t
|
||||
#endif
|
||||
|
||||
/* Large file support for Android */
|
||||
#ifdef __ANDROID__
|
||||
#include "android_lf.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On Windows, define LIBARCHIVE_STATIC if you're building or using a
|
||||
* .lib. The default here assumes you're building a DLL. Only
|
||||
* libarchive source should ever define __LIBARCHIVE_BUILD.
|
||||
*/
|
||||
#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
|
||||
# ifdef __LIBARCHIVE_BUILD
|
||||
# ifdef __GNUC__
|
||||
# define __LA_DECL __attribute__((dllexport)) extern
|
||||
# else
|
||||
# define __LA_DECL __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# define __LA_DECL
|
||||
# else
|
||||
# define __LA_DECL __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
/* Static libraries on all platforms and shared libraries on non-Windows. */
|
||||
# define __LA_DECL
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1
|
||||
# define __LA_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
# define __LA_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Description of an archive entry.
|
||||
*
|
||||
* You can think of this as "struct stat" with some text fields added in.
|
||||
*
|
||||
* TODO: Add "comment", "charset", and possibly other entries that are
|
||||
* supported by "pax interchange" format. However, GNU, ustar, cpio,
|
||||
* and other variants don't support these features, so they're not an
|
||||
* excruciatingly high priority right now.
|
||||
*
|
||||
* TODO: "pax interchange" format allows essentially arbitrary
|
||||
* key/value attributes to be attached to any entry. Supporting
|
||||
* such extensions may make this library useful for special
|
||||
* applications (e.g., a package manager could attach special
|
||||
* package-management attributes to each entry).
|
||||
*/
|
||||
struct archive;
|
||||
struct archive_entry;
|
||||
|
||||
/*
|
||||
* File-type constants. These are returned from archive_entry_filetype()
|
||||
* and passed to archive_entry_set_filetype().
|
||||
*
|
||||
* These values match S_XXX defines on every platform I've checked,
|
||||
* including Windows, AIX, Linux, Solaris, and BSD. They're
|
||||
* (re)defined here because platforms generally don't define the ones
|
||||
* they don't support. For example, Windows doesn't define S_IFLNK or
|
||||
* S_IFBLK. Instead of having a mass of conditional logic and system
|
||||
* checks to define any S_XXX values that aren't supported locally,
|
||||
* I've just defined a new set of such constants so that
|
||||
* libarchive-based applications can manipulate and identify archive
|
||||
* entries properly even if the hosting platform can't store them on
|
||||
* disk.
|
||||
*
|
||||
* These values are also used directly within some portable formats,
|
||||
* such as cpio. If you find a platform that varies from these, the
|
||||
* correct solution is to leave these alone and translate from these
|
||||
* portable values to platform-native values when entries are read from
|
||||
* or written to disk.
|
||||
*/
|
||||
/*
|
||||
* In libarchive 4.0, we can drop the casts here.
|
||||
* They're needed to work around Borland C's broken mode_t.
|
||||
*/
|
||||
#define AE_IFMT ((__LA_MODE_T)0170000)
|
||||
#define AE_IFREG ((__LA_MODE_T)0100000)
|
||||
#define AE_IFLNK ((__LA_MODE_T)0120000)
|
||||
#define AE_IFSOCK ((__LA_MODE_T)0140000)
|
||||
#define AE_IFCHR ((__LA_MODE_T)0020000)
|
||||
#define AE_IFBLK ((__LA_MODE_T)0060000)
|
||||
#define AE_IFDIR ((__LA_MODE_T)0040000)
|
||||
#define AE_IFIFO ((__LA_MODE_T)0010000)
|
||||
|
||||
/*
|
||||
* Symlink types
|
||||
*/
|
||||
#define AE_SYMLINK_TYPE_UNDEFINED 0
|
||||
#define AE_SYMLINK_TYPE_FILE 1
|
||||
#define AE_SYMLINK_TYPE_DIRECTORY 2
|
||||
|
||||
/*
|
||||
* Basic object manipulation
|
||||
*/
|
||||
|
||||
__LA_DECL struct archive_entry *archive_entry_clear(struct archive_entry *);
|
||||
/* The 'clone' function does a deep copy; all of the strings are copied too. */
|
||||
__LA_DECL struct archive_entry *archive_entry_clone(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_free(struct archive_entry *);
|
||||
__LA_DECL struct archive_entry *archive_entry_new(void);
|
||||
|
||||
/*
|
||||
* This form of archive_entry_new2() will pull character-set
|
||||
* conversion information from the specified archive handle. The
|
||||
* older archive_entry_new(void) form is equivalent to calling
|
||||
* archive_entry_new2(NULL) and will result in the use of an internal
|
||||
* default character-set conversion.
|
||||
*/
|
||||
__LA_DECL struct archive_entry *archive_entry_new2(struct archive *);
|
||||
|
||||
/*
|
||||
* Retrieve fields from an archive_entry.
|
||||
*
|
||||
* There are a number of implicit conversions among these fields. For
|
||||
* example, if a regular string field is set and you read the _w wide
|
||||
* character field, the entry will implicitly convert narrow-to-wide
|
||||
* using the current locale. Similarly, dev values are automatically
|
||||
* updated when you write devmajor or devminor and vice versa.
|
||||
*
|
||||
* In addition, fields can be "set" or "unset." Unset string fields
|
||||
* return NULL, non-string fields have _is_set() functions to test
|
||||
* whether they've been set. You can "unset" a string field by
|
||||
* assigning NULL; non-string fields have _unset() functions to
|
||||
* unset them.
|
||||
*
|
||||
* Note: There is one ambiguity in the above; string fields will
|
||||
* also return NULL when implicit character set conversions fail.
|
||||
* This is usually what you want.
|
||||
*/
|
||||
__LA_DECL time_t archive_entry_atime(struct archive_entry *);
|
||||
__LA_DECL long archive_entry_atime_nsec(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_atime_is_set(struct archive_entry *);
|
||||
__LA_DECL time_t archive_entry_birthtime(struct archive_entry *);
|
||||
__LA_DECL long archive_entry_birthtime_nsec(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_birthtime_is_set(struct archive_entry *);
|
||||
__LA_DECL time_t archive_entry_ctime(struct archive_entry *);
|
||||
__LA_DECL long archive_entry_ctime_nsec(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_ctime_is_set(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_dev(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_dev_is_set(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_devmajor(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_devminor(struct archive_entry *);
|
||||
__LA_DECL __LA_MODE_T archive_entry_filetype(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_fflags(struct archive_entry *,
|
||||
unsigned long * /* set */,
|
||||
unsigned long * /* clear */);
|
||||
__LA_DECL const char *archive_entry_fflags_text(struct archive_entry *);
|
||||
__LA_DECL la_int64_t archive_entry_gid(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_gname(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_gname_utf8(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_gname_w(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_hardlink(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_hardlink_utf8(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_hardlink_w(struct archive_entry *);
|
||||
__LA_DECL la_int64_t archive_entry_ino(struct archive_entry *);
|
||||
__LA_DECL la_int64_t archive_entry_ino64(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_ino_is_set(struct archive_entry *);
|
||||
__LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *);
|
||||
__LA_DECL time_t archive_entry_mtime(struct archive_entry *);
|
||||
__LA_DECL long archive_entry_mtime_nsec(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_mtime_is_set(struct archive_entry *);
|
||||
__LA_DECL unsigned int archive_entry_nlink(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_pathname(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_pathname_utf8(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *);
|
||||
__LA_DECL __LA_MODE_T archive_entry_perm(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_rdev(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_rdevmajor(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_sourcepath(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_sourcepath_w(struct archive_entry *);
|
||||
__LA_DECL la_int64_t archive_entry_size(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_size_is_set(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_strmode(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_symlink(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_symlink_utf8(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_symlink_type(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *);
|
||||
__LA_DECL la_int64_t archive_entry_uid(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_uname(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_uname_utf8(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_uname_w(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_is_data_encrypted(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_is_metadata_encrypted(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_is_encrypted(struct archive_entry *);
|
||||
|
||||
/*
|
||||
* Set fields in an archive_entry.
|
||||
*
|
||||
* Note: Before libarchive 2.4, there were 'set' and 'copy' versions
|
||||
* of the string setters. 'copy' copied the actual string, 'set' just
|
||||
* stored the pointer. In libarchive 2.4 and later, strings are
|
||||
* always copied.
|
||||
*/
|
||||
|
||||
__LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long);
|
||||
__LA_DECL void archive_entry_unset_atime(struct archive_entry *);
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *, BY_HANDLE_FILE_INFORMATION *);
|
||||
#endif
|
||||
__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long);
|
||||
__LA_DECL void archive_entry_unset_birthtime(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long);
|
||||
__LA_DECL void archive_entry_unset_ctime(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_filetype(struct archive_entry *, unsigned int);
|
||||
__LA_DECL void archive_entry_set_fflags(struct archive_entry *,
|
||||
unsigned long /* set */, unsigned long /* clear */);
|
||||
/* Returns pointer to start of first invalid token, or NULL if none. */
|
||||
/* Note that all recognized tokens are processed, regardless. */
|
||||
__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
|
||||
const char *);
|
||||
__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
|
||||
const wchar_t *);
|
||||
__LA_DECL void archive_entry_set_gid(struct archive_entry *, la_int64_t);
|
||||
__LA_DECL void archive_entry_set_gname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_gname_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_gname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_gname_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_hardlink(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_hardlink_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_hardlink(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_hardlink_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_ino(struct archive_entry *, la_int64_t);
|
||||
__LA_DECL void archive_entry_set_ino64(struct archive_entry *, la_int64_t);
|
||||
__LA_DECL void archive_entry_set_link(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_link_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T);
|
||||
__LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long);
|
||||
__LA_DECL void archive_entry_unset_mtime(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int);
|
||||
__LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_pathname_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_pathname_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_perm(struct archive_entry *, __LA_MODE_T);
|
||||
__LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_size(struct archive_entry *, la_int64_t);
|
||||
__LA_DECL void archive_entry_unset_size(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_sourcepath_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_symlink_type(struct archive_entry *, int);
|
||||
__LA_DECL void archive_entry_set_symlink_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_symlink_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_uid(struct archive_entry *, la_int64_t);
|
||||
__LA_DECL void archive_entry_set_uname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_uname_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_uname_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_is_data_encrypted(struct archive_entry *, char is_encrypted);
|
||||
__LA_DECL void archive_entry_set_is_metadata_encrypted(struct archive_entry *, char is_encrypted);
|
||||
/*
|
||||
* Routines to bulk copy fields to/from a platform-native "struct
|
||||
* stat." Libarchive used to just store a struct stat inside of each
|
||||
* archive_entry object, but this created issues when trying to
|
||||
* manipulate archives on systems different than the ones they were
|
||||
* created on.
|
||||
*
|
||||
* TODO: On Linux and other LFS systems, provide both stat32 and
|
||||
* stat64 versions of these functions and all of the macro glue so
|
||||
* that archive_entry_stat is magically defined to
|
||||
* archive_entry_stat32 or archive_entry_stat64 as appropriate.
|
||||
*/
|
||||
__LA_DECL const struct stat *archive_entry_stat(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_copy_stat(struct archive_entry *, const struct stat *);
|
||||
|
||||
/*
|
||||
* Storage for Mac OS-specific AppleDouble metadata information.
|
||||
* Apple-format tar files store a separate binary blob containing
|
||||
* encoded metadata with ACL, extended attributes, etc.
|
||||
* This provides a place to store that blob.
|
||||
*/
|
||||
|
||||
__LA_DECL const void * archive_entry_mac_metadata(struct archive_entry *, size_t *);
|
||||
__LA_DECL void archive_entry_copy_mac_metadata(struct archive_entry *, const void *, size_t);
|
||||
|
||||
/*
|
||||
* Digest routine. This is used to query the raw hex digest for the
|
||||
* given entry. The type of digest is provided as an argument.
|
||||
*/
|
||||
#define ARCHIVE_ENTRY_DIGEST_MD5 0x00000001
|
||||
#define ARCHIVE_ENTRY_DIGEST_RMD160 0x00000002
|
||||
#define ARCHIVE_ENTRY_DIGEST_SHA1 0x00000003
|
||||
#define ARCHIVE_ENTRY_DIGEST_SHA256 0x00000004
|
||||
#define ARCHIVE_ENTRY_DIGEST_SHA384 0x00000005
|
||||
#define ARCHIVE_ENTRY_DIGEST_SHA512 0x00000006
|
||||
|
||||
__LA_DECL const unsigned char * archive_entry_digest(struct archive_entry *, int /* type */);
|
||||
|
||||
/*
|
||||
* ACL routines. This used to simply store and return text-format ACL
|
||||
* strings, but that proved insufficient for a number of reasons:
|
||||
* = clients need control over uname/uid and gname/gid mappings
|
||||
* = there are many different ACL text formats
|
||||
* = would like to be able to read/convert archives containing ACLs
|
||||
* on platforms that lack ACL libraries
|
||||
*
|
||||
* This last point, in particular, forces me to implement a reasonably
|
||||
* complete set of ACL support routines.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Permission bits.
|
||||
*/
|
||||
#define ARCHIVE_ENTRY_ACL_EXECUTE 0x00000001
|
||||
#define ARCHIVE_ENTRY_ACL_WRITE 0x00000002
|
||||
#define ARCHIVE_ENTRY_ACL_READ 0x00000004
|
||||
#define ARCHIVE_ENTRY_ACL_READ_DATA 0x00000008
|
||||
#define ARCHIVE_ENTRY_ACL_LIST_DIRECTORY 0x00000008
|
||||
#define ARCHIVE_ENTRY_ACL_WRITE_DATA 0x00000010
|
||||
#define ARCHIVE_ENTRY_ACL_ADD_FILE 0x00000010
|
||||
#define ARCHIVE_ENTRY_ACL_APPEND_DATA 0x00000020
|
||||
#define ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY 0x00000020
|
||||
#define ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS 0x00000040
|
||||
#define ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS 0x00000080
|
||||
#define ARCHIVE_ENTRY_ACL_DELETE_CHILD 0x00000100
|
||||
#define ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES 0x00000200
|
||||
#define ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES 0x00000400
|
||||
#define ARCHIVE_ENTRY_ACL_DELETE 0x00000800
|
||||
#define ARCHIVE_ENTRY_ACL_READ_ACL 0x00001000
|
||||
#define ARCHIVE_ENTRY_ACL_WRITE_ACL 0x00002000
|
||||
#define ARCHIVE_ENTRY_ACL_WRITE_OWNER 0x00004000
|
||||
#define ARCHIVE_ENTRY_ACL_SYNCHRONIZE 0x00008000
|
||||
|
||||
#define ARCHIVE_ENTRY_ACL_PERMS_POSIX1E \
|
||||
(ARCHIVE_ENTRY_ACL_EXECUTE \
|
||||
| ARCHIVE_ENTRY_ACL_WRITE \
|
||||
| ARCHIVE_ENTRY_ACL_READ)
|
||||
|
||||
#define ARCHIVE_ENTRY_ACL_PERMS_NFS4 \
|
||||
(ARCHIVE_ENTRY_ACL_EXECUTE \
|
||||
| ARCHIVE_ENTRY_ACL_READ_DATA \
|
||||
| ARCHIVE_ENTRY_ACL_LIST_DIRECTORY \
|
||||
| ARCHIVE_ENTRY_ACL_WRITE_DATA \
|
||||
| ARCHIVE_ENTRY_ACL_ADD_FILE \
|
||||
| ARCHIVE_ENTRY_ACL_APPEND_DATA \
|
||||
| ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY \
|
||||
| ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS \
|
||||
| ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS \
|
||||
| ARCHIVE_ENTRY_ACL_DELETE_CHILD \
|
||||
| ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES \
|
||||
| ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES \
|
||||
| ARCHIVE_ENTRY_ACL_DELETE \
|
||||
| ARCHIVE_ENTRY_ACL_READ_ACL \
|
||||
| ARCHIVE_ENTRY_ACL_WRITE_ACL \
|
||||
| ARCHIVE_ENTRY_ACL_WRITE_OWNER \
|
||||
| ARCHIVE_ENTRY_ACL_SYNCHRONIZE)
|
||||
|
||||
/*
|
||||
* Inheritance values (NFS4 ACLs only); included in permset.
|
||||
*/
|
||||
#define ARCHIVE_ENTRY_ACL_ENTRY_INHERITED 0x01000000
|
||||
#define ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT 0x02000000
|
||||
#define ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT 0x04000000
|
||||
#define ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT 0x08000000
|
||||
#define ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY 0x10000000
|
||||
#define ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS 0x20000000
|
||||
#define ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS 0x40000000
|
||||
|
||||
#define ARCHIVE_ENTRY_ACL_INHERITANCE_NFS4 \
|
||||
(ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT \
|
||||
| ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT \
|
||||
| ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT \
|
||||
| ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY \
|
||||
| ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS \
|
||||
| ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS \
|
||||
| ARCHIVE_ENTRY_ACL_ENTRY_INHERITED)
|
||||
|
||||
/* We need to be able to specify combinations of these. */
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 0x00000100 /* POSIX.1e only */
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 0x00000200 /* POSIX.1e only */
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_ALLOW 0x00000400 /* NFS4 only */
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_DENY 0x00000800 /* NFS4 only */
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_AUDIT 0x00001000 /* NFS4 only */
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_ALARM 0x00002000 /* NFS4 only */
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_POSIX1E (ARCHIVE_ENTRY_ACL_TYPE_ACCESS \
|
||||
| ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_NFS4 (ARCHIVE_ENTRY_ACL_TYPE_ALLOW \
|
||||
| ARCHIVE_ENTRY_ACL_TYPE_DENY \
|
||||
| ARCHIVE_ENTRY_ACL_TYPE_AUDIT \
|
||||
| ARCHIVE_ENTRY_ACL_TYPE_ALARM)
|
||||
|
||||
/* Tag values mimic POSIX.1e */
|
||||
#define ARCHIVE_ENTRY_ACL_USER 10001 /* Specified user. */
|
||||
#define ARCHIVE_ENTRY_ACL_USER_OBJ 10002 /* User who owns the file. */
|
||||
#define ARCHIVE_ENTRY_ACL_GROUP 10003 /* Specified group. */
|
||||
#define ARCHIVE_ENTRY_ACL_GROUP_OBJ 10004 /* Group who owns the file. */
|
||||
#define ARCHIVE_ENTRY_ACL_MASK 10005 /* Modify group access (POSIX.1e only) */
|
||||
#define ARCHIVE_ENTRY_ACL_OTHER 10006 /* Public (POSIX.1e only) */
|
||||
#define ARCHIVE_ENTRY_ACL_EVERYONE 10107 /* Everyone (NFS4 only) */
|
||||
|
||||
/*
|
||||
* Set the ACL by clearing it and adding entries one at a time.
|
||||
* Unlike the POSIX.1e ACL routines, you must specify the type
|
||||
* (access/default) for each entry. Internally, the ACL data is just
|
||||
* a soup of entries. API calls here allow you to retrieve just the
|
||||
* entries of interest. This design (which goes against the spirit of
|
||||
* POSIX.1e) is useful for handling archive formats that combine
|
||||
* default and access information in a single ACL list.
|
||||
*/
|
||||
__LA_DECL void archive_entry_acl_clear(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_acl_add_entry(struct archive_entry *,
|
||||
int /* type */, int /* permset */, int /* tag */,
|
||||
int /* qual */, const char * /* name */);
|
||||
__LA_DECL int archive_entry_acl_add_entry_w(struct archive_entry *,
|
||||
int /* type */, int /* permset */, int /* tag */,
|
||||
int /* qual */, const wchar_t * /* name */);
|
||||
|
||||
/*
|
||||
* To retrieve the ACL, first "reset", then repeatedly ask for the
|
||||
* "next" entry. The want_type parameter allows you to request only
|
||||
* certain types of entries.
|
||||
*/
|
||||
__LA_DECL int archive_entry_acl_reset(struct archive_entry *, int /* want_type */);
|
||||
__LA_DECL int archive_entry_acl_next(struct archive_entry *, int /* want_type */,
|
||||
int * /* type */, int * /* permset */, int * /* tag */,
|
||||
int * /* qual */, const char ** /* name */);
|
||||
|
||||
/*
|
||||
* Construct a text-format ACL. The flags argument is a bitmask that
|
||||
* can include any of the following:
|
||||
*
|
||||
* Flags only for archive entries with POSIX.1e ACL:
|
||||
* ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include POSIX.1e "access" entries.
|
||||
* ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include POSIX.1e "default" entries.
|
||||
* ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each
|
||||
* default ACL entry.
|
||||
* ARCHIVE_ENTRY_ACL_STYLE_SOLARIS - Output only one colon after "other" and
|
||||
* "mask" entries.
|
||||
*
|
||||
* Flags only for archive entries with NFSv4 ACL:
|
||||
* ARCHIVE_ENTRY_ACL_STYLE_COMPACT - Do not output the minus character for
|
||||
* unset permissions and flags in NFSv4 ACL permission and flag fields
|
||||
*
|
||||
* Flags for for archive entries with POSIX.1e ACL or NFSv4 ACL:
|
||||
* ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
|
||||
* each ACL entry.
|
||||
* ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA - Separate entries with comma
|
||||
* instead of newline.
|
||||
*/
|
||||
#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 0x00000001
|
||||
#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 0x00000002
|
||||
#define ARCHIVE_ENTRY_ACL_STYLE_SOLARIS 0x00000004
|
||||
#define ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA 0x00000008
|
||||
#define ARCHIVE_ENTRY_ACL_STYLE_COMPACT 0x00000010
|
||||
|
||||
__LA_DECL wchar_t *archive_entry_acl_to_text_w(struct archive_entry *,
|
||||
la_ssize_t * /* len */, int /* flags */);
|
||||
__LA_DECL char *archive_entry_acl_to_text(struct archive_entry *,
|
||||
la_ssize_t * /* len */, int /* flags */);
|
||||
__LA_DECL int archive_entry_acl_from_text_w(struct archive_entry *,
|
||||
const wchar_t * /* wtext */, int /* type */);
|
||||
__LA_DECL int archive_entry_acl_from_text(struct archive_entry *,
|
||||
const char * /* text */, int /* type */);
|
||||
|
||||
/* Deprecated constants */
|
||||
#define OLD_ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
|
||||
#define OLD_ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
|
||||
|
||||
/* Deprecated functions */
|
||||
__LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *,
|
||||
int /* flags */) __LA_DEPRECATED;
|
||||
__LA_DECL const char *archive_entry_acl_text(struct archive_entry *,
|
||||
int /* flags */) __LA_DEPRECATED;
|
||||
|
||||
/* Return bitmask of ACL types in an archive entry */
|
||||
__LA_DECL int archive_entry_acl_types(struct archive_entry *);
|
||||
|
||||
/* Return a count of entries matching 'want_type' */
|
||||
__LA_DECL int archive_entry_acl_count(struct archive_entry *, int /* want_type */);
|
||||
|
||||
/* Return an opaque ACL object. */
|
||||
/* There's not yet anything clients can actually do with this... */
|
||||
struct archive_acl;
|
||||
__LA_DECL struct archive_acl *archive_entry_acl(struct archive_entry *);
|
||||
|
||||
/*
|
||||
* extended attributes
|
||||
*/
|
||||
|
||||
__LA_DECL void archive_entry_xattr_clear(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_xattr_add_entry(struct archive_entry *,
|
||||
const char * /* name */, const void * /* value */,
|
||||
size_t /* size */);
|
||||
|
||||
/*
|
||||
* To retrieve the xattr list, first "reset", then repeatedly ask for the
|
||||
* "next" entry.
|
||||
*/
|
||||
|
||||
__LA_DECL int archive_entry_xattr_count(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_xattr_reset(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_xattr_next(struct archive_entry *,
|
||||
const char ** /* name */, const void ** /* value */, size_t *);
|
||||
|
||||
/*
|
||||
* sparse
|
||||
*/
|
||||
|
||||
__LA_DECL void archive_entry_sparse_clear(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_sparse_add_entry(struct archive_entry *,
|
||||
la_int64_t /* offset */, la_int64_t /* length */);
|
||||
|
||||
/*
|
||||
* To retrieve the xattr list, first "reset", then repeatedly ask for the
|
||||
* "next" entry.
|
||||
*/
|
||||
|
||||
__LA_DECL int archive_entry_sparse_count(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_sparse_reset(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_sparse_next(struct archive_entry *,
|
||||
la_int64_t * /* offset */, la_int64_t * /* length */);
|
||||
|
||||
/*
|
||||
* Utility to match up hardlinks.
|
||||
*
|
||||
* The 'struct archive_entry_linkresolver' is a cache of archive entries
|
||||
* for files with multiple links. Here's how to use it:
|
||||
* 1. Create a lookup object with archive_entry_linkresolver_new()
|
||||
* 2. Tell it the archive format you're using.
|
||||
* 3. Hand each archive_entry to archive_entry_linkify().
|
||||
* That function will return 0, 1, or 2 entries that should
|
||||
* be written.
|
||||
* 4. Call archive_entry_linkify(resolver, NULL) until
|
||||
* no more entries are returned.
|
||||
* 5. Call archive_entry_linkresolver_free(resolver) to free resources.
|
||||
*
|
||||
* The entries returned have their hardlink and size fields updated
|
||||
* appropriately. If an entry is passed in that does not refer to
|
||||
* a file with multiple links, it is returned unchanged. The intention
|
||||
* is that you should be able to simply filter all entries through
|
||||
* this machine.
|
||||
*
|
||||
* To make things more efficient, be sure that each entry has a valid
|
||||
* nlinks value. The hardlink cache uses this to track when all links
|
||||
* have been found. If the nlinks value is zero, it will keep every
|
||||
* name in the cache indefinitely, which can use a lot of memory.
|
||||
*
|
||||
* Note that archive_entry_size() is reset to zero if the file
|
||||
* body should not be written to the archive. Pay attention!
|
||||
*/
|
||||
struct archive_entry_linkresolver;
|
||||
|
||||
/*
|
||||
* There are three different strategies for marking hardlinks.
|
||||
* The descriptions below name them after the best-known
|
||||
* formats that rely on each strategy:
|
||||
*
|
||||
* "Old cpio" is the simplest, it always returns any entry unmodified.
|
||||
* As far as I know, only cpio formats use this. Old cpio archives
|
||||
* store every link with the full body; the onus is on the dearchiver
|
||||
* to detect and properly link the files as they are restored.
|
||||
* "tar" is also pretty simple; it caches a copy the first time it sees
|
||||
* any link. Subsequent appearances are modified to be hardlink
|
||||
* references to the first one without any body. Used by all tar
|
||||
* formats, although the newest tar formats permit the "old cpio" strategy
|
||||
* as well. This strategy is very simple for the dearchiver,
|
||||
* and reasonably straightforward for the archiver.
|
||||
* "new cpio" is trickier. It stores the body only with the last
|
||||
* occurrence. The complication is that we might not
|
||||
* see every link to a particular file in a single session, so
|
||||
* there's no easy way to know when we've seen the last occurrence.
|
||||
* The solution here is to queue one link until we see the next.
|
||||
* At the end of the session, you can enumerate any remaining
|
||||
* entries by calling archive_entry_linkify(NULL) and store those
|
||||
* bodies. If you have a file with three links l1, l2, and l3,
|
||||
* you'll get the following behavior if you see all three links:
|
||||
* linkify(l1) => NULL (the resolver stores l1 internally)
|
||||
* linkify(l2) => l1 (resolver stores l2, you write l1)
|
||||
* linkify(l3) => l2, l3 (all links seen, you can write both).
|
||||
* If you only see l1 and l2, you'll get this behavior:
|
||||
* linkify(l1) => NULL
|
||||
* linkify(l2) => l1
|
||||
* linkify(NULL) => l2 (at end, you retrieve remaining links)
|
||||
* As the name suggests, this strategy is used by newer cpio variants.
|
||||
* It's noticeably more complex for the archiver, slightly more complex
|
||||
* for the dearchiver than the tar strategy, but makes it straightforward
|
||||
* to restore a file using any link by simply continuing to scan until
|
||||
* you see a link that is stored with a body. In contrast, the tar
|
||||
* strategy requires you to rescan the archive from the beginning to
|
||||
* correctly extract an arbitrary link.
|
||||
*/
|
||||
|
||||
__LA_DECL struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);
|
||||
__LA_DECL void archive_entry_linkresolver_set_strategy(
|
||||
struct archive_entry_linkresolver *, int /* format_code */);
|
||||
__LA_DECL void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);
|
||||
__LA_DECL void archive_entry_linkify(struct archive_entry_linkresolver *,
|
||||
struct archive_entry **, struct archive_entry **);
|
||||
__LA_DECL struct archive_entry *archive_entry_partial_links(
|
||||
struct archive_entry_linkresolver *res, unsigned int *links);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This is meaningless outside of this header. */
|
||||
#undef __LA_DECL
|
||||
|
||||
#endif /* !ARCHIVE_ENTRY_H_INCLUDED */
|
||||
@@ -0,0 +1,41 @@
|
||||
# libarchive.la - a libtool library file
|
||||
# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-14
|
||||
#
|
||||
# Please DO NOT delete this file!
|
||||
# It is necessary for linking the library.
|
||||
|
||||
# The name that we can dlopen(3).
|
||||
dlname=''
|
||||
|
||||
# Names of this library.
|
||||
library_names=''
|
||||
|
||||
# The name of the static archive.
|
||||
old_library='libarchive.a'
|
||||
|
||||
# Linker flags that cannot go in dependency_libs.
|
||||
inherited_linker_flags=''
|
||||
|
||||
# Libraries that this one depends upon.
|
||||
dependency_libs=' -L/opt/devkitpro/portlibs/3ds/lib -L/opt/devkitpro/libctru/lib /opt/devkitpro/portlibs/3ds/lib/liblzma.la -lbz2 -lz -lctru'
|
||||
|
||||
# Names of additional weak libraries provided by this library
|
||||
weak_library_names=''
|
||||
|
||||
# Version information for libarchive.
|
||||
current=18
|
||||
age=5
|
||||
revision=1
|
||||
|
||||
# Is this an already installed library?
|
||||
installed=yes
|
||||
|
||||
# Should we warn about portability when linking against -modules?
|
||||
shouldnotlink=no
|
||||
|
||||
# Files to dlopen/dlpreopen
|
||||
dlopen=''
|
||||
dlpreopen=''
|
||||
|
||||
# Directory that this library needs to be installed in:
|
||||
libdir='/opt/devkitpro/portlibs/3ds/lib'
|
||||
@@ -0,0 +1,12 @@
|
||||
prefix=/opt/devkitpro/portlibs/3ds
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: libarchive
|
||||
Description: library that can create and read several streaming archive formats
|
||||
Version: 3.5.1
|
||||
Cflags: -I${includedir}
|
||||
Cflags.private: -DLIBARCHIVE_STATIC
|
||||
Libs: -L${libdir} -larchive
|
||||
Libs.private: -llzma -lbz2 -lz -lctru
|
||||
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 135 KiB |