mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
Android stuff 2
This commit is contained in:
parent
798c194025
commit
5084fb82b8
4 changed files with 43 additions and 14 deletions
19
3rdparty/CMakeLists.txt
vendored
19
3rdparty/CMakeLists.txt
vendored
|
@ -79,17 +79,16 @@ else()
|
||||||
# we don't have the system libusb, so we compile from submodule
|
# we don't have the system libusb, so we compile from submodule
|
||||||
unset(LIBUSB_LIBRARIES CACHE)
|
unset(LIBUSB_LIBRARIES CACHE)
|
||||||
add_subdirectory(libusb EXCLUDE_FROM_ALL)
|
add_subdirectory(libusb EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
if (NOT TARGET usb-1.0 AND TARGET usb-1.0-static)
|
||||||
|
add_library(usb-1.0 ALIAS usb-1.0-static)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# hidapi
|
# hidapi
|
||||||
if (NOT ANDROID)
|
add_subdirectory(hidapi)
|
||||||
add_subdirectory(hidapi)
|
|
||||||
else()
|
|
||||||
add_library(3rdparty_hidapi INTERFACE)
|
|
||||||
target_compile_definitions(3rdparty_hidapi INTERFACE WITHOUT_HIDAPI=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# glslang
|
# glslang
|
||||||
add_subdirectory(glslang EXCLUDE_FROM_ALL)
|
add_subdirectory(glslang EXCLUDE_FROM_ALL)
|
||||||
|
@ -278,13 +277,17 @@ if(NOT ANDROID)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(3rdparty_ffmpeg INTERFACE "Bcrypt.lib")
|
target_link_libraries(3rdparty_ffmpeg INTERFACE "Bcrypt.lib")
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
find_library(FFMPEG_LIB_AVFORMAT avformat PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
find_library(FFMPEG_LIB_AVFORMAT avformat PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||||
find_library(FFMPEG_LIB_AVCODEC avcodec PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
find_library(FFMPEG_LIB_AVCODEC avcodec PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||||
find_library(FFMPEG_LIB_AVUTIL avutil PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
find_library(FFMPEG_LIB_AVUTIL avutil PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||||
find_library(FFMPEG_LIB_SWSCALE swscale PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
find_library(FFMPEG_LIB_SWSCALE swscale PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||||
find_library(FFMPEG_LIB_SWRESAMPLE swresample PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
find_library(FFMPEG_LIB_SWRESAMPLE swresample PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
if (FFMPEG_LIB_AVFORMAT MATCHES "FFMPEG_LIB_AVFORMAT-NOTFOUND")
|
||||||
|
message(FATAL_ERROR "@#$%! FFMPEG NOT FOUND! ${FFMPEG_LIB_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(3rdparty_ffmpeg
|
target_link_libraries(3rdparty_ffmpeg
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${FFMPEG_LIB_AVFORMAT}
|
${FFMPEG_LIB_AVFORMAT}
|
||||||
|
@ -293,11 +296,11 @@ if(NOT ANDROID)
|
||||||
${FFMPEG_LIB_SWSCALE}
|
${FFMPEG_LIB_SWSCALE}
|
||||||
${FFMPEG_LIB_SWRESAMPLE}
|
${FFMPEG_LIB_SWRESAMPLE}
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
target_include_directories(3rdparty_ffmpeg INTERFACE "ffmpeg/include")
|
target_include_directories(3rdparty_ffmpeg INTERFACE "ffmpeg/include")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# GLEW
|
# GLEW
|
||||||
add_library(3rdparty_glew INTERFACE)
|
add_library(3rdparty_glew INTERFACE)
|
||||||
if(NOT MSVC AND NOT ANDROID)
|
if(NOT MSVC AND NOT ANDROID)
|
||||||
|
|
2
3rdparty/hidapi/CMakeLists.txt
vendored
2
3rdparty/hidapi/CMakeLists.txt
vendored
|
@ -15,6 +15,8 @@ elseif(CMAKE_SYSTEM MATCHES "Linux")
|
||||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hidraw udev)
|
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hidraw udev)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi::hidapi hidapi::include Shlwapi.lib)
|
target_link_libraries(3rdparty_hidapi INTERFACE hidapi::hidapi hidapi::include Shlwapi.lib)
|
||||||
|
elseif(ANDROID)
|
||||||
|
target_link_libraries(3rdparty_hidapi INTERFACE hidapi::libusb)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb)
|
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#ifndef WITHOUT_OPENAL
|
||||||
#include "3rdparty/OpenAL/openal-soft/include/AL/alext.h"
|
#include "3rdparty/OpenAL/openal-soft/include/AL/alext.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_CHANNEL(cellMic);
|
LOG_CHANNEL(cellMic);
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void fmt_class_string<CellMicInError>::format(std::string& out, u64 arg)
|
void fmt_class_string<CellMicInError>::format(std::string& out, u64 arg)
|
||||||
{
|
{
|
||||||
format_enum(out, arg, [](auto error)
|
format_enum(out, arg, [](auto error)
|
||||||
|
@ -43,7 +45,7 @@ void fmt_class_string<CellMicInError>::format(std::string& out, u64 arg)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void fmt_class_string<CellMicInErrorDsp>::format(std::string& out, u64 arg)
|
void fmt_class_string<CellMicInErrorDsp>::format(std::string& out, u64 arg)
|
||||||
{
|
{
|
||||||
format_enum(out, arg, [](auto error)
|
format_enum(out, arg, [](auto error)
|
||||||
|
@ -240,7 +242,6 @@ bool mic_context::check_device(u32 dev_num)
|
||||||
return device.is_registered();
|
return device.is_registered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
|
|
||||||
template <u32 bytesize>
|
template <u32 bytesize>
|
||||||
|
@ -304,6 +305,7 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
||||||
raw_samplingrate = raw_r;
|
raw_samplingrate = raw_r;
|
||||||
num_channels = channels;
|
num_channels = channels;
|
||||||
|
|
||||||
|
#ifndef WITHOUT_OPENAL
|
||||||
// Adjust number of channels depending on microphone type
|
// Adjust number of channels depending on microphone type
|
||||||
switch (device_type)
|
switch (device_type)
|
||||||
{
|
{
|
||||||
|
@ -482,10 +484,14 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
||||||
|
|
||||||
mic_opened = true;
|
mic_opened = true;
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
#else
|
||||||
|
return CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code microphone_device::close_microphone()
|
error_code microphone_device::close_microphone()
|
||||||
{
|
{
|
||||||
|
#ifndef WITHOUT_OPENAL
|
||||||
if (mic_started)
|
if (mic_started)
|
||||||
{
|
{
|
||||||
stop_microphone();
|
stop_microphone();
|
||||||
|
@ -504,12 +510,14 @@ error_code microphone_device::close_microphone()
|
||||||
|
|
||||||
temp_buf.clear();
|
temp_buf.clear();
|
||||||
mic_opened = false;
|
mic_opened = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code microphone_device::start_microphone()
|
error_code microphone_device::start_microphone()
|
||||||
{
|
{
|
||||||
|
#ifndef WITHOUT_OPENAL
|
||||||
for (const mic_device& micdevice : devices)
|
for (const mic_device& micdevice : devices)
|
||||||
{
|
{
|
||||||
alcCaptureStart(micdevice.device);
|
alcCaptureStart(micdevice.device);
|
||||||
|
@ -520,14 +528,15 @@ error_code microphone_device::start_microphone()
|
||||||
return CELL_MICIN_ERROR_FATAL;
|
return CELL_MICIN_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mic_started = true;
|
mic_started = true;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code microphone_device::stop_microphone()
|
error_code microphone_device::stop_microphone()
|
||||||
{
|
{
|
||||||
|
#ifndef WITHOUT_OPENAL
|
||||||
for (const mic_device& micdevice : devices)
|
for (const mic_device& micdevice : devices)
|
||||||
{
|
{
|
||||||
alcCaptureStop(micdevice.device);
|
alcCaptureStop(micdevice.device);
|
||||||
|
@ -536,9 +545,9 @@ error_code microphone_device::stop_microphone()
|
||||||
cellMic.error("Error stopping capture of device %s (error=0x%x)", micdevice.name, err);
|
cellMic.error("Error stopping capture of device %s (error=0x%x)", micdevice.name, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mic_started = false;
|
mic_started = false;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,6 +609,7 @@ f32 microphone_device::calculate_energy_level()
|
||||||
|
|
||||||
u32 microphone_device::capture_audio()
|
u32 microphone_device::capture_audio()
|
||||||
{
|
{
|
||||||
|
#ifndef WITHOUT_OPENAL
|
||||||
ensure(sample_size > 0);
|
ensure(sample_size > 0);
|
||||||
|
|
||||||
u32 num_samples = inbuf_size / sample_size;
|
u32 num_samples = inbuf_size / sample_size;
|
||||||
|
@ -634,6 +644,9 @@ u32 microphone_device::capture_audio()
|
||||||
}
|
}
|
||||||
|
|
||||||
return num_samples;
|
return num_samples;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private functions
|
// Private functions
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
#ifdef HAVE_SDL3
|
#ifdef HAVE_SDL3
|
||||||
#include "sdl_pad_handler.h"
|
#include "sdl_pad_handler.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ANDROID
|
||||||
#include "keyboard_pad_handler.h"
|
#include "keyboard_pad_handler.h"
|
||||||
|
#endif
|
||||||
#include "Emu/Io/Null/NullPadHandler.h"
|
#include "Emu/Io/Null/NullPadHandler.h"
|
||||||
#include "Emu/Io/interception.h"
|
#include "Emu/Io/interception.h"
|
||||||
#include "Emu/Io/PadHandler.h"
|
#include "Emu/Io/PadHandler.h"
|
||||||
|
@ -149,7 +151,9 @@ void pad_thread::Init()
|
||||||
|
|
||||||
input_log.trace("Using pad config:\n%s", g_cfg_input);
|
input_log.trace("Using pad config:\n%s", g_cfg_input);
|
||||||
|
|
||||||
|
#ifndef ANDROID
|
||||||
std::shared_ptr<keyboard_pad_handler> keyptr;
|
std::shared_ptr<keyboard_pad_handler> keyptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Always have a Null Pad Handler
|
// Always have a Null Pad Handler
|
||||||
std::shared_ptr<NullPadHandler> nullpad = std::make_shared<NullPadHandler>();
|
std::shared_ptr<NullPadHandler> nullpad = std::make_shared<NullPadHandler>();
|
||||||
|
@ -170,16 +174,19 @@ void pad_thread::Init()
|
||||||
{
|
{
|
||||||
if (handler_type == pad_handler::keyboard)
|
if (handler_type == pad_handler::keyboard)
|
||||||
{
|
{
|
||||||
|
#ifndef ANDROID
|
||||||
keyptr = std::make_shared<keyboard_pad_handler>();
|
keyptr = std::make_shared<keyboard_pad_handler>();
|
||||||
keyptr->moveToThread(static_cast<QThread*>(m_curthread));
|
keyptr->moveToThread(static_cast<QThread*>(m_curthread));
|
||||||
keyptr->SetTargetWindow(static_cast<QWindow*>(m_curwindow));
|
keyptr->SetTargetWindow(static_cast<QWindow*>(m_curwindow));
|
||||||
cur_pad_handler = keyptr;
|
cur_pad_handler = keyptr;
|
||||||
|
#else
|
||||||
|
cur_pad_handler = nullpad;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cur_pad_handler = GetHandler(handler_type);
|
cur_pad_handler = GetHandler(handler_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_handlers.emplace(handler_type, cur_pad_handler);
|
m_handlers.emplace(handler_type, cur_pad_handler);
|
||||||
}
|
}
|
||||||
cur_pad_handler->Init();
|
cur_pad_handler->Init();
|
||||||
|
@ -651,7 +658,11 @@ std::shared_ptr<PadHandlerBase> pad_thread::GetHandler(pad_handler type)
|
||||||
case pad_handler::null:
|
case pad_handler::null:
|
||||||
return std::make_shared<NullPadHandler>();
|
return std::make_shared<NullPadHandler>();
|
||||||
case pad_handler::keyboard:
|
case pad_handler::keyboard:
|
||||||
|
#ifdef ANDROID
|
||||||
|
return std::make_shared<NullPadHandler>();
|
||||||
|
#else
|
||||||
return std::make_shared<keyboard_pad_handler>();
|
return std::make_shared<keyboard_pad_handler>();
|
||||||
|
#endif
|
||||||
case pad_handler::ds3:
|
case pad_handler::ds3:
|
||||||
return std::make_shared<ds3_pad_handler>();
|
return std::make_shared<ds3_pad_handler>();
|
||||||
case pad_handler::ds4:
|
case pad_handler::ds4:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue