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:
Tillmann Karras
2014-02-28 12:43:20 +01:00
parent 5f0a8008f4
commit 315a8ba1c0
63 changed files with 494 additions and 420 deletions
+3 -6
View File
@@ -15,22 +15,19 @@ soundtouch::SoundTouch soundTouch;
// //
bool OpenALStream::Start() bool OpenALStream::Start()
{ {
ALDeviceList *pDeviceList = NULL;
ALCcontext *pContext = NULL;
ALCdevice *pDevice = NULL;
bool bReturn = false; bool bReturn = false;
pDeviceList = new ALDeviceList(); ALDeviceList *pDeviceList = new ALDeviceList();
if ((pDeviceList) && (pDeviceList->GetNumDevices())) if ((pDeviceList) && (pDeviceList->GetNumDevices()))
{ {
char *defDevName = pDeviceList->GetDeviceName(pDeviceList->GetDefaultDevice()); char *defDevName = pDeviceList->GetDeviceName(pDeviceList->GetDefaultDevice());
WARN_LOG(AUDIO, "Found OpenAL device %s", defDevName); WARN_LOG(AUDIO, "Found OpenAL device %s", defDevName);
pDevice = alcOpenDevice(defDevName); ALCdevice *pDevice = alcOpenDevice(defDevName);
if (pDevice) if (pDevice)
{ {
pContext = alcCreateContext(pDevice, NULL); ALCcontext *pContext = alcCreateContext(pDevice, NULL);
if (pContext) if (pContext)
{ {
// Used to determine an appropriate period size (2x period = total buffer size) // Used to determine an appropriate period size (2x period = total buffer size)
+4 -11
View File
@@ -42,10 +42,6 @@
ALDeviceList::ALDeviceList() ALDeviceList::ALDeviceList()
{ {
ALDEVICEINFO ALDeviceInfo; 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 // DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support
vDeviceInfo.clear(); vDeviceInfo.clear();
@@ -57,11 +53,10 @@ ALDeviceList::ALDeviceList()
//if (LoadOAL10Library(NULL, &ALFunction) == TRUE) { //if (LoadOAL10Library(NULL, &ALFunction) == TRUE) {
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
{ {
devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER); const char *devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); const char *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
index = 0;
// go through device list (each device terminated with a single NULL, list terminated with double NULL) // 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) if (strcmp(defaultDeviceName, devices) == 0)
{ {
@@ -75,7 +70,7 @@ ALDeviceList::ALDeviceList()
{ {
alcMakeContextCurrent(context); alcMakeContextCurrent(context);
// if new actual device name isn't already in the list, then add it... // 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; bool bNewName = true;
for (s32 i = 0; i < GetNumDevices(); i++) for (s32 i = 0; i < GetNumDevices(); i++)
{ {
@@ -130,8 +125,6 @@ ALDeviceList::ALDeviceList()
} }
alcCloseDevice(device); alcCloseDevice(device);
} }
devices += strlen(devices) + 1;
index += 1;
} }
} }
//} //}
+1 -1
View File
@@ -735,8 +735,8 @@ public:
{ {
#ifndef __SYMBIAN32__ #ifndef __SYMBIAN32__
FreeMemoryPages(region, region_size); FreeMemoryPages(region, region_size);
#endif
region = NULL; region = NULL;
#endif
region_size = 0; region_size = 0;
} }
+1 -1
View File
@@ -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) for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
{ {
std::string drive = StringFromFormat(checklist[i].format, 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)); drives.push_back(std::move(drive));
} }
+8
View File
@@ -25,6 +25,14 @@ extern const char *netplay_dolphin_ver;
#define LOGGING 1 #define LOGGING 1
#endif #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 #define STACKALIGN
#if __cplusplus >= 201103 || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__) #if __cplusplus >= 201103 || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)
-2
View File
@@ -362,8 +362,6 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
{ {
STACKFRAME callStack; STACKFRAME callStack;
BOOL bResult; BOOL bResult;
TCHAR symInfo[BUFFERSIZE] = _T("?");
TCHAR srcInfo[BUFFERSIZE] = _T("?");
HANDLE hProcess = GetCurrentProcess(); HANDLE hProcess = GetCurrentProcess();
// 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
+3 -3
View File
@@ -20,11 +20,11 @@ namespace FPURoundMode
PREC_53 = 1, PREC_53 = 1,
PREC_64 = 2 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: * There are two different flavors of float to int conversion:
+3 -3
View File
@@ -21,13 +21,13 @@
// Generic, do nothing // Generic, do nothing
namespace FPURoundMode 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() void SaveSIMDState()
+1 -2
View File
@@ -124,13 +124,12 @@ bool IniFile::Section::Get(const std::string& key, std::vector<std::string>& out
} }
// ignore starting , if any // ignore starting , if any
size_t subStart = temp.find_first_not_of(","); size_t subStart = temp.find_first_not_of(",");
size_t subEnd;
// split by , // split by ,
while (subStart != std::string::npos) while (subStart != std::string::npos)
{ {
// Find next , // Find next ,
subEnd = temp.find_first_of(",", subStart); size_t subEnd = temp.find_first_of(",", subStart);
if (subStart != subEnd) if (subStart != subEnd)
// take from first char until next , // take from first char until next ,
out.push_back(StripSpaces(temp.substr(subStart, subEnd - subStart))); out.push_back(StripSpaces(temp.substr(subStart, subEnd - subStart)));
+1 -1
View File
@@ -36,7 +36,7 @@ int AshmemCreateFileMapping(const char *name, size_t size)
return fd; return fd;
// We don't really care if we can't set the name, it is optional // 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); ret = ioctl(fd, ASHMEM_SET_SIZE, size);
if (ret < 0) if (ret < 0)
+2 -3
View File
@@ -129,11 +129,10 @@ void FreeMemoryPages(void* ptr, size_t size)
if (ptr) if (ptr)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (!VirtualFree(ptr, 0, MEM_RELEASE)) if (!VirtualFree(ptr, 0, MEM_RELEASE))
{
PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg()); PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg());
ptr = NULL; // Is this our responsibility? }
#else #else
munmap(ptr, size); munmap(ptr, size);
#endif #endif
+3 -3
View File
@@ -18,7 +18,7 @@ namespace FPURoundMode
static u32 saved_sse_state = _mm_getcsr(); static u32 saved_sse_state = _mm_getcsr();
static const u32 default_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 // Set FPU rounding mode to mimic the PowerPC's
#ifdef _M_IX86 #ifdef _M_IX86
@@ -49,7 +49,7 @@ namespace FPURoundMode
#endif #endif
} }
void SetPrecisionMode(enum PrecisionModes mode) void SetPrecisionMode(PrecisionModes mode)
{ {
#ifdef _M_IX86 #ifdef _M_IX86
// sets the floating-point lib to 53-bit // sets the floating-point lib to 53-bit
@@ -75,7 +75,7 @@ namespace FPURoundMode
#endif #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) // OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register)
const u32 EXCEPTION_MASK = 0x1F80; const u32 EXCEPTION_MASK = 0x1F80;
+53 -43
View File
@@ -145,51 +145,56 @@ const u32 table7[0x40] = {
void generateseeds(u32 *seeds, const u8 *seedtable, u8 doreverse) void generateseeds(u32 *seeds, const u8 *seedtable, u8 doreverse)
{ {
int i,j;
u32 tmp3; u32 tmp3;
u8 array0[0x38],array1[0x38],array2[0x08]; u8 array0[0x38],array1[0x38],array2[0x08];
u8 tmp,tmp2; u8 tmp,tmp2;
i = 0; for (int i = 0; i < 0x38; ++i)
while (i < 0x38)
{ {
tmp = (gentable0[i] - 1); 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; for (int i = 0; i < 0x10; ++i)
while (i < 0x10)
{ {
memset(array2,0,8); memset(array2,0,8);
tmp2 = gentable2[i]; tmp2 = gentable2[i];
for (j = 0; j < 0x38; j++) for (int j = 0; j < 0x38; j++)
{ {
tmp = (tmp2+j); tmp = (tmp2+j);
if (j > 0x1B) 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]; 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)); tmp = (((j*0x2AAB)>>16) - (j>>0x1F));
array2[tmp] |= (gentable1[j-(tmp*6)]>>2); array2[tmp] |= (gentable1[j-(tmp*6)]>>2);
} }
seeds[i<<1] = ((array2[0]<<24)|(array2[2]<<16)|(array2[4]<<8)|array2[6]); 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]); seeds[(i<<1)+1] = ((array2[1]<<24)|(array2[3]<<16)|(array2[5]<<8)|array2[7]);
i++;
} }
if (!doreverse) if (!doreverse)
{ {
j = 0x1F; int j = 0x1F;
for (i = 0; i < 16; i+=2) for (int i = 0; i < 16; i+=2)
{ {
tmp3 = seeds[i]; tmp3 = seeds[i];
seeds[i] = seeds[j-1]; seeds[i] = seeds[j-1];
@@ -223,19 +228,16 @@ void setcode(u32 *dst, u32 addr, u32 val)
u16 gencrc16(u32 *codes, u16 size) u16 gencrc16(u32 *codes, u16 size)
{ {
u16 ret = 0; u16 ret = 0;
u8 tmp=0,tmp2;
int i;
if (size > 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)); ret = ((crctable0[(tmp2>>4)&0x0F]^crctable1[tmp2&0x0F])^(ret>>8));
} }
tmp++;
} }
} }
return ret; return ret;
@@ -243,9 +245,7 @@ u16 gencrc16(u32 *codes, u16 size)
u8 verifycode(u32 *codes, u16 size) u8 verifycode(u32 *codes, u16 size)
{ {
u16 tmp; u16 tmp = gencrc16(codes,size);
tmp = gencrc16(codes,size);
return (((tmp>>12)^(tmp>>8)^(tmp>>4)^tmp)&0x0F); return (((tmp>>12)^(tmp>>8)^(tmp>>4)^tmp)&0x0F);
} }
@@ -338,7 +338,10 @@ bool getbitstring(u32 *ctrl, u32 *out, u8 len)
ctrl[1]++; ctrl[1]++;
tmp = (ctrl[0]+(ctrl[1]<<2)); 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)); *out = ((*out<<1) | ((tmp >> (0x1F-ctrl[2])) & 1));
ctrl[2]++; ctrl[2]++;
} }
@@ -372,13 +375,16 @@ bool batchdecrypt(u32 *codes, u16 size)
getbitstring(tmparray,tmparray2+5,2); // Region getbitstring(tmparray,tmparray2+5,2); // Region
// Grab gameid and region from the last decrypted code // 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]; //gameid = tmparray2[1];
//region = tmparray2[5]; //region = tmparray2[5];
tmp = codes[0]; tmp = codes[0];
codes[0] &= 0x0FFFFFFF; codes[0] &= 0x0FFFFFFF;
if ((tmp>>28) != verifycode(codes,size)) return false; if ((tmp>>28) != verifycode(codes,size))
{
return false;
}
return true; return true;
@@ -406,15 +412,16 @@ int GetVal(const char *flt, char chr)
int alphatobin(u32 *dst, std::vector<std::string> alpha, int size) int alphatobin(u32 *dst, std::vector<std::string> alpha, int size)
{ {
int i,j=0,k; int j = 0;
int ret=0,org=(size+1); int ret = 0;
int org = size + 1;
u32 bin[2]; u32 bin[2];
u8 parity; u8 parity;
while (size) for (; size; --size)
{ {
bin[0] = 0; bin[0] = 0;
for (i = 0; i < 6; i++) 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][i]) << (((5-i)*5)+2));
} }
@@ -422,7 +429,7 @@ int alphatobin(u32 *dst, std::vector<std::string> alpha, int size)
dst[j++] = bin[0]; dst[j++] = bin[0];
bin[1] = 0; bin[1] = 0;
for (i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
bin[1] |= (GetVal(filter,alpha[j>>1][i+6]) << (((5-i)*5)+4)); 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]; dst[j++] = bin[1];
//verify parity bit //verify parity bit
k=0; int k = 0;
parity = 0; parity = 0;
for (i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
{ {
if (i == 32) k++; if (i == 32)
{
k++;
}
parity ^= (bin[k] >> (i-(k<<5))); parity ^= (bin[k] >> (i-(k<<5)));
} }
if ((parity&1) != (GetVal(filter,alpha[(j-2)>>1][12])&1)) ret=(org-size); if ((parity&1) != (GetVal(filter,alpha[(j-2)>>1][12])&1))
{
size--; ret=(org-size);
}
} }
return ret; return ret;
@@ -451,12 +462,11 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
buildseeds(); buildseeds();
u32 uCodes[1200]; 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); std::transform(s.begin(), s.end(), s.begin(), toupper);
//PanicAlert("Encrypted AR Code\n%s", vCodes[i].c_str());
} }
if ((ret=alphatobin(uCodes, vCodes, (int)vCodes.size()))) 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" //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()); // "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; AREntry op;
op.cmd_addr = uCodes[i]; op.cmd_addr = uCodes[i];
@@ -482,7 +492,7 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
else else
{ {
// Skip passing the verification code back // 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; AREntry op;
op.cmd_addr = uCodes[i]; op.cmd_addr = uCodes[i];
+16 -16
View File
@@ -100,14 +100,14 @@ struct ARAddr
}; };
void LogInfo(const char *format, ...); void LogInfo(const char *format, ...);
bool Subtype_RamWriteAndFill(const ARAddr addr, const u32 data); bool Subtype_RamWriteAndFill(const ARAddr& addr, const u32 data);
bool Subtype_WriteToPointer(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_AddCode(const ARAddr& addr, const u32 data);
bool Subtype_MasterCodeAndWriteToCCXXXXXX(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_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 ZeroCode_MemoryCopy(const u32 val_last, const ARAddr& addr, const u32 data);
bool NormalCode(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 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);
// ---------------------- // ----------------------
@@ -487,7 +487,7 @@ bool IsSelfLogging()
// ---------------------- // ----------------------
// Code Functions // 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(); const u32 new_addr = addr.GCAddress();
@@ -544,7 +544,7 @@ bool Subtype_RamWriteAndFill(const ARAddr addr, const u32 data)
return true; 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 new_addr = addr.GCAddress();
const u32 ptr = Memory::Read_U32(new_addr); const u32 ptr = Memory::Read_U32(new_addr);
@@ -603,7 +603,7 @@ bool Subtype_WriteToPointer(const ARAddr addr, const u32 data)
return true; 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 // Used to increment/decrement a value in memory
const u32 new_addr = addr.GCAddress(); const u32 new_addr = addr.GCAddress();
@@ -663,7 +663,7 @@ bool Subtype_AddCode(const ARAddr addr, const u32 data)
return true; 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 // code not yet implemented - TODO
// u32 new_addr = (addr & 0x01FFFFFF) | 0x80000000; // u32 new_addr = (addr & 0x01FFFFFF) | 0x80000000;
@@ -675,7 +675,7 @@ bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr addr, const u32 data)
return false; 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 u32 new_addr = ((ARAddr*)&val_last)->GCAddress();
const u8 size = ((ARAddr*)&val_last)->size; 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 // 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_dest = val_last | 0x06000000;
const u32 addr_src = addr.GCAddress(); 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; return true;
} }
bool NormalCode(const ARAddr addr, const u32 data) bool NormalCode(const ARAddr& addr, const u32 data)
{ {
switch (addr.subtype) switch (addr.subtype)
{ {
@@ -834,7 +834,7 @@ bool NormalCode(const ARAddr addr, const u32 data)
return true; 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(); const u32 new_addr = addr.GCAddress();
-1
View File
@@ -392,7 +392,6 @@ bool CBoot::EmulatedBS2_Wii()
Memory::Write_U32(firmwareVer ? firmwareVer : 0x00090204, 0x00003140); Memory::Write_U32(firmwareVer ? firmwareVer : 0x00090204, 0x00003140);
// Load patches and run startup patches // Load patches and run startup patches
std::string gameID = VolumeHandler::GetVolume()->GetUniqueID();
PatchEngine::LoadPatches(); PatchEngine::LoadPatches();
// return // return
+1 -1
View File
@@ -48,7 +48,7 @@ namespace BootManager
struct ConfigCache struct ConfigCache
{ {
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread, 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 iCPUCore, Volume;
int iWiimoteSource[MAX_BBMOTES]; int iWiimoteSource[MAX_BBMOTES];
SIDevices Pads[MAX_SI_CHANNELS]; SIDevices Pads[MAX_SI_CHANNELS];
+1
View File
@@ -134,6 +134,7 @@ static void DSPCore_FreeMemoryPages()
FreeMemoryPages(g_dsp.iram, DSP_IRAM_BYTE_SIZE); FreeMemoryPages(g_dsp.iram, DSP_IRAM_BYTE_SIZE);
FreeMemoryPages(g_dsp.dram, DSP_DRAM_BYTE_SIZE); FreeMemoryPages(g_dsp.dram, DSP_DRAM_BYTE_SIZE);
FreeMemoryPages(g_dsp.coef, DSP_COEF_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, bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
File diff suppressed because it is too large Load Diff
@@ -59,8 +59,10 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
u32 cmdStart = 0; u32 cmdStart = 0;
u32 nextMemUpdate = 0; u32 nextMemUpdate = 0;
#if LOG_FIFO_CMDS
// Debugging // Debugging
vector<CmdData> prevCmds; vector<CmdData> prevCmds;
#endif
while (cmdStart < frame.fifoDataSize) while (cmdStart < frame.fifoDataSize)
{ {
@@ -75,7 +77,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
u32 cmdSize = DecodeCommand(&frame.fifoData[cmdStart]); u32 cmdSize = DecodeCommand(&frame.fifoData[cmdStart]);
#if (LOG_FIFO_CMDS) #if LOG_FIFO_CMDS
CmdData cmdData; CmdData cmdData;
cmdData.offset = cmdStart; cmdData.offset = cmdStart;
cmdData.ptr = &frame.fifoData[cmdStart]; cmdData.ptr = &frame.fifoData[cmdStart];
@@ -210,8 +212,10 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
FifoAnalyzer::LoadBPReg(bp, m_BpMem); FifoAnalyzer::LoadBPReg(bp, m_BpMem);
if (bp.address == BPMEM_TRIGGER_EFB_COPY) if (bp.address == BPMEM_TRIGGER_EFB_COPY)
{
StoreEfbCopyRegion(); StoreEfbCopyRegion();
} }
}
break; break;
default: default:
@@ -256,10 +260,14 @@ void FifoPlaybackAnalyzer::StoreEfbCopyRegion()
{ {
format |= _GX_TF_ZTF; format |= _GX_TF_ZTF;
if (copyfmt == 11) if (copyfmt == 11)
{
format = GX_TF_Z16; format = GX_TF_Z16;
}
else if (format < GX_TF_Z8 || format > GX_TF_Z24X8) else if (format < GX_TF_Z8 || format > GX_TF_Z24X8)
{
format |= _GX_TF_CTF; format |= _GX_TF_CTF;
} }
}
else else
{ {
if (copyfmt > GX_TF_RGBA8 || (copyfmt < GX_TF_RGB565 && !peCopy.intensity_fmt)) if (copyfmt > GX_TF_RGBA8 || (copyfmt < GX_TF_RGB565 && !peCopy.intensity_fmt))
+3 -1
View File
@@ -280,8 +280,10 @@ void Init(bool hle)
void Shutdown() void Shutdown()
{ {
if (!g_ARAM.wii_mode) if (!g_ARAM.wii_mode)
{
FreeMemoryPages(g_ARAM.ptr, g_ARAM.size); FreeMemoryPages(g_ARAM.ptr, g_ARAM.size);
g_ARAM.ptr = NULL; g_ARAM.ptr = NULL;
}
dsp_emulator->Shutdown(); dsp_emulator->Shutdown();
delete dsp_emulator; delete dsp_emulator;
@@ -563,7 +565,7 @@ void Do_ARAM_DMA()
{ {
while (g_arDMA.Cnt.count) 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 // See below in the write section for more information
if ((g_ARAM_Info.Hex & 0xf) == 3) if ((g_ARAM_Info.Hex & 0xf) == 3)
{ {

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