Merge pull request #2058 from Stevoisiak/Codemaid-Cleanup-Take2

Basic Formatting/Whitespace Cleanup
This commit is contained in:
Lioncash 2015-02-25 18:07:56 -05:00
commit 7408de7e79
97 changed files with 673 additions and 657 deletions

View File

@ -17,7 +17,7 @@ namespace AudioCommon
SoundStream* InitSoundStream(); SoundStream* InitSoundStream();
void ShutdownSoundStream(); void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends(); std::vector<std::string> GetSoundBackends();
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true); void PauseAndLock(bool doLock, bool unpauseOnUnlock = true);
void UpdateSoundStream(); void UpdateSoundStream();
void ClearAudioBuffer(bool mute); void ClearAudioBuffer(bool mute);
void SendAIBuffer(short* samples, unsigned int num_samples); void SendAIBuffer(short* samples, unsigned int num_samples);

View File

@ -80,9 +80,9 @@ static T FIRFilter(const T *buf, int pos, int len, int count, const float *coeff
// high part of window // high part of window
const T *ptr = &buf[pos]; const T *ptr = &buf[pos];
float r1=DotProduct(count1,ptr,coefficients);coefficients+=count1; float r1 = DotProduct(count1, ptr, coefficients); coefficients += count1;
float r2=DotProduct(count2,buf,coefficients); float r2 = DotProduct(count2, buf, coefficients);
return T(r1+r2); return T(r1 + r2);
} }
/* /*
@ -96,7 +96,7 @@ static T FIRFilter(const T *buf, int pos, int len, int count, const float *coeff
*/ */
static void Hamming(int n, float* w) static void Hamming(int n, float* w)
{ {
float k = float(2*M_PI/((float)(n-1))); // 2*pi/(N-1) float k = float(2*M_PI/((float)(n - 1))); // 2*pi/(N-1)
// Calculate window coefficients // Calculate window coefficients
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
@ -122,27 +122,28 @@ returns 0 if OK, -1 if fail
*/ */
static float* DesignFIR(unsigned int *n, float* fc, float opt) static float* DesignFIR(unsigned int *n, float* fc, float opt)
{ {
unsigned int o = *n & 1; // Indicator for odd filter length unsigned int o = *n & 1; // Indicator for odd filter length
unsigned int end = ((*n + 1) >> 1) - o; // Loop end unsigned int end = ((*n + 1) >> 1) - o; // Loop end
float k1 = 2 * float(M_PI); // 2*pi*fc1 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 k2 = 0.5f * (float)(1 - o); // Constant used if the filter has even length
float g = 0.0f; // Gain float g = 0.0f; // Gain
float t1; // Temporary variables float t1; // Temporary variables
float fc1; // Cutoff frequencies float fc1; // Cutoff frequencies
// Sanity check // Sanity check
if (*n==0) return nullptr; if (*n == 0)
MathUtil::Clamp(&fc[0],float(0.001),float(1)); return nullptr;
MathUtil::Clamp(&fc[0], float(0.001), float(1));
float *w=(float*)calloc(sizeof(float),*n); float *w = (float*)calloc(sizeof(float), *n);
// Get window coefficients // Get window coefficients
Hamming(*n,w); Hamming(*n, w);
fc1=*fc; fc1 = *fc;
// Cutoff frequency must be < 0.5 where 0.5 <=> Fs/2 // Cutoff frequency must be < 0.5 where 0.5 <=> Fs/2
fc1 = ((fc1 <= 1.0) && (fc1 > 0.0)) ? fc1/2 : 0.25f; fc1 = ((fc1 <= 1.0) && (fc1 > 0.0)) ? fc1 / 2 : 0.25f;
k1 *= fc1; k1 *= fc1;
// Low pass filter // Low pass filter
@ -154,20 +155,20 @@ static float* DesignFIR(unsigned int *n, float* fc, float opt)
if (o) if (o)
{ {
w[end] = fc1 * w[end] * 2.0f; w[end] = fc1 * w[end] * 2.0f;
g=w[end]; g = w[end];
} }
// Create filter // Create filter
for (u32 i = 0; i < end; i++) for (u32 i = 0; i < end; i++)
{ {
t1 = (float)(i+1) - k2; t1 = (float)(i + 1) - k2;
w[end-i-1] = w[*n-end+i] = float(w[end-i-1] * sin(k1 * t1)/(M_PI * t1)); // Sinc w[end - i - 1] = w[*n - end + i] = float(w[end - i - 1] * sin(k1 * t1)/(M_PI * t1)); // Sinc
g += 2*w[end-i-1]; // Total gain in filter g += 2*w[end - i - 1]; // Total gain in filter
} }
// Normalize gain // Normalize gain
g=1/g; g = 1/g;
for (u32 i = 0; i < *n; i++) for (u32 i = 0; i < *n; i++)
w[i] *= g; w[i] *= g;

View File

@ -172,7 +172,7 @@ void OpenALStream::SoundLoop()
ALint iBuffersFilled = 0; ALint iBuffersFilled = 0;
ALint iBuffersProcessed = 0; ALint iBuffersProcessed = 0;
ALint iState = 0; ALint iState = 0;
ALuint uiBufferTemp[OAL_MAX_BUFFERS] = {0}; ALuint uiBufferTemp[OAL_MAX_BUFFERS] = { 0 };
soundTouch.setChannels(2); soundTouch.setChannels(2);
soundTouch.setSampleRate(ulFrequency); soundTouch.setSampleRate(ulFrequency);
@ -255,7 +255,7 @@ void OpenALStream::SoundLoop()
// good 5.0 but not a good 5.1 output. Sadly there is not a 5.0 // good 5.0 but not a good 5.1 output. Sadly there is not a 5.0
// AL_FORMAT_50CHN32 to make this super-explicit. // AL_FORMAT_50CHN32 to make this super-explicit.
// DPL2Decode output: LEFTFRONT, RIGHTFRONT, CENTREFRONT, (sub), LEFTREAR, RIGHTREAR // DPL2Decode output: LEFTFRONT, RIGHTFRONT, CENTREFRONT, (sub), LEFTREAR, RIGHTREAR
for (u32 i=0; i < nSamples; ++i) for (u32 i = 0; i < nSamples; ++i)
{ {
dpl2[i*SURROUND_CHANNELS + 3 /*sub/lfe*/] = 0.0f; dpl2[i*SURROUND_CHANNELS + 3 /*sub/lfe*/] = 0.0f;
} }

View File

@ -23,7 +23,7 @@ public:
virtual bool Start() override; virtual bool Start() override;
virtual void Stop() override; virtual void Stop() override;
static bool isValid() {return true;} static bool isValid() { return true; }
virtual void Update() override; virtual void Update() override;

View File

@ -8,7 +8,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
enum {BUF_SIZE = 32*1024}; enum { BUF_SIZE = 32*1024 };
WaveFileWriter::WaveFileWriter(): WaveFileWriter::WaveFileWriter():
skip_silence(false), skip_silence(false),
@ -19,7 +19,7 @@ WaveFileWriter::WaveFileWriter():
WaveFileWriter::~WaveFileWriter() WaveFileWriter::~WaveFileWriter()
{ {
delete [] conv_buffer; delete[] conv_buffer;
Stop(); Stop();
} }

View File

@ -130,7 +130,7 @@ public:
BitField() = default; BitField() = default;
#ifndef _WIN32 #ifndef _WIN32
// We explicitly delete the copy assigment operator here, because the // We explicitly delete the copy assignment operator here, because the
// default copy assignment would copy the full storage value, rather than // default copy assignment would copy the full storage value, rather than
// just the bits relevant to this particular bit field. // just the bits relevant to this particular bit field.
// Ideally, we would just implement the copy assignment to copy only the // Ideally, we would just implement the copy assignment to copy only the
@ -183,7 +183,7 @@ private:
__forceinline StorageType GetMask() const __forceinline StorageType GetMask() const
{ {
return ((~(StorageTypeU)0) >> (8*sizeof(T) - bits)) << position; return ((~(StorageTypeU)0) >> (8 * sizeof(T) - bits)) << position;
} }
StorageType storage; StorageType storage;

View File

@ -68,7 +68,7 @@ public:
bool IsTempBreakPoint(u32 _iAddress); bool IsTempBreakPoint(u32 _iAddress);
// Add BreakPoint // Add BreakPoint
void Add(u32 em_address, bool temp=false); void Add(u32 em_address, bool temp = false);
void Add(const TBreakPoint& bp); void Add(const TBreakPoint& bp);
// Remove Breakpoint // Remove Breakpoint

View File

@ -72,23 +72,23 @@ std::vector<std::string> cdio_get_devices()
CFMutableDictionaryRef classes_to_match; CFMutableDictionaryRef classes_to_match;
std::vector<std::string> drives; std::vector<std::string> drives;
kern_result = IOMasterPort( MACH_PORT_NULL, &master_port ); kern_result = IOMasterPort(MACH_PORT_NULL, &master_port);
if (kern_result != KERN_SUCCESS) if (kern_result != KERN_SUCCESS)
return( drives ); return drives;
classes_to_match = IOServiceMatching( kIOCDMediaClass ); classes_to_match = IOServiceMatching(kIOCDMediaClass);
if (classes_to_match == nullptr) if (classes_to_match == nullptr)
return( drives ); return drives;
CFDictionarySetValue( classes_to_match, CFDictionarySetValue(classes_to_match,
CFSTR(kIOMediaEjectableKey), kCFBooleanTrue ); CFSTR(kIOMediaEjectableKey), kCFBooleanTrue);
kern_result = IOServiceGetMatchingServices( master_port, kern_result = IOServiceGetMatchingServices(master_port,
classes_to_match, &media_iterator ); classes_to_match, &media_iterator);
if (kern_result != KERN_SUCCESS) if (kern_result != KERN_SUCCESS)
return( drives ); return drives;
next_media = IOIteratorNext( media_iterator ); next_media = IOIteratorNext(media_iterator);
if (next_media != 0) if (next_media != 0)
{ {
CFTypeRef str_bsd_path; CFTypeRef str_bsd_path;
@ -96,12 +96,12 @@ std::vector<std::string> cdio_get_devices()
do do
{ {
str_bsd_path = str_bsd_path =
IORegistryEntryCreateCFProperty( next_media, IORegistryEntryCreateCFProperty(next_media,
CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, CFSTR(kIOBSDNameKey), kCFAllocatorDefault,
0 ); 0);
if (str_bsd_path == nullptr) if (str_bsd_path == nullptr)
{ {
IOObjectRelease( next_media ); IOObjectRelease(next_media);
continue; continue;
} }
@ -120,12 +120,11 @@ std::vector<std::string> cdio_get_devices()
delete[] buf; delete[] buf;
} }
CFRelease( str_bsd_path ); CFRelease(str_bsd_path);
IOObjectRelease( next_media ); IOObjectRelease(next_media);
} while ((next_media = IOIteratorNext(media_iterator)) != 0);
} while (( next_media = IOIteratorNext( media_iterator ) ) != 0);
} }
IOObjectRelease( media_iterator ); IOObjectRelease(media_iterator);
return drives; return drives;
} }
#else #else
@ -166,11 +165,11 @@ static bool is_cdrom(const std::string& drive, char *mnttype)
{ {
// Check if the device exists // Check if the device exists
if (!is_device(drive)) if (!is_device(drive))
return(false); return false;
bool is_cd=false; bool is_cd = false;
// If it does exist, verify that it is a cdrom/dvd drive // If it does exist, verify that it is a cdrom/dvd drive
int cdfd = open(drive.c_str(), (O_RDONLY|O_NONBLOCK), 0); int cdfd = open(drive.c_str(), (O_RDONLY | O_NONBLOCK), 0);
if (cdfd >= 0) if (cdfd >= 0)
{ {
#ifdef __linux__ #ifdef __linux__
@ -179,11 +178,11 @@ static bool is_cdrom(const std::string& drive, char *mnttype)
is_cd = true; is_cd = true;
close(cdfd); close(cdfd);
} }
return(is_cd); return is_cd;
} }
// Returns a pointer to an array of strings with the device names // Returns a pointer to an array of strings with the device names
std::vector<std::string> cdio_get_devices () std::vector<std::string> cdio_get_devices()
{ {
std::vector<std::string> drives; std::vector<std::string> drives;
// Scan the system for DVD/CD-ROM drives. // Scan the system for DVD/CD-ROM drives.

View File

@ -161,7 +161,7 @@ public:
} }
template <typename T, std::size_t N> template <typename T, std::size_t N>
void DoArray(std::array<T,N>& x) void DoArray(std::array<T, N>& x)
{ {
DoArray(x.data(), (u32)x.size()); DoArray(x.data(), (u32)x.size());
} }
@ -260,8 +260,7 @@ public:
LinkedListItem<T>* next = list_cur->next; LinkedListItem<T>* next = list_cur->next;
TFree(list_cur); TFree(list_cur);
list_cur = next; list_cur = next;
} } while (list_cur);
while (list_cur);
} }
} }
break; break;
@ -332,7 +331,7 @@ public:
template<class T> template<class T>
static bool Load(const std::string& _rFilename, u32 _Revision, T& _class) static bool Load(const std::string& _rFilename, u32 _Revision, T& _class)
{ {
INFO_LOG(COMMON, "ChunkReader: Loading %s" , _rFilename.c_str()); INFO_LOG(COMMON, "ChunkReader: Loading %s", _rFilename.c_str());
if (!File::Exists(_rFilename)) if (!File::Exists(_rFilename))
return false; return false;
@ -342,14 +341,14 @@ public:
static const u64 headerSize = sizeof(SChunkHeader); static const u64 headerSize = sizeof(SChunkHeader);
if (fileSize < headerSize) if (fileSize < headerSize)
{ {
ERROR_LOG(COMMON,"ChunkReader: File too small"); ERROR_LOG(COMMON, "ChunkReader: File too small");
return false; return false;
} }
File::IOFile pFile(_rFilename, "rb"); File::IOFile pFile(_rFilename, "rb");
if (!pFile) if (!pFile)
{ {
ERROR_LOG(COMMON,"ChunkReader: Can't open file for reading"); ERROR_LOG(COMMON, "ChunkReader: Can't open file for reading");
return false; return false;
} }
@ -357,14 +356,14 @@ public:
SChunkHeader header; SChunkHeader header;
if (!pFile.ReadArray(&header, 1)) if (!pFile.ReadArray(&header, 1))
{ {
ERROR_LOG(COMMON,"ChunkReader: Bad header size"); ERROR_LOG(COMMON, "ChunkReader: Bad header size");
return false; return false;
} }
// Check revision // Check revision
if (header.Revision != _Revision) if (header.Revision != _Revision)
{ {
ERROR_LOG(COMMON,"ChunkReader: Wrong file revision, got %d expected %d", ERROR_LOG(COMMON, "ChunkReader: Wrong file revision, got %d expected %d",
header.Revision, _Revision); header.Revision, _Revision);
return false; return false;
} }
@ -373,7 +372,7 @@ public:
const u32 sz = (u32)(fileSize - headerSize); const u32 sz = (u32)(fileSize - headerSize);
if (header.ExpectedSize != sz) if (header.ExpectedSize != sz)
{ {
ERROR_LOG(COMMON,"ChunkReader: Bad file size, got %d expected %d", ERROR_LOG(COMMON, "ChunkReader: Bad file size, got %d expected %d",
sz, header.ExpectedSize); sz, header.ExpectedSize);
return false; return false;
} }
@ -382,7 +381,7 @@ public:
std::vector<u8> buffer(sz); std::vector<u8> buffer(sz);
if (!pFile.ReadArray(&buffer[0], sz)) if (!pFile.ReadArray(&buffer[0], sz))
{ {
ERROR_LOG(COMMON,"ChunkReader: Error reading file"); ERROR_LOG(COMMON, "ChunkReader: Error reading file");
return false; return false;
} }
@ -390,7 +389,7 @@ public:
PointerWrap p(&ptr, PointerWrap::MODE_READ); PointerWrap p(&ptr, PointerWrap::MODE_READ);
_class.DoState(p); _class.DoState(p);
INFO_LOG(COMMON, "ChunkReader: Done loading %s" , _rFilename.c_str()); INFO_LOG(COMMON, "ChunkReader: Done loading %s", _rFilename.c_str());
return true; return true;
} }
@ -398,11 +397,11 @@ public:
template<class T> template<class T>
static bool Save(const std::string& _rFilename, u32 _Revision, T& _class) static bool Save(const std::string& _rFilename, u32 _Revision, T& _class)
{ {
INFO_LOG(COMMON, "ChunkReader: Writing %s" , _rFilename.c_str()); INFO_LOG(COMMON, "ChunkReader: Writing %s", _rFilename.c_str());
File::IOFile pFile(_rFilename, "wb"); File::IOFile pFile(_rFilename, "wb");
if (!pFile) if (!pFile)
{ {
ERROR_LOG(COMMON,"ChunkReader: Error opening file for write"); ERROR_LOG(COMMON, "ChunkReader: Error opening file for write");
return false; return false;
} }
@ -424,17 +423,17 @@ public:
// Write to file // Write to file
if (!pFile.WriteArray(&header, 1)) if (!pFile.WriteArray(&header, 1))
{ {
ERROR_LOG(COMMON,"ChunkReader: Failed writing header"); ERROR_LOG(COMMON, "ChunkReader: Failed writing header");
return false; return false;
} }
if (!pFile.WriteArray(&buffer[0], sz)) if (!pFile.WriteArray(&buffer[0], sz))
{ {
ERROR_LOG(COMMON,"ChunkReader: Failed writing data"); ERROR_LOG(COMMON, "ChunkReader: Failed writing data");
return false; return false;
} }
INFO_LOG(COMMON,"ChunkReader: Done writing %s", _rFilename.c_str()); INFO_LOG(COMMON, "ChunkReader: Done writing %s", _rFilename.c_str());
return true; return true;
} }

View File

@ -83,7 +83,7 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
std::equal(end_match.rbegin(), end_match.rend(), found.rbegin())) std::equal(end_match.rbegin(), end_match.rend(), found.rbegin()))
{ {
std::string full_name; std::string full_name;
if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR) if (_strPath.c_str()[_strPath.size() - 1] == DIR_SEP_CHR)
full_name = _strPath + found; full_name = _strPath + found;
else else
full_name = _strPath + DIR_SEP + found; full_name = _strPath + DIR_SEP + found;

View File

@ -33,7 +33,7 @@ public:
~FixedSizeQueue() ~FixedSizeQueue()
{ {
delete [] storage; delete[] storage;
} }
void clear() void clear()

View File

@ -24,11 +24,11 @@ u32 HashFletcher(const u8* data_u8, size_t length)
size_t tlen = len > 360 ? 360 : len; size_t tlen = len > 360 ? 360 : len;
len -= tlen; len -= tlen;
do { do
{
sum1 += *data++; sum1 += *data++;
sum2 += sum1; sum2 += sum1;
} } while (--tlen);
while (--tlen);
sum1 = (sum1 & 0xffff) + (sum1 >> 16); sum1 = (sum1 & 0xffff) + (sum1 >> 16);
sum2 = (sum2 & 0xffff) + (sum2 >> 16); sum2 = (sum2 & 0xffff) + (sum2 >> 16);
@ -58,8 +58,7 @@ u32 HashAdler32(const u8* data, size_t len)
{ {
a += *data++; a += *data++;
b += a; b += a;
} } while (--tlen);
while (--tlen);
a = (a & 0xffff) + (a >> 16) * (65536 - MOD_ADLER); a = (a & 0xffff) + (a >> 16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >> 16) * (65536 - MOD_ADLER); b = (b & 0xffff) + (b >> 16) * (65536 - MOD_ADLER);
@ -115,24 +114,24 @@ inline u64 getblock(const u64 * p, int i)
inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2) inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2)
{ {
k1 *= c1; k1 *= c1;
k1 = _rotl64(k1,23); k1 = _rotl64(k1, 23);
k1 *= c2; k1 *= c2;
h1 ^= k1; h1 ^= k1;
h1 += h2; h1 += h2;
h2 = _rotl64(h2,41); h2 = _rotl64(h2, 41);
k2 *= c2; k2 *= c2;
k2 = _rotl64(k2,23); k2 = _rotl64(k2, 23);
k2 *= c1; k2 *= c1;
h2 ^= k2; h2 ^= k2;
h2 += h1; h2 += h1;
h1 = h1*3+0x52dce729; h1 = h1 * 3 + 0x52dce729;
h2 = h2*3+0x38495ab5; h2 = h2 * 3 + 0x38495ab5;
c1 = c1*5+0x7b7d159c; c1 = c1 * 5 + 0x7b7d159c;
c2 = c2*5+0x6bce6396; c2 = c2 * 5 + 0x6bce6396;
} }
//---------- //----------
@ -154,9 +153,11 @@ u64 GetMurmurHash3(const u8 *src, u32 len, u32 samples)
const u8 * data = (const u8*)src; const u8 * data = (const u8*)src;
const int nblocks = len / 16; const int nblocks = len / 16;
u32 Step = (len / 8); u32 Step = (len / 8);
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
u64 h1 = 0x9368e53c2f6af274; u64 h1 = 0x9368e53c2f6af274;
u64 h2 = 0x586dcd208f7cd3fd; u64 h2 = 0x586dcd208f7cd3fd;
@ -172,8 +173,8 @@ u64 GetMurmurHash3(const u8 *src, u32 len, u32 samples)
for (int i = 0; i < nblocks; i+=Step) for (int i = 0; i < nblocks; i+=Step)
{ {
u64 k1 = getblock(blocks,i*2+0); u64 k1 = getblock(blocks, i*2+0);
u64 k2 = getblock(blocks,i*2+1); u64 k2 = getblock(blocks, i*2+1);
bmix64(h1,h2,k1,k2,c1,c2); bmix64(h1,h2,k1,k2,c1,c2);
} }
@ -232,9 +233,11 @@ u64 GetCRC32(const u8 *src, u32 len, u32 samples)
u32 Step = (len / 8); u32 Step = (len / 8);
const u64 *data = (const u64 *)src; const u64 *data = (const u64 *)src;
const u64 *end = data + Step; const u64 *end = data + Step;
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
while (data < end - Step * 3) while (data < end - Step * 3)
{ {
h[0] = _mm_crc32_u64(h[0], data[Step * 0]); h[0] = _mm_crc32_u64(h[0], data[Step * 0]);
@ -280,9 +283,11 @@ u64 GetHashHiresTexture(const u8 *src, u32 len, u32 samples)
u32 Step = (len / 8); u32 Step = (len / 8);
const u64 *data = (const u64 *)src; const u64 *data = (const u64 *)src;
const u64 *end = data + Step; const u64 *end = data + Step;
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
while (data < end) while (data < end)
{ {
u64 k = data[0]; u64 k = data[0];
@ -323,9 +328,11 @@ u64 GetCRC32(const u8 *src, u32 len, u32 samples)
u32 Step = (len/4); u32 Step = (len/4);
const u32 *data = (const u32 *)src; const u32 *data = (const u32 *)src;
const u32 *end = data + Step; const u32 *end = data + Step;
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
while (data < end) while (data < end)
{ {
h = _mm_crc32_u32(h, data[0]); h = _mm_crc32_u32(h, data[0]);
@ -367,24 +374,24 @@ inline u32 fmix32(u32 h)
inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2) inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2)
{ {
k1 *= c1; k1 *= c1;
k1 = _rotl(k1,11); k1 = _rotl(k1, 11);
k1 *= c2; k1 *= c2;
h1 ^= k1; h1 ^= k1;
h1 += h2; h1 += h2;
h2 = _rotl(h2,17); h2 = _rotl(h2, 17);
k2 *= c2; k2 *= c2;
k2 = _rotl(k2,11); k2 = _rotl(k2, 11);
k2 *= c1; k2 *= c1;
h2 ^= k2; h2 ^= k2;
h2 += h1; h2 += h1;
h1 = h1*3+0x52dce729; h1 = h1*3+0x52dce729;
h2 = h2*3+0x38495ab5; h2 = h2*3+0x38495ab5;
c1 = c1*5+0x7b7d159c; c1 = c1*5+0x7b7d159c;
c2 = c2*5+0x6bce6396; c2 = c2*5+0x6bce6396;
} }
//---------- //----------
@ -395,9 +402,11 @@ u64 GetMurmurHash3(const u8* src, u32 len, u32 samples)
u32 out[2]; u32 out[2];
const int nblocks = len / 8; const int nblocks = len / 8;
u32 Step = (len / 4); u32 Step = (len / 4);
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
u32 h1 = 0x8de1c3ac; u32 h1 = 0x8de1c3ac;
u32 h2 = 0xbab98226; u32 h2 = 0xbab98226;
@ -446,8 +455,8 @@ u64 GetMurmurHash3(const u8* src, u32 len, u32 samples)
h1 += h2; h1 += h2;
h2 += h1; h2 += h1;
h1 = fmix32(h1); h1 = fmix32(h1);
h2 = fmix32(h2); h2 = fmix32(h2);
h1 += h2; h1 += h2;
h2 += h1; h2 += h1;
@ -471,9 +480,11 @@ u64 GetHashHiresTexture(const u8 *src, u32 len, u32 samples)
u32 Step = (len / 8); u32 Step = (len / 8);
const u64 *data = (const u64 *)src; const u64 *data = (const u64 *)src;
const u64 *end = data + Step; const u64 *end = data + Step;
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
while (data < end) while (data < end)
{ {
u64 k = data[0]; u64 k = data[0];

View File

@ -63,7 +63,6 @@ public:
void Set(const std::string& key, bool newValue) void Set(const std::string& key, bool newValue)
{ {
Set(key, StringFromBool(newValue)); Set(key, StringFromBool(newValue));
} }
template<typename T> template<typename T>

View File

@ -41,7 +41,8 @@ void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title
// Open the console window and create the window handle for GetStdHandle() // Open the console window and create the window handle for GetStdHandle()
AllocConsole(); AllocConsole();
// Hide // Hide
if (Hidden) ShowWindow(GetConsoleWindow(), SW_HIDE); if (Hidden)
ShowWindow(GetConsoleWindow(), SW_HIDE);
// Save the window handle that AllocConsole() created // Save the window handle that AllocConsole() created
hConsole = GetStdHandle(STD_OUTPUT_HANDLE); hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// Set the console window title // Set the console window title
@ -133,9 +134,9 @@ void ConsoleListener::LetterSpace(int Width, int Height)
int NewScreenHeight = OldScreenHeight; int NewScreenHeight = OldScreenHeight;
// Width // Width
BufferWidthHeight(NewBufferWidth, OldBufferHeight, NewScreenWidth, OldScreenHeight, (NewBufferWidth > OldScreenWidth-1)); BufferWidthHeight(NewBufferWidth, OldBufferHeight, NewScreenWidth, OldScreenHeight, (NewBufferWidth > OldScreenWidth - 1));
// Height // Height
BufferWidthHeight(NewBufferWidth, NewBufferHeight, NewScreenWidth, NewScreenHeight, (NewBufferHeight > OldScreenHeight-1)); BufferWidthHeight(NewBufferWidth, NewBufferHeight, NewScreenWidth, NewScreenHeight, (NewBufferHeight > OldScreenHeight - 1));
// Resize the window too // Resize the window too
//MoveWindow(GetConsoleWindow(), 200,200, (Width*8 + 50),(NewScreenHeight*12 + 200), true); //MoveWindow(GetConsoleWindow(), 200,200, (Width*8 + 50),(NewScreenHeight*12 + 200), true);
@ -157,7 +158,8 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
{ {
#ifdef _WIN32 #ifdef _WIN32
// Check size // Check size
if (Width < 8 || Height < 12) return; if (Width < 8 || Height < 12)
return;
bool DBef = true; bool DBef = true;
bool DAft = true; bool DAft = true;
@ -233,10 +235,12 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
COORD Coo = GetCoordinates(OldCursor, LBufWidth); COORD Coo = GetCoordinates(OldCursor, LBufWidth);
SetConsoleCursorPosition(hConsole, Coo); SetConsoleCursorPosition(hConsole, Coo);
if (SLog.length() > 0) Log(LogTypes::LNOTICE, SLog.c_str()); if (SLog.length() > 0)
Log(LogTypes::LNOTICE, SLog.c_str());
// Resize the window too // Resize the window too
if (Resize) MoveWindow(GetConsoleWindow(), Left,Top, (Width + 100),Height, true); if (Resize)
MoveWindow(GetConsoleWindow(), Left, Top, (Width + 100), Height, true);
#endif #endif
} }
@ -328,7 +332,8 @@ void ConsoleListener::ClearScreen(bool Cursor)
GetConsoleScreenBufferInfo(hConsole, &csbi); GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
// Reset cursor // Reset cursor
if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); if (Cursor)
SetConsoleCursorPosition(hConsole, coordScreen);
#endif #endif
} }

View File

@ -130,7 +130,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
char temp[MAX_MSGLEN]; char temp[MAX_MSGLEN];
LogContainer *log = m_Log[type]; LogContainer *log = m_Log[type];
if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners()) if (!log->IsEnabled() || level > log->GetLevel() || !log->HasListeners())
return; return;
CharArrayFromFormatV(temp, MAX_MSGLEN, format, args); CharArrayFromFormatV(temp, MAX_MSGLEN, format, args);

View File

@ -109,10 +109,10 @@ void* AllocateMemoryPages(size_t size)
return ptr; return ptr;
} }
void* AllocateAlignedMemory(size_t size,size_t alignment) void* AllocateAlignedMemory(size_t size, size_t alignment)
{ {
#ifdef _WIN32 #ifdef _WIN32
void* ptr = _aligned_malloc(size,alignment); void* ptr = _aligned_malloc(size, alignment);
#else #else
void* ptr = nullptr; void* ptr = nullptr;
if (posix_memalign(&ptr, alignment, size) != 0) if (posix_memalign(&ptr, alignment, size) != 0)

View File

@ -74,7 +74,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args); CharArrayFromFormatV(buffer, sizeof(buffer) - 1, str_translator(format).c_str(), args);
va_end(args); va_end(args);
ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer); ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer);

