Skip to content

Commit

Permalink
Final v1.0.0 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryOderNichts committed Jul 20, 2024
1 parent 855806a commit 130db2b
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 26 deletions.
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ It temporarily applies patches to the IOS-PAD module responsible for Bluetooth c
- Connect up to 7 controllers wirelessly via Bluetooth
- Rumble support
- Battery levels
- Button and stick remapping (only for Bloopair controllers)

## Supported controllers
- Nintendo Switch Pro Controller
Expand All @@ -22,19 +23,31 @@ To pair a DualShock 3 to the console, see the [Pairing a DualShock 3](#pairing-a
## Installation
- Download and extract the latest .zip from the [releases page](https://github.com/GaryOderNichts/Bloopair/releases).
- Copy the `30_bloopair.rpx` from the .zip file to the `modules/setup/` folder of your target environment on the SD Card.
This would be `wiiu/environments/tiramisu/modules/setup/` for Tiramisu.
This would be `wiiu/environments/aroma/modules/setup/` for Aroma.
- Copy the `wiiu` folder from the .zip and copy it to the root of your SD Card.
If you're using aroma you can delete the `Koopair.rpx` in the `wiiu/apps` folder and use the .wuhb instead.

Make sure you're using Tiramisu or Aroma. Follow https://wiiu.hacks.guide/#/ to setup Tiramisu.
More info about Tiramisu here: https://maschell.github.io/homebrew/2021/12/31/tiramisu.html
Make sure you're using Aroma or Tiramisu. Follow https://wiiu.hacks.guide/#/ to setup Aroma.

## Usage
- Once you're booted into Tiramisu and are in the Wii U menu, press the SYNC button on your console and controller.
- Once you're booted into Aroma or Tiramisu and are in the Wii U menu, press the SYNC button on your console and controller.
- Wait until the Controller is connected.

If a controller had been paired in the past, simply turn it on again and it should reconnect.

## Koopair
Koopair is the Bloopair companion app which comes with Bloopair.

<img src="https://gist.github.com/user-attachments/assets/d72b69ec-092d-487a-bcc1-2ff197de39f7" width="23%"></img> <img src="https://gist.github.com/user-attachments/assets/135da080-3719-4ff7-b629-68ce6c59c4f0" width="23%"></img> <img src="https://gist.github.com/user-attachments/assets/e1ab3a08-5daa-44d9-9d9a-fd1da9131283" width="23%"></img> <img src="https://gist.github.com/user-attachments/assets/34e5da6b-522d-4dfd-81e5-da09f6f825bd" width="23%"></img>
<img src="https://gist.github.com/user-attachments/assets/6ebdd0d8-485a-46ee-a1fd-aeddcdfe3f31" width="23%"></img> <img src="https://gist.github.com/user-attachments/assets/338756b7-7868-406a-bf92-f2b2d5d6a6df" width="23%"></img> <img src="https://gist.github.com/user-attachments/assets/6a3e80b9-9d1f-4ee4-b462-3f91ae0f056b" width="23%"></img> <img src="https://gist.github.com/user-attachments/assets/f957d874-4a1a-4380-85b2-2e8dda0cbe5c" width="23%"></img>

Koopair supports:
- Testing connected controllers
- Creating mappings for buttons and sticks
- Editing controller options
- Managing configuration files
- Pairing DualShock 3 controllers

## Pairing a DualShock 3
The DualShock 3 needs to be paired using a USB cable. After the initial pairing it can be used like any other wireless Bluetooth controller.
- Open Koopair from the Wii U menu or Homebrew Launcher. Now open the "Controller Pairing" option on the menu.
Expand All @@ -47,16 +60,20 @@ The DualShock 3 is now ready to use with the console.

## FAQ / Troubleshooting

### My controller doesn't pair to the console
**My controller doesn't pair to the console**
Make sure Bloopair is running and both the console and the controller are in SYNC mode.
Also make sure the controller is on the supported list.
Wait for about a minute, and if nothing happens restart your console and redo the process.
You can also try [clearing controller syncs](https://en-americas-support.nintendo.com/app/answers/detail/a_id/1705/~/how-to-clear-all-syncs).

### Will you add support for controller xyz?
**Will you add support for controller xyz?**
Possibly, I've for now added support for all the controllers I currently own. Maybe I can get a few more controllers which I could add support for.
Pull requests for different controllers are always welcome.

**Where are configuration files stored?**
Bloopair loads configuration files from the `wiiu/bloopair` folder on your SD Card.
This means configurations work across multiple environments.

## To-Do
- Support more controllers
- Bluetooth LE support (Unlikely, only partially supported by the Bluetooth Stack)
Expand Down Expand Up @@ -87,5 +104,6 @@ Koopair additionally requires the following packages:
- wiiu-sdl2
- wiiu-sdl2_gfx
- wiiu-sdl2_ttf
- wiiu-sdl2_image

Run `make`.
Binary file modified dist/wiiu/apps/Koopair/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions koopair/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TOPDIR ?= $(CURDIR)
# APP_SHORTNAME sets the short name of the application
# APP_AUTHOR sets the author of the application
#-------------------------------------------------------------------------------
APP_NAME := Bloopair Companion App
APP_NAME := Koopair
APP_SHORTNAME := Koopair
APP_AUTHOR := GaryOderNichts
APP_VERSION := 1.0.0
Expand Down Expand Up @@ -56,7 +56,7 @@ CXXFLAGS := $(CFLAGS) -std=gnu++20
ASFLAGS := $(ARCH)
LDFLAGS = $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map)

LIBS := -lSDL2 -lSDL2_ttf -lSDL2_gfx -lfreetype -lharfbuzz -lfreetype -lpng -lbz2 -lz -lbloopair -lwut
LIBS := -lSDL2 -lSDL2_ttf -lSDL2_gfx -lSDL2_image -lfreetype -lharfbuzz -lfreetype -lpng -lbz2 -lz -lbloopair -lwut

ifeq ($(DEBUG), 1)
CFLAGS += -g -DCOMMIT_HASH=\"$(BLOOPAIR_COMMIT_HASH)\"
Expand Down Expand Up @@ -200,6 +200,12 @@ $(OFILES_SRC) : $(HFILES_BIN)
@echo $(notdir $<)
@$(bin2o)

#-------------------------------------------------------------------------------
%.png.o %_png.h : %.png
#-------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

-include $(DEPENDS)

#-------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions koopair/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Koopair additionally requires the following packages:
- wiiu-sdl2
- wiiu-sdl2_gfx
- wiiu-sdl2_ttf
- wiiu-sdl2_image
Binary file added koopair/data/shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified koopair/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 33 additions & 1 deletion koopair/source/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ bool KPADController::Update()
MAP_BTN(WPAD_CLASSIC_BUTTON_R, BUTTON_R);
MAP_BTN(WPAD_CLASSIC_BUTTON_L, BUTTON_L);
#undef MAP_BTN

mStickL.x = mStatus.classic.leftStick.x;
mStickL.y = mStatus.classic.leftStick.y;
mStickR.x = mStatus.classic.rightStick.x;
mStickR.y = mStatus.classic.rightStick.y;
}

return true;
Expand Down Expand Up @@ -324,7 +329,8 @@ std::array<uint8_t, 6> KPADController::GetBDA() const
}

