diff options
| -rw-r--r-- | CMakeLists.txt | 26 | ||||
| -rw-r--r-- | externals/cmake-modules/FindGLEW.cmake | 47 | ||||
| -rw-r--r-- | src/citra/CMakeLists.txt | 11 | ||||
| -rw-r--r-- | src/citra/emu_window/emu_window_glfw.cpp | 9 | ||||
| -rw-r--r-- | src/citra_qt/CMakeLists.txt | 25 | ||||
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 34 | ||||
| -rw-r--r-- | src/common/CMakeLists.txt | 41 | ||||
| -rw-r--r-- | src/common/chunk_file.h | 5 | ||||
| -rw-r--r-- | src/common/common.h | 46 | ||||
| -rw-r--r-- | src/common/common_types.h | 4 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 45 | ||||
| -rw-r--r-- | src/core/arm/interpreter/mmu/maverick.cpp | 4 | ||||
| -rw-r--r-- | src/core/arm/interpreter/vfp/vfp_helper.h | 4 | ||||
| -rw-r--r-- | src/core/arm/interpreter/vfp/vfpdouble.cpp | 8 | ||||
| -rw-r--r-- | src/core/arm/interpreter/vfp/vfpsingle.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/function_wrappers.h | 15 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 4 | ||||
| -rw-r--r-- | src/video_core/utils.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/video_core.cpp | 3 |
21 files changed, 286 insertions, 68 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a588fe193..114e39207 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -2,21 +2,37 @@ cmake_minimum_required(VERSION 2.6) | |||
| 2 | 2 | ||
| 3 | project(citra) | 3 | project(citra) |
| 4 | 4 | ||
| 5 | SET(GCC_COMPILE_FLAGS "-std=c++11 -fpermissive") | 5 | SET(CXX_COMPILE_FLAGS "-std=c++11 -fpermissive") |
| 6 | 6 | ||
| 7 | # silence some spam | 7 | # silence some spam |
| 8 | add_definitions(-Wno-attributes) | 8 | add_definitions(-Wno-attributes) |
| 9 | add_definitions(-DSINGLETHREADED) | 9 | add_definitions(-DSINGLETHREADED) |
| 10 | add_definitions(${GCC_COMPILE_FLAGS}) | 10 | add_definitions(${CXX_COMPILE_FLAGS}) |
| 11 | 11 | ||
| 12 | # dependency checking | 12 | # dependency checking |
| 13 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules/") | ||
| 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests) | 14 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests) |
| 14 | include(FindOpenGL REQUIRED) | ||
| 15 | include(FindX11 REQUIRED) | 15 | include(FindX11 REQUIRED) |
| 16 | find_package(PkgConfig REQUIRED) | 16 | find_package(PkgConfig REQUIRED) |
| 17 | find_package(GLEW REQUIRED) | ||
| 18 | find_package(OpenGL REQUIRED) | ||
| 17 | pkg_search_module(GLFW REQUIRED glfw3) | 19 | pkg_search_module(GLFW REQUIRED glfw3) |
| 18 | 20 | ||
| 21 | # corefoundation is required only on OSX | ||
| 22 | IF (APPLE) | ||
| 23 | FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) | ||
| 24 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | ||
| 25 | SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") | ||
| 26 | ENDIF (APPLE) | ||
| 27 | |||
| 28 | #external includes | ||
| 19 | include_directories(${GLFW_INCLUDE_DIRS}) | 29 | include_directories(${GLFW_INCLUDE_DIRS}) |
| 30 | include_directories(${OPENGL_INCLUDE_DIR}) | ||
| 31 | include_directories(${GLEW_INCLUDE_PATH}) | ||
| 32 | |||
| 33 | # workaround for GLFW linking on OSX | ||
| 34 | link_directories(${GLFW_LIBRARY_DIRS}) | ||
| 35 | |||
| 20 | option(DISABLE_QT4 "Disable Qt4 GUI" OFF) | 36 | option(DISABLE_QT4 "Disable Qt4 GUI" OFF) |
| 21 | if(NOT DISABLE_QT4) | 37 | if(NOT DISABLE_QT4) |
| 22 | include(FindQt4) | 38 | include(FindQt4) |
| @@ -32,14 +48,10 @@ if(NOT DISABLE_QT4) | |||
| 32 | endif() | 48 | endif() |
| 33 | 49 | ||
| 34 | # generate git revision information | 50 | # generate git revision information |
| 35 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules/") | ||
| 36 | include(GetGitRevisionDescription) | 51 | include(GetGitRevisionDescription) |
| 37 | get_git_head_revision(GIT_REF_SPEC GIT_REV) | 52 | get_git_head_revision(GIT_REF_SPEC GIT_REV) |
| 38 | git_describe(GIT_DESC --always --long --dirty) | 53 | git_describe(GIT_DESC --always --long --dirty) |
| 39 | git_branch_name(GIT_BRANCH) | 54 | git_branch_name(GIT_BRANCH) |
| 40 | |||
| 41 | # external includes | ||
| 42 | include_directories(${OPENGL_INCLUDE_DIR}) | ||
| 43 | 55 | ||
| 44 | # internal includes | 56 | # internal includes |
| 45 | include_directories(src) | 57 | include_directories(src) |
diff --git a/externals/cmake-modules/FindGLEW.cmake b/externals/cmake-modules/FindGLEW.cmake new file mode 100644 index 000000000..105e30eb0 --- /dev/null +++ b/externals/cmake-modules/FindGLEW.cmake | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | # | ||
| 2 | # Try to find GLEW library and include path. | ||
| 3 | # Once done this will define | ||
| 4 | # | ||
| 5 | # GLEW_FOUND | ||
| 6 | # GLEW_INCLUDE_PATH | ||
| 7 | # GLEW_LIBRARY | ||
| 8 | # | ||
| 9 | |||
| 10 | IF (WIN32) | ||
| 11 | FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h | ||
| 12 | $ENV{PROGRAMFILES}/GLEW/include | ||
| 13 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include | ||
| 14 | DOC "The directory where GL/glew.h resides") | ||
| 15 | FIND_LIBRARY( GLEW_LIBRARY | ||
| 16 | NAMES glew GLEW glew32 glew32s | ||
| 17 | PATHS | ||
| 18 | $ENV{PROGRAMFILES}/GLEW/lib | ||
| 19 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin | ||
| 20 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib | ||
| 21 | DOC "The GLEW library") | ||
| 22 | ELSE (WIN32) | ||
| 23 | FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h | ||
| 24 | /usr/include | ||
| 25 | /usr/local/include | ||
| 26 | /sw/include | ||
| 27 | /opt/local/include | ||
| 28 | DOC "The directory where GL/glew.h resides") | ||
| 29 | FIND_LIBRARY( GLEW_LIBRARY | ||
| 30 | NAMES GLEW glew | ||
| 31 | PATHS | ||
| 32 | /usr/lib64 | ||
| 33 | /usr/lib | ||
| 34 | /usr/local/lib64 | ||
| 35 | /usr/local/lib | ||
| 36 | /sw/lib | ||
| 37 | /opt/local/lib | ||
| 38 | DOC "The GLEW library") | ||
| 39 | ENDIF (WIN32) | ||
| 40 | |||
| 41 | IF (GLEW_INCLUDE_PATH) | ||
| 42 | SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") | ||
| 43 | ELSE (GLEW_INCLUDE_PATH) | ||
| 44 | SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") | ||
| 45 | ENDIF (GLEW_INCLUDE_PATH) | ||
| 46 | |||
| 47 | MARK_AS_ADVANCED( GLEW_FOUND ) | ||
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 147f51e94..1ad607d76 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt | |||
| @@ -1,12 +1,19 @@ | |||
| 1 | set(SRCS citra.cpp | 1 | set(SRCS citra.cpp |
| 2 | emu_window/emu_window_glfw.cpp) | 2 | emu_window/emu_window_glfw.cpp) |
| 3 | set(HEADERS citra.h | ||
| 4 | resource.h) | ||
| 3 | 5 | ||
| 4 | # NOTE: This is a workaround for CMake bug 0006976 (missing X11_xf86vmode_LIB variable) | 6 | # NOTE: This is a workaround for CMake bug 0006976 (missing X11_xf86vmode_LIB variable) |
| 5 | if (NOT X11_xf86vmode_LIB) | 7 | if (NOT X11_xf86vmode_LIB) |
| 6 | set(X11_xv86vmode_LIB Xxf86vm) | 8 | set(X11_xv86vmode_LIB Xxf86vm) |
| 7 | endif() | 9 | endif() |
| 8 | 10 | ||
| 9 | add_executable(citra ${SRCS}) | 11 | add_executable(citra ${SRCS} ${HEADERS}) |
| 10 | 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}) | 12 | |
| 13 | if (APPLE) | ||
| 14 | target_link_libraries(citra core common video_core iconv pthread ${COREFOUNDATION_LIBRARY} ${OPENGL_LIBRARIES} ${GLEW_LIBRARY} ${GLFW_LIBRARIES}) | ||
| 15 | else() | ||
| 16 | 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}) | ||
| 17 | endif() | ||
| 11 | 18 | ||
| 12 | #install(TARGETS citra RUNTIME DESTINATION ${bindir}) | 19 | #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.cpp index e6943f146..73c116373 100644 --- a/src/citra/emu_window/emu_window_glfw.cpp +++ b/src/citra/emu_window/emu_window_glfw.cpp | |||
| @@ -27,11 +27,18 @@ EmuWindow_GLFW::EmuWindow_GLFW() { | |||
| 27 | exit(1); | 27 | exit(1); |
| 28 | } | 28 | } |
| 29 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); | 29 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); |
| 30 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); | 30 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); |
| 31 | glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); | ||
| 32 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); | ||
| 31 | m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth, | 33 | m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth, |
| 32 | (VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight), | 34 | (VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight), |
| 33 | m_window_title.c_str(), NULL, NULL); | 35 | m_window_title.c_str(), NULL, NULL); |
| 34 | 36 | ||
| 37 | if (m_render_window == NULL) { | ||
| 38 | printf("Failed to create GLFW window! Exiting..."); | ||
| 39 | exit(1); | ||
| 40 | } | ||
| 41 | |||
| 35 | // Setup callbacks | 42 | // Setup callbacks |
| 36 | glfwSetWindowUserPointer(m_render_window, this); | 43 | glfwSetWindowUserPointer(m_render_window, this); |
| 37 | //glfwSetKeyCallback(m_render_window, OnKeyEvent); | 44 | //glfwSetKeyCallback(m_render_window, OnKeyEvent); |
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 594460a71..549f69217 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt | |||
| @@ -8,6 +8,23 @@ set(SRCS | |||
| 8 | main.cpp | 8 | main.cpp |
| 9 | config/controller_config.cpp | 9 | config/controller_config.cpp |
| 10 | config/controller_config_util.cpp) | 10 | config/controller_config_util.cpp) |
| 11 | set (HEADERS | ||
| 12 | bootmanager.hxx | ||
| 13 | debugger/callstack.hxx | ||
| 14 | debugger/disassembler.hxx | ||
| 15 | debugger/ramview.hxx | ||
| 16 | debugger/registers.hxx | ||
| 17 | hotkeys.hxx | ||
| 18 | main.hxx | ||
| 19 | ui_callstack.h | ||
| 20 | ui_controller_config.h | ||
| 21 | ui_disassembler.h | ||
| 22 | ui_hotkeys.h | ||
| 23 | ui_main.h | ||
| 24 | ui_registers.h | ||
| 25 | version.h | ||
| 26 | config/controller_config.hxx | ||
| 27 | config/controller_config_util.hxx) | ||
| 11 | 28 | ||
| 12 | qt4_wrap_ui(UI_HDRS | 29 | qt4_wrap_ui(UI_HDRS |
| 13 | debugger/callstack.ui | 30 | debugger/callstack.ui |
| @@ -32,7 +49,11 @@ qt4_wrap_cpp(MOC_SRCS | |||
| 32 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | 49 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
| 33 | include_directories(./) | 50 | include_directories(./) |
| 34 | 51 | ||
| 35 | add_executable(citra-qt ${SRCS} ${MOC_SRCS} ${UI_HDRS}) | 52 | add_executable(citra-qt ${SRCS} ${HEADERS} ${MOC_SRCS} ${UI_HDRS}) |
| 36 | target_link_libraries(citra-qt core common video_core qhexedit ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} rt GLEW ${GLFW_LIBRARIES}) | 53 | if (APPLE) |
| 54 | target_link_libraries(citra-qt core common video_core qhexedit iconv ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES}) | ||
| 55 | else() | ||
| 56 | target_link_libraries(citra-qt core common video_core qhexedit ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} rt GLEW ${GLFW_LIBRARIES}) | ||
| 57 | endif() | ||
| 37 | 58 | ||
| 38 | #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) | 59 | #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) |
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index cf9e1bffc..f85116419 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -50,7 +50,7 @@ void EmuThread::run() | |||
| 50 | 50 | ||
| 51 | void EmuThread::Stop() | 51 | void EmuThread::Stop() |
| 52 | { | 52 | { |
| 53 | if (!isRunning()) | 53 | if (!isRunning()) |
| 54 | { | 54 | { |
| 55 | INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning..."); | 55 | INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning..."); |
| 56 | return; | 56 | return; |
| @@ -65,7 +65,7 @@ void EmuThread::Stop() | |||
| 65 | terminate(); | 65 | terminate(); |
| 66 | wait(1000); | 66 | wait(1000); |
| 67 | if (isRunning()) | 67 | if (isRunning()) |
| 68 | WARN_LOG(MASTER_LOG, "EmuThread STILL running, something is wrong here..."); | 68 | WARN_LOG(MASTER_LOG, "EmuThread STILL running, something is wrong here..."); |
| 69 | } | 69 | } |
| 70 | INFO_LOG(MASTER_LOG, "EmuThread stopped"); | 70 | INFO_LOG(MASTER_LOG, "EmuThread stopped"); |
| 71 | } | 71 | } |
| @@ -76,9 +76,8 @@ void EmuThread::Stop() | |||
| 76 | class GGLWidgetInternal : public QGLWidget | 76 | class GGLWidgetInternal : public QGLWidget |
| 77 | { | 77 | { |
| 78 | public: | 78 | public: |
| 79 | GGLWidgetInternal(GRenderWindow* parent) : QGLWidget(parent) | 79 | GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) : QGLWidget(parent) |
| 80 | { | 80 | { |
| 81 | setAutoBufferSwap(false); | ||
| 82 | doneCurrent(); | 81 | doneCurrent(); |
| 83 | parent_ = parent; | 82 | parent_ = parent; |
| 84 | } | 83 | } |
| @@ -106,8 +105,13 @@ EmuThread& GRenderWindow::GetEmuThread() | |||
| 106 | GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this) | 105 | GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this) |
| 107 | { | 106 | { |
| 108 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose | 107 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose |
| 109 | 108 | QGLFormat fmt; | |
| 110 | child = new GGLWidgetInternal(this); | 109 | fmt.setProfile(QGLFormat::CoreProfile); |
| 110 | fmt.setVersion(3,2); | ||
| 111 | fmt.setSampleBuffers(true); | ||
| 112 | fmt.setSamples(4); | ||
| 113 | |||
| 114 | child = new GGLWidgetInternal(fmt, this); | ||
| 111 | QBoxLayout* layout = new QHBoxLayout(this); | 115 | QBoxLayout* layout = new QHBoxLayout(this); |
| 112 | resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); | 116 | resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); |
| 113 | layout->addWidget(child); | 117 | layout->addWidget(child); |
| @@ -147,12 +151,12 @@ void GRenderWindow::DoneCurrent() | |||
| 147 | void GRenderWindow::PollEvents() { | 151 | void GRenderWindow::PollEvents() { |
| 148 | // TODO(ShizZy): Does this belong here? This is a reasonable place to update the window title | 152 | // TODO(ShizZy): Does this belong here? This is a reasonable place to update the window title |
| 149 | // from the main thread, but this should probably be in an event handler... | 153 | // from the main thread, but this should probably be in an event handler... |
| 150 | /* | 154 | /* |
| 151 | static char title[128]; | 155 | static char title[128]; |
| 152 | sprintf(title, "%s (FPS: %02.02f)", window_title_.c_str(), | 156 | sprintf(title, "%s (FPS: %02.02f)", window_title_.c_str(), |
| 153 | video_core::g_renderer->current_fps()); | 157 | video_core::g_renderer->current_fps()); |
| 154 | setWindowTitle(title); | 158 | setWindowTitle(title); |
| 155 | */ | 159 | */ |
| 156 | } | 160 | } |
| 157 | 161 | ||
| 158 | void GRenderWindow::BackupGeometry() | 162 | void GRenderWindow::BackupGeometry() |
| @@ -185,26 +189,26 @@ QByteArray GRenderWindow::saveGeometry() | |||
| 185 | 189 | ||
| 186 | void GRenderWindow::keyPressEvent(QKeyEvent* event) | 190 | void GRenderWindow::keyPressEvent(QKeyEvent* event) |
| 187 | { | 191 | { |
| 188 | /* | 192 | /* |
| 189 | bool key_processed = false; | 193 | bool key_processed = false; |
| 190 | for (unsigned int channel = 0; channel < 4 && controller_interface(); ++channel) | 194 | for (unsigned int channel = 0; channel < 4 && controller_interface(); ++channel) |
| 191 | if (controller_interface()->SetControllerStatus(channel, event->key(), input_common::GCController::PRESSED)) | 195 | if (controller_interface()->SetControllerStatus(channel, event->key(), input_common::GCController::PRESSED)) |
| 192 | key_processed = true; | 196 | key_processed = true; |
| 193 | 197 | ||
| 194 | if (!key_processed) | 198 | if (!key_processed) |
| 195 | QWidget::keyPressEvent(event); | 199 | QWidget::keyPressEvent(event); |
| 196 | */ | 200 | */ |
| 197 | } | 201 | } |
| 198 | 202 | ||
| 199 | void GRenderWindow::keyReleaseEvent(QKeyEvent* event) | 203 | void GRenderWindow::keyReleaseEvent(QKeyEvent* event) |
| 200 | { | 204 | { |
| 201 | /* | 205 | /* |
| 202 | bool key_processed = false; | 206 | bool key_processed = false; |
| 203 | for (unsigned int channel = 0; channel < 4 && controller_interface(); ++channel) | 207 | for (unsigned int channel = 0; channel < 4 && controller_interface(); ++channel) |
| 204 | if (controller_interface()->SetControllerStatus(channel, event->key(), input_common::GCController::RELEASED)) | 208 | if (controller_interface()->SetControllerStatus(channel, event->key(), input_common::GCController::RELEASED)) |
| 205 | key_processed = true; | 209 | key_processed = true; |
| 206 | 210 | ||
| 207 | if (!key_processed) | 211 | if (!key_processed) |
| 208 | QWidget::keyPressEvent(event); | 212 | QWidget::keyPressEvent(event); |
| 209 | */ | 213 | */ |
| 210 | } \ No newline at end of file | 214 | } \ No newline at end of file |
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 5eaf67365..aae183393 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -19,4 +19,43 @@ set(SRCS break_points.cpp | |||
| 19 | timer.cpp | 19 | timer.cpp |
| 20 | utf8.cpp) | 20 | utf8.cpp) |
| 21 | 21 | ||
| 22 | add_library(common STATIC ${SRCS}) | 22 | set(HEADERS atomic.h |
| 23 | atomic_gcc.h | ||
| 24 | atomic_win32.h | ||
| 25 | bit_field.h | ||
| 26 | break_points.h | ||
| 27 | chunk_file.h | ||
| 28 | common_funcs.h | ||
| 29 | common_paths.h | ||
| 30 | common_types.h | ||
| 31 | common.h | ||
| 32 | console_listener.h | ||
| 33 | cpu_detect.h | ||
| 34 | debug_interface.h | ||
| 35 | emu_window.h | ||
| 36 | extended_trace.h | ||
| 37 | fifo_queue.h | ||
| 38 | file_search.h | ||
| 39 | file_util.h | ||
| 40 | hash.h | ||
| 41 | linear_disk_cache.h | ||
| 42 | log_manager.h | ||
| 43 | log.h | ||
| 44 | math_util.h | ||
| 45 | mem_arena.h | ||
| 46 | memory_util.h | ||
| 47 | msg_handler.h | ||
| 48 | platform.h | ||
| 49 | scm_rev.h | ||
| 50 | std_condition_variable.h | ||
| 51 | std_mutex.h | ||
| 52 | std_thread.h | ||
| 53 | string_util.h | ||
| 54 | swap.h | ||
| 55 | symbols.h | ||
| 56 | thread.h | ||
| 57 | thunk.h | ||
| 58 | timer.h | ||
| 59 | utf8.h) | ||
| 60 | |||
| 61 | add_library(common STATIC ${SRCS} ${HEADERS}) | ||
diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index a41205857..8c9f839da 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h | |||
| @@ -654,7 +654,8 @@ inline PointerWrapSection::~PointerWrapSection() { | |||
| 654 | } | 654 | } |
| 655 | 655 | ||
| 656 | 656 | ||
| 657 | class CChunkFileReader | 657 | // Commented out because it is currently unused, and breaks builds on OSX |
| 658 | /*class CChunkFileReader | ||
| 658 | { | 659 | { |
| 659 | public: | 660 | public: |
| 660 | enum Error { | 661 | enum Error { |
| @@ -869,6 +870,6 @@ private: | |||
| 869 | int UncompressedSize; | 870 | int UncompressedSize; |
| 870 | char GitVersion[32]; | 871 | char GitVersion[32]; |
| 871 | }; | 872 | }; |
| 872 | }; | 873 | }; */ |
| 873 | 874 | ||
| 874 | #endif // _POINTERWRAP_H_ | 875 | #endif // _POINTERWRAP_H_ |
diff --git a/src/common/common.h b/src/common/common.h index 418757855..2578d0010 100644 --- a/src/common/common.h +++ b/src/common/common.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #define STACKALIGN | 22 | #define STACKALIGN |
| 23 | 23 | ||
| 24 | #if __cplusplus >= 201103 || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__) | 24 | #if __cplusplus >= 201103L || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__) |
| 25 | #define HAVE_CXX11_SYNTAX 1 | 25 | #define HAVE_CXX11_SYNTAX 1 |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| @@ -159,4 +159,48 @@ enum EMUSTATE_CHANGE | |||
| 159 | EMUSTATE_CHANGE_STOP | 159 | EMUSTATE_CHANGE_STOP |
| 160 | }; | 160 | }; |
| 161 | 161 | ||
| 162 | |||
| 163 | #ifdef _MSC_VER | ||
| 164 | #ifndef _XBOX | ||
| 165 | inline unsigned long long bswap64(unsigned long long x) { return _byteswap_uint64(x); } | ||
| 166 | inline unsigned int bswap32(unsigned int x) { return _byteswap_ulong(x); } | ||
| 167 | inline unsigned short bswap16(unsigned short x) { return _byteswap_ushort(x); } | ||
| 168 | #else | ||
| 169 | inline unsigned long long bswap64(unsigned long long x) { return __loaddoublewordbytereverse(0, &x); } | ||
| 170 | inline unsigned int bswap32(unsigned int x) { return __loadwordbytereverse(0, &x); } | ||
| 171 | inline unsigned short bswap16(unsigned short x) { return __loadshortbytereverse(0, &x); } | ||
| 172 | #endif | ||
| 173 | #else | ||
| 174 | // TODO: speedup | ||
| 175 | inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); } | ||
| 176 | inline unsigned int bswap32(unsigned int x) { return (x >> 24) | ((x & 0xFF0000) >> 8) | ((x & 0xFF00) << 8) | (x << 24);} | ||
| 177 | inline unsigned long long bswap64(unsigned long long x) {return ((unsigned long long)bswap32(x) << 32) | bswap32(x >> 32); } | ||
| 178 | #endif | ||
| 179 | |||
| 180 | inline float bswapf(float f) { | ||
| 181 | union { | ||
| 182 | float f; | ||
| 183 | unsigned int u32; | ||
| 184 | } dat1, dat2; | ||
| 185 | |||
| 186 | dat1.f = f; | ||
| 187 | dat2.u32 = bswap32(dat1.u32); | ||
| 188 | |||
| 189 | return dat2.f; | ||
| 190 | } | ||
| 191 | |||
| 192 | inline double bswapd(double f) { | ||
| 193 | union { | ||
| 194 | double f; | ||
| 195 | unsigned long long u64; | ||
| 196 | } dat1, dat2; | ||
| 197 | |||
| 198 | dat1.f = f; | ||
| 199 | dat2.u64 = bswap64(dat1.u64); | ||
| 200 | |||
| 201 | return dat2.f; | ||
| 202 | } | ||
| 203 | |||
| 204 | #include "swap.h" | ||
| 205 | |||
| 162 | #endif // _COMMON_H_ | 206 | #endif // _COMMON_H_ |
diff --git a/src/common/common_types.h b/src/common/common_types.h index 4289b88d3..402410507 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h | |||
| @@ -62,7 +62,7 @@ typedef signed long long s64; ///< 64-bit signed int | |||
| 62 | typedef float f32; ///< 32-bit floating point | 62 | typedef float f32; ///< 32-bit floating point |
| 63 | typedef double f64; ///< 64-bit floating point | 63 | typedef double f64; ///< 64-bit floating point |
| 64 | 64 | ||
| 65 | #include "common/swap.h" | 65 | #include "common/common.h" |
| 66 | 66 | ||
| 67 | /// Union for fast 16-bit type casting | 67 | /// Union for fast 16-bit type casting |
| 68 | union t16 { | 68 | union t16 { |
| @@ -100,6 +100,7 @@ union t128 { | |||
| 100 | __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers) | 100 | __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers) |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| 103 | namespace common { | ||
| 103 | /// Rectangle data structure | 104 | /// Rectangle data structure |
| 104 | class Rect { | 105 | class Rect { |
| 105 | public: | 106 | public: |
| @@ -123,3 +124,4 @@ public: | |||
| 123 | return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); | 124 | return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); |
| 124 | } | 125 | } |
| 125 | }; | 126 | }; |
| 127 | } | ||
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index fdf68c386..14c598bf3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -43,4 +43,47 @@ set(SRCS core.cpp | |||
| 43 | hw/lcd.cpp | 43 | hw/lcd.cpp |
| 44 | hw/ndma.cpp) | 44 | hw/ndma.cpp) |
| 45 | 45 | ||
| 46 | add_library(core STATIC ${SRCS}) | 46 | set(HEADERS core.h |
| 47 | core_timing.h | ||
| 48 | loader.h | ||
| 49 | mem_map.h | ||
| 50 | system.h | ||
| 51 | arm/disassembler/arm_disasm.h | ||
| 52 | arm/disassembler/load_symbol_map.h | ||
| 53 | arm/interpreter/arm_interpreter.h | ||
| 54 | arm/interpreter/arm_regformat.h | ||
| 55 | arm/interpreter/armcpu.h | ||
| 56 | arm/interpreter/armdefs.h | ||
| 57 | arm/interpreter/armemu.h | ||
| 58 | arm/interpreter/armmmu.h | ||
| 59 | arm/interpreter/armos.h | ||
| 60 | arm/interpreter/skyeye_defs.h | ||
| 61 | arm/interpreter/mmu/arm1176jzf_s_mmu.h | ||
| 62 | arm/interpreter/mmu/cache.h | ||
| 63 | arm/interpreter/mmu/rb.h | ||
| 64 | arm/interpreter/mmu/sa_mmu.h | ||
| 65 | arm/interpreter/mmu/tlb.h | ||
| 66 | arm/interpreter/mmu/wb.h | ||
| 67 | arm/interpreter/vfp/asm_vfp.h | ||
| 68 | arm/interpreter/vfp/vfp.h | ||
| 69 | arm/interpreter/vfp/vfp_helper.h | ||
| 70 | elf/elf_reader.h | ||
| 71 | elf/elf_types.h | ||
| 72 | file_sys/directory_file_system.h | ||
| 73 | file_sys/file_sys.h | ||
| 74 | file_sys/meta_file_system.h | ||
| 75 | hle/config_mem.h | ||
| 76 | hle/coprocessor.h | ||
| 77 | hle/hle.h | ||
| 78 | hle/syscall.h | ||
| 79 | hle/function_wrappers.h | ||
| 80 | hle/service/apt.h | ||
| 81 | hle/service/gsp.h | ||
| 82 | hle/service/hid.h | ||
| 83 | hle/service/service.h | ||
| 84 | hle/service/srv.h | ||
| 85 | hw/hw.h | ||
| 86 | hw/lcd.h | ||
| 87 | hw/ndma.h) | ||
| 88 | |||
| 89 | add_library(core STATIC ${SRCS} ${HEADERS}) | ||
diff --git a/src/core/arm/interpreter/mmu/maverick.cpp b/src/core/arm/interpreter/mmu/maverick.cpp index 0e98ef22b..adcc2efb5 100644 --- a/src/core/arm/interpreter/mmu/maverick.cpp +++ b/src/core/arm/interpreter/mmu/maverick.cpp | |||
| @@ -86,12 +86,12 @@ static union | |||
| 86 | } reg_conv; | 86 | } reg_conv; |
| 87 | 87 | ||
| 88 | static void | 88 | static void |
| 89 | printf_nothing (void *foo, ...) | 89 | printf_nothing (const char *foo, ...) |
| 90 | { | 90 | { |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | static void | 93 | static void |
| 94 | cirrus_not_implemented (char *insn) | 94 | cirrus_not_implemented (const char *insn) |
| 95 | { | 95 | { |
| 96 | fprintf (stderr, "Cirrus instruction '%s' not implemented.\n", insn); | 96 | fprintf (stderr, "Cirrus instruction '%s' not implemented.\n", insn); |
| 97 | fprintf (stderr, "aborting!\n"); | 97 | fprintf (stderr, "aborting!\n"); |
diff --git a/src/core/arm/interpreter/vfp/vfp_helper.h b/src/core/arm/interpreter/vfp/vfp_helper.h index 80f9a93f4..b222e79f1 100644 --- a/src/core/arm/interpreter/vfp/vfp_helper.h +++ b/src/core/arm/interpreter/vfp/vfp_helper.h | |||
| @@ -50,7 +50,7 @@ | |||
| 50 | #define pr_info //printf | 50 | #define pr_info //printf |
| 51 | #define pr_debug //printf | 51 | #define pr_debug //printf |
| 52 | 52 | ||
| 53 | static u32 fls(int x); | 53 | static u32 vfp_fls(int x); |
| 54 | #define do_div(n, base) {n/=base;} | 54 | #define do_div(n, base) {n/=base;} |
| 55 | 55 | ||
| 56 | /* From vfpinstr.h */ | 56 | /* From vfpinstr.h */ |
| @@ -508,7 +508,7 @@ struct op { | |||
| 508 | u32 flags; | 508 | u32 flags; |
| 509 | }; | 509 | }; |
| 510 | 510 | ||
| 511 | static inline u32 fls(int x) | 511 | static u32 vfp_fls(int x) |
| 512 | { | 512 | { |
| 513 | int r = 32; | 513 | int r = 32; |
| 514 | 514 | ||
diff --git a/src/core/arm/interpreter/vfp/vfpdouble.cpp b/src/core/arm/interpreter/vfp/vfpdouble.cpp index cd5b5afa4..7f975cbeb 100644 --- a/src/core/arm/interpreter/vfp/vfpdouble.cpp +++ b/src/core/arm/interpreter/vfp/vfpdouble.cpp | |||
| @@ -69,9 +69,9 @@ static void vfp_double_dump(const char *str, struct vfp_double *d) | |||
| 69 | 69 | ||
| 70 | static void vfp_double_normalise_denormal(struct vfp_double *vd) | 70 | static void vfp_double_normalise_denormal(struct vfp_double *vd) |
| 71 | { | 71 | { |
| 72 | int bits = 31 - fls(vd->significand >> 32); | 72 | int bits = 31 - vfp_fls(vd->significand >> 32); |
| 73 | if (bits == 31) | 73 | if (bits == 31) |
| 74 | bits = 63 - fls(vd->significand); | 74 | bits = 63 - vfp_fls(vd->significand); |
| 75 | 75 | ||
| 76 | vfp_double_dump("normalise_denormal: in", vd); | 76 | vfp_double_dump("normalise_denormal: in", vd); |
| 77 | 77 | ||
| @@ -108,9 +108,9 @@ u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double *vd, | |||
| 108 | exponent = vd->exponent; | 108 | exponent = vd->exponent; |
| 109 | significand = vd->significand; | 109 | significand = vd->significand; |
| 110 | 110 | ||
| 111 | shift = 32 - fls(significand >> 32); | 111 | shift = 32 - vfp_fls(significand >> 32); |
| 112 | if (shift == 32) | 112 | if (shift == 32) |
| 113 | shift = 64 - fls(significand); | 113 | shift = 64 - vfp_fls(significand); |
| 114 | if (shift) { | 114 | if (shift) { |
| 115 | exponent -= shift; | 115 | exponent -= shift; |
| 116 | significand <<= shift; | 116 | significand <<= shift; |
diff --git a/src/core/arm/interpreter/vfp/vfpsingle.cpp b/src/core/arm/interpreter/vfp/vfpsingle.cpp index 05279f5ce..602713cff 100644 --- a/src/core/arm/interpreter/vfp/vfpsingle.cpp +++ b/src/core/arm/interpreter/vfp/vfpsingle.cpp | |||
| @@ -69,7 +69,7 @@ static void vfp_single_dump(const char *str, struct vfp_single *s) | |||
| 69 | 69 | ||
| 70 | static void vfp_single_normalise_denormal(struct vfp_single *vs) | 70 | static void vfp_single_normalise_denormal(struct vfp_single *vs) |
| 71 | { | 71 | { |
| 72 | int bits = 31 - fls(vs->significand); | 72 | int bits = 31 - vfp_fls(vs->significand); |
| 73 | 73 | ||
| 74 | vfp_single_dump("normalise_denormal: in", vs); | 74 | vfp_single_dump("normalise_denormal: in", vs); |
| 75 | 75 | ||
| @@ -111,7 +111,7 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs, | |||
| 111 | * bit 31, so we have VFP_SINGLE_LOW_BITS + 1 below the least | 111 | * bit 31, so we have VFP_SINGLE_LOW_BITS + 1 below the least |
| 112 | * significant bit. | 112 | * significant bit. |
| 113 | */ | 113 | */ |
| 114 | shift = 32 - fls(significand); | 114 | shift = 32 - vfp_fls(significand); |
| 115 | if (shift < 32 && shift) { | 115 | if (shift < 32 && shift) { |
| 116 | exponent -= shift; | 116 | exponent -= shift; |
| 117 | significand <<= shift; | 117 | significand <<= shift; |
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 18b01b14b..d934eafb4 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h | |||
| @@ -83,15 +83,6 @@ template<u32 func(int, void *)> void WrapU_IV() { | |||
| 83 | RETURN(retval); | 83 | RETURN(retval); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | template<float func()> void WrapF_V() { | ||
| 87 | RETURNF(func()); | ||
| 88 | } | ||
| 89 | |||
| 90 | // TODO: Not sure about the floating point parameter passing | ||
| 91 | template<float func(int, float, u32)> void WrapF_IFU() { | ||
| 92 | RETURNF(func(PARAM(0), PARAMF(0), PARAM(1))); | ||
| 93 | } | ||
| 94 | |||
| 95 | template<u32 func(u32)> void WrapU_U() { | 86 | template<u32 func(u32)> void WrapU_U() { |
| 96 | u32 retval = func(PARAM(0)); | 87 | u32 retval = func(PARAM(0)); |
| 97 | RETURN(retval); | 88 | RETURN(retval); |
| @@ -127,12 +118,6 @@ template<int func(u32, u32)> void WrapI_UU() { | |||
| 127 | RETURN(retval); | 118 | RETURN(retval); |
| 128 | } | 119 | } |
| 129 | 120 | ||
| 130 | template<int func(u32, float, float)> void WrapI_UFF() { | ||
| 131 | // Not sure about the float arguments. | ||
| 132 | int retval = func(PARAM(0), PARAMF(0), PARAMF(1)); | ||
| 133 | RETURN(retval); | ||
| 134 | } | ||
| 135 | |||
| 136 | template<int func(u32, u32, u32)> void WrapI_UUU() { | 121 | template<int func(u32, u32, u32)> void WrapI_UUU() { |
| 137 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); | 122 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); |
| 138 | RETURN(retval); | 123 | RETURN(retval); |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 56394b930..e43e6e1bb 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -2,4 +2,9 @@ set(SRCS video_core.cpp | |||
| 2 | utils.cpp | 2 | utils.cpp |
| 3 | renderer_opengl/renderer_opengl.cpp) | 3 | renderer_opengl/renderer_opengl.cpp) |
| 4 | 4 | ||
| 5 | add_library(video_core STATIC ${SRCS}) | 5 | set(HEADERS video_core.h |
| 6 | utils.h | ||
| 7 | renderer_base.h | ||
| 8 | renderer_opengl/renderer_opengl.h) | ||
| 9 | |||
| 10 | add_library(video_core STATIC ${SRCS} ${HEADERS}) | ||
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 24f9a91fd..bb5eb34aa 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -37,7 +37,7 @@ void RendererOpenGL::SwapBuffers() { | |||
| 37 | // EFB->XFB copy | 37 | // EFB->XFB copy |
| 38 | // TODO(bunnei): This is a hack and does not belong here. The copy should be triggered by some | 38 | // TODO(bunnei): This is a hack and does not belong here. The copy should be triggered by some |
| 39 | // register write We're also treating both framebuffers as a single one in OpenGL. | 39 | // register write We're also treating both framebuffers as a single one in OpenGL. |
| 40 | Rect framebuffer_size(0, 0, m_resolution_width, m_resolution_height); | 40 | common::Rect framebuffer_size(0, 0, m_resolution_width, m_resolution_height); |
| 41 | RenderXFB(framebuffer_size, framebuffer_size); | 41 | RenderXFB(framebuffer_size, framebuffer_size); |
| 42 | 42 | ||
| 43 | // XFB->Window copy | 43 | // XFB->Window copy |
| @@ -75,7 +75,7 @@ void RendererOpenGL::FlipFramebuffer(const u8* in, u8* out) { | |||
| 75 | * @param src_rect Source rectangle in XFB to copy | 75 | * @param src_rect Source rectangle in XFB to copy |
| 76 | * @param dst_rect Destination rectangle in output framebuffer to copy to | 76 | * @param dst_rect Destination rectangle in output framebuffer to copy to |
| 77 | */ | 77 | */ |
| 78 | void RendererOpenGL::RenderXFB(const Rect& src_rect, const Rect& dst_rect) { | 78 | void RendererOpenGL::RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect) { |
| 79 | 79 | ||
| 80 | FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_top_left_1), m_xfb_top_flipped); | 80 | FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_top_left_1), m_xfb_top_flipped); |
| 81 | FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_sub_left_1), m_xfb_bottom_flipped); | 81 | FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_sub_left_1), m_xfb_bottom_flipped); |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 4c0b6e59d..dd811cad6 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -28,7 +28,7 @@ public: | |||
| 28 | * @param src_rect Source rectangle in XFB to copy | 28 | * @param src_rect Source rectangle in XFB to copy |
| 29 | * @param dst_rect Destination rectangle in output framebuffer to copy to | 29 | * @param dst_rect Destination rectangle in output framebuffer to copy to |
| 30 | */ | 30 | */ |
| 31 | void RenderXFB(const Rect& src_rect, const Rect& dst_rect); | 31 | void RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect); |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * Set the emulator window to use for renderer | 34 | * Set the emulator window to use for renderer |
| @@ -59,7 +59,7 @@ private: | |||
| 59 | * @param out Pointer to output buffer with flipped framebuffer | 59 | * @param out Pointer to output buffer with flipped framebuffer |
| 60 | * @todo Early on hack... I'd like to find a more efficient way of doing this /bunnei | 60 | * @todo Early on hack... I'd like to find a more efficient way of doing this /bunnei |
| 61 | */ | 61 | */ |
| 62 | void RendererOpenGL::FlipFramebuffer(const u8* in, u8* out); | 62 | void FlipFramebuffer(const u8* in, u8* out); |
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | EmuWindow* m_render_window; ///< Handle to render window | 65 | EmuWindow* m_render_window; ///< Handle to render window |
diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp index 67d74a2d8..b94376ac1 100644 --- a/src/video_core/utils.cpp +++ b/src/video_core/utils.cpp | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include "video_core/utils.h" | 8 | #include "video_core/utils.h" |
| 9 | 9 | ||
| 10 | namespace VideoCore { | 10 | namespace VideoCore { |
| 11 | |||
| 12 | /** | 11 | /** |
| 13 | * Dumps a texture to TGA | 12 | * Dumps a texture to TGA |
| 14 | * @param filename String filename to dump texture to | 13 | * @param filename String filename to dump texture to |
| @@ -32,9 +31,9 @@ void DumpTGA(std::string filename, int width, int height, u8* raw_data) { | |||
| 32 | fwrite(&hdr, sizeof(TGAHeader), 1, fout); | 31 | fwrite(&hdr, sizeof(TGAHeader), 1, fout); |
| 33 | for (int i = 0; i < height; i++) { | 32 | for (int i = 0; i < height; i++) { |
| 34 | for (int j = 0; j < width; j++) { | 33 | for (int j = 0; j < width; j++) { |
| 35 | r = raw_data[(4 * (i * width)) + (4 * j) + 0]; | 34 | b = raw_data[(3 * (i * width)) + (3 * j) + 0]; |
| 36 | g = raw_data[(4 * (i * width)) + (4 * j) + 1]; | 35 | g = raw_data[(3 * (i * width)) + (3 * j) + 1]; |
| 37 | b = raw_data[(4 * (i * width)) + (4 * j) + 2]; | 36 | r = raw_data[(3 * (i * width)) + (3 * j) + 2]; |
| 38 | putc(b, fout); | 37 | putc(b, fout); |
| 39 | putc(g, fout); | 38 | putc(g, fout); |
| 40 | putc(r, fout); | 39 | putc(r, fout); |
| @@ -42,5 +41,4 @@ void DumpTGA(std::string filename, int width, int height, u8* raw_data) { | |||
| 42 | } | 41 | } |
| 43 | fclose(fout); | 42 | fclose(fout); |
| 44 | } | 43 | } |
| 45 | |||
| 46 | } // namespace | 44 | } // namespace |
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index f2e17f9f9..cbd540bdf 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp | |||
| @@ -30,6 +30,9 @@ void Start() { | |||
| 30 | 30 | ||
| 31 | /// Initialize the video core | 31 | /// Initialize the video core |
| 32 | void Init(EmuWindow* emu_window) { | 32 | void Init(EmuWindow* emu_window) { |
| 33 | // Known problem with GLEW prevents contexts above 2.x on OSX unless glewExperimental is enabled. | ||
| 34 | glewExperimental = GL_TRUE; | ||
| 35 | |||
| 33 | g_emu_window = emu_window; | 36 | g_emu_window = emu_window; |
| 34 | g_emu_window->MakeCurrent(); | 37 | g_emu_window->MakeCurrent(); |
| 35 | g_renderer = new RendererOpenGL(); | 38 | g_renderer = new RendererOpenGL(); |