mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge branch 'master' into fix-unittests
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
|
||||
Vendored
+1
@@ -61,6 +61,7 @@
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\Source\VSProps\Base.props" />
|
||||
<Import Project="..\..\Source\VSProps\ClDisableAllWarnings.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
|
||||
@@ -45,15 +45,15 @@
|
||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Utility</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Utility</ConfigurationType>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Common/Logging/LogManager.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
|
||||
#include "Core/Boot/Boot.h"
|
||||
#include "Core/BootManager.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
@@ -794,7 +795,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv*
|
||||
|
||||
// No use running the loop when booting fails
|
||||
s_have_wm_user_stop = false;
|
||||
if (BootManager::BootCore(s_filename.c_str(), SConfig::BOOT_DEFAULT))
|
||||
if (BootManager::BootCore(BootParameters::GenerateFromFile(s_filename)))
|
||||
{
|
||||
static constexpr int TIMEOUT = 10000;
|
||||
static constexpr int WAIT_STEP = 25;
|
||||
|
||||
@@ -155,17 +155,23 @@ static ALenum CheckALError(const char* desc)
|
||||
return err;
|
||||
}
|
||||
|
||||
static bool IsCreativeXFi()
|
||||
{
|
||||
return strstr(alGetString(AL_RENDERER), "X-Fi") != nullptr;
|
||||
}
|
||||
|
||||
void OpenALStream::SoundLoop()
|
||||
{
|
||||
Common::SetCurrentThreadName("Audio thread - openal");
|
||||
|
||||
bool surround_capable = SConfig::GetInstance().bDPL2Decoder;
|
||||
bool float32_capable = false;
|
||||
bool fixed32_capable = false;
|
||||
bool float32_capable = alIsExtensionPresent("AL_EXT_float32") != 0;
|
||||
bool surround_capable = alIsExtensionPresent("AL_EXT_MCFORMATS") || IsCreativeXFi();
|
||||
bool use_surround = SConfig::GetInstance().bDPL2Decoder && surround_capable;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
surround_capable = false;
|
||||
#endif
|
||||
// As there is no extension to check for 32-bit fixed point support
|
||||
// and we know that only a X-Fi with hardware OpenAL supports it,
|
||||
// we just check if one is being used.
|
||||
bool fixed32_capable = IsCreativeXFi();
|
||||
|
||||
u32 ulFrequency = m_mixer->GetSampleRate();
|
||||
numBuffers = SConfig::GetInstance().iLatency + 2; // OpenAL requires a minimum of two buffers
|
||||
@@ -173,15 +179,6 @@ void OpenALStream::SoundLoop()
|
||||
memset(uiBuffers, 0, numBuffers * sizeof(ALuint));
|
||||
uiSource = 0;
|
||||
|
||||
if (alIsExtensionPresent("AL_EXT_float32"))
|
||||
float32_capable = true;
|
||||
|
||||
// As there is no extension to check for 32-bit fixed point support
|
||||
// and we know that only a X-Fi with hardware OpenAL supports it,
|
||||
// we just check if one is being used.
|
||||
if (strstr(alGetString(AL_RENDERER), "X-Fi"))
|
||||
fixed32_capable = true;
|
||||
|
||||
// Clear error state before querying or else we get false positives.
|
||||
ALenum err = alGetError();
|
||||
|
||||
@@ -226,7 +223,7 @@ void OpenALStream::SoundLoop()
|
||||
|
||||
unsigned int numSamples = OAL_MAX_SAMPLES;
|
||||
|
||||
if (surround_capable)
|
||||
if (use_surround)
|
||||
{
|
||||
// DPL2 accepts 240 samples minimum (FWRDURATION)
|
||||
unsigned int minSamples = 240;
|
||||
@@ -297,7 +294,7 @@ void OpenALStream::SoundLoop()
|
||||
// 5.1 is not supported by the host, fallback to stereo
|
||||
WARN_LOG(AUDIO,
|
||||
"Unable to set 5.1 surround mode. Updating OpenAL Soft might fix this issue.");
|
||||
surround_capable = false;
|
||||
use_surround = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -42,19 +42,23 @@
|
||||
#define FRAME_SURROUND_INT32 SURROUND_CHANNELS* SIZE_INT32
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// OS X does not have the alext AL_FORMAT_STEREO_FLOAT32, AL_FORMAT_STEREO32,
|
||||
// AL_FORMAT_51CHN32 and AL_FORMAT_51CHN16 yet.
|
||||
#define AL_FORMAT_STEREO_FLOAT32 0
|
||||
#define AL_FORMAT_STEREO32 0
|
||||
#define AL_FORMAT_51CHN32 0
|
||||
#define AL_FORMAT_51CHN16 0
|
||||
#elif defined(_WIN32)
|
||||
// From AL_EXT_float32
|
||||
#ifndef AL_FORMAT_STEREO_FLOAT32
|
||||
#define AL_FORMAT_STEREO_FLOAT32 0x10011
|
||||
#endif
|
||||
|
||||
// From AL_EXT_MCFORMATS
|
||||
#ifndef AL_FORMAT_51CHN16
|
||||
#define AL_FORMAT_51CHN16 0x120B
|
||||
#endif
|
||||
#ifndef AL_FORMAT_51CHN32
|
||||
#define AL_FORMAT_51CHN32 0x120C
|
||||
#endif
|
||||
|
||||
// Only X-Fi on Windows supports the alext AL_FORMAT_STEREO32 alext for now,
|
||||
// but it is not documented or in "OpenAL/include/al.h".
|
||||
#ifndef AL_FORMAT_STEREO32
|
||||
#define AL_FORMAT_STEREO32 0x1203
|
||||
#else
|
||||
#define AL_FORMAT_STEREO32 0
|
||||
#endif
|
||||
|
||||
class OpenALStream final : public SoundStream
|
||||
|
||||
@@ -25,8 +25,7 @@ private:
|
||||
|
||||
public:
|
||||
StreamingVoiceContext(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
|
||||
|
||||
~StreamingVoiceContext();
|
||||
virtual ~StreamingVoiceContext();
|
||||
|
||||
void Stop();
|
||||
void Play();
|
||||
|
||||
@@ -25,8 +25,7 @@ private:
|
||||
|
||||
public:
|
||||
StreamingVoiceContext2_7(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
|
||||
|
||||
~StreamingVoiceContext2_7();
|
||||
virtual ~StreamingVoiceContext2_7();
|
||||
|
||||
void Stop();
|
||||
void Play();
|
||||
|
||||
@@ -27,6 +27,7 @@ class Section
|
||||
|
||||
public:
|
||||
Section(LayerType layer, System system, const std::string& name);
|
||||
virtual ~Section() = default;
|
||||
|
||||
virtual bool Exists(const std::string& key) const;
|
||||
bool Delete(const std::string& key);
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
#include "Common/Crypto/bn.h"
|
||||
#include "Common/Crypto/ec.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4505)
|
||||
#endif
|
||||
|
||||
// y**2 + x*y = x**3 + x + b
|
||||
UNUSED static const u8 ec_b[30] = {0x00, 0x66, 0x64, 0x7e, 0xde, 0x6c, 0x33, 0x2c, 0x7f, 0x8c,
|
||||
0x09, 0x23, 0xbb, 0x58, 0x21, 0x3b, 0x33, 0x3b, 0x20, 0xe9,
|
||||
@@ -404,3 +409,7 @@ void ec_priv_to_pub(const u8* k, u8* Q)
|
||||
{
|
||||
point_mul(Q, k, ec_G);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
@@ -631,9 +631,9 @@ void CopyDir(const std::string& source_path, const std::string& dest_path)
|
||||
// Returns the current directory
|
||||
std::string GetCurrentDir()
|
||||
{
|
||||
char* dir;
|
||||
// Get the current working directory (getcwd uses malloc)
|
||||
if (!(dir = __getcwd(nullptr, 0)))
|
||||
char* dir = __getcwd(nullptr, 0);
|
||||
if (!dir)
|
||||
{
|
||||
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", GetLastErrorMsg().c_str());
|
||||
return nullptr;
|
||||
@@ -986,7 +986,7 @@ u64 IOFile::Tell() const
|
||||
if (IsOpen())
|
||||
return ftello(m_file);
|
||||
else
|
||||
return -1;
|
||||
return UINT64_MAX;
|
||||
}
|
||||
|
||||
bool IOFile::Flush()
|
||||
|
||||
@@ -248,8 +248,8 @@ bool cInterfaceWGL::Create(void* window_handle, bool core)
|
||||
return false;
|
||||
}
|
||||
|
||||
int pixel_format;
|
||||
if (!(pixel_format = ChoosePixelFormat(m_dc, &pfd)))
|
||||
int pixel_format = ChoosePixelFormat(m_dc, &pfd);
|
||||
if (!pixel_format)
|
||||
{
|
||||
PanicAlert("(2) Can't find a suitable PixelFormat.");
|
||||
return false;
|
||||
@@ -261,7 +261,8 @@ bool cInterfaceWGL::Create(void* window_handle, bool core)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(m_rc = wglCreateContext(m_dc)))
|
||||
m_rc = wglCreateContext(m_dc);
|
||||
if (!m_rc)
|
||||
{
|
||||
PanicAlert("(4) Can't create an OpenGL rendering context.");
|
||||
return false;
|
||||
|
||||
@@ -198,7 +198,7 @@ inline int IntLog2(u64 val)
|
||||
return 63 - __builtin_clzll(val);
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
unsigned long result = -1;
|
||||
unsigned long result = ULONG_MAX;
|
||||
_BitScanReverse64(&result, val);
|
||||
return result;
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ std::string Profiler::s_lazy_result = "";
|
||||
int Profiler::s_lazy_delay = 0;
|
||||
|
||||
Profiler::Profiler(const std::string& name)
|
||||
: m_name(name), m_usecs(0), m_usecs_min(-1), m_usecs_max(0), m_usecs_quad(0), m_calls(0),
|
||||
m_depth(0)
|
||||
: m_name(name), m_usecs(0), m_usecs_min(UINT64_MAX), m_usecs_max(0), m_usecs_quad(0),
|
||||
m_calls(0), m_depth(0)
|
||||
{
|
||||
m_time = Common::Timer::GetTimeUs();
|
||||
s_max_length = std::max<u32>(s_max_length, u32(m_name.length()));
|
||||
@@ -154,7 +154,7 @@ std::string Profiler::Read()
|
||||
buffer << std::setw(PROFILER_FIELD_LENGTH) << std::right << m_usecs_max;
|
||||
|
||||
m_usecs = 0;
|
||||
m_usecs_min = -1;
|
||||
m_usecs_min = UINT64_MAX;
|
||||
m_usecs_max = 0;
|
||||
m_usecs_quad = 0;
|
||||
m_calls = 0;
|
||||
|
||||
@@ -49,6 +49,11 @@
|
||||
#include <unistd.h> // for unlink()
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4310)
|
||||
#endif
|
||||
|
||||
/* Believe me, you *don't* want to change these constants !! */
|
||||
#define BYTES_PER_SECTOR 512
|
||||
#define RESERVED_SECTORS 32
|
||||
@@ -289,3 +294,7 @@ FailWrite:
|
||||
ERROR_LOG(COMMON, "unlink(%s) failed: %s", filename.c_str(), GetLastErrorMsg().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
@@ -62,11 +62,8 @@ void SwitchCurrentThread()
|
||||
}
|
||||
|
||||
// Sets the debugger-visible name of the current thread.
|
||||
// Uses undocumented (actually, it is now documented) trick.
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp
|
||||
|
||||
// This is implemented much nicer in upcoming msvc++, see:
|
||||
// http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx
|
||||
// Uses trick documented in:
|
||||
// https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
|
||||
void SetCurrentThreadName(const char* szThreadName)
|
||||
{
|
||||
static const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||
@@ -83,7 +80,7 @@ void SetCurrentThreadName(const char* szThreadName)
|
||||
|
||||
info.dwType = 0x1000;
|
||||
info.szName = szThreadName;
|
||||
info.dwThreadID = -1; // dwThreadID;
|
||||
info.dwThreadID = static_cast<DWORD>(-1);
|
||||
info.dwFlags = 0;
|
||||
|
||||
__try
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
@@ -469,7 +471,8 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>* ops)
|
||||
std::transform(s.begin(), s.end(), s.begin(), toupper);
|
||||
}
|
||||
|
||||
if ((ret = alphatobin(uCodes, vCodes, (int)vCodes.size())))
|
||||
ret = alphatobin(uCodes, vCodes, (int)vCodes.size());
|
||||
if (ret)
|
||||
{
|
||||
// Return value is index + 1, 0 being the success flag value.
|
||||
PanicAlertT("Action Replay Code Decryption Error:\nParity Check Failed\n\nCulprit Code:\n%s",
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cstdarg>
|
||||
#include <iterator>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
+219
-209
File diff suppressed because it is too large
Load Diff
@@ -5,15 +5,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class Volume;
|
||||
struct Partition;
|
||||
}
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
|
||||
struct RegionSetting
|
||||
{
|
||||
@@ -23,11 +23,54 @@ struct RegionSetting
|
||||
const std::string code;
|
||||
};
|
||||
|
||||
class BootExecutableReader;
|
||||
|
||||
struct BootParameters
|
||||
{
|
||||
struct Disc
|
||||
{
|
||||
std::string path;
|
||||
std::unique_ptr<DiscIO::Volume> volume;
|
||||
};
|
||||
|
||||
struct Executable
|
||||
{
|
||||
std::string path;
|
||||
std::unique_ptr<BootExecutableReader> reader;
|
||||
};
|
||||
|
||||
struct NAND
|
||||
{
|
||||
std::string content_path;
|
||||
};
|
||||
|
||||
struct IPL
|
||||
{
|
||||
explicit IPL(DiscIO::Region region_);
|
||||
IPL(DiscIO::Region region_, Disc&& disc_);
|
||||
std::string path;
|
||||
DiscIO::Region region;
|
||||
// It is possible to boot the IPL with a disc inserted (with "skip IPL" disabled).
|
||||
std::optional<Disc> disc;
|
||||
};
|
||||
|
||||
struct DFF
|
||||
{
|
||||
std::string dff_path;
|
||||
};
|
||||
|
||||
static std::unique_ptr<BootParameters> GenerateFromFile(const std::string& path);
|
||||
|
||||
using Parameters = std::variant<Disc, Executable, NAND, IPL, DFF>;
|
||||
BootParameters(Parameters&& parameters_);
|
||||
|
||||
Parameters parameters;
|
||||
};
|
||||
|
||||
class CBoot
|
||||
{
|
||||
public:
|
||||
static bool BootUp();
|
||||
static bool IsElfWii(const std::string& filename);
|
||||
static bool BootUp(std::unique_ptr<BootParameters> boot);
|
||||
|
||||
// Tries to find a map file for the current game by looking first in the
|
||||
// local user directory, then in the shared user directory.
|
||||
@@ -38,11 +81,8 @@ public:
|
||||
// If writable_map_file is not nullptr, it is set to the path to where a map
|
||||
// file should be saved.
|
||||
//
|
||||
// If title_id is not nullptr, it is set to the title id
|
||||
//
|
||||
// Returns true if a map file exists, false if none could be found.
|
||||
static bool FindMapFile(std::string* existing_map_file, std::string* writable_map_file,
|
||||
std::string* title_id = nullptr);
|
||||
static bool FindMapFile(std::string* existing_map_file, std::string* writable_map_file);
|
||||
static bool LoadMapFromFilename();
|
||||
|
||||
private:
|
||||
@@ -52,7 +92,6 @@ private:
|
||||
|
||||
static void UpdateDebugger_MapLoaded();
|
||||
|
||||
static bool Boot_ELF(const std::string& filename);
|
||||
static bool Boot_WiiWAD(const std::string& filename);
|
||||
|
||||
static void SetupMSR();
|
||||
@@ -66,3 +105,20 @@ private:
|
||||
|
||||
static bool SetupWiiMemory(const DiscIO::Volume* volume, u64 ios_title_id);
|
||||
};
|
||||
|
||||
class BootExecutableReader
|
||||
{
|
||||
public:
|
||||
explicit BootExecutableReader(const std::string& file_name);
|
||||
explicit BootExecutableReader(const std::vector<u8>& buffer);
|
||||
virtual ~BootExecutableReader();
|
||||
|
||||
virtual u32 GetEntryPoint() const = 0;
|
||||
virtual bool IsValid() const = 0;
|
||||
virtual bool IsWii() const = 0;
|
||||
virtual bool LoadIntoMemory(bool only_in_mem1 = false) const = 0;
|
||||
virtual bool LoadSymbols() const = 0;
|
||||
|
||||
protected:
|
||||
std::vector<u8> m_bytes;
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user