View File

@ -45,14 +45,14 @@ size_t XEmitter::ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_align
ABI_CalculateFrameSize(mask, rsp_alignment, needed_frame_size, &shadow, &subtraction, &xmm_offset); ABI_CalculateFrameSize(mask, rsp_alignment, needed_frame_size, &shadow, &subtraction, &xmm_offset);
for (int r : mask & ABI_ALL_GPRS) for (int r : mask & ABI_ALL_GPRS)
PUSH((X64Reg) r); PUSH((X64Reg)r);
if (subtraction) if (subtraction)
SUB(64, R(RSP), subtraction >= 0x80 ? Imm32((u32)subtraction) : Imm8((u8)subtraction)); SUB(64, R(RSP), subtraction >= 0x80 ? Imm32((u32)subtraction) : Imm8((u8)subtraction));
for (int x : mask & ABI_ALL_FPRS) for (int x : mask & ABI_ALL_FPRS)
{ {
MOVAPD(MDisp(RSP, (int)xmm_offset), (X64Reg) (x - 16)); MOVAPD(MDisp(RSP, (int)xmm_offset), (X64Reg)(x - 16));
xmm_offset += 16; xmm_offset += 16;
} }
@ -76,7 +76,7 @@ void XEmitter::ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignmen
for (int r = 15; r >= 0; r--) for (int r = 15; r >= 0; r--)
{ {
if (mask[r]) if (mask[r])
POP((X64Reg) r); POP((X64Reg)r);
} }
} }

View File

@ -30,7 +30,7 @@ struct ModRM
ModRM(u8 modRM, u8 rex) ModRM(u8 modRM, u8 rex)
{ {
mod = modRM >> 6; mod = modRM >> 6;
reg = ((modRM >> 3) & 7) | ((rex & 4)?8:0); reg = ((modRM >> 3) & 7) | ((rex & 4) ? 8 : 0);
rm = modRM & 7; rm = modRM & 7;
} }
}; };

View File

@ -21,7 +21,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
#if defined _LP64 #if defined _LP64
// Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to // Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to
// restored at the end of the asm block. // restored at the end of the asm block.
__asm__ ( __asm__(
"cpuid;" "cpuid;"
"movl %%ebx,%1;" "movl %%ebx,%1;"
: "=a" (*eax), : "=a" (*eax),
@ -32,7 +32,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
: "rbx" : "rbx"
); );
#else #else
__asm__ ( __asm__(
"cpuid;" "cpuid;"
"movl %%ebx,%1;" "movl %%ebx,%1;"
: "=a" (*eax), : "=a" (*eax),
@ -219,7 +219,8 @@ void CPUInfo::Detect()
logical_cpu_count /= cores_x_package; logical_cpu_count /= cores_x_package;
} }
} }
} else }
else
{ {
// Use AMD's new method. // Use AMD's new method.
num_cores = (cpu_id[2] & 0xFF) + 1; num_cores = (cpu_id[2] & 0xFF) + 1;

View File

@ -186,7 +186,7 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
PanicAlert("%s IPL found in %s directory. The disc may not be recognized", ipl_region.c_str(), BootRegion.c_str()); PanicAlert("%s IPL found in %s directory. The disc may not be recognized", ipl_region.c_str(), BootRegion.c_str());
// Run the descrambler over the encrypted section containing BS1/BS2 // Run the descrambler over the encrypted section containing BS1/BS2
CEXIIPL::Descrambler((u8*)data.data()+0x100, 0x1AFE00); CEXIIPL::Descrambler((u8*)data.data() + 0x100, 0x1AFE00);
// TODO: Execution is supposed to start at 0xFFF00000, not 0x81200000; // TODO: Execution is supposed to start at 0xFFF00000, not 0x81200000;
// copying the initial boot code to 0x81200000 is a hack. // copying the initial boot code to 0x81200000 is a hack.

View File

@ -64,7 +64,7 @@ bool CBoot::Boot_ELF(const std::string& filename)
// Load ELF into GameCube Memory // Load ELF into GameCube Memory
ElfReader reader(elf.get()); ElfReader reader(elf.get());
if(!reader.LoadIntoMemory()) if (!reader.LoadIntoMemory())
return false; return false;
// Set up MSR and the BAT SPR registers. // Set up MSR and the BAT SPR registers.

View File

@ -28,9 +28,9 @@
static u32 state_checksum(u32 *buf, int len) static u32 state_checksum(u32 *buf, int len)
{ {
u32 checksum = 0; u32 checksum = 0;
len = len>>2; len = len >> 2;
for (int i=0; i<len; i++) for (int i = 0; i < len; i++)
{ {
checksum += buf[i]; checksum += buf[i];
} }
@ -59,7 +59,7 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
state_file.ReadBytes(&state, sizeof(StateFlags)); state_file.ReadBytes(&state, sizeof(StateFlags));
state.type = 0x03; // TYPE_RETURN state.type = 0x03; // TYPE_RETURN
state.checksum = state_checksum((u32*)&state.flags, sizeof(StateFlags)-4); state.checksum = state_checksum((u32*)&state.flags, sizeof(StateFlags) - 4);
state_file.Seek(0, SEEK_SET); state_file.Seek(0, SEEK_SET);
state_file.WriteBytes(&state, sizeof(StateFlags)); state_file.WriteBytes(&state, sizeof(StateFlags));
@ -69,10 +69,10 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
File::CreateFullPath(state_filename); File::CreateFullPath(state_filename);
File::IOFile state_file(state_filename, "a+b"); File::IOFile state_file(state_filename, "a+b");
StateFlags state; StateFlags state;
memset(&state,0,sizeof(StateFlags)); memset(&state, 0, sizeof(StateFlags));
state.type = 0x03; // TYPE_RETURN state.type = 0x03; // TYPE_RETURN
state.discstate = 0x01; // DISCSTATE_WII state.discstate = 0x01; // DISCSTATE_WII
state.checksum = state_checksum((u32*)&state.flags, sizeof(StateFlags)-4); state.checksum = state_checksum((u32*)&state.flags, sizeof(StateFlags) - 4);
state_file.WriteBytes(&state, sizeof(StateFlags)); state_file.WriteBytes(&state, sizeof(StateFlags));
} }

View File

@ -98,7 +98,7 @@ const char* ElfReader::GetSectionName(int section) const
// This is just a simple elf loader, good enough to load elfs generated by devkitPPC // This is just a simple elf loader, good enough to load elfs generated by devkitPPC
bool ElfReader::LoadIntoMemory() bool ElfReader::LoadIntoMemory()
{ {
DEBUG_LOG(MASTER_LOG,"String section: %i", header->e_shstrndx); DEBUG_LOG(MASTER_LOG, "String section: %i", header->e_shstrndx);
// Should we relocate? // Should we relocate?
bRelocate = (header->e_type != ET_EXEC); bRelocate = (header->e_type != ET_EXEC);
@ -109,7 +109,7 @@ bool ElfReader::LoadIntoMemory()
return false; return false;
} }
INFO_LOG(MASTER_LOG,"%i segments:", header->e_phnum); INFO_LOG(MASTER_LOG, "%i segments:", header->e_phnum);
// Copy segments into ram. // Copy segments into ram.
for (int i = 0; i < header->e_phnum; i++) for (int i = 0; i < header->e_phnum; i++)
@ -128,13 +128,13 @@ bool ElfReader::LoadIntoMemory()
Memory::CopyToEmu(writeAddr, src, srcSize); Memory::CopyToEmu(writeAddr, src, srcSize);
if (srcSize < dstSize) if (srcSize < dstSize)
Memory::Memset(writeAddr + srcSize, 0, dstSize-srcSize); //zero out bss Memory::Memset(writeAddr + srcSize, 0, dstSize - srcSize); //zero out bss
INFO_LOG(MASTER_LOG,"Loadable Segment Copied to %08x, size %08x", writeAddr, p->p_memsz); INFO_LOG(MASTER_LOG, "Loadable Segment Copied to %08x, size %08x", writeAddr, p->p_memsz);
} }
} }
INFO_LOG(MASTER_LOG,"Done loading."); INFO_LOG(MASTER_LOG, "Done loading.");
return true; return true;
} }

View File

@ -125,7 +125,7 @@ struct SConfig : NonCopyable
void LoadSettings(); void LoadSettings();
// Return the permanent and somewhat globally used instance of this struct // Return the permanent and somewhat globally used instance of this struct
static SConfig& GetInstance() {return(*m_Instance);} static SConfig& GetInstance() { return(*m_Instance); }
static void Init(); static void Init();
static void Shutdown(); static void Shutdown();

View File

@ -93,7 +93,6 @@ bool CCPU::IsStepping()
void CCPU::Reset() void CCPU::Reset()
{ {
} }
void CCPU::StepOpcode(Common::Event *event) void CCPU::StepOpcode(Common::Event *event)

View File

@ -52,33 +52,33 @@ void ROMUCode::HandleMail(u32 mail)
{ {
switch (m_next_parameter) switch (m_next_parameter)
{ {
case 0x80F3A001: case 0x80F3A001:
m_current_ucode.m_ram_address = mail; m_current_ucode.m_ram_address = mail;
break; break;
case 0x80F3A002: case 0x80F3A002:
m_current_ucode.m_length = mail & 0xffff; m_current_ucode.m_length = mail & 0xffff;
break; break;
case 0x80F3B002: case 0x80F3B002:
m_current_ucode.m_dmem_length = mail & 0xffff; m_current_ucode.m_dmem_length = mail & 0xffff;
if (m_current_ucode.m_dmem_length) if (m_current_ucode.m_dmem_length)
{ {
NOTICE_LOG(DSPHLE,"m_current_ucode.m_dmem_length = 0x%04x.", m_current_ucode.m_dmem_length); NOTICE_LOG(DSPHLE, "m_current_ucode.m_dmem_length = 0x%04x.", m_current_ucode.m_dmem_length);
} }
break; break;
case 0x80F3C002: case 0x80F3C002:
m_current_ucode.m_imem_address = mail & 0xffff; m_current_ucode.m_imem_address = mail & 0xffff;
break; break;
case 0x80F3D001: case 0x80F3D001:
m_current_ucode.m_start_pc = mail & 0xffff; m_current_ucode.m_start_pc = mail & 0xffff;
BootUCode(); BootUCode();
return; // Important! BootUCode indirectly does "delete this;". Must exit immediately. return; // Important! BootUCode indirectly does "delete this;". Must exit immediately.
default: default:
break; break;
} }
// THE GODDAMN OVERWRITE WAS HERE. Without the return above, since BootUCode may delete "this", well ... // THE GODDAMN OVERWRITE WAS HERE. Without the return above, since BootUCode may delete "this", well ...

View File

@ -154,13 +154,13 @@ private:
{ {
switch (m_crc) switch (m_crc)
{ {
case 0xb7eb9a9c: // Wii Pikmin - PAL case 0xb7eb9a9c: // Wii Pikmin - PAL
case 0xeaeb38cc: // Wii Pikmin 2 - PAL case 0xeaeb38cc: // Wii Pikmin 2 - PAL
case 0x6c3f6f94: // Wii Zelda TP - PAL case 0x6c3f6f94: // Wii Zelda TP - PAL
case 0xD643001F: // Super Mario Galaxy case 0xD643001F: // Super Mario Galaxy
return true; return true;
default: default:
return false; return false;
} }
} }
@ -171,13 +171,13 @@ private:
{ {
switch (m_crc) switch (m_crc)
{ {
case 0x6ba3b3ea: // IPL - PAL case 0x6ba3b3ea: // IPL - PAL
case 0x24b22038: // IPL - NTSC/NTSC-JAP case 0x24b22038: // IPL - NTSC/NTSC-JAP
case 0x42f64ac4: // Luigi's Mansion case 0x42f64ac4: // Luigi's Mansion
case 0x4be6a5cb: // AC, Pikmin NTSC case 0x4be6a5cb: // AC, Pikmin NTSC
return true; return true;
default: default:
return false; return false;
} }
} }
@ -189,11 +189,11 @@ private:
{ {
switch (m_crc) switch (m_crc)
{ {
case 0x56d36052: // Super Mario Sunshine case 0x56d36052: // Super Mario Sunshine
case 0x267fd05a: // Pikmin PAL case 0x267fd05a: // Pikmin PAL
return true; return true;
default: default:
return false; return false;
} }
} }

View File

@ -25,7 +25,7 @@ void ZeldaUCode::RenderSynth_RectWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
if (PB.NeedsReset) if (PB.NeedsReset)
{ {
PB.RemLength = PB.Length - PB.RestartPos; PB.RemLength = PB.Length - PB.RestartPos;
PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1); PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1);
PB.ReachedEnd = 0; PB.ReachedEnd = 0;
} }
@ -45,7 +45,7 @@ _lRestart:
{ {
PB.RestartPos = PB.LoopStartPos; PB.RestartPos = PB.LoopStartPos;
PB.RemLength = PB.Length - PB.RestartPos; PB.RemLength = PB.Length - PB.RestartPos;
PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1); PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1);
pos[1] = 0; pos[0] = 0; pos[1] = 0; pos[0] = 0;
} }
} }

View File

@ -461,7 +461,7 @@ void Decoder21_ReadAudio(ZeldaVoicePB &PB, int size, s16* _Buffer)
// ACC0 is the address // ACC0 is the address
// ACC1 is the read size // ACC1 is the read size
const u16* src = (u16*) Memory::GetPointer(ACC0 & Memory::RAM_MASK); const u16* src = (u16*)Memory::GetPointer(ACC0 & Memory::RAM_MASK);
for (u32 i = 0; i < (ACC1 >> 16); i++) for (u32 i = 0; i < (ACC1 >> 16); i++)
{ {

View File

@ -47,8 +47,8 @@ private:
u32 ROMDIS : 1; // ROM Disable u32 ROMDIS : 1; // ROM Disable
u32 :18; u32 :18;
}; };
UEXI_STATUS() {Hex = 0;} UEXI_STATUS() { Hex = 0; }
UEXI_STATUS(u32 _hex) {Hex = _hex;} UEXI_STATUS(u32 _hex) { Hex = _hex; }
}; };
// EXI Control Register // EXI Control Register
@ -86,7 +86,7 @@ private:
public: public:
// get device // get device
IEXIDevice* GetDevice(const u8 _CHIP_SELECT); IEXIDevice* GetDevice(const u8 _CHIP_SELECT);
IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex=-1); IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex = -1);
CEXIChannel(u32 ChannelId); CEXIChannel(u32 ChannelId);
~CEXIChannel(); ~CEXIChannel();
@ -96,7 +96,7 @@ public:
void SendTransferComplete(); void SendTransferComplete();
void AddDevice(const TEXIDevices device_type, const int device_num); void AddDevice(const TEXIDevices device_type, const int device_num);
void AddDevice(IEXIDevice* pDevice, const int device_num, bool notifyPresenceChanged=true); void AddDevice(IEXIDevice* pDevice, const int device_num, bool notifyPresenceChanged = true);
// Remove all devices // Remove all devices
void RemoveDevices(); void RemoveDevices();

View File

@ -36,7 +36,7 @@ u32 IEXIDevice::ImmRead(u32 _uSize)
{ {
u8 uByte = 0; u8 uByte = 0;
TransferByte(uByte); TransferByte(uByte);
uResult |= uByte << (24-(uPosition++ * 8)); uResult |= uByte << (24 - (uPosition++ * 8));
} }
return uResult; return uResult;
} }

View File

@ -123,7 +123,6 @@ void CEXIAgp::LoadFileToEEPROM(const std::string& filename)
m_eeprom_size = 0; m_eeprom_size = 0;
m_eeprom.clear(); m_eeprom.clear();
} }
} }
void CEXIAgp::SaveFileFromEEPROM(const std::string& filename) void CEXIAgp::SaveFileFromEEPROM(const std::string& filename)
@ -139,7 +138,7 @@ void CEXIAgp::SaveFileFromEEPROM(const std::string& filename)
{ {
u64 NewVal = ((u64*)(m_eeprom.data()))[index]; u64 NewVal = ((u64*)(m_eeprom.data()))[index];
for (u32 indexb = 0; indexb < 8; indexb++) for (u32 indexb = 0; indexb < 8; indexb++)
temp_eeprom[index * 8 + (7-indexb)] = (NewVal >> (indexb * 8)) & 0xFF; temp_eeprom[index * 8 + (7 - indexb)] = (NewVal >> (indexb * 8)) & 0xFF;
} }
pStream.WriteBytes(temp_eeprom.data(), m_eeprom_size); pStream.WriteBytes(temp_eeprom.data(), m_eeprom_size);
} }

View File

