Update to r1272

This commit is contained in:
wiidev 2019-08-26 18:53:21 +01:00
parent 92af55325c
commit 8172a19c42
62 changed files with 56035 additions and 55894 deletions

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name> USB Loader GX</name> <name> USB Loader GX</name>
<coder>USB Loader GX Team</coder> <coder>USB Loader GX Team</coder>
<version>3.0 r1267</version> <version>3.0 r1272</version>
<release_date>20171214150718</release_date> <release_date>20190615140527</release_date>
<!-- // remove this line to enable arguments <!-- // remove this line to enable arguments
<arguments> <arguments>
<arg>--ios=250</arg> <arg>--ios=250</arg>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: USB Loader GX\n" "Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-14 15:50+0100\n" "POT-Creation-Date: 2019-06-15 16:02+0200\n"
"Last-Translator: nakata6790\n" "Last-Translator: nakata6790\n"
"Language-Team: nakata6790 (aka0107@gmail.com)\n" "Language-Team: nakata6790 (aka0107@gmail.com)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -100,6 +100,9 @@ msgstr "Åîþöõëëá 3D"
msgid "4 (Adults Only 18+)" msgid "4 (Adults Only 18+)"
msgstr "4 (Ìïíï ãéá åíÞëéêåò 18+)" msgstr "4 (Ìïíï ãéá åíÞëéêåò 18+)"
msgid "480p Pixel Fix Patch"
msgstr ""
msgid "5 min" msgid "5 min"
msgstr "5 ëåðôÜ" msgstr "5 ëåðôÜ"
@ -2115,6 +2118,9 @@ msgstr ""
msgid "This game has multiple discs. Please select the disc to launch." msgid "This game has multiple discs. Please select the disc to launch."
msgstr "" msgstr ""
msgid "This patch might not work with all games. If a game doesn't boot, disable it in individual game settings menu."
msgstr ""
msgid "This path must be on SD!" msgid "This path must be on SD!"
msgstr "Ôï ìïíïðÜôé áõôü ðñÝðåé íá êáôåõèýíåé óå áñ÷åßï óôçí êÜñôá SD!" msgstr "Ôï ìïíïðÜôé áõôü ðñÝðåé íá êáôåõèýíåé óå áñ÷åßï óôçí êÜñôá SD!"

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: USB Loader GX\n" "Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-19 14:43+0200\n" "POT-Creation-Date: 2019-06-15 16:02+0200\n"
"PO-Revision-Date: 2011-09-11 12:19+0100\n" "PO-Revision-Date: 2011-09-11 12:19+0100\n"
"Last-Translator: Zonta85\n" "Last-Translator: Zonta85\n"
"Language-Team: Zonta85 (zonta_85@hotmail.it)\n" "Language-Team: Zonta85 (zonta_85@hotmail.it)\n"
@ -101,6 +101,9 @@ msgstr "Copertine 3D"
msgid "4 (Adults Only 18+)" msgid "4 (Adults Only 18+)"
msgstr "4 (Maggiorenni 18+)" msgstr "4 (Maggiorenni 18+)"
msgid "480p Pixel Fix Patch"
msgstr ""
msgid "5 min" msgid "5 min"
msgstr "5 minuti" msgstr "5 minuti"
@ -1301,7 +1304,7 @@ msgstr "Luglio"
msgid "June" msgid "June"
msgstr "Giugno" msgstr "Giugno"
msgid"KPAD Read" msgid "KPAD Read"
msgstr "KPAD Read" msgstr "KPAD Read"
msgid "Keyboard" msgid "Keyboard"
@ -2116,6 +2119,9 @@ msgstr "Questa versione di Nintendont non è correttamente supportata. Autoboot
msgid "This game has multiple discs. Please select the disc to launch." msgid "This game has multiple discs. Please select the disc to launch."
msgstr "Questo gioco contiene più di un disco. Selezione quello da avviare." msgstr "Questo gioco contiene più di un disco. Selezione quello da avviare."
msgid "This patch might not work with all games. If a game doesn't boot, disable it in individual game settings menu."
msgstr ""
msgid "This path must be on SD!" msgid "This path must be on SD!"
msgstr "Questo percorso deve essere sulla SD!" msgstr "Questo percorso deve essere sulla SD!"
@ -2495,11 +2501,11 @@ msgstr "di"
msgid "seconds left" msgid "seconds left"
msgstr "secondi rimasti" msgstr "secondi rimasti"
msgid "Plugins Default Partition" #~ msgid "Plugins Default Partition"
msgstr "Partizione predefinita Plugins" #~ msgstr "Partizione predefinita Plugins"
msgid "Plugin Files Path" #~ msgid "Plugin Files Path"
msgstr "Percorso files Plugin" #~ msgstr "Percorso files Plugin"
#~ msgid "Install WAD to EmuNand" #~ msgid "Install WAD to EmuNand"
#~ msgstr "Installa WAD nella NAND emulata" #~ msgstr "Installa WAD nella NAND emulata"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: USB Loader GX\n" "Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-14 16:05+0100\n" "POT-Creation-Date: 2019-06-15 16:05+0200\n"
"PO-Revision-Date: 2011-11-03 11:00+0000\n" "PO-Revision-Date: 2011-11-03 11:00+0000\n"
"Last-Translator: Codemaster(TheCodemastr) <javafangamers@hotmail.com>\n" "Last-Translator: Codemaster(TheCodemastr) <javafangamers@hotmail.com>\n"
"Language-Team: Sky8000, pplucky\n" "Language-Team: Sky8000, pplucky\n"
@ -101,6 +101,9 @@ msgstr "Capas 3D"
msgid "4 (Adults Only 18+)" msgid "4 (Adults Only 18+)"
msgstr "4 (Adultos 18+)" msgstr "4 (Adultos 18+)"
msgid "480p Pixel Fix Patch"
msgstr ""
msgid "5 min" msgid "5 min"
msgstr "" msgstr ""
@ -2116,6 +2119,9 @@ msgstr "Essa versão do Nintendont não é suportada. Auto boot desativado"
msgid "This game has multiple discs. Please select the disc to launch." msgid "This game has multiple discs. Please select the disc to launch."
msgstr "Esse jogo utiliza vários discos. Escolha o disco a iniciar" msgstr "Esse jogo utiliza vários discos. Escolha o disco a iniciar"
msgid "This patch might not work with all games. If a game doesn't boot, disable it in individual game settings menu."
msgstr ""
msgid "This path must be on SD!" msgid "This path must be on SD!"
msgstr "Essa pasta precisa estar no Cartão SD!" msgstr "Essa pasta precisa estar no Cartão SD!"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ INCLUDES := source
# Default cIOS to load into to load the settings # Default cIOS to load into to load the settings
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifndef $(IOS) ifndef $(IOS)
IOS = 249 IOS = 58
endif endif
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -67,7 +67,7 @@ endif
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -g -ggdb -O3 -Wall -Wno-multichar -Wno-unused-parameter -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DBUILD_IOS=$(IOS) CFLAGS = -g -ggdb -O3 -Wall -Wno-multichar -Wno-unused-parameter -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DBUILD_IOS=$(IOS)
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80B00000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80B00000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size
ifeq ($(BUILDMODE),channel) ifeq ($(BUILDMODE),channel)
CFLAGS += -DFULLCHANNEL CFLAGS += -DFULLCHANNEL
@ -78,7 +78,7 @@ endif
# any extra libraries we wish to link with the project # any extra libraries we wish to link with the project
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
LIBS := -lcustomfat -lcustomntfs -lcustomext2fs -lvorbisidec -lmad -lfreetype \ LIBS := -lcustomfat -lcustomntfs -lcustomext2fs -lvorbisidec -lmad -lfreetype \
-lgd -ljpeg -lpng -lzip -lm -lz -lwiiuse -lwupc -lbte -lasnd -logc -lgd -ljpeg -lpng -lzip -lm -lz -lwiiuse -lwiidrc -lbte -lasnd -logc -lruntimeiospatch
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing
# include and lib # include and lib
@ -145,6 +145,7 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -L$(CURDIR)/source/libs/libfat/ \ export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -L$(CURDIR)/source/libs/libfat/ \
-L$(CURDIR)/source/libs/libntfs/ -L$(CURDIR)/source/libs/libext2fs/ \ -L$(CURDIR)/source/libs/libntfs/ -L$(CURDIR)/source/libs/libext2fs/ \
-L$(CURDIR)/source/libs/libruntimeiospatch/ -L$(CURDIR)/source/libs/libdrc/ \
-L$(LIBOGC_LIB) -L$(PORTLIBS)/lib -L$(LIBOGC_LIB) -L$(PORTLIBS)/lib
export OUTPUT := $(CURDIR)/$(TARGET) export OUTPUT := $(CURDIR)/$(TARGET)

View File

@ -87,7 +87,7 @@ BoxCover::~BoxCover()
//! Remove me later //! Remove me later
void BoxCover::WiiPADControl(GuiTrigger *t) void BoxCover::WiiPADControl(GuiTrigger *t)
{ {
if((t->wpad.btns_d & WPAD_BUTTON_A) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->pad.btns_h & PAD_BUTTON_A)) if((t->wpad.btns_d & WPAD_BUTTON_A) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->pad.btns_h & PAD_BUTTON_A))
{ {
if(t->wpad.ir.valid) if(t->wpad.ir.valid)
{ {
@ -128,13 +128,13 @@ void BoxCover::WiiPADControl(GuiTrigger *t)
else else
moveChan = -1; moveChan = -1;
} }
else if(((t->wpad.btns_h & WPAD_BUTTON_A) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->pad.btns_h & PAD_BUTTON_A)) && moveChan == t->chan && t->wpad.ir.valid && !effects) else if(((t->wpad.btns_h & WPAD_BUTTON_A) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->pad.btns_h & PAD_BUTTON_A)) && moveChan == t->chan && t->wpad.ir.valid && !effects)
{ {
movePosX = (t->wpad.ir.x-moveStartPosX) * fabs(PosZ)/3400.f; movePosX = (t->wpad.ir.x-moveStartPosX) * fabs(PosZ)/3400.f;
movePosY = (moveStartPosY-t->wpad.ir.y) * fabs(PosZ)/3400.f; movePosY = (moveStartPosY-t->wpad.ir.y) * fabs(PosZ)/3400.f;
last_manual_move_frame = frameCount; last_manual_move_frame = frameCount;
} }
else if(!(t->wpad.btns_h & WPAD_BUTTON_A) && !(t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) && !(t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_A) && !(t->pad.btns_h & PAD_BUTTON_A) && moveChan == t->chan) else if(!(t->wpad.btns_h & WPAD_BUTTON_A) && !(t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) && !(t->pad.btns_h & PAD_BUTTON_A) && moveChan == t->chan)
{ {
if(moveChan >= 0 && moveChan < 4) if(moveChan >= 0 && moveChan < 4)
{ {
@ -144,27 +144,27 @@ void BoxCover::WiiPADControl(GuiTrigger *t)
} }
} }
if((t->wpad.btns_h & WPAD_BUTTON_UP) || (t->pad.substickY > PADCAL) || (t->wupcdata.substickY > WUPCCAL)) if((t->wpad.btns_h & WPAD_BUTTON_UP) || (t->pad.substickY > PADCAL) )
{ {
RotX -= 2.0f; RotX -= 2.0f;
last_manual_move_frame = frameCount; last_manual_move_frame = frameCount;
} }
if((t->wpad.btns_h & WPAD_BUTTON_DOWN) || (t->pad.substickY < -PADCAL) || (t->wupcdata.substickY < -WUPCCAL)) if((t->wpad.btns_h & WPAD_BUTTON_DOWN) || (t->pad.substickY < -PADCAL) )
{ {
RotX += 2.0f; RotX += 2.0f;
last_manual_move_frame = frameCount; last_manual_move_frame = frameCount;
} }
if((t->wpad.btns_h & WPAD_BUTTON_LEFT) || (t->pad.substickX < -PADCAL) || (t->wupcdata.substickX < -WUPCCAL)) if((t->wpad.btns_h & WPAD_BUTTON_LEFT) || (t->pad.substickX < -PADCAL) )
{ {
RotY -= 2.0f; RotY -= 2.0f;
last_manual_move_frame = frameCount; last_manual_move_frame = frameCount;
} }
if((t->wpad.btns_h & WPAD_BUTTON_RIGHT) || (t->pad.substickX > PADCAL) || (t->wupcdata.substickX > WUPCCAL)) if((t->wpad.btns_h & WPAD_BUTTON_RIGHT) || (t->pad.substickX > PADCAL) )
{ {
RotY += 2.0f; RotY += 2.0f;
last_manual_move_frame = frameCount; last_manual_move_frame = frameCount;
} }
if((t->wpad.btns_d & WPAD_BUTTON_2) || (t->pad.btns_d & PAD_BUTTON_X) || (t->wpad.btns_d & WPAD_CLASSIC_BUTTON_X) || (t->wupcdata.btns_d & WPAD_CLASSIC_BUTTON_X)) if((t->wpad.btns_d & WPAD_BUTTON_2) || (t->pad.btns_d & PAD_BUTTON_X) || (t->wpad.btns_d & WPAD_CLASSIC_BUTTON_X) )
{ {
if(RotY < 180.0f) if(RotY < 180.0f)
SetEffect(EFFECT_BOX_ROTATE_X, 10, 180); SetEffect(EFFECT_BOX_ROTATE_X, 10, 180);
@ -172,12 +172,12 @@ void BoxCover::WiiPADControl(GuiTrigger *t)
SetEffect(EFFECT_BOX_ROTATE_X, -10, -180); SetEffect(EFFECT_BOX_ROTATE_X, -10, -180);
last_manual_move_frame = frameCount; last_manual_move_frame = frameCount;
} }
if((t->wpad.btns_h & WPAD_BUTTON_PLUS) || (t->pad.btns_h & PAD_TRIGGER_R) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_FULL_R) || (t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_FULL_R)) if((t->wpad.btns_h & WPAD_BUTTON_PLUS) || (t->pad.btns_h & PAD_TRIGGER_R) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_FULL_R) )
{ {
if(PosZ < -2.8f) if(PosZ < -2.8f)
PosZ += 0.4f*fabs(PosZ)/19.f; PosZ += 0.4f*fabs(PosZ)/19.f;
} }
if((t->wpad.btns_h & WPAD_BUTTON_MINUS) || (t->pad.btns_h & PAD_TRIGGER_L) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_FULL_L) || (t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_FULL_L)) if((t->wpad.btns_h & WPAD_BUTTON_MINUS) || (t->pad.btns_h & PAD_TRIGGER_L) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_FULL_L) )
{ {
if(PosZ > -43.0f) if(PosZ > -43.0f)
PosZ -= 0.4f*fabs(PosZ)/19.f; PosZ -= 0.4f*fabs(PosZ)/19.f;

View File

@ -375,7 +375,7 @@ int PartitionHandle::CheckGPT(u8 PartNum)
bool bootable = (memcmp(part_entry->part_type_guid, TYPE_BIOS, 16) == 0); bool bootable = (memcmp(part_entry->part_type_guid, TYPE_BIOS, 16) == 0);
AddPartition("GUID-Entry", le64(part_entry->part_first_lba), le64(part_entry->part_last_lba), bootable, PARTITION_TYPE_GPT, PartNum, GPT); AddPartition("GUID-Entry", le64(part_entry->part_first_lba), le64(part_entry->part_last_lba), bootable, PARTITION_TYPE_GPT, i, GPT);
} }
next_lba++; next_lba++;

View File

