Skip to content

Commit

Permalink
Merge latest master changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinob committed Oct 1, 2015
1 parent a9560c8 commit 1c27fa0
Show file tree
Hide file tree
Showing 251 changed files with 1,674 additions and 1,765 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,12 @@ if(USE_UPNP)
if(NOT APPLE AND NOT ANDROID)
include(FindMiniupnpc)
endif()
if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
if(MINIUPNP_FOUND AND (MINIUPNPC_VERSION_1_7_OR_HIGHER OR MINIUPNPC_VERSION_API14_OR_HIGHER))
message("Using shared miniupnpc")
include_directories(${MINIUPNP_INCLUDE_DIR})
if (MINIUPNPC_VERSION_API14_OR_HIGHER)
add_definitions(-DUPNPDISCOVER_HAS_TTL)
endif()
else()
message("Using static miniupnpc from Externals")
add_subdirectory(Externals/miniupnpc)
Expand Down
39 changes: 34 additions & 5 deletions CMakeTests/FindMiniupnpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,30 @@ if (MINIUPNP_FOUND)

message(STATUS "Detecting version of miniupnpc in path: ${MINIUPNP_INCLUDE_DIR}")

set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
int main()
{
struct UPNPDev *devlist = NULL;
int upnp_delay = 5000;
const char *upnp_multicastif = NULL;
const char *upnp_minissdpdsock = NULL;
int upnp_sameport = 0;
int upnp_ipv6 = 0;
unsigned char upnp_ttl = 2;
int upnp_error = 0;
devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport, upnp_ipv6, upnp_ttl, &upnp_error);
return 0;
}"
MINIUPNPC_VERSION_API14_OR_HIGHER)

IF (NOT MINIUPNPC_VERSION_API14_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
Expand All @@ -66,8 +90,9 @@ if (MINIUPNP_FOUND)
return 0;
}"
MINIUPNPC_VERSION_1_7_OR_HIGHER)
ENDIF()

IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER AND NOT MINIUPNPC_VERSION_API14_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
Expand All @@ -91,7 +116,7 @@ IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
MINIUPNPC_VERSION_PRE1_7)
ENDIF()

IF (NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
IF (NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER AND NOT MINIUPNPC_VERSION_API14_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
Expand All @@ -116,7 +141,7 @@ IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)

ENDIF()

IF (NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
IF (NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER AND NOT MINIUPNPC_VERSION_API14_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
Expand All @@ -136,7 +161,7 @@ IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
MINIUPNPC_VERSION_1_5_OR_HIGHER)
ENDIF()

IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER AND NOT MINIUPNPC_VERSION_API14_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
Expand Down Expand Up @@ -167,10 +192,14 @@ IF(MINIUPNPC_VERSION_PRE1_7)
message(STATUS "Found miniupnpc version is pre v1.7")
ENDIF()

IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7)
IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_API14_OR_HIGHER)
message(STATUS "Found miniupnpc version is v1.7 or higher")
ENDIF()

IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
message(STATUS "Found miniupnpc version is v1.9 API version 14 or higher")
ENDIF()

else ()
message (STATUS "Could not find miniupnp")
endif ()
Expand Down
1 change: 0 additions & 1 deletion Data/Sys/GameSettings/GM8.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ EmulationIssues =
SafeTextureCacheColorSamples = 512

[Video_Hacks]
EFBToTextureEnable = False
2 changes: 2 additions & 0 deletions Source/Core/AudioCommon/AOSoundStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "AudioCommon/AOSoundStream.h"
#include "AudioCommon/Mixer.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h"

#if defined(HAVE_AO) && HAVE_AO

Expand Down
19 changes: 5 additions & 14 deletions Source/Core/AudioCommon/AlsaSoundStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,13 @@
#include "AudioCommon/AlsaSoundStream.h"
#include "Common/CommonTypes.h"
#include "Common/Thread.h"

#define FRAME_COUNT_MIN 256
#define BUFFER_SIZE_MAX 8192
#define BUFFER_SIZE_BYTES (BUFFER_SIZE_MAX*2*2)
#include "Common/Logging/Log.h"

AlsaSound::AlsaSound()
: m_thread_status(ALSAThreadStatus::STOPPED)
, handle(nullptr)
, frames_to_deliver(FRAME_COUNT_MIN)
{
mix_buffer = new u8[BUFFER_SIZE_BYTES];
}