@ -59,7 +59,7 @@ void CEXIAMBaseboard::TransferByte(u8& _byte)
if ((m_position >= 2) && (m_command[0] == 0 && m_command[1] == 0)) if ((m_position >= 2) && (m_command[0] == 0 && m_command[1] == 0))
{ {
_byte = "\x06\x04\x10\x00"[(m_position-2)&3]; _byte = "\x06\x04\x10\x00"[(m_position - 2) & 3];
} }
else if (m_position == 3) else if (m_position == 3)
{ {

View File

@ -78,7 +78,7 @@ bool CEXIETHERNET::IsInterruptSet()
return !!(exi_status.interrupt & exi_status.interrupt_mask); return !!(exi_status.interrupt & exi_status.interrupt_mask);
} }
void CEXIETHERNET::ImmWrite(u32 data, u32 size) void CEXIETHERNET::ImmWrite(u32 data, u32 size)
{ {
data >>= (4 - size) * 8; data >>= (4 - size) * 8;

View File

@ -365,7 +365,7 @@ u32 CEXIIPL::GetGCTime()
// Get SRAM bias // Get SRAM bias
u32 Bias; u32 Bias;
for (int i=0; i<4; i++) for (int i = 0; i < 4; i++)
{ {
((u8*)&Bias)[i] = sram_dump[0xc + (i^3)]; ((u8*)&Bias)[i] = sram_dump[0xc + (i^3)];
} }

View File

@ -136,7 +136,6 @@ CEXIMemoryCard::CEXIMemoryCard(const int index, bool gciFolder)
void CEXIMemoryCard::SetupGciFolder(u16 sizeMb) void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
{ {
DiscIO::IVolume::ECountry CountryCode = DiscIO::IVolume::COUNTRY_UNKNOWN; DiscIO::IVolume::ECountry CountryCode = DiscIO::IVolume::COUNTRY_UNKNOWN;
auto strUniqueID = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID; auto strUniqueID = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID;
@ -315,14 +314,14 @@ void CEXIMemoryCard::SetCS(int cs)
if (m_uPosition >= 5) if (m_uPosition >= 5)
{ {
int count = m_uPosition - 5; int count = m_uPosition - 5;
int i=0; int i = 0;
status &= ~0x80; status &= ~0x80;
while (count--) while (count--)
{ {
memorycard->Write(address, 1, &(programming_buffer[i++])); memorycard->Write(address, 1, &(programming_buffer[i++]));
i &= 127; i &= 127;
address = (address & ~0x1FF) | ((address+1) & 0x1FF); address = (address & ~0x1FF) | ((address + 1) & 0x1FF);
} }
CmdDoneLater(5000); CmdDoneLater(5000);
@ -423,7 +422,7 @@ void CEXIMemoryCard::TransferByte(u8 &byte)
// after 9 bytes, we start incrementing the address, // after 9 bytes, we start incrementing the address,
// but only the sector offset - the pointer wraps around // but only the sector offset - the pointer wraps around
if (m_uPosition >= 9) if (m_uPosition >= 9)
address = (address & ~0x1FF) | ((address+1) & 0x1FF); address = (address & ~0x1FF) | ((address + 1) & 0x1FF);
} }
break; break;

View File

@ -17,7 +17,7 @@ public:
bool UseDelayedTransferCompletion() override; bool UseDelayedTransferCompletion() override;
bool IsPresent() override; bool IsPresent() override;
void DoState(PointerWrap &p) override; void DoState(PointerWrap &p) override;
IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex=-1) override; IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex = -1) override;
void DMARead(u32 _uAddr, u32 _uSize) override; void DMARead(u32 _uAddr, u32 _uSize) override;
void DMAWrite(u32 _uAddr, u32 _uSize) override; void DMAWrite(u32 _uAddr, u32 _uSize) override;

View File

@ -249,7 +249,7 @@ GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index)
std::string GCKeyboard::GetName() const std::string GCKeyboard::GetName() const
{ {
return std::string("GCKeyboard") + char('1'+m_index); return std::string("GCKeyboard") + char('1' + m_index);
} }
void GCKeyboard::GetInput(KeyboardStatus* const kb) void GCKeyboard::GetInput(KeyboardStatus* const kb)

View File

@ -55,7 +55,7 @@ bool CWiiSaveCrypted::ExportWiiSave(u64 title_id)
} }
else else
{ {
PanicAlertT("Export failed"); PanicAlertT("Export failed");
} }
return export_save.m_valid; return export_save.m_valid;
} }
@ -205,7 +205,7 @@ void CWiiSaveCrypted::WriteHDR()
std::string banner_file_path = m_wii_title_path + "banner.bin"; std::string banner_file_path = m_wii_title_path + "banner.bin";
u32 banner_size = static_cast<u32>(File::GetSize(banner_file_path)); u32 banner_size = static_cast<u32>(File::GetSize(banner_file_path));
m_header.hdr.BannerSize = Common::swap32(banner_size); m_header.hdr.BannerSize = Common::swap32(banner_size);
m_header.hdr.SaveGameTitle = Common::swap64(m_title_id); m_header.hdr.SaveGameTitle = Common::swap64(m_title_id);
memcpy(m_header.hdr.Md5, s_md5_blanker, 0x10); memcpy(m_header.hdr.Md5, s_md5_blanker, 0x10);
@ -391,7 +391,7 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
std::string name; std::string name;
memset(&file_hdr_tmp, 0, FILE_HDR_SZ); memset(&file_hdr_tmp, 0, FILE_HDR_SZ);
u32 file_size = 0; u32 file_size = 0;
if (File::IsDirectory(m_files_list[i])) if (File::IsDirectory(m_files_list[i]))
{ {
file_hdr_tmp.type = 2; file_hdr_tmp.type = 2;
@ -513,7 +513,7 @@ void CWiiSaveCrypted::do_sig()
generate_ecdsa(ap_sig, ap_sig + 30, ng_priv, hash); generate_ecdsa(ap_sig, ap_sig + 30, ng_priv, hash);
make_ec_cert(ap_cert, ap_sig, signer, name, ap_priv, 0); make_ec_cert(ap_cert, ap_sig, signer, name, ap_priv, 0);
data_size = Common::swap32(m_bk_hdr.sizeOfFiles) + 0x80; data_size = Common::swap32(m_bk_hdr.sizeOfFiles) + 0x80;
File::IOFile data_file(m_encrypted_save_path, "rb"); File::IOFile data_file(m_encrypted_save_path, "rb");
if (!data_file) if (!data_file)
@ -575,7 +575,7 @@ bool CWiiSaveCrypted::getPaths(bool for_export)
char game_id[5]; char game_id[5];
sprintf(game_id, "%c%c%c%c", sprintf(game_id, "%c%c%c%c",
(u8)(m_title_id >> 24) & 0xFF, (u8)(m_title_id >> 16) & 0xFF, (u8)(m_title_id >> 24) & 0xFF, (u8)(m_title_id >> 16) & 0xFF,
(u8)(m_title_id >> 8) & 0xFF, (u8)m_title_id & 0xFF); (u8)(m_title_id >> 8) & 0xFF, (u8)m_title_id & 0xFF);
if (!File::IsDirectory(m_wii_title_path)) if (!File::IsDirectory(m_wii_title_path))
{ {

View File

@ -43,7 +43,7 @@ void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid)
hid->deviceCommandAddress = 0; hid->deviceCommandAddress = 0;
} }
} }
timeToFill+=8; timeToFill += 8;
libusb_handle_events_timeout(nullptr, &tv); libusb_handle_events_timeout(nullptr, &tv);
} }
@ -175,13 +175,13 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
-4 Can't find device specified -4 Can't find device specified
*/ */
u32 dev_num = Memory::Read_U32(BufferIn+0x10); u32 dev_num = Memory::Read_U32(BufferIn + 0x10);
u8 bmRequestType = Memory::Read_U8(BufferIn+0x14); u8 bmRequestType = Memory::Read_U8(BufferIn + 0x14);
u8 bRequest = Memory::Read_U8(BufferIn+0x15); u8 bRequest = Memory::Read_U8(BufferIn + 0x15);
u16 wValue = Memory::Read_U16(BufferIn+0x16); u16 wValue = Memory::Read_U16(BufferIn + 0x16);
u16 wIndex = Memory::Read_U16(BufferIn+0x18); u16 wIndex = Memory::Read_U16(BufferIn + 0x18);
u16 wLength = Memory::Read_U16(BufferIn+0x1A); u16 wLength = Memory::Read_U16(BufferIn + 0x1A);
u32 data = Memory::Read_U32(BufferIn+0x1C); u32 data = Memory::Read_U32(BufferIn + 0x1C);
ReturnValue = HIDERR_NO_DEVICE_FOUND; ReturnValue = HIDERR_NO_DEVICE_FOUND;
@ -210,11 +210,11 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
case IOCTL_HID_INTERRUPT_OUT: case IOCTL_HID_INTERRUPT_OUT:
case IOCTL_HID_INTERRUPT_IN: case IOCTL_HID_INTERRUPT_IN:
{ {
u32 dev_num = Memory::Read_U32(BufferIn+0x10); u32 dev_num = Memory::Read_U32(BufferIn + 0x10);
u32 endpoint = Memory::Read_U32(BufferIn+0x14); u32 endpoint = Memory::Read_U32(BufferIn + 0x14);
u32 length = Memory::Read_U32(BufferIn+0x18); u32 length = Memory::Read_U32(BufferIn + 0x18);
u32 data = Memory::Read_U32(BufferIn+0x1C); u32 data = Memory::Read_U32(BufferIn + 0x1C);
ReturnValue = HIDERR_NO_DEVICE_FOUND; ReturnValue = HIDERR_NO_DEVICE_FOUND;

View File

@ -98,14 +98,14 @@ IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI"); INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI");
break; break;
case IOCTL_NWC24_EXEC_RESUME_SCHEDULAR : // NWC24iResumeForCloseLib case IOCTL_NWC24_EXEC_RESUME_SCHEDULAR: // NWC24iResumeForCloseLib
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_RESUME_SCHEDULAR - NI"); INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_RESUME_SCHEDULAR - NI");
Memory::Write_U32(0, BufferOut); // no error Memory::Write_U32(0, BufferOut); // no error
break; break;
case IOCTL_NWC24_STARTUP_SOCKET: // NWC24iStartupSocket case IOCTL_NWC24_STARTUP_SOCKET: // NWC24iStartupSocket
Memory::Write_U32(0, BufferOut); Memory::Write_U32(0, BufferOut);
Memory::Write_U32(0, BufferOut+4); Memory::Write_U32(0, BufferOut + 4);
ReturnValue = 0; ReturnValue = 0;
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI"); INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI");
break; break;
@ -126,7 +126,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
case IOCTL_NWC24_REQUEST_REGISTER_USER_ID: case IOCTL_NWC24_REQUEST_REGISTER_USER_ID:
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_REGISTER_USER_ID"); INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_REGISTER_USER_ID");
Memory::Write_U32(0, BufferOut); Memory::Write_U32(0, BufferOut);
Memory::Write_U32(0, BufferOut+4); Memory::Write_U32(0, BufferOut + 4);
break; break;
case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes) case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes)
@ -171,7 +171,6 @@ IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
{ {
Memory::Write_U32(WC24_ERR_FATAL, BufferOut); Memory::Write_U32(WC24_ERR_FATAL, BufferOut);
} }
} }
else if (config.CreationStage() == nwc24_config_t::NWC24_IDCS_GENERATED) else if (config.CreationStage() == nwc24_config_t::NWC24_IDCS_GENERATED)
{ {
@ -259,13 +258,13 @@ s32 CWII_IPC_HLE_Device_net_kd_request::NWC24MakeUserID(u64* nwc24_id, u32 holly
const u8 table2[8] = {0x1, 0x5, 0x0, 0x4, 0x2, 0x3, 0x6, 0x7}; const u8 table2[8] = {0x1, 0x5, 0x0, 0x4, 0x2, 0x3, 0x6, 0x7};
const u8 table1[16] = {0x4, 0xB, 0x7, 0x9, 0xF, 0x1, 0xD, 0x3, 0xC, 0x2, 0x6, 0xE, 0x8, 0x0, 0xA, 0x5}; const u8 table1[16] = {0x4, 0xB, 0x7, 0x9, 0xF, 0x1, 0xD, 0x3, 0xC, 0x2, 0x6, 0xE, 0x8, 0x0, 0xA, 0x5};
u64 mix_id = ((u64)area_code<<50) | ((u64)hardware_model<<47) | ((u64)hollywood_id<<15) | ((u64)id_ctr<<10); u64 mix_id = ((u64)area_code << 50) | ((u64)hardware_model << 47) | ((u64)hollywood_id << 15) | ((u64)id_ctr << 10);
u64 mix_id_copy1 = mix_id; u64 mix_id_copy1 = mix_id;
int ctr = 0; int ctr = 0;
for (ctr = 0; ctr <= 42; ctr++) for (ctr = 0; ctr <= 42; ctr++)
{ {
u64 value = mix_id >> (52-ctr); u64 value = mix_id >> (52 - ctr);
if (value & 1) if (value & 1)
{ {
value = 0x0000000000000635ULL << (42-ctr); value = 0x0000000000000635ULL << (42-ctr);
@ -274,12 +273,12 @@ s32 CWII_IPC_HLE_Device_net_kd_request::NWC24MakeUserID(u64* nwc24_id, u32 holly
} }
mix_id = (mix_id_copy1 | (mix_id & 0xFFFFFFFFUL)) ^ 0x0000B3B3B3B3B3B3ULL; mix_id = (mix_id_copy1 | (mix_id & 0xFFFFFFFFUL)) ^ 0x0000B3B3B3B3B3B3ULL;
mix_id = (mix_id >> 10) | ((mix_id & 0x3FF) << (11+32)); mix_id = (mix_id >> 10) | ((mix_id & 0x3FF) << (11 + 32));
for (ctr = 0; ctr <= 5; ctr++) for (ctr = 0; ctr <= 5; ctr++)
{ {
u8 ret = u64_get_byte(mix_id, ctr); u8 ret = u64_get_byte(mix_id, ctr);
u8 foobar = ((table1[(ret>>4)&0xF])<<4) | (table1[ret&0xF]); u8 foobar = ((table1[(ret >> 4) & 0xF]) << 4) | (table1[ret & 0xF]);
mix_id = u64_insert_byte(mix_id, ctr, foobar & 0xff); mix_id = u64_insert_byte(mix_id, ctr, foobar & 0xff);
} }
u64 mix_id_copy2 = mix_id; u64 mix_id_copy2 = mix_id;
@ -343,7 +342,7 @@ CWII_IPC_HLE_Device_net_ncd_manage::~CWII_IPC_HLE_Device_net_ncd_manage()
IPCCommandResult CWII_IPC_HLE_Device_net_ncd_manage::Open(u32 _CommandAddress, u32 _Mode) IPCCommandResult CWII_IPC_HLE_Device_net_ncd_manage::Open(u32 _CommandAddress, u32 _Mode)
{ {
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: Open"); INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: Open");
Memory::Write_U32(GetDeviceID(), _CommandAddress+4); Memory::Write_U32(GetDeviceID(), _CommandAddress + 4);
m_Active = true; m_Active = true;
return IPC_DEFAULT_REPLY; return IPC_DEFAULT_REPLY;
} }
@ -751,7 +750,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
u8 optval[20]; u8 optval[20];
u32 optlen = 4; u32 optlen = 4;
int ret = getsockopt (fd, nat_level, nat_optname, (char*) &optval, (socklen_t*)&optlen); int ret = getsockopt(fd, nat_level, nat_optname, (char*)&optval, (socklen_t*)&optlen);
ReturnValue = WiiSockMan::GetNetErrorCode(ret, "SO_GETSOCKOPT", false); ReturnValue = WiiSockMan::GetNetErrorCode(ret, "SO_GETSOCKOPT", false);
@ -782,7 +781,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
"BufferIn: (%08x, %i), BufferOut: (%08x, %i)" "BufferIn: (%08x, %i), BufferOut: (%08x, %i)"
"%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx", "%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx",
fd, level, optname, optlen, BufferIn, BufferInSize, BufferOut, BufferOutSize, optval[0], optval[1], optval[2], optval[3], fd, level, optname, optlen, BufferIn, BufferInSize, BufferOut, BufferOutSize, optval[0], optval[1], optval[2], optval[3],
optval[4], optval[5],optval[6], optval[7], optval[8], optval[9], optval[10], optval[11], optval[12], optval[13], optval[14], optval[4], optval[5], optval[6], optval[7], optval[8], optval[9], optval[10], optval[11], optval[12], optval[13], optval[14],
optval[15], optval[16], optval[17], optval[18], optval[19]); optval[15], optval[16], optval[17], optval[18], optval[19]);
//TODO: bug booto about this, 0x2005 most likely timeout related, default value on Wii is , 0x2001 is most likely tcpnodelay //TODO: bug booto about this, 0x2005 most likely timeout related, default value on Wii is , 0x2001 is most likely tcpnodelay
@ -935,7 +934,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
std::string address = Memory::GetString(BufferIn); std::string address = Memory::GetString(BufferIn);
INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETPTON " INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETPTON "
"(Translating: %s)", address.c_str()); "(Translating: %s)", address.c_str());
ReturnValue = inet_pton(address.c_str(), Memory::GetPointer(BufferOut+4)); ReturnValue = inet_pton(address.c_str(), Memory::GetPointer(BufferOut + 4));
break; break;
} }
@ -1117,7 +1116,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
goto default_; goto default_;
default: default:
INFO_LOG(WII_IPC_NET,"0x%x " INFO_LOG(WII_IPC_NET, "0x%x "
"BufferIn: (%08x, %i), BufferOut: (%08x, %i)", "BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
Command, BufferIn, BufferInSize, BufferOut, BufferOutSize); Command, BufferIn, BufferInSize, BufferOut, BufferOutSize);
default_: default_:
@ -1186,15 +1185,15 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
case IOCTLV_SO_GETINTERFACEOPT: case IOCTLV_SO_GETINTERFACEOPT:
{ {
param = Memory::Read_U32(_BufferIn); param = Memory::Read_U32(_BufferIn);
param2 = Memory::Read_U32(_BufferIn+4); param2 = Memory::Read_U32(_BufferIn + 4);
param3 = Memory::Read_U32(_BufferOut); param3 = Memory::Read_U32(_BufferOut);
param4 = Memory::Read_U32(_BufferOut2); param4 = Memory::Read_U32(_BufferOut2);
if (BufferOutSize >= 8) if (BufferOutSize >= 8)
{ {
param5 = Memory::Read_U32(_BufferOut+4); param5 = Memory::Read_U32(_BufferOut + 4);
} }
INFO_LOG(WII_IPC_NET,"IOCTLV_SO_GETINTERFACEOPT(%08X, %08X, %X, %X, %X) " INFO_LOG(WII_IPC_NET, "IOCTLV_SO_GETINTERFACEOPT(%08X, %08X, %X, %X, %X) "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i) ", "BufferIn: (%08x, %i), BufferIn2: (%08x, %i) ",
param, param2, param3, param4, param5, param, param2, param3, param4, param5,
_BufferIn, BufferInSize, _BufferIn2, BufferInSize2); _BufferIn, BufferInSize, _BufferIn2, BufferInSize2);
@ -1240,7 +1239,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
IPAddr dwDestAddr = (IPAddr)0x08080808; IPAddr dwDestAddr = (IPAddr)0x08080808;
// If successful, output some information from the data we received // If successful, output some information from the data we received
PIP_ADAPTER_ADDRESSES AdapterList = AdapterAddresses; PIP_ADAPTER_ADDRESSES AdapterList = AdapterAddresses;
if (GetBestInterface(dwDestAddr,&dwBestIfIndex) == NO_ERROR) if (GetBestInterface(dwDestAddr, &dwBestIfIndex) == NO_ERROR)
{ {
while (AdapterList) while (AdapterList)
{ {
@ -1270,7 +1269,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
address = 0x08080808; address = 0x08080808;
Memory::Write_U32(address, _BufferOut); Memory::Write_U32(address, _BufferOut);
Memory::Write_U32(0x08080404, _BufferOut+4); Memory::Write_U32(0x08080404, _BufferOut + 4);
break; break;
} }
case 0x1003: // error case 0x1003: // error
@ -1294,8 +1293,8 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
case 0x4003: // ip addr table case 0x4003: // ip addr table
Memory::Write_U32(0xC, _BufferOut2); Memory::Write_U32(0xC, _BufferOut2);
Memory::Write_U32(10 << 24 | 1 << 8 | 30, _BufferOut); Memory::Write_U32(10 << 24 | 1 << 8 | 30, _BufferOut);
Memory::Write_U32(255 << 24 | 255 << 16 | 255 << 8 | 0, _BufferOut+4); Memory::Write_U32(255 << 24 | 255 << 16 | 255 << 8 | 0, _BufferOut + 4);
Memory::Write_U32(10 << 24 | 0 << 16 | 255 << 8 | 255, _BufferOut+8); Memory::Write_U32(10 << 24 | 0 << 16 | 255 << 8 | 255, _BufferOut + 8);
break; break;
default: default:

View File

@ -189,7 +189,7 @@ private:
void DoSock(u32 _CommandAddress, NET_IOCTL type); void DoSock(u32 _CommandAddress, NET_IOCTL type);
void DoSock(u32 _CommandAddress, SSL_IOCTL type); void DoSock(u32 _CommandAddress, SSL_IOCTL type);
void Update(bool read, bool write, bool except); void Update(bool read, bool write, bool except);
bool IsValid() {return fd >= 0;} bool IsValid() { return fd >= 0; }
public: public:
WiiSocket() : fd(-1), nonBlock(false) {} WiiSocket() : fd(-1), nonBlock(false) {}
~WiiSocket(); ~WiiSocket();
@ -211,7 +211,7 @@ public:
void Update(); void Update();
static void EnqueueReply(u32 CommandAddress, s32 ReturnValue, IPCCommandType CommandType); static void EnqueueReply(u32 CommandAddress, s32 ReturnValue, IPCCommandType CommandType);
static void Convert(WiiSockAddrIn const & from, sockaddr_in& to); static void Convert(WiiSockAddrIn const & from, sockaddr_in& to);
static void Convert(sockaddr_in const & from, WiiSockAddrIn& to, s32 addrlen=-1); static void Convert(sockaddr_in const & from, WiiSockAddrIn& to, s32 addrlen = -1);
// NON-BLOCKING FUNCTIONS // NON-BLOCKING FUNCTIONS
s32 NewSocket(s32 af, s32 type, s32 protocol); s32 NewSocket(s32 af, s32 type, s32 protocol);
void AddSocket(s32 fd); void AddSocket(s32 fd);

View File

@ -81,7 +81,7 @@ void Interpreter::andi_rc(UGeckoInstruction _inst)
void Interpreter::andis_rc(UGeckoInstruction _inst) void Interpreter::andis_rc(UGeckoInstruction _inst)
{ {
rGPR[_inst.RA] = rGPR[_inst.RS] & ((u32)_inst.UIMM<<16); rGPR[_inst.RA] = rGPR[_inst.RS] & ((u32)_inst.UIMM << 16);
Helper_UpdateCR0(rGPR[_inst.RA]); Helper_UpdateCR0(rGPR[_inst.RA]);
} }

View File

@ -49,8 +49,8 @@ void Interpreter::ps_nabs(UGeckoInstruction _inst)
void Interpreter::ps_abs(UGeckoInstruction _inst) void Interpreter::ps_abs(UGeckoInstruction _inst)
{ {
riPS0(_inst.FD) = riPS0(_inst.FB) &~ (1ULL << 63); riPS0(_inst.FD) = riPS0(_inst.FB) & ~(1ULL << 63);
riPS1(_inst.FD) = riPS1(_inst.FB) &~ (1ULL << 63); riPS1(_inst.FD) = riPS1(_inst.FB) & ~(1ULL << 63);
if (_inst.Rc) if (_inst.Rc)
Helper_UpdateCR1(); Helper_UpdateCR1();

View File

@ -26,7 +26,6 @@ mffsx: 80036650 (huh?)
static void FPSCRtoFPUSettings(UReg_FPSCR fp) static void FPSCRtoFPUSettings(UReg_FPSCR fp)
{ {
FPURoundMode::SetRoundMode(fp.RN); FPURoundMode::SetRoundMode(fp.RN);
if (fp.VE || fp.OE || fp.UE || fp.ZE || fp.XE) if (fp.VE || fp.OE || fp.UE || fp.ZE || fp.XE)

View File

@ -82,7 +82,7 @@ public:
} }
void Flush(FlushMode mode = FLUSH_ALL, BitSet32 regsToFlush = BitSet32::AllTrue(32)); void Flush(FlushMode mode = FLUSH_ALL, BitSet32 regsToFlush = BitSet32::AllTrue(32));
void Flush(PPCAnalyst::CodeOp *op) {Flush();} void Flush(PPCAnalyst::CodeOp *op) { Flush(); }
int SanityCheck() const; int SanityCheck() const;
void KillImmediate(size_t preg, bool doLoad, bool makeDirty); void KillImmediate(size_t preg, bool doLoad, bool makeDirty);
@ -103,7 +103,7 @@ public:
if (IsBound(preg)) if (IsBound(preg))
return regs[preg].location.GetSimpleReg(); return regs[preg].location.GetSimpleReg();
PanicAlert("Not so simple - %u", (unsigned int) preg); PanicAlert("Not so simple - %u", (unsigned int)preg);
return Gen::INVALID_REG; return Gen::INVALID_REG;
} }
virtual Gen::OpArg GetDefaultLocation(size_t reg) const = 0; virtual Gen::OpArg GetDefaultLocation(size_t reg) const = 0;

View File

@ -136,9 +136,9 @@ void Jit64::bcx(UGeckoInstruction inst)
WriteExit(destination, inst.LK, js.compilerPC + 4); WriteExit(destination, inst.LK, js.compilerPC + 4);
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0) if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0)
SetJumpTarget( pConditionDontBranch ); SetJumpTarget(pConditionDontBranch);
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch ); SetJumpTarget(pCTRDontBranch);
if (!analyzer.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE)) if (!analyzer.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
{ {
@ -242,9 +242,9 @@ void Jit64::bclrx(UGeckoInstruction inst)
WriteBLRExit(); WriteBLRExit();
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0) if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0)
SetJumpTarget( pConditionDontBranch ); SetJumpTarget(pConditionDontBranch);
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch ); SetJumpTarget(pCTRDontBranch);
if (!analyzer.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE)) if (!analyzer.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
{ {

View File

@ -155,7 +155,7 @@ void Jit64::ps_sum(UGeckoInstruction inst)
int a = inst.FA; int a = inst.FA;
int b = inst.FB; int b = inst.FB;
int c = inst.FC; int c = inst.FC;
fpr.Lock(a,b,c,d); fpr.Lock(a, b, c, d);
switch (inst.SUBOP5) switch (inst.SUBOP5)
{ {
case 10: case 10:
@ -220,7 +220,7 @@ void Jit64::ps_mergeXX(UGeckoInstruction inst)
int d = inst.FD; int d = inst.FD;
int a = inst.FA; int a = inst.FA;
int b = inst.FB; int b = inst.FB;
fpr.Lock(a,b,d); fpr.Lock(a, b, d);
fpr.BindToRegister(d, d == a || d == b); fpr.BindToRegister(d, d == a || d == b);
switch (inst.SUBOP10) switch (inst.SUBOP10)
@ -310,7 +310,7 @@ void Jit64::ps_maddXX(UGeckoInstruction inst)
int d = inst.FD; int d = inst.FD;
bool fma = cpu_info.bFMA && !Core::g_want_determinism; bool fma = cpu_info.bFMA && !Core::g_want_determinism;
bool round_input = !jit->js.op->fprIsSingle[c]; bool round_input = !jit->js.op->fprIsSingle[c];
fpr.Lock(a,b,c,d); fpr.Lock(a, b, c, d);
if (fma) if (fma)
fpr.BindToRegister(b, true, false); fpr.BindToRegister(b, true, false);

View File

@ -146,18 +146,18 @@ static inline uint64_t __rdtsc()
{ {
uint32_t lo, hi; uint32_t lo, hi;
#ifdef _LP64 #ifdef _LP64
__asm__ __volatile__ ("xorl %%eax,%%eax \n cpuid" __asm__ __volatile__("xorl %%eax,%%eax \n cpuid"
::: "%rax", "%rbx", "%rcx", "%rdx"); ::: "%rax", "%rbx", "%rcx", "%rdx");
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo; return (uint64_t)hi << 32 | lo;
#else #else
__asm__ __volatile__ ( __asm__ __volatile__(
"xor %%eax,%%eax;" "xor %%eax,%%eax;"
"push %%ebx;" "push %%ebx;"
"cpuid;" "cpuid;"
"pop %%ebx;" "pop %%ebx;"
::: "%eax", "%ecx", "%edx"); ::: "%eax", "%ecx", "%edx");
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi));
#endif #endif
return (uint64_t)hi << 32 | lo; return (uint64_t)hi << 32 | lo;
} }

View File

@ -106,7 +106,7 @@ class JitBaseBlockCache
std::array<JitBlock, MAX_NUM_BLOCKS> blocks; std::array<JitBlock, MAX_NUM_BLOCKS> blocks;
int num_blocks; int num_blocks;
std::multimap<u32, int> links_to; std::multimap<u32, int> links_to;
std::map<std::pair<u32,u32>, u32> block_map; // (end_addr, start_addr) -> number std::map<std::pair<u32, u32>, u32> block_map; // (end_addr, start_addr) -> number
ValidBlockBitSet valid_block; ValidBlockBitSet valid_block;
bool m_initialized; bool m_initialized;

View File

@ -144,7 +144,7 @@ namespace PowerPC
else if (addr & ICACHE_EXRAM_BIT) else if (addr & ICACHE_EXRAM_BIT)
lookup_table_ex[(addr >> 5) & 0x1fffff] = t; lookup_table_ex[(addr >> 5) & 0x1fffff] = t;
else else
lookup_table[(addr>>5) & 0xfffff] = t; lookup_table[(addr >> 5) & 0xfffff] = t;
tags[set][t] = tag; tags[set][t] = tag;
valid[set] |= (1 << t); valid[set] |= (1 << t);
} }

View File

@ -47,7 +47,7 @@ static u8 default_NG_sig[] = {
void get_ng_cert(u8* ng_cert_out, u32 NG_id, u32 NG_key_id, const u8* NG_priv, const u8* NG_sig) void get_ng_cert(u8* ng_cert_out, u32 NG_id, u32 NG_key_id, const u8* NG_priv, const u8* NG_sig)
{ {
char name[64]; char name[64];
if ((NG_id==0)||(NG_key_id==0)||(NG_priv==nullptr)||(NG_sig==nullptr)) if ((NG_id == 0) || (NG_key_id == 0) || (NG_priv == nullptr) || (NG_sig == nullptr))
{ {
NG_id = default_NG_id; NG_id = default_NG_id;
NG_key_id = default_NG_key_id; NG_key_id = default_NG_key_id;
@ -78,7 +78,7 @@ void get_ap_sig_and_cert(u8 *sig_out, u8 *ap_cert_out, u64 title_id, u8 *data, u
char signer[64]; char signer[64];
char name[64]; char name[64];
if ((NG_id==0)||(NG_priv == nullptr)) if ((NG_id == 0) || (NG_priv == nullptr))
{ {
NG_priv = default_NG_priv; NG_priv = default_NG_priv;
NG_id = default_NG_id; NG_id = default_NG_id;
@ -91,14 +91,14 @@ void get_ap_sig_and_cert(u8 *sig_out, u8 *ap_cert_out, u64 title_id, u8 *data, u
// get_rand_bytes(ap_priv, 0x1e); // get_rand_bytes(ap_priv, 0x1e);
// ap_priv[0] &= 1; // ap_priv[0] &= 1;
memset(ap_cert_out+4, 0, 60); memset(ap_cert_out + 4, 0, 60);
sprintf(signer, "Root-CA00000001-MS00000002-NG%08x", NG_id); sprintf(signer, "Root-CA00000001-MS00000002-NG%08x", NG_id);
sprintf(name, "AP%08x%08x", (u32)(title_id>>32), (u32)(title_id&0xffffffff)); sprintf(name, "AP%08x%08x", (u32)(title_id >> 32), (u32)(title_id & 0xffffffff));
make_blanksig_ec_cert(ap_cert_out, signer, name, ap_priv, 0); make_blanksig_ec_cert(ap_cert_out, signer, name, ap_priv, 0);
sha1(ap_cert_out + 0x80, 0x100, hash); sha1(ap_cert_out + 0x80, 0x100, hash);
generate_ecdsa(ap_cert_out+4, ap_cert_out+34, NG_priv, hash); generate_ecdsa(ap_cert_out + 4, ap_cert_out + 34, NG_priv, hash);
sha1(data, data_size, hash); sha1(data, data_size, hash);
generate_ecdsa(sig_out, sig_out + 30, ap_priv, hash); generate_ecdsa(sig_out, sig_out + 30, ap_priv, hash);

View File

@ -68,7 +68,7 @@ GameFile::GameFile(const QString& fileName)
m_volume_names = VectorToStringList(volume->GetNames()); m_volume_names = VectorToStringList(volume->GetNames());
m_country = volume->GetCountry(); m_country = volume->GetCountry();
m_file_size = volume->GetRawSize(); m_file_size = volume->GetRawSize();
m_volume_size = volume->GetSize(); m_volume_size = volume->GetSize();

View File

@ -145,7 +145,7 @@ void DGameTracker::ScanForGames()
{ {
bool list = true; bool list = true;
switch(obj->GetCountry()) switch (obj->GetCountry())
{ {
case DiscIO::IVolume::COUNTRY_AUSTRALIA: case DiscIO::IVolume::COUNTRY_AUSTRALIA:
if (!SConfig::GetInstance().m_ListAustralia) if (!SConfig::GetInstance().m_ListAustralia)
@ -251,7 +251,6 @@ void DGameTracker::SelectLastBootedGame()
m_tree_widget->SelectGame(game); m_tree_widget->SelectGame(game);
break; break;
} }
} }
} }
} }

View File

@ -64,15 +64,15 @@ CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id,
EditCheatCode = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE); EditCheatCode = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);
UpdateTextCtrl(tempEntries); UpdateTextCtrl(tempEntries);
sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER|wxALL, 5); sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER | wxALL, 5);
sgEntry->Add(EditCheatName, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sgEntry->Add(EditCheatName, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND|wxALL, 5); sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND | wxALL, 5);
sgEntry->Add(EditCheatCode, wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5); sgEntry->Add(EditCheatCode, wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND | wxALL, 5);
sgEntry->AddGrowableCol(1); sgEntry->AddGrowableCol(1);
sgEntry->AddGrowableRow(1); sgEntry->AddGrowableRow(1);
sbEntry->Add(sgEntry, 1, wxEXPAND|wxALL); sbEntry->Add(sgEntry, 1, wxEXPAND | wxALL);
sEditCheat->Add(sbEntry, 1, wxEXPAND|wxALL, 5); sEditCheat->Add(sbEntry, 1, wxEXPAND | wxALL, 5);
sEditCheat->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 5); sEditCheat->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 5);
SetSizerAndFit(sEditCheat); SetSizerAndFit(sEditCheat);
@ -86,7 +86,7 @@ void CARCodeAddEdit::ChangeEntry(wxSpinEvent& event)
UpdateTextCtrl(currentCode); UpdateTextCtrl(currentCode);
} }
void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event)) void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED(event))
{ {
std::vector<ActionReplay::AREntry> decryptedLines; std::vector<ActionReplay::AREntry> decryptedLines;
std::vector<std::string> encryptedLines; std::vector<std::string> encryptedLines;
@ -95,7 +95,7 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
std::vector<std::string> userInputLines; std::vector<std::string> userInputLines;
SplitString(WxStrToStr(EditCheatCode->GetValue()), '\n', userInputLines); SplitString(WxStrToStr(EditCheatCode->GetValue()), '\n', userInputLines);
for (size_t i = 0; i < userInputLines.size(); i++) for (size_t i = 0; i < userInputLines.size(); i++)
{ {
// Make sure to ignore unneeded whitespace characters. // Make sure to ignore unneeded whitespace characters.
std::string line_str = StripSpaces(userInputLines[i]); std::string line_str = StripSpaces(userInputLines[i]);
@ -131,7 +131,7 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
// If the above-mentioned conditions weren't met, then something went wrong. // If the above-mentioned conditions weren't met, then something went wrong.
if (!PanicYesNoT("Unable to parse line %u of the entered AR code as a valid " if (!PanicYesNoT("Unable to parse line %u of the entered AR code as a valid "
"encrypted or decrypted code. Make sure you typed it correctly.\n" "encrypted or decrypted code. Make sure you typed it correctly.\n"
"Would you like to ignore this line and continue parsing?", (unsigned) (i + 1))) "Would you like to ignore this line and continue parsing?", (unsigned)(i + 1)))
{ {
return; return;
} }

View File

@ -15,11 +15,11 @@ class wxWindow;
class AboutDolphin : public wxDialog class AboutDolphin : public wxDialog
{ {
public: public:
AboutDolphin(wxWindow *parent, AboutDolphin(wxWindow *parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
const wxString &title = _("About Dolphin"), const wxString &title = _("About Dolphin"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE); long style = wxDEFAULT_DIALOG_STYLE);
}; };

View File

@ -42,7 +42,7 @@ CheatSearchTab::CheatSearchTab(wxWindow* const parent)
m_btn_next_scan->Disable(); m_btn_next_scan->Disable();
// data sizes radiobox // data sizes radiobox
std::array<wxString, 3> data_size_names = {{ _("8-bit"), _("16-bit"), _("32-bit") }}; std::array<wxString, 3> data_size_names = { { _("8-bit"), _("16-bit"), _("32-bit") } };
m_data_sizes = new wxRadioBox(this, wxID_ANY, _("Data Size"), wxDefaultPosition, wxDefaultSize, static_cast<int>(data_size_names.size()), data_size_names.data()); m_data_sizes = new wxRadioBox(this, wxID_ANY, _("Data Size"), wxDefaultPosition, wxDefaultSize, static_cast<int>(data_size_names.size()), data_size_names.data());
// Listbox for search results (shown in monospace font). // Listbox for search results (shown in monospace font).
@ -111,7 +111,7 @@ CheatSearchTab::CheatSearchTab(wxWindow* const parent)
// right sizer // right sizer
wxBoxSizer* const sizer_right = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const sizer_right = new wxBoxSizer(wxVERTICAL);
sizer_right->Add(m_data_sizes, 0, wxEXPAND | wxBOTTOM, 5); sizer_right->Add(m_data_sizes, 0, wxEXPAND | wxBOTTOM, 5);
sizer_right->Add(sizer_cheat_search_filter, 0, wxEXPAND | wxBOTTOM, 5); sizer_right->Add(sizer_cheat_search_filter, 0, wxEXPAND | wxBOTTOM, 5);
sizer_right->AddStretchSpacer(1); sizer_right->AddStretchSpacer(1);
sizer_right->Add(boxButtons, 0, wxTOP | wxEXPAND, 5); sizer_right->Add(boxButtons, 0, wxTOP | wxEXPAND, 5);
@ -124,7 +124,7 @@ CheatSearchTab::CheatSearchTab(wxWindow* const parent)
SetSizerAndFit(sizer_main); SetSizerAndFit(sizer_main);
} }
void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED (event)) void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED(event))
{ {
const u8* const memptr = Memory::m_pRAM; const u8* const memptr = Memory::m_pRAM;
if (memptr == nullptr) if (memptr == nullptr)
@ -174,7 +174,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
// 2 : greater-than // 2 : greater-than
// 4 : less-than // 4 : less-than
const int filters[] = {7, 6, 1, 2, 4}; const int filters[] = { 7, 6, 1, 2, 4 };
int filter_mask = filters[m_search_type->GetSelection()]; int filter_mask = filters[m_search_type->GetSelection()];
if (m_value_x_radiobtn.rad_oldvalue->GetValue()) // using old value comparison if (m_value_x_radiobtn.rad_oldvalue->GetValue()) // using old value comparison
@ -182,7 +182,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
for (CheatSearchResult& result : m_search_results) for (CheatSearchResult& result : m_search_results)
{ {
// with big endian, can just use memcmp for ><= comparison // with big endian, can just use memcmp for ><= comparison
int cmp_result = memcmp(memptr + result.address, &result.old_value,m_search_type_size); int cmp_result = memcmp(memptr + result.address, &result.old_value, m_search_type_size);
if (cmp_result < 0) if (cmp_result < 0)
cmp_result = 4; cmp_result = 4;
else else
@ -216,12 +216,12 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
// #ifdef LIL_ENDIAN :p // #ifdef LIL_ENDIAN :p
switch (m_search_type_size) switch (m_search_type_size)
{ {
case 1 : case 1:
break; break;
case 2 : case 2:
*(u16*)&user_x_val = Common::swap16((u8*)&user_x_val); *(u16*)&user_x_val = Common::swap16((u8*)&user_x_val);
break; break;
case 4 : case 4:
user_x_val = Common::swap32(user_x_val); user_x_val = Common::swap32(user_x_val);
break; break;
} }
@ -279,12 +279,12 @@ void CheatSearchTab::UpdateCheatSearchResultsList()
// #ifdef LIL_ENDIAN :p // #ifdef LIL_ENDIAN :p
switch (m_search_type_size) switch (m_search_type_size)
{ {
case 1 : case 1:
break; break;
case 2 : case 2:
*(u16*)&display_value = Common::swap16((u8*)&display_value); *(u16*)&display_value = Common::swap16((u8*)&display_value);
break; break;
case 4 : case 4:
display_value = Common::swap32(display_value); display_value = Common::swap32(display_value);
break; break;
} }

View File

@ -50,7 +50,6 @@ private:
{ {
wxRadioButton* rad_oldvalue; wxRadioButton* rad_oldvalue;
wxRadioButton* rad_uservalue; wxRadioButton* rad_uservalue;
} m_value_x_radiobtn; } m_value_x_radiobtn;
void UpdateCheatSearchResultsList(); void UpdateCheatSearchResultsList();

View File

@ -45,7 +45,7 @@
#include "DolphinWX/Cheats/GeckoCodeDiag.h" #include "DolphinWX/Cheats/GeckoCodeDiag.h"
wxCheatsWindow::wxCheatsWindow(wxWindow* const parent) wxCheatsWindow::wxCheatsWindow(wxWindow* const parent)
: wxDialog(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxDIALOG_NO_PARENT) : wxDialog(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxDIALOG_NO_PARENT)
{ {
// Create the GUI controls // Create the GUI controls
Init_ChildControls(); Init_ChildControls();
@ -109,12 +109,12 @@ void wxCheatsWindow::Init_ChildControls()
m_textctrl_log = new wxTextCtrl(m_tab_log, wxID_ANY, "", wxDefaultPosition, wxSize(100, -1), wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); m_textctrl_log = new wxTextCtrl(m_tab_log, wxID_ANY, "", wxDefaultPosition, wxSize(100, -1), wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
wxBoxSizer *HStrip1 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *HStrip1 = new wxBoxSizer(wxHORIZONTAL);
HStrip1->Add(m_checkbox_log_ar, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); HStrip1->Add(m_checkbox_log_ar, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
HStrip1->Add(button_updatelog, 0, wxALL, 5); HStrip1->Add(button_updatelog, 0, wxALL, 5);
wxBoxSizer *sTabLog = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sTabLog = new wxBoxSizer(wxVERTICAL);
sTabLog->Add(HStrip1, 0, wxALL, 5); sTabLog->Add(HStrip1, 0, wxALL, 5);
sTabLog->Add(m_textctrl_log, 1, wxALL|wxEXPAND, 5); sTabLog->Add(m_textctrl_log, 1, wxALL | wxEXPAND, 5);
m_tab_log->SetSizerAndFit(sTabLog); m_tab_log->SetSizerAndFit(sTabLog);
@ -140,12 +140,12 @@ void wxCheatsWindow::Init_ChildControls()
sButtons->Realize(); sButtons->Realize();
wxBoxSizer* const sMain = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_notebook_main, 1, wxEXPAND|wxALL, 5); sMain->Add(m_notebook_main, 1, wxEXPAND | wxALL, 5);
sMain->Add(sButtons, 0, wxRIGHT | wxBOTTOM | wxALIGN_RIGHT, 5); sMain->Add(sButtons, 0, wxRIGHT | wxBOTTOM | wxALIGN_RIGHT, 5);
SetSizerAndFit(sMain); SetSizerAndFit(sMain);
} }
void wxCheatsWindow::OnEvent_ButtonClose_Press(wxCommandEvent& WXUNUSED (event)) void wxCheatsWindow::OnEvent_ButtonClose_Press(wxCommandEvent& WXUNUSED(event))
{ {
Close(); Close();
} }
@ -206,7 +206,7 @@ void wxCheatsWindow::Load_GeckoCodes()
m_geckocode_panel->LoadCodes(m_gameini_default, m_gameini_local, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID(), true); m_geckocode_panel->LoadCodes(m_gameini_default, m_gameini_local, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID(), true);
} }
void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (event)) void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED(event))
{ {
using namespace ActionReplay; using namespace ActionReplay;
@ -231,7 +231,7 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
} }
} }
void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED (event)) void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED(event))
{ {
int index = m_checklistbox_cheats_list->GetSelection(); int index = m_checklistbox_cheats_list->GetSelection();
for (const ARCodeIndex& code_index : m_index_list) for (const ARCodeIndex& code_index : m_index_list)
@ -269,7 +269,7 @@ void wxCheatsWindow::OnEvent_ApplyChanges_Press(wxCommandEvent& ev)
ev.Skip(); ev.Skip();
} }
void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (event)) void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED(event))
{ {
m_textctrl_log->Clear(); m_textctrl_log->Clear();
for (const std::string& text : ActionReplay::GetSelfLog()) for (const std::string& text : ActionReplay::GetSelfLog())
@ -278,7 +278,7 @@ void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (eve
} }
} }
void wxCheatsWindow::OnEvent_CheckBoxEnableLogging_StateChange(wxCommandEvent& WXUNUSED (event)) void wxCheatsWindow::OnEvent_CheckBoxEnableLogging_StateChange(wxCommandEvent& WXUNUSED(event))
{ {
ActionReplay::EnableSelfLogging(m_checkbox_log_ar->IsChecked()); ActionReplay::EnableSelfLogging(m_checkbox_log_ar->IsChecked());
} }