@ -21,6 +21,7 @@
#include "video.h" #include "video.h"
#include "input.h" #include "input.h"
extern bool isWiiVC; // in sys.cpp
Mtx44 WiiPointer::projection; Mtx44 WiiPointer::projection;
@ -66,50 +67,32 @@ void WiiPointer::Draw(GuiTrigger *t)
else else
{ {
angle = 0.0f; angle = 0.0f;
// dynamic deadzone value required for WiiU gamepad when using Virtual Console Wii channels. Fixes diagonal sticks.
// dirty fix. could be in input.h ?
u8 deadzone = isWiiVC ? 20 : PADCAL;
// GC PAD // GC PAD
// x-axis // x-axis
if(t->pad.stickX < -PADCAL) if(t->pad.stickX < -deadzone)
{ {
posX += (t->pad.stickX + PADCAL) * Settings.PointerSpeed; posX += (t->pad.stickX + deadzone) * Settings.PointerSpeed;
lastActivity = 0; lastActivity = 0;
} }
else if(t->pad.stickX > PADCAL) else if(t->pad.stickX > deadzone)
{ {
posX += (t->pad.stickX - PADCAL) * Settings.PointerSpeed; posX += (t->pad.stickX - deadzone) * Settings.PointerSpeed;
lastActivity = 0; lastActivity = 0;
} }
// y-axis // y-axis
if(t->pad.stickY < -PADCAL) if(t->pad.stickY < -deadzone)
{ {
posY -= (t->pad.stickY + PADCAL) * Settings.PointerSpeed; posY -= (t->pad.stickY + deadzone) * Settings.PointerSpeed;
lastActivity = 0; lastActivity = 0;
} }
else if(t->pad.stickY > PADCAL) else if(t->pad.stickY > deadzone)
{ {
posY -= (t->pad.stickY - PADCAL) * Settings.PointerSpeed; posY -= (t->pad.stickY - deadzone) * Settings.PointerSpeed;
lastActivity = 0;
}
//Wii u pro x-axis
if(t->wupcdata.stickX < -WUPCCAL)
{
posX += (t->wupcdata.stickX + WUPCCAL) * Settings.PointerSpeed/8;
lastActivity = 0;
}
else if(t->wupcdata.stickX > WUPCCAL)
{
posX += (t->wupcdata.stickX - WUPCCAL) * Settings.PointerSpeed/8;
lastActivity = 0;
}
//Wii u pro y-axis
if(t->wupcdata.stickY < -WUPCCAL)
{
posY -= (t->wupcdata.stickY + WUPCCAL) * Settings.PointerSpeed/8;
lastActivity = 0;
}
else if(t->wupcdata.stickY > WUPCCAL)
{
posY -= (t->wupcdata.stickY - WUPCCAL) * Settings.PointerSpeed/8;
lastActivity = 0; lastActivity = 0;
} }
@ -140,7 +123,7 @@ void WiiPointer::Draw(GuiTrigger *t)
lastActivity = 0; lastActivity = 0;
} }
if(t->pad.btns_h || t->wpad.btns_h || t->wupcdata.btns_h) if(t->pad.btns_h || t->wpad.btns_h)
lastActivity = 0; lastActivity = 0;
posX = LIMIT(posX, -50.0f, screenwidth+50.0f); posX = LIMIT(posX, -50.0f, screenwidth+50.0f);

View File

@ -38,7 +38,6 @@
#include <math.h> #include <math.h>
#include <asndlib.h> #include <asndlib.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <wupc/wupc.h>
#include "gui_imagedata.h" #include "gui_imagedata.h"
#include "FreeTypeGX.h" #include "FreeTypeGX.h"
#include "video.h" #include "video.h"
@ -108,15 +107,6 @@ typedef struct _paddata
u8 triggerR; u8 triggerR;
} PADData; } PADData;
typedef struct _wupcfulldata {
u32 btns_d;
u32 btns_u;
u32 btns_h;
s16 stickX;
s16 stickY;
s16 substickX;
s16 substickY;
} WUPCFULLData;
#define EFFECT_SLIDE_TOP 1 #define EFFECT_SLIDE_TOP 1
#define EFFECT_SLIDE_BOTTOM 2 #define EFFECT_SLIDE_BOTTOM 2
@ -175,7 +165,6 @@ class GuiTrigger
u8 type; //!< trigger type (TRIGGER_SIMPLE, TRIGGER_HELD, TRIGGER_BUTTON_ONLY) u8 type; //!< trigger type (TRIGGER_SIMPLE, TRIGGER_HELD, TRIGGER_BUTTON_ONLY)
s32 chan; //!< Trigger controller channel (0-3, -1 for all) s32 chan; //!< Trigger controller channel (0-3, -1 for all)
WPADData wpad; //!< Wii controller trigger data WPADData wpad; //!< Wii controller trigger data
WUPCFULLData wupcdata;//!< Wii U pro controller trigger data
PADData pad; //!< GameCube controller trigger data PADData pad; //!< GameCube controller trigger data
}; };

View File

@ -444,7 +444,7 @@ void GuiButton::Update(GuiTrigger * t)
// button triggers // button triggers
if (this->IsClickable() && scrollison == 0) if (this->IsClickable() && scrollison == 0)
{ {
s32 wm_btns, wm_btns_trig, cc_btns, cc_btns_trig, wupc_btns, wupc_btns_trig; s32 wm_btns, wm_btns_trig, cc_btns, cc_btns_trig;
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
if (trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan)) if (trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan))
@ -457,15 +457,9 @@ void GuiButton::Update(GuiTrigger * t)
cc_btns = t->wpad.btns_d >> 16; cc_btns = t->wpad.btns_d >> 16;
cc_btns_trig = trigger[i]->wpad.btns_d >> 16; cc_btns_trig = trigger[i]->wpad.btns_d >> 16;
// lower 16 bits only (WiiU Pro controller)
wupc_btns = t->wupcdata.btns_d >> 16;
wupc_btns_trig = trigger[i]->wupcdata.btns_d >> 16;
if( ((t->wpad.btns_d > 0 && wm_btns == wm_btns_trig) if( ((t->wpad.btns_d > 0 && wm_btns == wm_btns_trig)
|| (t->wpad.exp.type == WPAD_EXP_CLASSIC && cc_btns == cc_btns_trig)) || (t->wpad.exp.type == WPAD_EXP_CLASSIC && cc_btns == cc_btns_trig))
|| (t->pad.btns_d > 0 && t->pad.btns_d == trigger[i]->pad.btns_d) || (t->pad.btns_d > 0 && t->pad.btns_d == trigger[i]->pad.btns_d))
|| (t->wupcdata.btns_d > 0 && wupc_btns == wupc_btns_trig))
{ {
if (t->chan == stateChan || stateChan == -1) if (t->chan == stateChan || stateChan == -1)
{ {
@ -489,7 +483,7 @@ void GuiButton::Update(GuiTrigger * t)
if (this->IsHoldable()) if (this->IsHoldable())
{ {
bool held = false; bool held = false;
s32 wm_btns, wm_btns_h, wm_btns_trig, cc_btns, cc_btns_h, cc_btns_trig, wupc_btns, wupc_btns_h, wupc_btns_trig; s32 wm_btns, wm_btns_h, wm_btns_trig, cc_btns, cc_btns_h, cc_btns_trig;
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
@ -505,15 +499,9 @@ void GuiButton::Update(GuiTrigger * t)
cc_btns_h = t->wpad.btns_h >> 16; cc_btns_h = t->wpad.btns_h >> 16;
cc_btns_trig = trigger[i]->wpad.btns_h >> 16; cc_btns_trig = trigger[i]->wpad.btns_h >> 16;
// lower 16 bits only (WiiU Pro controller)
wupc_btns = t->wupcdata.btns_d >> 16;
wupc_btns_h = t->wupcdata.btns_h >> 16;
wupc_btns_trig = trigger[i]->wupcdata.btns_h >> 16;
if( (t->wpad.btns_d > 0 && wm_btns == wm_btns_trig) if( (t->wpad.btns_d > 0 && wm_btns == wm_btns_trig)
|| (t->wpad.exp.type == WPAD_EXP_CLASSIC && cc_btns == cc_btns_trig) || (t->wpad.exp.type == WPAD_EXP_CLASSIC && cc_btns == cc_btns_trig)
|| (t->pad.btns_d > 0 && t->pad.btns_d == trigger[i]->pad.btns_d) || (t->pad.btns_d > 0 && t->pad.btns_d == trigger[i]->pad.btns_d))
|| (t->wupcdata.btns_d > 0 && wupc_btns == wupc_btns_trig))
{ {
if (trigger[i]->type == TRIGGER_HELD && state == STATE_SELECTED && (t->chan == stateChan || stateChan == -1)) if (trigger[i]->type == TRIGGER_HELD && state == STATE_SELECTED && (t->chan == stateChan || stateChan == -1))
this->SetState(STATE_CLICKED, t->chan); this->SetState(STATE_CLICKED, t->chan);
@ -522,7 +510,6 @@ void GuiButton::Update(GuiTrigger * t)
if( (t->wpad.btns_h > 0 && wm_btns_h == wm_btns_trig) if( (t->wpad.btns_h > 0 && wm_btns_h == wm_btns_trig)
|| (t->wpad.exp.type == WPAD_EXP_CLASSIC && cc_btns_h == cc_btns_trig) || (t->wpad.exp.type == WPAD_EXP_CLASSIC && cc_btns_h == cc_btns_trig)
|| (t->pad.btns_h > 0 && t->pad.btns_h == trigger[i]->pad.btns_h) || (t->pad.btns_h > 0 && t->pad.btns_h == trigger[i]->pad.btns_h)
|| (t->wupcdata.btns_h > 0 && wupc_btns_h == wupc_btns_trig)
) )
{ {
if (trigger[i]->type == TRIGGER_HELD) if (trigger[i]->type == TRIGGER_HELD)

View File

@ -187,13 +187,12 @@ void GuiCheckboxBrowser::Update(GuiTrigger *t)
if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT |
WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) ||
(t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN)) || (t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN)))
(t->wupcdata.btns_d & (WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)))
pressedChan = t->chan; pressedChan = t->chan;
for(u32 i = 0; i < checkBoxDrawn.size(); i++) for(u32 i = 0; i < checkBoxDrawn.size(); i++)
{ {
if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h && !t->wupcdata.btns_h)) if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h))
{ {
if(i != (u32) selectedItem && checkBoxDrawn[i]->GetState() == STATE_SELECTED) { if(i != (u32) selectedItem && checkBoxDrawn[i]->GetState() == STATE_SELECTED) {
textLineList[i]->SetMaxWidth(maxTextWidth, DOTTED); textLineList[i]->SetMaxWidth(maxTextWidth, DOTTED);
@ -214,7 +213,7 @@ void GuiCheckboxBrowser::Update(GuiTrigger *t)
markImg->SetPosition(5, 15+i*(checkBoxDrawn[i]->GetHeight()+6)+(checkBoxDrawn[i]->GetHeight()-markImg->GetHeight())/2); markImg->SetPosition(5, 15+i*(checkBoxDrawn[i]->GetHeight()+6)+(checkBoxDrawn[i]->GetHeight()-markImg->GetHeight())/2);
} }
if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h && !t->wupcdata.btns_d && !t->wupcdata.btns_h) if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h)
pressedChan = -1; pressedChan = -1;
scrollBar.SetPageSize(checkBoxDrawn.size()); scrollBar.SetPageSize(checkBoxDrawn.size());

View File

@ -184,14 +184,13 @@ void GuiFileBrowser::Update(GuiTrigger * t)
if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT |
WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) ||
(t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN)) || (t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN)))
(t->wupcdata.btns_d & (WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)))
pressedChan = t->chan; pressedChan = t->chan;
if(browser->browserList.size() > FILEBROWSERSIZE) if(browser->browserList.size() > FILEBROWSERSIZE)
scrollBar.Update(t); scrollBar.Update(t);
if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h && !t->wupcdata.btns_h)) if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h))
{ {
for (int i = 0; i < FILEBROWSERSIZE; i++) for (int i = 0; i < FILEBROWSERSIZE; i++)
{ {
@ -208,7 +207,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
} }
if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h && !t->wupcdata.btns_d && !t->wupcdata.btns_h) if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h)
pressedChan = -1; pressedChan = -1;
scrollBar.SetPageSize(FILEBROWSERSIZE); scrollBar.SetPageSize(FILEBROWSERSIZE);

View File

@ -337,7 +337,7 @@ void GuiGameCarousel::Update(GuiTrigger * t)
// Left/Right Navigation // Left/Right Navigation
if (btnLeft->GetState() == STATE_CLICKED) if (btnLeft->GetState() == STATE_CLICKED)
{ {
u32 buttons = t->wpad.btns_h | t->wupcdata.btns_h; u32 buttons = t->wpad.btns_h;
u32 buttonsPAD = t->pad.btns_h; u32 buttonsPAD = t->pad.btns_h;
if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) ||
(buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_MINUS) || (buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_MINUS) ||
@ -353,7 +353,7 @@ void GuiGameCarousel::Update(GuiTrigger * t)
} }
else if (btnRight->GetState() == STATE_CLICKED) else if (btnRight->GetState() == STATE_CLICKED)
{ {
u32 buttons = t->wpad.btns_h | t->wupcdata.btns_h; u32 buttons = t->wpad.btns_h;
u32 buttonsPAD = t->pad.btns_h; u32 buttonsPAD = t->pad.btns_h;
if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) ||
(buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_PLUS) || (buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_PLUS) ||

View File

@ -472,7 +472,7 @@ void GuiGameGrid::Update(GuiTrigger * t)
if (btnLeft->GetState() == STATE_CLICKED) if (btnLeft->GetState() == STATE_CLICKED)
{ {
u32 buttons = t->wpad.btns_h | t->wupcdata.btns_h; u32 buttons = t->wpad.btns_h;
u32 buttonsPAD = t->pad.btns_h; u32 buttonsPAD = t->pad.btns_h;
if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) ||
(buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_MINUS) || (buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_MINUS) ||
@ -488,7 +488,7 @@ void GuiGameGrid::Update(GuiTrigger * t)
} }
else if (btnRight->GetState() == STATE_CLICKED) else if (btnRight->GetState() == STATE_CLICKED)
{ {
u32 buttons = t->wpad.btns_h | t->wupcdata.btns_h; u32 buttons = t->wpad.btns_h;
u32 buttonsPAD = t->pad.btns_h; u32 buttonsPAD = t->pad.btns_h;
if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) ||
(buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_PLUS) || (buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_PLUS) ||

View File

@ -258,14 +258,13 @@ void GuiGameList::Update(GuiTrigger * t)
if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT |
WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) ||
(t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN)) || (t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN)))
(t->wupcdata.btns_d & (WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)))
pressedChan = t->chan; pressedChan = t->chan;
// update the location of the scroll box based on the position in the option list // update the location of the scroll box based on the position in the option list
scrollBar.Update(t); scrollBar.Update(t);
if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h && !t->wupcdata.btns_h)) if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h))
{ {
for (int i = 0, next = listOffset; i < pagesize; ++i, ++next) for (int i = 0, next = listOffset; i < pagesize; ++i, ++next)
{ {
@ -284,7 +283,7 @@ void GuiGameList::Update(GuiTrigger * t)
} }
} }
if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h && !t->wupcdata.btns_d && !t->wupcdata.btns_h) if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h)
pressedChan = -1; pressedChan = -1;
scrollBar.SetPageSize(pagesize); scrollBar.SetPageSize(pagesize);

View File

@ -227,14 +227,13 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | if((t->wpad.btns_d & (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP | WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT |
WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) || WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)) ||
(t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN)) || (t->pad.btns_d & (PAD_BUTTON_UP | PAD_BUTTON_DOWN)))
(t->wupcdata.btns_d & (WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_UP | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_RIGHT)))
pressedChan = t->chan; pressedChan = t->chan;
// update the location of the scroll box based on the position in the option list // update the location of the scroll box based on the position in the option list
scrollBar.Update(t); scrollBar.Update(t);
if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h && !t->wupcdata.btns_h)) if(pressedChan == -1 || (!t->wpad.btns_h && !t->pad.btns_h))
{ {
for(int i = 0; i < listSize; i++) for(int i = 0; i < listSize; i++)
{ {
@ -254,7 +253,7 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
} }
} }
if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h && !t->wupcdata.btns_d && !t->wupcdata.btns_h) if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h)
pressedChan = -1; pressedChan = -1;
if(selectedItem != oldSelectedItem) if(selectedItem != oldSelectedItem)

View File

