Permalink
Browse files

merged with upstream / amended SDL2 multi monitor support

  • Loading branch information...
1 parent fadedee commit ce5edeb5897f2472791e837f3617f44db3c8e213 @beaumanvienna beaumanvienna committed Oct 15, 2014
Showing with 14,508 additions and 2,438 deletions.
  1. +14 −0 .gitattributes
  2. +6 −3 .travis.yml
  3. +5 −3 Blackberry/bar-descriptor.xml
  4. +27 −7 CMakeLists.txt
  5. +180 −0 CMakeTests/FindSDL2.cmake
  6. +43 −0 Common/CPUDetect.cpp
  7. +5 −0 Common/CPUDetect.h
  8. +2 −1 Common/CommonFuncs.h
  9. +23 −7 Common/Misc.cpp
  10. +826 −476 Common/x64Emitter.cpp
  11. +291 −150 Common/x64Emitter.h
  12. +13 −0 Core/Core.vcxproj
  13. +42 −0 Core/Core.vcxproj.filters
  14. +2 −2 Core/Debugger/DisassemblyManager.cpp
  15. +3 −2 Core/Dialog/PSPMsgDialog.cpp
  16. +2 −1 Core/Dialog/PSPMsgDialog.h
  17. +6 −6 Core/Dialog/PSPSaveDialog.cpp
  18. +2 −0 Core/Dialog/PSPSaveDialog.h
  19. +12 −19 Core/Dialog/SavedataParam.cpp
  20. +2 −1 Core/Dialog/SavedataParam.h
  21. +96 −0 Core/HLE/ReplaceTables.cpp
  22. +305 −121 Core/HLE/sceAtrac.cpp
  23. +2 −2 Core/HLE/sceAtrac.h
  24. +212 −212 Core/HLE/sceAudiocodec.cpp
  25. +7 −2 Core/HLE/sceFont.cpp
  26. +1 −3 Core/HLE/sceKernelThread.cpp
  27. +1 −1 Core/HLE/sceSas.cpp
  28. +2 −0 Core/HLE/sceUtility.cpp
  29. +3 −3 Core/HW/SasAudio.cpp
  30. +1 −1 Core/HW/SasAudio.h
  31. +5 −5 Core/MIPS/ARM/ArmAsm.cpp
  32. +125 −80 Core/MIPS/ARM/ArmCompBranch.cpp
  33. +7 −6 Core/MIPS/ARM/ArmCompFPU.cpp
  34. +0 −2 Core/MIPS/ARM/ArmCompVFPU.cpp
  35. +86 −20 Core/MIPS/ARM/ArmJit.cpp
  36. +5 −2 Core/MIPS/ARM/ArmJit.h
  37. +97 −25 Core/MIPS/JitCommon/JitBlockCache.cpp
  38. +6 −1 Core/MIPS/JitCommon/JitBlockCache.h
  39. +8 −1 Core/MIPS/JitCommon/JitState.h
  40. +0 −25 Core/MIPS/MIPS.cpp
  41. +7 −10 Core/MIPS/MIPS.h
  42. +32 −19 Core/MIPS/MIPSAnalyst.cpp
  43. +3 −2 Core/MIPS/MIPSAnalyst.h
  44. +46 −35 Core/MIPS/MIPSInt.cpp
  45. +51 −55 Core/MIPS/MIPSTables.cpp
  46. +56 −41 Core/MIPS/MIPSTables.h
  47. +2 −2 Core/MIPS/PPC/PpcCompVFPU.cpp
  48. +10 −7 Core/MIPS/x86/Asm.cpp
  49. +14 −8 Core/MIPS/x86/CompALU.cpp
  50. +92 −42 Core/MIPS/x86/CompBranch.cpp
  51. +6 −4 Core/MIPS/x86/CompFPU.cpp
  52. +1 −1 Core/MIPS/x86/CompLoadStore.cpp
  53. +12 −8 Core/MIPS/x86/CompVFPU.cpp
  54. +113 −44 Core/MIPS/x86/Jit.cpp
  55. +25 −3 Core/MIPS/x86/Jit.h
  56. +6 −0 Core/MIPS/x86/JitSafeMem.cpp
  57. +6 −5 Core/MIPS/x86/RegCache.cpp
  58. +6 −0 Core/MIPS/x86/RegCache.h
  59. +2 −1 Core/MIPS/x86/RegCacheFPU.cpp
  60. +37 −3 Core/Reporting.cpp
  61. +3 −0 Core/Reporting.h
  62. +240 −240 GPU/Common/DrawEngineCommon.cpp
  63. +42 −42 GPU/Common/DrawEngineCommon.h
  64. +0 −7 GPU/Common/VertexDecoderX86.cpp
  65. +0 −6 GPU/Directx9/GPU_DX9.cpp
  66. +40 −1 GPU/Directx9/PixelShaderGeneratorDX9.cpp
  67. +1 −1 GPU/Directx9/ShaderManagerDX9.cpp
  68. +95 −35 GPU/Directx9/StateMappingDX9.cpp
  69. +2 −1 GPU/Directx9/TransformPipelineDX9.h
  70. +27 −23 GPU/Directx9/helper/global.cpp
  71. +1 −1 GPU/Directx9/helper/global.h
  72. +43 −1 GPU/GLES/FragmentShaderGenerator.cpp
  73. +94 −35 GPU/GLES/StateMapping.cpp
  74. +2 −1 GPU/GLES/TransformPipeline.h
  75. +7 −6 GPU/GLES/VertexShaderGenerator.cpp
  76. +4 −2 GPU/GPUCommon.cpp
  77. +6 −0 Qt/Native.pro
  78. +2 −2 Qt/PPSSPP.pro
  79. +1 −4 Qt/mainwindow.cpp
  80. +2 −6 SDL/SDLJoystick.cpp
  81. +1 −1 UI/ControlMappingScreen.cpp
  82. +22 −1 UI/DevScreens.cpp
  83. +12 −0 UI/MainScreen.cpp
  84. +1 −0 UI/MainScreen.h
  85. +4 −0 UI/NativeApp.cpp
  86. +185 −0 UI/ReportScreen.cpp
  87. +41 −0 UI/ReportScreen.h
  88. +2 −0 UI/UI.vcxproj
  89. +7 −0 UI/UI.vcxproj.filters
  90. +203 −195 Windows/D3D9Base.cpp
  91. +1 −1 Windows/Debugger/CtrlDisAsmView.cpp
  92. +31 −3 Windows/EmuThread.cpp
  93. +1 −1 Windows/OpenGLBase.cpp
  94. +336 −336 Windows/resource.h
  95. +9 −1 android/jni/Android.mk
  96. +2 −1 android/jni/Locals.mk
  97. +1 −0 assets/langregion.ini
  98. +22 −0 ext/udis86/LICENSE
  99. +1,265 −0 ext/udis86/decode.c
  100. +197 −0 ext/udis86/decode.h
  101. +113 −0 ext/udis86/extern.h
  102. +5,937 −0 ext/udis86/itab.c
  103. +935 −0 ext/udis86/itab.h
  104. +228 −0 ext/udis86/syn-att.c
  105. +224 −0 ext/udis86/syn-intel.c
  106. +212 −0 ext/udis86/syn.c
  107. +53 −0 ext/udis86/syn.h
  108. +259 −0 ext/udis86/types.h
  109. +93 −0 ext/udis86/udint.h
  110. +456 −0 ext/udis86/udis86.c
  111. +33 −0 ext/udis86/udis86.h
  112. +4 −2 ios/ViewController.mm
  113. +2 −0 ios/ios.toolchain.cmake
  114. +1 −1 lang
  115. +1 −1 native