View File

@ -629,7 +629,7 @@ void CConfigMain::CreateGUIControls()
// Audio page // Audio page
DSPEngine = new wxRadioBox(AudioPage, ID_DSPENGINE, _("DSP Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_DSPEngine, 0, wxRA_SPECIFY_ROWS); DSPEngine = new wxRadioBox(AudioPage, ID_DSPENGINE, _("DSP Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_DSPEngine, 0, wxRA_SPECIFY_ROWS);
DPL2Decoder = new wxCheckBox(AudioPage, ID_DPL2DECODER, _("Dolby Pro Logic II decoder")); DPL2Decoder = new wxCheckBox(AudioPage, ID_DPL2DECODER, _("Dolby Pro Logic II decoder"));
VolumeSlider = new wxSlider(AudioPage, ID_VOLUME, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL|wxSL_INVERSE); VolumeSlider = new wxSlider(AudioPage, ID_VOLUME, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
VolumeText = new wxStaticText(AudioPage, wxID_ANY, ""); VolumeText = new wxStaticText(AudioPage, wxID_ANY, "");
BackendSelection = new wxChoice(AudioPage, ID_BACKEND, wxDefaultPosition, wxDefaultSize, wxArrayBackends, 0, wxDefaultValidator, wxEmptyString); BackendSelection = new wxChoice(AudioPage, ID_BACKEND, wxDefaultPosition, wxDefaultSize, wxArrayBackends, 0, wxDefaultValidator, wxEmptyString);
Latency = new wxSpinCtrl(AudioPage, ID_LATENCY, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 30); Latency = new wxSpinCtrl(AudioPage, ID_LATENCY, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 30);
@ -649,24 +649,24 @@ void CConfigMain::CreateGUIControls()
sbAudioSettings->Add(DPL2Decoder, 0, wxALL, 5); sbAudioSettings->Add(DPL2Decoder, 0, wxALL, 5);
wxStaticBoxSizer *sbVolume = new wxStaticBoxSizer(wxVERTICAL, AudioPage, _("Volume")); wxStaticBoxSizer *sbVolume = new wxStaticBoxSizer(wxVERTICAL, AudioPage, _("Volume"));
sbVolume->Add(VolumeSlider, 1, wxLEFT|wxRIGHT, 13); sbVolume->Add(VolumeSlider, 1, wxLEFT | wxRIGHT, 13);
sbVolume->Add(VolumeText, 0, wxALIGN_CENTER|wxALL, 5); sbVolume->Add(VolumeText, 0, wxALIGN_CENTER | wxALL, 5);
wxGridBagSizer *sBackend = new wxGridBagSizer(); wxGridBagSizer *sBackend = new wxGridBagSizer();
sBackend->Add(TEXT_BOX(AudioPage, _("Audio Backend:")), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sBackend->Add(TEXT_BOX(AudioPage, _("Audio Backend:")), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBackend->Add(BackendSelection, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5); sBackend->Add(BackendSelection, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5);
sBackend->Add(TEXT_BOX(AudioPage, _("Latency:")), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sBackend->Add(TEXT_BOX(AudioPage, _("Latency:")), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBackend->Add(Latency, wxGBPosition(1, 1), wxDefaultSpan, wxALL, 5); sBackend->Add(Latency, wxGBPosition(1, 1), wxDefaultSpan, wxALL, 5);
wxStaticBoxSizer *sbBackend = new wxStaticBoxSizer(wxHORIZONTAL, AudioPage, _("Backend Settings")); wxStaticBoxSizer *sbBackend = new wxStaticBoxSizer(wxHORIZONTAL, AudioPage, _("Backend Settings"));
sbBackend->Add(sBackend, 0, wxEXPAND); sbBackend->Add(sBackend, 0, wxEXPAND);
wxBoxSizer *sAudio = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sAudio = new wxBoxSizer(wxHORIZONTAL);
sAudio->Add(sbAudioSettings, 1, wxEXPAND|wxALL, 5); sAudio->Add(sbAudioSettings, 1, wxEXPAND | wxALL, 5);
sAudio->Add(sbVolume, 0, wxEXPAND|wxALL, 5); sAudio->Add(sbVolume, 0, wxEXPAND | wxALL, 5);
sAudioPage = new wxBoxSizer(wxVERTICAL); sAudioPage = new wxBoxSizer(wxVERTICAL);
sAudioPage->Add(sAudio, 0, wxALL|wxEXPAND); sAudioPage->Add(sAudio, 0, wxALL | wxEXPAND);
sAudioPage->Add(sbBackend, 0, wxALL|wxEXPAND, 5); sAudioPage->Add(sbBackend, 0, wxALL | wxEXPAND, 5);
AudioPage->SetSizerAndFit(sAudioPage); AudioPage->SetSizerAndFit(sAudioPage);
@ -704,8 +704,8 @@ void CConfigMain::CreateGUIControls()
sGamecubeIPLSettings = new wxGridBagSizer(); sGamecubeIPLSettings = new wxGridBagSizer();
sGamecubeIPLSettings->Add(GCAlwaysHLE_BS2, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5); sGamecubeIPLSettings->Add(GCAlwaysHLE_BS2, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sGamecubeIPLSettings->Add(TEXT_BOX(GamecubePage, _("System Language:")), sGamecubeIPLSettings->Add(TEXT_BOX(GamecubePage, _("System Language:")),
wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(1, 1), wxDefaultSpan, wxLEFT|wxRIGHT|wxBOTTOM, 5); sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(1, 1), wxDefaultSpan, wxLEFT | wxRIGHT | wxBOTTOM, 5);
sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, _("IPL Settings")); sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, _("IPL Settings"));
sbGamecubeIPLSettings->Add(sGamecubeIPLSettings); sbGamecubeIPLSettings->Add(sGamecubeIPLSettings);
@ -714,16 +714,17 @@ void CConfigMain::CreateGUIControls()
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
{ {
sbGamecubeEXIDevSettings->Add(GCEXIDeviceText[i], wxGBPosition(i, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); sbGamecubeEXIDevSettings->Add(GCEXIDeviceText[i], wxGBPosition(i, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
sbGamecubeEXIDevSettings->Add(GCEXIDevice[i], wxGBPosition(i, 1), wxGBSpan(1, (i < 2)?1:2), wxALIGN_CENTER_VERTICAL); sbGamecubeEXIDevSettings->Add(GCEXIDevice[i], wxGBPosition(i, 1), wxGBSpan(1, (i < 2) ? 1 : 2), wxALIGN_CENTER_VERTICAL);
if (i < 2) sbGamecubeEXIDevSettings->Add(GCMemcardPath[i], wxGBPosition(i, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); if (i < 2)
sbGamecubeEXIDevSettings->Add(GCMemcardPath[i], wxGBPosition(i, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
if (NetPlay::IsNetPlayRunning()) if (NetPlay::IsNetPlayRunning())
GCEXIDevice[i]->Disable(); GCEXIDevice[i]->Disable();
} }
sbGamecubeDeviceSettings->Add(sbGamecubeEXIDevSettings, 0, wxALL, 5); sbGamecubeDeviceSettings->Add(sbGamecubeEXIDevSettings, 0, wxALL, 5);
sGamecubePage = new wxBoxSizer(wxVERTICAL); sGamecubePage = new wxBoxSizer(wxVERTICAL);
sGamecubePage->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5); sGamecubePage->Add(sbGamecubeIPLSettings, 0, wxEXPAND | wxALL, 5);
sGamecubePage->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5); sGamecubePage->Add(sbGamecubeDeviceSettings, 0, wxEXPAND | wxALL, 5);
GamecubePage->SetSizer(sGamecubePage); GamecubePage->SetSizer(sGamecubePage);
// Wii page // Wii page
@ -742,10 +743,10 @@ void CConfigMain::CreateGUIControls()
sWiiIPLSettings->Add(WiiScreenSaver, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5); sWiiIPLSettings->Add(WiiScreenSaver, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sWiiIPLSettings->Add(WiiPAL60, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5); sWiiIPLSettings->Add(WiiPAL60, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
sWiiIPLSettings->Add(TEXT_BOX(WiiPage, _("Aspect Ratio:")), sWiiIPLSettings->Add(TEXT_BOX(WiiPage, _("Aspect Ratio:")),
wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sWiiIPLSettings->Add(WiiAspectRatio, wxGBPosition(2, 1), wxDefaultSpan, wxALL, 5); sWiiIPLSettings->Add(WiiAspectRatio, wxGBPosition(2, 1), wxDefaultSpan, wxALL, 5);
sWiiIPLSettings->Add(TEXT_BOX(WiiPage, _("System Language:")), sWiiIPLSettings->Add(TEXT_BOX(WiiPage, _("System Language:")),
wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sWiiIPLSettings->Add(WiiSystemLang, wxGBPosition(3, 1), wxDefaultSpan, wxALL, 5); sWiiIPLSettings->Add(WiiSystemLang, wxGBPosition(3, 1), wxDefaultSpan, wxALL, 5);
sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, _("Misc Settings")); sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, _("Misc Settings"));
sbWiiIPLSettings->Add(sWiiIPLSettings); sbWiiIPLSettings->Add(sWiiIPLSettings);
@ -755,8 +756,8 @@ void CConfigMain::CreateGUIControls()
sbWiiDeviceSettings->Add(WiiKeyboard, 0, wxALL, 5); sbWiiDeviceSettings->Add(WiiKeyboard, 0, wxALL, 5);
sWiiPage = new wxBoxSizer(wxVERTICAL); sWiiPage = new wxBoxSizer(wxVERTICAL);
sWiiPage->Add(sbWiiIPLSettings, 0, wxEXPAND|wxALL, 5); sWiiPage->Add(sbWiiIPLSettings, 0, wxEXPAND | wxALL, 5);
sWiiPage->Add(sbWiiDeviceSettings, 0, wxEXPAND|wxALL, 5); sWiiPage->Add(sbWiiDeviceSettings, 0, wxEXPAND | wxALL, 5);
WiiPage->SetSizer(sWiiPage); WiiPage->SetSizer(sWiiPage);
@ -769,46 +770,46 @@ void CConfigMain::CreateGUIControls()
DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, _("Choose a default ISO:"), DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, _("Choose a default ISO:"),
_("All GC/Wii files (elf, dol, gcm, iso, wbfs, ciso, gcz, wad)") + wxString::Format("|*.elf;*.dol;*.gcm;*.iso;*.wbfs;*.ciso;*.gcz;*.wad|%s", wxGetTranslation(wxALL_FILES)), _("All GC/Wii files (elf, dol, gcm, iso, wbfs, ciso, gcz, wad)") + wxString::Format("|*.elf;*.dol;*.gcm;*.iso;*.wbfs;*.ciso;*.gcz;*.wad|%s", wxGetTranslation(wxALL_FILES)),
wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL | wxFLP_OPEN);
DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, _("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL); DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, _("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL);
ApploaderPath = new wxFilePickerCtrl(PathsPage, ID_APPLOADERPATH, wxEmptyString, _("Choose file to use as apploader: (applies to discs constructed from directories only)"), ApploaderPath = new wxFilePickerCtrl(PathsPage, ID_APPLOADERPATH, wxEmptyString, _("Choose file to use as apploader: (applies to discs constructed from directories only)"),
_("apploader (.img)") + wxString::Format("|*.img|%s", wxGetTranslation(wxALL_FILES)), _("apploader (.img)") + wxString::Format("|*.img|%s", wxGetTranslation(wxALL_FILES)),
wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL | wxFLP_OPEN);
NANDRoot = new wxDirPickerCtrl(PathsPage, ID_NANDROOT, wxEmptyString, _("Choose a NAND root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL); NANDRoot = new wxDirPickerCtrl(PathsPage, ID_NANDROOT, wxEmptyString, _("Choose a NAND root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL);
// Populate the settings // Populate the settings
wxBoxSizer* sISOButtons = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sISOButtons = new wxBoxSizer(wxHORIZONTAL);
sISOButtons->Add(RecursiveISOPath, 0, wxALL|wxALIGN_CENTER, 0); sISOButtons->Add(RecursiveISOPath, 0, wxALL | wxALIGN_CENTER, 0);
sISOButtons->AddStretchSpacer(); sISOButtons->AddStretchSpacer();
sISOButtons->Add(AddISOPath, 0, wxALL, 0); sISOButtons->Add(AddISOPath, 0, wxALL, 0);
sISOButtons->Add(RemoveISOPath, 0, wxALL, 0); sISOButtons->Add(RemoveISOPath, 0, wxALL, 0);
sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, _("ISO Directories")); sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, _("ISO Directories"));
sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0); sbISOPaths->Add(ISOPaths, 1, wxEXPAND | wxALL, 0);
sbISOPaths->Add(sISOButtons, 0, wxEXPAND|wxALL, 5); sbISOPaths->Add(sISOButtons, 0, wxEXPAND | wxALL, 5);
sOtherPaths = new wxGridBagSizer(); sOtherPaths = new wxGridBagSizer();
sOtherPaths->Add(TEXT_BOX(PathsPage, _("Default ISO:")), sOtherPaths->Add(TEXT_BOX(PathsPage, _("Default ISO:")),
wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
sOtherPaths->Add(TEXT_BOX(PathsPage, _("DVD Root:")), sOtherPaths->Add(TEXT_BOX(PathsPage, _("DVD Root:")),
wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
sOtherPaths->Add(TEXT_BOX(PathsPage, _("Apploader:")), sOtherPaths->Add(TEXT_BOX(PathsPage, _("Apploader:")),
wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
sOtherPaths->Add(TEXT_BOX(PathsPage, _("Wii NAND Root:")), sOtherPaths->Add(TEXT_BOX(PathsPage, _("Wii NAND Root:")),
wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sOtherPaths->Add(NANDRoot, wxGBPosition(3, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->Add(NANDRoot, wxGBPosition(3, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
sOtherPaths->AddGrowableCol(1); sOtherPaths->AddGrowableCol(1);
// Populate the Paths page // Populate the Paths page
sPathsPage = new wxBoxSizer(wxVERTICAL); sPathsPage = new wxBoxSizer(wxVERTICAL);
sPathsPage->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5); sPathsPage->Add(sbISOPaths, 1, wxEXPAND | wxALL, 5);
sPathsPage->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5); sPathsPage->Add(sOtherPaths, 0, wxEXPAND | wxALL, 5);
PathsPage->SetSizer(sPathsPage); PathsPage->SetSizer(sPathsPage);
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5); sMain->Add(Notebook, 1, wxEXPAND | wxALL, 5);
sMain->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); sMain->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
wxStaticBoxSizer* sbCPUOptions = new wxStaticBoxSizer(wxVERTICAL, AdvancedPage, _("CPU Options")); wxStaticBoxSizer* sbCPUOptions = new wxStaticBoxSizer(wxVERTICAL, AdvancedPage, _("CPU Options"));
@ -848,12 +849,12 @@ void CConfigMain::CreateGUIControls()
SetFocus(); SetFocus();
} }
void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event)) void CConfigMain::OnClose(wxCloseEvent& WXUNUSED(event))
{ {
EndModal((bRefreshList) ? wxID_OK : wxID_CANCEL); EndModal((bRefreshList) ? wxID_OK : wxID_CANCEL);
} }
void CConfigMain::OnOk(wxCommandEvent& WXUNUSED (event)) void CConfigMain::OnOk(wxCommandEvent& WXUNUSED(event))
{ {
Close(); Close();
@ -1100,7 +1101,7 @@ void CConfigMain::ChooseSlotPath(bool isSlotA, TEXIDevices device_type)
if (!memorycard.IsValid()) if (!memorycard.IsValid())
{ {
WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n" \ WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n" \
"is not a valid gamecube memory card file"), filename.c_str())); "is not a valid GameCube memory card file"), filename.c_str()));
return; return;
} }
} }
@ -1239,7 +1240,7 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
// Paths settings // Paths settings
// ------------------- // -------------------
void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event)) void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED(event))
{ {
RemoveISOPath->Enable(ISOPaths->GetSelection() != wxNOT_FOUND); RemoveISOPath->Enable(ISOPaths->GetSelection() != wxNOT_FOUND);
} }
@ -1282,28 +1283,28 @@ void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
SConfig::GetInstance().m_ISOFolder.push_back(WxStrToStr(ISOPaths->GetStrings()[i])); SConfig::GetInstance().m_ISOFolder.push_back(WxStrToStr(ISOPaths->GetStrings()[i]));
} }
void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event)) void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED(event))
{ {
SConfig::GetInstance().m_RecursiveISOFolder = RecursiveISOPath->IsChecked(); SConfig::GetInstance().m_RecursiveISOFolder = RecursiveISOPath->IsChecked();
bRefreshList = true; bRefreshList = true;
} }
void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event)) void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED(event))
{ {
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultISO = WxStrToStr(DefaultISO->GetPath()); SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultISO = WxStrToStr(DefaultISO->GetPath());
} }
void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event)) void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED(event))
{ {
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = WxStrToStr(DVDRoot->GetPath()); SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = WxStrToStr(DVDRoot->GetPath());
} }
void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event)) void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED(event))
{ {
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader = WxStrToStr(ApploaderPath->GetPath()); SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader = WxStrToStr(ApploaderPath->GetPath());
} }
void CConfigMain::NANDRootChanged(wxFileDirPickerEvent& WXUNUSED (event)) void CConfigMain::NANDRootChanged(wxFileDirPickerEvent& WXUNUSED(event))
{ {
std::string NANDPath = std::string NANDPath =
SConfig::GetInstance().m_NANDPath = SConfig::GetInstance().m_NANDPath =

View File

@ -266,7 +266,7 @@ private:
void AddRemoveISOPaths(wxCommandEvent& event); void AddRemoveISOPaths(wxCommandEvent& event);
void DefaultISOChanged(wxFileDirPickerEvent& event); void DefaultISOChanged(wxFileDirPickerEvent& event);
void DVDRootChanged(wxFileDirPickerEvent& event); void DVDRootChanged(wxFileDirPickerEvent& event);
void ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event)); void ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED(event));
void NANDRootChanged(wxFileDirPickerEvent& event); void NANDRootChanged(wxFileDirPickerEvent& event);
private: private:

View File

