Various changes suggested by cppcheck
- remove unused variables - reduce the scope where it makes sense - correct limits (did you know that strcat()'s last parameter does not include the \0 that is always added?) - set some free()'d pointers to NULL
This commit is contained in:
parent
5f0a8008f4
commit
315a8ba1c0
|
@ -15,22 +15,19 @@ soundtouch::SoundTouch soundTouch;
|
|||
//
|
||||
bool OpenALStream::Start()
|
||||
{
|
||||
ALDeviceList *pDeviceList = NULL;
|
||||
ALCcontext *pContext = NULL;
|
||||
ALCdevice *pDevice = NULL;
|
||||
bool bReturn = false;
|
||||
|
||||
pDeviceList = new ALDeviceList();
|
||||
ALDeviceList *pDeviceList = new ALDeviceList();
|
||||
if ((pDeviceList) && (pDeviceList->GetNumDevices()))
|
||||
{
|
||||
char *defDevName = pDeviceList->GetDeviceName(pDeviceList->GetDefaultDevice());
|
||||
|
||||
WARN_LOG(AUDIO, "Found OpenAL device %s", defDevName);
|
||||
|
||||
pDevice = alcOpenDevice(defDevName);
|
||||
ALCdevice *pDevice = alcOpenDevice(defDevName);
|
||||
if (pDevice)
|
||||
{
|
||||
pContext = alcCreateContext(pDevice, NULL);
|
||||
ALCcontext *pContext = alcCreateContext(pDevice, NULL);
|
||||
if (pContext)
|
||||
{
|
||||
// Used to determine an appropriate period size (2x period = total buffer size)
|
||||
|
|
|
@ -42,10 +42,6 @@
|
|||
ALDeviceList::ALDeviceList()
|
||||
{
|
||||
ALDEVICEINFO ALDeviceInfo;
|
||||
char *devices;
|
||||
s32 index;
|
||||
const char *defaultDeviceName = NULL;
|
||||
const char *actualDeviceName = NULL;
|
||||
|
||||
// DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support
|
||||
vDeviceInfo.clear();
|
||||
|
@ -57,11 +53,10 @@ ALDeviceList::ALDeviceList()
|
|||
//if (LoadOAL10Library(NULL, &ALFunction) == TRUE) {
|
||||
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
|
||||
{
|
||||
devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
||||
index = 0;
|
||||
const char *devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||
const char *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
||||
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
||||
while (devices != NULL && strlen(devices) > 0)
|
||||
for (s32 index = 0; devices != NULL && strlen(devices) > 0; index++, devices += strlen(devices) + 1)
|
||||
{
|
||||
if (strcmp(defaultDeviceName, devices) == 0)
|
||||
{
|
||||
|
@ -75,7 +70,7 @@ ALDeviceList::ALDeviceList()
|
|||
{
|
||||
alcMakeContextCurrent(context);
|
||||
// if new actual device name isn't already in the list, then add it...
|
||||
actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
|
||||
const char *actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
|
||||
bool bNewName = true;
|
||||
for (s32 i = 0; i < GetNumDevices(); i++)
|
||||
{
|
||||
|
@ -130,8 +125,6 @@ ALDeviceList::ALDeviceList()
|
|||
}
|
||||
alcCloseDevice(device);
|
||||
}
|
||||
devices += strlen(devices) + 1;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -735,8 +735,8 @@ public:
|
|||
{
|
||||
#ifndef __SYMBIAN32__
|
||||
FreeMemoryPages(region, region_size);
|
||||
#endif
|
||||
region = NULL;
|
||||
#endif
|
||||
region_size = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ std::vector<std::string> cdio_get_devices ()
|
|||
for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
|
||||
{
|
||||
std::string drive = StringFromFormat(checklist[i].format, j);
|
||||
if ( (is_cdrom(drive, NULL)) > 0 )
|
||||
if (is_cdrom(drive, NULL))
|
||||
{
|
||||
drives.push_back(std::move(drive));
|
||||
}
|
||||
|
|
|
@ -25,6 +25,14 @@ extern const char *netplay_dolphin_ver;
|
|||
#define LOGGING 1
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || __clang__
|
||||
// Disable "unused function" warnings for the ones manually marked as such.
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
// Not sure MSVC even checks this...
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
#define STACKALIGN
|
||||
|
||||
#if __cplusplus >= 201103 || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
|
|
|
@ -362,8 +362,6 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
|
|||
{
|
||||
STACKFRAME callStack;
|
||||
BOOL bResult;
|
||||
TCHAR symInfo[BUFFERSIZE] = _T("?");
|
||||
TCHAR srcInfo[BUFFERSIZE] = _T("?");
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
// If it's not this thread, let's suspend it, and resume it at the end
|
||||
|
|
|
@ -20,11 +20,11 @@ namespace FPURoundMode
|
|||
PREC_53 = 1,
|
||||
PREC_64 = 2
|
||||
};
|
||||
void SetRoundMode(enum RoundModes mode);
|
||||
void SetRoundMode(RoundModes mode);
|
||||
|
||||
void SetPrecisionMode(enum PrecisionModes mode);
|
||||
void SetPrecisionMode(PrecisionModes mode);
|
||||
|
||||
void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode);
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode);
|
||||
|
||||
/*
|
||||
* There are two different flavors of float to int conversion:
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
// Generic, do nothing
|
||||
namespace FPURoundMode
|
||||
{
|
||||
void SetRoundMode(enum RoundModes mode)
|
||||
void SetRoundMode(RoundModes mode)
|
||||
{
|
||||
}
|
||||
void SetPrecisionMode(enum PrecisionModes mode)
|
||||
void SetPrecisionMode(PrecisionModes mode)
|
||||
{
|
||||
}
|
||||
void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode)
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode)
|
||||
{
|
||||
}
|
||||
void SaveSIMDState()
|
||||
|
|
|
@ -124,13 +124,12 @@ bool IniFile::Section::Get(const std::string& key, std::vector<std::string>& out
|
|||
}
|
||||
// ignore starting , if any
|
||||
size_t subStart = temp.find_first_not_of(",");
|
||||
size_t subEnd;
|
||||
|
||||
// split by ,
|
||||
while (subStart != std::string::npos)
|
||||
{
|
||||
// Find next ,
|
||||
subEnd = temp.find_first_of(",", subStart);
|
||||
size_t subEnd = temp.find_first_of(",", subStart);
|
||||
if (subStart != subEnd)
|
||||
// take from first char until next ,
|
||||
out.push_back(StripSpaces(temp.substr(subStart, subEnd - subStart)));
|
||||
|
|
|
@ -36,7 +36,7 @@ int AshmemCreateFileMapping(const char *name, size_t size)
|
|||
return fd;
|
||||
|
||||
// We don't really care if we can't set the name, it is optional
|
||||
ret = ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
|
||||
ret = ioctl(fd, ASHMEM_SET_SIZE, size);
|
||||
if (ret < 0)
|
||||
|
|
|
@ -129,11 +129,10 @@ void FreeMemoryPages(void* ptr, size_t size)
|
|||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
||||
{
|
||||
PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg());
|
||||
ptr = NULL; // Is this our responsibility?
|
||||
|
||||
}
|
||||
#else
|
||||
munmap(ptr, size);
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace FPURoundMode
|
|||
static u32 saved_sse_state = _mm_getcsr();
|
||||
static const u32 default_sse_state = _mm_getcsr();
|
||||
|
||||
void SetRoundMode(enum RoundModes mode)
|
||||
void SetRoundMode(RoundModes mode)
|
||||
{
|
||||
// Set FPU rounding mode to mimic the PowerPC's
|
||||
#ifdef _M_IX86
|
||||
|
@ -49,7 +49,7 @@ namespace FPURoundMode
|
|||
#endif
|
||||
}
|
||||
|
||||
void SetPrecisionMode(enum PrecisionModes mode)
|
||||
void SetPrecisionMode(PrecisionModes mode)
|
||||
{
|
||||
#ifdef _M_IX86
|
||||
// sets the floating-point lib to 53-bit
|
||||
|
@ -75,7 +75,7 @@ namespace FPURoundMode
|
|||
#endif
|
||||
}
|
||||
|
||||
void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode)
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode)
|
||||
{
|
||||
// OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register)
|
||||
const u32 EXCEPTION_MASK = 0x1F80;
|
||||
|
|
|
@ -145,51 +145,56 @@ const u32 table7[0x40] = {
|
|||
|
||||
void generateseeds(u32 *seeds, const u8 *seedtable, u8 doreverse)
|
||||
{
|
||||
int i,j;
|
||||
u32 tmp3;
|
||||
u8 array0[0x38],array1[0x38],array2[0x08];
|
||||
u8 tmp,tmp2;
|
||||
|
||||
i = 0;
|
||||
while (i < 0x38)
|
||||
for (int i = 0; i < 0x38; ++i)
|
||||
{
|
||||
tmp = (gentable0[i] - 1);
|
||||
array0[i++] = ((u32)(0-(seedtable[tmp>>3] & gentable1[tmp&7])) >> 31);
|
||||
array0[i] = ((u32)(0-(seedtable[tmp>>3] & gentable1[tmp&7])) >> 31);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < 0x10)
|
||||
for (int i = 0; i < 0x10; ++i)
|
||||
{
|
||||
memset(array2,0,8);
|
||||
tmp2 = gentable2[i];
|
||||
|
||||
for (j = 0; j < 0x38; j++)
|
||||
for (int j = 0; j < 0x38; j++)
|
||||
{
|
||||
tmp = (tmp2+j);
|
||||
|
||||
if (j > 0x1B)
|
||||
{
|
||||
if (tmp > 0x37) tmp-=0x1C;
|
||||
if (tmp > 0x37)
|
||||
{
|
||||
tmp-=0x1C;
|
||||
}
|
||||
}
|
||||
else if (tmp > 0x1B)
|
||||
{
|
||||
tmp-=0x1C;
|
||||
}
|
||||
else if (tmp > 0x1B) tmp-=0x1C;
|
||||
|
||||
array1[j] = array0[tmp];
|
||||
}
|
||||
for (j = 0; j < 0x30; j++)
|
||||
for (int j = 0; j < 0x30; j++)
|
||||
{
|
||||
if (!array1[gentable3[j]-1]) continue;
|
||||
if (!array1[gentable3[j]-1])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
tmp = (((j*0x2AAB)>>16) - (j>>0x1F));
|
||||
array2[tmp] |= (gentable1[j-(tmp*6)]>>2);
|
||||
}
|
||||
seeds[i<<1] = ((array2[0]<<24)|(array2[2]<<16)|(array2[4]<<8)|array2[6]);
|
||||
seeds[(i<<1)+1] = ((array2[1]<<24)|(array2[3]<<16)|(array2[5]<<8)|array2[7]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!doreverse)
|
||||
{
|
||||
j = 0x1F;
|
||||
for (i = 0; i < 16; i+=2)
|
||||
int j = 0x1F;
|
||||
for (int i = 0; i < 16; i+=2)
|
||||
{
|
||||
tmp3 = seeds[i];
|
||||
seeds[i] = seeds[j-1];
|
||||
|
@ -222,20 +227,17 @@ void setcode(u32 *dst, u32 addr, u32 val)
|
|||
|
||||
u16 gencrc16(u32 *codes, u16 size)
|
||||
{
|
||||
u16 ret=0;
|
||||
u8 tmp=0,tmp2;
|
||||
int i;
|
||||
u16 ret = 0;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
while (tmp < size)
|
||||
for (u8 tmp = 0; tmp < size; ++tmp)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
tmp2 = ((codes[tmp] >> (i<<3))^ret);
|
||||
u8 tmp2 = ((codes[tmp] >> (i<<3))^ret);
|
||||
ret = ((crctable0[(tmp2>>4)&0x0F]^crctable1[tmp2&0x0F])^(ret>>8));
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -243,9 +245,7 @@ u16 gencrc16(u32 *codes, u16 size)
|
|||
|
||||
u8 verifycode(u32 *codes, u16 size)
|
||||
{
|
||||
u16 tmp;
|
||||
|
||||
tmp = gencrc16(codes,size);
|
||||
u16 tmp = gencrc16(codes,size);
|
||||
return (((tmp>>12)^(tmp>>8)^(tmp>>4)^tmp)&0x0F);
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,10 @@ bool getbitstring(u32 *ctrl, u32 *out, u8 len)
|
|||
ctrl[1]++;
|
||||
tmp = (ctrl[0]+(ctrl[1]<<2));
|
||||
}
|
||||
if (ctrl[1] >= ctrl[3]) return false;
|
||||
if (ctrl[1] >= ctrl[3])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*out = ((*out<<1) | ((tmp >> (0x1F-ctrl[2])) & 1));
|
||||
ctrl[2]++;
|
||||
}
|
||||
|
@ -372,13 +375,16 @@ bool batchdecrypt(u32 *codes, u16 size)
|
|||
getbitstring(tmparray,tmparray2+5,2); // Region
|
||||
|
||||
// Grab gameid and region from the last decrypted code
|
||||
// Maybe check this against dolphin's GameID? - "code is for wrong game" type msg
|
||||
// TODO: Maybe check this against dolphin's GameID? - "code is for wrong game" type msg
|
||||
//gameid = tmparray2[1];
|
||||
//region = tmparray2[5];
|
||||
|
||||
tmp = codes[0];
|
||||
codes[0] &= 0x0FFFFFFF;
|
||||
if ((tmp>>28) != verifycode(codes,size)) return false;
|
||||
if ((tmp>>28) != verifycode(codes,size))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -406,23 +412,24 @@ int GetVal(const char *flt, char chr)
|
|||
|
||||
int alphatobin(u32 *dst, std::vector<std::string> alpha, int size)
|
||||
{
|
||||
int i,j=0,k;
|
||||
int ret=0,org=(size+1);
|
||||
int j = 0;
|
||||
int ret = 0;
|
||||
int org = size + 1;
|
||||
u32 bin[2];
|
||||
u8 parity;
|
||||
|
||||
while (size)
|
||||
for (; size; --size)
|
||||
{
|
||||
bin[0]=0;
|
||||
for (i = 0; i < 6; i++)
|
||||
bin[0] = 0;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
bin[0] |= (GetVal(filter,alpha[j>>1][i]) << (((5-i)*5)+2));
|
||||
}
|
||||
bin[0] |= (GetVal(filter,alpha[j>>1][6]) >> 3);
|
||||
dst[j++] = bin[0];
|
||||
|
||||
bin[1]=0;
|
||||
for (i = 0; i < 6; i++)
|
||||
bin[1] = 0;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
bin[1] |= (GetVal(filter,alpha[j>>1][i+6]) << (((5-i)*5)+4));
|
||||
}
|
||||
|
@ -430,16 +437,20 @@ int alphatobin(u32 *dst, std::vector<std::string> alpha, int size)
|
|||
dst[j++] = bin[1];
|
||||
|
||||
//verify parity bit
|
||||
k=0;
|
||||
parity=0;
|
||||
for (i = 0; i < 64; i++)
|
||||
int k = 0;
|
||||
parity = 0;
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
if (i == 32) k++;
|
||||
if (i == 32)
|
||||
{
|
||||
k++;
|
||||
}
|
||||
parity ^= (bin[k] >> (i-(k<<5)));
|
||||
}
|
||||
if ((parity&1) != (GetVal(filter,alpha[(j-2)>>1][12])&1)) ret=(org-size);
|
||||
|
||||
size--;
|
||||
if ((parity&1) != (GetVal(filter,alpha[(j-2)>>1][12])&1))
|
||||
{
|
||||
ret=(org-size);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -451,12 +462,11 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
|
|||
buildseeds();
|
||||
|
||||
u32 uCodes[1200];
|
||||
u32 i,ret;
|
||||
u32 ret;
|
||||
|
||||
for(i = 0; i < vCodes.size(); ++i)
|
||||
for (std::string& s : vCodes)
|
||||
{
|
||||
transform(vCodes[i].begin(), vCodes[i].end(), vCodes[i].begin(), toupper);
|
||||
//PanicAlert("Encrypted AR Code\n%s", vCodes[i].c_str());
|
||||
std::transform(s.begin(), s.end(), s.begin(), toupper);
|
||||
}
|
||||
|
||||
if ((ret=alphatobin(uCodes, vCodes, (int)vCodes.size())))
|
||||
|
@ -470,7 +480,7 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
|
|||
//PanicAlert("Action Replay Code Decryption Error:\nCRC Check Failed\n\n"
|
||||
// "First Code in Block(should be verification code):\n%s", vCodes[0].c_str());
|
||||
|
||||
for (i = 0; i < (vCodes.size()<<1); i+=2)
|
||||
for (size_t i = 0; i < (vCodes.size()<<1); i+=2)
|
||||
{
|
||||
AREntry op;
|
||||
op.cmd_addr = uCodes[i];
|
||||
|
@ -482,7 +492,7 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
|
|||
else
|
||||
{
|
||||
// Skip passing the verification code back
|
||||
for (i = 2; i < (vCodes.size()<<1); i+=2)
|
||||
for (size_t i = 2; i < (vCodes.size()<<1); i+=2)
|
||||
{
|
||||
AREntry op;
|
||||
op.cmd_addr = uCodes[i];
|
||||
|
|
|
@ -100,14 +100,14 @@ struct ARAddr
|
|||
};
|
||||
|
||||
void LogInfo(const char *format, ...);
|
||||
bool Subtype_RamWriteAndFill(const ARAddr addr, const u32 data);
|
||||
bool Subtype_WriteToPointer(const ARAddr addr, const u32 data);
|
||||
bool Subtype_AddCode(const ARAddr addr, const u32 data);
|
||||
bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr addr, const u32 data);
|
||||
bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr addr, const u32 data);
|
||||
bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data);
|
||||
bool NormalCode(const ARAddr addr, const u32 data);
|
||||
bool ConditionalCode(const ARAddr addr, const u32 data, int* const pSkipCount);
|
||||
bool Subtype_RamWriteAndFill(const ARAddr& addr, const u32 data);
|
||||
bool Subtype_WriteToPointer(const ARAddr& addr, const u32 data);
|
||||
bool Subtype_AddCode(const ARAddr& addr, const u32 data);
|
||||
bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr& addr, const u32 data);
|
||||
bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr& addr, const u32 data);
|
||||
bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr& addr, const u32 data);
|
||||
bool NormalCode(const ARAddr& addr, const u32 data);
|
||||
bool ConditionalCode(const ARAddr& addr, const u32 data, int* const pSkipCount);
|
||||
bool CompareValues(const u32 val1, const u32 val2, const int type);
|
||||
|
||||
// ----------------------
|
||||
|
@ -487,7 +487,7 @@ bool IsSelfLogging()
|
|||
|
||||
// ----------------------
|
||||
// Code Functions
|
||||
bool Subtype_RamWriteAndFill(const ARAddr addr, const u32 data)
|
||||
bool Subtype_RamWriteAndFill(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
|
||||
|
@ -544,7 +544,7 @@ bool Subtype_RamWriteAndFill(const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Subtype_WriteToPointer(const ARAddr addr, const u32 data)
|
||||
bool Subtype_WriteToPointer(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
const u32 ptr = Memory::Read_U32(new_addr);
|
||||
|
@ -603,7 +603,7 @@ bool Subtype_WriteToPointer(const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Subtype_AddCode(const ARAddr addr, const u32 data)
|
||||
bool Subtype_AddCode(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
// Used to increment/decrement a value in memory
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
|
@ -663,7 +663,7 @@ bool Subtype_AddCode(const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr addr, const u32 data)
|
||||
bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
// code not yet implemented - TODO
|
||||
// u32 new_addr = (addr & 0x01FFFFFF) | 0x80000000;
|
||||
|
@ -675,7 +675,7 @@ bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr addr, const u32 data)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr addr, const u32 data) // This needs more testing
|
||||
bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr& addr, const u32 data) // This needs more testing
|
||||
{
|
||||
const u32 new_addr = ((ARAddr*)&val_last)->GCAddress();
|
||||
const u8 size = ((ARAddr*)&val_last)->size;
|
||||
|
@ -750,7 +750,7 @@ bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr addr, const u32 data
|
|||
}
|
||||
|
||||
// Looks like this is new?? - untested
|
||||
bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data)
|
||||
bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr& addr, const u32 data)
|
||||
{
|
||||
const u32 addr_dest = val_last | 0x06000000;
|
||||
const u32 addr_src = addr.GCAddress();
|
||||
|
@ -796,7 +796,7 @@ bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool NormalCode(const ARAddr addr, const u32 data)
|
||||
bool NormalCode(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
switch (addr.subtype)
|
||||
{
|
||||
|
@ -834,7 +834,7 @@ bool NormalCode(const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ConditionalCode(const ARAddr addr, const u32 data, int* const pSkipCount)
|
||||
bool ConditionalCode(const ARAddr& addr, const u32 data, int* const pSkipCount)
|
||||
{
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
|
||||
|
|
|
@ -392,7 +392,6 @@ bool CBoot::EmulatedBS2_Wii()
|
|||
Memory::Write_U32(firmwareVer ? firmwareVer : 0x00090204, 0x00003140);
|
||||
|
||||
// Load patches and run startup patches
|
||||
std::string gameID = VolumeHandler::GetVolume()->GetUniqueID();
|
||||
PatchEngine::LoadPatches();
|
||||
|
||||
// return
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace BootManager
|
|||
struct ConfigCache
|
||||
{
|
||||
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread,
|
||||
bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2, bTLBHack, bUseFPS;
|
||||
bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2, bTLBHack;
|
||||
int iCPUCore, Volume;
|
||||
int iWiimoteSource[MAX_BBMOTES];
|
||||
SIDevices Pads[MAX_SI_CHANNELS];
|
||||
|
|
|
@ -134,6 +134,7 @@ static void DSPCore_FreeMemoryPages()
|
|||
FreeMemoryPages(g_dsp.iram, DSP_IRAM_BYTE_SIZE);
|
||||
FreeMemoryPages(g_dsp.dram, DSP_DRAM_BYTE_SIZE);
|
||||
FreeMemoryPages(g_dsp.coef, DSP_COEF_BYTE_SIZE);
|
||||
g_dsp.irom = g_dsp.iram = g_dsp.dram = g_dsp.coef = NULL;
|
||||
}
|
||||
|
||||
bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
|
||||
|
|
|
@ -35,12 +35,18 @@ static void *reg_ptr(int reg)
|
|||
case DSP_REG_ACH0:
|
||||
case DSP_REG_ACH1:
|
||||
return &g_dsp.r.ac[reg - DSP_REG_ACH0].h;
|
||||
case DSP_REG_CR: return &g_dsp.r.cr;
|
||||
case DSP_REG_SR: return &g_dsp.r.sr;
|
||||
case DSP_REG_PRODL: return &g_dsp.r.prod.l;
|
||||
case DSP_REG_PRODM: return &g_dsp.r.prod.m;
|
||||
case DSP_REG_PRODH: return &g_dsp.r.prod.h;
|
||||
case DSP_REG_PRODM2: return &g_dsp.r.prod.m2;
|
||||
case DSP_REG_CR:
|
||||
return &g_dsp.r.cr;
|
||||
case DSP_REG_SR:
|
||||
return &g_dsp.r.sr;
|
||||
case DSP_REG_PRODL:
|
||||
return &g_dsp.r.prod.l;
|
||||
case DSP_REG_PRODM:
|
||||
return &g_dsp.r.prod.m;
|
||||
case DSP_REG_PRODH:
|
||||
return &g_dsp.r.prod.h;
|
||||
case DSP_REG_PRODM2:
|
||||
return &g_dsp.r.prod.m2;
|
||||
case DSP_REG_AXL0:
|
||||
case DSP_REG_AXL1:
|
||||
return &g_dsp.r.ax[reg - DSP_REG_AXL0].l;
|
||||
|
@ -81,24 +87,24 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
|||
xreg.pushed = false;
|
||||
}
|
||||
|
||||
xregs[RAX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV
|
||||
xregs[RDX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV
|
||||
xregs[RCX].guest_reg = DSP_REG_STATIC;// reserved for shifts
|
||||
xregs[RAX].guest_reg = DSP_REG_STATIC; // reserved for MUL/DIV
|
||||
xregs[RDX].guest_reg = DSP_REG_STATIC; // reserved for MUL/DIV
|
||||
xregs[RCX].guest_reg = DSP_REG_STATIC; // reserved for shifts
|
||||
|
||||
xregs[RBX].guest_reg = DSP_REG_STATIC;//extended op backing store
|
||||
xregs[RBX].guest_reg = DSP_REG_STATIC; // extended op backing store
|
||||
|
||||
xregs[RSP].guest_reg = DSP_REG_STATIC;//stack pointer
|
||||
xregs[RSP].guest_reg = DSP_REG_STATIC; // stack pointer
|
||||
|
||||
xregs[RBP].guest_reg = DSP_REG_NONE;//definitely usable in dsplle because
|
||||
//all external calls are protected
|
||||
xregs[RBP].guest_reg = DSP_REG_NONE; // definitely usable in dsplle because
|
||||
// all external calls are protected
|
||||
|
||||
xregs[RSI].guest_reg = DSP_REG_NONE;
|
||||
xregs[RDI].guest_reg = DSP_REG_NONE;
|
||||
|
||||
#ifdef _M_X64
|
||||
#ifdef STATIC_REG_ACCS
|
||||
xregs[R8].guest_reg = DSP_REG_STATIC;//acc0
|
||||
xregs[R9].guest_reg = DSP_REG_STATIC;//acc1
|
||||
xregs[R8].guest_reg = DSP_REG_STATIC; //acc0
|
||||
xregs[R9].guest_reg = DSP_REG_STATIC; //acc1
|
||||
#else
|
||||
xregs[R8].guest_reg = DSP_REG_NONE;
|
||||
xregs[R9].guest_reg = DSP_REG_NONE;
|
||||
|
@ -121,12 +127,13 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
|||
regs[i].parentReg = DSP_REG_NONE;
|
||||
regs[i].shift = 0;
|
||||
regs[i].host_reg = INVALID_REG;
|
||||
|
||||
regs[i].loc = M(regs[i].mem);
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < 32; i++)
|
||||
{
|
||||
regs[i].size = 2;
|
||||
}
|
||||
//special composite registers
|
||||
#ifdef _M_X64
|
||||
#ifdef STATIC_REG_ACCS
|
||||
|
@ -170,8 +177,8 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
|||
DSPJitRegCache::DSPJitRegCache(const DSPJitRegCache &cache)
|
||||
: emitter(cache.emitter), temporary(true), merged(false)
|
||||
{
|
||||
memcpy(xregs,cache.xregs,sizeof(xregs));
|
||||
memcpy(regs,cache.regs,sizeof(regs));
|
||||
memcpy(xregs, cache.xregs, sizeof(xregs));
|
||||
memcpy(regs, cache.regs, sizeof(regs));
|
||||
}
|
||||
|
||||
DSPJitRegCache& DSPJitRegCache::operator=(const DSPJitRegCache &cache)
|
||||
|
@ -179,8 +186,8 @@ DSPJitRegCache& DSPJitRegCache::operator=(const DSPJitRegCache &cache)
|
|||
_assert_msg_(DSPLLE, &emitter == &cache.emitter, "emitter does not match");
|
||||
_assert_msg_(DSPLLE, temporary, "register cache not temporary??");
|
||||
merged = false;
|
||||
memcpy(xregs,cache.xregs,sizeof(xregs));
|
||||
memcpy(regs,cache.regs,sizeof(regs));
|
||||
memcpy(xregs, cache.xregs, sizeof(xregs));
|
||||
memcpy(regs, cache.regs, sizeof(regs));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -199,18 +206,20 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
{
|
||||
cache.merged = true;
|
||||
|
||||
unsigned int 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++)
|
||||
{
|
||||
regs[i].used = false;//used is restored later
|
||||
regs[i].used = false; //used is restored later
|
||||
if (regs[i].loc.IsSimpleReg() &&
|
||||
!cache.regs[i].loc.IsSimpleReg())
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
//try to move guest regs in the wrong host reg to the correct one
|
||||
// try to move guest regs in the wrong host reg to the correct one
|
||||
int movcnt;
|
||||
do
|
||||
{
|
||||
|
@ -228,16 +237,18 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
}
|
||||
} 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++)
|
||||
{
|
||||
if (cache.regs[i].loc.GetSimpleReg() !=
|
||||
regs[i].loc.GetSimpleReg() &&
|
||||
regs[i].loc.IsSimpleReg())
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
//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++)
|
||||
{
|
||||
if (cache.regs[i].loc.IsSimpleReg())
|
||||
|
@ -255,43 +266,48 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
regs[i].last_use_ctr = cache.regs[i].last_use_ctr;
|
||||
}
|
||||
|
||||
//sync the freely used xregs
|
||||
// sync the freely used xregs
|
||||
if (!emit) {
|
||||
for(i = 0; i < NUMXREGS; i++) {
|
||||
for(i = 0; i < NUMXREGS; i++)
|
||||
{
|
||||
if (cache.xregs[i].guest_reg == DSP_REG_USED &&
|
||||
xregs[i].guest_reg == DSP_REG_NONE)
|
||||
{
|
||||
xregs[i].guest_reg = DSP_REG_USED;
|
||||
}
|
||||
if (cache.xregs[i].guest_reg == DSP_REG_NONE &&
|
||||
xregs[i].guest_reg == DSP_REG_USED)
|
||||
{
|
||||
xregs[i].guest_reg = DSP_REG_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//consistency checks
|
||||
// consistency checks
|
||||
for(i = 0; i < NUMXREGS; i++)
|
||||
{
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[i].guest_reg == cache.xregs[i].guest_reg,
|
||||
"cache and current xreg guest_reg mismatch for %d", i);
|
||||
"cache and current xreg guest_reg mismatch for %zi", i);
|
||||
}
|
||||
|
||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].loc.IsImm() == cache.regs[i].loc.IsImm(),
|
||||
"cache and current reg loc mismatch for %x", i);
|
||||
"cache and current reg loc mismatch for %zi", i);
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].loc.GetSimpleReg() == cache.regs[i].loc.GetSimpleReg(),
|
||||
"cache and current reg loc mismatch for %x", i);
|
||||
"cache and current reg loc mismatch for %zi", i);
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].dirty || !cache.regs[i].dirty,
|
||||
"cache and current reg dirty mismatch for %x", i);
|
||||
"cache and current reg dirty mismatch for %zi", i);
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].used == cache.regs[i].used,
|
||||
"cache and current reg used mismatch for %x", i);
|
||||
"cache and current reg used mismatch for %zi", i);
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].shift == cache.regs[i].shift,
|
||||
"cache and current reg shift mismatch for %x", i);
|
||||
"cache and current reg shift mismatch for %zi", i);
|
||||
}
|
||||
|
||||
use_ctr = cache.use_ctr;
|
||||
|
@ -299,9 +315,9 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
|
||||
void DSPJitRegCache::flushMemBackedRegs()
|
||||
{
|
||||
//also needs to undo any dynamic changes to static allocated regs
|
||||
//this should have the same effect as
|
||||
//merge(DSPJitRegCache(emitter));
|
||||
// also needs to undo any dynamic changes to static allocated regs
|
||||
// this should have the same effect as
|
||||
// merge(DSPJitRegCache(emitter));
|
||||
|
||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
|
@ -309,7 +325,9 @@ void DSPJitRegCache::flushMemBackedRegs()
|
|||
"register %x still in use", i);
|
||||
|
||||
if (regs[i].used)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
|
@ -330,8 +348,10 @@ void DSPJitRegCache::flushRegs()
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
|
@ -401,8 +421,10 @@ void DSPJitRegCache::loadRegs(bool emit)
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToHostReg(i,regs[i].host_reg, emit);
|
||||
}
|
||||
}
|
||||
|
||||
if (emit)
|
||||
{
|
||||
|
@ -421,8 +443,10 @@ void DSPJitRegCache::saveRegs()
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
|
@ -445,8 +469,10 @@ void DSPJitRegCache::pushRegs()
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
int push_count = 0;
|
||||
for(auto& xreg : xregs)
|
||||
|
@ -458,10 +484,14 @@ void DSPJitRegCache::pushRegs()
|
|||
//hardcoding alignment to 16 bytes
|
||||
#ifdef _M_X64
|
||||
if (push_count & 1)
|
||||
{
|
||||
emitter.SUB(64,R(RSP),Imm32(8));
|
||||
}
|
||||
#else
|
||||
if (push_count & 3)
|
||||
{
|
||||
emitter.SUB(32,R(ESP),Imm32(16 - 4 * (push_count & 3)));
|
||||
}
|
||||
#endif
|
||||
|
||||
for(unsigned int i = 0; i < NUMXREGS; i++)
|
||||
|
@ -506,8 +536,10 @@ void DSPJitRegCache::popRegs() {
|
|||
for(auto& xreg : xregs)
|
||||
{
|
||||
if (xreg.pushed)
|
||||
{
|
||||
push_count++;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = NUMXREGS-1; i >= 0; i--)
|
||||
{
|
||||
|
@ -522,17 +554,23 @@ void DSPJitRegCache::popRegs() {
|
|||
//hardcoding alignment to 16 bytes
|
||||
#ifdef _M_X64
|
||||
if (push_count & 1)
|
||||
{
|
||||
emitter.ADD(64,R(RSP),Imm32(8));
|
||||
}
|
||||
#else
|
||||
if (push_count & 3)
|
||||
{
|
||||
emitter.ADD(32,R(ESP),Imm32(16 - 4 * (push_count & 3)));
|
||||
}
|
||||
#endif
|
||||
|
||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToHostReg(i,regs[i].host_reg, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
X64Reg DSPJitRegCache::makeABICallSafe(X64Reg reg)
|
||||
|
@ -547,7 +585,9 @@ X64Reg DSPJitRegCache::makeABICallSafe(X64Reg reg)
|
|||
X64Reg safe = findSpillFreeXReg();
|
||||
_assert_msg_(DSPLLE, safe != INVALID_REG, "could not find register");
|
||||
if (safe == INVALID_REG)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
xregs[RBP].guest_reg = rbp_guest;
|
||||
#ifdef _M_X64
|
||||
emitter.MOV(64,R(safe),R(reg));
|
||||
|
@ -567,22 +607,29 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load)
|
|||
"moving to host reg in use guest reg %x!", reg);
|
||||
X64Reg old_reg = regs[reg].loc.GetSimpleReg();
|
||||
if (old_reg == host_reg)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (xregs[host_reg].guest_reg != DSP_REG_STATIC)
|
||||
{
|
||||
xregs[host_reg].guest_reg = reg;
|
||||
}
|
||||
|
||||
if (load)
|
||||
{
|
||||
switch(regs[reg].size)
|
||||
{
|
||||
case 2:
|
||||
emitter.MOV(16, R(host_reg), regs[reg].loc); break;
|
||||
emitter.MOV(16, R(host_reg), regs[reg].loc);
|
||||
break;
|
||||
case 4:
|
||||
emitter.MOV(32, R(host_reg), regs[reg].loc); break;
|
||||
emitter.MOV(32, R(host_reg), regs[reg].loc);
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.MOV(64, R(host_reg), regs[reg].loc); break;
|
||||
emitter.MOV(64, R(host_reg), regs[reg].loc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
_assert_msg_(DSPLLE, 0, "unsupported memory size");
|
||||
|
@ -593,7 +640,9 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load)
|
|||
regs[reg].loc = R(host_reg);
|
||||
if (old_reg != INVALID_REG &&
|
||||
xregs[old_reg].guest_reg != DSP_REG_STATIC)
|
||||
{
|
||||
xregs[old_reg].guest_reg = DSP_REG_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void DSPJitRegCache::movToHostReg(int reg, bool load)
|
||||
|
@ -606,16 +655,24 @@ void DSPJitRegCache::movToHostReg(int reg, bool load)
|
|||
"moving to host reg in use guest reg %x!", reg);
|
||||
|
||||
if (regs[reg].loc.IsSimpleReg())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
X64Reg tmp;
|
||||
if (regs[reg].host_reg != INVALID_REG)
|
||||
{
|
||||
tmp = regs[reg].host_reg;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = findSpillFreeXReg();
|
||||
}
|
||||
|
||||
if (tmp == INVALID_REG)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
movToHostReg(reg, tmp, load);
|
||||
}
|
||||
|
@ -636,17 +693,14 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit)
|
|||
switch(regs[reg].size)
|
||||
{
|
||||
case 2:
|
||||
emitter.ROR(16, regs[reg].loc,
|
||||
Imm8(shift - regs[reg].shift));
|
||||
emitter.ROR(16, regs[reg].loc, Imm8(shift - regs[reg].shift));
|
||||
break;
|
||||
case 4:
|
||||
emitter.ROR(32, regs[reg].loc,
|
||||
Imm8(shift - regs[reg].shift));
|
||||
emitter.ROR(32, regs[reg].loc, Imm8(shift - regs[reg].shift));
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.ROR(64, regs[reg].loc,
|
||||
Imm8(shift - regs[reg].shift));
|
||||
emitter.ROR(64, regs[reg].loc, Imm8(shift - regs[reg].shift));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -656,17 +710,14 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit)
|
|||
switch(regs[reg].size)
|
||||
{
|
||||
case 2:
|
||||
emitter.ROL(16, regs[reg].loc,
|
||||
Imm8(regs[reg].shift - shift));
|
||||
emitter.ROL(16, regs[reg].loc, Imm8(regs[reg].shift - shift));
|
||||
break;
|
||||
case 4:
|
||||
emitter.ROL(32, regs[reg].loc,
|
||||
Imm8(regs[reg].shift - shift));
|
||||
emitter.ROL(32, regs[reg].loc, Imm8(regs[reg].shift - shift));
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.ROL(64, regs[reg].loc,
|
||||
Imm8(regs[reg].shift - shift));
|
||||
emitter.ROL(64, regs[reg].loc, Imm8(regs[reg].shift - shift));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -684,11 +735,15 @@ void DSPJitRegCache::movToMemory(int reg)
|
|||
"moving to memory in use guest reg %x!", reg);
|
||||
|
||||
if (regs[reg].used)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
|
||||
if (!regs[reg].loc.IsSimpleReg() &&
|
||||
!regs[reg].loc.IsImm())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//but first, check for any needed rotations
|
||||
if (regs[reg].loc.IsSimpleReg())
|
||||
|
@ -710,12 +765,15 @@ void DSPJitRegCache::movToMemory(int reg)
|
|||
switch(regs[reg].size)
|
||||
{
|
||||
case 2:
|
||||
emitter.MOV(16, tmp, regs[reg].loc); break;
|
||||
emitter.MOV(16, tmp, regs[reg].loc);
|
||||
break;
|
||||
case 4:
|
||||
emitter.MOV(32, tmp, regs[reg].loc); break;
|
||||
emitter.MOV(32, tmp, regs[reg].loc);
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.MOV(64, tmp, regs[reg].loc); break;
|
||||
emitter.MOV(64, tmp, regs[reg].loc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
_assert_msg_(DSPLLE, 0, "unsupported memory size");
|
||||
|
@ -728,8 +786,10 @@ void DSPJitRegCache::movToMemory(int reg)
|
|||
{
|
||||
X64Reg hostreg = regs[reg].loc.GetSimpleReg();
|
||||
if (xregs[hostreg].guest_reg != DSP_REG_STATIC)
|
||||
{
|
||||
xregs[hostreg].guest_reg = DSP_REG_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
regs[reg].last_use_ctr = -1;
|
||||
regs[reg].loc = tmp;
|
||||
|
@ -759,7 +819,9 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load)
|
|||
"register %x already in use", real_reg);
|
||||
|
||||
if (regs[real_reg].used)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
// no nead to actually emit code for load or rotate if caller doesn't
|
||||
// use the contents, but see above for a reason to force the load
|
||||
movToHostReg(real_reg, load);
|
||||
|
@ -778,15 +840,13 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load)
|
|||
#ifdef _M_X64
|
||||
case DSP_REG_ACC0_64:
|
||||
case DSP_REG_ACC1_64:
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
//need to do this because interpreter only does 48 bits
|
||||
//(and putReg does the same)
|
||||
emitter.SHL(64, oparg, Imm8(64-40));//sign extend
|
||||
// need to do this because interpreter only does 48 bits
|
||||
// (and putReg does the same)
|
||||
emitter.SHL(64, oparg, Imm8(64-40)); // sign extend
|
||||
emitter.SAR(64, oparg, Imm8(64-40));
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -806,20 +866,19 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
|||
{
|
||||
case DSP_REG_ACH0:
|
||||
case DSP_REG_ACH1:
|
||||
{
|
||||
if (dirty)
|
||||
{
|
||||
//no need to extend to full 64bit here until interpreter
|
||||
//uses that
|
||||
// no need to extend to full 64bit here until interpreter
|
||||
// uses that
|
||||
if (oparg.IsSimpleReg())
|
||||
{
|
||||
//register is already shifted correctly
|
||||
//(if at all)
|
||||
// register is already shifted correctly
|
||||
// (if at all)
|
||||
|
||||
// sign extend from the bottom 8 bits.
|
||||
#ifndef _M_X64
|
||||
//cannot use movsx with SPL, BPL, SIL or DIL
|
||||
//on 32 bit
|
||||
// cannot use movsx with SPL, BPL, SIL or DIL
|
||||
// on 32 bit
|
||||
if (oparg.GetSimpleReg() == RSP ||
|
||||
oparg.GetSimpleReg() == RBP ||
|
||||
oparg.GetSimpleReg() == RSI ||
|
||||
|
@ -831,9 +890,7 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
emitter.MOVSX(16, 8,
|
||||
oparg.GetSimpleReg(),
|
||||
oparg);
|
||||
emitter.MOVSX(16, 8, oparg.GetSimpleReg(), oparg);
|
||||
}
|
||||
}
|
||||
else if (oparg.IsImm())
|
||||
|
@ -842,8 +899,8 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
|||
}
|
||||
else
|
||||
{
|
||||
//this works on the memory, so use reg instead
|
||||
//of real_reg, since it has the right loc
|
||||
// this works on the memory, so use reg instead
|
||||
// of real_reg, since it has the right loc
|
||||
X64Reg tmp;
|
||||
getFreeXReg(tmp);
|
||||
// sign extend from the bottom 8 bits.
|
||||
|
@ -852,18 +909,15 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
|||
putXReg(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case DSP_REG_ACC0_64:
|
||||
case DSP_REG_ACC1_64:
|
||||
{
|
||||
if (dirty)
|
||||
{
|
||||
emitter.SHL(64, oparg, Imm8(64-40));//sign extend
|
||||
emitter.SHL(64, oparg, Imm8(64-40)); // sign extend
|
||||
emitter.SAR(64, oparg, Imm8(64-40));
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -891,30 +945,46 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend
|
|||
switch(extend)
|
||||
{
|
||||
#ifdef _M_X64
|
||||
case SIGN: emitter.MOVSX(64, 16, host_dreg, reg); break;
|
||||
case ZERO: emitter.MOVZX(64, 16, host_dreg, reg); break;
|
||||
case SIGN:
|
||||
emitter.MOVSX(64, 16, host_dreg, reg);
|
||||
break;
|
||||
case ZERO:
|
||||
emitter.MOVZX(64, 16, host_dreg, reg);
|
||||
break;
|
||||
#else
|
||||
case SIGN: emitter.MOVSX(32, 16, host_dreg, reg); break;
|
||||
case ZERO: emitter.MOVZX(32, 16, host_dreg, reg); break;
|
||||
case SIGN:
|
||||
emitter.MOVSX(32, 16, host_dreg, reg);
|
||||
break;
|
||||
case ZERO:
|
||||
emitter.MOVZX(32, 16, host_dreg, reg);
|
||||
break;
|
||||
#endif
|
||||
case NONE: emitter.MOV(16, R(host_dreg), reg); break;
|
||||
case NONE:
|
||||
emitter.MOV(16, R(host_dreg), reg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
#ifdef _M_X64
|
||||
switch(extend)
|
||||
{
|
||||
case SIGN: emitter.MOVSX(64, 32, host_dreg, reg); break;
|
||||
case ZERO: emitter.MOVZX(64, 32, host_dreg, reg); break;
|
||||
case NONE: emitter.MOV(32, R(host_dreg), reg); break;
|
||||
case SIGN:
|
||||
emitter.MOVSX(64, 32, host_dreg, reg);
|
||||
break;
|
||||
case ZERO:
|
||||
emitter.MOVZX(64, 32, host_dreg, reg);
|
||||
break;
|
||||
case NONE:
|
||||
emitter.MOV(32, R(host_dreg), reg);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
emitter.MOV(32, R(host_dreg), reg); break;
|
||||
emitter.MOV(32, R(host_dreg), reg);
|
||||
#endif
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.MOV(64, R(host_dreg), reg); break;
|
||||
emitter.MOV(64, R(host_dreg), reg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -932,14 +1002,22 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg)
|
|||
{
|
||||
switch(regs[dreg].size)
|
||||
{
|
||||
case 2: emitter.MOV(16, reg, Imm16((u16) arg.offset)); break;
|
||||
case 4: emitter.MOV(32, reg, Imm32((u32) arg.offset)); break;
|
||||
case 2:
|
||||
emitter.MOV(16, reg, Imm16((u16) arg.offset));
|
||||
break;
|
||||
case 4:
|
||||
emitter.MOV(32, reg, Imm32((u32) arg.offset));
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
if ((u32) arg.offset == arg.offset)
|
||||
{
|
||||
emitter.MOV(64, reg, Imm32((u32) arg.offset));
|
||||
}
|
||||
else
|
||||
{
|
||||
emitter.MOV(64, reg, Imm64(arg.offset));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -951,10 +1029,16 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg)
|
|||
{
|
||||
switch(regs[dreg].size)
|
||||
{
|
||||
case 2: emitter.MOV(16, reg, arg); break;
|
||||
case 4: emitter.MOV(32, reg, arg); break;
|
||||
case 2:
|
||||
emitter.MOV(16, reg, arg);
|
||||
break;
|
||||
case 4:
|
||||
emitter.MOV(32, reg, arg);
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8: emitter.MOV(64, reg, arg); break;
|
||||
case 8:
|
||||
emitter.MOV(64, reg, arg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
_assert_msg_(DSPLLE, 0, "unsupported memory size");
|
||||
|
@ -976,18 +1060,15 @@ static X64Reg alloc_order[] = {
|
|||
|
||||
X64Reg DSPJitRegCache::spillXReg()
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int max_use_ctr_diff = 0;
|
||||
int max_use_ctr_diff = 0;
|
||||
X64Reg least_recent_use_reg = INVALID_REG;
|
||||
for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
for(size_t i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
{
|
||||
X64Reg reg = alloc_order[i];
|
||||
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED &&
|
||||
!regs[xregs[reg].guest_reg].used)
|
||||
{
|
||||
unsigned int use_ctr_diff = use_ctr -
|
||||
regs[xregs[reg].guest_reg].last_use_ctr;
|
||||
|
||||
int use_ctr_diff = use_ctr - regs[xregs[reg].guest_reg].last_use_ctr;
|
||||
if (use_ctr_diff >= max_use_ctr_diff)
|
||||
{
|
||||
max_use_ctr_diff = use_ctr_diff;
|
||||
|
@ -1003,7 +1084,7 @@ X64Reg DSPJitRegCache::spillXReg()
|
|||
}
|
||||
|
||||
//just choose one.
|
||||
for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
for(size_t i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
{
|
||||
X64Reg reg = alloc_order[i];
|
||||
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED &&
|
||||
|
@ -1051,7 +1132,9 @@ X64Reg DSPJitRegCache::findSpillFreeXReg()
|
|||
{
|
||||
X64Reg reg = findFreeXReg();
|
||||
if (reg == INVALID_REG)
|
||||
{
|
||||
reg = spillXReg();
|
||||
}
|
||||
return reg;
|
||||
}
|
||||
|
||||
|
@ -1061,7 +1144,9 @@ void DSPJitRegCache::getFreeXReg(X64Reg ®)
|
|||
|
||||
_assert_msg_(DSPLLE, reg != INVALID_REG, "could not find register");
|
||||
if (reg == INVALID_REG)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
xregs[reg].guest_reg = DSP_REG_USED;
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1159,9 @@ void DSPJitRegCache::getXReg(X64Reg reg)
|
|||
}
|
||||
|
||||
if (xregs[reg].guest_reg != DSP_REG_NONE)
|
||||
{
|
||||
spillXReg(reg);
|
||||
}
|
||||
_assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_NONE, "register already in use");
|
||||
xregs[reg].guest_reg = DSP_REG_USED;
|
||||
}
|
||||
|
|
|
@ -59,8 +59,10 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
|
|||
u32 cmdStart = 0;
|
||||
u32 nextMemUpdate = 0;
|
||||
|
||||
#if LOG_FIFO_CMDS
|
||||
// Debugging
|
||||
vector<CmdData> prevCmds;
|
||||
#endif
|
||||
|
||||
while (cmdStart < frame.fifoDataSize)
|
||||
{
|
||||
|
@ -75,7 +77,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
|
|||
|
||||
u32 cmdSize = DecodeCommand(&frame.fifoData[cmdStart]);
|
||||
|
||||
#if (LOG_FIFO_CMDS)
|
||||
#if LOG_FIFO_CMDS
|
||||
CmdData cmdData;
|
||||
cmdData.offset = cmdStart;
|
||||
cmdData.ptr = &frame.fifoData[cmdStart];
|
||||
|
@ -210,8 +212,10 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
|
|||
FifoAnalyzer::LoadBPReg(bp, m_BpMem);
|
||||
|
||||
if (bp.address == BPMEM_TRIGGER_EFB_COPY)
|
||||
{
|
||||
StoreEfbCopyRegion();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -256,10 +260,14 @@ void FifoPlaybackAnalyzer::StoreEfbCopyRegion()
|
|||
{
|
||||
format |= _GX_TF_ZTF;
|
||||
if (copyfmt == 11)
|
||||
{
|
||||
format = GX_TF_Z16;
|
||||
}
|
||||
else if (format < GX_TF_Z8 || format > GX_TF_Z24X8)
|
||||
{
|
||||
format |= _GX_TF_CTF;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (copyfmt > GX_TF_RGBA8 || (copyfmt < GX_TF_RGB565 && !peCopy.intensity_fmt))
|
||||
|
|
|
@ -280,8 +280,10 @@ void Init(bool hle)
|
|||
void Shutdown()
|
||||
{
|
||||
if (!g_ARAM.wii_mode)
|
||||
{
|
||||
FreeMemoryPages(g_ARAM.ptr, g_ARAM.size);
|
||||
g_ARAM.ptr = NULL;
|
||||
}
|
||||
|
||||
dsp_emulator->Shutdown();
|
||||
delete dsp_emulator;
|
||||
|
@ -563,7 +565,7 @@ void Do_ARAM_DMA()
|
|||
{
|
||||
while (g_arDMA.Cnt.count)
|
||||
{
|
||||
// These are logically seperated in code to show that a memory map has been set up
|
||||
// These are logically separated in code to show that a memory map has been set up
|
||||
// See below in the write section for more information
|
||||
if ((g_ARAM_Info.Hex & 0xf) == 3)
|
||||
{
|
||||
|
|
|
@ -657,7 +657,6 @@ ContinueWithBlock:
|
|||
switch (count) {
|
||||
case 0: _LeftBuffer[i] += (u64)unmixed_audio * ramp >> 29; break;
|
||||
case 1: _RightBuffer[i] += (u64)unmixed_audio * ramp >> 29; break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,11 +129,8 @@ CEXIIPL::~CEXIIPL()
|
|||
m_szBuffer[m_count] = 0x00;
|
||||
}
|
||||
|
||||
if (m_pIPL != NULL)
|
||||
{
|
||||
FreeMemoryPages(m_pIPL, ROM_SIZE);
|
||||
m_pIPL = NULL;
|
||||
}
|
||||
|
||||
// SRAM
|
||||
File::IOFile file(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM, "wb");
|
||||
|
|
|
@ -813,7 +813,6 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
|
|||
{
|
||||
File::IOFile gci(gcih);
|
||||
unsigned int offset;
|
||||
char tmp[0xD];
|
||||
std::string fileType;
|
||||
SplitPath(inputFile, NULL, NULL, &fileType);
|
||||
|
||||
|
@ -821,7 +820,8 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
|
|||
offset = GCI;
|
||||
else
|
||||
{
|
||||
gci.ReadBytes(tmp, 0xD);
|
||||
char tmp[0xD];
|
||||
gci.ReadBytes(tmp, sizeof(tmp));
|
||||
if (!strcasecmp(fileType.c_str(), ".gcs"))
|
||||
{
|
||||
if (!memcmp(tmp, "GCSAVE", 6)) // Header must be uppercase
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
|
@ -11,16 +12,16 @@ namespace WiimoteEmu
|
|||
// The id for nothing inserted
|
||||
static const u8 nothing_id[] = { 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e };
|
||||
// The id for a partially inserted extension (currently unused)
|
||||
//static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
|
||||
UNUSED static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
|
||||
|
||||
Attachment::Attachment( const char* const _name, WiimoteEmu::ExtensionReg& _reg )
|
||||
: name( _name ), reg( _reg )
|
||||
Attachment::Attachment(const char* const _name, WiimoteEmu::ExtensionReg& _reg)
|
||||
: name(_name), reg(_reg)
|
||||
{
|
||||
memset(id, 0, sizeof(id));
|
||||
memset(calibration, 0, sizeof(calibration));
|
||||
}
|
||||
|
||||
None::None( WiimoteEmu::ExtensionReg& _reg ) : Attachment( "None", _reg )
|
||||
None::None(WiimoteEmu::ExtensionReg& _reg) : Attachment("None", _reg)
|
||||
{
|
||||
// set up register
|
||||
memcpy(&id, nothing_id, sizeof(nothing_id));
|
||||
|
@ -34,14 +35,14 @@ std::string Attachment::GetName() const
|
|||
void Attachment::Reset()
|
||||
{
|
||||
// set up register
|
||||
memset( ®, 0, WIIMOTE_REG_EXT_SIZE );
|
||||
memcpy( ®.constant_id, id, sizeof(id) );
|
||||
memcpy( ®.calibration, calibration, sizeof(calibration) );
|
||||
memset(®, 0, WIIMOTE_REG_EXT_SIZE);
|
||||
memcpy(®.constant_id, id, sizeof(id));
|
||||
memcpy(®.calibration, calibration, sizeof(calibration));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ControllerEmu::Extension::GetState( u8* const data, const bool focus )
|
||||
void ControllerEmu::Extension::GetState(u8* const data, const bool focus)
|
||||
{
|
||||
((WiimoteEmu::Attachment*)attachments[active_extension].get())->GetState( data, focus );
|
||||
((WiimoteEmu::Attachment*)attachments[active_extension].get())->GetState(data, focus);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,6 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
|||
}
|
||||
|
||||
#ifdef WIIMOTE_SPEAKER_DUMP
|
||||
std::stringstream name;
|
||||
static int num = 0;
|
||||
|
||||
if (num == 0)
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
#include "Core/HW/WiimoteEmu/Attachment/Turntable.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
inline double round(double x) { return (x-floor(x))>0.5 ? ceil(x) : floor(x); } //because damn MSVSC doesen't comply to C99
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -649,13 +650,10 @@ void Wiimote::Update()
|
|||
u8 data[MAX_PAYLOAD];
|
||||
memset(data, 0, sizeof(data));
|
||||
|
||||
// figure out what data we need
|
||||
s8 rptf_size = MAX_PAYLOAD;
|
||||
|
||||
Movie::SetPolledDevice();
|
||||
|
||||
const ReportFeatures& rptf = reporting_mode_features[m_reporting_mode - WM_REPORT_CORE];
|
||||
rptf_size = rptf.size;
|
||||
s8 rptf_size = rptf.size;
|
||||
if (Movie::IsPlayingInput() && Movie::PlayWiimote(m_index, data, rptf, m_reg_ir.mode))
|
||||
{
|
||||
if (rptf.core)
|
||||
|
|
|
@ -331,7 +331,6 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
|
|||
(attrib.VendorID == 0x057e) &&
|
||||
(attrib.ProductID == 0x0306)))
|
||||
{
|
||||
int rc = 0;
|
||||
// max_cycles insures we are never stuck here due to bad coding...
|
||||
int max_cycles = 20;
|
||||
u8 buf[MAX_PAYLOAD] = {0};
|
||||
|
@ -343,16 +342,16 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
|
|||
u8 const disable_enc_pt1_report[MAX_PAYLOAD] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xf0, 0x01, 0x55};
|
||||
u8 const disable_enc_pt2_report[MAX_PAYLOAD] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xfb, 0x01, 0x00};
|
||||
|
||||
rc = CheckDeviceType_Write(dev_handle,
|
||||
CheckDeviceType_Write(dev_handle,
|
||||
disable_enc_pt1_report,
|
||||
sizeof(disable_enc_pt1_report),
|
||||
1);
|
||||
rc = CheckDeviceType_Write(dev_handle,
|
||||
CheckDeviceType_Write(dev_handle,
|
||||
disable_enc_pt2_report,
|
||||
sizeof(disable_enc_pt2_report),
|
||||
1);
|
||||
|
||||
rc = CheckDeviceType_Write(dev_handle,
|
||||
int rc = CheckDeviceType_Write(dev_handle,
|
||||
req_status_report,
|
||||
sizeof(req_status_report),
|
||||
1);
|
||||
|
@ -681,7 +680,6 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
|
|||
}
|
||||
|
||||
return result;
|
||||
break;
|
||||
}
|
||||
case MSBT_STACK_BLUESOLEIL:
|
||||
{
|
||||
|
@ -816,7 +814,9 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
|
|||
std::vector<WCHAR>(radio_addr, radio_addr + 6).data(), 6);
|
||||
|
||||
if (ERROR_SUCCESS != auth_result)
|
||||
{
|
||||
ERROR_LOG(WIIMOTE, "AttachWiimote: BluetoothAuthenticateDevice returned %08x", auth_result);
|
||||
}
|
||||
|
||||
DWORD pcServices = 16;
|
||||
GUID guids[16];
|
||||
|
@ -824,7 +824,9 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
|
|||
const DWORD srv_result = Bth_BluetoothEnumerateInstalledServices(hRadio, &btdi, &pcServices, guids);
|
||||
|
||||
if (ERROR_SUCCESS != srv_result)
|
||||
{
|
||||
ERROR_LOG(WIIMOTE, "AttachWiimote: BluetoothEnumerateInstalledServices returned %08x", srv_result);
|
||||
}
|
||||
#endif
|
||||
// Activate service
|
||||
const DWORD hr = Bth_BluetoothSetServiceState(hRadio, &btdi,
|
||||
|
@ -833,10 +835,14 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
|
|||
g_connect_times[btdi.Address.ullLong] = std::time(nullptr);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERROR_LOG(WIIMOTE, "AttachWiimote: BluetoothSetServiceState returned %08x", hr);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -851,8 +857,8 @@ bool ForgetWiimote(BLUETOOTH_DEVICE_INFO_STRUCT& btdi)
|
|||
auto const avoid_forget_seconds = 5.0;
|
||||
|
||||
auto pair_time = g_connect_times.find(btdi.Address.ullLong);
|
||||
if (pair_time == g_connect_times.end()
|
||||
|| std::difftime(time(nullptr), pair_time->second) >= avoid_forget_seconds)
|
||||
if (pair_time == g_connect_times.end() ||
|
||||
std::difftime(time(nullptr), pair_time->second) >= avoid_forget_seconds)
|
||||
{
|
||||
// Make Windows forget about device so it will re-find it if visible.
|
||||
// This is also required to detect a disconnect for some reason..
|
||||
|
|
|
@ -468,14 +468,12 @@ int CWII_IPC_HLE_Device_di::GetCmdDelay(u32 _CommandAddress)
|
|||
// More than ~1150K "bytes / sec" hangs NSMBWii on boot.
|
||||
// Less than ~800K "bytes / sec" hangs DKCR randomly (ok, probably not true)
|
||||
return SystemTimers::GetTicksPerSecond() / 975000 * Size;
|
||||
break;
|
||||
}
|
||||
|
||||
case DVDLowClearCoverInterrupt:
|
||||
// Less than ~1/155th of a second hangs Oregon Trail at "loading wheel".
|
||||
// More than ~1/140th of a second hangs Resident Evil Archives: Resident Evil Zero.
|
||||
return SystemTimers::GetTicksPerSecond() / 146;
|
||||
break;
|
||||
|
||||
// case DVDLowAudioBufferConfig:
|
||||
// case DVDLowInquiry:
|
||||
|
@ -489,6 +487,5 @@ int CWII_IPC_HLE_Device_di::GetCmdDelay(u32 _CommandAddress)
|
|||
// random numbers here!
|
||||
// More than ~1/2000th of a second hangs DKCR with DSP HLE, maybe.
|
||||
return SystemTimers::GetTicksPerSecond() / 15000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,6 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
BufferIn, BufferInSize, BufferOut, BufferOutSize);
|
||||
deviceCommandAddress = _CommandAddress;
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case IOCTL_HID_OPEN:
|
||||
{
|
||||
|
@ -210,7 +209,6 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
|
||||
// It's the async way!
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case IOCTL_HID_INTERRUPT_OUT:
|
||||
case IOCTL_HID_INTERRUPT_IN:
|
||||
|
@ -242,7 +240,6 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
|
||||
// It's the async way!
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case IOCTL_HID_SHUTDOWN:
|
||||
{
|
||||
|
|
|
@ -689,7 +689,6 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
|
|||
WiiSockMan &sm = WiiSockMan::getInstance();
|
||||
sm.doSock(fd, _CommandAddress, (NET_IOCTL)Command);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////
|
||||
// TODO: Tidy all below //
|
||||
|
|
|
@ -610,10 +610,8 @@ void NetPlayServer::unmapPortThread()
|
|||
// discovers the IGD
|
||||
bool NetPlayServer::initUPnP()
|
||||
{
|
||||
UPNPDev *devlist;
|
||||
std::vector<UPNPDev *> igds;
|
||||
int descXMLsize = 0, upnperror = 0;
|
||||
char *descXML;
|
||||
|
||||
// Don't init if already inited
|
||||
if (m_upnp_inited)
|
||||
|
@ -627,7 +625,7 @@ bool NetPlayServer::initUPnP()
|
|||
memset(&m_upnp_data, 0, sizeof(IGDdatas));
|
||||
|
||||
// Find all UPnP devices
|
||||
devlist = upnpDiscover(2000, NULL, NULL, 0, 0, &upnperror);
|
||||
UPNPDev *devlist = upnpDiscover(2000, NULL, NULL, 0, 0, &upnperror);
|
||||
if (!devlist)
|
||||
{
|
||||
WARN_LOG(NETPLAY, "An error occured trying to discover UPnP devices.");
|
||||
|
@ -647,7 +645,7 @@ bool NetPlayServer::initUPnP()
|
|||
|
||||
for (const UPNPDev* dev : igds)
|
||||
{
|
||||
descXML = (char *) miniwget(dev->descURL, &descXMLsize, 0);
|
||||
char* descXML = (char*) miniwget(dev->descURL, &descXMLsize, 0);
|
||||
if (descXML)
|
||||
{
|
||||
parserootdesc(descXML, descXMLsize, &m_upnp_data);
|
||||
|
|
|
@ -366,7 +366,7 @@ void Jit64::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]);
|
||||
strncat(regs, reg, 500);
|
||||
strncat(regs, reg, sizeof(regs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -375,7 +375,7 @@ void Jit64::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "f%02d: %016x ", i, riPS0(i));
|
||||
strncat(fregs, reg, 750);
|
||||
strncat(fregs, reg, sizeof(fregs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2111,7 +2111,7 @@ void Jit64::srawix(UGeckoInstruction inst)
|
|||
}
|
||||
else
|
||||
{
|
||||
Default(inst); return;
|
||||
Default(inst); return; // FIXME
|
||||
gpr.Lock(a, s);
|
||||
JitClearCA();
|
||||
gpr.BindToRegister(a, a == s, true);
|
||||
|
|
|
@ -463,7 +463,7 @@ void JitIL::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]);
|
||||
strncat(regs, reg, 500);
|
||||
strncat(regs, reg, sizeof(regs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -472,7 +472,7 @@ void JitIL::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "f%02d: %016x ", i, riPS0(i));
|
||||
strncat(fregs, reg, 750);
|
||||
strncat(fregs, reg, sizeof(fregs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ void JitArm::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]);
|
||||
strncat(regs, reg, 500);
|
||||
strncat(regs, reg, sizeof(regs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -237,7 +237,7 @@ void JitArm::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "f%02d: %016x ", i, riPS0(i));
|
||||
strncat(fregs, reg, 750);
|
||||
strncat(fregs, reg, sizeof(fregs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ void JitArm::subfic(UGeckoInstruction inst)
|
|||
{
|
||||
INSTRUCTION_START
|
||||
JITDISABLE(bJITIntegerOff)
|
||||
Default(inst); return;
|
||||
Default(inst); return; // FIXME
|
||||
int a = inst.RA, d = inst.RD;
|
||||
|
||||
int imm = inst.SIMM_16;
|
||||
|
@ -615,7 +615,7 @@ void JitArm::addex(UGeckoInstruction inst)
|
|||
INSTRUCTION_START
|
||||
JITDISABLE(bJITIntegerOff)
|
||||
u32 a = inst.RA, b = inst.RB, d = inst.RD;
|
||||
Default(inst); return;
|
||||
Default(inst); return; // FIXME
|
||||
ARMReg RA = gpr.R(a);
|
||||
ARMReg RB = gpr.R(b);
|
||||
ARMReg RD = gpr.R(d);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "Core/PowerPC/PPCTables.h"
|
||||
#include "Core/PowerPC/JitArmIL/JitIL.h"
|
||||
|
||||
|
||||
// FIXME
|
||||
#define NORMALBRANCH_START Default(inst); ibuild.EmitInterpreterBranch(); return;
|
||||
//#define NORMALBRANCH_START
|
||||
|
||||
|
|
|
@ -1296,7 +1296,7 @@ void IRBuilder::WriteToFile(u64 codeHash) {
|
|||
alwaysUseds.find(opcode) != alwaysUseds.end();
|
||||
|
||||
// Line number
|
||||
fprintf(file, "%4d", i);
|
||||
fprintf(file, "%4u", i);
|
||||
|
||||
if (!thisUsed) {
|
||||
fprintf(file, "%*c", 32, ' ');
|
||||
|
|
|
@ -77,7 +77,6 @@ namespace JitInterface
|
|||
PanicAlert("Unrecognizable cpu_core: %d", core);
|
||||
jit = NULL;
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
jit = static_cast<JitBase*>(ptr);
|
||||
|
|
|
@ -211,7 +211,7 @@ bool PPCSymbolDB::LoadMap(const char *filename)
|
|||
continue;
|
||||
|
||||
char temp[256];
|
||||
sscanf(line, "%s", temp);
|
||||
sscanf(line, "%255s", temp);
|
||||
|
||||
if (strcmp(temp, "UNUSED")==0) continue;
|
||||
if (strcmp(temp, ".text")==0) {started = true; continue;};
|
||||
|
@ -234,7 +234,7 @@ bool PPCSymbolDB::LoadMap(const char *filename)
|
|||
|
||||
u32 address, vaddress, size, unknown;
|
||||
char name[512];
|
||||
sscanf(line, "%08x %08x %08x %i %s", &address, &size, &vaddress, &unknown, name);
|
||||
sscanf(line, "%08x %08x %08x %i %511s", &address, &size, &vaddress, &unknown, name);
|
||||
|
||||
const char *namepos = strstr(line, name);
|
||||
if (namepos != 0) //would be odd if not :P
|
||||
|
|
|
@ -184,9 +184,10 @@ std::map<double, int> GetSavedStates()
|
|||
std::map<double, int> m;
|
||||
for (int i = 1; i <= (int)NUM_STATES; i++)
|
||||
{
|
||||
if (File::Exists(MakeStateFilename(i)))
|
||||
std::string filename = MakeStateFilename(i);
|
||||
if (File::Exists(filename))
|
||||
{
|
||||
if (ReadHeader(MakeStateFilename(i), header))
|
||||
if (ReadHeader(filename, header))
|
||||
{
|
||||
double d = Common::Timer::GetDoubleTime() - header.time;
|
||||
// increase time until unique value is obtained
|
||||
|
@ -340,7 +341,7 @@ void SaveAs(const std::string& filename, bool wait)
|
|||
Core::PauseAndLock(false, wasUnpaused);
|
||||
}
|
||||
|
||||
bool ReadHeader(const std::string filename, StateHeader& header)
|
||||
bool ReadHeader(const std::string& filename, StateHeader& header)
|
||||
{
|
||||
Flush();
|
||||
File::IOFile f(filename, "rb");
|
||||
|
|
|
@ -29,7 +29,7 @@ void Shutdown();
|
|||
|
||||
void EnableCompression(bool compression);
|
||||
|
||||
bool ReadHeader(const std::string filename, StateHeader& header);
|
||||
bool ReadHeader(const std::string& filename, StateHeader& header);
|
||||
|
||||
// These don't happen instantly - they get scheduled as events.
|
||||
// ...But only if we're not in the main cpu thread.
|
||||
|
|
|
@ -89,9 +89,7 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
|
|||
return (DWORD)EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
//Where in the x86 code are we?
|
||||
PVOID codeAddr = pPtrs->ExceptionRecord->ExceptionAddress;
|
||||
unsigned char *codePtr = (unsigned char*)codeAddr;
|
||||
// virtual address of the inaccessible data
|
||||
u64 badAddress = (u64)pPtrs->ExceptionRecord->ExceptionInformation[1];
|
||||
CONTEXT *ctx = pPtrs->ContextRecord;
|
||||
|
||||
|
@ -104,7 +102,6 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
|
|||
// Let's not prevent debugging.
|
||||
return (DWORD)EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
|
|
|
@ -374,9 +374,9 @@ void CNANDContentLoader::RemoveTitle() const
|
|||
// remove tmd?
|
||||
for (u32 i = 0; i < m_numEntries; i++)
|
||||
{
|
||||
char szFilename[1024];
|
||||
if (!(m_Content[i].m_Type & 0x8000)) // skip shared apps
|
||||
{
|
||||
char szFilename[1024];
|
||||
sprintf(szFilename, "%s%08x.app", Common::GetTitleContentPath(m_TitleID).c_str(), m_Content[i].m_ContentID);
|
||||
INFO_LOG(DISCIO, "Delete %s", szFilename);
|
||||
File::Delete(szFilename);
|
||||
|
|
|
@ -114,8 +114,7 @@ namespace ButtonManager
|
|||
}
|
||||
bool GetButtonPressed(int padID, ButtonType button)
|
||||
{
|
||||
bool pressed = false;
|
||||
pressed = m_buttons[std::make_pair(padID, button)]->Pressed();
|
||||
bool pressed = m_buttons[std::make_pair(padID, button)]->Pressed();
|
||||
|
||||
for (const auto& ctrl : m_controllers)
|
||||
pressed |= ctrl.second->ButtonValue(padID, button);
|
||||
|
|
|
@ -228,10 +228,6 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
|
|||
dc.GetTextExtent(_T("W"),&w,&h);
|
||||
int fontSize = w;
|
||||
int textPlacement = 17 + 9 * fontSize;
|
||||
struct branch
|
||||
{
|
||||
int src, dst, srcAddr;
|
||||
};
|
||||
|
||||
// TODO: Add any drawing code here...
|
||||
int width = rc.width;
|
||||
|
|
|
@ -916,7 +916,6 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
|
|||
|
||||
void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
|
||||
{
|
||||
std::vector<const DiscIO::SFileInfo *> fst;
|
||||
DiscIO::IFileSystem *FS = NULL;
|
||||
wxString Path = wxDirSelector(_("Choose the folder to extract to"));
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, u32 width, u32 height
|
|||
|
||||
u8 *pdata = new u8[bytes];
|
||||
|
||||
memset(pdata,0,bytes);
|
||||
memcpy(pdata,hdr,sizeof(hdr));
|
||||
memset(pdata+sizeof(hdr),0,bytes-sizeof(hdr));
|
||||
|
||||
u8 *pixelData = pdata + sizeof(hdr);
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
|
|||
for(u32 i = 0; i < _numberOfFiles; i++)
|
||||
{
|
||||
FileHDR tmpFileHDR;
|
||||
std::string __name, __ext;
|
||||
std::string __name;
|
||||
memset(&tmpFileHDR, 0, FILE_HDR_SZ);
|
||||
|
||||
u32 _fileSize = 0;
|
||||
|
|
|
@ -657,11 +657,6 @@ PadMapDiag::PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiim
|
|||
for (auto& player : m_player_list)
|
||||
player_names.Add(player->name);
|
||||
|
||||
wxString wiimote_names[5];
|
||||
wiimote_names[0] = _("None");
|
||||
for (unsigned int i=1; i < 5; ++i)
|
||||
wiimote_names[i] = wxString(_("Wiimote ")) + (wxChar)(wxT('0')+i);
|
||||
|
||||
for (unsigned int i=0; i<4; ++i)
|
||||
{
|
||||
wxBoxSizer* const v_szr = new wxBoxSizer(wxVERTICAL);
|
||||
|
|
|
@ -138,7 +138,6 @@ KeyboardMouse::KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIREC
|
|||
|
||||
void GetMousePos(float* const x, float* const y)
|
||||
{
|
||||
unsigned int win_width = 2, win_height = 2;
|
||||
POINT point = { 1, 1 };
|
||||
GetCursorPos(&point);
|
||||
// Get the cursor position relative to the upper left corner of the rendering window
|
||||
|
@ -148,8 +147,8 @@ void GetMousePos(float* const x, float* const y)
|
|||
RECT rect;
|
||||
GetClientRect(hwnd, &rect);
|
||||
// Width and height is the size of the rendering window
|
||||
win_width = rect.right - rect.left;
|
||||
win_height = rect.bottom - rect.top;
|
||||
unsigned int win_width = rect.right - rect.left;
|
||||
unsigned int win_height = rect.bottom - rect.top;
|
||||
|
||||
// Return the mouse position as a range from -1 to 1
|
||||
*x = (float)point.x / (float)win_width * 2 - 1;
|
||||
|
|
|
@ -154,8 +154,6 @@ bool VideoBackend::Initialize(void *&window_handle)
|
|||
|
||||
frameCount = 0;
|
||||
|
||||
const SCoreStartupParameter& core_params = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini").c_str());
|
||||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
|
|
|
@ -272,6 +272,7 @@ public:
|
|||
glBindBuffer(m_buffertype, 0);
|
||||
glFinish(); // ogl pipeline must be flushed, else this buffer can be in use
|
||||
FreeAlignedMemory(m_pointer);
|
||||
m_pointer = NULL;
|
||||
}
|
||||
|
||||
std::pair<u8*, size_t> Map(size_t size, u32 stride) {
|
||||
|
|
|
@ -55,7 +55,7 @@ static u32 s_DepthCbufid;
|
|||
static u32 s_Textures[8];
|
||||
static u32 s_ActiveTexture;
|
||||
|
||||
bool SaveTexture(const std::string filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level)
|
||||
bool SaveTexture(const std::string& filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level)
|
||||
{
|
||||
if (GLInterface->GetMode() != GLInterfaceMode::MODE_OPENGL)
|
||||
return false;
|
||||
|
@ -121,7 +121,7 @@ void TextureCache::TCacheEntry::Bind(unsigned int stage)
|
|||
}
|
||||
}
|
||||
|
||||
bool TextureCache::TCacheEntry::Save(const std::string filename, unsigned int level)
|
||||
bool TextureCache::TCacheEntry::Save(const std::string& filename, unsigned int level)
|
||||
{
|
||||
return SaveTexture(filename, GL_TEXTURE_2D, texture, virtual_width, virtual_height, level);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ private:
|
|||
const float *colmat) override;
|
||||
|
||||
void Bind(unsigned int stage) override;
|
||||
bool Save(const std::string filename, unsigned int level);
|
||||
bool Save(const std::string& filename, unsigned int level);
|
||||
};
|
||||
|
||||
~TextureCache();
|
||||
|
@ -59,6 +59,6 @@ private:
|
|||
TCacheEntryBase* CreateRenderTargetTexture(unsigned int scaled_tex_w, unsigned int scaled_tex_h) override;
|
||||
};
|
||||
|
||||
bool SaveTexture(const std::string filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level);
|
||||
bool SaveTexture(const std::string& filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level);
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ void Init()
|
|||
}
|
||||
}
|
||||
|
||||
void SaveTexture(const std::string filename, u32 texmap, s32 mip)
|
||||
void SaveTexture(const std::string& filename, u32 texmap, s32 mip)
|
||||
{
|
||||
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
|
||||
u8 subTexmap = texmap & 3;
|
||||
|
@ -123,7 +123,7 @@ void DumpActiveTextures()
|
|||
}
|
||||
}
|
||||
|
||||
void DumpEfb(const std::string filename)
|
||||
void DumpEfb(const std::string& filename)
|
||||
{
|
||||
u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
|
||||
u8 *writePtr = data;
|
||||
|
@ -146,7 +146,7 @@ void DumpEfb(const std::string filename)
|
|||
delete[] data;
|
||||
}
|
||||
|
||||
void DumpDepth(const std::string filename)
|
||||
void DumpDepth(const std::string& filename)
|
||||
{
|
||||
u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
|
||||
u8 *writePtr = data;
|
||||
|
|
|
@ -32,7 +32,7 @@ static void LogFPSToFile(unsigned long val)
|
|||
s_bench_file.Open(File::GetUserPath(D_LOGS_IDX) + "fps.txt", "w");
|
||||
|
||||
char buffer[256];
|
||||
snprintf(buffer, 256, "%ld\n", val);
|
||||
snprintf(buffer, 256, "%lu\n", val);
|
||||
s_bench_file.WriteArray(buffer, strlen(buffer));
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ void Fifo_Shutdown()
|
|||
{
|
||||
if (GpuRunningState) PanicAlert("Fifo shutting down while active");
|
||||
FreeMemoryPages(videoBuffer, FIFO_SIZE);
|
||||
videoBuffer = NULL;
|
||||
}
|
||||
|
||||
u8* GetVideoBufferStartPtr()
|
||||
|
|
|
@ -26,7 +26,7 @@ Inputs:
|
|||
data : This is an array of RGBA with 8 bits per channel. 4 bytes for each pixel.
|
||||
row_stride: Determines the amount of bytes per row of pixels.
|
||||
*/
|
||||
bool TextureToPng(u8* data, int row_stride, const std::string filename, int width, int height, bool saveAlpha)
|
||||
bool TextureToPng(u8* data, int row_stride, const std::string& filename, int width, int height, bool saveAlpha)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
#include "Common/Common.h"
|
||||
|
||||
bool SaveData(const char* filename, const char* pdata);
|
||||
bool TextureToPng(u8* data, int row_stride, const std::string filename, int width, int height, bool saveAlpha = true);
|
||||
bool TextureToPng(u8* data, int row_stride, const std::string& filename, int width, int height, bool saveAlpha = true);
|
||||
|
|
|
@ -73,11 +73,8 @@ void TextureCache::Invalidate()
|
|||
TextureCache::~TextureCache()
|
||||
{
|
||||
Invalidate();
|
||||
if (temp)
|
||||
{
|
||||
FreeAlignedMemory(temp);
|
||||
temp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCache::OnConfigChanged(VideoConfig& config)
|
||||
|
@ -238,11 +235,11 @@ bool TextureCache::CheckForCustomTextureLODs(u64 tex_hash, int texformat, unsign
|
|||
|
||||
for (unsigned int level = 1; level < levels; ++level)
|
||||
{
|
||||
sprintf(texPathTemp, "%s_mip%i", texBasePathTemp, level);
|
||||
sprintf(texPathTemp, "%s_mip%u", texBasePathTemp, level);
|
||||
if (!HiresTextures::HiresTexExists(texPathTemp))
|
||||
{
|
||||
if (level > 1)
|
||||
WARN_LOG(VIDEO, "Couldn't find custom texture LOD with index %i (filename: %s), disabling custom LODs for this texture", level, texPathTemp);
|
||||
WARN_LOG(VIDEO, "Couldn't find custom texture LOD with index %u (filename: %s), disabling custom LODs for this texture", level, texPathTemp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -260,7 +257,7 @@ PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsign
|
|||
if (level == 0)
|
||||
sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat);
|
||||
else
|
||||
sprintf(texPathTemp, "%s_%08x_%i_mip%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat, level);
|
||||
sprintf(texPathTemp, "%s_%08x_%i_mip%u", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat, level);
|
||||
|
||||
unsigned int required_size = 0;
|
||||
PC_TexFormat ret = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, &required_size, texformat, temp_size, temp);
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
virtual ~TCacheEntryBase();
|
||||
|
||||
virtual void Bind(unsigned int stage) = 0;
|
||||
virtual bool Save(const std::string filename, unsigned int level) = 0;
|
||||
virtual bool Save(const std::string& filename, unsigned int level) = 0;
|
||||
|
||||
virtual void Load(unsigned int width, unsigned int height,
|
||||
unsigned int expanded_width, unsigned int level) = 0;
|
||||
|
|
|
@ -141,13 +141,13 @@ void WriteToBitDepth(char*& p, u8 depth, const char* src, const char* dest)
|
|||
WRITE(p, " %s = floor(%s * 255.0 / exp2(8.0 - %d.0));\n", dest, src, depth);
|
||||
}
|
||||
|
||||
void WriteEncoderEnd(char* p, API_TYPE ApiType)
|
||||
void WriteEncoderEnd(char*& p, API_TYPE ApiType)
|
||||
{
|
||||
WRITE(p, "}\n");
|
||||
IntensityConstantAdded = false;
|
||||
}
|
||||
|
||||
void WriteI8Encoder(char* p, API_TYPE ApiType)
|
||||
void WriteI8Encoder(char*& p, API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_I8, ApiType);
|
||||
WRITE(p, " float3 texSample;\n");
|
||||
|
@ -169,7 +169,7 @@ void WriteI8Encoder(char* p, API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteI4Encoder(char* p, API_TYPE ApiType)
|
||||
void WriteI4Encoder(char*& p, API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_I4, ApiType);
|
||||
WRITE(p, " float3 texSample;\n");
|
||||
|
@ -210,7 +210,7 @@ void WriteI4Encoder(char* p, API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteIA8Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteIA8Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_IA8, ApiType);
|
||||
WRITE(p, " float4 texSample;\n");
|
||||
|
@ -228,7 +228,7 @@ void WriteIA8Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteIA4Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteIA4Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_IA4, ApiType);
|
||||
WRITE(p, " float4 texSample;\n");
|
||||
|
@ -260,7 +260,7 @@ void WriteIA4Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteRGB565Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteRGB565Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_RGB565, ApiType);
|
||||
|
||||
|
@ -283,7 +283,7 @@ void WriteRGB565Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteRGB5A3Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_RGB5A3, ApiType);
|
||||
|
||||
|
@ -349,7 +349,7 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteRGBA4443Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteRGBA4443Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_RGB5A3, ApiType);
|
||||
|
||||
|
@ -373,7 +373,7 @@ void WriteRGBA4443Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteRGBA8Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteRGBA8Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_RGBA8, ApiType);
|
||||
|
||||
|
@ -398,7 +398,7 @@ void WriteRGBA8Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteC4Encoder(char* p, const char* comp,API_TYPE ApiType)
|
||||
void WriteC4Encoder(char*& p, const char* comp,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_R4, ApiType);
|
||||
WRITE(p, " float4 color0;\n");
|
||||
|
@ -420,7 +420,7 @@ void WriteC4Encoder(char* p, const char* comp,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteC8Encoder(char* p, const char* comp,API_TYPE ApiType)
|
||||
void WriteC8Encoder(char*& p, const char* comp,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_R8, ApiType);
|
||||
|
||||
|
@ -432,7 +432,7 @@ void WriteC8Encoder(char* p, const char* comp,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteCC4Encoder(char* p, const char* comp,API_TYPE ApiType)
|
||||
void WriteCC4Encoder(char*& p, const char* comp,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_RA4, ApiType);
|
||||
WRITE(p, " float2 texSample;\n");
|
||||
|
@ -462,7 +462,7 @@ void WriteCC4Encoder(char* p, const char* comp,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteCC8Encoder(char* p, const char* comp, API_TYPE ApiType)
|
||||
void WriteCC8Encoder(char*& p, const char* comp, API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_RA8, ApiType);
|
||||
|
||||
|
@ -472,7 +472,7 @@ void WriteCC8Encoder(char* p, const char* comp, API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ8Encoder(char* p, const char* multiplier,API_TYPE ApiType)
|
||||
void WriteZ8Encoder(char*& p, const char* multiplier,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_Z8M, ApiType);
|
||||
|
||||
|
@ -493,7 +493,7 @@ void WriteZ8Encoder(char* p, const char* multiplier,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ16Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteZ16Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_Z16, ApiType);
|
||||
|
||||
|
@ -525,7 +525,7 @@ void WriteZ16Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ16LEncoder(char* p,API_TYPE ApiType)
|
||||
void WriteZ16LEncoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_Z16L, ApiType);
|
||||
|
||||
|
@ -561,7 +561,7 @@ void WriteZ16LEncoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ24Encoder(char* p, API_TYPE ApiType)
|
||||
void WriteZ24Encoder(char*& p, API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_Z24X8, ApiType);
|
||||
|
||||
|
|
Loading…
Reference in New Issue