Merge branch 'master' into TemporaryHackishBranch

# Conflicts:
#	UI/GameSettingsScreen.cpp
#	Windows/ppsspp.rc
This commit is contained in:
LunaMoo committed 2018-03-27 11:16:08 +02:00
commit 79104ebf31
109 files changed
+6977 -355

No files matched your search

+2
View File
@@ -106,6 +106,8 @@ travis_script() {
if [ "$QT" = "TRUE" ]; then
./b.sh --qt
elif [ "$LIBRETRO" = "TRUE" ]; then
./b.sh --libretro
else
./b.sh --headless
fi
+8
View File
@@ -64,6 +64,14 @@ matrix:
compiler: "gcc"
env: PPSSPP_BUILD_TYPE=Linux
QT=TRUE
- os: linux
compiler: "gcc"
env: PPSSPP_BUILD_TYPE=Linux
LIBRETRO=TRUE
- os: linux
compiler: "clang"
env: PPSSPP_BUILD_TYPE=Linux
LIBRETRO=TRUE
- os: osx
osx_image: xcode8
compiler: "clang macos"
+65 -27
View File
@@ -50,6 +50,11 @@ include(ccache)
# Remove soon?
set(USE_FFMPEG ON)
# the libraries in the ffmpeg/ directory are not compatible with mingw
if(MINGW AND NOT DEFINED USE_SYSTEM_FFMPEG)
set(USE_SYSTEM_FFMPEG ON)
endif()
if(NOT ANDROID AND NOT IOS)
if(ARM OR SIMULATOR)
set(USING_EGL ON)
@@ -110,6 +115,7 @@ option(MOBILE_DEVICE "Set to ON when targeting a mobile device" ${MOBILE_DEVICE}
option(HEADLESS "Set to OFF to not generate the PPSSPPHeadless target" ${HEADLESS})
option(UNITTEST "Set to ON to generate the unittest target" ${UNITTEST})
option(SIMULATOR "Set to ON when targeting an x86 simulator of an ARM platform" ${SIMULATOR})
option(LIBRETRO "Set to ON to generate the libretro target" OFF)
# :: Options
option(USE_FFMPEG "Build with FFMPEG support" ${USE_FFMPEG})
option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG})
@@ -130,6 +136,14 @@ if(UNIX AND NOT (APPLE OR ANDROID) AND VULKAN)
endif()
endif()
if(LIBRETRO)
add_definitions(-D__LIBRETRO__)
add_definitions(-DGLEW_NO_GLU)
if(NOT MSVC)
add_compile_options(-fPIC)
endif()
endif()
if(ANDROID)
set(CoreLibName ppsspp_jni)
set(CoreLinkType SHARED)
@@ -243,7 +257,7 @@ if(NOT MSVC)
add_definitions(-Wno-deprecated-register)
# Don't compile with strict aliasing, we're not 100% aliasing-safe
add_definitions(-fno-strict-aliasing)
add_compile_options(-fno-strict-aliasing)
if (${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -parallel -fopenmp")
endif()
@@ -273,13 +287,16 @@ if(NOT MSVC)
else()
# Disable warnings about MS-specific _s variants of libc functions
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_UNICODE -DUNICODE)
add_definitions(-DUSING_WIN_UI)
add_definitions(-MP)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_NDEBUG")
endif()
if(WIN32)
add_definitions(-D_UNICODE -DUNICODE)
add_definitions(-DUSING_WIN_UI)
endif()
if(NOT ANDROID)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
@@ -419,7 +436,15 @@ target_link_libraries(Common Ext::Snappy)
if(WIN32)
include_directories(dx9sdk/Include)
target_link_libraries(Common winmm d3d9 dxguid dsound)
include_directories(dx9sdk/Include/DX11)
if(MINGW)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <INCLUDES> <SOURCE> <OBJECT>")
# required when using the dx9sdk include paths
add_definitions(-include ${CMAKE_CURRENT_SOURCE_DIR}/Windows/mingw_defines.h)
else()
target_link_libraries(Common dxguid)
endif()
target_link_libraries(Common winmm d3d9 dsound)
endif()
if(TARGET SDL2::SDL2)
@@ -772,24 +797,6 @@ elseif(USING_QT_UI)
set(nativeExtraLibs ${nativeExtraLibs} Qt5::Multimedia)
endif()
elseif(TARGET SDL2::SDL2)
set(TargetBin PPSSPPSDL)
# Require SDL
add_definitions(-DSDL)
set(nativeExtra ${nativeExtra}
SDL/SDLJoystick.h
SDL/SDLJoystick.cpp
SDL/SDLMain.cpp
SDL/SDLGLGraphicsContext.cpp
SDL/SDLVulkanGraphicsContext.cpp)
set(nativeExtraLibs ${nativeExtraLibs} SDL2::SDL2)
if(APPLE)
set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm)
set(nativeExtraLibs ${nativeExtraLibs} ${COCOA_LIBRARY})
elseif(USING_EGL)
set(nativeExtraLibs ${nativeExtraLibs} pthread)
endif()
set(TargetBin PPSSPPSDL)
elseif(WIN32)
# Don't care about SDL.
set(TargetBin PPSSPPWindows)
@@ -798,6 +805,25 @@ elseif(WIN32)
else()
link_directories(dx9sdk/Lib/x86)
endif()
set(nativeExtra ${nativeExtra} ext/native/base/logging.cpp)
elseif(TARGET SDL2::SDL2)
set(TargetBin PPSSPPSDL)
# Require SDL
add_definitions(-DSDL)
set(nativeExtra ${nativeExtra}
SDL/SDLJoystick.h
SDL/SDLJoystick.cpp
SDL/SDLMain.cpp
SDL/SDLGLGraphicsContext.cpp
SDL/SDLVulkanGraphicsContext.cpp)
set(nativeExtraLibs ${nativeExtraLibs} SDL2::SDL2)
if(APPLE)
set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm)
set(nativeExtraLibs ${nativeExtraLibs} ${COCOA_LIBRARY})
elseif(USING_EGL)
set(nativeExtraLibs ${nativeExtraLibs} pthread)
endif()
set(TargetBin PPSSPPSDL)
else()
message(FATAL_ERROR "Could not find SDL2. Failing.")
endif()
@@ -1031,7 +1057,7 @@ if(ANDROID)
SET(ATOMIC_LIB atomic)
endif()
target_link_libraries(native ${LIBZIP_LIBRARY} ${ZLIB_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson udis86 ${RT_LIB} ${nativeExtraLibs} ${ATOMIC_LIB})
target_link_libraries(native ${LIBZIP_LIBRARY} ${PNG_LIBRARY} ${ZLIB_LIBRARY} rg_etc1 vjson udis86 ${RT_LIB} ${nativeExtraLibs} ${ATOMIC_LIB})
if(TARGET Ext::GLEW)
target_link_libraries(native Ext::GLEW)
endif()
@@ -1080,7 +1106,7 @@ include_directories(ext/xxhash)
set(CoreExtra)
set(CoreExtraLibs)
if(WINDOWS OR ANDROID)
if(WIN32 OR ANDROID)
set(CoreExtraLibs ${CoreExtraLibs} armips)
endif()
@@ -1689,6 +1715,10 @@ set(CoreExtraLibs ${CoreExtraLibs} armips)
set(GlslangLibs glslang OGLCompiler OSDependent SPIRV SPVRemapper spirv-cross-glsl)
if(WIN32)
set(GlslangLibs ${GlslangLibs} spirv-cross-hlsl)
endif()
target_link_libraries(${CoreLibName} Common native kirk cityhash sfmt19937 xbrz xxhash ${GlslangLibs}
${CoreExtraLibs} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS})
@@ -1700,6 +1730,7 @@ if(FFmpeg_FOUND)
FFmpeg::avutil
FFmpeg::swresample
FFmpeg::swscale
${ZLIB_LIBRARY}
)
endif()
@@ -1765,7 +1796,6 @@ set(WindowsFiles
Windows/EmuThread.cpp
Windows/EmuThread.h
Windows/GeDebugger/GeDebugger.cpp
Windows/Globals.cpp
Windows/GPU/D3D9Context.cpp
Windows/GPU/D3D9Context.h
Windows/GPU/D3D11Context.cpp
@@ -1813,7 +1843,7 @@ set(WindowsFiles
list(APPEND LinkCommon ${CoreLibName} ${CMAKE_THREAD_LIBS_INIT})
if(WIN32)
list(APPEND LinkCommon kernel32 user32 gdi32 shell32 comctl32 dsound xinput)
list(APPEND LinkCommon kernel32 user32 gdi32 shell32 comctl32 dsound xinput d3d9 winmm dinput8 ole32 winspool ksuser)
#setup_target_project(${TargetBin} Windows)
list(APPEND NativeAppSource ${WindowsFiles})
endif()
@@ -1863,6 +1893,10 @@ if(UNITTEST)
setup_target_project(unitTest unittest)
endif()
if(LIBRETRO)
add_subdirectory(libretro)
endif()
if (TargetBin)
if (IOS OR APPLE)
if (APPLE AND NOT IOS)
@@ -1892,7 +1926,11 @@ if (TargetBin)
endif()
elseif(WIN32)
add_executable(${TargetBin} WIN32 ${NativeAppSource})
set_target_properties(${TargetBin} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
if(MSVC)
set_target_properties(${TargetBin} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
else()
set_target_properties(${TargetBin} PROPERTIES LINK_FLAGS "-Wl,-subsystem,windows")
endif()
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${TargetBin})
else()
add_executable(${TargetBin} ${NativeAppSource})
+2
View File
@@ -61,8 +61,10 @@ inline u64 __rotr64(u64 x, unsigned int shift){
#else // WIN32
// Function Cross-Compatibility
#ifndef __MINGW32__
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#endif
#define unlink _unlink
#define __rotl _rotl
#define __rotl64 _rotl64
+5
View File
@@ -26,6 +26,9 @@
#else
#include <stdarg.h>
#endif
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include "ppsspp_config.h"
#include "thread/threadutil.h"
@@ -67,6 +70,8 @@ ConsoleListener::ConsoleListener() : bHidden(true)
bUseColor = false;
#elif PPSSPP_PLATFORM(UWP)
bUseColor = false;
#elif defined(_MSC_VER)
bUseColor = false;
#else
bUseColor = isatty(fileno(stdout));
#endif
+6 -1
View File
@@ -176,6 +176,7 @@ void LogManager::ChangeFileLog(const char *filename) {
if (fileLog_) {
RemoveListener(fileLog_);
delete fileLog_;
fileLog_ = nullptr;
}
if (filename) {
@@ -245,16 +246,20 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const
}
char msgBuf[1024];
va_list args_copy;
va_copy(args_copy, args);
size_t neededBytes = vsnprintf(msgBuf, sizeof(msgBuf), format, args);
if (neededBytes > sizeof(msgBuf)) {
// Needed more space? Re-run vsnprintf.
message.msg.resize(neededBytes + 1);
vsnprintf(&message.msg[0], neededBytes + 1, format, args);
vsnprintf(&message.msg[0], neededBytes + 1, format, args_copy);
} else {
message.msg.resize(neededBytes + 1);
memcpy(&message.msg[0], msgBuf, neededBytes);
}
message.msg[message.msg.size() - 1] = '\n';
va_end(args_copy);
std::lock_guard<std::mutex> listeners_lock(listeners_lock_);
for (auto &iter : listeners_) {
+2 -2
View File
@@ -43,13 +43,13 @@ const char *GetLastErrorMsg()
const char *GetStringErrorMsg(int errCode) {
static const size_t buff_size = 1023;
#ifdef _WIN32
static __declspec(thread) wchar_t err_strw[buff_size] = {};
static __THREAD wchar_t err_strw[buff_size] = {};
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
err_strw, buff_size, NULL);
static __declspec(thread) char err_str[buff_size] = {};
static __THREAD char err_str[buff_size] = {};
snprintf(err_str, buff_size, "%s", ConvertWStringToUTF8(err_strw).c_str());
#else
static __thread char err_str[buff_size] = {};
+2 -2
View File
@@ -1,6 +1,6 @@
#include "ppsspp_config.h"
#ifdef _MSC_VER
#ifdef _WIN32
#include <cstdint>
#include "OSVersion.h"
@@ -93,4 +93,4 @@ std::string GetWindowsSystemArchitecture() {
return "(Unknown)";
}
#endif
#endif
+2 -2
View File
@@ -2,11 +2,11 @@
#include <string>
#ifdef _MSC_VER
#ifdef _WIN32
bool IsVistaOrHigher();
bool DoesVersionMatchWindows(uint32_t major, uint32_t minor, uint32_t spMajor, uint32_t spMinor, bool acceptGreater);
std::string GetWindowsVersion();
std::string GetWindowsSystemArchitecture();
#endif
#endif
+11 -8
View File
@@ -640,10 +640,13 @@ void VulkanContext::ReinitSurface(int width, int height) {
HINSTANCE connection = (HINSTANCE)winsysData1_;
HWND window = (HWND)winsysData2_;
RECT rc;
GetClientRect(window, &rc);
width = rc.right - rc.left;
height = rc.bottom - rc.top;
if (width < 0 || height < 0)
{
RECT rc;
GetClientRect(window, &rc);
width = rc.right - rc.left;
height = rc.bottom - rc.top;
}
VkWin32SurfaceCreateInfoKHR win32{ VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR };
win32.flags = 0;
@@ -1151,6 +1154,10 @@ void VulkanDeleteList::Take(VulkanDeleteList &del) {
}
void VulkanDeleteList::PerformDeletes(VkDevice device) {
for (auto &callback : callbacks_) {
callback.func(callback.userdata);
}
callbacks_.clear();
for (auto &cmdPool : cmdPools_) {
vkDestroyCommandPool(device, cmdPool, nullptr);
}
@@ -1211,8 +1218,4 @@ void VulkanDeleteList::PerformDeletes(VkDevice device) {
vkDestroyDescriptorSetLayout(device, descSetLayout, nullptr);
}
descSetLayouts_.clear();
for (auto &callback : callbacks_) {
callback.func(callback.userdata);
}
callbacks_.clear();
}
+2
View File
@@ -22,8 +22,10 @@
#elif defined(_WIN32)
#define VK_USE_PLATFORM_WIN32_KHR
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
#define NOMINMAX
#endif
#endif
#define VK_NO_PROTOTYPES
+3 -3
View File
@@ -20,16 +20,16 @@
#ifdef _WIN32
#ifndef _WIN32_WINNT
#if _MSC_VER < 1700
#if defined(_MSC_VER) && _MSC_VER < 1700
#error You need a newer version of Visual Studio.
#else
#define _WIN32_WINNT 0x600
#define _WIN32_WINNT 0x601
#endif
#endif // #ifndef _WIN32_WINNT
#undef WINVER
#define WINVER 0x0600
#define WINVER _WIN32_WINNT
#ifndef _WIN32_IE
#define _WIN32_IE 0x0600 // Default value is 0x0400
#endif
+16 -7
View File
@@ -325,6 +325,14 @@ static bool DefaultCodeGen() {
#endif
}
static bool DefaultEnableStateUndo() {
#ifdef MOBILE_DEVICE
// Off on mobile to save disk space.
return false;
#endif
return true;
}
struct ConfigSectionSettings {
const char *section;
ConfigSetting *settings;
@@ -359,6 +367,7 @@ static ConfigSetting generalSettings[] = {
ConfigSetting("DumpAudio", &g_Config.bDumpAudio, false),
ConfigSetting("SaveLoadResetsAVdumping", &g_Config.bSaveLoadResetsAVdumping, false),
ConfigSetting("StateSlot", &g_Config.iCurrentStateSlot, 0, true, true),
ConfigSetting("EnableStateUndo", &g_Config.bEnableStateUndo, &DefaultEnableStateUndo, true, true),
ConfigSetting("RewindFlipFrequency", &g_Config.iRewindFlipFrequency, 0, true, true),
ConfigSetting("GridView1", &g_Config.bGridView1, true),
@@ -605,7 +614,7 @@ static bool DefaultShowTouchControls() {
static const float defaultControlScale = 1.15f;
static ConfigSetting controlSettings[] = {
ConfigSetting("HapticFeedback", &g_Config.bHapticFeedback, true, true, true),
ConfigSetting("HapticFeedback", &g_Config.bHapticFeedback, false, true, true),
ConfigSetting("ShowTouchCross", &g_Config.bShowTouchCross, true, true, true),
ConfigSetting("ShowTouchCircle", &g_Config.bShowTouchCircle, true, true, true),
ConfigSetting("ShowTouchSquare", &g_Config.bShowTouchSquare, true, true, true),
@@ -928,7 +937,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
IniFile iniFile;
if (!iniFile.Load(iniFilename_)) {
ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFilename_.c_str());
ERROR_LOG(LOADER, "Failed to read '%s'. Setting config to default.", iniFilename_.c_str());
// Continue anyway to initialize the config.
}
@@ -1088,7 +1097,7 @@ void Config::Save() {
CleanRecent();
IniFile iniFile;
if (!iniFile.Load(iniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't read ini %s", iniFilename_.c_str());
ERROR_LOG(LOADER, "Error saving config - can't read ini '%s'", iniFilename_.c_str());
}
// Need to do this somewhere...
@@ -1129,21 +1138,21 @@ void Config::Save() {
LogManager::GetInstance()->SaveConfig(log);
if (!iniFile.Save(iniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't write ini %s", iniFilename_.c_str());
ERROR_LOG(LOADER, "Error saving config - can't write ini '%s'", iniFilename_.c_str());
System_SendMessage("toast", "Failed to save settings!\nCheck permissions, or try to restart the device.");
return;
}
INFO_LOG(LOADER, "Config saved: %s", iniFilename_.c_str());
INFO_LOG(LOADER, "Config saved: '%s'", iniFilename_.c_str());
if (!bGameSpecific) //otherwise we already did this in saveGameConfig()
{
IniFile controllerIniFile;
if (!controllerIniFile.Load(controllerIniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't read ini %s", controllerIniFilename_.c_str());
ERROR_LOG(LOADER, "Error saving config - can't read ini '%s'", controllerIniFilename_.c_str());
}
KeyMap::SaveToIni(controllerIniFile);
if (!controllerIniFile.Save(controllerIniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't write ini %s", controllerIniFilename_.c_str());
ERROR_LOG(LOADER, "Error saving config - can't write ini '%s'", controllerIniFilename_.c_str());
return;
}
INFO_LOG(LOADER, "Controller config saved: %s", controllerIniFilename_.c_str());
+1
View File
@@ -208,6 +208,7 @@ public:
int iMaxRecent;
int iCurrentStateSlot;
int iRewindFlipFrequency;
bool bEnableStateUndo;
bool bEnableAutoLoad;
bool bEnableCheats;
bool bReloadCheats;
+4
View File
@@ -15,6 +15,10 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#ifdef __MINGW32__
#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
#endif
#include <thread>
#include "i18n/i18n.h"
+1 -1
View File
@@ -77,7 +77,7 @@ namespace MIPSComp {
}
}
#if PPSSPP_PLATFORM(WINDOWS) && !defined(__LIBRETRO__)
#if PPSSPP_PLATFORM(WINDOWS)
#define DISASM_ALL 1
#endif
+79 -24
View File
@@ -325,30 +325,46 @@ namespace SaveState
// Slot utilities
std::string AppendSlotTitle(const std::string &filename, const std::string &title) {
if (!endsWith(filename, std::string(".") + STATE_EXTENSION)) {
return title + " (" + filename + ")";
char slotChar = 0;
auto detectSlot = [&](const std::string &ext) {
if (!endsWith(filename, std::string(".") + ext)) {
return false;
}
// Usually these are slots, let's check the slot # after the last '_'.
size_t slotNumPos = filename.find_last_of('_');
if (slotNumPos == filename.npos) {
return false;
}
const size_t extLength = ext.length() + 1;
// If we take out the extension, '_', etc. we should be left with only a single digit.
if (slotNumPos + 1 + extLength != filename.length() - 1) {
return false;
}
slotChar = filename[slotNumPos + 1];
if (slotChar < '0' || slotChar > '8') {
return false;
}
// Change from zero indexed to human friendly.
slotChar++;
return true;
};
if (detectSlot(STATE_EXTENSION)) {
return StringFromFormat("%s (%c)", title.c_str(), slotChar);
}
if (detectSlot(UNDO_STATE_EXTENSION)) {
I18NCategory *sy = GetI18NCategory("System");
// Allow the number to be positioned where it makes sense.
std::string undo = sy->T("undo %c");
return title + " (" + StringFromFormat(undo.c_str(), slotChar) + ")";
}
// Usually these are slots, let's check the slot # after the last '_'.
size_t slotNumPos = filename.find_last_of('_');
if (slotNumPos == filename.npos) {
return title + " (" + filename + ")";
}
const size_t extLength = strlen(STATE_EXTENSION) + 1;
// If we take out the extension, '_', etc. we should be left with only a single digit.
if (slotNumPos + 1 + extLength != filename.length() - 1) {
return title + " (" + filename + ")";
}
std::string slot = filename.substr(slotNumPos + 1, 1);
if (slot[0] < '0' || slot[0] > '8') {
return title + " (" + filename + ")";
}
// Change from zero indexed to human friendly.
slot[0]++;
return title + " (" + slot + ")";
// Couldn't detect, use the filename.
return title + " (" + filename + ")";
}
std::string GetTitle(const std::string &filename) {
@@ -412,11 +428,16 @@ namespace SaveState
{
std::string fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION);
std::string shot = GenerateSaveSlotFilename(gameFilename, slot, SCREENSHOT_EXTENSION);
std::string fnUndo = GenerateSaveSlotFilename(gameFilename, slot, UNDO_STATE_EXTENSION);
std::string shotUndo = GenerateSaveSlotFilename(gameFilename, slot, UNDO_SCREENSHOT_EXTENSION);
if (!fn.empty()) {
auto renameCallback = [=](bool status, const std::string &message, void *data) {
if (status) {
if (File::Exists(fn)) {
File::Delete(fn);
if (File::Exists(fnUndo) && g_Config.bEnableStateUndo) {
File::Delete(fnUndo);
}
if (File::Exists(fn) && g_Config.bEnableStateUndo) {
File::Rename(fn, fnUndo);
}
File::Rename(fn + ".tmp", fn);
}
@@ -425,6 +446,9 @@ namespace SaveState
}
};
// Let's also create a screenshot.
if (File::Exists(shot) && g_Config.bEnableStateUndo) {
File::Rename(shot, shotUndo);
}
SaveScreenshot(shot, Callback(), 0);
Save(fn + ".tmp", renameCallback, cbUserData);
} else {
@@ -434,12 +458,43 @@ namespace SaveState
}
}
bool UndoSaveSlot(const std::string &gameFilename, int slot) {
std::string fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION);
std::string shot = GenerateSaveSlotFilename(gameFilename, slot, SCREENSHOT_EXTENSION);
std::string fnUndo = GenerateSaveSlotFilename(gameFilename, slot, UNDO_STATE_EXTENSION);
std::string shotUndo = GenerateSaveSlotFilename(gameFilename, slot, UNDO_SCREENSHOT_EXTENSION);
// Do nothing if there's no undo.
if (File::Exists(fnUndo)) {
// Swap them so they can undo again to redo. Mistakes happen.
if (File::Exists(shotUndo)) {
File::Rename(shot, shot + ".tmp");
File::Rename(shotUndo, shot);
File::Rename(shot + ".tmp", shotUndo);
}
File::Rename(fn, fn + ".tmp");
File::Rename(fnUndo, fn);
File::Rename(fn + ".tmp", fnUndo);
return true;
}
return false;
}
bool HasSaveInSlot(const std::string &gameFilename, int slot)
{
std::string fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION);
return File::Exists(fn);
}
bool HasUndoSaveInSlot(const std::string &gameFilename, int slot)
{
std::string fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION);
return File::Exists(fn + ".undo");
}
bool HasScreenshotInSlot(const std::string &gameFilename, int slot)
{
std::string fn = GenerateSaveSlotFilename(gameFilename, slot, SCREENSHOT_EXTENSION);
+4
View File
@@ -28,6 +28,8 @@ namespace SaveState
static const int NUM_SLOTS = 5;
static const char *STATE_EXTENSION = "ppst";
static const char *SCREENSHOT_EXTENSION = "jpg";
static const char *UNDO_STATE_EXTENSION = "undo.ppst";
static const char *UNDO_SCREENSHOT_EXTENSION = "undo.jpg";
void Init();
void Shutdown();
@@ -36,8 +38,10 @@ namespace SaveState
void NextSlot();
void SaveSlot(const std::string &gameFilename, int slot, Callback callback, void *cbUserData = 0);
void LoadSlot(const std::string &gameFilename, int slot, Callback callback, void *cbUserData = 0);
bool UndoSaveSlot(const std::string &gameFilename, int slot);
// Checks whether there's an existing save in the specified slot.
bool HasSaveInSlot(const std::string &gameFilename, int slot);
bool HasUndoSaveInSlot(const std::string &gameFilename, int slot);
bool HasScreenshotInSlot(const std::string &gameFilename, int slot);
int GetCurrentSlot();
+1 -1
View File
@@ -35,7 +35,7 @@ static const std::string NEW_TEXTURE_DIR = "new/";
static const int VERSION = 1;
static const int MAX_MIP_LEVELS = 12; // 12 should be plenty, 8 is the max mip levels supported by the PSP.
TextureReplacer::TextureReplacer() : enabled_(false), allowVideo_(false), ignoreAddress_(false), hash_(ReplacedTextureHash::QUICK) {
TextureReplacer::TextureReplacer() {
none_.alphaStatus_ = ReplacedTextureAlpha::UNKNOWN;
}
+5 -5
View File
@@ -196,13 +196,13 @@ protected:
void PopulateReplacement(ReplacedTexture *result, u64 cachekey, u32 hash, int w, int h);
SimpleBuf<u32> saveBuf;
bool enabled_;
bool allowVideo_;
bool ignoreAddress_;
bool reduceHash_;
bool enabled_ = false;
bool allowVideo_ = false;
bool ignoreAddress_ = false;
bool reduceHash_ = false;
std::string gameID_;
std::string basePath_;
ReplacedTextureHash hash_;
ReplacedTextureHash hash_ = ReplacedTextureHash::QUICK;
typedef std::pair<int, int> WidthHeightPair;
std::unordered_map<u64, WidthHeightPair> hashranges_;
std::unordered_map<ReplacementAliasKey, std::string> aliases_;
+2 -2
View File
@@ -387,8 +387,8 @@ protected:
bool gameUsesSequentialCopies_ = false;
// Sampled in BeginFrame for safety.
float renderWidth_;
float renderHeight_;
float renderWidth_ = 0.0f;
float renderHeight_ = 0.0f;
int pixelWidth_;
int pixelHeight_;
int bloomHack_ = 0;
+1 -1
View File
@@ -27,7 +27,7 @@
struct ShaderInfo {
std::string iniFile; // which ini file was this definition in? So we can write settings back later
std::string section; // ini file section. This is saved.
std::string name; // Fancy display name. TODO: Not using yet.
std::string name; // Fancy display name.
std::string fragmentShaderFile;
std::string vertexShaderFile;
+8 -18
View File
@@ -575,23 +575,15 @@ void TextureCacheCommon::DecimateVideos() {
}
}
bool TextureCacheCommon::HandleTextureChange(TexCacheEntry *const entry, const char *reason, bool initialMatch, bool doDelete) {
bool replaceImages = false;
void TextureCacheCommon::HandleTextureChange(TexCacheEntry *const entry, const char *reason, bool initialMatch, bool doDelete) {
cacheSizeEstimate_ -= EstimateTexMemoryUsage(entry);
entry->numInvalidated++;
gpuStats.numTextureInvalidations++;
DEBUG_LOG(G3D, "Texture different or overwritten, reloading at %08x: %s", entry->addr, reason);
if (doDelete) {
if (initialMatch && standardScaleFactor_ == 1 && (entry->status & TexCacheEntry::STATUS_IS_SCALED) == 0) {
// Actually, if size and number of levels match, let's try to avoid deleting and recreating.
// Instead, let's use glTexSubImage to replace the images.
replaceImages = true;
} else {
InvalidateLastTexture();
ReleaseTexture(entry, true);
entry->status &= ~TexCacheEntry::STATUS_IS_SCALED;
}
InvalidateLastTexture();
ReleaseTexture(entry, true);
entry->status &= ~TexCacheEntry::STATUS_IS_SCALED;
}
// Clear the reliable bit if set.
if (entry->GetHashStatus() == TexCacheEntry::STATUS_RELIABLE) {
@@ -618,8 +610,6 @@ bool TextureCacheCommon::HandleTextureChange(TexCacheEntry *const entry, const c
}
}
entry->numFrames = 0;
return replaceImages;
}
void TextureCacheCommon::NotifyFramebuffer(u32 address, VirtualFramebuffer *framebuffer, FramebufferNotification msg) {
@@ -1488,7 +1478,6 @@ void TextureCacheCommon::ApplyTexture() {
UpdateMaxSeenV(entry, gstate.isModeThrough());
bool replaceImages = false;
if (nextNeedsRebuild_) {
// Regardless of hash fails or otherwise, if this is a video, mark it frequently changing.
// This prevents temporary scaling perf hits on the first second of video.
@@ -1509,14 +1498,14 @@ void TextureCacheCommon::ApplyTexture() {
}
if (nextNeedsChange_) {
// This texture existed previously, let's handle the change.
replaceImages = HandleTextureChange(entry, nextChangeReason_, false, true);
HandleTextureChange(entry, nextChangeReason_, false, true);
}
// We actually build afterward (shared with rehash rebuild.)
} else if (nextNeedsRehash_) {
// Okay, this matched and didn't change - but let's check the hash. Maybe it will change.
bool doDelete = true;
if (!CheckFullHash(entry, doDelete)) {
replaceImages = HandleTextureChange(entry, "hash fail", true, doDelete);
HandleTextureChange(entry, "hash fail", true, doDelete);
nextNeedsRebuild_ = true;
} else if (nextTexture_ != nullptr) {
// The secondary cache may choose an entry from its storage by setting nextTexture_.
@@ -1529,7 +1518,8 @@ void TextureCacheCommon::ApplyTexture() {
// Okay, now actually rebuild the texture if needed.
if (nextNeedsRebuild_) {
BuildTexture(entry, replaceImages);
_assert_(!entry->texturePtr);
BuildTexture(entry);
}
entry->lastFrame = gpuStats.numFlips;
+2 -2
View File
@@ -225,8 +225,8 @@ protected:
void Decimate();
virtual void ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffer *framebuffer) = 0;
bool HandleTextureChange(TexCacheEntry *const entry, const char *reason, bool initialMatch, bool doDelete);
virtual void BuildTexture(TexCacheEntry *const entry, bool replaceImages) = 0;
void HandleTextureChange(TexCacheEntry *const entry, const char *reason, bool initialMatch, bool doDelete);
virtual void BuildTexture(TexCacheEntry *const entry) = 0;
virtual void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) = 0;
bool CheckFullHash(TexCacheEntry *entry, bool &doDelete);
+2 -1
View File
@@ -1,6 +1,7 @@
#include "ppsspp_config.h"
#include <cstdint>
#include <cfloat>
#include <vector>
#include <d3d11.h>
#include <D3Dcompiler.h>
@@ -151,4 +152,4 @@ void StockObjectsD3D11::Destroy() {
samplerLinear2DClamp->Release();
}
StockObjectsD3D11 stockD3D11;
StockObjectsD3D11 stockD3D11;
+7 -17
View File
@@ -427,7 +427,7 @@ void TextureCacheD3D11::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFra
}
void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry, bool replaceImages) {
void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry) {
entry->status &= ~TexCacheEntry::STATUS_ALPHA_MASK;
// For the estimate, we assume cluts always point to 8888 for simplicity.
@@ -487,11 +487,6 @@ void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry, bool replaceIma
int h = gstate.getTextureHeight(0);
ReplacedTexture &replaced = replacer_.FindReplacement(cachekey, entry->fullhash, w, h);
if (replaced.GetSize(0, w, h)) {
if (replaceImages) {
// Since we're replacing the texture, we can't replace the image inside.
ReleaseTexture(entry, true);
replaceImages = false;
}
// We're replacing, so we won't scale.
scaleFactor = 1;
entry->status |= TexCacheEntry::STATUS_IS_SCALED;
@@ -521,12 +516,6 @@ void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry, bool replaceIma
}
}
if (replaceImages) {
// Make sure it's not currently set.
ID3D11ShaderResourceView *srv = nullptr;
context_->PSSetShaderResources(0, 1, &srv);
}
// Seems to cause problems in Tactics Ogre.
if (badMipSizes) {
maxLevel = 0;
@@ -541,10 +530,11 @@ void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry, bool replaceIma
if (IsFakeMipmapChange()) {
// NOTE: Since the level is not part of the cache key, we assume it never changes.
u8 level = std::max(0, gstate.getTexLevelOffset16() / 16);
LoadTextureLevel(*entry, replaced, level, maxLevel, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, level, maxLevel, scaleFactor, dstFmt);
} else {
LoadTextureLevel(*entry, replaced, 0, maxLevel, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, 0, maxLevel, scaleFactor, dstFmt);
}
ID3D11ShaderResourceView *textureView = DxView(entry);
if (!textureView) {
return;
@@ -553,7 +543,7 @@ void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry, bool replaceIma
// Mipmapping is only enabled when texture scaling is disabled.
if (maxLevel > 0 && scaleFactor == 1) {
for (int i = 1; i <= maxLevel; i++) {
LoadTextureLevel(*entry, replaced, i, maxLevel, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, i, maxLevel, scaleFactor, dstFmt);
}
}
@@ -647,12 +637,12 @@ DXGI_FORMAT ToDXGIFormat(ReplacedTextureFormat fmt) {
}
}
void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int maxLevel, bool replaceImages, int scaleFactor, DXGI_FORMAT dstFmt) {
void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int maxLevel, int scaleFactor, DXGI_FORMAT dstFmt) {
int w = gstate.getTextureWidth(level);
int h = gstate.getTextureHeight(level);
ID3D11Texture2D *texture = DxTex(&entry);
if ((level == 0 || IsFakeMipmapChange()) && (!replaceImages || texture == nullptr)) {
if ((level == 0 || IsFakeMipmapChange()) && texture == nullptr) {
// Create texture
int levels = scaleFactor == 1 ? maxLevel + 1 : 1;
int tw = w, th = h;
+4 -4
View File
@@ -69,19 +69,19 @@ protected:
void ReleaseTexture(TexCacheEntry *entry, bool delete_them) override;
private:
void LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int maxLevel, bool replaceImages, int scaleFactor, DXGI_FORMAT dstFmt);
void LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int maxLevel, int scaleFactor, DXGI_FORMAT dstFmt);
DXGI_FORMAT GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const;
TexCacheEntry::TexStatus CheckAlpha(const u32 *pixelData, u32 dstFmt, int stride, int w, int h);
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
void ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffer *framebuffer) override;
void BuildTexture(TexCacheEntry *const entry, bool replaceImages) override;
void BuildTexture(TexCacheEntry *const entry) override;
ID3D11Device *device_;
ID3D11DeviceContext *context_;
ID3D11Texture2D *DxTex(TexCacheEntry *entry) {
return (ID3D11Texture2D *)entry->texturePtr;
ID3D11Texture2D *&DxTex(TexCacheEntry *entry) {
return (ID3D11Texture2D *&)entry->texturePtr;
}
ID3D11ShaderResourceView *DxView(TexCacheEntry *entry) {
return (ID3D11ShaderResourceView *)entry->textureView;
+6 -15
View File
@@ -469,7 +469,7 @@ void TextureCacheDX9::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFrame
InvalidateLastTexture();
}
void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry, bool replaceImages) {
void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry) {
entry->status &= ~TexCacheEntry::STATUS_ALPHA_MASK;
// For the estimate, we assume cluts always point to 8888 for simplicity.
@@ -537,11 +537,6 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry, bool replaceImage
int h = gstate.getTextureHeight(0);
ReplacedTexture &replaced = replacer_.FindReplacement(cachekey, entry->fullhash, w, h);
if (replaced.GetSize(0, w, h)) {
if (replaceImages) {
// Since we're replacing the texture, we can't replace the image inside.
ReleaseTexture(entry, true);
replaceImages = false;
}
// We're replacing, so we won't scale.
scaleFactor = 1;
entry->status |= TexCacheEntry::STATUS_IS_SCALED;
@@ -571,10 +566,6 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry, bool replaceImage
}
}
if (replaceImages) {
// Make sure it's not currently set.
device_->SetTexture(0, NULL);
}
// Seems to cause problems in Tactics Ogre.
if (badMipSizes) {
maxLevel = 0;
@@ -583,9 +574,9 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry, bool replaceImage
if (IsFakeMipmapChange()) {
// NOTE: Since the level is not part of the cache key, we assume it never changes.
u8 level = std::max(0, gstate.getTexLevelOffset16() / 16);
LoadTextureLevel(*entry, replaced, level, maxLevel, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, level, maxLevel, scaleFactor, dstFmt);
} else {
LoadTextureLevel(*entry, replaced, 0, maxLevel, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, 0, maxLevel, scaleFactor, dstFmt);
}
LPDIRECT3DTEXTURE9 &texture = DxTex(entry);
if (!texture) {
@@ -595,7 +586,7 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry, bool replaceImage
// Mipmapping is only enabled when texture scaling is disabled.
if (maxLevel > 0 && scaleFactor == 1) {
for (int i = 1; i <= maxLevel; i++) {
LoadTextureLevel(*entry, replaced, i, maxLevel, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, i, maxLevel, scaleFactor, dstFmt);
}
}
@@ -670,12 +661,12 @@ D3DFORMAT ToD3D9Format(ReplacedTextureFormat fmt) {
}
}
void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int maxLevel, bool replaceImages, int scaleFactor, u32 dstFmt) {
void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int maxLevel, int scaleFactor, u32 dstFmt) {
int w = gstate.getTextureWidth(level);
int h = gstate.getTextureHeight(level);
LPDIRECT3DTEXTURE9 &texture = DxTex(&entry);
if ((level == 0 || IsFakeMipmapChange()) && (!replaceImages || texture == nullptr)) {
if ((level == 0 || IsFakeMipmapChange()) && texture == nullptr) {
// Create texture
D3DPOOL pool = D3DPOOL_MANAGED;
int usage = 0;
+2 -2
View File
@@ -63,13 +63,13 @@ protected:
private:
void UpdateSamplingParams(TexCacheEntry &entry, bool force);
void LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int maxLevel, bool replaceImages, int scaleFactor, u32 dstFmt);
void LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int maxLevel, int scaleFactor, u32 dstFmt);
D3DFORMAT GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const;
TexCacheEntry::TexStatus CheckAlpha(const u32 *pixelData, u32 dstFmt, int stride, int w, int h);
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
void ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffer *framebuffer) override;
void BuildTexture(TexCacheEntry *const entry, bool replaceImages) override;
void BuildTexture(TexCacheEntry *const entry) override;
LPDIRECT3DTEXTURE9 &DxTex(TexCacheEntry *entry) {
return *(LPDIRECT3DTEXTURE9 *)&entry->texturePtr;
+12 -31
View File
@@ -496,13 +496,9 @@ GLenum ToGLESFormat(ReplacedTextureFormat fmt) {
}
}
void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImages) {
void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
entry->status &= ~TexCacheEntry::STATUS_ALPHA_MASK;
// Never replace images in-place - there's no such thing, drivers have to fake it anyway, at least if
// the image has been in use within the last frame or two.
replaceImages = false;
// For the estimate, we assume cluts always point to 8888 for simplicity.
cacheSizeEstimate_ += EstimateTexMemoryUsage(entry);
@@ -512,10 +508,8 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImag
}
// Always generate a texture name unless it's a framebuffer, we might need it if the texture is replaced later.
if (!replaceImages) {
if (!entry->textureName) {
entry->textureName = render_->CreateTexture(GL_TEXTURE_2D);
}
if (!entry->textureName) {
entry->textureName = render_->CreateTexture(GL_TEXTURE_2D);
}
if ((entry->bufw == 0 || (gstate.texbufwidth[0] & 0xf800) != 0) && entry->addr >= PSP_GetKernelMemoryEnd()) {
@@ -581,13 +575,6 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImag
int h = gstate.getTextureHeight(0);
ReplacedTexture &replaced = replacer_.FindReplacement(cachekey, entry->fullhash, w, h);
if (replaced.GetSize(0, w, h)) {
if (replaceImages) {
// Since we're replacing the texture, we can't replace the image inside.
render_->DeleteTexture(entry->textureName);
entry->textureName = render_->CreateTexture(GL_TEXTURE_2D);
replaceImages = false;
}
// We're replacing, so we won't scale.
scaleFactor = 1;
entry->status |= TexCacheEntry::STATUS_IS_SCALED;
@@ -630,9 +617,9 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImag
if (IsFakeMipmapChange()) {
// NOTE: Since the level is not part of the cache key, we assume it never changes.
u8 level = std::max(0, gstate.getTexLevelOffset16() / 16);
LoadTextureLevel(*entry, replaced, level, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, level, scaleFactor, dstFmt);
} else
LoadTextureLevel(*entry, replaced, 0, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, 0, scaleFactor, dstFmt);
// Mipmapping only enable when texture scaling disable
int texMaxLevel = 0;
@@ -649,7 +636,7 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImag
}
} else {
for (int i = 1; i <= maxLevel; i++) {
LoadTextureLevel(*entry, replaced, i, replaceImages, scaleFactor, dstFmt);
LoadTextureLevel(*entry, replaced, i, scaleFactor, dstFmt);
}
texMaxLevel = maxLevel;
}
@@ -726,7 +713,7 @@ TexCacheEntry::TexStatus TextureCacheGLES::CheckAlpha(const uint8_t *pixelData,
return (TexCacheEntry::TexStatus)res;
}
void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, bool replaceImages, int scaleFactor, GLenum dstFmt) {
void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int scaleFactor, GLenum dstFmt) {
int w = gstate.getTextureWidth(level);
int h = gstate.getTextureHeight(level);
bool useUnpack = false;
@@ -798,17 +785,11 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r
GLuint components2 = components;
if (replaceImages) {
PROFILE_THIS_SCOPE("repltex");
Crash();
// glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, w, h, components2, dstFmt, pixelData);
} else {
PROFILE_THIS_SCOPE("loadtex");
if (IsFakeMipmapChange())
render_->TextureImage(entry.textureName, 0, w, h, components, components2, dstFmt, pixelData, GLRAllocType::ALIGNED);
else
render_->TextureImage(entry.textureName, level, w, h, components, components2, dstFmt, pixelData, GLRAllocType::ALIGNED);
}
PROFILE_THIS_SCOPE("loadtex");
if (IsFakeMipmapChange())
render_->TextureImage(entry.textureName, 0, w, h, components, components2, dstFmt, pixelData, GLRAllocType::ALIGNED);
else
render_->TextureImage(entry.textureName, level, w, h, components, components2, dstFmt, pixelData, GLRAllocType::ALIGNED);
}
bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) {
+2 -2
View File
@@ -75,14 +75,14 @@ protected:
private:
void UpdateSamplingParams(TexCacheEntry &entry, bool force);
void LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, bool replaceImages, int scaleFactor, GLenum dstFmt);
void LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &replaced, int level, int scaleFactor, GLenum dstFmt);
GLenum GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const;
TexCacheEntry::TexStatus CheckAlpha(const uint8_t *pixelData, GLenum dstFmt, int stride, int w, int h);
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
void ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffer *framebuffer) override;
void BuildTexture(TexCacheEntry *const entry, bool replaceImages) override;
void BuildTexture(TexCacheEntry *const entry) override;
GLRenderManager *render_;
+2 -2
View File
@@ -77,14 +77,14 @@ bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) {
SetGPU(new SoftGPU(ctx, draw));
break;
case GPUCORE_DIRECTX9:
#if defined(_WIN32) && !defined(__LIBRETRO__)
#if defined(_WIN32)
SetGPU(new DIRECTX9_GPU(ctx, draw));
break;
#else
return false;
#endif
case GPUCORE_DIRECTX11:
#if defined(_WIN32) && !defined(__LIBRETRO__)
#if defined(_WIN32)
SetGPU(new GPU_D3D11(ctx, draw));
break;
#else
+7 -4
View File
@@ -86,10 +86,10 @@ const CommonCommandTableEntry commonCommandTable[] = {
{ GE_CMD_LIGHTENABLE1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE },
{ GE_CMD_LIGHTENABLE2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE },
{ GE_CMD_LIGHTENABLE3, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE },
{ GE_CMD_LIGHTTYPE0, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE },
{ GE_CMD_LIGHTTYPE1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE },
{ GE_CMD_LIGHTTYPE2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE },
{ GE_CMD_LIGHTTYPE3, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE },
{ GE_CMD_LIGHTTYPE0, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_LIGHT0 },
{ GE_CMD_LIGHTTYPE1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_LIGHT1 },
{ GE_CMD_LIGHTTYPE2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_LIGHT2 },
{ GE_CMD_LIGHTTYPE3, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_LIGHT3 },
{ GE_CMD_MATERIALUPDATE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE },
// These change both shaders so need flushing.
@@ -1472,6 +1472,9 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) {
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// Rough estimate, not sure what's correct.
cyclesExecuted += EstimatePerVertexCost() * count;
if (gstate.isModeClear()) {
gpuStats.numClears++;
}
return;
}
+2 -2
View File
@@ -333,8 +333,8 @@ protected:
bool debugRecording_;
bool interruptsEnabled_;
bool resized_;
DrawType lastDraw_;
GEPrimitiveType lastPrim_;
DrawType lastDraw_ = DRAW_UNKNOWN;
GEPrimitiveType lastPrim_ = GE_PRIM_INVALID;
int vertexCost_ = 0;
+4 -7
View File
@@ -182,7 +182,9 @@ void TextureCacheVulkan::DeviceLost() {
}
samplerCache_.DeviceLost();
vulkan_->Delete().QueueDeleteSampler(samplerNearest_);
if (samplerNearest_)
vulkan_->Delete().QueueDeleteSampler(samplerNearest_);
nextTexture_ = nullptr;
}
@@ -457,7 +459,7 @@ VkFormat ToVulkanFormat(ReplacedTextureFormat fmt) {
}
}
void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry, bool replaceImages) {
void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
entry->status &= ~TexCacheEntry::STATUS_ALPHA_MASK;
VkCommandBuffer cmdInit = (VkCommandBuffer)draw_->GetNativeObject(Draw::NativeObject::INIT_COMMANDBUFFER);
@@ -526,11 +528,6 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry, bool replaceIm
int h = gstate.getTextureHeight(0);
ReplacedTexture &replaced = replacer_.FindReplacement(cachekey, entry->fullhash, w, h);
if (replaced.GetSize(0, w, h)) {
if (replaceImages) {
// Since we're replacing the texture, we can't replace the image inside.
ReleaseTexture(entry, true);
replaceImages = false;
}
// We're replacing, so we won't scale.
scaleFactor = 1;
entry->status |= TexCacheEntry::STATUS_IS_SCALED;
+1 -1
View File
@@ -129,7 +129,7 @@ private:
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
void ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffer *framebuffer) override;
void BuildTexture(TexCacheEntry *const entry, bool replaceImages) override;
void BuildTexture(TexCacheEntry *const entry) override;
VulkanContext *vulkan_ = nullptr;
VulkanDeviceAllocator *allocator_ = nullptr;
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#ifdef _WIN32
#ifdef _MSC_VER
#include "SDL/SDL.h"
#include "SDL/SDL_thread.h"
#else
+24 -6
View File
@@ -218,7 +218,8 @@ int getDisplayNumber(void) {
void SystemToast(const char *text) {
#ifdef _WIN32
MessageBox(0, text, "Toast!", MB_ICONINFORMATION);
std::wstring str = ConvertUTF8ToWString(text);
MessageBox(0, str.c_str(), L"Toast!", MB_ICONINFORMATION);
#else
puts(text);
#endif
@@ -256,7 +257,8 @@ void LaunchBrowser(const char *url) {
#if defined(MOBILE_DEVICE)
ILOG("Would have gone to %s but LaunchBrowser is not implemented on this platform", url);
#elif defined(_WIN32)
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
std::wstring wurl = ConvertUTF8ToWString(url);
ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL);
#elif defined(__APPLE__)
std::string command = std::string("open ") + url;
system(command.c_str());
@@ -273,7 +275,8 @@ void LaunchMarket(const char *url) {
#if defined(MOBILE_DEVICE)
ILOG("Would have gone to %s but LaunchMarket is not implemented on this platform", url);
#elif defined(_WIN32)
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
std::wstring wurl = ConvertUTF8ToWString(url);
ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL);
#elif defined(__APPLE__)
std::string command = std::string("open ") + url;
system(command.c_str());
@@ -290,7 +293,8 @@ void LaunchEmail(const char *email_address) {
#if defined(MOBILE_DEVICE)
ILOG("Would have opened your email client for %s but LaunchEmail is not implemented on this platform", email_address);
#elif defined(_WIN32)
ShellExecute(NULL, "open", (std::string("mailto:") + email_address).c_str(), NULL, NULL, SW_SHOWNORMAL);
std::wstring mailto = std::wstring(L"mailto:") + ConvertUTF8ToWString(email_address);
ShellExecute(NULL, L"open", mailto.c_str(), NULL, NULL, SW_SHOWNORMAL);
#elif defined(__APPLE__)
std::string command = std::string("open mailto:") + email_address;
system(command.c_str());
@@ -698,6 +702,7 @@ int main(int argc, char *argv[]) {
graphicsContext->ThreadStart();
while (true) {
double startTime = time_now_d();
SDL_Event event;
while (SDL_PollEvent(&event)) {
float mx = event.motion.x * g_dpi_scale_x;
@@ -887,9 +892,21 @@ int main(int argc, char *argv[]) {
if (!graphicsContext->ThreadFrame())
break;
}
graphicsContext->SwapBuffers();
ToggleFullScreenIfFlagSet(window);
// Simple throttling to not burn the GPU in the menu.
time_update();
if (GetUIState() != UISTATE_INGAME || !PSP_IsInited()) {
double diffTime = time_now_d() - startTime;
int sleepTime = (int)(1000.0 / 60.0) - (int)(diffTime * 1000.0);
if (sleepTime > 0)
sleep_ms(sleepTime);
}
time_update();
framecount++;
}
@@ -908,11 +925,12 @@ int main(int argc, char *argv[]) {
if (!useEmuThread) {
NativeShutdownGraphics();
}
graphicsContext->Shutdown();
graphicsContext->ThreadEnd();
graphicsContext->ShutdownFromRenderThread();
NativeShutdown();
// Destroys Draw, which is used in NativeShutdown to shutdown.
graphicsContext->ShutdownFromRenderThread();
delete graphicsContext;
SDL_PauseAudio(1);
+29 -12
View File
@@ -52,6 +52,7 @@
#include "Core/Host.h"
#include "Core/System.h"
#include "Core/Reporting.h"
#include "GPU/Common/PostShader.h"
#include "android/jni/TestRunner.h"
#include "GPU/GPUInterface.h"
#include "GPU/Common/FramebufferCommon.h"
@@ -106,6 +107,14 @@ bool DoesBackendSupportHWTess() {
return false;
}
static std::string PostShaderTranslateName(const char *value) {
I18NCategory *ps = GetI18NCategory("PostShaders");
const ShaderInfo *info = GetPostShaderInfo(value);
if (info) {
return ps->T(value, info ? info->name.c_str() : value);
}
}
void GameSettingsScreen::CreateViews() {
if (editThenRestore_) {
g_Config.loadGameConfig(gameID_);
@@ -246,7 +255,7 @@ void GameSettingsScreen::CreateViews() {
// Hide postprocess option on unsupported backends to avoid confusion.
if (GetGPUBackend() != GPUBackend::DIRECT3D9) {
I18NCategory *ps = GetI18NCategory("PostShaders");
postProcChoice_ = graphicsSettings->Add(new ChoiceWithValueDisplay(&g_Config.sPostShaderName, gr->T("Postprocessing Shader"), ps->GetName()));
postProcChoice_ = graphicsSettings->Add(new ChoiceWithValueDisplay(&g_Config.sPostShaderName, gr->T("Postprocessing Shader"), &PostShaderTranslateName));
postProcChoice_->OnClick.Handle(this, &GameSettingsScreen::OnPostProcShader);
postProcEnable_ = !g_Config.bSoftwareRendering && (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE);
postProcChoice_->SetEnabledPtr(&postProcEnable_);
@@ -613,12 +622,12 @@ void GameSettingsScreen::CreateViews() {
#if !defined(MOBILE_DEVICE) && !defined(USING_QT_UI)
networkingSettings->Add(new PopupTextInputChoice(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), "", 255, screenManager()));
#elif defined(__ANDROID__)
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress);
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), (const char *)nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress);
#else
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress);
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), (const char *)nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress);
#endif
networkingSettings->Add(new CheckBox(&g_Config.bEnableAdhocServer, n->T("Enable built-in PRO Adhoc Server", "Enable built-in PRO Adhoc Server")));
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.sMACAddress, n->T("Change Mac Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeMacAddress);
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.sMACAddress, n->T("Change Mac Address"), (const char *)nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeMacAddress);
networkingSettings->Add(new PopupSliderChoice(&g_Config.iPortOffset, 0, 60000, n->T("Port offset", "Port offset(0 = PSP compatibility)"), 100, screenManager()));
networkingSettings->Add(new CheckBox(&g_Config.bMOHH2hack, n->T("Medal of Honor Heroes 2 hack", "Medal of Honor Heroes 2 hack")));
@@ -708,6 +717,7 @@ void GameSettingsScreen::CreateViews() {
}
systemSettings->Add(new Choice(sy->T("Restore Default Settings")))->OnClick.Handle(this, &GameSettingsScreen::OnRestoreDefaultSettings);
if (!g_Config.bSimpleUI) {
systemSettings->Add(new CheckBox(&g_Config.bEnableStateUndo, sy->T("Savestate slot backups")));
systemSettings->Add(new CheckBox(&g_Config.bEnableAutoLoad, sy->T("Auto Load Newest Savestate")));
#if defined(USING_WIN_UI)
@@ -735,13 +745,20 @@ void GameSettingsScreen::CreateViews() {
}
else
SavePathInMyDocumentChoice->SetEnabled(false);
}
else {
if (installed_ && (result == S_OK)) {
std::ifstream inputFile(ConvertUTF8ToWString(installedFile));
if (!inputFile.fail() && inputFile.is_open()) {
std::string tempString;
std::getline(inputFile, tempString);
else
SavePathInOtherChoice->SetEnabled(true);
} else
SavePathInMyDocumentChoice->SetEnabled(false);
} else {
if (installed_ && (result == S_OK)) {
#ifdef _MSC_VER
std::ifstream inputFile(ConvertUTF8ToWString(installedFile));
#else
std::ifstream inputFile(installedFile);
#endif
if (!inputFile.fail() && inputFile.is_open()) {
std::string tempString;
std::getline(inputFile, tempString);
// Skip UTF-8 encoding bytes if there are any. There are 3 of them.
if (tempString.substr(0, 3) == "\xEF\xBB\xBF")
@@ -781,7 +798,7 @@ void GameSettingsScreen::CreateViews() {
#elif defined(USING_QT_UI)
systemSettings->Add(new Choice(sy->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname);
#elif defined(__ANDROID__)
systemSettings->Add(new ChoiceWithValueDisplay(&g_Config.sNickName, sy->T("Change Nickname"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname);
systemSettings->Add(new ChoiceWithValueDisplay(&g_Config.sNickName, sy->T("Change Nickname"), (const char *)nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname);
#endif
#if defined(_WIN32) || (defined(USING_QT_UI) && !defined(MOBILE_DEVICE))
if (!g_Config.bSimpleUI) {
+1 -1
View File
@@ -311,7 +311,7 @@ PostProcScreen::PostProcScreen(const std::string &title) : ListPopupScreen(title
for (int i = 0; i < (int)shaders_.size(); i++) {
if (shaders_[i].section == g_Config.sPostShaderName)
selected = i;
items.push_back(ps->T(shaders_[i].section.c_str()));
items.push_back(ps->T(shaders_[i].section.c_str(), shaders_[i].name.c_str()));
}
adaptor_ = UI::StringVectorListAdaptor(items, selected);
}
+20 -4
View File
@@ -138,6 +138,8 @@ static bool isOuya;
static bool resized = false;
static bool restarting = false;
static bool askedForStoragePermission = false;
struct PendingMessage {
std::string msg;
std::string value;
@@ -369,6 +371,9 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
g_Config.AddSearchPath(user_data_path);
g_Config.AddSearchPath(g_Config.memStickDirectory + "PSP/SYSTEM/");
g_Config.SetDefaultPath(g_Config.memStickDirectory + "PSP/SYSTEM/");
// Note that if we don't have storage permission here, loading the config will
// fail and it will be set to the default. Later, we load again when we get permission.
g_Config.Load();
g_Config.externalDirectory = external_dir;
#endif
@@ -384,6 +389,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
File::CreateDir((g_Config.memStickDirectory + "PSP/GAME").c_str());
#endif
const char *fileToLog = 0;
const char *stateToLoad = 0;
@@ -510,6 +517,13 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
else
i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) {
if (System_GetPermissionStatus(SYSTEM_PERMISSION_STORAGE) != PERMISSION_STATUS_GRANTED) {
System_AskForPermission(SYSTEM_PERMISSION_STORAGE);
}
}
I18NCategory *des = GetI18NCategory("DesktopUI");
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.
@@ -925,6 +939,12 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
Core_SetPowerSaving(value != "false");
}
if (msg == "permission_granted" && value == "storage") {
// We must have failed to load the config before, so load it now to avoid overwriting the old config
// with a freshly generated one.
ILOG("Reloading config after storage permission grant.");
g_Config.Load();
}
}
void NativeUpdate() {
@@ -1130,10 +1150,6 @@ void NativeShutdown() {
// I think we handle most globals correctly or correct-enough now.
}
void NativePermissionStatus(SystemPermission permission, PermissionStatus status) {
// TODO: Send this through the screen system? Nicer than listening to string messages
}
void PushNewGpsData(float latitude, float longitude, float altitude, float speed, float bearing, long long time) {
GPS::setGpsData(latitude, longitude, altitude, speed, bearing, time);
}
+2 -2
View File
@@ -689,7 +689,7 @@ void RemoteISOSettingsScreen::CreateViews() {
#if !defined(MOBILE_DEVICE)
PopupTextInputChoice *remoteServer = remoteisoSettings->Add(new PopupTextInputChoice(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), "", 255, screenManager()));
#else
ChoiceWithValueDisplay *remoteServer = new ChoiceWithValueDisplay(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), nullptr);
ChoiceWithValueDisplay *remoteServer = new ChoiceWithValueDisplay(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), (const char *)nullptr);
remoteisoSettings->Add(remoteServer);
remoteServer->OnClick.Handle(this, &RemoteISOSettingsScreen::OnClickRemoteServer);
#endif
@@ -701,7 +701,7 @@ void RemoteISOSettingsScreen::CreateViews() {
remoteSubdir->OnChange.Handle(this, &RemoteISOSettingsScreen::OnChangeRemoteISOSubdir);
#else
ChoiceWithValueDisplay *remoteSubdir = remoteisoSettings->Add(
new ChoiceWithValueDisplay(&g_Config.sRemoteISOSubdir, ri->T("Remote Subdirectory"), nullptr));
new ChoiceWithValueDisplay(&g_Config.sRemoteISOSubdir, ri->T("Remote Subdirectory"), (const char *)nullptr));
remoteSubdir->OnClick.Handle(this, &RemoteISOSettingsScreen::OnClickRemoteISOSubdir);
#endif
remoteSubdir->SetEnabledPtr(&g_Config.bRemoteISOManual);
+17 -9
View File
@@ -1,8 +1,15 @@
#include "Common/CommonWindows.h"
#include <mmreg.h>
#include <dsound.h>
#include <process.h>
#ifdef __MINGW32__
#define __null
#endif
#include <dsound.h>
#ifdef __MINGW32__
#undef __null
#endif
#include "thread/threadutil.h"
#include "Common/OSVersion.h"
#include "Core/Reporting.h"
@@ -317,8 +324,16 @@ int WASAPIAudioBackend::RunThread() {
REFERENCE_TIME hnsBufferDuration, hnsActualDuration;
UINT32 pNumBufferFrames;
UINT32 pNumPaddingFrames, pNumAvFrames;
short *shortBuf = nullptr;
int numSamples;
hnsBufferDuration = REFTIMES_PER_SEC;
enum {
UNKNOWN_FORMAT = 0,
IEEE_FLOAT = 1,
PCM16 = 2,
} format = UNKNOWN_FORMAT;
HRESULT hresult;
hresult = CoCreateInstance(CLSID_MMDeviceEnumerator,
NULL, /*Object is not created as the part of the aggregate */
@@ -357,12 +372,6 @@ int WASAPIAudioBackend::RunThread() {
sampleRate_ = pDeviceFormat->Format.nSamplesPerSec;
enum {
UNKNOWN_FORMAT = 0,
IEEE_FLOAT = 1,
PCM16 = 2,
} format = UNKNOWN_FORMAT;
// Don't know if PCM16 ever shows up here, the documentation only talks about float... but let's blindly
// try to support it :P
@@ -383,11 +392,10 @@ int WASAPIAudioBackend::RunThread() {
}
}
short *shortBuf = nullptr;
BYTE *pData;
hresult = pAudioRenderClient->GetBuffer(pNumBufferFrames, &pData);
int numSamples = pNumBufferFrames * pDeviceFormat->Format.nChannels;
numSamples = pNumBufferFrames * pDeviceFormat->Format.nChannels;
if (format == IEEE_FLOAT) {
memset(pData, 0, sizeof(float) * numSamples);
shortBuf = new short[pNumBufferFrames * pDeviceFormat->Format.nChannels];
-1
View File
@@ -3,7 +3,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "../../Globals.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I M P L E M E N T A T I O N //////////////////////////////////////////////////////////////////////
+2
View File
@@ -15,8 +15,10 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "stdafx.h"
#include <limits.h>
#include <algorithm>
#include <mmsystem.h>
#include "Core/HLE/sceCtrl.h"
#include "DinputDevice.h"
+6 -2
View File
@@ -45,7 +45,6 @@ extern std::vector<std::wstring> GetWideCmdLine();
class GraphicsContext;
static GraphicsContext *g_graphicsContext;
void EmuThreadFunc(GraphicsContext *graphicsContext);
void MainThreadFunc();
// On most other platforms, we let the "main" thread become the render thread and
@@ -185,10 +184,15 @@ void MainThreadFunc() {
g_Config.Save();
W32Util::ExitAndRestart();
} else {
if (g_Config.iGPUBackend == (int)GPUBackend::DIRECT3D9) {
// Allow the user to download the DX9 runtime.
LaunchBrowser("https://www.microsoft.com/en-us/download/details.aspx?id=34429");
}
}
// No safe way out without graphics.
exit(1);
ExitProcess(1);
}
GraphicsContext *graphicsContext = g_graphicsContext;
+5
View File
@@ -17,6 +17,11 @@
#include "thin3d/thin3d_create.h"
#include "thin3d/d3d11_loader.h"
#ifdef __MINGW32__
#undef __uuidof
#define __uuidof(type) IID_##type
#endif
#if PPSSPP_PLATFORM(UWP)
#error This file should not be compiled for UWP.
#endif
+1
View File
@@ -1,5 +1,6 @@
#pragma once
#include <string>
#include "Common/CommonWindows.h"
+1 -1
View File
@@ -5,7 +5,7 @@
#include "KeyMap.h"
#include "KeyboardDevice.h"
#include "../Common/CommonTypes.h"
#include "WinUser.h"
#include "../Common/CommonWindows.h"
// TODO: More keys need to be added, but this is more than
+1 -1
View File
@@ -20,7 +20,7 @@
// NOTE: Apologies for the quality of this code, this is really from pre-opensource Dolphin - that is, 2003.
// It's improving slowly, though. :)
#include "stdafx.h"
#include "Common/CommonWindows.h"
#include "Common/KeyMap.h"
#include "Common/OSVersion.h"
+6 -1
View File
@@ -185,11 +185,16 @@ namespace MainWindow {
}
bool CreateShadersSubmenu(HMENU menu) {
// NOTE: We do not load this until translations are loaded!
if (!I18NCategoryLoaded("PostShaders"))
return false;
// We only reload this initially and when a menu is actually opened.
if (!menuShaderInfoLoaded) {
ReloadAllPostShaderInfo();
menuShaderInfoLoaded = true;
}
std::vector<ShaderInfo> info = GetAllPostShaderInfo();
if (menuShaderInfo.size() == info.size() && std::equal(info.begin(), info.end(), menuShaderInfo.begin())) {
@@ -224,7 +229,7 @@ namespace MainWindow {
checkedStatus = MF_CHECKED;
}
translatedShaderName = ps->T(i->section.c_str());
translatedShaderName = ps->T(i->section.c_str(), i->name.c_str());
AppendMenu(shaderMenu, MF_STRING | MF_BYPOSITION | checkedStatus, item++, ConvertUTF8ToWString(translatedShaderName).c_str());
}
+2 -1
View File
@@ -1,4 +1,4 @@
#define NOMINMAX
#include "stdafx.h"
#include <Windows.h>
#include "Windows/TouchInputHandler.h"
@@ -7,6 +7,7 @@
#include "base/display.h"
#include "Common/CommonWindows.h"
#include "Common/CommonFuncs.h"
#include "Common/Log.h"
#include "base/NativeApp.h"
#include "Windows/MainWindow.h"
+3 -3
View File
@@ -56,7 +56,7 @@ namespace W32Util
void NiceSizeFormat(size_t size, char *out)
{
char *sizes[] = {"B","KB","MB","GB","TB","PB","EB"};
const char *sizes[] = {"B","KB","MB","GB","TB","PB","EB"};
int s = 0;
int frac = 0;
while (size>=1024)
@@ -172,7 +172,7 @@ GenericListControl::GenericListControl(HWND hwnd, const GenericListViewDef& def)
int totalListSize = rect.right-rect.left;
for (int i = 0; i < columnCount; i++) {
lvc.cx = columns[i].size * totalListSize;
lvc.pszText = columns[i].name;
lvc.pszText = (LPTSTR)columns[i].name;
if (columns[i].flags & GLVC_CENTERED)
lvc.fmt = LVCFMT_CENTER;
@@ -385,4 +385,4 @@ void GenericListControl::SelectAll()
int GenericListControl::GetSelectedIndex()
{
return ListView_GetNextItem(handle, -1, LVNI_SELECTED);
}
}
+3 -2
View File
@@ -1,5 +1,6 @@
#pragma once
#include <string>
#include "Common/CommonWindows.h"
namespace W32Util
@@ -15,7 +16,7 @@ namespace W32Util
struct GenericListViewColumn
{
wchar_t *name;
const wchar_t *name;
float size;
int flags;
};
@@ -71,4 +72,4 @@ private:
// Used for hacky workaround to fix a rare hang (see issue #5184)
volatile bool inResizeColumns;
volatile bool updating;
};
};
+6 -6
View File
@@ -15,7 +15,7 @@ TabControl::TabControl(HWND handle, bool noDisplayArea)
hasButtons = (GetWindowLong(handle,GWL_STYLE) & TCS_BUTTONS) != 0;
}
HWND TabControl::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style)
HWND TabControl::AddTabWindow(const wchar_t* className, const wchar_t *title, DWORD style)
{
TabInfo info;
info.hasBorder = (style & WS_BORDER) != 0;
@@ -50,13 +50,13 @@ HWND TabControl::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style)
return tabHandle;
}
void TabControl::AddTabDialog(Dialog* dialog, wchar_t* title)
void TabControl::AddTabDialog(Dialog* dialog, const wchar_t* title)
{
HWND handle = dialog->GetDlgHandle();
AddTab(handle,title);
}
void TabControl::AddTab(HWND handle, wchar_t* title)
void TabControl::AddTab(HWND handle, const wchar_t* title)
{
if (showTabTitles)
AppendPageToControl(title);
@@ -93,13 +93,13 @@ void TabControl::AddTab(HWND handle, wchar_t* title)
ShowTab(index);
}
int TabControl::AppendPageToControl(wchar_t* title)
int TabControl::AppendPageToControl(const wchar_t *title)
{
TCITEM tcItem;
ZeroMemory (&tcItem,sizeof (tcItem));
tcItem.mask = TCIF_TEXT;
tcItem.dwState = 0;
tcItem.pszText = title;
tcItem.pszText = (LPTSTR)title;
tcItem.cchTextMax = (int)wcslen(tcItem.pszText)+1;
tcItem.iImage = 0;
@@ -304,4 +304,4 @@ LRESULT CALLBACK TabControl::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
return (LRESULT)CallWindowProc((WNDPROC)tabControl->oldProc,hwnd,msg,wParam,lParam);
}
}
+5 -5
View File
@@ -11,9 +11,9 @@ class TabControl
public:
TabControl(HWND handle, bool noDisplayArea = false);
void HandleNotify(LPARAM lParam);
HWND AddTabWindow(wchar_t* className, wchar_t* title, DWORD style = 0);
void AddTabDialog(Dialog* dialog, wchar_t* title);
void AddTab(HWND hwnd, wchar_t* title);
HWND AddTabWindow(const wchar_t* className, const wchar_t* title, DWORD style = 0);
void AddTabDialog(Dialog* dialog, const wchar_t* title);
void AddTab(HWND hwnd, const wchar_t* title);
void ShowTab(int index, bool setControlIndex = true);
void ShowTab(HWND pageHandle);
void NextTab(bool cycle);
@@ -33,7 +33,7 @@ public:
private:
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void OnResize();
int AppendPageToControl(wchar_t* title);
int AppendPageToControl(const wchar_t* title);
struct TabInfo
{
@@ -52,4 +52,4 @@ private:
int currentTab;
bool hasButtons;
bool noDisplayArea_;
};
};
+3 -3
View File
@@ -247,7 +247,7 @@ void WindowsHost::BootDone() {
Core_EnableStepping(!g_Config.bAutoRun);
}
static std::string SymbolMapFilename(const char *currentFilename, char* ext) {
static std::string SymbolMapFilename(const char *currentFilename, const char* ext) {
FileInfo info;
std::string result = currentFilename;
@@ -256,9 +256,9 @@ static std::string SymbolMapFilename(const char *currentFilename, char* ext) {
getFileInfo(currentFilename, &info);
if (info.isDirectory) {
#ifdef _WIN32
char* slash = "\\";
const char* slash = "\\";
#else
char* slash = "/";
const char* slash = "/";
#endif
if (!endsWith(result,slash))
result += slash;
+1
View File
@@ -18,6 +18,7 @@
#include "../Core/Host.h"
#include "InputDevice.h"
#include "KeyboardDevice.h"
#include "Common/CommonWindows.h"
#include <list>
#include <memory>
+1
View File
@@ -5,6 +5,7 @@
#include "base/NativeApp.h"
#include "Core/Config.h"
#include "Common/CommonWindows.h"
#include "Common/KeyMap.h"
#include "Common/Log.h"
#include "input/input_state.h"
+1
View File
@@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "stdafx.h"
#include <algorithm>
#include <cmath>
+237
View File
@@ -0,0 +1,237 @@
/* these defines are needed when using the msvc headers from the dx9sdk directory with mingw */
#pragma once
#define WINAPI_FAMILY_ONE_PARTITION(vset, v) ((WINAPI_FAMILY & vset) == v)
#define __REQUIRED_RPCNDR_H_VERSION__ 475
/* Pointer parameters */
#define _In_
#define _Out_
#define _Inout_
#define _In_z_
#define _Inout_z_
#define _In_reads_(s)
#define _In_reads_bytes_(s)
#define _In_reads_z_(s)
#define _In_reads_or_z_(s)
#define _Out_writes_(s)
#define _Out_writes_bytes_(s)
#define _Out_writes_z_(s)
#define _Inout_updates_(s)
#define _Inout_updates_bytes_(s)
#define _Inout_updates_z_(s)
#define _Out_writes_to_(s,c)
#define _Out_writes_bytes_to_(s, c)
#define _Out_writes_all_(s)
#define _Out_writes_bytes_all_(s)
#define _Inout_updates_to_(s, c)
#define _Inout_updates_bytes_to_(s, c)
#define _Inout_updates_all_(s)
#define _Inout_updates_bytes_all_(s)
#define _In_reads_to_ptr_(p)
#define _In_reads_to_ptr_z_(p)
#define _Out_writes_to_ptr_(p)
#define _Out_writes_to_ptr_z(p)
/* Optional pointer parameters */
#define __in_opt
#define __out_opt
#define __inout_opt
#define _In_opt_
#define _Out_opt_
#define _Inout_opt_
#define _In_opt_z_
#define _Inout_opt_z_
#define _In_reads_opt_(s)
#define _In_reads_bytes_opt_(s)
#define _In_reads_opt_z_(s)
#define _Out_writes_opt_(s)
#define _Out_writes_opt_z_(s)
#define _Inout_updates_opt_(s)
#define _Inout_updates_bytes_opt_(s)
#define _Inout_updates_opt_z_(s)
#define _Out_writes_to_opt_(s, c)
#define _Out_writes_bytes_to_opt_(s, c)
#define _Out_writes_all_opt_(s)
#define _Out_writes_bytes_all_opt_(s)
#define _Inout_updates_to_opt_(s, c)
#define _Inout_updates_bytes_to_opt_(s, c)
#define _Inout_updates_all_opt_(s)
#define _Inout_updates_bytes_all_opt_(s)
#define _In_reads_to_ptr_opt_(p)
#define _In_reads_to_ptr_opt_z_(p)
#define _Out_writes_to_ptr_opt_(p)
#define _Out_writes_to_ptr_opt_z_(p)
/* Output pointer parameters */
#define _Outptr_
#define _Outptr_opt_
#define _Outptr_result_maybenull_
#define _Outptr_opt_result_maybenull_
#define _Outptr_result_z_
#define _Outptr_opt_result_z_
#define _Outptr_result_maybenull_z_
#define _Outptr_opt_result_maybenull_z_
#define _COM_Outptr_
#define _COM_Outptr_opt_
#define _COM_Outptr_result_maybenull_
#define _COM_Outptr_opt_result_maybenull_
#define _Outptr_result_buffer_(s)
#define _Outptr_result_bytebuffer_(s)
#define _Outptr_opt_result_buffer_(s)
#define _Outptr_opt_result_bytebuffer_(s)
#define _Outptr_result_buffer_to_(s, c)
#define _Outptr_result_bytebuffer_to_(s, c)
#define _Outptr_result_bytebuffer_maybenull_(s)
#define _Outptr_opt_result_buffer_to_(s, c)
#define _Outptr_opt_result_bytebuffer_to_(s, c)
#define _Result_nullonfailure_
#define _Result_zeroonfailure_
#define _Outptr_result_nullonfailure_
#define _Outptr_opt_result_nullonfailure_
#define _Outref_result_nullonfailure_
/* Output reference parameters */
#define _Outref_
#define _Outref_result_maybenull_
#define _Outref_result_buffer_(s)
#define _Outref_result_bytebuffer_(s)
#define _Outref_result_buffer_to_(s, c)
#define _Outref_result_bytebuffer_to_(s, c)
#define _Outref_result_buffer_all_(s)
#define _Outref_result_bytebuffer_all_(s)
#define _Outref_result_buffer_maybenull_(s)
#define _Outref_result_bytebuffer_maybenull_(s)
#define _Outref_result_buffer_to_maybenull_(s, c)
#define _Outref_result_bytebuffer_to_maybenull_(s, c)
#define _Outref_result_buffer_all_maybenull_(s)
#define _Outref_result_bytebuffer_all_maybenull_(s)
/* Return values */
#define _Ret_z_
#define _Ret_writes_(s)
#define _Ret_writes_bytes_(s)
#define _Ret_writes_z_(s)
#define _Ret_writes_bytes_to_(s, c)
#define _Ret_writes_maybenull_(s)
#define _Ret_writes_to_maybenull_(s, c)
#define _Ret_writes_maybenull_z_(s)
#define _Ret_maybenull_
#define _Ret_maybenull_z_
#define _Ret_null_
#define _Ret_notnull_
#define _Ret_writes_bytes_to_(s, c)
#define _Ret_writes_bytes_maybenull_(s)
#define _Ret_writes_bytes_to_maybenull_(s, c)
/* Other common annotations */
#define _In_range_(low, hi)
#define _Out_range_(low, hi)
#define _Ret_range_(low, hi)
#define _Deref_in_range_(low, hi)
#define _Deref_out_range_(low, hi)
#define _Deref_inout_range_(low, hi)
#define _Pre_equal_to_(expr)
#define _Post_equal_to_(expr)
#define _Struct_size_bytes_(size)
/* Function annotations */
#define _Called_from_function_class_(name)
#define _Check_return_ __checkReturn
#define _Function_class_(name)
#define _Raises_SEH_exception_
#define _Maybe_raises_SEH_exception_
#define _Must_inspect_result_
#define _Use_decl_annotations_
/* Success/failure annotations */
#define _Always_(anno_list)
#define _On_failure_(anno_list)
#define _Return_type_success_(expr)
#define _Success_(expr)
#define _Reserved_
#define _Const_
/* Buffer properties */
#define _Readable_bytes_(s)
#define _Readable_elements_(s)
#define _Writable_bytes_(s)
#define _Writable_elements_(s)
#define _Null_terminated_
#define _NullNull_terminated_
#define _Pre_readable_size_(s)
#define _Pre_writable_size_(s)
#define _Pre_readable_byte_size_(s)
#define _Pre_writable_byte_size_(s)
#define _Post_readable_size_(s)
#define _Post_writable_size_(s)
#define _Post_readable_byte_size_(s)
#define _Post_writable_byte_size_(s)
/* Field properties */
#define _Field_size_(s)
#define _Field_size_full_(s)
#define _Field_size_full_opt_(s)
#define _Field_size_opt_(s)
#define _Field_size_part_(s, c)
#define _Field_size_part_opt_(s, c)
#define _Field_size_bytes_(size)
#define _Field_size_bytes_full_(size)
#define _Field_size_bytes_full_opt_(s)
#define _Field_size_bytes_opt_(s)
#define _Field_size_bytes_part_(s, c)
#define _Field_size_bytes_part_opt_(s, c)
#define _Field_z_
#define _Field_range_(min, max)
/* Structural annotations */
#define _At_(e, a)
#define _At_buffer_(e, i, c, a)
#define _Group_(a)
#define _When_(e, a)
/* printf/scanf annotations */
#define _Printf_format_string_
#define _Scanf_format_string_
#define _Scanf_s_format_string_
#define _Format_string_impl_(kind,where)
#define _Printf_format_string_params_(x)
#define _Scanf_format_string_params_(x)
#define _Scanf_s_format_string_params_(x)
/* Analysis */
#define _Analysis_assume_(expr)
#define _Analysis_assume_nullterminated_(expr)
#define __in
#define __out
#define __deref_out
#define __in_bcount(size)
#define __in_bcount_opt(size)
#define __in_ecount(size)
#define __out_bcount(size)
#define __out_bcount_opt(size)
#define __out_bcount_part(size, length)
#define __out_ecount(size)
#define __out_ecount_opt(size)
#define __inout
#define __deref_out_bcount(size)
#define __deref_opt_out_bcount(size)
#define __deref_out_ecount(size)
#define __in_ecount_opt(s)
#define _In_
#define _In_opt_
#define _Null_
#define _Out_writes_bytes_opt_(s)
#define _Out_writes_bytes_(s)
#define _In_reads_bytes_(s)
#define _Inout_opt_bytecount_(s)
#define __reserved
+68 -9
View File
@@ -111,8 +111,48 @@ END
// Version
//
#include "version.rc"
// no utf-16 support when using mingw's resource compiler
#ifdef __MINGW32__
// win-version.h is generated by git-version-gen.cmd.
#include "win-version.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION PPSSPP_WIN_VERSION_COMMA
PRODUCTVERSION PPSSPP_WIN_VERSION_COMMA
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "PPSSPP PSP emulator"
VALUE "CompanyName", "Henrik Rydgård"
VALUE "FileDescription", "PPSSPP"
VALUE "FileVersion", PPSSPP_WIN_VERSION_STRING
VALUE "InternalName", "PPSSPPEmu"
VALUE "LegalCopyright", "Copyright (C) 2006-2015 by Henrik Rydgård"
VALUE "LegalTrademarks", "All product names are trademarks of their respective owners."
VALUE "OriginalFilename", "PPSSPP.exe"
VALUE "ProductName", "PPSSPP"
VALUE "ProductVersion", PPSSPP_WIN_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#else
#include "version.rc"
#endif
#endif // Neutral (Default) resources
/////////////////////////////////////////////////////////////////////////////
@@ -228,8 +268,27 @@ BEGIN
CONTROL "",IDC_GEDBG_MATRICES,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER | WS_TABSTOP,7,7,217,86
END
// no utf-16 support when using mingw's resource compiler
#ifdef __MINGW32__
IDD_ABOUTBOX DIALOGEX 0, 0, 301, 163
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,243,140,50,14
ICON IDI_PPSSPP,IDC_STATIC,10,9,21,20
LTEXT "PPSSPP",IDC_VERSION,40,8,127,9
LTEXT "Copyright (c) by Henrik Rydgård the PPSSPP project 2012-",IDC_STATIC,40,33,253,8
LTEXT "All trademarks are property of their respective owners.\nThe emulator is for educational and development purposes only and it may not be used to play games you do not legally own.",IDC_STATIC,40,102,253,24
LTEXT "PSP emulator and debugger",IDC_STATIC,40,19,253,8
LTEXT "CISO decompression code by BOOSTER",IDC_STATIC,48,73,240,8
LTEXT "PSPSDK by #pspdev (freenode)",IDC_STATIC,48,62,240,8
LTEXT "zlib by Jean-loup Gailly (compression) and Mark Adler (decompression)",IDC_STATIC,48,85,240,8
LTEXT "Additional credits:",IDC_STATIC,40,49,253,8
END
#else
#include "aboutbox.rc"
#endif
IDD_MEMORY DIALOGEX 0, 0, 566, 287
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
@@ -466,7 +525,7 @@ BEGIN
MENUITEM "Ignore Windows Key", ID_OPTIONS_IGNOREWINKEY
MENUITEM "Language...", ID_OPTIONS_LANGUAGE
MENUITEM "Control Mapping...", ID_OPTIONS_CONTROLS
MENUITEM "Display Layout Editor" ID_OPTIONS_DISPLAY_LAYOUT
MENUITEM "Display Layout Editor", ID_OPTIONS_DISPLAY_LAYOUT
MENUITEM "More Settings...", ID_OPTIONS_MORE_SETTINGS
MENUITEM SEPARATOR
MENUITEM "Fullscreen", ID_OPTIONS_FULLSCREEN
@@ -502,10 +561,10 @@ BEGIN
POPUP "Backend"
BEGIN
MENUITEM "Direct3D9" ID_OPTIONS_DIRECT3D9
MENUITEM "Direct3D11" ID_OPTIONS_DIRECT3D11
MENUITEM "OpenGL" ID_OPTIONS_OPENGL
MENUITEM "Vulkan" ID_OPTIONS_VULKAN
MENUITEM "Direct3D9", ID_OPTIONS_DIRECT3D9
MENUITEM "Direct3D11", ID_OPTIONS_DIRECT3D11
MENUITEM "OpenGL", ID_OPTIONS_OPENGL
MENUITEM "Vulkan", ID_OPTIONS_VULKAN
END
POPUP "Rendering Mode"
@@ -640,7 +699,7 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Run to Cursor", ID_DISASM_RUNTOHERE
MENUITEM "Jump to Cursor", ID_DISASM_SETPCTOHERE
MENUITEM "Set Stall" ID_GEDBG_SETSTALLADDR
MENUITEM "Set Stall", ID_GEDBG_SETSTALLADDR
MENUITEM "Toggle Breakpoint", ID_DISASM_TOGGLEBREAKPOINT
MENUITEM SEPARATOR
MENUITEM "Go to Displaylist PC", ID_GEDBG_GOTOPC
@@ -661,7 +720,7 @@ BEGIN
POPUP "gepreviewoptions"
BEGIN
MENUITEM "Export Image...", ID_GEDBG_EXPORT_IMAGE
MENUITEM "Show Prim Preview" ID_GEDBG_ENABLE_PREVIEW
MENUITEM "Show Prim Preview", ID_GEDBG_ENABLE_PREVIEW
MENUITEM "Show Replacement Filename" ID_GEDBG_REPLACEMENT_FILENAME
END
END
+13 -6
View File
@@ -19,19 +19,16 @@
#pragma warning(disable:4996)
// WinSock2 MUST be included before <windows.h> !!!
#include <WinSock2.h>
#undef _WIN32_WINNT
#if _MSC_VER < 1700
#if defined(_MSC_VER) && _MSC_VER < 1700
#error You need a newer version of Visual Studio
#else
#define _WIN32_WINNT 0x600 // Compile for Vista on Visual Studio 2012 and above
#define _WIN32_WINNT 0x601 // Compile for Win7 on Visual Studio 2012 and above
#endif
#undef WINVER
#define WINVER 0x0600
#define WINVER _WIN32_WINNT
#ifndef _WIN32_IE
#define _WIN32_IE 0x0600 // Default value is 0x0400
#endif
@@ -47,6 +44,16 @@
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
// WinSock2 MUST be included before <windows.h> !!!
#include <WinSock2.h>
#include "Common/CommonWindows.h"
#include <windowsx.h>
+2 -4
View File
@@ -791,19 +791,17 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_sendMessage(JNIEnv *env
ILOG("STORAGE PERMISSION: PENDING");
// TODO: Add support for other permissions
permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_PENDING;
NativePermissionStatus(SYSTEM_PERMISSION_STORAGE, PERMISSION_STATUS_PENDING);
} else if (msg == "permission_denied") {
ILOG("STORAGE PERMISSION: DENIED");
permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_DENIED;
NativePermissionStatus(SYSTEM_PERMISSION_STORAGE, PERMISSION_STATUS_PENDING);
} else if (msg == "permission_granted") {
ILOG("STORAGE PERMISSION: GRANTED");
permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_GRANTED;
NativePermissionStatus(SYSTEM_PERMISSION_STORAGE, PERMISSION_STATUS_PENDING);
} else if (msg == "sustained_perf_supported") {
sustainedPerfSupported = true;
}
// Ensures that the receiver can handle it on a sensible thread.
NativeMessageReceived(msg.c_str(), prm.c_str());
}
@@ -906,7 +904,7 @@ static void ProcessFrameCommands(JNIEnv *env) {
frameCmd = frameCommands.front();
frameCommands.pop();
WLOG("frameCommand! '%s' '%s'", frameCmd.command.c_str(), frameCmd.params.c_str());
ILOG("frameCommand '%s' '%s'", frameCmd.command.c_str(), frameCmd.params.c_str());
jstring cmd = env->NewStringUTF(frameCmd.command.c_str());
jstring param = env->NewStringUTF(frameCmd.params.c_str());
@@ -530,25 +530,12 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
}
private Point desiredSize = new Point();
private int badOrientationCount = 0;
@Override
public void surfaceCreated(SurfaceHolder holder) {
pixelWidth = holder.getSurfaceFrame().width();
pixelHeight = holder.getSurfaceFrame().height();
// Workaround for terrible bug when locking and unlocking the screen in landscape mode on Nexus 5X.
int requestedOr = getRequestedOrientation();
boolean requestedPortrait = requestedOr == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || requestedOr == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
boolean detectedPortrait = pixelHeight > pixelWidth;
if (badOrientationCount < 3 && requestedPortrait != detectedPortrait && requestedOr != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
Log.e(TAG, "Bad orientation detected (w=" + pixelWidth + " h=" + pixelHeight + "! Recreating activity.");
badOrientationCount++;
recreate();
return;
} else if (requestedPortrait == detectedPortrait) {
badOrientationCount = 0;
}
Log.d(TAG, "Surface created. pixelWidth=" + pixelWidth + ", pixelHeight=" + pixelHeight + " holder: " + holder.toString() + " or: " + requestedOr);
NativeApp.setDisplayParameters(pixelWidth, pixelHeight, (int)densityDpi, refreshRate);
getDesiredBackbufferSize(desiredSize);
@@ -1091,7 +1078,6 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
dlg.show();
}
public boolean processCommand(String command, String params) {
SurfaceView surfView = javaGL ? mGLSurfaceView : mSurfaceView;
if (command.equals("launchBrowser")) {
@@ -1204,7 +1190,7 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
Log.i(TAG, "Launching inputbox: " + title + " " + defString);
inputBox(title, defString, "OK");
return true;
} else if (command.equals("vibrate") && surfView != null) {
} else if (command.equals("vibrate")) {
int milliseconds = -1;
if (params != "") {
try {
@@ -1219,20 +1205,24 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
// -3 = Long press feedback
// Note that these three do not require the VIBRATE Android
// permission.
switch (milliseconds) {
case -1:
surfView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
break;
case -2:
surfView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
break;
case -3:
surfView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
break;
default:
// Requires the vibrate permission, which we don't have, so disabled.
// vibrator.vibrate(milliseconds);
break;
if (surfView != null) {
switch (milliseconds) {
case -1:
surfView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
break;
case -2:
surfView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
break;
case -3:
surfView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
break;
default:
// Requires the vibrate permission, which we don't have, so disabled.
// vibrator.vibrate(milliseconds);
break;
}
} else {
Log.e(TAG, "Can't vibrate, no surface view");
}
return true;
} else if (command.equals("finish")) {
+5 -1
View File
@@ -14,6 +14,10 @@ Vertex=fxaa.vsh
Name=Natural Colors
Fragment=natural.fsh
Vertex=natural.vsh
[NaturalA]
Name=Natural Colors (No Blur)
Fragment=naturalA.fsh
Vertex=natural.vsh
[Vignette]
Name=Vignette
Author=Henrik
@@ -82,4 +86,4 @@ Name=Video aware guest.r AA 4.o
Author=guest.r(tweak by LunaMoo)
Fragment=videoAA.fsh
Vertex=fxaa.vsh
OutputResolution=True
OutputResolution=True
+39
View File
@@ -0,0 +1,39 @@
// Natural Vision Shader with removed blur.
// by ShadX (Modded by SimoneT and Leopard20)
// http://forums.ngemu.com/showthread.php?t=76098
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212,
0.587,-0.275,-0.523,
0.114,-0.321, 0.311);
const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);
const vec3 val00 = vec3( 1.2, 1.2, 1.2);
void main()
{
vec3 c0,c1;
c0 = texture2D(sampler0,v_texcoord0.xy).xyz;
c1=RGBtoYIQ*c0;
c1=vec3(pow(c1.x,val00.x),c1.yz*val00.yz);
gl_FragColor.rgb=YIQtoRGB*c1;
gl_FragColor.a = 1.0;
}
+3
View File
@@ -37,6 +37,9 @@ do
--headless) echo "Headless mode enabled"
CMAKE_ARGS="-DHEADLESS=ON ${CMAKE_ARGS}"
;;
--libretro) echo "Build Libretro core"
CMAKE_ARGS="-DLIBRETRO=ON ${CMAKE_ARGS}"
;;
--unittest) echo "Build unittest"
CMAKE_ARGS="-DUNITTEST=ON ${CMAKE_ARGS}"
;;
-14
View File
@@ -97,25 +97,11 @@ void NativeSetMixer(void* mixer);
void NativeShutdownGraphics();
void NativeShutdown();
// Called on app.onCreate and app.onDestroy (?). Tells the app to save/restore
// light state. If app was fully rebooted between these calls, it's okay if some minor
// state is lost (position in level) but the level currently playihg, or the song
// currently being edited, or whatever, should be restored properly. In this case,
// firstTime will be set so that appropriate action can be taken (or not taken when
// it's not set).
//
// Note that NativeRestore is always called on bootup.
void NativeRestoreState(bool firstTime); // onCreate
void NativeSaveState(); // onDestroy
void NativePermissionStatus(SystemPermission permission, PermissionStatus status);
// Calls back into Java / SDL
// These APIs must be implemented by every port (for example app-android.cpp, SDLMain.cpp).
// You are free to call these.
void SystemToast(const char *text);
void ShowKeyboard();
void ShowAd(int x, int y, bool center_x);
// Vibrate either takes a number of milliseconds to vibrate unconditionally,
// or you can specify these constants for "standard" feedback. On Android,
+1 -1
View File
@@ -54,7 +54,7 @@ inline uint32_t swap32(const uint8_t* _pData) {return swap32(*(const uint32_t*)_
inline uint64_t swap64(const uint8_t* _pData) {return swap64(*(const uint64_t*)_pData);}
// Thread local storage
#ifdef _WIN32
#ifdef _MSC_VER
#define __THREAD __declspec( thread )
#else
#define __THREAD __thread
-1
View File
@@ -172,7 +172,6 @@ bool getFileInfo(const char *path, FileInfo *fileInfo) {
int result = stat64(copy.c_str(), &file_info);
#endif
if (result < 0) {
WLOG("IsDirectory: stat failed on %s", path);
fileInfo->exists = false;
return false;
}
+2 -2
View File
@@ -1,4 +1,4 @@
#ifdef _MSC_VER
#ifdef _WIN32
#include "d3d9_shader.h"
#include "thin3d/d3dx9_loader.h"
@@ -88,4 +88,4 @@ bool CompileVertexShader(LPDIRECT3DDEVICE9 device, const char *code, LPDIRECT3DV
} // namespace
#endif
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once
#include "Common/CommonWindows.h"
#include <initguid.h>
#include <string>
#include <d3d9.h>
+1 -1
View File
@@ -1,4 +1,4 @@
#ifdef _MSC_VER
#ifdef _WIN32
#include "d3d9_state.h"
#include <assert.h>
-2
View File
@@ -270,7 +270,6 @@ void CheckGLExtensions() {
}
}
#ifndef __LIBRETRO__
#ifdef WIN32
const char *wglString = 0;
if (wglGetExtensionsStringEXT)
@@ -284,7 +283,6 @@ void CheckGLExtensions() {
#elif !defined(USING_GLES2)
// const char *glXString = glXQueryExtensionString();
// gl_extensions.EXT_swap_control_tear = strstr(glXString, "GLX_EXT_swap_control_tear") != 0;
#endif
#endif
// Check the desktop extension instead of the OES one. They are very similar.
+7
View File
@@ -77,6 +77,9 @@ public:
std::string LanguageID();
I18NCategory *GetCategory(const char *categoryName);
bool HasCategory(const char *categoryName) const {
return cats_.find(categoryName) != cats_.end();
}
const char *T(const char *category, const char *key, const char *def = 0);
private:
@@ -101,6 +104,10 @@ inline I18NCategory *GetI18NCategory(const char *categoryName) {
return i18nrepo.GetCategory(categoryName);
}
inline bool I18NCategoryLoaded(const char *categoryName) {
return i18nrepo.HasCategory(categoryName);
}
inline const char *T(const char *category, const char *key, const char *def = 0) {
return i18nrepo.T(category, key, def);
}
+2 -1
View File
@@ -4,6 +4,7 @@
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <stdexcept>
#include "base/logging.h"
#include "thin3d/d3dx9_loader.h"
@@ -184,4 +185,4 @@ HRESULT dyn_D3DXCompileShader(LPCSTR pSrcData, UINT srcDataLen, CONST D3DXMACRO*
return m_TFunc_D3DXCompileShader(pSrcData, srcDataLen, pDefines,
pInclude, pFunctionName, pProfile,
Flags, ppShader, ppErrorMsgs, ppConstantTable);
}
}
+39 -2
View File
@@ -13,11 +13,17 @@
#include "Common/ColorConv.h"
#include <cassert>
#include <cfloat>
#include <D3DCommon.h>
#include <d3d11.h>
#include <d3d11_1.h>
#include <d3dcompiler.h>
#ifdef __MINGW32__
#undef __uuidof
#define __uuidof(type) IID_##type
#endif
namespace Draw {
// A problem is that we can't get the D3Dcompiler.dll without using a later SDK than 7.1, which was the last that
@@ -92,6 +98,8 @@ public:
void DrawUP(const void *vdata, int vertexCount) override;
void Clear(int mask, uint32_t colorval, float depthVal, int stencilVal);
void BeginFrame() override;
std::string GetInfoString(InfoField info) const override {
switch (info) {
case APIVERSION: return "Direct3D 11";
@@ -717,13 +725,14 @@ public:
};
Texture *D3D11DrawContext::CreateTexture(const TextureDesc &desc) {
D3D11Texture *tex = new D3D11Texture(desc);
if (!(GetDataFormatSupport(desc.format) & FMT_TEXTURE)) {
// D3D11 does not support this format as a texture format.
return false;
return nullptr;
}
D3D11Texture *tex = new D3D11Texture(desc);
bool generateMips = desc.generateMips;
if (desc.generateMips && !(GetDataFormatSupport(desc.format) & FMT_AUTOGEN_MIPS)) {
// D3D11 does not support autogenerating mipmaps for this format.
@@ -1267,6 +1276,34 @@ void D3D11DrawContext::Clear(int mask, uint32_t colorval, float depthVal, int st
}
}
void D3D11DrawContext::BeginFrame() {
context_->OMSetRenderTargets(1, &curRenderTargetView_, curDepthStencilView_);
if (curBlend_) {
context_->OMSetBlendState(curBlend_->bs, blendFactor_, 0xFFFFFFFF);
}
if (curDepth_) {
context_->OMSetDepthStencilState(curDepth_->dss, stencilRef_);
}
if (curRaster_) {
context_->RSSetState(curRaster_->rs);
}
context_->IASetInputLayout(curInputLayout_);
context_->VSSetShader(curVS_, nullptr, 0);
context_->PSSetShader(curPS_, nullptr, 0);
context_->GSSetShader(curGS_, nullptr, 0);
if (curTopology_ != D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED) {
context_->IASetPrimitiveTopology(curTopology_);
}
if (curPipeline_) {
context_->IASetVertexBuffers(0, 1, nextVertexBuffers_, (UINT *)curPipeline_->input->strides.data(), (UINT *)nextVertexBufferOffsets_);
context_->IASetIndexBuffer(nextIndexBuffer_, DXGI_FORMAT_R32_UINT, nextIndexBufferOffset_);
if (curPipeline_->dynamicUniforms) {
context_->VSSetConstantBuffers(0, 1, &curPipeline_->dynamicUniforms);
}
}
}
void D3D11DrawContext::CopyFramebufferImage(Framebuffer *srcfb, int level, int x, int y, int z, Framebuffer *dstfb, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth, int channelBit) {
D3D11Framebuffer *src = (D3D11Framebuffer *)srcfb;
D3D11Framebuffer *dst = (D3D11Framebuffer *)dstfb;
+2 -1
View File
@@ -648,7 +648,8 @@ Pipeline *D3D9Context::CreateGraphicsPipeline(const PipelineDesc &desc) {
for (auto iter : desc.shaders) {
if (!iter) {
ELOG("NULL shader passed to CreateGraphicsPipeline");
return false;
delete pipeline;
return NULL;
}
if (iter->GetStage() == ShaderStage::FRAGMENT) {
pipeline->pshader = static_cast<D3D9ShaderModule *>(iter);
+3 -1
View File
@@ -836,7 +836,9 @@ void ChoiceWithValueDisplay::Draw(UIContext &dc) {
I18NCategory *category = GetI18NCategory(category_);
std::ostringstream valueText;
if (sValue_ != nullptr) {
if (translateCallback_ && sValue_) {
valueText << translateCallback_(sValue_->c_str());
} else if (sValue_ != nullptr) {
if (category)
valueText << category->T(*sValue_);
else
+10 -5
View File
@@ -354,17 +354,22 @@ private:
class ChoiceWithValueDisplay : public UI::Choice {
public:
ChoiceWithValueDisplay(int *value, const std::string &text, LayoutParams *layoutParams = 0)
: Choice(text, layoutParams), iValue_(value), category_(nullptr) { sValue_ = nullptr; }
: Choice(text, layoutParams), iValue_(value) {}
ChoiceWithValueDisplay(std::string *value, const std::string &text, const char *category, LayoutParams *layoutParams = 0)
: Choice(text, layoutParams), sValue_(value), category_(category) { iValue_ = nullptr; }
: Choice(text, layoutParams), sValue_(value), category_(category) {}
ChoiceWithValueDisplay(std::string *value, const std::string &text, std::string (*translateCallback)(const char *value), LayoutParams *layoutParams = 0)
: Choice(text, layoutParams), sValue_(value), translateCallback_(translateCallback) {
}
virtual void Draw(UIContext &dc) override;
private:
int *iValue_;
std::string *sValue_;
const char *category_;
int *iValue_ = nullptr;
std::string *sValue_ = nullptr;
const char *category_ = nullptr;
std::string (*translateCallback_)(const char *value) = nullptr;
};
} // namespace UI
+85 -13
View File
@@ -32,11 +32,13 @@
#include "GPU/GPUState.h"
#include "base/logging.h"
#include "base/timeutil.h"
#include "gfx/gl_common.h"
#include "gfx_es2/gpu_features.h"
#include "file/vfs.h"
#include "file/zip_read.h"
#include "thin3d/thin3d_create.h"
#include "thin3d/GLRenderManager.h"
const bool WINDOW_VISIBLE = false;
const int WINDOW_WIDTH = 480;
@@ -53,20 +55,47 @@ SDL_Window *CreateHiddenWindow() {
class GLDummyGraphicsContext : public DummyGraphicsContext {
public:
GLDummyGraphicsContext() {
CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext();
SetGPUBackend(GPUBackend::OPENGL);
bool success = draw_->CreatePresets();
assert(success);
}
~GLDummyGraphicsContext() { delete draw_; }
bool InitFromRenderThread(std::string *errorMessage) override;
void ShutdownFromRenderThread() override {
delete draw_;
draw_ = nullptr;
SDL_GL_DeleteContext(glContext_);
glContext_ = nullptr;
SDL_DestroyWindow(screen_);
screen_ = nullptr;
}
Draw::DrawContext *GetDrawContext() override {
return draw_;
}
void ThreadStart() override {
renderManager_->ThreadStart();
}
bool ThreadFrame() override {
return renderManager_->ThreadFrame();
}
void ThreadEnd() override {
renderManager_->ThreadEnd();
}
void StopThread() override {
renderManager_->WaitUntilQueueIdle();
renderManager_->StopThread();
}
private:
Draw::DrawContext *draw_;
GLRenderManager *renderManager_ = nullptr;
SDL_Window *screen_;
SDL_GLContext glContext_;
};
void SDLHeadlessHost::LoadNativeAssets() {
@@ -75,7 +104,7 @@ void SDLHeadlessHost::LoadNativeAssets() {
VFSRegister("", new DirectoryAssetReader("../"));
}
bool SDLHeadlessHost::InitGraphics(std::string *error_message, GraphicsContext **ctx) {
bool GLDummyGraphicsContext::InitFromRenderThread(std::string *errorMessage) {
SDL_Init(SDL_INIT_VIDEO);
// TODO
@@ -115,29 +144,72 @@ bool SDLHeadlessHost::InitGraphics(std::string *error_message, GraphicsContext *
}
#endif
CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext();
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
SetGPUBackend(GPUBackend::OPENGL);
bool success = draw_->CreatePresets();
assert(success);
renderManager_->SetSwapFunction([&]() {
SDL_GL_SwapWindow(screen_);
});
return success;
}
bool SDLHeadlessHost::InitGraphics(std::string *error_message, GraphicsContext **ctx) {
GraphicsContext *graphicsContext = new GLDummyGraphicsContext();
*ctx = graphicsContext;
gfx_ = graphicsContext;
std::thread th([&]{
while (threadState_ == RenderThreadState::IDLE)
sleep_ms(1);
threadState_ = RenderThreadState::STARTING;
std::string err;
if (!gfx_->InitFromRenderThread(&err)) {
threadState_ = RenderThreadState::START_FAILED;
return;
}
gfx_->ThreadStart();
threadState_ = RenderThreadState::STARTED;
while (threadState_ != RenderThreadState::STOP_REQUESTED) {
if (!gfx_->ThreadFrame()) {
break;
}
gfx_->SwapBuffers();
}
threadState_ = RenderThreadState::STOPPING;
gfx_->ThreadEnd();
gfx_->ShutdownFromRenderThread();
threadState_ = RenderThreadState::STOPPED;
});
th.detach();
LoadNativeAssets();
return true;
threadState_ = RenderThreadState::START_REQUESTED;
while (threadState_ == RenderThreadState::START_REQUESTED || threadState_ == RenderThreadState::STARTING)
sleep_ms(1);
return threadState_ == RenderThreadState::STARTED;
}
void SDLHeadlessHost::ShutdownGraphics() {
gfx_->StopThread();
while (threadState_ != RenderThreadState::STOPPED)
sleep_ms(1);
gfx_->Shutdown();
delete gfx_;
gfx_ = nullptr;
SDL_GL_DeleteContext(glContext_);
glContext_ = nullptr;
SDL_DestroyWindow(screen_);
screen_ = nullptr;
}
void SDLHeadlessHost::SwapBuffers() {
gfx_->SwapBuffers();
SDL_GL_SwapWindow(screen_);
}
#endif
+12 -2
View File
@@ -38,9 +38,19 @@ public:
protected:
void LoadNativeAssets();
SDL_Window *screen_;
SDL_GLContext glContext_;
enum class RenderThreadState {
IDLE,
START_REQUESTED,
STARTING,
START_FAILED,
STARTED,
STOP_REQUESTED,
STOPPING,
STOPPED,
};
GraphicsContext *gfx_;
volatile RenderThreadState threadState_ = RenderThreadState::IDLE;
};
#endif
+42 -3
View File
@@ -32,6 +32,7 @@
#include "Windows/GPU/WindowsVulkanContext.h"
#include "base/logging.h"
#include "base/timeutil.h"
#include "gfx/gl_common.h"
#include "gfx_es2/gpu_features.h"
#include "file/vfs.h"
@@ -86,11 +87,13 @@ bool WindowsHeadlessHost::InitGraphics(std::string *error_message, GraphicsConte
}
WindowsGraphicsContext *graphicsContext = nullptr;
bool needRenderThread = false;
switch (gpuCore_) {
case GPUCORE_NULL:
case GPUCORE_GLES:
case GPUCORE_SOFTWARE:
graphicsContext = new WindowsGLContext();
needRenderThread = true;
break;
case GPUCORE_DIRECTX9:
@@ -116,17 +119,53 @@ bool WindowsHeadlessHost::InitGraphics(std::string *error_message, GraphicsConte
return false;
}
if (gpuCore_ == GPUCORE_GLES) {
// TODO: Do we need to do this here?
CheckGLExtensions();
if (needRenderThread) {
std::thread th([&]{
while (threadState_ == RenderThreadState::IDLE)
sleep_ms(1);
threadState_ = RenderThreadState::STARTING;
std::string err;
if (!gfx_->InitFromRenderThread(&err)) {
threadState_ = RenderThreadState::START_FAILED;
return;
}
gfx_->ThreadStart();
threadState_ = RenderThreadState::STARTED;
while (threadState_ != RenderThreadState::STOP_REQUESTED) {
if (!gfx_->ThreadFrame()) {
break;
}
gfx_->SwapBuffers();
}
threadState_ = RenderThreadState::STOPPING;
gfx_->ThreadEnd();
gfx_->ShutdownFromRenderThread();
threadState_ = RenderThreadState::STOPPED;
});
th.detach();
}
LoadNativeAssets();
if (needRenderThread) {
threadState_ = RenderThreadState::START_REQUESTED;
while (threadState_ == RenderThreadState::START_REQUESTED || threadState_ == RenderThreadState::STARTING)
sleep_ms(1);
return threadState_ == RenderThreadState::STARTED;
}
return true;
}
void WindowsHeadlessHost::ShutdownGraphics() {
gfx_->StopThread();
while (threadState_ != RenderThreadState::STOPPED)
sleep_ms(1);
gfx_->Shutdown();
delete gfx_;
gfx_ = nullptr;
+13
View File
@@ -18,6 +18,7 @@
#pragma once
#include "headless/StubHost.h"
#include <thread>
#undef HEADLESSHOST_CLASS
#define HEADLESSHOST_CLASS WindowsHeadlessHost
@@ -38,8 +39,20 @@ public:
protected:
void LoadNativeAssets();
enum class RenderThreadState {
IDLE,
START_REQUESTED,
STARTING,
START_FAILED,
STARTED,
STOP_REQUESTED,
STOPPING,
STOPPED,
};
HWND hWnd;
HDC hDC;
HGLRC hRC;
GraphicsContext *gfx_;
volatile RenderThreadState threadState_ = RenderThreadState::IDLE;
};
+4
View File
@@ -0,0 +1,4 @@
*.bc
*.so
*.dll
*.dylib
+26
View File
@@ -0,0 +1,26 @@
set(LIBRETRO_SRCS
libretro.cpp
LibretroGraphicsContext.cpp
LibretroGLContext.cpp
LibretroVulkanContext.cpp
libretro_vulkan.cpp)
if(WIN32)
set(LIBRETRO_SRCS ${LIBRETRO_SRCS}
LibretroD3D11Context.cpp)
endif()
include_directories(libretro)
add_library(ppsspp_libretro SHARED ${LIBRETRO_SRCS})
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}")
set_target_properties(ppsspp_libretro PROPERTIES PREFIX "")
if(ANDROID)
set_target_properties(ppsspp_libretro PROPERTIES SUFFIX "_android.so")
endif()
if(NOT MSVC)
target_link_libraries(ppsspp_libretro "-Wl,-Bsymbolic")
endif()
target_link_libraries(ppsspp_libretro ${LinkCommon})
+95
View File
@@ -0,0 +1,95 @@
#include "libretro/LibretroD3D11Context.h"
#include "thin3d/d3d11_loader.h"
#include <d3d11_1.h>
#ifdef __MINGW32__
#undef __uuidof
#define __uuidof(type) IID_##type
#endif
bool LibretroD3D11Context::Init() {
if (!LibretroHWRenderContext::Init(true))
return false;
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D11;
return true;
}
void LibretroD3D11Context::CreateDrawContext() {
if (!Libretro::environ_cb(RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE, (void **)&d3d11_) || !d3d11_) {
ERROR_LOG(G3D, "Failed to get HW rendering interface!\n");
return;
}
if (d3d11_->interface_version != RETRO_HW_RENDER_INTERFACE_D3D11_VERSION) {
ERROR_LOG(G3D, "HW render interface mismatch, expected %u, got %u!\n", RETRO_HW_RENDER_INTERFACE_D3D11_VERSION, d3d11_->interface_version);
return;
}
ptr_D3DCompile = d3d11_->D3DCompile;
ID3D11Device1 *device1 = nullptr;
d3d11_->device->QueryInterface(__uuidof(ID3D11Device1), (void **)&device1);
ID3D11DeviceContext1 *context1 = nullptr;
d3d11_->context->QueryInterface(__uuidof(ID3D11DeviceContext1), (void **)&context1);
draw_ = Draw::T3DCreateD3D11Context(d3d11_->device, d3d11_->context, device1, context1, d3d11_->featureLevel, NULL);
}
void LibretroD3D11Context::DestroyDrawContext() {
LibretroHWRenderContext::DestroyDrawContext();
d3d11_ = nullptr;
}
void LibretroD3D11Context::GotBackbuffer() {
D3D11_TEXTURE2D_DESC desc{};
desc.Width = PSP_CoreParameter().pixelWidth;
desc.Height = PSP_CoreParameter().pixelHeight;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = format_;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;
if (SUCCEEDED(d3d11_->device->CreateTexture2D(&desc, nullptr, &texture_))) {
if (SUCCEEDED(d3d11_->device->CreateRenderTargetView(texture_, nullptr, &RTView_))) {
if (SUCCEEDED(d3d11_->device->CreateShaderResourceView(texture_, nullptr, &SRView_))) {
draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, RTView_, texture_);
return;
}
RTView_->Release();
RTView_ = nullptr;
}
texture_->Release();
texture_ = nullptr;
}
}
void LibretroD3D11Context::LostBackbuffer() {
LibretroGraphicsContext::LostBackbuffer();
SRView_->Release();
SRView_ = nullptr;
RTView_->Release();
RTView_ = nullptr;
texture_->Release();
texture_ = nullptr;
}
void LibretroD3D11Context::SwapBuffers() {
ID3D11RenderTargetView *nullView = nullptr;
d3d11_->context->OMSetRenderTargets(1, &nullView, nullptr);
d3d11_->context->PSSetShaderResources(0, 1, &SRView_);
LibretroHWRenderContext::SwapBuffers();
ID3D11ShaderResourceView *nullSRV = nullptr;
d3d11_->context->PSSetShaderResources(0, 1, &nullSRV);
draw_->HandleEvent(Draw::Event::PRESENTED, 0, 0, nullptr, nullptr);
}
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#define HAVE_D3D11
#include "libretro/libretro_d3d.h"
#include "libretro/LibretroGraphicsContext.h"
class LibretroD3D11Context : public LibretroHWRenderContext {
public:
LibretroD3D11Context() : LibretroHWRenderContext(RETRO_HW_CONTEXT_DIRECT3D, 11) {}
bool Init() override;
void SwapBuffers() override;
void GotBackbuffer() override;
void LostBackbuffer() override;
void CreateDrawContext() override;
void DestroyDrawContext() override;
GPUCore GetGPUCore() override { return GPUCORE_DIRECTX11; }
const char *Ident() override { return "DirectX 11"; }
private:
retro_hw_render_interface_d3d11 *d3d11_ = nullptr;
ID3D11Texture2D *texture_ = nullptr;
ID3D11RenderTargetView *RTView_ = nullptr;
ID3D11ShaderResourceView *SRView_ = nullptr;
DXGI_FORMAT format_ = DXGI_FORMAT_R8G8B8A8_UNORM;
};
+35
View File
@@ -0,0 +1,35 @@
#include "Common/Log.h"
#include "Core/Config.h"
#include "Core/System.h"
#include "gfx_es2/gpu_features.h"
#include "libretro/LibretroGLContext.h"
bool LibretroGLContext::Init() {
if (!LibretroHWRenderContext::Init(true))
return false;
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
return true;
}
void LibretroGLContext::CreateDrawContext() {
if (!glewInitDone) {
#if !defined(IOS) && !defined(USING_GLES2)
if (glewInit() != GLEW_OK) {
ERROR_LOG(G3D, "glewInit() failed.\n");
return;
}
#endif
glewInitDone = true;
CheckGLExtensions();
}
draw_ = Draw::T3DCreateGLContext();
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
}
void LibretroGLContext::DestroyDrawContext() {
LibretroHWRenderContext::DestroyDrawContext();
renderManager_ = nullptr;
}
+43
View File
@@ -0,0 +1,43 @@
#pragma once
#include "gfx/gl_common.h"
#include "libretro/LibretroGraphicsContext.h"
#include "thin3d/GLRenderManager.h"
class LibretroGLContext : public LibretroHWRenderContext {
public:
LibretroGLContext()
#ifdef USING_GLES2
: HWRenderContext(RETRO_HW_CONTEXT_OPENGLES2)
#elif defined(HAVE_OPENGL_CORE)
: HWRenderContext(RETRO_HW_CONTEXT_OPENGL_CORE, 3, 1)
#else
: LibretroHWRenderContext(RETRO_HW_CONTEXT_OPENGL)
#endif
{
hw_render_.bottom_left_origin = true;
}
bool Init() override;
void CreateDrawContext() override;
void DestroyDrawContext() override;
void SetRenderTarget() override {
extern GLuint g_defaultFBO;
g_defaultFBO = hw_render_.get_current_framebuffer();
}
void ThreadStart() override { renderManager_->ThreadStart(); }
bool ThreadFrame() override { return renderManager_->ThreadFrame(); }
void ThreadEnd() override { renderManager_->ThreadEnd(); }
void StopThread() override {
renderManager_->WaitUntilQueueIdle();
renderManager_->StopThread();
}
GPUCore GetGPUCore() override { return GPUCORE_GLES; }
const char *Ident() override { return "OpenGL"; }
private:
GLRenderManager *renderManager_ = nullptr;
bool glewInitDone = false;
};
+129
View File
@@ -0,0 +1,129 @@
#include "libretro/LibretroGraphicsContext.h"
#include "libretro/LibretroGLContext.h"
#include "libretro/libretro.h"
#ifndef NO_VULKAN
#include "libretro/LibretroVulkanContext.h"
#endif
#ifdef _WIN32
#include "libretro/LibretroD3D11Context.h"
#endif
#include "Common/Log.h"
#include "Core/Config.h"
#include "Core/System.h"
#include "GPU/GPUInterface.h"
retro_video_refresh_t LibretroGraphicsContext::video_cb;
void retro_set_video_refresh(retro_video_refresh_t cb) { LibretroGraphicsContext::video_cb = cb; }
static void context_reset() { ((LibretroHWRenderContext *)Libretro::ctx)->ContextReset(); }
static void context_destroy() { ((LibretroHWRenderContext *)Libretro::ctx)->ContextDestroy(); }
bool LibretroHWRenderContext::Init(bool cache_context) {
hw_render_.cache_context = cache_context;
return Libretro::environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render_);
}
LibretroHWRenderContext::LibretroHWRenderContext(retro_hw_context_type context_type, unsigned version_major, unsigned version_minor) {
hw_render_.context_type = context_type;
hw_render_.version_major = version_major;
hw_render_.version_minor = version_minor;
hw_render_.context_reset = context_reset;
hw_render_.context_destroy = context_destroy;
hw_render_.depth = true;
}
void LibretroHWRenderContext::ContextReset() {
INFO_LOG(G3D, "Context reset");
// needed to restart the thread
// TODO: find a way to move this to ContextDestroy.
if (!hw_render_.cache_context && Libretro::useEmuThread && draw_ && Libretro::emuThreadState != Libretro::EmuThreadState::PAUSED) {
DestroyDrawContext();
}
if (!draw_) {
CreateDrawContext();
PSP_CoreParameter().thin3d = draw_;
bool success = draw_->CreatePresets();
assert(success);
}
GotBackbuffer();
if (gpu) {
gpu->DeviceRestore();
}
}
void LibretroHWRenderContext::ContextDestroy() {
INFO_LOG(G3D, "Context destroy");
if (Libretro::useEmuThread) {
#if 0
Libretro::EmuThreadPause();
#else
Libretro::EmuThreadStop();
#endif
}
LostBackbuffer();
gpu->DeviceLost();
if (!hw_render_.cache_context && !Libretro::useEmuThread) {
Shutdown();
}
}
void LibretroGraphicsContext::GotBackbuffer() { draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight); }
void LibretroGraphicsContext::LostBackbuffer() { draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, -1, -1); }
LibretroGraphicsContext *LibretroGraphicsContext::CreateGraphicsContext() {
LibretroGraphicsContext *ctx;
ctx = new LibretroGLContext();
if (ctx->Init()) {
return ctx;
}
delete ctx;
#ifndef NO_VULKAN
ctx = new LibretroVulkanContext();
if (ctx->Init()) {
return ctx;
}
delete ctx;
#endif
#ifdef _WIN32
ctx = new LibretroD3D11Context();
if (ctx->Init()) {
return ctx;
}
delete ctx;
ctx = new LibretroD3D9Context();
if (ctx->Init()) {
return ctx;
}
delete ctx;
#endif
#if 1
ctx = new LibretroSoftwareContext();
if (ctx->Init()) {
return ctx;
}
delete ctx;
#endif
return new LibretroNullContext();
}
+121
View File
@@ -0,0 +1,121 @@
#pragma once
#include <atomic>
#include "libretro/libretro.h"
#include "Common/GraphicsContext.h"
#include "thin3d/thin3d_create.h"
#include "Core/System.h"
#include "GPU/GPUState.h"
class LibretroGraphicsContext : public GraphicsContext {
public:
LibretroGraphicsContext() {}
~LibretroGraphicsContext() override { Shutdown(); }
virtual bool Init() = 0;
virtual void SetRenderTarget() {}
virtual GPUCore GetGPUCore() = 0;
virtual const char *Ident() = 0;
void Shutdown() override {
DestroyDrawContext();
PSP_CoreParameter().thin3d = nullptr;
}
void SwapInterval(int interval) override {}
void Resize() override {}
virtual void GotBackbuffer();
virtual void LostBackbuffer();
virtual void CreateDrawContext() {}
virtual void DestroyDrawContext() {
if (!draw_) {
return;
}
delete draw_;
draw_ = nullptr;
}
Draw::DrawContext *GetDrawContext() override { return draw_; }
static LibretroGraphicsContext *CreateGraphicsContext();
static retro_video_refresh_t video_cb;
protected:
Draw::DrawContext *draw_ = nullptr;
};
class LibretroHWRenderContext : public LibretroGraphicsContext {
public:
LibretroHWRenderContext(retro_hw_context_type context_type, unsigned version_major = 0, unsigned version_minor = 0);
bool Init(bool cache_context);
void SetRenderTarget() override {}
void SwapBuffers() override {
if (gstate_c.skipDrawReason) {
video_cb(NULL, 0, 0, 0);
} else {
video_cb(RETRO_HW_FRAME_BUFFER_VALID, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, 0);
}
}
virtual void ContextReset();
virtual void ContextDestroy();
protected:
retro_hw_render_callback hw_render_ = {};
};
#ifdef _WIN32
class LibretroD3D9Context : public LibretroHWRenderContext {
public:
LibretroD3D9Context() : LibretroHWRenderContext(RETRO_HW_CONTEXT_DIRECT3D, 9) {}
bool Init() override { return false; }
void CreateDrawContext() override {
draw_ = Draw::T3DCreateDX9Context(nullptr, nullptr, 0, nullptr, nullptr);
draw_->CreatePresets();
}
GPUCore GetGPUCore() override { return GPUCORE_DIRECTX9; }
const char *Ident() override { return "DirectX 9"; }
};
#endif
class LibretroSoftwareContext : public LibretroGraphicsContext {
public:
LibretroSoftwareContext() {}
bool Init() override { return true; }
void SwapBuffers() override { video_cb(NULL, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, 0); }
GPUCore GetGPUCore() override { return GPUCORE_SOFTWARE; }
const char *Ident() override { return "Software"; }
};
class LibretroNullContext : public LibretroGraphicsContext {
public:
LibretroNullContext() {}
bool Init() override { return true; }
void SwapBuffers() override { video_cb(NULL, 0, 0, 0); }
GPUCore GetGPUCore() override { return GPUCORE_NULL; }
const char *Ident() override { return "NULL"; }
};
namespace Libretro {
extern LibretroGraphicsContext *ctx;
extern retro_environment_t environ_cb;
enum class EmuThreadState {
DISABLED,
START_REQUESTED,
RUNNING,
PAUSE_REQUESTED,
PAUSED,
QUIT_REQUESTED,
STOPPED,
};
extern bool useEmuThread;
extern std::atomic<EmuThreadState> emuThreadState;
void EmuThreadStart();
void EmuThreadStop();
void EmuThreadPause();
} // namespace Libretro
+143
View File
@@ -0,0 +1,143 @@
#include "Common/Vulkan/VulkanLoader.h"
#include "Common/Vulkan/VulkanContext.h"
#include "Common/Vulkan/VulkanDebug.h"
#include "Common/Log.h"
#include "Core/Config.h"
#include "Core/System.h"
#include "GPU/GPUInterface.h"
#include "util/text/parsers.h"
#include "libretro/LibretroVulkanContext.h"
#include "libretro/libretro_vulkan.h"
static VulkanContext *vk;
void vk_libretro_init(VkInstance instance, VkPhysicalDevice gpu, VkSurfaceKHR surface, PFN_vkGetInstanceProcAddr get_instance_proc_addr, const char **required_device_extensions, unsigned num_required_device_extensions, const char **required_device_layers, unsigned num_required_device_layers, const VkPhysicalDeviceFeatures *required_features);
void vk_libretro_shutdown();
void vk_libretro_set_hwrender_interface(retro_hw_render_interface *hw_render_interface);
void vk_libretro_wait_for_presentation();
LibretroVulkanContext::LibretroVulkanContext()
: LibretroHWRenderContext(RETRO_HW_CONTEXT_VULKAN, VK_MAKE_VERSION(1, 0, 18)) {}
void LibretroVulkanContext::SwapBuffers() {
vk_libretro_wait_for_presentation();
LibretroHWRenderContext::SwapBuffers();
}
static bool create_device(retro_vulkan_context *context, VkInstance instance, VkPhysicalDevice gpu, VkSurfaceKHR surface, PFN_vkGetInstanceProcAddr get_instance_proc_addr, const char **required_device_extensions, unsigned num_required_device_extensions, const char **required_device_layers, unsigned num_required_device_layers, const VkPhysicalDeviceFeatures *required_features) {
init_glslang();
vk = new VulkanContext;
if (!vk->InitError().empty()) {
ERROR_LOG(G3D, "%s", vk->InitError().c_str());
return false;
}
vk_libretro_init(instance, gpu, surface, get_instance_proc_addr, required_device_extensions, num_required_device_extensions, required_device_layers, num_required_device_layers, required_features);
vk->CreateInstance({});
int physical_device = 0;
while (gpu && vk->GetPhysicalDevice(physical_device) != gpu) {
physical_device++;
}
if (!gpu) {
physical_device = vk->GetBestPhysicalDevice();
}
vk->ChooseDevice(physical_device);
vk->CreateDevice();
#ifdef _WIN32
vk->InitSurface(WINDOWSYSTEM_WIN32, nullptr, nullptr);
#elif defined(__ANDROID__)
vk->InitSurface(WINDOWSYSTEM_ANDROID, nullptr, nullptr);
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
vk->InitSurface(WINDOWSYSTEM_XLIB, nullptr, nullptr);
#elif defined(VK_USE_PLATFORM_XCB_KHR)
vk->InitSurface(WINDOWSYSTEM_XCB, nullptr, nullptr);
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
vk->InitSurface(WINDOWSYSTEM_WAYLAND, nullptr, nullptr);
#endif
if (!vk->InitQueue()) {
return false;
}
context->gpu = vk->GetPhysicalDevice(physical_device);
context->device = vk->GetDevice();
context->queue = vk->GetGraphicsQueue();
context->queue_family_index = vk->GetGraphicsQueueFamilyIndex();
context->presentation_queue = context->queue;
context->presentation_queue_family_index = context->queue_family_index;
#ifdef _DEBUG
fflush(stdout);
#endif
return true;
}
static const VkApplicationInfo *GetApplicationInfo(void) {
static VkApplicationInfo app_info{ VK_STRUCTURE_TYPE_APPLICATION_INFO };
app_info.pApplicationName = "PPSSPP";
app_info.applicationVersion = Version(PPSSPP_GIT_VERSION).ToInteger();
app_info.pEngineName = "PPSSPP";
app_info.engineVersion = 2;
app_info.apiVersion = VK_API_VERSION_1_0;
return &app_info;
}
bool LibretroVulkanContext::Init() {
if (!LibretroHWRenderContext::Init(false)) {
return false;
}
static const struct retro_hw_render_context_negotiation_interface_vulkan iface = { RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN, RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN_VERSION, GetApplicationInfo, create_device, nullptr };
Libretro::environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE, (void *)&iface);
g_Config.iGPUBackend = (int)GPUBackend::VULKAN;
return true;
}
void LibretroVulkanContext::Shutdown() {
LibretroHWRenderContext::Shutdown();
if (!vk) {
return;
}
vk->WaitUntilQueueIdle();
vk->DestroyObjects();
vk->DestroyDevice();
vk->DestroyInstance();
delete vk;
vk = nullptr;
finalize_glslang();
vk_libretro_shutdown();
}
void *LibretroVulkanContext::GetAPIContext() { return vk; }
void LibretroVulkanContext::CreateDrawContext() {
retro_hw_render_interface *vulkan;
if (!Libretro::environ_cb(RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE, (void **)&vulkan) || !vulkan) {
ERROR_LOG(G3D, "Failed to get HW rendering interface!\n");
return;
}
if (vulkan->interface_version != RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION) {
ERROR_LOG(G3D, "HW render interface mismatch, expected %u, got %u!\n", RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION, vulkan->interface_version);
return;
}
vk_libretro_set_hwrender_interface(vulkan);
vk->ReinitSurface(PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
if (!vk->InitSwapchain()) {
return;
}
draw_ = Draw::T3DCreateVulkanContext(vk, false);
}
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include "libretro/LibretroGraphicsContext.h"
class LibretroVulkanContext : public LibretroHWRenderContext {
public:
LibretroVulkanContext();
~LibretroVulkanContext() override {}
bool Init() override;
void Shutdown() override;
void SwapBuffers() override;
void *GetAPIContext() override;
void CreateDrawContext() override;
GPUCore GetGPUCore() override { return GPUCORE_VULKAN; }
const char *Ident() override { return "Vulkan"; }
};
+453
View File
@@ -0,0 +1,453 @@
DEBUG=0
WITH_DYNAREC := 1
DYNAFLAGS :=
INCFLAGS := -I.
COREFLAGS :=
CPUFLAGS :=
UNAME=$(shell uname -a)
# Cross compile ?
ifeq (,$(TARGET_ARCH))
TARGET_ARCH = $(shell uname -m)
endif
ifneq (,$(findstring 64,$(TARGET_ARCH)))
override TARGET_ARCH := x86_64
else ifneq (,$(findstring 86,$(TARGET_ARCH)))
override TARGET_ARCH := x86
endif
ifeq ($(platform),)
platform = unix
ifeq ($(UNAME),)
platform = win
else ifneq ($(findstring MINGW,$(UNAME)),)
platform = win
else ifneq ($(findstring Darwin,$(UNAME)),)
platform = osx
LDFLAGS += -lm
else ifneq ($(findstring win,$(UNAME)),)
platform = win
endif
endif
ifeq ($(platform), unix)
LDFLAGS += -lm
endif
# Dirs
CORE_DIR = ..
FFMPEGDIR = $(CORE_DIR)/ffmpeg
LIBRETRODIR = $(CORE_DIR)/libretro
COREDIR = $(CORE_DIR)/Core
COMMONDIR = $(CORE_DIR)/Common
GPUCOMMONDIR = $(CORE_DIR)/GPU/Common
GPUDIR = $(CORE_DIR)/GPU
NATIVEDIR = $(CORE_DIR)/native
EXTDIR = $(CORE_DIR)/ext
TARGET_NAME := ppsspp
FFMPEGINCFLAGS :=
FFMPEGLIBDIR :=
FFMPEGLIBS :=
# Unix
ifneq (,$(findstring unix,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
LDFLAGS += -shared -Wl,--version-script=link.T -Wl,--no-undefined
FFMPEGINCFLAGS += -I$(FFMPEGDIR)/linux/$(TARGET_ARCH)/include
FFMPEGLIBDIR := $(FFMPEGDIR)/linux/$(TARGET_ARCH)/lib
FFMPEGLDFLAGS += -L$(FFMPEGLIBDIR) -lavformat -lavcodec -lavutil -lswresample -lswscale
fpic = -fPIC
ifneq (,$(findstring gles,$(platform)))
GLES = 1
GL_LIB := -lGLESv2
else
GL_LIB := -lGL
endif
PLATFORM_EXT := unix
LDFLAGS += -lrt -ldl
# Raspberry Pi
else ifneq (,$(findstring rpi,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
LDFLAGS += -shared -Wl,--version-script=link.T
fpic = -fPIC
GLES = 1
GL_LIB := -lGLESv2
INCFLAGS += -I/opt/vc/include
CPUFLAGS += -DARMv5_ONLY
PLATFORM_EXT := unix
TARGET_ARCH = arm
LDFLAGS += -lrt -ldl
# i.MX6
else ifneq (,$(findstring imx6,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
LDFLAGS += -shared -Wl,--version-script=link.T
fpic = -fPIC
GLES = 1
GL_LIB := -lGLESv2
CPUFLAGS +=
PLATFORM_EXT := unix
TARGET_ARCH = arm
HAVE_NEON=1
FFMPEGINCFLAGS += -I$(FFMPEGDIR)/linux/$(TARGET_ARCH)/include
FFMPEGLIBDIR := $(FFMPEGDIR)/linux/$(TARGET_ARCH)/lib
FFMPEGLDFLAGS += -L$(FFMPEGLIBDIR) -lavformat -lavcodec -lavutil -lswresample -lswscale
LDFLAGS += -lrt -ldl
# OS X
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
LDFLAGS += -dynamiclib
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9 )) && echo "YES"`
ifeq ($(OSX_LT_MAVERICKS),"YES")
LDFLAGS += -mmacosx-version-min=10.5
endif
LDFLAGS += -stdlib=libc++
fpic = -fPIC
FFMPEGINCFLAGS += -I$(FFMPEGDIR)/macosx/$(TARGET_ARCH)/include
FFMPEGLIBDIR := $(FFMPEGDIR)/macosx/$(TARGET_ARCH)/lib
FFMPEGLDFLAGS += -liconv -L$(FFMPEGLIBDIR) -lavformat -lavcodec -lavutil -lswresample -lswscale
PLATCFLAGS += -D__MACOSX__
GL_LIB := -framework OpenGL
PLATFORM_EXT := darwin
# iOS
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
PLATCFLAGS += -DIOS
LDFLAGS += -dynamiclib -marm
fpic = -fPIC
GLES = 1
GL_LIB := -framework OpenGLES
HAVE_NEON = 1
FFMPEGINCFLAGS += -I$(FFMPEGDIR)/ios/universal/include
FFMPEGLIBDIR := $(FFMPEGDIR)/ios/universal/lib
FFMPEGLDFLAGS += -L$(FFMPEGLIBDIR) -lavformat -lavcodec -lavutil -lswresample -lswscale
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
CC = clang -arch armv7 -isysroot $(IOSSDK)
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
OSXVER = `sw_vers -productVersion | cut -c 4`
ifneq ($(OSXVER),9)
CC += -miphoneos-version-min=5.0
AS += -miphoneos-version-min=5.0
CXX += -miphoneos-version-min=5.0
PLATCFLAGS += -miphoneos-version-min=5.0
endif
PLATCFLAGS += -DIOS -DHAVE_POSIX_MEMALIGN
CPUFLAGS += -DARMv5_ONLY -DARM
PLATFORM_EXT := unix
TARGET_ARCH = arm
# Android
else ifneq (,$(findstring android,$(platform)))
fpic = -fPIC
TARGET := $(TARGET_NAME)_libretro_android.so
LDFLAGS += -shared -Wl,--version-script=link.T -Wl,--no-undefined -Wl,--warn-common
GL_LIB := -lGLESv2
CC = arm-linux-androideabi-gcc
CXX = arm-linux-androideabi-g++
TARGET_ARCH = arm
GLES = 1
PLATCFLAGS += -DANDROID
CPUCFLAGS +=
HAVE_NEON = 1
CPUFLAGS += -marm -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -D__arm__ -DARM_ASM -D__NEON_OPT
CFLAGS += -DANDROID
LDFLAGS += -llog -lGLESv2 -lEGL
FFMPEGINCFLAGS += -I$(FFMPEGDIR)/android/armv7/include
FFMPEGLIBDIR := $(FFMPEGDIR)/android/armv7/lib
FFMPEGLDFLAGS += -L$(FFMPEGLIBDIR) -lavformat -lavcodec -lavutil -lswresample -lswscale
PLATFORM_EXT := android
# QNX
else ifeq ($(platform), qnx)
fpic = -fPIC
TARGET := $(TARGET_NAME)_libretro_qnx.so
LDFLAGS += -shared -Wl,--version-script=link.T -Wl,--no-undefined -Wl,--warn-common
GL_LIB := -lGLESv2
CC = qcc -Vgcc_ntoarmv7le
AS = qcc -Vgcc_ntoarmv7le
CXX = QCC -Vgcc_ntoarmv7le
AR = QCC -Vgcc_ntoarmv7le
TARGET_ARCH = arm
GLES = 1
PLATCFLAGS += -D__BLACKBERRY_QNX__
HAVE_NEON = 1
CPUFLAGS += -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp -D__arm__ -DARM_ASM -D__NEON_OPT
CFLAGS += -D__QNX__
PLATFORM_EXT := unix
# ARM
else ifneq (,$(findstring armv,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
TARGET_ARCH = armv7
fpic := -fPIC
LDFLAGS += -shared -Wl,--version-script=link.T -Wl,--no-undefined
FFMPEGINCFLAGS += -I$(FFMPEGDIR)/linux/$(TARGET_ARCH)/include
FFMPEGLIBDIR := $(FFMPEGDIR)/linux/$(TARGET_ARCH)/lib
FFMPEGLDFLAGS += -L$(FFMPEGLIBDIR) -lavformat -lavcodec -lavutil -lswresample -lswscale
INCFLAGS += -I.
ifneq (,$(findstring gles,$(platform)))
GLES := 1
GL_LIB := -lGLESv2 -lEGL
LDFLAGS += -lGLESv2 -lEGL
else
GL_LIB := -lGL
endif
ifneq (,$(findstring cortexa8,$(platform)))
CPUFLAGS += -marm -mcpu=cortex-a8
else ifneq (,$(findstring cortexa9,$(platform)))
CPUFLAGS += -marm -mcpu=cortex-a9
endif
CPUFLAGS += -marm
ifneq (,$(findstring neon,$(platform)))
CPUFLAGS += -mfpu=neon -D__NEON_OPT
HAVE_NEON = 1
endif
ifneq (,$(findstring softfloat,$(platform)))
CPUFLAGS += -mfloat-abi=softfp
else ifneq (,$(findstring hardfloat,$(platform)))
CPUFLAGS += -mfloat-abi=hard
endif
CPUFLAGS += -D__arm__ -DARM_ASM
PLATCFLAGS += -DARM
LDFLAGS += -lrt -ldl
# emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
GLES := 1
CPUFLAGS +=
PLATCFLAGS += -DCC_resampler=mupen_CC_resampler -Dsinc_resampler=mupen_sinc_resampler \
-Drglgen_symbol_map=mupen_rglgen_symbol_map -Dmain_exit=mupen_main_exit \
-Dadler32=mupen_adler32 -Drarch_resampler_realloc=mupen_rarch_resampler_realloc \
-Daudio_convert_s16_to_float_C=mupen_audio_convert_s16_to_float_C -Daudio_convert_float_to_s16_C=mupen_audio_convert_float_to_s16_C \
-Daudio_convert_init_simd=mupen_audio_convert_init_simd -Drglgen_resolve_symbols_custom=mupen_rglgen_resolve_symbols_custom \
-Drglgen_resolve_symbols=mupen_rglgen_resolve_symbols
PLATFORM_EXT := unix
# Windows MSVC 2017 all architectures
else ifneq (,$(findstring windows_msvc2017,$(platform)))
PlatformSuffix = $(subst windows_msvc2017_,,$(platform))
ifneq (,$(findstring desktop,$(PlatformSuffix)))
WinPartition = desktop
MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_UNICODE -DUNICODE -DWINVER=0x0501 -D_WIN32_WINNT=0x0501
LDFLAGS += -MANIFEST -NXCOMPAT -DYNAMICBASE -DEBUG -OPT:REF -INCREMENTAL:NO -SUBSYSTEM:WINDOWS -MANIFESTUAC:"level='asInvoker' uiAccess='false'" -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1
LIBS += kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
else ifneq (,$(findstring uwp,$(PlatformSuffix)))
WinPartition = uwp
MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_APP -DWINDLL -D_UNICODE -DUNICODE -DWRL_NO_DEFAULT_LIB
LDFLAGS += -APPCONTAINER -NXCOMPAT -DYNAMICBASE -MANIFEST:NO -OPT:REF -SUBSYSTEM:CONSOLE -MANIFESTUAC:NO -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1 -DEBUG:FULL -WINMD:NO
LIBS += WindowsApp.lib
endif
CFLAGS += $(MSVC2017CompileFlags) -nologo
CXXFLAGS += $(MSVC2017CompileFlags) -nologo -EHsc
TargetArchMoniker = $(subst $(WinPartition)_,,$(PlatformSuffix))
CC = cl.exe
CXX = cl.exe
SPACE :=
SPACE := $(SPACE) $(SPACE)
BACKSLASH :=
BACKSLASH := \$(BACKSLASH)
filter_out1 = $(filter-out $(firstword $1),$1)
filter_out2 = $(call filter_out1,$(call filter_out1,$1))
reg_query = $(call filter_out2,$(subst $2,,$(shell reg query "$2" -v "$1" 2>nul)))
fix_path = $(subst $(SPACE),\ ,$(subst \,/,$1))
b1 := (
b2 := )
ProgramFiles86w := $(ProgramFiles$(b1)x86$(b2))
ProgramFiles86 := $(shell cygpath "$(ProgramFiles86w)")
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir := $(WindowsSdkDir)
WindowsSDKVersion ?= $(firstword $(foreach folder,$(subst $(subst \,/,$(WindowsSdkDir)Include/),,$(wildcard $(call fix_path,$(WindowsSdkDir)Include\*))),$(if $(wildcard $(call fix_path,$(WindowsSdkDir)Include/$(folder)/um/Windows.h)),$(folder),)))$(BACKSLASH)
WindowsSDKVersion := $(WindowsSDKVersion)
VsInstallBuildTools = $(ProgramFiles86)/Microsoft Visual Studio/2017/BuildTools
VsInstallEnterprise = $(ProgramFiles86)/Microsoft Visual Studio/2017/Enterprise
VsInstallProfessional = $(ProgramFiles86)/Microsoft Visual Studio/2017/Professional
VsInstallCommunity = $(ProgramFiles86)/Microsoft Visual Studio/2017/Community
VsInstallRoot ?= $(shell if [ -d "$(VsInstallBuildTools)" ]; then echo "$(VsInstallBuildTools)"; fi)
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallEnterprise)" ]; then echo "$(VsInstallEnterprise)"; fi)
endif
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallProfessional)" ]; then echo "$(VsInstallProfessional)"; fi)
endif
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallCommunity)" ]; then echo "$(VsInstallCommunity)"; fi)
endif
VsInstallRoot := $(VsInstallRoot)
VcCompilerToolsVer := $(shell cat "$(VsInstallRoot)/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt" | grep -o '[0-9\.]*')
VcCompilerToolsDir := $(VsInstallRoot)/VC/Tools/MSVC/$(VcCompilerToolsVer)
VcCompilerLibDir := $(VcCompilerToolsDir)/lib/$(TargetArchMoniker)
WindowsSDKSharedIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\shared")
WindowsSDKUCRTIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\ucrt")
WindowsSDKUMIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\um")
WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\$(TargetArchMoniker)")
WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\$(TargetArchMoniker)")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerLibDir)")
INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/include")
# For some reason the HostX86 compiler doesn't like compiling for x64
# ("no such file" opening a shared library), and vice-versa.
# Work around it for now by using the strictly x86 compiler for x86, and x64 for x64.
# NOTE: What about ARM?
ifneq (,$(findstring x64,$(TargetArchMoniker)))
override TARGET_ARCH = x86_64
VCCompilerToolsBinDir := $(VcCompilerToolsDir)/bin/HostX64/$(TargetArchMoniker)
LIB := $(LIB);$(CORE_DIR)/dx9sdk/Lib/x64
else
override TARGET_ARCH = x86
VCCompilerToolsBinDir := $(VcCompilerToolsDir)/bin/HostX86/$(TargetArchMoniker)
LIB := $(LIB);$(CORE_DIR)/dx9sdk/Lib/x86
endif
PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VsInstallRoot)/Common7/IDE")
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir);$(FFMPEGDIR)/Windows/$(TARGET_ARCH)/lib
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
PLATFORM_EXT := win32
FFMPEGINCFLAGS += -I$(FFMPEGDIR)/Windows/$(TARGET_ARCH)/include
FFMPEGLIBDIR := $(FFMPEGDIR)/Windows/$(TARGET_ARCH)/lib
FFMPEGLDFLAGS += -LIBPATH:$(FFMPEGLIBDIR)
GL_LIB := opengl32.lib
LDFLAGS += ws2_32.lib user32.lib shell32.lib avcodec.lib avutil.lib swresample.lib swscale.lib avformat.lib advapi32.lib winmm.lib gdi32.lib d3d9.lib d3dx9.lib
# Windows
else ifneq (,$(findstring win,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dll
CFLAGS += -D_UNICODE -DUNICODE
CXXFLAGS += -fpermissive -Wno-multichar -D_UNICODE -DUNICODE
LDFLAGS += -shared -Wl,--no-undefined -static-libgcc -static-libstdc++ -Wl,--version-script=link.T -lwinmm -lgdi32 -lwsock32 -lws2_32 -ld3d9 -ld3dx9
GL_LIB := -lopengl32
PLATFORM_EXT := win32
FFMPEGINCFLAGS += -I$(FFMPEGDIR)/Windows/$(TARGET_ARCH)/include
FFMPEGLDFLAGS += -lavformat -lavcodec -lavutil -lswresample -lswscale
INCFLAGS += -include $(CORE_DIR)/Windows/mingw_defines.h
ifneq (,$(findstring 64,$(TARGET_ARCH)))
LDFLAGS += -L$(CORE_DIR)/dx9sdk/Lib/x64
else
LDFLAGS += -L$(CORE_DIR)/dx9sdk/Lib/x86
endif
fpic = -fPIC
CC = gcc
CXX = g++
endif
include Makefile.common
ifeq ($(GLES), 1)
GLFLAGS += -DGLES -DUSING_GLES2
else
GLFLAGS += -DHAVE_OPENGL
endif
COREFLAGS += -D__LIBRETRO__ -DPPSSPP -DUSE_FFMPEG -DGLEW_STATIC -DGLEW_NO_GLU
ifeq ($(DEBUG), 1)
ifneq (,$(findstring msvc,$(platform)))
CPUOPTS += -Od -MDd -Zi -FS
LDFLAGS += -DEBUG
else
CPUOPTS += -O0 -g
endif
CPUOPTS += -D_DEBUG
else
CPUOPTS += -O2 -D_NDEBUG
endif
ifeq (,$(findstring msvc,$(platform)))
CXXFLAGS += -std=c++11
endif
### Finalize ###
OBJECTS += $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o) $(ASMFILES:.S=.o)
CXXFLAGS += $(CPUOPTS) $(COREFLAGS) $(FFMPEGINCFLAGS) $(INCFLAGS) $(INCFLAGS_PLATFORM) $(PLATCFLAGS) $(fpic) $(PLATCFLAGS) $(CPUFLAGS) $(GLFLAGS) $(DYNAFLAGS)
CFLAGS += $(CPUOPTS) $(COREFLAGS) $(FFMPEGINCFLAGS) $(INCFLAGS) $(INCFLAGS_PLATFORM) $(PLATCFLAGS) $(fpic) $(PLATCFLAGS) $(CPUFLAGS) $(GLFLAGS) $(DYNAFLAGS)
LDFLAGS += $(FFMPEGLDFLAGS) $(fpic)
ifeq (,$(findstring android,$(platform))$(findstring msvc,$(platform)))
LDFLAGS += -lpthread
endif
OBJOUT = -o
LINKOUT = -o
ifneq (,$(findstring msvc,$(platform)))
OBJOUT = -Fo
LINKOUT = -out:
LD = link.exe
else ifneq (,$(findstring osx,$(platform)))
LD = $(CXX)
else
LD = $(CXX)
CFLAGS += -ffunction-sections -fdata-sections
CXXFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += -Wl,--gc-sections
endif
all: $(TARGET)
%.o: %.S
$(AS) $(CFLAGS) -c $(OBJOUT)$@ $<
%.o: %.c
$(CC) $(CFLAGS) -c $(OBJOUT)$@ $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $(OBJOUT)$@ $<
$(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $A $(OBJECTS)
else
$(LD) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(GL_LIB)
endif
clean:
rm -f $(OBJECTS) $(TARGET)
.PHONY: clean
print-%:
@echo '$*=$($*)'
+692
View File
@@ -0,0 +1,692 @@
FFMPEGDIR = $(CORE_DIR)/ffmpeg
LIBRETRODIR = $(CORE_DIR)/libretro
COREDIR = $(CORE_DIR)/Core
COMMONDIR = $(CORE_DIR)/Common
GPUCOMMONDIR = $(CORE_DIR)/GPU/Common
GPUDIR = $(CORE_DIR)/GPU
EXTDIR = $(CORE_DIR)/ext
NATIVEDIR = $(EXTDIR)/native
INCFLAGS += \
-I$(CORE_DIR) \
-I$(COMMONDIR) \
-I$(CORE_DIR)/libretro \
-I$(EXTDIR)/native \
-I$(EXTDIR)/zlib \
-I$(EXTDIR)/snappy \
-I$(FFMPEGDIR) \
$(FFMPEGINCFLAGS) \
-I$(EXTDIR)/cityhash \
-I$(EXTDIR)/armips \
-I$(NATIVEDIR)/ext \
-I$(NATIVEDIR) \
-I$(EXTDIR)/libkirk \
-I$(EXTDIR)/xbrz \
-I$(EXTDIR)/xxhash \
-I$(EXTDIR)/glew
ifeq ($(PLATFORM_EXT), android)
INCFLAGS += -I$(NATIVEDIR)/ext/libzip
SOURCES_C += \
$(NATIVEDIR)/ext/libzip/mkstemp.c \
$(NATIVEDIR)/ext/libzip/zip_add.c \
$(NATIVEDIR)/ext/libzip/zip_add_dir.c \
$(NATIVEDIR)/ext/libzip/zip_close.c \
$(NATIVEDIR)/ext/libzip/zip_delete.c \
$(NATIVEDIR)/ext/libzip/zip_dirent.c \
$(NATIVEDIR)/ext/libzip/zip_entry_free.c \
$(NATIVEDIR)/ext/libzip/zip_entry_new.c \
$(NATIVEDIR)/ext/libzip/zip_err_str.c \
$(NATIVEDIR)/ext/libzip/zip_error.c \
$(NATIVEDIR)/ext/libzip/zip_error_clear.c \
$(NATIVEDIR)/ext/libzip/zip_error_get.c \
$(NATIVEDIR)/ext/libzip/zip_error_get_sys_type.c \
$(NATIVEDIR)/ext/libzip/zip_error_strerror.c \
$(NATIVEDIR)/ext/libzip/zip_error_to_str.c \
$(NATIVEDIR)/ext/libzip/zip_fclose.c \
$(NATIVEDIR)/ext/libzip/zip_file_error_clear.c \
$(NATIVEDIR)/ext/libzip/zip_file_error_get.c \
$(NATIVEDIR)/ext/libzip/zip_file_get_offset.c \
$(NATIVEDIR)/ext/libzip/zip_file_strerror.c \
$(NATIVEDIR)/ext/libzip/zip_filerange_crc.c \
$(NATIVEDIR)/ext/libzip/zip_fopen.c \
$(NATIVEDIR)/ext/libzip/zip_fopen_index.c \
$(NATIVEDIR)/ext/libzip/zip_fread.c \
$(NATIVEDIR)/ext/libzip/zip_free.c \
$(NATIVEDIR)/ext/libzip/zip_get_archive_comment.c \
$(NATIVEDIR)/ext/libzip/zip_get_archive_flag.c \
$(NATIVEDIR)/ext/libzip/zip_get_file_comment.c \
$(NATIVEDIR)/ext/libzip/zip_get_name.c \
$(NATIVEDIR)/ext/libzip/zip_get_num_files.c \
$(NATIVEDIR)/ext/libzip/zip_memdup.c \
$(NATIVEDIR)/ext/libzip/zip_name_locate.c \
$(NATIVEDIR)/ext/libzip/zip_new.c \
$(NATIVEDIR)/ext/libzip/zip_open.c \
$(NATIVEDIR)/ext/libzip/zip_rename.c \
$(NATIVEDIR)/ext/libzip/zip_replace.c \
$(NATIVEDIR)/ext/libzip/zip_set_archive_comment.c \
$(NATIVEDIR)/ext/libzip/zip_set_archive_flag.c \
$(NATIVEDIR)/ext/libzip/zip_set_file_comment.c \
$(NATIVEDIR)/ext/libzip/zip_set_name.c \
$(NATIVEDIR)/ext/libzip/zip_source_buffer.c \
$(NATIVEDIR)/ext/libzip/zip_source_file.c \
$(NATIVEDIR)/ext/libzip/zip_source_filep.c \
$(NATIVEDIR)/ext/libzip/zip_source_free.c \
$(NATIVEDIR)/ext/libzip/zip_source_function.c \
$(NATIVEDIR)/ext/libzip/zip_source_zip.c \
$(NATIVEDIR)/ext/libzip/zip_stat.c \
$(NATIVEDIR)/ext/libzip/zip_stat_index.c \
$(NATIVEDIR)/ext/libzip/zip_stat_init.c \
$(NATIVEDIR)/ext/libzip/zip_strerror.c \
$(NATIVEDIR)/ext/libzip/zip_unchange.c \
$(NATIVEDIR)/ext/libzip/zip_unchange_all.c \
$(NATIVEDIR)/ext/libzip/zip_unchange_archive.c \
$(NATIVEDIR)/ext/libzip/zip_unchange_data.c
SOURCES_C +=\
$(NATIVEDIR)/gfx_es2/gl3stub.c \
$(NATIVEDIR)/math/fast/fast_math.c \
$(NATIVEDIR)/math/fast/fast_matrix.c
endif
SOURCES_C += $(EXTDIR)/glew/glew.c
SOURCES_C += \
$(EXTDIR)/libkirk/AES.c \
$(EXTDIR)/libkirk/amctrl.c \
$(EXTDIR)/libkirk/SHA1.c \
$(EXTDIR)/libkirk/bn.c \
$(EXTDIR)/libkirk/ec.c \
$(EXTDIR)/libkirk/kirk_engine.c
SOURCES_C += \
$(NATIVEDIR)/ext/libpng17/png.c \
$(NATIVEDIR)/ext/libpng17/pngerror.c \
$(NATIVEDIR)/ext/libpng17/pngget.c \
$(NATIVEDIR)/ext/libpng17/pngmem.c \
$(NATIVEDIR)/ext/libpng17/pngread.c \
$(NATIVEDIR)/ext/libpng17/pngrio.c \
$(NATIVEDIR)/ext/libpng17/pngrtran.c \
$(NATIVEDIR)/ext/libpng17/pngrutil.c \
$(NATIVEDIR)/ext/libpng17/pngset.c \
$(NATIVEDIR)/ext/libpng17/pngtrans.c \
$(NATIVEDIR)/ext/libpng17/pngwio.c \
$(NATIVEDIR)/ext/libpng17/pngwrite.c \
$(NATIVEDIR)/ext/libpng17/pngwtran.c \
$(NATIVEDIR)/ext/libpng17/pngwutil.c
SOURCES_C += $(EXTDIR)/sfmt19937/SFMT.c
SOURCES_C += $(EXTDIR)/xxhash.c
SOURCES_CXX += \
$(EXTDIR)/snappy/snappy-c.cpp \
$(EXTDIR)/snappy/snappy.cpp
SOURCES_CXX += $(EXTDIR)/xbrz/xbrz.cpp
SOURCES_CXX += \
$(NATIVEDIR)/ext/vjson/json.cpp \
$(NATIVEDIR)/ext/vjson/block_allocator.cpp
SOURCES_CXX += $(NATIVEDIR)/ext/cityhash/city.cpp
SOURCES_CXX += \
$(COMMONDIR)/Crypto/md5.cpp \
$(COMMONDIR)/Crypto/sha1.cpp \
$(COMMONDIR)/Crypto/sha256.cpp
SOURCES_CXX += \
$(COMMONDIR)/ChunkFile.cpp \
$(COMMONDIR)/ConsoleListener.cpp \
$(COMMONDIR)/FileUtil.cpp \
$(COMMONDIR)/KeyMap.cpp \
$(COMMONDIR)/LogManager.cpp \
$(COMMONDIR)/OSVersion.cpp \
$(COMMONDIR)/MemoryUtil.cpp \
$(COMMONDIR)/Misc.cpp \
$(COMMONDIR)/MsgHandler.cpp \
$(COMMONDIR)/StringUtils.cpp \
$(COMMONDIR)/Timer.cpp \
$(COMMONDIR)/ThreadPools.cpp
SOURCES_CXX += \
$(GPUCOMMONDIR)/VertexDecoderCommon.cpp \
$(GPUCOMMONDIR)/GPUStateUtils.cpp \
$(GPUCOMMONDIR)/DrawEngineCommon.cpp \
$(GPUCOMMONDIR)/SplineCommon.cpp \
$(GPUCOMMONDIR)/FramebufferCommon.cpp \
$(GPUCOMMONDIR)/ShaderId.cpp \
$(GPUCOMMONDIR)/ShaderCommon.cpp \
$(GPUCOMMONDIR)/ShaderUniforms.cpp \
$(GPUCOMMONDIR)/ShaderTranslation.cpp \
$(GPUCOMMONDIR)/GPUDebugInterface.cpp \
$(GPUCOMMONDIR)/DepalettizeShaderCommon.cpp \
$(GPUCOMMONDIR)/TransformCommon.cpp \
$(GPUCOMMONDIR)/IndexGenerator.cpp \
$(GPUCOMMONDIR)/TextureDecoder.cpp \
$(GPUCOMMONDIR)/PostShader.cpp \
$(COMMONDIR)/ColorConv.cpp \
$(GPUDIR)/Debugger/Breakpoints.cpp \
$(GPUDIR)/Debugger/Stepping.cpp \
$(GPUDIR)/Debugger/Record.cpp \
$(GPUDIR)/Common/TextureCacheCommon.cpp \
$(GPUDIR)/Common/TextureScalerCommon.cpp \
$(GPUDIR)/Common/SoftwareTransformCommon.cpp \
$(GPUDIR)/Common/StencilCommon.cpp \
$(GPUDIR)/Software/TransformUnit.cpp \
$(GPUDIR)/Software/SoftGpu.cpp \
$(GPUDIR)/Software/Sampler.cpp \
$(GPUDIR)/GeDisasm.cpp \
$(GPUDIR)/GPUCommon.cpp \
$(GPUDIR)/GPU.cpp \
$(GPUDIR)/GPUState.cpp \
$(GPUDIR)/Math3D.cpp \
$(GPUDIR)/Null/NullGpu.cpp \
$(GPUDIR)/Software/Clipper.cpp \
$(GPUDIR)/Software/Lighting.cpp \
$(GPUDIR)/Software/Rasterizer.cpp \
$(GPUDIR)/GLES/DepalettizeShaderGLES.cpp \
$(GPUDIR)/GLES/VertexShaderGeneratorGLES.cpp \
$(GPUDIR)/GLES/DrawEngineGLES.cpp \
$(GPUDIR)/GLES/GPU_GLES.cpp \
$(GPUDIR)/GLES/FragmentShaderGeneratorGLES.cpp \
$(GPUDIR)/GLES/FragmentTestCacheGLES.cpp \
$(GPUDIR)/GLES/FramebufferManagerGLES.cpp \
$(GPUDIR)/GLES/TextureCacheGLES.cpp \
$(GPUDIR)/GLES/TextureScalerGLES.cpp \
$(GPUDIR)/GLES/ShaderManagerGLES.cpp \
$(GPUDIR)/GLES/StateMappingGLES.cpp \
$(GPUDIR)/GLES/StencilBufferGLES.cpp \
$(EXTDIR)/native/base/backtrace.cpp \
$(EXTDIR)/native/base/buffer.cpp \
$(EXTDIR)/native/base/colorutil.cpp \
$(EXTDIR)/native/base/display.cpp \
$(EXTDIR)/native/base/logging.cpp \
$(EXTDIR)/native/base/stringutil.cpp \
$(EXTDIR)/native/base/timeutil.cpp \
$(EXTDIR)/native/data/compression.cpp \
$(EXTDIR)/glslang/OGLCompilersDLL/InitializeDll.cpp \
$(EXTDIR)/glslang/glslang/GenericCodeGen/CodeGen.cpp \
$(EXTDIR)/glslang/glslang/GenericCodeGen/Link.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/Constant.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/InfoSink.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/Initialize.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/Intermediate.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/IntermTraverse.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/ParseContextBase.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/ParseHelper.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/PoolAlloc.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/RemoveTree.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/Scan.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/ShaderLang.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/SymbolTable.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/Versions.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/glslang_tab.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/intermOut.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/iomapper.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/limits.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/linkValidate.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/parseConst.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/propagateNoContraction.cpp \
$(EXTDIR)/glslang/glslang/MachineIndependent/reflection.cpp \
$(EXTDIR)/glslang/SPIRV/InReadableOrder.cpp \
$(EXTDIR)/glslang/SPIRV/GlslangToSpv.cpp \
$(EXTDIR)/glslang/SPIRV/Logger.cpp \
$(EXTDIR)/glslang/SPIRV/SpvBuilder.cpp \
$(EXTDIR)/SPIRV-Cross/spirv_cfg.cpp \
$(EXTDIR)/SPIRV-Cross/spirv_cross.cpp \
$(EXTDIR)/SPIRV-Cross/spirv_glsl.cpp \
$(EXTDIR)/SPIRV-Cross/spirv_hlsl.cpp
ifeq ($(PLATFORM_EXT), win32)
SOURCES_CXX += $(COMMONDIR)/MemArenaWin32.cpp \
$(EXTDIR)/glslang/glslang/OSDependent/Windows/ossource.cpp \
$(NATIVEDIR)/gfx_es2/draw_text_win.cpp
else ifeq ($(PLATFORM_EXT), darwin)
SOURCES_CXX += $(COMMONDIR)/MemArenaDarwin.cpp \
$(EXTDIR)/glslang/glslang/OSDependent/Unix/ossource.cpp
else ifeq ($(PLATFORM_EXT), android)
SOURCES_CXX += $(COMMONDIR)/MemArenaAndroid.cpp \
$(EXTDIR)/glslang/glslang/OSDependent/Unix/ossource.cpp \
$(NATIVEDIR)/gfx_es2/draw_text_android.cpp
else
SOURCES_CXX += $(COMMONDIR)/MemArenaPosix.cpp \
$(EXTDIR)/glslang/glslang/OSDependent/Unix/ossource.cpp
endif
SOURCES_CXX += $(NATIVEDIR)/math/dataconv.cpp \
$(NATIVEDIR)/file/fd_util.cpp \
$(NATIVEDIR)/file/file_util.cpp \
$(NATIVEDIR)/file/ini_file.cpp \
$(NATIVEDIR)/file/free.cpp \
$(NATIVEDIR)/file/zip_read.cpp \
$(NATIVEDIR)/gfx/gl_debug_log.cpp \
$(NATIVEDIR)/gfx/texture_atlas.cpp \
$(NATIVEDIR)/gfx/d3d9_shader.cpp \
$(NATIVEDIR)/gfx/d3d9_state.cpp \
$(NATIVEDIR)/gfx_es2/draw_buffer.cpp \
$(NATIVEDIR)/gfx_es2/draw_text.cpp \
$(NATIVEDIR)/gfx_es2/gpu_features.cpp \
$(NATIVEDIR)/gfx_es2/glsl_program.cpp \
$(NATIVEDIR)/i18n/i18n.cpp \
$(NATIVEDIR)/image/zim_load.cpp \
$(NATIVEDIR)/image/png_load.cpp \
$(NATIVEDIR)/input/gesture_detector.cpp \
$(NATIVEDIR)/input/input_state.cpp \
$(NATIVEDIR)/math/curves.cpp \
$(NATIVEDIR)/math/expression_parser.cpp \
$(NATIVEDIR)/math/lin/matrix4x4.cpp \
$(NATIVEDIR)/math/lin/plane.cpp \
$(NATIVEDIR)/math/lin/quat.cpp \
$(NATIVEDIR)/math/lin/vec3.cpp \
$(NATIVEDIR)/net/http_client.cpp \
$(NATIVEDIR)/net/resolve.cpp \
$(NATIVEDIR)/net/url.cpp \
$(NATIVEDIR)/thin3d/thin3d.cpp \
$(NATIVEDIR)/thin3d/thin3d_gl.cpp \
$(NATIVEDIR)/thin3d/GLRenderManager.cpp \
$(NATIVEDIR)/thin3d/GLQueueRunner.cpp \
$(NATIVEDIR)/thin3d/DataFormatGL.cpp \
$(NATIVEDIR)/thread/threadutil.cpp \
$(NATIVEDIR)/thread/threadpool.cpp \
$(NATIVEDIR)/ui/screen.cpp \
$(NATIVEDIR)/ui/ui.cpp \
$(NATIVEDIR)/ui/ui_context.cpp \
$(NATIVEDIR)/ui/ui_screen.cpp \
$(NATIVEDIR)/ui/ui_tween.cpp \
$(NATIVEDIR)/ui/view.cpp \
$(NATIVEDIR)/ui/viewgroup.cpp \
$(NATIVEDIR)/util/hash/hash.cpp \
$(NATIVEDIR)/util/text/utf8.cpp \
$(NATIVEDIR)/util/text/parsers.cpp \
$(NATIVEDIR)/util/text/wrap_text.cpp \
$(NATIVEDIR)/ext/jpge/jpgd.cpp \
$(NATIVEDIR)/ext/jpge/jpge.cpp \
$(COREDIR)/AVIDump.cpp \
$(COREDIR)/Config.cpp \
$(COREDIR)/TextureReplacer.cpp \
$(COREDIR)/Core.cpp \
$(COREDIR)/WaveFile.cpp \
$(COREDIR)/FileLoaders/HTTPFileLoader.cpp \
$(COREDIR)/FileLoaders/CachingFileLoader.cpp \
$(COREDIR)/FileLoaders/DiskCachingFileLoader.cpp \
$(COREDIR)/FileLoaders/RetryingFileLoader.cpp \
$(COREDIR)/FileLoaders/RamCachingFileLoader.cpp \
$(COREDIR)/FileLoaders/LocalFileLoader.cpp \
$(COREDIR)/CoreTiming.cpp \
$(COREDIR)/CwCheat.cpp \
$(COREDIR)/HDRemaster.cpp \
$(COREDIR)/Debugger/Breakpoints.cpp \
$(COREDIR)/Debugger/SymbolMap.cpp \
$(COREDIR)/Dialog/PSPDialog.cpp \
$(COREDIR)/Dialog/PSPGamedataInstallDialog.cpp \
$(COREDIR)/Dialog/PSPMsgDialog.cpp \
$(COREDIR)/Dialog/PSPNetconfDialog.cpp \
$(COREDIR)/Dialog/PSPOskDialog.cpp \
$(COREDIR)/Dialog/PSPSaveDialog.cpp \
$(COREDIR)/Dialog/PSPScreenshotDialog.cpp \
$(COREDIR)/Dialog/SavedataParam.cpp \
$(COREDIR)/ELF/ElfReader.cpp \
$(COREDIR)/ELF/PBPReader.cpp \
$(COREDIR)/ELF/PrxDecrypter.cpp \
$(COREDIR)/ELF/ParamSFO.cpp \
$(COREDIR)/FileSystems/tlzrc.cpp \
$(COREDIR)/FileSystems/BlockDevices.cpp \
$(COREDIR)/FileSystems/BlobFileSystem.cpp \
$(COREDIR)/FileSystems/DirectoryFileSystem.cpp \
$(COREDIR)/FileSystems/FileSystem.cpp \
$(COREDIR)/FileSystems/ISOFileSystem.cpp \
$(COREDIR)/FileSystems/MetaFileSystem.cpp \
$(COREDIR)/FileSystems/VirtualDiscFileSystem.cpp \
$(COREDIR)/Font/PGF.cpp \
$(COREDIR)/HLE/HLE.cpp \
$(COREDIR)/HLE/KUBridge.cpp \
$(COREDIR)/HLE/sceSha256.cpp \
$(COREDIR)/HLE/sceG729.cpp \
$(COREDIR)/HLE/sceSfmt19937.cpp \
$(COREDIR)/HLE/ReplaceTables.cpp \
$(COREDIR)/HLE/HLEHelperThread.cpp \
$(COREDIR)/HLE/HLETables.cpp \
$(COREDIR)/HLE/sceAdler.cpp \
$(COREDIR)/HLE/sceAtrac.cpp \
$(COREDIR)/HLE/sceAudio.cpp \
$(COREDIR)/HLE/sceAudiocodec.cpp \
$(COREDIR)/HLE/sceAudioRouting.cpp \
$(COREDIR)/HLE/sceCcc.cpp \
$(COREDIR)/HLE/sceChnnlsv.cpp \
$(COREDIR)/HLE/sceCtrl.cpp \
$(COREDIR)/HLE/sceDeflt.cpp \
$(COREDIR)/HLE/sceDisplay.cpp \
$(COREDIR)/HLE/sceDmac.cpp \
$(COREDIR)/HLE/sceGameUpdate.cpp \
$(COREDIR)/HLE/sceGe.cpp \
$(COREDIR)/HLE/sceFont.cpp \
$(COREDIR)/HLE/sceHeap.cpp \
$(COREDIR)/HLE/sceHprm.cpp \
$(COREDIR)/HLE/sceHttp.cpp \
$(COREDIR)/HLE/sceImpose.cpp \
$(COREDIR)/HLE/sceIo.cpp \
$(COREDIR)/HLE/sceJpeg.cpp \
$(COREDIR)/HLE/sceKernel.cpp \
$(COREDIR)/HLE/sceKernelAlarm.cpp \
$(COREDIR)/HLE/sceKernelEventFlag.cpp \
$(COREDIR)/HLE/sceKernelInterrupt.cpp \
$(COREDIR)/HLE/sceKernelMbx.cpp \
$(COREDIR)/HLE/sceKernelMemory.cpp \
$(COREDIR)/HLE/sceKernelModule.cpp \
$(COREDIR)/HLE/sceKernelMsgPipe.cpp \
$(COREDIR)/HLE/sceKernelMutex.cpp \
$(COREDIR)/HLE/sceKernelSemaphore.cpp \
$(COREDIR)/HLE/sceKernelThread.cpp \
$(COREDIR)/HLE/sceKernelTime.cpp \
$(COREDIR)/HLE/sceKernelVTimer.cpp \
$(COREDIR)/HLE/sceMpeg.cpp \
$(COREDIR)/HLE/sceNet.cpp \
$(COREDIR)/HLE/sceNetAdhoc.cpp \
$(COREDIR)/HLE/proAdhocServer.cpp \
$(COREDIR)/HLE/proAdhoc.cpp \
$(COREDIR)/HLE/sceOpenPSID.cpp \
$(COREDIR)/HLE/sceP3da.cpp \
$(COREDIR)/HLE/sceMt19937.cpp \
$(COREDIR)/HLE/sceMd5.cpp \
$(COREDIR)/HLE/sceMp4.cpp \
$(COREDIR)/HLE/sceMp3.cpp \
$(COREDIR)/HLE/sceParseHttp.cpp \
$(COREDIR)/HLE/sceParseUri.cpp \
$(COREDIR)/HLE/scePower.cpp \
$(COREDIR)/HLE/scePsmf.cpp \
$(COREDIR)/HLE/sceRtc.cpp \
$(COREDIR)/HLE/sceSas.cpp \
$(COREDIR)/HLE/sceSsl.cpp \
$(COREDIR)/HLE/sceUmd.cpp \
$(COREDIR)/HLE/sceUsb.cpp \
$(COREDIR)/HLE/sceUsbCam.cpp \
$(COREDIR)/HLE/sceUtility.cpp \
$(COREDIR)/HLE/sceVaudio.cpp \
$(COREDIR)/HLE/scePspNpDrm_user.cpp \
$(COREDIR)/HLE/sceNp.cpp \
$(COREDIR)/HLE/scePauth.cpp \
$(COREDIR)/HLE/sceUsbGps.cpp \
$(COREDIR)/HW/SimpleAudioDec.cpp \
$(COREDIR)/HW/AsyncIOManager.cpp \
$(COREDIR)/HW/MediaEngine.cpp \
$(COREDIR)/HW/MpegDemux.cpp \
$(COREDIR)/HW/MemoryStick.cpp \
$(COREDIR)/HW/SasAudio.cpp \
$(COREDIR)/HW/SasReverb.cpp \
$(COREDIR)/HW/StereoResampler.cpp \
$(COREDIR)/Compatibility.cpp \
$(COREDIR)/Host.cpp \
$(COREDIR)/Loaders.cpp \
$(COREDIR)/MIPS/JitCommon/JitCommon.cpp \
$(COREDIR)/MIPS/JitCommon/JitState.cpp \
$(COREDIR)/MIPS/JitCommon/JitBlockCache.cpp \
$(COREDIR)/MIPS/IR/IRCompALU.cpp \
$(COREDIR)/MIPS/IR/IRCompBranch.cpp \
$(COREDIR)/MIPS/IR/IRCompFPU.cpp \
$(COREDIR)/MIPS/IR/IRCompLoadStore.cpp \
$(COREDIR)/MIPS/IR/IRCompVFPU.cpp \
$(COREDIR)/MIPS/IR/IRInterpreter.cpp \
$(COREDIR)/MIPS/IR/IRJit.cpp \
$(COREDIR)/MIPS/IR/IRInst.cpp \
$(COREDIR)/MIPS/IR/IRPassSimplify.cpp \
$(COREDIR)/MIPS/IR/IRRegCache.cpp \
$(COREDIR)/MIPS/IR/IRFrontend.cpp \
$(COREDIR)/MIPS/MIPS.cpp \
$(COREDIR)/MIPS/MIPSAnalyst.cpp \
$(COREDIR)/MIPS/MIPSCodeUtils.cpp \
$(COREDIR)/MIPS/MIPSDebugInterface.cpp \
$(COREDIR)/MIPS/MIPSDis.cpp \
$(COREDIR)/MIPS/MIPSDisVFPU.cpp \
$(COREDIR)/MIPS/MIPSInt.cpp \
$(COREDIR)/MIPS/MIPSIntVFPU.cpp \
$(COREDIR)/MIPS/MIPSTables.cpp \
$(COREDIR)/MIPS/MIPSVFPUUtils.cpp \
$(COREDIR)/MemMap.cpp \
$(COREDIR)/MemMapFunctions.cpp \
$(COREDIR)/PSPLoaders.cpp \
$(COREDIR)/Reporting.cpp \
$(COREDIR)/SaveState.cpp \
$(COREDIR)/Screenshot.cpp \
$(COREDIR)/System.cpp \
$(COREDIR)/Util/BlockAllocator.cpp \
$(COREDIR)/Util/PPGeDraw.cpp \
$(COREDIR)/Util/ppge_atlas.cpp \
$(COREDIR)/Util/AudioFormat.cpp \
$(EXTDIR)/disarm.cpp \
$(CORE_DIR)/UI/TextureUtil.cpp
SOURCES_CXX += $(COREDIR)/HLE/__sceAudio.cpp
### DYNAREC ###
ifeq ($(WITH_DYNAREC),1)
DYNAFLAGS += -DDYNAREC
ifeq ($(TARGET_ARCH),arm)
DYNAFLAGS += -D_ARCH_32
SOURCES_CXX += $(COMMONDIR)/ArmEmitter.cpp \
$(COMMONDIR)/ArmCPUDetect.cpp \
$(COREDIR)/MIPS/ARM/ArmAsm.cpp \
$(COREDIR)/MIPS/ARM/ArmCompALU.cpp \
$(COREDIR)/MIPS/ARM/ArmCompBranch.cpp \
$(COREDIR)/MIPS/ARM/ArmCompFPU.cpp \
$(COREDIR)/MIPS/ARM/ArmCompLoadStore.cpp \
$(COREDIR)/MIPS/ARM/ArmCompVFPU.cpp \
$(COREDIR)/MIPS/ARM/ArmCompReplace.cpp \
$(COREDIR)/MIPS/ARM/ArmJit.cpp \
$(COREDIR)/MIPS/ARM/ArmRegCache.cpp \
$(COREDIR)/MIPS/ARM/ArmRegCacheFPU.cpp \
$(GPUCOMMONDIR)/VertexDecoderArm.cpp
ifeq ($(HAVE_NEON),1)
SOURCES_CXX += \
$(COREDIR)/MIPS/ARM/ArmCompVFPUNEON.cpp \
$(COREDIR)/MIPS/ARM/ArmCompVFPUNEONUtil.cpp \
$(COREDIR)/Util/AudioFormatNEON.cpp \
$(COMMONDIR)/ColorConvNEON.cpp \
$(GPUDIR)/Common/TextureDecoderNEON.cpp
SOURCES_C += $(NATIVEDIR)/ext/libpng17/arm/arm_init.c \
$(NATIVEDIR)/ext/libpng17/arm/filter_neon_intrinsics.c
ASMFILES += $(NATIVEDIR)/math/fast/fast_matrix_neon.S \
$(NATIVEDIR)/ext/libpng17/arm/filter_neon.S
endif
else ifeq ($(TARGET_ARCH),arm64)
DYNAFLAGS += -D_ARCH_64
SOURCES_CXX += $(COMMONDIR)/Arm64Emitter.cpp \
$(COMMONDIR)/ArmCPUDetect.cpp \
$(COREDIR)/MIPS/ARM64/Arm64Asm.cpp \
$(COREDIR)/MIPS/ARM64/Arm64CompALU.cpp \
$(COREDIR)/MIPS/ARM64/Arm64CompBranch.cpp \
$(COREDIR)/MIPS/ARM64/Arm64CompFPU.cpp \
$(COREDIR)/MIPS/ARM64/Arm64CompLoadStore.cpp \
$(COREDIR)/MIPS/ARM64/Arm64CompVFPU.cpp \
$(COREDIR)/MIPS/ARM64/Arm64CompReplace.cpp \
$(COREDIR)/MIPS/ARM64/Arm64Jit.cpp \
$(COREDIR)/MIPS/ARM64/Arm64RegCache.cpp \
$(COREDIR)/MIPS/ARM64/Arm64RegCacheFPU.cpp \
$(COREDIR)/Util/DisArm64.cpp \
$(GPUCOMMONDIR)/VertexDecoderArm64.cpp
ifeq ($(HAVE_NEON),1)
SOURCES_CXX += \
$(COREDIR)/MIPS/ARM/ArmCompVFPUNEON.cpp \
$(COREDIR)/MIPS/ARM/ArmCompVFPUNEONUtil.cpp \
$(COMMONDIR)/ColorConvNEON.cpp \
$(GPUDIR)/Common/TextureDecoderNEON.cpp
SOURCES_C += $(NATIVEDIR)/ext/libpng17/arm/arm_init.c \
$(NATIVEDIR)/ext/libpng17/arm/filter_neon_intrinsics.c
ASMFILES += $(NATIVEDIR)/math/fast/fast_matrix_neon.S \
$(NATIVEDIR)/ext/libpng17/arm/filter_neon.S
endif
else
ifneq (,$(findstring msvc,$(platform)))
ifeq (,$(findstring x64,$(platform)))
CPUFLAGS += /arch:SSE2
endif
CPUFLAGS += -D_M_IX86_FP
else
CPUFLAGS += -msse -msse2
endif
ifeq ($(TARGET_ARCH),x86_64)
CPUFLAGS += -D_M_X64 -D_ARCH_64
else
CPUFLAGS += -D_M_IX86 -D_ARCH_32
ifeq (,$(findstring msvc,$(platform)))
CPUFLAGS += -m32
endif
endif
SOURCES_CXX += $(GPUDIR)/Software/SamplerX86.cpp
SOURCES_CXX += $(COMMONDIR)/x64Emitter.cpp \
$(COMMONDIR)/ABI.cpp \
$(COMMONDIR)/Thunk.cpp \
$(COMMONDIR)/CPUDetect.cpp \
$(COREDIR)/MIPS/x86/CompReplace.cpp \
$(COREDIR)/MIPS/x86/CompBranch.cpp \
$(COREDIR)/MIPS/x86/Asm.cpp \
$(COREDIR)/MIPS/x86/CompALU.cpp \
$(COREDIR)/MIPS/x86/CompVFPU.cpp \
$(COREDIR)/MIPS/x86/CompLoadStore.cpp \
$(COREDIR)/MIPS/x86/CompFPU.cpp \
$(COREDIR)/MIPS/x86/Jit.cpp \
$(COREDIR)/MIPS/x86/JitSafeMem.cpp \
$(COREDIR)/MIPS/x86/RegCache.cpp \
$(COREDIR)/MIPS/x86/RegCacheFPU.cpp \
$(GPUDIR)/Common/VertexDecoderX86.cpp
SOURCES_C += $(NATIVEDIR)/math/fast/fast_matrix_sse.c
endif
endif
SOURCES_CXX += \
$(COMMONDIR)/ArmEmitter.cpp \
$(COMMONDIR)/Arm64Emitter.cpp \
$(COREDIR)/Util/DisArm64.cpp
#UDIS86
# Compiled and linked even on ARM for now
SOURCES_C += $(EXTDIR)/udis86/decode.c \
$(EXTDIR)/udis86/itab.c \
$(EXTDIR)/udis86/syn-intel.c \
$(EXTDIR)/udis86/syn.c \
$(EXTDIR)/udis86/udis86.c
ifeq ($(PLATFORM_EXT), darwin)
COREFLAGS += -DNO_VULKAN
else
SOURCES_CXX += \
$(COMMONDIR)/Vulkan/SPIRVDisasm.cpp \
$(COMMONDIR)/Vulkan/VulkanContext.cpp \
$(COMMONDIR)/Vulkan/VulkanDebug.cpp \
$(COMMONDIR)/Vulkan/VulkanImage.cpp \
$(COMMONDIR)/Vulkan/VulkanLoader.cpp \
$(COMMONDIR)/Vulkan/VulkanMemory.cpp \
$(NATIVEDIR)/thin3d/thin3d_vulkan.cpp \
$(NATIVEDIR)/thin3d/VulkanRenderManager.cpp \
$(NATIVEDIR)/thin3d/VulkanQueueRunner.cpp \
$(GPUDIR)/Vulkan/DepalettizeShaderVulkan.cpp \
$(GPUDIR)/Vulkan/DrawEngineVulkan.cpp \
$(GPUDIR)/Vulkan/FragmentShaderGeneratorVulkan.cpp \
$(GPUDIR)/Vulkan/FramebufferVulkan.cpp \
$(GPUDIR)/Vulkan/GPU_Vulkan.cpp \
$(GPUDIR)/Vulkan/PipelineManagerVulkan.cpp \
$(GPUDIR)/Vulkan/ShaderManagerVulkan.cpp \
$(GPUDIR)/Vulkan/StateMappingVulkan.cpp \
$(GPUDIR)/Vulkan/StencilBufferVulkan.cpp \
$(GPUDIR)/Vulkan/TextureCacheVulkan.cpp \
$(GPUDIR)/Vulkan/TextureScalerVulkan.cpp \
$(GPUDIR)/Vulkan/VertexShaderGeneratorVulkan.cpp \
$(GPUDIR)/Vulkan/VulkanUtil.cpp \
$(LIBRETRODIR)/LibretroVulkanContext.cpp \
$(LIBRETRODIR)/libretro_vulkan.cpp
ifeq ($(PLATFORM_EXT), unix)
COREFLAGS += -DVK_USE_PLATFORM_XLIB_KHR
endif
endif
ifeq ($(PLATFORM_EXT), win32)
SOURCES_CXX += \
$(GPUDIR)/Directx9/DepalettizeShaderDX9.cpp \
$(GPUDIR)/Directx9/DrawEngineDX9.cpp \
$(GPUDIR)/Directx9/PixelShaderGeneratorDX9.cpp \
$(GPUDIR)/Directx9/FramebufferDX9.cpp \
$(GPUDIR)/Directx9/GPU_DX9.cpp \
$(GPUDIR)/Directx9/ShaderManagerDX9.cpp \
$(GPUDIR)/Directx9/StateMappingDX9.cpp \
$(GPUDIR)/Directx9/StencilBufferDX9.cpp \
$(GPUDIR)/Directx9/TextureCacheDX9.cpp \
$(GPUDIR)/Directx9/TextureScalerDX9.cpp \
$(GPUDIR)/Directx9/VertexShaderGeneratorDX9.cpp
SOURCES_CXX += \
$(GPUDIR)/D3D11/DepalettizeShaderD3D11.cpp \
$(GPUDIR)/D3D11/DrawEngineD3D11.cpp \
$(GPUDIR)/D3D11/FragmentShaderGeneratorD3D11.cpp \
$(GPUDIR)/D3D11/FramebufferManagerD3D11.cpp \
$(GPUDIR)/D3D11/GPU_D3D11.cpp \
$(GPUDIR)/D3D11/D3D11Util.cpp \
$(GPUDIR)/D3D11/ShaderManagerD3D11.cpp \
$(GPUDIR)/D3D11/StateMappingD3D11.cpp \
$(GPUDIR)/D3D11/StencilBufferD3D11.cpp \
$(GPUDIR)/D3D11/TextureCacheD3D11.cpp \
$(GPUDIR)/D3D11/TextureScalerD3D11.cpp \
$(GPUDIR)/D3D11/VertexShaderGeneratorD3D11.cpp \
$(LIBRETRODIR)/LibretroD3D11Context.cpp
SOURCES_CXX += \
$(NATIVEDIR)/thin3d/thin3d_d3d9.cpp \
$(NATIVEDIR)/thin3d/thin3d_d3d11.cpp \
$(NATIVEDIR)/thin3d/d3dx9_loader.cpp \
$(NATIVEDIR)/thin3d/d3d11_loader.cpp
INCFLAGS += -I$(CORE_DIR)/dx9sdk/Include -I$(CORE_DIR)/dx9sdk/Include/DX11
endif
SOURCES_CXX += \
$(LIBRETRODIR)/libretro.cpp \
$(LIBRETRODIR)/LibretroGraphicsContext.cpp \
$(LIBRETRODIR)/LibretroGLContext.cpp
ifneq ($(STATIC_LINKING), 1)
SOURCES_C += \
$(EXTDIR)/zlib/adler32.c \
$(EXTDIR)/zlib/compress.c \
$(EXTDIR)/zlib/crc32.c \
$(EXTDIR)/zlib/deflate.c \
$(EXTDIR)/zlib/gzclose.c \
$(EXTDIR)/zlib/gzlib.c \
$(EXTDIR)/zlib/gzread.c \
$(EXTDIR)/zlib/gzwrite.c \
$(EXTDIR)/zlib/inffast.c \
$(EXTDIR)/zlib/inflate.c \
$(EXTDIR)/zlib/inftrees.c \
$(EXTDIR)/zlib/trees.c \
$(EXTDIR)/zlib/uncompr.c \
$(EXTDIR)/zlib/zutil.c
endif
GIT_VERSION_SRC = $(CORE_DIR)/git-version.cpp
GIT_VERSION := $(shell git describe --always || echo v1.4.2-git)
GIT_VERSION_NO_UPDATE = $(findstring 1,$(shell grep -s PPSSPP_GIT_VERSION_NO_UPDATE $(GIT_VERSION_SRC)))
ifneq (,$(findstring $(GIT_VERSION),$(shell grep -s char $(GIT_VERSION_SRC))))
GIT_VERSION_NO_UPDATE = 1
endif
ifneq ($(GIT_VERSION_NO_UPDATE),1)
$(shell echo '// This is a generated file.' > $(GIT_VERSION_SRC))
$(shell echo >> $(GIT_VERSION_SRC))
$(shell echo 'const char *PPSSPP_GIT_VERSION = "${GIT_VERSION}";' >> $(GIT_VERSION_SRC))
$(shell echo >> $(GIT_VERSION_SRC))
$(shell echo "// If you don't want this file to update/recompile, change to 1." >> $(GIT_VERSION_SRC))
$(shell echo '#define PPSSPP_GIT_VERSION_NO_UPDATE 0' >> $(GIT_VERSION_SRC))
endif
SOURCES_CXX += $(GIT_VERSION_SRC)
+82
View File
@@ -0,0 +1,82 @@
LOCAL_PATH := $(call my-dir)
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
COREFLAGS :=
CORE_DIR := ../..
FFMPEGDIR := $(CORE_DIR)/ffmpeg
FFMPEGLIBS += libavformat libavcodec libavutil libswresample libswscale
ifeq ($(TARGET_ARCH),arm64)
COREFLAGS += -DARM64 -D_ARCH_64
HAVE_NEON := 1
FFMPEGLIBDIR := $(FFMPEGDIR)/android/arm64/lib
FFMPEGINCFLAGS := -I$(FFMPEGDIR)/android/arm64/include
endif
ifeq ($(TARGET_ARCH),arm)
COREFLAGS += -DARM -DARMEABI_V7A -D__arm__ -DARM_ASM -D_ARCH_32 -mfpu=neon
HAVE_NEON := 1
FFMPEGLIBDIR := $(FFMPEGDIR)/android/armv7/lib
FFMPEGINCFLAGS := -I$(FFMPEGDIR)/android/armv7/include
endif
ifeq ($(TARGET_ARCH),x86)
COREFLAGS += -D_ARCH_32 -D_M_IX86 -fomit-frame-pointer -mtune=atom -mfpmath=sse -mssse3 -mstackrealign
FFMPEGLIBDIR := $(FFMPEGDIR)/android/x86/lib
FFMPEGINCFLAGS := -I$(FFMPEGDIR)/android/x86/include
endif
ifeq ($(TARGET_ARCH),x86_64)
COREFLAGS += -D_ARCH_64 -D_M_X64 -fomit-frame-pointer -mtune=atom -mfpmath=sse -mssse3 -mstackrealign
FFMPEGLIBDIR := $(FFMPEGDIR)/android/x86_64/lib
FFMPEGINCFLAGS := -I$(FFMPEGDIR)/android/x86_64/include
endif
include $(CLEAR_VARS)
LOCAL_MODULE := libavformat
LOCAL_SRC_FILES := $(FFMPEGLIBDIR)/libavformat.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := $(FFMPEGLIBDIR)/libavcodec.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libavutil
LOCAL_SRC_FILES := $(FFMPEGLIBDIR)/libavutil.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libswresample
LOCAL_SRC_FILES := $(FFMPEGLIBDIR)/libswresample.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libswscale
LOCAL_SRC_FILES := $(FFMPEGLIBDIR)/libswscale.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
PLATFORM_EXT := android
platform := android
GLES = 1
LOCAL_MODULE := retro
include $(CORE_DIR)/libretro/Makefile.common
COREFLAGS += -DINLINE="inline" -DPPSSPP -DUSE_FFMPEG -DMOBILE_DEVICE -DBAKE_IN_GIT -DDYNAREC -D__LIBRETRO__ -DUSING_GLES2 -D__STDC_CONSTANT_MACROS -DGLEW_NO_GLU -DNO_VULKAN $(INCFLAGS)
LOCAL_SRC_FILES = $(SOURCES_CXX) $(SOURCES_C) $(ASMFILES)
LOCAL_CPPFLAGS := -Wall -std=gnu++11 $(COREFLAGS) -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
LOCAL_CFLAGS := -O2 -ffast-math -DANDROID $(COREFLAGS)
LOCAL_LDLIBS += -lz -llog -lGLESv2 -lEGL -latomic
LOCAL_STATIC_LIBRARIES += $(FFMPEGLIBS)
include $(BUILD_SHARED_LIBRARY)
+5
View File
@@ -0,0 +1,5 @@
NDK_TOOLCHAIN_VERSION ?= 4.8
APP_ABI := armeabi-v7a,arm64-v8a,x86
APP_STL := c++_static
APP_GNUSTL_CPP_FEATURES := exceptions
APP_PLATFORM := android-9
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff. Show more