@ -115,7 +115,7 @@ void FifoPlayerDlg::CreateGUIControls()
m_FrameToLabel->Wrap(-1); m_FrameToLabel->Wrap(-1);
sFrameRange->Add(m_FrameToLabel, 0, wxALL, 5); sFrameRange->Add(m_FrameToLabel, 0, wxALL, 5);
m_FrameToCtrl = new wxSpinCtrl(m_PlayPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(-1,-1), wxSP_ARROW_KEYS, 0, 10, 0); m_FrameToCtrl = new wxSpinCtrl(m_PlayPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), wxSP_ARROW_KEYS, 0, 10, 0);
sFrameRange->Add(m_FrameToCtrl, 0, wxALL, 5); sFrameRange->Add(m_FrameToCtrl, 0, wxALL, 5);
sPlayPage->Add(sFrameRange, 0, wxEXPAND, 5); sPlayPage->Add(sFrameRange, 0, wxEXPAND, 5);
@ -475,9 +475,9 @@ void FifoPlayerDlg::OnBeginSearch(wxCommandEvent& event)
} }
const u8* const start_ptr = &fifo_frame.fifoData[frame.objectStarts[obj_idx]]; const u8* const start_ptr = &fifo_frame.fifoData[frame.objectStarts[obj_idx]];
const u8* const end_ptr = &fifo_frame.fifoData[frame.objectStarts[obj_idx+1]]; const u8* const end_ptr = &fifo_frame.fifoData[frame.objectStarts[obj_idx + 1]];
for (const u8* ptr = start_ptr; ptr < end_ptr-val_length+1; ++ptr) for (const u8* ptr = start_ptr; ptr < end_ptr - val_length + 1; ++ptr)
{ {
if (std::equal(search_val.begin(), search_val.end(), ptr)) if (std::equal(search_val.begin(), search_val.end(), ptr))
{ {
@ -490,7 +490,7 @@ void FifoPlayerDlg::OnBeginSearch(wxCommandEvent& event)
{ {
if (ptr < start_ptr + m_objectCmdOffsets[cmd_idx]) if (ptr < start_ptr + m_objectCmdOffsets[cmd_idx])
{ {
result.cmd_idx = cmd_idx-1; result.cmd_idx = cmd_idx - 1;
break; break;
} }
} }
@ -540,7 +540,7 @@ void FifoPlayerDlg::OnFindPreviousClick(wxCommandEvent& event)
{ {
if (it->cmd_idx < cur_cmd_index) if (it->cmd_idx < cur_cmd_index)
{ {
ChangeSearchResult(search_results.size()-1 - (it - search_results.rbegin())); ChangeSearchResult(search_results.size() - 1 - (it - search_results.rbegin()));
return; return;
} }
} }
@ -575,7 +575,7 @@ void FifoPlayerDlg::ChangeSearchResult(unsigned int result_idx)
OnObjectCmdListSelectionChanged(ev); OnObjectCmdListSelectionChanged(ev);
} }
m_findNext->Enable(result_idx+1 < search_results.size()); m_findNext->Enable(result_idx + 1 < search_results.size());
m_findPrevious->Enable(result_idx != 0); m_findPrevious->Enable(result_idx != 0);
} }
else if (search_results.size()) else if (search_results.size())
@ -747,7 +747,7 @@ void FifoPlayerDlg::OnObjectListSelectionChanged(wxCommandEvent& event)
void FifoPlayerDlg::OnObjectCmdListSelectionChanged(wxCommandEvent& event) void FifoPlayerDlg::OnObjectCmdListSelectionChanged(wxCommandEvent& event)
{ {
const int frame_idx = m_framesList->GetSelection(); const int frame_idx = m_framesList->GetSelection();
const int object_idx = m_objectsList->GetSelection(); const int object_idx = m_objectsList->GetSelection();
if (event.GetInt() == -1 || frame_idx == -1 || object_idx == -1) if (event.GetInt() == -1 || frame_idx == -1 || object_idx == -1)
{ {
@ -766,10 +766,10 @@ void FifoPlayerDlg::OnObjectCmdListSelectionChanged(wxCommandEvent& event)
{ {
std::string name; std::string name;
std::string desc; std::string desc;
GetBPRegInfo(cmddata+1, &name, &desc); GetBPRegInfo(cmddata + 1, &name, &desc);
newLabel = _("BP register "); newLabel = _("BP register ");
newLabel += (name.empty()) ? wxString::Format(_("UNKNOWN_%02X"), *(cmddata+1)) : StrToWxStr(name); newLabel += (name.empty()) ? wxString::Format(_("UNKNOWN_%02X"), *(cmddata + 1)) : StrToWxStr(name);
newLabel += ":\n"; newLabel += ":\n";
if (desc.empty()) if (desc.empty())

View File

@ -36,16 +36,16 @@ public:
private: private:
void CreateGUIControls(); void CreateGUIControls();
void OnPaint( wxPaintEvent& event ); void OnPaint(wxPaintEvent& event);
void OnFrameFrom( wxSpinEvent& event ); void OnFrameFrom(wxSpinEvent& event);
void OnFrameTo( wxSpinEvent& event ); void OnFrameTo(wxSpinEvent& event);
void OnObjectFrom( wxSpinEvent& event ); void OnObjectFrom(wxSpinEvent& event);
void OnObjectTo( wxSpinEvent& event ); void OnObjectTo(wxSpinEvent& event);
void OnCheckEarlyMemoryUpdates( wxCommandEvent& event ); void OnCheckEarlyMemoryUpdates(wxCommandEvent& event);
void OnRecordStop( wxCommandEvent& event ); void OnRecordStop(wxCommandEvent& event);
void OnSaveFile( wxCommandEvent& event ); void OnSaveFile(wxCommandEvent& event);
void OnNumFramesToRecord( wxSpinEvent& event ); void OnNumFramesToRecord(wxSpinEvent& event);
void OnCloseClick( wxCommandEvent& event ); void OnCloseClick(wxCommandEvent& event);
void OnBeginSearch(wxCommandEvent& event); void OnBeginSearch(wxCommandEvent& event);
void OnFindNextClick(wxCommandEvent& event); void OnFindNextClick(wxCommandEvent& event);

View File

@ -866,7 +866,7 @@ bool CFrame::UIHasFocus()
return (focusWindow != nullptr); return (focusWindow != nullptr);
} }
void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event)) void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED(event))
{ {
// Show all platforms and regions if... // Show all platforms and regions if...
// 1. All platforms are set to hide // 1. All platforms are set to hide
@ -1106,7 +1106,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
void CFrame::OnKeyUp(wxKeyEvent& event) void CFrame::OnKeyUp(wxKeyEvent& event)
{ {
if(Core::IsRunning() && (RendererHasFocus() || TASInputHasFocus())) if (Core::IsRunning() && (RendererHasFocus() || TASInputHasFocus()))
{ {
if (IsHotkey(event, HK_TOGGLE_THROTTLE)) if (IsHotkey(event, HK_TOGGLE_THROTTLE))
{ {
@ -1191,12 +1191,12 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
ToggleDisplayMode(enable_fullscreen); ToggleDisplayMode(enable_fullscreen);
#if defined(__APPLE__) #if defined(__APPLE__)
NSView *view = (NSView *) m_RenderFrame->GetHandle(); NSView *view = (NSView *)m_RenderFrame->GetHandle();
NSWindow *window = [view window]; NSWindow *window = [view window];
if (enable_fullscreen != RendererIsFullscreen()) if (enable_fullscreen != RendererIsFullscreen())
{ {
[window toggleFullScreen:nil]; [window toggleFullScreen : nil];
} }
#else #else
if (enable_fullscreen) if (enable_fullscreen)

View File

@ -335,7 +335,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
// Create the popup menu // Create the popup menu
wxMenu MenuPopup; wxMenu MenuPopup;
wxMenuItem* Item = new wxMenuItem(&MenuPopup, wxID_ANY, _("Select floating windows")); wxMenuItem* Item = new wxMenuItem(&MenuPopup, wxID_ANY, _("Select floating windows"));
MenuPopup.Append(Item); MenuPopup.Append(Item);
Item->Enable(false); Item->Enable(false);
MenuPopup.Append(new wxMenuItem(&MenuPopup)); MenuPopup.Append(new wxMenuItem(&MenuPopup));
@ -467,7 +467,7 @@ void CFrame::DoAddPage(wxWindow *Win, int i, bool Float)
if (!Win) return; if (!Win) return;
// Ensure accessor remains within valid bounds. // Ensure accessor remains within valid bounds.
if (i < 0 || i > GetNotebookCount()-1) if (i < 0 || i > GetNotebookCount() - 1)
i = 0; i = 0;
// The page was already previously added, no need to add it again. // The page was already previously added, no need to add it again.
@ -682,7 +682,7 @@ void CFrame::SetPaneSize()
// Convert percentages to pixel lengths // Convert percentages to pixel lengths
W = (W * iClientX) / 100; W = (W * iClientX) / 100;
H = (H * iClientY) / 100; H = (H * iClientY) / 100;
m_Mgr->GetAllPanes()[i].BestSize(W,H).MinSize(W,H); m_Mgr->GetAllPanes()[i].BestSize(W, H).MinSize(W, H);
j++; j++;
} }
@ -693,7 +693,7 @@ void CFrame::SetPaneSize()
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{ {
m_Mgr->GetAllPanes()[i].MinSize(-1,-1); m_Mgr->GetAllPanes()[i].MinSize(-1, -1);
} }
} }
} }
@ -842,7 +842,7 @@ void CFrame::SaveIniPerspectives()
{ {
STmp += Perspective.Name + ","; STmp += Perspective.Name + ",";
} }
STmp = STmp.substr(0, STmp.length()-1); STmp = STmp.substr(0, STmp.length() - 1);
IniFile::Section* perspectives = ini.GetOrCreateSection("Perspectives"); IniFile::Section* perspectives = ini.GetOrCreateSection("Perspectives");
perspectives->Set("Perspectives", STmp); perspectives->Set("Perspectives", STmp);
@ -862,8 +862,8 @@ void CFrame::SaveIniPerspectives()
SHeight += StringFromFormat("%i,", Perspective.Height[j]); SHeight += StringFromFormat("%i,", Perspective.Height[j]);
} }
// Remove the ending "," // Remove the ending ","
SWidth = SWidth.substr(0, SWidth.length()-1); SWidth = SWidth.substr(0, SWidth.length() - 1);
SHeight = SHeight.substr(0, SHeight.length()-1); SHeight = SHeight.substr(0, SHeight.length() - 1);
perspec_section->Set("Width", SWidth); perspec_section->Set("Width", SWidth);
perspec_section->Set("Height", SHeight); perspec_section->Set("Height", SHeight);

View File

@ -189,7 +189,7 @@ wxMenuBar* CFrame::CreateMenu()
loadMenu->Append(IDM_UNDO_SAVE_STATE, GetMenuLabel(HK_UNDO_SAVE_STATE)); loadMenu->Append(IDM_UNDO_SAVE_STATE, GetMenuLabel(HK_UNDO_SAVE_STATE));
saveMenu->AppendSeparator(); saveMenu->AppendSeparator();
loadMenu->Append(IDM_LOAD_STATE_FILE, GetMenuLabel(HK_LOAD_STATE_FILE)); loadMenu->Append(IDM_LOAD_STATE_FILE, GetMenuLabel(HK_LOAD_STATE_FILE));
loadMenu->Append(IDM_LOAD_SELECTED_SLOT, GetMenuLabel(HK_LOAD_STATE_SLOT_SELECTED)); loadMenu->Append(IDM_LOAD_SELECTED_SLOT, GetMenuLabel(HK_LOAD_STATE_SLOT_SELECTED));
loadMenu->Append(IDM_UNDO_LOAD_STATE, GetMenuLabel(HK_UNDO_LOAD_STATE)); loadMenu->Append(IDM_UNDO_LOAD_STATE, GetMenuLabel(HK_UNDO_LOAD_STATE));
loadMenu->AppendSeparator(); loadMenu->AppendSeparator();
@ -198,7 +198,7 @@ wxMenuBar* CFrame::CreateMenu()
{ {
loadMenu->Append(IDM_LOAD_SLOT_1 + i - 1, GetMenuLabel(HK_LOAD_STATE_SLOT_1 + i - 1)); loadMenu->Append(IDM_LOAD_SLOT_1 + i - 1, GetMenuLabel(HK_LOAD_STATE_SLOT_1 + i - 1));
saveMenu->Append(IDM_SAVE_SLOT_1 + i - 1, GetMenuLabel(HK_SAVE_STATE_SLOT_1 + i - 1)); saveMenu->Append(IDM_SAVE_SLOT_1 + i - 1, GetMenuLabel(HK_SAVE_STATE_SLOT_1 + i - 1));
slotSelectMenu->Append(IDM_SELECT_SLOT_1 + i - 1, GetMenuLabel(HK_SELECT_STATE_SLOT_1 + i -1)); slotSelectMenu->Append(IDM_SELECT_SLOT_1 + i - 1, GetMenuLabel(HK_SELECT_STATE_SLOT_1 + i - 1));
} }
loadMenu->AppendSeparator(); loadMenu->AppendSeparator();
@ -939,12 +939,12 @@ void CFrame::ToggleDisplayMode(bool bFullscreen)
if (bFullscreen && SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution != "Auto") if (bFullscreen && SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution != "Auto")
{ {
DEVMODE dmScreenSettings; DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings); dmScreenSettings.dmSize = sizeof(dmScreenSettings);
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(), sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(),
"%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight); "%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight);
dmScreenSettings.dmBitsPerPel = 32; dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar. // Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN); ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
@ -1424,7 +1424,7 @@ void CFrame::ClearStatusBar()
void CFrame::StatusBarMessage(const char * Text, ...) void CFrame::StatusBarMessage(const char * Text, ...)
{ {
const int MAX_BYTES = 1024*10; const int MAX_BYTES = 1024 * 10;
char Str[MAX_BYTES]; char Str[MAX_BYTES];
va_list ArgPtr; va_list ArgPtr;
va_start(ArgPtr, Text); va_start(ArgPtr, Text);
@ -1433,7 +1433,7 @@ void CFrame::StatusBarMessage(const char * Text, ...)
if (this->GetStatusBar()->IsEnabled()) if (this->GetStatusBar()->IsEnabled())
{ {
this->GetStatusBar()->SetStatusText(StrToWxStr(Str),0); this->GetStatusBar()->SetStatusText(StrToWxStr(Str), 0);
} }
} }

View File

@ -1028,7 +1028,7 @@ void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED (event))
void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED (event)) void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED (event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso) if (!iso)
return; return;
@ -1118,10 +1118,10 @@ bool CGameListCtrl::MultiCompressCB(const std::string& text, float percent, void
{ {
percent = (((float)m_currentItem) + percent) / (float)m_numberItem; percent = (((float)m_currentItem) + percent) / (float)m_numberItem;
wxString textString(StrToWxStr(StringFromFormat("%s (%i/%i) - %s", wxString textString(StrToWxStr(StringFromFormat("%s (%i/%i) - %s",
m_currentFilename.c_str(), (int)m_currentItem+1, m_currentFilename.c_str(), (int)m_currentItem + 1,
(int)m_numberItem, text.c_str()))); (int)m_numberItem, text.c_str())));
return ((wxProgressDialog*)arg)->Update((int)(percent*1000), textString); return ((wxProgressDialog*)arg)->Update((int)(percent * 1000), textString);
} }
void CGameListCtrl::OnMultiCompressISO(wxCommandEvent& /*event*/) void CGameListCtrl::OnMultiCompressISO(wxCommandEvent& /*event*/)
@ -1160,7 +1160,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
m_currentItem = 0; m_currentItem = 0;
m_numberItem = GetSelectedItemCount(); m_numberItem = GetSelectedItemCount();
for (u32 i=0; i < m_numberItem; i++) for (u32 i = 0; i < m_numberItem; i++)
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (iso->GetPlatform() == GameListItem::WII_WAD || iso->GetFileName().rfind(".wbfs") != std::string::npos) if (iso->GetPlatform() == GameListItem::WII_WAD || iso->GetFileName().rfind(".wbfs") != std::string::npos)
@ -1230,7 +1230,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
bool CGameListCtrl::CompressCB(const std::string& text, float percent, void* arg) bool CGameListCtrl::CompressCB(const std::string& text, float percent, void* arg)
{ {
return ((wxProgressDialog*)arg)-> return ((wxProgressDialog*)arg)->
Update((int)(percent*1000), StrToWxStr(text)); Update((int)(percent * 1000), StrToWxStr(text));
} }
void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED (event)) void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED (event))
@ -1374,7 +1374,7 @@ void CGameListCtrl::AutomaticColumnWidth()
void CGameListCtrl::UnselectAll() void CGameListCtrl::UnselectAll()
{ {
for (int i=0; i<GetItemCount(); i++) for (int i = 0; i < GetItemCount(); i++)
{ {
SetItemState(i, 0, wxLIST_STATE_SELECTED); SetItemState(i, 0, wxLIST_STATE_SELECTED);
} }

View File

@ -55,7 +55,7 @@ public:
const wxString& title = _("Properties"), const wxString& title = _("Properties"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
virtual ~CISOProperties(); virtual ~CISOProperties();
bool bRefreshList; bool bRefreshList;

View File

@ -131,7 +131,7 @@ class PlatformX11 : public Platform
XSetWMProtocols(dpy, win, wmProtocols, 1); XSetWMProtocols(dpy, win, wmProtocols, 1);
XMapRaised(dpy, win); XMapRaised(dpy, win);
XFlush(dpy); XFlush(dpy);
s_window_handle = (void*) win; s_window_handle = (void*)win;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
X11Utils::InhibitScreensaver(dpy, win, true); X11Utils::InhibitScreensaver(dpy, win, true);
@ -145,10 +145,10 @@ class PlatformX11 : public Platform
// make a blank cursor // make a blank cursor
Pixmap Blank; Pixmap Blank;
XColor DummyColor; XColor DummyColor;
char ZeroData[1] = {0}; char ZeroData[1] = { 0 };
Blank = XCreateBitmapFromData (dpy, win, ZeroData, 1, 1); Blank = XCreateBitmapFromData(dpy, win, ZeroData, 1, 1);
blankCursor = XCreatePixmapCursor(dpy, Blank, Blank, &DummyColor, &DummyColor, 0, 0); blankCursor = XCreatePixmapCursor(dpy, Blank, Blank, &DummyColor, &DummyColor, 0, 0);
XFreePixmap (dpy, Blank); XFreePixmap(dpy, Blank);
XDefineCursor(dpy, win, blankCursor); XDefineCursor(dpy, win, blankCursor);
} }
} }

View File

