-reverted changes of r1156. readded libwupc.

This commit is contained in:
fledge68 2018-07-26 22:24:00 +00:00
parent 580f98fac5
commit e4d9b2e0d1
9 changed files with 86 additions and 20 deletions

View File

@ -57,7 +57,7 @@ ios := 249
#---------------------------------------------------------------------------------
CFLAGS = -g -ggdb -Os -Wall -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DHAVE_CONFIG_H
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size
LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register
ifeq ($(BUILDMODE),channel)
CFLAGS += -DFULLCHANNEL
@ -67,7 +67,7 @@ endif
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lcustomfat -lcustomntfs -lcustomext2fs -lpng -lturbojpeg -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -lsicksaxis
LIBS := -lcustomfat -lcustomntfs -lcustomext2fs -lpng -lturbojpeg -lm -lz -lwiiuse -lwupc -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -lsicksaxis
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -0,0 +1,49 @@
/****************************************************************************
* Copyright (C) 2014 FIX94
*
* 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, either version 3 of the License, or
* (at your option) any later version.
*
* 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef _WUPC_H_
#define _WUPC_H_
#ifdef __cplusplus
extern "C" {
#endif
struct WUPCData {
s16 xAxisL;
s16 xAxisR;
s16 yAxisL;
s16 yAxisR;
u32 button;
};
void WUPC_Init();
void WUPC_Shutdown();
struct WUPCData *WUPC_Data(u8 chan);
void WUPC_Rumble(u8 chan, bool rumble);
u32 WUPC_UpdateButtonStats();
u32 WUPC_ButtonsUp(u8 chan);
u32 WUPC_ButtonsDown(u8 chan);
u32 WUPC_ButtonsHeld(u8 chan);
s16 WUPC_lStickX(u8 chan);
s16 WUPC_lStickY(u8 chan);
s16 WUPC_rStickX(u8 chan);
s16 WUPC_rStickY(u8 chan);
#ifdef __cplusplus
}
#endif
#endif

BIN
portlibs/lib/libwupc.a Normal file

Binary file not shown.

View File

@ -413,10 +413,11 @@ void CButtonsMgr::setSoundVolume(int vol)
m_soundVolume = min(max(0, vol), 0xFF);
}
void CButtonsMgr::setRumble(int chan, bool wii, bool gc)
void CButtonsMgr::setRumble(int chan, bool wii, bool gc, bool wupc)
{
wii_rumble[chan] = wii;
gc_rumble[chan] = gc;
wupc_rumble[chan] = wupc;
}
void CButtonsMgr::setMouse(bool enable)
@ -459,6 +460,7 @@ void CButtonsMgr::click(s16 id)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
WUPC_Rumble(chan, 0);
WPAD_Rumble(chan, 0);
PAD_ControlMotor(chan, 0);
@ -517,6 +519,7 @@ void CButtonsMgr::mouse(int chan, int x, int y)
if(m_rumbleEnabled)
{
m_rumble[chan] = 4;
if(wupc_rumble[chan]) WUPC_Rumble(chan, 1);
if(wii_rumble[chan]) WPAD_Rumble(chan, 1);
if(gc_rumble[chan]) PAD_ControlMotor(chan, 1);
}
@ -600,6 +603,7 @@ void CButtonsMgr::tick(void)
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
if (m_rumble[chan] > 0 && --m_rumble[chan] == 0)
{
WUPC_Rumble(chan, 0);
WPAD_Rumble(chan, 0);
PAD_ControlMotor(chan, 0);
}

View File

@ -6,6 +6,7 @@
#include <ogc/pad.h>
#include "wiiuse/wpad.h"
#include "wupc/wupc.h"
#include "sicksaxis-wrapper/sicksaxis-wrapper.h"
#include "video.hpp"
@ -63,7 +64,7 @@ public:
void noHover(bool nohover = false);
void click(s16 id = -1);
bool selected(s16 button = -1);
void setRumble(int, bool wii = false, bool gc = false);
void setRumble(int, bool wii = false, bool gc = false, bool wupc = false);
void deselect(void){ for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--) m_selected[chan] = -1; }
void stopSounds(void);
void setSoundVolume(int vol);
@ -147,6 +148,7 @@ private:
u8 m_rumble[WPAD_MAX_WIIMOTES];
bool wii_rumble[WPAD_MAX_WIIMOTES];
bool gc_rumble[WPAD_MAX_WIIMOTES];
bool wupc_rumble[WPAD_MAX_WIIMOTES];
GuiSound *m_sndHover;
GuiSound *m_sndClick;
u8 m_soundVolume;

View File

@ -16,6 +16,7 @@
#include "memory/mem2.hpp"
#include "memory/memory.h"
#include "wiiuse/wpad.h"
#include "wupc/wupc.h"
#include "sicksaxis-wrapper/sicksaxis-wrapper.h"
/* Variables */
@ -35,6 +36,7 @@ void Open_Inputs(void)
{
/* Initialize Wiimote subsystem */
PAD_Init();
WUPC_Init();
WPAD_Init();
DS3_Init();
//drc
@ -47,6 +49,8 @@ void Open_Inputs(void)
void Close_Inputs(void)
{
WUPC_Shutdown();
u32 cnt;
/* Disconnect Wiimotes */

View File

@ -27,6 +27,7 @@
#include "music/MusicPlayer.hpp"
#include "plugin/plugin.hpp"
#include "wiiuse/wpad.h"
#include "wupc/wupc.h"
#include "sicksaxis-wrapper/sicksaxis-wrapper.h"
using namespace std;
@ -666,6 +667,8 @@ private:
bool wBtn_HeldChan(int btn, u8 ext, int &chan);
u32 gc_btnsPressed;
u32 gc_btnsHeld;
u32 wupc_btnsPressed[WPAD_MAX_WIIMOTES];
u32 wupc_btnsHeld[WPAD_MAX_WIIMOTES];
bool ds3_btnRepeat(s64 btn);
bool m_show_pointer[WPAD_MAX_WIIMOTES];
float left_stick_angle[WPAD_MAX_WIIMOTES];

View File

@ -65,6 +65,7 @@ void CMenu::ScanInput()
m_show_zone_prev = false;
m_show_zone_next = false;
WUPC_UpdateButtonStats();
WPAD_ScanPads();
PAD_ScanPads();
DS3_ScanPads();
@ -109,7 +110,8 @@ void CMenu::ScanInput()
}
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
m_btnMgr.setRumble(chan, WPadIR_Valid(chan), PAD_StickX(chan) < -20 || PAD_StickX(chan) > 20 || PAD_StickY(chan) < -20 || PAD_StickY(chan) > 20);
m_btnMgr.setRumble(chan, WPadIR_Valid(chan), PAD_StickX(chan) < -20 || PAD_StickX(chan) > 20 || PAD_StickY(chan) < -20 || PAD_StickY(chan) > 20,
WUPC_lStickX(chan) < -160 || WUPC_lStickX(chan) > 160 || WUPC_lStickY(chan) < -160 || WUPC_lStickY(chan) > 160);
m_btnMgr.setMouse(WPadIR_Valid(chan) || m_show_pointer[chan]);
if(WPadIR_Valid(chan))
{
@ -149,6 +151,7 @@ void CMenu::ButtonsPressed()
{
wii_btnsPressed[chan] = WPAD_ButtonsDown(chan);
gc_btnsPressed |= PAD_ButtonsDown(chan);
wupc_btnsPressed[chan] = WUPC_ButtonsDown(chan);
//drc
}
}
@ -161,13 +164,14 @@ void CMenu::ButtonsHeld()
{
wii_btnsHeld[chan] = WPAD_ButtonsHeld(chan);
gc_btnsHeld |= PAD_ButtonsHeld(chan);
wupc_btnsHeld[chan] = WUPC_ButtonsHeld(chan);
//drc
}
}
bool CMenu::wBtn_PressedChan(int btn, u8 ext, int &chan)
{
return ((wii_btnsPressed[chan] & btn) && (ext == WPAD_EXP_NONE || ext == wd[chan]->exp.type));
return ((wii_btnsPressed[chan] & btn) && (ext == WPAD_EXP_NONE || ext == wd[chan]->exp.type)) || ((wupc_btnsPressed[chan] & btn) && (ext == WPAD_EXP_CLASSIC));
}
bool CMenu::wBtn_Pressed(int btn, u8 ext)
@ -182,7 +186,7 @@ bool CMenu::wBtn_Pressed(int btn, u8 ext)
bool CMenu::wBtn_HeldChan(int btn, u8 ext, int &chan)
{
return ((wii_btnsHeld[chan] & btn) && (ext == WPAD_EXP_NONE || ext == wd[chan]->exp.type));
return ((wii_btnsHeld[chan] & btn) && (ext == WPAD_EXP_NONE || ext == wd[chan]->exp.type)) || ((wupc_btnsHeld[chan] & btn) && (ext == WPAD_EXP_CLASSIC));
}
bool CMenu::wBtn_Held(int btn, u8 ext)
@ -200,13 +204,13 @@ void CMenu::LeftStick()
u8 speed = 0, pSpeed = 0;
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if(left_stick_mag[chan] > 0.15 || abs(PAD_StickX(chan)) > 20 || abs(PAD_StickY(chan)) > 20 || (chan == 0 && (abs(DS3_StickX()) > 20 || abs(DS3_StickY()) > 20)))
if(left_stick_mag[chan] > 0.15 || abs(PAD_StickX(chan)) > 20 || abs(PAD_StickY(chan)) > 20 || (chan == 0 && (abs(DS3_StickX()) > 20 || abs(DS3_StickY()) > 20)) || abs(WUPC_lStickX(chan)) > 160 || abs(WUPC_lStickY(chan)) > 160)
{
m_show_pointer[chan] = true;
if(LEFT_STICK_LEFT)
{
speed = (u8)(left_stick_mag[chan] * 10.00);
pSpeed = (u8)(((int)abs(PAD_StickX(chan))/10)|((int)abs(DS3_StickX()/10)));
pSpeed = (u8)(((int)abs(PAD_StickX(chan))/10)|((int)abs(DS3_StickX()/10))|((int)abs(WUPC_lStickX(chan))/80));
if(stickPointer_x[chan] > m_cursor[chan].width()/2)
stickPointer_x[chan] = stickPointer_x[chan]-speed-pSpeed;
pointerhidedelay[chan] = 150;
@ -214,7 +218,7 @@ void CMenu::LeftStick()
if(LEFT_STICK_DOWN)
{
speed = (u8)(left_stick_mag[chan] * 10.00);
pSpeed = (u8)(((int)abs(PAD_StickY(chan))/10)|((int)abs(DS3_StickY()/10)));
pSpeed = (u8)(((int)abs(PAD_StickY(chan))/10)|((int)abs(DS3_StickY()/10))|((int)abs(WUPC_lStickY(chan))/80));
if(stickPointer_y[chan] < (m_vid.height() + (m_cursor[chan].height()/2)))
stickPointer_y[chan] = stickPointer_y[chan]+speed+pSpeed;
pointerhidedelay[chan] = 150;
@ -222,7 +226,7 @@ void CMenu::LeftStick()
if(LEFT_STICK_RIGHT)
{
speed = (u8)(left_stick_mag[chan] * 10.00);
pSpeed = (u8)(((int)abs(PAD_StickX(chan))/10)|((int)abs(DS3_StickX()/10)));
pSpeed = (u8)(((int)abs(PAD_StickX(chan))/10)|((int)abs(DS3_StickX()/10))|((int)abs(WUPC_lStickX(chan))/80));
if(stickPointer_x[chan] < (m_vid.width() + (m_cursor[chan].width()/2)))
stickPointer_x[chan] = stickPointer_x[chan]+speed+pSpeed;
pointerhidedelay[chan] = 150;
@ -230,7 +234,7 @@ void CMenu::LeftStick()
if(LEFT_STICK_UP)
{
speed = (u8)(left_stick_mag[chan] * 10.00);
pSpeed = (u8)(((int)abs(PAD_StickY(chan))/10)|((int)abs(DS3_StickY()/10)));
pSpeed = (u8)(((int)abs(PAD_StickY(chan))/10)|((int)abs(DS3_StickY()/10))|((int)abs(WUPC_lStickY(chan))/80));
if(stickPointer_y[chan] > m_cursor[chan].height()/2)
stickPointer_y[chan] = stickPointer_y[chan]-speed-pSpeed;
pointerhidedelay[chan] = 150;
@ -512,7 +516,7 @@ bool CMenu::lStick_Up(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if((LEFT_STICK_ANG_UP && left_stick_mag[chan] > 0.15) || PAD_StickY(chan) > 20 || DS3_StickY() < -20)
if((LEFT_STICK_ANG_UP && left_stick_mag[chan] > 0.15) || PAD_StickY(chan) > 20 || DS3_StickY() < -20 || WUPC_lStickY(chan) > 160)
return true;
}
return false;
@ -522,7 +526,7 @@ bool CMenu::lStick_Right(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if((LEFT_STICK_ANG_RIGHT && left_stick_mag[chan] > 0.15) || PAD_StickX(chan) > 20 || DS3_StickX() > 20)
if((LEFT_STICK_ANG_RIGHT && left_stick_mag[chan] > 0.15) || PAD_StickX(chan) > 20 || DS3_StickX() > 20 || WUPC_lStickX(chan) > 160)
return true;
}
return false;
@ -532,7 +536,7 @@ bool CMenu::lStick_Down(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if((LEFT_STICK_ANG_DOWN && left_stick_mag[chan] > 0.15) || PAD_StickY(chan) < -20 || DS3_StickY() > 20)
if((LEFT_STICK_ANG_DOWN && left_stick_mag[chan] > 0.15) || PAD_StickY(chan) < -20 || DS3_StickY() > 20 || WUPC_lStickY(chan) < -160)
return true;
}
return false;
@ -542,7 +546,7 @@ bool CMenu::lStick_Left(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if((LEFT_STICK_ANG_LEFT && left_stick_mag[chan] > 0.15) || PAD_StickX(chan) < -20 || DS3_StickX() < -20)
if((LEFT_STICK_ANG_LEFT && left_stick_mag[chan] > 0.15) || PAD_StickX(chan) < -20 || DS3_StickX() < -20 || WUPC_lStickX(chan) < -160)
return true;
}
return false;
@ -552,7 +556,7 @@ bool CMenu::rStick_Up(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if((RIGHT_STICK_ANG_UP && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickY(chan) > 20)
if((RIGHT_STICK_ANG_UP && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickY(chan) > 20 || WUPC_rStickY(chan) > 160)
return true;
}
return false;
@ -562,7 +566,7 @@ bool CMenu::rStick_Right(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if((RIGHT_STICK_ANG_RIGHT && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickX(chan) > 20)
if((RIGHT_STICK_ANG_RIGHT && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickX(chan) > 20 || WUPC_rStickX(chan) > 160)
return true;
}
return false;
@ -572,7 +576,7 @@ bool CMenu::rStick_Down(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if((RIGHT_STICK_ANG_DOWN && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickY(chan) < -20)
if((RIGHT_STICK_ANG_DOWN && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickY(chan) < -20 || WUPC_rStickY(chan) < -160)
return true;
}
return false;
@ -582,7 +586,7 @@ bool CMenu::rStick_Left(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if((RIGHT_STICK_ANG_LEFT && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickX(chan) < -20)
if((RIGHT_STICK_ANG_LEFT && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickX(chan) < -20 || WUPC_rStickX(chan) < -160)
return true;
}
return false;