-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
631 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"profiles": { | ||
"配置文件 1": { | ||
"commandName": "Executable", | ||
"executablePath": "C:\\Users\\minec\\Desktop\\bds\\bedrock_server_mod.exe", | ||
"workingDirectory": "C:\\Users\\minec\\Desktop\\bds" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
namespace Hosihikari.NativeInterop.Unmanaged; | ||
|
||
public readonly ref struct MoveHandle<T> where T : class, ICppInstance<T> | ||
#pragma warning disable CS8500 | ||
public unsafe readonly ref struct MoveHandle<T> | ||
{ | ||
private readonly T _instance; | ||
private readonly T* _instance; | ||
|
||
internal MoveHandle(T val) | ||
internal MoveHandle(in T val) | ||
{ | ||
_instance = val; | ||
fixed (T* ptr = &val) | ||
_instance = ptr; | ||
} | ||
|
||
public T Target => _instance; | ||
public T* Target => _instance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Hosihikari.NativeInterop.Unmanaged.STL; | ||
|
||
[StructLayout(LayoutKind.Sequential)] | ||
public unsafe struct StdErrorCondition | ||
{ | ||
public int val; | ||
public StdErrorCategory* category; | ||
} | ||
|
||
[StructLayout(LayoutKind.Explicit, Size = 16)] | ||
public unsafe struct StdErrorCategory | ||
{ | ||
[StructLayout(LayoutKind.Sequential)] | ||
public readonly unsafe struct VTable : ICppVtable | ||
{ | ||
// 0 | ||
public readonly delegate* unmanaged<StdErrorCategory*, void> destructor; | ||
// 1 | ||
public readonly delegate* unmanaged<StdErrorCategory*, byte*> name; | ||
// 2 | ||
public readonly delegate* unmanaged<StdErrorCategory*, int, StdString> message; | ||
// 3 | ||
public readonly delegate* unmanaged<StdErrorCategory*, int, StdErrorCondition> default_error_condition; | ||
// 4 | ||
public readonly delegate* unmanaged<StdErrorCategory*, int, in StdErrorCondition, bool> equivalent; | ||
// 5 | ||
public readonly delegate* unmanaged<StdErrorCategory*, in StdErrorCode, int, bool> equivalent_overload; | ||
|
||
public static ulong VtableLength => 6; | ||
} | ||
} | ||
|
||
[StructLayout(LayoutKind.Sequential)] | ||
public unsafe struct StdErrorCode | ||
{ | ||
public int val; | ||
public void* errorCategory; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Hosihikari.NativeInterop.Generation; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
|
||
namespace Hosihikari.NativeInterop.Unmanaged.STL; | ||
|
||
[StructLayout(LayoutKind.Sequential)] | ||
public unsafe partial struct CxxSharedPtr : ITypeReferenceProvider | ||
{ | ||
public void* ptr; | ||
|
||
public void* ctr; | ||
|
||
#if WINDOWS | ||
[GeneratedRegex("^class std::shared_ptr<(?<class_type>.*)>")] | ||
internal static partial Regex StdSharedPtrRegex(); | ||
#else | ||
internal static Regex StdVectorRegex() => throw new NotImplementedException(); | ||
#endif | ||
|
||
public static Regex Regex => StdSharedPtrRegex(); | ||
|
||
public static Type? Matched(Match match) => typeof(CxxSharedPtr); | ||
|
||
public readonly void* Target<T>() where T : class, ICppInstance<T> | ||
=> T.ConstructInstance((nint)ptr, false, true); | ||
} | ||
|
||
//public class StdSharedPtr<T> | ||
// where T : class, ICppInstance<T> | ||
//{ | ||
|
||
//} |
Oops, something went wrong.