Added the mirroring functionality. Now it cycles between normal, swapped, mirrored TV, and mirrored gamepad. I haven't touched or tested the swapped Voice stuff.

This commit is contained in:
Andy Rice 2021-07-12 19:04:24 -04:00
parent 65aec45c62
commit 9ba911e8fb
5 changed files with 61 additions and 12 deletions

View File

@ -16,7 +16,7 @@ WUT_ENABLE_CPP := 0
WUT_DEFAULT_MALLOC := 1
# Target filename
TARGET := swipswapme.mod
TARGET := swipswapmirror.mod
# Source directories
SOURCES := src/ \

View File

@ -16,7 +16,7 @@
****************************************************************************/
#include "common/c_retain_vars.h"
uint8_t gSwap __attribute__((section(".data"))) = 0;
uint8_t gSwap __attribute__((section(".data"))) = G_SWAP_NORMAL;
uint8_t gCallbackCooldown __attribute__((section(".data"))) = 0;
uint8_t gAppStatus __attribute__((section(".data"))) = 0;
uint32_t gButtonCombo __attribute__((section(".data"))) = 0;

View File

@ -19,6 +19,10 @@
#include "utils/voice_info.h"
extern uint8_t gSwap;
#define G_SWAP_NORMAL 0
#define G_SWAP_SWAPPED 1
#define G_SWAP_MIRROR_TV 2
#define G_SWAP_MIRROR_DRC 3
extern uint8_t gCallbackCooldown;
extern uint8_t gAppStatus;
extern uint32_t gButtonCombo;

View File

@ -63,14 +63,44 @@ DECL_FUNCTION(void, AXFreeVoice, void *v){
}
DECL_FUNCTION(void, GX2CopyColorBufferToScanBuffer, GX2ColorBuffer *colorBuffer, int32_t scan_target){
if(gSwap){
if(scan_target == 1){
scan_target = 4;
}else{
scan_target = 1;
if(gSwap == G_SWAP_NORMAL) {
// simply copy as normal
real_GX2CopyColorBufferToScanBuffer(colorBuffer,scan_target);
} else if(gSwap == G_SWAP_SWAPPED){
// swap the target then scan
if(scan_target == GX2_SCAN_TARGET_TV){
scan_target = GX2_SCAN_TARGET_DRC;
} else if(scan_target == GX2_SCAN_TARGET_DRC) {
scan_target = GX2_SCAN_TARGET_TV;
} else {
// not sure what to do here
}
real_GX2CopyColorBufferToScanBuffer(colorBuffer,scan_target);
} else if(gSwap == G_SWAP_MIRROR_TV) {
// display TV on both
if(scan_target == GX2_SCAN_TARGET_TV) {
// copy and scan to both
real_GX2CopyColorBufferToScanBuffer(colorBuffer,GX2_SCAN_TARGET_TV);
real_GX2CopyColorBufferToScanBuffer(colorBuffer,GX2_SCAN_TARGET_DRC);
} else if(scan_target == GX2_SCAN_TARGET_DRC) {
// drop the target entirely
} else {
// not sure what to do here
}
} else if(gSwap == G_SWAP_MIRROR_DRC) {
// display DRC on both
if(scan_target == GX2_SCAN_TARGET_DRC) {
// copy and scan to both
real_GX2CopyColorBufferToScanBuffer(colorBuffer,GX2_SCAN_TARGET_TV);
real_GX2CopyColorBufferToScanBuffer(colorBuffer,GX2_SCAN_TARGET_DRC);
} else if(scan_target == GX2_SCAN_TARGET_TV) {
// drop the target entirely
} else {
// not sure what to do here
}
} else {
// Shouldn't ever happen
}
real_GX2CopyColorBufferToScanBuffer(colorBuffer,scan_target);
}
/*
@ -98,7 +128,22 @@ DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buff
if(result > 0 && *error == VPAD_READ_SUCCESS && ((buffer[0].hold & gButtonCombo) == gButtonCombo) && gCallbackCooldown == 0 ){
gCallbackCooldown = 0x3C;
if(gAppStatus == WUPS_APP_STATUS_FOREGROUND){
gSwap = !gSwap;
switch(gSwap) {
case G_SWAP_NORMAL:
gSwap = G_SWAP_SWAPPED;
break;
case G_SWAP_SWAPPED:
gSwap = G_SWAP_MIRROR_TV;
break;
case G_SWAP_MIRROR_TV:
gSwap = G_SWAP_MIRROR_DRC;
break;
case G_SWAP_MIRROR_DRC:
gSwap = G_SWAP_NORMAL;
break;
default:
gSwap = G_SWAP_NORMAL;
}
swapVoices();
}
}

View File

@ -31,10 +31,10 @@
#include <nsysnet/socket.h>
#include <utils/logger.h>
WUPS_PLUGIN_NAME("SwipSwapMe");
WUPS_PLUGIN_DESCRIPTION("Swaps the gamepad and tv screen when pressing a certain button (TV is default)");
WUPS_PLUGIN_NAME("SwipSwapMirror");
WUPS_PLUGIN_DESCRIPTION("Fork of SwipSwapMe, Swaps the gamepad and tv screen when pressing a certain button (TV is default)");
WUPS_PLUGIN_VERSION("v1.0");
WUPS_PLUGIN_AUTHOR("Maschell");
WUPS_PLUGIN_AUTHOR("KrispyRice9, original by Maschell");
WUPS_PLUGIN_LICENSE("GPL");
WUPS_FS_ACCESS()