citra-emu
/
citra
Archived
1
0
Fork 0

Address clang-format issues.

This commit is contained in:
bunnei 2016-12-17 01:20:47 -05:00
parent 4fc8b8229e
commit 5ac5cbeab7
8 changed files with 49 additions and 49 deletions

View File

@ -126,13 +126,13 @@ int main(int argc, char** argv) {
Settings::values.use_gdbstub = use_gdbstub; Settings::values.use_gdbstub = use_gdbstub;
Settings::Apply(); Settings::Apply();
std::unique_ptr<EmuWindow_SDL2> emu_window{ std::make_unique<EmuWindow_SDL2>() }; std::unique_ptr<EmuWindow_SDL2> emu_window{std::make_unique<EmuWindow_SDL2>()};
Core::System& system{ Core::System::GetInstance() }; Core::System& system{Core::System::GetInstance()};
SCOPE_EXIT({ system.Shutdown(); }); SCOPE_EXIT({ system.Shutdown(); });
const Core::System::ResultStatus load_result{ system.Load(emu_window.get(), filepath) }; const Core::System::ResultStatus load_result{system.Load(emu_window.get(), filepath)};
switch (load_result) { switch (load_result) {
case Core::System::ResultStatus::ErrorGetLoader: case Core::System::ResultStatus::ErrorGetLoader:

View File

@ -283,49 +283,48 @@ bool GMainWindow::LoadROM(const std::string& filename) {
if (!gladLoadGL()) { if (!gladLoadGL()) {
QMessageBox::critical(this, tr("Error while starting Citra!"), QMessageBox::critical(this, tr("Error while starting Citra!"),
tr("Failed to initialize the video core!\n\n" tr("Failed to initialize the video core!\n\n"
"Please ensure that your GPU supports OpenGL 3.3 and that you " "Please ensure that your GPU supports OpenGL 3.3 and that you "
"have the latest graphics driver.")); "have the latest graphics driver."));
return false; return false;
} }
Core::System& system{ Core::System::GetInstance() }; Core::System& system{Core::System::GetInstance()};
const Core::System::ResultStatus result{ system.Load(render_window, filename) }; const Core::System::ResultStatus result{system.Load(render_window, filename)};
if (result != Core::System::ResultStatus::Success) { if (result != Core::System::ResultStatus::Success) {
switch (result) { switch (result) {
case Core::System::ResultStatus::ErrorGetLoader: case Core::System::ResultStatus::ErrorGetLoader:
LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filename.c_str()); LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filename.c_str());
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("The ROM format is not supported.")); tr("The ROM format is not supported."));
break; break;
case Core::System::ResultStatus::ErrorSystemMode: case Core::System::ResultStatus::ErrorSystemMode:
LOG_CRITICAL(Frontend, "Failed to load ROM!"); LOG_CRITICAL(Frontend, "Failed to load ROM!");
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("Could not determine the system mode.")); tr("Could not determine the system mode."));
break; break;
case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: {
{
// Build the MessageBox ourselves to have clickable link // Build the MessageBox ourselves to have clickable link
QMessageBox popup_error; QMessageBox popup_error;
popup_error.setTextFormat(Qt::RichText); popup_error.setTextFormat(Qt::RichText);
popup_error.setWindowTitle(tr("Error while loading ROM!")); popup_error.setWindowTitle(tr("Error while loading ROM!"));
popup_error.setText( popup_error.setText(
tr("The game that you are trying to load must be decrypted before being used with " tr("The game that you are trying to load must be decrypted before being used with "
"Citra.<br/><br/>" "Citra.<br/><br/>"
"For more information on dumping and decrypting games, please see: <a " "For more information on dumping and decrypting games, please see: <a "
"href='https://citra-emu.org/wiki/Dumping-Game-Cartridges'>https://" "href='https://citra-emu.org/wiki/Dumping-Game-Cartridges'>https://"
"citra-emu.org/wiki/Dumping-Game-Cartridges</a>")); "citra-emu.org/wiki/Dumping-Game-Cartridges</a>"));
popup_error.setIcon(QMessageBox::Critical); popup_error.setIcon(QMessageBox::Critical);
popup_error.exec(); popup_error.exec();
break; break;
} }
case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("The ROM format is not supported.")); tr("The ROM format is not supported."));
break; break;
default: default:

View File

