From 81cb80997ac3e0867c954cedcf3b43e7096d35d0 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 27 Apr 2014 21:49:50 -0400 Subject: add missing bswap functions --- src/common/common.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/common/common.h b/src/common/common.h index 41875785..58de0c7d 100644 --- a/src/common/common.h +++ b/src/common/common.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_ -- cgit v1.2.3 From ff48c8bed3a7329b57f3889b36492f31e6d44700 Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 27 Apr 2014 22:21:46 -0700 Subject: Rect to BasicRect Somewhere along the line an OSX header had already taken the name Rect. --- src/common/common_types.h | 8 ++++---- src/video_core/renderer_opengl/renderer_opengl.cpp | 4 ++-- src/video_core/renderer_opengl/renderer_opengl.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/common_types.h b/src/common/common_types.h index 4289b88d..50cf1873 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h @@ -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/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index b63a73d1..314b1a8e 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 4c0b6e59..cd048017 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 -- cgit v1.2.3 From 48deb456244312940ea127ac8ec57e45f8413992 Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 27 Apr 2014 22:23:01 -0700 Subject: Xcode complains that the class name is redundant. --- src/video_core/renderer_opengl/renderer_opengl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index cd048017..06e602b4 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -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 -- cgit v1.2.3 From b9fc729928ff76b26cc10456bdc68728fc53732c Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 27 Apr 2014 22:23:58 -0700 Subject: Problematic template functions --- src/core/hle/function_wrappers.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 4897d3f2..cab77200 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h @@ -83,15 +83,6 @@ template void WrapU_IV() { RETURN(retval); } -template void WrapF_V() { - RETURNF(func()); -} - -// TODO: Not sure about the floating point parameter passing -template void WrapF_IFU() { - RETURNF(func(PARAM(0), PARAMF(0), PARAM(1))); -} - template void WrapU_U() { u32 retval = func(PARAM(0)); RETURN(retval); @@ -127,12 +118,6 @@ template void WrapI_UU() { RETURN(retval); } -template void WrapI_UFF() { - // Not sure about the float arguments. - int retval = func(PARAM(0), PARAMF(0), PARAMF(1)); - RETURN(retval); -} - template void WrapI_UUU() { int retval = func(PARAM(0), PARAM(1), PARAM(2)); RETURN(retval); -- cgit v1.2.3 From 5741f2fb267daa7b1e8001a19bbd243bd2dc8f26 Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 27 Apr 2014 22:24:39 -0700 Subject: Problematic class with no current implementation --- src/common/chunk_file.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index a4120585..c6a7cee3 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_ -- cgit v1.2.3 From 5749d1eabe9aa016affdc528c06b2a5f6a7f23a4 Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 27 Apr 2014 22:25:30 -0700 Subject: Fix complaints about functions that could not be found --- src/common/common_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/common_types.h b/src/common/common_types.h index 50cf1873..25dc912a 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 { -- cgit v1.2.3 From 5a9c2ce5ea1b272d73001acaf9ec15f1c0e5e041 Mon Sep 17 00:00:00 2001 From: archshift Date: Mon, 28 Apr 2014 19:40:39 -0700 Subject: IT'S ALIVE! --- CMakeLists.txt | 11 +++++++++-- src/citra/CMakeLists.txt | 4 +++- src/citra_qt/CMakeLists.txt | 25 +++++++++++++++++++++++-- src/common/CMakeLists.txt | 40 +++++++++++++++++++++++++++++++++++++++- src/video_core/CMakeLists.txt | 7 ++++++- 5 files changed, 80 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a588fe19..bd21af25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 2.6) project(citra) -SET(GCC_COMPILE_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,11 +12,16 @@ 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) +ENDIF (APPLE) + include_directories(${GLFW_INCLUDE_DIRS}) option(DISABLE_QT4 "Disable Qt4 GUI" OFF) if(NOT DISABLE_QT4) @@ -40,6 +46,7 @@ git_branch_name(GIT_BRANCH) # external includes include_directories(${OPENGL_INCLUDE_DIR}) +include_directories(${GLEW_INCLUDE_DIR}) # internal includes include_directories(src) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 0023da2b..d7478a2d 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}) +add_executable(citra ${SRCS} ${HEADS}) target_link_libraries(citra core common video_core GLEW pthread X11 Xxf86vm Xi ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} rt ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB}) #install(TARGETS citra RUNTIME DESTINATION ${bindir}) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 594460a7..abca202e 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() + +endif() #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 5eaf6736..48f30de4 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/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 56394b93..8d04d381 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}) -- cgit v1.2.3 From 52377cf0d2e29143717898e82f09349d417da1a0 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 29 Apr 2014 19:27:01 -0700 Subject: Some more experimentation --- CMakeLists.txt | 6 +++++- src/citra/CMakeLists.txt | 2 +- src/common/common.h | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd21af25..49c1a384 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6) project(citra) +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") @@ -19,7 +20,10 @@ find_package(OpenGL REQUIRED) pkg_search_module(GLFW REQUIRED glfw3) IF (APPLE) - FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) + 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) include_directories(${GLFW_INCLUDE_DIRS}) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index ca272249..25f47689 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -9,6 +9,6 @@ if (NOT X11_xf86vmode_LIB) endif() add_executable(citra ${SRCS} ${HEADS}) -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 iconv pthread ${COREFOUNDATION_LIBRARY} ${OPENGL_LIBRARIES} ${GLEW_LIBRARY} ${GLFW_LIBRARIES}) #install(TARGETS citra RUNTIME DESTINATION ${bindir}) diff --git a/src/common/common.h b/src/common/common.h index 58de0c7d..30a6761b 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" -- cgit v1.2.3 From a7f3ed003d03c79f83c1c354329e5ce47f6940e7 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 16:56:25 -0700 Subject: A bit of Cmake love --- CMakeLists.txt | 11 +++++++---- src/citra/CMakeLists.txt | 12 ++++++------ src/citra_qt/CMakeLists.txt | 4 ++-- src/core/CMakeLists.txt | 39 ++++++++++++++++++++++++++++++++++++++- 4 files changed, 53 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49c1a384..6837d36f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,14 @@ IF (APPLE) 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) @@ -47,10 +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}) -include_directories(${GLEW_INCLUDE_DIR}) # internal includes include_directories(src) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 25f47689..ee3cb55c 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -3,12 +3,12 @@ set(SRCS citra.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}) -target_link_libraries(citra core common video_core iconv pthread ${COREFOUNDATION_LIBRARY} ${OPENGL_LIBRARIES} ${GLEW_LIBRARY} ${GLFW_LIBRARIES}) + +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_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index abca202e..b06be56f 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -51,9 +51,9 @@ include_directories(./) 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}) + 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/core/CMakeLists.txt b/src/core/CMakeLists.txt index 314f6e64..c8d95ba5 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}) -- cgit v1.2.3 From c1b770cc0db5649c4b9dc52f5e31105b2bc88eb6 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 17:00:36 -0700 Subject: OpenGL 3+ on OSX with GLFW --- src/citra/emu_window/emu_window_glfw.cpp | 9 ++++++++- src/video_core/video_core.cpp | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp index e6943f14..ea1499e7 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/video_core/video_core.cpp b/src/video_core/video_core.cpp index f2e17f9f..4e9cd70b 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(); -- cgit v1.2.3 From 3dad4e3b5cf0e5cc0c52fa28fb055ed98f912915 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 17:10:38 -0700 Subject: Sets OGL version for Qt; will only work with Qt5 --- src/citra_qt/bootmanager.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 31958ac2..52b39eb2 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); -- cgit v1.2.3 From fb47258af76898f9f495e3da1a7db03a724cc9b3 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 18:34:49 -0700 Subject: TGA dumps work, courtesy of @bunnei --- src/citra/citra.cpp | 2 +- src/video_core/renderer_opengl/renderer_opengl.cpp | 2 + src/video_core/utils.cpp | 72 +++++++++++----------- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index d55b9739..458695ca 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -24,7 +24,7 @@ int __cdecl main(int argc, char **argv) { System::Init(emu_window); - std::string boot_filename = "homebrew.elf"; + std::string boot_filename = "/Users/gandrade-air/Downloads/homebrew/yeti3DS-master.elf"; std::string error_str; bool res = Loader::LoadFile(boot_filename, &error_str); diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 314b1a8e..5407c483 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -6,6 +6,7 @@ #include "video_core/video_core.h" #include "video_core/renderer_opengl/renderer_opengl.h" +#include "video_core/utils.h" #include "core/mem_map.h" @@ -49,6 +50,7 @@ void RendererOpenGL::SwapBuffers() { // Switch back to EFB and clear glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[kFramebuffer_EFB]); + VideoCore::DumpTGA("dump.tga", 400, 240, m_xfb_top_flipped); } /** diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp index 67d74a2d..9fcefaad 100644 --- a/src/video_core/utils.cpp +++ b/src/video_core/utils.cpp @@ -8,39 +8,39 @@ #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++) { - r = raw_data[(4 * (i * width)) + (4 * j) + 0]; - g = raw_data[(4 * (i * width)) + (4 * j) + 1]; - b = raw_data[(4 * (i * width)) + (4 * j) + 2]; - putc(b, fout); - putc(g, fout); - putc(r, fout); - } - } - fclose(fout); -} - -} // namespace + + /** + * 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 file -- cgit v1.2.3 From 541c9dffb7ff0b71d0e67b5f4a61ce4b3b89a494 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 18:34:49 -0700 Subject: Unintended change reversal --- src/video_core/utils.cpp | 72 ++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp index 67d74a2d..9fcefaad 100644 --- a/src/video_core/utils.cpp +++ b/src/video_core/utils.cpp @@ -8,39 +8,39 @@ #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++) { - r = raw_data[(4 * (i * width)) + (4 * j) + 0]; - g = raw_data[(4 * (i * width)) + (4 * j) + 1]; - b = raw_data[(4 * (i * width)) + (4 * j) + 2]; - putc(b, fout); - putc(g, fout); - putc(r, fout); - } - } - fclose(fout); -} - -} // namespace + + /** + * 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 file -- cgit v1.2.3 From dade106aa92cd82864aeda2f17ef10da1ed8b49d Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 18:44:48 -0700 Subject: Linux support --- src/citra/CMakeLists.txt | 7 ++++++- src/citra_qt/CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index ee3cb55c..2e4fbe35 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -3,12 +3,17 @@ set(SRCS citra.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}) 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}) + 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_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index b06be56f..3a133554 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} ${GLEW_LIBRARY} ${OPENGL_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}) -- cgit v1.2.3 From 7b1d8045eeff7efded31aa50548e96dcfaba4959 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 19:51:36 -0700 Subject: Fix Travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8bad122b..515dbde4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,11 @@ compiler: before_install: - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get -qq update - - sudo apt-get -qq install g++-4.8 xorg-dev libglu1-mesa-dev libglew-dev libxcursor-dev + - sudo apt-get -qq install g++-4.8 xorg-dev libglu1-mesa-dev libglew-dev libxcursor-dev libglew-dev - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 - git clone https://github.com/glfw/glfw.git - "mkdir glfw/build && cd glfw/build && cmake .. && make && sudo make install ; cd -" script: - mkdir build && cd build - cmake .. - - make -j4 \ No newline at end of file + - make -j4 -- cgit v1.2.3 From 25106ac96ee311e658a55b169eb8df0bb52900ee Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 19:59:38 -0700 Subject: Revert "Fix Travis" This reverts commit 7b1d8045eeff7efded31aa50548e96dcfaba4959. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 515dbde4..8bad122b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,11 @@ compiler: before_install: - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get -qq update - - sudo apt-get -qq install g++-4.8 xorg-dev libglu1-mesa-dev libglew-dev libxcursor-dev libglew-dev + - sudo apt-get -qq install g++-4.8 xorg-dev libglu1-mesa-dev libglew-dev libxcursor-dev - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 - git clone https://github.com/glfw/glfw.git - "mkdir glfw/build && cd glfw/build && cmake .. && make && sudo make install ; cd -" script: - mkdir build && cd build - cmake .. - - make -j4 + - make -j4 \ No newline at end of file -- cgit v1.2.3 From 948cfe6d37558ee3a98649d88655a08774f09e3e Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 20:00:44 -0700 Subject: Reverse debugging changes --- src/citra/citra.cpp | 2 +- src/video_core/renderer_opengl/renderer_opengl.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 458695ca..d55b9739 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -24,7 +24,7 @@ int __cdecl main(int argc, char **argv) { System::Init(emu_window); - std::string boot_filename = "/Users/gandrade-air/Downloads/homebrew/yeti3DS-master.elf"; + std::string boot_filename = "homebrew.elf"; std::string error_str; bool res = Loader::LoadFile(boot_filename, &error_str); diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 5407c483..314b1a8e 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -6,7 +6,6 @@ #include "video_core/video_core.h" #include "video_core/renderer_opengl/renderer_opengl.h" -#include "video_core/utils.h" #include "core/mem_map.h" @@ -50,7 +49,6 @@ void RendererOpenGL::SwapBuffers() { // Switch back to EFB and clear glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[kFramebuffer_EFB]); - VideoCore::DumpTGA("dump.tga", 400, 240, m_xfb_top_flipped); } /** -- cgit v1.2.3 From 704075f04a8adda82141f3c68addfd6c34a08765 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 20:12:01 -0700 Subject: Fixed indents --- src/citra/CMakeLists.txt | 2 +- src/citra/emu_window/emu_window_glfw.cpp | 14 +++---- src/citra_qt/CMakeLists.txt | 2 +- src/citra_qt/bootmanager.cpp | 38 +++++++++--------- src/common/CMakeLists.txt | 2 +- src/core/CMakeLists.txt | 4 +- src/video_core/utils.cpp | 68 ++++++++++++++++---------------- src/video_core/video_core.cpp | 4 +- 8 files changed, 66 insertions(+), 68 deletions(-) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 2e4fbe35..7787d6a7 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.cpp index ea1499e7..73c11637 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 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 3a133554..9d983c0f 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.cpp index 52b39eb2..bd01b78c 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 QGLWidget public: 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 file diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 48f30de4..ae233107 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -45,7 +45,7 @@ set(HEADS atomic.h memory_util.h msg_handler.h platform.h - scm_rev.h + scm_rev.h std_condition_variable.h std_mutex.h std_thread.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c8d95ba5..11b90434 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -50,10 +50,10 @@ set(HEADS core.h arm/mmu/wb.h elf/elf_reader.h elf/elf_types.h - file_sys/directory_file_system.h + file_sys/directory_file_system.h file_sys/file_sys.h file_sys/meta_file_system.h - hle/hle.h + hle/hle.h hle/mrc.h hle/syscall.h hle/function_wrappers.h diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp index 9fcefaad..29382c81 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 file diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 4e9cd70b..5f1933b1 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -30,8 +30,8 @@ void Start() { /// Initialize the video core void Init(EmuWindow* emu_window) { - glewExperimental = GL_TRUE; - + glewExperimental = GL_TRUE; + g_emu_window = emu_window; g_emu_window->MakeCurrent(); g_renderer = new RendererOpenGL(); -- cgit v1.2.3 From 7817d6c79a2c169eb90714c1a05745d208e8ad32 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 30 Apr 2014 23:47:38 -0700 Subject: Support for C++11 on OSX --- CMakeLists.txt | 5 ++--- src/common/common.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6837d36f..07a04c2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,9 +21,8 @@ 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++") + SET(CMAKE_CXX_FLAGS "-stdlib=libc++") + SET(CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++") ENDIF (APPLE) #external includes diff --git a/src/common/common.h b/src/common/common.h index 30a6761b..2578d001 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -25,7 +25,7 @@ #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" -- cgit v1.2.3 From 1e729e7cae237a14067138aaf2b4f5933dba3b36 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 16 May 2014 23:03:10 -0700 Subject: Added FindGLEW to cmake-modules --- CMakeLists.txt | 2 +- externals/cmake-modules/FindGLEW.cmake | 47 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 externals/cmake-modules/FindGLEW.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 07a04c2c..7aa6637d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ add_definitions(-DSINGLETHREADED) add_definitions(${GCC_COMPILE_FLAGS}) # dependency checking +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests) include(FindX11 REQUIRED) find_package(PkgConfig REQUIRED) @@ -48,7 +49,6 @@ if(NOT DISABLE_QT4) endif() # generate git revision information -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules/") include(GetGitRevisionDescription) get_git_head_revision(GIT_REF_SPEC GIT_REV) git_describe(GIT_DESC --always --long --dirty) diff --git a/externals/cmake-modules/FindGLEW.cmake b/externals/cmake-modules/FindGLEW.cmake new file mode 100644 index 00000000..c95d558b --- /dev/null +++ b/externals/cmake-modules/FindGLEW.cmake @@ -0,0 +1,47 @@ +# +# Try to find GLEW library and include path. +# Once done this will define +# +# GLEW_FOUND +# GLEW_INCLUDE_PATH +# GLEW_LIBRARY +# + +IF (WIN32) + FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h + $ENV{PROGRAMFILES}/GLEW/include + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include + DOC "The directory where GL/glew.h resides") + FIND_LIBRARY( GLEW_LIBRARY + NAMES glew GLEW glew32 glew32s + PATHS + $ENV{PROGRAMFILES}/GLEW/lib + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib + DOC "The GLEW library") +ELSE (WIN32) + FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h + /usr/include + /usr/local/include + /sw/include + /opt/local/include + DOC "The directory where GL/glew.h resides") + FIND_LIBRARY( GLEW_LIBRARY + NAMES GLEW glew + PATHS + /usr/lib64 + /usr/lib + /usr/local/lib64 + /usr/local/lib + /sw/lib + /opt/local/lib + DOC "The GLEW library") +ENDIF (WIN32) + +IF (GLEW_INCLUDE_PATH) + SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") +ELSE (GLEW_INCLUDE_PATH) + SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") +ENDIF (GLEW_INCLUDE_PATH) + +MARK_AS_ADVANCED( GLEW_FOUND ) -- cgit v1.2.3 From c1394650ff0ab1859b93505771e14c9afdb8aeb3 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 16 May 2014 23:39:27 -0700 Subject: Updated cmakelists --- src/common/CMakeLists.txt | 1 + src/core/CMakeLists.txt | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index ae233107..0027ae2b 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -22,6 +22,7 @@ set(SRCS break_points.cpp set(HEADS atomic.h atomic_gcc.h atomic_win32.h + bit_field.h break_points.h chunk_file.h common_funcs.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f96f04b1..ddf6bf79 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -49,6 +49,7 @@ set(HEADS core.h mem_map.h system.h arm/disassembler/arm_disasm.h + arm/disassembler/load_symbol_map.h arm/interpreter/arm_interpreter.h arm/interpreter/arm_regformat.h arm/interpreter/armcpu.h @@ -57,18 +58,23 @@ set(HEADS core.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 + arm/interpreter/mmu/arm1176jzf_s_mmu.h + arm/interpreter/mmu/cache.h + arm/interpreter/mmu/rb.h + arm/interpreter/mmu/sa_mmu.h + arm/interpreter/mmu/tlb.h + arm/interpreter/mmu/wb.h + arm/interpreter/vfp/asm_vfp.h + arm/interpreter/vfp/vfp.h + arm/interpreter/vfp/vfp_helper.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/config_mem.h + hle/coprocessor.h hle/hle.h - hle/mrc.h hle/syscall.h hle/function_wrappers.h hle/service/apt.h -- cgit v1.2.3 From c396a5ac576c172951e129f19a987398d53dc95c Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 17 May 2014 10:55:45 -0700 Subject: Fixed vfp issues --- src/core/arm/interpreter/mmu/maverick.cpp | 4 ++-- src/core/arm/interpreter/vfp/vfp_helper.h | 4 ++-- src/core/arm/interpreter/vfp/vfpdouble.cpp | 8 ++++---- src/core/arm/interpreter/vfp/vfpsingle.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/arm/interpreter/mmu/maverick.cpp b/src/core/arm/interpreter/mmu/maverick.cpp index 0e98ef22..adcc2efb 100644 --- a/src/core/arm/interpreter/mmu/maverick.cpp +++ b/src/core/arm/interpreter/mmu/maverick.cpp @@ -86,12 +86,12 @@ static union } reg_conv; static void -printf_nothing (void *foo, ...) +printf_nothing (const char *foo, ...) { } static void -cirrus_not_implemented (char *insn) +cirrus_not_implemented (const char *insn) { fprintf (stderr, "Cirrus instruction '%s' not implemented.\n", insn); 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 80f9a93f..b222e79f 100644 --- a/src/core/arm/interpreter/vfp/vfp_helper.h +++ b/src/core/arm/interpreter/vfp/vfp_helper.h @@ -50,7 +50,7 @@ #define pr_info //printf #define pr_debug //printf -static u32 fls(int x); +static u32 vfp_fls(int x); #define do_div(n, base) {n/=base;} /* From vfpinstr.h */ @@ -508,7 +508,7 @@ struct op { u32 flags; }; -static inline u32 fls(int x) +static u32 vfp_fls(int x) { int r = 32; diff --git a/src/core/arm/interpreter/vfp/vfpdouble.cpp b/src/core/arm/interpreter/vfp/vfpdouble.cpp index cd5b5afa..7f975cbe 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) static void vfp_double_normalise_denormal(struct vfp_double *vd) { - int bits = 31 - fls(vd->significand >> 32); + int bits = 31 - vfp_fls(vd->significand >> 32); if (bits == 31) - bits = 63 - fls(vd->significand); + bits = 63 - vfp_fls(vd->significand); vfp_double_dump("normalise_denormal: in", vd); @@ -108,9 +108,9 @@ u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double *vd, exponent = vd->exponent; significand = vd->significand; - shift = 32 - fls(significand >> 32); + shift = 32 - vfp_fls(significand >> 32); if (shift == 32) - shift = 64 - fls(significand); + shift = 64 - vfp_fls(significand); if (shift) { exponent -= shift; significand <<= shift; diff --git a/src/core/arm/interpreter/vfp/vfpsingle.cpp b/src/core/arm/interpreter/vfp/vfpsingle.cpp index 05279f5c..602713cf 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) static void vfp_single_normalise_denormal(struct vfp_single *vs) { - int bits = 31 - fls(vs->significand); + int bits = 31 - vfp_fls(vs->significand); vfp_single_dump("normalise_denormal: in", vs); @@ -111,7 +111,7 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs, * bit 31, so we have VFP_SINGLE_LOW_BITS + 1 below the least * significant bit. */ - shift = 32 - fls(significand); + shift = 32 - vfp_fls(significand); if (shift < 32 && shift) { exponent -= shift; significand <<= shift; -- cgit v1.2.3 From 603ef89dad8f261464067c0e68c320d5bd595d25 Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 17 May 2014 12:54:38 -0700 Subject: Indent fixes --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7aa6637d..f7ea1949 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ pkg_search_module(GLFW REQUIRED glfw3) IF (APPLE) FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) - SET(CMAKE_CXX_FLAGS "-stdlib=libc++") + SET(CMAKE_CXX_FLAGS "-stdlib=libc++") SET(CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++") ENDIF (APPLE) -- cgit v1.2.3 From b5d2ff9b26560b3f2bfdcd311ada661313eaba83 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 18 May 2014 21:14:37 -0400 Subject: updated Travis-CI image/link in readme for new project repo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 832b647b..04fcefa1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ citra emulator ============== -[![Travis CI Build Status](https://travis-ci.org/bunnei/citra.svg)](https://travis-ci.org/bunnei/citra) +[![Travis CI Build Status](https://travis-ci.org/citra-emu/citra.svg)](https://travis-ci.org/citra-emu/citra) An experimental open-source Nintendo 3DS emulator/debugger written in C++. At this time, it only emulates a very small subset of 3DS hardware, and therefore is only useful for booting/debugging very simple homebrew demos. Citra is licensed under the GPLv2. Refer to the license.txt file included. Please read the [FAQ](https://github.com/bunnei/citra/wiki/FAQ) before getting started with the project. -- cgit v1.2.3 From 71b8789803e801dae6eae081c741523c62e071cd Mon Sep 17 00:00:00 2001 From: archshift Date: Mon, 19 May 2014 13:51:59 -0700 Subject: Indent fixes --- CMakeLists.txt | 2 +- externals/cmake-modules/FindGLEW.cmake | 58 +++++++++++++++---------------- src/video_core/utils.cpp | 62 +++++++++++++++++----------------- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7ea1949..b4665640 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ pkg_search_module(GLFW REQUIRED glfw3) IF (APPLE) FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) SET(CMAKE_CXX_FLAGS "-stdlib=libc++") - SET(CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++") + SET(CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++") ENDIF (APPLE) #external includes diff --git a/externals/cmake-modules/FindGLEW.cmake b/externals/cmake-modules/FindGLEW.cmake index c95d558b..105e30eb 100644 --- a/externals/cmake-modules/FindGLEW.cmake +++ b/externals/cmake-modules/FindGLEW.cmake @@ -8,40 +8,40 @@ # IF (WIN32) - FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h - $ENV{PROGRAMFILES}/GLEW/include - ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include - DOC "The directory where GL/glew.h resides") - FIND_LIBRARY( GLEW_LIBRARY - NAMES glew GLEW glew32 glew32s - PATHS - $ENV{PROGRAMFILES}/GLEW/lib - ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin - ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib - DOC "The GLEW library") + FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h + $ENV{PROGRAMFILES}/GLEW/include + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include + DOC "The directory where GL/glew.h resides") + FIND_LIBRARY( GLEW_LIBRARY + NAMES glew GLEW glew32 glew32s + PATHS + $ENV{PROGRAMFILES}/GLEW/lib + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib + DOC "The GLEW library") ELSE (WIN32) - FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h - /usr/include - /usr/local/include - /sw/include - /opt/local/include - DOC "The directory where GL/glew.h resides") - FIND_LIBRARY( GLEW_LIBRARY - NAMES GLEW glew - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - DOC "The GLEW library") + FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h + /usr/include + /usr/local/include + /sw/include + /opt/local/include + DOC "The directory where GL/glew.h resides") + FIND_LIBRARY( GLEW_LIBRARY + NAMES GLEW glew + PATHS + /usr/lib64 + /usr/lib + /usr/local/lib64 + /usr/local/lib + /sw/lib + /opt/local/lib + DOC "The GLEW library") ENDIF (WIN32) IF (GLEW_INCLUDE_PATH) - SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") + SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") ELSE (GLEW_INCLUDE_PATH) - SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") + SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") ENDIF (GLEW_INCLUDE_PATH) MARK_AS_ADVANCED( GLEW_FOUND ) diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp index 29382c81..a90fc183 100644 --- a/src/video_core/utils.cpp +++ b/src/video_core/utils.cpp @@ -8,37 +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); - } +/** + * 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); } + fclose(fout); +} } // namespace \ No newline at end of file -- cgit v1.2.3 From 403e4bf837c47c7e10dc006fafffea8c160c890f Mon Sep 17 00:00:00 2001 From: archshift Date: Mon, 19 May 2014 15:19:36 -0700 Subject: CMakeLists: rename HEADS, improved comments Changes for clarity of comments, removed redundant compiler flags. --- CMakeLists.txt | 5 ++--- src/citra/CMakeLists.txt | 4 ++-- src/citra_qt/CMakeLists.txt | 4 ++-- src/common/CMakeLists.txt | 4 ++-- src/core/CMakeLists.txt | 4 ++-- src/video_core/CMakeLists.txt | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4665640..76190c5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,6 @@ cmake_minimum_required(VERSION 2.6) project(citra) 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) @@ -20,6 +18,7 @@ find_package(GLEW REQUIRED) find_package(OpenGL REQUIRED) pkg_search_module(GLFW REQUIRED glfw3) +# corefoundation is required only on OSX IF (APPLE) FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) SET(CMAKE_CXX_FLAGS "-stdlib=libc++") @@ -31,7 +30,7 @@ include_directories(${GLFW_INCLUDE_DIRS}) include_directories(${OPENGL_INCLUDE_DIR}) include_directories(${GLEW_INCLUDE_DIR}) -#use pkg_search_module library dirs +# workaround for GLFW linking on OSX link_directories(${GLFW_LIBRARY_DIRS}) option(DISABLE_QT4 "Disable Qt4 GUI" OFF) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 7787d6a7..1ad607d7 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -1,6 +1,6 @@ set(SRCS citra.cpp emu_window/emu_window_glfw.cpp) -set(HEADS citra.h +set(HEADERS citra.h resource.h) # NOTE: This is a workaround for CMake bug 0006976 (missing X11_xf86vmode_LIB variable) @@ -8,7 +8,7 @@ if (NOT X11_xf86vmode_LIB) set(X11_xv86vmode_LIB Xxf86vm) endif() -add_executable(citra ${SRCS} ${HEADS}) +add_executable(citra ${SRCS} ${HEADERS}) if (APPLE) target_link_libraries(citra core common video_core iconv pthread ${COREFOUNDATION_LIBRARY} ${OPENGL_LIBRARIES} ${GLEW_LIBRARY} ${GLFW_LIBRARIES}) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 9d983c0f..549f6921 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -8,7 +8,7 @@ set(SRCS main.cpp config/controller_config.cpp config/controller_config_util.cpp) -set (HEADS +set (HEADERS bootmanager.hxx debugger/callstack.hxx debugger/disassembler.hxx @@ -49,7 +49,7 @@ qt4_wrap_cpp(MOC_SRCS include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(./) -add_executable(citra-qt ${SRCS} ${HEADS} ${MOC_SRCS} ${UI_HDRS}) +add_executable(citra-qt ${SRCS} ${HEADERS} ${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() diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 0027ae2b..aae18339 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -19,7 +19,7 @@ set(SRCS break_points.cpp timer.cpp utf8.cpp) -set(HEADS atomic.h +set(HEADERS atomic.h atomic_gcc.h atomic_win32.h bit_field.h @@ -58,4 +58,4 @@ set(HEADS atomic.h timer.h utf8.h) -add_library(common STATIC ${SRCS} ${HEADS}) +add_library(common STATIC ${SRCS} ${HEADERS}) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ddf6bf79..14c598bf 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -43,7 +43,7 @@ set(SRCS core.cpp hw/lcd.cpp hw/ndma.cpp) -set(HEADS core.h +set(HEADERS core.h core_timing.h loader.h mem_map.h @@ -86,4 +86,4 @@ set(HEADS core.h hw/lcd.h hw/ndma.h) -add_library(core STATIC ${SRCS} ${HEADS}) +add_library(core STATIC ${SRCS} ${HEADERS}) diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 8d04d381..e43e6e1b 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -2,9 +2,9 @@ set(SRCS video_core.cpp utils.cpp renderer_opengl/renderer_opengl.cpp) -set(HEADS video_core.h +set(HEADERS video_core.h utils.h renderer_base.h renderer_opengl/renderer_opengl.h) -add_library(video_core STATIC ${SRCS} ${HEADS}) +add_library(video_core STATIC ${SRCS} ${HEADERS}) -- cgit v1.2.3 From 034e3aabc81219ca3804bfa6483d6667c3ab5679 Mon Sep 17 00:00:00 2001 From: archshift Date: Mon, 19 May 2014 15:21:55 -0700 Subject: Improved clarity and whitespace Changed QGL version to 3,2 in order to be less restrictive, yet it should still change up to 4,1 on OSX on Qt5. --- src/citra_qt/bootmanager.cpp | 2 +- src/common/chunk_file.h | 1 + src/video_core/utils.cpp | 6 +++--- src/video_core/video_core.cpp | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index bd01b78c..7089b9f9 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -104,7 +104,7 @@ 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.setVersion(3,2); fmt.setSampleBuffers(true); fmt.setSamples(4); diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index c6a7cee3..8c9f839d 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -654,6 +654,7 @@ inline PointerWrapSection::~PointerWrapSection() { } +// Commented out because it is currently unused, and breaks builds on OSX /*class CChunkFileReader { public: diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp index a90fc183..b94376ac 100644 --- a/src/video_core/utils.cpp +++ b/src/video_core/utils.cpp @@ -20,13 +20,13 @@ 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++) { @@ -41,4 +41,4 @@ void DumpTGA(std::string filename, int width, int height, u8* raw_data) { } fclose(fout); } -} // namespace \ No newline at end of file +} // namespace diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 5f1933b1..cbd540bd 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -30,6 +30,7 @@ void Start() { /// Initialize the video core void Init(EmuWindow* emu_window) { + // Known problem with GLEW prevents contexts above 2.x on OSX unless glewExperimental is enabled. glewExperimental = GL_TRUE; g_emu_window = emu_window; -- cgit v1.2.3 From 9216c96f48b498788b78739655b64caf95307fe3 Mon Sep 17 00:00:00 2001 From: archshift Date: Mon, 19 May 2014 16:33:23 -0700 Subject: CMakeLists: Fixed GLEW include var name, compile flag vars After adding FindGLEW.cmake to externals, the variable call for the GLEW include path needed to be revised. Append flags on OSX, rather than overwrite them. I realized that GCC_COMPILE_FLAGS was changed to CMAKE_CXX_FLAGS mistakenly, so both were changed to a more platform-independent name. --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76190c5e..114e3920 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 2.6) project(citra) -SET(CMAKE_CXX_FLAGS "-std=c++11 -fpermissive") +SET(CXX_COMPILE_FLAGS "-std=c++11 -fpermissive") # silence some spam add_definitions(-Wno-attributes) add_definitions(-DSINGLETHREADED) -add_definitions(${GCC_COMPILE_FLAGS}) +add_definitions(${CXX_COMPILE_FLAGS}) # dependency checking list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules/") @@ -21,14 +21,14 @@ pkg_search_module(GLFW REQUIRED glfw3) # corefoundation is required only on OSX IF (APPLE) FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) - SET(CMAKE_CXX_FLAGS "-stdlib=libc++") - SET(CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") ENDIF (APPLE) #external includes include_directories(${GLFW_INCLUDE_DIRS}) include_directories(${OPENGL_INCLUDE_DIR}) -include_directories(${GLEW_INCLUDE_DIR}) +include_directories(${GLEW_INCLUDE_PATH}) # workaround for GLFW linking on OSX link_directories(${GLFW_LIBRARY_DIRS}) -- cgit v1.2.3 From 5a8ed196e6e9416134a85fbc7da14fed3af307e4 Mon Sep 17 00:00:00 2001 From: archshift Date: Mon, 19 May 2014 17:57:35 -0700 Subject: common_types: Changed BasicRect back to Rect, in the common namespace Only Rect is in the namespace for now; the rest of common should be added in the future --- src/common/common_types.h | 10 ++++++---- src/video_core/renderer_opengl/renderer_opengl.cpp | 4 ++-- src/video_core/renderer_opengl/renderer_opengl.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/common/common_types.h b/src/common/common_types.h index 25dc912a..40241050 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h @@ -100,16 +100,17 @@ union t128 { __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers) }; +namespace common { /// Rectangle data structure -class BasicRect { +class Rect { public: - BasicRect(int x0=0, int y0=0, int x1=0, int y1=0) { + Rect(int x0=0, int y0=0, int x1=0, int y1=0) { x0_ = x0; y0_ = y0; x1_ = x1; y1_ = y1; } - ~BasicRect() { } + ~Rect() { } int x0_; ///< Rect top left X-coordinate int y0_; ///< Rect top left Y-coordinate @@ -119,7 +120,8 @@ public: inline u32 width() const { return abs(x1_ - x0_); } inline u32 height() const { return abs(y1_ - y0_); } - inline bool operator == (const BasicRect& val) const { + inline bool operator == (const Rect& val) const { return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); } }; +} diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index f2e809b1..bb5eb34a 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. - BasicRect framebuffer_size(0, 0, m_resolution_width, m_resolution_height); + common::Rect framebuffer_size(0, 0, m_resolution_width, m_resolution_height); RenderXFB(framebuffer_size, framebuffer_size); // XFB->Window copy @@ -75,7 +75,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 BasicRect& src_rect, const BasicRect& dst_rect) { +void RendererOpenGL::RenderXFB(const common::Rect& src_rect, const common::Rect& 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 06e602b4..dd811cad 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 BasicRect& src_rect, const BasicRect& dst_rect); + void RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect); /** * Set the emulator window to use for renderer -- cgit v1.2.3