@ -38,21 +38,21 @@
#define ARROWS slot ? "" : ARROW[slot], slot ? ARROW[slot] : "" #define ARROWS slot ? "" : ARROW[slot], slot ? ARROW[slot] : ""
const u8 hdr[] = { const u8 hdr[] = {
0x42,0x4D, 0x42, 0x4D,
0x38,0x30,0x00,0x00, 0x38, 0x30, 0x00, 0x00,
0x00,0x00,0x00,0x00, 0x00, 0x00, 0x00, 0x00,
0x36,0x00,0x00,0x00, 0x36, 0x00, 0x00, 0x00,
0x28,0x00,0x00,0x00, 0x28, 0x00, 0x00, 0x00,
0x20,0x00,0x00,0x00, //W 0x20, 0x00, 0x00, 0x00, //W
0x20,0x00,0x00,0x00, //H 0x20, 0x00, 0x00, 0x00, //H
0x01,0x00, 0x01, 0x00,
0x20,0x00, 0x20, 0x00,
0x00,0x00,0x00,0x00, 0x00, 0x00, 0x00, 0x00,
0x02,0x30,0x00,0x00, //data size 0x02, 0x30, 0x00, 0x00, //data size
0x12,0x0B,0x00,0x00, 0x12, 0x0B, 0x00, 0x00,
0x12,0x0B,0x00,0x00, 0x12, 0x0B, 0x00, 0x00,
0x00,0x00,0x00,0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00 0x00, 0x00, 0x00, 0x00
}; };
static wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, u32 width, u32 height) static wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, u32 width, u32 height)
@ -61,28 +61,28 @@ static wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, u32 width, u32
u32 bytes = (stride*height) + sizeof(hdr); u32 bytes = (stride*height) + sizeof(hdr);
bytes = (bytes+3)&(~3); bytes = (bytes + 3)&(~3);
u8 *pdata = new u8[bytes]; u8 *pdata = new u8[bytes];
memcpy(pdata,hdr,sizeof(hdr)); memcpy(pdata, hdr, sizeof(hdr));
memset(pdata+sizeof(hdr),0,bytes-sizeof(hdr)); memset(pdata + sizeof(hdr), 0, bytes - sizeof(hdr));
u8 *pixelData = pdata + sizeof(hdr); u8 *pixelData = pdata + sizeof(hdr);
for (u32 y=0;y<height;y++) for (u32 y = 0; y < height; y++)
{ {
memcpy(pixelData+y*stride,data+(height-y-1)*stride,stride); memcpy(pixelData + y*stride, data + (height - y - 1)*stride, stride);
} }
*(u32*)(pdata+18) = width; *(u32*)(pdata + 18) = width;
*(u32*)(pdata+22) = height; *(u32*)(pdata + 22) = height;
*(u32*)(pdata+34) = bytes-sizeof(hdr); *(u32*)(pdata + 34) = bytes - sizeof(hdr);
wxMemoryInputStream is(pdata, bytes); wxMemoryInputStream is(pdata, bytes);
wxBitmap map(wxImage(is, wxBITMAP_TYPE_BMP, -1), -1); wxBitmap map(wxImage(is, wxBITMAP_TYPE_BMP, -1), -1);
delete [] pdata; delete[] pdata;
return map; return map;
} }
@ -114,8 +114,8 @@ END_EVENT_TABLE()
CMemcardManager::CMemcardManager(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) CMemcardManager::CMemcardManager(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
{ {
memoryCard[SLOT_A]=nullptr; memoryCard[SLOT_A] = nullptr;
memoryCard[SLOT_B]=nullptr; memoryCard[SLOT_B] = nullptr;
mcmSettings.twoCardsLoaded = false; mcmSettings.twoCardsLoaded = false;
if (!LoadSettings()) if (!LoadSettings())
@ -124,7 +124,7 @@ CMemcardManager::CMemcardManager(wxWindow* parent, wxWindowID id, const wxString
mcmSettings.usePages = true; mcmSettings.usePages = true;
for (int i = COLUMN_BANNER; i < NUMBER_OF_COLUMN; i++) for (int i = COLUMN_BANNER; i < NUMBER_OF_COLUMN; i++)
{ {
mcmSettings.column[i] = (i <= COLUMN_FIRSTBLOCK)? true:false; mcmSettings.column[i] = (i <= COLUMN_FIRSTBLOCK) ? true : false;
} }
} }
maxPages = (128 / itemsPerPage) - 1; maxPages = (128 / itemsPerPage) - 1;
@ -219,52 +219,52 @@ void CMemcardManager::CreateGUIControls()
m_PrevPage[slot] = new wxButton(this, ID_PREVPAGE_A + slot, _("Prev Page")); m_PrevPage[slot] = new wxButton(this, ID_PREVPAGE_A + slot, _("Prev Page"));
m_NextPage[slot] = new wxButton(this, ID_NEXTPAGE_A + slot, _("Next Page")); m_NextPage[slot] = new wxButton(this, ID_NEXTPAGE_A + slot, _("Next Page"));
t_Status[slot] = new wxStaticText(this, 0, wxEmptyString, wxDefaultPosition,wxDefaultSize, 0, wxEmptyString); t_Status[slot] = new wxStaticText(this, 0, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString);
wxBoxSizer * const sPages = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer * const sPages = new wxBoxSizer(wxHORIZONTAL);
sPages->Add(m_PrevPage[slot], 0, wxEXPAND|wxALL, 1); sPages->Add(m_PrevPage[slot], 0, wxEXPAND | wxALL, 1);
sPages->Add(t_Status[slot],0, wxEXPAND|wxALL, 5); sPages->Add(t_Status[slot], 0, wxEXPAND | wxALL, 5);
sPages->Add(0, 0, 1, wxEXPAND|wxALL, 0); sPages->Add(0, 0, 1, wxEXPAND|wxALL, 0);
sPages->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1); sPages->Add(m_NextPage[slot], 0, wxEXPAND | wxALL, 1);
m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot, m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot,
StrToWxStr(File::GetUserPath(D_GCUSER_IDX)), _("Choose a memory card:"), StrToWxStr(File::GetUserPath(D_GCUSER_IDX)), _("Choose a memory card:"),
_("GameCube Memory Cards (*.raw,*.gcp)") + wxString("|*.raw;*.gcp"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); _("GameCube Memory Cards (*.raw,*.gcp)") + wxString("|*.raw;*.gcp"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL | wxFLP_OPEN);
m_MemcardList[slot] = new CMemcardListCtrl(this, ID_MEMCARDLIST_A + slot, wxDefaultPosition, wxSize(350,400), m_MemcardList[slot] = new CMemcardListCtrl(this, ID_MEMCARDLIST_A + slot, wxDefaultPosition, wxSize(350, 400),
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL, mcmSettings); wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL, mcmSettings);
m_MemcardList[slot]->AssignImageList(new wxImageList(96,32),wxIMAGE_LIST_SMALL); m_MemcardList[slot]->AssignImageList(new wxImageList(96, 32), wxIMAGE_LIST_SMALL);
sMemcard[slot] = new wxStaticBoxSizer(wxVERTICAL, this, _("Memory Card") + wxString::Format(" %c", 'A' + slot)); sMemcard[slot] = new wxStaticBoxSizer(wxVERTICAL, this, _("Memory Card") + wxString::Format(" %c", 'A' + slot));
sMemcard[slot]->Add(m_MemcardPath[slot], 0, wxEXPAND|wxALL, 5); sMemcard[slot]->Add(m_MemcardPath[slot], 0, wxEXPAND | wxALL, 5);
sMemcard[slot]->Add(m_MemcardList[slot], 1, wxEXPAND|wxALL, 5); sMemcard[slot]->Add(m_MemcardList[slot], 1, wxEXPAND | wxALL, 5);
sMemcard[slot]->Add(sPages, 0, wxEXPAND|wxALL, 1); sMemcard[slot]->Add(sPages, 0, wxEXPAND | wxALL, 1);
} }
wxBoxSizer * const sButtons = new wxBoxSizer(wxVERTICAL); wxBoxSizer * const sButtons = new wxBoxSizer(wxVERTICAL);
sButtons->AddStretchSpacer(2); sButtons->AddStretchSpacer(2);
sButtons->Add(m_CopyFrom[SLOT_B], 0, wxEXPAND, 5); sButtons->Add(m_CopyFrom[SLOT_B], 0, wxEXPAND, 5);
sButtons->Add(m_CopyFrom[SLOT_A], 0, wxEXPAND, 5); sButtons->Add(m_CopyFrom[SLOT_A], 0, wxEXPAND, 5);
sButtons->AddStretchSpacer(1); sButtons->AddStretchSpacer(1);
sButtons->Add(m_SaveImport[SLOT_A], 0, wxEXPAND, 5); sButtons->Add(m_SaveImport[SLOT_A], 0, wxEXPAND, 5);
sButtons->Add(m_SaveExport[SLOT_A], 0, wxEXPAND, 5); sButtons->Add(m_SaveExport[SLOT_A], 0, wxEXPAND, 5);
sButtons->AddStretchSpacer(1); sButtons->AddStretchSpacer(1);
sButtons->Add(m_ConvertToGci, 0, wxEXPAND, 5); sButtons->Add(m_ConvertToGci, 0, wxEXPAND, 5);
sButtons->AddStretchSpacer(1); sButtons->AddStretchSpacer(1);
sButtons->Add(m_SaveImport[SLOT_B], 0, wxEXPAND, 5); sButtons->Add(m_SaveImport[SLOT_B], 0, wxEXPAND, 5);
sButtons->Add(m_SaveExport[SLOT_B], 0, wxEXPAND, 5); sButtons->Add(m_SaveExport[SLOT_B], 0, wxEXPAND, 5);
sButtons->AddStretchSpacer(1); sButtons->AddStretchSpacer(1);
sButtons->Add(m_Delete[SLOT_A], 0, wxEXPAND, 5); sButtons->Add(m_Delete[SLOT_A], 0, wxEXPAND, 5);
sButtons->Add(m_Delete[SLOT_B], 0, wxEXPAND, 5); sButtons->Add(m_Delete[SLOT_B], 0, wxEXPAND, 5);
sButtons->AddStretchSpacer(); sButtons->AddStretchSpacer();
sButtons->Add(new wxButton(this, wxID_OK, _("Close")), 0, wxEXPAND, 5); sButtons->Add(new wxButton(this, wxID_OK, _("Close")), 0, wxEXPAND, 5);
sButtons->AddStretchSpacer(); sButtons->AddStretchSpacer();
wxBoxSizer * const sMain = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer * const sMain = new wxBoxSizer(wxHORIZONTAL);
sMain->Add(sMemcard[SLOT_A], 1, wxEXPAND|wxALL, 5); sMain->Add(sMemcard[SLOT_A], 1, wxEXPAND | wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 0); sMain->Add(sButtons, 0, wxEXPAND, 0);
sMain->Add(sMemcard[SLOT_B], 1, wxEXPAND|wxALL, 5); sMain->Add(sMemcard[SLOT_B], 1, wxEXPAND | wxALL, 5);
SetSizerAndFit(sMain); SetSizerAndFit(sMain);
Center(); Center();
@ -549,7 +549,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
wxString temp2 = wxFileSelector(_("Save GCI as..."), wxString temp2 = wxFileSelector(_("Save GCI as..."),
wxEmptyString, wxEmptyString, ".gci", wxEmptyString, wxEmptyString, ".gci",
_("GCI File(*.gci)") + wxString("|*.gci"), _("GCI File(*.gci)") + wxString("|*.gci"),
wxFD_OVERWRITE_PROMPT|wxFD_SAVE, this); wxFD_OVERWRITE_PROMPT | wxFD_SAVE, this);
if (temp2.empty()) if (temp2.empty())
break; break;
@ -563,7 +563,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
} }
break; break;
case ID_SAVEEXPORT_A: case ID_SAVEEXPORT_A:
slot=SLOT_A; slot = SLOT_A;
index = index_A; index = index_A;
case ID_SAVEEXPORT_B: case ID_SAVEEXPORT_B:
index = memoryCard[slot]->GetFileIndex(index); index = memoryCard[slot]->GetFileIndex(index);
@ -582,7 +582,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
_("Native GCI files(*.gci)") + wxString("|*.gci|") + _("Native GCI files(*.gci)") + wxString("|*.gci|") +
_("MadCatz Gameshark files(*.gcs)") + wxString("|*.gcs|") + _("MadCatz Gameshark files(*.gcs)") + wxString("|*.gcs|") +
_("Datel MaxDrive/Pro files(*.sav)") + wxString("|*.sav"), _("Datel MaxDrive/Pro files(*.sav)") + wxString("|*.sav"),
wxFD_OVERWRITE_PROMPT|wxFD_SAVE, this); wxFD_OVERWRITE_PROMPT | wxFD_SAVE, this);
if (fileName.length() > 0) if (fileName.length() > 0)
{ {
@ -594,7 +594,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
} }
break; break;
case ID_EXPORTALL_A: case ID_EXPORTALL_A:
slot=SLOT_A; slot = SLOT_A;
case ID_EXPORTALL_B: case ID_EXPORTALL_B:
{ {
std::string path1, path2, mpath; std::string path1, path2, mpath;
@ -661,9 +661,9 @@ bool CMemcardManager::ReloadMemcard(const std::string& fileName, int card)
list->RemoveAll(); list->RemoveAll();
u8 nFiles = memoryCard[card]->GetNumFiles(); u8 nFiles = memoryCard[card]->GetNumFiles();
int *images = new int[nFiles*2]; int *images = new int[nFiles * 2];
for (u8 i = 0;i < nFiles;i++) for (u8 i = 0; i < nFiles; i++)
{ {
static u32 pxdata[96*32]; static u32 pxdata[96*32];
static u8 animDelay[8]; static u8 animDelay[8];
@ -674,45 +674,45 @@ bool CMemcardManager::ReloadMemcard(const std::string& fileName, int card)
if (!memoryCard[card]->ReadBannerRGBA8(fileIndex, pxdata)) if (!memoryCard[card]->ReadBannerRGBA8(fileIndex, pxdata))
{ {
memset(pxdata,0,96*32*4); memset(pxdata, 0, 96*32*4);
if (numFrames>0) // Just use the first one if (numFrames > 0) // Just use the first one
{ {
u32 *icdata = animData; u32 *icdata = animData;
for (int y=0;y<32;y++) for (int y = 0; y < 32; y++)
{ {
for (int x=0;x<32;x++) for (int x = 0; x < 32; x++)
{ {
pxdata[y*96+x+32] = icdata[y*32+x];// | 0xFF000000 pxdata[y*96 + x + 32] = icdata[y*32 + x];// | 0xFF000000
} }
} }
} }
} }
wxBitmap map = wxBitmapFromMemoryRGBA((u8*)pxdata,96,32); wxBitmap map = wxBitmapFromMemoryRGBA((u8*)pxdata, 96, 32);
images[i*2] = list->Add(map); images[i*2] = list->Add(map);
if (numFrames>0) if (numFrames > 0)
{ {
memset(pxdata,0,96*32*4); memset(pxdata, 0, 96*32*4);
int frames=3; int frames = 3;
if (numFrames<frames) if (numFrames < frames)
frames=numFrames; frames = numFrames;
for (int f=0;f<frames;f++) for (int f = 0; f < frames; f++)
{ {
for (int y=0;y<32;y++) for (int y = 0; y < 32; y++)
{ {
for (int x=0;x<32;x++) for (int x = 0; x < 32; x++)
{ {
pxdata[y*96 + x + 32*f] = animData[f*32*32 + y*32 + x]; pxdata[y*96 + x + 32*f] = animData[f*32*32 + y*32 + x];
} }
} }
} }
wxBitmap icon = wxBitmapFromMemoryRGBA((u8*)pxdata,96,32); wxBitmap icon = wxBitmapFromMemoryRGBA((u8*)pxdata, 96, 32);
images[i*2+1] = list->Add(icon); images[i*2 + 1] = list->Add(icon);
} }
} }
@ -748,7 +748,7 @@ bool CMemcardManager::ReloadMemcard(const std::string& fileName, int card)
blocks = 0; blocks = 0;
wxBlock.Printf("%10d", blocks); wxBlock.Printf("%10d", blocks);
m_MemcardList[card]->SetItem(index,COLUMN_BLOCKS, wxBlock); m_MemcardList[card]->SetItem(index, COLUMN_BLOCKS, wxBlock);
firstblock = memoryCard[card]->DEntry_FirstBlock(fileIndex); firstblock = memoryCard[card]->DEntry_FirstBlock(fileIndex);
//if (firstblock == 0xFFFF) firstblock = 3; // to make firstblock -1 //if (firstblock == 0xFFFF) firstblock = 3; // to make firstblock -1
wxFirstBlock.Printf("%15d", firstblock); wxFirstBlock.Printf("%15d", firstblock);
@ -758,7 +758,7 @@ bool CMemcardManager::ReloadMemcard(const std::string& fileName, int card)
if (images[j] >= 0) if (images[j] >= 0)
{ {
m_MemcardList[card]->SetItemImage(index, images[j*2]); m_MemcardList[card]->SetItemImage(index, images[j*2]);
m_MemcardList[card]->SetItemColumnImage(index, COLUMN_ICON, images[j*2+1]); m_MemcardList[card]->SetItemColumnImage(index, COLUMN_ICON, images[j*2 + 1]);
} }
} }
@ -804,7 +804,6 @@ bool CMemcardManager::ReloadMemcard(const std::string& fileName, int card)
void CMemcardManager::CMemcardListCtrl::OnRightClick(wxMouseEvent& event) void CMemcardManager::CMemcardListCtrl::OnRightClick(wxMouseEvent& event)
{ {
int flags; int flags;
long item = HitTest(event.GetPosition(), flags); long item = HitTest(event.GetPosition(), flags);
wxMenu popupMenu; wxMenu popupMenu;
@ -813,7 +812,7 @@ void CMemcardManager::CMemcardListCtrl::OnRightClick(wxMouseEvent& event)
{ {
if (GetItemState(item, wxLIST_STATE_SELECTED) != wxLIST_STATE_SELECTED) if (GetItemState(item, wxLIST_STATE_SELECTED) != wxLIST_STATE_SELECTED)
{ {
SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
} }
SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);

View File

@ -68,7 +68,7 @@ static std::string BuildGameName(const GameListItem& game)
static void FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list) static void FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list)
{ {
for (u32 i = 0 ; auto game = game_list.GetISO(i); ++i) for (u32 i = 0; auto game = game_list.GetISO(i); ++i)
game_lbox->Append(StrToWxStr(BuildGameName(*game))); game_lbox->Append(StrToWxStr(BuildGameName(*game)));
} }
@ -373,7 +373,7 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game
m_start_btn->Bind(wxEVT_BUTTON, &NetPlayDiag::OnStart, this); m_start_btn->Bind(wxEVT_BUTTON, &NetPlayDiag::OnStart, this);
bottom_szr->Add(m_start_btn); bottom_szr->Add(m_start_btn);
bottom_szr->Add(new wxStaticText(panel, wxID_ANY, _("Buffer:")), 0, wxLEFT | wxCENTER, 5 ); bottom_szr->Add(new wxStaticText(panel, wxID_ANY, _("Buffer:")), 0, wxLEFT | wxCENTER, 5);
wxSpinCtrl* const padbuf_spin = new wxSpinCtrl(panel, wxID_ANY, std::to_string(INITIAL_PAD_BUFFER_SIZE) wxSpinCtrl* const padbuf_spin = new wxSpinCtrl(panel, wxID_ANY, std::to_string(INITIAL_PAD_BUFFER_SIZE)
, wxDefaultPosition, wxSize(64, -1), wxSP_ARROW_KEYS, 0, 200, INITIAL_PAD_BUFFER_SIZE); , wxDefaultPosition, wxSize(64, -1), wxSP_ARROW_KEYS, 0, 200, INITIAL_PAD_BUFFER_SIZE);
padbuf_spin->Bind(wxEVT_SPINCTRL, &NetPlayDiag::OnAdjustBuffer, this); padbuf_spin->Bind(wxEVT_SPINCTRL, &NetPlayDiag::OnAdjustBuffer, this);
@ -447,7 +447,7 @@ void NetPlayDiag::GetNetSettings(NetSettings &settings)
std::string NetPlayDiag::FindGame() std::string NetPlayDiag::FindGame()
{ {
// find path for selected game, sloppy.. // find path for selected game, sloppy..
for (u32 i = 0 ; auto game = m_game_list->GetISO(i); ++i) for (u32 i = 0; auto game = m_game_list->GetISO(i); ++i)
if (m_selected_game == BuildGameName(*game)) if (m_selected_game == BuildGameName(*game))
return game->GetFileName(); return game->GetFileName();
@ -573,7 +573,7 @@ void NetPlayDiag::OnThread(wxThreadEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case NP_GUI_EVT_CHANGE_GAME : case NP_GUI_EVT_CHANGE_GAME:
// update selected game :/ // update selected game :/
{ {
m_selected_game.assign(WxStrToStr(event.GetString())); m_selected_game.assign(WxStrToStr(event.GetString()));
@ -690,7 +690,7 @@ void ChangeGameDiag::OnPick(wxCommandEvent& event)
PadMapDiag::PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiimotemap[], std::vector<const Player *>& player_list) PadMapDiag::PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiimotemap[], std::vector<const Player *>& player_list)
: wxDialog(parent, wxID_ANY, _("Configure Pads")) : wxDialog(parent, wxID_ANY, _("Configure Pads"))
, m_mapping(map) , m_mapping(map)
, m_wiimapping (wiimotemap) , m_wiimapping(wiimotemap)
, m_player_list(player_list) , m_player_list(player_list)
{ {
wxBoxSizer* const h_szr = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const h_szr = new wxBoxSizer(wxHORIZONTAL);
@ -701,11 +701,11 @@ PadMapDiag::PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiim
for (auto& player : m_player_list) for (auto& player : m_player_list)
player_names.Add(player->name); player_names.Add(player->name);
for (unsigned int i=0; i<4; ++i) for (unsigned int i = 0; i < 4; ++i)
{ {
wxBoxSizer* const v_szr = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const v_szr = new wxBoxSizer(wxVERTICAL);
v_szr->Add(new wxStaticText(this, wxID_ANY, (wxString(_("Pad ")) + (wxChar)('0'+i))), v_szr->Add(new wxStaticText(this, wxID_ANY, (wxString(_("Pad ")) + (wxChar)('0' + i))),
1, wxALIGN_CENTER_HORIZONTAL); 1, wxALIGN_CENTER_HORIZONTAL);
m_map_cbox[i] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, player_names); m_map_cbox[i] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, player_names);
m_map_cbox[i]->Bind(wxEVT_CHOICE, &PadMapDiag::OnAdjust, this); m_map_cbox[i]->Bind(wxEVT_CHOICE, &PadMapDiag::OnAdjust, this);
@ -722,11 +722,11 @@ PadMapDiag::PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiim
h_szr->AddSpacer(10); h_szr->AddSpacer(10);
} }
for (unsigned int i=0; i<4; ++i) for (unsigned int i = 0; i < 4; ++i)
{ {
wxBoxSizer* const v_szr = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const v_szr = new wxBoxSizer(wxVERTICAL);
v_szr->Add(new wxStaticText(this, wxID_ANY, (wxString(_("Wiimote ")) + (wxChar)('0'+i))), v_szr->Add(new wxStaticText(this, wxID_ANY, (wxString(_("Wiimote ")) + (wxChar)('0' + i))),
1, wxALIGN_CENTER_HORIZONTAL); 1, wxALIGN_CENTER_HORIZONTAL);
m_map_cbox[i+4] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, player_names); m_map_cbox[i+4] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, player_names);
m_map_cbox[i+4]->Bind(wxEVT_CHOICE, &PadMapDiag::OnAdjust, this); m_map_cbox[i+4]->Bind(wxEVT_CHOICE, &PadMapDiag::OnAdjust, this);

View File

@ -70,8 +70,8 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
EntrySelection = new wxSpinButton(this); EntrySelection = new wxSpinButton(this);
EntrySelection->Bind(wxEVT_SPIN, &CPatchAddEdit::ChangeEntry, this); EntrySelection->Bind(wxEVT_SPIN, &CPatchAddEdit::ChangeEntry, this);
EntrySelection->SetRange(0, (int)tempEntries.size()-1); EntrySelection->SetRange(0, (int)tempEntries.size() - 1);
EntrySelection->SetValue((int)tempEntries.size()-1); EntrySelection->SetValue((int)tempEntries.size() - 1);
wxArrayString wxArrayStringFor_EditPatchType; wxArrayString wxArrayStringFor_EditPatchType;
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
@ -92,19 +92,19 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
EntryRemove->Disable(); EntryRemove->Disable();
wxBoxSizer* sEditPatchName = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sEditPatchName = new wxBoxSizer(wxHORIZONTAL);
sEditPatchName->Add(EditPatchNameText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); sEditPatchName->Add(EditPatchNameText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sEditPatchName->Add(EditPatchName, 1, wxEXPAND|wxALL, 5); sEditPatchName->Add(EditPatchName, 1, wxEXPAND | wxALL, 5);
sEditPatch->Add(sEditPatchName, 0, wxEXPAND); sEditPatch->Add(sEditPatchName, 0, wxEXPAND);
sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, wxString::Format(_("Entry 1/%d"), (int)tempEntries.size())); sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, wxString::Format(_("Entry 1/%d"), (int)tempEntries.size()));
currentItem = 1; currentItem = 1;
wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0); wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);
sgEntry->Add(EditPatchType, wxGBPosition(0, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5); sgEntry->Add(EditPatchType, wxGBPosition(0, 0), wxGBSpan(1, 2), wxEXPAND | wxALL, 5);
sgEntry->Add(EditPatchOffsetText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); sgEntry->Add(EditPatchOffsetText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sgEntry->Add(EditPatchOffset, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sgEntry->Add(EditPatchOffset, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
sgEntry->Add(EditPatchValueText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); sgEntry->Add(EditPatchValueText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sgEntry->Add(EditPatchValue, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sgEntry->Add(EditPatchValue, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(3, 1), wxEXPAND|wxALL, 5); sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(3, 1), wxEXPAND | wxALL, 5);
sgEntry->AddGrowableCol(1); sgEntry->AddGrowableCol(1);
wxBoxSizer* sEntryAddRemove = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sEntryAddRemove = new wxBoxSizer(wxHORIZONTAL);
@ -113,8 +113,8 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
sbEntry->Add(sgEntry, 0, wxEXPAND); sbEntry->Add(sgEntry, 0, wxEXPAND);
sbEntry->Add(sEntryAddRemove, 0, wxEXPAND); sbEntry->Add(sEntryAddRemove, 0, wxEXPAND);
sEditPatch->Add(sbEntry, 0, wxEXPAND|wxALL, 5); sEditPatch->Add(sbEntry, 0, wxEXPAND | wxALL, 5);
sEditPatch->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5); sEditPatch->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
SetSizerAndFit(sEditPatch); SetSizerAndFit(sEditPatch);
SetFocus(); SetFocus();
} }

View File

@ -290,7 +290,6 @@ void PostProcessingConfigDiag::Event_Slider(wxCommandEvent &ev)
s32 value = option_data.m_integer_step_values[i] * current_step + option_data.m_integer_min_values[i]; s32 value = option_data.m_integer_step_values[i] * current_step + option_data.m_integer_min_values[i];
m_post_processor->SetOptioni(config->GetOption(), i, value); m_post_processor->SetOptioni(config->GetOption(), i, value);
string_value = std::to_string(value); string_value = std::to_string(value);
} }
else else
{ {

View File

@ -77,7 +77,7 @@ void TASInputDlg::CreateBaseLayout()
} }
const int TASInputDlg::m_gc_pad_buttons_bitmask[12] = { const int TASInputDlg::m_gc_pad_buttons_bitmask[12] = {
PAD_BUTTON_DOWN, PAD_BUTTON_UP, PAD_BUTTON_LEFT,PAD_BUTTON_RIGHT, PAD_BUTTON_A, PAD_BUTTON_B, PAD_BUTTON_DOWN, PAD_BUTTON_UP, PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT, PAD_BUTTON_A, PAD_BUTTON_B,
PAD_BUTTON_X, PAD_BUTTON_Y, PAD_TRIGGER_Z, PAD_TRIGGER_L, PAD_TRIGGER_R, PAD_BUTTON_START PAD_BUTTON_X, PAD_BUTTON_Y, PAD_TRIGGER_Z, PAD_TRIGGER_L, PAD_TRIGGER_R, PAD_BUTTON_START
}; };
@ -133,7 +133,7 @@ void TASInputDlg::CreateWiiLayout(int num)
IniFile ini; IniFile ini;
ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini"); ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
std::string extension; std::string extension;
ini.GetIfExists("Wiimote" + std::to_string(num+1), "Extension", &extension); ini.GetIfExists("Wiimote" + std::to_string(num + 1), "Extension", &extension);
if (extension == "Nunchuk") if (extension == "Nunchuk")
m_ext = 1; m_ext = 1;
@ -288,7 +288,7 @@ TASInputDlg::Stick TASInputDlg::CreateStick(int id_stick, int xRange, int yRange
tempStick.bitmap->Bind(wxEVT_LEFT_DOWN, &TASInputDlg::OnMouseDownL, this); tempStick.bitmap->Bind(wxEVT_LEFT_DOWN, &TASInputDlg::OnMouseDownL, this);
tempStick.bitmap->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnMouseUpR, this); tempStick.bitmap->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnMouseUpR, this);
tempStick.x_cont = CreateControl(wxSL_HORIZONTAL | (reverseX ? wxSL_INVERSE : 0), 120, -1, reverseX, xRange, defaultX); tempStick.x_cont = CreateControl(wxSL_HORIZONTAL | (reverseX ? wxSL_INVERSE : 0), 120, -1, reverseX, xRange, defaultX);
tempStick.y_cont = CreateControl(wxSL_VERTICAL | (reverseY ? wxSL_INVERSE : 0), -1, 120, reverseY, yRange, defaultY); tempStick.y_cont = CreateControl(wxSL_VERTICAL | (reverseY ? wxSL_INVERSE : 0), -1, 120, reverseY, yRange, defaultY);
return tempStick; return tempStick;
} }
@ -528,7 +528,7 @@ void TASInputDlg::GetValues(u8* data, WiimoteEmu::ReportFeatures rptf, int ext,
wm_ir_basic* ir_data = (wm_ir_basic*)irData; wm_ir_basic* ir_data = (wm_ir_basic*)irData;
for (unsigned int i = 0; i < 2; ++i) for (unsigned int i = 0; i < 2; ++i)
{ {
if (x[i*2] < 1024 && y < 768) if (x[i * 2] < 1024 && y < 768)
{ {
ir_data[i].x1 = static_cast<u8>(x[i*2]); ir_data[i].x1 = static_cast<u8>(x[i*2]);
ir_data[i].x1hi = x[i*2] >> 8; ir_data[i].x1hi = x[i*2] >> 8;
@ -536,10 +536,10 @@ void TASInputDlg::GetValues(u8* data, WiimoteEmu::ReportFeatures rptf, int ext,
ir_data[i].y1 = static_cast<u8>(y); ir_data[i].y1 = static_cast<u8>(y);
ir_data[i].y1hi = y >> 8; ir_data[i].y1hi = y >> 8;
} }
if (x[i*2+1] < 1024 && y < 768) if (x[i*2 + 1] < 1024 && y < 768)
{ {
ir_data[i].x2 = static_cast<u8>(x[i*2+1]); ir_data[i].x2 = static_cast<u8>(x[i*2 + 1]);
ir_data[i].x2hi = x[i*2+1] >> 8; ir_data[i].x2hi = x[i*2 + 1] >> 8;
ir_data[i].y2 = static_cast<u8>(y); ir_data[i].y2 = static_cast<u8>(y);
ir_data[i].y2hi = y >> 8; ir_data[i].y2hi = y >> 8;
@ -656,7 +656,7 @@ void TASInputDlg::UpdateFromSliders(wxCommandEvent& event)
text = control->text; text = control->text;
} }
int value = ((wxSlider*) event.GetEventObject())->GetValue(); int value = ((wxSlider*)event.GetEventObject())->GetValue();
if (text) if (text)
text->SetValue(std::to_string(value)); text->SetValue(std::to_string(value));
} }
@ -665,7 +665,7 @@ void TASInputDlg::UpdateFromText(wxCommandEvent& event)
{ {
unsigned long value; unsigned long value;
if (!((wxTextCtrl*) event.GetEventObject())->GetValue().ToULong(&value)) if (!((wxTextCtrl*)event.GetEventObject())->GetValue().ToULong(&value))
return; return;
for (Control* const control : m_controls) for (Control* const control : m_controls)
@ -742,7 +742,7 @@ void TASInputDlg::OnMouseUpR(wxMouseEvent& event)
stick->x_cont.value = stick->x_cont.default_value; stick->x_cont.value = stick->x_cont.default_value;
stick->y_cont.value = stick->y_cont.default_value; stick->y_cont.value = stick->y_cont.default_value;
stick->bitmap->SetBitmap(CreateStickBitmap(128,128)); stick->bitmap->SetBitmap(CreateStickBitmap(128, 128));
stick->x_cont.text->SetValue(std::to_string(stick->x_cont.default_value)); stick->x_cont.text->SetValue(std::to_string(stick->x_cont.default_value));
stick->y_cont.text->SetValue(std::to_string(stick->y_cont.default_value)); stick->y_cont.text->SetValue(std::to_string(stick->y_cont.default_value));
stick->x_cont.slider->SetValue(stick->x_cont.default_value); stick->x_cont.slider->SetValue(stick->x_cont.default_value);
@ -862,7 +862,7 @@ wxBitmap TASInputDlg::CreateStickBitmap(int x, int y)
memDC.SetBrush(*wxRED_BRUSH); memDC.SetBrush(*wxRED_BRUSH);
memDC.DrawLine(64, 64, x, y); memDC.DrawLine(64, 64, x, y);
memDC.DrawLine(63, 64, x - 1, y); memDC.DrawLine(63, 64, x - 1, y);
memDC.DrawLine(65, 64, x + 1 , y); memDC.DrawLine(65, 64, x + 1, y);
memDC.DrawLine(64, 63, x, y - 1); memDC.DrawLine(64, 63, x, y - 1);
memDC.DrawLine(64, 65, x, y + 1); memDC.DrawLine(64, 65, x, y + 1);
memDC.SetPen(*wxBLACK_PEN); memDC.SetPen(*wxBLACK_PEN);

View File

@ -658,7 +658,7 @@ SettingRadioButton* VideoConfigDiag::CreateRadioButton(wxWindow* parent, const w
/* Use this to register descriptions for controls which have NOT been created using the Create* functions from above */ /* Use this to register descriptions for controls which have NOT been created using the Create* functions from above */
wxControl* VideoConfigDiag::RegisterControl(wxControl* const control, const wxString& description) wxControl* VideoConfigDiag::RegisterControl(wxControl* const control, const wxString& description)
{ {
ctrl_descs.insert(std::pair<wxWindow*,wxString>(control, description)); ctrl_descs.insert(std::pair<wxWindow*, wxString>(control, description));
control->Bind(wxEVT_ENTER_WINDOW, &VideoConfigDiag::Evt_EnterControl, this); control->Bind(wxEVT_ENTER_WINDOW, &VideoConfigDiag::Evt_EnterControl, this);
control->Bind(wxEVT_LEAVE_WINDOW, &VideoConfigDiag::Evt_LeaveControl, this); control->Bind(wxEVT_LEAVE_WINDOW, &VideoConfigDiag::Evt_LeaveControl, this);
return control; return control;
@ -713,7 +713,7 @@ void VideoConfigDiag::CreateDescriptionArea(wxPanel* const page, wxBoxSizer* con
desc_sizer->Add(desc_text, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); desc_sizer->Add(desc_text, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
// Store description text object for later lookup // Store description text object for later lookup
desc_texts.insert(std::pair<wxWindow*,wxStaticText*>(page, desc_text)); desc_texts.insert(std::pair<wxWindow*, wxStaticText*>(page, desc_text));
} }
void VideoConfigDiag::PopulatePostProcessingShaders() void VideoConfigDiag::PopulatePostProcessingShaders()

View File

@ -1916,7 +1916,7 @@ namespace GLExtensions
// Grab a few functions for initial checking // Grab a few functions for initial checking
// We need them to grab the extension list // We need them to grab the extension list
// Also to check if there is an error grabbing the version // Also to check if there is an error grabbing the version
if (GetFuncAddress ("glGetIntegerv", (void**)&glGetIntegerv) == nullptr) if (GetFuncAddress("glGetIntegerv", (void**)&glGetIntegerv) == nullptr)
return false; return false;
if (GetFuncAddress("glGetString", (void**)&glGetString) == nullptr) if (GetFuncAddress("glGetString", (void**)&glGetString) == nullptr)
return false; return false;

View File

@ -42,8 +42,8 @@ void SWRenderer::Init()
void SWRenderer::Shutdown() void SWRenderer::Shutdown()
{ {
delete [] s_xfbColorTexture[0]; delete[] s_xfbColorTexture[0];
delete [] s_xfbColorTexture[1]; delete[] s_xfbColorTexture[1];
glDeleteProgram(program); glDeleteProgram(program);
glDeleteTextures(1, &s_RenderTarget); glDeleteTextures(1, &s_RenderTarget);
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL) if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL)
@ -87,8 +87,8 @@ static void CreateShaders()
void SWRenderer::Prepare() void SWRenderer::Prepare()
{ {
s_xfbColorTexture[0] = new u8[MAX_XFB_WIDTH*MAX_XFB_HEIGHT*4]; s_xfbColorTexture[0] = new u8[MAX_XFB_WIDTH * MAX_XFB_HEIGHT * 4];
s_xfbColorTexture[1] = new u8[MAX_XFB_WIDTH*MAX_XFB_HEIGHT*4]; s_xfbColorTexture[1] = new u8[MAX_XFB_WIDTH * MAX_XFB_HEIGHT * 4];
s_currentColorTexture = 0; s_currentColorTexture = 0;
@ -118,8 +118,8 @@ void SWRenderer::RenderText(const char* pstr, int left, int top, u32 color)
return; return;
int nBackbufferWidth = (int)GLInterface->GetBackBufferWidth(); int nBackbufferWidth = (int)GLInterface->GetBackBufferWidth();
int nBackbufferHeight = (int)GLInterface->GetBackBufferHeight(); int nBackbufferHeight = (int)GLInterface->GetBackBufferHeight();
glColor4f(((color>>16) & 0xff)/255.0f, ((color>> 8) & 0xff)/255.0f, glColor4f(((color >> 16) & 0xff) / 255.0f, ((color >> 8) & 0xff) / 255.0f,
((color>> 0) & 0xff)/255.0f, ((color>>24) & 0xFF)/255.0f); ((color >> 0) & 0xff) / 255.0f, ((color >> 24) & 0xFF) / 255.0f);
s_pfont->printMultilineText(pstr, s_pfont->printMultilineText(pstr,
left * 2.0f / (float)nBackbufferWidth - 1, left * 2.0f / (float)nBackbufferWidth - 1,
1 - top * 2.0f / (float)nBackbufferHeight, 1 - top * 2.0f / (float)nBackbufferHeight,
@ -169,7 +169,7 @@ void SWRenderer::SwapColorTexture()
void SWRenderer::UpdateColorTexture(EfbInterface::yuv422_packed *xfb, u32 fbWidth, u32 fbHeight) void SWRenderer::UpdateColorTexture(EfbInterface::yuv422_packed *xfb, u32 fbWidth, u32 fbHeight)
{ {
if (fbWidth*fbHeight > MAX_XFB_WIDTH*MAX_XFB_HEIGHT) if (fbWidth * fbHeight > MAX_XFB_WIDTH * MAX_XFB_HEIGHT)
{ {
ERROR_LOG(VIDEO, "Framebuffer is too large: %ix%i", fbWidth, fbHeight); ERROR_LOG(VIDEO, "Framebuffer is too large: %ix%i", fbWidth, fbHeight);
return; return;
@ -184,9 +184,9 @@ void SWRenderer::UpdateColorTexture(EfbInterface::yuv422_packed *xfb, u32 fbWidt
{ {
// We do this one color sample (aka 2 RGB pixles) at a time // We do this one color sample (aka 2 RGB pixles) at a time
int Y1 = xfb[x].Y - 16; int Y1 = xfb[x].Y - 16;
int Y2 = xfb[x+1].Y - 16; int Y2 = xfb[x + 1].Y - 16;
int U = int(xfb[x].UV) - 128; int U = int(xfb[x].UV) - 128;
int V = int(xfb[x+1].UV) - 128; int V = int(xfb[x + 1].UV) - 128;
// We do the inverse BT.601 conversion for YCbCr to RGB // We do the inverse BT.601 conversion for YCbCr to RGB
// http://www.equasys.de/colorconversion.html#YCbCr-RGBColorFormatConversion // http://www.equasys.de/colorconversion.html#YCbCr-RGBColorFormatConversion
@ -225,7 +225,7 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height)
if (s_bScreenshot) if (s_bScreenshot)
{ {
std::lock_guard<std::mutex> lk(s_criticalScreenshot); std::lock_guard<std::mutex> lk(s_criticalScreenshot);
TextureToPng(texture, width*4, s_sScreenshotName, width, height, false); TextureToPng(texture, width * 4, s_sScreenshotName, width, height, false);
// Reset settings // Reset settings
s_sScreenshotName.clear(); s_sScreenshotName.clear();
s_bScreenshot = false; s_bScreenshot = false;

View File

@ -39,7 +39,7 @@ static u32 InterpretDisplayList(u32 address, u32 size)
u8* startAddress; u8* startAddress;
if (g_use_deterministic_gpu_thread) if (g_use_deterministic_gpu_thread)
startAddress = (u8*) PopFifoAuxBuffer(size); startAddress = (u8*)PopFifoAuxBuffer(size);
else else
startAddress = Memory::GetPointer(address); startAddress = Memory::GetPointer(address);

View File

@ -120,7 +120,7 @@ void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbWidt
if (g_ActiveConfig.bUseXFB) if (g_ActiveConfig.bUseXFB)
{ {
FramebufferManagerBase::CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc,Gamma); FramebufferManagerBase::CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc, Gamma);
} }
else else
{ {
@ -328,7 +328,6 @@ void Renderer::DrawDebugText()
if ((u32)OSDTime > Common::Timer::GetTimeMs()) if ((u32)OSDTime > Common::Timer::GetTimeMs())
{ {
const char* res_text = ""; const char* res_text = "";
switch (g_ActiveConfig.iEFBScale) switch (g_ActiveConfig.iEFBScale)
{ {
@ -386,7 +385,7 @@ void Renderer::DrawDebugText()
std::string("Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"), std::string("Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"),
}; };
enum { lines_count = sizeof(lines)/sizeof(*lines) }; enum { lines_count = sizeof(lines) / sizeof(*lines) };
// The latest changed setting in yellow // The latest changed setting in yellow
for (int i = 0; i != lines_count; ++i) for (int i = 0; i != lines_count; ++i)
@ -436,34 +435,34 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
// Update aspect ratio hack values // Update aspect ratio hack values
// Won't take effect until next frame // Won't take effect until next frame
// Don't know if there is a better place for this code so there isn't a 1 frame delay // Don't know if there is a better place for this code so there isn't a 1 frame delay
if ( g_ActiveConfig.bWidescreenHack ) if (g_ActiveConfig.bWidescreenHack)
{ {
float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f); float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f);
float target_aspect; float target_aspect;
switch ( g_ActiveConfig.iAspectRatio ) switch (g_ActiveConfig.iAspectRatio)
{ {
case ASPECT_FORCE_16_9 : case ASPECT_FORCE_16_9:
target_aspect = 16.0f / 9.0f; target_aspect = 16.0f / 9.0f;
break; break;
case ASPECT_FORCE_4_3 : case ASPECT_FORCE_4_3:
target_aspect = 4.0f / 3.0f; target_aspect = 4.0f / 3.0f;
break; break;
case ASPECT_STRETCH : case ASPECT_STRETCH:
target_aspect = WinWidth / WinHeight; target_aspect = WinWidth / WinHeight;
break; break;
default : default:
// ASPECT_AUTO == no hacking // ASPECT_AUTO == no hacking
target_aspect = source_aspect; target_aspect = source_aspect;
break; break;
} }
float adjust = source_aspect / target_aspect; float adjust = source_aspect / target_aspect;
if ( adjust > 1 ) if (adjust > 1)
{ {
// Vert+ // Vert+
g_Config.fAspectRatioHackW = 1; g_Config.fAspectRatioHackW = 1;
g_Config.fAspectRatioHackH = 1/adjust; g_Config.fAspectRatioHackH = 1 / adjust;
} }
else else
{ {

View File

@ -113,7 +113,6 @@ class ShaderCode : public ShaderGeneratorInterface
public: public:
ShaderCode() : buf(nullptr), write_ptr(nullptr) ShaderCode() : buf(nullptr), write_ptr(nullptr)
{ {
} }
void Write(const char* fmt, ...) void Write(const char* fmt, ...)
@ -142,7 +141,7 @@ public:
inline void SetConstantsUsed(unsigned int first_index, unsigned int last_index) inline void SetConstantsUsed(unsigned int first_index, unsigned int last_index)
{ {
for (unsigned int i = first_index; i < last_index+1; ++i) for (unsigned int i = first_index; i < last_index + 1; ++i)
constant_usage[i] = true; constant_usage[i] = true;
} }
@ -198,7 +197,7 @@ public:
u8 value = new_uid.GetUidDataRaw()[i]; u8 value = new_uid.GetUidDataRaw()[i];
if ((i % 4) == 0) if ((i % 4) == 0)
{ {
auto last_value = (i+3 < new_uid.GetUidDataSize()-1) ? i+3 : new_uid.GetUidDataSize(); auto last_value = (i + 3 < new_uid.GetUidDataSize() - 1) ? i + 3 : new_uid.GetUidDataSize();
file << std::setfill(' ') << std::dec; file << std::setfill(' ') << std::dec;
file << "Values " << std::setw(2) << i << " - " << last_value << ": "; file << "Values " << std::setw(2) << i << " - " << last_value << ": ";
} }
@ -216,7 +215,7 @@ public:
} }
private: private:
std::map<UidT,std::string> m_shaders; std::map<UidT, std::string> m_shaders;
std::vector<UidT> m_uids; std::vector<UidT> m_uids;
}; };

View File

@ -46,9 +46,9 @@ std::string Statistics::ToString()
str += StringFromFormat("CP loads (DL): %i\n", stats.thisFrame.numCPLoadsInDL); str += StringFromFormat("CP loads (DL): %i\n", stats.thisFrame.numCPLoadsInDL);
str += StringFromFormat("BP loads: %i\n", stats.thisFrame.numBPLoads); str += StringFromFormat("BP loads: %i\n", stats.thisFrame.numBPLoads);
str += StringFromFormat("BP loads (DL): %i\n", stats.thisFrame.numBPLoadsInDL); str += StringFromFormat("BP loads (DL): %i\n", stats.thisFrame.numBPLoadsInDL);
str += StringFromFormat("Vertex streamed: %i kB\n", stats.thisFrame.bytesVertexStreamed/1024); str += StringFromFormat("Vertex streamed: %i kB\n", stats.thisFrame.bytesVertexStreamed / 1024);
str += StringFromFormat("Index streamed: %i kB\n", stats.thisFrame.bytesIndexStreamed/1024); str += StringFromFormat("Index streamed: %i kB\n", stats.thisFrame.bytesIndexStreamed / 1024);
str += StringFromFormat("Uniform streamed: %i kB\n", stats.thisFrame.bytesUniformStreamed/1024); str += StringFromFormat("Uniform streamed: %i kB\n", stats.thisFrame.bytesUniformStreamed / 1024);
str += StringFromFormat("Vertex Loaders: %i\n", stats.numVertexLoaders); str += StringFromFormat("Vertex Loaders: %i\n", stats.numVertexLoaders);
std::string vertex_list; std::string vertex_list;

View File

@ -140,7 +140,7 @@ void TextureCache::Cleanup(int _frameCount)
TexCache::iterator tcend = textures.end(); TexCache::iterator tcend = textures.end();
while (iter != tcend) while (iter != tcend)
{ {
if(iter->second->frameCount == FRAMECOUNT_INVALID) if (iter->second->frameCount == FRAMECOUNT_INVALID)
{ {
iter->second->frameCount = _frameCount; iter->second->frameCount = _frameCount;
} }
@ -161,7 +161,7 @@ void TextureCache::Cleanup(int _frameCount)
TexPool::iterator tcend2 = texture_pool.end(); TexPool::iterator tcend2 = texture_pool.end();
while (iter2 != tcend2) while (iter2 != tcend2)
{ {
if(iter2->second->frameCount == FRAMECOUNT_INVALID) if (iter2->second->frameCount == FRAMECOUNT_INVALID)
{ {
iter2->second->frameCount = _frameCount; iter2->second->frameCount = _frameCount;
} }
@ -467,7 +467,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
} }
else else
{ {
u8* src_data_gb = &texMem[bpmem.tex[stage/4].texImage2[stage%4].tmem_odd * TMEM_LINE_SIZE]; u8* src_data_gb = &texMem[bpmem.tex[stage / 4].texImage2[stage % 4].tmem_odd * TMEM_LINE_SIZE];
TexDecoder_DecodeRGBA8FromTmem(temp, src_data, src_data_gb, expandedWidth, expandedHeight); TexDecoder_DecodeRGBA8FromTmem(temp, src_data, src_data_gb, expandedWidth, expandedHeight);
} }
} }
@ -520,8 +520,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
const u8* ptr_odd = nullptr; const u8* ptr_odd = nullptr;
if (from_tmem) if (from_tmem)
{ {
ptr_even = &texMem[bpmem.tex[stage/4].texImage1[stage%4].tmem_even * TMEM_LINE_SIZE + texture_size]; ptr_even = &texMem[bpmem.tex[stage / 4].texImage1[stage % 4].tmem_even * TMEM_LINE_SIZE + texture_size];
ptr_odd = &texMem[bpmem.tex[stage/4].texImage2[stage%4].tmem_odd * TMEM_LINE_SIZE]; ptr_odd = &texMem[bpmem.tex[stage / 4].texImage2[stage % 4].tmem_odd * TMEM_LINE_SIZE];
} }
for (; level != texLevels; ++level) for (; level != texLevels; ++level)
@ -535,7 +535,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
? ((level % 2) ? ptr_odd : ptr_even) ? ((level % 2) ? ptr_odd : ptr_even)
: src_data; : src_data;
const u8* tlut = &texMem[tlutaddr]; const u8* tlut = &texMem[tlutaddr];
TexDecoder_Decode(temp, mip_src_data, expanded_mip_width, expanded_mip_height, texformat, tlut, (TlutFormat) tlutfmt); TexDecoder_Decode(temp, mip_src_data, expanded_mip_width, expanded_mip_height, texformat, tlut, (TlutFormat)tlutfmt);
mip_src_data += TexDecoder_GetTextureSizeInBytes(expanded_mip_width, expanded_mip_height, texformat); mip_src_data += TexDecoder_GetTextureSizeInBytes(expanded_mip_width, expanded_mip_height, texformat);
entry->Load(mip_width, mip_height, expanded_mip_width, level); entry->Load(mip_width, mip_height, expanded_mip_width, level);
@ -669,7 +669,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
} }
else if (isIntensity) else if (isIntensity)
{ {
fConstAdd[0] = fConstAdd[1] = fConstAdd[2] = 16.0f/255.0f; fConstAdd[0] = fConstAdd[1] = fConstAdd[2] = 16.0f / 255.0f;
switch (dstFormat) switch (dstFormat)
{ {
case 0: // I4 case 0: // I4
@ -685,7 +685,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
if (dstFormat < 2 || dstFormat == 8) if (dstFormat < 2 || dstFormat == 8)
{ {
colmat[12] = 0.257f; colmat[13] = 0.504f; colmat[14] = 0.098f; colmat[12] = 0.257f; colmat[13] = 0.504f; colmat[14] = 0.098f;
fConstAdd[3] = 16.0f/255.0f; fConstAdd[3] = 16.0f / 255.0f;
if (dstFormat == 0) if (dstFormat == 0)
{ {
ColorMask[0] = ColorMask[1] = ColorMask[2] = 15.0f; ColorMask[0] = ColorMask[1] = ColorMask[2] = 15.0f;
@ -841,8 +841,8 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
} }
} }
const unsigned int tex_w = scaleByHalf ? srcRect.GetWidth()/2 : srcRect.GetWidth(); const unsigned int tex_w = scaleByHalf ? srcRect.GetWidth() / 2 : srcRect.GetWidth();
const unsigned int tex_h = scaleByHalf ? srcRect.GetHeight()/2 : srcRect.GetHeight(); const unsigned int tex_h = scaleByHalf ? srcRect.GetHeight() / 2 : srcRect.GetHeight();
unsigned int scaled_tex_w = g_ActiveConfig.bCopyEFBScaled ? Renderer::EFBToScaledX(tex_w) : tex_w; unsigned int scaled_tex_w = g_ActiveConfig.bCopyEFBScaled ? Renderer::EFBToScaledX(tex_w) : tex_w;
unsigned int scaled_tex_h = g_ActiveConfig.bCopyEFBScaled ? Renderer::EFBToScaledY(tex_h) : tex_h; unsigned int scaled_tex_h = g_ActiveConfig.bCopyEFBScaled ? Renderer::EFBToScaledY(tex_h) : tex_h;

View File

@ -41,7 +41,6 @@ public:
return std::hash<u64>::operator()(id); return std::hash<u64>::operator()(id);
} }
}; };
}; };
struct TCacheEntryBase struct TCacheEntryBase
{ {

View File

@ -9,7 +9,7 @@
enum enum
{ {
TMEM_SIZE = 1024*1024, TMEM_SIZE = 1024 * 1024,
TMEM_LINE_SIZE = 32, TMEM_LINE_SIZE = 32,
}; };
extern GC_ALIGNED16(u8 texMem[TMEM_SIZE]); extern GC_ALIGNED16(u8 texMem[TMEM_SIZE]);

View File

@ -10,8 +10,8 @@
#include "VideoCommon/sfont.inc" #include "VideoCommon/sfont.inc"
#include "VideoCommon/TextureDecoder.h" #include "VideoCommon/TextureDecoder.h"
static bool TexFmt_Overlay_Enable=false; static bool TexFmt_Overlay_Enable = false;
static bool TexFmt_Overlay_Center=false; static bool TexFmt_Overlay_Center = false;
// TRAM // TRAM
// STATE_TO_SAVE // STATE_TO_SAVE
@ -185,11 +185,11 @@ static void TexDecoder_DrawOverlay(u8 *dst, int width, int height, int texformat
if (!TexFmt_Overlay_Center) if (!TexFmt_Overlay_Center)
{ {
xoff=0; xoff = 0;
yoff=0; yoff = 0;
} }
const char* fmt = texfmt[texformat&15]; const char* fmt = texfmt[texformat & 15];
while (*fmt) while (*fmt)
{ {
int xcnt = 0; int xcnt = 0;
@ -197,16 +197,16 @@ static void TexDecoder_DrawOverlay(u8 *dst, int width, int height, int texformat
const unsigned char *ptr = sfont_raw[nchar]; // each char is up to 9x10 const unsigned char *ptr = sfont_raw[nchar]; // each char is up to 9x10
for (int x = 0; x < 9;x++) for (int x = 0; x < 9; x++)
{ {
if (ptr[x] == 0x78) if (ptr[x] == 0x78)
break; break;
xcnt++; xcnt++;
} }
for (int y=0; y < 10; y++) for (int y = 0; y < 10; y++)
{ {
for (int x=0; x < xcnt; x++) for (int x = 0; x < xcnt; x++)
{ {
int *dtp = (int*)dst; int *dtp = (int*)dst;
dtp[(y + yoff) * width + x + xoff] = ptr[x] ? 0xFFFFFFFF : 0xFF000000; dtp[(y + yoff) * width + x + xoff] = ptr[x] ? 0xFFFFFFFF : 0xFF000000;
@ -230,7 +230,7 @@ static inline u32 DecodePixel_IA8(u16 val)
{ {
int a = val & 0xFF; int a = val & 0xFF;
int i = val >> 8; int i = val >> 8;
return i | (i<<8) | (i<<16) | (a<<24); return i | (i << 8) | (i << 16) | (a << 24);
} }
static inline u32 DecodePixel_RGB565(u16 val) static inline u32 DecodePixel_RGB565(u16 val)

View File

@ -92,7 +92,7 @@ void VertexLoader::CompileVertexTranslator()
WriteCall(BoundingBox::SetVertexBufferPosition); WriteCall(BoundingBox::SetVertexBufferPosition);
// Colors // Colors
const u64 col[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1}; const u64 col[2] = { m_VtxDesc.Color0, m_VtxDesc.Color1 };
// TextureCoord // TextureCoord
const u64 tc[8] = { const u64 tc[8] = {
m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord, m_VtxDesc.Tex3Coord, m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord, m_VtxDesc.Tex3Coord,
@ -118,14 +118,14 @@ void VertexLoader::CompileVertexTranslator()
m_VertexSize += 1; m_VertexSize += 1;
} }
if (m_VtxDesc.Tex0MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX0; WriteCall(TexMtx_ReadDirect_UByte); } if (m_VtxDesc.Tex0MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX0; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex1MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX1; WriteCall(TexMtx_ReadDirect_UByte); } if (m_VtxDesc.Tex1MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX1; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex2MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX2; WriteCall(TexMtx_ReadDirect_UByte); } if (m_VtxDesc.Tex2MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX2; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex3MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX3; WriteCall(TexMtx_ReadDirect_UByte); } if (m_VtxDesc.Tex3MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX3; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex4MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX4; WriteCall(TexMtx_ReadDirect_UByte); } if (m_VtxDesc.Tex4MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX4; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex5MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX5; WriteCall(TexMtx_ReadDirect_UByte); } if (m_VtxDesc.Tex5MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX5; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex6MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX6; WriteCall(TexMtx_ReadDirect_UByte); } if (m_VtxDesc.Tex6MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX6; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex7MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); } if (m_VtxDesc.Tex7MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); }
// Write vertex position loader // Write vertex position loader
WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements)); WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements));

View File

@ -100,7 +100,7 @@ void VertexLoaderBase::AppendToString(std::string *dest) const
m_VtxAttr.NormalElements, posMode[m_VtxDesc.Normal], posFormats[m_VtxAttr.NormalFormat])); m_VtxAttr.NormalElements, posMode[m_VtxDesc.Normal], posFormats[m_VtxAttr.NormalFormat]));
} }
u64 color_mode[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1}; u64 color_mode[2] = { m_VtxDesc.Color0, m_VtxDesc.Color1 };
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (color_mode[i]) if (color_mode[i])

View File

@ -16,7 +16,7 @@ static const X64Reg scratch3 = ABI_PARAM4;
static const X64Reg count_reg = R10; static const X64Reg count_reg = R10;
static const X64Reg skipped_reg = R11; static const X64Reg skipped_reg = R11;
VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att): VertexLoaderBase(vtx_desc, vtx_att) VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att) : VertexLoaderBase(vtx_desc, vtx_att)
{ {
if (!IsInitialized()) if (!IsInitialized())
return; return;
@ -97,7 +97,7 @@ int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count
X64Reg coords = XMM0; X64Reg coords = XMM0;
int elem_size = 1 << (format / 2); int elem_size = 1 << (format / 2);
int load_bytes = elem_size * count_in; int load_bytes = elem_size * count_in;
if (load_bytes >= 8) if (load_bytes >= 8)
MOVDQU(coords, data); MOVDQU(coords, data);
else if (load_bytes >= 4) else if (load_bytes >= 4)
@ -337,7 +337,7 @@ void VertexLoaderX64::GenerateVertexLoader()
if (m_VtxDesc.Normal) if (m_VtxDesc.Normal)
{ {
static const u8 map[8] = {7, 6, 15, 14}; static const u8 map[8] = { 7, 6, 15, 14 };
u8 scaling_exponent = map[m_VtxAttr.NormalFormat]; u8 scaling_exponent = map[m_VtxAttr.NormalFormat];
for (int i = 0; i < (m_VtxAttr.NormalElements ? 3 : 1); i++) for (int i = 0; i < (m_VtxAttr.NormalElements ? 3 : 1); i++)
@ -357,7 +357,7 @@ void VertexLoaderX64::GenerateVertexLoader()
m_native_components |= VB_HAS_NRM1 | VB_HAS_NRM2; m_native_components |= VB_HAS_NRM1 | VB_HAS_NRM2;
} }
const u64 col[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1}; const u64 col[2] = { m_VtxDesc.Color0, m_VtxDesc.Color1 };
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (col[i]) if (col[i])

View File

@ -100,7 +100,7 @@ template <typename I>
void Color_ReadIndex_16b_565(VertexLoader* loader) void Color_ReadIndex_16b_565(VertexLoader* loader)
{ {
auto const Index = DataRead<I>(); auto const Index = DataRead<I>();
u16 val = Common::swap16(*(const u16 *)(cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]))); u16 val = Common::swap16(*(const u16 *)(cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex])));
_SetCol565(loader, val); _SetCol565(loader, val);
} }
@ -108,7 +108,7 @@ template <typename I>
void Color_ReadIndex_24b_888(VertexLoader* loader) void Color_ReadIndex_24b_888(VertexLoader* loader)
{ {
auto const Index = DataRead<I>(); auto const Index = DataRead<I>();
const u8 *iAddress = cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]); const u8 *iAddress = cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]);
_SetCol(loader, _Read24(iAddress)); _SetCol(loader, _Read24(iAddress));
} }
@ -116,7 +116,7 @@ template <typename I>
void Color_ReadIndex_32b_888x(VertexLoader* loader) void Color_ReadIndex_32b_888x(VertexLoader* loader)
{ {
auto const Index = DataRead<I>(); auto const Index = DataRead<I>();
const u8 *iAddress = cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]); const u8 *iAddress = cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]);
_SetCol(loader, _Read24(iAddress)); _SetCol(loader, _Read24(iAddress));
} }
@ -124,7 +124,7 @@ template <typename I>
void Color_ReadIndex_16b_4444(VertexLoader* loader) void Color_ReadIndex_16b_4444(VertexLoader* loader)
{ {
auto const Index = DataRead<I>(); auto const Index = DataRead<I>();
u16 val = *(const u16 *)(cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex])); u16 val = *(const u16 *)(cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]));
_SetCol4444(loader, val); _SetCol4444(loader, val);
} }
@ -132,7 +132,7 @@ template <typename I>
void Color_ReadIndex_24b_6666(VertexLoader* loader) void Color_ReadIndex_24b_6666(VertexLoader* loader)
{ {
auto const Index = DataRead<I>(); auto const Index = DataRead<I>();
const u8* pData = cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]) - 1; const u8* pData = cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]) - 1;
u32 val = Common::swap32(pData); u32 val = Common::swap32(pData);
_SetCol6666(loader, val); _SetCol6666(loader, val);
} }
@ -141,7 +141,7 @@ template <typename I>
void Color_ReadIndex_32b_8888(VertexLoader* loader) void Color_ReadIndex_32b_8888(VertexLoader* loader)
{ {
auto const Index = DataRead<I>(); auto const Index = DataRead<I>();
const u8 *iAddress = cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]); const u8 *iAddress = cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]);
_SetCol(loader, _Read32(iAddress)); _SetCol(loader, _Read32(iAddress));
} }