CombinedInputController::CombinedInputController() : Controller(),
mName("Combined Controller")
mName("Combined Controller"),
mPreviousButtons()
{
}

Expand All @@ -342,9 +348,35 @@ bool CombinedInputController::Combine(const std::vector<const Controller*>& cont
mButtonsHeld |= c->GetButtonsHeld();
mButtonsTriggered |= c->GetButtonsTriggered();

if (c->GetStickL().x > 0.2f) {
if ((mPreviousButtons & BUTTON_RIGHT) == 0) {
mButtonsTriggered |= BUTTON_RIGHT;
}
mButtonsHeld |= BUTTON_RIGHT;
} else if (c->GetStickL().x < -0.2f) {
if ((mPreviousButtons & BUTTON_LEFT) == 0) {
mButtonsTriggered |= BUTTON_LEFT;
}
mButtonsHeld |= BUTTON_LEFT;
}
if (c->GetStickL().y > 0.2f) {
if ((mPreviousButtons & BUTTON_UP) == 0) {
mButtonsTriggered |= BUTTON_UP;
}
mButtonsHeld |= BUTTON_UP;
} else if (c->GetStickL().y < -0.2f) {
if ((mPreviousButtons & BUTTON_DOWN) == 0) {
mButtonsTriggered |= BUTTON_DOWN;
}
mButtonsHeld |= BUTTON_DOWN;
}


// TODO sticks
}

mPreviousButtons = mButtonsHeld;

return true;
}

Expand Down
2 changes: 2 additions & 0 deletions koopair/source/Controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,6 @@ class CombinedInputController : public Controller {

private:
std::string mName;

Buttons mPreviousButtons;
};
18 changes: 16 additions & 2 deletions koopair/source/Gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "Gfx.hpp"
#include "SDL_FontCache.h"
#include <SDL2_gfxPrimitives.h>
#include <SDL_image.h>
#include <map>
#include <cstdarg>

Expand All @@ -25,6 +26,7 @@

#include <ter-u32b_bdf.h>
#include <fa-solid-900_ttf.h>
#include <shell_png.h>

namespace
{
Expand All @@ -45,6 +47,8 @@ TTF_Font* iconFont = nullptr;

std::map<Uint16, SDL_Texture*> iconCache;

SDL_Texture* appIcon = nullptr;

FC_Font* GetFontForSize(int size)
{
if (fontMap.contains(size)) {
Expand All @@ -67,6 +71,10 @@ FC_Font* GetFontForSize(int size)

SDL_Texture* LoadIcon(Uint16 icon)
{
if (icon == Gfx::APP_ICON) {
return appIcon;
}

if (iconCache.contains(icon)) {
return iconCache[icon];
}
Expand Down Expand Up @@ -123,17 +131,22 @@ bool Init()
return false;
}

if (!FC_LoadFont_RW(monospaceFont, renderer, SDL_RWFromMem((void*)ter_u32b_bdf, ter_u32b_bdf_size), 1, 32, Gfx::COLOR_BLACK, TTF_STYLE_NORMAL)) {
if (!FC_LoadFont_RW(monospaceFont, renderer, SDL_RWFromConstMem(ter_u32b_bdf, ter_u32b_bdf_size), 1, 32, Gfx::COLOR_BLACK, TTF_STYLE_NORMAL)) {
FC_FreeFont(monospaceFont);
return false;
}

// icons @256 should be large enough for our needs
iconFont = TTF_OpenFontRW(SDL_RWFromMem((void*)fa_solid_900_ttf, fa_solid_900_ttf_size), 1, 256);
iconFont = TTF_OpenFontRW(SDL_RWFromConstMem(fa_solid_900_ttf, fa_solid_900_ttf_size), 1, 256);
if (!iconFont) {
return false;
}

appIcon = IMG_LoadTextureTyped_RW(renderer, SDL_RWFromConstMem(shell_png, shell_png_size), 1, "PNG");
if (!appIcon) {
return false;
}

return true;
}

Expand All @@ -147,6 +160,7 @@ void Shutdown()
SDL_DestroyTexture(value);
}

SDL_DestroyTexture(appIcon);
FC_FreeFont(monospaceFont);
TTF_CloseFont(iconFont);
TTF_Quit();
Expand Down
2 changes: 2 additions & 0 deletions koopair/source/Gfx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ constexpr SDL_Color COLOR_BARS = { 0x00, 0x22, 0x42, 0xff };
constexpr SDL_Color COLOR_ERROR = { 0xff, 0x33, 0x33, 0xff };
constexpr SDL_Color COLOR_WIIU = { 0x00, 0x95, 0xc7, 0xff };

constexpr uint16_t APP_ICON = 0xfffe;

enum AlignFlags {
ALIGN_LEFT = 1 << 0,
ALIGN_RIGHT = 1 << 1,
Expand Down
8 changes: 4 additions & 4 deletions koopair/source/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ void Screen::DrawTopBar(const char* name)
Gfx::DrawRectFilled(0, 0, Gfx::SCREEN_WIDTH, 75, Gfx::COLOR_BARS);

// draw top bar content
Gfx::DrawIcon(32, 75 / 2, 60, Gfx::COLOR_TEXT, 0xffff, Gfx::ALIGN_VERTICAL);
Gfx::Print(128, 75 / 2, 60, Gfx::COLOR_TEXT, "Koopair", Gfx::ALIGN_VERTICAL);
Gfx::DrawIcon(68, 75 / 2, 60, Gfx::COLOR_TEXT, Gfx::APP_ICON, Gfx::ALIGN_CENTER);
Gfx::Print(128 + 8, 75 / 2, 60, Gfx::COLOR_TEXT, "Koopair", Gfx::ALIGN_VERTICAL);
#ifdef NDEBUG
Gfx::Print(Gfx::GetTextWidth(60, "Koopair") + 128 + 16, 75 / 2 + 5, 50, Gfx::COLOR_ALT_TEXT, "v" APP_VERSION, Gfx::ALIGN_VERTICAL);
Gfx::Print(Gfx::GetTextWidth(60, "Koopair") + 128 + 8 + 16, 75 / 2 + 5, 50, Gfx::COLOR_ALT_TEXT, "v" APP_VERSION, Gfx::ALIGN_VERTICAL);
#else
Gfx::Print(Gfx::GetTextWidth(60, "Koopair") + 128 + 16, 75 / 2 + 5, 50, Gfx::COLOR_ALT_TEXT, "v" APP_VERSION "-" + std::string(COMMIT_HASH).substr(0, 7), Gfx::ALIGN_VERTICAL);
Gfx::Print(Gfx::GetTextWidth(60, "Koopair") + 128 + 8 + 16, 75 / 2 + 5, 50, Gfx::COLOR_ALT_TEXT, "v" APP_VERSION "-" + std::string(COMMIT_HASH).substr(0, 7), Gfx::ALIGN_VERTICAL);
#endif
if (name)
Gfx::Print(Gfx::SCREEN_WIDTH - 32, 75 / 2, 50, Gfx::COLOR_ALT_TEXT, name, Gfx::ALIGN_VERTICAL | Gfx::ALIGN_RIGHT);
Expand Down
3 changes: 1 addition & 2 deletions koopair/source/screens/ControllerConfigurationsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ ControllerConfigurationsScreen::~ControllerConfigurationsScreen()

void ControllerConfigurationsScreen::Draw()
{
// TODO
DrawTopBar("ControllerConfigurationsScreen");
DrawTopBar("Controller Configurations");

if (!mConfigurations.empty()) {
int drawIndex = 0;
Expand Down
3 changes: 1 addition & 2 deletions koopair/source/screens/ControllerMappingScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ ControllerMappingScreen::~ControllerMappingScreen()

void ControllerMappingScreen::Draw()
{
// TODO
DrawTopBar("ControllerMappingScreen");
DrawTopBar("Controller Mapping");

int drawIndex = 0;
for (size_t i = mSelectionStart; i < mSelectionEnd; i++) {
Expand Down
2 changes: 1 addition & 1 deletion koopair/source/screens/ControllerOptionsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ControllerOptionsScreen::~ControllerOptionsScreen()

void ControllerOptionsScreen::Draw()
{
DrawTopBar("ControllerOptionsScreen");
DrawTopBar("Controller Options");

uint32_t yOff = 128;

Expand Down
3 changes: 1 addition & 2 deletions koopair/source/screens/ControllerPairingScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ ControllerPairingScreen::~ControllerPairingScreen()

void ControllerPairingScreen::Draw()
{
// TODO
DrawTopBar("ControllerPairingScreen");
DrawTopBar("Controller Pairing");

Gfx::Print(Gfx::SCREEN_WIDTH / 2, Gfx::SCREEN_HEIGHT / 2, 60, Gfx::COLOR_TEXT,
"Connect a DualShock 3 using a USB cable\nto any USB port of the system to pair it.\n"
Expand Down
4 changes: 2 additions & 2 deletions koopair/source/screens/MainScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
namespace
{

// Let's make sure to not break API for minor and patch versions
// Let's make sure to not break API for patch versions
constexpr uint32_t kMinBloopairVersion = BLOOPAIR_VERSION(1, 0, 0);
constexpr uint32_t kMaxBloopairVersion = BLOOPAIR_VERSION(1, 255, 255);
constexpr uint32_t kMaxBloopairVersion = BLOOPAIR_VERSION(1, 0, 255);

}

Expand Down
3 changes: 1 addition & 2 deletions koopair/source/screens/SettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ SettingsScreen::~SettingsScreen()

void SettingsScreen::Draw()
{
// TODO
DrawTopBar("SettingsScreen");
DrawTopBar("Settings");

Gfx::Print(Gfx::SCREEN_WIDTH / 2, Gfx::SCREEN_HEIGHT / 2, 60, Gfx::COLOR_TEXT, "Nothing here yet :)", Gfx::ALIGN_CENTER);

Expand Down

0 comments on commit 130db2b

Please sign in to comment.