View
@@ -0,0 +1,14 @@
+*.cpp text diff=cpp
+*.h text diff=cpp
+*.mm text diff=objc
+*.m text diff=objc
+*.java text diff=java
+*.sh text eol=lf
+*.vcproj text eol=crlf
+*.vcproj.filters text eol=crlf
+*.sln text eol=crlf
+*.properties text
+*.xml text
+
+# To avoid mucking up the utf-8 characters.
+Core/Dialog/PSPOskDialog.cpp binary
View
@@ -35,10 +35,13 @@ before_install:
install:
# Ubuntu Linux + GCC 4.8
- if [ "$PPSSPP_BUILD_TYPE" == "Linux" ]; then
- sudo apt-get install libsdl1.2-dev -qq &&
+ sudo add-apt-repository ppa:zoogie/sdl2-snapshots -y &&
+ if [[ "$CXX" == g++ ]]; then
+ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y;
+ fi;
+ sudo apt-get update &&
+ sudo apt-get install libsdl2-dev -qq &&
if [[ "$CXX" == g++ ]]; then
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y &&
- sudo apt-get update &&
sudo apt-get install g++-4.8 -qq &&
export CXX="g++-4.8" CC="gcc-4.8";
fi;
@@ -18,9 +18,11 @@
<asset path="PPSSPPBlackberry" entry="true" type="Qnx/Elf">PPSSPPBlackberry</asset>
<asset path="../assets/icon-114.png">icon-114.png</asset>
- <asset path="../android/assets">assets</asset>
- <asset path="../assets/langregion.ini">assets/langregion.ini</asset>
- <asset path="../assets/shaders">assets/shaders</asset>
+ <asset path="../assets" dest="assets">
+ <include name="*.png"/>
+ <include name="*.ini"/>
+ <include name="*atlas.zim"/>
+ </asset>
<asset path="../lang">assets/lang</asset>
<asset path="../flash0">assets/flash0</asset>
View
@@ -2,6 +2,7 @@
cmake_minimum_required(VERSION 2.8.8)
project(PPSSPP)
enable_language(ASM)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
add_definitions(-DPPSSPP)
@@ -126,7 +127,7 @@ if(MAEMO)
endif()
if (NOT BLACKBERRY AND NOT ANDROID AND NOT IOS)
- include(FindSDL)
+ include(FindSDL2)
endif()
include(FindThreads)
@@ -358,6 +359,23 @@ add_library(snappy STATIC
)
include_directories(ext/snappy)
+add_library(udis86 STATIC
+ ext/udis86/decode.c
+ ext/udis86/decode.h
+ ext/udis86/extern.h
+ ext/udis86/itab.c
+ ext/udis86/itab.h
+ ext/udis86/syn-att.c
+ ext/udis86/syn-intel.c
+ ext/udis86/syn.c
+ ext/udis86/syn.h
+ ext/udis86/types.h
+ ext/udis86/udint.h
+ ext/udis86/udis86.c
+ ext/udis86/udis86.h
+)
+include_directories(ext/udis86)
+
add_library(vjson STATIC
native/ext/vjson/json.cpp
native/ext/vjson/json.h
@@ -554,6 +572,7 @@ include_directories(ext/cityhash)
if (NOT MSVC)
# These can be fast even for debug.
set_target_properties(snappy PROPERTIES COMPILE_FLAGS "-O3")
+ set_target_properties(udis86 PROPERTIES COMPILE_FLAGS "-O3")
set_target_properties(cityhash PROPERTIES COMPILE_FLAGS "-O3")
if(NOT ZLIB_FOUND)
set_target_properties(zlib PROPERTIES COMPILE_FLAGS "-O3")
@@ -729,15 +748,15 @@ elseif(BLACKBERRY)
set(nativeExtra ${nativeExtra} native/base/BlackberryMain.cpp native/base/BlackberryDisplay.cpp)
set(nativeExtraLibs ${nativeExtraLibs} OpenAL bps screen socket EGL)
set(TargetBin PPSSPPBlackberry)
-elseif(SDL_FOUND)
+elseif(SDL2_FOUND)
set(TargetBin PPSSPPSDL)
# Require SDL
- include_directories(${SDL_INCLUDE_DIR})
+ include_directories(${SDL2_INCLUDE_DIR})
set(nativeExtra ${nativeExtra}
SDL/SDLJoystick.h
SDL/SDLJoystick.cpp
native/base/PCMain.cpp)
- set(nativeExtraLibs ${nativeExtraLibs} ${SDL_LIBRARY})
+ set(nativeExtraLibs ${nativeExtraLibs} ${SDL2_LIBRARY})
if(APPLE)
set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm)
set(nativeExtraLibs ${nativeExtraLibs} ${COCOA_LIBRARY})
@@ -746,7 +765,7 @@ elseif(SDL_FOUND)
endif()
set(TargetBin PPSSPPSDL)
else()
- message(FATAL_ERROR "Could not find SDL. Failing.")
+ message(FATAL_ERROR "Could not find SDL2. Failing.")
endif()
set(NativeAppSource
@@ -767,6 +786,7 @@ set(NativeAppSource
UI/GamepadEmu.cpp
UI/OnScreenDisplay.cpp
UI/ControlMappingScreen.cpp
+ UI/ReportScreen.cpp
UI/Store.cpp
UI/CwCheatScreen.cpp
UI/InstallZipScreen.cpp
@@ -947,7 +967,7 @@ if (LINUX AND NOT ANDROID)
SET(RT_LIB rt)
endif()
-target_link_libraries(native ${LIBZIP_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson stb_vorbis snappy ${RT_LIB} ${GLEW_LIBRARIES})
+target_link_libraries(native ${LIBZIP_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson stb_vorbis snappy udis86 ${RT_LIB} ${GLEW_LIBRARIES})
if(ANDROID)
target_link_libraries(native log EGL)
@@ -1528,7 +1548,7 @@ if(IOS)
)
set(APP_DIR_NAME \${TARGET_BUILD_DIR}/\${FULL_PRODUCT_NAME})
add_custom_command(TARGET PPSSPP POST_BUILD
- COMMAND tar -c -C . --exclude .DS_Store --exclude .git -H assets | tar -x -C '${APP_DIR_NAME}'
+ COMMAND tar -c -C . --exclude .DS_Store --exclude .git -H gnu assets | tar -x -C '${APP_DIR_NAME}'
)
# Force Xcode to relink the binary.
add_custom_command(TARGET Core PRE_BUILD
@@ -0,0 +1,180 @@
+# Locate SDL2 library
+# This module defines
+# SDL2_LIBRARY, the name of the library to link against
+# SDL2_FOUND, if false, do not try to link to SDL2
+# SDL2_INCLUDE_DIR, where to find SDL.h
+#
+# This module responds to the the flag:
+# SDL2_BUILDING_LIBRARY
+# If this is defined, then no SDL2_main will be linked in because
+# only applications need main().
+# Otherwise, it is assumed you are building an application and this
+# module will attempt to locate and set the the proper link flags
+# as part of the returned SDL2_LIBRARY variable.
+#
+# Don't forget to include SDL2main.h and SDL2main.m your project for the
+# OS X framework based version. (Other versions link to -lSDL2main which
+# this module will try to find on your behalf.) Also for OS X, this
+# module will automatically add the -framework Cocoa on your behalf.
+#
+#
+# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
+# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
+# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
+# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
+# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
+# as appropriate. These values are used to generate the final SDL2_LIBRARY
+# variable, but when these values are unset, SDL2_LIBRARY does not get created.
+#
+#
+# $SDL2DIR is an environment variable that would
+# correspond to the ./configure --prefix=$SDL2DIR
+# used in building SDL2.
+# l.e.galup 9-20-02
+#
+# Modified by Eric Wing.
+# Added code to assist with automated building by using environmental variables
+# and providing a more controlled/consistent search behavior.
+# Added new modifications to recognize OS X frameworks and
+# additional Unix paths (FreeBSD, etc).
+# Also corrected the header search path to follow "proper" SDL2 guidelines.
+# Added a search for SDL2main which is needed by some platforms.
+# Added a search for threads which is needed by some platforms.
+# Added needed compile switches for MinGW.
+#
+# On OSX, this will prefer the Framework version (if found) over others.
+# People will have to manually change the cache values of
+# SDL2_LIBRARY to override this selection or set the CMake environment
+# CMAKE_INCLUDE_PATH to modify the search paths.
+#
+# Note that the header path has changed from SDL2/SDL.h to just SDL.h
+# This needed to change because "proper" SDL2 convention
+# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
+# reasons because not all systems place things in SDL2/ (see FreeBSD).
+#
+# Ported by Johnny Patterson. This is a literal port for SDL2 of the FindSDL.cmake
+# module with the minor edit of changing "SDL" to "SDL2" where necessary. This
+# was not created for redistribution, and exists temporarily pending official
+# SDL2 CMake modules.
+
+#=============================================================================
+# Copyright 2003-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+FIND_PATH(SDL2_INCLUDE_DIR SDL_gamecontroller.h
+ HINTS
+ $ENV{SDL2DIR}
+ PATH_SUFFIXES include/SDL2 include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local/include/SDL2
+ /usr/include/SDL2
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+#MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}")
+
+FIND_LIBRARY(SDL2_LIBRARY_TEMP
+ NAMES SDL2
+ HINTS
+ $ENV{SDL2DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+#MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}")
+
+IF(NOT SDL2_BUILDING_LIBRARY)
+ IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
+ # Non-OS X framework versions expect you to also dynamically link to
+ # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
+ # seem to provide SDL2main for compatibility even though they don't
+ # necessarily need it.
+ FIND_LIBRARY(SDL2MAIN_LIBRARY
+ NAMES SDL2main
+ HINTS
+ $ENV{SDL2DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ )
+ ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
+ENDIF(NOT SDL2_BUILDING_LIBRARY)
+
+# SDL2 may require threads on your system.
+# The Apple build may not need an explicit flag because one of the
+# frameworks may already provide it.
+# But for non-OSX systems, I will use the CMake Threads package.
+IF(NOT APPLE)
+ FIND_PACKAGE(Threads)
+ENDIF(NOT APPLE)
+
+# MinGW needs an additional library, mwindows
+# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
+# (Actually on second look, I think it only needs one of the m* libraries.)
+IF(MINGW)
+ SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
+ENDIF(MINGW)
+
+SET(SDL2_FOUND "NO")
+IF(SDL2_LIBRARY_TEMP)
+ # For SDL2main
+ IF(NOT SDL2_BUILDING_LIBRARY)
+ IF(SDL2MAIN_LIBRARY)
+ SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
+ ENDIF(SDL2MAIN_LIBRARY)
+ ENDIF(NOT SDL2_BUILDING_LIBRARY)
+
+ # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
+ # CMake doesn't display the -framework Cocoa string in the UI even
+ # though it actually is there if I modify a pre-used variable.
+ # I think it has something to do with the CACHE STRING.
+ # So I use a temporary variable until the end so I can set the
+ # "real" variable in one-shot.
+ IF(APPLE)
+ SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
+ ENDIF(APPLE)
+
+ # For threads, as mentioned Apple doesn't need this.
+ # In fact, there seems to be a problem if I used the Threads package
+ # and try using this line, so I'm just skipping it entirely for OS X.
+ IF(NOT APPLE)
+ SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
+ ENDIF(NOT APPLE)
+
+ # For MinGW library
+ IF(MINGW)
+ SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
+ ENDIF(MINGW)
+
+ # Set the final string here so the GUI reflects the final state.
+ SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
+ # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
+ SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
+
+ SET(SDL2_FOUND "YES")
+ENDIF(SDL2_LIBRARY_TEMP)
+
+INCLUDE(FindPackageHandleStandardArgs)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
+ REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
View
@@ -49,6 +49,17 @@ void do_cpuid(u32 regs[4], u32 cpuid_leaf) {
#ifdef _M_SSE
#include <xmmintrin.h>
+
+#define _XCR_XFEATURE_ENABLED_MASK 0
+static unsigned long long _xgetbv(unsigned int index)
+{
+ unsigned int eax, edx;
+ __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
+ return ((unsigned long long)edx << 32) | eax;
+}
+
+#else
+#define _XCR_XFEATURE_ENABLED_MASK 0
#endif
#if defined __FreeBSD__
@@ -172,6 +183,38 @@ void CPUInfo::Detect() {
bFMA = true;
}
if ((cpu_id[2] >> 25) & 1) bAES = true;
+
+ if ((cpu_id[3] >> 24) & 1)
+ {
+ // We can use FXSAVE.
+ bFXSR = true;
+ }
+
+ // AVX support requires 3 separate checks:
+ // - Is the AVX bit set in CPUID?
+ // - Is the XSAVE bit set in CPUID?
+ // - XGETBV result has the XCR bit set.
+ if (((cpu_id[2] >> 28) & 1) && ((cpu_id[2] >> 27) & 1))
+ {
+ if ((_xgetbv(_XCR_XFEATURE_ENABLED_MASK) & 0x6) == 0x6)
+ {
+ bAVX = true;
+ if ((cpu_id[2] >> 12) & 1)
+ bFMA = true;
+ }
+ }
+
+ if (max_std_fn >= 7)
+ {
+ do_cpuid(cpu_id, 0x00000007);
+ // careful; we can't enable AVX2 unless the XSAVE/XGETBV checks above passed
+ if ((cpu_id[1] >> 5) & 1)
+ bAVX2 = bAVX;
+ if ((cpu_id[1] >> 3) & 1)
+ bBMI1 = true;
+ if ((cpu_id[1] >> 8) & 1)
+ bBMI2 = true;
+ }
}
if (max_ex_fn >= 0x80000004) {
// Extract brand string
Oops, something went wrong.

0 comments on commit ce5edeb

Please sign in to comment.