View File

@ -31,7 +31,7 @@ void LOADERDECL Pos_ReadDirect(VertexLoader* loader)
DataReader src(g_video_buffer_read_ptr, nullptr); DataReader src(g_video_buffer_read_ptr, nullptr);
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
dst.Write(i<N ? PosScale(src.Read<T>(), scale) : 0.f); dst.Write(i < N ? PosScale(src.Read<T>(), scale) : 0.f);
g_vertex_manager_write_ptr = dst.GetPointer(); g_vertex_manager_write_ptr = dst.GetPointer();
g_video_buffer_read_ptr = src.GetPointer(); g_video_buffer_read_ptr = src.GetPointer();
@ -51,7 +51,7 @@ void LOADERDECL Pos_ReadIndex(VertexLoader* loader)
DataReader dst(g_vertex_manager_write_ptr, nullptr); DataReader dst(g_vertex_manager_write_ptr, nullptr);
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
dst.Write(i<N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f); dst.Write(i < N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
g_vertex_manager_write_ptr = dst.GetPointer(); g_vertex_manager_write_ptr = dst.GetPointer();
LOG_VTX(); LOG_VTX();

View File

@ -32,10 +32,10 @@ private:
static const u32 MAX_PRIMITIVES_PER_COMMAND = (u16)-1; static const u32 MAX_PRIMITIVES_PER_COMMAND = (u16)-1;
public: public:
static const u32 MAXVBUFFERSIZE = ROUND_UP_POW2 (MAX_PRIMITIVES_PER_COMMAND * LARGEST_POSSIBLE_VERTEX); static const u32 MAXVBUFFERSIZE = ROUND_UP_POW2(MAX_PRIMITIVES_PER_COMMAND * LARGEST_POSSIBLE_VERTEX);
// We may convert triangle-fans to triangle-lists, almost 3x as many indices. // We may convert triangle-fans to triangle-lists, almost 3x as many indices.
static const u32 MAXIBUFFERSIZE = ROUND_UP_POW2 (MAX_PRIMITIVES_PER_COMMAND * 3); static const u32 MAXIBUFFERSIZE = ROUND_UP_POW2(MAX_PRIMITIVES_PER_COMMAND * 3);
VertexManager(); VertexManager();
// needs to be virtual for DX11's dtor // needs to be virtual for DX11's dtor

View File

@ -133,7 +133,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
// transforms // transforms
if (components & VB_HAS_POSMTXIDX) if (components & VB_HAS_POSMTXIDX)
{ {
if (is_writing_shadercode && (DriverDetails::HasBug(DriverDetails::BUG_NODYNUBOACCESS) && !DriverDetails::HasBug(DriverDetails::BUG_ANNIHILATEDUBOS)) ) if (is_writing_shadercode && (DriverDetails::HasBug(DriverDetails::BUG_NODYNUBOACCESS) && !DriverDetails::HasBug(DriverDetails::BUG_ANNIHILATEDUBOS)))
{ {
// This'll cause issues, but it can't be helped // This'll cause issues, but it can't be helped
out.Write("float4 pos = float4(dot(" I_TRANSFORMMATRICES"[0], rawpos), dot(" I_TRANSFORMMATRICES"[1], rawpos), dot(" I_TRANSFORMMATRICES"[2], rawpos), 1);\n"); out.Write("float4 pos = float4(dot(" I_TRANSFORMMATRICES"[0], rawpos), dot(" I_TRANSFORMMATRICES"[1], rawpos), dot(" I_TRANSFORMMATRICES"[2], rawpos), 1);\n");
@ -218,36 +218,36 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
switch (texinfo.sourcerow) switch (texinfo.sourcerow)
{ {
case XF_SRCGEOM_INROW: case XF_SRCGEOM_INROW:
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 ); _assert_(texinfo.inputform == XF_TEXINPUT_ABC1);
out.Write("coord = rawpos;\n"); // pos.w is 1 out.Write("coord = rawpos;\n"); // pos.w is 1
break; break;
case XF_SRCNORMAL_INROW: case XF_SRCNORMAL_INROW:
if (components & VB_HAS_NRM0) if (components & VB_HAS_NRM0)
{ {
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 ); _assert_(texinfo.inputform == XF_TEXINPUT_ABC1);
out.Write("coord = float4(rawnorm0.xyz, 1.0);\n"); out.Write("coord = float4(rawnorm0.xyz, 1.0);\n");
} }
break; break;
case XF_SRCCOLORS_INROW: case XF_SRCCOLORS_INROW:
_assert_( texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 || texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1 ); _assert_(texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 || texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1);
break; break;
case XF_SRCBINORMAL_T_INROW: case XF_SRCBINORMAL_T_INROW:
if (components & VB_HAS_NRM1) if (components & VB_HAS_NRM1)
{ {
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 ); _assert_(texinfo.inputform == XF_TEXINPUT_ABC1);
out.Write("coord = float4(rawnorm1.xyz, 1.0);\n"); out.Write("coord = float4(rawnorm1.xyz, 1.0);\n");
} }
break; break;
case XF_SRCBINORMAL_B_INROW: case XF_SRCBINORMAL_B_INROW:
if (components & VB_HAS_NRM2) if (components & VB_HAS_NRM2)
{ {
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 ); _assert_(texinfo.inputform == XF_TEXINPUT_ABC1);
out.Write("coord = float4(rawnorm2.xyz, 1.0);\n"); out.Write("coord = float4(rawnorm2.xyz, 1.0);\n");
} }
break; break;
default: default:
_assert_(texinfo.sourcerow <= XF_SRCTEX7_INROW); _assert_(texinfo.sourcerow <= XF_SRCTEX7_INROW);
if (components & (VB_HAS_UV0<<(texinfo.sourcerow - XF_SRCTEX0_INROW)) ) if (components & (VB_HAS_UV0 << (texinfo.sourcerow - XF_SRCTEX0_INROW)))
out.Write("coord = float4(tex%d.x, tex%d.y, 1.0, 1.0);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW); out.Write("coord = float4(tex%d.x, tex%d.y, 1.0, 1.0);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW);
break; break;
} }
@ -314,7 +314,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
out.Write("float4 P0 = " I_POSTTRANSFORMMATRICES"[%d];\n" out.Write("float4 P0 = " I_POSTTRANSFORMMATRICES"[%d];\n"
"float4 P1 = " I_POSTTRANSFORMMATRICES"[%d];\n" "float4 P1 = " I_POSTTRANSFORMMATRICES"[%d];\n"
"float4 P2 = " I_POSTTRANSFORMMATRICES"[%d];\n", "float4 P2 = " I_POSTTRANSFORMMATRICES"[%d];\n",
postidx&0x3f, (postidx+1)&0x3f, (postidx+2)&0x3f); postidx & 0x3f, (postidx + 1) & 0x3f, (postidx + 2) & 0x3f);
if (texGenSpecialCase) if (texGenSpecialCase)
{ {

View File

@ -60,10 +60,10 @@ static float PHackValue(std::string sValue)
float f = 0; float f = 0;
bool fp = false; bool fp = false;
const char *cStr = sValue.c_str(); const char *cStr = sValue.c_str();
char *c = new char[strlen(cStr)+1]; char *c = new char[strlen(cStr) + 1];
std::istringstream sTof(""); std::istringstream sTof("");
for (unsigned int i=0; i<=strlen(cStr); ++i) for (unsigned int i = 0; i <= strlen(cStr); ++i)
{ {
if (i == 20) if (i == 20)
{ {
@ -71,7 +71,7 @@ static float PHackValue(std::string sValue)
break; break;
} }
c[i] = (cStr[i] == ',') ? '.' : *(cStr+i); c[i] = (cStr[i] == ',') ? '.' : *(cStr + i);
if (c[i] == '.') if (c[i] == '.')
fp = true; fp = true;
} }
@ -83,7 +83,7 @@ static float PHackValue(std::string sValue)
if (!fp) if (!fp)
f /= 0xF4240; f /= 0xF4240;
delete [] c; delete[] c;
return f; return f;
} }
@ -159,10 +159,10 @@ static void ViewportCorrectionMatrix(Matrix44& result)
if (Wd == 0 || Ht == 0) if (Wd == 0 || Ht == 0)
return; return;
result.data[4*0+0] = intendedWd / Wd; result.data[4*0 + 0] = intendedWd / Wd;
result.data[4*0+3] = (intendedWd - 2.f * (X - intendedX)) / Wd - 1.f; result.data[4*0 + 3] = (intendedWd - 2.f * (X - intendedX)) / Wd - 1.f;
result.data[4*1+1] = intendedHt / Ht; result.data[4*1 + 1] = intendedHt / Ht;
result.data[4*1+3] = (-intendedHt + 2.f * (Y - intendedY)) / Ht + 1.f; result.data[4*1 + 3] = (-intendedHt + 2.f * (Y - intendedY)) / Ht + 1.f;
} }
void VertexShaderManager::Init() void VertexShaderManager::Init()
@ -184,7 +184,7 @@ void VertexShaderManager::Init()
bViewportChanged = false; bViewportChanged = false;
memset(&xfmem, 0, sizeof(xfmem)); memset(&xfmem, 0, sizeof(xfmem));
memset(&constants, 0 , sizeof(constants)); memset(&constants, 0, sizeof(constants));
ResetView(); ResetView();
// TODO: should these go inside ResetView()? // TODO: should these go inside ResetView()?
@ -226,7 +226,7 @@ void VertexShaderManager::SetConstants()
{ {
int startn = nNormalMatricesChanged[0] / 3; int startn = nNormalMatricesChanged[0] / 3;
int endn = (nNormalMatricesChanged[1] + 2) / 3; int endn = (nNormalMatricesChanged[1] + 2) / 3;
for (int i=startn; i<endn; i++) for (int i = startn; i < endn; i++)
{ {
memcpy(constants.normalmatrices[i], &xfmem.normalMatrices[3*i], 12); memcpy(constants.normalmatrices[i], &xfmem.normalMatrices[3*i], 12);
} }
@ -237,7 +237,7 @@ void VertexShaderManager::SetConstants()
if (nPostTransformMatricesChanged[0] >= 0) if (nPostTransformMatricesChanged[0] >= 0)
{ {
int startn = nPostTransformMatricesChanged[0] / 4; int startn = nPostTransformMatricesChanged[0] / 4;
int endn = (nPostTransformMatricesChanged[1] + 3 ) / 4; int endn = (nPostTransformMatricesChanged[1] + 3) / 4;
memcpy(constants.posttransformmatrices[startn], &xfmem.postMatrices[startn * 4], (endn - startn) * 16); memcpy(constants.posttransformmatrices[startn], &xfmem.postMatrices[startn * 4], (endn - startn) * 16);
dirty = true; dirty = true;
nPostTransformMatricesChanged[0] = nPostTransformMatricesChanged[1] = -1; nPostTransformMatricesChanged[0] = nPostTransformMatricesChanged[1] = -1;
@ -315,8 +315,8 @@ void VertexShaderManager::SetConstants()
const float *pos = (const float *)xfmem.posMatrices + g_main_cp_state.matrix_index_a.PosNormalMtxIdx * 4; const float *pos = (const float *)xfmem.posMatrices + g_main_cp_state.matrix_index_a.PosNormalMtxIdx * 4;
const float *norm = (const float *)xfmem.normalMatrices + 3 * (g_main_cp_state.matrix_index_a.PosNormalMtxIdx & 31); const float *norm = (const float *)xfmem.normalMatrices + 3 * (g_main_cp_state.matrix_index_a.PosNormalMtxIdx & 31);
memcpy(constants.posnormalmatrix, pos, 3*16); memcpy(constants.posnormalmatrix, pos, 3*16);
memcpy(constants.posnormalmatrix[3], norm, 12); memcpy(constants.posnormalmatrix[3], norm, 12);
memcpy(constants.posnormalmatrix[4], norm+3, 12); memcpy(constants.posnormalmatrix[4], norm+3, 12);
memcpy(constants.posnormalmatrix[5], norm+6, 12); memcpy(constants.posnormalmatrix[5], norm+6, 12);
dirty = true; dirty = true;
@ -335,7 +335,7 @@ void VertexShaderManager::SetConstants()
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
memcpy(constants.texmatrices[3*i], fptrs[i], 3*16); memcpy(constants.texmatrices[3 * i], fptrs[i], 3 * 16);
} }
dirty = true; dirty = true;
} }
@ -352,7 +352,7 @@ void VertexShaderManager::SetConstants()
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
memcpy(constants.texmatrices[3*i+12], fptrs[i], 3*16); memcpy(constants.texmatrices[3*i + 12], fptrs[i], 3*16);
} }
dirty = true; dirty = true;
} }
@ -417,16 +417,16 @@ void VertexShaderManager::SetConstants()
g_fProjectionMatrix[14] = -1.0f; g_fProjectionMatrix[14] = -1.0f;
g_fProjectionMatrix[15] = 0.0f; g_fProjectionMatrix[15] = 0.0f;
SETSTAT_FT(stats.gproj_0, g_fProjectionMatrix[0]); SETSTAT_FT(stats.gproj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.gproj_1, g_fProjectionMatrix[1]); SETSTAT_FT(stats.gproj_1, g_fProjectionMatrix[1]);
SETSTAT_FT(stats.gproj_2, g_fProjectionMatrix[2]); SETSTAT_FT(stats.gproj_2, g_fProjectionMatrix[2]);
SETSTAT_FT(stats.gproj_3, g_fProjectionMatrix[3]); SETSTAT_FT(stats.gproj_3, g_fProjectionMatrix[3]);
SETSTAT_FT(stats.gproj_4, g_fProjectionMatrix[4]); SETSTAT_FT(stats.gproj_4, g_fProjectionMatrix[4]);
SETSTAT_FT(stats.gproj_5, g_fProjectionMatrix[5]); SETSTAT_FT(stats.gproj_5, g_fProjectionMatrix[5]);
SETSTAT_FT(stats.gproj_6, g_fProjectionMatrix[6]); SETSTAT_FT(stats.gproj_6, g_fProjectionMatrix[6]);
SETSTAT_FT(stats.gproj_7, g_fProjectionMatrix[7]); SETSTAT_FT(stats.gproj_7, g_fProjectionMatrix[7]);
SETSTAT_FT(stats.gproj_8, g_fProjectionMatrix[8]); SETSTAT_FT(stats.gproj_8, g_fProjectionMatrix[8]);
SETSTAT_FT(stats.gproj_9, g_fProjectionMatrix[9]); SETSTAT_FT(stats.gproj_9, g_fProjectionMatrix[9]);
SETSTAT_FT(stats.gproj_10, g_fProjectionMatrix[10]); SETSTAT_FT(stats.gproj_10, g_fProjectionMatrix[10]);
SETSTAT_FT(stats.gproj_11, g_fProjectionMatrix[11]); SETSTAT_FT(stats.gproj_11, g_fProjectionMatrix[11]);
SETSTAT_FT(stats.gproj_12, g_fProjectionMatrix[12]); SETSTAT_FT(stats.gproj_12, g_fProjectionMatrix[12]);
@ -460,28 +460,28 @@ void VertexShaderManager::SetConstants()
// Hack to fix depth clipping precision issues (such as Sonic Unleashed UI) // Hack to fix depth clipping precision issues (such as Sonic Unleashed UI)
g_fProjectionMatrix[15] = 1.0f + FLT_EPSILON; g_fProjectionMatrix[15] = 1.0f + FLT_EPSILON;
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]); SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]); SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
SETSTAT_FT(stats.g2proj_2, g_fProjectionMatrix[2]); SETSTAT_FT(stats.g2proj_2, g_fProjectionMatrix[2]);
SETSTAT_FT(stats.g2proj_3, g_fProjectionMatrix[3]); SETSTAT_FT(stats.g2proj_3, g_fProjectionMatrix[3]);
SETSTAT_FT(stats.g2proj_4, g_fProjectionMatrix[4]); SETSTAT_FT(stats.g2proj_4, g_fProjectionMatrix[4]);
SETSTAT_FT(stats.g2proj_5, g_fProjectionMatrix[5]); SETSTAT_FT(stats.g2proj_5, g_fProjectionMatrix[5]);
SETSTAT_FT(stats.g2proj_6, g_fProjectionMatrix[6]); SETSTAT_FT(stats.g2proj_6, g_fProjectionMatrix[6]);
SETSTAT_FT(stats.g2proj_7, g_fProjectionMatrix[7]); SETSTAT_FT(stats.g2proj_7, g_fProjectionMatrix[7]);
SETSTAT_FT(stats.g2proj_8, g_fProjectionMatrix[8]); SETSTAT_FT(stats.g2proj_8, g_fProjectionMatrix[8]);
SETSTAT_FT(stats.g2proj_9, g_fProjectionMatrix[9]); SETSTAT_FT(stats.g2proj_9, g_fProjectionMatrix[9]);
SETSTAT_FT(stats.g2proj_10, g_fProjectionMatrix[10]); SETSTAT_FT(stats.g2proj_10, g_fProjectionMatrix[10]);
SETSTAT_FT(stats.g2proj_11, g_fProjectionMatrix[11]); SETSTAT_FT(stats.g2proj_11, g_fProjectionMatrix[11]);
SETSTAT_FT(stats.g2proj_12, g_fProjectionMatrix[12]); SETSTAT_FT(stats.g2proj_12, g_fProjectionMatrix[12]);
SETSTAT_FT(stats.g2proj_13, g_fProjectionMatrix[13]); SETSTAT_FT(stats.g2proj_13, g_fProjectionMatrix[13]);
SETSTAT_FT(stats.g2proj_14, g_fProjectionMatrix[14]); SETSTAT_FT(stats.g2proj_14, g_fProjectionMatrix[14]);
SETSTAT_FT(stats.g2proj_15, g_fProjectionMatrix[15]); SETSTAT_FT(stats.g2proj_15, g_fProjectionMatrix[15]);
SETSTAT_FT(stats.proj_0, rawProjection[0]); SETSTAT_FT(stats.proj_0, rawProjection[0]);
SETSTAT_FT(stats.proj_1, rawProjection[1]); SETSTAT_FT(stats.proj_1, rawProjection[1]);
SETSTAT_FT(stats.proj_2, rawProjection[2]); SETSTAT_FT(stats.proj_2, rawProjection[2]);
SETSTAT_FT(stats.proj_3, rawProjection[3]); SETSTAT_FT(stats.proj_3, rawProjection[3]);
SETSTAT_FT(stats.proj_4, rawProjection[4]); SETSTAT_FT(stats.proj_4, rawProjection[4]);
SETSTAT_FT(stats.proj_5, rawProjection[5]); SETSTAT_FT(stats.proj_5, rawProjection[5]);
break; break;
default: default:
@ -549,12 +549,15 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
if (nTransformMatricesChanged[0] == -1) if (nTransformMatricesChanged[0] == -1)
{ {
nTransformMatricesChanged[0] = start; nTransformMatricesChanged[0] = start;
nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end; nTransformMatricesChanged[1] = end > XFMEM_POSMATRICES_END ? XFMEM_POSMATRICES_END : end;
} }
else else
{ {
if (nTransformMatricesChanged[0] > start) nTransformMatricesChanged[0] = start; if (nTransformMatricesChanged[0] > start)
if (nTransformMatricesChanged[1] < end) nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end; nTransformMatricesChanged[0] = start;
if (nTransformMatricesChanged[1] < end)
nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END ? XFMEM_POSMATRICES_END : end;
} }
} }
@ -570,8 +573,11 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
} }
else else
{ {
if (nNormalMatricesChanged[0] > _start) nNormalMatricesChanged[0] = _start; if (nNormalMatricesChanged[0] > _start)
if (nNormalMatricesChanged[1] < _end) nNormalMatricesChanged[1] = _end; nNormalMatricesChanged[0] = _start;
if (nNormalMatricesChanged[1] < _end)
nNormalMatricesChanged[1] = _end;
} }
} }
@ -587,8 +593,11 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
} }
else else
{ {
if (nPostTransformMatricesChanged[0] > _start) nPostTransformMatricesChanged[0] = _start; if (nPostTransformMatricesChanged[0] > _start)
if (nPostTransformMatricesChanged[1] < _end) nPostTransformMatricesChanged[1] = _end; nPostTransformMatricesChanged[0] = _start;
if (nPostTransformMatricesChanged[1] < _end)
nPostTransformMatricesChanged[1] = _end;
} }
} }
@ -597,15 +606,18 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
int _start = start < XFMEM_LIGHTS ? XFMEM_LIGHTS : start-XFMEM_LIGHTS; int _start = start < XFMEM_LIGHTS ? XFMEM_LIGHTS : start-XFMEM_LIGHTS;
int _end = end < XFMEM_LIGHTS_END ? end-XFMEM_LIGHTS : XFMEM_LIGHTS_END-XFMEM_LIGHTS; int _end = end < XFMEM_LIGHTS_END ? end-XFMEM_LIGHTS : XFMEM_LIGHTS_END-XFMEM_LIGHTS;
if (nLightsChanged[0] == -1 ) if (nLightsChanged[0] == -1)
{ {
nLightsChanged[0] = _start; nLightsChanged[0] = _start;
nLightsChanged[1] = _end; nLightsChanged[1] = _end;
} }
else else
{ {
if (nLightsChanged[0] > _start) nLightsChanged[0] = _start; if (nLightsChanged[0] > _start)
if (nLightsChanged[1] < _end) nLightsChanged[1] = _end; nLightsChanged[0] = _start;
if (nLightsChanged[1] < _end)
nLightsChanged[1] = _end;
} }
} }
} }
@ -615,7 +627,7 @@ void VertexShaderManager::SetTexMatrixChangedA(u32 Value)
if (g_main_cp_state.matrix_index_a.Hex != Value) if (g_main_cp_state.matrix_index_a.Hex != Value)
{ {
VertexManager::Flush(); VertexManager::Flush();
if (g_main_cp_state.matrix_index_a.PosNormalMtxIdx != (Value&0x3f)) if (g_main_cp_state.matrix_index_a.PosNormalMtxIdx != (Value & 0x3f))
bPosNormalMatrixChanged = true; bPosNormalMatrixChanged = true;
bTexMatricesChanged[0] = true; bTexMatricesChanged[0] = true;
g_main_cp_state.matrix_index_a.Hex = Value; g_main_cp_state.matrix_index_a.Hex = Value;
@ -650,7 +662,7 @@ void VertexShaderManager::SetMaterialColorChanged(int index, u32 color)
void VertexShaderManager::TranslateView(float x, float y, float z) void VertexShaderManager::TranslateView(float x, float y, float z)
{ {
float result[3]; float result[3];
float vector[3] = { x,z,y }; float vector[3] = { x, z, y };
Matrix33::Multiply(s_viewInvRotationMatrix, vector, result); Matrix33::Multiply(s_viewInvRotationMatrix, vector, result);

View File

@ -111,7 +111,7 @@ public:
// waits until is paused and fully idle, and acquires a lock on that state. // waits until is paused and fully idle, and acquires a lock on that state.
// or, if doLock is false, releases a lock on that state and optionally unpauses. // or, if doLock is false, releases a lock on that state and optionally unpauses.
// calls must be balanced and non-recursive (once with doLock true, then once with doLock false). // calls must be balanced and non-recursive (once with doLock true, then once with doLock false).
virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) = 0; virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) = 0;
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now // the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
virtual void DoState(PointerWrap &p) = 0; virtual void DoState(PointerWrap &p) = 0;
@ -152,7 +152,7 @@ class VideoBackendHardware : public VideoBackend
void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) override; void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) override;
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) override; void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) override;
void DoState(PointerWrap &p) override; void DoState(PointerWrap &p) override;
void UpdateWantDeterminism(bool want) override; void UpdateWantDeterminism(bool want) override;
@ -160,7 +160,7 @@ class VideoBackendHardware : public VideoBackend
bool m_invalid; bool m_invalid;
public: public:
void CheckInvalidState() override; void CheckInvalidState() override;
protected: protected:
void InitializeShared(); void InitializeShared();

