From ae7b8f7250b76a154b041668599d20a3c160bcf1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 7 Jan 2013 05:33:41 +0100 Subject: [PATCH] (Wiiuse) Meet license demands + some minor tweaks --- wii/wiiuse/classic.c | 3 +++ wii/wiiuse/classic.h | 3 +++ wii/wiiuse/dynamics.h | 3 +++ wii/wiiuse/events.c | 3 +++ wii/wiiuse/events.h | 3 +++ wii/wiiuse/io.c | 3 +++ wii/wiiuse/io.h | 3 +++ wii/wiiuse/io_wii.c | 3 +++ wii/wiiuse/ir.c | 3 +++ wii/wiiuse/ir.h | 3 +++ wii/wiiuse/lwp_priority.inl | 8 ++++---- wii/wiiuse/motion_plus.c | 3 +++ wii/wiiuse/motion_plus.h | 3 +++ wii/wiiuse/nunchuk.c | 3 +++ wii/wiiuse/nunchuk.h | 3 +++ wii/wiiuse/os.h | 3 +++ wii/wiiuse/speaker.c | 3 +++ wii/wiiuse/speaker.h | 3 +++ wii/wiiuse/wiiuse.c | 3 +++ wii/wiiuse/wiiuse_internal.h | 3 +++ wii/wiiuse/wpad.c | 39 ++++++++++++++++++++++++++++++++---- 21 files changed, 96 insertions(+), 8 deletions(-) diff --git a/wii/wiiuse/classic.c b/wii/wiiuse/classic.c index c37e94f0a9..e5d2383a34 100644 --- a/wii/wiiuse/classic.c +++ b/wii/wiiuse/classic.c @@ -31,6 +31,9 @@ * @brief Classic controller expansion device. */ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #include #include diff --git a/wii/wiiuse/classic.h b/wii/wiiuse/classic.h index 8ae62583f4..2e741efca5 100644 --- a/wii/wiiuse/classic.h +++ b/wii/wiiuse/classic.h @@ -31,6 +31,9 @@ * @brief Classic controller expansion device. */ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef CLASSIC_H_INCLUDED #define CLASSIC_H_INCLUDED diff --git a/wii/wiiuse/dynamics.h b/wii/wiiuse/dynamics.h index 4daec29f01..7d6f1ae642 100644 --- a/wii/wiiuse/dynamics.h +++ b/wii/wiiuse/dynamics.h @@ -35,6 +35,9 @@ * motion sensing. */ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef DYNAMICS_H_INCLUDED #define DYNAMICS_H_INCLUDED diff --git a/wii/wiiuse/events.c b/wii/wiiuse/events.c index fa60c61550..4c435af2ee 100644 --- a/wii/wiiuse/events.c +++ b/wii/wiiuse/events.c @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #ifndef WIN32 diff --git a/wii/wiiuse/events.h b/wii/wiiuse/events.h index b6f0c75542..a7de3380bd 100644 --- a/wii/wiiuse/events.h +++ b/wii/wiiuse/events.h @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef __EVENTS_H__ #define __EVENTS_H__ diff --git a/wii/wiiuse/io.c b/wii/wiiuse/io.c index 4266319ab3..05b6aeef51 100644 --- a/wii/wiiuse/io.c +++ b/wii/wiiuse/io.c @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #include diff --git a/wii/wiiuse/io.h b/wii/wiiuse/io.h index d7a5326a82..738ceea137 100644 --- a/wii/wiiuse/io.h +++ b/wii/wiiuse/io.h @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef __IO_H__ #define __IO_H__ diff --git a/wii/wiiuse/io_wii.c b/wii/wiiuse/io_wii.c index 0dc459b167..7f10c9e154 100644 --- a/wii/wiiuse/io_wii.c +++ b/wii/wiiuse/io_wii.c @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifdef GEKKO #include diff --git a/wii/wiiuse/ir.c b/wii/wiiuse/ir.c index c369778fd7..f118ea6e58 100644 --- a/wii/wiiuse/ir.c +++ b/wii/wiiuse/ir.c @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #include #include diff --git a/wii/wiiuse/ir.h b/wii/wiiuse/ir.h index f90cfc89c5..0ac683b8d1 100644 --- a/wii/wiiuse/ir.h +++ b/wii/wiiuse/ir.h @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef __IR_H__ #define __IR_H__ diff --git a/wii/wiiuse/lwp_priority.inl b/wii/wiiuse/lwp_priority.inl index 75c6438386..4e5b2bad44 100644 --- a/wii/wiiuse/lwp_priority.inl +++ b/wii/wiiuse/lwp_priority.inl @@ -1,7 +1,7 @@ #ifndef __LWP_PRIORITY_INL__ #define __LWP_PRIORITY_INL__ -static __inline__ void __lwp_priomap_init(prio_cntrl *theprio,u32 prio) +static inline void __lwp_priomap_init(prio_cntrl *theprio,u32 prio) { u32 major,minor,mask; @@ -22,20 +22,20 @@ static __inline__ void __lwp_priomap_init(prio_cntrl *theprio,u32 prio) #endif } -static __inline__ void __lwp_priomap_addto(prio_cntrl *theprio) +static inline void __lwp_priomap_addto(prio_cntrl *theprio) { *theprio->minor |= theprio->ready_minor; _prio_major_bitmap |= theprio->ready_major; } -static __inline__ void __lwp_priomap_removefrom(prio_cntrl *theprio) +static inline void __lwp_priomap_removefrom(prio_cntrl *theprio) { *theprio->minor &= theprio->block_minor; if(*theprio->minor==0) _prio_major_bitmap &= theprio->block_major; } -static __inline__ u32 __lwp_priomap_highest() +static inline u32 __lwp_priomap_highest() { u32 major,minor; major = cntlzw(_prio_major_bitmap); diff --git a/wii/wiiuse/motion_plus.c b/wii/wiiuse/motion_plus.c index 74ad17c98a..8d37d7063f 100644 --- a/wii/wiiuse/motion_plus.c +++ b/wii/wiiuse/motion_plus.c @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #include #include diff --git a/wii/wiiuse/motion_plus.h b/wii/wiiuse/motion_plus.h index 9f587cacf5..628d9c6492 100644 --- a/wii/wiiuse/motion_plus.h +++ b/wii/wiiuse/motion_plus.h @@ -3,6 +3,9 @@ * @brief Motion plus extension */ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef MOTION_PLUS_H_INCLUDED #define MOTION_PLUS_H_INCLUDED diff --git a/wii/wiiuse/nunchuk.c b/wii/wiiuse/nunchuk.c index 950c0eeb57..468db73a31 100644 --- a/wii/wiiuse/nunchuk.c +++ b/wii/wiiuse/nunchuk.c @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #include #include diff --git a/wii/wiiuse/nunchuk.h b/wii/wiiuse/nunchuk.h index 973412edda..7545aa7b6e 100644 --- a/wii/wiiuse/nunchuk.h +++ b/wii/wiiuse/nunchuk.h @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef __NUNCHUK_H__ #define __NUNCHUK_H__ diff --git a/wii/wiiuse/os.h b/wii/wiiuse/os.h index aa5bea37c5..16571047cd 100644 --- a/wii/wiiuse/os.h +++ b/wii/wiiuse/os.h @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef __OS_H__ #define __OS_H__ diff --git a/wii/wiiuse/speaker.c b/wii/wiiuse/speaker.c index 4c35197b79..43ca994275 100644 --- a/wii/wiiuse/speaker.c +++ b/wii/wiiuse/speaker.c @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #include #include diff --git a/wii/wiiuse/speaker.h b/wii/wiiuse/speaker.h index d7c61cca0b..b7b9229126 100644 --- a/wii/wiiuse/speaker.h +++ b/wii/wiiuse/speaker.h @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef __SPEAKER_H__ #define __SPEAKER_H__ diff --git a/wii/wiiuse/wiiuse.c b/wii/wiiuse/wiiuse.c index efadacdf95..53cf06bcfc 100644 --- a/wii/wiiuse/wiiuse.c +++ b/wii/wiiuse/wiiuse.c @@ -1,3 +1,6 @@ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #include #include diff --git a/wii/wiiuse/wiiuse_internal.h b/wii/wiiuse/wiiuse_internal.h index 149695259d..6350bbbf28 100644 --- a/wii/wiiuse/wiiuse_internal.h +++ b/wii/wiiuse/wiiuse_internal.h @@ -41,6 +41,9 @@ * internally, wiiuse.h is included only here. */ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #ifndef WIIUSE_INTERNAL_H_INCLUDED #define WIIUSE_INTERNAL_H_INCLUDED diff --git a/wii/wiiuse/wpad.c b/wii/wiiuse/wpad.c index 08b42b5f8d..5fd7005c3c 100644 --- a/wii/wiiuse/wpad.c +++ b/wii/wiiuse/wpad.c @@ -28,6 +28,9 @@ distribution. -------------------------------------------------------------*/ +/* This source as presented is a modified version of original wiiuse for use + * with RetroArch, and must not be confused with the original software. */ + #include #include #include @@ -78,13 +81,17 @@ struct _wpad_cb { s32 speaker_enabled; struct _wpad_thresh thresh; +#ifdef HAVE_WIIUSE_SPEAKER void *sound_data; u32 sound_len; u32 sound_off; syswd_t sound_alarm; +#endif WPADData lstate; +#ifdef HAVE_WIIUSE_QUEUE_EXT WPADData *queue_ext; +#endif WPADData queue_int[EVENTQUEUE_LENGTH]; }; @@ -495,10 +502,14 @@ static void __wpad_eventCB(struct wiimote_t *wm,s32 event) chan = wm->unid; wpdcb = &__wpdcb[chan]; +#ifdef HAVE_WIIUSE_QUEUE_EXT if(wpdcb->queue_ext!=NULL) { maxbufs = wpdcb->queue_length; wpadd = &(wpdcb->queue_ext[wpdcb->queue_tail]); - } else { + } + else +#endif + { maxbufs = EVENTQUEUE_LENGTH; wpadd = &(wpdcb->queue_int[wpdcb->queue_tail]); } @@ -546,7 +557,9 @@ static void __wpad_eventCB(struct wiimote_t *wm,s32 event) wpdcb->queue_tail = 0; wpdcb->queue_full = 0; wpdcb->queue_length = 0; +#ifdef HAVE_WIIUSE_QUEUE_EXT wpdcb->queue_ext = NULL; +#endif wpdcb->idle_time = -1; memset(&wpdcb->lstate,0,sizeof(WPADData)); memset(&wpaddata[chan],0,sizeof(WPADData)); @@ -600,12 +613,14 @@ s32 WPAD_Init() __wpdcb[i].thresh.js = WPAD_THRESH_DEFAULT_JOYSTICK; __wpdcb[i].thresh.mp = WPAD_THRESH_DEFAULT_MOTION_PLUS; +#ifdef HAVE_WIIUSE_SPEAKER if (SYS_CreateAlarm(&__wpdcb[i].sound_alarm) < 0) { WPAD_Shutdown(); _CPU_ISR_Restore(level); return WPAD_ERR_UNKNOWN; } +#endif } if(CONF_GetPadDevices(&__wpad_devs) < 0) { @@ -676,10 +691,14 @@ s32 WPAD_ReadEvent(s32 chan, WPADData *data) if(__wpads[chan] && WIIMOTE_IS_SET(__wpads[chan],WIIMOTE_STATE_CONNECTED)) { if(WIIMOTE_IS_SET(__wpads[chan],WIIMOTE_STATE_HANDSHAKE_COMPLETE)) { wpdcb = &__wpdcb[chan]; +#ifdef HAVE_WIIUSE_QUEUE_EXT if(wpdcb->queue_ext!=NULL) { maxbufs = wpdcb->queue_length; wpadd = wpdcb->queue_ext; - } else { + } + else +#endif + { maxbufs = EVENTQUEUE_LENGTH; wpadd = wpdcb->queue_int; } @@ -710,6 +729,7 @@ s32 WPAD_ReadEvent(s32 chan, WPADData *data) return 0; } +#if 0 s32 WPAD_DroppedEvents(s32 chan) { u32 level; @@ -761,6 +781,7 @@ s32 WPAD_Flush(s32 chan) if(ret == WPAD_ERR_QUEUE_EMPTY) return count; return ret; } +#endif s32 WPAD_ReadPending(s32 chan, WPADDataCallback datacb) { @@ -786,6 +807,7 @@ s32 WPAD_ReadPending(s32 chan, WPADDataCallback datacb) return ret; } +#if 0 s32 WPAD_SetDataFormat(s32 chan, s32 fmt) { u32 level; @@ -823,6 +845,7 @@ s32 WPAD_SetDataFormat(s32 chan, s32 fmt) _CPU_ISR_Restore(level); return WPAD_ERR_NONE; } +#endif s32 WPAD_SetMotionPlus(s32 chan, u8 enable) { @@ -898,7 +921,7 @@ s32 WPAD_Probe(s32 chan,u32 *type) u32 level,dev; wiimote *wm = NULL; - if(chan=WPAD_MAX_WIIMOTES) return WPAD_ERR_BAD_CHANNEL; + //if(chan=WPAD_MAX_WIIMOTES) return WPAD_ERR_BAD_CHANNEL; _CPU_ISR_Disable(level); if(__wpads_inited==WPAD_STATE_DISABLED) { @@ -928,7 +951,8 @@ s32 WPAD_Probe(s32 chan,u32 *type) return ret; } - + +#ifdef HAVE_WIIUSE_QUEUE_EXT s32 WPAD_SetEventBufs(s32 chan, WPADData *bufs, u32 cnt) { u32 level; @@ -946,6 +970,7 @@ s32 WPAD_SetEventBufs(s32 chan, WPADData *bufs, u32 cnt) _CPU_ISR_Restore(level); return WPAD_ERR_NONE; } +#endif void WPAD_SetPowerButtonCallback(WPADShutdownCallback cb) { @@ -1007,7 +1032,9 @@ void WPAD_Shutdown() SYS_RemoveAlarm(__wpad_timer); for(i=0;isound_alarm); +#endif __wpad_disconnect(wpdcb); } @@ -1066,6 +1093,7 @@ s32 WPAD_Rumble(s32 chan, int status) } #endif +#if 0 s32 WPAD_SetIdleThresholds(s32 chan, s32 btns, s32 ir, s32 accel, s32 js, s32 wb, s32 mp) { int i; @@ -1097,6 +1125,7 @@ s32 WPAD_SetIdleThresholds(s32 chan, s32 btns, s32 ir, s32 accel, s32 js, s32 wb _CPU_ISR_Restore(level); return WPAD_ERR_NONE; } +#endif #ifdef HAVE_WIIUSE_SPEAKER s32 WPAD_ControlSpeaker(s32 chan,s32 enable) @@ -1155,6 +1184,7 @@ s32 WPAD_IsSpeakerEnabled(s32 chan) } #endif +#if 0 s32 WPAD_SendStreamData(s32 chan,void *buf,u32 len) { u32 level; @@ -1187,6 +1217,7 @@ s32 WPAD_SendStreamData(s32 chan,void *buf,u32 len) _CPU_ISR_Restore(level); return WPAD_ERR_NONE; } +#endif #ifdef HAVE_WIIUSE_SPEAKER void WPAD_EncodeData(WPADEncStatus *info,u32 flag,const s16 *pcmSamples,s32 numSamples,u8 *encData)