Merge pull request #1752 from Buddybenj/clean-up

Clean Up
This commit is contained in:
magumagu
2015-02-10 11:39:14 -08:00
14 changed files with 23 additions and 38 deletions

View File

@ -51,27 +51,27 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo
aid_sample_rate = aid_sample_rate * (framelimit - 1) * 5 / VideoInterface::TargetRefreshRate;
}
const u32 ratio = (u32)( 65536.0f * aid_sample_rate / (float)m_mixer->m_sampleRate );
const u32 ratio = (u32)(65536.0f * aid_sample_rate / (float)m_mixer->m_sampleRate);
s32 lvolume = m_LVolume;
s32 rvolume = m_RVolume;
// TODO: consider a higher-quality resampling algorithm.
for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2)
for (; currentSample < numSamples * 2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample += 2)
{
u32 indexR2 = indexR + 2; //next sample
s16 l1 = Common::swap16(m_buffer[indexR & INDEX_MASK]); //current
s16 l2 = Common::swap16(m_buffer[indexR2 & INDEX_MASK]); //next
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)m_frac) >> 16;
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)m_frac) >> 16;
sampleL = (sampleL * lvolume) >> 8;
sampleL += samples[currentSample + 1];
MathUtil::Clamp(&sampleL, -32767, 32767);
samples[currentSample+1] = sampleL;
samples[currentSample + 1] = sampleL;
s16 r1 = Common::swap16(m_buffer[(indexR + 1) & INDEX_MASK]); //current
s16 r2 = Common::swap16(m_buffer[(indexR2 + 1) & INDEX_MASK]); //next
int sampleR = ((r1 << 16) + (r2 - r1) * (u16)m_frac) >> 16;
int sampleR = ((r1 << 16) + (r2 - r1) * (u16)m_frac) >> 16;
sampleR = (sampleR * rvolume) >> 8;
sampleR += samples[currentSample];
MathUtil::Clamp(&sampleR, -32767, 32767);

View File

@ -10,11 +10,7 @@
DSPEmulator *CreateDSPEmulator(bool HLE)
{
if (HLE)
{
return new DSPHLE();
}
else
{
return new DSPLLE();
}
}

View File

