Merge pull request #155 from Parlane/codestyle_fixes
Fixes spacing for "for", "while", "switch" and "if"
This commit is contained in:
commit
ede46556d9
|
@ -123,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt)
|
||||||
float fc1; // Cutoff frequencies
|
float fc1; // Cutoff frequencies
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if(*n==0) return nullptr;
|
if (*n==0) return nullptr;
|
||||||
MathUtil::Clamp(&fc[0],float(0.001),float(1));
|
MathUtil::Clamp(&fc[0],float(0.001),float(1));
|
||||||
|
|
||||||
float *w=(float*)calloc(sizeof(float),*n);
|
float *w=(float*)calloc(sizeof(float),*n);
|
||||||
|
|
|
@ -48,8 +48,8 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples, bool consider_
|
||||||
float numLeft = ((indexW - indexR) & INDEX_MASK) / 2;
|
float numLeft = ((indexW - indexR) & INDEX_MASK) / 2;
|
||||||
m_numLeftI = (numLeft + m_numLeftI*(CONTROL_AVG-1)) / CONTROL_AVG;
|
m_numLeftI = (numLeft + m_numLeftI*(CONTROL_AVG-1)) / CONTROL_AVG;
|
||||||
float offset = (m_numLeftI - LOW_WATERMARK) * CONTROL_FACTOR;
|
float offset = (m_numLeftI - LOW_WATERMARK) * CONTROL_FACTOR;
|
||||||
if(offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT;
|
if (offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT;
|
||||||
if(offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT;
|
if (offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT;
|
||||||
|
|
||||||
//render numleft sample pairs to samples[]
|
//render numleft sample pairs to samples[]
|
||||||
//advance indexR with sample position
|
//advance indexR with sample position
|
||||||
|
@ -65,7 +65,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples, bool consider_
|
||||||
static u32 frac = 0;
|
static u32 frac = 0;
|
||||||
const u32 ratio = (u32)( 65536.0f * aid_sample_rate / (float)m_sampleRate );
|
const u32 ratio = (u32)( 65536.0f * aid_sample_rate / (float)m_sampleRate );
|
||||||
|
|
||||||
if(ratio > 0x10000)
|
if (ratio > 0x10000)
|
||||||
ERROR_LOG(AUDIO, "ratio out of range");
|
ERROR_LOG(AUDIO, "ratio out of range");
|
||||||
|
|
||||||
for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2) {
|
for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ void OpenALStream::Clear(bool mute)
|
||||||
{
|
{
|
||||||
m_muted = mute;
|
m_muted = mute;
|
||||||
|
|
||||||
if(m_muted)
|
if (m_muted)
|
||||||
{
|
{
|
||||||
soundTouch.clear();
|
soundTouch.clear();
|
||||||
alSourceStop(uiSource);
|
alSourceStop(uiSource);
|
||||||
|
|
|
@ -49,7 +49,7 @@ void PulseAudio::SoundLoop()
|
||||||
while (m_run_thread.load() && m_pa_connected == 1 && m_pa_error >= 0)
|
while (m_run_thread.load() && m_pa_connected == 1 && m_pa_error >= 0)
|
||||||
m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr);
|
m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr);
|
||||||
|
|
||||||
if(m_pa_error < 0)
|
if (m_pa_error < 0)
|
||||||
ERROR_LOG(AUDIO, "PulseAudio error: %s", pa_strerror(m_pa_error));
|
ERROR_LOG(AUDIO, "PulseAudio error: %s", pa_strerror(m_pa_error));
|
||||||
|
|
||||||
PulseShutdown();
|
PulseShutdown();
|
||||||
|
|
|
@ -193,9 +193,9 @@ void ARMXEmitter::ORI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch)
|
||||||
|
|
||||||
void ARMXEmitter::FlushLitPool()
|
void ARMXEmitter::FlushLitPool()
|
||||||
{
|
{
|
||||||
for(LiteralPool& pool : currentLitPool) {
|
for (LiteralPool& pool : currentLitPool) {
|
||||||
// Search for duplicates
|
// Search for duplicates
|
||||||
for(LiteralPool& old_pool : currentLitPool) {
|
for (LiteralPool& old_pool : currentLitPool) {
|
||||||
if (old_pool.val == pool.val)
|
if (old_pool.val == pool.val)
|
||||||
pool.loc = old_pool.loc;
|
pool.loc = old_pool.loc;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
|
||||||
{
|
{
|
||||||
// Use MOVW+MOVT for ARMv7+
|
// Use MOVW+MOVT for ARMv7+
|
||||||
MOVW(reg, val & 0xFFFF);
|
MOVW(reg, val & 0xFFFF);
|
||||||
if(val & 0xFFFF0000)
|
if (val & 0xFFFF0000)
|
||||||
MOVT(reg, val, true);
|
MOVT(reg, val, true);
|
||||||
} else if (!TrySetValue_TwoOp(reg,val)) {
|
} else if (!TrySetValue_TwoOp(reg,val)) {
|
||||||
// Use literal pool for ARMv6.
|
// Use literal pool for ARMv6.
|
||||||
|
|
|
@ -161,7 +161,7 @@ public:
|
||||||
|
|
||||||
Operand2(ARMReg base, ShiftType type, u8 shift)// For IMM shifted register
|
Operand2(ARMReg base, ShiftType type, u8 shift)// For IMM shifted register
|
||||||
{
|
{
|
||||||
if(shift == 32) shift = 0;
|
if (shift == 32) shift = 0;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ST_LSL:
|
case ST_LSL:
|
||||||
|
@ -198,7 +198,7 @@ public:
|
||||||
}
|
}
|
||||||
u32 GetData()
|
u32 GetData()
|
||||||
{
|
{
|
||||||
switch(Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case TYPE_IMM:
|
case TYPE_IMM:
|
||||||
return Imm12Mod(); // This'll need to be changed later
|
return Imm12Mod(); // This'll need to be changed later
|
||||||
|
|
|
@ -73,11 +73,11 @@ std::vector<std::string> cdio_get_devices()
|
||||||
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,
|
||||||
|
@ -85,11 +85,11 @@ std::vector<std::string> cdio_get_devices()
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
char psz_buf[0x32];
|
char psz_buf[0x32];
|
||||||
size_t dev_path_length;
|
size_t dev_path_length;
|
||||||
|
@ -101,7 +101,7 @@ std::vector<std::string> cdio_get_devices()
|
||||||
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;
|
||||||
|
@ -113,12 +113,12 @@ std::vector<std::string> cdio_get_devices()
|
||||||
snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' );
|
snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' );
|
||||||
dev_path_length = strlen( psz_buf );
|
dev_path_length = strlen( psz_buf );
|
||||||
|
|
||||||
if( CFStringGetCString( (CFStringRef)str_bsd_path,
|
if (CFStringGetCString( (CFStringRef)str_bsd_path,
|
||||||
(char*)&psz_buf + dev_path_length,
|
(char*)&psz_buf + dev_path_length,
|
||||||
sizeof(psz_buf) - dev_path_length,
|
sizeof(psz_buf) - dev_path_length,
|
||||||
kCFStringEncodingASCII))
|
kCFStringEncodingASCII))
|
||||||
{
|
{
|
||||||
if(psz_buf != nullptr)
|
if (psz_buf != nullptr)
|
||||||
{
|
{
|
||||||
std::string str = psz_buf;
|
std::string str = psz_buf;
|
||||||
drives.push_back(str);
|
drives.push_back(str);
|
||||||
|
@ -127,7 +127,7 @@ std::vector<std::string> cdio_get_devices()
|
||||||
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;
|
||||||
|
@ -175,7 +175,7 @@ static bool is_cdrom(const std::string& drive, char *mnttype)
|
||||||
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__
|
||||||
if (ioctl(cdfd, CDROM_GET_CAPABILITY, 0) != -1)
|
if (ioctl(cdfd, CDROM_GET_CAPABILITY, 0) != -1)
|
||||||
|
|
|
@ -306,7 +306,7 @@ private:
|
||||||
|
|
||||||
void DoVoid(void *data, u32 size)
|
void DoVoid(void *data, u32 size)
|
||||||
{
|
{
|
||||||
for(u32 i = 0; i != size; ++i)
|
for (u32 i = 0; i != size; ++i)
|
||||||
DoByte(reinterpret_cast<u8*>(data)[i]);
|
DoByte(reinterpret_cast<u8*>(data)[i]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,8 +35,8 @@ struct ArraySizeImpl : public std::extent<T>
|
||||||
#define __GNUC_PREREQ(a, b) 0
|
#define __GNUC_PREREQ(a, b) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined __GNUC__ && !__GNUC_PREREQ(4,9)) \
|
#if (defined __GNUC__ && !__GNUC_PREREQ(4,9)) && \
|
||||||
&& !defined __SSSE3__ && !defined _M_GENERIC
|
!defined __SSSE3__ && !defined _M_GENERIC
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
static __inline __m128i __attribute__((__always_inline__))
|
static __inline __m128i __attribute__((__always_inline__))
|
||||||
_mm_shuffle_epi8(__m128i a, __m128i mask)
|
_mm_shuffle_epi8(__m128i a, __m128i mask)
|
||||||
|
@ -122,18 +122,18 @@ inline u64 _rotr64(u64 x, unsigned int shift){
|
||||||
// Retrieve the current thread-specific locale
|
// Retrieve the current thread-specific locale
|
||||||
locale_t old_locale = bIsPerThread ? _get_current_locale() : LC_GLOBAL_LOCALE;
|
locale_t old_locale = bIsPerThread ? _get_current_locale() : LC_GLOBAL_LOCALE;
|
||||||
|
|
||||||
if(new_locale == LC_GLOBAL_LOCALE)
|
if (new_locale == LC_GLOBAL_LOCALE)
|
||||||
{
|
{
|
||||||
// Restore the global locale
|
// Restore the global locale
|
||||||
_configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
|
_configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
|
||||||
}
|
}
|
||||||
else if(new_locale != nullptr)
|
else if (new_locale != nullptr)
|
||||||
{
|
{
|
||||||
// Configure the thread to set the locale only for this thread
|
// Configure the thread to set the locale only for this thread
|
||||||
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
|
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
|
||||||
|
|
||||||
// Set all locale categories
|
// Set all locale categories
|
||||||
for(int i = LC_MIN; i <= LC_MAX; i++)
|
for (int i = LC_MIN; i <= LC_MAX; i++)
|
||||||
setlocale(i, new_locale->locinfo->lc_category[i].locale);
|
setlocale(i, new_locale->locinfo->lc_category[i].locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ static void silly_random(u8 * rndArea, u8 count)
|
||||||
u16 i;
|
u16 i;
|
||||||
srand((unsigned) (time(nullptr)));
|
srand((unsigned) (time(nullptr)));
|
||||||
|
|
||||||
for(i=0;i<count;i++)
|
for (i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
rndArea[i]=rand();
|
rndArea[i]=rand();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut )
|
||||||
ULONG index = 0;
|
ULONG index = 0;
|
||||||
PCSTR lpAct = lpszIn;
|
PCSTR lpAct = lpszIn;
|
||||||
|
|
||||||
for( ; ; lpAct++ )
|
for ( ; ; lpAct++ )
|
||||||
{
|
{
|
||||||
lpszOut[index++] = (TCHAR)(*lpAct);
|
lpszOut[index++] = (TCHAR)(*lpAct);
|
||||||
if ( *lpAct == 0 )
|
if ( *lpAct == 0 )
|
||||||
|
@ -196,7 +196,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
|
||||||
if ( _tcsstr( lpszUnDSymbol, _T("(void)") ) == nullptr && _tcsstr( lpszUnDSymbol, _T("()") ) == nullptr)
|
if ( _tcsstr( lpszUnDSymbol, _T("(void)") ) == nullptr && _tcsstr( lpszUnDSymbol, _T("()") ) == nullptr)
|
||||||
{
|
{
|
||||||
ULONG index = 0;
|
ULONG index = 0;
|
||||||
for( ; ; index++ )
|
for ( ; ; index++ )
|
||||||
{
|
{
|
||||||
lpszParamSep = _tcschr( lpszParsed, _T(',') );
|
lpszParamSep = _tcschr( lpszParsed, _T(',') );
|
||||||
if ( lpszParamSep == nullptr )
|
if ( lpszParamSep == nullptr )
|
||||||
|
@ -331,7 +331,7 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
|
||||||
|
|
||||||
PrintFunctionAndSourceInfo(file, callStack);
|
PrintFunctionAndSourceInfo(file, callStack);
|
||||||
|
|
||||||
for( ULONG index = 0; ; index++ )
|
for ( ULONG index = 0; ; index++ )
|
||||||
{
|
{
|
||||||
bResult = StackWalk(
|
bResult = StackWalk(
|
||||||
IMAGE_FILE_MACHINE_I386,
|
IMAGE_FILE_MACHINE_I386,
|
||||||
|
@ -347,14 +347,14 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
|
||||||
if ( index == 0 )
|
if ( index == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !bResult || callStack.AddrFrame.Offset == 0 )
|
if (!bResult || callStack.AddrFrame.Offset == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PrintFunctionAndSourceInfo(file, callStack);
|
PrintFunctionAndSourceInfo(file, callStack);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hThread != GetCurrentThread() )
|
if (hThread != GetCurrentThread())
|
||||||
ResumeThread( hThread );
|
ResumeThread( hThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
|
||||||
|
|
||||||
// If it's not this thread, let's suspend it, and resume it at the end
|
// If it's not this thread, let's suspend it, and resume it at the end
|
||||||
if ( hThread != GetCurrentThread() )
|
if ( hThread != GetCurrentThread() )
|
||||||
if ( SuspendThread( hThread ) == -1 )
|
if (SuspendThread( hThread ) == -1)
|
||||||
{
|
{
|
||||||
// whaaat ?!
|
// whaaat ?!
|
||||||
etfprint(file, "Call stack info failed\n");
|
etfprint(file, "Call stack info failed\n");
|
||||||
|
@ -386,7 +386,7 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
|
||||||
|
|
||||||
PrintFunctionAndSourceInfo(file, callStack);
|
PrintFunctionAndSourceInfo(file, callStack);
|
||||||
|
|
||||||
for( ULONG index = 0; ; index++ )
|
for (ULONG index = 0; ; index++)
|
||||||
{
|
{
|
||||||
bResult = StackWalk(
|
bResult = StackWalk(
|
||||||
IMAGE_FILE_MACHINE_I386,
|
IMAGE_FILE_MACHINE_I386,
|
||||||
|
@ -399,17 +399,17 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
|
||||||
SymGetModuleBase,
|
SymGetModuleBase,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
if ( index == 0 )
|
if (index == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !bResult || callStack.AddrFrame.Offset == 0 )
|
if (!bResult || callStack.AddrFrame.Offset == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PrintFunctionAndSourceInfo(file, callStack);
|
PrintFunctionAndSourceInfo(file, callStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hThread != GetCurrentThread() )
|
if (hThread != GetCurrentThread())
|
||||||
ResumeThread( hThread );
|
ResumeThread(hThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
char g_uefbuf[2048];
|
char g_uefbuf[2048];
|
||||||
|
|
|
@ -78,9 +78,9 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
|
||||||
{
|
{
|
||||||
std::string found(dp->d_name);
|
std::string found(dp->d_name);
|
||||||
|
|
||||||
if ((found != ".") && (found != "..")
|
if ((found != ".") && (found != "..") &&
|
||||||
&& (found.size() >= end_match.size())
|
(found.size() >= end_match.size()) &&
|
||||||
&& 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)
|
||||||
|
|
|
@ -155,9 +155,9 @@ u64 GetMurmurHash3(const u8 *src, int 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 = max(Step, 1u);
|
if (samples == 0) samples = 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;
|
||||||
|
@ -171,7 +171,7 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples)
|
||||||
|
|
||||||
const u64 * blocks = (const u64 *)(data);
|
const u64 * blocks = (const u64 *)(data);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -187,7 +187,7 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples)
|
||||||
u64 k1 = 0;
|
u64 k1 = 0;
|
||||||
u64 k2 = 0;
|
u64 k2 = 0;
|
||||||
|
|
||||||
switch(len & 15)
|
switch (len & 15)
|
||||||
{
|
{
|
||||||
case 15: k2 ^= u64(tail[14]) << 48;
|
case 15: k2 ^= u64(tail[14]) << 48;
|
||||||
case 14: k2 ^= u64(tail[13]) << 40;
|
case 14: k2 ^= u64(tail[13]) << 40;
|
||||||
|
@ -233,10 +233,10 @@ u64 GetCRC32(const u8 *src, int 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 = max(Step, 1u);
|
if (samples == 0) samples = 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_u64(h, data[0]);
|
h = _mm_crc32_u64(h, data[0]);
|
||||||
data += Step;
|
data += Step;
|
||||||
|
@ -265,10 +265,10 @@ u64 GetHashHiresTexture(const u8 *src, int 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 = max(Step, 1u);
|
if (samples == 0) samples = 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];
|
||||||
data+=Step;
|
data+=Step;
|
||||||
|
@ -281,7 +281,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||||
|
|
||||||
const u8 * data2 = (const u8*)end;
|
const u8 * data2 = (const u8*)end;
|
||||||
|
|
||||||
switch(len & 7)
|
switch (len & 7)
|
||||||
{
|
{
|
||||||
case 7: h ^= u64(data2[6]) << 48;
|
case 7: h ^= u64(data2[6]) << 48;
|
||||||
case 6: h ^= u64(data2[5]) << 40;
|
case 6: h ^= u64(data2[5]) << 40;
|
||||||
|
@ -308,10 +308,10 @@ u64 GetCRC32(const u8 *src, int 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 = max(Step, 1u);
|
if (samples == 0) samples = 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]);
|
||||||
data += Step;
|
data += Step;
|
||||||
|
@ -380,9 +380,9 @@ u64 GetMurmurHash3(const u8* src, int 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 = max(Step, 1u);
|
if (samples == 0) samples = 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;
|
||||||
|
@ -395,7 +395,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
|
||||||
|
|
||||||
const u32 * blocks = (const u32 *)(data + nblocks*8);
|
const u32 * blocks = (const u32 *)(data + nblocks*8);
|
||||||
|
|
||||||
for(int i = -nblocks; i < 0; i+=Step)
|
for (int i = -nblocks; i < 0; i+=Step)
|
||||||
{
|
{
|
||||||
u32 k1 = getblock(blocks,i*2+0);
|
u32 k1 = getblock(blocks,i*2+0);
|
||||||
u32 k2 = getblock(blocks,i*2+1);
|
u32 k2 = getblock(blocks,i*2+1);
|
||||||
|
@ -411,7 +411,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
|
||||||
u32 k1 = 0;
|
u32 k1 = 0;
|
||||||
u32 k2 = 0;
|
u32 k2 = 0;
|
||||||
|
|
||||||
switch(len & 7)
|
switch (len & 7)
|
||||||
{
|
{
|
||||||
case 7: k2 ^= tail[6] << 16;
|
case 7: k2 ^= tail[6] << 16;
|
||||||
case 6: k2 ^= tail[5] << 8;
|
case 6: k2 ^= tail[5] << 8;
|
||||||
|
@ -456,10 +456,10 @@ u64 GetHashHiresTexture(const u8 *src, int 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 = max(Step, 1u);
|
if (samples == 0) samples = 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];
|
||||||
data+=Step;
|
data+=Step;
|
||||||
|
@ -472,7 +472,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||||
|
|
||||||
const u8 * data2 = (const u8*)end;
|
const u8 * data2 = (const u8*)end;
|
||||||
|
|
||||||
switch(len & 7)
|
switch (len & 7)
|
||||||
{
|
{
|
||||||
case 7: h ^= u64(data2[6]) << 48;
|
case 7: h ^= u64(data2[6]) << 48;
|
||||||
case 6: h ^= u64(data2[5]) << 40;
|
case 6: h ^= u64(data2[5]) << 40;
|
||||||
|
|
|
@ -373,8 +373,11 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data)
|
||||||
// Lines starting with '$', '*' or '+' are kept verbatim.
|
// Lines starting with '$', '*' or '+' are kept verbatim.
|
||||||
// Kind of a hack, but the support for raw lines inside an
|
// Kind of a hack, but the support for raw lines inside an
|
||||||
// INI is a hack anyway.
|
// INI is a hack anyway.
|
||||||
if ((key == "" && value == "")
|
if ((key == "" && value == "") ||
|
||||||
|| (line.size() >= 1 && (line[0] == '$' || line[0] == '+' || line[0] == '*')))
|
(line.size() >= 1 &&
|
||||||
|
(line[0] == '$' ||
|
||||||
|
line[0] == '+' ||
|
||||||
|
line[0] == '*')))
|
||||||
current_section->lines.push_back(line);
|
current_section->lines.push_back(line);
|
||||||
else
|
else
|
||||||
current_section->Set(key, value);
|
current_section->Set(key, value);
|
||||||
|
|
|
@ -150,8 +150,8 @@ private:
|
||||||
{
|
{
|
||||||
char file_header[sizeof(Header)];
|
char file_header[sizeof(Header)];
|
||||||
|
|
||||||
return (Read(file_header, sizeof(Header))
|
return (Read(file_header, sizeof(Header)) &&
|
||||||
&& !memcmp((const char*)&m_header, file_header, sizeof(Header)));
|
!memcmp((const char*)&m_header, file_header, sizeof(Header)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename D>
|
template <typename D>
|
||||||
|
|
|
@ -195,7 +195,7 @@ void Matrix44::LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33)
|
||||||
|
|
||||||
void Matrix44::Set(Matrix44 &mtx, const float mtxArray[16])
|
void Matrix44::Set(Matrix44 &mtx, const float mtxArray[16])
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 16; ++i)
|
for (int i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
mtx.data[i] = mtxArray[i];
|
mtx.data[i] = mtxArray[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
||||||
crit_caption = str_translator(_trans("Critical"));
|
crit_caption = str_translator(_trans("Critical"));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(Style)
|
switch (Style)
|
||||||
{
|
{
|
||||||
case INFORMATION:
|
case INFORMATION:
|
||||||
caption = info_caption;
|
caption = info_caption;
|
||||||
|
|
|
@ -84,13 +84,13 @@ void SettingsHandler::Reset()
|
||||||
|
|
||||||
void SettingsHandler::AddSetting(const std::string& key, const std::string& value)
|
void SettingsHandler::AddSetting(const std::string& key, const std::string& value)
|
||||||
{
|
{
|
||||||
for(const char& c : key) {
|
for (const char& c : key) {
|
||||||
WriteByte(c);
|
WriteByte(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteByte('=');
|
WriteByte('=');
|
||||||
|
|
||||||
for(const char& c : value) {
|
for (const char& c : value) {
|
||||||
WriteByte(c);
|
WriteByte(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,8 +173,8 @@ bool TryParse(const std::string &str, u32 *const output)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if ULONG_MAX > UINT_MAX
|
#if ULONG_MAX > UINT_MAX
|
||||||
if (value >= 0x100000000ull
|
if (value >= 0x100000000ull &&
|
||||||
&& value <= 0xFFFFFFFF00000000ull)
|
value <= 0xFFFFFFFF00000000ull)
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ std::string TabsToSpaces(int tab_size, const std::string &in)
|
||||||
|
|
||||||
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest)
|
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest)
|
||||||
{
|
{
|
||||||
while(1)
|
while (1)
|
||||||
{
|
{
|
||||||
size_t pos = result.find(src);
|
size_t pos = result.find(src);
|
||||||
if (pos == std::string::npos) break;
|
if (pos == std::string::npos) break;
|
||||||
|
@ -336,8 +336,8 @@ std::string UriDecode(const std::string & sSrc)
|
||||||
if (*pSrc == '%')
|
if (*pSrc == '%')
|
||||||
{
|
{
|
||||||
char dec1, dec2;
|
char dec1, dec2;
|
||||||
if (16 != (dec1 = HEX2DEC[*(pSrc + 1)])
|
if (16 != (dec1 = HEX2DEC[*(pSrc + 1)]) &&
|
||||||
&& 16 != (dec2 = HEX2DEC[*(pSrc + 2)]))
|
16 != (dec2 = HEX2DEC[*(pSrc + 2)]))
|
||||||
{
|
{
|
||||||
*pEnd++ = (dec1 << 4) + dec2;
|
*pEnd++ = (dec1 << 4) + dec2;
|
||||||
pSrc += 3;
|
pSrc += 3;
|
||||||
|
|
|
@ -153,7 +153,7 @@ u64 Timer::GetLocalTimeSinceJan1970()
|
||||||
|
|
||||||
// Account for DST where needed
|
// Account for DST where needed
|
||||||
gmTime = localtime(&sysTime);
|
gmTime = localtime(&sysTime);
|
||||||
if(gmTime->tm_isdst == 1)
|
if (gmTime->tm_isdst == 1)
|
||||||
tzDST = 3600;
|
tzDST = 3600;
|
||||||
else
|
else
|
||||||
tzDST = 0;
|
tzDST = 0;
|
||||||
|
|
|
@ -287,12 +287,15 @@ void XEmitter::ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||||
void XEmitter::ABI_CallFunction(void *func) {
|
void XEmitter::ABI_CallFunction(void *func) {
|
||||||
ABI_AlignStack(0);
|
ABI_AlignStack(0);
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -302,12 +305,15 @@ void XEmitter::ABI_CallFunctionC16(void *func, u16 param1) {
|
||||||
ABI_AlignStack(0);
|
ABI_AlignStack(0);
|
||||||
MOV(32, R(ABI_PARAM1), Imm32((u32)param1));
|
MOV(32, R(ABI_PARAM1), Imm32((u32)param1));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -318,12 +324,15 @@ void XEmitter::ABI_CallFunctionCC16(void *func, u32 param1, u16 param2) {
|
||||||
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
||||||
MOV(32, R(ABI_PARAM2), Imm32((u32)param2));
|
MOV(32, R(ABI_PARAM2), Imm32((u32)param2));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
// Far call
|
{
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
// Far call
|
||||||
CALLptr(R(RAX));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
} else {
|
CALLptr(R(RAX));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -333,12 +342,15 @@ void XEmitter::ABI_CallFunctionC(void *func, u32 param1) {
|
||||||
ABI_AlignStack(0);
|
ABI_AlignStack(0);
|
||||||
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -349,12 +361,15 @@ void XEmitter::ABI_CallFunctionCC(void *func, u32 param1, u32 param2) {
|
||||||
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
||||||
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -365,12 +380,15 @@ void XEmitter::ABI_CallFunctionCP(void *func, u32 param1, void *param2) {
|
||||||
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
MOV(32, R(ABI_PARAM1), Imm32(param1));
|
||||||
MOV(64, R(ABI_PARAM2), Imm64((u64)param2));
|
MOV(64, R(ABI_PARAM2), Imm64((u64)param2));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -382,12 +400,15 @@ void XEmitter::ABI_CallFunctionCCC(void *func, u32 param1, u32 param2, u32 param
|
||||||
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
||||||
MOV(32, R(ABI_PARAM3), Imm32(param3));
|
MOV(32, R(ABI_PARAM3), Imm32(param3));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -399,12 +420,15 @@ void XEmitter::ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *par
|
||||||
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
||||||
MOV(64, R(ABI_PARAM3), Imm64((u64)param3));
|
MOV(64, R(ABI_PARAM3), Imm64((u64)param3));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -417,12 +441,15 @@ void XEmitter::ABI_CallFunctionCCCP(void *func, u32 param1, u32 param2, u32 para
|
||||||
MOV(32, R(ABI_PARAM3), Imm32(param3));
|
MOV(32, R(ABI_PARAM3), Imm32(param3));
|
||||||
MOV(64, R(ABI_PARAM4), Imm64((u64)param4));
|
MOV(64, R(ABI_PARAM4), Imm64((u64)param4));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -433,12 +460,15 @@ void XEmitter::ABI_CallFunctionPC(void *func, void *param1, u32 param2) {
|
||||||
MOV(64, R(ABI_PARAM1), Imm64((u64)param1));
|
MOV(64, R(ABI_PARAM1), Imm64((u64)param1));
|
||||||
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -450,12 +480,15 @@ void XEmitter::ABI_CallFunctionPPC(void *func, void *param1, void *param2, u32 p
|
||||||
MOV(64, R(ABI_PARAM2), Imm64((u64)param2));
|
MOV(64, R(ABI_PARAM2), Imm64((u64)param2));
|
||||||
MOV(32, R(ABI_PARAM3), Imm32(param3));
|
MOV(32, R(ABI_PARAM3), Imm32(param3));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -467,12 +500,15 @@ void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) {
|
||||||
if (reg1 != ABI_PARAM1)
|
if (reg1 != ABI_PARAM1)
|
||||||
MOV(32, R(ABI_PARAM1), R(reg1));
|
MOV(32, R(ABI_PARAM1), R(reg1));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -481,24 +517,30 @@ void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) {
|
||||||
// Pass two registers as parameters.
|
// Pass two registers as parameters.
|
||||||
void XEmitter::ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2, bool noProlog) {
|
void XEmitter::ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2, bool noProlog) {
|
||||||
ABI_AlignStack(0, noProlog);
|
ABI_AlignStack(0, noProlog);
|
||||||
if (reg2 != ABI_PARAM1) {
|
if (reg2 != ABI_PARAM1)
|
||||||
|
{
|
||||||
if (reg1 != ABI_PARAM1)
|
if (reg1 != ABI_PARAM1)
|
||||||
MOV(64, R(ABI_PARAM1), R(reg1));
|
MOV(64, R(ABI_PARAM1), R(reg1));
|
||||||
if (reg2 != ABI_PARAM2)
|
if (reg2 != ABI_PARAM2)
|
||||||
MOV(64, R(ABI_PARAM2), R(reg2));
|
MOV(64, R(ABI_PARAM2), R(reg2));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (reg2 != ABI_PARAM2)
|
if (reg2 != ABI_PARAM2)
|
||||||
MOV(64, R(ABI_PARAM2), R(reg2));
|
MOV(64, R(ABI_PARAM2), R(reg2));
|
||||||
if (reg1 != ABI_PARAM1)
|
if (reg1 != ABI_PARAM1)
|
||||||
MOV(64, R(ABI_PARAM1), R(reg1));
|
MOV(64, R(ABI_PARAM1), R(reg1));
|
||||||
}
|
}
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0, noProlog);
|
ABI_RestoreStack(0, noProlog);
|
||||||
|
@ -511,12 +553,15 @@ void XEmitter::ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2
|
||||||
MOV(32, R(ABI_PARAM1), arg1);
|
MOV(32, R(ABI_PARAM1), arg1);
|
||||||
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
MOV(32, R(ABI_PARAM2), Imm32(param2));
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
@ -528,12 +573,15 @@ void XEmitter::ABI_CallFunctionA(void *func, const Gen::OpArg &arg1)
|
||||||
if (!arg1.IsSimpleReg(ABI_PARAM1))
|
if (!arg1.IsSimpleReg(ABI_PARAM1))
|
||||||
MOV(32, R(ABI_PARAM1), arg1);
|
MOV(32, R(ABI_PARAM1), arg1);
|
||||||
u64 distance = u64(func) - (u64(code) + 5);
|
u64 distance = u64(func) - (u64(code) + 5);
|
||||||
if (distance >= 0x0000000080000000ULL
|
if (distance >= 0x0000000080000000ULL &&
|
||||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
distance < 0xFFFFFFFF80000000ULL)
|
||||||
|
{
|
||||||
// Far call
|
// Far call
|
||||||
MOV(64, R(RAX), Imm64((u64)func));
|
MOV(64, R(RAX), Imm64((u64)func));
|
||||||
CALLptr(R(RAX));
|
CALLptr(R(RAX));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CALL(func);
|
CALL(func);
|
||||||
}
|
}
|
||||||
ABI_RestoreStack(0);
|
ABI_RestoreStack(0);
|
||||||
|
|
|
@ -49,7 +49,7 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo *info)
|
||||||
|
|
||||||
// Skip two-byte opcode byte
|
// Skip two-byte opcode byte
|
||||||
bool twoByte = false;
|
bool twoByte = false;
|
||||||
if(codeByte == 0x0F)
|
if (codeByte == 0x0F)
|
||||||
{
|
{
|
||||||
twoByte = true;
|
twoByte = true;
|
||||||
codeByte2 = *codePtr++;
|
codeByte2 = *codePtr++;
|
||||||
|
|
|
@ -208,11 +208,12 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg,
|
||||||
#if _M_X86_64
|
#if _M_X86_64
|
||||||
u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes;
|
u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes;
|
||||||
s64 distance = (s64)offset - (s64)ripAddr;
|
s64 distance = (s64)offset - (s64)ripAddr;
|
||||||
_assert_msg_(DYNA_REC, (distance < 0x80000000LL
|
_assert_msg_(DYNA_REC,
|
||||||
&& distance >= -0x80000000LL) ||
|
(distance < 0x80000000LL &&
|
||||||
!warn_64bit_offset,
|
distance >= -0x80000000LL) ||
|
||||||
"WriteRest: op out of range (0x%" PRIx64 " uses 0x%" PRIx64 ")",
|
!warn_64bit_offset,
|
||||||
ripAddr, offset);
|
"WriteRest: op out of range (0x%" PRIx64 " uses 0x%" PRIx64 ")",
|
||||||
|
ripAddr, offset);
|
||||||
s32 offs = (s32)distance;
|
s32 offs = (s32)distance;
|
||||||
emit->Write32((u32)offs);
|
emit->Write32((u32)offs);
|
||||||
#else
|
#else
|
||||||
|
@ -358,9 +359,9 @@ void XEmitter::JMP(const u8 *addr, bool force5Bytes)
|
||||||
{
|
{
|
||||||
s64 distance = (s64)(fn - ((u64)code + 5));
|
s64 distance = (s64)(fn - ((u64)code + 5));
|
||||||
|
|
||||||
_assert_msg_(DYNA_REC, distance >= -0x80000000LL
|
_assert_msg_(DYNA_REC,
|
||||||
&& distance < 0x80000000LL,
|
distance >= -0x80000000LL && distance < 0x80000000LL,
|
||||||
"Jump target too far away, needs indirect register");
|
"Jump target too far away, needs indirect register");
|
||||||
Write8(0xE9);
|
Write8(0xE9);
|
||||||
Write32((u32)(s32)distance);
|
Write32((u32)(s32)distance);
|
||||||
}
|
}
|
||||||
|
@ -396,9 +397,10 @@ void XEmitter::CALLptr(OpArg arg)
|
||||||
void XEmitter::CALL(const void *fnptr)
|
void XEmitter::CALL(const void *fnptr)
|
||||||
{
|
{
|
||||||
u64 distance = u64(fnptr) - (u64(code) + 5);
|
u64 distance = u64(fnptr) - (u64(code) + 5);
|
||||||
_assert_msg_(DYNA_REC, distance < 0x0000000080000000ULL
|
_assert_msg_(DYNA_REC,
|
||||||
|| distance >= 0xFFFFFFFF80000000ULL,
|
distance < 0x0000000080000000ULL ||
|
||||||
"CALL out of range (%p calls %p)", code, fnptr);
|
distance >= 0xFFFFFFFF80000000ULL,
|
||||||
|
"CALL out of range (%p calls %p)", code, fnptr);
|
||||||
Write8(0xE8);
|
Write8(0xE8);
|
||||||
Write32(u32(distance));
|
Write32(u32(distance));
|
||||||
}
|
}
|
||||||
|
@ -456,9 +458,9 @@ void XEmitter::J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s64 distance = (s64)(fn - ((u64)code + 6));
|
s64 distance = (s64)(fn - ((u64)code + 6));
|
||||||
_assert_msg_(DYNA_REC, distance >= -0x80000000LL
|
_assert_msg_(DYNA_REC,
|
||||||
&& distance < 0x80000000LL,
|
distance >= -0x80000000LL && distance < 0x80000000LL,
|
||||||
"Jump target too far away, needs indirect register");
|
"Jump target too far away, needs indirect register");
|
||||||
Write8(0x0F);
|
Write8(0x0F);
|
||||||
Write8(0x80 + conditionCode);
|
Write8(0x80 + conditionCode);
|
||||||
Write32((u32)(s32)distance);
|
Write32((u32)(s32)distance);
|
||||||
|
|
|
@ -115,8 +115,8 @@ bool CompareValues(const u32 val1, const u32 val2, const int type);
|
||||||
void LoadCodes(const IniFile& globalIni, const IniFile& localIni, bool forceLoad)
|
void LoadCodes(const IniFile& globalIni, const IniFile& localIni, bool forceLoad)
|
||||||
{
|
{
|
||||||
// Parses the Action Replay section of a game ini file.
|
// Parses the Action Replay section of a game ini file.
|
||||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats
|
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats &&
|
||||||
&& !forceLoad)
|
!forceLoad)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
arCodes.clear();
|
arCodes.clear();
|
||||||
|
@ -895,7 +895,7 @@ bool ConditionalCode(const ARAddr& addr, const u32 data, int* const pSkipCount)
|
||||||
|
|
||||||
bool CompareValues(const u32 val1, const u32 val2, const int type)
|
bool CompareValues(const u32 val1, const u32 val2, const int type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case CONDTIONAL_EQUAL:
|
case CONDTIONAL_EQUAL:
|
||||||
LogInfo("Type 1: If Equal");
|
LogInfo("Type 1: If Equal");
|
||||||
|
|
|
@ -312,7 +312,7 @@ bool CBoot::BootUp()
|
||||||
// ELF
|
// ELF
|
||||||
case SCoreStartupParameter::BOOT_ELF:
|
case SCoreStartupParameter::BOOT_ELF:
|
||||||
{
|
{
|
||||||
if(!File::Exists(_StartupPara.m_strFilename))
|
if (!File::Exists(_StartupPara.m_strFilename))
|
||||||
{
|
{
|
||||||
PanicAlertT("The file you specified (%s) does not exist",
|
PanicAlertT("The file you specified (%s) does not exist",
|
||||||
_StartupPara.m_strFilename.c_str());
|
_StartupPara.m_strFilename.c_str());
|
||||||
|
|
|
@ -137,7 +137,7 @@ bool CBoot::EmulatedBS2_GC()
|
||||||
INFO_LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
|
INFO_LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
|
||||||
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
|
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
|
||||||
|
|
||||||
} while(PowerPC::ppcState.gpr[3] != 0x00);
|
} while (PowerPC::ppcState.gpr[3] != 0x00);
|
||||||
|
|
||||||
// iAppLoaderClose
|
// iAppLoaderClose
|
||||||
DEBUG_LOG(MASTER_LOG, "call iAppLoaderClose");
|
DEBUG_LOG(MASTER_LOG, "call iAppLoaderClose");
|
||||||
|
@ -377,7 +377,7 @@ bool CBoot::EmulatedBS2_Wii()
|
||||||
|
|
||||||
INFO_LOG(BOOT, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
|
INFO_LOG(BOOT, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
|
||||||
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
|
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
|
||||||
} while(PowerPC::ppcState.gpr[3] != 0x00);
|
} while (PowerPC::ppcState.gpr[3] != 0x00);
|
||||||
|
|
||||||
// iAppLoaderClose
|
// iAppLoaderClose
|
||||||
DEBUG_LOG(BOOT, "Run iAppLoaderClose");
|
DEBUG_LOG(BOOT, "Run iAppLoaderClose");
|
||||||
|
|
|
@ -28,7 +28,7 @@ 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];
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ void CpuThread()
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_GDBSTUB
|
#ifdef USE_GDBSTUB
|
||||||
if(_CoreParameter.iGDBPort > 0)
|
if (_CoreParameter.iGDBPort > 0)
|
||||||
{
|
{
|
||||||
gdb_init(_CoreParameter.iGDBPort);
|
gdb_init(_CoreParameter.iGDBPort);
|
||||||
// break at next instruction (the first instruction)
|
// break at next instruction (the first instruction)
|
||||||
|
@ -353,7 +353,7 @@ void FifoPlayerThread()
|
||||||
|
|
||||||
g_bStarted = false;
|
g_bStarted = false;
|
||||||
|
|
||||||
if(!_CoreParameter.bCPUThread)
|
if (!_CoreParameter.bCPUThread)
|
||||||
g_video_backend->Video_Cleanup();
|
g_video_backend->Video_Cleanup();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -492,7 +492,7 @@ void EmuThread()
|
||||||
|
|
||||||
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
|
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
|
||||||
|
|
||||||
if(_CoreParameter.bCPUThread)
|
if (_CoreParameter.bCPUThread)
|
||||||
g_video_backend->Video_Cleanup();
|
g_video_backend->Video_Cleanup();
|
||||||
|
|
||||||
VolumeHandler::EjectVolume();
|
VolumeHandler::EjectVolume();
|
||||||
|
@ -644,7 +644,7 @@ bool ShouldSkipFrame(int skipped)
|
||||||
// Should be called from GPU thread when a frame is drawn
|
// Should be called from GPU thread when a frame is drawn
|
||||||
void Callback_VideoCopiedToXFB(bool video_update)
|
void Callback_VideoCopiedToXFB(bool video_update)
|
||||||
{
|
{
|
||||||
if(video_update)
|
if (video_update)
|
||||||
Common::AtomicIncrement(DrawnFrame);
|
Common::AtomicIncrement(DrawnFrame);
|
||||||
Movie::FrameUpdate();
|
Movie::FrameUpdate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ void (*advanceCallback)(int cyclesExecuted) = nullptr;
|
||||||
|
|
||||||
Event* GetNewEvent()
|
Event* GetNewEvent()
|
||||||
{
|
{
|
||||||
if(!eventPool)
|
if (!eventPool)
|
||||||
return new Event;
|
return new Event;
|
||||||
|
|
||||||
Event* ev = eventPool;
|
Event* ev = eventPool;
|
||||||
|
@ -127,7 +127,7 @@ void Shutdown()
|
||||||
ClearPendingEvents();
|
ClearPendingEvents();
|
||||||
UnregisterAllEvents();
|
UnregisterAllEvents();
|
||||||
|
|
||||||
while(eventPool)
|
while (eventPool)
|
||||||
{
|
{
|
||||||
Event *ev = eventPool;
|
Event *ev = eventPool;
|
||||||
eventPool = ev->next;
|
eventPool = ev->next;
|
||||||
|
@ -214,7 +214,7 @@ void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata
|
||||||
// in which case the event will get handled immediately, before returning.
|
// in which case the event will get handled immediately, before returning.
|
||||||
void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata)
|
void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata)
|
||||||
{
|
{
|
||||||
if(Core::IsCPUThread())
|
if (Core::IsCPUThread())
|
||||||
{
|
{
|
||||||
event_types[event_type].callback(userdata, 0);
|
event_types[event_type].callback(userdata, 0);
|
||||||
}
|
}
|
||||||
|
@ -238,10 +238,10 @@ void AddEventToQueue(Event* ne)
|
||||||
{
|
{
|
||||||
Event* prev = nullptr;
|
Event* prev = nullptr;
|
||||||
Event** pNext = &first;
|
Event** pNext = &first;
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
Event*& next = *pNext;
|
Event*& next = *pNext;
|
||||||
if(!next || ne->time < next->time)
|
if (!next || ne->time < next->time)
|
||||||
{
|
{
|
||||||
ne->next = next;
|
ne->next = next;
|
||||||
next = ne;
|
next = ne;
|
||||||
|
@ -287,7 +287,7 @@ void RemoveEvent(int event_type)
|
||||||
if (!first)
|
if (!first)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while(first)
|
while (first)
|
||||||
{
|
{
|
||||||
if (first->type == event_type)
|
if (first->type == event_type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,7 +90,7 @@ DSPAssembler::DSPAssembler(const AssemblerSettings &settings) :
|
||||||
|
|
||||||
DSPAssembler::~DSPAssembler()
|
DSPAssembler::~DSPAssembler()
|
||||||
{
|
{
|
||||||
if(gdg_buffer)
|
if (gdg_buffer)
|
||||||
free(gdg_buffer);
|
free(gdg_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ bool DSPAssembler::Assemble(const char *text, std::vector<u16> &code, std::vecto
|
||||||
if (m_totalSize > 0)
|
if (m_totalSize > 0)
|
||||||
{
|
{
|
||||||
gdg_buffer = (char *)malloc(m_totalSize * sizeof(u16) + 4);
|
gdg_buffer = (char *)malloc(m_totalSize * sizeof(u16) + 4);
|
||||||
if(!gdg_buffer)
|
if (!gdg_buffer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
memset(gdg_buffer, 0, m_totalSize * sizeof(u16));
|
memset(gdg_buffer, 0, m_totalSize * sizeof(u16));
|
||||||
|
@ -121,11 +121,13 @@ bool DSPAssembler::Assemble(const char *text, std::vector<u16> &code, std::vecto
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
code.resize(m_totalSize);
|
code.resize(m_totalSize);
|
||||||
for (int i = 0; i < m_totalSize; i++) {
|
for (int i = 0; i < m_totalSize; i++)
|
||||||
|
{
|
||||||
code[i] = *(u16 *)(gdg_buffer + i * 2);
|
code[i] = *(u16 *)(gdg_buffer + i * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gdg_buffer) {
|
if (gdg_buffer)
|
||||||
|
{
|
||||||
free(gdg_buffer);
|
free(gdg_buffer);
|
||||||
gdg_buffer = nullptr;
|
gdg_buffer = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +225,7 @@ s32 DSPAssembler::ParseValue(const char *str)
|
||||||
for (int i = 2; ptr[i] != 0; i++)
|
for (int i = 2; ptr[i] != 0; i++)
|
||||||
{
|
{
|
||||||
val *=2;
|
val *=2;
|
||||||
if(ptr[i] >= '0' && ptr[i] <= '1')
|
if (ptr[i] >= '0' && ptr[i] <= '1')
|
||||||
val += ptr[i] - '0';
|
val += ptr[i] - '0';
|
||||||
else
|
else
|
||||||
ShowError(ERR_INCORRECT_BIN, str);
|
ShowError(ERR_INCORRECT_BIN, str);
|
||||||
|
@ -773,7 +775,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
|
||||||
{
|
{
|
||||||
int opcode_size = 0;
|
int opcode_size = 0;
|
||||||
fsrc.getline(line, LINEBUF_SIZE);
|
fsrc.getline(line, LINEBUF_SIZE);
|
||||||
if(fsrc.fail())
|
if (fsrc.fail())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
cur_line = line;
|
cur_line = line;
|
||||||
|
@ -836,7 +838,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
|
||||||
{
|
{
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
|
|
||||||
for(int j = 0; j < (int)col_pos; j++)
|
for (int j = 0; j < (int)col_pos; j++)
|
||||||
{
|
{
|
||||||
if (j == 0)
|
if (j == 0)
|
||||||
if (!((ptr[j] >= 'A' && ptr[j] <= 'Z') || (ptr[j] == '_')))
|
if (!((ptr[j] >= 'A' && ptr[j] <= 'Z') || (ptr[j] == '_')))
|
||||||
|
|
|
@ -135,7 +135,7 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
|
||||||
{
|
{
|
||||||
std::vector<std::vector<u16> > codes_padded;
|
std::vector<std::vector<u16> > codes_padded;
|
||||||
u32 reserveSize = 0;
|
u32 reserveSize = 0;
|
||||||
for(u32 i = 0; i < numCodes; i++)
|
for (u32 i = 0; i < numCodes; i++)
|
||||||
{
|
{
|
||||||
codes_padded.push_back(codes[i]);
|
codes_padded.push_back(codes[i]);
|
||||||
// Pad with nops to 32byte boundary
|
// Pad with nops to 32byte boundary
|
||||||
|
@ -158,9 +158,9 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
|
||||||
header.append("};\n\n");
|
header.append("};\n\n");
|
||||||
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
|
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
|
||||||
|
|
||||||
for(u32 i = 0; i < numCodes; i++)
|
for (u32 i = 0; i < numCodes; i++)
|
||||||
{
|
{
|
||||||
if(codes[i].size() == 0)
|
if (codes[i].size() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
header.append("\t{\n\t\t");
|
header.append("\t{\n\t\t");
|
||||||
|
|
|
@ -202,7 +202,7 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
|
||||||
WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
|
WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
|
||||||
|
|
||||||
// Initialize JIT, if necessary
|
// Initialize JIT, if necessary
|
||||||
if(bUsingJIT)
|
if (bUsingJIT)
|
||||||
dspjit = new DSPEmitter();
|
dspjit = new DSPEmitter();
|
||||||
|
|
||||||
core_state = DSPCORE_RUNNING;
|
core_state = DSPCORE_RUNNING;
|
||||||
|
@ -216,7 +216,7 @@ void DSPCore_Shutdown()
|
||||||
|
|
||||||
core_state = DSPCORE_STOP;
|
core_state = DSPCORE_STOP;
|
||||||
|
|
||||||
if(dspjit) {
|
if (dspjit) {
|
||||||
delete dspjit;
|
delete dspjit;
|
||||||
dspjit = nullptr;
|
dspjit = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ void CompileCurrent()
|
||||||
while (retry)
|
while (retry)
|
||||||
{
|
{
|
||||||
retry = false;
|
retry = false;
|
||||||
for(u16 i = 0x0000; i < 0xffff; ++i)
|
for (u16 i = 0x0000; i < 0xffff; ++i)
|
||||||
{
|
{
|
||||||
if (!dspjit->unresolvedJumps[i].empty())
|
if (!dspjit->unresolvedJumps[i].empty())
|
||||||
{
|
{
|
||||||
|
@ -392,7 +392,7 @@ void CompileCurrent()
|
||||||
|
|
||||||
u16 DSPCore_ReadRegister(int reg)
|
u16 DSPCore_ReadRegister(int reg)
|
||||||
{
|
{
|
||||||
switch(reg)
|
switch (reg)
|
||||||
{
|
{
|
||||||
case DSP_REG_AR0:
|
case DSP_REG_AR0:
|
||||||
case DSP_REG_AR1:
|
case DSP_REG_AR1:
|
||||||
|
@ -443,7 +443,7 @@ u16 DSPCore_ReadRegister(int reg)
|
||||||
|
|
||||||
void DSPCore_WriteRegister(int reg, u16 val)
|
void DSPCore_WriteRegister(int reg, u16 val)
|
||||||
{
|
{
|
||||||
switch(reg)
|
switch (reg)
|
||||||
{
|
{
|
||||||
case DSP_REG_AR0:
|
case DSP_REG_AR0:
|
||||||
case DSP_REG_AR1:
|
case DSP_REG_AR1:
|
||||||
|
|
|
@ -34,7 +34,7 @@ DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1)
|
||||||
stubEntryPoint = CompileStub();
|
stubEntryPoint = CompileStub();
|
||||||
|
|
||||||
//clear all of the block references
|
//clear all of the block references
|
||||||
for(int i = 0x0000; i < MAX_BLOCKS; i++)
|
for (int i = 0x0000; i < MAX_BLOCKS; i++)
|
||||||
{
|
{
|
||||||
blocks[i] = (DSPCompiledCode)stubEntryPoint;
|
blocks[i] = (DSPCompiledCode)stubEntryPoint;
|
||||||
blockLinks[i] = nullptr;
|
blockLinks[i] = nullptr;
|
||||||
|
@ -52,7 +52,7 @@ DSPEmitter::~DSPEmitter()
|
||||||
|
|
||||||
void DSPEmitter::ClearIRAM()
|
void DSPEmitter::ClearIRAM()
|
||||||
{
|
{
|
||||||
for(int i = 0x0000; i < 0x1000; i++)
|
for (int i = 0x0000; i < 0x1000; i++)
|
||||||
{
|
{
|
||||||
blocks[i] = (DSPCompiledCode)stubEntryPoint;
|
blocks[i] = (DSPCompiledCode)stubEntryPoint;
|
||||||
blockLinks[i] = nullptr;
|
blockLinks[i] = nullptr;
|
||||||
|
@ -68,7 +68,7 @@ void DSPEmitter::ClearIRAMandDSPJITCodespaceReset()
|
||||||
CompileDispatcher();
|
CompileDispatcher();
|
||||||
stubEntryPoint = CompileStub();
|
stubEntryPoint = CompileStub();
|
||||||
|
|
||||||
for(int i = 0x0000; i < 0x10000; i++)
|
for (int i = 0x0000; i < 0x10000; i++)
|
||||||
{
|
{
|
||||||
blocks[i] = (DSPCompiledCode)stubEntryPoint;
|
blocks[i] = (DSPCompiledCode)stubEntryPoint;
|
||||||
blockLinks[i] = nullptr;
|
blockLinks[i] = nullptr;
|
||||||
|
@ -334,7 +334,7 @@ void DSPEmitter::Compile(u16 start_addr)
|
||||||
{
|
{
|
||||||
blockLinks[start_addr] = blockLinkEntry;
|
blockLinks[start_addr] = blockLinkEntry;
|
||||||
|
|
||||||
for(u16 i = 0x0000; i < 0xffff; ++i)
|
for (u16 i = 0x0000; i < 0xffff; ++i)
|
||||||
{
|
{
|
||||||
if (!unresolvedJumps[i].empty())
|
if (!unresolvedJumps[i].empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ void mv(const UDSPInstruction opc)
|
||||||
u8 sreg = (opc & 0x3) + DSP_REG_ACL0;
|
u8 sreg = (opc & 0x3) + DSP_REG_ACL0;
|
||||||
u8 dreg = ((opc >> 2) & 0x3);
|
u8 dreg = ((opc >> 2) & 0x3);
|
||||||
|
|
||||||
switch(sreg)
|
switch (sreg)
|
||||||
{
|
{
|
||||||
case DSP_REG_ACL0:
|
case DSP_REG_ACL0:
|
||||||
case DSP_REG_ACL1:
|
case DSP_REG_ACL1:
|
||||||
|
@ -97,7 +97,7 @@ void s(const UDSPInstruction opc)
|
||||||
u8 dreg = opc & 0x3;
|
u8 dreg = opc & 0x3;
|
||||||
u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0;
|
u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0;
|
||||||
|
|
||||||
switch(sreg)
|
switch (sreg)
|
||||||
{
|
{
|
||||||
case DSP_REG_ACL0:
|
case DSP_REG_ACL0:
|
||||||
case DSP_REG_ACL1:
|
case DSP_REG_ACL1:
|
||||||
|
@ -120,7 +120,7 @@ void sn(const UDSPInstruction opc)
|
||||||
u8 dreg = opc & 0x3;
|
u8 dreg = opc & 0x3;
|
||||||
u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0;
|
u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0;
|
||||||
|
|
||||||
switch(sreg)
|
switch (sreg)
|
||||||
{
|
{
|
||||||
case DSP_REG_ACL0:
|
case DSP_REG_ACL0:
|
||||||
case DSP_REG_ACL1:
|
case DSP_REG_ACL1:
|
||||||
|
|
|
@ -370,7 +370,7 @@ void addr(const UDSPInstruction opc)
|
||||||
|
|
||||||
s64 acc = dsp_get_long_acc(dreg);
|
s64 acc = dsp_get_long_acc(dreg);
|
||||||
s64 ax = 0;
|
s64 ax = 0;
|
||||||
switch(sreg) {
|
switch (sreg) {
|
||||||
case DSP_REG_AXL0:
|
case DSP_REG_AXL0:
|
||||||
case DSP_REG_AXL1:
|
case DSP_REG_AXL1:
|
||||||
ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l;
|
ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l;
|
||||||
|
@ -569,7 +569,7 @@ void subr(const UDSPInstruction opc)
|
||||||
|
|
||||||
s64 acc = dsp_get_long_acc(dreg);
|
s64 acc = dsp_get_long_acc(dreg);
|
||||||
s64 ax = 0;
|
s64 ax = 0;
|
||||||
switch(sreg) {
|
switch (sreg) {
|
||||||
case DSP_REG_AXL0:
|
case DSP_REG_AXL0:
|
||||||
case DSP_REG_AXL1:
|
case DSP_REG_AXL1:
|
||||||
ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l;
|
ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l;
|
||||||
|
@ -745,7 +745,7 @@ void movr(const UDSPInstruction opc)
|
||||||
u8 sreg = ((opc >> 9) & 0x3) + DSP_REG_AXL0;
|
u8 sreg = ((opc >> 9) & 0x3) + DSP_REG_AXL0;
|
||||||
|
|
||||||
s64 ax = 0;
|
s64 ax = 0;
|
||||||
switch(sreg)
|
switch (sreg)
|
||||||
{
|
{
|
||||||
case DSP_REG_AXL0:
|
case DSP_REG_AXL0:
|
||||||
case DSP_REG_AXL1:
|
case DSP_REG_AXL1:
|
||||||
|
|
|
@ -21,7 +21,7 @@ static void ReJitConditional(const UDSPInstruction opc, DSPEmitter& emitter)
|
||||||
|
|
||||||
emitter.dsp_op_read_reg(DSP_REG_SR, EAX);
|
emitter.dsp_op_read_reg(DSP_REG_SR, EAX);
|
||||||
|
|
||||||
switch(cond)
|
switch (cond)
|
||||||
{
|
{
|
||||||
case 0x0: // GE - Greater Equal
|
case 0x0: // GE - Greater Equal
|
||||||
case 0x1: // L - Less
|
case 0x1: // L - Less
|
||||||
|
|
|
@ -10,7 +10,7 @@ using namespace Gen;
|
||||||
|
|
||||||
static void *reg_ptr(int reg)
|
static void *reg_ptr(int reg)
|
||||||
{
|
{
|
||||||
switch(reg)
|
switch (reg)
|
||||||
{
|
{
|
||||||
case DSP_REG_AR0:
|
case DSP_REG_AR0:
|
||||||
case DSP_REG_AR1:
|
case DSP_REG_AR1:
|
||||||
|
@ -117,7 +117,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
||||||
xregs[R15].guest_reg = DSP_REG_NONE;
|
xregs[R15].guest_reg = DSP_REG_NONE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
regs[i].mem = reg_ptr(i);
|
regs[i].mem = reg_ptr(i);
|
||||||
regs[i].size = 0;
|
regs[i].size = 0;
|
||||||
|
@ -130,7 +130,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
||||||
regs[i].loc = M(regs[i].mem);
|
regs[i].loc = M(regs[i].mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i < 32; i++)
|
for (unsigned int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
regs[i].size = 2;
|
regs[i].size = 2;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
||||||
regs[DSP_REG_ACC0_64].host_reg = R8;
|
regs[DSP_REG_ACC0_64].host_reg = R8;
|
||||||
regs[DSP_REG_ACC1_64].host_reg = R9;
|
regs[DSP_REG_ACC1_64].host_reg = R9;
|
||||||
#endif
|
#endif
|
||||||
for(unsigned int i = 0; i < 2; i++)
|
for (unsigned int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
regs[i+DSP_REG_ACC0_64].size = 8;
|
regs[i+DSP_REG_ACC0_64].size = 8;
|
||||||
regs[i+DSP_REG_ACL0].parentReg = i+DSP_REG_ACC0_64;
|
regs[i+DSP_REG_ACL0].parentReg = i+DSP_REG_ACC0_64;
|
||||||
|
@ -162,7 +162,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
||||||
regs[DSP_REG_PRODM2].shift = 48;
|
regs[DSP_REG_PRODM2].shift = 48;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int i = 0; i < 2; i++)
|
for (unsigned int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
regs[i+DSP_REG_AX0_32].size = 4;
|
regs[i+DSP_REG_AX0_32].size = 4;
|
||||||
regs[i+DSP_REG_AXL0].parentReg = i+DSP_REG_AX0_32;
|
regs[i+DSP_REG_AXL0].parentReg = i+DSP_REG_AX0_32;
|
||||||
|
@ -209,7 +209,7 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
// drop all guest register not used by cache
|
// drop all guest register not used by cache
|
||||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
regs[i].used = false; //used is restored later
|
regs[i].used = false; //used is restored later
|
||||||
if (regs[i].loc.IsSimpleReg() &&
|
if (regs[i].loc.IsSimpleReg() &&
|
||||||
|
@ -224,7 +224,7 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
movcnt = 0;
|
movcnt = 0;
|
||||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
X64Reg simple = regs[i].loc.GetSimpleReg();
|
X64Reg simple = regs[i].loc.GetSimpleReg();
|
||||||
X64Reg simple_cache = cache.regs[i].loc.GetSimpleReg();
|
X64Reg simple_cache = cache.regs[i].loc.GetSimpleReg();
|
||||||
|
@ -238,7 +238,7 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
||||||
} while (movcnt != 0);
|
} while (movcnt != 0);
|
||||||
|
|
||||||
// free all host regs that are not used for the same guest reg
|
// free all host regs that are not used for the same guest reg
|
||||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
if (cache.regs[i].loc.GetSimpleReg() !=
|
if (cache.regs[i].loc.GetSimpleReg() !=
|
||||||
regs[i].loc.GetSimpleReg() &&
|
regs[i].loc.GetSimpleReg() &&
|
||||||
|
@ -249,14 +249,14 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// load all guest regs that are in memory and should be in host reg
|
// load all guest regs that are in memory and should be in host reg
|
||||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
if (cache.regs[i].loc.IsSimpleReg())
|
if (cache.regs[i].loc.IsSimpleReg())
|
||||||
{
|
{
|
||||||
movToHostReg(i, cache.regs[i].loc.GetSimpleReg(), true);
|
movToHostReg(i, cache.regs[i].loc.GetSimpleReg(), true);
|
||||||
rotateHostReg(i, cache.regs[i].shift, true);
|
rotateHostReg(i, cache.regs[i].shift, true);
|
||||||
}
|
}
|
||||||
else if(cache.regs[i].loc.IsImm())
|
else if (cache.regs[i].loc.IsImm())
|
||||||
{
|
{
|
||||||
// TODO: Immediates?
|
// TODO: Immediates?
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
||||||
|
|
||||||
// sync the freely used xregs
|
// sync the freely used xregs
|
||||||
if (!emit) {
|
if (!emit) {
|
||||||
for(i = 0; i < NUMXREGS; i++)
|
for (i = 0; i < NUMXREGS; i++)
|
||||||
{
|
{
|
||||||
if (cache.xregs[i].guest_reg == DSP_REG_USED &&
|
if (cache.xregs[i].guest_reg == DSP_REG_USED &&
|
||||||
xregs[i].guest_reg == DSP_REG_NONE)
|
xregs[i].guest_reg == DSP_REG_NONE)
|
||||||
|
@ -284,14 +284,14 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// consistency checks
|
// consistency checks
|
||||||
for(i = 0; i < NUMXREGS; i++)
|
for (i = 0; i < NUMXREGS; i++)
|
||||||
{
|
{
|
||||||
_assert_msg_(DSPLLE,
|
_assert_msg_(DSPLLE,
|
||||||
xregs[i].guest_reg == cache.xregs[i].guest_reg,
|
xregs[i].guest_reg == cache.xregs[i].guest_reg,
|
||||||
"cache and current xreg guest_reg mismatch for %zi", i);
|
"cache and current xreg guest_reg mismatch for %zi", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
_assert_msg_(DSPLLE,
|
_assert_msg_(DSPLLE,
|
||||||
regs[i].loc.IsImm() == cache.regs[i].loc.IsImm(),
|
regs[i].loc.IsImm() == cache.regs[i].loc.IsImm(),
|
||||||
|
@ -319,7 +319,7 @@ void DSPJitRegCache::flushMemBackedRegs()
|
||||||
// this should have the same effect as
|
// this should have the same effect as
|
||||||
// merge(DSPJitRegCache(emitter));
|
// merge(DSPJitRegCache(emitter));
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
_assert_msg_(DSPLLE, !regs[i].used,
|
_assert_msg_(DSPLLE, !regs[i].used,
|
||||||
"register %x still in use", i);
|
"register %x still in use", i);
|
||||||
|
@ -345,7 +345,7 @@ void DSPJitRegCache::flushRegs()
|
||||||
{
|
{
|
||||||
flushMemBackedRegs();
|
flushMemBackedRegs();
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
if (regs[i].host_reg != INVALID_REG)
|
if (regs[i].host_reg != INVALID_REG)
|
||||||
{
|
{
|
||||||
|
@ -353,7 +353,7 @@ void DSPJitRegCache::flushRegs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
_assert_msg_(DSPLLE,
|
_assert_msg_(DSPLLE,
|
||||||
!regs[i].loc.IsSimpleReg(),
|
!regs[i].loc.IsSimpleReg(),
|
||||||
|
@ -418,7 +418,7 @@ static u64 ebp_store;
|
||||||
|
|
||||||
void DSPJitRegCache::loadRegs(bool emit)
|
void DSPJitRegCache::loadRegs(bool emit)
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
if (regs[i].host_reg != INVALID_REG)
|
if (regs[i].host_reg != INVALID_REG)
|
||||||
{
|
{
|
||||||
|
@ -440,7 +440,7 @@ void DSPJitRegCache::saveRegs()
|
||||||
{
|
{
|
||||||
flushRegs();
|
flushRegs();
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
if (regs[i].host_reg != INVALID_REG)
|
if (regs[i].host_reg != INVALID_REG)
|
||||||
{
|
{
|
||||||
|
@ -448,7 +448,7 @@ void DSPJitRegCache::saveRegs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
_assert_msg_(DSPLLE,
|
_assert_msg_(DSPLLE,
|
||||||
!regs[i].loc.IsSimpleReg(),
|
!regs[i].loc.IsSimpleReg(),
|
||||||
|
@ -466,7 +466,7 @@ void DSPJitRegCache::pushRegs()
|
||||||
{
|
{
|
||||||
flushMemBackedRegs();
|
flushMemBackedRegs();
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
if (regs[i].host_reg != INVALID_REG)
|
if (regs[i].host_reg != INVALID_REG)
|
||||||
{
|
{
|
||||||
|
@ -494,7 +494,7 @@ void DSPJitRegCache::pushRegs()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int i = 0; i < NUMXREGS; i++)
|
for (unsigned int i = 0; i < NUMXREGS; i++)
|
||||||
{
|
{
|
||||||
if (xregs[i].guest_reg == DSP_REG_USED)
|
if (xregs[i].guest_reg == DSP_REG_USED)
|
||||||
{
|
{
|
||||||
|
@ -504,14 +504,14 @@ void DSPJitRegCache::pushRegs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
_assert_msg_(DSPLLE,
|
_assert_msg_(DSPLLE,
|
||||||
!regs[i].loc.IsSimpleReg(),
|
!regs[i].loc.IsSimpleReg(),
|
||||||
"register %x is still a simple reg", i);
|
"register %x is still a simple reg", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i < NUMXREGS; i++)
|
for (unsigned int i = 0; i < NUMXREGS; i++)
|
||||||
{
|
{
|
||||||
_assert_msg_(DSPLLE,
|
_assert_msg_(DSPLLE,
|
||||||
xregs[i].guest_reg == DSP_REG_NONE ||
|
xregs[i].guest_reg == DSP_REG_NONE ||
|
||||||
|
@ -541,7 +541,7 @@ void DSPJitRegCache::popRegs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = NUMXREGS-1; i >= 0; i--)
|
for (int i = NUMXREGS-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (xregs[i].pushed)
|
if (xregs[i].pushed)
|
||||||
{
|
{
|
||||||
|
@ -564,7 +564,7 @@ void DSPJitRegCache::popRegs() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||||
{
|
{
|
||||||
if (regs[i].host_reg != INVALID_REG)
|
if (regs[i].host_reg != INVALID_REG)
|
||||||
{
|
{
|
||||||
|
@ -618,7 +618,7 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load)
|
||||||
|
|
||||||
if (load)
|
if (load)
|
||||||
{
|
{
|
||||||
switch(regs[reg].size)
|
switch (regs[reg].size)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
emitter.MOV(16, R(host_reg), regs[reg].loc);
|
emitter.MOV(16, R(host_reg), regs[reg].loc);
|
||||||
|
@ -690,7 +690,7 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit)
|
||||||
|
|
||||||
if (shift > regs[reg].shift && emit)
|
if (shift > regs[reg].shift && emit)
|
||||||
{
|
{
|
||||||
switch(regs[reg].size)
|
switch (regs[reg].size)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
emitter.ROR(16, regs[reg].loc, Imm8(shift - regs[reg].shift));
|
emitter.ROR(16, regs[reg].loc, Imm8(shift - regs[reg].shift));
|
||||||
|
@ -707,7 +707,7 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit)
|
||||||
}
|
}
|
||||||
else if (shift < regs[reg].shift && emit)
|
else if (shift < regs[reg].shift && emit)
|
||||||
{
|
{
|
||||||
switch(regs[reg].size)
|
switch (regs[reg].size)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
emitter.ROL(16, regs[reg].loc, Imm8(regs[reg].shift - shift));
|
emitter.ROL(16, regs[reg].loc, Imm8(regs[reg].shift - shift));
|
||||||
|
@ -762,7 +762,7 @@ void DSPJitRegCache::movToMemory(int reg)
|
||||||
|
|
||||||
if (regs[reg].dirty)
|
if (regs[reg].dirty)
|
||||||
{
|
{
|
||||||
switch(regs[reg].size)
|
switch (regs[reg].size)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
emitter.MOV(16, tmp, regs[reg].loc);
|
emitter.MOV(16, tmp, regs[reg].loc);
|
||||||
|
@ -835,7 +835,7 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load)
|
||||||
regs[real_reg].used = true;
|
regs[real_reg].used = true;
|
||||||
|
|
||||||
//do some register specific fixup
|
//do some register specific fixup
|
||||||
switch(reg)
|
switch (reg)
|
||||||
{
|
{
|
||||||
#if _M_X86_64
|
#if _M_X86_64
|
||||||
case DSP_REG_ACC0_64:
|
case DSP_REG_ACC0_64:
|
||||||
|
@ -862,7 +862,7 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
||||||
|
|
||||||
OpArg oparg = regs[real_reg].loc;
|
OpArg oparg = regs[real_reg].loc;
|
||||||
|
|
||||||
switch(reg)
|
switch (reg)
|
||||||
{
|
{
|
||||||
case DSP_REG_ACH0:
|
case DSP_REG_ACH0:
|
||||||
case DSP_REG_ACH1:
|
case DSP_REG_ACH1:
|
||||||
|
@ -939,10 +939,10 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend
|
||||||
OpArg reg;
|
OpArg reg;
|
||||||
getReg(sreg, reg);
|
getReg(sreg, reg);
|
||||||
|
|
||||||
switch(regs[sreg].size)
|
switch (regs[sreg].size)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
switch(extend)
|
switch (extend)
|
||||||
{
|
{
|
||||||
#if _M_X86_64
|
#if _M_X86_64
|
||||||
case SIGN:
|
case SIGN:
|
||||||
|
@ -966,7 +966,7 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
#if _M_X86_64
|
#if _M_X86_64
|
||||||
switch(extend)
|
switch (extend)
|
||||||
{
|
{
|
||||||
case SIGN:
|
case SIGN:
|
||||||
emitter.MOVSX(64, 32, host_dreg, reg);
|
emitter.MOVSX(64, 32, host_dreg, reg);
|
||||||
|
@ -1000,7 +1000,7 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg)
|
||||||
getReg(dreg, reg, false);
|
getReg(dreg, reg, false);
|
||||||
if (arg.IsImm())
|
if (arg.IsImm())
|
||||||
{
|
{
|
||||||
switch(regs[dreg].size)
|
switch (regs[dreg].size)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
emitter.MOV(16, reg, Imm16((u16) arg.offset));
|
emitter.MOV(16, reg, Imm16((u16) arg.offset));
|
||||||
|
@ -1027,7 +1027,7 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch(regs[dreg].size)
|
switch (regs[dreg].size)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
emitter.MOV(16, reg, arg);
|
emitter.MOV(16, reg, arg);
|
||||||
|
|
|
@ -204,7 +204,7 @@ void DSPEmitter::dsp_op_read_reg_dont_saturate(int reg, Gen::X64Reg host_dreg, D
|
||||||
case DSP_REG_ST2:
|
case DSP_REG_ST2:
|
||||||
case DSP_REG_ST3:
|
case DSP_REG_ST3:
|
||||||
dsp_reg_load_stack(reg - DSP_REG_ST0, host_dreg);
|
dsp_reg_load_stack(reg - DSP_REG_ST0, host_dreg);
|
||||||
switch(extend)
|
switch (extend)
|
||||||
{
|
{
|
||||||
case SIGN:
|
case SIGN:
|
||||||
#if _M_X86_64
|
#if _M_X86_64
|
||||||
|
@ -240,7 +240,7 @@ void DSPEmitter::dsp_op_read_reg(int reg, Gen::X64Reg host_dreg, DSPJitSignExten
|
||||||
case DSP_REG_ST2:
|
case DSP_REG_ST2:
|
||||||
case DSP_REG_ST3:
|
case DSP_REG_ST3:
|
||||||
dsp_reg_load_stack(reg - DSP_REG_ST0, host_dreg);
|
dsp_reg_load_stack(reg - DSP_REG_ST0, host_dreg);
|
||||||
switch(extend)
|
switch (extend)
|
||||||
{
|
{
|
||||||
case SIGN:
|
case SIGN:
|
||||||
#if _M_X86_64
|
#if _M_X86_64
|
||||||
|
|
|
@ -128,14 +128,14 @@ void PPCDebugInterface::ClearAllMemChecks()
|
||||||
|
|
||||||
bool PPCDebugInterface::IsMemCheck(unsigned int address)
|
bool PPCDebugInterface::IsMemCheck(unsigned int address)
|
||||||
{
|
{
|
||||||
return (Memory::AreMemoryBreakpointsActivated()
|
return (Memory::AreMemoryBreakpointsActivated() &&
|
||||||
&& PowerPC::memchecks.GetMemCheck(address));
|
PowerPC::memchecks.GetMemCheck(address));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPCDebugInterface::ToggleMemCheck(unsigned int address)
|
void PPCDebugInterface::ToggleMemCheck(unsigned int address)
|
||||||
{
|
{
|
||||||
if (Memory::AreMemoryBreakpointsActivated()
|
if (Memory::AreMemoryBreakpointsActivated() &&
|
||||||
&& !PowerPC::memchecks.GetMemCheck(address))
|
!PowerPC::memchecks.GetMemCheck(address))
|
||||||
{
|
{
|
||||||
// Add Memory Check
|
// Add Memory Check
|
||||||
TMemCheck MemCheck;
|
TMemCheck MemCheck;
|
||||||
|
|
|
@ -159,7 +159,7 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
|
||||||
|
|
||||||
int cmd = ReadFifo8(data);
|
int cmd = ReadFifo8(data);
|
||||||
|
|
||||||
switch(cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case GX_NOP:
|
case GX_NOP:
|
||||||
case 0x44:
|
case 0x44:
|
||||||
|
|
|
@ -268,7 +268,7 @@ void HLEGeckoCodehandler()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(existing - magic > 5)
|
else if (existing - magic > 5)
|
||||||
{
|
{
|
||||||
existing = magic;
|
existing = magic;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,12 @@ void HLE_OSPanic()
|
||||||
void HLE_GeneralDebugPrint()
|
void HLE_GeneralDebugPrint()
|
||||||
{
|
{
|
||||||
std::string ReportMessage;
|
std::string ReportMessage;
|
||||||
if(*(u32*)Memory::GetPointer(GPR(3)) > 0x80000000){
|
if (*(u32*)Memory::GetPointer(GPR(3)) > 0x80000000)
|
||||||
|
{
|
||||||
GetStringVA(ReportMessage, 4);
|
GetStringVA(ReportMessage, 4);
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
GetStringVA(ReportMessage);
|
GetStringVA(ReportMessage);
|
||||||
}
|
}
|
||||||
NPC = LR;
|
NPC = LR;
|
||||||
|
@ -50,7 +53,8 @@ void HLE_VPrintf()
|
||||||
u32 offset = Memory::Read_U32(r4+8);
|
u32 offset = Memory::Read_U32(r4+8);
|
||||||
u32 check = Memory::Read_U32(r4);
|
u32 check = Memory::Read_U32(r4);
|
||||||
//NOTICE_LOG(OSREPORT, "Offset: %08X, Check %08X", offset, check);
|
//NOTICE_LOG(OSREPORT, "Offset: %08X, Check %08X", offset, check);
|
||||||
for(int i = 4; i<= 10; i++){
|
for (int i = 4; i<= 10; i++)
|
||||||
|
{
|
||||||
GPR(i) = Memory::Read_U32(offset+(i-(check == 0x01000000? 3 : 2))*4);
|
GPR(i) = Memory::Read_U32(offset+(i-(check == 0x01000000? 3 : 2))*4);
|
||||||
//NOTICE_LOG(OSREPORT, "r%d: %08X",i, GPR(i));
|
//NOTICE_LOG(OSREPORT, "r%d: %08X",i, GPR(i));
|
||||||
}
|
}
|
||||||
|
@ -96,18 +100,18 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(*pString)
|
while (*pString)
|
||||||
{
|
{
|
||||||
if (*pString == '%')
|
if (*pString == '%')
|
||||||
{
|
{
|
||||||
char* pArgument = ArgumentBuffer;
|
char* pArgument = ArgumentBuffer;
|
||||||
*pArgument++ = *pString++;
|
*pArgument++ = *pString++;
|
||||||
if(*pString == '%') {
|
if (*pString == '%') {
|
||||||
_rOutBuffer += "%";
|
_rOutBuffer += "%";
|
||||||
pString++;
|
pString++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
while(*pString < 'A' || *pString > 'z' || *pString == 'l' || *pString == '-')
|
while (*pString < 'A' || *pString > 'z' || *pString == 'l' || *pString == '-')
|
||||||
*pArgument++ = *pString++;
|
*pArgument++ = *pString++;
|
||||||
|
|
||||||
*pArgument++ = *pString;
|
*pArgument++ = *pString;
|
||||||
|
@ -130,7 +134,7 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
|
||||||
}
|
}
|
||||||
ParameterCounter++;
|
ParameterCounter++;
|
||||||
|
|
||||||
switch(*pString)
|
switch (*pString)
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
_rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer((u32)Parameter));
|
_rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer((u32)Parameter));
|
||||||
|
@ -170,7 +174,7 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
|
||||||
pString++;
|
pString++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(_rOutBuffer[_rOutBuffer.length() - 1] == '\n')
|
if (_rOutBuffer[_rOutBuffer.length() - 1] == '\n')
|
||||||
_rOutBuffer.resize(_rOutBuffer.length() - 1);
|
_rOutBuffer.resize(_rOutBuffer.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,7 @@ void DSPHLE::InitMixer()
|
||||||
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
|
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
|
||||||
delete soundStream;
|
delete soundStream;
|
||||||
soundStream = AudioCommon::InitSoundStream(new HLEMixer(this, AISampleRate, DACSampleRate, 48000), m_hWnd);
|
soundStream = AudioCommon::InitSoundStream(new HLEMixer(this, AISampleRate, DACSampleRate, 48000), m_hWnd);
|
||||||
if(!soundStream) PanicAlert("Error starting up sound stream");
|
if (!soundStream) PanicAlert("Error starting up sound stream");
|
||||||
// Mixer is initialized
|
// Mixer is initialized
|
||||||
m_InitMixer = true;
|
m_InitMixer = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ _lRestart:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while(i < _Size)
|
while (i < _Size)
|
||||||
{
|
{
|
||||||
s16 sample = ((pos[1] & mask) == mask) ? 0xc000 : 0x4000;
|
s16 sample = ((pos[1] & mask) == mask) ? 0xc000 : 0x4000;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Si
|
||||||
{
|
{
|
||||||
u16 address;
|
u16 address;
|
||||||
|
|
||||||
switch(PB.Format)
|
switch (PB.Format)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0x0004:
|
case 0x0004:
|
||||||
|
@ -161,7 +161,7 @@ void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Si
|
||||||
address = AddValueToReg(address, ((ACC0 >> 16) & 0xffff));
|
address = AddValueToReg(address, ((ACC0 >> 16) & 0xffff));
|
||||||
ACC0 &= 0xffff0000ffffULL;
|
ACC0 &= 0xffff0000ffffULL;
|
||||||
|
|
||||||
for(int i = 0; i < 0x50; i++)
|
for (int i = 0; i < 0x50; i++)
|
||||||
{
|
{
|
||||||
_Buffer[i] = m_MiscTable[address];
|
_Buffer[i] = m_MiscTable[address];
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ void PrintObject(const T &Obj)
|
||||||
ss << std::hex;
|
ss << std::hex;
|
||||||
for (size_t i = 0; i < sizeof(T); i++)
|
for (size_t i = 0; i < sizeof(T); i++)
|
||||||
{
|
{
|
||||||
if((i & 1) == 0)
|
if ((i & 1) == 0)
|
||||||
ss << ' ';
|
ss << ' ';
|
||||||
ss.width(2);
|
ss.width(2);
|
||||||
ss.fill('0');
|
ss.fill('0');
|
||||||
|
|
|
@ -185,7 +185,7 @@ void DSPLLE::InitMixer()
|
||||||
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
|
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
|
||||||
delete soundStream;
|
delete soundStream;
|
||||||
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000), m_hWnd);
|
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000), m_hWnd);
|
||||||
if(!soundStream) PanicAlert("Error starting up sound stream");
|
if (!soundStream) PanicAlert("Error starting up sound stream");
|
||||||
// Mixer is initialized
|
// Mixer is initialized
|
||||||
m_InitMixer = true;
|
m_InitMixer = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -521,7 +521,7 @@ void UpdateInterrupts()
|
||||||
|
|
||||||
void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt)
|
void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt)
|
||||||
{
|
{
|
||||||
switch(_DVDInterrupt)
|
switch (_DVDInterrupt)
|
||||||
{
|
{
|
||||||
case INT_DEINT: m_DISR.DEINT = 1; break;
|
case INT_DEINT: m_DISR.DEINT = 1; break;
|
||||||
case INT_TCINT: m_DISR.TCINT = 1; break;
|
case INT_TCINT: m_DISR.TCINT = 1; break;
|
||||||
|
@ -535,9 +535,9 @@ void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt)
|
||||||
void ExecuteCommand(UDICR& _DICR)
|
void ExecuteCommand(UDICR& _DICR)
|
||||||
{
|
{
|
||||||
// _dbg_assert_(DVDINTERFACE, _DICR.RW == 0); // only DVD to Memory
|
// _dbg_assert_(DVDINTERFACE, _DICR.RW == 0); // only DVD to Memory
|
||||||
int GCAM = ((SConfig::GetInstance().m_SIDevice[0] == SIDEVICE_AM_BASEBOARD)
|
int GCAM = ((SConfig::GetInstance().m_SIDevice[0] == SIDEVICE_AM_BASEBOARD) &&
|
||||||
&& (SConfig::GetInstance().m_EXIDevice[2] == EXIDEVICE_AM_BASEBOARD))
|
(SConfig::GetInstance().m_EXIDevice[2] == EXIDEVICE_AM_BASEBOARD))
|
||||||
? 1 : 0;
|
? 1 : 0;
|
||||||
|
|
||||||
if (GCAM)
|
if (GCAM)
|
||||||
{
|
{
|
||||||
|
@ -929,15 +929,15 @@ void ExecuteCommand(UDICR& _DICR)
|
||||||
// Just for fun
|
// Just for fun
|
||||||
case 0xFF:
|
case 0xFF:
|
||||||
{
|
{
|
||||||
if (m_DICMDBUF[0].Hex == 0xFF014D41
|
if (m_DICMDBUF[0].Hex == 0xFF014D41 &&
|
||||||
&& m_DICMDBUF[1].Hex == 0x54534849
|
m_DICMDBUF[1].Hex == 0x54534849 &&
|
||||||
&& m_DICMDBUF[2].Hex == 0x54410200)
|
m_DICMDBUF[2].Hex == 0x54410200)
|
||||||
{
|
{
|
||||||
INFO_LOG(DVDINTERFACE, "Unlock test 1 passed");
|
INFO_LOG(DVDINTERFACE, "Unlock test 1 passed");
|
||||||
}
|
}
|
||||||
else if (m_DICMDBUF[0].Hex == 0xFF004456
|
else if (m_DICMDBUF[0].Hex == 0xFF004456 &&
|
||||||
&& m_DICMDBUF[1].Hex == 0x442D4741
|
m_DICMDBUF[1].Hex == 0x442D4741 &&
|
||||||
&& m_DICMDBUF[2].Hex == 0x4D450300)
|
m_DICMDBUF[2].Hex == 0x4D450300)
|
||||||
{
|
{
|
||||||
INFO_LOG(DVDINTERFACE, "Unlock test 2 passed");
|
INFO_LOG(DVDINTERFACE, "Unlock test 2 passed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ void Init()
|
||||||
|
|
||||||
if (Movie::IsPlayingInput() && Movie::IsUsingMemcard() && Movie::IsConfigSaved())
|
if (Movie::IsPlayingInput() && Movie::IsUsingMemcard() && Movie::IsConfigSaved())
|
||||||
g_Channels[0]->AddDevice(EXIDEVICE_MEMORYCARD, 0); // SlotA
|
g_Channels[0]->AddDevice(EXIDEVICE_MEMORYCARD, 0); // SlotA
|
||||||
else if(Movie::IsPlayingInput() && !Movie::IsUsingMemcard() && Movie::IsConfigSaved())
|
else if (Movie::IsPlayingInput() && !Movie::IsUsingMemcard() && Movie::IsConfigSaved())
|
||||||
g_Channels[0]->AddDevice(EXIDEVICE_NONE, 0); // SlotA
|
g_Channels[0]->AddDevice(EXIDEVICE_NONE, 0); // SlotA
|
||||||
else
|
else
|
||||||
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
|
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
|
||||||
|
|
|
@ -137,7 +137,7 @@ void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
m_Control.TSTART = 0;
|
m_Control.TSTART = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_Control.TSTART) // completed !
|
if (!m_Control.TSTART) // completed !
|
||||||
{
|
{
|
||||||
m_Status.TCINT = 1;
|
m_Status.TCINT = 1;
|
||||||
CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
|
CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
|
||||||
|
@ -171,7 +171,7 @@ void CEXIChannel::AddDevice(IEXIDevice* pDevice, const int device_num, bool noti
|
||||||
// replace it with the new one
|
// replace it with the new one
|
||||||
m_pDevices[device_num].reset(pDevice);
|
m_pDevices[device_num].reset(pDevice);
|
||||||
|
|
||||||
if(notifyPresenceChanged)
|
if (notifyPresenceChanged)
|
||||||
{
|
{
|
||||||
// This means "device presence changed", software has to check
|
// This means "device presence changed", software has to check
|
||||||
// m_Status.EXT to see if it is now present or not
|
// m_Status.EXT to see if it is now present or not
|
||||||
|
@ -241,13 +241,13 @@ void CEXIChannel::DoState(PointerWrap &p)
|
||||||
p.Do(type);
|
p.Do(type);
|
||||||
IEXIDevice* pSaveDevice = (type == pDevice->m_deviceType) ? pDevice : EXIDevice_Create(type, m_ChannelId);
|
IEXIDevice* pSaveDevice = (type == pDevice->m_deviceType) ? pDevice : EXIDevice_Create(type, m_ChannelId);
|
||||||
pSaveDevice->DoState(p);
|
pSaveDevice->DoState(p);
|
||||||
if(pSaveDevice != pDevice)
|
if (pSaveDevice != pDevice)
|
||||||
{
|
{
|
||||||
// if we had to create a temporary device, discard it if we're not loading.
|
// if we had to create a temporary device, discard it if we're not loading.
|
||||||
// also, if no movie is active, we'll assume the user wants to keep their current devices
|
// also, if no movie is active, we'll assume the user wants to keep their current devices
|
||||||
// instead of the ones they had when the savestate was created,
|
// instead of the ones they had when the savestate was created,
|
||||||
// unless the device is NONE (since ChangeDevice sets that temporarily).
|
// unless the device is NONE (since ChangeDevice sets that temporarily).
|
||||||
if(p.GetMode() != PointerWrap::MODE_READ)
|
if (p.GetMode() != PointerWrap::MODE_READ)
|
||||||
{
|
{
|
||||||
delete pSaveDevice;
|
delete pSaveDevice;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,12 @@ void CEXIAD16::TransferByte(u8& _byte)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch(m_uCommand)
|
switch (m_uCommand)
|
||||||
{
|
{
|
||||||
case init:
|
case init:
|
||||||
{
|
{
|
||||||
m_uAD16Register.U32 = 0x04120000;
|
m_uAD16Register.U32 = 0x04120000;
|
||||||
switch(m_uPosition)
|
switch (m_uPosition)
|
||||||
{
|
{
|
||||||
case 1: _dbg_assert_(EXPANSIONINTERFACE, (_byte == 0x00)); break; // just skip
|
case 1: _dbg_assert_(EXPANSIONINTERFACE, (_byte == 0x00)); break; // just skip
|
||||||
case 2: _byte = m_uAD16Register.U8[0]; break;
|
case 2: _byte = m_uAD16Register.U8[0]; break;
|
||||||
|
@ -51,7 +51,7 @@ void CEXIAD16::TransferByte(u8& _byte)
|
||||||
|
|
||||||
case write:
|
case write:
|
||||||
{
|
{
|
||||||
switch(m_uPosition)
|
switch (m_uPosition)
|
||||||
{
|
{
|
||||||
case 1: m_uAD16Register.U8[0] = _byte; break;
|
case 1: m_uAD16Register.U8[0] = _byte; break;
|
||||||
case 2: m_uAD16Register.U8[1] = _byte; break;
|
case 2: m_uAD16Register.U8[1] = _byte; break;
|
||||||
|
@ -63,7 +63,7 @@ void CEXIAD16::TransferByte(u8& _byte)
|
||||||
|
|
||||||
case read:
|
case read:
|
||||||
{
|
{
|
||||||
switch(m_uPosition)
|
switch (m_uPosition)
|
||||||
{
|
{
|
||||||
case 1: _byte = m_uAD16Register.U8[0]; break;
|
case 1: _byte = m_uAD16Register.U8[0]; break;
|
||||||
case 2: _byte = m_uAD16Register.U8[1]; break;
|
case 2: _byte = m_uAD16Register.U8[1]; break;
|
||||||
|
|
|
@ -134,7 +134,7 @@ void innerFlush(FlushData* data)
|
||||||
// Flush memory card contents to disc
|
// Flush memory card contents to disc
|
||||||
void CEXIMemoryCard::Flush(bool exiting)
|
void CEXIMemoryCard::Flush(bool exiting)
|
||||||
{
|
{
|
||||||
if(!m_bDirty)
|
if (!m_bDirty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Core::g_CoreStartupParameter.bEnableMemcardSaving)
|
if (!Core::g_CoreStartupParameter.bEnableMemcardSaving)
|
||||||
|
@ -145,7 +145,7 @@ void CEXIMemoryCard::Flush(bool exiting)
|
||||||
flushThread.join();
|
flushThread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!exiting)
|
if (!exiting)
|
||||||
Core::DisplayMessage(StringFromFormat("Writing to memory card %c", card_index ? 'B' : 'A'), 1000);
|
Core::DisplayMessage(StringFromFormat("Writing to memory card %c", card_index ? 'B' : 'A'), 1000);
|
||||||
|
|
||||||
flushData.filename = m_strFilename;
|
flushData.filename = m_strFilename;
|
||||||
|
@ -423,7 +423,7 @@ void CEXIMemoryCard::TransferByte(u8 &byte)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_uPosition >= 5)
|
if (m_uPosition >= 5)
|
||||||
programming_buffer[((m_uPosition - 5) & 0x7F)] = byte; // wrap around after 128 bytes
|
programming_buffer[((m_uPosition - 5) & 0x7F)] = byte; // wrap around after 128 bytes
|
||||||
|
|
||||||
byte = 0xFF;
|
byte = 0xFF;
|
||||||
|
|
|
@ -155,7 +155,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
|
||||||
// the backup should be copied?
|
// the backup should be copied?
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if(BE16(dir_backup.UpdateCounter) > BE16(dir.UpdateCounter)) //check if the backup is newer
|
// if (BE16(dir_backup.UpdateCounter) > BE16(dir.UpdateCounter)) //check if the backup is newer
|
||||||
// {
|
// {
|
||||||
// dir = dir_backup;
|
// dir = dir_backup;
|
||||||
// bat = bat_backup; // needed?
|
// bat = bat_backup; // needed?
|
||||||
|
@ -348,7 +348,7 @@ u8 GCMemcard::TitlePresent(DEntry d) const
|
||||||
return DIRLEN;
|
return DIRLEN;
|
||||||
|
|
||||||
u8 i = 0;
|
u8 i = 0;
|
||||||
while(i < DIRLEN)
|
while (i < DIRLEN)
|
||||||
{
|
{
|
||||||
if ((BE32(CurrentDir->Dir[i].Gamecode) == BE32(d.Gamecode)) &&
|
if ((BE32(CurrentDir->Dir[i].Gamecode) == BE32(d.Gamecode)) &&
|
||||||
(!memcmp(CurrentDir->Dir[i].Filename, d.Filename, 32)))
|
(!memcmp(CurrentDir->Dir[i].Filename, d.Filename, 32)))
|
||||||
|
@ -433,7 +433,7 @@ std::string GCMemcard::DEntry_IconFmt(u8 index) const
|
||||||
|
|
||||||
int x = CurrentDir->Dir[index].IconFmt[0];
|
int x = CurrentDir->Dir[index].IconFmt[0];
|
||||||
std::string format;
|
std::string format;
|
||||||
for(int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (i == 8) x = CurrentDir->Dir[index].IconFmt[1];
|
if (i == 8) x = CurrentDir->Dir[index].IconFmt[1];
|
||||||
format.push_back((x & 0x80) ? '1' : '0');
|
format.push_back((x & 0x80) ? '1' : '0');
|
||||||
|
@ -449,7 +449,7 @@ std::string GCMemcard::DEntry_AnimSpeed(u8 index) const
|
||||||
|
|
||||||
int x = CurrentDir->Dir[index].AnimSpeed[0];
|
int x = CurrentDir->Dir[index].AnimSpeed[0];
|
||||||
std::string speed;
|
std::string speed;
|
||||||
for(int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (i == 8) x = CurrentDir->Dir[index].AnimSpeed[1];
|
if (i == 8) x = CurrentDir->Dir[index].AnimSpeed[1];
|
||||||
speed.push_back((x & 0x80) ? '1' : '0');
|
speed.push_back((x & 0x80) ? '1' : '0');
|
||||||
|
@ -929,7 +929,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire
|
||||||
|
|
||||||
gci.Seek(0, SEEK_SET);
|
gci.Seek(0, SEEK_SET);
|
||||||
|
|
||||||
switch(offset)
|
switch (offset)
|
||||||
{
|
{
|
||||||
case GCS:
|
case GCS:
|
||||||
u8 gcsHDR[GCS];
|
u8 gcsHDR[GCS];
|
||||||
|
@ -964,7 +964,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire
|
||||||
std::vector<GCMBlock> saveData;
|
std::vector<GCMBlock> saveData;
|
||||||
saveData.reserve(size);
|
saveData.reserve(size);
|
||||||
|
|
||||||
switch(GetSaveData(index, saveData))
|
switch (GetSaveData(index, saveData))
|
||||||
{
|
{
|
||||||
case FAIL:
|
case FAIL:
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
@ -985,7 +985,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire
|
||||||
|
|
||||||
void GCMemcard::Gcs_SavConvert(DEntry &tempDEntry, int saveType, int length)
|
void GCMemcard::Gcs_SavConvert(DEntry &tempDEntry, int saveType, int length)
|
||||||
{
|
{
|
||||||
switch(saveType)
|
switch (saveType)
|
||||||
{
|
{
|
||||||
case GCS:
|
case GCS:
|
||||||
{
|
{
|
||||||
|
@ -1171,7 +1171,7 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8 *delays) const
|
||||||
//Speed is set but there's no actual icon
|
//Speed is set but there's no actual icon
|
||||||
//This is used to reduce animation speed in Pikmin and Luigi's Mansion for example
|
//This is used to reduce animation speed in Pikmin and Luigi's Mansion for example
|
||||||
//These "blank frames" show the next icon
|
//These "blank frames" show the next icon
|
||||||
for(j=i; j<8;++j)
|
for (j=i; j<8;++j)
|
||||||
{
|
{
|
||||||
if (fmts[j] != 0)
|
if (fmts[j] != 0)
|
||||||
{
|
{
|
||||||
|
@ -1260,7 +1260,7 @@ void GCMemcard::FormatInternal(GCMC_Header &GCP)
|
||||||
u64 rand = CEXIIPL::GetGCTime();
|
u64 rand = CEXIIPL::GetGCTime();
|
||||||
p_hdr->formatTime = Common::swap64(rand);
|
p_hdr->formatTime = Common::swap64(rand);
|
||||||
|
|
||||||
for(int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16);
|
rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16);
|
||||||
p_hdr->serial[i] = (u8)(g_SRAM.flash_id[0][i] + (u32)rand);
|
p_hdr->serial[i] = (u8)(g_SRAM.flash_id[0][i] + (u32)rand);
|
||||||
|
|
|
@ -629,14 +629,14 @@ u32 LookupTLBPageAddress(const XCheckTLBFlag _Flag, const u32 vpa, u32 *paddr)
|
||||||
{
|
{
|
||||||
#ifdef FAST_TLB_CACHE
|
#ifdef FAST_TLB_CACHE
|
||||||
tlb_entry *tlbe = tlb[_Flag == FLAG_OPCODE][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK];
|
tlb_entry *tlbe = tlb[_Flag == FLAG_OPCODE][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK];
|
||||||
if(tlbe[0].tag == (vpa & ~0xfff) && !(tlbe[0].flags & TLB_FLAG_INVALID))
|
if (tlbe[0].tag == (vpa & ~0xfff) && !(tlbe[0].flags & TLB_FLAG_INVALID))
|
||||||
{
|
{
|
||||||
tlbe[0].flags |= TLB_FLAG_MOST_RECENT;
|
tlbe[0].flags |= TLB_FLAG_MOST_RECENT;
|
||||||
tlbe[1].flags &= ~TLB_FLAG_MOST_RECENT;
|
tlbe[1].flags &= ~TLB_FLAG_MOST_RECENT;
|
||||||
*paddr = tlbe[0].paddr | (vpa & 0xfff);
|
*paddr = tlbe[0].paddr | (vpa & 0xfff);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(tlbe[1].tag == (vpa & ~0xfff) && !(tlbe[1].flags & TLB_FLAG_INVALID))
|
if (tlbe[1].tag == (vpa & ~0xfff) && !(tlbe[1].flags & TLB_FLAG_INVALID))
|
||||||
{
|
{
|
||||||
tlbe[1].flags |= TLB_FLAG_MOST_RECENT;
|
tlbe[1].flags |= TLB_FLAG_MOST_RECENT;
|
||||||
tlbe[0].flags &= ~TLB_FLAG_MOST_RECENT;
|
tlbe[0].flags &= ~TLB_FLAG_MOST_RECENT;
|
||||||
|
@ -678,7 +678,7 @@ void UpdateTLBEntry(const XCheckTLBFlag _Flag, UPTE2 PTE2, const u32 vpa)
|
||||||
{
|
{
|
||||||
#ifdef FAST_TLB_CACHE
|
#ifdef FAST_TLB_CACHE
|
||||||
tlb_entry *tlbe = tlb[_Flag == FLAG_OPCODE][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK];
|
tlb_entry *tlbe = tlb[_Flag == FLAG_OPCODE][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK];
|
||||||
if((tlbe[0].flags & TLB_FLAG_MOST_RECENT) == 0)
|
if ((tlbe[0].flags & TLB_FLAG_MOST_RECENT) == 0)
|
||||||
{
|
{
|
||||||
tlbe[0].flags = TLB_FLAG_MOST_RECENT;
|
tlbe[0].flags = TLB_FLAG_MOST_RECENT;
|
||||||
tlbe[1].flags &= ~TLB_FLAG_MOST_RECENT;
|
tlbe[1].flags &= ~TLB_FLAG_MOST_RECENT;
|
||||||
|
@ -716,20 +716,20 @@ void InvalidateTLBEntry(u32 vpa)
|
||||||
{
|
{
|
||||||
#ifdef FAST_TLB_CACHE
|
#ifdef FAST_TLB_CACHE
|
||||||
tlb_entry *tlbe = tlb[0][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK];
|
tlb_entry *tlbe = tlb[0][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK];
|
||||||
if(tlbe[0].tag == (vpa & ~0xfff))
|
if (tlbe[0].tag == (vpa & ~0xfff))
|
||||||
{
|
{
|
||||||
tlbe[0].flags |= TLB_FLAG_INVALID;
|
tlbe[0].flags |= TLB_FLAG_INVALID;
|
||||||
}
|
}
|
||||||
if(tlbe[1].tag == (vpa & ~0xfff))
|
if (tlbe[1].tag == (vpa & ~0xfff))
|
||||||
{
|
{
|
||||||
tlbe[1].flags |= TLB_FLAG_INVALID;
|
tlbe[1].flags |= TLB_FLAG_INVALID;
|
||||||
}
|
}
|
||||||
tlb_entry *tlbe_i = tlb[1][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK];
|
tlb_entry *tlbe_i = tlb[1][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK];
|
||||||
if(tlbe_i[0].tag == (vpa & ~0xfff))
|
if (tlbe_i[0].tag == (vpa & ~0xfff))
|
||||||
{
|
{
|
||||||
tlbe_i[0].flags |= TLB_FLAG_INVALID;
|
tlbe_i[0].flags |= TLB_FLAG_INVALID;
|
||||||
}
|
}
|
||||||
if(tlbe_i[1].tag == (vpa & ~0xfff))
|
if (tlbe_i[1].tag == (vpa & ~0xfff))
|
||||||
{
|
{
|
||||||
tlbe_i[1].flags |= TLB_FLAG_INVALID;
|
tlbe_i[1].flags |= TLB_FLAG_INVALID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ static u8 g_SIBuffer[128];
|
||||||
|
|
||||||
void DoState(PointerWrap &p)
|
void DoState(PointerWrap &p)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < MAX_SI_CHANNELS; i++)
|
for (int i = 0; i < MAX_SI_CHANNELS; i++)
|
||||||
{
|
{
|
||||||
p.Do(g_Channel[i].m_InHi.Hex);
|
p.Do(g_Channel[i].m_InHi.Hex);
|
||||||
p.Do(g_Channel[i].m_InLo.Hex);
|
p.Do(g_Channel[i].m_InLo.Hex);
|
||||||
|
@ -223,12 +223,12 @@ void DoState(PointerWrap &p)
|
||||||
p.Do(type);
|
p.Do(type);
|
||||||
ISIDevice* pSaveDevice = (type == pDevice->GetDeviceType()) ? pDevice : SIDevice_Create(type, i);
|
ISIDevice* pSaveDevice = (type == pDevice->GetDeviceType()) ? pDevice : SIDevice_Create(type, i);
|
||||||
pSaveDevice->DoState(p);
|
pSaveDevice->DoState(p);
|
||||||
if(pSaveDevice != pDevice)
|
if (pSaveDevice != pDevice)
|
||||||
{
|
{
|
||||||
// if we had to create a temporary device, discard it if we're not loading.
|
// if we had to create a temporary device, discard it if we're not loading.
|
||||||
// also, if no movie is active, we'll assume the user wants to keep their current devices
|
// also, if no movie is active, we'll assume the user wants to keep their current devices
|
||||||
// instead of the ones they had when the savestate was created.
|
// instead of the ones they had when the savestate was created.
|
||||||
if(p.GetMode() != PointerWrap::MODE_READ ||
|
if (p.GetMode() != PointerWrap::MODE_READ ||
|
||||||
(!Movie::IsRecordingInput() && !Movie::IsPlayingInput()))
|
(!Movie::IsRecordingInput() && !Movie::IsPlayingInput()))
|
||||||
{
|
{
|
||||||
delete pSaveDevice;
|
delete pSaveDevice;
|
||||||
|
@ -355,7 +355,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
||||||
USIStatusReg tmpStatus(val);
|
USIStatusReg tmpStatus(val);
|
||||||
|
|
||||||
// clear bits ( if(tmp.bit) SISR.bit=0 )
|
// clear bits ( if (tmp.bit) SISR.bit=0 )
|
||||||
if (tmpStatus.NOREP0) g_StatusReg.NOREP0 = 0;
|
if (tmpStatus.NOREP0) g_StatusReg.NOREP0 = 0;
|
||||||
if (tmpStatus.COLL0) g_StatusReg.COLL0 = 0;
|
if (tmpStatus.COLL0) g_StatusReg.COLL0 = 0;
|
||||||
if (tmpStatus.OVRUN0) g_StatusReg.OVRUN0 = 0;
|
if (tmpStatus.OVRUN0) g_StatusReg.OVRUN0 = 0;
|
||||||
|
@ -422,7 +422,7 @@ void UpdateInterrupts()
|
||||||
|
|
||||||
void GenerateSIInterrupt(SIInterruptType _SIInterrupt)
|
void GenerateSIInterrupt(SIInterruptType _SIInterrupt)
|
||||||
{
|
{
|
||||||
switch(_SIInterrupt)
|
switch (_SIInterrupt)
|
||||||
{
|
{
|
||||||
case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break;
|
case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break;
|
||||||
case INT_TCINT: g_ComCSR.TCINT = 1; break;
|
case INT_TCINT: g_ComCSR.TCINT = 1; break;
|
||||||
|
|
|
@ -18,7 +18,7 @@ int ISIDevice::RunBuffer(u8* _pBuffer, int _iLength)
|
||||||
|
|
||||||
char szTemp[256] = "";
|
char szTemp[256] = "";
|
||||||
int num = 0;
|
int num = 0;
|
||||||
while(num < _iLength)
|
while (num < _iLength)
|
||||||
{
|
{
|
||||||
char szTemp2[128] = "";
|
char szTemp2[128] = "";
|
||||||
sprintf(szTemp2, "0x%02x ", _pBuffer[num^3]);
|
sprintf(szTemp2, "0x%02x ", _pBuffer[num^3]);
|
||||||
|
|
|
@ -90,14 +90,14 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
|
||||||
ISIDevice::RunBuffer(_pBuffer, _iLength);
|
ISIDevice::RunBuffer(_pBuffer, _iLength);
|
||||||
|
|
||||||
int iPosition = 0;
|
int iPosition = 0;
|
||||||
while(iPosition < _iLength)
|
while (iPosition < _iLength)
|
||||||
{
|
{
|
||||||
// read the command
|
// read the command
|
||||||
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
|
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
|
||||||
iPosition++;
|
iPosition++;
|
||||||
|
|
||||||
// handle it
|
// handle it
|
||||||
switch(command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case CMD_RESET: // returns ID and dip switches
|
case CMD_RESET: // returns ID and dip switches
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,12 +122,12 @@ bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low)
|
||||||
|
|
||||||
Movie::SetPolledDevice();
|
Movie::SetPolledDevice();
|
||||||
|
|
||||||
if(Movie::IsPlayingInput())
|
if (Movie::IsPlayingInput())
|
||||||
{
|
{
|
||||||
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
|
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||||
Movie::InputUpdate();
|
Movie::InputUpdate();
|
||||||
}
|
}
|
||||||
else if(Movie::IsRecordingInput())
|
else if (Movie::IsRecordingInput())
|
||||||
{
|
{
|
||||||
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
|
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||||
Movie::InputUpdate();
|
Movie::InputUpdate();
|
||||||
|
|
|
@ -122,12 +122,12 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||||
|
|
||||||
Movie::SetPolledDevice();
|
Movie::SetPolledDevice();
|
||||||
|
|
||||||
if(Movie::IsPlayingInput())
|
if (Movie::IsPlayingInput())
|
||||||
{
|
{
|
||||||
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
|
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||||
Movie::InputUpdate();
|
Movie::InputUpdate();
|
||||||
}
|
}
|
||||||
else if(Movie::IsRecordingInput())
|
else if (Movie::IsRecordingInput())
|
||||||
{
|
{
|
||||||
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
|
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||||
Movie::InputUpdate();
|
Movie::InputUpdate();
|
||||||
|
|
|
@ -113,12 +113,12 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low)
|
||||||
|
|
||||||
Movie::SetPolledDevice();
|
Movie::SetPolledDevice();
|
||||||
|
|
||||||
if(Movie::IsPlayingInput())
|
if (Movie::IsPlayingInput())
|
||||||
{
|
{
|
||||||
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
|
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||||
Movie::InputUpdate();
|
Movie::InputUpdate();
|
||||||
}
|
}
|
||||||
else if(Movie::IsRecordingInput())
|
else if (Movie::IsRecordingInput())
|
||||||
{
|
{
|
||||||
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
|
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||||
Movie::InputUpdate();
|
Movie::InputUpdate();
|
||||||
|
|
|
@ -78,7 +78,7 @@ void SetCardFlashID(u8* buffer, u8 card_index)
|
||||||
{
|
{
|
||||||
u64 rand = Common::swap64( *(u64*)&(buffer[12]));
|
u64 rand = Common::swap64( *(u64*)&(buffer[12]));
|
||||||
u8 csum=0;
|
u8 csum=0;
|
||||||
for(int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16);
|
rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16);
|
||||||
csum += g_SRAM.flash_id[card_index][i] = buffer[i] - ((u8)rand&0xff);
|
csum += g_SRAM.flash_id[card_index][i] = buffer[i] - ((u8)rand&0xff);
|
||||||
|
|
|
@ -515,7 +515,7 @@ static void BeginField(FieldType field)
|
||||||
// But the PAL ports of some games are poorly programmed and don't use correct ordering.
|
// But the PAL ports of some games are poorly programmed and don't use correct ordering.
|
||||||
// Zelda: Wind Waker and Simpsons Hit & Run are exampes of this, there are probally more.
|
// Zelda: Wind Waker and Simpsons Hit & Run are exampes of this, there are probally more.
|
||||||
// PAL Wind Waker also runs at 30fps instead of 25.
|
// PAL Wind Waker also runs at 30fps instead of 25.
|
||||||
if(field == FieldType::FIELD_PROGRESSIVE || GetXFBAddressBottom() != (GetXFBAddressTop() - 1280))
|
if (field == FieldType::FIELD_PROGRESSIVE || GetXFBAddressBottom() != (GetXFBAddressTop() - 1280))
|
||||||
{
|
{
|
||||||
WARN_LOG(VIDEOINTERFACE, "PAL game is trying to use incorrect (NTSC) field ordering");
|
WARN_LOG(VIDEOINTERFACE, "PAL game is trying to use incorrect (NTSC) field ordering");
|
||||||
// Lets kindly fix this for them.
|
// Lets kindly fix this for them.
|
||||||
|
@ -523,7 +523,9 @@ static void BeginField(FieldType field)
|
||||||
|
|
||||||
// TODO: PAL Simpsons Hit & Run now has a green line at the bottom when Real XFB is used.
|
// TODO: PAL Simpsons Hit & Run now has a green line at the bottom when Real XFB is used.
|
||||||
// Might be a bug later on in our code, or a bug in the actual game.
|
// Might be a bug later on in our code, or a bug in the actual game.
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
xfbAddr = GetXFBAddressBottom();
|
xfbAddr = GetXFBAddressBottom();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -67,7 +67,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
u8 data[32] = {};
|
u8 data[32] = {};
|
||||||
memcpy(data, data_, size_);
|
memcpy(data, data_, size_);
|
||||||
|
|
||||||
switch(data[1])
|
switch (data[1])
|
||||||
{
|
{
|
||||||
case WM_RUMBLE:
|
case WM_RUMBLE:
|
||||||
size = 1;
|
size = 1;
|
||||||
|
@ -109,7 +109,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
u32 address = Common::swap24(wd->address);
|
u32 address = Common::swap24(wd->address);
|
||||||
address &= ~0x010000;
|
address &= ~0x010000;
|
||||||
|
|
||||||
switch(data[2] >> 0x01)
|
switch (data[2] >> 0x01)
|
||||||
{
|
{
|
||||||
case WM_SPACE_EEPROM:
|
case WM_SPACE_EEPROM:
|
||||||
if (logCom) Name.append(" REG_EEPROM"); break;
|
if (logCom) Name.append(" REG_EEPROM"); break;
|
||||||
|
@ -120,16 +120,16 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
void *region_ptr = nullptr;
|
void *region_ptr = nullptr;
|
||||||
int region_size = 0;
|
int region_size = 0;
|
||||||
|
|
||||||
switch(data[3])
|
switch (data[3])
|
||||||
{
|
{
|
||||||
case 0xa2:
|
case 0xa2:
|
||||||
if (logCom)
|
if (logCom)
|
||||||
{
|
{
|
||||||
Name.append(" REG_SPEAKER");
|
Name.append(" REG_SPEAKER");
|
||||||
if(data[6] == 7)
|
if (data[6] == 7)
|
||||||
{
|
{
|
||||||
//INFO_LOG(CONSOLE, "Sound configuration:");
|
//INFO_LOG(CONSOLE, "Sound configuration:");
|
||||||
if(data[8] == 0x00)
|
if (data[8] == 0x00)
|
||||||
{
|
{
|
||||||
//memcpy(&SampleValue, &data[9], 2);
|
//memcpy(&SampleValue, &data[9], 2);
|
||||||
//NOTICE_LOG(CONSOLE, " Data format: 4-bit ADPCM (%i Hz)", 6000000 / SampleValue);
|
//NOTICE_LOG(CONSOLE, " Data format: 4-bit ADPCM (%i Hz)", 6000000 / SampleValue);
|
||||||
|
@ -173,7 +173,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
memcpy((u8*)region_ptr + region_offset, wd->data, wd->size);
|
memcpy((u8*)region_ptr + region_offset, wd->data, wd->size);
|
||||||
// save key
|
// save key
|
||||||
if (region_offset >= 0x40 && region_offset <= 0x4c) {
|
if (region_offset >= 0x40 && region_offset <= 0x4c) {
|
||||||
if(!emu)
|
if (!emu)
|
||||||
wiimote_gen_key(&wm->m_ext_key, wm->m_reg_ext.encryption_key);
|
wiimote_gen_key(&wm->m_ext_key, wm->m_reg_ext.encryption_key);
|
||||||
INFO_LOG(CONSOLE, "Writing key: %s", ArrayToString((u8*)&wm->m_ext_key, sizeof(wm->m_ext_key), 0, 30).c_str());
|
INFO_LOG(CONSOLE, "Writing key: %s", ArrayToString((u8*)&wm->m_ext_key, sizeof(wm->m_ext_key), 0, 30).c_str());
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
|
|
||||||
dataRep.push(((data[2]>>1)<<16) + ((data[3])<<8) + addressLO);
|
dataRep.push(((data[2]>>1)<<16) + ((data[3])<<8) + addressLO);
|
||||||
|
|
||||||
switch(data[2]>>1)
|
switch (data[2]>>1)
|
||||||
{
|
{
|
||||||
case WM_SPACE_EEPROM:
|
case WM_SPACE_EEPROM:
|
||||||
if (logCom) Name.append(" REG_EEPROM");
|
if (logCom) Name.append(" REG_EEPROM");
|
||||||
|
@ -216,7 +216,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
// ignore second byte for extension area
|
// ignore second byte for extension area
|
||||||
if (address>>16 == 0xA4) address &= 0xFF00FF;
|
if (address>>16 == 0xA4) address &= 0xFF00FF;
|
||||||
const u8 region_offset = (u8)address;
|
const u8 region_offset = (u8)address;
|
||||||
switch(data[3])
|
switch (data[3])
|
||||||
{
|
{
|
||||||
case 0xa2:
|
case 0xa2:
|
||||||
if (logCom) Name.append(" REG_SPEAKER");
|
if (logCom) Name.append(" REG_SPEAKER");
|
||||||
|
@ -300,7 +300,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
wm_read_data_reply* const rdr = (wm_read_data_reply*)(data2 + 2);
|
wm_read_data_reply* const rdr = (wm_read_data_reply*)(data2 + 2);
|
||||||
|
|
||||||
bool decrypted = false;
|
bool decrypted = false;
|
||||||
if(!dataRep.empty())
|
if (!dataRep.empty())
|
||||||
{
|
{
|
||||||
dataReply[0] = (dataRep.front()>>16)&0x00FF;
|
dataReply[0] = (dataRep.front()>>16)&0x00FF;
|
||||||
dataReply[1] = (dataRep.front()>>8)&0x00FF;
|
dataReply[1] = (dataRep.front()>>8)&0x00FF;
|
||||||
|
@ -308,14 +308,14 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
dataRep.pop();
|
dataRep.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(dataReply[0])
|
switch (dataReply[0])
|
||||||
{
|
{
|
||||||
case WM_SPACE_EEPROM:
|
case WM_SPACE_EEPROM:
|
||||||
if (logCom)
|
if (logCom)
|
||||||
Name.append(" REG_EEPROM");
|
Name.append(" REG_EEPROM");
|
||||||
// Wiimote calibration
|
// Wiimote calibration
|
||||||
if(data[4] == 0xf0 && data[5] == 0x00 && data[6] == 0x10) {
|
if (data[4] == 0xf0 && data[5] == 0x00 && data[6] == 0x10) {
|
||||||
if(data[6] == 0x10) {
|
if (data[6] == 0x10) {
|
||||||
accel_cal* calib = (accel_cal*)&rdr->data[6];
|
accel_cal* calib = (accel_cal*)&rdr->data[6];
|
||||||
ERROR_LOG(CONSOLE, "Wiimote calibration:");
|
ERROR_LOG(CONSOLE, "Wiimote calibration:");
|
||||||
//SERROR_LOG(CONSOLE, "%s", ArrayToString(rdr->data, rdr->size).c_str());
|
//SERROR_LOG(CONSOLE, "%s", ArrayToString(rdr->data, rdr->size).c_str());
|
||||||
|
@ -334,7 +334,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
|
|
||||||
case WM_SPACE_REGS1:
|
case WM_SPACE_REGS1:
|
||||||
case WM_SPACE_REGS2:
|
case WM_SPACE_REGS2:
|
||||||
switch(dataReply[1])
|
switch (dataReply[1])
|
||||||
{
|
{
|
||||||
case 0xa2: if (logCom) Name.append(" REG_SPEAKER"); break;
|
case 0xa2: if (logCom) Name.append(" REG_SPEAKER"); break;
|
||||||
case 0xa4: if (logCom) Name.append(" REG_EXT"); break;
|
case 0xa4: if (logCom) Name.append(" REG_EXT"); break;
|
||||||
|
@ -387,7 +387,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nunchuck calibration
|
// Nunchuck calibration
|
||||||
if(data[4] == 0xf0 && data[5] == 0x00 && (data[6] == 0x20 || data[6] == 0x30))
|
if (data[4] == 0xf0 && data[5] == 0x00 && (data[6] == 0x20 || data[6] == 0x30))
|
||||||
{
|
{
|
||||||
// log
|
// log
|
||||||
//TmpData = StringFromFormat("Read[%s] (enc): %s", (Emu ? "Emu" : "Real"), ArrayToString(data, size + 2).c_str());
|
//TmpData = StringFromFormat("Read[%s] (enc): %s", (Emu ? "Emu" : "Real"), ArrayToString(data, size + 2).c_str());
|
||||||
|
@ -435,7 +435,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
if (!emu)
|
if (!emu)
|
||||||
{
|
{
|
||||||
// Save to registry
|
// Save to registry
|
||||||
if(data[7 + 0] != 0xff)
|
if (data[7 + 0] != 0xff)
|
||||||
{
|
{
|
||||||
//memcpy((u8*)&wm->m_reg_ext.calibration, &data[7], 0x10);
|
//memcpy((u8*)&wm->m_reg_ext.calibration, &data[7], 0x10);
|
||||||
//memcpy((u8*)&wm->m_reg_ext.unknown3, &data[7], 0x10);
|
//memcpy((u8*)&wm->m_reg_ext.unknown3, &data[7], 0x10);
|
||||||
|
@ -448,7 +448,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
//WiimoteEmu::UpdateEeprom();
|
//WiimoteEmu::UpdateEeprom();
|
||||||
}
|
}
|
||||||
// third party Nunchuck
|
// third party Nunchuck
|
||||||
else if(data[7] == 0xff)
|
else if (data[7] == 0xff)
|
||||||
{
|
{
|
||||||
//memcpy(wm->m_reg_ext + 0x20, WiimoteEmu::wireless_nunchuck_calibration, sizeof(WiimoteEmu::wireless_nunchuck_calibration));
|
//memcpy(wm->m_reg_ext + 0x20, WiimoteEmu::wireless_nunchuck_calibration, sizeof(WiimoteEmu::wireless_nunchuck_calibration));
|
||||||
//memcpy(wm->m_reg_ext + 0x30, WiimoteEmu::wireless_nunchuck_calibration, sizeof(WiimoteEmu::wireless_nunchuck_calibration));
|
//memcpy(wm->m_reg_ext + 0x30, WiimoteEmu::wireless_nunchuck_calibration, sizeof(WiimoteEmu::wireless_nunchuck_calibration));
|
||||||
|
@ -460,7 +460,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||||
|
|
||||||
if (dataReply[1] == 0xa4 || dataReply[1] == 0xa6)
|
if (dataReply[1] == 0xa4 || dataReply[1] == 0xa6)
|
||||||
{
|
{
|
||||||
if(rdr->error == 7 || rdr->error == 8)
|
if (rdr->error == 7 || rdr->error == 8)
|
||||||
{
|
{
|
||||||
WARN_LOG(CONSOLE, "R%s[0x%02x 0x%02x]: e-%d", decrypted?"*":"", dataReply[1], rdr->address>>8, rdr->error);
|
WARN_LOG(CONSOLE, "R%s[0x%02x 0x%02x]: e-%d", decrypted?"*":"", dataReply[1], rdr->address>>8, rdr->error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ void genkey(const u8* const rand, const u8 idx, u8* const key)
|
||||||
const u8* const ans = ans_tbl[idx];
|
const u8* const ans = ans_tbl[idx];
|
||||||
u8 t0[10];
|
u8 t0[10];
|
||||||
|
|
||||||
for(int i=0; i<10; ++i)
|
for (int i=0; i<10; ++i)
|
||||||
t0[i] = tsbox[rand[i]];
|
t0[i] = tsbox[rand[i]];
|
||||||
|
|
||||||
key[0] = ((ror8((ans[0]^t0[5]),(t0[2]%8)) - t0[9]) ^ t0[4]);
|
key[0] = ((ror8((ans[0]^t0[5]),(t0[2]%8)) - t0[9]) ^ t0[4]);
|
||||||
|
@ -249,7 +249,7 @@ void wiimote_gen_key(wiimote_key* const key, const u8* const keydata)
|
||||||
//DEBUG_LOG(WIIMOTE, "rand: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", rand[0], rand[1], rand[2], rand[3], rand[4], rand[5], rand[6], rand[7], rand[8], rand[9]);
|
//DEBUG_LOG(WIIMOTE, "rand: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", rand[0], rand[1], rand[2], rand[3], rand[4], rand[5], rand[6], rand[7], rand[8], rand[9]);
|
||||||
//DEBUG_LOG(WIIMOTE, "key: %02x %02x %02x %02x %02x %02x", skey[0], skey[1], skey[2], skey[3], skey[4], skey[5]);
|
//DEBUG_LOG(WIIMOTE, "key: %02x %02x %02x %02x %02x %02x", skey[0], skey[1], skey[2], skey[3], skey[4], skey[5]);
|
||||||
|
|
||||||
for(idx = 0; idx < 7; ++idx)
|
for (idx = 0; idx < 7; ++idx)
|
||||||
{
|
{
|
||||||
genkey(rand, idx, testkey);
|
genkey(rand, idx, testkey);
|
||||||
if (0 == memcmp(testkey, skey, 6))
|
if (0 == memcmp(testkey, skey, 6))
|
||||||
|
|
|
@ -42,7 +42,8 @@ static s32 av_clip(s32 a, s32 amin, s32 amax)
|
||||||
|
|
||||||
static s16 adpcm_yamaha_expand_nibble(ADPCMState& s, u8 nibble)
|
static s16 adpcm_yamaha_expand_nibble(ADPCMState& s, u8 nibble)
|
||||||
{
|
{
|
||||||
if(!s.step) {
|
if (!s.step)
|
||||||
|
{
|
||||||
s.predictor = 0;
|
s.predictor = 0;
|
||||||
s.step = 0;
|
s.step = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,7 @@ bool Wiimote::Step()
|
||||||
m_rumble->controls[0]->control_ref->State(m_rumble_on);
|
m_rumble->controls[0]->control_ref->State(m_rumble_on);
|
||||||
|
|
||||||
// when a movie is active, this button status update is disabled (moved), because movies only record data reports.
|
// when a movie is active, this button status update is disabled (moved), because movies only record data reports.
|
||||||
if(!(Movie::IsPlayingInput() || Movie::IsRecordingInput()) || NetPlay::IsNetPlayRunning())
|
if (!(Movie::IsPlayingInput() || Movie::IsRecordingInput()) || NetPlay::IsNetPlayRunning())
|
||||||
{
|
{
|
||||||
UpdateButtonsStatus(has_focus);
|
UpdateButtonsStatus(has_focus);
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ void Wiimote::UpdateButtonsStatus(bool has_focus)
|
||||||
void Wiimote::GetCoreData(u8* const data)
|
void Wiimote::GetCoreData(u8* const data)
|
||||||
{
|
{
|
||||||
// when a movie is active, the button update happens here instead of Wiimote::Step, to avoid potential desync issues.
|
// when a movie is active, the button update happens here instead of Wiimote::Step, to avoid potential desync issues.
|
||||||
if(Movie::IsPlayingInput() || Movie::IsRecordingInput() || NetPlay::IsNetPlayRunning())
|
if (Movie::IsPlayingInput() || Movie::IsRecordingInput() || NetPlay::IsNetPlayRunning())
|
||||||
{
|
{
|
||||||
UpdateButtonsStatus(HAS_FOCUS);
|
UpdateButtonsStatus(HAS_FOCUS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
|
|
||||||
auto* const wm = new Wiimote;
|
auto* const wm = new Wiimote;
|
||||||
wm->bdaddr = scan_infos[i].bdaddr;
|
wm->bdaddr = scan_infos[i].bdaddr;
|
||||||
if(IsBalanceBoardName(name))
|
if (IsBalanceBoardName(name))
|
||||||
{
|
{
|
||||||
found_board = wm;
|
found_board = wm;
|
||||||
NOTICE_LOG(WIIMOTE, "Found balance board (%s).", bdaddr_str);
|
NOTICE_LOG(WIIMOTE, "Found balance board (%s).", bdaddr_str);
|
||||||
|
|
|
@ -149,7 +149,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
{
|
{
|
||||||
CFRunLoopRun();
|
CFRunLoopRun();
|
||||||
}
|
}
|
||||||
while(!sbt->done);
|
while (!sbt->done);
|
||||||
|
|
||||||
int found_devices = [[bti foundDevices] count];
|
int found_devices = [[bti foundDevices] count];
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
Wiimote *wm = new Wiimote();
|
Wiimote *wm = new Wiimote();
|
||||||
wm->btd = [dev retain];
|
wm->btd = [dev retain];
|
||||||
|
|
||||||
if(IsBalanceBoardName([[dev name] UTF8String]))
|
if (IsBalanceBoardName([[dev name] UTF8String]))
|
||||||
{
|
{
|
||||||
found_board = wm;
|
found_board = wm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,9 +179,9 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const
|
||||||
leds_rpt.leds = 0xf;
|
leds_rpt.leds = 0xf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (rpt[1] == WM_WRITE_SPEAKER_DATA
|
else if (rpt[1] == WM_WRITE_SPEAKER_DATA &&
|
||||||
&& (!SConfig::GetInstance().m_WiimoteEnableSpeaker
|
(!SConfig::GetInstance().m_WiimoteEnableSpeaker ||
|
||||||
|| (!wm->m_status.speaker || wm->m_speaker_mute)))
|
(!wm->m_status.speaker || wm->m_speaker_mute)))
|
||||||
{
|
{
|
||||||
// Translate speaker data reports into rumble reports.
|
// Translate speaker data reports into rumble reports.
|
||||||
rpt[1] = WM_RUMBLE;
|
rpt[1] = WM_RUMBLE;
|
||||||
|
@ -200,10 +200,14 @@ bool Wiimote::Read()
|
||||||
|
|
||||||
if (result > 0 && m_channel > 0)
|
if (result > 0 && m_channel > 0)
|
||||||
{
|
{
|
||||||
if (Core::g_CoreStartupParameter.iBBDumpPort > 0 && index == WIIMOTE_BALANCE_BOARD)
|
if (Core::g_CoreStartupParameter.iBBDumpPort > 0 &&
|
||||||
|
index == WIIMOTE_BALANCE_BOARD)
|
||||||
{
|
{
|
||||||
static sf::SocketUDP Socket;
|
static sf::SocketUDP Socket;
|
||||||
Socket.Send((char*)rpt.data(), rpt.size(), sf::IPAddress::LocalHost, Core::g_CoreStartupParameter.iBBDumpPort);
|
Socket.Send((char*)rpt.data(),
|
||||||
|
rpt.size(),
|
||||||
|
sf::IPAddress::LocalHost,
|
||||||
|
Core::g_CoreStartupParameter.iBBDumpPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add it to queue
|
// Add it to queue
|
||||||
|
@ -321,10 +325,10 @@ bool Wiimote::PrepareOnThread()
|
||||||
u8 static const req_status_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REQUEST_STATUS, 0};
|
u8 static const req_status_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REQUEST_STATUS, 0};
|
||||||
// TODO: check for sane response?
|
// TODO: check for sane response?
|
||||||
|
|
||||||
return (IOWrite(mode_report, sizeof(mode_report))
|
return (IOWrite(mode_report, sizeof(mode_report)) &&
|
||||||
&& IOWrite(led_report, sizeof(led_report))
|
IOWrite(led_report, sizeof(led_report)) &&
|
||||||
&& (SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report)))
|
(SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report))) &&
|
||||||
&& IOWrite(req_status_report, sizeof(req_status_report)));
|
IOWrite(req_status_report, sizeof(req_status_report)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wiimote::EmuStart()
|
void Wiimote::EmuStart()
|
||||||
|
@ -464,9 +468,9 @@ void WiimoteScanner::ThreadFunc()
|
||||||
// TODO: this is a fairly lame place for this
|
// TODO: this is a fairly lame place for this
|
||||||
CheckForDisconnectedWiimotes();
|
CheckForDisconnectedWiimotes();
|
||||||
|
|
||||||
if(m_want_wiimotes)
|
if (m_want_wiimotes)
|
||||||
HandleFoundWiimotes(found_wiimotes);
|
HandleFoundWiimotes(found_wiimotes);
|
||||||
if(m_want_bb && found_board)
|
if (m_want_bb && found_board)
|
||||||
TryToConnectBalanceBoard(found_board);
|
TryToConnectBalanceBoard(found_board);
|
||||||
|
|
||||||
//std::this_thread::yield();
|
//std::this_thread::yield();
|
||||||
|
@ -596,7 +600,7 @@ void Initialize(bool wait)
|
||||||
g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board);
|
g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board);
|
||||||
if (SConfig::GetInstance().m_WiimoteContinuousScanning)
|
if (SConfig::GetInstance().m_WiimoteContinuousScanning)
|
||||||
{
|
{
|
||||||
while(CalculateWantedWiimotes() && CalculateConnectedWiimotes() < found_wiimotes.size() && timeout)
|
while (CalculateWantedWiimotes() && CalculateConnectedWiimotes() < found_wiimotes.size() && timeout)
|
||||||
{
|
{
|
||||||
Common::SleepCurrentThread(100);
|
Common::SleepCurrentThread(100);
|
||||||
timeout--;
|
timeout--;
|
||||||
|
@ -671,8 +675,7 @@ void ChangeWiimoteSource(unsigned int index, int source)
|
||||||
|
|
||||||
static bool TryToConnectWiimoteN(Wiimote* wm, unsigned int i)
|
static bool TryToConnectWiimoteN(Wiimote* wm, unsigned int i)
|
||||||
{
|
{
|
||||||
if (WIIMOTE_SRC_REAL & g_wiimote_sources[i]
|
if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] && !g_wiimotes[i])
|
||||||
&& !g_wiimotes[i])
|
|
||||||
{
|
{
|
||||||
if (wm->Connect())
|
if (wm->Connect())
|
||||||
{
|
{
|
||||||
|
@ -794,7 +797,7 @@ void Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleFoundWiimotes(found_wiimotes);
|
HandleFoundWiimotes(found_wiimotes);
|
||||||
if(found_board)
|
if (found_board)
|
||||||
TryToConnectBalanceBoard(found_board);
|
TryToConnectBalanceBoard(found_board);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress)
|
||||||
|
|
||||||
// Prepare the out buffer(s) with zeros as a safety precaution
|
// Prepare the out buffer(s) with zeros as a safety precaution
|
||||||
// to avoid returning bad values
|
// to avoid returning bad values
|
||||||
for(u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
for (u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
||||||
{
|
{
|
||||||
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
||||||
CommandBuffer.PayloadBuffer[i].m_Size);
|
CommandBuffer.PayloadBuffer[i].m_Size);
|
||||||
|
@ -148,7 +148,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializing a filesystem if it was just loaded
|
// Initializing a filesystem if it was just loaded
|
||||||
if(!m_pFileSystem && VolumeHandler::IsValid())
|
if (!m_pFileSystem && VolumeHandler::IsValid())
|
||||||
{
|
{
|
||||||
m_pFileSystem = DiscIO::CreateFileSystem(VolumeHandler::GetVolume());
|
m_pFileSystem = DiscIO::CreateFileSystem(VolumeHandler::GetVolume());
|
||||||
m_CoverStatus |= DI_COVER_REG_INITIALIZED;
|
m_CoverStatus |= DI_COVER_REG_INITIALIZED;
|
||||||
|
@ -156,7 +156,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-initializing a filesystem if the volume was unmounted
|
// De-initializing a filesystem if the volume was unmounted
|
||||||
if(m_pFileSystem && !VolumeHandler::IsValid())
|
if (m_pFileSystem && !VolumeHandler::IsValid())
|
||||||
{
|
{
|
||||||
delete m_pFileSystem;
|
delete m_pFileSystem;
|
||||||
m_pFileSystem = nullptr;
|
m_pFileSystem = nullptr;
|
||||||
|
@ -294,13 +294,12 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
|
||||||
// * 0x460a0000 - 0x460a0008
|
// * 0x460a0000 - 0x460a0008
|
||||||
// * 0x7ed40000 - 0x7ed40008
|
// * 0x7ed40000 - 0x7ed40008
|
||||||
u32 DVDAddress32 = Memory::Read_U32(_BufferIn + 0x08);
|
u32 DVDAddress32 = Memory::Read_U32(_BufferIn + 0x08);
|
||||||
if (!( (DVDAddress32 > 0x00000000 && DVDAddress32 < 0x00014000)
|
if (!((DVDAddress32 > 0x00000000 && DVDAddress32 < 0x00014000) ||
|
||||||
|| (((DVDAddress32 + Size) > 0x00000000) && (DVDAddress32 + Size) < 0x00014000)
|
(((DVDAddress32 + Size) > 0x00000000) && (DVDAddress32 + Size) < 0x00014000) ||
|
||||||
|| (DVDAddress32 > 0x460a0000 && DVDAddress32 < 0x460a0008)
|
(DVDAddress32 > 0x460a0000 && DVDAddress32 < 0x460a0008) ||
|
||||||
|| (((DVDAddress32 + Size) > 0x460a0000) && (DVDAddress32 + Size) < 0x460a0008)
|
(((DVDAddress32 + Size) > 0x460a0000) && (DVDAddress32 + Size) < 0x460a0008) ||
|
||||||
|| (DVDAddress32 > 0x7ed40000 && DVDAddress32 < 0x7ed40008)
|
(DVDAddress32 > 0x7ed40000 && DVDAddress32 < 0x7ed40008) ||
|
||||||
|| (((DVDAddress32 + Size) > 0x7ed40000) && (DVDAddress32 + Size) < 0x7ed40008)
|
(((DVDAddress32 + Size) > 0x7ed40000) && (DVDAddress32 + Size) < 0x7ed40008)))
|
||||||
))
|
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: trying to read out of bounds @ %x", DVDAddress32);
|
WARN_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: trying to read out of bounds @ %x", DVDAddress32);
|
||||||
m_ErrorStatus = ERROR_READY | ERROR_BLOCK_OOB;
|
m_ErrorStatus = ERROR_READY | ERROR_BLOCK_OOB;
|
||||||
|
@ -317,7 +316,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
|
||||||
PanicAlertT("Detected attempt to read more data from the DVD than fit inside the out buffer. Clamp.");
|
PanicAlertT("Detected attempt to read more data from the DVD than fit inside the out buffer. Clamp.");
|
||||||
Size = _BufferOutSize;
|
Size = _BufferOutSize;
|
||||||
}
|
}
|
||||||
if(!VolumeHandler::RAWReadToPtr(Memory::GetPointer(_BufferOut), DVDAddress, Size))
|
if (!VolumeHandler::RAWReadToPtr(Memory::GetPointer(_BufferOut), DVDAddress, Size))
|
||||||
{
|
{
|
||||||
PanicAlertT("DVDLowUnencryptedRead - Fatal Error: failed to read from volume");
|
PanicAlertT("DVDLowUnencryptedRead - Fatal Error: failed to read from volume");
|
||||||
}
|
}
|
||||||
|
|
|
@ -803,7 +803,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
|
||||||
TMDCnt += DiscIO::INANDContentLoader::TMD_HEADER_SIZE;
|
TMDCnt += DiscIO::INANDContentLoader::TMD_HEADER_SIZE;
|
||||||
TMDCnt += (u32)Loader.GetContentSize() * DiscIO::INANDContentLoader::CONTENT_HEADER_SIZE;
|
TMDCnt += (u32)Loader.GetContentSize() * DiscIO::INANDContentLoader::CONTENT_HEADER_SIZE;
|
||||||
}
|
}
|
||||||
if(Buffer.NumberPayloadBuffer)
|
if (Buffer.NumberPayloadBuffer)
|
||||||
Memory::Write_U32(TMDCnt, Buffer.PayloadBuffer[0].m_Address);
|
Memory::Write_U32(TMDCnt, Buffer.PayloadBuffer[0].m_Address);
|
||||||
|
|
||||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||||
|
@ -1151,7 +1151,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!File::Exists(tmdPath))
|
if (!File::Exists(tmdPath))
|
||||||
{
|
{
|
||||||
File::IOFile _pTMDFile(tmdPath, "wb");
|
File::IOFile _pTMDFile(tmdPath, "wb");
|
||||||
if (!_pTMDFile.WriteBytes(_pTMD, _sz))
|
if (!_pTMDFile.WriteBytes(_pTMD, _sz))
|
||||||
|
|
|
@ -74,13 +74,13 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||||
|
|
||||||
// Prepare the out buffer(s) with zeros as a safety precaution
|
// Prepare the out buffer(s) with zeros as a safety precaution
|
||||||
// to avoid returning bad values
|
// to avoid returning bad values
|
||||||
for(u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
for (u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
||||||
{
|
{
|
||||||
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
||||||
CommandBuffer.PayloadBuffer[i].m_Size);
|
CommandBuffer.PayloadBuffer[i].m_Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(CommandBuffer.Parameter)
|
switch (CommandBuffer.Parameter)
|
||||||
{
|
{
|
||||||
case IOCTLV_READ_DIR:
|
case IOCTLV_READ_DIR:
|
||||||
{
|
{
|
||||||
|
@ -253,7 +253,7 @@ bool CWII_IPC_HLE_Device_fs::IOCtl(u32 _CommandAddress)
|
||||||
|
|
||||||
s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize)
|
s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize)
|
||||||
{
|
{
|
||||||
switch(_Parameter)
|
switch (_Parameter)
|
||||||
{
|
{
|
||||||
case IOCTL_GET_STATS:
|
case IOCTL_GET_STATS:
|
||||||
{
|
{
|
||||||
|
@ -508,7 +508,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
||||||
File::CreateDir(Path.c_str());
|
File::CreateDir(Path.c_str());
|
||||||
|
|
||||||
//now restore from the stream
|
//now restore from the stream
|
||||||
while(1) {
|
while (1) {
|
||||||
char type = 0;
|
char type = 0;
|
||||||
p.Do(type);
|
p.Do(type);
|
||||||
if (!type)
|
if (!type)
|
||||||
|
@ -516,7 +516,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
||||||
std::string filename;
|
std::string filename;
|
||||||
p.Do(filename);
|
p.Do(filename);
|
||||||
std::string name = Path + DIR_SEP + filename;
|
std::string name = Path + DIR_SEP + filename;
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 'd':
|
case 'd':
|
||||||
{
|
{
|
||||||
|
@ -531,7 +531,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
||||||
File::IOFile handle(name, "wb");
|
File::IOFile handle(name, "wb");
|
||||||
char buf[65536];
|
char buf[65536];
|
||||||
u32 count = size;
|
u32 count = size;
|
||||||
while(count > 65536) {
|
while (count > 65536) {
|
||||||
p.DoArray(&buf[0], 65536);
|
p.DoArray(&buf[0], 65536);
|
||||||
handle.WriteArray(&buf[0], 65536);
|
handle.WriteArray(&buf[0], 65536);
|
||||||
count -= 65536;
|
count -= 65536;
|
||||||
|
@ -553,7 +553,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
||||||
todo.insert(todo.end(), parentEntry.children.begin(),
|
todo.insert(todo.end(), parentEntry.children.begin(),
|
||||||
parentEntry.children.end());
|
parentEntry.children.end());
|
||||||
|
|
||||||
while(!todo.empty())
|
while (!todo.empty())
|
||||||
{
|
{
|
||||||
File::FSTEntry &entry = todo.front();
|
File::FSTEntry &entry = todo.front();
|
||||||
std::string name = entry.physicalName;
|
std::string name = entry.physicalName;
|
||||||
|
@ -574,7 +574,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
||||||
File::IOFile handle(entry.physicalName, "rb");
|
File::IOFile handle(entry.physicalName, "rb");
|
||||||
char buf[65536];
|
char buf[65536];
|
||||||
u32 count = size;
|
u32 count = size;
|
||||||
while(count > 65536) {
|
while (count > 65536) {
|
||||||
handle.ReadArray(&buf[0], 65536);
|
handle.ReadArray(&buf[0], 65536);
|
||||||
p.DoArray(&buf[0], 65536);
|
p.DoArray(&buf[0], 65536);
|
||||||
count -= 65536;
|
count -= 65536;
|
||||||
|
|
|
@ -390,7 +390,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
|
||||||
struct libusb_config_descriptor *config = nullptr;
|
struct libusb_config_descriptor *config = nullptr;
|
||||||
int cRet = libusb_get_config_descriptor(device, c, &config);
|
int cRet = libusb_get_config_descriptor(device, c, &config);
|
||||||
// do not try to use usb devices with more than one interface, games can crash
|
// do not try to use usb devices with more than one interface, games can crash
|
||||||
if(cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES)
|
if (cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES)
|
||||||
{
|
{
|
||||||
WiiHIDConfigDescriptor wii_config;
|
WiiHIDConfigDescriptor wii_config;
|
||||||
ConvertConfigToWii(&wii_config, config);
|
ConvertConfigToWii(&wii_config, config);
|
||||||
|
@ -430,7 +430,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(cRet)
|
if (cRet)
|
||||||
DEBUG_LOG(WII_IPC_HID, "libusb_get_config_descriptor failed with: %d", cRet);
|
DEBUG_LOG(WII_IPC_HID, "libusb_get_config_descriptor failed with: %d", cRet);
|
||||||
deviceValid = false;
|
deviceValid = false;
|
||||||
OffsetBuffer = OffsetStart;
|
OffsetBuffer = OffsetStart;
|
||||||
|
@ -471,7 +471,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
|
||||||
for (i=0; i<MAX_DEVICE_DEVNUM; i++)
|
for (i=0; i<MAX_DEVICE_DEVNUM; i++)
|
||||||
{
|
{
|
||||||
u16 check_cur = (u16)(hidDeviceAliases[i] >> 48);
|
u16 check_cur = (u16)(hidDeviceAliases[i] >> 48);
|
||||||
if(hidDeviceAliases[i] != 0 && check_cur != check)
|
if (hidDeviceAliases[i] != 0 && check_cur != check)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_HID, "Removing: device %d %hX %hX", i, check, check_cur);
|
DEBUG_LOG(WII_IPC_HID, "Removing: device %d %hX %hX", i, check, check_cur);
|
||||||
std::lock_guard<std::mutex> lk(s_open_devices);
|
std::lock_guard<std::mutex> lk(s_open_devices);
|
||||||
|
@ -505,7 +505,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
||||||
libusb_device_handle *handle = nullptr;
|
libusb_device_handle *handle = nullptr;
|
||||||
ssize_t cnt;
|
ssize_t cnt;
|
||||||
|
|
||||||
if(devNum >= MAX_DEVICE_DEVNUM)
|
if (devNum >= MAX_DEVICE_DEVNUM)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
||||||
if (open_devices.find(devNum) != open_devices.end())
|
if (open_devices.find(devNum) != open_devices.end())
|
||||||
{
|
{
|
||||||
handle = open_devices[devNum];
|
handle = open_devices[devNum];
|
||||||
if(libusb_kernel_driver_active(handle, 0) != LIBUSB_ERROR_NO_DEVICE)
|
if (libusb_kernel_driver_active(handle, 0) != LIBUSB_ERROR_NO_DEVICE)
|
||||||
{
|
{
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
@ -549,14 +549,15 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
||||||
{
|
{
|
||||||
if (ret == LIBUSB_ERROR_ACCESS)
|
if (ret == LIBUSB_ERROR_ACCESS)
|
||||||
{
|
{
|
||||||
if( dRet )
|
if (dRet)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "Dolphin does not have access to this device: Bus %03d Device %03d: ID ????:???? (couldn't get id).",
|
ERROR_LOG(WII_IPC_HID, "Dolphin does not have access to this device: Bus %03d Device %03d: ID ????:???? (couldn't get id).",
|
||||||
bus,
|
bus,
|
||||||
port
|
port
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "Dolphin does not have access to this device: Bus %03d Device %03d: ID %04X:%04X.",
|
ERROR_LOG(WII_IPC_HID, "Dolphin does not have access to this device: Bus %03d Device %03d: ID %04X:%04X.",
|
||||||
bus,
|
bus,
|
||||||
port,
|
port,
|
||||||
|
@ -568,7 +569,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
else if (ret == LIBUSB_ERROR_NOT_SUPPORTED)
|
else if (ret == LIBUSB_ERROR_NOT_SUPPORTED)
|
||||||
{
|
{
|
||||||
if(!has_warned_about_drivers)
|
if (!has_warned_about_drivers)
|
||||||
{
|
{
|
||||||
// Max of one warning.
|
// Max of one warning.
|
||||||
has_warned_about_drivers = true;
|
has_warned_about_drivers = true;
|
||||||
|
@ -615,7 +616,7 @@ int CWII_IPC_HLE_Device_hid::GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 b
|
||||||
for (int i=0; i<MAX_DEVICE_DEVNUM; i++)
|
for (int i=0; i<MAX_DEVICE_DEVNUM; i++)
|
||||||
{
|
{
|
||||||
u64 id = hidDeviceAliases[i] & HID_ID_MASK;
|
u64 id = hidDeviceAliases[i] & HID_ID_MASK;
|
||||||
if(id == 0 && pos == -1)
|
if (id == 0 && pos == -1)
|
||||||
{
|
{
|
||||||
pos = i;
|
pos = i;
|
||||||
}
|
}
|
||||||
|
@ -626,7 +627,7 @@ int CWII_IPC_HLE_Device_hid::GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pos != -1)
|
if (pos != -1)
|
||||||
{
|
{
|
||||||
hidDeviceAliases[pos] = unique_id | ((u64)check << 48);
|
hidDeviceAliases[pos] = unique_id | ((u64)check << 48);
|
||||||
return pos;
|
return pos;
|
||||||
|
|
|
@ -198,7 +198,7 @@ public:
|
||||||
SetEnableBooting(0);
|
SetEnableBooting(0);
|
||||||
SetEmail("@wii.com");
|
SetEmail("@wii.com");
|
||||||
|
|
||||||
for(i=0; i<nwc24_config_t::URL_COUNT; i++)
|
for (i=0; i<nwc24_config_t::URL_COUNT; i++)
|
||||||
{
|
{
|
||||||
strncpy(config.http_urls[i], urls[i], nwc24_config_t::MAX_URL_LENGTH);
|
strncpy(config.http_urls[i], urls[i], nwc24_config_t::MAX_URL_LENGTH);
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s32 config_error = CheckNwc24Config();
|
s32 config_error = CheckNwc24Config();
|
||||||
if(config_error)
|
if (config_error)
|
||||||
ERROR_LOG(WII_IPC_WC24, "There is an error in the config for for WC24: %d", config_error);
|
ERROR_LOG(WII_IPC_WC24, "There is an error in the config for for WC24: %d", config_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,14 +244,14 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress)
|
||||||
|
|
||||||
// Prepare the out buffer(s) with zeros as a safety precaution
|
// Prepare the out buffer(s) with zeros as a safety precaution
|
||||||
// to avoid returning bad values
|
// to avoid returning bad values
|
||||||
for(u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
for (u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
||||||
{
|
{
|
||||||
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
||||||
CommandBuffer.PayloadBuffer[i].m_Size);
|
CommandBuffer.PayloadBuffer[i].m_Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ReturnValue = 0;
|
u32 ReturnValue = 0;
|
||||||
switch(CommandBuffer.Parameter) {
|
switch (CommandBuffer.Parameter) {
|
||||||
case IOCTLV_SENDCMD:
|
case IOCTLV_SENDCMD:
|
||||||
INFO_LOG(WII_IPC_SD, "IOCTLV_SENDCMD 0x%08x", Memory::Read_U32(CommandBuffer.InBuffer[0].m_Address));
|
INFO_LOG(WII_IPC_SD, "IOCTLV_SENDCMD 0x%08x", Memory::Read_U32(CommandBuffer.InBuffer[0].m_Address));
|
||||||
ReturnValue = ExecuteCommand(
|
ReturnValue = ExecuteCommand(
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
Memory::Memset(BufferOut, 0, BufferOutSize);
|
Memory::Memset(BufferOut, 0, BufferOutSize);
|
||||||
u32 ReturnValue = 0;
|
u32 ReturnValue = 0;
|
||||||
|
|
||||||
switch(Parameter)
|
switch (Parameter)
|
||||||
{
|
{
|
||||||
case IOCTL_STM_RELEASE_EH:
|
case IOCTL_STM_RELEASE_EH:
|
||||||
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
|
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
|
||||||
|
|
|
@ -248,7 +248,7 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
||||||
u32 DataSize = _Size - sizeof(l2cap_hdr_t);
|
u32 DataSize = _Size - sizeof(l2cap_hdr_t);
|
||||||
INFO_LOG(WII_IPC_WIIMOTE, " CID 0x%04x, Len 0x%x, DataSize 0x%x", pHeader->dcid, pHeader->length, DataSize);
|
INFO_LOG(WII_IPC_WIIMOTE, " CID 0x%04x, Len 0x%x, DataSize 0x%x", pHeader->dcid, pHeader->length, DataSize);
|
||||||
|
|
||||||
if(pHeader->length != DataSize)
|
if (pHeader->length != DataSize)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_WIIMOTE, "Faulty packet. It is dropped.");
|
INFO_LOG(WII_IPC_WIIMOTE, "Faulty packet. It is dropped.");
|
||||||
return;
|
return;
|
||||||
|
@ -776,7 +776,7 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
|
||||||
|
|
||||||
CBigEndianBuffer buffer(_pData);
|
CBigEndianBuffer buffer(_pData);
|
||||||
|
|
||||||
switch(buffer.Read8(0))
|
switch (buffer.Read8(0))
|
||||||
{
|
{
|
||||||
// SDP_ServiceSearchRequest
|
// SDP_ServiceSearchRequest
|
||||||
case 0x02:
|
case 0x02:
|
||||||
|
|
|
@ -188,7 +188,7 @@ void WiiSocket::update(bool read, bool write, bool except)
|
||||||
u32 BufferOut = Memory::Read_U32(it->_CommandAddress + 0x18);
|
u32 BufferOut = Memory::Read_U32(it->_CommandAddress + 0x18);
|
||||||
u32 BufferOutSize = Memory::Read_U32(it->_CommandAddress + 0x1C);
|
u32 BufferOutSize = Memory::Read_U32(it->_CommandAddress + 0x1C);
|
||||||
|
|
||||||
switch(it->net_type)
|
switch (it->net_type)
|
||||||
{
|
{
|
||||||
case IOCTL_SO_FCNTL:
|
case IOCTL_SO_FCNTL:
|
||||||
{
|
{
|
||||||
|
@ -261,8 +261,8 @@ void WiiSocket::update(bool read, bool write, bool except)
|
||||||
// Fix blocking error codes
|
// Fix blocking error codes
|
||||||
if (!nonBlock)
|
if (!nonBlock)
|
||||||
{
|
{
|
||||||
if (it->net_type == IOCTL_SO_CONNECT
|
if (it->net_type == IOCTL_SO_CONNECT &&
|
||||||
&& ReturnValue == -SO_EISCONN)
|
ReturnValue == -SO_EISCONN)
|
||||||
{
|
{
|
||||||
ReturnValue = SO_SUCCESS;
|
ReturnValue = SO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ void WiiSocket::update(bool read, bool write, bool except)
|
||||||
int sslID = Memory::Read_U32(BufferOut) - 1;
|
int sslID = Memory::Read_U32(BufferOut) - 1;
|
||||||
if (SSLID_VALID(sslID))
|
if (SSLID_VALID(sslID))
|
||||||
{
|
{
|
||||||
switch(it->ssl_type)
|
switch (it->ssl_type)
|
||||||
{
|
{
|
||||||
case IOCTLV_NET_SSL_DOHANDSHAKE:
|
case IOCTLV_NET_SSL_DOHANDSHAKE:
|
||||||
{
|
{
|
||||||
|
@ -511,12 +511,19 @@ void WiiSocket::update(bool read, bool write, bool except)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( nonBlock || forceNonBlock
|
if (nonBlock ||
|
||||||
|| (!it->is_ssl && ReturnValue != -SO_EAGAIN && ReturnValue != -SO_EINPROGRESS && ReturnValue != -SO_EALREADY)
|
forceNonBlock ||
|
||||||
|| (it->is_ssl && ReturnValue != SSL_ERR_WAGAIN && ReturnValue != SSL_ERR_RAGAIN))
|
(!it->is_ssl &&
|
||||||
|
ReturnValue != -SO_EAGAIN &&
|
||||||
|
ReturnValue != -SO_EINPROGRESS &&
|
||||||
|
ReturnValue != -SO_EALREADY) ||
|
||||||
|
(it->is_ssl &&
|
||||||
|
ReturnValue != SSL_ERR_WAGAIN &&
|
||||||
|
ReturnValue != SSL_ERR_RAGAIN))
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_NET, "IOCTL(V) Sock: %08x ioctl/v: %d returned: %d nonBlock: %d forceNonBlock: %d",
|
DEBUG_LOG(WII_IPC_NET,
|
||||||
fd, it->is_ssl ? (int) it->ssl_type : (int) it->net_type, ReturnValue, nonBlock, forceNonBlock);
|
"IOCTL(V) Sock: %08x ioctl/v: %d returned: %d nonBlock: %d forceNonBlock: %d",
|
||||||
|
fd, it->is_ssl ? (int) it->ssl_type : (int) it->net_type, ReturnValue, nonBlock, forceNonBlock);
|
||||||
WiiSockMan::EnqueueReply(it->_CommandAddress, ReturnValue);
|
WiiSockMan::EnqueueReply(it->_CommandAddress, ReturnValue);
|
||||||
it = pending_sockops.erase(it);
|
it = pending_sockops.erase(it);
|
||||||
}
|
}
|
||||||
|
@ -552,9 +559,9 @@ void WiiSockMan::addSocket(s32 fd)
|
||||||
|
|
||||||
s32 WiiSockMan::newSocket(s32 af, s32 type, s32 protocol)
|
s32 WiiSockMan::newSocket(s32 af, s32 type, s32 protocol)
|
||||||
{
|
{
|
||||||
if (NetPlay::IsNetPlayRunning()
|
if (NetPlay::IsNetPlayRunning() ||
|
||||||
|| Movie::IsRecordingInput()
|
Movie::IsRecordingInput() ||
|
||||||
|| Movie::IsPlayingInput())
|
Movie::IsPlayingInput())
|
||||||
{
|
{
|
||||||
return SO_ENOMEM;
|
return SO_ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ std::string GetInputDisplay()
|
||||||
void FrameUpdate()
|
void FrameUpdate()
|
||||||
{
|
{
|
||||||
g_currentFrame++;
|
g_currentFrame++;
|
||||||
if(!g_bPolled)
|
if (!g_bPolled)
|
||||||
g_currentLagCount++;
|
g_currentLagCount++;
|
||||||
|
|
||||||
if (IsRecordingInput())
|
if (IsRecordingInput())
|
||||||
|
@ -139,7 +139,7 @@ void FrameUpdate()
|
||||||
if (g_bFrameStop)
|
if (g_bFrameStop)
|
||||||
*PowerPC::GetStatePtr() = PowerPC::CPU_STEPPING;
|
*PowerPC::GetStatePtr() = PowerPC::CPU_STEPPING;
|
||||||
|
|
||||||
if(g_framesToSkip)
|
if (g_framesToSkip)
|
||||||
FrameSkipping();
|
FrameSkipping();
|
||||||
|
|
||||||
g_bPolled = false;
|
g_bPolled = false;
|
||||||
|
@ -222,14 +222,14 @@ void SetPolledDevice()
|
||||||
|
|
||||||
void DoFrameStep()
|
void DoFrameStep()
|
||||||
{
|
{
|
||||||
if(Core::GetState() == Core::CORE_PAUSE)
|
if (Core::GetState() == Core::CORE_PAUSE)
|
||||||
{
|
{
|
||||||
// if already paused, frame advance for 1 frame
|
// if already paused, frame advance for 1 frame
|
||||||
Core::SetState(Core::CORE_RUN);
|
Core::SetState(Core::CORE_RUN);
|
||||||
Core::RequestRefreshInfo();
|
Core::RequestRefreshInfo();
|
||||||
g_bFrameStep = true;
|
g_bFrameStep = true;
|
||||||
}
|
}
|
||||||
else if(!g_bFrameStep)
|
else if (!g_bFrameStep)
|
||||||
{
|
{
|
||||||
// if not paused yet, pause immediately instead
|
// if not paused yet, pause immediately instead
|
||||||
Core::SetState(Core::CORE_PAUSE);
|
Core::SetState(Core::CORE_PAUSE);
|
||||||
|
@ -409,7 +409,7 @@ void ChangeWiiPads(bool instantly)
|
||||||
|
|
||||||
bool BeginRecordingInput(int controllers)
|
bool BeginRecordingInput(int controllers)
|
||||||
{
|
{
|
||||||
if(g_playMode != MODE_NONE || controllers == 0)
|
if (g_playMode != MODE_NONE || controllers == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
g_numPads = controllers;
|
g_numPads = controllers;
|
||||||
|
@ -432,7 +432,7 @@ bool BeginRecordingInput(int controllers)
|
||||||
|
|
||||||
if (Core::IsRunning())
|
if (Core::IsRunning())
|
||||||
{
|
{
|
||||||
if(File::Exists(tmpStateFilename))
|
if (File::Exists(tmpStateFilename))
|
||||||
File::Delete(tmpStateFilename);
|
File::Delete(tmpStateFilename);
|
||||||
|
|
||||||
State::SaveAs(tmpStateFilename.c_str());
|
State::SaveAs(tmpStateFilename.c_str());
|
||||||
|
@ -463,16 +463,16 @@ bool BeginRecordingInput(int controllers)
|
||||||
|
|
||||||
static void Analog2DToString(u8 x, u8 y, const char* prefix, char* str)
|
static void Analog2DToString(u8 x, u8 y, const char* prefix, char* str)
|
||||||
{
|
{
|
||||||
if((x <= 1 || x == 128 || x >= 255)
|
if ((x <= 1 || x == 128 || x >= 255) &&
|
||||||
&& (y <= 1 || y == 128 || y >= 255))
|
(y <= 1 || y == 128 || y >= 255))
|
||||||
{
|
{
|
||||||
if(x != 128 || y != 128)
|
if (x != 128 || y != 128)
|
||||||
{
|
{
|
||||||
if(x != 128 && y != 128)
|
if (x != 128 && y != 128)
|
||||||
{
|
{
|
||||||
sprintf(str, "%s:%s,%s", prefix, x<128?"LEFT":"RIGHT", y<128?"DOWN":"UP");
|
sprintf(str, "%s:%s,%s", prefix, x<128?"LEFT":"RIGHT", y<128?"DOWN":"UP");
|
||||||
}
|
}
|
||||||
else if(x != 128)
|
else if (x != 128)
|
||||||
{
|
{
|
||||||
sprintf(str, "%s:%s", prefix, x<128?"LEFT":"RIGHT");
|
sprintf(str, "%s:%s", prefix, x<128?"LEFT":"RIGHT");
|
||||||
}
|
}
|
||||||
|
@ -494,9 +494,9 @@ static void Analog2DToString(u8 x, u8 y, const char* prefix, char* str)
|
||||||
|
|
||||||
static void Analog1DToString(u8 v, const char* prefix, char* str)
|
static void Analog1DToString(u8 v, const char* prefix, char* str)
|
||||||
{
|
{
|
||||||
if(v > 0)
|
if (v > 0)
|
||||||
{
|
{
|
||||||
if(v == 255)
|
if (v == 255)
|
||||||
{
|
{
|
||||||
strcpy(str, prefix);
|
strcpy(str, prefix);
|
||||||
}
|
}
|
||||||
|
@ -517,26 +517,26 @@ void SetInputDisplayString(ControllerState padState, int controllerID)
|
||||||
sprintf(inp, "P%d:", controllerID + 1);
|
sprintf(inp, "P%d:", controllerID + 1);
|
||||||
g_InputDisplay[controllerID] = inp;
|
g_InputDisplay[controllerID] = inp;
|
||||||
|
|
||||||
if(g_padState.A)
|
if (g_padState.A)
|
||||||
g_InputDisplay[controllerID].append(" A");
|
g_InputDisplay[controllerID].append(" A");
|
||||||
if(g_padState.B)
|
if (g_padState.B)
|
||||||
g_InputDisplay[controllerID].append(" B");
|
g_InputDisplay[controllerID].append(" B");
|
||||||
if(g_padState.X)
|
if (g_padState.X)
|
||||||
g_InputDisplay[controllerID].append(" X");
|
g_InputDisplay[controllerID].append(" X");
|
||||||
if(g_padState.Y)
|
if (g_padState.Y)
|
||||||
g_InputDisplay[controllerID].append(" Y");
|
g_InputDisplay[controllerID].append(" Y");
|
||||||
if(g_padState.Z)
|
if (g_padState.Z)
|
||||||
g_InputDisplay[controllerID].append(" Z");
|
g_InputDisplay[controllerID].append(" Z");
|
||||||
if(g_padState.Start)
|
if (g_padState.Start)
|
||||||
g_InputDisplay[controllerID].append(" START");
|
g_InputDisplay[controllerID].append(" START");
|
||||||
|
|
||||||
if(g_padState.DPadUp)
|
if (g_padState.DPadUp)
|
||||||
g_InputDisplay[controllerID].append(" UP");
|
g_InputDisplay[controllerID].append(" UP");
|
||||||
if(g_padState.DPadDown)
|
if (g_padState.DPadDown)
|
||||||
g_InputDisplay[controllerID].append(" DOWN");
|
g_InputDisplay[controllerID].append(" DOWN");
|
||||||
if(g_padState.DPadLeft)
|
if (g_padState.DPadLeft)
|
||||||
g_InputDisplay[controllerID].append(" LEFT");
|
g_InputDisplay[controllerID].append(" LEFT");
|
||||||
if(g_padState.DPadRight)
|
if (g_padState.DPadRight)
|
||||||
g_InputDisplay[controllerID].append(" RIGHT");
|
g_InputDisplay[controllerID].append(" RIGHT");
|
||||||
|
|
||||||
Analog1DToString(g_padState.TriggerL, " L", inp);
|
Analog1DToString(g_padState.TriggerL, " L", inp);
|
||||||
|
@ -562,41 +562,41 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD
|
||||||
sprintf(inp, "R%d:", remoteID + 1);
|
sprintf(inp, "R%d:", remoteID + 1);
|
||||||
g_InputDisplay[controllerID] = inp;
|
g_InputDisplay[controllerID] = inp;
|
||||||
|
|
||||||
if(coreData)
|
if (coreData)
|
||||||
{
|
{
|
||||||
wm_core buttons = *(wm_core*)coreData;
|
wm_core buttons = *(wm_core*)coreData;
|
||||||
if(buttons & WiimoteEmu::Wiimote::PAD_LEFT)
|
if (buttons & WiimoteEmu::Wiimote::PAD_LEFT)
|
||||||
g_InputDisplay[controllerID].append(" LEFT");
|
g_InputDisplay[controllerID].append(" LEFT");
|
||||||
if(buttons & WiimoteEmu::Wiimote::PAD_RIGHT)
|
if (buttons & WiimoteEmu::Wiimote::PAD_RIGHT)
|
||||||
g_InputDisplay[controllerID].append(" RIGHT");
|
g_InputDisplay[controllerID].append(" RIGHT");
|
||||||
if(buttons & WiimoteEmu::Wiimote::PAD_DOWN)
|
if (buttons & WiimoteEmu::Wiimote::PAD_DOWN)
|
||||||
g_InputDisplay[controllerID].append(" DOWN");
|
g_InputDisplay[controllerID].append(" DOWN");
|
||||||
if(buttons & WiimoteEmu::Wiimote::PAD_UP)
|
if (buttons & WiimoteEmu::Wiimote::PAD_UP)
|
||||||
g_InputDisplay[controllerID].append(" UP");
|
g_InputDisplay[controllerID].append(" UP");
|
||||||
if(buttons & WiimoteEmu::Wiimote::BUTTON_A)
|
if (buttons & WiimoteEmu::Wiimote::BUTTON_A)
|
||||||
g_InputDisplay[controllerID].append(" A");
|
g_InputDisplay[controllerID].append(" A");
|
||||||
if(buttons & WiimoteEmu::Wiimote::BUTTON_B)
|
if (buttons & WiimoteEmu::Wiimote::BUTTON_B)
|
||||||
g_InputDisplay[controllerID].append(" B");
|
g_InputDisplay[controllerID].append(" B");
|
||||||
if(buttons & WiimoteEmu::Wiimote::BUTTON_PLUS)
|
if (buttons & WiimoteEmu::Wiimote::BUTTON_PLUS)
|
||||||
g_InputDisplay[controllerID].append(" +");
|
g_InputDisplay[controllerID].append(" +");
|
||||||
if(buttons & WiimoteEmu::Wiimote::BUTTON_MINUS)
|
if (buttons & WiimoteEmu::Wiimote::BUTTON_MINUS)
|
||||||
g_InputDisplay[controllerID].append(" -");
|
g_InputDisplay[controllerID].append(" -");
|
||||||
if(buttons & WiimoteEmu::Wiimote::BUTTON_ONE)
|
if (buttons & WiimoteEmu::Wiimote::BUTTON_ONE)
|
||||||
g_InputDisplay[controllerID].append(" 1");
|
g_InputDisplay[controllerID].append(" 1");
|
||||||
if(buttons & WiimoteEmu::Wiimote::BUTTON_TWO)
|
if (buttons & WiimoteEmu::Wiimote::BUTTON_TWO)
|
||||||
g_InputDisplay[controllerID].append(" 2");
|
g_InputDisplay[controllerID].append(" 2");
|
||||||
if(buttons & WiimoteEmu::Wiimote::BUTTON_HOME)
|
if (buttons & WiimoteEmu::Wiimote::BUTTON_HOME)
|
||||||
g_InputDisplay[controllerID].append(" HOME");
|
g_InputDisplay[controllerID].append(" HOME");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(accelData)
|
if (accelData)
|
||||||
{
|
{
|
||||||
wm_accel* dt = (wm_accel*)accelData;
|
wm_accel* dt = (wm_accel*)accelData;
|
||||||
sprintf(inp, " ACC:%d,%d,%d", dt->x, dt->y, dt->z);
|
sprintf(inp, " ACC:%d,%d,%d", dt->x, dt->y, dt->z);
|
||||||
g_InputDisplay[controllerID].append(inp);
|
g_InputDisplay[controllerID].append(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(irData) // incomplete
|
if (irData) // incomplete
|
||||||
{
|
{
|
||||||
sprintf(inp, " IR:%d,%d", ((u8*)irData)[0], ((u8*)irData)[1]);
|
sprintf(inp, " IR:%d,%d", ((u8*)irData)[0], ((u8*)irData)[1]);
|
||||||
g_InputDisplay[controllerID].append(inp);
|
g_InputDisplay[controllerID].append(inp);
|
||||||
|
@ -666,7 +666,7 @@ void CheckWiimoteStatus(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures&
|
||||||
|
|
||||||
void RecordWiimote(int wiimote, u8 *data, u8 size)
|
void RecordWiimote(int wiimote, u8 *data, u8 size)
|
||||||
{
|
{
|
||||||
if(!IsRecordingInput() || !IsUsingWiimote(wiimote))
|
if (!IsRecordingInput() || !IsUsingWiimote(wiimote))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InputUpdate();
|
InputUpdate();
|
||||||
|
@ -713,10 +713,10 @@ void ReadHeader()
|
||||||
|
|
||||||
bool PlayInput(const char *filename)
|
bool PlayInput(const char *filename)
|
||||||
{
|
{
|
||||||
if(!filename || g_playMode != MODE_NONE)
|
if (!filename || g_playMode != MODE_NONE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!File::Exists(filename))
|
if (!File::Exists(filename))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
File::IOFile g_recordfd;
|
File::IOFile g_recordfd;
|
||||||
|
@ -726,7 +726,10 @@ bool PlayInput(const char *filename)
|
||||||
|
|
||||||
g_recordfd.ReadArray(&tmpHeader, 1);
|
g_recordfd.ReadArray(&tmpHeader, 1);
|
||||||
|
|
||||||
if(tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A) {
|
if (tmpHeader.filetype[0] != 'D' ||
|
||||||
|
tmpHeader.filetype[1] != 'T' ||
|
||||||
|
tmpHeader.filetype[2] != 'M' ||
|
||||||
|
tmpHeader.filetype[3] != 0x1A) {
|
||||||
PanicAlertT("Invalid recording file");
|
PanicAlertT("Invalid recording file");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -748,10 +751,10 @@ bool PlayInput(const char *filename)
|
||||||
g_recordfd.Close();
|
g_recordfd.Close();
|
||||||
|
|
||||||
// Load savestate (and skip to frame data)
|
// Load savestate (and skip to frame data)
|
||||||
if(tmpHeader.bFromSaveState)
|
if (tmpHeader.bFromSaveState)
|
||||||
{
|
{
|
||||||
const std::string stateFilename = std::string(filename) + ".sav";
|
const std::string stateFilename = std::string(filename) + ".sav";
|
||||||
if(File::Exists(stateFilename))
|
if (File::Exists(stateFilename))
|
||||||
Core::SetStateFileName(stateFilename);
|
Core::SetStateFileName(stateFilename);
|
||||||
g_bRecordingFromSaveState = true;
|
g_bRecordingFromSaveState = true;
|
||||||
Movie::LoadInput(filename);
|
Movie::LoadInput(filename);
|
||||||
|
@ -791,7 +794,7 @@ void LoadInput(const char *filename)
|
||||||
|
|
||||||
t_record.ReadArray(&tmpHeader, 1);
|
t_record.ReadArray(&tmpHeader, 1);
|
||||||
|
|
||||||
if(tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A)
|
if (tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A)
|
||||||
{
|
{
|
||||||
PanicAlertT("Savestate movie %s is corrupted, movie recording stopping...", filename);
|
PanicAlertT("Savestate movie %s is corrupted, movie recording stopping...", filename);
|
||||||
EndPlayInput(false);
|
EndPlayInput(false);
|
||||||
|
@ -838,7 +841,7 @@ void LoadInput(const char *filename)
|
||||||
{
|
{
|
||||||
PanicAlertT("Warning: You loaded a save that's after the end of the current movie. (byte %u > %u) (frame %u > %u). You should load another save before continuing, or load this state with read-only mode off.", (u32)g_currentByte+256, (u32)g_totalBytes+256, (u32)g_currentFrame, (u32)g_totalFrames);
|
PanicAlertT("Warning: You loaded a save that's after the end of the current movie. (byte %u > %u) (frame %u > %u). You should load another save before continuing, or load this state with read-only mode off.", (u32)g_currentByte+256, (u32)g_totalBytes+256, (u32)g_currentFrame, (u32)g_totalFrames);
|
||||||
}
|
}
|
||||||
else if(g_currentByte > 0 && g_totalBytes > 0)
|
else if (g_currentByte > 0 && g_totalBytes > 0)
|
||||||
{
|
{
|
||||||
// verify identical from movie start to the save's current frame
|
// verify identical from movie start to the save's current frame
|
||||||
u32 len = (u32)g_currentByte;
|
u32 len = (u32)g_currentByte;
|
||||||
|
@ -850,7 +853,7 @@ void LoadInput(const char *filename)
|
||||||
{
|
{
|
||||||
// this is a "you did something wrong" alert for the user's benefit.
|
// this is a "you did something wrong" alert for the user's benefit.
|
||||||
// we'll try to say what's going on in excruciating detail, otherwise the user might not believe us.
|
// we'll try to say what's going on in excruciating detail, otherwise the user might not believe us.
|
||||||
if(IsUsingWiimote(0))
|
if (IsUsingWiimote(0))
|
||||||
{
|
{
|
||||||
// TODO: more detail
|
// TODO: more detail
|
||||||
PanicAlertT("Warning: You loaded a save whose movie mismatches on byte %d (0x%X). You should load another save before continuing, or load this state with read-only mode off. Otherwise you'll probably get a desync.", i+256, i+256);
|
PanicAlertT("Warning: You loaded a save whose movie mismatches on byte %d (0x%X). You should load another save before continuing, or load this state with read-only mode off. Otherwise you'll probably get a desync.", i+256, i+256);
|
||||||
|
@ -893,7 +896,7 @@ void LoadInput(const char *filename)
|
||||||
{
|
{
|
||||||
if (g_bReadOnly)
|
if (g_bReadOnly)
|
||||||
{
|
{
|
||||||
if(g_playMode != MODE_PLAYING)
|
if (g_playMode != MODE_PLAYING)
|
||||||
{
|
{
|
||||||
g_playMode = MODE_PLAYING;
|
g_playMode = MODE_PLAYING;
|
||||||
Core::DisplayMessage("Switched to playback", 2000);
|
Core::DisplayMessage("Switched to playback", 2000);
|
||||||
|
@ -901,7 +904,7 @@ void LoadInput(const char *filename)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(g_playMode != MODE_RECORDING)
|
if (g_playMode != MODE_RECORDING)
|
||||||
{
|
{
|
||||||
g_playMode = MODE_RECORDING;
|
g_playMode = MODE_RECORDING;
|
||||||
Core::DisplayMessage("Switched to recording", 2000);
|
Core::DisplayMessage("Switched to recording", 2000);
|
||||||
|
@ -956,37 +959,37 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
|
||||||
|
|
||||||
PadStatus->button |= PAD_USE_ORIGIN;
|
PadStatus->button |= PAD_USE_ORIGIN;
|
||||||
|
|
||||||
if(g_padState.A)
|
if (g_padState.A)
|
||||||
{
|
{
|
||||||
PadStatus->button |= PAD_BUTTON_A;
|
PadStatus->button |= PAD_BUTTON_A;
|
||||||
PadStatus->analogA = 0xFF;
|
PadStatus->analogA = 0xFF;
|
||||||
}
|
}
|
||||||
if(g_padState.B)
|
if (g_padState.B)
|
||||||
{
|
{
|
||||||
PadStatus->button |= PAD_BUTTON_B;
|
PadStatus->button |= PAD_BUTTON_B;
|
||||||
PadStatus->analogB = 0xFF;
|
PadStatus->analogB = 0xFF;
|
||||||
}
|
}
|
||||||
if(g_padState.X)
|
if (g_padState.X)
|
||||||
PadStatus->button |= PAD_BUTTON_X;
|
PadStatus->button |= PAD_BUTTON_X;
|
||||||
if(g_padState.Y)
|
if (g_padState.Y)
|
||||||
PadStatus->button |= PAD_BUTTON_Y;
|
PadStatus->button |= PAD_BUTTON_Y;
|
||||||
if(g_padState.Z)
|
if (g_padState.Z)
|
||||||
PadStatus->button |= PAD_TRIGGER_Z;
|
PadStatus->button |= PAD_TRIGGER_Z;
|
||||||
if(g_padState.Start)
|
if (g_padState.Start)
|
||||||
PadStatus->button |= PAD_BUTTON_START;
|
PadStatus->button |= PAD_BUTTON_START;
|
||||||
|
|
||||||
if(g_padState.DPadUp)
|
if (g_padState.DPadUp)
|
||||||
PadStatus->button |= PAD_BUTTON_UP;
|
PadStatus->button |= PAD_BUTTON_UP;
|
||||||
if(g_padState.DPadDown)
|
if (g_padState.DPadDown)
|
||||||
PadStatus->button |= PAD_BUTTON_DOWN;
|
PadStatus->button |= PAD_BUTTON_DOWN;
|
||||||
if(g_padState.DPadLeft)
|
if (g_padState.DPadLeft)
|
||||||
PadStatus->button |= PAD_BUTTON_LEFT;
|
PadStatus->button |= PAD_BUTTON_LEFT;
|
||||||
if(g_padState.DPadRight)
|
if (g_padState.DPadRight)
|
||||||
PadStatus->button |= PAD_BUTTON_RIGHT;
|
PadStatus->button |= PAD_BUTTON_RIGHT;
|
||||||
|
|
||||||
if(g_padState.L)
|
if (g_padState.L)
|
||||||
PadStatus->button |= PAD_TRIGGER_L;
|
PadStatus->button |= PAD_TRIGGER_L;
|
||||||
if(g_padState.R)
|
if (g_padState.R)
|
||||||
PadStatus->button |= PAD_TRIGGER_R;
|
PadStatus->button |= PAD_TRIGGER_R;
|
||||||
if (g_padState.disc)
|
if (g_padState.disc)
|
||||||
{
|
{
|
||||||
|
@ -1022,7 +1025,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
|
||||||
|
|
||||||
bool PlayWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode)
|
bool PlayWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode)
|
||||||
{
|
{
|
||||||
if(!IsPlayingInput() || !IsUsingWiimote(wiimote) || tmpInput == nullptr)
|
if (!IsPlayingInput() || !IsUsingWiimote(wiimote) || tmpInput == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (g_currentByte > g_totalBytes)
|
if (g_currentByte > g_totalBytes)
|
||||||
|
@ -1074,7 +1077,7 @@ void EndPlayInput(bool cont)
|
||||||
g_playMode = MODE_RECORDING;
|
g_playMode = MODE_RECORDING;
|
||||||
Core::DisplayMessage("Reached movie end. Resuming recording.", 2000);
|
Core::DisplayMessage("Reached movie end. Resuming recording.", 2000);
|
||||||
}
|
}
|
||||||
else if(g_playMode != MODE_NONE)
|
else if (g_playMode != MODE_NONE)
|
||||||
{
|
{
|
||||||
g_rerecords = 0;
|
g_rerecords = 0;
|
||||||
g_currentByte = 0;
|
g_currentByte = 0;
|
||||||
|
|
|
@ -697,7 +697,7 @@ bool NetPlayServer::UPnPMapPort(const std::string& addr, const u16 port)
|
||||||
(std::string("dolphin-emu TCP on ") + addr).c_str(),
|
(std::string("dolphin-emu TCP on ") + addr).c_str(),
|
||||||
"TCP", nullptr, nullptr);
|
"TCP", nullptr, nullptr);
|
||||||
|
|
||||||
if(result != 0)
|
if (result != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_upnp_mapped = port;
|
m_upnp_mapped = port;
|
||||||
|
|
|
@ -116,7 +116,7 @@ static u8 gdb_calc_chksum()
|
||||||
u8 *ptr = cmd_bfr;
|
u8 *ptr = cmd_bfr;
|
||||||
u8 c = 0;
|
u8 c = 0;
|
||||||
|
|
||||||
while(len-- > 0)
|
while (len-- > 0)
|
||||||
c += *ptr++;
|
c += *ptr++;
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
@ -306,7 +306,7 @@ static void gdb_reply(const char *reply)
|
||||||
u8 *ptr;
|
u8 *ptr;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if(!gdb_active())
|
if (!gdb_active())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(cmd_bfr, 0, sizeof cmd_bfr);
|
memset(cmd_bfr, 0, sizeof cmd_bfr);
|
||||||
|
@ -329,7 +329,8 @@ static void gdb_reply(const char *reply)
|
||||||
|
|
||||||
ptr = cmd_bfr;
|
ptr = cmd_bfr;
|
||||||
left = cmd_len + 4;
|
left = cmd_len + 4;
|
||||||
while (left > 0) {
|
while (left > 0)
|
||||||
|
{
|
||||||
n = send(sock, ptr, left, 0);
|
n = send(sock, ptr, left, 0);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
|
@ -719,14 +720,15 @@ static void gdb_remove_bp()
|
||||||
|
|
||||||
void gdb_handle_exception()
|
void gdb_handle_exception()
|
||||||
{
|
{
|
||||||
while (gdb_active()) {
|
while (gdb_active())
|
||||||
if(!gdb_data_available())
|
{
|
||||||
|
if (!gdb_data_available())
|
||||||
continue;
|
continue;
|
||||||
gdb_read_command();
|
gdb_read_command();
|
||||||
if (cmd_len == 0)
|
if (cmd_len == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch(cmd_bfr[0]) {
|
switch (cmd_bfr[0]) {
|
||||||
case 'q':
|
case 'q':
|
||||||
gdb_handle_query();
|
gdb_handle_query();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -154,11 +154,11 @@ void Interpreter::twi(UGeckoInstruction _inst)
|
||||||
|
|
||||||
ERROR_LOG(POWERPC, "twi rA %x SIMM %x TO %0x", a, b, TO);
|
ERROR_LOG(POWERPC, "twi rA %x SIMM %x TO %0x", a, b, TO);
|
||||||
|
|
||||||
if ( ((a < b) && (TO & 0x10))
|
if (((a < b) && (TO & 0x10)) ||
|
||||||
|| ((a > b) && (TO & 0x08))
|
((a > b) && (TO & 0x08)) ||
|
||||||
|| ((a ==b) && (TO & 0x04))
|
((a ==b) && (TO & 0x04)) ||
|
||||||
|| (((u32)a <(u32)b) && (TO & 0x02))
|
(((u32)a <(u32)b) && (TO & 0x02)) ||
|
||||||
|| (((u32)a >(u32)b) && (TO & 0x01)))
|
(((u32)a >(u32)b) && (TO & 0x01)))
|
||||||
{
|
{
|
||||||
Common::AtomicOr(PowerPC::ppcState.Exceptions, EXCEPTION_PROGRAM);
|
Common::AtomicOr(PowerPC::ppcState.Exceptions, EXCEPTION_PROGRAM);
|
||||||
PowerPC::CheckExceptions();
|
PowerPC::CheckExceptions();
|
||||||
|
@ -382,11 +382,11 @@ void Interpreter::tw(UGeckoInstruction _inst)
|
||||||
|
|
||||||
ERROR_LOG(POWERPC, "tw rA %0x rB %0x TO %0x", a, b, TO);
|
ERROR_LOG(POWERPC, "tw rA %0x rB %0x TO %0x", a, b, TO);
|
||||||
|
|
||||||
if ( ((a < b) && (TO & 0x10))
|
if (((a < b) && (TO & 0x10)) ||
|
||||||
|| ((a > b) && (TO & 0x08))
|
((a > b) && (TO & 0x08)) ||
|
||||||
|| ((a ==b) && (TO & 0x04))
|
((a ==b) && (TO & 0x04)) ||
|
||||||
|| (((u32)a <(u32)b) && (TO & 0x02))
|
(((u32)a <(u32)b) && (TO & 0x02)) ||
|
||||||
|| (((u32)a >(u32)b) && (TO & 0x01)))
|
(((u32)a >(u32)b) && (TO & 0x01)))
|
||||||
{
|
{
|
||||||
Common::AtomicOr(PowerPC::ppcState.Exceptions, EXCEPTION_PROGRAM);
|
Common::AtomicOr(PowerPC::ppcState.Exceptions, EXCEPTION_PROGRAM);
|
||||||
PowerPC::CheckExceptions();
|
PowerPC::CheckExceptions();
|
||||||
|
|
|
@ -99,7 +99,7 @@ float Interpreter::Helper_Dequantize(const u32 _Addr, const EQuantizeType _quant
|
||||||
{
|
{
|
||||||
// dequantize the value
|
// dequantize the value
|
||||||
float fResult;
|
float fResult;
|
||||||
switch(_quantizeType)
|
switch (_quantizeType)
|
||||||
{
|
{
|
||||||
case QUANTIZE_FLOAT:
|
case QUANTIZE_FLOAT:
|
||||||
{
|
{
|
||||||
|
|
|
@ -253,7 +253,7 @@ void Interpreter::mtspr(UGeckoInstruction _inst)
|
||||||
//Our DMA emulation is highly inaccurate - instead of properly emulating the queue
|
//Our DMA emulation is highly inaccurate - instead of properly emulating the queue
|
||||||
//and so on, we simply make all DMA:s complete instantaneously.
|
//and so on, we simply make all DMA:s complete instantaneously.
|
||||||
|
|
||||||
switch(iIndex)
|
switch (iIndex)
|
||||||
{
|
{
|
||||||
case SPR_TL:
|
case SPR_TL:
|
||||||
case SPR_TU:
|
case SPR_TU:
|
||||||
|
|
|
@ -132,7 +132,7 @@ void Jit64::bcx(UGeckoInstruction inst)
|
||||||
MOV(32, M(&LR), Imm32(js.compilerPC + 4));
|
MOV(32, M(&LR), Imm32(js.compilerPC + 4));
|
||||||
|
|
||||||
u32 destination;
|
u32 destination;
|
||||||
if(inst.AA)
|
if (inst.AA)
|
||||||
destination = SignExt16(inst.BD << 2);
|
destination = SignExt16(inst.BD << 2);
|
||||||
else
|
else
|
||||||
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
||||||
|
|
|
@ -18,7 +18,7 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (X
|
||||||
if (d == a)
|
if (d == a)
|
||||||
{
|
{
|
||||||
fpr.BindToRegister(d, true);
|
fpr.BindToRegister(d, true);
|
||||||
if(!single)
|
if (!single)
|
||||||
{
|
{
|
||||||
fpr.BindToRegister(b, true, false);
|
fpr.BindToRegister(b, true, false);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (X
|
||||||
if (reversible)
|
if (reversible)
|
||||||
{
|
{
|
||||||
fpr.BindToRegister(d, true);
|
fpr.BindToRegister(d, true);
|
||||||
if(!single)
|
if (!single)
|
||||||
{
|
{
|
||||||
fpr.BindToRegister(a, true, false);
|
fpr.BindToRegister(a, true, false);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (X
|
||||||
{
|
{
|
||||||
// Sources different from d, can use rather quick solution
|
// Sources different from d, can use rather quick solution
|
||||||
fpr.BindToRegister(d, !single);
|
fpr.BindToRegister(d, !single);
|
||||||
if(!single)
|
if (!single)
|
||||||
{
|
{
|
||||||
fpr.BindToRegister(b, true, false);
|
fpr.BindToRegister(b, true, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,12 +135,12 @@ void Jit64::GenerateRC()
|
||||||
|
|
||||||
void Jit64::ComputeRC(const Gen::OpArg & arg)
|
void Jit64::ComputeRC(const Gen::OpArg & arg)
|
||||||
{
|
{
|
||||||
if( arg.IsImm() )
|
if (arg.IsImm())
|
||||||
{
|
{
|
||||||
s32 value = (s32)arg.offset;
|
s32 value = (s32)arg.offset;
|
||||||
if( value < 0 )
|
if (value < 0)
|
||||||
MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x8));
|
MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x8));
|
||||||
else if( value > 0 )
|
else if (value > 0)
|
||||||
MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x4));
|
MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x4));
|
||||||
else
|
else
|
||||||
MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x2));
|
MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x2));
|
||||||
|
@ -1102,13 +1102,13 @@ void Jit64::mulli(UGeckoInstruction inst)
|
||||||
{
|
{
|
||||||
XOR(32, gpr.R(d), gpr.R(d));
|
XOR(32, gpr.R(d), gpr.R(d));
|
||||||
}
|
}
|
||||||
else if(imm == (u32)-1)
|
else if (imm == (u32)-1)
|
||||||
{
|
{
|
||||||
if (d != a)
|
if (d != a)
|
||||||
MOV(32, gpr.R(d), gpr.R(a));
|
MOV(32, gpr.R(d), gpr.R(a));
|
||||||
NEG(32, gpr.R(d));
|
NEG(32, gpr.R(d));
|
||||||
}
|
}
|
||||||
else if((imm & (imm - 1)) == 0)
|
else if ((imm & (imm - 1)) == 0)
|
||||||
{
|
{
|
||||||
u32 shift = 0;
|
u32 shift = 0;
|
||||||
if (imm & 0xFFFF0000) shift |= 16;
|
if (imm & 0xFFFF0000) shift |= 16;
|
||||||
|
@ -1157,13 +1157,13 @@ void Jit64::mullwx(UGeckoInstruction inst)
|
||||||
{
|
{
|
||||||
XOR(32, gpr.R(d), gpr.R(d));
|
XOR(32, gpr.R(d), gpr.R(d));
|
||||||
}
|
}
|
||||||
else if(imm == (u32)-1)
|
else if (imm == (u32)-1)
|
||||||
{
|
{
|
||||||
if (d != src)
|
if (d != src)
|
||||||
MOV(32, gpr.R(d), gpr.R(src));
|
MOV(32, gpr.R(d), gpr.R(src));
|
||||||
NEG(32, gpr.R(d));
|
NEG(32, gpr.R(d));
|
||||||
}
|
}
|
||||||
else if((imm & (imm - 1)) == 0 && !inst.OE)
|
else if ((imm & (imm - 1)) == 0 && !inst.OE)
|
||||||
{
|
{
|
||||||
u32 shift = 0;
|
u32 shift = 0;
|
||||||
if (imm & 0xFFFF0000) shift |= 16;
|
if (imm & 0xFFFF0000) shift |= 16;
|
||||||
|
@ -1245,7 +1245,7 @@ void Jit64::divwux(UGeckoInstruction inst)
|
||||||
|
|
||||||
if (gpr.R(a).IsImm() && gpr.R(b).IsImm())
|
if (gpr.R(a).IsImm() && gpr.R(b).IsImm())
|
||||||
{
|
{
|
||||||
if( gpr.R(b).offset == 0 )
|
if (gpr.R(b).offset == 0)
|
||||||
{
|
{
|
||||||
gpr.SetImmediate32(d, 0);
|
gpr.SetImmediate32(d, 0);
|
||||||
if (inst.OE)
|
if (inst.OE)
|
||||||
|
@ -1276,7 +1276,7 @@ void Jit64::divwux(UGeckoInstruction inst)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u32 shift = 31;
|
u32 shift = 31;
|
||||||
while(!(divisor & (1 << shift)))
|
while (!(divisor & (1 << shift)))
|
||||||
shift--;
|
shift--;
|
||||||
|
|
||||||
if (divisor == (u32)(1 << shift))
|
if (divisor == (u32)(1 << shift))
|
||||||
|
@ -1403,7 +1403,7 @@ void Jit64::divwx(UGeckoInstruction inst)
|
||||||
if (gpr.R(a).IsImm() && gpr.R(b).IsImm())
|
if (gpr.R(a).IsImm() && gpr.R(b).IsImm())
|
||||||
{
|
{
|
||||||
s32 i = (s32)gpr.R(a).offset, j = (s32)gpr.R(b).offset;
|
s32 i = (s32)gpr.R(a).offset, j = (s32)gpr.R(b).offset;
|
||||||
if( j == 0 || (i == (s32)0x80000000 && j == -1))
|
if (j == 0 || (i == (s32)0x80000000 && j == -1))
|
||||||
{
|
{
|
||||||
gpr.SetImmediate32(d, (i >> 31) ^ j);
|
gpr.SetImmediate32(d, (i >> 31) ^ j);
|
||||||
if (inst.OE)
|
if (inst.OE)
|
||||||
|
|
|
@ -262,7 +262,7 @@ void Jit64::crXXX(UGeckoInstruction inst)
|
||||||
SHR(8, R(ECX), Imm8(shiftB));
|
SHR(8, R(ECX), Imm8(shiftB));
|
||||||
|
|
||||||
// Compute combined bit
|
// Compute combined bit
|
||||||
switch(inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
case 33: // crnor
|
case 33: // crnor
|
||||||
OR(8, R(EAX), R(ECX));
|
OR(8, R(EAX), R(ECX));
|
||||||
|
|
|
@ -132,7 +132,7 @@ void JitArm::DoDownCount()
|
||||||
ARMReg rB = gpr.GetReg();
|
ARMReg rB = gpr.GetReg();
|
||||||
MOVI2R(rA, (u32)&CoreTiming::downcount);
|
MOVI2R(rA, (u32)&CoreTiming::downcount);
|
||||||
LDR(rB, rA);
|
LDR(rB, rA);
|
||||||
if(js.downcountAmount < 255) // We can enlarge this if we used rotations
|
if (js.downcountAmount < 255) // We can enlarge this if we used rotations
|
||||||
{
|
{
|
||||||
SUBS(rB, rB, js.downcountAmount);
|
SUBS(rB, rB, js.downcountAmount);
|
||||||
STR(rB, rA);
|
STR(rB, rA);
|
||||||
|
@ -257,19 +257,19 @@ void JitArm::PrintDebug(UGeckoInstruction inst, u32 level)
|
||||||
printf("\tOuts\n");
|
printf("\tOuts\n");
|
||||||
if (Info->flags & FL_OUT_A)
|
if (Info->flags & FL_OUT_A)
|
||||||
printf("\t-OUT_A: %x\n", inst.RA);
|
printf("\t-OUT_A: %x\n", inst.RA);
|
||||||
if(Info->flags & FL_OUT_D)
|
if (Info->flags & FL_OUT_D)
|
||||||
printf("\t-OUT_D: %x\n", inst.RD);
|
printf("\t-OUT_D: %x\n", inst.RD);
|
||||||
printf("\tIns\n");
|
printf("\tIns\n");
|
||||||
// A, AO, B, C, S
|
// A, AO, B, C, S
|
||||||
if(Info->flags & FL_IN_A)
|
if (Info->flags & FL_IN_A)
|
||||||
printf("\t-IN_A: %x\n", inst.RA);
|
printf("\t-IN_A: %x\n", inst.RA);
|
||||||
if(Info->flags & FL_IN_A0)
|
if (Info->flags & FL_IN_A0)
|
||||||
printf("\t-IN_A0: %x\n", inst.RA);
|
printf("\t-IN_A0: %x\n", inst.RA);
|
||||||
if(Info->flags & FL_IN_B)
|
if (Info->flags & FL_IN_B)
|
||||||
printf("\t-IN_B: %x\n", inst.RB);
|
printf("\t-IN_B: %x\n", inst.RB);
|
||||||
if(Info->flags & FL_IN_C)
|
if (Info->flags & FL_IN_C)
|
||||||
printf("\t-IN_C: %x\n", inst.RC);
|
printf("\t-IN_C: %x\n", inst.RC);
|
||||||
if(Info->flags & FL_IN_S)
|
if (Info->flags & FL_IN_S)
|
||||||
printf("\t-IN_S: %x\n", inst.RS);
|
printf("\t-IN_S: %x\n", inst.RS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ const u8* JitArm::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlo
|
||||||
const u8 *normalEntry = GetCodePtr();
|
const u8 *normalEntry = GetCodePtr();
|
||||||
b->normalEntry = normalEntry;
|
b->normalEntry = normalEntry;
|
||||||
|
|
||||||
if(ImHereDebug)
|
if (ImHereDebug)
|
||||||
QuickCallFunction(R14, (void *)&ImHere); //Used to get a trace of the last few blocks before a crash, sometimes VERY useful
|
QuickCallFunction(R14, (void *)&ImHere); //Used to get a trace of the last few blocks before a crash, sometimes VERY useful
|
||||||
|
|
||||||
if (js.fpa.any)
|
if (js.fpa.any)
|
||||||
|
|
|
@ -192,7 +192,7 @@ void JitArm::bcx(UGeckoInstruction inst)
|
||||||
gpr.Unlock(rA, rB);
|
gpr.Unlock(rA, rB);
|
||||||
|
|
||||||
u32 destination;
|
u32 destination;
|
||||||
if(inst.AA)
|
if (inst.AA)
|
||||||
destination = SignExt16(inst.BD << 2);
|
destination = SignExt16(inst.BD << 2);
|
||||||
else
|
else
|
||||||
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
||||||
|
@ -223,7 +223,7 @@ void JitArm::bcctrx(UGeckoInstruction inst)
|
||||||
//NPC = CTR & 0xfffffffc;
|
//NPC = CTR & 0xfffffffc;
|
||||||
ARMReg rA = gpr.GetReg();
|
ARMReg rA = gpr.GetReg();
|
||||||
|
|
||||||
if(inst.LK_3)
|
if (inst.LK_3)
|
||||||
{
|
{
|
||||||
u32 Jumpto = js.compilerPC + 4;
|
u32 Jumpto = js.compilerPC + 4;
|
||||||
MOVI2R(rA, Jumpto);
|
MOVI2R(rA, Jumpto);
|
||||||
|
|
|
@ -31,7 +31,7 @@ static Operand2 VXSQRTException(2, 5); // 0x200
|
||||||
inline void JitArm::SetFPException(ARMReg Reg, u32 Exception)
|
inline void JitArm::SetFPException(ARMReg Reg, u32 Exception)
|
||||||
{
|
{
|
||||||
Operand2 *ExceptionMask;
|
Operand2 *ExceptionMask;
|
||||||
switch(Exception)
|
switch (Exception)
|
||||||
{
|
{
|
||||||
case FPSCR_VXCVI:
|
case FPSCR_VXCVI:
|
||||||
ExceptionMask = &CVIException;
|
ExceptionMask = &CVIException;
|
||||||
|
|
|
@ -283,7 +283,7 @@ void JitArm::arith(UGeckoInstruction inst)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 31: // addcx, addx, subfx
|
case 31: // addcx, addx, subfx
|
||||||
switch(inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
case 24: // slwx
|
case 24: // slwx
|
||||||
case 28: // andx
|
case 28: // andx
|
||||||
|
@ -341,7 +341,7 @@ void JitArm::arith(UGeckoInstruction inst)
|
||||||
{
|
{
|
||||||
bool hasCarry = false;
|
bool hasCarry = false;
|
||||||
u32 dest = d;
|
u32 dest = d;
|
||||||
switch(inst.OPCD)
|
switch (inst.OPCD)
|
||||||
{
|
{
|
||||||
case 7:
|
case 7:
|
||||||
gpr.SetImmediate(d, Mul(Imm[0], Imm[1]));
|
gpr.SetImmediate(d, Mul(Imm[0], Imm[1]));
|
||||||
|
@ -372,7 +372,7 @@ void JitArm::arith(UGeckoInstruction inst)
|
||||||
dest = a;
|
dest = a;
|
||||||
break;
|
break;
|
||||||
case 31: // addcx, addx, subfx
|
case 31: // addcx, addx, subfx
|
||||||
switch(inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
case 24:
|
case 24:
|
||||||
gpr.SetImmediate(a, Imm[0] << Imm[1]);
|
gpr.SetImmediate(a, Imm[0] << Imm[1]);
|
||||||
|
@ -439,7 +439,7 @@ void JitArm::arith(UGeckoInstruction inst)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// One or the other isn't a IMM
|
// One or the other isn't a IMM
|
||||||
switch(inst.OPCD)
|
switch (inst.OPCD)
|
||||||
{
|
{
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
|
@ -511,7 +511,7 @@ void JitArm::arith(UGeckoInstruction inst)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 31:
|
case 31:
|
||||||
switch(inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
case 24:
|
case 24:
|
||||||
RA = gpr.R(a);
|
RA = gpr.R(a);
|
||||||
|
|
|
@ -89,7 +89,7 @@ void JitArm::SafeStoreFromReg(bool fastmem, s32 dest, u32 value, s32 regOffset,
|
||||||
if (regOffset != -1)
|
if (regOffset != -1)
|
||||||
RB = gpr.R(regOffset);
|
RB = gpr.R(regOffset);
|
||||||
ARMReg RS = gpr.R(value);
|
ARMReg RS = gpr.R(value);
|
||||||
switch(accessSize)
|
switch (accessSize)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
MOVI2R(rA, (u32)&Memory::Write_U32);
|
MOVI2R(rA, (u32)&Memory::Write_U32);
|
||||||
|
@ -129,7 +129,7 @@ void JitArm::stX(UGeckoInstruction inst)
|
||||||
bool zeroA = true;
|
bool zeroA = true;
|
||||||
bool update = false;
|
bool update = false;
|
||||||
bool fastmem = false;
|
bool fastmem = false;
|
||||||
switch(inst.OPCD)
|
switch (inst.OPCD)
|
||||||
{
|
{
|
||||||
case 45: // sthu
|
case 45: // sthu
|
||||||
update = true;
|
update = true;
|
||||||
|
@ -314,10 +314,10 @@ void JitArm::lXX(UGeckoInstruction inst)
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
bool fastmem = false;
|
bool fastmem = false;
|
||||||
|
|
||||||
switch(inst.OPCD)
|
switch (inst.OPCD)
|
||||||
{
|
{
|
||||||
case 31:
|
case 31:
|
||||||
switch(inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
case 55: // lwzux
|
case 55: // lwzux
|
||||||
zeroA = false;
|
zeroA = false;
|
||||||
|
|
|
@ -37,7 +37,7 @@ void JitArm::lfXX(UGeckoInstruction inst)
|
||||||
switch (inst.OPCD)
|
switch (inst.OPCD)
|
||||||
{
|
{
|
||||||
case 31:
|
case 31:
|
||||||
switch(inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
case 567: // lfsux
|
case 567: // lfsux
|
||||||
single = true;
|
single = true;
|
||||||
|
@ -199,7 +199,7 @@ void JitArm::stfXX(UGeckoInstruction inst)
|
||||||
switch (inst.OPCD)
|
switch (inst.OPCD)
|
||||||
{
|
{
|
||||||
case 31:
|
case 31:
|
||||||
switch(inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
case 663: // stfsx
|
case 663: // stfsx
|
||||||
single = true;
|
single = true;
|
||||||
|
|
|
@ -242,7 +242,7 @@ void JitArm::crXXX(UGeckoInstruction inst)
|
||||||
LSR(rB, rB, shiftB);
|
LSR(rB, rB, shiftB);
|
||||||
|
|
||||||
// Compute combined bit
|
// Compute combined bit
|
||||||
switch(inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
case 33: // crnor
|
case 33: // crnor
|
||||||
ORR(rA, rA, rB);
|
ORR(rA, rA, rB);
|
||||||
|
|
|
@ -16,14 +16,14 @@ void ArmFPRCache::Init(ARMXEmitter *emitter)
|
||||||
ARMReg *PPCRegs = GetPPCAllocationOrder(NUMPPCREG);
|
ARMReg *PPCRegs = GetPPCAllocationOrder(NUMPPCREG);
|
||||||
ARMReg *Regs = GetAllocationOrder(NUMARMREG);
|
ARMReg *Regs = GetAllocationOrder(NUMARMREG);
|
||||||
|
|
||||||
for(u8 a = 0; a < NUMPPCREG; ++a)
|
for (u8 a = 0; a < NUMPPCREG; ++a)
|
||||||
{
|
{
|
||||||
ArmCRegs[a].PPCReg = 33;
|
ArmCRegs[a].PPCReg = 33;
|
||||||
ArmCRegs[a].Reg = PPCRegs[a];
|
ArmCRegs[a].Reg = PPCRegs[a];
|
||||||
ArmCRegs[a].LastLoad = 0;
|
ArmCRegs[a].LastLoad = 0;
|
||||||
ArmCRegs[a].PS1 = false;
|
ArmCRegs[a].PS1 = false;
|
||||||
}
|
}
|
||||||
for(u8 a = 0; a < NUMARMREG; ++a)
|
for (u8 a = 0; a < NUMARMREG; ++a)
|
||||||
{
|
{
|
||||||
ArmRegs[a].Reg = Regs[a];
|
ArmRegs[a].Reg = Regs[a];
|
||||||
ArmRegs[a].free = true;
|
ArmRegs[a].free = true;
|
||||||
|
@ -61,8 +61,8 @@ ARMReg *ArmFPRCache::GetAllocationOrder(int &count)
|
||||||
|
|
||||||
ARMReg ArmFPRCache::GetReg(bool AutoLock)
|
ARMReg ArmFPRCache::GetReg(bool AutoLock)
|
||||||
{
|
{
|
||||||
for(u8 a = 0; a < NUMARMREG; ++a)
|
for (u8 a = 0; a < NUMARMREG; ++a)
|
||||||
if(ArmRegs[a].free)
|
if (ArmRegs[a].free)
|
||||||
{
|
{
|
||||||
// Alright, this one is free
|
// Alright, this one is free
|
||||||
if (AutoLock)
|
if (AutoLock)
|
||||||
|
@ -75,9 +75,9 @@ ARMReg ArmFPRCache::GetReg(bool AutoLock)
|
||||||
}
|
}
|
||||||
void ArmFPRCache::Unlock(ARMReg V0)
|
void ArmFPRCache::Unlock(ARMReg V0)
|
||||||
{
|
{
|
||||||
for(u8 RegNum = 0; RegNum < NUMARMREG; ++RegNum)
|
for (u8 RegNum = 0; RegNum < NUMARMREG; ++RegNum)
|
||||||
{
|
{
|
||||||
if(ArmRegs[RegNum].Reg == V0)
|
if (ArmRegs[RegNum].Reg == V0)
|
||||||
{
|
{
|
||||||
_assert_msg_(_DYNA_REC, !ArmRegs[RegNum].free, "This register is already unlocked");
|
_assert_msg_(_DYNA_REC, !ArmRegs[RegNum].free, "This register is already unlocked");
|
||||||
ArmRegs[RegNum].free = true;
|
ArmRegs[RegNum].free = true;
|
||||||
|
@ -88,7 +88,7 @@ u32 ArmFPRCache::GetLeastUsedRegister(bool increment)
|
||||||
{
|
{
|
||||||
u32 HighestUsed = 0;
|
u32 HighestUsed = 0;
|
||||||
u8 lastRegIndex = 0;
|
u8 lastRegIndex = 0;
|
||||||
for(u8 a = 0; a < NUMPPCREG; ++a){
|
for (u8 a = 0; a < NUMPPCREG; ++a){
|
||||||
if (increment)
|
if (increment)
|
||||||
++ArmCRegs[a].LastLoad;
|
++ArmCRegs[a].LastLoad;
|
||||||
if (ArmCRegs[a].LastLoad > HighestUsed)
|
if (ArmCRegs[a].LastLoad > HighestUsed)
|
||||||
|
|
|
@ -16,13 +16,13 @@ void ArmRegCache::Init(ARMXEmitter *emitter)
|
||||||
ARMReg *PPCRegs = GetPPCAllocationOrder(NUMPPCREG);
|
ARMReg *PPCRegs = GetPPCAllocationOrder(NUMPPCREG);
|
||||||
ARMReg *Regs = GetAllocationOrder(NUMARMREG);
|
ARMReg *Regs = GetAllocationOrder(NUMARMREG);
|
||||||
|
|
||||||
for(u8 a = 0; a < NUMPPCREG; ++a)
|
for (u8 a = 0; a < NUMPPCREG; ++a)
|
||||||
{
|
{
|
||||||
ArmCRegs[a].PPCReg = 33;
|
ArmCRegs[a].PPCReg = 33;
|
||||||
ArmCRegs[a].Reg = PPCRegs[a];
|
ArmCRegs[a].Reg = PPCRegs[a];
|
||||||
ArmCRegs[a].LastLoad = 0;
|
ArmCRegs[a].LastLoad = 0;
|
||||||
}
|
}
|
||||||
for(u8 a = 0; a < NUMARMREG; ++a)
|
for (u8 a = 0; a < NUMARMREG; ++a)
|
||||||
{
|
{
|
||||||
ArmRegs[a].Reg = Regs[a];
|
ArmRegs[a].Reg = Regs[a];
|
||||||
ArmRegs[a].free = true;
|
ArmRegs[a].free = true;
|
||||||
|
@ -57,8 +57,8 @@ ARMReg *ArmRegCache::GetAllocationOrder(int &count)
|
||||||
|
|
||||||
ARMReg ArmRegCache::GetReg(bool AutoLock)
|
ARMReg ArmRegCache::GetReg(bool AutoLock)
|
||||||
{
|
{
|
||||||
for(u8 a = 0; a < NUMARMREG; ++a)
|
for (u8 a = 0; a < NUMARMREG; ++a)
|
||||||
if(ArmRegs[a].free)
|
if (ArmRegs[a].free)
|
||||||
{
|
{
|
||||||
// Alright, this one is free
|
// Alright, this one is free
|
||||||
if (AutoLock)
|
if (AutoLock)
|
||||||
|
@ -72,23 +72,24 @@ ARMReg ArmRegCache::GetReg(bool AutoLock)
|
||||||
|
|
||||||
void ArmRegCache::Unlock(ARMReg R0, ARMReg R1, ARMReg R2, ARMReg R3)
|
void ArmRegCache::Unlock(ARMReg R0, ARMReg R1, ARMReg R2, ARMReg R3)
|
||||||
{
|
{
|
||||||
for(u8 RegNum = 0; RegNum < NUMARMREG; ++RegNum)
|
for (u8 RegNum = 0; RegNum < NUMARMREG; ++RegNum)
|
||||||
{
|
{
|
||||||
if(ArmRegs[RegNum].Reg == R0)
|
if (ArmRegs[RegNum].Reg == R0)
|
||||||
{
|
{
|
||||||
_assert_msg_(_DYNA_REC, !ArmRegs[RegNum].free, "This register is already unlocked");
|
_assert_msg_(_DYNA_REC, !ArmRegs[RegNum].free, "This register is already unlocked");
|
||||||
ArmRegs[RegNum].free = true;
|
ArmRegs[RegNum].free = true;
|
||||||
}
|
}
|
||||||
if( R1 != INVALID_REG && ArmRegs[RegNum].Reg == R1) ArmRegs[RegNum].free = true;
|
if ( R1 != INVALID_REG && ArmRegs[RegNum].Reg == R1) ArmRegs[RegNum].free = true;
|
||||||
if( R2 != INVALID_REG && ArmRegs[RegNum].Reg == R2) ArmRegs[RegNum].free = true;
|
if ( R2 != INVALID_REG && ArmRegs[RegNum].Reg == R2) ArmRegs[RegNum].free = true;
|
||||||
if( R3 != INVALID_REG && ArmRegs[RegNum].Reg == R3) ArmRegs[RegNum].free = true;
|
if ( R3 != INVALID_REG && ArmRegs[RegNum].Reg == R3) ArmRegs[RegNum].free = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
u32 ArmRegCache::GetLeastUsedRegister(bool increment)
|
u32 ArmRegCache::GetLeastUsedRegister(bool increment)
|
||||||
{
|
{
|
||||||
u32 HighestUsed = 0;
|
u32 HighestUsed = 0;
|
||||||
u8 lastRegIndex = 0;
|
u8 lastRegIndex = 0;
|
||||||
for(u8 a = 0; a < NUMPPCREG; ++a){
|
for (u8 a = 0; a < NUMPPCREG; ++a)
|
||||||
|
{
|
||||||
if (increment)
|
if (increment)
|
||||||
++ArmCRegs[a].LastLoad;
|
++ArmCRegs[a].LastLoad;
|
||||||
if (ArmCRegs[a].LastLoad > HighestUsed)
|
if (ArmCRegs[a].LastLoad > HighestUsed)
|
||||||
|
@ -118,7 +119,7 @@ ARMReg ArmRegCache::R(u32 preg)
|
||||||
u32 lastRegIndex = GetLeastUsedRegister(true);
|
u32 lastRegIndex = GetLeastUsedRegister(true);
|
||||||
|
|
||||||
// Check if already Loaded
|
// Check if already Loaded
|
||||||
if(regs[preg].GetType() == REG_REG)
|
if (regs[preg].GetType() == REG_REG)
|
||||||
{
|
{
|
||||||
u8 a = regs[preg].GetRegIndex();
|
u8 a = regs[preg].GetRegIndex();
|
||||||
ArmCRegs[a].LastLoad = 0;
|
ArmCRegs[a].LastLoad = 0;
|
||||||
|
|
|
@ -165,7 +165,7 @@ static void regWriteExit(RegInfo& RI, InstLoc dest) {
|
||||||
}
|
}
|
||||||
static void regStoreInstToPPCState(RegInfo& RI, unsigned width, InstLoc I, s32 offset) {
|
static void regStoreInstToPPCState(RegInfo& RI, unsigned width, InstLoc I, s32 offset) {
|
||||||
void (JitArmIL::*op)(ARMReg, ARMReg, Operand2, bool);
|
void (JitArmIL::*op)(ARMReg, ARMReg, Operand2, bool);
|
||||||
switch(width)
|
switch (width)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
op = &JitArmIL::STR;
|
op = &JitArmIL::STR;
|
||||||
|
|
|
@ -81,7 +81,7 @@ void JitArmIL::DoDownCount()
|
||||||
ARMReg rB = R12;
|
ARMReg rB = R12;
|
||||||
MOVI2R(rA, (u32)&CoreTiming::downcount);
|
MOVI2R(rA, (u32)&CoreTiming::downcount);
|
||||||
LDR(rB, rA);
|
LDR(rB, rA);
|
||||||
if(js.downcountAmount < 255) // We can enlarge this if we used rotations
|
if (js.downcountAmount < 255) // We can enlarge this if we used rotations
|
||||||
{
|
{
|
||||||
SUBS(rB, rB, js.downcountAmount);
|
SUBS(rB, rB, js.downcountAmount);
|
||||||
STR(rB, rA);
|
STR(rB, rA);
|
||||||
|
@ -155,19 +155,19 @@ void JitArmIL::PrintDebug(UGeckoInstruction inst, u32 level)
|
||||||
printf("\tOuts\n");
|
printf("\tOuts\n");
|
||||||
if (Info->flags & FL_OUT_A)
|
if (Info->flags & FL_OUT_A)
|
||||||
printf("\t-OUT_A: %x\n", inst.RA);
|
printf("\t-OUT_A: %x\n", inst.RA);
|
||||||
if(Info->flags & FL_OUT_D)
|
if (Info->flags & FL_OUT_D)
|
||||||
printf("\t-OUT_D: %x\n", inst.RD);
|
printf("\t-OUT_D: %x\n", inst.RD);
|
||||||
printf("\tIns\n");
|
printf("\tIns\n");
|
||||||
// A, AO, B, C, S
|
// A, AO, B, C, S
|
||||||
if(Info->flags & FL_IN_A)
|
if (Info->flags & FL_IN_A)
|
||||||
printf("\t-IN_A: %x\n", inst.RA);
|
printf("\t-IN_A: %x\n", inst.RA);
|
||||||
if(Info->flags & FL_IN_A0)
|
if (Info->flags & FL_IN_A0)
|
||||||
printf("\t-IN_A0: %x\n", inst.RA);
|
printf("\t-IN_A0: %x\n", inst.RA);
|
||||||
if(Info->flags & FL_IN_B)
|
if (Info->flags & FL_IN_B)
|
||||||
printf("\t-IN_B: %x\n", inst.RB);
|
printf("\t-IN_B: %x\n", inst.RB);
|
||||||
if(Info->flags & FL_IN_C)
|
if (Info->flags & FL_IN_C)
|
||||||
printf("\t-IN_C: %x\n", inst.RC);
|
printf("\t-IN_C: %x\n", inst.RC);
|
||||||
if(Info->flags & FL_IN_S)
|
if (Info->flags & FL_IN_S)
|
||||||
printf("\t-IN_S: %x\n", inst.RS);
|
printf("\t-IN_S: %x\n", inst.RS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ void JitArmIL::bcx(UGeckoInstruction inst)
|
||||||
IREmitter::InstLoc Test = TestBranch(ibuild, inst);
|
IREmitter::InstLoc Test = TestBranch(ibuild, inst);
|
||||||
|
|
||||||
u32 destination;
|
u32 destination;
|
||||||
if(inst.AA)
|
if (inst.AA)
|
||||||
destination = SignExt16(inst.BD << 2);
|
destination = SignExt16(inst.BD << 2);
|
||||||
else
|
else
|
||||||
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
||||||
|
|
|
@ -108,7 +108,7 @@ void JitILBase::bcx(UGeckoInstruction inst)
|
||||||
IREmitter::InstLoc Test = TestBranch(ibuild, inst);
|
IREmitter::InstLoc Test = TestBranch(ibuild, inst);
|
||||||
|
|
||||||
u32 destination;
|
u32 destination;
|
||||||
if(inst.AA)
|
if (inst.AA)
|
||||||
destination = SignExt16(inst.BD << 2);
|
destination = SignExt16(inst.BD << 2);
|
||||||
else
|
else
|
||||||
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue