Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from yahya14/master
Browse files Browse the repository at this point in the history
Added inkstrike DRC forcing and menu appears only once from the hbc
OatmealDome authored Jul 17, 2017
2 parents d688251 + f140c6e commit 6d0cb99
Showing 18 changed files with 597 additions and 255 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ export OBJCOPY := $(PREFIX)objcopy
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := geckiine
TARGET := swapdrc
BUILD := build
BUILD_DBG := $(TARGET)_dbg
SOURCES := src \
107 changes: 78 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,89 @@
# geckiine
# SWAP DRC for TV-Only Wii U Games

This tool installs both TCPGecko and Cafiine into the system memory so that you can use them at the same time.
Introducing Swap DRC, a homebrew application that allows you to play TV-only Wii U games on your gamepad screen.

## Usage
Swap DRC works by switching display buffers between the TV screen and the gamepad screen with a press of a button activation. This app also includes the TCPGecko and Cafiine installers for the other mediums of modding. The gamepad sensor bar can also switch on when the TV display is switched to the gamepad screen, so playing with wiimotes with just the gamepad is very possible.

### Prerequisites
* Wii U (on firmware version 4.1.0 or higher)
* Homebrew Launcher
* a cafiine server (examples: [the original by Chadderz and MrRean](https://github.com/MrRean/Cafiine-410-551/blob/master/server/cafiine_server.exe), [MusicRandomizer](https://github.com/OatmealDome/SplatoonUtilities/blob/master/MusicRandomizer/README.md), [Ray's custom server](https://github.com/Syroot/CafiineServer), and more)
* Your computer's local IP ([Windows](https://support.microsoft.com/en-us/help/15291/windows-find-pc-ip-address), [macOS](http://osxdaily.com/2010/11/21/find-ip-address-mac/))
Note that this mod has no audio swapping support, thus use headphones to listen to the audio from your gamepad if your game requires it.

### Instructions
## Instructions

Note: It is highly recommended that you set a static IP for your computer when using geckiine. For more information, click [here](https://github.com/OatmealDome/SplatoonUtilities/blob/master/Misc/StaticIPGuide.md).
To switch the TV and gamepad display buffers, press and hold the **L shoulder button**, then press **MINUS**. Switching them again will revert the displays back to normal.

0. Find your computer's local IP address. If you set a static IP because of the above recommendation, that static IP is your computer's local IP address.)
1. There are two possible ways to get a geckiine.elf file with your IP address.
If you're playing with Splatoon's enhanced swapping controls;

a. Go to [466gaming.ga/geckiine](http://466gaming.ga/geckiine) and enter in your IP address. Click the download button and extract the ZIP file.
+ Press **B** to switch screens except in-game menus.
+ Hold **A** + **D-PAD** in any direction to super jump to a teammate or the spawn point during a match.

## Requirements

* An SD card
* The Homebrew Launcher ([Haxchi](https://gbatemp.net/threads/haxchi-v2-0-a-persistent-wiiu-hack.451071/) or [Loadiine.ovh](http://loadiine.ovh) method)
* A Wii U (on firmware version 5.1.1, lower versions aren't tested)
* (Optional) A cafiine server (examples: [the original by Chadderz and MrRean](https://github.com/MrRean/Cafiine-410-551/blob/master/server/cafiine_server.exe), [MusicRandomizer](https://github.com/OatmealDome/SplatoonUtilities/blob/master/MusicRandomizer/README.md), [Ray's custom server](https://github.com/Syroot/CafiineServer), and more)
* (Optional) Your Wii U's IP for TCPGecko or your computer's local IP for Cafiine ([Windows](http://www.nirsoft.net/utils/wnetwatcher.zip), [macOS](http://osxdaily.com/2010/11/21/find-ip-address-mac/))
* For Splatoon's enhanced controls; ver 2.10.0 - 2.12.0


## Tutorial

### Video tutorial:

(coming soon)

### Text tutorial:

1. Download the homebrew launcher from [here](https://github.com/dimok789/homebrew_launcher/releases) (download v1.3 if v2.1 crashes for you), and the swadrc.elf application from here (soonTM).

2. Unzip both apps and then drag them into your SD Card, make sure both directories are at:

* SD:/wiiu/apps/homebrew/app.elf
* SD:/wiiu/apps/swapdrc/swapdrc.elf

3. Safely remove the SD card and insert it into your wii u, then launch the hombrew launcher from [loadiine.ovh](http://loadiine.ovh) in your Wii U browser. If you have the [haxchi](https://gbatemp.net/threads/haxchi-v2-0-a-persistent-wiiu-hack.451071/) homebrew launcher, that works too.

4. Press **A** to install Swap DRC with TCPGecko, or press **B** to install Swap DRC with TCPGecko + Cafiine (cafiine server on your computer is required)

5. You're done! You now switch displays anywhere but not in the settings menu (because it terminates any mod installers like it always does).

# FAQ

### What's TCPGecko and Cafiine?

TCPGecko is a mod that allows you to use a TCPGecko editor to modify the ram through a TCP connection. A
perfect example for this is the use of Splathax that let's you modify gears in your inventory in Splatoon.

Caffine is another mod that lets you replace modified game files that you'd like the game to load. A perfect
example for this is the popular use of model and skin edits for Smash Bros for Wii U. Unlike the "Install
TCPGecko only" option, Caffine requires you to have a server running on your computer at all times. Don't
use this if you don't want to use game file mods and have the computer running all the time.

### Can I get you banned playing online with Swap DRC in any game?

Swapping displays doesn't modify the games directly but through the Cafe OS instead. Therefore it's 100% safe.
However you can still get banned with TCPGecko and/or Caffine mods if you don't use them properly.

### r u a l33t hax0r?

YeS I Am.
(...I'm joking this question isn't real)


# Credits

### Creators:

+ OatmealDome
+ Yahya14

### Special thanks:

+ Maschell for HID to VPAD
+ Dimok for function_hooks and the pygecko server
+ Brienj for the IP selector and initial UI
+ /u/MachMatic for the banner background
+ BKOOL999 for feedback & testing the Swap DRC app

b. Download ```geckiine.zip``` with Geckiine Creator from [here](https://github.com/seresaa/geckiine-creator/releases/tag/v0.1) and extract it. Run ```Geckiine Creator.exe```, enter in your IP address into the four boxes, and click the "Create/Patch ELF" button.
3. Copy the ```geckiine``` folder to the ```wiiu/apps/``` folder on your SD card.
4. Insert your SD card into the Wii U and launch the Homebrew Launcher from [loadiine.ovh](http://loadiine.ovh).
5. Start a cafiine server on your computer.
6. Scroll to the "geckiine" application, tap on it, and tap the "Start" button. You will be returned to the Wii U menu.
7. Launch the game you want to modify.
8. Run any TCPGecko scripts and/or connect with TCPGecko dotNET/JGeckoU.

## Credits

* Maschell for HID to VPad
* Dimok for his amazing function_hooks system and pygecko server
* NWPlayer123 for the cafiine cient source code
* amiibu for helping me with the PHP script and giving me name ideas
* seresaa for putting together the banner, for name ideas, and for writing Geckiine Creator
* 466 for web hosting
* /u/MachMatic for creating the banner background

Shoutouts to everyone at the Splatoon Modding Hub Discord, because I probably annoyed them by talking endlessly about the various problems I encountered.
Binary file modified meta/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 11 additions & 10 deletions meta/meta.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<app version="1.1">
<name>geckiine</name>
<coder>multiple people</coder>
<url>https://github.com/xhp-creations/Geckiine</url>
<version> 1.1</version>
<release_date>201607080000000</release_date>
<short_description>TCPGecko and Cafiine combined</short_description>
<long_description>This tool installs both TCPGecko and Cafiine into system memory so that you can use them at the same time.
<name>Swap DRC</name>
<coder>OatmealDome and Yahya14</coder>
<url>TBA</url>
<version>1.0</version>
<release_date>201707190000000</release_date>
<short_description>Switch TV display onto the gamepad</short_description>
<long_description>This tool installs Swap DRC, TCPGecko, and/or Cafiine into system memory.

Switch the TV and gamepad display (and the DRC sensor bar) by holding the L shoulder button, and then press MINUS.

Special thanks to: Maschell, dimok, NWPlayer123, amibu, seresaa, /u/MachMatic, and brienj!

OatmealDome says, "Shoutouts to everyone at the Splatoon Modding Hub Discord, because I probably annoyed them by talking endlessly about the various problems I encountered."</long_description>
Special thanks to: Maschell, dimok, NWPlayer123, Brienj, and BKOOL999!
</long_description>
</app>
1 change: 1 addition & 0 deletions src/common/common.h
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ extern "C" {
#define LIB_NN_ACP 11
#define LIB_SYSHID 12
#define LIB_VPADBASE 13
#define LIB_PROCUI 14

// functions types
#define STATIC_FUNCTION 0
21 changes: 21 additions & 0 deletions src/dynamic_libs/procui_functions.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "os_functions.h"
#include "procui_functions.h"

unsigned int procui_handle __attribute__((section(".data"))) = 0;

EXPORT_DECL(void, ProcUIInit, ProcUISaveCallbackFunction function);
EXPORT_DECL(void, ProcUIRegisterCallback, int message, ProcUICallbackFunction function, void* data, int priority);

void InitAcquireProcUI(void)
{
OSDynLoad_Acquire("proc_ui.rpl", &procui_handle);
}

void InitProcUIFunctionPointers(void)
{
unsigned int *funcPointer = 0;
InitAcquireProcUI();

OS_FIND_EXPORT(procui_handle, ProcUIInit);
OS_FIND_EXPORT(procui_handle, ProcUIRegisterCallback);
}
41 changes: 41 additions & 0 deletions src/dynamic_libs/procui_functions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef __PROCUI_FUNCTIONS_H_
#define __PROCUI_FUNCTIONS_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef enum ProcUICallbackType
{
PROCUI_CALLBACK_ACQUIRE,
PROCUI_CALLBACK_RELEASE,
PROCUI_CALLBACK_EXIT,
PROCUI_CALLBACK_NET_IO_START,
PROCUI_CALLBACK_NET_IO_STOP,
PROCUI_CALLBACK_HOME_BUTTON_DENIED,
} ProcUICallbackType;

typedef enum ProcUIStatus
{
PROCUI_STATUS_IN_FOREGROUND,
PROCUI_STATUS_IN_BACKGROUND,
PROCUI_STATUS_RELEASE_FOREGROUND,
PROCUI_STATUS_EXITING,
} ProcUIStatus;

extern unsigned int procui_handle;

void InitProcUIFunctionPointers(void);
void InitAcquireProcUI(void);

typedef void (*ProcUISaveCallbackFunction)(void);
typedef int (*ProcUICallbackFunction)(void*);

extern void (*ProcUIInit)(ProcUISaveCallbackFunction function);
extern void (*ProcUIRegisterCallback)(int message, ProcUICallbackFunction function, void* data, int priority);

#ifdef __cplusplus
}
#endif

#endif // __PROCUI_FUNCTIONS_H_
2 changes: 1 addition & 1 deletion src/dynamic_libs/socket_functions.h
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ struct sockaddr
char sa_data[14];
};

unsigned int new_addr;
extern unsigned int new_addr;

void InitSocketFunctionPointers(void);
void InitAcquireSocket(void);
4 changes: 3 additions & 1 deletion src/dynamic_libs/vpad_functions.c
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@ EXPORT_DECL(void, VPADGetTPCalibratedPoint, int chan, VPADTPData *screen, VPADTP
EXPORT_DECL(void, VPADGetTPCalibratedPointEx, int chan, int resolution, VPADTPData *screen, VPADTPData *raw);
EXPORT_DECL(int, VPADBASEGetMotorOnRemainingCount, int padnum);
EXPORT_DECL(int, VPADBASESetMotorOnRemainingCount, int padnum, int counter);
EXPORT_DECL(void, VPADSetSensorBar, s32 chan, bool on);

void InitAcquireVPad(void)
{
@@ -53,7 +54,8 @@ void InitVPadFunctionPointers(void)
OS_FIND_EXPORT(vpad_handle, VPADGetLcdMode);
OS_FIND_EXPORT(vpad_handle, VPADSetLcdMode);
OS_FIND_EXPORT(vpad_handle, VPADGetTPCalibratedPoint);
OS_FIND_EXPORT(vpad_handle, VPADGetTPCalibratedPointEx);
OS_FIND_EXPORT(vpad_handle, VPADGetTPCalibratedPointEx);
OS_FIND_EXPORT(vpad_handle, VPADSetSensorBar);
OS_FIND_EXPORT(vpadbase_handle, VPADBASEGetMotorOnRemainingCount);
OS_FIND_EXPORT(vpadbase_handle, VPADBASESetMotorOnRemainingCount);
}
1 change: 1 addition & 0 deletions src/dynamic_libs/vpad_functions.h
Original file line number Diff line number Diff line change
@@ -108,6 +108,7 @@ extern void (* VPADGetTPCalibratedPoint)(int chan, VPADTPData *screen, VPADTPDat
extern void (* VPADGetTPCalibratedPointEx)(int chan, int resolution, VPADTPData *screen, VPADTPData *raw);
extern int (* VPADBASEGetMotorOnRemainingCount)(int lcdmode);
extern int (* VPADBASESetMotorOnRemainingCount)(int lcdmode,int counter);
extern void (* VPADSetSensorBar)(s32 chan, bool on);

#ifdef __cplusplus
}
298 changes: 208 additions & 90 deletions src/main.c

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/main.h
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ extern "C" {

//! C wrapper for our C++ functions
int Menu_Main(void);
void clearScreen(void);

#ifdef __cplusplus
}
164 changes: 45 additions & 119 deletions src/patcher/function_hooks.c
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
#include "utils/logger.h"
#include "cafiine/cafiine.h"
#include "retain_vars.h"
#include "gambit_functions.h"

#define LIB_CODE_RW_BASE_OFFSET 0xC1000000
#define CODE_RW_BASE_OFFSET 0x00000000
@@ -25,6 +26,8 @@
res (* real_ ## name)(__VA_ARGS__) __attribute__((section(".data"))); \
res my_ ## name(__VA_ARGS__)

int swapForce = 0;

DECL(int, FSAInit, void) {
if ((int)bss_ptr == 0x0a000000) {
memset_bss();
@@ -184,6 +187,11 @@ DECL(int, FSIsEof, void *pClient, void *pCmd, int fd, int error) {
return real_FSIsEof(pClient, pCmd, fd, error);
}

DECL(void, VPADSetSensorBar, s32 chan, bool on) {
real_VPADSetSensorBar(chan, on);
}


DECL(void, GX2CopyColorBufferToScanBuffer, GX2ColorBuffer *colorBuffer, s32 scan_target)
{
// GX2 destinations:
@@ -194,137 +202,55 @@ DECL(void, GX2CopyColorBufferToScanBuffer, GX2ColorBuffer *colorBuffer, s32 scan
// 0x0 = normal
// 0x1 = swap

if (drcMode == 1)
{
if (scan_target == 0x1)
{
real_GX2CopyColorBufferToScanBuffer(colorBuffer, 0x4);
}
else if (scan_target == 0x4)
{
real_GX2CopyColorBufferToScanBuffer(colorBuffer, 0x1);
}
}
// check drc swap and force the drcMode to default when inkstrike is activated
if (drcMode == 0 || swapForce)
{
real_GX2CopyColorBufferToScanBuffer(colorBuffer, scan_target);
}
else
{
real_GX2CopyColorBufferToScanBuffer(colorBuffer, scan_target);
switch (scan_target)
{
case 0x1:
real_GX2CopyColorBufferToScanBuffer(colorBuffer, 0x4);
break;
case 0x4:
real_GX2CopyColorBufferToScanBuffer(colorBuffer, 0x1);
break;
}
}
}

DECL(int, VPADRead, int chan, VPADData *buffer, u32 buffer_size, s32 *error)
{
int ret = real_VPADRead(chan, buffer, buffer_size, error);

// check if we should use Splatoon mode controls
if (isSplatoon)
{
if (gamemode == (uint32_t*)0)
{
uint32_t firstBase = *(uint32_t*)0x106A3BA0;
if (firstBase > 0x10000000 && firstBase < 0x11000000)
{
uint32_t secondBase = *(uint32_t*)(firstBase + 0xD074);
if (secondBase > 0x12000000 && secondBase < 0x14000000)
{
gamemode = (uint32_t*)(secondBase + 0x238);
}
}
}
else if (*gamemode != 0xFFFFFFFF)
{
// switch if B is pressed
if (buffer->btns_d & VPAD_BUTTON_B)
{
drcMode = !drcMode;
}
}
else
{
// switch on L and SELECT
if (buffer->btns_d & VPAD_BUTTON_MINUS)
{
drcMode = !drcMode;
}
}
}
else
{
// switch on L and SELECT
if (buffer->btns_d & VPAD_BUTTON_MINUS)
{
drcMode = !drcMode;
}
}
// switch on L and SELECT
if (buffer->btns_d & VPAD_BUTTON_MINUS && buffer->btns_h & VPAD_BUTTON_L)
{
drcMode = !drcMode;
// enable/disable sensor bar
VPADSetSensorBar(chan, drcMode);
}

// disable touchscreen input if the TV is on the DRC
if (drcMode == 1)
{
buffer->tpdata.touched = 0;
buffer->tpdata1.touched = 0;
buffer->tpdata2.touched = 0;
}
// patches splatoon enhanced controls
if (isSplatoon)
{
gambitPatches(buffer);
gambitDRC();
}

return ret;
return real_VPADRead(chan, buffer, buffer_size, error);
}

DECL(void, VPADGetTPCalibratedPoint, int chan, VPADTPData *screen, VPADTPData *raw)
{
real_VPADGetTPCalibratedPoint(chan, screen, raw);

// check for Splatoon
if (isSplatoon)
{
if (screenPressTimeout != 0)
{
screenPressTimeout--;
}

// disable touchscreen input if the TV is on the DRC
if (drcMode == 1 && screenPressTimeout == 0)
{
screen->touched = 0;
raw->touched = 0;
}
else
{
// Swap once a touchscreen input is received during a match
if (screen->touched == 1 && gamemode != 0 && *gamemode != 0xFFFFFFFF)
{
drcMode = !drcMode;
screenPressTimeout = 300;
}
}
}
}

DECL(void, VPADGetTPCalibratedPointEx, int chan, int resolution, VPADTPData *screen, VPADTPData *raw)
{
real_VPADGetTPCalibratedPointEx(chan, resolution, screen, raw);

// check for Splatoon
if (isSplatoon)
{
if (screenPressTimeout != 0)
{
screenPressTimeout--;
}

// disable touchscreen input if the TV is on the DRC
if (drcMode == 1 && screenPressTimeout == 0)
{
screen->touched = 0;
raw->touched = 0;
}
else
{
// Swap once a touchscreen input is received during a match
if (screen->touched == 1 && gamemode != 0 && *gamemode != 0xFFFFFFFF)
{
drcMode = !drcMode;
screenPressTimeout = 300;
}
}
}
if (isSplatoon)
{
// handles modified touch input for super jumps
gambitTouch(screen);
}
}

/* *****************************************************************************
@@ -358,10 +284,10 @@ static struct hooks_magic_t {
MAKE_MAGIC(FSSetPosFile, LIB_FS, STATIC_FUNCTION),
MAKE_MAGIC(FSGetStatFile, LIB_FS, STATIC_FUNCTION),
MAKE_MAGIC(FSIsEof, LIB_FS, STATIC_FUNCTION),
MAKE_MAGIC(GX2CopyColorBufferToScanBuffer, LIB_GX2, STATIC_FUNCTION),
MAKE_MAGIC(VPADRead, LIB_VPAD, STATIC_FUNCTION),
MAKE_MAGIC(VPADGetTPCalibratedPoint, LIB_VPAD, STATIC_FUNCTION),
MAKE_MAGIC(VPADGetTPCalibratedPointEx, LIB_VPAD, STATIC_FUNCTION)
MAKE_MAGIC(GX2CopyColorBufferToScanBuffer, LIB_GX2, STATIC_FUNCTION),
MAKE_MAGIC(VPADRead, LIB_VPAD, STATIC_FUNCTION),
MAKE_MAGIC(VPADGetTPCalibratedPoint, LIB_VPAD, STATIC_FUNCTION),
MAKE_MAGIC(VPADSetSensorBar, LIB_VPAD, STATIC_FUNCTION)
};


1 change: 1 addition & 0 deletions src/patcher/function_hooks.h
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ struct fs_async_t {
void *queue;
};

int swapForce;
void PatchMethodHooks(void);
void RestoreInstructions(void);
unsigned int GetAddressOfFunction(const char * functionName,unsigned int library);
139 changes: 139 additions & 0 deletions src/patcher/gambit_functions.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#include <stdio.h>
#include <string.h>
#include "dynamic_libs/vpad_functions.h"
#include "retain_vars.h"
#include "utils/logger.h"
#include "gambit_functions.h"
#include "function_hooks.h"

uint32_t* ptr = (uint32_t*)0x106E46E8;
uint32_t* ptr2 = (uint32_t*)0x106E4DA8;
bool AButton = 0;
int touchVal = 0;

void gambitDRC()
{
if (*inkstrikeEq == 2 && *spTimer != 0)
swapForce = 1;
else if (AButton && *ptr2 > 0x1C000000)
swapForce = 1;
else
swapForce = 0;
}

void gambitTouch(VPADTPData *screen)
{
switch (touchVal)
{
case D_LEFT:
screen->x = 1080;
screen->y = 130;
screen->touched = 1;
screen->invalid = 0;
break;
case D_UP:
screen->x = 1080;
screen->y = 290;
screen->touched = 1;
screen->invalid = 0;
break;
case D_RIGHT:
screen->x = 1080;
screen->y = 450;
screen->touched = 1;
screen->invalid = 0;
break;
case D_DOWN:
screen->x = 1170;
screen->y = 625;
screen->touched = 1;
screen->invalid = 0;
break;
case D_NEUTRAL:
// disable touchscreen input if the TV is on the DRC for Splatoon enhanced controls
if ((drcMode == 0 || swapForce)) {}
else if (*ptr > 0x10000000)
{
screen->touched = 0;
}
break;
}
}

void gambitPatches(VPADData *buffer)
{
// prevents the game from crashing
if (*ptr < 0x1C000000)
{
inkstrikeEq = (uint32_t*)0x10000000;
spTimer = (uint32_t*)0x10000000;
}
else
{
// define pointers
if (gamemode == (uint32_t*)0)
{
uint32_t firstBase = *(uint32_t*)0x106A3BA0;
if (firstBase > 0x10000000 && firstBase < 0x11000000)
{
uint32_t secondBase = *(uint32_t*)(firstBase + 0xD074);
if (secondBase > 0x12000000 && secondBase < 0x14000000)
{
gamemode = (uint32_t*)(secondBase + 0x238);
}
}
}

inkstrikeEq = (uint32_t*)(*ptr + 0x80);
spTimer = (uint32_t*)(*ptr + 0x808);

// check if in-game menu is up
if (*ptr2 > 0x1C000000)
{
// switch if B is pressed
if (buffer->btns_d & VPAD_BUTTON_B)
{
drcMode = !drcMode;

// enable/disable sensor bar
VPADSetSensorBar(0, drcMode);
}

// force temporary default swap in a match
if (buffer->btns_h & VPAD_BUTTON_A)
{
if (*gamemode != 0xFFFFFFFF)
{
AButton = true;

// super jumping with D-Pad
if (buffer->btns_h & VPAD_BUTTON_LEFT)
{
touchVal = D_LEFT;
}
else if (buffer->btns_h & VPAD_BUTTON_UP)
{
touchVal = D_UP;
}
else if (buffer->btns_h & VPAD_BUTTON_RIGHT)
{
touchVal = D_RIGHT;
}
else if (buffer->btns_h & VPAD_BUTTON_DOWN)
{
touchVal = D_DOWN;
}
else
{
touchVal = D_NEUTRAL;
}
}
}
else
{
AButton = false;
touchVal = D_NEUTRAL;
}
}
}
}
28 changes: 28 additions & 0 deletions src/patcher/gambit_functions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef _GAMBIT_FUNCTIONS_H_
#define _GAMBIT_FUNCTIONS_H_

#include "dynamic_libs/vpad_functions.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum GambitDPAD
{
D_NEUTRAL,
D_LEFT,
D_UP,
D_RIGHT,
D_DOWN
} GambitDPAD;

extern void gambitDRC(void);
extern void gambitJump(VPADData *buffer);
extern void gambitTouch(VPADTPData *screen);
extern void gambitPatches(VPADData *buffer);

#ifdef __cplusplus
}
#endif

#endif /* _GAMBIT_FUNCTIONS_H_ */
12 changes: 10 additions & 2 deletions src/retain_vars.c
Original file line number Diff line number Diff line change
@@ -2,5 +2,13 @@

int isSplatoon __attribute__((section(".data"))) = 0;
int drcMode __attribute__((section(".data"))) = 0;
int screenPressTimeout __attribute__((section(".data"))) = 0;
uint32_t* gamemode __attribute__((section(".data"))) = (uint32_t*)0;
int patched __attribute__((section(".data"))) = 0;
uint32_t new_addr __attribute__((section(".data"))) = 0;

// for Splatoon
uint32_t* gamemode __attribute__((section(".data"))) = (uint32_t*)0;
uint32_t* inkstrikeEq __attribute__((section(".data"))) = (uint32_t*)0x10000000;
uint32_t* spTimer __attribute__((section(".data"))) = (uint32_t*)0x10000000;

uint32_t incrementVal __attribute__((section(".data"))) = (uint32_t)0;
uint32_t* incrementPtr __attribute__((section(".data"))) = (uint32_t*)0x10000000;
9 changes: 8 additions & 1 deletion src/retain_vars.h
Original file line number Diff line number Diff line change
@@ -5,7 +5,14 @@

extern int isSplatoon;
extern int drcMode;
extern int screenPressTimeout;
extern int patched;

// for Splatoon
extern uint32_t* gamemode;
extern uint32_t* inkstrikeEq;
extern uint32_t* spTimer;

extern uint32_t incrementVal;
extern uint32_t* incrementPtr;

#endif // _RETAIN_VARS_H_

0 comments on commit 6d0cb99

Please sign in to comment.