Skip to content

Commit

Permalink
Public Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyquagsire23 committed Dec 7, 2016
0 parents commit d2528e5
Show file tree
Hide file tree
Showing 82 changed files with 20,987 additions and 0 deletions.
450 changes: 450 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions Makefile
@@ -0,0 +1,73 @@
.SUFFIXES:

ifeq ($(strip $(WUT_ROOT)),)
$(error "Please ensure WUT_ROOT is in your environment.")
endif

ifeq ($(findstring CYGWIN,$(shell uname -s)),CYGWIN)
ROOT := $(shell cygpath -w ${CURDIR})
WUT_ROOT := $(shell cygpath -w ${WUT_ROOT})
else
ROOT := $(CURDIR)
endif

include $(WUT_ROOT)/rules/rpl.mk

TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCE := src src/matrix
INCLUDE := include
DATA := data
LIBS := -lcrt -lgcc -lm -lcoreinit -lgx2 -lvpad -lproc_ui -lsysapp -lgd -lpng -lz -ljpeg -lfreetype -lm

CFLAGS += -O2 -Wall -std=c11
CXXFLAGS += -O2 -Wall

ifneq ($(BUILD),$(notdir $(CURDIR)))

export OUTPUT := $(ROOT)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCE),$(ROOT)/$(dir)) \
$(foreach dir,$(DATA),$(ROOT)/$(dir))
export BUILDDIR := $(ROOT)
export DEPSDIR := $(BUILDDIR)

CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S)))

