From d0b522ab97751445a526c08b86ae245351ea6e34 Mon Sep 17 00:00:00 2001 From: vgmoose Date: Mon, 5 Mar 2018 15:34:54 -0500 Subject: [PATCH] switch: HTTP download, fix unzipping --- Input.cpp | 2 +- Input.hpp | 2 +- Makefile | 8 ++++---- Makefile.pc | 5 +++-- Menu.cpp | 9 ++++++++- libs/get | 2 +- main.cpp | 8 ++++++-- stub.c | 4 ---- 8 files changed, 24 insertions(+), 16 deletions(-) delete mode 100644 stub.c diff --git a/Input.cpp b/Input.cpp index 7776ce9..588f631 100644 --- a/Input.cpp +++ b/Input.cpp @@ -29,7 +29,7 @@ void Input::updateButtons() this->btns_h |= ((event.key.keysym.sym == SDLK_DOWN)? BUTTON_DOWN : 0); this->btns_h |= ((event.key.keysym.sym == SDLK_LEFT)? BUTTON_LEFT : 0); this->btns_h |= ((event.key.keysym.sym == SDLK_RIGHT)? BUTTON_RIGHT : 0); - this->btns_h |= ((event.key.keysym.sym == SDLK_PLUS || event.key.keysym.sym == SDLK_RETURN)? BUTTON_PLUS : 0); + this->btns_h |= ((event.key.keysym.sym == SDLK_MINUS|| event.key.keysym.sym == SDLK_RETURN)? BUTTON_MINUS : 0); this->btns_h |= ((event.key.keysym.sym == SDLK_x)? BUTTON_X : 0); } } diff --git a/Input.hpp b/Input.hpp index 9ff955a..8b89cca 100644 --- a/Input.hpp +++ b/Input.hpp @@ -5,7 +5,7 @@ #define BUTTON_DOWN 0b00001000 #define BUTTON_X 0b00010000 -#define BUTTON_PLUS 0b00100000 +#define BUTTON_MINUS 0b00100000 #define BUTTON_A 0b01000000 #define BUTTON_B 0b10000000 diff --git a/Makefile b/Makefile index 60de93f..5375b94 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,8 @@ INCLUDES := . $(RAPIDJSON) $(MINIZIP) #DATA := data EXEFS_SRC := exefs_src -APP_TITLE := App Store -APP_AUTHOR := VGMoose +APP_TITLE := hb App Store +APP_AUTHOR := vgmoose APP_VERSION := 0.5 ICON := icon.jpg #APP_TITLEID := is the titleID of the app stored in the .nacp file (Optional) @@ -55,7 +55,7 @@ CFLAGS := -g -Wall -O2 \ -ffast-math \ $(ARCH) $(DEFINES) -CFLAGS += $(INCLUDE) -DSWITCH -D__LIBNX__ -DNOSTYLUS +CFLAGS += $(INCLUDE) -DSWITCH -D__LIBNX__ -DNOSTYLUS -DUSE_FILE32API CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 @@ -63,7 +63,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 ASFLAGS := -g $(ARCH) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) -LIBS := -lSDL_gfx -lSDL_image -lSDL -lz -lcurl -lnx -lm +LIBS := -lSDL_gfx -lSDL_image -lSDL -lz -lnx -lm #-lcurl #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing diff --git a/Makefile.pc b/Makefile.pc index 2821fd8..c8c8836 100644 --- a/Makefile.pc +++ b/Makefile.pc @@ -6,9 +6,10 @@ MINIZIP_O := zip.o ioapi.o unzip.o all: gcc -c $(MINIZIP)/*.c - g++ -std=gnu++11 *.cpp -lSDL -lSDLmain ./libs/get/src/*.cpp $(MINIZIP_O) -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -lcurl -lz -o appstore.exe + g++ -std=gnu++11 *.cpp -lSDL -lSDLmain ./libs/get/src/*.cpp $(MINIZIP_O) -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -lcurl -lz -o appstore.exe -fstack-protector-all macos: - g++ -std=gnu++11 *.cpp -lSDL -lSDLmain -framework Cocoa ./libs/get/src/*.cpp $(MINIZIP_O) -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -lcurl -lz -o appstore.exe + gcc -c $(MINIZIP)/*.c + g++ -std=gnu++11 *.cpp -lSDL -lSDLmain -framework Cocoa ./libs/get/src/*.cpp $(MINIZIP_O) -I $(RAPIDJSON) -I $(MINIZIP) -I /usr/local/include -lcurl -lz -o appstore.exe -fstack-protector-all clean: rm *.o *.bin diff --git a/Menu.cpp b/Menu.cpp index 39d352c..e197b9a 100644 --- a/Menu.cpp +++ b/Menu.cpp @@ -25,7 +25,7 @@ void Menu::display() { console->drawString(9, 21, "Homebrew App Store (Preview!)"); console->drawColorString(9, 26, "thanks to:", 0xcc, 0xcc, 0xcc); - console->drawColorString(15, 27, "vgmoose, pwsincd, rw-r-r_0644, zarklord, kgsws", 0xcc, 0xcc, 0xcc); + console->drawColorString(15, 27, "vgmoose, pwsincd, rw-r-r_0644, zarklord", 0xcc, 0xcc, 0xcc); console->drawColorString(9, 32, "Press [A] to continue", 0xff, 0xff, 0x00); } @@ -76,6 +76,13 @@ void Menu::display() if (this->screen == INSTALL_SCREEN) { + if (this->position < 0 || this->position > get->packages.size()) + { + // invalid selection, go back a screen + this->screen--; + return; + } + // currently selected package Package* cur = get->packages[this->position]; diff --git a/libs/get b/libs/get index 911f296..7a97cbb 160000 --- a/libs/get +++ b/libs/get @@ -1 +1 @@ -Subproject commit 911f296e55c71db4df7bb2c8455ee4d7c79016ae +Subproject commit 7a97cbb861d2697aefb6e92a4b4aca01621baa56 diff --git a/main.cpp b/main.cpp index a76153e..d766914 100644 --- a/main.cpp +++ b/main.cpp @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) menu->display(); SDL_Delay(16); - // updeate pressed buttons in input object + // update pressed buttons in input object input->updateButtons(); // if we're on the install screen, perform an install @@ -58,7 +58,11 @@ int main(int argc, char *argv[]) menu->screen = REMOVING; // if plus is pressed, exit - if (input->held(BUTTON_PLUS)) + if (input->held(BUTTON_MINUS)) + running = false; + + // if B is pressed on the splash screen, exit + if (menu->screen == SPLASH && input->held(BUTTON_B)) running = false; // move cursor up or down depending on input diff --git a/stub.c b/stub.c deleted file mode 100644 index e118830..0000000 --- a/stub.c +++ /dev/null @@ -1,4 +0,0 @@ -void fopen64() {} -void ftello64() {} -void fseeko64() {} -void access() {}