Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hackermdch committed Sep 22, 2024
0 parents commit 7a018f8
Show file tree
Hide file tree
Showing 4 changed files with 193 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gclient
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
solutions = [
{
"managed": False,
"name": "src/flutter",
"url": "https://github.com/PrimogemStudio/engine",
"custom_deps": {},
"deps_file": "DEPS",
"safesync_url": "",
"custom_vars" : {
"download_android_deps" : False
},
},
]
81 changes: 81 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build
on: workflow_dispatch
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
name: Windows
cmd: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth 1
$env:Path="$pwd/depot_tools;$env:Path"
$env:DEPOT_TOOLS_WIN_TOOLCHAIN=0
$env:GYP_MSVS_OVERRIDE_PATH="C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$env:WINDOWSSDKDIR="C:\Program Files (x86)\Windows Kits\10"
gclient sync --no-history
cd src/flutter/third_party/dart
git apply ../../../../0001-Update.patch --ignore-space-change --ignore-whitespace
cd ../../..
./flutter/tools/gn --runtime-mode release --no-enable-unittests --disable-desktop-embeddings --no-prebuilt-dart-sdk --enable-vulkan
ninja -C out/host_release -j8
cp ./out/host_release/flutter_minecraft.dll ../flutter_minecraft.dll
- os: ubuntu-latest
name: Linux
cmd: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth 1
export PATH=$(pwd)/depot_tools:$PATH
gclient sync --no-history
cd src
./flutter/tools/gn --runtime-mode release --no-enable-unittests --disable-desktop-embeddings --enable-vulkan
ninja -C out/host_release -j8
cp ./out/host_release/libflutter_minecraft.so ../libflutter_minecraft.so
- os: macos-14
name: MacOS
cmd: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth 1
export PATH=$(pwd)/depot_tools:$PATH
gclient sync --no-history
cd src
cd flutter
git apply ../../0002-Update.patch
cd ..
./flutter/tools/gn --runtime-mode release --no-enable-unittests --disable-desktop-embeddings --enable-vulkan
ninja -C out/host_release -j8
cp ./out/host_release/libflutter_minecraft.dylib ../libflutter_minecraft.dylib
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build
run: |
${{ matrix.cmd }}
- name: Upload Artifacts (Linux)
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: libs
path: ./libflutter_minecraft.so

- name: Upload Artifacts (Windows)
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: libs
path: ./flutter_minecraft.dll

- name: Upload Artifacts (MacOS)
uses: actions/upload-artifact@v3
if: matrix.os == 'macos-14'
with:
name: libs
path: ./libflutter_minecraft.dylib
73 changes: 73 additions & 0 deletions 0001-Update.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From e87bd2a1914f9ffb0bfa10c62fd63bf4dbed45d5 Mon Sep 17 00:00:00 2001
From: hackermdch <58121864+hackermdch@users.noreply.github.com>
Date: Wed, 18 Sep 2024 01:19:40 +0800
Subject: [PATCH] Update

---
runtime/vm/native_symbol_win.cc | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/runtime/vm/native_symbol_win.cc b/runtime/vm/native_symbol_win.cc
index 4541937f449..1159132d842 100644
--- a/runtime/vm/native_symbol_win.cc
+++ b/runtime/vm/native_symbol_win.cc
@@ -16,6 +16,7 @@ namespace dart {

static bool running_ = false;
static Mutex* lock_ = nullptr;
+static HANDLE handle_ = nullptr;

void NativeSymbolResolver::Init() {
ASSERT(running_ == false);
@@ -28,13 +29,14 @@ void NativeSymbolResolver::Init() {
// when compiled in UWP.
#ifndef DART_TARGET_OS_WINDOWS_UWP
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS);
- HANDLE hProcess = GetCurrentProcess();
- if (!SymInitialize(hProcess, nullptr, TRUE)) {
+ DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(), GetCurrentProcess(),
+ &handle_, 0, false, DUPLICATE_SAME_ACCESS);
+
+ if (!SymInitialize(handle_, nullptr, TRUE)) {
DWORD error = GetLastError();
OS::PrintErr("Failed to init NativeSymbolResolver (SymInitialize %" Pu32
")\n",
error);
- return;
}
#endif
}
@@ -46,13 +48,13 @@ void NativeSymbolResolver::Cleanup() {
}
running_ = false;
#ifndef DART_TARGET_OS_WINDOWS_UWP
- HANDLE hProcess = GetCurrentProcess();
- if (!SymCleanup(hProcess)) {
+ if (!SymCleanup(handle_)) {
DWORD error = GetLastError();
OS::PrintErr("Failed to shutdown NativeSymbolResolver (SymCleanup %" Pu32
")\n",
error);
}
+ CloseHandle(handle_);
#endif
}

@@ -72,13 +74,12 @@ const char* NativeSymbolResolver::LookupSymbolName(uword pc, uword* start) {
*start = 0;
}
memset(&buffer[0], 0, sizeof(buffer));
- HANDLE hProcess = GetCurrentProcess();
DWORD64 address = static_cast<DWORD64>(pc);
PSYMBOL_INFO pSymbol = reinterpret_cast<PSYMBOL_INFO>(&buffer[0]);
pSymbol->SizeOfStruct = kSymbolInfoSize;
pSymbol->MaxNameLen = kMaxNameLength;
DWORD64 displacement;
- BOOL r = SymFromAddr(hProcess, address, &displacement, pSymbol);
+ BOOL r = SymFromAddr(handle_, address, &displacement, pSymbol);
if (r == FALSE) {
return nullptr;
}
--
2.41.0.windows.1

26 changes: 26 additions & 0 deletions 0002-Update.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 2914ed92e81a19f17f6db3d67697acfaf51185d6 Mon Sep 17 00:00:00 2001
From: hackermdch <58121864+hackermdch@users.noreply.github.com>
Date: Sun, 22 Sep 2024 10:03:07 +0800
Subject: [PATCH] Update

---
shell/platform/minecraft/text_input_plugin.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/shell/platform/minecraft/text_input_plugin.cc b/shell/platform/minecraft/text_input_plugin.cc
index 4a8af55d1c..e0d1f692ea 100644
--- a/shell/platform/minecraft/text_input_plugin.cc
+++ b/shell/platform/minecraft/text_input_plugin.cc
@@ -202,8 +202,8 @@ void TextInputPlugin::SendStateUpdate(const TextInputModel& model) {
editing_state.AddMember(kComposingExtentKey, -1, allocator);
editing_state.AddMember(kSelectionAffinityKey, kAffinityDownstream,
allocator);
- editing_state.AddMember(kSelectionBaseKey, selection.base(), allocator);
- editing_state.AddMember(kSelectionExtentKey, selection.extent(), allocator);
+ editing_state.AddMember(kSelectionBaseKey, (uint64_t)selection.base(), allocator);
+ editing_state.AddMember(kSelectionExtentKey, (uint64_t)selection.extent(), allocator);
editing_state.AddMember(kSelectionIsDirectionalKey, false, allocator);
editing_state.AddMember(
kTextKey, rapidjson::Value(model.GetText(), allocator).Move(), allocator);
--
2.41.0.windows.1

0 comments on commit 7a018f8

Please # to comment.