mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
* chore(i18n): translate every missing string in all locales Adds the 87 strings the bottom-screen Dashboard and in-game stats pages introduced to all 32 locales, plus the 51 older settings strings Japanese and the 50 Chinese locales were still missing. Every locale now has all 3456 translatable strings with the same placeholders as English. Also translates 36 entries that were still English where the language does not use the English word, and makes es-419 touch_app_id use the same %1$s placeholder as English. * chore(patches): drop comments from the lines downstream patches add Removes comment lines and trailing comments from lines our patches add, with hunk headers recounted. Lines that a later patch uses as context and the upstream backport 0123 are left as they are. The gamescope, FEX, proot and xodus series still apply to their pinned sources, and the patched trees differ only in those comments. test_hud_frames now finds the HUD writer by its first declaration. * docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix These were credited only in source headers and NOTICE files. * chore: remove source comments and unused functions Removes explanatory comments from first-party Kotlin, Java, C, C++, Rust, TypeScript, Python, shell, Gradle, CMake and workflow files. License and attribution headers stay, and vendored third-party trees, generated files and license files are untouched. A shellcheck directive is kept, and udevmon's fallthrough comments became fallthrough attributes. Syntax trees and token streams match the previous sources apart from the comments and Python docstrings. Module docstrings that argparse prints are kept, and device-smoke.sh prints the same --help text from a heredoc. Also removes 37 functions and 4 fields that nothing referenced. * chore: remove comments from the Syncthing integration and the latest main sources * docs: credit Syncthing and the syncthing-android fork * chore(i18n): translate the Syncthing strings in all locales The 107 strings the Syncthing integration added are now in all 32 locales. sync_web_path_locked names the Syncthing tab by its label. * docs: credit @xXJSONDeruloXx for the HUD metric readers The CPU, GPU load, thermal and battery readers come from their PerformanceHudView pull requests #777, #877, #991, #1406 and #1573. The FusionHUD credit line is unchanged. * docs: credit the HUD metric readers to @xXJSONDeruloXx's work
99 lines
3.7 KiB
Diff
99 lines
3.7 KiB
Diff
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/LinuxAllocator.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/LinuxAllocator.cpp
|
|
index 60b0ef1..4a94009 100644
|
|
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/LinuxAllocator.cpp
|
|
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/LinuxAllocator.cpp
|
|
@@ -2,6 +2,7 @@
|
|
#include "LinuxSyscalls/LinuxAllocator.h"
|
|
#include "LinuxSyscalls/Syscalls.h"
|
|
|
|
+#include <FEXCore/Utils/Allocator.h>
|
|
#include <FEXCore/Utils/MathUtils.h>
|
|
#include <FEXCore/Utils/TypeDefines.h>
|
|
#include <FEXHeaderUtils/Syscalls.h>
|
|
@@ -9,6 +10,7 @@
|
|
#include <FEXCore/fextl/memory.h>
|
|
|
|
#include <bitset>
|
|
+#include <fcntl.h>
|
|
#include <linux/mman.h>
|
|
#include <unistd.h>
|
|
#include <sys/user.h>
|
|
@@ -82,6 +84,7 @@ private:
|
|
std::mutex AllocMutex {};
|
|
uint64_t FindPageRange(uint64_t Start, size_t Pages) const;
|
|
uint64_t FindPageRange_TopDown(uint64_t Start, size_t Pages) const;
|
|
+ bool SetHostMappedPages(uint64_t PageAddr, size_t PagesLength);
|
|
using FindHandler = uint64_t (MemAllocator32Bit::*)(uint64_t Start, size_t Pages) const;
|
|
FindHandler FindPageRangePtr {};
|
|
};
|
|
@@ -132,6 +135,36 @@ uint64_t MemAllocator32Bit::FindPageRange_TopDown(uint64_t Start, size_t Pages)
|
|
return 0;
|
|
}
|
|
|
|
+bool MemAllocator32Bit::SetHostMappedPages(uint64_t PageAddr, size_t PagesLength) {
|
|
+ const int MapsFD = ::open("/proc/self/maps", O_RDONLY | O_CLOEXEC);
|
|
+ if (MapsFD == -1) {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ const auto Gaps =
|
|
+ FEXCore::Allocator::CollectMemoryGaps(BASE_KEY << FEXCore::Utils::FEX_PAGE_SHIFT, TOP_KEY << FEXCore::Utils::FEX_PAGE_SHIFT, MapsFD);
|
|
+ close(MapsFD);
|
|
+
|
|
+ const uint64_t EndPage = PageAddr + PagesLength;
|
|
+ uint64_t MappedBegin = BASE_KEY;
|
|
+ bool Marked = false;
|
|
+ auto MarkIfOverlapping = [&](uint64_t MappedEnd) {
|
|
+ if (MappedBegin < MappedEnd && MappedBegin < EndPage && PageAddr < MappedEnd) {
|
|
+ SetUsedPages(MappedBegin, MappedEnd - MappedBegin);
|
|
+ Marked = true;
|
|
+ }
|
|
+ };
|
|
+
|
|
+ for (const auto& Gap : Gaps) {
|
|
+ const uintptr_t GapBegin = reinterpret_cast<uintptr_t>(Gap.Ptr);
|
|
+ MarkIfOverlapping(GapBegin >> FEXCore::Utils::FEX_PAGE_SHIFT);
|
|
+ MappedBegin = (GapBegin + Gap.Size) >> FEXCore::Utils::FEX_PAGE_SHIFT;
|
|
+ }
|
|
+ MarkIfOverlapping(TOP_KEY);
|
|
+
|
|
+ return Marked;
|
|
+}
|
|
+
|
|
void* MemAllocator32Bit::Mmap(void* addr, size_t length, int prot, int flags, int fd, off_t offset) {
|
|
std::scoped_lock<std::mutex> lk {AllocMutex};
|
|
size_t PagesLength = FEXCore::AlignUp(length, FEXCore::Utils::FEX_PAGE_SIZE) >> FEXCore::Utils::FEX_PAGE_SHIFT;
|
|
@@ -175,11 +208,16 @@ void* MemAllocator32Bit::Mmap(void* addr, size_t length, int prot, int flags, in
|
|
|
|
auto AllocateNoHint = [&]() -> void* {
|
|
bool Wrapped = false;
|
|
+ bool Restarted = false;
|
|
uint64_t BottomPage = Map32Bit && (LastScanLocation >= LastKeyLocation32Bit) ? LastKeyLocation32Bit : LastScanLocation;
|
|
restart: {
|
|
// Linear range scan
|
|
uint64_t LowerPage = (this->*FindPageRangePtr)(BottomPage, PagesLength);
|
|
if (LowerPage == 0) {
|
|
+ if (Restarted) {
|
|
+ return reinterpret_cast<void*>(-ENOMEM);
|
|
+ }
|
|
+ Restarted = true;
|
|
// Try again but this time from the start
|
|
BottomPage = Map32Bit ? LastKeyLocation32Bit : LastKeyLocation;
|
|
LowerPage = (this->*FindPageRangePtr)(BottomPage, PagesLength);
|
|
@@ -206,7 +244,14 @@ restart: {
|
|
return (void*)(uintptr_t)-errno;
|
|
} else {
|
|
// Try again
|
|
- if (SearchDown) {
|
|
+ if (Map32Bit) {
|
|
+ const bool Marked = SetHostMappedPages(LowerPage, PagesLength);
|
|
+ if (SearchDown) {
|
|
+ BottomPage = Marked ? UpperPage - 1 : LowerPage - 1;
|
|
+ } else {
|
|
+ BottomPage = Marked ? LowerPage : UpperPage;
|
|
+ }
|
|
+ } else if (SearchDown) {
|
|
--BottomPage;
|
|
} else {
|
|
++BottomPage;
|