Clean up more space/tab mismatches in AudioCommon, Common, and VideoCommon.

Not planning to touch Core since it's the most actively changed part of the project.
This commit is contained in:
lioncash
2013-03-19 21:51:12 -04:00
parent 0e3d8e2e9f
commit edd9d0e0ef
91 changed files with 2151 additions and 2169 deletions
@@ -34,7 +34,7 @@ void AOSound::SoundLoop()
format.channels = 2;
format.rate = m_mixer->GetSampleRate();
format.byte_format = AO_FMT_LITTLE;
device = ao_open_live(default_driver, &format, NULL /* no options */);
if (!device)
{
@@ -49,7 +49,7 @@ void AOSound::SoundLoop()
while (!threadData)
{
m_mixer->Mix(realtimeBuffer, numBytesToRender >> 2);
{
std::lock_guard<std::mutex> lk(soundCriticalSection);
ao_play(device, (char*)realtimeBuffer, numBytesToRender);
@@ -62,7 +62,7 @@ void AOSound::SoundLoop()
bool AOSound::Start()
{
memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
thread = std::thread(std::mem_fun(&AOSound::SoundLoop), this);
return true;
}
+6 -6
View File
@@ -45,21 +45,21 @@ public:
AOSound(CMixer *mixer) : SoundStream(mixer) {}
virtual ~AOSound();
virtual bool Start();
virtual void SoundLoop();
virtual void Stop();
static bool isValid() {
return true;
}
virtual bool usesMixer() const {
return true;
}
virtual void Update();
#else
+16 -16
View File
@@ -88,7 +88,7 @@ bool AlsaSound::AlsaInit()
snd_pcm_hw_params_t *hwparams;
snd_pcm_uframes_t buffer_size,buffer_size_max;
unsigned int periods;
err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
if (err < 0)
{
@@ -97,7 +97,7 @@ bool AlsaSound::AlsaInit()
}
snd_pcm_hw_params_alloca(&hwparams);
err = snd_pcm_hw_params_any(handle, hwparams);
if (err < 0)
{
@@ -111,8 +111,8 @@ bool AlsaSound::AlsaInit()
ERROR_LOG(AUDIO, "Access type not available: %s\n", snd_strerror(err));
return false;
}
err = snd_pcm_hw_params_set_format(handle, hwparams, SND_PCM_FORMAT_S16_LE);
err = snd_pcm_hw_params_set_format(handle, hwparams, SND_PCM_FORMAT_S16_LE);
if (err < 0)
{
ERROR_LOG(AUDIO, "Sample format not available: %s\n", snd_strerror(err));
@@ -126,14 +126,14 @@ bool AlsaSound::AlsaInit()
ERROR_LOG(AUDIO, "Rate not available: %s\n", snd_strerror(err));
return false;
}
err = snd_pcm_hw_params_set_channels(handle, hwparams, 2);
err = snd_pcm_hw_params_set_channels(handle, hwparams, 2);
if (err < 0)
{
ERROR_LOG(AUDIO, "Channels count not available: %s\n", snd_strerror(err));
return false;
}
periods = BUFFER_SIZE_MAX / FRAME_COUNT_MIN;
err = snd_pcm_hw_params_set_periods_max(handle, hwparams, &periods, &dir);
if (err < 0)
@@ -153,10 +153,10 @@ bool AlsaSound::AlsaInit()
err = snd_pcm_hw_params(handle, hwparams);
if (err < 0)
{
ERROR_LOG(AUDIO, "Unable to install hw params: %s\n", snd_strerror(err));
ERROR_LOG(AUDIO, "Unable to install hw params: %s\n", snd_strerror(err));
return false;
}
err = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size);
if (err < 0)
{
@@ -176,10 +176,10 @@ bool AlsaSound::AlsaInit()
frames_to_deliver = buffer_size / periods;
//limit the minimum size. pulseaudio advertises a minimum of 32 samples.
if (frames_to_deliver < FRAME_COUNT_MIN)
frames_to_deliver = FRAME_COUNT_MIN;
frames_to_deliver = FRAME_COUNT_MIN;
//it is probably a bad idea to try to send more than one buffer of data
if ((unsigned int)frames_to_deliver > buffer_size)
frames_to_deliver = buffer_size;
frames_to_deliver = buffer_size;
NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver);
snd_pcm_sw_params_alloca(&swparams);
@@ -187,21 +187,21 @@ bool AlsaSound::AlsaInit()
err = snd_pcm_sw_params_current(handle, swparams);
if (err < 0)
{
ERROR_LOG(AUDIO, "cannot init sw params: %s\n", snd_strerror(err));
ERROR_LOG(AUDIO, "cannot init sw params: %s\n", snd_strerror(err));
return false;
}
err = snd_pcm_sw_params_set_start_threshold(handle, swparams, 0U);
if (err < 0)
{
ERROR_LOG(AUDIO, "cannot set start thresh: %s\n", snd_strerror(err));
ERROR_LOG(AUDIO, "cannot set start thresh: %s\n", snd_strerror(err));
return false;
}
err = snd_pcm_sw_params(handle, swparams);
if (err < 0)
{
ERROR_LOG(AUDIO, "cannot set sw params: %s\n", snd_strerror(err));
ERROR_LOG(AUDIO, "cannot set sw params: %s\n", snd_strerror(err));
return false;
}
@@ -30,19 +30,19 @@ class CoreAudioSound : public SoundStream
public:
CoreAudioSound(CMixer *mixer);
virtual ~CoreAudioSound();
virtual bool Start();
virtual void SetVolume(int volume);
virtual void SoundLoop();
virtual void Stop();
static bool isValid() {
return true;
}
virtual bool usesMixer() const {
return true;
}
virtual void Update();
private:
+26 -26
View File
@@ -130,15 +130,15 @@ returns 0 if OK, -1 if fail
*/
float* design_fir(unsigned int *n, float* fc, float opt)
{
unsigned int o = *n & 1; // Indicator for odd filter length
unsigned int end = ((*n + 1) >> 1) - o; // Loop end
unsigned int i; // Loop index
unsigned int o = *n & 1; // Indicator for odd filter length
unsigned int end = ((*n + 1) >> 1) - o; // Loop end
unsigned int i; // Loop index
float k1 = 2 * float(M_PI); // 2*pi*fc1
float k2 = 0.5f * (float)(1 - o);// Constant used if the filter has even length
float g = 0.0f; // Gain
float t1; // Temporary variables
float fc1; // Cutoff frequencies
float k1 = 2 * float(M_PI); // 2*pi*fc1
float k2 = 0.5f * (float)(1 - o); // Constant used if the filter has even length
float g = 0.0f; // Gain
float t1; // Temporary variables
float fc1; // Cutoff frequencies
// Sanity check
if(*n==0) return NULL;
@@ -241,18 +241,18 @@ void matrix_decode(const float *in, const int k, const int il,
float *_rr, float *_cf)
{
static const float M9_03DB = 0.3535533906f;
static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */
static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */
static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */
static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */
static const float MATCOMPGAIN = 0.37f; /* Cross talk compensation gain, 0.50 - 0.55 is full cancellation. */
const int kr = (k + olddelay) % _dlbuflen;
float l_gain = (_l_fwr + _r_fwr) / (1 + _l_fwr + _l_fwr);
float r_gain = (_l_fwr + _r_fwr) / (1 + _r_fwr + _r_fwr);
/* The 2nd axis has strong gain fluctuations, and therefore require
limits. The factor corresponds to the 1 / amplification of (Lt
- Rt) when (Lt, Rt) is strongly correlated. (e.g. during
dialogues). It should be bigger than -12 dB to prevent
distortion. */
// The 2nd axis has strong gain fluctuations, and therefore require
// limits. The factor corresponds to the 1 / amplification of (Lt
// - Rt) when (Lt, Rt) is strongly correlated. (e.g. during
// dialogues). It should be bigger than -12 dB to prevent
// distortion.
float lmr_lim_fwr = _lmr_fwr > M9_03DB * _lpr_fwr ? _lmr_fwr : M9_03DB * _lpr_fwr;
float lpr_gain = (_lpr_fwr + lmr_lim_fwr) / (1 + _lpr_fwr + _lpr_fwr);
float lmr_gain = (_lpr_fwr + lmr_lim_fwr) / (1 + lmr_lim_fwr + lmr_lim_fwr);
@@ -275,9 +275,9 @@ void matrix_decode(const float *in, const int k, const int il,
if (decode_rear)
{
_lr[kr] = _rr[kr] = (l_agc - r_agc) * (float)M_SQRT1_2;
/* Stereo rear channel is steered with the same AGC steering as
the decoding matrix. Note this requires a fast updating AGC
at the order of 20 ms (which is the case here). */
// Stereo rear channel is steered with the same AGC steering as
// the decoding matrix. Note this requires a fast updating AGC
// at the order of 20 ms (which is the case here).
_lr[kr] *= (_l_fwr + _l_fwr) / (1 + _l_fwr + _r_fwr);
_rr[kr] *= (_r_fwr + _r_fwr) / (1 + _l_fwr + _r_fwr);
}
@@ -298,16 +298,16 @@ void matrix_decode(const float *in, const int k, const int il,
_rf[k] = (lpr_agc - lmr_agc) * (float)M_SQRT1_2;
/*** CENTER FRONT CANCELLATION ***/
/* A heuristic approach exploits that Lt + Rt gain contains the
information about Lt, Rt correlation. This effectively reshapes
the front and rear "cones" to concentrate Lt + Rt to C and
introduce Lt - Rt in L, R. */
// A heuristic approach exploits that Lt + Rt gain contains the
// information about Lt, Rt correlation. This effectively reshapes
// the front and rear "cones" to concentrate Lt + Rt to C and
// introduce Lt - Rt in L, R.
/* 0.67677 is the empirical lower bound for lpr_gain. */
c_gain = 8 * (*_adapt_lpr_gain - 0.67677f);
c_gain = c_gain > 0 ? c_gain : 0;
/* c_gain should not be too high, not even reaching full
cancellation (~ 0.50 - 0.55 at current AGC implementation), or
the center will sound too narrow. */
// c_gain should not be too high, not even reaching full
// cancellation (~ 0.50 - 0.55 at current AGC implementation), or
// the center will sound too narrow. */
c_gain = MATCOMPGAIN / (1 + c_gain * c_gain);
c_agc_cfk = c_gain * _cf[k];
_lf[k] -= c_agc_cfk;
@@ -317,7 +317,7 @@ void matrix_decode(const float *in, const int k, const int il,
void dpl2decode(float *samples, int numsamples, float *out)
{
static const unsigned int FWRDURATION = 240; /* FWR average duration (samples) */
static const unsigned int FWRDURATION = 240; // FWR average duration (samples)
static const int cfg_delay = 0;
static const unsigned int fmt_freq = 48000;
static const unsigned int fmt_nchannels = 2; // input channels
+1 -1
View File
@@ -122,7 +122,7 @@ void DSound::SoundLoop()
bool DSound::Start()
{
if (FAILED(DirectSoundCreate8(0, &ds, 0)))
return false;
return false;
if (hWnd)
{
HRESULT hr = ds->SetCooperativeLevel((HWND)hWnd, DSSCL_PRIORITY);
+25 -25
View File
@@ -31,33 +31,33 @@
class DSound : public SoundStream
{
#ifdef _WIN32
std::thread thread;
Common::Event soundSyncEvent;
void *hWnd;
std::thread thread;
Common::Event soundSyncEvent;
void *hWnd;
IDirectSound8* ds;
IDirectSoundBuffer* dsBuffer;
int bufferSize; //i bytes
IDirectSound8* ds;
IDirectSoundBuffer* dsBuffer;
int bufferSize; //i bytes
int m_volume;
// playback position
int currentPos;
int lastPos;
short realtimeBuffer[BUFSIZE / sizeof(short)];
inline int FIX128(int x)
// playback position
int currentPos;
int lastPos;
short realtimeBuffer[BUFSIZE / sizeof(short)];
inline int FIX128(int x)
{
return x & (~127);
}
}
inline int ModBufferSize(int x)
inline int ModBufferSize(int x)
{
return (x + bufferSize) % bufferSize;
}
}
bool CreateBuffer();
bool WriteDataToBuffer(DWORD dwOffset, char* soundData, DWORD dwSoundBytes);
bool CreateBuffer();
bool WriteDataToBuffer(DWORD dwOffset, char* soundData, DWORD dwSoundBytes);
public:
DSound(CMixer *mixer, void *_hWnd = NULL)
@@ -70,16 +70,16 @@ public:
, hWnd(_hWnd)
{}
virtual ~DSound() {}
virtual ~DSound() {}
virtual bool Start();
virtual void SoundLoop();
virtual void SoundLoop();
virtual void SetVolume(int volume);
virtual void Stop();
virtual void Stop();
virtual void Clear(bool mute);
static bool isValid() { return true; }
virtual bool usesMixer() const { return true; }
virtual void Update();
static bool isValid() { return true; }
virtual bool usesMixer() const { return true; }
virtual void Update();
#else
public:
+4 -7
View File
@@ -67,7 +67,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
{
static const __m128i sr_mask =
_mm_set_epi32(0x0C0D0E0FL, 0x08090A0BL,
0x04050607L, 0x00010203L);
0x04050607L, 0x00010203L);
for (unsigned int i = 0; i < numLeft * 2; i += 8)
{
@@ -99,12 +99,11 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
if ((m_indexR2 & INDEX_MASK) == (m_indexW & INDEX_MASK)) //..if it exists
m_indexR2 = m_indexR;
s16 l1 = Common::swap16(m_buffer[m_indexR & INDEX_MASK]); //current
s16 l2 = Common::swap16(m_buffer[m_indexR2 & INDEX_MASK]); //next
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16;
samples[i+1] = sampleL;
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16;
samples[i+1] = sampleL;
s16 r1 = Common::swap16(m_buffer[(m_indexR + 1) & INDEX_MASK]); //current
s16 r2 = Common::swap16(m_buffer[(m_indexR2 + 1) & INDEX_MASK]); //next
int sampleR = ((r1 << 16) + (r2 - r1) * (u16)frac) >> 16;
@@ -116,8 +115,6 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
}
}
} else {
numLeft = 0;
}
@@ -25,24 +25,24 @@
class NullSound : public SoundStream
{
// playback position
short realtimeBuffer[BUF_SIZE / sizeof(short)];
// playback position
short realtimeBuffer[BUF_SIZE / sizeof(short)];
public:
NullSound(CMixer *mixer, void *hWnd = NULL)
: SoundStream(mixer)
{}
virtual ~NullSound() {}
virtual ~NullSound() {}
virtual bool Start();
virtual void SoundLoop();
virtual void SoundLoop();
virtual void SetVolume(int volume);
virtual void Stop();
virtual void Stop();
virtual void Clear(bool mute);
static bool isValid() { return true; }
virtual bool usesMixer() const { return true; }
virtual void Update();
static bool isValid() { return true; }
virtual bool usesMixer() const { return true; }
virtual void Update();
};
#endif //_NULLSOUNDSTREAM_H_
@@ -295,7 +295,6 @@ void OpenALStream::SoundLoop()
{
ERROR_LOG(AUDIO, "Error occurred while buffering float32 data: %08x", err);
}
}
#endif
if (!float32_capable)
@@ -308,7 +307,6 @@ void OpenALStream::SoundLoop()
stereo[i * 2 + 1] = (short)((float)sampleBuffer[i * 2 + 1] * (1 << 16));
}
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO16, stereo, nSamples * 2 * 2, ulFrequency);
}
}
+5 -5
View File
@@ -27,17 +27,17 @@ class SoundStream
protected:
CMixer *m_mixer;
// We set this to shut down the sound thread.
// 0=keep playing, 1=stop playing NOW.
volatile int threadData;
bool m_logAudio;
// We set this to shut down the sound thread.
// 0=keep playing, 1=stop playing NOW.
volatile int threadData;
bool m_logAudio;
WaveFileWriter g_wave_writer;
bool m_muted;
public:
SoundStream(CMixer *mixer) : m_mixer(mixer), threadData(0), m_logAudio(false), m_muted(false) {}
virtual ~SoundStream() { delete m_mixer;}
static bool isValid() { return false; }
virtual CMixer *GetMixer() const { return m_mixer; }
virtual bool Start() { return false; }
+5 -5
View File
@@ -104,21 +104,21 @@ void WaveFileWriter::AddStereoSamples(const short *sample_data, u32 count)
{
if (!file)
PanicAlertT("WaveFileWriter - file not open.");
if (skip_silence)
{
bool all_zero = true;
for (u32 i = 0; i < count * 2; i++)
{
if (sample_data[i])
all_zero = false;
}
if (all_zero)
return;
}
file.WriteBytes(sample_data, count * 4);
audio_size += count * 4;
}
@@ -134,7 +134,7 @@ void WaveFileWriter::AddStereoSamplesBE(const short *sample_data, u32 count)
if (skip_silence)
{
bool all_zero = true;
for (u32 i = 0; i < count * 2; i++)
{
if (sample_data[i])
@@ -95,10 +95,10 @@ void StreamingVoiceContext::OnBufferEnd(void* context)
if (!m_source_voice || !context)
return;
//m_sound_sync_event->Wait(); // sync
//m_sound_sync_event->Spin(); // or tight sync
m_mixer->Mix(static_cast<short*>(context), SAMPLES_PER_BUFFER);
SubmitBuffer(static_cast<BYTE*>(context));
}
@@ -183,6 +183,6 @@ void XAudio2::Stop()
m_mastering_voice->DestroyVoice();
m_mastering_voice = nullptr;
}
m_xaudio2.reset(); // release interface
}
+7 -7
View File
@@ -33,7 +33,7 @@ char *GetCPUString()
auto const fp = file.GetHandle();
if (!fp)
return 0;
while (fgets(buf, sizeof(buf), fp))
{
if (strncmp(buf, marker, sizeof(marker) - 1))
@@ -74,12 +74,12 @@ int GetCoreCount()
const char marker[] = "processor\t: ";
int cores = 0;
char buf[1024];
File::IOFile file(procfile, "r");
auto const fp = file.GetHandle();
if (!fp)
return 0;
while (fgets(buf, sizeof(buf), fp))
{
if (strncmp(buf, marker, sizeof(marker) - 1))
@@ -103,12 +103,12 @@ void CPUInfo::Detect()
HTT = false;
OS64bit = false;
CPU64bit = false;
Mode64bit = false;
Mode64bit = false;
vendor = VENDOR_ARM;
// Get the information about the CPU
strncpy(cpu_string, GetCPUString(), sizeof(cpu_string));
num_cores = GetCoreCount();
num_cores = GetCoreCount();
bSwp = CheckCPUFeature("swp");
bHalf = CheckCPUFeature("half");
bThumb = CheckCPUFeature("thumb");
@@ -122,7 +122,7 @@ void CPUInfo::Detect()
bVFPv4 = CheckCPUFeature("vfpv4");
bIDIVa = CheckCPUFeature("idiva");
bIDIVt = CheckCPUFeature("idivt");
// On some buggy kernels(Qualcomm) they show that they support VFPv4 but not IDIVa
// All VFPv4 CPUs will support IDIVa
if (bVFPv4)
+1 -1
View File
@@ -157,7 +157,7 @@ void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
{
Operand2 op2;
bool inverse;
if (cpu_info.bArmV7 && !optimize)
{
// For backpatching on ARMv7
+14 -14
View File
@@ -136,7 +136,7 @@ protected:
u32 Value;
private:
OpType Type;
OpType Type;
// IMM types
u8 Rotation; // Only for u8 values
@@ -154,7 +154,7 @@ public:
{
Type = type;
Value = imm;
Rotation = 0;
Rotation = 0;
}
Operand2(ARMReg Reg)
@@ -297,7 +297,7 @@ public:
u32 Imm24()
{
_assert_msg_(DYNA_REC, (Type == TYPE_IMM), "Imm16 not IMM");
return (Value & 0x0FFFFFFF);
return (Value & 0x0FFFFFFF);
}
// NEON and ASIMD specific
u32 Imm8ASIMD()
@@ -336,9 +336,9 @@ struct FixupBranch
struct LiteralPool
{
s32 loc;
u8* ldr_address;
u32 val;
s32 loc;
u8* ldr_address;
u32 val;
};
typedef const u8* JumpTarget;
@@ -357,7 +357,7 @@ private:
void WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg src, ARMReg op2);
void WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg src, Operand2 op2);
void WriteSignedMultiply(u32 Op, u32 Op2, u32 Op3, ARMReg dest, ARMReg r1, ARMReg r2);
u32 EncodeVd(ARMReg Vd);
u32 EncodeVn(ARMReg Vn);
u32 EncodeVm(ARMReg Vm);
@@ -407,10 +407,10 @@ public:
// Hint instruction
void YIELD();
// Do nothing
void NOP(int count = 1); //nop padding - TODO: fast nop slides, for amd and intel (check their manuals)
#ifdef CALL
#undef CALL
#endif
@@ -422,7 +422,7 @@ public:
FixupBranch BL();
FixupBranch BL_CC(CCFlags Cond);
void SetJumpTarget(FixupBranch const &branch);
void B (const void *fnptr);
void B (ARMReg src);
void BL(const void *fnptr);
@@ -468,7 +468,7 @@ public:
void BICS(ARMReg dest, ARMReg src, Operand2 op2);
void MVN (ARMReg dest, Operand2 op2);
void MVNS(ARMReg dest, Operand2 op2);
void MOVW(ARMReg dest, Operand2 op2);
void MOVW(ARMReg dest, Operand2 op2);
void MOVT(ARMReg dest, Operand2 op2, bool TopBits = false);
// UDIV and SDIV are only available on CPUs that have
@@ -510,7 +510,7 @@ public:
void STMFD(ARMReg dest, bool WriteBack, const int Regnum, ...);
void LDMFD(ARMReg dest, bool WriteBack, const int Regnum, ...);
// Exclusive Access operations
void LDREX(ARMReg dest, ARMReg base);
// result contains the result if the instruction managed to store the value
@@ -528,7 +528,7 @@ public:
// NEON Only
void VADD(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm);
void VSUB(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm);
// VFP Only
void VLDR(ARMReg Dest, ARMReg Base, s16 offset);
void VSTR(ARMReg Src, ARMReg Base, s16 offset);
@@ -539,7 +539,7 @@ public:
void VCMPE(ARMReg Vd);
void VDIV(ARMReg Vd, ARMReg Vn, ARMReg Vm);
void VSQRT(ARMReg Vd, ARMReg Vm);
// NEON and VFP
void VADD(ARMReg Vd, ARMReg Vn, ARMReg Vm);
void VSUB(ARMReg Vd, ARMReg Vn, ARMReg Vm);
+4 -4
View File
@@ -27,9 +27,9 @@ class DebugInterface;
struct TBreakPoint
{
u32 iAddress;
u32 iAddress;
bool bOn;
bool bTemporary;
bool bTemporary;
};
struct TMemCheck
@@ -96,9 +96,9 @@ public:
typedef std::vector<std::string> TMemChecksStr;
TMemChecks m_MemChecks;
const TMemChecks& GetMemChecks() { return m_MemChecks; }
TMemChecksStr GetStrings() const;
void AddFromStrings(const TMemChecksStr& mcs);
+5 -5
View File
@@ -32,13 +32,13 @@ enum CPUVendor
struct CPUInfo
{
CPUVendor vendor;
char cpu_string[0x21];
char brand_string[0x41];
bool OS64bit;
bool CPU64bit;
bool Mode64bit;
bool HTT;
int num_cores;
int logical_cpu_count;
@@ -56,7 +56,7 @@ struct CPUInfo
bool bAES;
bool bLAHFSAHF64;
bool bLongMode;
// ARM specific CPUInfo
bool bSwp;
bool bHalf;
@@ -72,14 +72,14 @@ struct CPUInfo
bool bIDIVa;
bool bIDIVt;
bool bArmV7; // enable MOVT, MOVW etc
// ARMv8 specific
bool bFP;
bool bASIMD;
// Call Detect()
explicit CPUInfo();
// Turn the cpu info into a string we can show
std::string Summarize();
+26 -26
View File
@@ -69,7 +69,7 @@ public:
{
u32 count = (u32)x.size();
Do(count);
switch (mode)
{
case MODE_READ:
@@ -81,7 +81,7 @@ public:
x.insert(pair);
}
break;
case MODE_WRITE:
case MODE_MEASURE:
case MODE_VERIFY:
@@ -93,14 +93,14 @@ public:
break;
}
}
template <typename T>
void DoContainer(T& x)
{
u32 size = (u32)x.size();
Do(size);
x.resize(size);
for (auto itr = x.begin(); itr != x.end(); ++itr)
Do(*itr);
}
@@ -110,32 +110,32 @@ public:
{
DoContainer(x);
}
template <typename T>
void Do(std::list<T>& x)
{
DoContainer(x);
}
template <typename T>
void Do(std::deque<T>& x)
{
DoContainer(x);
}
template <typename T>
void Do(std::basic_string<T>& x)
{
DoContainer(x);
}
template <typename T>
template <typename T>
void DoArray(T* x, u32 count)
{
for (u32 i = 0; i != count; ++i)
Do(x[i]);
}
}
template <typename T>
void Do(T& x)
{
@@ -220,7 +220,7 @@ public:
{
u32 cookie = arbitraryNumber;
Do(cookie);
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber)
{
PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...",
@@ -228,7 +228,7 @@ public:
mode = PointerWrap::MODE_MEASURE;
}
}
private:
__forceinline void DoByte(u8& x)
{
@@ -237,27 +237,27 @@ private:
case MODE_READ:
x = **ptr;
break;
case MODE_WRITE:
**ptr = x;
break;
case MODE_MEASURE:
break;
case MODE_VERIFY:
_dbg_assert_msg_(COMMON, (x == **ptr),
"Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n",
x, x, &x, **ptr, **ptr, *ptr);
break;
default:
break;
}
++(*ptr);
}
void DoVoid(void *data, u32 size)
{
for(u32 i = 0; i != size; ++i)
@@ -300,7 +300,7 @@ public:
ERROR_LOG(COMMON,"ChunkReader: Bad header size");
return false;
}
// Check revision
if (header.Revision != _Revision)
{
@@ -308,7 +308,7 @@ public:
header.Revision, _Revision);
return false;
}
// get size
const u32 sz = (u32)(fileSize - headerSize);
if (header.ExpectedSize != sz)
@@ -317,7 +317,7 @@ public:
sz, header.ExpectedSize);
return false;
}
// read the state
std::vector<u8> buffer(sz);
if (!pFile.ReadArray(&buffer[0], sz))
@@ -333,7 +333,7 @@ public:
INFO_LOG(COMMON, "ChunkReader: Done loading %s" , _rFilename.c_str());
return true;
}
// Save file template
template<class T>
static bool Save(const std::string& _rFilename, u32 _Revision, T& _class)
@@ -355,12 +355,12 @@ public:
ptr = &buffer[0];
p.SetMode(PointerWrap::MODE_WRITE);
_class.DoState(p);
// Create header
SChunkHeader header;
header.Revision = _Revision;
header.ExpectedSize = (u32)sz;
// Write to file
if (!pFile.WriteArray(&header, 1))
{
@@ -373,11 +373,11 @@ public:
ERROR_LOG(COMMON,"ChunkReader: Failed writing data");
return false;
}
INFO_LOG(COMMON,"ChunkReader: Done writing %s", _rFilename.c_str());
return true;
}
private:
struct SChunkHeader
{
+6 -6
View File
@@ -68,9 +68,9 @@ _mm_shuffle_epi8(__m128i a, __m128i mask)
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
inline u32 _rotl(u32 x, int shift) {
shift &= 31;
if (!shift) return x;
return (x << shift) | (x >> (32 - shift));
shift &= 31;
if (!shift) return x;
return (x << shift) | (x >> (32 - shift));
}
inline u64 _rotl64(u64 x, unsigned int shift){
@@ -79,9 +79,9 @@ inline u64 _rotl64(u64 x, unsigned int shift){
}
inline u32 _rotr(u32 x, int shift) {
shift &= 31;
if (!shift) return x;
return (x >> shift) | (x << (32 - shift));
shift &= 31;
if (!shift) return x;
return (x >> shift) | (x << (32 - shift));
}
inline u64 _rotr64(u64 x, unsigned int shift){

Some files were not shown because too many files have changed in this diff Show More