diff options
-rw-r--r-- | CMakeLists.txt | 24 | ||||
-rw-r--r-- | src/citra/CMakeLists.txt | 14 | ||||
-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 | 16 | ||||
-rw-r--r-- | src/common/CMakeLists.txt | 40 | ||||
-rw-r--r-- | src/common/chunk_file.h | 4 | ||||
-rw-r--r-- | src/common/common.h | 50 | ||||
-rw-r--r-- | src/common/common_types.h | 10 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 39 | ||||
-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/video_core.cpp | 2 |
15 files changed, 211 insertions, 52 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a588fe193..6837d36fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 2.6) project(citra) -SET(GCC_COMPILE_FLAGS "-std=c++11 -fpermissive") +SET(CMAKE_CXX_FLAGS "-std=c++11 -fpermissive") +SET(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -fpermissive") +SET(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fpermissive") # silence some spam add_definitions(-Wno-attributes) @@ -11,12 +13,27 @@ add_definitions(${GCC_COMPILE_FLAGS}) # dependency checking set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests) -include(FindOpenGL REQUIRED) include(FindX11 REQUIRED) find_package(PkgConfig REQUIRED) +find_package(GLEW REQUIRED) +find_package(OpenGL REQUIRED) pkg_search_module(GLFW REQUIRED glfw3) +IF (APPLE) + FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) + SET(CMAKE_CXX_FLAGS "-stdlib=libc++") + SET(CMAKE_CXX_FLAGS_DEBUG "-stdlib=libc++") + SET(CMAKE_CXX_FLAGS_RELEASE "-stdlib=libc++") +ENDIF (APPLE) + +#external includes include_directories(${GLFW_INCLUDE_DIRS}) +include_directories(${OPENGL_INCLUDE_DIR}) +include_directories(${GLEW_INCLUDE_DIR}) + +#use pkg_search_module library dirs +link_directories(${GLFW_LIBRARY_DIRS}) + option(DISABLE_QT4 "Disable Qt4 GUI" OFF) if(NOT DISABLE_QT4) include(FindQt4) @@ -37,9 +54,6 @@ include(GetGitRevisionDescription) get_git_head_revision(GIT_REF_SPEC GIT_REV) git_describe(GIT_DESC --always --long --dirty) git_branch_name(GIT_BRANCH) - -# external includes -include_directories(${OPENGL_INCLUDE_DIR}) # internal includes include_directories(src) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 147f51e94..ee3cb55cf 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -1,12 +1,14 @@ set(SRCS citra.cpp emu_window/emu_window_glfw.cpp) +set(HEADS citra.h + resource.h) -# NOTE: This is a workaround for CMake bug 0006976 (missing X11_xf86vmode_LIB variable) -if (NOT X11_xf86vmode_LIB) - set(X11_xv86vmode_LIB Xxf86vm) -endif() +add_executable(citra ${SRCS} ${HEADS}) -add_executable(citra ${SRCS}) -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}) +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 pthread ${OPENGL_LIBRARIES} ${GLEW_LIBRARY} ${GLFW_LIBRARIES}) +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.cpp index e6943f146..ea1499e7c 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() { exit(1); } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); + 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); + } + // Setup callbacks glfwSetWindowUserPointer(m_render_window, this); //glfwSetKeyCallback(m_render_window, OnKeyEvent); diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 594460a71..b06be56fe 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -8,6 +8,23 @@ set(SRCS main.cpp config/controller_config.cpp config/controller_config_util.cpp) +set (HEADS + bootmanager.hxx + debugger/callstack.hxx + debugger/disassembler.hxx + debugger/ramview.hxx + debugger/registers.hxx + hotkeys.hxx + main.hxx + ui_callstack.h + ui_controller_config.h + ui_disassembler.h + ui_hotkeys.h + ui_main.h + ui_registers.h + version.h + config/controller_config.hxx + config/controller_config_util.hxx) qt4_wrap_ui(UI_HDRS debugger/callstack.ui @@ -32,7 +49,11 @@ qt4_wrap_cpp(MOC_SRCS include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(./) -add_executable(citra-qt ${SRCS} ${MOC_SRCS} ${UI_HDRS}) -target_link_libraries(citra-qt core common video_core qhexedit ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} rt GLEW ${GLFW_LIBRARIES}) +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} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES}) +endif() #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 31958ac28..52b39eb27 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -73,11 +73,10 @@ void EmuThread::Stop() class GGLWidgetInternal : public QGLWidget { public: - GGLWidgetInternal(GRenderWindow* parent) : QGLWidget(parent) + GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) : QGLWidget(parent) { - setAutoBufferSwap(false); - doneCurrent(); - parent_ = parent; + doneCurrent(); + parent_ = parent; } void paintEvent(QPaintEvent* ev) @@ -103,8 +102,13 @@ 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 - - child = new GGLWidgetInternal(this); + 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); layout->addWidget(child); diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 5eaf67365..48f30de4c 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -19,4 +19,42 @@ set(SRCS break_points.cpp timer.cpp utf8.cpp) -add_library(common STATIC ${SRCS}) +set(HEADS atomic.h + atomic_gcc.h + atomic_win32.h + break_points.h + chunk_file.h + common_funcs.h + common_paths.h + common_types.h + common.h + console_listener.h + cpu_detect.h + debug_interface.h + emu_window.h + extended_trace.h + fifo_queue.h + file_search.h + file_util.h + hash.h + linear_disk_cache.h + log_manager.h + log.h + math_util.h + mem_arena.h + memory_util.h + msg_handler.h + platform.h + scm_rev.h + std_condition_variable.h + std_mutex.h + std_thread.h + string_util.h + swap.h + symbols.h + thread.h + thunk.h + timer.h + utf8.h) + +add_library(common STATIC ${SRCS} ${HEADS}) diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index a41205857..c6a7cee35 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -654,7 +654,7 @@ inline PointerWrapSection::~PointerWrapSection() { } -class CChunkFileReader +/*class CChunkFileReader { public: enum Error { @@ -869,6 +869,6 @@ private: int UncompressedSize; char GitVersion[32]; }; -}; +}; */ #endif // _POINTERWRAP_H_ diff --git a/src/common/common.h b/src/common/common.h index 418757855..30a6761b7 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -21,11 +21,11 @@ #define STACKALIGN -#if __cplusplus >= 201103 || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__) +#if __cplusplus >= 201103L || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__) #define HAVE_CXX11_SYNTAX 1 #endif -#if HAVE_CXX11_SYNTAX +//#if HAVE_CXX11_SYNTAX // An inheritable class to disallow the copy constructor and operator= functions class NonCopyable { @@ -37,7 +37,7 @@ private: NonCopyable(NonCopyable&); NonCopyable& operator=(NonCopyable& other); }; -#endif +//#endif #include "common/log.h" #include "common/common_types.h" @@ -159,4 +159,48 @@ enum EMUSTATE_CHANGE EMUSTATE_CHANGE_STOP }; + +#ifdef _MSC_VER +#ifndef _XBOX +inline unsigned long long bswap64(unsigned long long x) { return _byteswap_uint64(x); } +inline unsigned int bswap32(unsigned int x) { return _byteswap_ulong(x); } +inline unsigned short bswap16(unsigned short x) { return _byteswap_ushort(x); } +#else +inline unsigned long long bswap64(unsigned long long x) { return __loaddoublewordbytereverse(0, &x); } +inline unsigned int bswap32(unsigned int x) { return __loadwordbytereverse(0, &x); } +inline unsigned short bswap16(unsigned short x) { return __loadshortbytereverse(0, &x); } +#endif +#else +// TODO: speedup +inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); } +inline unsigned int bswap32(unsigned int x) { return (x >> 24) | ((x & 0xFF0000) >> 8) | ((x & 0xFF00) << 8) | (x << 24);} +inline unsigned long long bswap64(unsigned long long x) {return ((unsigned long long)bswap32(x) << 32) | bswap32(x >> 32); } +#endif + +inline float bswapf(float f) { + union { + float f; + unsigned int u32; + } dat1, dat2; + + dat1.f = f; + dat2.u32 = bswap32(dat1.u32); + + return dat2.f; +} + +inline double bswapd(double f) { + union { + double f; + unsigned long long u64; + } dat1, dat2; + + dat1.f = f; + dat2.u64 = bswap64(dat1.u64); + + return dat2.f; +} + +#include "swap.h" + #endif // _COMMON_H_ diff --git a/src/common/common_types.h b/src/common/common_types.h index 4289b88d3..25dc912a9 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 typedef float f32; ///< 32-bit floating point typedef double f64; ///< 64-bit floating point -#include "common/swap.h" +#include "common/common.h" /// Union for fast 16-bit type casting union t16 { @@ -101,15 +101,15 @@ union t128 { }; /// Rectangle data structure -class Rect { +class BasicRect { public: - Rect(int x0=0, int y0=0, int x1=0, int y1=0) { + BasicRect(int x0=0, int y0=0, int x1=0, int y1=0) { x0_ = x0; y0_ = y0; x1_ = x1; y1_ = y1; } - ~Rect() { } + ~BasicRect() { } int x0_; ///< Rect top left X-coordinate int y0_; ///< Rect top left Y-coordinate @@ -119,7 +119,7 @@ public: inline u32 width() const { return abs(x1_ - x0_); } inline u32 height() const { return abs(y1_ - y0_); } - inline bool operator == (const Rect& val) const { + inline bool operator == (const BasicRect& val) const { return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); } }; diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 314f6e64c..c8d95ba5d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -29,4 +29,41 @@ set(SRCS core.cpp hw/lcd.cpp hw/ndma.cpp) -add_library(core STATIC ${SRCS}) +set(HEADS core.h + core_timing.h + loader.h + mem_map.h + system.h + arm/disassembler/arm_disasm.h + arm/interpreter/arm_interpreter.h + arm/interpreter/arm_regformat.h + arm/interpreter/armcpu.h + arm/interpreter/armdefs.h + arm/interpreter/armemu.h + arm/interpreter/armmmu.h + arm/interpreter/armos.h + arm/interpreter/skyeye_defs.h + arm/mmu/arm1176jzf_s_mmu.h + arm/mmu/cache.h + arm/mmu/rb.h + arm/mmu/tlb.h + arm/mmu/wb.h + elf/elf_reader.h + elf/elf_types.h + file_sys/directory_file_system.h + file_sys/file_sys.h + file_sys/meta_file_system.h + hle/hle.h + hle/mrc.h + hle/syscall.h + hle/function_wrappers.h + hle/service/apt.h + hle/service/gsp.h + hle/service/hid.h + hle/service/service.h + hle/service/srv.h + hw/hw.h + hw/lcd.h + hw/ndma.h) + +add_library(core STATIC ${SRCS} ${HEADS}) diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 4897d3f28..cab772004 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() { RETURN(retval); } -template<float func()> void WrapF_V() { - RETURNF(func()); -} - -// TODO: Not sure about the floating point parameter passing -template<float func(int, float, u32)> void WrapF_IFU() { - RETURNF(func(PARAM(0), PARAMF(0), PARAM(1))); -} - template<u32 func(u32)> void WrapU_U() { u32 retval = func(PARAM(0)); RETURN(retval); @@ -127,12 +118,6 @@ template<int func(u32, u32)> void WrapI_UU() { RETURN(retval); } -template<int func(u32, float, float)> void WrapI_UFF() { - // Not sure about the float arguments. - int retval = func(PARAM(0), PARAMF(0), PARAMF(1)); - RETURN(retval); -} - template<int func(u32, u32, u32)> void WrapI_UUU() { int retval = func(PARAM(0), PARAM(1), PARAM(2)); RETURN(retval); diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 56394b930..8d04d381c 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -2,4 +2,9 @@ set(SRCS video_core.cpp utils.cpp renderer_opengl/renderer_opengl.cpp) -add_library(video_core STATIC ${SRCS}) +set(HEADS video_core.h + utils.h + renderer_base.h + renderer_opengl/renderer_opengl.h) + +add_library(video_core STATIC ${SRCS} ${HEADS}) diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index b63a73d18..314b1a8ed 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() { // EFB->XFB copy // TODO(bunnei): This is a hack and does not belong here. The copy should be triggered by some // register write We're also treating both framebuffers as a single one in OpenGL. - Rect framebuffer_size(0, 0, m_resolution_width, m_resolution_height); + BasicRect framebuffer_size(0, 0, m_resolution_width, m_resolution_height); RenderXFB(framebuffer_size, framebuffer_size); // XFB->Window copy @@ -76,7 +76,7 @@ void RendererOpenGL::FlipFramebuffer(const u8* in, u8* out) { * @param src_rect Source rectangle in XFB to copy * @param dst_rect Destination rectangle in output framebuffer to copy to */ -void RendererOpenGL::RenderXFB(const Rect& src_rect, const Rect& dst_rect) { +void RendererOpenGL::RenderXFB(const BasicRect& src_rect, const BasicRect& dst_rect) { FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_top_left_1), m_xfb_top_flipped); 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..06e602b46 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -28,7 +28,7 @@ public: * @param src_rect Source rectangle in XFB to copy * @param dst_rect Destination rectangle in output framebuffer to copy to */ - void RenderXFB(const Rect& src_rect, const Rect& dst_rect); + void RenderXFB(const BasicRect& src_rect, const BasicRect& dst_rect); /** * Set the emulator window to use for renderer @@ -59,7 +59,7 @@ private: * @param out Pointer to output buffer with flipped framebuffer * @todo Early on hack... I'd like to find a more efficient way of doing this /bunnei */ - void RendererOpenGL::FlipFramebuffer(const u8* in, u8* out); + void FlipFramebuffer(const u8* in, u8* out); EmuWindow* m_render_window; ///< Handle to render window diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index f2e17f9f9..4e9cd70bc 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -30,6 +30,8 @@ void Start() { /// Initialize the video core void Init(EmuWindow* emu_window) { + glewExperimental = GL_TRUE; + g_emu_window = emu_window; g_emu_window->MakeCurrent(); g_renderer = new RendererOpenGL(); |