VERY experimental Nintendo Switch 2 emulator
C++
Fixed indents
archshift704075f04a8a
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txtindex 2e4fbe353e..7787d6a72e 100644--- a/src/citra/CMakeLists.txt+++ b/src/citra/CMakeLists.txt@@ -13,7 +13,7 @@ add_executable(citra ${SRCS} ${HEADS})if (APPLE)target_link_libraries(citra core common video_core iconv pthread ${COREFOUNDATION_LIBRARY} ${OPENGL_LIBRARIES} ${GLEW_LIBRARY} ${GLFW_LIBRARIES})else()- target_link_libraries(citra core common video_core GLEW pthread X11 Xxf86vm Xi Xcursor ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} rt ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB})+ target_link_libraries(citra core common video_core GLEW pthread X11 Xxf86vm Xi Xcursor ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} rt ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB})endif()#install(TARGETS citra RUNTIME DESTINATION ${bindir})diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cppindex ea1499e7c0..73c1163731 100644--- a/src/citra/emu_window/emu_window_glfw.cpp+++ b/src/citra/emu_window/emu_window_glfw.cpp@@ -28,17 +28,17 @@ EmuWindow_GLFW::EmuWindow_GLFW() {}glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);- glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);+ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);+ glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth,(VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight),m_window_title.c_str(), NULL, NULL);- if (m_render_window == NULL) {- printf("Failed to create GLFW window! Exiting...");- exit(1);- }-+ if (m_render_window == NULL) {+ printf("Failed to create GLFW window! Exiting...");+ exit(1);+ }+// Setup callbacksglfwSetWindowUserPointer(m_render_window, this);//glfwSetKeyCallback(m_render_window, OnKeyEvent);diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txtindex 3a13355449..9d983c0f0d 100644--- a/src/citra_qt/CMakeLists.txt+++ b/src/citra_qt/CMakeLists.txt@@ -53,7 +53,7 @@ add_executable(citra-qt ${SRCS} ${HEADS} ${MOC_SRCS} ${UI_HDRS})if (APPLE)target_link_libraries(citra-qt core common video_core qhexedit iconv ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES})else()- target_link_libraries(citra-qt core common video_core qhexedit ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} rt GLEW ${GLFW_LIBRARIES})+ target_link_libraries(citra-qt core common video_core qhexedit ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} rt GLEW ${GLFW_LIBRARIES})endif()#install(TARGETS citra-qt RUNTIME DESTINATION ${bindir})diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cppindex 52b39eb27d..bd01b78c5c 100644--- a/src/citra_qt/bootmanager.cpp+++ b/src/citra_qt/bootmanager.cpp@@ -47,7 +47,7 @@ void EmuThread::run()void EmuThread::Stop(){- if (!isRunning())+ if (!isRunning()){INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning...");return;@@ -62,7 +62,7 @@ void EmuThread::Stop()terminate();wait(1000);if (isRunning())- WARN_LOG(MASTER_LOG, "EmuThread STILL running, something is wrong here...");+ WARN_LOG(MASTER_LOG, "EmuThread STILL running, something is wrong here...");}INFO_LOG(MASTER_LOG, "EmuThread stopped");}@@ -75,8 +75,8 @@ class GGLWidgetInternal : public QGLWidgetpublic:GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) : QGLWidget(parent){- doneCurrent();- parent_ = parent;+ doneCurrent();+ parent_ = parent;}void paintEvent(QPaintEvent* ev)@@ -102,12 +102,12 @@ EmuThread& GRenderWindow::GetEmuThread()GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this){// TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose- QGLFormat fmt;- fmt.setProfile(QGLFormat::CoreProfile);- fmt.setVersion(4,1);- fmt.setSampleBuffers(true);- fmt.setSamples(4);-+ QGLFormat fmt;+ fmt.setProfile(QGLFormat::CoreProfile);+ fmt.setVersion(4,1);+ fmt.setSampleBuffers(true);+ fmt.setSamples(4);+child = new GGLWidgetInternal(fmt, this);QBoxLayout* layout = new QHBoxLayout(this);resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight);@@ -148,12 +148,12 @@ void GRenderWindow::DoneCurrent()void GRenderWindow::PollEvents() {// TODO(ShizZy): Does this belong here? This is a reasonable place to update the window title// from the main thread, but this should probably be in an event handler...- /*- static char title[128];+ /*+ static char title[128];sprintf(title, "%s (FPS: %02.02f)", window_title_.c_str(),video_core::g_renderer->current_fps());setWindowTitle(title);- */+ */}void GRenderWindow::BackupGeometry()@@ -186,26 +186,26 @@ QByteArray GRenderWindow::saveGeometry()void GRenderWindow::keyPressEvent(QKeyEvent* event){- /*- bool key_processed = false;+ /*+ bool key_processed = false;for (unsigned int channel = 0; channel < 4 && controller_interface(); ++channel)if (controller_interface()->SetControllerStatus(channel, event->key(), input_common::GCController::PRESSED))key_processed = true;if (!key_processed)QWidget::keyPressEvent(event);- */+ */}void GRenderWindow::keyReleaseEvent(QKeyEvent* event){- /*- bool key_processed = false;+ /*+ bool key_processed = false;for (unsigned int channel = 0; channel < 4 && controller_interface(); ++channel)if (controller_interface()->SetControllerStatus(channel, event->key(), input_common::GCController::RELEASED))key_processed = true;if (!key_processed)QWidget::keyPressEvent(event);- */+ */}\ No newline at end of filediff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txtindex 48f30de4cb..ae23310701 100644--- a/src/common/CMakeLists.txt+++ b/src/common/CMakeLists.txt@@ -45,7 +45,7 @@ set(HEADS atomic.hmemory_util.hmsg_handler.hplatform.h- scm_rev.h+ scm_rev.hstd_condition_variable.hstd_mutex.hstd_thread.hdiff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex c8d95ba5dc..11b90434d9 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -50,10 +50,10 @@ set(HEADS core.harm/mmu/wb.helf/elf_reader.helf/elf_types.h- file_sys/directory_file_system.h+ file_sys/directory_file_system.hfile_sys/file_sys.hfile_sys/meta_file_system.h- hle/hle.h+ hle/hle.hhle/mrc.hhle/syscall.hhle/function_wrappers.hdiff --git a/src/video_core/utils.cpp b/src/video_core/utils.cppindex 9fcefaad3d..29382c8148 100644--- a/src/video_core/utils.cpp+++ b/src/video_core/utils.cpp@@ -8,39 +8,37 @@#include "video_core/utils.h"namespace VideoCore {-- /**- * Dumps a texture to TGA- * @param filename String filename to dump texture to- * @param width Width of texture in pixels- * @param height Height of texture in pixels- * @param raw_data Raw RGBA8 texture data to dump- * @todo This should be moved to some general purpose/common code- */- void DumpTGA(std::string filename, int width, int height, u8* raw_data) {- TGAHeader hdr;- FILE* fout;- u8 r, g, b;-- memset(&hdr, 0, sizeof(hdr));- hdr.datatypecode = 2; // uncompressed RGB- hdr.bitsperpixel = 24; // 24 bpp- hdr.width = width;- hdr.height = height;-- fout = fopen(filename.c_str(), "wb");- fwrite(&hdr, sizeof(TGAHeader), 1, fout);- for (int i = 0; i < height; i++) {- for (int j = 0; j < width; j++) {- b = raw_data[(3 * (i * width)) + (3 * j) + 0];- g = raw_data[(3 * (i * width)) + (3 * j) + 1];- r = raw_data[(3 * (i * width)) + (3 * j) + 2];- putc(b, fout);- putc(g, fout);- putc(r, fout);- }- }- fclose(fout);- }-+ /**+ * Dumps a texture to TGA+ * @param filename String filename to dump texture to+ * @param width Width of texture in pixels+ * @param height Height of texture in pixels+ * @param raw_data Raw RGBA8 texture data to dump+ * @todo This should be moved to some general purpose/common code+ */+ void DumpTGA(std::string filename, int width, int height, u8* raw_data) {+ TGAHeader hdr;+ FILE* fout;+ u8 r, g, b;++ memset(&hdr, 0, sizeof(hdr));+ hdr.datatypecode = 2; // uncompressed RGB+ hdr.bitsperpixel = 24; // 24 bpp+ hdr.width = width;+ hdr.height = height;++ fout = fopen(filename.c_str(), "wb");+ fwrite(&hdr, sizeof(TGAHeader), 1, fout);+ for (int i = 0; i < height; i++) {+ for (int j = 0; j < width; j++) {+ b = raw_data[(3 * (i * width)) + (3 * j) + 0];+ g = raw_data[(3 * (i * width)) + (3 * j) + 1];+ r = raw_data[(3 * (i * width)) + (3 * j) + 2];+ putc(b, fout);+ putc(g, fout);+ putc(r, fout);+ }+ }+ fclose(fout);+ }} // namespace\ No newline at end of filediff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cppindex 4e9cd70bcc..5f1933b1e3 100644--- a/src/video_core/video_core.cpp+++ b/src/video_core/video_core.cpp@@ -30,8 +30,8 @@ void Start() {/// Initialize the video corevoid Init(EmuWindow* emu_window) {- glewExperimental = GL_TRUE;-+ glewExperimental = GL_TRUE;+g_emu_window = emu_window;g_emu_window->MakeCurrent();g_renderer = new RendererOpenGL();