@ -78,20 +78,20 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
return ResultStatus::ErrorGetLoader; return ResultStatus::ErrorGetLoader;
} }
boost::optional<u32> system_mode{ app_loader->LoadKernelSystemMode() }; boost::optional<u32> system_mode{app_loader->LoadKernelSystemMode()};
if (!system_mode) { if (!system_mode) {
LOG_CRITICAL(Core, "Failed to determine system mode!"); LOG_CRITICAL(Core, "Failed to determine system mode!");
return ResultStatus::ErrorSystemMode; return ResultStatus::ErrorSystemMode;
} }
ResultStatus init_result{ Init(emu_window, system_mode.get()) }; ResultStatus init_result{Init(emu_window, system_mode.get())};
if (init_result != ResultStatus::Success) { if (init_result != ResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to initialize system (Error %i)!", init_result); LOG_CRITICAL(Core, "Failed to initialize system (Error %i)!", init_result);
System::Shutdown(); System::Shutdown();
return init_result; return init_result;
} }
const Loader::ResultStatus load_result{ app_loader->Load() }; const Loader::ResultStatus load_result{app_loader->Load()};
if (Loader::ResultStatus::Success != load_result) { if (Loader::ResultStatus::Success != load_result) {
LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result); LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result);
System::Shutdown(); System::Shutdown();

View File

@ -42,23 +42,24 @@ public:
/// Enumeration representing the return values of the System Initialize and Load process. /// Enumeration representing the return values of the System Initialize and Load process.
enum class ResultStatus : u32 { enum class ResultStatus : u32 {
Success, ///< Succeeded Success, ///< Succeeded
ErrorNotInitialized, ///< Error trying to use core prior to initialization ErrorNotInitialized, ///< Error trying to use core prior to initialization
ErrorGetLoader, ///< Error finding the correct application loader ErrorGetLoader, ///< Error finding the correct application loader
ErrorSystemMode, ///< Error determining the system mode ErrorSystemMode, ///< Error determining the system mode
ErrorLoader, ///< Error loading the specified application ErrorLoader, ///< Error loading the specified application
ErrorLoader_ErrorEncrypted, ///< Error loading the specified application due to encryption ErrorLoader_ErrorEncrypted, ///< Error loading the specified application due to encryption
ErrorLoader_ErrorInvalidFormat, ///< Error loading the specified application due to an invalid format ErrorLoader_ErrorInvalidFormat, ///< Error loading the specified application due to an
ErrorVideoCore, ///< Error in the video core /// invalid format
ErrorVideoCore, ///< Error in the video core
}; };
/** /**
* Run the core CPU loop * Run the core CPU loop
* This function runs the core for the specified number of CPU instructions before trying to update * This function runs the core for the specified number of CPU instructions before trying to
* hardware. This is much faster than SingleStep (and should be equivalent), as the CPU is not * update hardware. This is much faster than SingleStep (and should be equivalent), as the CPU
* required to do a full dispatch with each instruction. NOTE: the number of instructions requested * is not required to do a full dispatch with each instruction. NOTE: the number of instructions
* is not guaranteed to run, as this will be interrupted preemptively if a hardware update is * requested is not guaranteed to run, as this will be interrupted preemptively if a hardware
* requested (e.g. on a thread switch). * update is requested (e.g. on a thread switch).
* @param tight_loop Number of instructions to execute. * @param tight_loop Number of instructions to execute.
* @return Result status, indicating whethor or not the operation succeeded. * @return Result status, indicating whethor or not the operation succeeded.
*/ */

View File

@ -141,11 +141,10 @@ std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path)
std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) { std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) {
if (shared) if (shared)
return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(), return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(), SYSTEM_ID);
SYSTEM_ID);
return Common::StringFromFormat("%sNintendo 3DS/%s/%s/extdata/", mount_point.c_str(), return Common::StringFromFormat("%sNintendo 3DS/%s/%s/extdata/", mount_point.c_str(), SYSTEM_ID,
SYSTEM_ID, SDCARD_ID); SDCARD_ID);
} }
Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) { Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {

View File

@ -30,12 +30,12 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "core/loader/loader.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/arm/arm_interface.h" #include "core/arm/arm_interface.h"
#include "core/core.h" #include "core/core.h"
#include "core/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
#include "core/loader/loader.h"
#include "core/memory.h" #include "core/memory.h"
const int GDB_BUFFER_SIZE = 10000; const int GDB_BUFFER_SIZE = 10000;
@ -629,7 +629,7 @@ static void WriteRegisters() {
i += 2; i += 2;
} else if (reg > CPSR_REGISTER && reg < FPSCR_REGISTER) { } else if (reg > CPSR_REGISTER && reg < FPSCR_REGISTER) {
Core::AppCore().SetVFPReg(reg - CPSR_REGISTER - 1, Core::AppCore().SetVFPReg(reg - CPSR_REGISTER - 1,
GdbHexToInt(buffer_ptr + i * CHAR_BIT)); GdbHexToInt(buffer_ptr + i * CHAR_BIT));
i++; // Skip padding i++; // Skip padding
} else if (reg == FPSCR_REGISTER) { } else if (reg == FPSCR_REGISTER) {
Core::AppCore().SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr + i * CHAR_BIT)); Core::AppCore().SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr + i * CHAR_BIT));

View File

@ -17,9 +17,9 @@ class FileBackend;
} }
/// The unique system identifier hash, also known as ID0 /// The unique system identifier hash, also known as ID0
static constexpr char SYSTEM_ID[]{ "00000000000000000000000000000000" }; static constexpr char SYSTEM_ID[]{"00000000000000000000000000000000"};
/// The scrambled SD card CID, also known as ID1 /// The scrambled SD card CID, also known as ID1
static constexpr char SDCARD_ID[]{ "00000000000000000000000000000000" }; static constexpr char SDCARD_ID[]{"00000000000000000000000000000000"};
namespace Service { namespace Service {
namespace FS { namespace FS {

View File

@ -166,7 +166,8 @@ static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 add
} }
/// Maps a memory block to specified address /// Maps a memory block to specified address
static ResultCode MapMemoryBlock(Kernel::Handle handle, u32 addr, u32 permissions, u32 other_permissions) { static ResultCode MapMemoryBlock(Kernel::Handle handle, u32 addr, u32 permissions,
u32 other_permissions) {
using Kernel::SharedMemory; using Kernel::SharedMemory;
using Kernel::MemoryPermission; using Kernel::MemoryPermission;
@ -295,8 +296,8 @@ static ResultCode WaitSynchronization1(Kernel::Handle handle, s64 nano_seconds)
} }
/// Wait for the given handles to synchronize, timeout after the specified nanoseconds /// Wait for the given handles to synchronize, timeout after the specified nanoseconds
static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 handle_count, bool wait_all, static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 handle_count,
s64 nano_seconds) { bool wait_all, s64 nano_seconds) {
Kernel::Thread* thread = Kernel::GetCurrentThread(); Kernel::Thread* thread = Kernel::GetCurrentThread();
// Check if 'handles' is invalid // Check if 'handles' is invalid
@ -507,8 +508,8 @@ static ResultCode GetResourceLimitCurrentValues(s64* values, Kernel::Handle reso
} }
/// Get resource limit max values /// Get resource limit max values
static ResultCode GetResourceLimitLimitValues(s64* values, Kernel::Handle resource_limit_handle, u32* names, static ResultCode GetResourceLimitLimitValues(s64* values, Kernel::Handle resource_limit_handle,
u32 name_count) { u32* names, u32 name_count) {
LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d",
resource_limit_handle, names, name_count); resource_limit_handle, names, name_count);
@ -860,8 +861,8 @@ static s64 GetSystemTick() {
} }
/// Creates a memory block at the specified address with the specified permissions and size /// Creates a memory block at the specified address with the specified permissions and size
static ResultCode CreateMemoryBlock(Kernel::Handle* out_handle, u32 addr, u32 size, u32 my_permission, static ResultCode CreateMemoryBlock(Kernel::Handle* out_handle, u32 addr, u32 size,
u32 other_permission) { u32 my_permission, u32 other_permission) {
using Kernel::SharedMemory; using Kernel::SharedMemory;
if (size % Memory::PAGE_SIZE != 0) if (size % Memory::PAGE_SIZE != 0)
@ -912,8 +913,8 @@ static ResultCode CreateMemoryBlock(Kernel::Handle* out_handle, u32 addr, u32 si
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client_port, const char* name, static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client_port,
u32 max_sessions) { const char* name, u32 max_sessions) {
// TODO(Subv): Implement named ports. // TODO(Subv): Implement named ports.
ASSERT_MSG(name == nullptr, "Named ports are currently unimplemented"); ASSERT_MSG(name == nullptr, "Named ports are currently unimplemented");