diff --git a/Makefile.wiiu b/Makefile.wiiu new file mode 100644 index 0000000..67484a3 --- /dev/null +++ b/Makefile.wiiu @@ -0,0 +1,57 @@ +BASEDIR := $(dir $(firstword $(MAKEFILE_LIST))) +VPATH := $(BASEDIR) + + +GET := ./libs/get/src +RAPIDJSON := ./libs/get/src/libs/rapidjson/include +MINIZIP := ./libs/get/src/libs/minizip + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing header files +#--------------------------------------------------------------------------------- +TARGET := appstore +BUILD := build +SOURCES := . $(GET) $(MINIZIP) console gui +INCLUDES := -I. -I$(RAPIDJSON) -I$(MINIZIP) + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +CFLAGS += -DUSE_FILE32API -DNOCRYPT -DINPUT_JOYSTICK $(INCLUDES) +CXXFLAGS += $(CFLAGS) +LDFLAGS += $(WUT_NEWLIB_LDFLAGS) $(WUT_STDCPP_LDFLAGS) $(WUT_DEVOPTAB_LDFLAGS) \ + -lSDL2_ttf -lfreetype -lpng -lSDL2_gfx -lSDL2_image -lSDL2 -ljpeg -lz -lzip \ + -lcoreinit -lvpad -lsysapp -lnsysnet -lnlibcurl -lproc_ui -lgx2 -lgfd -lwhb + +#--------------------------------------------------------------------------------- +# get a list of objects +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.c)) +CPPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.cpp)) +SFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.s)) +OBJECTS := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) + +#--------------------------------------------------------------------------------- +# objectives +#--------------------------------------------------------------------------------- +$(TARGET).rpx: $(OBJECTS) + +clean: + rm -rf $(TARGET).rpx $(TARGET).rpx.elf $(OBJECTS) $(OBJECTS:.o=.d) + +#--------------------------------------------------------------------------------- +# wut +#--------------------------------------------------------------------------------- +WUT_KEEP_RPLELF := 1 +include $(WUT_ROOT)/share/wut.mk + +#--------------------------------------------------------------------------------- +# portlibs +#--------------------------------------------------------------------------------- +PORTLIBS := $(DEVKITPRO)/portlibs/ppc +LDFLAGS += -L$(PORTLIBS)/lib +CFLAGS += -I$(PORTLIBS)/include +CXXFLAGS += -I$(PORTLIBS)/include \ No newline at end of file diff --git a/console/Input.cpp b/console/Input.cpp index 588f631..c6e862a 100644 --- a/console/Input.cpp +++ b/console/Input.cpp @@ -2,6 +2,14 @@ Input::Input() { +#if defined(INPUT_JOYSTICK) + if(SDL_Init(SDL_INIT_JOYSTICK) < 0) + return; + + for (int i = 0; i < SDL_NumJoysticks(); i++) + if (!SDL_JoystickOpen(i)) + printf("SDL_JoystickOpen: %s\n", SDL_GetError()); +#endif } void Input::close() @@ -10,17 +18,29 @@ void Input::close() void Input::updateButtons() { - // reset buttons - this->btns_h = 0b00000000; - SDL_Event event; SDL_PollEvent(&event); + // reset buttons + this->btns_h = 0b00000000; + this->lstick_x = 0; this->lstick_y = 0; this->rstick_x = 0; this->rstick_x = 0; - + +#if defined(INPUT_JOYSTICK) + if (event.type == SDL_JOYBUTTONDOWN) + { + this->btns_h |= ((event.jbutton.button == SDL_CONTROLLER_BUTTON_A)? BUTTON_A : 0); + this->btns_h |= ((event.jbutton.button == SDL_CONTROLLER_BUTTON_B)? BUTTON_B : 0); + this->btns_h |= ((event.jbutton.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)? BUTTON_UP : 0); + this->btns_h |= ((event.jbutton.button == SDL_CONTROLLER_BUTTON_MAX)? BUTTON_DOWN : 0); + this->btns_h |= ((event.jbutton.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)? BUTTON_LEFT : 0); + this->btns_h |= ((event.jbutton.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)? BUTTON_RIGHT : 0); + this->btns_h |= ((event.jbutton.button == SDL_CONTROLLER_BUTTON_DPAD_UP)? BUTTON_MINUS : 0); + } +#else if (event.type == SDL_KEYDOWN) { this->btns_h |= ((event.key.keysym.sym == SDLK_a)? BUTTON_A : 0); @@ -32,6 +52,7 @@ void Input::updateButtons() 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); } +#endif } bool Input::held(char b) diff --git a/gui/MainDisplay.cpp b/gui/MainDisplay.cpp index a1af35c..db5bd82 100644 --- a/gui/MainDisplay.cpp +++ b/gui/MainDisplay.cpp @@ -104,7 +104,12 @@ bool MainDisplay::process(InputEvents* event) // if we're on the splash/loading screen, we need to fetch icons+screenshots from the remote repo // and load them into our surface cache with the pkg_name+version as the key +#if defined(__WIIU__) + //FIXME + if (this->showingSplash /*&& event->noop*/) +#else if (this->showingSplash && event->noop) +#endif { // should be a progress bar if (this->get->packages.size() != 1) diff --git a/main.cpp b/main.cpp index 21b9952..104a76f 100644 --- a/main.cpp +++ b/main.cpp @@ -12,11 +12,41 @@ #include #endif +#if defined(__WIIU__) + #include + + +//remove when the wiiu starts working +#include +#include +#include +static devoptab_t dotab_stdout; +static ssize_t wiiu_log_write (struct _reent *r, void *fd, const char *ptr, size_t len) { + WHBLogPrintf("%*.*s", len, len, ptr); + return len; +} + +#endif + int main(int argc, char *argv[]) { // consoleDebugInit(debugDevice_SVC); // stdout = stderr; // for yuzu +#if defined(__WIIU__) + +//remove when the wiiu starts working +WHBLogUdpInit(); +memset(&dotab_stdout, 0, sizeof(devoptab_t)); +dotab_stdout.name = "stdout_udp"; +dotab_stdout.write_r = &wiiu_log_write; +devoptab_list[STD_OUT] = &dotab_stdout; +devoptab_list[STD_ERR] = &dotab_stdout; + + + chdir("fs:/vol/external01/wiiu/apps/appstore"); +#endif + #if defined(NOGUI) // if NOGUI variable defined, use the console's main method int console_main(void);