2017-03-30 17:53:36 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2016,2017 Maschell
|
|
|
|
*
|
|
|
|
* 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 _UDPSERVER_WINDOW_H_
|
|
|
|
#define _UDPSERVER_WINDOW_H_
|
|
|
|
|
2017-10-29 09:34:47 +01:00
|
|
|
#include "../ControllerPatcherIncludes.hpp"
|
2017-03-30 17:53:36 +02:00
|
|
|
|
|
|
|
#define DEFAULT_UDP_PORT 8113
|
|
|
|
|
2017-04-10 15:39:58 +02:00
|
|
|
#define WIIU_CP_UDP_CONTROLLER_READ_DATA 0x03
|
|
|
|
|
2018-06-19 17:46:37 +02:00
|
|
|
class UDPServer {
|
2017-03-30 17:53:36 +02:00
|
|
|
friend class ControllerPatcher;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static UDPServer *getInstance() {
|
|
|
|
if(instance == NULL)
|
|
|
|
instance = new UDPServer(DEFAULT_UDP_PORT);
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void destroyInstance() {
|
2018-06-19 17:46:37 +02:00
|
|
|
if(instance != NULL) {
|
2017-03-30 17:53:36 +02:00
|
|
|
delete instance;
|
|
|
|
instance = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
UDPServer(int32_t port);
|
2017-03-30 17:53:36 +02:00
|
|
|
~UDPServer();
|
|
|
|
void StartUDPThread(UDPServer * server);
|
2017-10-29 09:34:47 +01:00
|
|
|
static void DoUDPThread(CThread *thread, void *arg);
|
2017-03-30 17:53:36 +02:00
|
|
|
void DoUDPThreadInternal();
|
2018-06-20 15:07:15 +02:00
|
|
|
BOOL cpyIncrementBufferOffset(void * target, void * source, int32_t * offset, int32_t typesize, int32_t maximum);
|
2017-03-30 17:53:36 +02:00
|
|
|
|
2018-06-20 15:07:15 +02:00
|
|
|
volatile int32_t sockfd = -1;
|
|
|
|
volatile int32_t exitThread = 0;
|
2017-03-30 17:53:36 +02:00
|
|
|
|
|
|
|
static UDPServer *instance;
|
2017-10-29 09:34:47 +01:00
|
|
|
static CThread *pThread;
|
2017-03-30 17:53:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //_UDPSERVER_WINDOW_H_
|