AlsaSound::~AlsaSound()
{
delete [] mix_buffer;
}

bool AlsaSound::Start()
Expand Down Expand Up @@ -62,7 +53,7 @@ void AlsaSound::SoundLoop()
std::unique_lock<std::mutex> lock(cv_m);
cv.wait(lock, [this]{return !m_muted || m_thread_status.load() != ALSAThreadStatus::RUNNING;});

m_mixer->Mix(reinterpret_cast<short *>(mix_buffer), frames_to_deliver);
m_mixer->Mix(mix_buffer, frames_to_deliver);
int rc = snd_pcm_writei(handle, mix_buffer, frames_to_deliver);
if (rc == -EPIPE)
{
Expand Down Expand Up @@ -144,7 +135,7 @@ bool AlsaSound::AlsaInit()
return false;
}

err = snd_pcm_hw_params_set_channels(handle, hwparams, 2);
err = snd_pcm_hw_params_set_channels(handle, hwparams, CHANNEL_COUNT);
if (err < 0)
{
ERROR_LOG(AUDIO, "Channels count not available: %s\n", snd_strerror(err));
Expand All @@ -155,15 +146,15 @@ bool AlsaSound::AlsaInit()
err = snd_pcm_hw_params_set_periods_max(handle, hwparams, &periods, &dir);
if (err < 0)
{
ERROR_LOG(AUDIO, "Cannot set Minimum periods: %s\n", snd_strerror(err));
ERROR_LOG(AUDIO, "Cannot set maximum periods per buffer: %s\n", snd_strerror(err));
return false;
}

buffer_size_max = BUFFER_SIZE_MAX;
err = snd_pcm_hw_params_set_buffer_size_max(handle, hwparams, &buffer_size_max);
if (err < 0)
{
ERROR_LOG(AUDIO, "Cannot set minimum buffer size: %s\n", snd_strerror(err));
ERROR_LOG(AUDIO, "Cannot set maximum buffer size: %s\n", snd_strerror(err));
return false;
}

Expand Down
12 changes: 10 additions & 2 deletions Source/Core/AudioCommon/AlsaSoundStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class AlsaSound final : public SoundStream
#if defined(HAVE_ALSA) && HAVE_ALSA
public:
AlsaSound();
virtual ~AlsaSound();

bool Start() override;
void SoundLoop() override;
Expand All @@ -35,6 +34,15 @@ class AlsaSound final : public SoundStream
}

private:
// maximum number of frames the buffer can hold
static constexpr size_t BUFFER_SIZE_MAX = 8192;

// minimum number of frames to deliver in one transfer
static constexpr u32 FRAME_COUNT_MIN = 256;

// number of channels per frame
static constexpr u32 CHANNEL_COUNT = 2;

