mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
1 Commits
build/alph
...
typo/ci
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a10e9e40a2 |
2
.github/workflows/close_stale.yml
vendored
2
.github/workflows/close_stale.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
- uses: actions/stale@v9
|
- uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
any-of-labels: 'needs-more-info,需要更多信息'
|
any-of-labels: 'needs-more-info,需要更多信息'
|
||||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 3 days.'
|
stale-issue-message: 'This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 3 days.'
|
||||||
days-before-stale: 7
|
days-before-stale: 7
|
||||||
days-before-close: 3
|
days-before-close: 3
|
||||||
close-issue-reason: not_planned
|
close-issue-reason: not_planned
|
||||||
10
build.cake
10
build.cake
@@ -11,15 +11,6 @@ var version = "version";
|
|||||||
var repoDir = "repoDir";
|
var repoDir = "repoDir";
|
||||||
var outputPath = "outputPath";
|
var outputPath = "outputPath";
|
||||||
|
|
||||||
// Extension
|
|
||||||
|
|
||||||
static ProcessArgumentBuilder AppendIf(this ProcessArgumentBuilder builder, string text, bool condition)
|
|
||||||
{
|
|
||||||
return condition ? builder.Append(text) : builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Properties
|
|
||||||
|
|
||||||
string solution
|
string solution
|
||||||
{
|
{
|
||||||
get => System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao.sln");
|
get => System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao.sln");
|
||||||
@@ -166,7 +157,6 @@ Task("Build binary package")
|
|||||||
.Append("/p:AppxPackageSigningEnabled=false")
|
.Append("/p:AppxPackageSigningEnabled=false")
|
||||||
.Append("/p:AppxBundle=Never")
|
.Append("/p:AppxBundle=Never")
|
||||||
.Append("/p:AppxPackageOutput=" + outputPath)
|
.Append("/p:AppxPackageOutput=" + outputPath)
|
||||||
.AppendIf("/p:AlphaConstants=IS_ALPHA_BUILD", !AppVeyor.IsRunningOnAppVeyor)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DotNetBuild(project, settings);
|
DotNetBuild(project, settings);
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ public sealed partial class App : Application
|
|||||||
/// <param name="serviceProvider">服务提供器</param>
|
/// <param name="serviceProvider">服务提供器</param>
|
||||||
public App(IServiceProvider serviceProvider)
|
public App(IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
// DispatcherShutdownMode = DispatcherShutdownMode.OnExplicitShutdown;
|
|
||||||
|
|
||||||
// Load app resource
|
// Load app resource
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
activation = serviceProvider.GetRequiredService<IActivation>();
|
activation = serviceProvider.GetRequiredService<IActivation>();
|
||||||
|
|||||||
@@ -17,13 +17,8 @@
|
|||||||
<x:String x:Key="UI_Icon_Intee_Explore_1">https://api.snapgenshin.com/static/raw/Bg/UI_Icon_Intee_Explore_1.png</x:String>
|
<x:String x:Key="UI_Icon_Intee_Explore_1">https://api.snapgenshin.com/static/raw/Bg/UI_Icon_Intee_Explore_1.png</x:String>
|
||||||
<x:String x:Key="UI_ImgSign_ItemIcon">https://api.snapgenshin.com/static/raw/Bg/UI_ImgSign_ItemIcon.png</x:String>
|
<x:String x:Key="UI_ImgSign_ItemIcon">https://api.snapgenshin.com/static/raw/Bg/UI_ImgSign_ItemIcon.png</x:String>
|
||||||
<x:String x:Key="UI_ItemIcon_None">https://api.snapgenshin.com/static/raw/Bg/UI_ItemIcon_None.png</x:String>
|
<x:String x:Key="UI_ItemIcon_None">https://api.snapgenshin.com/static/raw/Bg/UI_ItemIcon_None.png</x:String>
|
||||||
|
<x:String x:Key="UI_MarkQuest_Events_Proce">https://api.snapgenshin.com/static/raw/Bg/UI_MarkQuest_Events_Proce.png</x:String>
|
||||||
<!-- Mark -->
|
<x:String x:Key="UI_MarkTower">https://api.snapgenshin.com/static/raw/Bg/UI_MarkTower.png</x:String>
|
||||||
<x:String x:Key="UI_MarkQuest_Events_Proce">https://api.snapgenshin.com/static/raw/Mark/UI_MarkQuest_Events_Proce.png</x:String>
|
|
||||||
<x:String x:Key="UI_MarkQuest_Events_Start">https://api.snapgenshin.com/static/raw/Mark/UI_MarkQuest_Events_Start.png</x:String>
|
|
||||||
<x:String x:Key="UI_MarkQuest_Main_Proce">https://api.snapgenshin.com/static/raw/Mark/UI_MarkQuest_Main_Proce.png</x:String>
|
|
||||||
<x:String x:Key="UI_MarkQuest_Main_Start">https://api.snapgenshin.com/static/raw/Mark/UI_MarkQuest_Main_Start.png</x:String>
|
|
||||||
<x:String x:Key="UI_MarkTower">https://api.snapgenshin.com/static/raw/Mark/UI_MarkTower.png</x:String>
|
|
||||||
|
|
||||||
<!-- ItemIcon -->
|
<!-- ItemIcon -->
|
||||||
<x:String x:Key="UI_ItemIcon_201">https://api.snapgenshin.com/static/raw/ItemIcon/UI_ItemIcon_201.png</x:String>
|
<x:String x:Key="UI_ItemIcon_201">https://api.snapgenshin.com/static/raw/ItemIcon/UI_ItemIcon_201.png</x:String>
|
||||||
|
|||||||
25
src/Snap.Hutao/Snap.Hutao/Core/Convert.cs
Normal file
25
src/Snap.Hutao/Snap.Hutao/Core/Convert.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支持Md5转换
|
||||||
|
/// </summary>
|
||||||
|
[HighQuality]
|
||||||
|
internal static class Convert
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取字符串的MD5计算结果
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">源字符串</param>
|
||||||
|
/// <returns>计算的结果</returns>
|
||||||
|
public static string ToMd5HexString(string source)
|
||||||
|
{
|
||||||
|
byte[] hash = MD5.HashData(Encoding.UTF8.GetBytes(source));
|
||||||
|
return System.Convert.ToHexString(hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,12 +51,6 @@ internal sealed class HutaoException : Exception
|
|||||||
throw new InvalidCastException(message, innerException);
|
throw new InvalidCastException(message, innerException);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DoesNotReturn]
|
|
||||||
public static InvalidOperationException InvalidOperation(string message, Exception? innerException = default)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(message, innerException);
|
|
||||||
}
|
|
||||||
|
|
||||||
[DoesNotReturn]
|
[DoesNotReturn]
|
||||||
public static NotSupportedException NotSupported(string? message = default, Exception? innerException = default)
|
public static NotSupportedException NotSupported(string? message = default, Exception? innerException = default)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,13 +62,13 @@ internal static class FileOperation
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IUnknownMarshal.Release(pDestShellItem);
|
pDestShellItem->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
IUnknownMarshal.Release(pSourceShellItem);
|
pSourceShellItem->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
IUnknownMarshal.Release(pFileOperation);
|
pFileOperation->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -89,10 +89,10 @@ internal static class FileOperation
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IUnknownMarshal.Release(pShellItem);
|
pShellItem->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
IUnknownMarshal.Release(pFileOperation);
|
pFileOperation->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -8,17 +8,12 @@ namespace Snap.Hutao.Core.IO.Hashing;
|
|||||||
|
|
||||||
internal static class Hash
|
internal static class Hash
|
||||||
{
|
{
|
||||||
public static unsafe string SHA1HexString(string input)
|
public static string SHA1HexString(string input)
|
||||||
{
|
{
|
||||||
return HashCore(Convert.ToHexString, SHA1.HashData, Encoding.UTF8.GetBytes, input);
|
return HashCore(System.Convert.ToHexString, SHA1.HashData, Encoding.UTF8.GetBytes, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe string MD5HexString(string input)
|
private static TResult HashCore<TInput, TResult>(Func<byte[], TResult> resultConverter, Func<byte[], byte[]> hashMethod, Func<TInput, byte[]> bytesConverter, TInput input)
|
||||||
{
|
|
||||||
return HashCore(Convert.ToHexString, System.Security.Cryptography.MD5.HashData, Encoding.UTF8.GetBytes, input);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static unsafe TResult HashCore<TInput, TResult>(Func<byte[], TResult> resultConverter, Func<byte[], byte[]> hashMethod, Func<TInput, byte[]> bytesConverter, TInput input)
|
|
||||||
{
|
{
|
||||||
return resultConverter(hashMethod(bytesConverter(input)));
|
return resultConverter(hashMethod(bytesConverter(input)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,6 @@ internal static class MD5
|
|||||||
public static async ValueTask<string> HashAsync(Stream stream, CancellationToken token = default)
|
public static async ValueTask<string> HashAsync(Stream stream, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
byte[] bytes = await System.Security.Cryptography.MD5.HashDataAsync(stream, token).ConfigureAwait(false);
|
byte[] bytes = await System.Security.Cryptography.MD5.HashDataAsync(stream, token).ConfigureAwait(false);
|
||||||
return Convert.ToHexString(bytes);
|
return System.Convert.ToHexString(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,6 @@ internal static class SHA256
|
|||||||
public static async ValueTask<string> HashAsync(Stream stream, CancellationToken token = default)
|
public static async ValueTask<string> HashAsync(Stream stream, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
byte[] bytes = await System.Security.Cryptography.SHA256.HashDataAsync(stream, token).ConfigureAwait(false);
|
byte[] bytes = await System.Security.Cryptography.SHA256.HashDataAsync(stream, token).ConfigureAwait(false);
|
||||||
return Convert.ToHexString(bytes);
|
return System.Convert.ToHexString(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Core;
|
|
||||||
|
|
||||||
internal readonly ref struct ReadOnlySpan2D<T>
|
|
||||||
where T : unmanaged
|
|
||||||
{
|
|
||||||
private readonly ref T reference;
|
|
||||||
private readonly int length;
|
|
||||||
private readonly int columns;
|
|
||||||
|
|
||||||
public unsafe ReadOnlySpan2D(void* pointer, int length, int columns)
|
|
||||||
{
|
|
||||||
reference = ref *(T*)pointer;
|
|
||||||
this.length = length;
|
|
||||||
this.columns = columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReadOnlySpan<T> this[int row]
|
|
||||||
{
|
|
||||||
get => MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref reference, row * columns), columns);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using Microsoft.Web.WebView2.Core;
|
using Microsoft.Web.WebView2.Core;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Snap.Hutao.Core.IO.Hashing;
|
|
||||||
using Snap.Hutao.Core.Setting;
|
using Snap.Hutao.Core.Setting;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Principal;
|
using System.Security.Principal;
|
||||||
@@ -51,7 +50,7 @@ internal sealed class RuntimeOptions
|
|||||||
{
|
{
|
||||||
string userName = Environment.UserName;
|
string userName = Environment.UserName;
|
||||||
object? machineGuid = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\", "MachineGuid", userName);
|
object? machineGuid = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\", "MachineGuid", userName);
|
||||||
return Hash.MD5HexString($"{userName}{machineGuid}");
|
return Convert.ToMd5HexString($"{userName}{machineGuid}");
|
||||||
});
|
});
|
||||||
|
|
||||||
private readonly LazySlim<(string Version, bool Supported)> lazyWebViewEnvironment = new(() =>
|
private readonly LazySlim<(string Version, bool Supported)> lazyWebViewEnvironment = new(() =>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ internal sealed partial class ShellLinkInterop : IShellLinkInterop
|
|||||||
pShellLink->SetShowCmd(SHOW_WINDOW_CMD.SW_NORMAL);
|
pShellLink->SetShowCmd(SHOW_WINDOW_CMD.SW_NORMAL);
|
||||||
pShellLink->SetIconLocation(targetLogoPath, 0);
|
pShellLink->SetIconLocation(targetLogoPath, 0);
|
||||||
|
|
||||||
if (SUCCEEDED(IUnknownMarshal.QueryInterface(pShellLink, in IPersistFile.IID, out IPersistFile* pPersistFile)))
|
if (SUCCEEDED(pShellLink->QueryInterface(in IPersistFile.IID, out IPersistFile* pPersistFile)))
|
||||||
{
|
{
|
||||||
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||||
string target = Path.Combine(desktop, $"{SH.FormatAppNameAndVersion(runtimeOptions.Version)}.lnk");
|
string target = Path.Combine(desktop, $"{SH.FormatAppNameAndVersion(runtimeOptions.Version)}.lnk");
|
||||||
@@ -64,10 +64,10 @@ internal sealed partial class ShellLinkInterop : IShellLinkInterop
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IUnknownMarshal.Release(pPersistFile);
|
pPersistFile->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint value = IUnknownMarshal.Release(pShellLink);
|
pShellLink->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ internal sealed partial class IdentifyMonitorWindow : Window
|
|||||||
{
|
{
|
||||||
List<IdentifyMonitorWindow> windows = [];
|
List<IdentifyMonitorWindow> windows = [];
|
||||||
|
|
||||||
// TODO: the order here is not sync with unity.
|
|
||||||
IReadOnlyList<DisplayArea> displayAreas = DisplayArea.FindAll();
|
IReadOnlyList<DisplayArea> displayAreas = DisplayArea.FindAll();
|
||||||
for (int i = 0; i < displayAreas.Count; i++)
|
for (int i = 0; i < displayAreas.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,18 +23,6 @@
|
|||||||
"Equatable": true,
|
"Equatable": true,
|
||||||
"EqualityOperators": true
|
"EqualityOperators": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Name": "ChapterId",
|
|
||||||
"Documentation": "章节 Id",
|
|
||||||
"Equatable": true,
|
|
||||||
"EqualityOperators": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "ChapterGroupId",
|
|
||||||
"Documentation": "章节分组 Id",
|
|
||||||
"Equatable": true,
|
|
||||||
"EqualityOperators": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Name": "EquipAffixId",
|
"Name": "EquipAffixId",
|
||||||
"Documentation": "装备属性 Id",
|
"Documentation": "装备属性 Id",
|
||||||
@@ -125,12 +113,6 @@
|
|||||||
"Equatable": true,
|
"Equatable": true,
|
||||||
"EqualityOperators": true
|
"EqualityOperators": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Name": "QuestId",
|
|
||||||
"Documentation": "任务 Id",
|
|
||||||
"Equatable": true,
|
|
||||||
"EqualityOperators": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Name": "ReliquaryLevel",
|
"Name": "ReliquaryLevel",
|
||||||
"Documentation": "圣遗物等级 1 - 21",
|
"Documentation": "圣遗物等级 1 - 21",
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using Snap.Hutao.Core.Abstraction;
|
using Snap.Hutao.Core.Abstraction;
|
||||||
using Snap.Hutao.Model.Entity.Abstraction;
|
using Snap.Hutao.Model.Entity.Abstraction;
|
||||||
using Snap.Hutao.Model.Primitive;
|
|
||||||
using Snap.Hutao.ViewModel.DailyNote;
|
|
||||||
using Snap.Hutao.ViewModel.User;
|
using Snap.Hutao.ViewModel.User;
|
||||||
using Snap.Hutao.Web.Hoyolab.Takumi.Binding;
|
using Snap.Hutao.Web.Hoyolab.Takumi.Binding;
|
||||||
using Snap.Hutao.Web.Hoyolab.Takumi.GameRecord.DailyNote;
|
using Snap.Hutao.Web.Hoyolab.Takumi.GameRecord.DailyNote;
|
||||||
@@ -55,9 +53,6 @@ internal sealed class DailyNoteEntry : ObservableObject, IMappingFrom<DailyNoteE
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DailyNote? DailyNote { get; set; }
|
public DailyNote? DailyNote { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
|
||||||
public DailyNoteArchonQuestView ArchonQuestView { get; set; } = default!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 刷新时间
|
/// 刷新时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -3,42 +3,14 @@
|
|||||||
|
|
||||||
namespace Snap.Hutao.Model.Intrinsic;
|
namespace Snap.Hutao.Model.Intrinsic;
|
||||||
|
|
||||||
internal enum QuestType : uint
|
internal enum QuestType
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Archon Quest 魔神任务
|
|
||||||
/// </summary>
|
|
||||||
AQ,
|
AQ,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fractions Quest 帮派任务
|
|
||||||
/// </summary>
|
|
||||||
FQ,
|
FQ,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Legend Quest 传说任务
|
|
||||||
/// </summary>
|
|
||||||
LQ,
|
LQ,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event Quest 活动任务
|
|
||||||
/// </summary>
|
|
||||||
EQ,
|
EQ,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Daily Quest 日常任务
|
|
||||||
/// </summary>
|
|
||||||
DQ,
|
DQ,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indescribable Quest 不可描述的任务?
|
|
||||||
/// </summary>
|
|
||||||
IQ,
|
IQ,
|
||||||
|
|
||||||
VQ,
|
VQ,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// World Quest 世界任务
|
|
||||||
/// </summary>
|
|
||||||
WQ,
|
WQ,
|
||||||
}
|
}
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Model.Intrinsic;
|
|
||||||
using Snap.Hutao.Model.Primitive;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Model.Metadata;
|
|
||||||
|
|
||||||
internal sealed class Chapter
|
|
||||||
{
|
|
||||||
public ChapterId Id { get; set; }
|
|
||||||
|
|
||||||
public ChapterGroupId GroupId { get; set; }
|
|
||||||
|
|
||||||
public QuestId BeginQuestId { get; set; }
|
|
||||||
|
|
||||||
public QuestId EndQuestId { get; set; }
|
|
||||||
|
|
||||||
public uint NeedPlayerLevel { get; set; }
|
|
||||||
|
|
||||||
public string Number { get; set; } = default!;
|
|
||||||
|
|
||||||
public string Title { get; set; } = default!;
|
|
||||||
|
|
||||||
public string Icon { get; set; } = default!;
|
|
||||||
|
|
||||||
public string ImageTitle { get; set; } = default!;
|
|
||||||
|
|
||||||
public string SerialNumberIcon { get; set; } = default!;
|
|
||||||
|
|
||||||
public City CityId { get; set; }
|
|
||||||
|
|
||||||
public QuestType QuestType { get; set; }
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ namespace Snap.Hutao.Model.Metadata;
|
|||||||
// CityTaskOpenExcelConfig
|
// CityTaskOpenExcelConfig
|
||||||
internal enum City : uint
|
internal enum City : uint
|
||||||
{
|
{
|
||||||
None = 0,
|
|
||||||
Mondstadt = 1,
|
Mondstadt = 1,
|
||||||
Liyue = 2,
|
Liyue = 2,
|
||||||
Inazuma = 3,
|
Inazuma = 3,
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ internal sealed class Material : DisplayItem
|
|||||||
/// <returns>是否为物品栏物品</returns>
|
/// <returns>是否为物品栏物品</returns>
|
||||||
public bool IsInventoryItem()
|
public bool IsInventoryItem()
|
||||||
{
|
{
|
||||||
|
// TODO: Add a pre-filtered metadata set to check if it's an inventory item
|
||||||
|
|
||||||
// 原质
|
// 原质
|
||||||
if (Id == 112001U)
|
if (Id == 112001U)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3044,9 +3044,6 @@
|
|||||||
<data name="WebBridgeShareCopyToClipboardSuccess" xml:space="preserve">
|
<data name="WebBridgeShareCopyToClipboardSuccess" xml:space="preserve">
|
||||||
<value>已复制到剪贴板</value>
|
<value>已复制到剪贴板</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="WebDailyNoteArchonQuestChapterFinished" xml:space="preserve">
|
|
||||||
<value>所有魔神任务已完成</value>
|
|
||||||
</data>
|
|
||||||
<data name="WebDailyNoteArchonQuestStatusFinished" xml:space="preserve">
|
<data name="WebDailyNoteArchonQuestStatusFinished" xml:space="preserve">
|
||||||
<value>全部完成</value>
|
<value>全部完成</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Model.Metadata;
|
|
||||||
using Snap.Hutao.Service.Metadata.ContextAbstraction;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.DailyNote;
|
|
||||||
|
|
||||||
internal class DailyNoteMetadataContext : IMetadataContext,
|
|
||||||
IMetadataListChapterSource
|
|
||||||
{
|
|
||||||
public List<Chapter> Chapters { get; set; } = default!;
|
|
||||||
}
|
|
||||||
@@ -5,11 +5,7 @@ using CommunityToolkit.Mvvm.Messaging;
|
|||||||
using Snap.Hutao.Core.DependencyInjection.Abstraction;
|
using Snap.Hutao.Core.DependencyInjection.Abstraction;
|
||||||
using Snap.Hutao.Message;
|
using Snap.Hutao.Message;
|
||||||
using Snap.Hutao.Model.Entity;
|
using Snap.Hutao.Model.Entity;
|
||||||
using Snap.Hutao.Service.Abstraction;
|
|
||||||
using Snap.Hutao.Service.Metadata;
|
|
||||||
using Snap.Hutao.Service.Metadata.ContextAbstraction;
|
|
||||||
using Snap.Hutao.Service.User;
|
using Snap.Hutao.Service.User;
|
||||||
using Snap.Hutao.ViewModel.DailyNote;
|
|
||||||
using Snap.Hutao.ViewModel.User;
|
using Snap.Hutao.ViewModel.User;
|
||||||
using Snap.Hutao.Web.Hoyolab;
|
using Snap.Hutao.Web.Hoyolab;
|
||||||
using Snap.Hutao.Web.Hoyolab.Takumi.GameRecord;
|
using Snap.Hutao.Web.Hoyolab.Takumi.GameRecord;
|
||||||
@@ -87,18 +83,9 @@ internal sealed partial class DailyNoteService : IDailyNoteService, IRecipient<U
|
|||||||
await userService.GetRoleCollectionAsync().ConfigureAwait(false);
|
await userService.GetRoleCollectionAsync().ConfigureAwait(false);
|
||||||
await RefreshDailyNotesCoreAsync(forceRefresh, token).ConfigureAwait(false);
|
await RefreshDailyNotesCoreAsync(forceRefresh, token).ConfigureAwait(false);
|
||||||
|
|
||||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
List<DailyNoteEntry> entryList = await dailyNoteDbService.GetDailyNoteEntryListIncludingUserAsync(token).ConfigureAwait(false);
|
||||||
{
|
entryList.ForEach(entry => { entry.UserGameRole = userService.GetUserGameRoleByUid(entry.Uid); });
|
||||||
DailyNoteMetadataContext context = await scope.GetRequiredService<IMetadataService>().GetContextAsync<DailyNoteMetadataContext>(token).ConfigureAwait(false);
|
entries = entryList.ToObservableCollection();
|
||||||
|
|
||||||
List<DailyNoteEntry> entryList = await dailyNoteDbService.GetDailyNoteEntryListIncludingUserAsync(token).ConfigureAwait(false);
|
|
||||||
entryList.ForEach(entry =>
|
|
||||||
{
|
|
||||||
entry.UserGameRole = userService.GetUserGameRoleByUid(entry.Uid);
|
|
||||||
entry.ArchonQuestView = DailyNoteArchonQuestView.Create(entry.DailyNote, context.Chapters);
|
|
||||||
});
|
|
||||||
entries = entryList.ToObservableCollection();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Gdi;
|
|
||||||
using Snap.Hutao.Win32.System.WinRT.Graphics.Capture;
|
|
||||||
using Windows.Graphics.Capture;
|
|
||||||
using Windows.Graphics.DirectX;
|
|
||||||
using Windows.Graphics.DirectX.Direct3D11;
|
|
||||||
using static Snap.Hutao.Win32.Gdi32;
|
|
||||||
using static Snap.Hutao.Win32.User32;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Automation.ScreenCapture;
|
|
||||||
|
|
||||||
internal readonly struct GameScreenCaptureContext
|
|
||||||
{
|
|
||||||
public readonly GraphicsCaptureItem Item;
|
|
||||||
|
|
||||||
private readonly IDirect3DDevice direct3DDevice;
|
|
||||||
private readonly HWND hwnd;
|
|
||||||
|
|
||||||
public GameScreenCaptureContext(IDirect3DDevice direct3DDevice, HWND hwnd)
|
|
||||||
{
|
|
||||||
this.direct3DDevice = direct3DDevice;
|
|
||||||
this.hwnd = hwnd;
|
|
||||||
|
|
||||||
GraphicsCaptureItem.As<IGraphicsCaptureItemInterop>().CreateForWindow(hwnd, out Item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Direct3D11CaptureFramePool CreatePool()
|
|
||||||
{
|
|
||||||
return Direct3D11CaptureFramePool.CreateFreeThreaded(direct3DDevice, DeterminePixelFormat(hwnd), 2, Item.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RecreatePool(Direct3D11CaptureFramePool framePool)
|
|
||||||
{
|
|
||||||
framePool.Recreate(direct3DDevice, DeterminePixelFormat(hwnd), 2, Item.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GraphicsCaptureSession CreateSession(Direct3D11CaptureFramePool framePool)
|
|
||||||
{
|
|
||||||
GraphicsCaptureSession session = framePool.CreateCaptureSession(Item);
|
|
||||||
session.IsCursorCaptureEnabled = false;
|
|
||||||
session.IsBorderRequired = false;
|
|
||||||
return session;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DirectXPixelFormat DeterminePixelFormat(HWND hwnd)
|
|
||||||
{
|
|
||||||
HDC hdc = GetDC(hwnd);
|
|
||||||
if (hdc != HDC.NULL)
|
|
||||||
{
|
|
||||||
int bitsPerPixel = GetDeviceCaps(hdc, GET_DEVICE_CAPS_INDEX.BITSPIXEL);
|
|
||||||
_ = ReleaseDC(hwnd, hdc);
|
|
||||||
if (bitsPerPixel >= 32)
|
|
||||||
{
|
|
||||||
return DirectXPixelFormat.R16G16B16A16Float;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return DirectXPixelFormat.B8G8R8A8UIntNormalized;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Core;
|
|
||||||
using Snap.Hutao.Core.ExceptionService;
|
|
||||||
using System.Buffers;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Automation.ScreenCapture;
|
|
||||||
|
|
||||||
internal sealed class GameScreenCaptureMemoryPool : MemoryPool<byte>
|
|
||||||
{
|
|
||||||
private static LazySlim<GameScreenCaptureMemoryPool> lazyShared = new(() => new());
|
|
||||||
|
|
||||||
private readonly object syncRoot = new();
|
|
||||||
private readonly LinkedList<GameScreenCaptureBuffer> unrentedBuffers = [];
|
|
||||||
private readonly LinkedList<GameScreenCaptureBuffer> rentedBuffers = [];
|
|
||||||
|
|
||||||
private int bufferCount;
|
|
||||||
|
|
||||||
public new static GameScreenCaptureMemoryPool Shared { get => lazyShared.Value; }
|
|
||||||
|
|
||||||
public override int MaxBufferSize { get => Array.MaxLength; }
|
|
||||||
|
|
||||||
public int BufferCount { get => bufferCount; }
|
|
||||||
|
|
||||||
public override IMemoryOwner<byte> Rent(int minBufferSize = -1)
|
|
||||||
{
|
|
||||||
ArgumentOutOfRangeException.ThrowIfLessThan(minBufferSize, 0);
|
|
||||||
|
|
||||||
lock (syncRoot)
|
|
||||||
{
|
|
||||||
foreach (GameScreenCaptureBuffer buffer in unrentedBuffers)
|
|
||||||
{
|
|
||||||
if (buffer.Memory.Length >= minBufferSize)
|
|
||||||
{
|
|
||||||
unrentedBuffers.Remove(buffer);
|
|
||||||
rentedBuffers.AddLast(buffer);
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GameScreenCaptureBuffer newBuffer = new(this, minBufferSize);
|
|
||||||
rentedBuffers.AddLast(newBuffer);
|
|
||||||
++bufferCount;
|
|
||||||
return newBuffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
lock (syncRoot)
|
|
||||||
{
|
|
||||||
if (rentedBuffers.Count > 0)
|
|
||||||
{
|
|
||||||
HutaoException.InvalidOperation("There are still rented buffers.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal sealed class GameScreenCaptureBuffer : IMemoryOwner<byte>
|
|
||||||
{
|
|
||||||
private readonly GameScreenCaptureMemoryPool pool;
|
|
||||||
private readonly byte[] buffer;
|
|
||||||
|
|
||||||
public GameScreenCaptureBuffer(GameScreenCaptureMemoryPool pool, int bufferSize)
|
|
||||||
{
|
|
||||||
this.pool = pool;
|
|
||||||
buffer = GC.AllocateUninitializedArray<byte>(bufferSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Memory<byte> Memory { get => buffer.AsMemory(); }
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
lock (pool.syncRoot)
|
|
||||||
{
|
|
||||||
pool.rentedBuffers.Remove(this);
|
|
||||||
pool.unrentedBuffers.AddLast(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Core;
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Direct3D;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi;
|
|
||||||
using Snap.Hutao.Win32.System.Com;
|
|
||||||
using Windows.Graphics.Capture;
|
|
||||||
using Windows.Graphics.DirectX.Direct3D11;
|
|
||||||
using WinRT;
|
|
||||||
using static Snap.Hutao.Win32.ConstValues;
|
|
||||||
using static Snap.Hutao.Win32.D3D11;
|
|
||||||
using static Snap.Hutao.Win32.Macros;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Automation.ScreenCapture;
|
|
||||||
|
|
||||||
[ConstructorGenerated]
|
|
||||||
[Injection(InjectAs.Singleton, typeof(IGameScreenCaptureService))]
|
|
||||||
internal sealed partial class GameScreenCaptureService : IGameScreenCaptureService
|
|
||||||
{
|
|
||||||
private readonly ILogger<GameScreenCaptureService> logger;
|
|
||||||
|
|
||||||
public bool IsSupported()
|
|
||||||
{
|
|
||||||
if (!Core.UniversalApiContract.IsPresent(WindowsVersion.Windows10Version1903))
|
|
||||||
{
|
|
||||||
logger.LogWarning("Windows 10 Version 1903 or later is required for Windows.Graphics.Capture API.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GraphicsCaptureSession.IsSupported())
|
|
||||||
{
|
|
||||||
logger.LogWarning("GraphicsCaptureSession is not supported.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[SuppressMessage("", "SH002")]
|
|
||||||
public unsafe bool TryStartCapture(HWND hwnd, [NotNullWhen(true)] out GameScreenCaptureSession? session)
|
|
||||||
{
|
|
||||||
session = default;
|
|
||||||
|
|
||||||
D3D11_CREATE_DEVICE_FLAG flag = D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_BGRA_SUPPORT
|
|
||||||
#if DEBUG
|
|
||||||
| D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_DEBUG
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
HRESULT hr;
|
|
||||||
hr = D3D11CreateDevice(default, D3D_DRIVER_TYPE.D3D_DRIVER_TYPE_HARDWARE, default, flag, [], D3D11_SDK_VERSION, out ID3D11Device* pD3D11Device, out _, out _);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
logger.LogWarning("D3D11CreateDevice failed with code: {Code}", hr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = IUnknownMarshal.QueryInterface(pD3D11Device, in IDXGIDevice.IID, out IDXGIDevice* pDXGIDevice);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
logger.LogWarning("ID3D11Device.QueryInterface<IDXGIDevice> failed with code: {Code}", hr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
IUnknownMarshal.Release(pDXGIDevice);
|
|
||||||
|
|
||||||
hr = CreateDirect3D11DeviceFromDXGIDevice(pDXGIDevice, out Win32.System.WinRT.IInspectable* inspectable);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
logger.LogWarning("CreateDirect3D11DeviceFromDXGIDevice failed with code: {Code}", hr);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
IUnknownMarshal.Release(inspectable);
|
|
||||||
|
|
||||||
IDirect3DDevice direct3DDevice = IInspectable.FromAbi((nint)inspectable).ObjRef.AsInterface<IDirect3DDevice>();
|
|
||||||
|
|
||||||
GameScreenCaptureContext captureContext = new(direct3DDevice, hwnd);
|
|
||||||
session = new(captureContext, logger);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Core;
|
|
||||||
using Snap.Hutao.Core.ExceptionService;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi.Common;
|
|
||||||
using Snap.Hutao.Win32.System.WinRT.Graphics.Capture;
|
|
||||||
using System.Buffers;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using Windows.Graphics;
|
|
||||||
using Windows.Graphics.Capture;
|
|
||||||
using Windows.Graphics.DirectX.Direct3D11;
|
|
||||||
using WinRT;
|
|
||||||
using static Snap.Hutao.Win32.Macros;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Automation.ScreenCapture;
|
|
||||||
|
|
||||||
internal sealed class GameScreenCaptureSession : IDisposable
|
|
||||||
{
|
|
||||||
private readonly GameScreenCaptureContext captureContext;
|
|
||||||
private readonly Direct3D11CaptureFramePool framePool;
|
|
||||||
private readonly GraphicsCaptureSession session;
|
|
||||||
private readonly ILogger logger;
|
|
||||||
|
|
||||||
private TaskCompletionSource<IMemoryOwner<byte>>? frameRawPixelDataTaskCompletionSource;
|
|
||||||
private bool isFrameRawPixelDataRequested;
|
|
||||||
private SizeInt32 contentSize;
|
|
||||||
|
|
||||||
private bool isDisposed;
|
|
||||||
|
|
||||||
[SuppressMessage("", "SH002")]
|
|
||||||
public GameScreenCaptureSession(GameScreenCaptureContext captureContext, ILogger logger)
|
|
||||||
{
|
|
||||||
this.captureContext = captureContext;
|
|
||||||
this.logger = logger;
|
|
||||||
|
|
||||||
contentSize = captureContext.Item.Size;
|
|
||||||
|
|
||||||
captureContext.Item.Closed += OnItemClosed;
|
|
||||||
|
|
||||||
framePool = captureContext.CreatePool();
|
|
||||||
framePool.FrameArrived += OnFrameArrived;
|
|
||||||
|
|
||||||
session = captureContext.CreateSession(framePool);
|
|
||||||
session.StartCapture();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask<IMemoryOwner<byte>> RequestFrameRawPixelDataAsync()
|
|
||||||
{
|
|
||||||
if (Volatile.Read(ref isFrameRawPixelDataRequested))
|
|
||||||
{
|
|
||||||
HutaoException.InvalidOperation("The frame raw pixel data has already been requested.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDisposed)
|
|
||||||
{
|
|
||||||
HutaoException.InvalidOperation("The session has been disposed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
frameRawPixelDataTaskCompletionSource = new();
|
|
||||||
Volatile.Write(ref isFrameRawPixelDataRequested, true);
|
|
||||||
|
|
||||||
return await frameRawPixelDataTaskCompletionSource.Task.ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
if (isDisposed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
session.Dispose();
|
|
||||||
framePool.Dispose();
|
|
||||||
isDisposed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnItemClosed(GraphicsCaptureItem sender, object args)
|
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe void OnFrameArrived(Direct3D11CaptureFramePool sender, object args)
|
|
||||||
{
|
|
||||||
// Simply ignore the frame if the frame raw pixel data is not requested.
|
|
||||||
if (!Volatile.Read(ref isFrameRawPixelDataRequested))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (Direct3D11CaptureFrame? frame = sender.TryGetNextFrame())
|
|
||||||
{
|
|
||||||
if (frame is null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool needsReset = false;
|
|
||||||
|
|
||||||
if (frame.ContentSize != contentSize)
|
|
||||||
{
|
|
||||||
needsReset = true;
|
|
||||||
contentSize = frame.ContentSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UnsafeProcessFrameSurface(frame.Surface);
|
|
||||||
}
|
|
||||||
catch (Exception ex) // TODO: test if it's device lost.
|
|
||||||
{
|
|
||||||
logger.LogError(ex, "Failed to process the frame surface.");
|
|
||||||
needsReset = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needsReset)
|
|
||||||
{
|
|
||||||
captureContext.RecreatePool(sender);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe void UnsafeProcessFrameSurface(IDirect3DSurface surface)
|
|
||||||
{
|
|
||||||
IDirect3DDxgiInterfaceAccess access = surface.As<IDirect3DDxgiInterfaceAccess>();
|
|
||||||
if (FAILED(access.GetInterface(in IDXGISurface.IID, out IDXGISurface* pDXGISurface)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(pDXGISurface->GetDesc(out DXGI_SURFACE_DESC dxgiSurfaceDesc)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should be the same device used to create the frame pool.
|
|
||||||
if (FAILED(pDXGISurface->GetDevice(in ID3D11Device.IID, out ID3D11Device* pD3D11Device)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D11_TEXTURE2D_DESC d3d11Texture2DDesc = default;
|
|
||||||
d3d11Texture2DDesc.Width = dxgiSurfaceDesc.Width;
|
|
||||||
d3d11Texture2DDesc.Height = dxgiSurfaceDesc.Height;
|
|
||||||
d3d11Texture2DDesc.ArraySize = 1;
|
|
||||||
|
|
||||||
// We have to copy out the resource to a CPU readable texture.
|
|
||||||
d3d11Texture2DDesc.CPUAccessFlags = D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_READ;
|
|
||||||
|
|
||||||
// DirectX will automatically convert any format to B8G8R8A8_UNORM.
|
|
||||||
d3d11Texture2DDesc.Format = DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM;
|
|
||||||
d3d11Texture2DDesc.MipLevels = 1;
|
|
||||||
d3d11Texture2DDesc.SampleDesc.Count = 1;
|
|
||||||
d3d11Texture2DDesc.Usage = D3D11_USAGE.D3D11_USAGE_STAGING;
|
|
||||||
|
|
||||||
if (FAILED(pD3D11Device->CreateTexture2D(ref d3d11Texture2DDesc, ref Unsafe.NullRef<D3D11_SUBRESOURCE_DATA>(), out ID3D11Texture2D* pD3D11Texture2D)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(access.GetInterface(in ID3D11Resource.IID, out ID3D11Resource* pD3D11Resource)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pD3D11Device->GetImmediateContext(out ID3D11DeviceContext* pD3D11DeviceContext);
|
|
||||||
pD3D11DeviceContext->CopyResource((ID3D11Resource*)pD3D11Texture2D, pD3D11Resource);
|
|
||||||
|
|
||||||
if (FAILED(pD3D11DeviceContext->Map((ID3D11Resource*)pD3D11Texture2D, 0U, D3D11_MAP.D3D11_MAP_READ, 0U, out D3D11_MAPPED_SUBRESOURCE d3d11MappedSubresource)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The D3D11_MAPPED_SUBRESOURCE data is arranged as follows:
|
|
||||||
// |--------- Row pitch ----------|
|
|
||||||
// |---- Data width ----|- Blank -|
|
|
||||||
// ┌────────────────────┬─────────┐
|
|
||||||
// │ │ │
|
|
||||||
// │ Actual data │ Stride │
|
|
||||||
// │ │ │
|
|
||||||
// └────────────────────┴─────────┘
|
|
||||||
ReadOnlySpan2D<byte> subresource = new(d3d11MappedSubresource.pData, (int)d3d11Texture2DDesc.Height, (int)d3d11MappedSubresource.RowPitch);
|
|
||||||
|
|
||||||
int rowLength = contentSize.Width * 4;
|
|
||||||
IMemoryOwner<byte> buffer = GameScreenCaptureMemoryPool.Shared.Rent(contentSize.Height * rowLength);
|
|
||||||
|
|
||||||
for (int row = 0; row < contentSize.Height; row++)
|
|
||||||
{
|
|
||||||
subresource[row][..rowLength].CopyTo(buffer.Memory.Span.Slice(row * rowLength, rowLength));
|
|
||||||
}
|
|
||||||
|
|
||||||
ArgumentNullException.ThrowIfNull(frameRawPixelDataTaskCompletionSource);
|
|
||||||
frameRawPixelDataTaskCompletionSource.SetResult(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Automation.ScreenCapture;
|
|
||||||
|
|
||||||
internal interface IGameScreenCaptureService
|
|
||||||
{
|
|
||||||
bool IsSupported();
|
|
||||||
|
|
||||||
bool TryStartCapture(HWND hwnd, [NotNullWhen(true)] out GameScreenCaptureSession? session);
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Model.Metadata;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Metadata.ContextAbstraction;
|
|
||||||
|
|
||||||
internal interface IMetadataListChapterSource
|
|
||||||
{
|
|
||||||
public List<Chapter> Chapters { get; set; }
|
|
||||||
}
|
|
||||||
@@ -23,11 +23,6 @@ internal static class MetadataServiceContextExtension
|
|||||||
listAchievementSource.Achievements = await metadataService.GetAchievementListAsync(token).ConfigureAwait(false);
|
listAchievementSource.Achievements = await metadataService.GetAchievementListAsync(token).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context is IMetadataListChapterSource listChapterSource)
|
|
||||||
{
|
|
||||||
listChapterSource.Chapters = await metadataService.GetChapterListAsync(token).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context is IMetadataListGachaEventSource listGachaEventSource)
|
if (context is IMetadataListGachaEventSource listGachaEventSource)
|
||||||
{
|
{
|
||||||
listGachaEventSource.GachaEvents = await metadataService.GetGachaEventListAsync(token).ConfigureAwait(false);
|
listGachaEventSource.GachaEvents = await metadataService.GetGachaEventListAsync(token).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ internal static class MetadataFileNames
|
|||||||
public const string FileNameAvatar = "Avatar";
|
public const string FileNameAvatar = "Avatar";
|
||||||
public const string FileNameAvatarCurve = "AvatarCurve";
|
public const string FileNameAvatarCurve = "AvatarCurve";
|
||||||
public const string FileNameAvatarPromote = "AvatarPromote";
|
public const string FileNameAvatarPromote = "AvatarPromote";
|
||||||
public const string FileNameChapter = "Chapter";
|
|
||||||
public const string FileNameDisplayItem = "DisplayItem";
|
public const string FileNameDisplayItem = "DisplayItem";
|
||||||
public const string FileNameGachaEvent = "GachaEvent";
|
public const string FileNameGachaEvent = "GachaEvent";
|
||||||
public const string FileNameMaterial = "Material";
|
public const string FileNameMaterial = "Material";
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ internal static class MetadataServiceListExtension
|
|||||||
return metadataService.FromCacheOrFileAsync<List<Model.Metadata.Achievement.Achievement>>(FileNameAchievement, token);
|
return metadataService.FromCacheOrFileAsync<List<Model.Metadata.Achievement.Achievement>>(FileNameAchievement, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ValueTask<List<Chapter>> GetChapterListAsync(this IMetadataService metadataService, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
return metadataService.FromCacheOrFileAsync<List<Chapter>>(FileNameChapter, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ValueTask<List<AchievementGoal>> GetAchievementGoalListAsync(this IMetadataService metadataService, CancellationToken token = default)
|
public static ValueTask<List<AchievementGoal>> GetAchievementGoalListAsync(this IMetadataService metadataService, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
return metadataService.FromCacheOrFileAsync<List<AchievementGoal>>(FileNameAchievementGoal, token);
|
return metadataService.FromCacheOrFileAsync<List<AchievementGoal>>(FileNameAchievementGoal, token);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<AppxBundle>Never</AppxBundle>
|
<AppxBundle>Never</AppxBundle>
|
||||||
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
|
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
|
||||||
<StartupObject>Snap.Hutao.Program</StartupObject>
|
<StartupObject>Snap.Hutao.Program</StartupObject>
|
||||||
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_MAIN;DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION;DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT;$(AlphaConstants)</DefineConstants>
|
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_MAIN;DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION;DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT</DefineConstants>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
@@ -323,8 +323,8 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Validation" Version="17.8.8" />
|
<PackageReference Include="Microsoft.VisualStudio.Validation" Version="17.8.8" />
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
|
||||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240428000" />
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240404000" />
|
||||||
<PackageReference Include="QRCoder" Version="1.5.1" />
|
<PackageReference Include="QRCoder" Version="1.4.3" />
|
||||||
<PackageReference Include="Snap.Discord.GameSDK" Version="1.6.0" />
|
<PackageReference Include="Snap.Discord.GameSDK" Version="1.6.0" />
|
||||||
<PackageReference Include="Snap.Hutao.Deployment.Runtime" Version="1.16.0">
|
<PackageReference Include="Snap.Hutao.Deployment.Runtime" Version="1.16.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
@@ -343,7 +343,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
|
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
|
||||||
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||||
<Manifest Include="$(ApplicationManifest)" />
|
<Manifest Include="$(ApplicationManifest)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
<NavigationView
|
<NavigationView
|
||||||
x:Name="NavView"
|
x:Name="NavView"
|
||||||
Margin="0,0,0,0"
|
Margin="-1,0,0,-1"
|
||||||
shch:NavigationViewHelper.PaneCornerRadius="0"
|
shch:NavigationViewHelper.PaneCornerRadius="0"
|
||||||
CompactPaneLength="48"
|
CompactPaneLength="48"
|
||||||
IsBackEnabled="{x:Bind ContentFrame.CanGoBack, Mode=OneWay}"
|
IsBackEnabled="{x:Bind ContentFrame.CanGoBack, Mode=OneWay}"
|
||||||
|
|||||||
@@ -41,11 +41,9 @@
|
|||||||
x:Name="ImageZoomBorder"
|
x:Name="ImageZoomBorder"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
cw:VisualExtensions.NormalizedCenterPoint="0.5">
|
cw:VisualExtensions.NormalizedCenterPoint="0.5">
|
||||||
<cww:ConstrainedBox
|
<cww:ConstrainedBox AspectRatio="1080:390" CornerRadius="{ThemeResource ControlCornerRadiusTop}">
|
||||||
Margin="-4"
|
|
||||||
AspectRatio="1080:390"
|
|
||||||
CornerRadius="{ThemeResource ControlCornerRadiusTop}">
|
|
||||||
<shci:CachedImage
|
<shci:CachedImage
|
||||||
|
Margin="-1"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
PlaceholderMargin="16"
|
PlaceholderMargin="16"
|
||||||
PlaceholderSource="{StaticResource UI_EmotionIcon271}"
|
PlaceholderSource="{StaticResource UI_EmotionIcon271}"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:cw="using:CommunityToolkit.WinUI"
|
xmlns:cw="using:CommunityToolkit.WinUI"
|
||||||
xmlns:cwcont="using:CommunityToolkit.WinUI.Controls"
|
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||||
xmlns:cwconv="using:CommunityToolkit.WinUI.Converters"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||||
@@ -13,7 +12,6 @@
|
|||||||
xmlns:shch="using:Snap.Hutao.Control.Helper"
|
xmlns:shch="using:Snap.Hutao.Control.Helper"
|
||||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||||
xmlns:shme="using:Snap.Hutao.Model.Entity"
|
|
||||||
xmlns:shvc="using:Snap.Hutao.View.Control"
|
xmlns:shvc="using:Snap.Hutao.View.Control"
|
||||||
xmlns:shvcp="using:Snap.Hutao.View.Card.Primitive"
|
xmlns:shvcp="using:Snap.Hutao.View.Card.Primitive"
|
||||||
xmlns:shvd="using:Snap.Hutao.ViewModel.DailyNote"
|
xmlns:shvd="using:Snap.Hutao.ViewModel.DailyNote"
|
||||||
@@ -28,16 +26,6 @@
|
|||||||
<Page.Resources>
|
<Page.Resources>
|
||||||
<shc:BindingProxy x:Key="ViewModelBindingProxy" DataContext="{Binding}"/>
|
<shc:BindingProxy x:Key="ViewModelBindingProxy" DataContext="{Binding}"/>
|
||||||
|
|
||||||
<cwconv:BoolToObjectConverter
|
|
||||||
x:Name="DailyTaskIconConverter"
|
|
||||||
FalseValue="{StaticResource UI_MarkQuest_Events_Start}"
|
|
||||||
TrueValue="{StaticResource UI_MarkQuest_Events_Proce}"/>
|
|
||||||
|
|
||||||
<cwconv:BoolToObjectConverter
|
|
||||||
x:Name="ArchonQuestIconConverter"
|
|
||||||
FalseValue="{StaticResource UI_MarkQuest_Main_Start}"
|
|
||||||
TrueValue="{StaticResource UI_MarkQuest_Main_Proce}"/>
|
|
||||||
|
|
||||||
<DataTemplate x:Key="UserAndUidTemplate">
|
<DataTemplate x:Key="UserAndUidTemplate">
|
||||||
<Grid Padding="0,0,0,16">
|
<Grid Padding="0,0,0,16">
|
||||||
<TextBlock VerticalAlignment="Center" Text="{Binding Uid}"/>
|
<TextBlock VerticalAlignment="Center" Text="{Binding Uid}"/>
|
||||||
@@ -55,7 +43,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate x:Key="DailyNoteEntryTemplate" x:DataType="shme:DailyNoteEntry">
|
<DataTemplate x:Key="DailyNoteEntryTemplate">
|
||||||
<ItemContainer cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<ItemContainer cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
||||||
<ItemContainer.Resources>
|
<ItemContainer.Resources>
|
||||||
<SolidColorBrush x:Key="ItemContainerPointerOverBackground" Color="Transparent"/>
|
<SolidColorBrush x:Key="ItemContainerPointerOverBackground" Color="Transparent"/>
|
||||||
@@ -120,43 +108,6 @@
|
|||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="0,8,0,0"
|
Margin="0,8,0,0"
|
||||||
Spacing="6">
|
Spacing="6">
|
||||||
<Grid Style="{ThemeResource GridCardStyle}">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="auto"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ProgressBar
|
|
||||||
Grid.ColumnSpan="2"
|
|
||||||
Height="40"
|
|
||||||
MinHeight="48"
|
|
||||||
Background="{x:Null}"
|
|
||||||
CornerRadius="{ThemeResource ControlCornerRadius}"
|
|
||||||
Maximum="{Binding ArchonQuestView.Ids.Count, Mode=OneWay}"
|
|
||||||
Opacity="{StaticResource LargeBackgroundProgressBarOpacity}"
|
|
||||||
Value="{Binding ArchonQuestView.ProgressValue, Mode=OneWay}"/>
|
|
||||||
<shci:CachedImage
|
|
||||||
Grid.Column="0"
|
|
||||||
Margin="4"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
shch:FrameworkElementHelper.SquareLength="32"
|
|
||||||
Source="{Binding DailyNote.IsArchonQuestFinished, Converter={StaticResource ArchonQuestIconConverter}}"/>
|
|
||||||
<StackPanel
|
|
||||||
Grid.Column="1"
|
|
||||||
Margin="8,0,0,0"
|
|
||||||
VerticalAlignment="Center">
|
|
||||||
<TextBlock
|
|
||||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
|
||||||
Text="{Binding ArchonQuestView.ProgressFormatted, Mode=OneWay}"
|
|
||||||
TextTrimming="CharacterEllipsis"
|
|
||||||
TextWrapping="NoWrap"/>
|
|
||||||
<TextBlock
|
|
||||||
Opacity="0.6"
|
|
||||||
Style="{StaticResource CaptionTextBlockStyle}"
|
|
||||||
Text="{Binding ArchonQuestView.ChapterFormatted, Mode=OneWay}"
|
|
||||||
TextTrimming="CharacterEllipsis"
|
|
||||||
TextWrapping="NoWrap"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
<Grid Style="{ThemeResource GridCardStyle}">
|
<Grid Style="{ThemeResource GridCardStyle}">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="auto"/>
|
<ColumnDefinition Width="auto"/>
|
||||||
@@ -251,7 +202,7 @@
|
|||||||
Margin="4"
|
Margin="4"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
shch:FrameworkElementHelper.SquareLength="32"
|
shch:FrameworkElementHelper.SquareLength="32"
|
||||||
Source="{Binding DailyNote.DailyTask.IsExtraTaskRewardReceived, Converter={StaticResource DailyTaskIconConverter}}"/>
|
Source="{StaticResource UI_MarkQuest_Events_Proce}"/>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
@@ -382,7 +333,7 @@
|
|||||||
ItemsSource="{Binding DailyNote.Expeditions, Mode=OneWay}">
|
ItemsSource="{Binding DailyNote.Expeditions, Mode=OneWay}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<cwcont:UniformGrid
|
<cwc:UniformGrid
|
||||||
ColumnSpacing="8"
|
ColumnSpacing="8"
|
||||||
Columns="2"
|
Columns="2"
|
||||||
RowSpacing="8"/>
|
RowSpacing="8"/>
|
||||||
@@ -499,16 +450,16 @@
|
|||||||
<x:Double x:Key="SettingsCardWrapNoIconThreshold">0</x:Double>
|
<x:Double x:Key="SettingsCardWrapNoIconThreshold">0</x:Double>
|
||||||
</StackPanel.Resources>
|
</StackPanel.Resources>
|
||||||
|
|
||||||
<cwcont:HeaderedContentControl
|
<cwc:HeaderedContentControl
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
IsEnabled="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolNegationConverter}}">
|
IsEnabled="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolNegationConverter}}">
|
||||||
<cwcont:HeaderedContentControl.Header>
|
<cwc:HeaderedContentControl.Header>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="1,0,0,5"
|
Margin="1,0,0,5"
|
||||||
Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||||
Text="{shcm:ResourceString Name=ViewPageDailyNoteSettingRefreshHeader}"/>
|
Text="{shcm:ResourceString Name=ViewPageDailyNoteSettingRefreshHeader}"/>
|
||||||
</cwcont:HeaderedContentControl.Header>
|
</cwc:HeaderedContentControl.Header>
|
||||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||||
<InfoBar
|
<InfoBar
|
||||||
Title="{shcm:ResourceString Name=ViewPageDailyNoteSettingRefreshElevatedHint}"
|
Title="{shcm:ResourceString Name=ViewPageDailyNoteSettingRefreshElevatedHint}"
|
||||||
@@ -516,12 +467,12 @@
|
|||||||
IsOpen="True"
|
IsOpen="True"
|
||||||
Severity="Warning"
|
Severity="Warning"
|
||||||
Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||||
<cwcont:SettingsCard
|
<cwc:SettingsCard
|
||||||
Description="{shcm:ResourceString Name=ViewPageDailyNoteSettingAutoRefreshDescription}"
|
Description="{shcm:ResourceString Name=ViewPageDailyNoteSettingAutoRefreshDescription}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageDailyNoteSettingAutoRefresh}"
|
Header="{shcm:ResourceString Name=ViewPageDailyNoteSettingAutoRefresh}"
|
||||||
HeaderIcon="{shcm:FontIcon Glyph=}">
|
HeaderIcon="{shcm:FontIcon Glyph=}">
|
||||||
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsAutoRefreshEnabled, Mode=TwoWay}"/>
|
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsAutoRefreshEnabled, Mode=TwoWay}"/>
|
||||||
</cwcont:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
<RadioButtons
|
<RadioButtons
|
||||||
Margin="1,11,0,5"
|
Margin="1,11,0,5"
|
||||||
IsEnabled="{Binding DailyNoteOptions.IsAutoRefreshEnabled}"
|
IsEnabled="{Binding DailyNoteOptions.IsAutoRefreshEnabled}"
|
||||||
@@ -537,15 +488,15 @@
|
|||||||
</RadioButtons.ItemTemplate>
|
</RadioButtons.ItemTemplate>
|
||||||
</RadioButtons>
|
</RadioButtons>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</cwcont:HeaderedContentControl>
|
</cwc:HeaderedContentControl>
|
||||||
|
|
||||||
<cwcont:HeaderedContentControl
|
<cwc:HeaderedContentControl
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
IsEnabled="{Binding RuntimeOptions.IsToastAvailable}">
|
IsEnabled="{Binding RuntimeOptions.IsToastAvailable}">
|
||||||
<cwcont:HeaderedContentControl.Header>
|
<cwc:HeaderedContentControl.Header>
|
||||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageDailyNoteNotificationHeader}"/>
|
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageDailyNoteNotificationHeader}"/>
|
||||||
</cwcont:HeaderedContentControl.Header>
|
</cwc:HeaderedContentControl.Header>
|
||||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||||
<InfoBar
|
<InfoBar
|
||||||
Title="胡桃的通知权限已被关闭"
|
Title="胡桃的通知权限已被关闭"
|
||||||
@@ -553,23 +504,23 @@
|
|||||||
IsOpen="True"
|
IsOpen="True"
|
||||||
Severity="Warning"
|
Severity="Warning"
|
||||||
Visibility="{Binding RuntimeOptions.IsToastAvailable, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
|
Visibility="{Binding RuntimeOptions.IsToastAvailable, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
|
||||||
<cwcont:SettingsCard
|
<cwc:SettingsCard
|
||||||
Description="{shcm:ResourceString Name=ViewPageDailyNoteSlientModeDescription}"
|
Description="{shcm:ResourceString Name=ViewPageDailyNoteSlientModeDescription}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageDailyNoteSlientModeHeader}"
|
Header="{shcm:ResourceString Name=ViewPageDailyNoteSlientModeHeader}"
|
||||||
HeaderIcon="{shcm:FontIcon Glyph=}">
|
HeaderIcon="{shcm:FontIcon Glyph=}">
|
||||||
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsSilentWhenPlayingGame, Mode=TwoWay}"/>
|
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsSilentWhenPlayingGame, Mode=TwoWay}"/>
|
||||||
</cwcont:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
<cwcont:SettingsCard
|
<cwc:SettingsCard
|
||||||
Description="{shcm:ResourceString Name=ViewPageDailyNoteReminderDescription}"
|
Description="{shcm:ResourceString Name=ViewPageDailyNoteReminderDescription}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageDailyNoteReminderHeader}"
|
Header="{shcm:ResourceString Name=ViewPageDailyNoteReminderHeader}"
|
||||||
HeaderIcon="{shcm:FontIcon Glyph=}">
|
HeaderIcon="{shcm:FontIcon Glyph=}">
|
||||||
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsReminderNotification, Mode=TwoWay}"/>
|
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsReminderNotification, Mode=TwoWay}"/>
|
||||||
</cwcont:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</cwcont:HeaderedContentControl>
|
</cwc:HeaderedContentControl>
|
||||||
|
|
||||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageDailyNoteDataInteropHeader}"/>
|
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageDailyNoteDataInteropHeader}"/>
|
||||||
<cwcont:SettingsCard
|
<cwc:SettingsCard
|
||||||
Command="{Binding ConfigDailyNoteWebhookUrlCommand}"
|
Command="{Binding ConfigDailyNoteWebhookUrlCommand}"
|
||||||
Description="{shcm:ResourceString Name=ViewPageDailyNoteConfigWebhookDescription}"
|
Description="{shcm:ResourceString Name=ViewPageDailyNoteConfigWebhookDescription}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageDailyNoteConfigWebhookHeader}"
|
Header="{shcm:ResourceString Name=ViewPageDailyNoteConfigWebhookHeader}"
|
||||||
|
|||||||
@@ -98,13 +98,6 @@
|
|||||||
Style="{ThemeResource SettingButtonStyle}"/>
|
Style="{ThemeResource SettingButtonStyle}"/>
|
||||||
</cwc:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
|
|
||||||
<cwc:SettingsCard Header="Test Windows.Graphics.Capture">
|
|
||||||
<Button
|
|
||||||
Command="{Binding TestWindowsGraphicsCaptureCommand}"
|
|
||||||
Content="Test"
|
|
||||||
Style="{ThemeResource SettingButtonStyle}"/>
|
|
||||||
</cwc:SettingsCard>
|
|
||||||
|
|
||||||
<cwc:SettingsCard Header="Suppress Metadata Initialization">
|
<cwc:SettingsCard Header="Suppress Metadata Initialization">
|
||||||
<ToggleSwitch IsOn="{Binding SuppressMetadataInitialization, Mode=TwoWay}"/>
|
<ToggleSwitch IsOn="{Binding SuppressMetadataInitialization, Mode=TwoWay}"/>
|
||||||
</cwc:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ internal sealed class CultivateItemView : ObservableObject, IEntityWithMetadata<
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否为今日物品
|
/// 是否为今日物品
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsToday { get => Inner.IsTodaysItem(true); }
|
public bool IsToday { get => Inner.IsTodaysItem(); }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 星期中的日期
|
/// 星期中的日期
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Model.Intrinsic;
|
|
||||||
using Snap.Hutao.Model.Metadata;
|
|
||||||
using Snap.Hutao.Model.Primitive;
|
|
||||||
using Snap.Hutao.Web.Hoyolab.Takumi.GameRecord.DailyNote;
|
|
||||||
using WebDailyNote = Snap.Hutao.Web.Hoyolab.Takumi.GameRecord.DailyNote.DailyNote;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.ViewModel.DailyNote;
|
|
||||||
|
|
||||||
internal sealed class DailyNoteArchonQuestView
|
|
||||||
{
|
|
||||||
private readonly WebDailyNote? dailyNote;
|
|
||||||
|
|
||||||
private DailyNoteArchonQuestView(WebDailyNote? dailyNote, List<Chapter> chapters)
|
|
||||||
{
|
|
||||||
this.dailyNote = dailyNote;
|
|
||||||
Ids = chapters
|
|
||||||
.Where(chapter => chapter.QuestType is QuestType.AQ)
|
|
||||||
.Select(chapter => chapter.Id)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ChapterId> Ids { get; set; } = default!;
|
|
||||||
|
|
||||||
public int ProgressValue
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (TryGetFirstArchonQuest(out ArchonQuest? quest))
|
|
||||||
{
|
|
||||||
return Ids.IndexOf(quest.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ids.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ProgressFormatted
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (TryGetFirstArchonQuest(out ArchonQuest? quest))
|
|
||||||
{
|
|
||||||
return quest.Status.GetLocalizedDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
return SH.WebDailyNoteArchonQuestStatusFinished;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ChapterFormatted
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (TryGetFirstArchonQuest(out ArchonQuest? quest))
|
|
||||||
{
|
|
||||||
return $"{quest.ChapterNum} {quest.ChapterTitle}";
|
|
||||||
}
|
|
||||||
|
|
||||||
return SH.WebDailyNoteArchonQuestChapterFinished;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DailyNoteArchonQuestView Create(WebDailyNote? dailyNote, List<Chapter> chapters)
|
|
||||||
{
|
|
||||||
return new(dailyNote, chapters);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool TryGetFirstArchonQuest([NotNullWhen(true)] out ArchonQuest? archonQuest)
|
|
||||||
{
|
|
||||||
if (dailyNote is { ArchonQuestProgress.List: [{ } target, ..] })
|
|
||||||
{
|
|
||||||
archonQuest = target;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
archonQuest = default;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,6 @@ using Snap.Hutao.Core;
|
|||||||
using Snap.Hutao.Factory.ContentDialog;
|
using Snap.Hutao.Factory.ContentDialog;
|
||||||
using Snap.Hutao.Model.Entity;
|
using Snap.Hutao.Model.Entity;
|
||||||
using Snap.Hutao.Service.DailyNote;
|
using Snap.Hutao.Service.DailyNote;
|
||||||
using Snap.Hutao.Service.Metadata;
|
|
||||||
using Snap.Hutao.Service.Notification;
|
using Snap.Hutao.Service.Notification;
|
||||||
using Snap.Hutao.Service.User;
|
using Snap.Hutao.Service.User;
|
||||||
using Snap.Hutao.View.Control;
|
using Snap.Hutao.View.Control;
|
||||||
@@ -28,7 +27,6 @@ internal sealed partial class DailyNoteViewModel : Abstraction.ViewModel
|
|||||||
private readonly IContentDialogFactory contentDialogFactory;
|
private readonly IContentDialogFactory contentDialogFactory;
|
||||||
private readonly IDailyNoteService dailyNoteService;
|
private readonly IDailyNoteService dailyNoteService;
|
||||||
private readonly DailyNoteOptions dailyNoteOptions;
|
private readonly DailyNoteOptions dailyNoteOptions;
|
||||||
private readonly IMetadataService metadataService;
|
|
||||||
private readonly IInfoBarService infoBarService;
|
private readonly IInfoBarService infoBarService;
|
||||||
private readonly RuntimeOptions runtimeOptions;
|
private readonly RuntimeOptions runtimeOptions;
|
||||||
private readonly ITaskContext taskContext;
|
private readonly ITaskContext taskContext;
|
||||||
@@ -55,26 +53,22 @@ internal sealed partial class DailyNoteViewModel : Abstraction.ViewModel
|
|||||||
|
|
||||||
protected override async ValueTask<bool> InitializeUIAsync()
|
protected override async ValueTask<bool> InitializeUIAsync()
|
||||||
{
|
{
|
||||||
if (await metadataService.InitializeAsync().ConfigureAwait(false))
|
try
|
||||||
{
|
{
|
||||||
try
|
await taskContext.SwitchToBackgroundAsync();
|
||||||
{
|
ObservableCollection<UserAndUid> roles = await userService.GetRoleCollectionAsync().ConfigureAwait(false);
|
||||||
await taskContext.SwitchToBackgroundAsync();
|
ObservableCollection<DailyNoteEntry> entries = await dailyNoteService.GetDailyNoteEntryCollectionAsync().ConfigureAwait(false);
|
||||||
ObservableCollection<UserAndUid> roles = await userService.GetRoleCollectionAsync().ConfigureAwait(false);
|
|
||||||
ObservableCollection<DailyNoteEntry> entries = await dailyNoteService.GetDailyNoteEntryCollectionAsync().ConfigureAwait(false);
|
|
||||||
|
|
||||||
await taskContext.SwitchToMainThreadAsync();
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
UserAndUids = roles;
|
UserAndUids = roles;
|
||||||
DailyNoteEntries = entries;
|
DailyNoteEntries = entries;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Core.ExceptionService.UserdataCorruptedException ex)
|
catch (Core.ExceptionService.UserdataCorruptedException ex)
|
||||||
{
|
{
|
||||||
infoBarService.Error(ex);
|
infoBarService.Error(ex);
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("TrackRoleCommand")]
|
[Command("TrackRoleCommand")]
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using Snap.Hutao.Model.Entity;
|
using Snap.Hutao.Model.Entity;
|
||||||
using Snap.Hutao.Service.DailyNote;
|
using Snap.Hutao.Service.DailyNote;
|
||||||
using Snap.Hutao.Service.Metadata;
|
|
||||||
using Snap.Hutao.Service.Notification;
|
using Snap.Hutao.Service.Notification;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ internal sealed partial class DailyNoteViewModelSlim : Abstraction.ViewModelSlim
|
|||||||
{
|
{
|
||||||
private readonly ITaskContext taskContext;
|
private readonly ITaskContext taskContext;
|
||||||
private readonly IInfoBarService infoBarService;
|
private readonly IInfoBarService infoBarService;
|
||||||
private readonly IMetadataService metadataService;
|
|
||||||
private readonly IDailyNoteService dailyNoteService;
|
private readonly IDailyNoteService dailyNoteService;
|
||||||
|
|
||||||
private List<DailyNoteEntry>? dailyNoteEntries;
|
private List<DailyNoteEntry>? dailyNoteEntries;
|
||||||
@@ -31,28 +29,25 @@ internal sealed partial class DailyNoteViewModelSlim : Abstraction.ViewModelSlim
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
protected override async Task OpenUIAsync()
|
protected override async Task OpenUIAsync()
|
||||||
{
|
{
|
||||||
if (await metadataService.InitializeAsync().ConfigureAwait(false))
|
try
|
||||||
{
|
{
|
||||||
try
|
await taskContext.SwitchToBackgroundAsync();
|
||||||
{
|
ObservableCollection<DailyNoteEntry> entries = await dailyNoteService
|
||||||
await taskContext.SwitchToBackgroundAsync();
|
.GetDailyNoteEntryCollectionAsync()
|
||||||
ObservableCollection<DailyNoteEntry> entries = await dailyNoteService
|
.ConfigureAwait(false);
|
||||||
.GetDailyNoteEntryCollectionAsync()
|
|
||||||
.ConfigureAwait(false);
|
|
||||||
|
|
||||||
// 此处使用浅拷贝的列表以避免当导航到实时便笺页面后
|
// 此处使用浅拷贝的列表以避免当导航到实时便笺页面后
|
||||||
// 由于主页尚未卸载,添加或删除便笺可能会崩溃的问题
|
// 由于主页尚未卸载,添加或删除便笺可能会崩溃的问题
|
||||||
List<DailyNoteEntry> entryList = [.. entries];
|
List<DailyNoteEntry> entryList = [.. entries];
|
||||||
|
|
||||||
await taskContext.SwitchToMainThreadAsync();
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
DailyNoteEntries = entryList;
|
DailyNoteEntries = entryList;
|
||||||
IsInitialized = true;
|
IsInitialized = true;
|
||||||
}
|
}
|
||||||
catch (Core.ExceptionService.UserdataCorruptedException ex)
|
catch (Core.ExceptionService.UserdataCorruptedException ex)
|
||||||
{
|
{
|
||||||
infoBarService.Error(ex);
|
infoBarService.Error(ex);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,57 +65,41 @@ internal sealed class DownloadSummary : ObservableObject
|
|||||||
ILogger<DownloadSummary> logger = serviceProvider.GetRequiredService<ILogger<DownloadSummary>>();
|
ILogger<DownloadSummary> logger = serviceProvider.GetRequiredService<ILogger<DownloadSummary>>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int retryTimes = 0;
|
HttpRequestMessage message = httpRequestMessageBuilderFactory
|
||||||
while (retryTimes++ < 3)
|
.Create()
|
||||||
|
.SetRequestUri(fileUrl)
|
||||||
|
.SetStaticResourceControlHeaders()
|
||||||
|
.Get()
|
||||||
|
.HttpRequestMessage;
|
||||||
|
|
||||||
|
using (message)
|
||||||
{
|
{
|
||||||
HttpRequestMessage message = httpRequestMessageBuilderFactory
|
using (HttpResponseMessage response = await httpClient.SendAsync(message, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false))
|
||||||
.Create()
|
|
||||||
.SetRequestUri(fileUrl)
|
|
||||||
.SetStaticResourceControlHeaders()
|
|
||||||
.Get()
|
|
||||||
.HttpRequestMessage;
|
|
||||||
|
|
||||||
TimeSpan delay = default;
|
|
||||||
|
|
||||||
using (message)
|
|
||||||
{
|
{
|
||||||
using (HttpResponseMessage response = await httpClient.SendAsync(message, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false))
|
if (!AllowedMediaTypes.Contains(response.Content.Headers.ContentType?.MediaType))
|
||||||
{
|
{
|
||||||
if (!AllowedMediaTypes.Contains(response.Content.Headers.ContentType?.MediaType))
|
logger.LogWarning("Download Static Zip failed, Content-Type is {Type}", response.Content.Headers.ContentType);
|
||||||
{
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
logger.LogWarning("Download Static Zip failed, Content-Type is {Type}", response.Content.Headers.ContentType);
|
Description = SH.ViewModelWelcomeDownloadSummaryContentTypeNotMatch;
|
||||||
await taskContext.SwitchToMainThreadAsync();
|
return false;
|
||||||
Description = SH.ViewModelWelcomeDownloadSummaryContentTypeNotMatch;
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
long contentLength = response.Content.Headers.ContentLength ?? 0;
|
|
||||||
logger.LogInformation("Begin download, size: {length}", Converters.ToFileSizeString(contentLength));
|
|
||||||
using (Stream content = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
using (TempFileStream temp = new(FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
|
||||||
{
|
|
||||||
await new StreamCopyWorker(content, temp, contentLength).CopyAsync(progress).ConfigureAwait(false);
|
|
||||||
ExtractFiles(temp);
|
|
||||||
await taskContext.SwitchToMainThreadAsync();
|
|
||||||
ProgressValue = 1;
|
|
||||||
Description = SH.ViewModelWelcomeDownloadSummaryComplete;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.Headers.RetryAfter?.Delta is { } retryAfter)
|
long contentLength = response.Content.Headers.ContentLength ?? 0;
|
||||||
|
logger.LogInformation("Begin download, size: {length}", Converters.ToFileSizeString(contentLength));
|
||||||
|
using (Stream content = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
using (TempFileStream temp = new(FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||||
{
|
{
|
||||||
delay = retryAfter;
|
await new StreamCopyWorker(content, temp, contentLength).CopyAsync(progress).ConfigureAwait(false);
|
||||||
|
ExtractFiles(temp);
|
||||||
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
|
ProgressValue = 1;
|
||||||
|
Description = SH.ViewModelWelcomeDownloadSummaryComplete;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.Delay(delay).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ internal static class StaticResource
|
|||||||
{ "IconElement", 0 },
|
{ "IconElement", 0 },
|
||||||
{ "ItemIcon", 0 },
|
{ "ItemIcon", 0 },
|
||||||
{ "LoadingPic", 0 },
|
{ "LoadingPic", 0 },
|
||||||
{ "Mark", 0 },
|
|
||||||
{ "MonsterIcon", 0 },
|
{ "MonsterIcon", 0 },
|
||||||
{ "MonsterSmallIcon", 0 },
|
{ "MonsterSmallIcon", 0 },
|
||||||
{ "NameCardIcon", 0 },
|
{ "NameCardIcon", 0 },
|
||||||
@@ -63,7 +62,6 @@ internal static class StaticResource
|
|||||||
{ "IconElement", 3 },
|
{ "IconElement", 3 },
|
||||||
{ "ItemIcon", 4 },
|
{ "ItemIcon", 4 },
|
||||||
{ "LoadingPic", 2 },
|
{ "LoadingPic", 2 },
|
||||||
{ "Mark", 0 },
|
|
||||||
{ "MonsterIcon", 3 },
|
{ "MonsterIcon", 3 },
|
||||||
{ "MonsterSmallIcon", 2 },
|
{ "MonsterSmallIcon", 2 },
|
||||||
{ "NameCardIcon", 3 },
|
{ "NameCardIcon", 3 },
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ internal static class StaticResourceHttpHeaderBuilderExtension
|
|||||||
where TBuilder : IHttpHeadersBuilder<HttpHeaders>
|
where TBuilder : IHttpHeadersBuilder<HttpHeaders>
|
||||||
{
|
{
|
||||||
return builder
|
return builder
|
||||||
.SetHeader("x-hutao-quality", $"{UnsafeLocalSetting.Get(SettingKeys.StaticResourceImageQuality, StaticResourceQuality.Raw)}")
|
.SetHeader("x-quality", $"{UnsafeLocalSetting.Get(SettingKeys.StaticResourceImageQuality, StaticResourceQuality.Raw)}")
|
||||||
.SetHeader("x-hutao-archive", $"{UnsafeLocalSetting.Get(SettingKeys.StaticResourceImageArchive, StaticResourceArchive.Full)}");
|
.SetHeader("x-archive", $"{UnsafeLocalSetting.Get(SettingKeys.StaticResourceImageArchive, StaticResourceArchive.Full)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TBuilder SetStaticResourceControlHeadersIf<TBuilder>(this TBuilder builder, bool condition)
|
public static TBuilder SetStaticResourceControlHeadersIf<TBuilder>(this TBuilder builder, bool condition)
|
||||||
|
|||||||
@@ -2,33 +2,11 @@
|
|||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Snap.Hutao.Core;
|
|
||||||
using Snap.Hutao.Core.Caching;
|
using Snap.Hutao.Core.Caching;
|
||||||
using Snap.Hutao.Core.LifeCycle;
|
|
||||||
using Snap.Hutao.Core.Setting;
|
using Snap.Hutao.Core.Setting;
|
||||||
using Snap.Hutao.Service.Notification;
|
using Snap.Hutao.Service.Notification;
|
||||||
using Snap.Hutao.ViewModel.Guide;
|
using Snap.Hutao.ViewModel.Guide;
|
||||||
using Snap.Hutao.Web.Hutao.HutaoAsAService;
|
using Snap.Hutao.Web.Hutao.HutaoAsAService;
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Direct3D;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi.Common;
|
|
||||||
using Snap.Hutao.Win32.System.Com;
|
|
||||||
using Snap.Hutao.Win32.System.WinRT;
|
|
||||||
using Snap.Hutao.Win32.System.WinRT.Graphics.Capture;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using Windows.Foundation;
|
|
||||||
using Windows.Graphics.Capture;
|
|
||||||
using Windows.Graphics.DirectX;
|
|
||||||
using Windows.Graphics.DirectX.Direct3D11;
|
|
||||||
using Windows.Graphics.Imaging;
|
|
||||||
using Windows.Storage.Streams;
|
|
||||||
using WinRT;
|
|
||||||
using static Snap.Hutao.Win32.ConstValues;
|
|
||||||
using static Snap.Hutao.Win32.D3D11;
|
|
||||||
using static Snap.Hutao.Win32.Macros;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.ViewModel;
|
namespace Snap.Hutao.ViewModel;
|
||||||
|
|
||||||
@@ -41,7 +19,6 @@ namespace Snap.Hutao.ViewModel;
|
|||||||
internal sealed partial class TestViewModel : Abstraction.ViewModel
|
internal sealed partial class TestViewModel : Abstraction.ViewModel
|
||||||
{
|
{
|
||||||
private readonly HutaoAsAServiceClient homaAsAServiceClient;
|
private readonly HutaoAsAServiceClient homaAsAServiceClient;
|
||||||
private readonly IServiceProvider serviceProvider;
|
|
||||||
private readonly IInfoBarService infoBarService;
|
private readonly IInfoBarService infoBarService;
|
||||||
private readonly ILogger<TestViewModel> logger;
|
private readonly ILogger<TestViewModel> logger;
|
||||||
private readonly IMemoryCache memoryCache;
|
private readonly IMemoryCache memoryCache;
|
||||||
@@ -159,156 +136,4 @@ internal sealed partial class TestViewModel : Abstraction.ViewModel
|
|||||||
logger.LogInformation("Failed ImageCache download tasks: [{Tasks}]", set?.ToString(','));
|
logger.LogInformation("Failed ImageCache download tasks: [{Tasks}]", set?.ToString(','));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("TestWindowsGraphicsCaptureCommand")]
|
|
||||||
private unsafe void TestWindowsGraphicsCapture()
|
|
||||||
{
|
|
||||||
// https://github.com/obsproject/obs-studio/blob/master/libobs-winrt/winrt-capture.cpp
|
|
||||||
if (!Core.UniversalApiContract.IsPresent(WindowsVersion.Windows10Version1903))
|
|
||||||
{
|
|
||||||
logger.LogWarning("Windows 10 Version 1903 or later is required for Windows.Graphics.Capture API.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GraphicsCaptureSession.IsSupported())
|
|
||||||
{
|
|
||||||
logger.LogWarning("GraphicsCaptureSession is not supported.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D11_CREATE_DEVICE_FLAG flag = D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_DEBUG;
|
|
||||||
|
|
||||||
if (SUCCEEDED(D3D11CreateDevice(default, D3D_DRIVER_TYPE.D3D_DRIVER_TYPE_HARDWARE, default, flag, [], D3D11_SDK_VERSION, out ID3D11Device* pD3D11Device, out _, out _)))
|
|
||||||
{
|
|
||||||
if (SUCCEEDED(IUnknownMarshal.QueryInterface(pD3D11Device, in IDXGIDevice.IID, out IDXGIDevice* pDXGIDevice)))
|
|
||||||
{
|
|
||||||
if (SUCCEEDED(CreateDirect3D11DeviceFromDXGIDevice(pDXGIDevice, out Win32.System.WinRT.IInspectable* inspectable)))
|
|
||||||
{
|
|
||||||
IDirect3DDevice direct3DDevice = WinRT.IInspectable.FromAbi((nint)inspectable).ObjRef.AsInterface<IDirect3DDevice>();
|
|
||||||
|
|
||||||
HWND hwnd = serviceProvider.GetRequiredService<ICurrentWindowReference>().GetWindowHandle();
|
|
||||||
GraphicsCaptureItem.As<IGraphicsCaptureItemInterop>().CreateForWindow(hwnd, out GraphicsCaptureItem item);
|
|
||||||
|
|
||||||
using (Direct3D11CaptureFramePool framePool = Direct3D11CaptureFramePool.CreateFreeThreaded(direct3DDevice, DirectXPixelFormat.B8G8R8A8UIntNormalized, 2, item.Size))
|
|
||||||
{
|
|
||||||
framePool.FrameArrived += (pool, _) =>
|
|
||||||
{
|
|
||||||
using (Direct3D11CaptureFrame frame = pool.TryGetNextFrame())
|
|
||||||
{
|
|
||||||
if (frame is not null)
|
|
||||||
{
|
|
||||||
logger.LogInformation("Content Size: {Width} x {Height}", frame.ContentSize.Width, frame.ContentSize.Height);
|
|
||||||
|
|
||||||
IDirect3DDxgiInterfaceAccess access = frame.Surface.As<IDirect3DDxgiInterfaceAccess>();
|
|
||||||
if (FAILED(access.GetInterface(in IDXGISurface.IID, out IDXGISurface* pDXGISurface)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(pDXGISurface->GetDesc(out DXGI_SURFACE_DESC surfaceDesc)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D11_TEXTURE2D_DESC texture2DDesc = default;
|
|
||||||
texture2DDesc.Width = surfaceDesc.Width;
|
|
||||||
texture2DDesc.Height = surfaceDesc.Height;
|
|
||||||
texture2DDesc.ArraySize = 1;
|
|
||||||
texture2DDesc.CPUAccessFlags = D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_READ;
|
|
||||||
texture2DDesc.Format = DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM;
|
|
||||||
texture2DDesc.MipLevels = 1;
|
|
||||||
texture2DDesc.SampleDesc.Count = 1;
|
|
||||||
texture2DDesc.Usage = D3D11_USAGE.D3D11_USAGE_STAGING;
|
|
||||||
|
|
||||||
if (FAILED(pDXGISurface->GetDevice(in ID3D11Device.IID, out ID3D11Device* pD3D11Device)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(pD3D11Device->CreateTexture2D(ref texture2DDesc, ref Unsafe.NullRef<D3D11_SUBRESOURCE_DATA>(), out ID3D11Texture2D* pTexture2D)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(access.GetInterface(in ID3D11Resource.IID, out ID3D11Resource* pD3D11Resource)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pD3D11Device->GetImmediateContext(out ID3D11DeviceContext* pDeviceContext);
|
|
||||||
pDeviceContext->CopyResource((ID3D11Resource*)pTexture2D, pD3D11Resource);
|
|
||||||
|
|
||||||
if (FAILED(pDeviceContext->Map((ID3D11Resource*)pTexture2D, 0, D3D11_MAP.D3D11_MAP_READ, 0, out D3D11_MAPPED_SUBRESOURCE mappedSubresource)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int size = (int)(mappedSubresource.RowPitch * texture2DDesc.Height * 4);
|
|
||||||
|
|
||||||
SoftwareBitmap softwareBitmap = new(BitmapPixelFormat.Bgra8, (int)texture2DDesc.Width, (int)texture2DDesc.Height, BitmapAlphaMode.Premultiplied);
|
|
||||||
using (BitmapBuffer bitmapBuffer = softwareBitmap.LockBuffer(BitmapBufferAccessMode.Write))
|
|
||||||
{
|
|
||||||
using (IMemoryBufferReference reference = bitmapBuffer.CreateReference())
|
|
||||||
{
|
|
||||||
reference.As<IMemoryBufferByteAccess>().GetBuffer(out Span<byte> bufferSpan);
|
|
||||||
fixed (byte* p = bufferSpan)
|
|
||||||
{
|
|
||||||
for (uint i = 0; i < texture2DDesc.Height; i++)
|
|
||||||
{
|
|
||||||
System.Buffer.MemoryCopy(((byte*)mappedSubresource.pData) + (i * mappedSubresource.RowPitch), p + (i * texture2DDesc.Width * 4), texture2DDesc.Width * 4, texture2DDesc.Width * 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
using (InMemoryRandomAccessStream stream = new())
|
|
||||||
{
|
|
||||||
BitmapEncoder encoder = BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream).AsTask().Result;
|
|
||||||
encoder.SetSoftwareBitmap(softwareBitmap);
|
|
||||||
encoder.FlushAsync().AsTask().Wait();
|
|
||||||
|
|
||||||
using (FileStream fileStream = new("D:\\test.png", FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
|
|
||||||
{
|
|
||||||
stream.AsStream().CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = 1;
|
|
||||||
|
|
||||||
pDeviceContext->Unmap((ID3D11Resource*)pTexture2D, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger.LogInformation("Null Frame");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
using (GraphicsCaptureSession captureSession = framePool.CreateCaptureSession(item))
|
|
||||||
{
|
|
||||||
captureSession.IsCursorCaptureEnabled = false;
|
|
||||||
captureSession.IsBorderRequired = false;
|
|
||||||
captureSession.StartCapture();
|
|
||||||
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger.LogWarning("CreateDirect3D11DeviceFromDXGIDevice failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
IUnknownMarshal.Release(pDXGIDevice);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger.LogWarning("ID3D11Device As IDXGIDevice failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger.LogWarning("D3D11CreateDevice failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using Snap.Hutao.Core.IO.Hashing;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Web.Hoyolab.DataSigning;
|
namespace Snap.Hutao.Web.Hoyolab.DataSigning;
|
||||||
|
|
||||||
internal static class DataSignAlgorithm
|
internal static class DataSignAlgorithm
|
||||||
@@ -21,7 +19,7 @@ internal static class DataSignAlgorithm
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable CA1308
|
#pragma warning disable CA1308
|
||||||
string check = Hash.MD5HexString(dsContent).ToLowerInvariant();
|
string check = Core.Convert.ToMd5HexString(dsContent).ToLowerInvariant();
|
||||||
#pragma warning restore CA1308
|
#pragma warning restore CA1308
|
||||||
|
|
||||||
return $"{t},{r},{check}";
|
return $"{t},{r},{check}";
|
||||||
|
|||||||
@@ -132,10 +132,4 @@ internal sealed class DailyNote : DailyNoteCommon
|
|||||||
|
|
||||||
[JsonPropertyName("archon_quest_progress")]
|
[JsonPropertyName("archon_quest_progress")]
|
||||||
public ArchonQuestProgress ArchonQuestProgress { get; set; } = default!;
|
public ArchonQuestProgress ArchonQuestProgress { get; set; } = default!;
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool IsArchonQuestFinished
|
|
||||||
{
|
|
||||||
get => ArchonQuestProgress.List.Count == 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ internal sealed partial class HutaoInfrastructureClient
|
|||||||
{
|
{
|
||||||
HttpRequestMessageBuilder builder = httpRequestMessageBuilderFactory.Create()
|
HttpRequestMessageBuilder builder = httpRequestMessageBuilderFactory.Create()
|
||||||
.SetRequestUri(HutaoEndpoints.PatchSnapHutao)
|
.SetRequestUri(HutaoEndpoints.PatchSnapHutao)
|
||||||
.SetHeader("x-hutao-device-id", runtimeOptions.DeviceId)
|
.SetHeader("x-device-id", runtimeOptions.DeviceId)
|
||||||
.Get();
|
.Get();
|
||||||
|
|
||||||
HutaoResponse<HutaoVersionInformation>? resp = await builder.TryCatchSendAsync<HutaoResponse<HutaoVersionInformation>>(httpClient, logger, token).ConfigureAwait(false);
|
HutaoResponse<HutaoVersionInformation>? resp = await builder.TryCatchSendAsync<HutaoResponse<HutaoVersionInformation>>(httpClient, logger, token).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ namespace Snap.Hutao.Win32;
|
|||||||
[SuppressMessage("", "SA1310")]
|
[SuppressMessage("", "SA1310")]
|
||||||
internal static class ConstValues
|
internal static class ConstValues
|
||||||
{
|
{
|
||||||
public const uint D3D11_SDK_VERSION = 0x00000007U;
|
|
||||||
public const uint WM_NULL = 0x00000000U;
|
public const uint WM_NULL = 0x00000000U;
|
||||||
public const uint WM_ERASEBKGND = 0x00000014U;
|
public const uint WM_ERASEBKGND = 0x00000014U;
|
||||||
public const uint WM_GETMINMAXINFO = 0x00000024U;
|
public const uint WM_GETMINMAXINFO = 0x00000024U;
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Direct3D;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi;
|
|
||||||
using Snap.Hutao.Win32.System.WinRT;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32;
|
|
||||||
|
|
||||||
[SuppressMessage("", "SA1313")]
|
|
||||||
[SuppressMessage("", "SYSLIB1054")]
|
|
||||||
internal static class D3D11
|
|
||||||
{
|
|
||||||
[DllImport("d3d11.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
|
||||||
public static unsafe extern HRESULT CreateDirect3D11DeviceFromDXGIDevice(IDXGIDevice* dxgiDevice, IInspectable** graphicsDevice);
|
|
||||||
|
|
||||||
[DebuggerStepThrough]
|
|
||||||
public static unsafe HRESULT CreateDirect3D11DeviceFromDXGIDevice(IDXGIDevice* dxgiDevice, out IInspectable* graphicsDevice)
|
|
||||||
{
|
|
||||||
fixed (IInspectable** pGraphicsDevice = &graphicsDevice)
|
|
||||||
{
|
|
||||||
return CreateDirect3D11DeviceFromDXGIDevice(dxgiDevice, pGraphicsDevice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("d3d11.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
|
||||||
public static unsafe extern HRESULT D3D11CreateDevice([AllowNull] IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, D3D11_CREATE_DEVICE_FLAG Flags, [AllowNull] D3D_FEATURE_LEVEL* pFeatureLevels, uint FeatureLevels, uint SDKVersion, [MaybeNull] ID3D11Device** ppDevice, [MaybeNull] D3D_FEATURE_LEVEL* pFeatureLevel, [MaybeNull] ID3D11DeviceContext** ppImmediateContext);
|
|
||||||
|
|
||||||
public static unsafe HRESULT D3D11CreateDevice([AllowNull] IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, D3D11_CREATE_DEVICE_FLAG Flags, [AllowNull] ReadOnlySpan<D3D_FEATURE_LEVEL> featureLevels, uint SDKVersion, out ID3D11Device* pDevice, out D3D_FEATURE_LEVEL featureLevel, out ID3D11DeviceContext* pImmediateContext)
|
|
||||||
{
|
|
||||||
fixed (ID3D11Device** ppDevice = &pDevice)
|
|
||||||
{
|
|
||||||
fixed (D3D_FEATURE_LEVEL* pFeatureLevels = featureLevels)
|
|
||||||
{
|
|
||||||
fixed (D3D_FEATURE_LEVEL* pFeatureLevel = &featureLevel)
|
|
||||||
{
|
|
||||||
fixed (ID3D11DeviceContext** ppImmediateContext = &pImmediateContext)
|
|
||||||
{
|
|
||||||
return D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, (uint)featureLevels.Length, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,17 +15,12 @@ internal readonly partial struct HRESULT
|
|||||||
public static unsafe implicit operator int(HRESULT value) => *(int*)&value;
|
public static unsafe implicit operator int(HRESULT value) => *(int*)&value;
|
||||||
|
|
||||||
public static unsafe implicit operator HRESULT(int value) => *(HRESULT*)&value;
|
public static unsafe implicit operator HRESULT(int value) => *(HRESULT*)&value;
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return $"0x{Value:X8}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
[DebuggerDisplay("{DebuggerDisplay}")]
|
[DebuggerDisplay("{DebuggerDisplay}")]
|
||||||
internal readonly partial struct HRESULT
|
internal readonly partial struct HRESULT
|
||||||
{
|
{
|
||||||
private string DebuggerDisplay { get => ToString(); }
|
private string DebuggerDisplay => $"0x{Value:X8}";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -9,7 +9,7 @@ internal readonly struct HWND
|
|||||||
|
|
||||||
public HWND(nint value) => Value = value;
|
public HWND(nint value) => Value = value;
|
||||||
|
|
||||||
public static unsafe implicit operator HWND(nint value) => *(HWND*)&value;
|
public bool IsNull => Value is 0;
|
||||||
|
|
||||||
public static unsafe implicit operator nint(HWND value) => *(nint*)&value;
|
public static unsafe implicit operator HWND(nint value) => *(HWND*)&value;
|
||||||
}
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Foundation;
|
|
||||||
|
|
||||||
internal readonly struct LUID
|
|
||||||
{
|
|
||||||
public readonly uint LowPart;
|
|
||||||
public readonly int HighPart;
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Foundation;
|
|
||||||
|
|
||||||
internal readonly struct PCSTR
|
|
||||||
{
|
|
||||||
public readonly unsafe byte* Value;
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Foundation;
|
|
||||||
|
|
||||||
internal readonly struct PSTR
|
|
||||||
{
|
|
||||||
public readonly unsafe byte* Value;
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D;
|
|
||||||
|
|
||||||
internal enum D3D_DRIVER_TYPE
|
|
||||||
{
|
|
||||||
D3D_DRIVER_TYPE_UNKNOWN = 0,
|
|
||||||
D3D_DRIVER_TYPE_HARDWARE = 1,
|
|
||||||
D3D_DRIVER_TYPE_REFERENCE = 2,
|
|
||||||
D3D_DRIVER_TYPE_NULL = 3,
|
|
||||||
D3D_DRIVER_TYPE_SOFTWARE = 4,
|
|
||||||
D3D_DRIVER_TYPE_WARP = 5,
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D;
|
|
||||||
|
|
||||||
internal enum D3D_FEATURE_LEVEL
|
|
||||||
{
|
|
||||||
D3D_FEATURE_LEVEL_1_0_GENERIC = 0x100,
|
|
||||||
D3D_FEATURE_LEVEL_1_0_CORE = 0x1000,
|
|
||||||
D3D_FEATURE_LEVEL_9_1 = 0x9100,
|
|
||||||
D3D_FEATURE_LEVEL_9_2 = 0x9200,
|
|
||||||
D3D_FEATURE_LEVEL_9_3 = 0x9300,
|
|
||||||
D3D_FEATURE_LEVEL_10_0 = 0xA000,
|
|
||||||
D3D_FEATURE_LEVEL_10_1 = 0xA100,
|
|
||||||
D3D_FEATURE_LEVEL_11_0 = 0xB000,
|
|
||||||
D3D_FEATURE_LEVEL_11_1 = 0xB100,
|
|
||||||
D3D_FEATURE_LEVEL_12_0 = 0xC000,
|
|
||||||
D3D_FEATURE_LEVEL_12_1 = 0xC100,
|
|
||||||
D3D_FEATURE_LEVEL_12_2 = 0xC200,
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D;
|
|
||||||
|
|
||||||
internal enum D3D_PRIMITIVE_TOPOLOGY
|
|
||||||
{
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLEFAN = 6,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
|
|
||||||
D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_LINELIST = 2,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
|
|
||||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_LINELIST = 2,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D;
|
|
||||||
|
|
||||||
internal enum D3D_SRV_DIMENSION
|
|
||||||
{
|
|
||||||
D3D_SRV_DIMENSION_UNKNOWN = 0,
|
|
||||||
D3D_SRV_DIMENSION_BUFFER = 1,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE1D = 2,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE2D = 4,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE2DMS = 6,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURE3D = 8,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURECUBE = 9,
|
|
||||||
D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
|
|
||||||
D3D_SRV_DIMENSION_BUFFEREX = 11,
|
|
||||||
D3D10_SRV_DIMENSION_UNKNOWN = 0,
|
|
||||||
D3D10_SRV_DIMENSION_BUFFER = 1,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE1D = 2,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE1DARRAY = 3,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE2D = 4,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE2DARRAY = 5,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE2DMS = 6,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURE3D = 8,
|
|
||||||
D3D10_SRV_DIMENSION_TEXTURECUBE = 9,
|
|
||||||
D3D10_1_SRV_DIMENSION_UNKNOWN = 0,
|
|
||||||
D3D10_1_SRV_DIMENSION_BUFFER = 1,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE1D = 2,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = 3,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE2D = 4,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = 5,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE2DMS = 6,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURE3D = 8,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURECUBE = 9,
|
|
||||||
D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
|
|
||||||
D3D11_SRV_DIMENSION_UNKNOWN = 0,
|
|
||||||
D3D11_SRV_DIMENSION_BUFFER = 1,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE1D = 2,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE1DARRAY = 3,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE2D = 4,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE2DARRAY = 5,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE2DMS = 6,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURE3D = 8,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURECUBE = 9,
|
|
||||||
D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
|
|
||||||
D3D11_SRV_DIMENSION_BUFFEREX = 11,
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
internal enum D3D11_BIND_FLAG : uint
|
|
||||||
{
|
|
||||||
D3D11_BIND_VERTEX_BUFFER = 0x1,
|
|
||||||
D3D11_BIND_INDEX_BUFFER = 0x2,
|
|
||||||
D3D11_BIND_CONSTANT_BUFFER = 0x4,
|
|
||||||
D3D11_BIND_SHADER_RESOURCE = 0x8,
|
|
||||||
D3D11_BIND_STREAM_OUTPUT = 0x10,
|
|
||||||
D3D11_BIND_RENDER_TARGET = 0x20,
|
|
||||||
D3D11_BIND_DEPTH_STENCIL = 0x40,
|
|
||||||
D3D11_BIND_UNORDERED_ACCESS = 0x80,
|
|
||||||
D3D11_BIND_DECODER = 0x200,
|
|
||||||
D3D11_BIND_VIDEO_ENCODER = 0x400,
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_BLEND
|
|
||||||
{
|
|
||||||
D3D11_BLEND_ZERO = 1,
|
|
||||||
D3D11_BLEND_ONE = 2,
|
|
||||||
D3D11_BLEND_SRC_COLOR = 3,
|
|
||||||
D3D11_BLEND_INV_SRC_COLOR = 4,
|
|
||||||
D3D11_BLEND_SRC_ALPHA = 5,
|
|
||||||
D3D11_BLEND_INV_SRC_ALPHA = 6,
|
|
||||||
D3D11_BLEND_DEST_ALPHA = 7,
|
|
||||||
D3D11_BLEND_INV_DEST_ALPHA = 8,
|
|
||||||
D3D11_BLEND_DEST_COLOR = 9,
|
|
||||||
D3D11_BLEND_INV_DEST_COLOR = 10,
|
|
||||||
D3D11_BLEND_SRC_ALPHA_SAT = 11,
|
|
||||||
D3D11_BLEND_BLEND_FACTOR = 14,
|
|
||||||
D3D11_BLEND_INV_BLEND_FACTOR = 15,
|
|
||||||
D3D11_BLEND_SRC1_COLOR = 16,
|
|
||||||
D3D11_BLEND_INV_SRC1_COLOR = 17,
|
|
||||||
D3D11_BLEND_SRC1_ALPHA = 18,
|
|
||||||
D3D11_BLEND_INV_SRC1_ALPHA = 19,
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_BLEND_DESC
|
|
||||||
{
|
|
||||||
public BOOL AlphaToCoverageEnable;
|
|
||||||
public BOOL IndependentBlendEnable;
|
|
||||||
public D3D11_RENDER_TARGET_BLEND_DESC_8 RenderTarget;
|
|
||||||
|
|
||||||
[InlineArray(8)]
|
|
||||||
internal struct D3D11_RENDER_TARGET_BLEND_DESC_8
|
|
||||||
{
|
|
||||||
public D3D11_RENDER_TARGET_BLEND_DESC Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_BLEND_OP
|
|
||||||
{
|
|
||||||
D3D11_BLEND_OP_ADD = 1,
|
|
||||||
D3D11_BLEND_OP_SUBTRACT = 2,
|
|
||||||
D3D11_BLEND_OP_REV_SUBTRACT = 3,
|
|
||||||
D3D11_BLEND_OP_MIN = 4,
|
|
||||||
D3D11_BLEND_OP_MAX = 5,
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
public struct D3D11_BOX
|
|
||||||
{
|
|
||||||
public uint left;
|
|
||||||
public uint top;
|
|
||||||
public uint front;
|
|
||||||
public uint right;
|
|
||||||
public uint bottom;
|
|
||||||
public uint back;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_BUFFEREX_SRV
|
|
||||||
{
|
|
||||||
public uint FirstElement;
|
|
||||||
public uint NumElements;
|
|
||||||
public uint Flags;
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_BUFFER_DESC
|
|
||||||
{
|
|
||||||
public uint ByteWidth;
|
|
||||||
public D3D11_USAGE Usage;
|
|
||||||
public D3D11_BIND_FLAG BindFlags;
|
|
||||||
public D3D11_CPU_ACCESS_FLAG CPUAccessFlags;
|
|
||||||
public D3D11_RESOURCE_MISC_FLAG MiscFlags;
|
|
||||||
public uint StructureByteStride;
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_BUFFER_RTV
|
|
||||||
{
|
|
||||||
public Union1 Anonymous1;
|
|
||||||
public Union2 Anonymous2;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
|
||||||
internal struct Union1
|
|
||||||
{
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public uint FirstElement;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public uint ElementOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
|
||||||
internal struct Union2
|
|
||||||
{
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public uint NumElements;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public uint ElementWidth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_BUFFER_SRV
|
|
||||||
{
|
|
||||||
public Union1 Anonymous1;
|
|
||||||
public Union2 Anonymous2;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
|
||||||
internal struct Union1
|
|
||||||
{
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public uint FirstElement;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public uint ElementOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
|
||||||
internal struct Union2
|
|
||||||
{
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public uint NumElements;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public uint ElementWidth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_BUFFER_UAV
|
|
||||||
{
|
|
||||||
public uint FirstElement;
|
|
||||||
public uint NumElements;
|
|
||||||
public uint Flags;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_CLASS_INSTANCE_DESC
|
|
||||||
{
|
|
||||||
public uint InstanceId;
|
|
||||||
public uint InstanceIndex;
|
|
||||||
public uint TypeId;
|
|
||||||
public uint ConstantBuffer;
|
|
||||||
public uint BaseConstantBufferOffset;
|
|
||||||
public uint BaseTexture;
|
|
||||||
public uint BaseSampler;
|
|
||||||
public BOOL Created;
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_COMPARISON_FUNC
|
|
||||||
{
|
|
||||||
D3D11_COMPARISON_NEVER = 1,
|
|
||||||
D3D11_COMPARISON_LESS = 2,
|
|
||||||
D3D11_COMPARISON_EQUAL = 3,
|
|
||||||
D3D11_COMPARISON_LESS_EQUAL = 4,
|
|
||||||
D3D11_COMPARISON_GREATER = 5,
|
|
||||||
D3D11_COMPARISON_NOT_EQUAL = 6,
|
|
||||||
D3D11_COMPARISON_GREATER_EQUAL = 7,
|
|
||||||
D3D11_COMPARISON_ALWAYS = 8,
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_COUNTER
|
|
||||||
{
|
|
||||||
D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_COUNTER_DESC
|
|
||||||
{
|
|
||||||
public D3D11_COUNTER Counter;
|
|
||||||
public uint MiscFlags;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_COUNTER_INFO
|
|
||||||
{
|
|
||||||
public D3D11_COUNTER LastDeviceDependentCounter;
|
|
||||||
public uint NumSimultaneousCounters;
|
|
||||||
public byte NumDetectableParallelUnits;
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_COUNTER_TYPE
|
|
||||||
{
|
|
||||||
D3D11_COUNTER_TYPE_FLOAT32 = 0,
|
|
||||||
D3D11_COUNTER_TYPE_UINT16 = 1,
|
|
||||||
D3D11_COUNTER_TYPE_UINT32 = 2,
|
|
||||||
D3D11_COUNTER_TYPE_UINT64 = 3,
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
internal enum D3D11_CPU_ACCESS_FLAG : uint
|
|
||||||
{
|
|
||||||
D3D11_CPU_ACCESS_WRITE = 0x10000,
|
|
||||||
D3D11_CPU_ACCESS_READ = 0x20000,
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum D3D11_CREATE_DEVICE_FLAG : uint
|
|
||||||
{
|
|
||||||
D3D11_CREATE_DEVICE_SINGLETHREADED = 0x1U,
|
|
||||||
D3D11_CREATE_DEVICE_DEBUG = 0x2U,
|
|
||||||
D3D11_CREATE_DEVICE_SWITCH_TO_REF = 0x4U,
|
|
||||||
D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8U,
|
|
||||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20U,
|
|
||||||
D3D11_CREATE_DEVICE_DEBUGGABLE = 0x40U,
|
|
||||||
D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 0x80U,
|
|
||||||
D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT = 0x100U,
|
|
||||||
D3D11_CREATE_DEVICE_VIDEO_SUPPORT = 0x800U,
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_CULL_MODE
|
|
||||||
{
|
|
||||||
D3D11_CULL_NONE = 1,
|
|
||||||
D3D11_CULL_FRONT = 2,
|
|
||||||
D3D11_CULL_BACK = 3,
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_DEPTH_STENCILOP_DESC
|
|
||||||
{
|
|
||||||
public D3D11_STENCIL_OP StencilFailOp;
|
|
||||||
public D3D11_STENCIL_OP StencilDepthFailOp;
|
|
||||||
public D3D11_STENCIL_OP StencilPassOp;
|
|
||||||
public D3D11_COMPARISON_FUNC StencilFunc;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_DEPTH_STENCIL_DESC
|
|
||||||
{
|
|
||||||
public BOOL DepthEnable;
|
|
||||||
public D3D11_DEPTH_WRITE_MASK DepthWriteMask;
|
|
||||||
public D3D11_COMPARISON_FUNC DepthFunc;
|
|
||||||
public BOOL StencilEnable;
|
|
||||||
public byte StencilReadMask;
|
|
||||||
public byte StencilWriteMask;
|
|
||||||
public D3D11_DEPTH_STENCILOP_DESC FrontFace;
|
|
||||||
public D3D11_DEPTH_STENCILOP_DESC BackFace;
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi.Common;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_DEPTH_STENCIL_VIEW_DESC
|
|
||||||
{
|
|
||||||
public DXGI_FORMAT Format;
|
|
||||||
public D3D11_DSV_DIMENSION ViewDimension;
|
|
||||||
public uint Flags;
|
|
||||||
public Union Anonymous;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
|
||||||
public struct Union
|
|
||||||
{
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX1D_DSV Texture1D;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX1D_ARRAY_DSV Texture1DArray;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX2D_DSV Texture2D;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX2D_ARRAY_DSV Texture2DArray;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX2DMS_DSV Texture2DMS;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX2DMS_ARRAY_DSV Texture2DMSArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_DEPTH_WRITE_MASK
|
|
||||||
{
|
|
||||||
D3D11_DEPTH_WRITE_MASK_ZERO = 0,
|
|
||||||
D3D11_DEPTH_WRITE_MASK_ALL = 1,
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_DEVICE_CONTEXT_TYPE
|
|
||||||
{
|
|
||||||
D3D11_DEVICE_CONTEXT_IMMEDIATE = 0,
|
|
||||||
D3D11_DEVICE_CONTEXT_DEFERRED = 1,
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_DSV_DIMENSION
|
|
||||||
{
|
|
||||||
D3D11_DSV_DIMENSION_UNKNOWN = 0,
|
|
||||||
D3D11_DSV_DIMENSION_TEXTURE1D = 1,
|
|
||||||
D3D11_DSV_DIMENSION_TEXTURE1DARRAY = 2,
|
|
||||||
D3D11_DSV_DIMENSION_TEXTURE2D = 3,
|
|
||||||
D3D11_DSV_DIMENSION_TEXTURE2DARRAY = 4,
|
|
||||||
D3D11_DSV_DIMENSION_TEXTURE2DMS = 5,
|
|
||||||
D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY = 6,
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_FEATURE
|
|
||||||
{
|
|
||||||
D3D11_FEATURE_THREADING = 0,
|
|
||||||
D3D11_FEATURE_DOUBLES = 1,
|
|
||||||
D3D11_FEATURE_FORMAT_SUPPORT = 2,
|
|
||||||
D3D11_FEATURE_FORMAT_SUPPORT2 = 3,
|
|
||||||
D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = 4,
|
|
||||||
D3D11_FEATURE_D3D11_OPTIONS = 5,
|
|
||||||
D3D11_FEATURE_ARCHITECTURE_INFO = 6,
|
|
||||||
D3D11_FEATURE_D3D9_OPTIONS = 7,
|
|
||||||
D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT = 8,
|
|
||||||
D3D11_FEATURE_D3D9_SHADOW_SUPPORT = 9,
|
|
||||||
D3D11_FEATURE_D3D11_OPTIONS1 = 10,
|
|
||||||
D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT = 11,
|
|
||||||
D3D11_FEATURE_MARKER_SUPPORT = 12,
|
|
||||||
D3D11_FEATURE_D3D9_OPTIONS1 = 13,
|
|
||||||
D3D11_FEATURE_D3D11_OPTIONS2 = 14,
|
|
||||||
D3D11_FEATURE_D3D11_OPTIONS3 = 15,
|
|
||||||
D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = 16,
|
|
||||||
D3D11_FEATURE_D3D11_OPTIONS4 = 17,
|
|
||||||
D3D11_FEATURE_SHADER_CACHE = 18,
|
|
||||||
D3D11_FEATURE_D3D11_OPTIONS5 = 19,
|
|
||||||
D3D11_FEATURE_DISPLAYABLE = 20,
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_FILL_MODE
|
|
||||||
{
|
|
||||||
D3D11_FILL_WIREFRAME = 2,
|
|
||||||
D3D11_FILL_SOLID = 3,
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_FILTER
|
|
||||||
{
|
|
||||||
D3D11_FILTER_MIN_MAG_MIP_POINT = 0,
|
|
||||||
D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 1,
|
|
||||||
D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 4,
|
|
||||||
D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 5,
|
|
||||||
D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 16,
|
|
||||||
D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 17,
|
|
||||||
D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 20,
|
|
||||||
D3D11_FILTER_MIN_MAG_MIP_LINEAR = 21,
|
|
||||||
D3D11_FILTER_ANISOTROPIC = 85,
|
|
||||||
D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 128,
|
|
||||||
D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 129,
|
|
||||||
D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 132,
|
|
||||||
D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 133,
|
|
||||||
D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 144,
|
|
||||||
D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 145,
|
|
||||||
D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 148,
|
|
||||||
D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 149,
|
|
||||||
D3D11_FILTER_COMPARISON_ANISOTROPIC = 213,
|
|
||||||
D3D11_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 256,
|
|
||||||
D3D11_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 257,
|
|
||||||
D3D11_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 260,
|
|
||||||
D3D11_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 261,
|
|
||||||
D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 272,
|
|
||||||
D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 273,
|
|
||||||
D3D11_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 276,
|
|
||||||
D3D11_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 277,
|
|
||||||
D3D11_FILTER_MINIMUM_ANISOTROPIC = 341,
|
|
||||||
D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 384,
|
|
||||||
D3D11_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 385,
|
|
||||||
D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 388,
|
|
||||||
D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 389,
|
|
||||||
D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 400,
|
|
||||||
D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 401,
|
|
||||||
D3D11_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 404,
|
|
||||||
D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 405,
|
|
||||||
D3D11_FILTER_MAXIMUM_ANISOTROPIC = 469,
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_INPUT_CLASSIFICATION
|
|
||||||
{
|
|
||||||
D3D11_INPUT_PER_VERTEX_DATA = 0,
|
|
||||||
D3D11_INPUT_PER_INSTANCE_DATA = 1,
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi.Common;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_INPUT_ELEMENT_DESC
|
|
||||||
{
|
|
||||||
public PCSTR SemanticName;
|
|
||||||
public uint SemanticIndex;
|
|
||||||
public DXGI_FORMAT Format;
|
|
||||||
public uint InputSlot;
|
|
||||||
public uint AlignedByteOffset;
|
|
||||||
public D3D11_INPUT_CLASSIFICATION InputSlotClass;
|
|
||||||
public uint InstanceDataStepRate;
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_MAP
|
|
||||||
{
|
|
||||||
D3D11_MAP_READ = 1,
|
|
||||||
D3D11_MAP_WRITE = 2,
|
|
||||||
D3D11_MAP_READ_WRITE = 3,
|
|
||||||
D3D11_MAP_WRITE_DISCARD = 4,
|
|
||||||
D3D11_MAP_WRITE_NO_OVERWRITE = 5,
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
[SuppressMessage("", "SA1307")]
|
|
||||||
internal struct D3D11_MAPPED_SUBRESOURCE
|
|
||||||
{
|
|
||||||
public unsafe void* pData;
|
|
||||||
public uint RowPitch;
|
|
||||||
public uint DepthPitch;
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_QUERY
|
|
||||||
{
|
|
||||||
D3D11_QUERY_EVENT = 0,
|
|
||||||
D3D11_QUERY_OCCLUSION = 1,
|
|
||||||
D3D11_QUERY_TIMESTAMP = 2,
|
|
||||||
D3D11_QUERY_TIMESTAMP_DISJOINT = 3,
|
|
||||||
D3D11_QUERY_PIPELINE_STATISTICS = 4,
|
|
||||||
D3D11_QUERY_OCCLUSION_PREDICATE = 5,
|
|
||||||
D3D11_QUERY_SO_STATISTICS = 6,
|
|
||||||
D3D11_QUERY_SO_OVERFLOW_PREDICATE = 7,
|
|
||||||
D3D11_QUERY_SO_STATISTICS_STREAM0 = 8,
|
|
||||||
D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 = 9,
|
|
||||||
D3D11_QUERY_SO_STATISTICS_STREAM1 = 10,
|
|
||||||
D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 = 11,
|
|
||||||
D3D11_QUERY_SO_STATISTICS_STREAM2 = 12,
|
|
||||||
D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 = 13,
|
|
||||||
D3D11_QUERY_SO_STATISTICS_STREAM3 = 14,
|
|
||||||
D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = 15,
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_QUERY_DESC
|
|
||||||
{
|
|
||||||
public D3D11_QUERY Query;
|
|
||||||
public uint MiscFlags;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_RASTERIZER_DESC
|
|
||||||
{
|
|
||||||
public D3D11_FILL_MODE FillMode;
|
|
||||||
public D3D11_CULL_MODE CullMode;
|
|
||||||
public BOOL FrontCounterClockwise;
|
|
||||||
public int DepthBias;
|
|
||||||
public float DepthBiasClamp;
|
|
||||||
public float SlopeScaledDepthBias;
|
|
||||||
public BOOL DepthClipEnable;
|
|
||||||
public BOOL ScissorEnable;
|
|
||||||
public BOOL MultisampleEnable;
|
|
||||||
public BOOL AntialiasedLineEnable;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_RENDER_TARGET_BLEND_DESC
|
|
||||||
{
|
|
||||||
public BOOL BlendEnable;
|
|
||||||
public D3D11_BLEND SrcBlend;
|
|
||||||
public D3D11_BLEND DestBlend;
|
|
||||||
public D3D11_BLEND_OP BlendOp;
|
|
||||||
public D3D11_BLEND SrcBlendAlpha;
|
|
||||||
public D3D11_BLEND DestBlendAlpha;
|
|
||||||
public D3D11_BLEND_OP BlendOpAlpha;
|
|
||||||
public byte RenderTargetWriteMask;
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32.Graphics.Dxgi.Common;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_RENDER_TARGET_VIEW_DESC
|
|
||||||
{
|
|
||||||
public DXGI_FORMAT Format;
|
|
||||||
public D3D11_RTV_DIMENSION ViewDimension;
|
|
||||||
public Union Anonymous;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
|
||||||
internal struct Union
|
|
||||||
{
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_BUFFER_RTV Buffer;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX1D_RTV Texture1D;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX1D_ARRAY_RTV Texture1DArray;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX2D_RTV Texture2D;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX2D_ARRAY_RTV Texture2DArray;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX2DMS_RTV Texture2DMS;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX2DMS_ARRAY_RTV Texture2DMSArray;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public D3D11_TEX3D_RTV Texture3D;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_RESOURCE_DIMENSION
|
|
||||||
{
|
|
||||||
D3D11_RESOURCE_DIMENSION_UNKNOWN = 0,
|
|
||||||
D3D11_RESOURCE_DIMENSION_BUFFER = 1,
|
|
||||||
D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2,
|
|
||||||
D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3,
|
|
||||||
D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4,
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
internal enum D3D11_RESOURCE_MISC_FLAG : uint
|
|
||||||
{
|
|
||||||
D3D11_RESOURCE_MISC_GENERATE_MIPS = 0x1,
|
|
||||||
D3D11_RESOURCE_MISC_SHARED = 0x2,
|
|
||||||
D3D11_RESOURCE_MISC_TEXTURECUBE = 0x4,
|
|
||||||
D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10,
|
|
||||||
D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20,
|
|
||||||
D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40,
|
|
||||||
D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80,
|
|
||||||
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100,
|
|
||||||
D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200,
|
|
||||||
D3D11_RESOURCE_MISC_SHARED_NTHANDLE = 0x800,
|
|
||||||
D3D11_RESOURCE_MISC_RESTRICTED_CONTENT = 0x1000,
|
|
||||||
D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE = 0x2000,
|
|
||||||
D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER = 0x4000,
|
|
||||||
D3D11_RESOURCE_MISC_GUARDED = 0x8000,
|
|
||||||
D3D11_RESOURCE_MISC_TILE_POOL = 0x20000,
|
|
||||||
D3D11_RESOURCE_MISC_TILED = 0x40000,
|
|
||||||
D3D11_RESOURCE_MISC_HW_PROTECTED = 0x80000,
|
|
||||||
D3D11_RESOURCE_MISC_SHARED_DISPLAYABLE = 0x100000,
|
|
||||||
D3D11_RESOURCE_MISC_SHARED_EXCLUSIVE_WRITER = 0x200000,
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal enum D3D11_RTV_DIMENSION
|
|
||||||
{
|
|
||||||
D3D11_RTV_DIMENSION_UNKNOWN = 0,
|
|
||||||
D3D11_RTV_DIMENSION_BUFFER = 1,
|
|
||||||
D3D11_RTV_DIMENSION_TEXTURE1D = 2,
|
|
||||||
D3D11_RTV_DIMENSION_TEXTURE1DARRAY = 3,
|
|
||||||
D3D11_RTV_DIMENSION_TEXTURE2D = 4,
|
|
||||||
D3D11_RTV_DIMENSION_TEXTURE2DARRAY = 5,
|
|
||||||
D3D11_RTV_DIMENSION_TEXTURE2DMS = 6,
|
|
||||||
D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY = 7,
|
|
||||||
D3D11_RTV_DIMENSION_TEXTURE3D = 8,
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Win32.Graphics.Direct3D11;
|
|
||||||
|
|
||||||
internal struct D3D11_SAMPLER_DESC
|
|
||||||
{
|
|
||||||
public D3D11_FILTER Filter;
|
|
||||||
public D3D11_TEXTURE_ADDRESS_MODE AddressU;
|
|
||||||
public D3D11_TEXTURE_ADDRESS_MODE AddressV;
|
|
||||||
public D3D11_TEXTURE_ADDRESS_MODE AddressW;
|
|
||||||
public float MipLODBias;
|
|
||||||
public uint MaxAnisotropy;
|
|
||||||
public D3D11_COMPARISON_FUNC ComparisonFunc;
|
|
||||||
public unsafe fixed float BorderColor[4];
|
|
||||||
public float MinLOD;
|
|
||||||
public float MaxLOD;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user