@ -439,7 +439,7 @@ void GuiScrollbar::ScrollByButton(GuiTrigger *t)
if(!t->wpad.ir.valid || ScrollState < ButtonScrollSpeed-ButtonScrollSpeed*fabs(pressedPosition-t->wpad.ir.y)/250.f) if(!t->wpad.ir.valid || ScrollState < ButtonScrollSpeed-ButtonScrollSpeed*fabs(pressedPosition-t->wpad.ir.y)/250.f)
return; return;
if(pressedChan == -1 && ((t->wpad.btns_d & ButtonScroll) || (t->wupcdata.btns_d & ButtonScroll) ) && if(pressedChan == -1 && (t->wpad.btns_d & ButtonScroll) &&
parentElement && parentElement->IsInside(t->wpad.ir.x, t->wpad.ir.y)) parentElement && parentElement->IsInside(t->wpad.ir.x, t->wpad.ir.y))
{ {
pressedPosition = t->wpad.ir.y; pressedPosition = t->wpad.ir.y;
@ -447,7 +447,7 @@ void GuiScrollbar::ScrollByButton(GuiTrigger *t)
oneButtonScrollImg->SetPosition(t->wpad.ir.x-oneButtonScrollImg->GetWidth()/2, t->wpad.ir.y-oneButtonScrollImg->GetHeight()/2); oneButtonScrollImg->SetPosition(t->wpad.ir.x-oneButtonScrollImg->GetWidth()/2, t->wpad.ir.y-oneButtonScrollImg->GetHeight()/2);
} }
if(pressedChan == t->chan && ((t->wpad.btns_h & ButtonScroll) || (t->wupcdata.btns_h & ButtonScroll) )) if(pressedChan == t->chan && (t->wpad.btns_h & ButtonScroll) )
{ {
if(pressedPosition-oneButtonScrollImg->GetHeight()/2 > t->wpad.ir.y) if(pressedPosition-oneButtonScrollImg->GetHeight()/2 > t->wpad.ir.y)
ScrollOneUp(); ScrollOneUp();
@ -458,7 +458,7 @@ void GuiScrollbar::ScrollByButton(GuiTrigger *t)
listChanged(SelItem, SelInd); listChanged(SelItem, SelInd);
} }
if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h && !t->wupcdata.btns_d && !t->wupcdata.btns_h) if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h)
{ {
pressedChan = -1; pressedChan = -1;
pressedPosition = -1; pressedPosition = -1;

View File

@ -18,7 +18,6 @@ static int scrollDelay = 0;
GuiTrigger::GuiTrigger() GuiTrigger::GuiTrigger()
{ {
chan = -1; chan = -1;
memset(&wupcdata, 0, sizeof(WUPCFULLData));
memset(&wpad, 0, sizeof(WPADData)); memset(&wpad, 0, sizeof(WPADData));
memset(&pad, 0, sizeof(PADData)); memset(&pad, 0, sizeof(PADData));
} }
@ -39,7 +38,6 @@ void GuiTrigger::SetSimpleTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
{ {
type = TRIGGER_SIMPLE; type = TRIGGER_SIMPLE;
chan = ch; chan = ch;
wupcdata.btns_d = wiibtns;
wpad.btns_d = wiibtns; wpad.btns_d = wiibtns;
pad.btns_d = gcbtns; pad.btns_d = gcbtns;
} }
@ -53,7 +51,6 @@ void GuiTrigger::SetHeldTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
{ {
type = TRIGGER_HELD; type = TRIGGER_HELD;
chan = ch; chan = ch;
wupcdata.btns_h = wiibtns;
wpad.btns_h = wiibtns; wpad.btns_h = wiibtns;
pad.btns_h = gcbtns; pad.btns_h = gcbtns;
} }
@ -66,7 +63,6 @@ void GuiTrigger::SetButtonOnlyTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
{ {
type = TRIGGER_BUTTON_ONLY; type = TRIGGER_BUTTON_ONLY;
chan = ch; chan = ch;
wupcdata.btns_d = wiibtns;
wpad.btns_d = wiibtns; wpad.btns_d = wiibtns;
pad.btns_d = gcbtns; pad.btns_d = gcbtns;
} }
@ -130,15 +126,13 @@ s8 GuiTrigger::WPAD_Stick(u8 right, int axis)
bool GuiTrigger::Left() bool GuiTrigger::Left()
{ {
u32 wiibtn = WPAD_BUTTON_LEFT; u32 wiibtn = WPAD_BUTTON_LEFT;
if(wpad.exp.type == WPAD_EXP_CLASSIC || (wupcdata.btns_d | wupcdata.btns_h) > 0) if(wpad.exp.type == WPAD_EXP_CLASSIC)
wiibtn |= WPAD_CLASSIC_BUTTON_LEFT; wiibtn |= WPAD_CLASSIC_BUTTON_LEFT;
if( ((wpad.btns_d | wpad.btns_h) & wiibtn) if( ((wpad.btns_d | wpad.btns_h) & wiibtn)
|| ((wupcdata.btns_d | wupcdata.btns_h) & wiibtn)
|| ((pad.btns_d | pad.btns_h) & PAD_BUTTON_LEFT)) || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_LEFT))
{ {
if( (wpad.btns_d & wiibtn) if( (wpad.btns_d & wiibtn)
|| (wupcdata.btns_d & wiibtn)
|| (pad.btns_d & PAD_BUTTON_LEFT)) || (pad.btns_d & PAD_BUTTON_LEFT))
{ {
scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay.
@ -156,16 +150,14 @@ bool GuiTrigger::Left()
bool GuiTrigger::Right() bool GuiTrigger::Right()
{ {
u32 wiibtn = WPAD_BUTTON_RIGHT; u32 wiibtn = WPAD_BUTTON_RIGHT;
if(wpad.exp.type == WPAD_EXP_CLASSIC || (wupcdata.btns_d | wupcdata.btns_h)) if(wpad.exp.type == WPAD_EXP_CLASSIC)
wiibtn |= WPAD_CLASSIC_BUTTON_RIGHT; wiibtn |= WPAD_CLASSIC_BUTTON_RIGHT;
if( ((wpad.btns_d | wpad.btns_h) & wiibtn) if( ((wpad.btns_d | wpad.btns_h) & wiibtn)
|| ((pad.btns_d | pad.btns_h) & PAD_BUTTON_RIGHT) || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_RIGHT))
|| ((wupcdata.btns_d | wupcdata.btns_h) & wiibtn))
{ {
if( (wpad.btns_d & wiibtn) if( (wpad.btns_d & wiibtn)
|| (pad.btns_d & PAD_BUTTON_RIGHT) || (pad.btns_d & PAD_BUTTON_RIGHT))
|| (wupcdata.btns_d & wiibtn))
{ {
scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay.
return true; return true;
@ -182,15 +174,13 @@ bool GuiTrigger::Right()
bool GuiTrigger::Up() bool GuiTrigger::Up()
{ {
u32 wiibtn = WPAD_BUTTON_UP; u32 wiibtn = WPAD_BUTTON_UP;
if(wpad.exp.type == WPAD_EXP_CLASSIC || (wupcdata.btns_d | wupcdata.btns_h)) if(wpad.exp.type == WPAD_EXP_CLASSIC)
wiibtn |= WPAD_CLASSIC_BUTTON_UP; wiibtn |= WPAD_CLASSIC_BUTTON_UP;
if( ((wpad.btns_d | wpad.btns_h) & wiibtn) if( ((wpad.btns_d | wpad.btns_h) & wiibtn)
|| ((pad.btns_d | pad.btns_h) & PAD_BUTTON_UP) || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_UP))
|| ((wupcdata.btns_d | wupcdata.btns_h) & wiibtn))
{ {
if( (wpad.btns_d & wiibtn) if( (wpad.btns_d & wiibtn)
|| (wupcdata.btns_d & wiibtn)
|| (pad.btns_d & PAD_BUTTON_UP)) || (pad.btns_d & PAD_BUTTON_UP))
{ {
scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay.
@ -208,16 +198,14 @@ bool GuiTrigger::Up()
bool GuiTrigger::Down() bool GuiTrigger::Down()
{ {
u32 wiibtn = WPAD_BUTTON_DOWN; u32 wiibtn = WPAD_BUTTON_DOWN;
if(wpad.exp.type == WPAD_EXP_CLASSIC || (wupcdata.btns_d | wupcdata.btns_h)) if(wpad.exp.type == WPAD_EXP_CLASSIC)
wiibtn |= WPAD_CLASSIC_BUTTON_DOWN; wiibtn |= WPAD_CLASSIC_BUTTON_DOWN;
if( ((wpad.btns_d | wpad.btns_h) & wiibtn) if( ((wpad.btns_d | wpad.btns_h) & wiibtn)
|| ((pad.btns_d | pad.btns_h) & PAD_BUTTON_DOWN) || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_DOWN))
|| ((wupcdata.btns_d | wupcdata.btns_h) & wiibtn))
{ {
if( (wpad.btns_d & wiibtn) if( (wpad.btns_d & wiibtn)
|| (pad.btns_d & PAD_BUTTON_DOWN) || (pad.btns_d & PAD_BUTTON_DOWN))
|| (wupcdata.btns_d & wiibtn))
{ {
scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay.
return true; return true;

View File

@ -20,12 +20,12 @@
#include <gctypes.h> #include <gctypes.h>
#define NIN_MAGIC 0x01070CF6 #define NIN_MAGIC 0x01070CF6
#define NIN_CFG_VERSION 0x00000007 #define NIN_CFG_VERSION 0x00000008
typedef struct NIN_CFG typedef struct NIN_CFG
{ {
u32 Magicbytes; // 0x01070CF6 u32 Magicbytes; // 0x01070CF6
u32 Version; // v4 since v3.354, v5 since v3.358, v6 since v3.368, v7 since 4.424 u32 Version; // v4 since v3.354, v5 since v3.358, v6 since v3.368, v7 since 4.424, v8 since 4.431
u32 Config; u32 Config;
u32 VideoMode; u32 VideoMode;
u32 Language; u32 Language;
@ -66,8 +66,8 @@ enum ninconfig
NIN_CFG_NATIVE_SI = (1<<14), // v2.189 NIN_CFG_NATIVE_SI = (1<<14), // v2.189
NIN_CFG_WIIU_WIDE = (1<<15), // v2.258 NIN_CFG_WIIU_WIDE = (1<<15), // v2.258
NIN_CFG_ARCADE_MODE = (1<<16), // v4.424 NIN_CFG_ARCADE_MODE = (1<<16), // v4.424
NIN_CFG_CC_RUMBLE = (1 << 17),// v4.43x NIN_CFG_CC_RUMBLE = (1 << 17),// v4.431 cfg version 8
NIN_CFG_SKIP_IPL = (1 << 18),// v4.43x NIN_CFG_SKIP_IPL = (1 << 18),// v4.435
}; };
enum ninvideomode enum ninvideomode

View File

@ -10,7 +10,7 @@
#include "wad/nandtitle.h" #include "wad/nandtitle.h"
#include "SystemMenu/SystemMenuResources.h" #include "SystemMenu/SystemMenuResources.h"
#include "system/IosLoader.h" #include "system/IosLoader.h"
#include "system/runtimeiospatch.h" #include "libs/libruntimeiospatch/runtimeiospatch.h"
#include "utils/timer.h" #include "utils/timer.h"
#include "settings/CSettings.h" #include "settings/CSettings.h"
#include "settings/CGameSettings.h" #include "settings/CGameSettings.h"
@ -25,6 +25,8 @@
#include "sys.h" #include "sys.h"
#include "svnrev.h" #include "svnrev.h"
extern bool isWiiVC; // in sys.cpp
StartUpProcess::StartUpProcess() StartUpProcess::StartUpProcess()
{ {
//! Load default font for the next text outputs //! Load default font for the next text outputs
@ -55,7 +57,7 @@ StartUpProcess::StartUpProcess()
versionTxt->SetTextf("v3.0 Rev. %s", GetRev()); versionTxt->SetTextf("v3.0 Rev. %s", GetRev());
#endif #endif
#if 0 // enable if you release a modded version #if 1 // enable if you release a modded version - enabled by default to differentiate official releases
versionTxt->SetTextf("v3.0 Rev. %s mod", GetRev()); versionTxt->SetTextf("v3.0 Rev. %s mod", GetRev());
#endif #endif
@ -267,7 +269,8 @@ int StartUpProcess::Execute()
SetTextf("Initialize sd card\n"); SetTextf("Initialize sd card\n");
DeviceHandler::Instance()->MountSD(); DeviceHandler::Instance()->MountSD();
if(Settings.USBAutoMount == ON) // Do not mount USB if not needed. USB is not available with WiiU WiiVC injected channel.
if(Settings.USBAutoMount == ON && !isWiiVC)
{ {
SetTextf("Initialize usb device\n"); SetTextf("Initialize usb device\n");
USBSpinUp(); USBSpinUp();
@ -283,7 +286,9 @@ int StartUpProcess::Execute()
gprintf("\tLoading game categories...%s\n", GameCategories.Load(Settings.ConfigPath) ? "done" : "failed"); gprintf("\tLoading game categories...%s\n", GameCategories.Load(Settings.ConfigPath) ? "done" : "failed");
if(Settings.CacheTitles) if(Settings.CacheTitles)
gprintf("\tLoading cached titles...%s\n", GameTitles.ReadCachedTitles(Settings.titlestxt_path) ? "done" : "failed (using default)"); gprintf("\tLoading cached titles...%s\n", GameTitles.ReadCachedTitles(Settings.titlestxt_path) ? "done" : "failed (using default)");
if(Settings.LoaderIOS != IOS_GetVersion())
// Reload to user's settings if different than current IOS, and if not using an injected WiiU WiiVC IOS255 (fw.img)
if(Settings.LoaderIOS != IOS_GetVersion() && !isWiiVC)
{ {
SetTextf("Reloading to config file's cIOS...\n"); SetTextf("Reloading to config file's cIOS...\n");
@ -294,7 +299,6 @@ int StartUpProcess::Execute()
// Shut down pads // Shut down pads
WPAD_Shutdown(); WPAD_Shutdown();
WUPC_Shutdown();
// Loading now the cios setup in the settings // Loading now the cios setup in the settings
IosLoader::LoadAppCios(); IosLoader::LoadAppCios();
@ -320,7 +324,7 @@ int StartUpProcess::Execute()
} }
else if(Settings.USBPort == 1 && USBStorage2_GetPort() != Settings.USBPort) else if(Settings.USBPort == 1 && USBStorage2_GetPort() != Settings.USBPort)
{ {
if(Settings.USBAutoMount == ON) if(Settings.USBAutoMount == ON && !isWiiVC)
{ {
SetTextf("Changing USB Port to %i\n", Settings.USBPort); SetTextf("Changing USB Port to %i\n", Settings.USBPort);
DeviceHandler::Instance()->UnMountAllUSB(); DeviceHandler::Instance()->UnMountAllUSB();
@ -329,18 +333,18 @@ int StartUpProcess::Execute()
} }
else if(Settings.USBPort == 2) else if(Settings.USBPort == 2)
{ {
if(Settings.USBAutoMount == ON) if(Settings.USBAutoMount == ON && !isWiiVC)
{ {
SetTextf("Mounting USB Port to 1\n"); SetTextf("Mounting USB Port to 1\n");
DeviceHandler::Instance()->MountUSBPort1(); DeviceHandler::Instance()->MountUSBPort1();
} }
} }
// enable isfs permission if using IOS+AHB or Hermes v4 // enable isfs permission if using Hermes v4 without AHB, or WiiU WiiVC (IOS255 fw.img)
if(IOS_GetVersion() < 200 || (IosLoader::IsHermesIOS() && IOS_GetRevision() == 4)) if(IOS_GetVersion() < 200 || (IosLoader::IsHermesIOS() && IOS_GetRevision() == 4) || isWiiVC)
{ {
SetTextf("Patching %sIOS%d...\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion()); SetTextf("Patching %sIOS%d...\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion());
if (IosPatch_RUNTIME(true, false, false, false) == ERROR_PATCH) if (IosPatch_RUNTIME(!isWiiVC, false, false, isWiiVC, false) == ERROR_PATCH)
gprintf("Patching %sIOS%d failed!\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion()); gprintf("Patching %sIOS%d failed!\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion());
else else
NandTitles.Get(); // get NAND channel's titles NandTitles.Get(); // get NAND channel's titles

View File

@ -15,7 +15,7 @@
#include <ogcsys.h> #include <ogcsys.h>
#include <unistd.h> #include <unistd.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <wupc/wupc.h> #include "libs/libdrc/wiidrc.h"
#include "menu.h" #include "menu.h"
#include "video.h" #include "video.h"
@ -27,6 +27,7 @@
int rumbleRequest[4] = { 0, 0, 0, 0 }; int rumbleRequest[4] = { 0, 0, 0, 0 };
GuiTrigger userInput[4]; GuiTrigger userInput[4];
static int rumbleCount[4] = { 0, 0, 0, 0 }; static int rumbleCount[4] = { 0, 0, 0, 0 };
extern bool isWiiVC; // in sys.cpp
/**************************************************************************** /****************************************************************************
* UpdatePads * UpdatePads
@ -35,7 +36,6 @@ static int rumbleCount[4] = { 0, 0, 0, 0 };
***************************************************************************/ ***************************************************************************/
void UpdatePads() void UpdatePads()
{ {
WUPC_UpdateButtonStats();
WPAD_ScanPads(); WPAD_ScanPads();
PAD_ScanPads(); PAD_ScanPads();
@ -52,22 +52,7 @@ void UpdatePads()
userInput[i].pad.substickY = PAD_SubStickY(i); userInput[i].pad.substickY = PAD_SubStickY(i);
userInput[i].pad.triggerL = PAD_TriggerL(i); userInput[i].pad.triggerL = PAD_TriggerL(i);
userInput[i].pad.triggerR = PAD_TriggerR(i); userInput[i].pad.triggerR = PAD_TriggerR(i);
// WiiU Pro Controller
userInput[i].wupcdata.btns_d = WUPC_ButtonsDown(i);
userInput[i].wupcdata.btns_u = WUPC_ButtonsUp(i);
userInput[i].wupcdata.btns_h = WUPC_ButtonsHeld(i);
userInput[i].wupcdata.stickX = WUPC_lStickX(i);
userInput[i].wupcdata.stickY = WUPC_lStickY(i);
userInput[i].wupcdata.substickX = WUPC_rStickX(i);
userInput[i].wupcdata.substickY = WUPC_rStickY(i);
// Don't use only held to disconnect, on reconnect the pad sends last held state for a short time.
if((WUPC_ButtonsHeld(i) & WUPC_EXTRA_BUTTON_RSTICK && WUPC_ButtonsDown(i) & WUPC_EXTRA_BUTTON_LSTICK) // R3+L3
||(WUPC_ButtonsHeld(i) & WUPC_EXTRA_BUTTON_LSTICK && WUPC_ButtonsDown(i) & WUPC_EXTRA_BUTTON_RSTICK))
WUPC_Disconnect(i);
if (Settings.rumble == ON) DoRumble(i); if (Settings.rumble == ON) DoRumble(i);
if(userInput[i].wpad.exp.type == WPAD_EXP_NUNCHUK) if(userInput[i].wpad.exp.type == WPAD_EXP_NUNCHUK)
@ -78,6 +63,23 @@ void UpdatePads()
if((userInput[i].pad.btns_h & PAD_TRIGGER_R) && (userInput[i].pad.btns_d & PAD_TRIGGER_Z)) if((userInput[i].pad.btns_h & PAD_TRIGGER_R) && (userInput[i].pad.btns_d & PAD_TRIGGER_Z))
ScreenShot(); ScreenShot();
} }
// WiiU gamepad (DRC) when using WiiVC injected WiiU channels
// Copy the drc state to Gamecube pad state
if(WiiDRC_Inited() && WiiDRC_Connected())
{
WiiDRC_ScanPads();
// DRC buttons state written to gamecube pad data
userInput[0].pad.btns_d |= wiidrc_to_pad(WiiDRC_ButtonsDown());
userInput[0].pad.btns_u |= wiidrc_to_pad(WiiDRC_ButtonsUp());
userInput[0].pad.btns_h |= wiidrc_to_pad(WiiDRC_ButtonsHeld());
// DRC stick state written to gamecube pad data
userInput[0].pad.stickX = WiiDRC_lStickX();
userInput[0].pad.stickY = WiiDRC_lStickY();
userInput[0].pad.substickX = WiiDRC_rStickX();
userInput[0].pad.substickY = WiiDRC_rStickY();
}
} }
/**************************************************************************** /****************************************************************************
@ -136,9 +138,13 @@ bool ControlActivityTimeout(void)
***************************************************************************/ ***************************************************************************/
void SetupPads() void SetupPads()
{ {
WUPC_Init();
PAD_Init(); PAD_Init();
WPAD_Init(); WPAD_Init();
// check WiiVC to init WiiU gamepad
WiiDRC_Init();
isWiiVC = WiiDRC_Inited();
// read wiimote accelerometer and IR data // read wiimote accelerometer and IR data
WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR); WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);
@ -159,7 +165,6 @@ void ShutoffRumble()
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
WUPC_Rumble(i, 0);
WPAD_Rumble(i, 0); WPAD_Rumble(i, 0);
rumbleCount[i] = 0; rumbleCount[i] = 0;
} }
@ -172,7 +177,6 @@ void DoRumble(int i)
{ {
if (rumbleRequest[i] && rumbleCount[i] < 3) if (rumbleRequest[i] && rumbleCount[i] < 3)
{ {
WUPC_Rumble(i, 1);
WPAD_Rumble(i, 1); // rumble on WPAD_Rumble(i, 1); // rumble on
rumbleCount[i]++; rumbleCount[i]++;
} }
@ -185,7 +189,73 @@ void DoRumble(int i)
{ {
if (rumbleCount[i]) rumbleCount[i]--; if (rumbleCount[i]) rumbleCount[i]--;
WPAD_Rumble(i, 0); // rumble off WPAD_Rumble(i, 0); // rumble off
WUPC_Rumble(i, 0);
} }
} }
/****************************************************************************
* WiiDRC to WPAD
*
* Sets WPAD button state based on WiiDRC (WiiU gamepad in WiiVC) pressed buttons.
***************************************************************************/
u32 wiidrc_to_wpad(u32 btns) {
u32 ret = 0;
if(btns & WIIDRC_BUTTON_LEFT)
ret |= WPAD_BUTTON_LEFT;
if(btns & WIIDRC_BUTTON_RIGHT)
ret |= WPAD_BUTTON_RIGHT;
if(btns & WIIDRC_BUTTON_UP)
ret |= WPAD_BUTTON_UP;
if(btns & WIIDRC_BUTTON_DOWN)
ret |= WPAD_BUTTON_DOWN;
if(btns & WIIDRC_BUTTON_A)
ret |= WPAD_BUTTON_A;
if(btns & WIIDRC_BUTTON_B)
ret |= WPAD_BUTTON_B;
if(btns & WIIDRC_BUTTON_X)
ret |= WPAD_BUTTON_1;
if(btns & WIIDRC_BUTTON_Y)
ret |= WPAD_BUTTON_2;
if((btns & WIIDRC_BUTTON_L) || (btns & WIIDRC_BUTTON_ZL) || (btns & WIIDRC_BUTTON_MINUS))
ret |= WPAD_BUTTON_MINUS;
if((btns & WIIDRC_BUTTON_R) || (btns & WIIDRC_BUTTON_ZR) || (btns & WIIDRC_BUTTON_PLUS))
ret |= WPAD_BUTTON_PLUS;
if(btns & WIIDRC_BUTTON_HOME)
ret |= WPAD_BUTTON_HOME;
return (ret&0xffff) ;
}
/****************************************************************************
* WiiDRC to PAD
*
* Sets PAD button state based on WiiDRC (WiiU gamepad in WiiVC) pressed buttons.
***************************************************************************/
u32 wiidrc_to_pad(u32 btns) {
u32 ret = 0;
if(btns & WIIDRC_BUTTON_LEFT)
ret |= PAD_BUTTON_LEFT;
if(btns & WIIDRC_BUTTON_RIGHT)
ret |= PAD_BUTTON_RIGHT;
if(btns & WIIDRC_BUTTON_UP)
ret |= PAD_BUTTON_UP;
if(btns & WIIDRC_BUTTON_DOWN)
ret |= PAD_BUTTON_DOWN;
if(btns & WIIDRC_BUTTON_A)
ret |= PAD_BUTTON_A;
if(btns & WIIDRC_BUTTON_B)
ret |= PAD_BUTTON_B;
if(btns & WIIDRC_BUTTON_X)
ret |= PAD_BUTTON_X;
if(btns & WIIDRC_BUTTON_Y)
ret |= PAD_BUTTON_Y;
if((btns & WIIDRC_BUTTON_L) || (btns & WIIDRC_BUTTON_ZL) || (btns & WIIDRC_BUTTON_MINUS))
ret |= PAD_TRIGGER_L;
if((btns & WIIDRC_BUTTON_R) || (btns & WIIDRC_BUTTON_ZR) || (btns & WIIDRC_BUTTON_PLUS))
ret |= PAD_TRIGGER_R;
if(btns & WIIDRC_BUTTON_HOME)
ret |= PAD_BUTTON_START;
return (ret&0xffff) ;
}

View File

@ -14,7 +14,6 @@
#define PI 3.14159265f #define PI 3.14159265f
#define PADCAL 50 #define PADCAL 50
#define WUPCCAL 400
extern int rumbleRequest[4]; extern int rumbleRequest[4];
@ -24,5 +23,7 @@ void ShutoffRumble();
void DoRumble(int i); void DoRumble(int i);
void SetWPADTimeout(); void SetWPADTimeout();
bool ControlActivityTimeout(void); bool ControlActivityTimeout(void);
u32 wiidrc_to_wpad(u32 btns);
u32 wiidrc_to_pad(u32 btns);
#endif #endif

Binary file not shown.

View File

@ -0,0 +1,67 @@
/*
* Copyright (C) 2017 FIX94
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#ifndef _WIIDRC_H_
#define _WIIDRC_H_
#ifdef __cplusplus
extern "C" {
#endif
struct WiiDRCData {
s16 xAxisL;
s16 xAxisR;
s16 yAxisL;
s16 yAxisR;
u16 button;
u8 battery;
u8 extra;
};
#define WIIDRC_BUTTON_A 0x8000
#define WIIDRC_BUTTON_B 0x4000
#define WIIDRC_BUTTON_X 0x2000
#define WIIDRC_BUTTON_Y 0x1000
#define WIIDRC_BUTTON_LEFT 0x0800
#define WIIDRC_BUTTON_RIGHT 0x0400
#define WIIDRC_BUTTON_UP 0x0200
#define WIIDRC_BUTTON_DOWN 0x0100
#define WIIDRC_BUTTON_ZL 0x0080
#define WIIDRC_BUTTON_ZR 0x0040
#define WIIDRC_BUTTON_L 0x0020
#define WIIDRC_BUTTON_R 0x0010
#define WIIDRC_BUTTON_PLUS 0x0008
#define WIIDRC_BUTTON_MINUS 0x0004
#define WIIDRC_BUTTON_HOME 0x0002
#define WIIDRC_BUTTON_SYNC 0x0001
#define WIIDRC_EXTRA_BUTTON_L3 0x80
#define WIIDRC_EXTRA_BUTTON_R3 0x40
#define WIIDRC_EXTRA_BUTTON_TV 0x20
#define WIIDRC_EXTRA_OVERLAY_TV 0x10
#define WIIDRC_EXTRA_OVERLAY_POWER 0x01
bool WiiDRC_Init();
bool WiiDRC_Inited();
bool WiiDRC_Recalibrate();
bool WiiDRC_ScanPads();
bool WiiDRC_Connected();
bool WiiDRC_ShutdownRequested();
const u8 *WiiDRC_GetRawI2CAddr();
const struct WiiDRCData *WiiDRC_Data();
u32 WiiDRC_ButtonsUp();
u32 WiiDRC_ButtonsDown();
u32 WiiDRC_ButtonsHeld();
s16 WiiDRC_lStickX();
s16 WiiDRC_lStickY();
s16 WiiDRC_rStickX();
s16 WiiDRC_rStickY();
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

View File

@ -105,26 +105,28 @@ s32 IosPatch_AHBPROT(bool verbose);
/** /**
* This function applies patches on current IOS * This function applies patches on current IOS
* @see Patchsets * @see Patchsets
* @param wii Flag determing whether or not to apply Wii patches. * @param wii Flag determining whether or not to apply Wii patches.
* @param sciifii Flag determing whether or not to apply extra Sciifii patches. * @param sciifii Flag determining whether or not to apply extra Sciifii patches.
* @param vwii Flag determing whether or not to apply extra vWii patches. * @param vwii Flag determining whether or not to apply extra vWii patches.
* @param verbose Flag determing whether or not to print messages on-screen. * @param wiivc Flag determining whether or not to apply WiiVC patches.
* @param verbose Flag determining whether or not to print messages on-screen.
* @example if(AHBPROT_DISABLED) IosPatch_FULL(true, false, false, false); * @example if(AHBPROT_DISABLED) IosPatch_FULL(true, false, false, false);
* @return Signed 32bit integer representing code * @return Signed 32bit integer representing code
* > 0 : Success - return equals to number of applied patches * > 0 : Success - return equals to number of applied patches
* ERROR_AHBPROT : Error - No HW_AHBPROT access * ERROR_AHBPROT : Error - No HW_AHBPROT access
* ERROR_PATCH : Error - Patching HW_AHBPROT access failed * ERROR_PATCH : Error - Patching HW_AHBPROT access failed
*/ */
s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose); s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool wiivc, bool verbose);
/** /**
* This function combines IosPatch_AHBPROT + IOS_ReloadIOS + IosPatch_RUNTIME * This function combines IosPatch_AHBPROT + IOS_ReloadIOS + IosPatch_RUNTIME
* @see Patchsets * @see Patchsets
* @param wii Flag determing whether or not to apply Wii patches. * @param wii Flag determining whether or not to apply Wii patches.
* @param sciifii Flag determing whether or not to apply extra Sciifii patches. * @param sciifii Flag determining whether or not to apply extra Sciifii patches.
* @param vwii Flag determing whether or not to apply extra vWii patches. * @param vwii Flag determining whether or not to apply extra vWii patches.
* @param verbose Flag determing whether or not to print messages on-screen. * @param wiivc Flag determining whether or not to apply WiiVC patches.
* @param verbose Flag determining whether or not to print messages on-screen.
* @param IOS Which IOS to reload into. * @param IOS Which IOS to reload into.
* @example if(AHBPROT_DISABLED) IosPatch_FULL(true, false, false, false, 58); * @example if(AHBPROT_DISABLED) IosPatch_FULL(true, false, false, false, 58);
* @return Signed 32bit integer representing code * @return Signed 32bit integer representing code
@ -132,7 +134,7 @@ s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose);
* ERROR_AHBPROT : Error - No HW_AHBPROT access * ERROR_AHBPROT : Error - No HW_AHBPROT access
* ERROR_PATCH : Error - Patching HW_AHBPROT access failed * ERROR_PATCH : Error - Patching HW_AHBPROT access failed
*/ */
s32 IosPatch_FULL(bool wii, bool sciifii, bool vwii, bool verbose, int IOS); s32 IosPatch_FULL(bool wii, bool sciifii, bool vwii, bool wiivc, bool verbose, int IOS);
/** /**
* This function patches only SSL certificate check * This function patches only SSL certificate check

View File

@ -33,6 +33,7 @@ const struct block emptyblock = { 0, NULL };
//The maximum amount of bytes to send per net_write() call //The maximum amount of bytes to send per net_write() call
//#define NET_BUFFER_SIZE 1024 //#define NET_BUFFER_SIZE 1024
#define NET_BUFFER_SIZE 3600 #define NET_BUFFER_SIZE 3600
//#define VERBOSE
// Write our message to the server // Write our message to the server
static s32 send_message(s32 server, char *msg) static s32 send_message(s32 server, char *msg)
@ -231,17 +232,22 @@ struct block downloadfile(const char *url)
char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\n%sUser-Agent: USBLoaderGX r%s\r\n\r\n"; char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\n%sUser-Agent: USBLoaderGX r%s\r\n\r\n";
char header[strlen(headerformat) + strlen(path) + strlen(domain) + strlen(referer) + 100]; char header[strlen(headerformat) + strlen(path) + strlen(domain) + strlen(referer) + 100];
sprintf(header, headerformat, path, domain, referer, GetRev()); sprintf(header, headerformat, path, domain, referer, GetRev());
//gprintf("\nHTTP Request:\n");
//gprintf("%s\n",header); #ifdef VERBOSE
gprintf("\nHTTP Request:\n");
gprintf("%s\n",header);
#endif
//Do the request and get the response //Do the request and get the response
send_message(connection, header); send_message(connection, header);
struct block response = read_message(connection); struct block response = read_message(connection);
net_close(connection); net_close(connection);
#ifdef VERBOSE
// dump response // dump response
// hexdump(response.data, response.size); hexdump(response.data, response.size);
#endif
//Search for the 4-character sequence \r\n\r\n in the response which signals the start of the http payload (file) //Search for the 4-character sequence \r\n\r\n in the response which signals the start of the http payload (file)
unsigned char *filestart = NULL; unsigned char *filestart = NULL;
u32 filesize = 0; u32 filesize = 0;
@ -269,7 +275,9 @@ struct block downloadfile(const char *url)
int code; int code;
if (sscanf(codep+1, "%d", &code) == 1) if (sscanf(codep+1, "%d", &code) == 1)
{ {
//gprintf("HTTP response code: %d\n", code); #ifdef VERBOSE
gprintf("HTTP response code: %d\n", code);
#endif
if (code == 302) // 302 FOUND (redirected link) if (code == 302) // 302 FOUND (redirected link)
{ {
char *ptr = strcasestr((char*)response.data, "Location: "); char *ptr = strcasestr((char*)response.data, "Location: ");
@ -280,18 +288,24 @@ struct block downloadfile(const char *url)
*(strchr(newURL, '\r'))=0; *(strchr(newURL, '\r'))=0;
redirect = true; redirect = true;
//gprintf("New URL to download = %s \n", newURL); #ifdef VERBOSE
gprintf("New URL to download = %s \n", newURL);
#endif
} }
else else
{ {
//gprintf("HTTP ERROR: %s\n", htstat); #ifdef VERBOSE
gprintf("HTTP ERROR: %s\n", htstat);
#endif
free(response.data); free(response.data);
return emptyblock; return emptyblock;
} }
} }
if (code >=400) // Not found if (code >=400) // Not found
{ {
//gprintf("HTTP ERROR: %s\n", htstat); #ifdef VERBOSE
gprintf("HTTP ERROR: %s\n", htstat);
#endif
free(response.data); free(response.data);
return emptyblock; return emptyblock;
} }
@ -319,7 +333,9 @@ struct block downloadfile(const char *url)
u8 * tmp = realloc(response.data, redirected.size); u8 * tmp = realloc(response.data, redirected.size);
if (tmp == NULL) if (tmp == NULL)
{ {
//gprintf("Could not allocate enough memory for new URL. Download canceled.\n"); #ifdef VERBOSE
gprintf("Could not allocate enough memory for new URL. Download canceled.\n");
#endif
free(response.data); free(response.data);
free(redirected.data); free(redirected.data);
return emptyblock; return emptyblock;

View File

@ -3,7 +3,7 @@
#include <gccore.h> #include <gccore.h>
#include <string.h> #include <string.h>
#include "ssl.h" #include "ssl.h"
#include "system/runtimeiospatch.h" #include "libs/libruntimeiospatch/runtimeiospatch.h"
#define ISALIGNED(x) ((((u32)x)&0x1F)==0) #define ISALIGNED(x) ((((u32)x)&0x1F)==0)

View File

@ -11,6 +11,7 @@
#include "memory/memory.h" #include "memory/memory.h"
#include "memory/mem2.h" #include "memory/mem2.h"
#include "settings/SettingsEnums.h" #include "settings/SettingsEnums.h"
#include "svnrev.h"
typedef struct _appDOL typedef struct _appDOL
{ {
@ -114,6 +115,108 @@ bool Anti_002_fix(u8 * Address, int Size)
return PatchDOL(Address, Size, (const u8 *) SearchPattern, sizeof(SearchPattern), (const u8 *) PatchData, sizeof(PatchData)); return PatchDOL(Address, Size, (const u8 *) SearchPattern, sizeof(SearchPattern), (const u8 *) PatchData, sizeof(PatchData));
} }
/** 480p Pixel Fix Patch by leseratte
fix for a Nintendo Revolution SDK bug found by Extrems affecting early Wii console when using 480p video mode.
https://shmups.system11.org/viewtopic.php?p=1361158#p1361158
https://github.com/ExtremsCorner/libogc-rice/commit/941d687e271fada68c359bbed98bed1fbb454448
**/
void PatchFix480p()
{
u8 prefix[2] = { 0x4b, 0xff };
/// Patch offset: ----------VVVVVVVV
u32 Pattern_MKW[8] = { 0x38000065, 0x9b810019, 0x38810018, 0x386000e0, 0x98010018, 0x38a00002};
u32 patches_MKW[2] = { 0x38600003, 0x98610019 };
/// Used by: MKWii, Wii Play, Need for Speed Nitro, Wii Sports, ...
/// Patch offset: ----------------------------------------------VVVVVVVV
u32 Pattern_NSMB[8] = { 0x38000065, 0x9801001c, 0x3881001c, 0x386000e0, 0x9b81001d, 0x38a00002};
u32 patches_NSMB[2] = { 0x38a00003, 0x98a1001d };
/// Used by: New Super Mario Bros, ...
/*
* Code block that is being patched (in MKW):
*
* 4bffe30d: bl WaitMicroTime
* 38000065: li r0, 0x65
* 9b810019: stb r28, 25(r1) // store the wrong value (1)
* 38810018: addi r4, r1, 0x18
* 386000e0: li r3, 0xe0
* 98010018: stb r0, 24(r1)
* 38a00002: li r5, 2
* 4bffe73d: bl __VISendI2CData
*
* r28 is a register that is set to 1 at the beginning of the function.
* However, its contents are used elsewhere as well, so we can't just modify this one function.
*
* The following code first searches for one of the patterns above, then replaces the
* "stb r28, 25(r1)" instruction that stores the wrong value on the stack with a branch instead
* That branch branches to the injected custom code ("li r3, 3; stb r3, 25(r1)") that stores the
* correct value (3) instead. At the end of the injected code will be another branch that branches
* back to the instruction after the one that has been replaced (so, to "addi r4, r1, 0x18").
* r3 can safely be used as a temporary register because its contents will be replaced immediately
* afterwards anyways.
*
*/
void * offset = NULL;
void * addr = (void*)0x80000000;
u32 len = 0x900000;
void * patch_ptr = 0 ;
void * a = addr;
while ((char*)a < ((char*)addr + len)) {
if (memcmp(a, &Pattern_MKW, 6 * 4) == 0) {
// Found pattern?
if (memcmp(a - 4, &prefix, 2) == 0) {
if (memcmp(a + 8*4, &prefix, 2) == 0) {
offset = a + 4;
hexdump (a, 30);
patch_ptr = &patches_MKW;
break;
}
}
}
else if (memcmp(a, &Pattern_NSMB, 6 * 4) == 0) {
// Found pattern?
if (memcmp(a - 4, &prefix, 2) == 0) {
if (memcmp(a + 8*4, &prefix, 2) == 0) {
offset = a + 16;
hexdump (a, 30);
patch_ptr = &patches_NSMB;
break;
}
}
}
a+= 4;
}
if (offset == 0) {
// offset is still 0, we didn't find the pattern, return
gprintf("Didn't find offset for 480p patch!\n");
return;
}
// If we are here, we found the offset. Lets grab some space
// from the heap for our patch
u32 old_heap_ptr = *(u32*)0x80003110;
*((u32*)0x80003110) = (old_heap_ptr - 0x20);
u32 heap_space = old_heap_ptr-0x20;
gprintf("Found offset for 480p patch - create branch from 0x%x to heap (0x%x)\n", offset, heap_space);
hexdump (offset, 30);
memcpy((void*)heap_space, patch_ptr, 8);
*((u32*)offset) = 0x48000000 + (((u32)(heap_space) - ((u32)(offset))) & 0x3ffffff);
*((u32*)((u32)heap_space + 8)) = 0x48000000 + (((u32)((u32)offset + 4) - ((u32)(heap_space + 8))) & 0x3ffffff);
return;
}
/** Patch URLs for private Servers - Thanks to ToadKing/wiilauncher-nossl **/ /** Patch URLs for private Servers - Thanks to ToadKing/wiilauncher-nossl **/
void PrivateServerPatcher(void *addr, u32 len, u8 privateServer) void PrivateServerPatcher(void *addr, u32 len, u8 privateServer)
{ {
@ -134,13 +237,252 @@ void PrivateServerPatcher(void *addr, u32 len, u8 privateServer)
// Patch nintendowifi.net -> private server domain // Patch nintendowifi.net -> private server domain
if(privateServer == PRIVSERV_WIIMMFI ) if(privateServer == PRIVSERV_WIIMMFI )
{
domainpatcher(addr, len, "wiimmfi.de"); domainpatcher(addr, len, "wiimmfi.de");
}
//else if(privateServer == PRIVSERV_CUSTOM) //else if(privateServer == PRIVSERV_CUSTOM)
//domainpatcher(dst, len, Settings.CustomPrivateServer); //domainpatcher(dst, len, Settings.CustomPrivateServer);
} }
u32 do_new_wiimmfi()
{
// As of November 2018, Wiimmfi requires a special Wiimmfi patcher
// update which does a bit more than just patch the server adresses.
// This function is being called by GameBooter.cpp, right before
// jumping to the entry point (only for Mario Kart Wii & Wiimmfi),
// and applies all the necessary new patches to the game.
// This includes support for the new patcher update plus
// support for StaticR.rel patching.
// This function has been implemented by Leseratte. Please don't
// try to modify it without speaking to the Wiimmfi team because
// doing so could have unintended side effects.
// check region:
char region = *((char *)(0x80000003));
char * patched;
void * patch1_offset, *patch2_offset, *patch3_offset;
// define some offsets and variables depending on the region:
switch (region) {
case 'P':
patched = (char*)0x80276054;
patch1_offset = (void*)0x800ee3a0;
patch2_offset = (void*)0x801d4efc;
patch3_offset = (void*)0x801A72E0;
break;
case 'E':
patched = (char*)0x80271d14;
patch1_offset = (void*)0x800ee300;
patch2_offset = (void*)0x801d4e5c;
patch3_offset = (void*)0x801A7240;
break;
case 'J':
patched = (char*)0x802759f4;
patch1_offset = (void*)0x800ee2c0;
patch2_offset = (void*)0x801d4e1c;
patch3_offset = (void*)0x801A7200;
break;
case 'K':
patched = (char*)0x80263E34;
patch1_offset = (void*)0x800ee418;
patch2_offset = (void*)0x801d5258;
patch3_offset = (void*)0x801A763c;
break;
default:
return -1;
}
if (*patched != '*') return -2; // ISO already patched
// This RAM address is set (no asterisk) by all officially
// updated patchers, so if it is modified, the image is already
// patched with a new patcher and we don't need to patch anything.
// For statistics and easier debugging in case of problems, Wiimmfi
// wants to know what patcher a game has been patched with, thus,
// let the game know the exact USB-Loader version.
char * fmt = "USB-Loader GX v3.0 R%-30s";
char patcher[50] = {0};
snprintf((char *)&patcher, 49, fmt, GetRev());
strncpy(patched, (char *)&patcher, 42);
// Do the plain old patching with the string search
PrivateServerPatcher((void*)0x80004000, 0x385200, PRIVSERV_WIIMMFI);
// Replace some URLs for Wiimmfi's new update system
char newURL1[] = "http://ca.nas.wiimmfi.de/ca";
char newURL2[] = "http://naswii.wiimmfi.de/ac";
char newURL3P[] = "https://main.nas.wiimmfi.de/pp";
char newURL3E[] = "https://main.nas.wiimmfi.de/pe";
char newURL3J[] = "https://main.nas.wiimmfi.de/pj";
char newURL3K[] = "https://main.nas.wiimmfi.de/pk";
// Write the URLs to the proper place and do some other patching.
switch (region) {
case 'P':
memcpy((void*)0x8027A400, newURL1, sizeof(newURL1));
memcpy((void*)0x8027A400 + 0x28, newURL2, sizeof(newURL2));
memcpy((void*)0x8027A400 + 0x4C, newURL3P, sizeof(newURL3P));
*(u32*)0x802a146c = 0x733a2f2f;
*(u32*)0x800ecaac = 0x3bc00000;
break;
case 'E':
memcpy((void*)0x802760C0, newURL1, sizeof(newURL1));
memcpy((void*)0x802760C0 + 0x28, newURL2, sizeof(newURL2));
memcpy((void*)0x802760C0 + 0x4C, newURL3E, sizeof(newURL3E));
*(u32*)0x8029D12C = 0x733a2f2f;
*(u32*)0x800ECA0C = 0x3bc00000;
break;
case 'J':
memcpy((void*)0x80279DA0, newURL1, sizeof(newURL1));
memcpy((void*)0x80279DA0 + 0x28, newURL2, sizeof(newURL2));
memcpy((void*)0x80279DA0 + 0x4C, newURL3J, sizeof(newURL3J));
*(u32*)0x802A0E0C = 0x733a2f2f;
*(u32*)0x800EC9CC = 0x3bc00000;
break;
case 'K':
memcpy((void*)0x802682B0, newURL1, sizeof(newURL1));
memcpy((void*)0x802682B0 + 0x28, newURL2, sizeof(newURL2));
memcpy((void*)0x802682B0 + 0x4C, newURL3K, sizeof(newURL3K));
*(u32*)0x8028F474 = 0x733a2f2f;
*(u32*)0x800ECB24 = 0x3bc00000;
break;
}
// Make some space on heap (0x400) for our custom code.
u32 old_heap_ptr = *(u32*)0x80003110;
*((u32*)0x80003110) = (old_heap_ptr - 0x400);
u32 heap_space = old_heap_ptr-0x400;
memset((void*)old_heap_ptr-0x400, 0xed, 0x400);
// Binary blobs with Wiimmfi patches. Do not modify.
// Provided by Leseratte on 2018-12-14.
int binary[] = { 0x37C849A2, 0x8BC32FA4, 0xC9A34B71, 0x1BCB49A2,
0x2F119304, 0x5F402684, 0x3E4FDA29, 0x50849A21,
0xB88B3452, 0x627FC9C1, 0xDC24D119, 0x5844350F,
0xD893444F, 0x19A588DC, 0x16C91184, 0x0C3E237C,
0x75906CED, 0x6E68A55E, 0x58791842, 0x072237E9,
0xAB24906F, 0x0A8BDF21, 0x4D11BE42, 0x1AAEDDC8,
0x1C42F908, 0x280CF2B2, 0x453A1BA4, 0x9A56C869,
0x786F108E, 0xE8DF05D2, 0x6DB641EB, 0x6DFC84BB,
0x7E980914, 0x0D7FB324, 0x23442185, 0xA7744966,
0x53901359, 0xBF2103CC, 0xC24A4EB7, 0x32049A02,
0xC1683466, 0xCA93689D, 0xD8245106, 0xA84987CF,
0xEC9B47C9, 0x6FA688FE, 0x0A4D11A6, 0x8B653C7B,
0x09D27E30, 0x5B936208, 0x5DD336DE, 0xCD092487,
0xEF2C6D36, 0x1E09DF2D, 0x75B1BE47, 0xE68A7F22,
0xB0E5F90D, 0xEC49F216, 0xAD1DCC24, 0xE2B5C841,
0x066F6F63, 0xF4D90926, 0x299F42CD, 0xA3F125D6,
0x077B093C, 0xB5721268, 0x1BE424D1, 0xEBC30BF0,
0x77867BED, 0x4F0C9BCA, 0x3E195930, 0xDC32DE2C,
0x1865D189, 0x70C67E7A, 0x71FA7329, 0x532233D3,
0x06D2E87B, 0x6CBEBA7F, 0x99F08532, 0x52FA601C,
0x05F4B82C, 0x4B64839C, 0xB5C65009, 0x1B8396E3,
0x0A8B2DAF, 0x0DB85BE6, 0x12F1B71D, 0x186F6E4D,
0x2870DC2E, 0x5960B8E6, 0x8F4D71BD, 0x0614E3C3,
0x05E8C725, 0x365D8E3D, 0x74351CDE, 0xE1AB3930,
0xFEDA721B, 0xE53AE4E9, 0xC3B4C9A6, 0xBAE59346,
0x6D45269D, 0x634E4D1A, 0x2FD99A30, 0x26393449,
0xE49768D1, 0x81E1D1A1, 0xFCE1A34A, 0x7EB44697,
0xEB2F8D2D, 0xCECFE5AF, 0x81BD34B6, 0xB1F1696E,
0x5E6ED2B2, 0xA473A4A0, 0x41664B70, 0xBF40968A,
0x662F2CCB, 0xC5DF5B8C, 0xB632B772, 0x74EB6F39,
0xE017DC71, 0xFDA3B890, 0xE3C9713D, 0xCE53E397,
0xA12BC743, 0x5AD98EA5, 0xBC721C9F, 0x4568395A,
0x925E72B4, 0x2D7DE4D7, 0x6777C9C7, 0xD6619396,
0xA502268A, 0x77884D75, 0xF79E9AF0, 0xE6FC3461,
0xF07468A5, 0xF866D11D, 0xF90CA342, 0xCF9546FF,
0x87A48D81, 0x06881A51, 0x309C34D1, 0x79B669CE,
0xFAADD2D7, 0xC8D7A5D1, 0x89214BE5, 0x1B8396EF,
0x0A8B2DE9, 0x0D985B06, 0x12F1B711, 0x186F6E57,
0x2850DC0E, 0x5960B8EA, 0x8F4D71AC, 0x0614E3E3,
0x05E8C729, 0x365D8E39, 0x74351CFE, 0x518E3943,
0x4A397268, 0x9D58E4B8, 0xD394C9A2, 0x0E069344,
0xB522268B, 0x636E4D77, 0x2FF99A37, 0xF6DC346D,
0xE49268B4, 0x2001D1A0, 0x4929A365, 0x7B764691,
0xFFC68D49, 0x16A81A53, 0x247A34D2, 0xA1D16967,
0x4B6DD2D5, 0xDDF4A5B7, 0x454A4B70, 0x0FAE96E2,
0x0A8A2DC7, 0x0D98A47A, 0x06DCB71D, 0x0CCC6E38,
0x55F25CFB, 0xB08C1E88, 0xDF4259C9, 0x0714E387,
0xB00D47AF, 0x7B722975, 0x48BE349A, 0x29CC393C,
0xEA797228, 0x98986471, 0x3778E1A3, 0xD7626D06,
0x1567268D, 0x668ECD00, 0xD614F5C8, 0x133037CF,
0x92F26CF2, 0x00000000, 0x00000000, 0x00000000};
// Prepare patching process ....
int i = 3;
int idx = 0;
for (; i < 202; i++) {
if (i == 67 || i == 82) idx++;
binary[i] = binary[i] ^ binary[idx];
binary[idx] = ((binary[idx] << 1) | ((binary[idx] >> (32 - 1)) & ~(0xfffffffe)));
}
// Binary blob needs some changes for regions other than PAL ...
switch (region) {
case 'E':
binary[29] = binary[67];
binary[37] = binary[68];
binary[43] = binary[69];
binary[185] = 0x61295C74;
binary[189] = 0x61295D40;
binary[198] = 0x61086F5C;
break;
case 'J':
binary[29] = binary[70];
binary[37] = binary[71];
binary[43] = binary[72];
binary[185] = 0x612997CC;
binary[189] = 0x61299898;
binary[198] = 0x61086F1C;
break;
case 'K':
binary[6] = binary[73];
binary[9] = binary[74];
binary[11] = binary[75];
binary[23] = binary[76];
binary[29] = binary[77];
binary[33] = binary[78];
binary[37] = binary[79];
binary[43] = binary[80];
binary[63] = binary[81];
binary[184] = 0x3D208088;
binary[185] = 0x61298AA4;
binary[188] = 0x3D208088;
binary[189] = 0x61298B58;
binary[198] = 0x61087358;
break;
}
// Installing all the patches.
memcpy((void*)heap_space, (void*)binary, 820);
u32 code_offset_1 = heap_space + 12;
u32 code_offset_2 = heap_space + 88;
u32 code_offset_3 = heap_space + 92;
u32 code_offset_4 = heap_space + 264;
u32 code_offset_5 = heap_space + 328;
*((u32*)patch1_offset) = 0x48000000 + (((u32)(code_offset_1) - ((u32)(patch1_offset))) & 0x3ffffff);
*((u32*)code_offset_2) = 0x48000000 + (((u32)(patch1_offset + 4) - ((u32)(code_offset_2))) & 0x3ffffff);
*((u32*)patch2_offset) = 0x48000000 + (((u32)(code_offset_3) - ((u32)(patch2_offset))) & 0x3ffffff);
*((u32*)code_offset_4) = 0x48000000 + (((u32)(patch2_offset + 4) - ((u32)(code_offset_4))) & 0x3ffffff);
*((u32*)patch3_offset) = 0x48000000 + (((u32)(code_offset_5) - ((u32)(patch3_offset))) & 0x3ffffff);
// Patches successfully installed
// returns 0 when all patching is done and game is ready to be booted.
return 0;
}
void domainpatcher(void *addr, u32 len, const char* domain) void domainpatcher(void *addr, u32 len, const char* domain)
{ {
if(strlen("nintendowifi.net") < strlen(domain)) if(strlen("nintendowifi.net") < strlen(domain))

View File

@ -13,6 +13,8 @@ void gamepatches(u8 videoSelected, u8 videoPatchDol, u8 aspectForce, u8 language
u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u64 returnTo, u8 privateServer); u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u64 returnTo, u8 privateServer);
bool Anti_002_fix(u8 * Address, int Size); bool Anti_002_fix(u8 * Address, int Size);
void PrivateServerPatcher(void *addr, u32 len, u8 privateServer); void PrivateServerPatcher(void *addr, u32 len, u8 privateServer);
void PatchFix480p();
u32 do_new_wiimmfi();
void domainpatcher(void *addr, u32 len, const char* domain); void domainpatcher(void *addr, u32 len, const char* domain);
bool NSMBPatch(); bool NSMBPatch();
bool PoPPatch(); bool PoPPatch();

View File

@ -188,6 +188,7 @@ bool CGameSettings::Save()
fprintf(f, "game:%s = ", GameList[i].id); fprintf(f, "game:%s = ", GameList[i].id);
fprintf(f, "video:%d; ", GameList[i].video); fprintf(f, "video:%d; ", GameList[i].video);
fprintf(f, "videoPatchDol:%d; ", GameList[i].videoPatchDol); fprintf(f, "videoPatchDol:%d; ", GameList[i].videoPatchDol);
fprintf(f, "patchFix480p:%d; ", GameList[i].patchFix480p);
fprintf(f, "aspectratio:%d; ", GameList[i].aspectratio); fprintf(f, "aspectratio:%d; ", GameList[i].aspectratio);
fprintf(f, "language:%d; ", GameList[i].language); fprintf(f, "language:%d; ", GameList[i].language);
fprintf(f, "ocarina:%d; ", GameList[i].ocarina); fprintf(f, "ocarina:%d; ", GameList[i].ocarina);
@ -258,11 +259,16 @@ bool CGameSettings::SetSetting(GameCFG & game, const char *name, const char *val
game.video = atoi(value); game.video = atoi(value);
return true; return true;
} }
if (strcmp(name, "videoPatchDol") == 0) else if (strcmp(name, "videoPatchDol") == 0)
{ {
game.videoPatchDol = atoi(value); game.videoPatchDol = atoi(value);
return true; return true;
} }
else if (strcmp(name, "patchFix480p") == 0)
{
game.patchFix480p = atoi(value);
return true;
}
else if(strcmp(name, "aspectratio") == 0) else if(strcmp(name, "aspectratio") == 0)
{ {
game.aspectratio = atoi(value); game.aspectratio = atoi(value);
@ -646,6 +652,7 @@ void CGameSettings::SetDefault(GameCFG &game)
memset(game.id, 0, sizeof(game.id)); memset(game.id, 0, sizeof(game.id));
game.video = INHERIT; game.video = INHERIT;
game.videoPatchDol = INHERIT; game.videoPatchDol = INHERIT;
game.patchFix480p = INHERIT;
game.aspectratio = INHERIT; game.aspectratio = INHERIT;
game.language = INHERIT; game.language = INHERIT;
game.ocarina = INHERIT; game.ocarina = INHERIT;

View File

@ -12,6 +12,7 @@ typedef struct _GameCFG
char id[7]; char id[7];
short video; short video;
short videoPatchDol; short videoPatchDol;
short patchFix480p;
short aspectratio; short aspectratio;
short language; short language;
short ocarina; short ocarina;
@ -74,6 +75,7 @@ typedef struct _GameCFG
memcpy(this->id, game.id, sizeof(game.id)); memcpy(this->id, game.id, sizeof(game.id));
this->video = game.video; this->video = game.video;
this->videoPatchDol = game.videoPatchDol; this->videoPatchDol = game.videoPatchDol;
this->patchFix480p = game.patchFix480p;
this->aspectratio = game.aspectratio; this->aspectratio = game.aspectratio;
this->language = game.language; this->language = game.language;
this->ocarina = game.ocarina; this->ocarina = game.ocarina;
@ -109,6 +111,8 @@ typedef struct _GameCFG
this->NINVideoOffset = game.NINVideoOffset; this->NINVideoOffset = game.NINVideoOffset;
this->NINRemlimit = game.NINRemlimit; this->NINRemlimit = game.NINRemlimit;
this->NINArcadeMode = game.NINArcadeMode; this->NINArcadeMode = game.NINArcadeMode;
this->NINCCRumble = game.NINCCRumble;
this->NINSkipIPL = game.NINSkipIPL;
this->NINMCEmulation = game.NINMCEmulation; this->NINMCEmulation = game.NINMCEmulation;
this->NINMCSize = game.NINMCSize; this->NINMCSize = game.NINMCSize;
this->NINUSBHID = game.NINUSBHID; this->NINUSBHID = game.NINUSBHID;

View File

@ -72,13 +72,13 @@ void CSettings::SetDefault()
snprintf(WiinnertagPath, sizeof(WiinnertagPath), "%s", ConfigPath); snprintf(WiinnertagPath, sizeof(WiinnertagPath), "%s", ConfigPath);
snprintf(theme_path, sizeof(theme_path), "%stheme/", ConfigPath); snprintf(theme_path, sizeof(theme_path), "%stheme/", ConfigPath);
snprintf(dolpath, sizeof(dolpath), "%s/", BootDevice); snprintf(dolpath, sizeof(dolpath), "%s/", BootDevice);
snprintf(NandEmuPath, sizeof(NandEmuPath), "%s/nand/", BootDevice); snprintf(NandEmuPath, sizeof(NandEmuPath), "%s/nands/01/", BootDevice);
snprintf(DEVOLoaderPath, sizeof(DEVOLoaderPath), "%s/apps/gc_devo/", BootDevice); snprintf(DEVOLoaderPath, sizeof(DEVOLoaderPath), "%s/apps/gc_devo/", BootDevice);
snprintf(NINLoaderPath, sizeof(NINLoaderPath), "%s/apps/nintendont/", BootDevice); snprintf(NINLoaderPath, sizeof(NINLoaderPath), "%s/apps/nintendont/", BootDevice);
strlcpy(NandEmuChanPath, NandEmuPath, sizeof(NandEmuChanPath)); strlcpy(NandEmuChanPath, NandEmuPath, sizeof(NandEmuChanPath));
strlcpy(GameCubePath, "usb1:/games/", sizeof(GameCubePath)); strlcpy(GameCubePath, "usb1:/games/", sizeof(GameCubePath));
strlcpy(GameCubeSDPath, "sd:/games/", sizeof(GameCubeSDPath)); strlcpy(GameCubeSDPath, "sd:/games/", sizeof(GameCubeSDPath));
strlcpy(CustomBannersURL, "http://nintendont.gxarena.com/banners/", sizeof(CustomBannersURL)); strlcpy(CustomBannersURL, "http://banner.rc24.xyz/", sizeof(CustomBannersURL));
theme[0] = 0; theme[0] = 0;
language_path[0] = 0; language_path[0] = 0;
ogg_path[0] = 0; ogg_path[0] = 0;
@ -94,6 +94,7 @@ void CSettings::SetDefault()
videomode = VIDEO_MODE_DISCDEFAULT; videomode = VIDEO_MODE_DISCDEFAULT;
videopatch = OFF; videopatch = OFF;
videoPatchDol = OFF; videoPatchDol = OFF;
patchFix480p = OFF;
language = CONSOLE_DEFAULT; language = CONSOLE_DEFAULT;
ocarina = OFF; ocarina = OFF;
hddinfo = CLOCK_HR12; hddinfo = CLOCK_HR12;
@ -107,7 +108,7 @@ void CSettings::SetDefault()
gamesound = ON; gamesound = ON;
parentalcontrol = PARENTAL_LVL_ADULT; parentalcontrol = PARENTAL_LVL_ADULT;
LoaderIOS = BUILD_IOS; LoaderIOS = BUILD_IOS;
cios = BUILD_IOS; cios = 249;
gridRows = 3; gridRows = 3;
partition = 0; partition = 0;
discart = DISCARTS_ORIGINALS_CUSTOMS; discart = DISCARTS_ORIGINALS_CUSTOMS;
@ -302,6 +303,7 @@ bool CSettings::Save()
fprintf(file, "videomode = %d\n", videomode); fprintf(file, "videomode = %d\n", videomode);
fprintf(file, "videopatch = %d\n", videopatch); fprintf(file, "videopatch = %d\n", videopatch);
fprintf(file, "videoPatchDol = %d\n", videoPatchDol); fprintf(file, "videoPatchDol = %d\n", videoPatchDol);
fprintf(file, "patchFix480p = %d\n", patchFix480p);
fprintf(file, "language = %d\n", language); fprintf(file, "language = %d\n", language);
fprintf(file, "ocarina = %d\n", ocarina); fprintf(file, "ocarina = %d\n", ocarina);
fprintf(file, "hddinfo = %d\n", hddinfo); fprintf(file, "hddinfo = %d\n", hddinfo);
@ -504,6 +506,11 @@ bool CSettings::SetSetting(char *name, char *value)
videoPatchDol = atoi(value); videoPatchDol = atoi(value);
return true; return true;
} }
else if (strcmp(name, "patchFix480p") == 0)
{
patchFix480p = atoi(value);
return true;
}
else if (strcmp(name, "language") == 0) else if (strcmp(name, "language") == 0)
{ {
language = atoi(value); language = atoi(value);
@ -1225,10 +1232,12 @@ bool CSettings::SetSetting(char *name, char *value)
} }
else if (strcmp(name, "CustomBannersURL") == 0) else if (strcmp(name, "CustomBannersURL") == 0)
{ {
// update banner URL
if( strcmp(value, "http://dl.dropbox.com/u/101209384/") == 0 || if( strcmp(value, "http://dl.dropbox.com/u/101209384/") == 0 ||
strcmp(value, "http://dl.dropboxusercontent.com/u/101209384/") == 0 || strcmp(value, "http://dl.dropboxusercontent.com/u/101209384/") == 0 ||
strcmp(value, "http://copy.com/vRN3HgFVyk9u7YuB/Public/") == 0) strcmp(value, "http://copy.com/vRN3HgFVyk9u7YuB/Public/") == 0 ||
strlcpy(CustomBannersURL, "http://nintendont.gxarena.com/banners/", sizeof(CustomBannersURL)); // update banner URL strcmp(value, "http://nintendont.gxarena.com/banners/") == 0) // Thanks to AbdallahTerro for this one and previous URLs
strlcpy(CustomBannersURL, "http://banner.rc24.xyz/", sizeof(CustomBannersURL)); // Thanks to Larsenv
else else
strlcpy(CustomBannersURL, value, sizeof(CustomBannersURL)); strlcpy(CustomBannersURL, value, sizeof(CustomBannersURL));
return true; return true;

View File

@ -95,6 +95,7 @@ class CSettings
short ocarina; short ocarina;
short videopatch; short videopatch;
short videoPatchDol; short videoPatchDol;
short patchFix480p;
short sinfo; short sinfo;
short hddinfo; short hddinfo;
short rumble; short rumble;

View File

@ -184,6 +184,7 @@ void GameLoadSM::SetOptionNames()
Options->SetName(Idx++, "%s", tr( "Favorite Level" )); Options->SetName(Idx++, "%s", tr( "Favorite Level" ));
Options->SetName(Idx++, "%s", tr( "Video Mode" )); Options->SetName(Idx++, "%s", tr( "Video Mode" ));
Options->SetName(Idx++, "%s", tr( "Dol Video Patch" )); Options->SetName(Idx++, "%s", tr( "Dol Video Patch" ));
Options->SetName(Idx++, "%s", tr( "480p Pixel Fix Patch" ));
Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" )); Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" ));
Options->SetName(Idx++, "%s", tr( "VIDTV Patch" )); Options->SetName(Idx++, "%s", tr( "VIDTV Patch" ));
Options->SetName(Idx++, "%s", tr( "Aspect Ratio" )); Options->SetName(Idx++, "%s", tr( "Aspect Ratio" ));
@ -237,6 +238,12 @@ void GameLoadSM::SetOptionValues()
else else
Options->SetValue(Idx++, "%s", tr(VideoPatchDolText[GameConfig.videoPatchDol])); Options->SetValue(Idx++, "%s", tr(VideoPatchDolText[GameConfig.videoPatchDol]));
//! Settings: 480p Pixel Fix Patch
if(GameConfig.patchFix480p == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.patchFix480p]));
//! Settings: Sneek Video Patch //! Settings: Sneek Video Patch
if(GameConfig.sneekVideoPatch == INHERIT) if(GameConfig.sneekVideoPatch == INHERIT)
Options->SetValue(Idx++, tr("Use global")); Options->SetValue(Idx++, tr("Use global"));
@ -411,6 +418,12 @@ int GameLoadSM::GetMenuInternal()
if (++GameConfig.videoPatchDol >= VIDEO_PATCH_DOL_MAX) GameConfig.videoPatchDol = INHERIT; if (++GameConfig.videoPatchDol >= VIDEO_PATCH_DOL_MAX) GameConfig.videoPatchDol = INHERIT;
} }
//! Settings: 480p Pixel Fix Patch
else if (ret == ++Idx)
{
if (++GameConfig.patchFix480p >= MAX_ON_OFF) GameConfig.patchFix480p = INHERIT;
}
//! Settings: Sneek Video Patch //! Settings: Sneek Video Patch
else if (ret == ++Idx) else if (ret == ++Idx)
{ {

View File

@ -229,6 +229,7 @@ void LoaderSettings::SetOptionNames()
Options->SetName(Idx++, "%s", tr( "Video Mode" )); Options->SetName(Idx++, "%s", tr( "Video Mode" ));
Options->SetName(Idx++, "%s", tr( "Dol Video Patch" )); Options->SetName(Idx++, "%s", tr( "Dol Video Patch" ));
Options->SetName(Idx++, "%s", tr( "480p Pixel Fix Patch" ));
Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" )); Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" ));
Options->SetName(Idx++, "%s", tr( "VIDTV Patch" )); Options->SetName(Idx++, "%s", tr( "VIDTV Patch" ));
Options->SetName(Idx++, "%s", tr( "Aspect Ratio" )); Options->SetName(Idx++, "%s", tr( "Aspect Ratio" ));
@ -309,6 +310,9 @@ void LoaderSettings::SetOptionValues()
//! Settings: Dol Video Patch //! Settings: Dol Video Patch
Options->SetValue(Idx++, "%s", tr( VideoPatchDolText[Settings.videoPatchDol] )); Options->SetValue(Idx++, "%s", tr( VideoPatchDolText[Settings.videoPatchDol] ));
//! Settings: 480p Pixel Fix Patch
Options->SetValue(Idx++, "%s", tr( OnOffText[Settings.patchFix480p] ));
//! Settings: Sneek Video Patch //! Settings: Sneek Video Patch
Options->SetValue(Idx++, "%s", tr( OnOffText[Settings.sneekVideoPatch] )); Options->SetValue(Idx++, "%s", tr( OnOffText[Settings.sneekVideoPatch] ));
@ -540,6 +544,14 @@ int LoaderSettings::GetMenuInternal()
if (++Settings.videoPatchDol >= VIDEO_PATCH_DOL_MAX) Settings.videoPatchDol = 0; if (++Settings.videoPatchDol >= VIDEO_PATCH_DOL_MAX) Settings.videoPatchDol = 0;
} }
//! Settings: 480p Pixel Fix Patch
if (ret == ++Idx)
{
if (++Settings.patchFix480p >= MAX_ON_OFF) Settings.patchFix480p = 0;
if(Settings.patchFix480p)
WindowPrompt(tr("Warning:"), tr("This patch might not work with all games. If a game doesn't boot, disable it in individual game settings menu."), tr("OK"));
}
//! Settings: Sneek Video Patch //! Settings: Sneek Video Patch
else if (ret == ++Idx ) else if (ret == ++Idx )
{ {

6
source/svnrev.c Normal file
View File

@ -0,0 +1,6 @@
#define SVN_REV "1272"
const char *GetRev()
{
return SVN_REV;
}

View File

@ -46,6 +46,13 @@ void wiilight(int enable) // Toggle wiilight (thanks Bool for wiilight source)
u8 shutdown = 0; u8 shutdown = 0;
u8 reset = 0; u8 reset = 0;
/*
* True if running from a WiiU Wii Virtual console channel.
* Checked when initializing gamepad in input.c
* Thanks to Fix94
*/
bool isWiiVC = false;
void __Sys_ResetCallback(void) void __Sys_ResetCallback(void)
{ {
/* Reboot console */ /* Reboot console */
@ -302,5 +309,5 @@ void ScreenShot()
*/ */
bool isWiiU() bool isWiiU()
{ {
return ((*(vu32*)(0xCD8005A0) >> 16 ) == 0xCAFE); return (((*(vu32*)(0xCD8005A0) >> 16 ) == 0xCAFE) || isWiiVC);
} }

View File

@ -1,224 +0,0 @@
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// Copyright (C) 2010 Joseph Jordan <joe.ftpii@psychlaw.com.au>
// Copyright (C) 2012-2013 damysteryman
// Copyright (C) 2012-2015 Christopher Bratusek <nano@jpberlin.de>
// Copyright (C) 2013 DarkMatterCore
// Copyright (C) 2014 megazig
// Copyright (C) 2015 FIX94
#include <gccore.h>
#include <ogc/machine/processor.h>
#include <stdio.h>
#include <string.h>
#include "runtimeiospatch.h"
#define MEM_REG_BASE 0xd8b4000
#define MEM_PROT (MEM_REG_BASE + 0x20a)
static inline void disable_memory_protection(void) {
write32(MEM_PROT, read32(MEM_PROT) & 0x0000FFFF);
}
static const u8 di_readlimit_old[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0A, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x7E, 0xD4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08
};
static const u8 di_readlimit_patch[] = { 0x7e, 0xd4 };
static const u8 isfs_permissions_old[] = { 0x42, 0x8B, 0xD0, 0x01, 0x25, 0x66 };
static const u8 isfs_permissions_patch[] = { 0x42, 0x8B, 0xE0, 0x01, 0x25, 0x66 };
#if 0
static const u8 setuid_old[] = { 0xD1, 0x2A, 0x1C, 0x39 };
static const u8 setuid_patch[] = { 0x46, 0xC0 };
#endif
static const u8 es_identify_old[] = { 0x28, 0x03, 0xD1, 0x23 };
static const u8 es_identify_patch[] = { 0x00, 0x00 };
static const u8 hash_old[] = { 0x20, 0x07, 0x23, 0xA2 };
static const u8 hash_patch[] = { 0x00 };
static const u8 new_hash_old[] = { 0x20, 0x07, 0x4B, 0x0B };
#if 0
static const u8 addticket_vers_check[] = { 0xD2, 0x01, 0x4E, 0x56 };
static const u8 addticket_patch[] = { 0xE0 };
#endif
static const u8 es_set_ahbprot_old[] = { 0x68, 0x5B, 0x22, 0xEC, 0x00, 0x52, 0x18, 0x9B, 0x68, 0x1B, 0x46, 0x98, 0x07, 0xDB };
static const u8 es_set_ahbprot_patch[] = { 0x01 };
/* SSL patches made by FIX94 for Nintendont. Ported to libruntimeiospatch by DarkMatterCore */
static const u8 ssl_patch1_old[] = { 0xFE, 0x0E, 0xE3, 0x50, 0x00, 0x00, 0x05, 0x9F };
static const u8 ssl_patch1_new[] = { 0xFE, 0x0E, 0xE3, 0x28, 0xF1, 0x02, 0x05, 0x9F }; // Fixes SSL error -9 (wrong host)
static const u8 ssl_patch2_old[] = { 0x00, 0x00, 0x0A, 0x00, 0x00, 0x09, 0xEA, 0x00 };
static const u8 ssl_patch2_new[] = { 0x00, 0x00, 0xEA, 0x00, 0x00, 0x09, 0xEA, 0x00 }; // Fixes SSL error -10 (part 1) (wrong root cert)
static const u8 ssl_patch3_old[] = { 0x00, 0x00, 0x1A, 0x00, 0x00, 0x08, 0xE3, 0xE0 };
static const u8 ssl_patch3_new[] = { 0x00, 0x00, 0xEA, 0x00, 0x00, 0x08, 0xE3, 0xE0 }; // Fixes SSL error -10 (part 2) (wrong root cert)
static const u8 ssl_patch4_old[] = { 0x00, 0x00, 0xDA, 0x00, 0x00, 0x16, 0xE7, 0x96 };
static const u8 ssl_patch4_new[] = { 0x00, 0x00, 0xEA, 0x00, 0x00, 0x16, 0xE7, 0x96 }; // Fixes SSL error -11 (wrong client cert)
//Following patches added to iospatch.c by damysteryman, taken from sciifii v5
static const u8 MEM2_prot_old[] = { 0xB5, 0x00, 0x4B, 0x09, 0x22, 0x01, 0x80, 0x1A, 0x22, 0xF0 };
static const u8 MEM2_prot_patch[] = { 0xB5, 0x00, 0x4B, 0x09, 0x22, 0x00, 0x80, 0x1A, 0x22, 0xF0 };
static const u8 ES_OpenTitleContent1_old[] = { 0x9D, 0x05, 0x42, 0x9D, 0xD0, 0x03 };
static const u8 ES_OpenTitleContent1_patch[] = { 0x9D, 0x05, 0x42, 0x9D, 0xE0, 0x03 };
static const u8 ES_OpenTitleContent2_old[] = { 0xD4, 0x01, 0x4C, 0x36, 0xE0, 0x3B };
static const u8 ES_OpenTitleContent2_patch[] = { 0xE0, 0x01, 0x4C, 0x36, 0xE0, 0x3B };
static const u8 ES_ReadContent_old[] = { 0xFC, 0x0F, 0xB5, 0x30, 0x1C, 0x14, 0x1C, 0x1D, 0x4B,
0x0E, 0x68, 0x9B, 0x2B, 0x00, 0xD0, 0x03, 0x29, 0x00, 0xDB, 0x01,
0x29, 0x0F, 0xDD, 0x01 };
static const u8 ES_ReadContent_patch[] = { 0xFC, 0x0F, 0xB5, 0x30, 0x1C, 0x14, 0x1C, 0x1D, 0x4B,
0x0E, 0x68, 0x9B, 0x2B, 0x00, 0x46, 0xC0, 0x29, 0x00, 0x46, 0xC0,
0x29, 0x0F, 0xE0, 0x01 };
static const u8 ES_CloseContent_old[] = { 0xB5, 0x10, 0x4B, 0x10, 0x68, 0x9B, 0x2B, 0x00, 0xD0,
0x03, 0x29, 0x00, 0xDB, 0x01, 0x29, 0x0F, 0xDD, 0x01 };
static const u8 ES_CloseContent_patch[] = { 0xB5, 0x10, 0x4B, 0x10, 0x68, 0x9B, 0x2B, 0x00, 0x46,
0xC0, 0x29, 0x00, 0x46, 0xC0, 0x29, 0x0F, 0xE0, 0x01 };
static const u8 ES_TitleVersionCheck_old[] = { 0xD2, 0x01, 0x4E, 0x56 };
static const u8 ES_TitleVersionCheck_patch[] = { 0xE0, 0x01, 0x4E, 0x56 };
static const u8 ES_TitleDeleteCheck_old[] = { 0xD8, 0x00, 0x4A, 0x04 };
static const u8 ES_TitleDeleteCheck_patch[] = { 0xE0, 0x00, 0x4A, 0x04 };
//Following set of patches made by damysteryman for use with Wii U's vWii
static const u8 Kill_AntiSysTitleInstallv3_pt1_old[] = { 0x68, 0x1A, 0x2A, 0x01, 0xD0, 0x05 }; // Make sure that the pt1
static const u8 Kill_AntiSysTitleInstallv3_pt1_patch[] = { 0x68, 0x1A, 0x2A, 0x01, 0x46, 0xC0 }; // patch is applied twice. -dmm
static const u8 Kill_AntiSysTitleInstallv3_pt2_old[] = { 0xD0, 0x02, 0x33, 0x06, 0x42, 0x9A, 0xD1, 0x01 }; // Make sure that the pt2 patch
static const u8 Kill_AntiSysTitleInstallv3_pt2_patch[] = { 0x46, 0xC0, 0x33, 0x06, 0x42, 0x9A, 0xE0, 0x01 }; // is also applied twice. -dmm
static const u8 Kill_AntiSysTitleInstallv3_pt3_old[] = { 0x68, 0xFB, 0x2B, 0x00, 0xDB, 0x01 };
static const u8 Kill_AntiSysTitleInstallv3_pt3_patch[] = { 0x68, 0xFB, 0x2B, 0x00, 0xDB, 0x10 };
/* ISFS_SetAttr patches made by megazig */
#if 0
static const u8 isfs_setattr_pt1_old[] = { 0x42, 0xAB, 0xD0, 0x02, 0x20, 0x66 };
static const u8 isfs_setattr_pt1_patch[] = { 0x42, 0xAB, 0xE0, 0x02, 0x20, 0x66 };
static const u8 isfs_setattr_pt2_old[] = { 0x2D, 0x00, 0xD0, 0x02, 0x20, 0x66 };
static const u8 isfs_setattr_pt2_patch[] = { 0x2D, 0x00, 0xE0, 0x02, 0x20, 0x66 };
#endif
static u8 apply_patch(const char *name, const u8 *old, u32 old_size, const u8 *patch, size_t patch_size, u32 patch_offset, bool verbose) {
u8 *ptr_start = (u8*)*((u32*)0x80003134), *ptr_end = (u8*)0x94000000;
u8 found = 0;
if(verbose)
printf(" Patching %-30s", name);
u8 *location = NULL;
while (ptr_start < (ptr_end - patch_size)) {
if (!memcmp(ptr_start, old, old_size)) {
found++;
location = ptr_start + patch_offset;
u8 *start = location;
u32 i;
for (i = 0; i < patch_size; i++) {
*location++ = patch[i];
}
DCFlushRange((u8 *)(((u32)start) >> 5 << 5), (patch_size >> 5 << 5) + 64);
ICInvalidateRange((u8 *)(((u32)start) >> 5 << 5), (patch_size >> 5 << 5) + 64);
}
ptr_start++;
}
if(verbose){
if (found)
printf(" patched\n");
else
printf(" not patched\n");
}
return found;
}
s32 IosPatch_AHBPROT(bool verbose) {
if (AHBPROT_DISABLED) {
disable_memory_protection();
s32 ret = apply_patch("es_set_ahbprot", es_set_ahbprot_old, sizeof(es_set_ahbprot_old), es_set_ahbprot_patch, sizeof(es_set_ahbprot_patch), 25, verbose);
if (ret)
return ret;
else
return ERROR_PATCH;
}
return ERROR_AHBPROT;
}
s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose) {
s32 count = 0;
if (AHBPROT_DISABLED) {
disable_memory_protection();
if(wii)
{
if(verbose) printf(">> Applying standard Wii patches:\n");
count += apply_patch("di_readlimit", di_readlimit_old, sizeof(di_readlimit_old), di_readlimit_patch, sizeof(di_readlimit_patch), 12, verbose);
count += apply_patch("isfs_permissions", isfs_permissions_old, sizeof(isfs_permissions_old), isfs_permissions_patch, sizeof(isfs_permissions_patch), 0, verbose);
//count += apply_patch("es_setuid", setuid_old, sizeof(setuid_old), setuid_patch, sizeof(setuid_patch), 0, verbose);
count += apply_patch("es_identify", es_identify_old, sizeof(es_identify_old), es_identify_patch, sizeof(es_identify_patch), 2, verbose);
count += apply_patch("hash_check", hash_old, sizeof(hash_old), hash_patch, sizeof(hash_patch), 1, verbose);
count += apply_patch("new_hash_check", new_hash_old, sizeof(new_hash_old), hash_patch, sizeof(hash_patch), 1, verbose);
//count += apply_patch("isfs_setattr_pt1", isfs_setattr_pt1_old, sizeof(isfs_setattr_pt1_old), isfs_setattr_pt1_patch, sizeof(isfs_setattr_pt1_patch), 0, verbose);
//count += apply_patch("isfs_setattr_pt2", isfs_setattr_pt2_old, sizeof(isfs_setattr_pt2_old), isfs_setattr_pt2_patch, sizeof(isfs_setattr_pt2_patch), 0, verbose);
//count += apply_patch("ssl_patch1", ssl_patch1_old, sizeof(ssl_patch1_old), ssl_patch1_new, sizeof(ssl_patch1_new), 0, verbose);
//count += apply_patch("ssl_patch2", ssl_patch2_old, sizeof(ssl_patch2_old), ssl_patch2_new, sizeof(ssl_patch2_new), 0, verbose);
//count += apply_patch("ssl_patch3", ssl_patch3_old, sizeof(ssl_patch3_old), ssl_patch3_new, sizeof(ssl_patch3_new), 0, verbose);
//count += apply_patch("ssl_patch4", ssl_patch4_old, sizeof(ssl_patch4_old), ssl_patch4_new, sizeof(ssl_patch4_new), 0, verbose);
}
if(sciifii)
{
if(verbose) printf(">> Applying Sciifii patches:\n");
count += apply_patch("MEM2_prot", MEM2_prot_old, sizeof(MEM2_prot_old), MEM2_prot_patch, sizeof(MEM2_prot_patch), 0, verbose);
count += apply_patch("ES_OpenTitleContent1", ES_OpenTitleContent1_old, sizeof(ES_OpenTitleContent1_old), ES_OpenTitleContent1_patch, sizeof(ES_OpenTitleContent1_patch), 0, verbose);
count += apply_patch("ES_OpenTitleContent2", ES_OpenTitleContent2_old, sizeof(ES_OpenTitleContent2_old), ES_OpenTitleContent2_patch, sizeof(ES_OpenTitleContent2_patch), 0, verbose);
count += apply_patch("ES_ReadContent_prot", ES_ReadContent_old, sizeof(ES_ReadContent_old), ES_ReadContent_patch, sizeof(ES_ReadContent_patch), 0, verbose);
count += apply_patch("ES_CloseContent", ES_CloseContent_old, sizeof(ES_CloseContent_old), ES_CloseContent_patch, sizeof(ES_CloseContent_patch), 0, verbose);
count += apply_patch("ES_TitleVersionCheck", ES_TitleVersionCheck_old, sizeof(ES_TitleVersionCheck_old), ES_TitleVersionCheck_patch, sizeof(ES_TitleVersionCheck_patch), 0, verbose);
count += apply_patch("ES_TitleDeleteCheck", ES_TitleDeleteCheck_old, sizeof(ES_TitleDeleteCheck_old), ES_TitleDeleteCheck_patch, sizeof(ES_TitleDeleteCheck_patch), 0, verbose);
}
if(vwii)
{
if(verbose) printf(">> Applying vWii patches:\n");
count += apply_patch("Kill_AntiSysTitleInstallv3_pt1", Kill_AntiSysTitleInstallv3_pt1_old, sizeof(Kill_AntiSysTitleInstallv3_pt1_old), Kill_AntiSysTitleInstallv3_pt1_patch, sizeof(Kill_AntiSysTitleInstallv3_pt1_patch), 0, verbose);
count += apply_patch("Kill_AntiSysTitleInstallv3_pt2", Kill_AntiSysTitleInstallv3_pt2_old, sizeof(Kill_AntiSysTitleInstallv3_pt2_old), Kill_AntiSysTitleInstallv3_pt2_patch, sizeof(Kill_AntiSysTitleInstallv3_pt2_patch), 0, verbose);
count += apply_patch("Kill_AntiSysTitleInstallv3_pt3", Kill_AntiSysTitleInstallv3_pt3_old, sizeof(Kill_AntiSysTitleInstallv3_pt3_old), Kill_AntiSysTitleInstallv3_pt3_patch, sizeof(Kill_AntiSysTitleInstallv3_pt3_patch), 0, verbose);
}
return count;
}
return ERROR_AHBPROT;
}
s32 IosPatch_FULL(bool wii, bool sciifii, bool vwii, bool verbose, int IOS) {
s32 ret = 0;
s32 xret = 0;
if (AHBPROT_DISABLED)
ret = IosPatch_AHBPROT(verbose);
else
return ERROR_AHBPROT;
if (ret) {
IOS_ReloadIOS(IOS);
xret = IosPatch_RUNTIME(wii, sciifii, vwii, verbose);
} else {
xret = ERROR_PATCH;
}
return xret;
}
s32 IosPatch_SSL(bool verbose) {
s32 count = 0;
if (AHBPROT_DISABLED) {
disable_memory_protection();
if(verbose) printf(">> Applying SSL patches:\n");
count += apply_patch("ssl_patch1", ssl_patch1_old, sizeof(ssl_patch1_old), ssl_patch1_new, sizeof(ssl_patch1_new), 0, verbose);
count += apply_patch("ssl_patch2", ssl_patch2_old, sizeof(ssl_patch2_old), ssl_patch2_new, sizeof(ssl_patch2_new), 0, verbose);
count += apply_patch("ssl_patch3", ssl_patch3_old, sizeof(ssl_patch3_old), ssl_patch3_new, sizeof(ssl_patch3_new), 0, verbose);
count += apply_patch("ssl_patch4", ssl_patch4_old, sizeof(ssl_patch4_old), ssl_patch4_new, sizeof(ssl_patch4_new), 0, verbose);
return count;
}
return ERROR_AHBPROT;
}

View File

@ -20,7 +20,7 @@
#include "mload/mload.h" #include "mload/mload.h"
#include "mload/mload_modules.h" #include "mload/mload_modules.h"
#include "system/IosLoader.h" #include "system/IosLoader.h"
#include "system/runtimeiospatch.h" #include "libs/libruntimeiospatch/runtimeiospatch.h"
#include "Controls/DeviceHandler.hpp" #include "Controls/DeviceHandler.hpp"
#include "Channels/channels.h" #include "Channels/channels.h"
#include "usbloader/disc.h" #include "usbloader/disc.h"
@ -59,6 +59,7 @@
//appentrypoint has to be global because of asm //appentrypoint has to be global because of asm
u32 AppEntrypoint = 0; u32 AppEntrypoint = 0;
extern bool isWiiVC; // in sys.cpp
extern u32 hdd_sector_size[2]; extern u32 hdd_sector_size[2];
extern "C" extern "C"
{ {
@ -255,6 +256,7 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
GameCFG * game_cfg = GameSettings.GetGameCFG(gameHeader.id); GameCFG * game_cfg = GameSettings.GetGameCFG(gameHeader.id);
u8 videoChoice = game_cfg->video == INHERIT ? Settings.videomode : game_cfg->video; u8 videoChoice = game_cfg->video == INHERIT ? Settings.videomode : game_cfg->video;
u8 videoPatchDolChoice = game_cfg->videoPatchDol == INHERIT ? Settings.videoPatchDol : game_cfg->videoPatchDol; u8 videoPatchDolChoice = game_cfg->videoPatchDol == INHERIT ? Settings.videoPatchDol : game_cfg->videoPatchDol;
u8 patchFix480pChoice = game_cfg->patchFix480p == INHERIT ? Settings.patchFix480p : game_cfg->patchFix480p;
u8 aspectChoice = game_cfg->aspectratio == INHERIT ? Settings.GameAspectRatio : game_cfg->aspectratio; u8 aspectChoice = game_cfg->aspectratio == INHERIT ? Settings.GameAspectRatio : game_cfg->aspectratio;
u8 languageChoice = game_cfg->language == INHERIT ? Settings.language : game_cfg->language; u8 languageChoice = game_cfg->language == INHERIT ? Settings.language : game_cfg->language;
u8 ocarinaChoice = game_cfg->ocarina == INHERIT ? Settings.ocarina : game_cfg->ocarina; u8 ocarinaChoice = game_cfg->ocarina == INHERIT ? Settings.ocarina : game_cfg->ocarina;
@ -312,7 +314,7 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
if(IOS_GetVersion() < 200 || (IosLoader::IsHermesIOS() && IOS_GetRevision() == 4)) if(IOS_GetVersion() < 200 || (IosLoader::IsHermesIOS() && IOS_GetRevision() == 4))
{ {
gprintf("Patching IOS%d...\n", IOS_GetVersion()); gprintf("Patching IOS%d...\n", IOS_GetVersion());
if (IosPatch_RUNTIME(true, false, false, false) == ERROR_PATCH) if (IosPatch_RUNTIME(true, false, false, false, false) == ERROR_PATCH)
gprintf("Patching %sIOS%d failed!\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion()); gprintf("Patching %sIOS%d failed!\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion());
} }
@ -415,11 +417,55 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
//! Do all the game patches //! Do all the game patches
gprintf("Applying game patches...\n"); gprintf("Applying game patches...\n");
gamepatches(videoChoice, videoPatchDolChoice, aspectChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, returnToChoice, PrivServChoice);
//! Now this code block is responsible for the private server patch
//! and the gecko code handler loading
//! If a server other than Wiimmfi is selected, do the normal patching
//! If Wiimmfi is selected for other games than MKWii, do normal patching as well
//! If Wiimmfi is selected for MKWii, skip normal patching (PRIVSERV_OFF)
//! and let the new code in do_new_wiimmfi() handle the complete server patch
//! Also, the new Wiimmfi server patch should be loaded into memory after
//! the code handler and the cheat codes.
if (PrivServChoice != PRIVSERV_WIIMMFI || memcmp(((void *)(0x80000000)), (char*)"RMC", 3) != 0) {
//! Either the server is not Wiimmfi, or, if it is Wiimmfi, the game isn't MKWii - patch the old way
gamepatches(videoChoice, videoPatchDolChoice, aspectChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, returnToChoice, PrivServChoice);
}
else {
//! Wiimmfi patch for Mario Kart Wii - patch with PRIVSERV_OFF and handle all the patching within do_new_wiimmfi()
gamepatches(videoChoice, videoPatchDolChoice, aspectChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, returnToChoice, PRIVSERV_OFF);
}
//! Load Code handler if needed //! Load Code handler if needed
load_handler(Hooktype, WiirdDebugger, Settings.WiirdDebuggerPause); load_handler(Hooktype, WiirdDebugger, Settings.WiirdDebuggerPause);
//! Perform 480p fix if needed.
//! Needs to be done after the call to gamepatches(), after loading any code handler.
//! Can (and should) be done before Wiimmfi patching, can't be done in gamepatches() itself.
if(patchFix480pChoice)
PatchFix480p();
//! New Wiimmfi patch should be loaded last, after the codehandler, just before the call to the entry point
if (PrivServChoice == PRIVSERV_WIIMMFI && memcmp(((void *)(0x80000000)), (char*)"RMC", 3) == 0 ) {
// all the cool new Wiimmfi stuff:
switch(do_new_wiimmfi()) {
case 0:
gprintf("Wiimmfi patch for Mario Kart Wii successful.\n");
break;
case -1:
gprintf("Could not determine game region for Wiimmfi patch - make sure the fourth char of the ID is one of [PEJK].\n");
break;
case -2:
gprintf("This image is already patched for Wiimmfi, no need to do so again.\n");
break;
}
}
//! Jump to the entrypoint of the game - the last function of the USB Loader //! Jump to the entrypoint of the game - the last function of the USB Loader
gprintf("Jumping to game entrypoint: 0x%08X.\n", AppEntrypoint); gprintf("Jumping to game entrypoint: 0x%08X.\n", AppEntrypoint);
return Disc_JumpToEntrypoint(Hooktype, WDMMenu::GetDolParameter()); return Disc_JumpToEntrypoint(Hooktype, WDMMenu::GetDolParameter());
@ -1424,9 +1470,9 @@ int GameBooter::BootNintendont(struct discHdr *gameHdr)
if(ninArcadeModeChoice) if(ninArcadeModeChoice)
nin_config->Config |= NIN_CFG_ARCADE_MODE; // v4.424+ Triforce Arcade Mode nin_config->Config |= NIN_CFG_ARCADE_MODE; // v4.424+ Triforce Arcade Mode
if (ninCCRumbleChoice) if (ninCCRumbleChoice)
nin_config->Config |= NIN_CFG_CC_RUMBLE; // v4.424+ Classic Controller Rumble nin_config->Config |= NIN_CFG_CC_RUMBLE; // v4.431+ Classic Controller Rumble
if (ninSkipIPLChoice) if (ninSkipIPLChoice)
nin_config->Config |= NIN_CFG_SKIP_IPL; // v4.424+ Skip Gamecube BIOS nin_config->Config |= NIN_CFG_SKIP_IPL; // v4.435+ Skip Gamecube BIOS
// Max Pads // Max Pads
nin_config->MaxPads = ninMaxPadsChoice; // NIN_CFG_VERSION 2 r42 nin_config->MaxPads = ninMaxPadsChoice; // NIN_CFG_VERSION 2 r42
@ -1502,6 +1548,14 @@ int GameBooter::BootNintendont(struct discHdr *gameHdr)
} }
gprintf("NIN: Language 0x%08x \n", nin_config->Language); gprintf("NIN: Language 0x%08x \n", nin_config->Language);
// if WiiVC, force creation and use of nincfg.bin file to fix a nintendont bug if HID is connected before launching it.
if(isWiiVC)
{
ninSettingsChoice = ON;
NINArgsboot = OFF;
}
// Delete existing nincfg.bin files // Delete existing nincfg.bin files
if(ninSettingsChoice == OFF) if(ninSettingsChoice == OFF)
{ {

View File

@ -18,7 +18,6 @@ void __Wpad_PowerCallback(s32 chan)
s32 Wpad_Init(void) s32 Wpad_Init(void)
{ {
WUPC_Init();
s32 ret; s32 ret;
/* Initialize Wiimote subsystem */ /* Initialize Wiimote subsystem */
@ -40,7 +39,6 @@ void Wpad_Disconnect(void)
WPAD_Disconnect(cnt); WPAD_Disconnect(cnt);
/* Shutdown Wiimote subsystem */ /* Shutdown Wiimote subsystem */
WUPC_Shutdown();
WPAD_Shutdown(); WPAD_Shutdown();
} }
@ -66,13 +64,11 @@ u32 ButtonsHold(void)
int i; int i;
u32 buttons = 0; u32 buttons = 0;
WUPC_UpdateButtonStats();
WPAD_ScanPads(); WPAD_ScanPads();
PAD_ScanPads(); PAD_ScanPads();
for (i = 3; i >= 0; i--) for (i = 3; i >= 0; i--)
{ {
buttons |= WUPC_ButtonsHeld(i);
buttons |= PAD_ButtonsHeld(i); buttons |= PAD_ButtonsHeld(i);
buttons |= WPAD_ButtonsHeld(i); buttons |= WPAD_ButtonsHeld(i);
} }
@ -83,13 +79,11 @@ u32 ButtonsPressed(void)
{ {
int i; int i;
u32 buttons = 0; u32 buttons = 0;
WUPC_UpdateButtonStats();
WPAD_ScanPads(); WPAD_ScanPads();
PAD_ScanPads(); PAD_ScanPads();
for (i = 3; i >= 0; i--) for (i = 3; i >= 0; i--)
{ {
buttons |= WUPC_ButtonsDown(i);
buttons |= PAD_ButtonsDown(i); buttons |= PAD_ButtonsDown(i);
buttons |= WPAD_ButtonsDown(i); buttons |= WPAD_ButtonsDown(i);
} }

View File

@ -2,7 +2,6 @@
#define _WPAD_H_ #define _WPAD_H_
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <wupc/wupc.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"