enum class ALSAThreadStatus
{
RUNNING,
Expand All @@ -45,7 +53,7 @@ class AlsaSound final : public SoundStream
bool AlsaInit();
void AlsaShutdown();

u8 *mix_buffer;
s16 mix_buffer[BUFFER_SIZE_MAX * CHANNEL_COUNT];
std::thread thread;
std::atomic<ALSAThreadStatus> m_thread_status;
std::condition_variable cv;
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/AudioCommon/AudioCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#include "AudioCommon/XAudio2Stream.h"

#include "Common/FileUtil.h"

#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"
#include "Core/Movie.h"

Expand Down
14 changes: 14 additions & 0 deletions Source/Core/AudioCommon/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ const float CMixer::MAX_FREQ_SHIFT = 200;
const float CMixer::CONTROL_FACTOR = 0.2f;
const float CMixer::CONTROL_AVG = 32;

CMixer::CMixer(u32 BackendSampleRate)
: m_dma_mixer(this, 32000)
, m_streaming_mixer(this, 48000)
, m_wiimote_speaker_mixer(this, 3000)
, m_sample_rate(BackendSampleRate)
, m_log_dtk_audio(0)
, m_log_dsp_audio(0)
, m_speed(0)
, m_l_dither_prev(0)
, m_r_dither_prev(0)
{
INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
}

void CMixer::LinearMixerFifo::Interpolate(u32 left_input_index, float* left_output, float* right_output)
{
*left_output = (1 - m_fraction) * m_float_buffer[left_input_index & INDEX_MASK]
Expand Down
14 changes: 1 addition & 13 deletions Source/Core/AudioCommon/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,7 @@ __forceinline void TriangleDither(float& sample, float& prev_dither)
class CMixer {

public:
CMixer(u32 BackendSampleRate)
: m_dma_mixer(this, 32000)
, m_streaming_mixer(this, 48000)
, m_wiimote_speaker_mixer(this, 3000)
, m_sample_rate(BackendSampleRate)
, m_log_dtk_audio(0)
, m_log_dsp_audio(0)
, m_speed(0)
, m_l_dither_prev(0)
, m_r_dither_prev(0)
{
INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
}
CMixer(u32 BackendSampleRate);

static const u32 MAX_SAMPLES = 2048;
static const u32 INDEX_MASK = MAX_SAMPLES * 2 - 1;
Expand Down
1 change: 1 addition & 0 deletions Source/Core/AudioCommon/OpenALStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "AudioCommon/DPL2Decoder.h"
#include "AudioCommon/OpenALStream.h"
#include "Core/Core.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"

#if defined HAVE_OPENAL && HAVE_OPENAL
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/AudioCommon/OpenSLESStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <SLES/OpenSLES_Android.h>

#include "AudioCommon/OpenSLESStream.h"
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"

// engine interfaces
static SLObjectItf engineObject;
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/AudioCommon/PulseAudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "AudioCommon/PulseAudioStream.h"
#include "Common/CommonTypes.h"
#include "Common/Thread.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"

namespace
Expand Down Expand Up @@ -163,7 +164,8 @@ void PulseAudio::StateCallback(pa_context* c)
void PulseAudio::UnderflowCallback(pa_stream* s)
{
m_pa_ba.tlength += BUFFER_SAMPLES * m_channels * m_bytespersample;
pa_stream_set_buffer_attr(s, &m_pa_ba, nullptr, nullptr);
pa_operation* op = pa_stream_set_buffer_attr(s, &m_pa_ba, nullptr, nullptr);
pa_operation_unref(op);

WARN_LOG(AUDIO, "pulseaudio underflow, new latency: %d bytes", m_pa_ba.tlength);
}
Expand Down
1 change: 1 addition & 0 deletions Source/Core/AudioCommon/SoundStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "AudioCommon/Mixer.h"
#include "AudioCommon/WaveFile.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/Thread.h"


Expand Down
5 changes: 3 additions & 2 deletions Source/Core/AudioCommon/WaveFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#include "AudioCommon/WaveFile.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"

enum {BUF_SIZE = 32*1024};
enum { BUF_SIZE = 32*1024 };

WaveFileWriter::WaveFileWriter():
skip_silence(false),
Expand All @@ -19,7 +20,7 @@ WaveFileWriter::WaveFileWriter():

WaveFileWriter::~WaveFileWriter()
{
delete [] conv_buffer;
delete[] conv_buffer;
Stop();
}

Expand Down
1 change: 1 addition & 0 deletions Source/Core/AudioCommon/WaveFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <string>
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/NonCopyable.h"

class WaveFileWriter : NonCopyable
{
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/AudioCommon/XAudio2Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "Core/Core.h"
#include "Core/ConfigManager.h"
#include "Common/Event.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h"

struct StreamingVoiceContext : public IXAudio2VoiceCallback
{
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/AudioCommon/XAudio2_7Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "Core/Core.h"
#include "Core/ConfigManager.h"
#include "Common/Event.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h"

struct StreamingVoiceContext2_7 : public IXAudio2VoiceCallback
{
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/AudioCommon/aldlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
*/

#include "AudioCommon/aldlist.h"
#include "Common/Common.h"
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
#ifdef _WIN32
#include "../../../Externals/OpenAL/include/al.h"
#include "../../../Externals/OpenAL/include/alc.h"
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Common/Arm64Emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <vector>

#include "Common/Arm64Emitter.h"
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"

Expand Down
1 change: 1 addition & 0 deletions Source/Core/Common/Arm64Emitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <functional>

#include "Common/ArmCommon.h"
#include "Common/Assert.h"
#include "Common/BitSet.h"
#include "Common/CodeBlock.h"
#include "Common/Common.h"
Expand Down
Loading

0 comments on commit 1c27fa0

Please sign in to comment.