VERY experimental Nintendo Switch 2 emulator
C++
Remove tabs in all files except in skyeye imports and in generated GL code
Emmanuel Gil Peyrot739bb58c3a92
diff --git a/src/citra/emu_window/emu_window_glfw.h b/src/citra/emu_window/emu_window_glfw.hindex 61cef4e65c..5b04e87bb2 100644--- a/src/citra/emu_window/emu_window_glfw.h+++ b/src/citra/emu_window/emu_window_glfw.h@@ -16,8 +16,8 @@ public:/// Swap buffers to display the next framevoid SwapBuffers() override;- /// Polls window events- void PollEvents() override;+ /// Polls window events+ void PollEvents() override;/// Makes the graphics context current for the caller threadvoid MakeCurrent() override;diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cppindex 20623c9393..9bf079919b 100644--- a/src/citra_qt/bootmanager.cpp+++ b/src/citra_qt/bootmanager.cpp@@ -274,5 +274,5 @@ void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height)}void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) {- setMinimumSize(minimal_size.first, minimal_size.second);+ setMinimumSize(minimal_size.first, minimal_size.second);}diff --git a/src/citra_qt/config/controller_config_util.cpp b/src/citra_qt/config/controller_config_util.cppindex c5426570ba..aee3f8616a 100644--- a/src/citra_qt/config/controller_config_util.cpp+++ b/src/citra_qt/config/controller_config_util.cpp@@ -48,7 +48,7 @@ void GKeyConfigButton::OnActivePortChanged(const common::Config::ControllerPort&else if (config.keys.key_code[id] == Qt::Key_Control) text = tr("Control");else if (config.keys.key_code[id] == Qt::Key_Alt) text = tr("Alt");else if (config.keys.key_code[id] == Qt::Key_Meta) text = tr("Meta");- setText(text);+ setText(text);}void GKeyConfigButton::OnClicked()@@ -118,4 +118,4 @@ GButtonConfigGroup::GButtonConfigGroup(const QString& name, common::Config::ContsetLayout(layout);}-*/\ No newline at end of file+*/diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cppindex 96ceed4807..ed17ee4b4a 100644--- a/src/citra_qt/debugger/registers.cpp+++ b/src/citra_qt/debugger/registers.cpp@@ -46,18 +46,18 @@ void RegistersWidget::OnCPUStepped()CSPR->setText(1, QString("0x%1").arg(app_core->GetCPSR(), 8, 16, QLatin1Char('0')));CSPR->child(0)->setText(1, QString("b%1").arg(app_core->GetCPSR() & 0x1F, 5, 2, QLatin1Char('0'))); // M - Mode- CSPR->child(1)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 5) & 0x1)); // T - State- CSPR->child(2)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 6) & 0x1)); // F - FIQ disable- CSPR->child(3)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 7) & 0x1)); // I - IRQ disable- CSPR->child(4)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 8) & 0x1)); // A - Imprecise abort- CSPR->child(5)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 9) & 0x1)); // E - Data endianess- CSPR->child(6)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 10) & 0x3F)); // IT - If-Then state (DNM)- CSPR->child(7)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 16) & 0xF)); // GE - Greater-than-or-Equal- CSPR->child(8)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 20) & 0xF)); // DNM - Do not modify- CSPR->child(9)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 24) & 0x1)); // J - Java state- CSPR->child(10)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 27) & 0x1)); // Q - Sticky overflow- CSPR->child(11)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 28) & 0x1)); // V - Overflow- CSPR->child(12)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 29) & 0x1)); // C - Carry/Borrow/Extend- CSPR->child(13)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 30) & 0x1)); // Z - Zero- CSPR->child(14)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 31) & 0x1)); // N - Negative/Less than+ CSPR->child(1)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 5) & 0x1)); // T - State+ CSPR->child(2)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 6) & 0x1)); // F - FIQ disable+ CSPR->child(3)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 7) & 0x1)); // I - IRQ disable+ CSPR->child(4)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 8) & 0x1)); // A - Imprecise abort+ CSPR->child(5)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 9) & 0x1)); // E - Data endianess+ CSPR->child(6)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 10) & 0x3F)); // IT - If-Then state (DNM)+ CSPR->child(7)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 16) & 0xF)); // GE - Greater-than-or-Equal+ CSPR->child(8)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 20) & 0xF)); // DNM - Do not modify+ CSPR->child(9)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 24) & 0x1)); // J - Java state+ CSPR->child(10)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 27) & 0x1)); // Q - Sticky overflow+ CSPR->child(11)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 28) & 0x1)); // V - Overflow+ CSPR->child(12)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 29) & 0x1)); // C - Carry/Borrow/Extend+ CSPR->child(13)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 30) & 0x1)); // Z - Zero+ CSPR->child(14)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 31) & 0x1)); // N - Negative/Less than}diff --git a/src/citra_qt/debugger/registers.hxx b/src/citra_qt/debugger/registers.hxxindex b525aa49ef..4cca957ce4 100644--- a/src/citra_qt/debugger/registers.hxx+++ b/src/citra_qt/debugger/registers.hxx@@ -16,10 +16,10 @@ public slots:void OnCPUStepped();private:- Ui::ARMRegisters cpu_regs_ui;+ Ui::ARMRegisters cpu_regs_ui;- QTreeWidget* tree;+ QTreeWidget* tree;- QTreeWidgetItem* registers;- QTreeWidgetItem* CSPR;+ QTreeWidgetItem* registers;+ QTreeWidgetItem* CSPR;};diff --git a/src/common/common_types.h b/src/common/common_types.hindex 6d432e462b..fcc8b9a4e5 100644--- a/src/common/common_types.h+++ b/src/common/common_types.h@@ -45,8 +45,8 @@ typedef double f64; ///< 64-bit floating point/// Union for fast 16-bit type castingunion t16 {- u8 _u8[2]; ///< 8-bit unsigned char(s)- u16 _u16; ///< 16-bit unsigned shorts(s)+ u8 _u8[2]; ///< 8-bit unsigned char(s)+ u16 _u16; ///< 16-bit unsigned shorts(s)};/// Union for fast 32-bit type castingdiff --git a/src/common/file_util.h b/src/common/file_util.hindex 173ce66237..72b80be8a5 100644--- a/src/common/file_util.h+++ b/src/common/file_util.h@@ -16,33 +16,33 @@// User directory indices for GetUserPathenum {- D_USER_IDX,- D_ROOT_IDX,- D_CONFIG_IDX,- D_GAMECONFIG_IDX,- D_MAPS_IDX,- D_CACHE_IDX,- D_SHADERCACHE_IDX,- D_SHADERS_IDX,- D_STATESAVES_IDX,- D_SCREENSHOTS_IDX,- D_SDMC_IDX,- D_HIRESTEXTURES_IDX,- D_DUMP_IDX,- D_DUMPFRAMES_IDX,- D_DUMPAUDIO_IDX,- D_DUMPTEXTURES_IDX,- D_DUMPDSP_IDX,- D_LOGS_IDX,- D_SYSCONF_IDX,- F_EMUCONFIG_IDX,- F_DEBUGGERCONFIG_IDX,- F_LOGGERCONFIG_IDX,- F_MAINLOG_IDX,- F_RAMDUMP_IDX,- F_ARAMDUMP_IDX,- F_SYSCONF_IDX,- NUM_PATH_INDICES+ D_USER_IDX,+ D_ROOT_IDX,+ D_CONFIG_IDX,+ D_GAMECONFIG_IDX,+ D_MAPS_IDX,+ D_CACHE_IDX,+ D_SHADERCACHE_IDX,+ D_SHADERS_IDX,+ D_STATESAVES_IDX,+ D_SCREENSHOTS_IDX,+ D_SDMC_IDX,+ D_HIRESTEXTURES_IDX,+ D_DUMP_IDX,+ D_DUMPFRAMES_IDX,+ D_DUMPAUDIO_IDX,+ D_DUMPTEXTURES_IDX,+ D_DUMPDSP_IDX,+ D_LOGS_IDX,+ D_SYSCONF_IDX,+ F_EMUCONFIG_IDX,+ F_DEBUGGERCONFIG_IDX,+ F_LOGGERCONFIG_IDX,+ F_MAINLOG_IDX,+ F_RAMDUMP_IDX,+ F_ARAMDUMP_IDX,+ F_SYSCONF_IDX,+ NUM_PATH_INDICES};namespace FileUtil@@ -51,11 +51,11 @@ namespace FileUtil// FileSystem tree node/struct FSTEntry{- bool isDirectory;- u64 size; // file length or number of entries from children- std::string physicalName; // name on disk- std::string virtualName; // name in FST names table- std::vector<FSTEntry> children;+ bool isDirectory;+ u64 size; // file length or number of entries from children+ std::string physicalName; // name on disk+ std::string virtualName; // name in FST names table+ std::vector<FSTEntry> children;};// Returns true if file filename exists@@ -148,86 +148,86 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_namclass IOFile : public NonCopyable{public:- IOFile();- IOFile(std::FILE* file);- IOFile(const std::string& filename, const char openmode[]);+ IOFile();+ IOFile(std::FILE* file);+ IOFile(const std::string& filename, const char openmode[]);- ~IOFile();+ ~IOFile();- IOFile(IOFile&& other);- IOFile& operator=(IOFile&& other);+ IOFile(IOFile&& other);+ IOFile& operator=(IOFile&& other);- void Swap(IOFile& other);+ void Swap(IOFile& other);- bool Open(const std::string& filename, const char openmode[]);- bool Close();+ bool Open(const std::string& filename, const char openmode[]);+ bool Close();- template <typename T>- size_t ReadArray(T* data, size_t length)- {- if (!IsOpen()) {- m_good = false;- return -1;- }+ template <typename T>+ size_t ReadArray(T* data, size_t length)+ {+ if (!IsOpen()) {+ m_good = false;+ return -1;+ }- size_t items_read = std::fread(data, sizeof(T), length, m_file);- if (items_read != length)- m_good = false;+ size_t items_read = std::fread(data, sizeof(T), length, m_file);+ if (items_read != length)+ m_good = false;- return items_read;- }+ return items_read;+ }- template <typename T>- size_t WriteArray(const T* data, size_t length)- {- if (!IsOpen()) {- m_good = false;- return -1;- }+ template <typename T>+ size_t WriteArray(const T* data, size_t length)+ {+ if (!IsOpen()) {+ m_good = false;+ return -1;+ }- size_t items_written = std::fwrite(data, sizeof(T), length, m_file);- if (items_written != length)- m_good = false;+ size_t items_written = std::fwrite(data, sizeof(T), length, m_file);+ if (items_written != length)+ m_good = false;- return items_written;- }+ return items_written;+ }- size_t ReadBytes(void* data, size_t length)- {- return ReadArray(reinterpret_cast<char*>(data), length);- }+ size_t ReadBytes(void* data, size_t length)+ {+ return ReadArray(reinterpret_cast<char*>(data), length);+ }- size_t WriteBytes(const void* data, size_t length)- {- return WriteArray(reinterpret_cast<const char*>(data), length);- }+ size_t WriteBytes(const void* data, size_t length)+ {+ return WriteArray(reinterpret_cast<const char*>(data), length);+ }- bool IsOpen() { return NULL != m_file; }+ bool IsOpen() { return NULL != m_file; }- // m_good is set to false when a read, write or other function fails- bool IsGood() { return m_good; }- operator void*() { return m_good ? m_file : NULL; }+ // m_good is set to false when a read, write or other function fails+ bool IsGood() { return m_good; }+ operator void*() { return m_good ? m_file : NULL; }- std::FILE* ReleaseHandle();+ std::FILE* ReleaseHandle();- std::FILE* GetHandle() { return m_file; }+ std::FILE* GetHandle() { return m_file; }- void SetHandle(std::FILE* file);+ void SetHandle(std::FILE* file);- bool Seek(s64 off, int origin);- u64 Tell();- u64 GetSize();- bool Resize(u64 size);- bool Flush();+ bool Seek(s64 off, int origin);+ u64 Tell();+ u64 GetSize();+ bool Resize(u64 size);+ bool Flush();- // clear error state- void Clear() { m_good = true; std::clearerr(m_file); }+ // clear error state+ void Clear() { m_good = true; std::clearerr(m_file); }- std::FILE* m_file;- bool m_good;+ std::FILE* m_file;+ bool m_good;private:- IOFile(IOFile&);- IOFile& operator=(IOFile& other);+ IOFile(IOFile&);+ IOFile& operator=(IOFile& other);};} // namespace@@ -237,8 +237,8 @@ template <typename T>void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode){#ifdef _WIN32- fstream.open(Common::UTF8ToTStr(filename).c_str(), openmode);+ fstream.open(Common::UTF8ToTStr(filename).c_str(), openmode);#else- fstream.open(filename.c_str(), openmode);+ fstream.open(filename.c_str(), openmode);#endif}diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cppindex 31ca27b422..67dbaf509d 100644--- a/src/common/mem_arena.cpp+++ b/src/common/mem_arena.cpp@@ -38,7 +38,7 @@ void* globalbase = NULL;// Hopefully this ABI will never change...-#define ASHMEM_DEVICE "/dev/ashmem"+#define ASHMEM_DEVICE "/dev/ashmem"/** ashmem_create_region - creates a new ashmem region and returns the file@@ -273,10 +273,10 @@ u8* MemArena::Find4GBBase()// yeah, this could also be done in like two bitwise ops...#define SKIP(a_flags, b_flags)-// if (!(a_flags & MV_WII_ONLY) && (b_flags & MV_WII_ONLY))-// continue;-// if (!(a_flags & MV_FAKE_VMEM) && (b_flags & MV_FAKE_VMEM))-// continue;+//if (!(a_flags & MV_WII_ONLY) && (b_flags & MV_WII_ONLY))+// continue;+//if (!(a_flags & MV_FAKE_VMEM) && (b_flags & MV_FAKE_VMEM))+// continue;static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32 flags, MemArena *arena) {// OK, we know where to find free space. Now grab it!diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cppindex d6e9dc849e..558c6cbf74 100644--- a/src/core/core_timing.cpp+++ b/src/core/core_timing.cpp@@ -41,7 +41,7 @@ struct BaseEvents64 time;u64 userdata;int type;- // Event *next;+ // Event *next;};typedef LinkedListItem<BaseEvent> Event;@@ -469,8 +469,8 @@ void ProcessFifoWaitEvents(){if (first->time <= globalTimer){- // LOG(TIMER, "[Scheduler] %s (%lld, %lld) ",- // first->name ? first->name : "?", (u64)globalTimer, (u64)first->time);+ //LOG(TIMER, "[Scheduler] %s (%lld, %lld) ",+ // first->name ? first->name : "?", (u64)globalTimer, (u64)first->time);Event* evt = first;first = first->next;event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));@@ -516,23 +516,23 @@ void Advance()//currentMIPS->downcount = slicelength;//if (Common::AtomicLoadAcquire(hasTsEvents))- // MoveEvents();+ // MoveEvents();//ProcessFifoWaitEvents();//if (!first)//{- // // WARN_LOG(TIMER, "WARNING - no events in queue. Setting currentMIPS->downcount to 10000");- // currentMIPS->downcount += 10000;+ // // WARN_LOG(TIMER, "WARNING - no events in queue. Setting currentMIPS->downcount to 10000");+ // currentMIPS->downcount += 10000;//}//else//{- // slicelength = (int)(first->time - globalTimer);- // if (slicelength > MAX_SLICE_LENGTH)- // slicelength = MAX_SLICE_LENGTH;- // currentMIPS->downcount = slicelength;+ // slicelength = (int)(first->time - globalTimer);+ // if (slicelength > MAX_SLICE_LENGTH)+ // slicelength = MAX_SLICE_LENGTH;+ // currentMIPS->downcount = slicelength;//}//if (advanceCallback)- // advanceCallback(cyclesExecuted);+ // advanceCallback(cyclesExecuted);}void LogPendingEvents()@@ -550,20 +550,20 @@ void Idle(int maxIdle)ERROR_LOG(TIME, "Unimplemented function!");//int cyclesDown = currentMIPS->downcount;//if (maxIdle != 0 && cyclesDown > maxIdle)- // cyclesDown = maxIdle;+ // cyclesDown = maxIdle;//if (first && cyclesDown > 0)//{- // int cyclesExecuted = slicelength - currentMIPS->downcount;- // int cyclesNextEvent = (int) (first->time - globalTimer);-- // if (cyclesNextEvent < cyclesExecuted + cyclesDown)- // {- // cyclesDown = cyclesNextEvent - cyclesExecuted;- // // Now, now... no time machines, please.- // if (cyclesDown < 0)- // cyclesDown = 0;- // }+ // int cyclesExecuted = slicelength - currentMIPS->downcount;+ // int cyclesNextEvent = (int) (first->time - globalTimer);++ // if (cyclesNextEvent < cyclesExecuted + cyclesDown)+ // {+ // cyclesDown = cyclesNextEvent - cyclesExecuted;+ // // Now, now... no time machines, please.+ // if (cyclesDown < 0)+ // cyclesDown = 0;+ // }//}//INFO_LOG(TIME, "Idle for %i cycles! (%f ms)", cyclesDown, cyclesDown / (float)(g_clock_rate_arm11 * 0.001f));@@ -571,7 +571,7 @@ void Idle(int maxIdle)//idledCycles += cyclesDown;//currentMIPS->downcount -= cyclesDown;//if (currentMIPS->downcount == 0)- // currentMIPS->downcount = -1;+ // currentMIPS->downcount = -1;}std::string GetScheduledEventsSummary()@@ -623,4 +623,4 @@ void DoState(PointerWrap &p)p.Do(idledCycles);}-} // namespace+} // namespacediff --git a/src/core/system.h b/src/core/system.hindex 0be8711e47..2bc2edc75e 100644--- a/src/core/system.h+++ b/src/core/system.h@@ -12,14 +12,14 @@ namespace System {// State of the full emulatorenum State {- STATE_NULL = 0, ///< System is in null state, nothing initialized- STATE_IDLE, ///< System is in an initialized state, but not running- STATE_RUNNING, ///< System is running- STATE_LOADING, ///< System is loading a ROM- STATE_HALTED, ///< System is halted (error)- STATE_STALLED, ///< System is stalled (unused)- STATE_DEBUG, ///< System is in a special debug mode (unused)- STATE_DIE ///< System is shutting down+ STATE_NULL = 0, ///< System is in null state, nothing initialized+ STATE_IDLE, ///< System is in an initialized state, but not running+ STATE_RUNNING, ///< System is running+ STATE_LOADING, ///< System is loading a ROM+ STATE_HALTED, ///< System is halted (error)+ STATE_STALLED, ///< System is stalled (unused)+ STATE_DEBUG, ///< System is in a special debug mode (unused)+ STATE_DIE ///< System is shutting down};extern volatile State g_state;diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cppindex 22b8e99507..275b06b7cd 100644--- a/src/video_core/debug_utils/debug_utils.cpp+++ b/src/video_core/debug_utils/debug_utils.cpp@@ -318,9 +318,9 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {return;#ifndef HAVE_PNG- return;+ return;#else- if (!data)+ if (!data)return;// Write data to filediff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.hindex 8b1499bf22..b1558cfae6 100644--- a/src/video_core/debug_utils/debug_utils.h+++ b/src/video_core/debug_utils/debug_utils.h@@ -41,7 +41,7 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data// Utility class to log Pica commands.struct PicaTrace {struct Write : public std::pair<u32,u32> {- Write(u32 id, u32 value) : std::pair<u32,u32>(id, value) {}+ Write(u32 id, u32 value) : std::pair<u32,u32>(id, value) {}u32& Id() { return first; }const u32& Id() const { return first; }diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cppindex 729e8e73d1..abbb4c2cbf 100644--- a/src/video_core/renderer_opengl/renderer_opengl.cpp+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp@@ -239,7 +239,7 @@ MathUtil::Rectangle<unsigned> RendererOpenGL::GetViewportExtent() {MathUtil::Rectangle<unsigned> viewport_extent;if (window_aspect_ratio > emulation_aspect_ratio) {- // Window is narrower than the emulation content => apply borders to the top and bottom+ // Window is narrower than the emulation content => apply borders to the top and bottomunsigned viewport_height = emulation_aspect_ratio * framebuffer_width;viewport_extent.left = 0;viewport_extent.top = (framebuffer_height - viewport_height) / 2;diff --git a/src/video_core/utils.h b/src/video_core/utils.hindex 9cb3d4d43d..21380a9080 100644--- a/src/video_core/utils.h+++ b/src/video_core/utils.h@@ -12,24 +12,24 @@ namespace FormatPrecision {/// Adjust RGBA8 color with RGBA6 precisionstatic inline u32 rgba8_with_rgba6(u32 src) {- u32 color = src;- color &= 0xFCFCFCFC;- color |= (color >> 6) & 0x03030303;- return color;+ u32 color = src;+ color &= 0xFCFCFCFC;+ color |= (color >> 6) & 0x03030303;+ return color;}/// Adjust RGBA8 color with RGB565 precisionstatic inline u32 rgba8_with_rgb565(u32 src) {- u32 color = (src & 0xF8FCF8);- color |= (color >> 5) & 0x070007;- color |= (color >> 6) & 0x000300;- color |= 0xFF000000;- return color;+ u32 color = (src & 0xF8FCF8);+ color |= (color >> 5) & 0x070007;+ color |= (color >> 6) & 0x000300;+ color |= 0xFF000000;+ return color;}/// Adjust Z24 depth value with Z16 precisionstatic inline u32 z24_with_z16(u32 src) {- return (src & 0xFFFF00) | (src >> 16);+ return (src & 0xFFFF00) | (src >> 16);}} // namespace