View File

@ -62,7 +62,7 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("Crop", &bCrop, false); settings->Get("Crop", &bCrop, false);
settings->Get("UseXFB", &bUseXFB, 0); settings->Get("UseXFB", &bUseXFB, 0);
settings->Get("UseRealXFB", &bUseRealXFB, 0); settings->Get("UseRealXFB", &bUseRealXFB, 0);
settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,128); settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples, 128);
settings->Get("ShowFPS", &bShowFPS, false); settings->Get("ShowFPS", &bShowFPS, false);
settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false); settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false);
settings->Get("OverlayStats", &bOverlayStats, false); settings->Get("OverlayStats", &bOverlayStats, false);
@ -77,7 +77,7 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0); settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0);
settings->Get("FastDepthCalc", &bFastDepthCalc, true); settings->Get("FastDepthCalc", &bFastDepthCalc, true);
settings->Get("MSAA", &iMultisampleMode, 0); settings->Get("MSAA", &iMultisampleMode, 0);
settings->Get("EFBScale", &iEFBScale, (int) SCALE_1X); // native settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native
settings->Get("DstAlphaPass", &bDstAlphaPass, false); settings->Get("DstAlphaPass", &bDstAlphaPass, false);
settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0); settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0); settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);

View File

@ -13,9 +13,9 @@ TEST(VertexLoaderUID, UniqueEnough)
std::unordered_set<VertexLoaderUID> uids; std::unordered_set<VertexLoaderUID> uids;
TVtxDesc vtx_desc; TVtxDesc vtx_desc;
memset(&vtx_desc, 0, sizeof (vtx_desc)); memset(&vtx_desc, 0, sizeof(vtx_desc));
VAT vat; VAT vat;
memset(&vat, 0, sizeof (vat)); memset(&vat, 0, sizeof(vat));
uids.insert(VertexLoaderUID(vtx_desc, vat)); uids.insert(VertexLoaderUID(vtx_desc, vat));
vtx_desc.Hex = 0xFEDCBA9876543210ull; vtx_desc.Hex = 0xFEDCBA9876543210ull;
@ -38,11 +38,11 @@ protected:
void SetUp() override void SetUp() override
{ {
memset(&input_memory[0], 0, sizeof (input_memory)); memset(&input_memory[0], 0, sizeof(input_memory));
memset(&output_memory[0], 0, sizeof (input_memory)); memset(&output_memory[0], 0, sizeof(input_memory));
memset(&m_vtx_desc, 0, sizeof (m_vtx_desc)); memset(&m_vtx_desc, 0, sizeof(m_vtx_desc));
memset(&m_vtx_attr, 0, sizeof (m_vtx_attr)); memset(&m_vtx_attr, 0, sizeof(m_vtx_attr));
ResetPointers(); ResetPointers();
} }
@ -53,7 +53,7 @@ protected:
{ {
// Converts *to* big endian, not from. // Converts *to* big endian, not from.
*(T*)(&input_memory[m_input_pos]) = Common::FromBigEndian(val); *(T*)(&input_memory[m_input_pos]) = Common::FromBigEndian(val);
m_input_pos += sizeof (val); m_input_pos += sizeof(val);
} }
// Reads a value from the output stream. // Reads a value from the output stream.
@ -61,7 +61,7 @@ protected:
T Output() T Output()
{ {
T out = *(T*)&output_memory[m_output_pos]; T out = *(T*)&output_memory[m_output_pos];
m_output_pos += sizeof (out); m_output_pos += sizeof(out);
return out; return out;
} }
@ -75,8 +75,8 @@ protected:
void ResetPointers() void ResetPointers()
{ {
m_input_pos = m_output_pos = 0; m_input_pos = m_output_pos = 0;
src = DataReader(input_memory, input_memory+sizeof(input_memory)); src = DataReader(input_memory, input_memory + sizeof(input_memory));
dst = DataReader(output_memory, output_memory+sizeof(output_memory)); dst = DataReader(output_memory, output_memory + sizeof(output_memory));
} }
u32 m_input_pos, m_output_pos; u32 m_input_pos, m_output_pos;
@ -95,8 +95,8 @@ TEST_F(VertexLoaderTest, PositionDirectFloatXYZ)
VertexLoaderBase* loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr); VertexLoaderBase* loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr);
ASSERT_EQ(3 * sizeof (float), (u32)loader->m_native_vtx_decl.stride); ASSERT_EQ(3 * sizeof(float), (u32)loader->m_native_vtx_decl.stride);
ASSERT_EQ(3 * sizeof (float), (u32)loader->m_VertexSize); ASSERT_EQ(3 * sizeof(float), (u32)loader->m_VertexSize);
// Write some vertices. // Write some vertices.
Input(0.0f); Input(0.0f); Input(0.0f); Input(0.0f); Input(0.0f); Input(0.0f);
@ -134,8 +134,8 @@ TEST_F(VertexLoaderTest, PositionDirectU16XY)
VertexLoaderBase* loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr); VertexLoaderBase* loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr);
ASSERT_EQ(3 * sizeof (float), (u32)loader->m_native_vtx_decl.stride); ASSERT_EQ(3 * sizeof(float), (u32)loader->m_native_vtx_decl.stride);
ASSERT_EQ(2 * sizeof (u16), (u32)loader->m_VertexSize); ASSERT_EQ(2 * sizeof(u16), (u32)loader->m_VertexSize);
// Write some vertices. // Write some vertices.
Input<u16>(0); Input<u16>(0); Input<u16>(0); Input<u16>(0);
@ -176,8 +176,8 @@ TEST_F(VertexLoaderTest, PositionDirectFloatXYZSpeed)
VertexLoaderBase* loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr); VertexLoaderBase* loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr);
ASSERT_EQ(3 * sizeof (float), (u32)loader->m_native_vtx_decl.stride); ASSERT_EQ(3 * sizeof(float), (u32)loader->m_native_vtx_decl.stride);
ASSERT_EQ(3 * sizeof (float), (u32)loader->m_VertexSize); ASSERT_EQ(3 * sizeof(float), (u32)loader->m_VertexSize);
for (int i = 0; i < 1000; ++i) for (int i = 0; i < 1000; ++i)
{ {
@ -197,8 +197,8 @@ TEST_F(VertexLoaderTest, PositionDirectU16XYSpeed)
VertexLoaderBase* loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr); VertexLoaderBase* loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr);
ASSERT_EQ(3 * sizeof (float), (u32)loader->m_native_vtx_decl.stride); ASSERT_EQ(3 * sizeof(float), (u32)loader->m_native_vtx_decl.stride);
ASSERT_EQ(2 * sizeof (u16), (u32)loader->m_VertexSize); ASSERT_EQ(2 * sizeof(u16), (u32)loader->m_VertexSize);
for (int i = 0; i < 1000; ++i) for (int i = 0; i < 1000; ++i)
{ {