diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 065750613c..f6e89707da 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -225,7 +225,7 @@ jobs:
run: |
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
sudo apt-get update -y -qq
- sudo apt-get install libsdl2-dev libgl1-mesa-dev libglu1-mesa-dev
+ sudo apt-get install libsdl2-dev libgl1-mesa-dev libglu1-mesa-dev libsdl2-ttf-dev libfontconfig1-dev
- name: Create macOS git-version.cpp for tagged release
if: startsWith(github.ref, 'refs/tags/') && runner.os == 'macOS' && matrix.extra == 'test'
diff --git a/.gitignore b/.gitignore
index 0723838277..842b171bd1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -117,6 +117,8 @@ debian/ppsspp/
# Libretro build
*.o
+*.tmp
+*.a
# YouCompleteMe file
.ycm_extra_conf.pyc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a91796708..f637fd9ce9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -257,14 +257,14 @@ endif()
if(NOT LIBRETRO AND NOT IOS AND NOT MACOSX)
find_package(SDL2)
- find_package(SDL2_TTF)
+ find_package(SDL2_ttf)
find_package(Fontconfig)
endif()
if(MACOSX AND NOT IOS)
if(USE_SYSTEM_LIBSDL2)
find_package(SDL2)
- find_package(SDL2_TTF)
+ find_package(SDL2_ttf)
else()
find_library(SDL2Fwk SDL2 REQUIRED PATHS SDL/macOS)
message(STATUS "found SDL2Fwk=${SDL2Fwk}")
@@ -420,6 +420,9 @@ if(NOT MSVC)
add_definitions(-D_XOPEN_SOURCE=700)
add_definitions(-D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1 -D_BSD_SOURCE -D_DEFAULT_SOURCE)
add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
+ if(${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
+ add_definitions(-D_NETBSD_SOURCE)
+ endif()
elseif(ANDROID)
add_definitions(-fsigned-char)
endif()
@@ -750,6 +753,8 @@ add_library(Common STATIC
Common/Render/Text/draw_text.h
Common/Render/Text/draw_text_android.cpp
Common/Render/Text/draw_text_android.h
+ Common/Render/Text/draw_text_sdl.cpp
+ Common/Render/Text/draw_text_sdl.h
Common/Render/Text/draw_text_win.cpp
Common/Render/Text/draw_text_win.h
Common/Render/Text/draw_text_uwp.cpp
@@ -1180,15 +1185,6 @@ set(nativeExtra)
set(nativeExtraLibs)
if(ANDROID)
- set(nativeExtra ${nativeExtra}
- Common/GL/GLInterface/EGLAndroid.cpp
- Common/GL/GLInterface/EGLAndroid.h
- Common/GL/GLInterface/EGL.cpp
- Common/GL/GLInterface/EGL.h
- Common/GL/GLInterface/GLInterface.cpp
- Common/GL/GLInterfaceBase.h
- )
-
set(NativeAppSource ${NativeAppSource}
android/jni/app-android.cpp
android/jni/AndroidJavaGLContext.cpp
@@ -1319,7 +1315,7 @@ else()
SDL/SDLVulkanGraphicsContext.cpp
)
endif()
- if(SDL2_TTF_FOUND)
+ if(SDL2_ttf_FOUND)
add_definitions(-DUSE_SDL2_TTF)
set(nativeExtraLibs ${nativeExtraLibs} SDL2_ttf::SDL2_ttf)
@@ -1389,6 +1385,8 @@ list(APPEND NativeAppSource
UI/BackgroundAudio.cpp
UI/ChatScreen.h
UI/ChatScreen.cpp
+ UI/DebugOverlay.cpp
+ UI/DebugOverlay.h
UI/DevScreens.cpp
UI/DevScreens.h
UI/DisplayLayoutScreen.cpp
@@ -1469,8 +1467,6 @@ add_library(native STATIC
${nativeExtra}
Common/Render/Text/draw_text_qt.cpp
Common/Render/Text/draw_text_qt.h
- Common/Render/Text/draw_text_sdl.cpp
- Common/Render/Text/draw_text_sdl.h
ext/jpge/jpgd.cpp
ext/jpge/jpgd.h
ext/jpge/jpge.cpp
@@ -1554,6 +1550,8 @@ set(CoreExtra ${CoreExtra}
Core/MIPS/IR/IRInterpreter.h
Core/MIPS/IR/IRJit.cpp
Core/MIPS/IR/IRJit.h
+ Core/MIPS/IR/IRNativeCommon.cpp
+ Core/MIPS/IR/IRNativeCommon.h
Core/MIPS/IR/IRPassSimplify.cpp
Core/MIPS/IR/IRPassSimplify.h
Core/MIPS/IR/IRRegCache.cpp
diff --git a/Common/CPUDetect.cpp b/Common/CPUDetect.cpp
index aa43930ead..2628f91d46 100644
--- a/Common/CPUDetect.cpp
+++ b/Common/CPUDetect.cpp
@@ -17,7 +17,7 @@
// Reference : https://stackoverflow.com/questions/6121792/how-to-check-if-a-cpu-supports-the-sse3-instruction-set
#include "ppsspp_config.h"
-#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
+#if (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)) && !defined(__EMSCRIPTEN__)
#include "ext/cpu_features/include/cpuinfo_x86.h"
diff --git a/Common/CodeBlock.h b/Common/CodeBlock.h
index f7fc8a2481..766d0a1cca 100644
--- a/Common/CodeBlock.h
+++ b/Common/CodeBlock.h
@@ -32,7 +32,7 @@ public:
virtual const u8 *GetCodePtr() const = 0;
- u8 *GetBasePtr() {
+ u8 *GetBasePtr() const {
return region;
}
diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj
index 2b80aaa4d2..3d70da2944 100644
--- a/Common/Common.vcxproj
+++ b/Common/Common.vcxproj
@@ -530,27 +530,6 @@
-
-
- true
- true
- true
- true
- true
- true
- true
- true
-
-
- true
- true
- true
- true
- true
- true
- true
- true
-
@@ -988,36 +967,6 @@
-
- true
- true
- true
- true
- true
- true
- true
- true
-
-
- true
- true
- true
- true
- true
- true
- true
- true
-
-
- true
- true
- true
- true
- true
- true
- true
- true
-
@@ -1084,4 +1033,4 @@
-
\ No newline at end of file
+
diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters
index 5527848423..2a970c6f9f 100644
--- a/Common/Common.vcxproj.filters
+++ b/Common/Common.vcxproj.filters
@@ -32,15 +32,6 @@
-
- GL\GLInterface
-
-
- GL\GLInterface
-
-
- GL
-
@@ -547,15 +538,6 @@
-
- GL\GLInterface
-
-
- GL\GLInterface
-
-
- GL\GLInterface
-
@@ -982,12 +964,6 @@
{1b593f03-7b28-4707-9228-4981796f5589}
-
- {2f2ca112-9e26-499e-9cb9-38a78b4ac09d}
-
-
- {2c723cf4-75b6-406a-90c0-ebb7a13ba476}
-
{7be79ad5-3520-46a1-a370-dce2a943978c}
diff --git a/Common/CommonFuncs.h b/Common/CommonFuncs.h
index 294cf4fb39..65b3344090 100644
--- a/Common/CommonFuncs.h
+++ b/Common/CommonFuncs.h
@@ -30,7 +30,7 @@
#include
#include
-#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
+#if (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)) && !defined(__EMSCRIPTEN__)
#define Crash() {asm ("int $3");}
#elif PPSSPP_PLATFORM(SWITCH)
// TODO: Implement Crash() for Switch, lets not use breakpoint for the time being
diff --git a/Common/Data/Collections/FastVec.h b/Common/Data/Collections/FastVec.h
index 3dab59abb8..88d8971c9f 100644
--- a/Common/Data/Collections/FastVec.h
+++ b/Common/Data/Collections/FastVec.h
@@ -155,3 +155,16 @@ private:
bool capacityLocked_ = false;
#endif
};
+
+// Simple cyclical vector.
+// Initially, doesn't do any sanity checking.
+template
+class HistoryBuffer {
+public:
+ // Out of bounds (past size() - 1) is undefined behavior.
+ T &operator[] (const size_t index) { return data_[index % size]; }
+ const T &operator[] (const size_t index) const { return data_[index % size]; }
+
+private:
+ T data_[size]{};
+};
diff --git a/Common/Data/Collections/FixedSizeQueue.h b/Common/Data/Collections/FixedSizeQueue.h
index e8578c6bd8..621f4f0035 100644
--- a/Common/Data/Collections/FixedSizeQueue.h
+++ b/Common/Data/Collections/FixedSizeQueue.h
@@ -222,4 +222,3 @@ private:
volatile int curReadBlock;
volatile int curWriteBlock;
};
-
diff --git a/Common/Data/Encoding/Utf8.cpp b/Common/Data/Encoding/Utf8.cpp
index 760fe6b07d..82567948cf 100644
--- a/Common/Data/Encoding/Utf8.cpp
+++ b/Common/Data/Encoding/Utf8.cpp
@@ -426,6 +426,17 @@ int u8_is_locale_utf8(const char *locale)
return 0;
}
+bool AnyEmojiInString(const char *s, size_t byteCount) {
+ int i = 0;
+ while (i < byteCount) {
+ uint32_t c = u8_nextchar(s, &i);
+ if (CodepointIsProbablyEmoji(c)) {
+ return true;
+ }
+ }
+ return false;
+}
+
int UTF8StringNonASCIICount(const char *utf8string) {
UTF8 utf(utf8string);
int count = 0;
@@ -558,6 +569,12 @@ std::u16string ConvertUTF8ToUCS2(const std::string &source) {
return dst;
}
+std::string CodepointToUTF8(uint32_t codePoint) {
+ char temp[16]{};
+ UTF8::encode(temp, codePoint);
+ return std::string(temp);
+}
+
#ifndef _WIN32
// Replacements for the Win32 wstring functions. Not to be used from emulation code!
diff --git a/Common/Data/Encoding/Utf8.h b/Common/Data/Encoding/Utf8.h
index 29d09f67e9..5123ef8a4b 100644
--- a/Common/Data/Encoding/Utf8.h
+++ b/Common/Data/Encoding/Utf8.h
@@ -26,6 +26,15 @@ int u8_strlen(const char *s);
void u8_inc(const char *s, int *i);
void u8_dec(const char *s, int *i);
+inline bool CodepointIsProbablyEmoji(uint32_t c) {
+ // Original check was some ranges grabbed from https://stackoverflow.com/a/62898106.
+ // But let's just go with checking if outside the BMP, it's not a big deal if we accidentally
+ // switch to color when not needed if someone uses a weird glyph.
+ return c > 0xFFFF;
+}
+
+bool AnyEmojiInString(const char *s, size_t byteCount);
+
class UTF8 {
public:
static const uint32_t INVALID = (uint32_t)-1;
@@ -89,6 +98,8 @@ bool UTF8StringHasNonASCII(const char *utf8string);
// Removes overlong encodings and similar.
std::string SanitizeUTF8(const std::string &utf8string);
+std::string CodepointToUTF8(uint32_t codePoint);
+
// UTF8 to Win32 UTF-16
// Should be used when calling Win32 api calls
diff --git a/Common/Data/Format/IniFile.cpp b/Common/Data/Format/IniFile.cpp
index 79ff0aebee..ba5055983b 100644
--- a/Common/Data/Format/IniFile.cpp
+++ b/Common/Data/Format/IniFile.cpp
@@ -420,42 +420,36 @@ bool Section::Delete(const char *key)
// IniFile
-const Section* IniFile::GetSection(const char* sectionName) const
-{
- for (std::vector::const_iterator iter = sections.begin(); iter != sections.end(); ++iter)
+const Section* IniFile::GetSection(const char* sectionName) const {
+ for (const auto &iter : sections)
if (!strcasecmp(iter->name().c_str(), sectionName))
- return (&(*iter));
+ return iter.get();
+ return nullptr ;
+}
+
+Section* IniFile::GetSection(const char* sectionName) {
+ for (const auto &iter : sections)
+ if (!strcasecmp(iter->name().c_str(), sectionName))
+ return iter.get();
return 0;
}
-Section* IniFile::GetSection(const char* sectionName)
-{
- for (std::vector::iterator iter = sections.begin(); iter != sections.end(); ++iter)
- if (!strcasecmp(iter->name().c_str(), sectionName))
- return (&(*iter));
- return 0;
-}
-
-Section* IniFile::GetOrCreateSection(const char* sectionName)
-{
+Section* IniFile::GetOrCreateSection(const char* sectionName) {
Section* section = GetSection(sectionName);
- if (!section)
- {
- sections.push_back(Section(sectionName));
- section = §ions[sections.size() - 1];
+ if (!section) {
+ sections.push_back(std::unique_ptr(new Section(sectionName)));
+ section = sections.back().get();
}
return section;
}
-bool IniFile::DeleteSection(const char* sectionName)
-{
+bool IniFile::DeleteSection(const char* sectionName) {
Section* s = GetSection(sectionName);
if (!s)
return false;
- for (std::vector::iterator iter = sections.begin(); iter != sections.end(); ++iter)
- {
- if (&(*iter) == s)
- {
+
+ for (auto iter = sections.begin(); iter != sections.end(); ++iter) {
+ if (iter->get() == s) {
sections.erase(iter);
return true;
}
@@ -463,8 +457,7 @@ bool IniFile::DeleteSection(const char* sectionName)
return false;
}
-bool IniFile::Exists(const char* sectionName, const char* key) const
-{
+bool IniFile::Exists(const char* sectionName, const char* key) const {
const Section* section = GetSection(sectionName);
if (!section)
return false;
@@ -556,7 +549,7 @@ void IniFile::SortSections()
bool IniFile::Load(const Path &path)
{
sections.clear();
- sections.push_back(Section(""));
+ sections.push_back(std::unique_ptr(new Section("")));
// first section consists of the comments before the first real section
// Open file
@@ -612,16 +605,16 @@ bool IniFile::Load(std::istream &in) {
if (sectionNameEnd != std::string::npos) {
// New section!
std::string sub = line.substr(1, sectionNameEnd - 1);
- sections.push_back(Section(sub));
+ sections.push_back(std::unique_ptr(new Section(sub)));
if (sectionNameEnd + 1 < line.size()) {
- sections[sections.size() - 1].comment = line.substr(sectionNameEnd + 1);
+ sections.back()->comment = line.substr(sectionNameEnd + 1);
}
} else {
if (sections.empty()) {
- sections.push_back(Section(""));
+ sections.push_back(std::unique_ptr(new Section("")));
}
- sections[sections.size() - 1].lines.push_back(line);
+ sections.back()->lines.push_back(line);
}
}
}
@@ -641,12 +634,12 @@ bool IniFile::Save(const Path &filename)
// TODO: Do we still need this? It's annoying.
fprintf(file, "\xEF\xBB\xBF");
- for (const Section §ion : sections) {
- if (!section.name().empty() && (!section.lines.empty() || !section.comment.empty())) {
- fprintf(file, "[%s]%s\n", section.name().c_str(), section.comment.c_str());
+ for (const auto §ion : sections) {
+ if (!section->name().empty() && (!section->lines.empty() || !section->comment.empty())) {
+ fprintf(file, "[%s]%s\n", section->name().c_str(), section->comment.c_str());
}
- for (const std::string &s : section.lines) {
+ for (const std::string &s : section->lines) {
fprintf(file, "%s\n", s.c_str());
}
}
diff --git a/Common/Data/Format/IniFile.h b/Common/Data/Format/IniFile.h
index cbe73f1855..528ece1f1c 100644
--- a/Common/Data/Format/IniFile.h
+++ b/Common/Data/Format/IniFile.h
@@ -5,6 +5,7 @@
#pragma once
#include
+#include
#include