@ -42,7 +42,6 @@ void CCPU::Run()
while (true)
{
reswitch:
switch (PowerPC::GetState())
{
case PowerPC::CPU_RUNNING:
@ -60,7 +59,7 @@ reswitch:
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
return;
if (PowerPC::GetState() != PowerPC::CPU_STEPPING)
goto reswitch;
continue;
//3: do a step
PowerPC::SingleStep();

View File

@ -136,7 +136,7 @@ static void ExceptionThread(mach_port_t port)
mach_msg_header_t *send_msg = nullptr;
mach_msg_size_t send_size = 0;
mach_msg_option_t option = MACH_RCV_MSG;
while (1)
while (true)
{
// If this isn't the first run, send the reply message. Then, receive
// a message: either a mach_exception_raise_state RPC due to

View File

@ -32,7 +32,7 @@ typedef std::vector<u8> NetWiimote;
#define NETPLAY_VERSION "Dolphin NetPlay 2014-01-08"
const int NETPLAY_INITIAL_GCTIME = 1272737767;
static const int NETPLAY_INITIAL_GCTIME = 1272737767;
// messages

View File

@ -313,7 +313,7 @@ static void FindFunctionsAfterBLR(PPCSymbolDB *func_db)
{
while (true)
{
// skip zeroes that sometimes pad function to 16 byte boundary (eg. Donkey Kong Country Returns)
// skip zeroes that sometimes pad function to 16 byte boundary (e.g. Donkey Kong Country Returns)
while (Memory::Read_Instruction(location) == 0 && ((location & 0xf) != 0))
location += 4;
if (PPCTables::IsValidInstruction(Memory::Read_Instruction(location)))

View File

@ -176,7 +176,8 @@ static int GetEmptySlot(std::map<double, int> m)
break;
}
}
if (!found) return i;
if (!found)
return i;
}
return -1;
}

View File

@ -40,10 +40,8 @@ WbfsFileReader::WbfsFileReader(const std::string& filename)
WbfsFileReader::~WbfsFileReader()
{
for (u32 i = 0; i != m_files.size(); ++ i)
{
delete m_files[i];
}
for (file_entry* entry : m_files)
delete entry;
delete[] m_wlba_table;
}
@ -58,7 +56,7 @@ bool WbfsFileReader::OpenFiles(const std::string& filename)
// Replace last character with index (e.g. wbfs = wbf1)
std::string path = filename;
if (0 != m_total_files)
if (m_total_files != 0)
{
path[path.length() - 1] = '0' + m_total_files;
}
@ -73,7 +71,7 @@ bool WbfsFileReader::OpenFiles(const std::string& filename)
new_entry->size = new_entry->file.GetSize();
m_size += new_entry->size;
m_total_files ++;
m_total_files++;
m_files.push_back(new_entry);
}
}
@ -90,10 +88,7 @@ bool WbfsFileReader::ReadHeader()
m_hd_sector_size = 1ull << m_hd_sector_shift;
if (m_size != (m_hd_sector_count * m_hd_sector_size))
{
//printf("File size doesn't match expected size\n");
return false;
}
// Read wbfs cluster info
m_files[0]->file.ReadBytes(&m_wbfs_sector_shift, 1);
@ -101,10 +96,7 @@ bool WbfsFileReader::ReadHeader()
m_wbfs_sector_count = m_size / m_wbfs_sector_size;
if (m_wbfs_sector_size < WII_SECTOR_SIZE)
{
//Setting this too low would case a very large memory allocation
return false;
}
m_blocks_per_disc = (WII_SECTOR_COUNT * WII_SECTOR_SIZE) / m_wbfs_sector_size;
m_disc_info_size = align(WII_DISC_HEADER_SIZE + m_blocks_per_disc * 2, m_hd_sector_size);
@ -113,11 +105,8 @@ bool WbfsFileReader::ReadHeader()
m_files[0]->file.Seek(2, SEEK_CUR);
m_files[0]->file.ReadBytes(m_disc_table, 500);
if (0 == m_disc_table[0])
{
//printf("Game must be in 'slot 0'\n");
if (m_disc_table[0] == 0)
return false;
}
return true;
}
@ -153,7 +142,7 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
u64 cluster_offset = offset & (m_wbfs_sector_size - 1);
u64 final_address = cluster_address + cluster_offset;
for (u32 i = 0; i != m_total_files; i ++)
for (u32 i = 0; i != m_total_files; i++)
{
if (final_address < (m_files[i]->base_address + m_files[i]->size))
{

View File

@ -284,7 +284,7 @@ void DMainWindow::OnOpenDocs()
void DMainWindow::OnOpenGitHub()
{
QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin/")));
QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin")));
}
void DMainWindow::OnOpenSystemInfo()

View File

@ -41,7 +41,7 @@ AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id,
"Today Dolphin is an open source project with many\n"
"contributors, too many to list.\n"
"If interested, just go check out the project page at\n"
"https://github.com/dolphin-emu/dolphin/ .\n"
"https://github.com/dolphin-emu/dolphin .\n"
"\n"
"Special thanks to Bushing, Costis, CrowTRobo,\n"
"Marcan, Segher, Titanik, or9 and Hotquik for their\n"

View File

@ -1415,7 +1415,7 @@ void CFrame::OnHelp(wxCommandEvent& event)
WxUtils::Launch("https://dolphin-emu.org/docs/guides/");
break;
case IDM_HELP_GITHUB:
WxUtils::Launch("https://github.com/dolphin-emu/dolphin/");
WxUtils::Launch("https://github.com/dolphin-emu/dolphin");
break;
}
}

View File

@ -136,7 +136,7 @@ void Television::Submit(u32 xfbAddr, u32 stride, u32 width, u32 height)
// Load data from GameCube RAM to YUYV texture
u8* yuyvSrc = Memory::GetPointer(xfbAddr);
D3D11_BOX box = CD3D11_BOX(0, 0, 0, stride, height, 1);
D3D::context->UpdateSubresource(m_yuyvTexture, 0, &box, yuyvSrc, 2*stride, 2*stride*height);
D3D::context->UpdateSubresource(m_yuyvTexture, 0, &box, yuyvSrc, 2 * stride, 2 * stride * height);
}
void Television::Render()