Prepare for gamepads
This commit is contained in:
+14
-2
@@ -42,7 +42,17 @@ set(SUNSHINE_TARGET_FILES
|
|||||||
utility.h
|
utility.h
|
||||||
uuid.h
|
uuid.h
|
||||||
config.h config.cpp
|
config.h config.cpp
|
||||||
main.cpp crypto.cpp crypto.h nvhttp.cpp nvhttp.h stream.cpp stream.h video.cpp video.h queue.h input.cpp input.h audio.cpp audio.h platform/linux.cpp platform/common.h)
|
main.cpp
|
||||||
|
crypto.cpp crypto.h
|
||||||
|
nvhttp.cpp nvhttp.h
|
||||||
|
stream.cpp stream.h
|
||||||
|
video.cpp video.h
|
||||||
|
queue.h
|
||||||
|
input.cpp input.h
|
||||||
|
audio.cpp audio.h
|
||||||
|
platform/linux.cpp
|
||||||
|
platform/linux_evdev.cpp
|
||||||
|
platform/common.h)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
@@ -50,6 +60,7 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/moonlight-common-c/enet/include
|
${CMAKE_CURRENT_SOURCE_DIR}/moonlight-common-c/enet/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/moonlight-common-c/reedsolomon
|
${CMAKE_CURRENT_SOURCE_DIR}/moonlight-common-c/reedsolomon
|
||||||
${X11_INCLUDE_DIR}
|
${X11_INCLUDE_DIR}
|
||||||
|
/usr/include/libevdev-1.0
|
||||||
${FFMPEG_INCLUDE_DIRS}
|
${FFMPEG_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -82,7 +93,8 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
|||||||
pulse
|
pulse
|
||||||
pulse-simple
|
pulse-simple
|
||||||
|
|
||||||
opus)
|
opus
|
||||||
|
evdev)
|
||||||
|
|
||||||
add_definitions(-DSUNSHINE_ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
add_definitions(-DSUNSHINE_ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
||||||
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
|
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "platform/common.h"
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
if(argc > 1) {
|
if(argc > 1) {
|
||||||
|
|||||||
@@ -14,17 +14,30 @@ void freeDisplay(void*);
|
|||||||
void freeImage(void*);
|
void freeImage(void*);
|
||||||
void freeAudio(void*);
|
void freeAudio(void*);
|
||||||
void freeMic(void*);
|
void freeMic(void*);
|
||||||
|
void freeGamePad(void*);
|
||||||
|
|
||||||
using display_t = util::safe_ptr<void, freeDisplay>;
|
using display_t = util::safe_ptr<void, freeDisplay>;
|
||||||
using img_t = util::safe_ptr<void, freeImage>;
|
using img_t = util::safe_ptr<void, freeImage>;
|
||||||
using mic_t = util::safe_ptr<void, freeMic>;
|
using mic_t = util::safe_ptr<void, freeMic>;
|
||||||
using audio_t = util::safe_ptr<void, freeAudio>;
|
using audio_t = util::safe_ptr<void, freeAudio>;
|
||||||
|
using gamepad_t = util::safe_ptr<void, freeGamePad>;
|
||||||
|
|
||||||
|
struct gamepad_state_t {
|
||||||
|
std::uint16_t buttonFlags;
|
||||||
|
std::uint8_t lt;
|
||||||
|
std::uint8_t rt;
|
||||||
|
std::uint16_t lsX;
|
||||||
|
std::uint16_t lsY;
|
||||||
|
std::uint16_t rsX;
|
||||||
|
std::uint16_t rsY;
|
||||||
|
};
|
||||||
|
|
||||||
std::string get_local_ip();
|
std::string get_local_ip();
|
||||||
display_t display();
|
display_t display();
|
||||||
img_t snapshot(display_t &display);
|
img_t snapshot(display_t &display);
|
||||||
mic_t microphone();
|
mic_t microphone();
|
||||||
audio_t audio(mic_t &mic, std::uint32_t sample_size);
|
audio_t audio(mic_t &mic, std::uint32_t sample_size);
|
||||||
|
gamepad_t gamepad();
|
||||||
|
|
||||||
int32_t img_width(img_t &);
|
int32_t img_width(img_t &);
|
||||||
int32_t img_height(img_t &);
|
int32_t img_height(img_t &);
|
||||||
@@ -36,6 +49,7 @@ void move_mouse(display_t::element_type *display, int deltaX, int deltaY);
|
|||||||
void button_mouse(display_t::element_type *display, int button, bool release);
|
void button_mouse(display_t::element_type *display, int button, bool release);
|
||||||
void scroll(display_t::element_type *display, int distance);
|
void scroll(display_t::element_type *display, int distance);
|
||||||
void keyboard(display_t::element_type *display, uint16_t modcode, bool release);
|
void keyboard(display_t::element_type *display, uint16_t modcode, bool release);
|
||||||
|
void gamepad_event(gamepad_t &gamepad, const gamepad_state_t &gamepad_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //SUNSHINE_COMMON_H
|
#endif //SUNSHINE_COMMON_H
|
||||||
|
|||||||
Reference in New Issue
Block a user