ifeq ($(strip $(CXXFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif

export OFILES := $(CFILES:.c=.o) \
$(CXXFILES:.cpp=.o) \
$(SFILES:.S=.o)
export INCLUDES := $(foreach dir,$(INCLUDE),-I$(ROOT)/$(dir)) \
-I$(ROOT)/$(BUILD) -I $(DEVKITPPC)/include

.PHONY: $(BUILD) clean

$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(ROOT)/Makefile

clean:
@echo "[RM] $(notdir $(OUTPUT))"
@rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).rpx $(OUTPUT).a $(OUTPUT).woomy
@rm $(OUTPUT)/code/*.rpx

else

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

$(OUTPUT).woomy: $(OUTPUT).rpx
cp $(OUTPUT).rpx $(OUTPUT)/code/
makefst -out $(OUTPUT).woomy -name "Woominstaller" -internal "Woominstaller Application" -entry "woomy" -icon "$(OUTPUT)/meta/iconTex.tga" $(OUTPUT)/
$(OUTPUT).rpx: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

-include $(DEPENDS)

endif
9 changes: 9 additions & 0 deletions README.md
@@ -0,0 +1,9 @@
# Woomïnstaller GX2
![Woomïnstaller Screenshot](http://i.imgur.com/ZCRnrvy.png)
Homebrew package installer for Wii U

##Compiling Notes
Compilation requires [makefst](https://github.com/shinyquagsire23/makefst), [WUT](https://github.com/decaf-emu/wut), and DevKitPPC portlibs to be installed. The generated output is a .woomy package and a woominstaller\_gx2\_out folder with raw FST contents.

##Usage Notes
This application requires access to texture2D.gsh from either Health and Safety or in content/. This can either be provided through custom firmwares which properly loosen file permissions or by changing the permissions of /vol/storage_mlc01/sys/title/00050010/1004EX00/content/shader/texture2D.gsh to RW for all applications (where X is 0, 1 or 2 depending on the Wii U region). This is due to using GPU acceleration through GX2 while there is no publically accessible GX2 shader compiler (an LLVM-based compiler *may* be possible in the future). The current alternative would be to build in shaders generated by Nintendo's SDK, which is potentially illegal.
97 changes: 97 additions & 0 deletions include/button.h
@@ -0,0 +1,97 @@
/*
* Woomïnstaller GX2 - Homebrew package installer for Wii U
*
* Copyright (C) 2016 SALT
* Copyright (C) 2016 Max Thomas (Shiny Quagsire) <mtinc2@gmail.com>
*
* This code is licensed under the terms of the GNU LGPL, version 2.1
* see file LICENSE.md or https://www.gnu.org/licenses/lgpl-2.1.txt
*/

#ifndef BUTTON_H
#define BUTTON_H

#include <wut.h>
#include <memory.h>
#include <gx2/texture.h>

#include "draw.h"
#include "font.h"
#include "gui.h"

typedef struct button_texture
{
GX2Texture *texture;
float x_shift;
float y_shift;
float width;
float height;
float x_corner_size;
float top_y_corner_size;
float bottom_y_corner_size;
bool x_flip;
bool y_flip;
float scale;
} button_texture;

typedef struct button_text
{
float x_shift;
float y_shift;
int height;
int color;
char *text;
} button_text;

typedef struct button_t
{
float x_pos;
float y_pos;
float width;
float height;
float scale;
float scale_pressed;
int button_mask;
bool selected;
bool touching;
bool touch_down;
bool inflated;
bool x_center_scale;
bool y_center_scale;
float touch_x;
float touch_y;
int num_textures;
button_texture** textures;
int num_texts;
button_text** texts;
int num_start_events;
void **start_events;
int num_inflate_events;
void **inflate_events;
int num_inflate_release_events;
void **inflate_release_events;
int num_deflate_events;
void **deflate_events;
void *extra_data;
void *extra_data_2;
} button_t;

bool in_rect(float tpXPos, float tpYPos, float x_pos, float y_pos, float width, float height);

button_t *button_instantiate(float x_pos, float y_pos, float scale_pressed);
void button_add_texture(button_t *button, GX2Texture *texture, float x_shift, float y_shift, float width, float height, bool x_flip, bool y_flip);
void button_add_texture_nostretch(button_t *button, GX2Texture *texture, float x_shift, float y_shift, float width, float height, float x_corner_size, float top_y_corner_size, float bottom_y_corner_size, bool x_flip, bool y_flip);
void button_add_text(button_t *button, float x_shift, float y_shift, int height, int color, char *text);
void button_update(button_t *button, float tpXPos, float tpYPos, bool tpIsTouched);
void button_draw(button_t *button);
void button_destroy(button_t *button);

void button_add_start_event(button_t *button, void *callback);
void button_add_inflate_event(button_t *button, void *callback);
void button_add_inflate_release_event(button_t *button, void *callback);
void button_add_deflate_event(button_t *button, void *callback);

void button_add_button_map(button_t *button, u32 mask);
void button_remove_button_map(button_t *button, u32 mask);

#endif
34 changes: 34 additions & 0 deletions include/common.h
@@ -0,0 +1,34 @@
/*
* Woomïnstaller GX2 - Homebrew package installer for Wii U
*
* Copyright (C) 2016 SALT
* Copyright (C) 2016 Max Thomas (Shiny Quagsire) <mtinc2@gmail.com>
* Copyright (C) 2016 WulfyStylez
*
* This code is licensed under the terms of the GNU LGPL, version 2.1
* see file LICENSE.md or https://www.gnu.org/licenses/lgpl-2.1.txt
*/

#ifndef COMMON_H
#define COMMON_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <dirent.h>
#include <math.h>
#include <wut.h>
#include <wut_types.h>
#include <coreinit/core.h>
#include <coreinit/debug.h>
#include <coreinit/thread.h>
#include <coreinit/filesystem.h>
#include <coreinit/foreground.h>
#include <coreinit/screen.h>
#include <coreinit/internal.h>
#include <coreinit/mcp.h>

int read_directory(char *path, struct dirent** out);

#endif
57 changes: 57 additions & 0 deletions include/draw.h
@@ -0,0 +1,57 @@
/*
* Woomïnstaller GX2 - Homebrew package installer for Wii U
*
* Copyright (C) 2016 SALT
* Copyright (C) 2016 Max Thomas (Shiny Quagsire) <mtinc2@gmail.com>
*
* This code is licensed under the terms of the GNU LGPL, version 2.1
* see file LICENSE.md or https://www.gnu.org/licenses/lgpl-2.1.txt
*/

#ifndef DRAW_H
#define DRAW_H

#include <gx2/mem.h>
#include <gx2/draw.h>
#include <gx2/enum.h>
#include <gx2/swap.h>
#include <gx2/clear.h>
#include <gx2/state.h>
#include <gx2/texture.h>
#include <gx2/display.h>
#include <gx2/context.h>
#include <gx2/shaders.h>
#include <gx2/registers.h>

#include <string.h>
#include <stdlib.h>

#include "gl-matrix.h"

#define TARGET_WIDTH (1920)
#define TARGET_HEIGHT (1080)

GX2VertexShader *vertexShader;
GX2PixelShader *pixelShader;
GX2FetchShader *fetchShader;
GX2AttribStream *attributes;
void *fetchShaderProgramm;
mat4_t projectionMtx;

void clean_tex_allocs();

void draw_set_global_alpha(float a);
void draw_set_global_scale(float scale);
void draw_set_global_xshift(float shift);
void draw_set_global_yshift(float shift);
void draw_set_use_globals(bool state);
void draw_set_use_global_shifts(bool state);

void render_texture_partial_color(GX2Texture *render_texture, float x_pos, float y_pos, float width, float height, int partial_x, int partial_y, int partial_width, int partial_height, float r, float g, float b, float a);
void render_texture_partial(GX2Texture *render_texture, float x_pos, float y_pos, float width, float height, int partial_x, int partial_y, int partial_width, int partial_height);
void render_texture_color(GX2Texture *render_texture, float x_pos, float y_pos, float width, float height, float r, float g, float b, float a);
void render_texture(GX2Texture *render_texture, float x_pos, float y_pos, float width, float height);
void render_texture_nostretch_color(GX2Texture *render_texture, float x_pos, float y_pos, float x_corner_size, float top_y_corner_size, float bottom_y_corner_size, float width, float height, float r, float g, float b, float a);
void render_texture_nostretch(GX2Texture *render_texture, float x_pos, float y_pos, float x_corner_size, float top_y_corner_size, float bottom_y_corner_size, float width, float height);

#endif

0 comments on commit d2528e5

Please sign in to comment.