From 4f324ad74280540efc7fdc66a30d43594118938d Mon Sep 17 00:00:00 2001 From: Benjamin Przybocki Date: Sun, 21 Dec 2014 12:06:08 -0600 Subject: [PATCH] Clean Up --- Installer/Installer.nsi | 2 +- Source/Core/AudioCommon/Mixer.cpp | 10 ++++----- Source/Core/Core/DSPEmulator.cpp | 4 ---- Source/Core/Core/HW/CPU.cpp | 3 +-- Source/Core/Core/MemTools.cpp | 2 +- Source/Core/Core/NetPlayProto.h | 2 +- Source/Core/Core/PowerPC/PPCAnalyst.cpp | 2 +- Source/Core/Core/State.cpp | 3 ++- Source/Core/DiscIO/WbfsBlob.cpp | 23 +++++--------------- Source/Core/DolphinQt/MainWindow.cpp | 2 +- Source/Core/DolphinWX/AboutDolphin.cpp | 2 +- Source/Core/DolphinWX/FrameTools.cpp | 2 +- Source/Core/VideoBackends/D3D/Television.cpp | 2 +- docs/ActionReplay/GCNCodeTypes.txt | 2 +- 14 files changed, 23 insertions(+), 38 deletions(-) diff --git a/Installer/Installer.nsi b/Installer/Installer.nsi index 3543d149b5..fc4e6b5322 100644 --- a/Installer/Installer.nsi +++ b/Installer/Installer.nsi @@ -3,7 +3,7 @@ !define BASE_DIR "..\Binary\${DOLPHIN_ARCH}" ; HM NIS Edit Wizard helper defines -!define PRODUCT_PUBLISHER "Dolphin Development Team" +!define PRODUCT_PUBLISHER "Dolphin Team" !define PRODUCT_WEB_SITE "https://dolphin-emu.org/" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 60203b2f37..90f771d3fa 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -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); diff --git a/Source/Core/Core/DSPEmulator.cpp b/Source/Core/Core/DSPEmulator.cpp index a15f5be6e6..61f6e8e348 100644 --- a/Source/Core/Core/DSPEmulator.cpp +++ b/Source/Core/Core/DSPEmulator.cpp @@ -10,11 +10,7 @@ DSPEmulator *CreateDSPEmulator(bool HLE) { if (HLE) - { return new DSPHLE(); - } else - { return new DSPLLE(); - } } diff --git a/Source/Core/Core/HW/CPU.cpp b/Source/Core/Core/HW/CPU.cpp index 6164817194..2c810d8a15 100644 --- a/Source/Core/Core/HW/CPU.cpp +++ b/Source/Core/Core/HW/CPU.cpp @@ -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(); diff --git a/Source/Core/Core/MemTools.cpp b/Source/Core/Core/MemTools.cpp index 13029f245d..4c20ca2877 100644 --- a/Source/Core/Core/MemTools.cpp +++ b/Source/Core/Core/MemTools.cpp @@ -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 diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h index 01b4964350..255635810b 100644 --- a/Source/Core/Core/NetPlayProto.h +++ b/Source/Core/Core/NetPlayProto.h @@ -32,7 +32,7 @@ typedef std::vector NetWiimote; #define NETPLAY_VERSION "Dolphin NetPlay 2014-01-08" -const int NETPLAY_INITIAL_GCTIME = 1272737767; +static const int NETPLAY_INITIAL_GCTIME = 1272737767; // messages diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index 97b81f4118..84aba8ecbd 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -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))) diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index a63fafc2a5..23d5799437 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -176,7 +176,8 @@ static int GetEmptySlot(std::map m) break; } } - if (!found) return i; + if (!found) + return i; } return -1; } diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp index 08cb4ec078..7f0a625968 100644 --- a/Source/Core/DiscIO/WbfsBlob.cpp +++ b/Source/Core/DiscIO/WbfsBlob.cpp @@ -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)) { diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 75d7729eaa..90fa48abb1 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -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() diff --git a/Source/Core/DolphinWX/AboutDolphin.cpp b/Source/Core/DolphinWX/AboutDolphin.cpp index 19c6742bae..4ab29b068e 100644 --- a/Source/Core/DolphinWX/AboutDolphin.cpp +++ b/Source/Core/DolphinWX/AboutDolphin.cpp @@ -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" diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 08ddcb2e39..f49735d58d 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -1376,7 +1376,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; } } diff --git a/Source/Core/VideoBackends/D3D/Television.cpp b/Source/Core/VideoBackends/D3D/Television.cpp index ed54016ffd..cc805f1a16 100644 --- a/Source/Core/VideoBackends/D3D/Television.cpp +++ b/Source/Core/VideoBackends/D3D/Television.cpp @@ -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() diff --git a/docs/ActionReplay/GCNCodeTypes.txt b/docs/ActionReplay/GCNCodeTypes.txt index bc924e68b7..01095a3a53 100644 --- a/docs/ActionReplay/GCNCodeTypes.txt +++ b/docs/ActionReplay/GCNCodeTypes.txt @@ -29,7 +29,7 @@ NEWBIES OR WANNABES. Sorry. *************** If you are an experienced, known (by me or gscentral admins) code hacker, and you don't understand this document, you may try to ask help using the -www.gscentral.com forums +gscentral.com forums (or PM me there).