From ce4647d9909ce1a26c17cb2fd843fe8037ab1f22 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Thu, 26 Nov 2026 23:00:34 -0400 Subject: [PATCH 001/120] Fix DD FrameGen scratch resource leak on resize --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index f366d9a9c4..7f343fdffb 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -261,6 +261,10 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur const Pipe& expandP = m4 ? pExpandM4_ : pExpand_; if (!g_scratch.built || g_scratch.builtFor.width != extent_.width || g_scratch.builtFor.height != extent_.height) { + if (g_scratch.built) { + dd_->DeviceWaitIdle(device_); + destroyScratch(dd_, device_, descPool_); + } ensureScratch(this, dd_, device_, memProps_, descPool_, linear_, extent_, pyrA_, pyrB_, pyrAs_, flowLvl_, flowExpA_, flowExpB_, pLuma_, pDown_, flowP, expandP, pSynth_, pGmReduce_, pGmPrewarp_, From 7b0b811db1b0ff4744817d378649ce1c640861b0 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Thu, 26 Nov 2026 23:12:46 -0400 Subject: [PATCH 002/120] Optimize DD FrameGen flow image initialization --- .../main/cpp/framegen/ddfg/record_impl.inc | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 7f343fdffb..be365f3368 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -326,15 +326,27 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur VkImageSubresourceRange rng{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; for (int l = flowFinest_; l < kLevels; ++l) { VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; - b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; b.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - b.srcAccessMask = 0; b.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - b.image = flowLvl_[l].image; b.subresourceRange = rng; + b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + b.srcAccessMask = 0; + b.image = flowLvl_[l].image; + b.subresourceRange = rng; b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); - dd_->CmdClearColorImage(cmd, flowLvl_[l].image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &zero, 1, &rng); - b.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; b.newLayout = VK_IMAGE_LAYOUT_GENERAL; - b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; - dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); + + if (l == kLevels - 1) { + b.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + b.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); + dd_->CmdClearColorImage(cmd, flowLvl_[l].image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &zero, 1, &rng); + b.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + b.newLayout = VK_IMAGE_LAYOUT_GENERAL; + b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; + dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); + } else { + b.newLayout = VK_IMAGE_LAYOUT_GENERAL; + b.dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); + } } } From 24adee99f83cbd4b66bb517090f076c79ba95967 Mon Sep 17 00:00:00 2001 From: EnzoDLofi Date: Thu, 26 Nov 2026 23:59:23 -0400 Subject: [PATCH 003/120] Optimize DD FrameGen flow shader sampling --- .../cpp/framegen/ddfg/embedded_shaders.hpp | 212 +++++++++++++++++- 1 file changed, 210 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp b/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp index 61f5c154c7..dba9f7724e 100644 --- a/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp +++ b/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp @@ -6,8 +6,216 @@ static const uint32_t OF3_LUMA_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00 static const size_t OF3_LUMA_LEN = 481; static const uint32_t OF3_DOWNSAMPLE_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x0000008au,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000000du,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00030005u,0x00000009u,0x00646967u,0x00080005u,0x0000000du,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000016u,0x74734475u,0x00000000u,0x00040005u,0x00000030u,0x44637273u,0x00006d69u,0x00040005u,0x00000034u,0x63725375u,0x00000000u,0x00040005u,0x0000003au,0x65736162u,0x00000000u,0x00030005u,0x00000044u,0x00000068u,0x00030005u,0x0000004au,0x00000061u,0x00030005u,0x00000059u,0x00000062u,0x00030005u,0x00000065u,0x00000063u,0x00030005u,0x00000071u,0x00000064u,0x00040047u,0x0000000du,0x0000000bu,0x0000001cu,0x00030047u,0x00000016u,0x00000019u,0x00040047u,0x00000016u,0x00000021u,0x00000030u,0x00040047u,0x00000016u,0x00000022u,0x00000000u,0x00040047u,0x00000034u,0x00000021u,0x00000020u,0x00040047u,0x00000034u,0x00000022u,0x00000000u,0x00040047u,0x00000089u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00040015u,0x0000000au,0x00000020u,0x00000000u,0x00040017u,0x0000000bu,0x0000000au,0x00000003u,0x00040020u,0x0000000cu,0x00000001u,0x0000000bu,0x0004003bu,0x0000000cu,0x0000000du,0x00000001u,0x00040017u,0x0000000eu,0x0000000au,0x00000002u,0x00030016u,0x00000013u,0x00000020u,0x00090019u,0x00000014u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000003u,0x00040020u,0x00000015u,0x00000000u,0x00000014u,0x0004003bu,0x00000015u,0x00000016u,0x00000000u,0x00020014u,0x00000019u,0x0004002bu,0x0000000au,0x0000001au,0x00000000u,0x00040020u,0x0000001bu,0x00000007u,0x00000006u,0x0004002bu,0x0000000au,0x00000024u,0x00000001u,0x00040017u,0x0000002eu,0x00000013u,0x00000002u,0x00040020u,0x0000002fu,0x00000007u,0x0000002eu,0x00090019u,0x00000031u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000032u,0x00000031u,0x00040020u,0x00000033u,0x00000000u,0x00000032u,0x0004003bu,0x00000033u,0x00000034u,0x00000000u,0x0004002bu,0x00000006u,0x00000036u,0x00000000u,0x0004002bu,0x00000013u,0x0000003du,0x40000000u,0x0004002bu,0x00000013u,0x0000003fu,0x3f800000u,0x0004002bu,0x00000013u,0x00000045u,0x3f000000u,0x00040020u,0x00000049u,0x00000007u,0x00000013u,0x0004002bu,0x00000013u,0x00000055u,0x00000000u,0x00040017u,0x00000056u,0x00000013u,0x00000004u,0x0004002bu,0x00000013u,0x00000085u,0x3e800000u,0x0004002bu,0x0000000au,0x00000088u,0x00000010u,0x0006002cu,0x0000000bu,0x00000089u,0x00000088u,0x00000088u,0x00000024u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000008u,0x00000009u,0x00000007u,0x0004003bu,0x00000008u,0x00000012u,0x00000007u,0x0004003bu,0x0000002fu,0x00000030u,0x00000007u,0x0004003bu,0x0000002fu,0x0000003au,0x00000007u,0x0004003bu,0x0000002fu,0x00000044u,0x00000007u,0x0004003bu,0x00000049u,0x0000004au,0x00000007u,0x0004003bu,0x00000049u,0x00000059u,0x00000007u,0x0004003bu,0x00000049u,0x00000065u,0x00000007u,0x0004003bu,0x00000049u,0x00000071u,0x00000007u,0x0004003du,0x0000000bu,0x0000000fu,0x0000000du,0x0007004fu,0x0000000eu,0x00000010u,0x0000000fu,0x0000000fu,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x00000011u,0x00000010u,0x0003003eu,0x00000009u,0x00000011u,0x0004003du,0x00000014u,0x00000017u,0x00000016u,0x00040068u,0x00000007u,0x00000018u,0x00000017u,0x0003003eu,0x00000012u,0x00000018u,0x00050041u,0x0000001bu,0x0000001cu,0x00000009u,0x0000001au,0x0004003du,0x00000006u,0x0000001du,0x0000001cu,0x00050041u,0x0000001bu,0x0000001eu,0x00000012u,0x0000001au,0x0004003du,0x00000006u,0x0000001fu,0x0000001eu,0x000500afu,0x00000019u,0x00000020u,0x0000001du,0x0000001fu,0x000400a8u,0x00000019u,0x00000021u,0x00000020u,0x000300f7u,0x00000023u,0x00000000u,0x000400fau,0x00000021u,0x00000022u,0x00000023u,0x000200f8u,0x00000022u,0x00050041u,0x0000001bu,0x00000025u,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000026u,0x00000025u,0x00050041u,0x0000001bu,0x00000027u,0x00000012u,0x00000024u,0x0004003du,0x00000006u,0x00000028u,0x00000027u,0x000500afu,0x00000019u,0x00000029u,0x00000026u,0x00000028u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x000700f5u,0x00000019u,0x0000002au,0x00000020u,0x00000005u,0x00000029u,0x00000022u,0x000300f7u,0x0000002cu,0x00000000u,0x000400fau,0x0000002au,0x0000002bu,0x0000002cu,0x000200f8u,0x0000002bu,0x000100fdu,0x000200f8u,0x0000002cu,0x0004003du,0x00000032u,0x00000035u,0x00000034u,0x00040064u,0x00000031u,0x00000037u,0x00000035u,0x00050067u,0x00000007u,0x00000038u,0x00000037u,0x00000036u,0x0004006fu,0x0000002eu,0x00000039u,0x00000038u,0x0003003eu,0x00000030u,0x00000039u,0x0004003du,0x00000007u,0x0000003bu,0x00000009u,0x0004006fu,0x0000002eu,0x0000003cu,0x0000003bu,0x0005008eu,0x0000002eu,0x0000003eu,0x0000003cu,0x0000003du,0x00050050u,0x0000002eu,0x00000040u,0x0000003fu,0x0000003fu,0x00050081u,0x0000002eu,0x00000041u,0x0000003eu,0x00000040u,0x0004003du,0x0000002eu,0x00000042u,0x00000030u,0x00050088u,0x0000002eu,0x00000043u,0x00000041u,0x00000042u,0x0003003eu,0x0000003au,0x00000043u,0x0004003du,0x0000002eu,0x00000046u,0x00000030u,0x00050050u,0x0000002eu,0x00000047u,0x00000045u,0x00000045u,0x00050088u,0x0000002eu,0x00000048u,0x00000047u,0x00000046u,0x0003003eu,0x00000044u,0x00000048u,0x0004003du,0x00000032u,0x0000004bu,0x00000034u,0x0004003du,0x0000002eu,0x0000004cu,0x0000003au,0x00050041u,0x00000049u,0x0000004du,0x00000044u,0x0000001au,0x0004003du,0x00000013u,0x0000004eu,0x0000004du,0x0004007fu,0x00000013u,0x0000004fu,0x0000004eu,0x00050041u,0x00000049u,0x00000050u,0x00000044u,0x00000024u,0x0004003du,0x00000013u,0x00000051u,0x00000050u,0x0004007fu,0x00000013u,0x00000052u,0x00000051u,0x00050050u,0x0000002eu,0x00000053u,0x0000004fu,0x00000052u,0x00050081u,0x0000002eu,0x00000054u,0x0000004cu,0x00000053u,0x00070058u,0x00000056u,0x00000057u,0x0000004bu,0x00000054u,0x00000002u,0x00000055u,0x00050051u,0x00000013u,0x00000058u,0x00000057u,0x00000000u,0x0003003eu,0x0000004au,0x00000058u,0x0004003du,0x00000032u,0x0000005au,0x00000034u,0x0004003du,0x0000002eu,0x0000005bu,0x0000003au,0x00050041u,0x00000049u,0x0000005cu,0x00000044u,0x0000001au,0x0004003du,0x00000013u,0x0000005du,0x0000005cu,0x00050041u,0x00000049u,0x0000005eu,0x00000044u,0x00000024u,0x0004003du,0x00000013u,0x0000005fu,0x0000005eu,0x0004007fu,0x00000013u,0x00000060u,0x0000005fu,0x00050050u,0x0000002eu,0x00000061u,0x0000005du,0x00000060u,0x00050081u,0x0000002eu,0x00000062u,0x0000005bu,0x00000061u,0x00070058u,0x00000056u,0x00000063u,0x0000005au,0x00000062u,0x00000002u,0x00000055u,0x00050051u,0x00000013u,0x00000064u,0x00000063u,0x00000000u,0x0003003eu,0x00000059u,0x00000064u,0x0004003du,0x00000032u,0x00000066u,0x00000034u,0x0004003du,0x0000002eu,0x00000067u,0x0000003au,0x00050041u,0x00000049u,0x00000068u,0x00000044u,0x0000001au,0x0004003du,0x00000013u,0x00000069u,0x00000068u,0x0004007fu,0x00000013u,0x0000006au,0x00000069u,0x00050041u,0x00000049u,0x0000006bu,0x00000044u,0x00000024u,0x0004003du,0x00000013u,0x0000006cu,0x0000006bu,0x00050050u,0x0000002eu,0x0000006du,0x0000006au,0x0000006cu,0x00050081u,0x0000002eu,0x0000006eu,0x00000067u,0x0000006du,0x00070058u,0x00000056u,0x0000006fu,0x00000066u,0x0000006eu,0x00000002u,0x00000055u,0x00050051u,0x00000013u,0x00000070u,0x0000006fu,0x00000000u,0x0003003eu,0x00000065u,0x00000070u,0x0004003du,0x00000032u,0x00000072u,0x00000034u,0x0004003du,0x0000002eu,0x00000073u,0x0000003au,0x00050041u,0x00000049u,0x00000074u,0x00000044u,0x0000001au,0x0004003du,0x00000013u,0x00000075u,0x00000074u,0x00050041u,0x00000049u,0x00000076u,0x00000044u,0x00000024u,0x0004003du,0x00000013u,0x00000077u,0x00000076u,0x00050050u,0x0000002eu,0x00000078u,0x00000075u,0x00000077u,0x00050081u,0x0000002eu,0x00000079u,0x00000073u,0x00000078u,0x00070058u,0x00000056u,0x0000007au,0x00000072u,0x00000079u,0x00000002u,0x00000055u,0x00050051u,0x00000013u,0x0000007bu,0x0000007au,0x00000000u,0x0003003eu,0x00000071u,0x0000007bu,0x0004003du,0x00000014u,0x0000007cu,0x00000016u,0x0004003du,0x00000007u,0x0000007du,0x00000009u,0x0004003du,0x00000013u,0x0000007eu,0x0000004au,0x0004003du,0x00000013u,0x0000007fu,0x00000059u,0x00050081u,0x00000013u,0x00000080u,0x0000007eu,0x0000007fu,0x0004003du,0x00000013u,0x00000081u,0x00000065u,0x00050081u,0x00000013u,0x00000082u,0x00000080u,0x00000081u,0x0004003du,0x00000013u,0x00000083u,0x00000071u,0x00050081u,0x00000013u,0x00000084u,0x00000082u,0x00000083u,0x00050085u,0x00000013u,0x00000086u,0x00000084u,0x00000085u,0x00070050u,0x00000056u,0x00000087u,0x00000086u,0x00000055u,0x00000055u,0x00000055u,0x00040063u,0x0000007cu,0x0000007du,0x00000087u,0x000100fdu,0x00010038u}; static const size_t OF3_DOWNSAMPLE_LEN = 753; -static const uint32_t OF3_FLOW_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000185u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000000du,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00030005u,0x00000009u,0x00646967u,0x00080005u,0x0000000du,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000016u,0x6f6c4675u,0x00000077u,0x00040005u,0x00000030u,0x44766e69u,0x00006d69u,0x00030005u,0x00000036u,0x00007675u,0x00040005u,0x0000003fu,0x654c6f74u,0x006c6576u,0x00030005u,0x00000040u,0x00000055u,0x00060006u,0x00000040u,0x00000000u,0x776f6c66u,0x6c616353u,0x00000065u,0x00050006u,0x00000040u,0x00000001u,0x6576656cu,0x0000006cu,0x00050006u,0x00000040u,0x00000002u,0x30646170u,0x00000000u,0x00050006u,0x00000040u,0x00000003u,0x31646170u,0x00000000u,0x00030005u,0x00000042u,0x00000000u,0x00050005u,0x0000004au,0x64657270u,0x6c6c7546u,0x00000000u,0x00050005u,0x0000004eu,0x65725075u,0x74636964u,0x0000726fu,0x00050005u,0x00000055u,0x64657270u,0x6576654cu,0x0000006cu,0x00040005u,0x00000059u,0x74736562u,0x00646153u,0x00050005u,0x0000005bu,0x74736562u,0x70736944u,0x00000000u,0x00030005u,0x0000005du,0x00007973u,0x00030005u,0x00000067u,0x00007873u,0x00040005u,0x0000006fu,0x646e6163u,0x00000000u,0x00030005u,0x00000077u,0x00646173u,0x00030005u,0x00000078u,0x00007962u,0x00030005u,0x00000081u,0x00007862u,0x00030005u,0x00000089u,0x00006f62u,0x00030005u,0x0000008fu,0x00000070u,0x00050005u,0x00000090u,0x6d754c75u,0x65725061u,0x00000076u,0x00030005u,0x00000099u,0x00000063u,0x00050005u,0x0000009au,0x6d754c75u,0x72754361u,0x00000072u,0x00040005u,0x000000cau,0x43646173u,0x00000000u,0x00040005u,0x000000ccu,0x58646173u,0x0000006du,0x00040005u,0x000000cdu,0x58646173u,0x00000070u,0x00040005u,0x000000ceu,0x59646173u,0x0000006du,0x00040005u,0x000000cfu,0x59646173u,0x00000070u,0x00030005u,0x000000d0u,0x00007962u,0x00030005u,0x000000d8u,0x00007862u,0x00030005u,0x000000e0u,0x00006f62u,0x00030005u,0x000000e6u,0x00000070u,0x00040005u,0x000000efu,0x646e6163u,0x00006d58u,0x00040005u,0x000000f4u,0x646e6163u,0x00007058u,0x00040005u,0x000000f8u,0x646e6163u,0x00006d59u,0x00040005u,0x000000fcu,0x646e6163u,0x00007059u,0x00030005u,0x00000148u,0x00007864u,0x00030005u,0x00000149u,0x00007964u,0x00040005u,0x0000014au,0x6f6e6564u,0x0000586du,0x00040005u,0x00000152u,0x6f6e6564u,0x0000596du,0x00050005u,0x00000176u,0x776f6c66u,0x6c6c7546u,0x00000000u,0x00040047u,0x0000000du,0x0000000bu,0x0000001cu,0x00030047u,0x00000016u,0x00000019u,0x00040047u,0x00000016u,0x00000021u,0x00000030u,0x00040047u,0x00000016u,0x00000022u,0x00000000u,0x00030047u,0x00000040u,0x00000002u,0x00050048u,0x00000040u,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x00000040u,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x00000040u,0x00000002u,0x00000023u,0x00000008u,0x00050048u,0x00000040u,0x00000003u,0x00000023u,0x0000000cu,0x00040047u,0x00000042u,0x00000021u,0x00000000u,0x00040047u,0x00000042u,0x00000022u,0x00000000u,0x00040047u,0x0000004eu,0x00000021u,0x00000022u,0x00040047u,0x0000004eu,0x00000022u,0x00000000u,0x00040047u,0x00000090u,0x00000021u,0x00000020u,0x00040047u,0x00000090u,0x00000022u,0x00000000u,0x00040047u,0x0000009au,0x00000021u,0x00000021u,0x00040047u,0x0000009au,0x00000022u,0x00000000u,0x00040047u,0x00000184u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00040015u,0x0000000au,0x00000020u,0x00000000u,0x00040017u,0x0000000bu,0x0000000au,0x00000003u,0x00040020u,0x0000000cu,0x00000001u,0x0000000bu,0x0004003bu,0x0000000cu,0x0000000du,0x00000001u,0x00040017u,0x0000000eu,0x0000000au,0x00000002u,0x00030016u,0x00000013u,0x00000020u,0x00090019u,0x00000014u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000002u,0x00040020u,0x00000015u,0x00000000u,0x00000014u,0x0004003bu,0x00000015u,0x00000016u,0x00000000u,0x00020014u,0x00000019u,0x0004002bu,0x0000000au,0x0000001au,0x00000000u,0x00040020u,0x0000001bu,0x00000007u,0x00000006u,0x0004002bu,0x0000000au,0x00000024u,0x00000001u,0x00040017u,0x0000002eu,0x00000013u,0x00000002u,0x00040020u,0x0000002fu,0x00000007u,0x0000002eu,0x0004002bu,0x00000013u,0x00000031u,0x3f800000u,0x0004002bu,0x00000013u,0x00000039u,0x3f000000u,0x00040020u,0x0000003eu,0x00000007u,0x00000013u,0x0006001eu,0x00000040u,0x00000013u,0x0000000au,0x0000000au,0x0000000au,0x00040020u,0x00000041u,0x00000002u,0x00000040u,0x0004003bu,0x00000041u,0x00000042u,0x00000002u,0x0004002bu,0x00000006u,0x00000043u,0x00000001u,0x00040020u,0x00000044u,0x00000002u,0x0000000au,0x00090019u,0x0000004bu,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x0000004cu,0x0000004bu,0x00040020u,0x0000004du,0x00000000u,0x0000004cu,0x0004003bu,0x0000004du,0x0000004eu,0x00000000u,0x0004002bu,0x00000013u,0x00000051u,0x00000000u,0x00040017u,0x00000052u,0x00000013u,0x00000004u,0x0004002bu,0x00000013u,0x0000005au,0x7f7fffffu,0x0004002bu,0x00000006u,0x0000005eu,0xfffffffdu,0x0004002bu,0x00000006u,0x00000065u,0x00000003u,0x0004002bu,0x00000006u,0x00000079u,0xffffffffu,0x0004003bu,0x0000004du,0x00000090u,0x00000000u,0x0004003bu,0x0000004du,0x0000009au,0x00000000u,0x0004002bu,0x00000013u,0x000000afu,0x3bc49ba6u,0x0004002bu,0x00000013u,0x000000f1u,0xbf800000u,0x0005002cu,0x0000002eu,0x000000f2u,0x000000f1u,0x00000051u,0x0005002cu,0x0000002eu,0x000000f6u,0x00000031u,0x00000051u,0x0005002cu,0x0000002eu,0x000000fau,0x00000051u,0x000000f1u,0x0005002cu,0x0000002eu,0x000000feu,0x00000051u,0x00000031u,0x0004002bu,0x00000013u,0x0000014cu,0x40000000u,0x0004002bu,0x00000013u,0x0000015au,0x358637bdu,0x0004002bu,0x00000013u,0x00000164u,0xbf000000u,0x0004002bu,0x0000000au,0x00000183u,0x00000010u,0x0006002cu,0x0000000bu,0x00000184u,0x00000183u,0x00000183u,0x00000024u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000008u,0x00000009u,0x00000007u,0x0004003bu,0x00000008u,0x00000012u,0x00000007u,0x0004003bu,0x0000002fu,0x00000030u,0x00000007u,0x0004003bu,0x0000002fu,0x00000036u,0x00000007u,0x0004003bu,0x0000003eu,0x0000003fu,0x00000007u,0x0004003bu,0x0000002fu,0x0000004au,0x00000007u,0x0004003bu,0x0000002fu,0x00000055u,0x00000007u,0x0004003bu,0x0000003eu,0x00000059u,0x00000007u,0x0004003bu,0x0000002fu,0x0000005bu,0x00000007u,0x0004003bu,0x0000001bu,0x0000005du,0x00000007u,0x0004003bu,0x0000001bu,0x00000067u,0x00000007u,0x0004003bu,0x0000002fu,0x0000006fu,0x00000007u,0x0004003bu,0x0000003eu,0x00000077u,0x00000007u,0x0004003bu,0x0000001bu,0x00000078u,0x00000007u,0x0004003bu,0x0000001bu,0x00000081u,0x00000007u,0x0004003bu,0x0000002fu,0x00000089u,0x00000007u,0x0004003bu,0x0000003eu,0x0000008fu,0x00000007u,0x0004003bu,0x0000003eu,0x00000099u,0x00000007u,0x0004003bu,0x0000003eu,0x000000cau,0x00000007u,0x0004003bu,0x0000003eu,0x000000ccu,0x00000007u,0x0004003bu,0x0000003eu,0x000000cdu,0x00000007u,0x0004003bu,0x0000003eu,0x000000ceu,0x00000007u,0x0004003bu,0x0000003eu,0x000000cfu,0x00000007u,0x0004003bu,0x0000001bu,0x000000d0u,0x00000007u,0x0004003bu,0x0000001bu,0x000000d8u,0x00000007u,0x0004003bu,0x0000002fu,0x000000e0u,0x00000007u,0x0004003bu,0x0000003eu,0x000000e6u,0x00000007u,0x0004003bu,0x0000002fu,0x000000efu,0x00000007u,0x0004003bu,0x0000002fu,0x000000f4u,0x00000007u,0x0004003bu,0x0000002fu,0x000000f8u,0x00000007u,0x0004003bu,0x0000002fu,0x000000fcu,0x00000007u,0x0004003bu,0x0000003eu,0x00000148u,0x00000007u,0x0004003bu,0x0000003eu,0x00000149u,0x00000007u,0x0004003bu,0x0000003eu,0x0000014au,0x00000007u,0x0004003bu,0x0000003eu,0x00000152u,0x00000007u,0x0004003bu,0x0000002fu,0x00000176u,0x00000007u,0x0004003du,0x0000000bu,0x0000000fu,0x0000000du,0x0007004fu,0x0000000eu,0x00000010u,0x0000000fu,0x0000000fu,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x00000011u,0x00000010u,0x0003003eu,0x00000009u,0x00000011u,0x0004003du,0x00000014u,0x00000017u,0x00000016u,0x00040068u,0x00000007u,0x00000018u,0x00000017u,0x0003003eu,0x00000012u,0x00000018u,0x00050041u,0x0000001bu,0x0000001cu,0x00000009u,0x0000001au,0x0004003du,0x00000006u,0x0000001du,0x0000001cu,0x00050041u,0x0000001bu,0x0000001eu,0x00000012u,0x0000001au,0x0004003du,0x00000006u,0x0000001fu,0x0000001eu,0x000500afu,0x00000019u,0x00000020u,0x0000001du,0x0000001fu,0x000400a8u,0x00000019u,0x00000021u,0x00000020u,0x000300f7u,0x00000023u,0x00000000u,0x000400fau,0x00000021u,0x00000022u,0x00000023u,0x000200f8u,0x00000022u,0x00050041u,0x0000001bu,0x00000025u,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000026u,0x00000025u,0x00050041u,0x0000001bu,0x00000027u,0x00000012u,0x00000024u,0x0004003du,0x00000006u,0x00000028u,0x00000027u,0x000500afu,0x00000019u,0x00000029u,0x00000026u,0x00000028u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x000700f5u,0x00000019u,0x0000002au,0x00000020u,0x00000005u,0x00000029u,0x00000022u,0x000300f7u,0x0000002cu,0x00000000u,0x000400fau,0x0000002au,0x0000002bu,0x0000002cu,0x000200f8u,0x0000002bu,0x000100fdu,0x000200f8u,0x0000002cu,0x0004003du,0x00000007u,0x00000032u,0x00000012u,0x0004006fu,0x0000002eu,0x00000033u,0x00000032u,0x00050050u,0x0000002eu,0x00000034u,0x00000031u,0x00000031u,0x00050088u,0x0000002eu,0x00000035u,0x00000034u,0x00000033u,0x0003003eu,0x00000030u,0x00000035u,0x0004003du,0x00000007u,0x00000037u,0x00000009u,0x0004006fu,0x0000002eu,0x00000038u,0x00000037u,0x00050050u,0x0000002eu,0x0000003au,0x00000039u,0x00000039u,0x00050081u,0x0000002eu,0x0000003bu,0x00000038u,0x0000003au,0x0004003du,0x0000002eu,0x0000003cu,0x00000030u,0x00050085u,0x0000002eu,0x0000003du,0x0000003bu,0x0000003cu,0x0003003eu,0x00000036u,0x0000003du,0x00050041u,0x00000044u,0x00000045u,0x00000042u,0x00000043u,0x0004003du,0x0000000au,0x00000046u,0x00000045u,0x00040070u,0x00000013u,0x00000047u,0x00000046u,0x0004007fu,0x00000013u,0x00000048u,0x00000047u,0x0006000cu,0x00000013u,0x00000049u,0x00000001u,0x0000001du,0x00000048u,0x0003003eu,0x0000003fu,0x00000049u,0x0004003du,0x0000004cu,0x0000004fu,0x0000004eu,0x0004003du,0x0000002eu,0x00000050u,0x00000036u,0x00070058u,0x00000052u,0x00000053u,0x0000004fu,0x00000050u,0x00000002u,0x00000051u,0x0007004fu,0x0000002eu,0x00000054u,0x00000053u,0x00000053u,0x00000000u,0x00000001u,0x0003003eu,0x0000004au,0x00000054u,0x0004003du,0x0000002eu,0x00000056u,0x0000004au,0x0004003du,0x00000013u,0x00000057u,0x0000003fu,0x0005008eu,0x0000002eu,0x00000058u,0x00000056u,0x00000057u,0x0003003eu,0x00000055u,0x00000058u,0x0003003eu,0x00000059u,0x0000005au,0x0004003du,0x0000002eu,0x0000005cu,0x00000055u,0x0003003eu,0x0000005bu,0x0000005cu,0x0003003eu,0x0000005du,0x0000005eu,0x000200f9u,0x0000005fu,0x000200f8u,0x0000005fu,0x000400f6u,0x00000061u,0x00000062u,0x00000000u,0x000200f9u,0x00000063u,0x000200f8u,0x00000063u,0x0004003du,0x00000006u,0x00000064u,0x0000005du,0x000500b3u,0x00000019u,0x00000066u,0x00000064u,0x00000065u,0x000400fau,0x00000066u,0x00000060u,0x00000061u,0x000200f8u,0x00000060u,0x0003003eu,0x00000067u,0x0000005eu,0x000200f9u,0x00000068u,0x000200f8u,0x00000068u,0x000400f6u,0x0000006au,0x0000006bu,0x00000000u,0x000200f9u,0x0000006cu,0x000200f8u,0x0000006cu,0x0004003du,0x00000006u,0x0000006du,0x00000067u,0x000500b3u,0x00000019u,0x0000006eu,0x0000006du,0x00000065u,0x000400fau,0x0000006eu,0x00000069u,0x0000006au,0x000200f8u,0x00000069u,0x0004003du,0x0000002eu,0x00000070u,0x00000055u,0x0004003du,0x00000006u,0x00000071u,0x00000067u,0x0004006fu,0x00000013u,0x00000072u,0x00000071u,0x0004003du,0x00000006u,0x00000073u,0x0000005du,0x0004006fu,0x00000013u,0x00000074u,0x00000073u,0x00050050u,0x0000002eu,0x00000075u,0x00000072u,0x00000074u,0x00050081u,0x0000002eu,0x00000076u,0x00000070u,0x00000075u,0x0003003eu,0x0000006fu,0x00000076u,0x0003003eu,0x00000077u,0x00000051u,0x0003003eu,0x00000078u,0x00000079u,0x000200f9u,0x0000007au,0x000200f8u,0x0000007au,0x000400f6u,0x0000007cu,0x0000007du,0x00000000u,0x000200f9u,0x0000007eu,0x000200f8u,0x0000007eu,0x0004003du,0x00000006u,0x0000007fu,0x00000078u,0x000500b3u,0x00000019u,0x00000080u,0x0000007fu,0x00000043u,0x000400fau,0x00000080u,0x0000007bu,0x0000007cu,0x000200f8u,0x0000007bu,0x0003003eu,0x00000081u,0x00000079u,0x000200f9u,0x00000082u,0x000200f8u,0x00000082u,0x000400f6u,0x00000084u,0x00000085u,0x00000000u,0x000200f9u,0x00000086u,0x000200f8u,0x00000086u,0x0004003du,0x00000006u,0x00000087u,0x00000081u,0x000500b3u,0x00000019u,0x00000088u,0x00000087u,0x00000043u,0x000400fau,0x00000088u,0x00000083u,0x00000084u,0x000200f8u,0x00000083u,0x0004003du,0x00000006u,0x0000008au,0x00000081u,0x0004006fu,0x00000013u,0x0000008bu,0x0000008au,0x0004003du,0x00000006u,0x0000008cu,0x00000078u,0x0004006fu,0x00000013u,0x0000008du,0x0000008cu,0x00050050u,0x0000002eu,0x0000008eu,0x0000008bu,0x0000008du,0x0003003eu,0x00000089u,0x0000008eu,0x0004003du,0x0000004cu,0x00000091u,0x00000090u,0x0004003du,0x0000002eu,0x00000092u,0x00000036u,0x0004003du,0x0000002eu,0x00000093u,0x00000089u,0x0004003du,0x0000002eu,0x00000094u,0x00000030u,0x00050085u,0x0000002eu,0x00000095u,0x00000093u,0x00000094u,0x00050081u,0x0000002eu,0x00000096u,0x00000092u,0x00000095u,0x00070058u,0x00000052u,0x00000097u,0x00000091u,0x00000096u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x00000098u,0x00000097u,0x00000000u,0x0003003eu,0x0000008fu,0x00000098u,0x0004003du,0x0000004cu,0x0000009bu,0x0000009au,0x0004003du,0x0000002eu,0x0000009cu,0x00000036u,0x0004003du,0x0000002eu,0x0000009du,0x00000089u,0x0004003du,0x0000002eu,0x0000009eu,0x0000006fu,0x00050081u,0x0000002eu,0x0000009fu,0x0000009du,0x0000009eu,0x0004003du,0x0000002eu,0x000000a0u,0x00000030u,0x00050085u,0x0000002eu,0x000000a1u,0x0000009fu,0x000000a0u,0x00050081u,0x0000002eu,0x000000a2u,0x0000009cu,0x000000a1u,0x00070058u,0x00000052u,0x000000a3u,0x0000009bu,0x000000a2u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x000000a4u,0x000000a3u,0x00000000u,0x0003003eu,0x00000099u,0x000000a4u,0x0004003du,0x00000013u,0x000000a5u,0x0000008fu,0x0004003du,0x00000013u,0x000000a6u,0x00000099u,0x00050083u,0x00000013u,0x000000a7u,0x000000a5u,0x000000a6u,0x0006000cu,0x00000013u,0x000000a8u,0x00000001u,0x00000004u,0x000000a7u,0x0004003du,0x00000013u,0x000000a9u,0x00000077u,0x00050081u,0x00000013u,0x000000aau,0x000000a9u,0x000000a8u,0x0003003eu,0x00000077u,0x000000aau,0x000200f9u,0x00000085u,0x000200f8u,0x00000085u,0x0004003du,0x00000006u,0x000000abu,0x00000081u,0x00050080u,0x00000006u,0x000000acu,0x000000abu,0x00000043u,0x0003003eu,0x00000081u,0x000000acu,0x000200f9u,0x00000082u,0x000200f8u,0x00000084u,0x000200f9u,0x0000007du,0x000200f8u,0x0000007du,0x0004003du,0x00000006u,0x000000adu,0x00000078u,0x00050080u,0x00000006u,0x000000aeu,0x000000adu,0x00000043u,0x0003003eu,0x00000078u,0x000000aeu,0x000200f9u,0x0000007au,0x000200f8u,0x0000007cu,0x0004003du,0x00000006u,0x000000b0u,0x00000067u,0x0004006fu,0x00000013u,0x000000b1u,0x000000b0u,0x0006000cu,0x00000013u,0x000000b2u,0x00000001u,0x00000004u,0x000000b1u,0x0004003du,0x00000006u,0x000000b3u,0x0000005du,0x0004006fu,0x00000013u,0x000000b4u,0x000000b3u,0x0006000cu,0x00000013u,0x000000b5u,0x00000001u,0x00000004u,0x000000b4u,0x00050081u,0x00000013u,0x000000b6u,0x000000b2u,0x000000b5u,0x00050085u,0x00000013u,0x000000b7u,0x000000afu,0x000000b6u,0x0004003du,0x00000013u,0x000000b8u,0x00000077u,0x00050081u,0x00000013u,0x000000b9u,0x000000b8u,0x000000b7u,0x0003003eu,0x00000077u,0x000000b9u,0x0004003du,0x00000013u,0x000000bau,0x00000077u,0x0004003du,0x00000013u,0x000000bbu,0x00000059u,0x000500b8u,0x00000019u,0x000000bcu,0x000000bau,0x000000bbu,0x000300f7u,0x000000beu,0x00000000u,0x000400fau,0x000000bcu,0x000000bdu,0x000000beu,0x000200f8u,0x000000bdu,0x0004003du,0x00000013u,0x000000bfu,0x00000077u,0x0003003eu,0x00000059u,0x000000bfu,0x0004003du,0x0000002eu,0x000000c0u,0x0000006fu,0x0003003eu,0x0000005bu,0x000000c0u,0x000200f9u,0x000000beu,0x000200f8u,0x000000beu,0x000200f9u,0x0000006bu,0x000200f8u,0x0000006bu,0x0004003du,0x00000006u,0x000000c1u,0x00000067u,0x00050080u,0x00000006u,0x000000c2u,0x000000c1u,0x00000043u,0x0003003eu,0x00000067u,0x000000c2u,0x000200f9u,0x00000068u,0x000200f8u,0x0000006au,0x000200f9u,0x00000062u,0x000200f8u,0x00000062u,0x0004003du,0x00000006u,0x000000c3u,0x0000005du,0x00050080u,0x00000006u,0x000000c4u,0x000000c3u,0x00000043u,0x0003003eu,0x0000005du,0x000000c4u,0x000200f9u,0x0000005fu,0x000200f8u,0x00000061u,0x00050041u,0x00000044u,0x000000c5u,0x00000042u,0x00000043u,0x0004003du,0x0000000au,0x000000c6u,0x000000c5u,0x000500aau,0x00000019u,0x000000c7u,0x000000c6u,0x0000001au,0x000300f7u,0x000000c9u,0x00000000u,0x000400fau,0x000000c7u,0x000000c8u,0x000000c9u,0x000200f8u,0x000000c8u,0x0004003du,0x00000013u,0x000000cbu,0x00000059u,0x0003003eu,0x000000cau,0x000000cbu,0x0003003eu,0x000000ccu,0x00000051u,0x0003003eu,0x000000cdu,0x00000051u,0x0003003eu,0x000000ceu,0x00000051u,0x0003003eu,0x000000cfu,0x00000051u,0x0003003eu,0x000000d0u,0x00000079u,0x000200f9u,0x000000d1u,0x000200f8u,0x000000d1u,0x000400f6u,0x000000d3u,0x000000d4u,0x00000000u,0x000200f9u,0x000000d5u,0x000200f8u,0x000000d5u,0x0004003du,0x00000006u,0x000000d6u,0x000000d0u,0x000500b3u,0x00000019u,0x000000d7u,0x000000d6u,0x00000043u,0x000400fau,0x000000d7u,0x000000d2u,0x000000d3u,0x000200f8u,0x000000d2u,0x0003003eu,0x000000d8u,0x00000079u,0x000200f9u,0x000000d9u,0x000200f8u,0x000000d9u,0x000400f6u,0x000000dbu,0x000000dcu,0x00000000u,0x000200f9u,0x000000ddu,0x000200f8u,0x000000ddu,0x0004003du,0x00000006u,0x000000deu,0x000000d8u,0x000500b3u,0x00000019u,0x000000dfu,0x000000deu,0x00000043u,0x000400fau,0x000000dfu,0x000000dau,0x000000dbu,0x000200f8u,0x000000dau,0x0004003du,0x00000006u,0x000000e1u,0x000000d8u,0x0004006fu,0x00000013u,0x000000e2u,0x000000e1u,0x0004003du,0x00000006u,0x000000e3u,0x000000d0u,0x0004006fu,0x00000013u,0x000000e4u,0x000000e3u,0x00050050u,0x0000002eu,0x000000e5u,0x000000e2u,0x000000e4u,0x0003003eu,0x000000e0u,0x000000e5u,0x0004003du,0x0000004cu,0x000000e7u,0x00000090u,0x0004003du,0x0000002eu,0x000000e8u,0x00000036u,0x0004003du,0x0000002eu,0x000000e9u,0x000000e0u,0x0004003du,0x0000002eu,0x000000eau,0x00000030u,0x00050085u,0x0000002eu,0x000000ebu,0x000000e9u,0x000000eau,0x00050081u,0x0000002eu,0x000000ecu,0x000000e8u,0x000000ebu,0x00070058u,0x00000052u,0x000000edu,0x000000e7u,0x000000ecu,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x000000eeu,0x000000edu,0x00000000u,0x0003003eu,0x000000e6u,0x000000eeu,0x0004003du,0x0000002eu,0x000000f0u,0x0000005bu,0x00050081u,0x0000002eu,0x000000f3u,0x000000f0u,0x000000f2u,0x0003003eu,0x000000efu,0x000000f3u,0x0004003du,0x0000002eu,0x000000f5u,0x0000005bu,0x00050081u,0x0000002eu,0x000000f7u,0x000000f5u,0x000000f6u,0x0003003eu,0x000000f4u,0x000000f7u,0x0004003du,0x0000002eu,0x000000f9u,0x0000005bu,0x00050081u,0x0000002eu,0x000000fbu,0x000000f9u,0x000000fau,0x0003003eu,0x000000f8u,0x000000fbu,0x0004003du,0x0000002eu,0x000000fdu,0x0000005bu,0x00050081u,0x0000002eu,0x000000ffu,0x000000fdu,0x000000feu,0x0003003eu,0x000000fcu,0x000000ffu,0x0004003du,0x00000013u,0x00000100u,0x000000e6u,0x0004003du,0x0000004cu,0x00000101u,0x0000009au,0x0004003du,0x0000002eu,0x00000102u,0x00000036u,0x0004003du,0x0000002eu,0x00000103u,0x000000e0u,0x0004003du,0x0000002eu,0x00000104u,0x000000efu,0x00050081u,0x0000002eu,0x00000105u,0x00000103u,0x00000104u,0x0004003du,0x0000002eu,0x00000106u,0x00000030u,0x00050085u,0x0000002eu,0x00000107u,0x00000105u,0x00000106u,0x00050081u,0x0000002eu,0x00000108u,0x00000102u,0x00000107u,0x00070058u,0x00000052u,0x00000109u,0x00000101u,0x00000108u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x0000010au,0x00000109u,0x00000000u,0x00050083u,0x00000013u,0x0000010bu,0x00000100u,0x0000010au,0x0006000cu,0x00000013u,0x0000010cu,0x00000001u,0x00000004u,0x0000010bu,0x0004003du,0x00000013u,0x0000010du,0x000000ccu,0x00050081u,0x00000013u,0x0000010eu,0x0000010du,0x0000010cu,0x0003003eu,0x000000ccu,0x0000010eu,0x0004003du,0x00000013u,0x0000010fu,0x000000e6u,0x0004003du,0x0000004cu,0x00000110u,0x0000009au,0x0004003du,0x0000002eu,0x00000111u,0x00000036u,0x0004003du,0x0000002eu,0x00000112u,0x000000e0u,0x0004003du,0x0000002eu,0x00000113u,0x000000f4u,0x00050081u,0x0000002eu,0x00000114u,0x00000112u,0x00000113u,0x0004003du,0x0000002eu,0x00000115u,0x00000030u,0x00050085u,0x0000002eu,0x00000116u,0x00000114u,0x00000115u,0x00050081u,0x0000002eu,0x00000117u,0x00000111u,0x00000116u,0x00070058u,0x00000052u,0x00000118u,0x00000110u,0x00000117u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x00000119u,0x00000118u,0x00000000u,0x00050083u,0x00000013u,0x0000011au,0x0000010fu,0x00000119u,0x0006000cu,0x00000013u,0x0000011bu,0x00000001u,0x00000004u,0x0000011au,0x0004003du,0x00000013u,0x0000011cu,0x000000cdu,0x00050081u,0x00000013u,0x0000011du,0x0000011cu,0x0000011bu,0x0003003eu,0x000000cdu,0x0000011du,0x0004003du,0x00000013u,0x0000011eu,0x000000e6u,0x0004003du,0x0000004cu,0x0000011fu,0x0000009au,0x0004003du,0x0000002eu,0x00000120u,0x00000036u,0x0004003du,0x0000002eu,0x00000121u,0x000000e0u,0x0004003du,0x0000002eu,0x00000122u,0x000000f8u,0x00050081u,0x0000002eu,0x00000123u,0x00000121u,0x00000122u,0x0004003du,0x0000002eu,0x00000124u,0x00000030u,0x00050085u,0x0000002eu,0x00000125u,0x00000123u,0x00000124u,0x00050081u,0x0000002eu,0x00000126u,0x00000120u,0x00000125u,0x00070058u,0x00000052u,0x00000127u,0x0000011fu,0x00000126u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x00000128u,0x00000127u,0x00000000u,0x00050083u,0x00000013u,0x00000129u,0x0000011eu,0x00000128u,0x0006000cu,0x00000013u,0x0000012au,0x00000001u,0x00000004u,0x00000129u,0x0004003du,0x00000013u,0x0000012bu,0x000000ceu,0x00050081u,0x00000013u,0x0000012cu,0x0000012bu,0x0000012au,0x0003003eu,0x000000ceu,0x0000012cu,0x0004003du,0x00000013u,0x0000012du,0x000000e6u,0x0004003du,0x0000004cu,0x0000012eu,0x0000009au,0x0004003du,0x0000002eu,0x0000012fu,0x00000036u,0x0004003du,0x0000002eu,0x00000130u,0x000000e0u,0x0004003du,0x0000002eu,0x00000131u,0x000000fcu,0x00050081u,0x0000002eu,0x00000132u,0x00000130u,0x00000131u,0x0004003du,0x0000002eu,0x00000133u,0x00000030u,0x00050085u,0x0000002eu,0x00000134u,0x00000132u,0x00000133u,0x00050081u,0x0000002eu,0x00000135u,0x0000012fu,0x00000134u,0x00070058u,0x00000052u,0x00000136u,0x0000012eu,0x00000135u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x00000137u,0x00000136u,0x00000000u,0x00050083u,0x00000013u,0x00000138u,0x0000012du,0x00000137u,0x0006000cu,0x00000013u,0x00000139u,0x00000001u,0x00000004u,0x00000138u,0x0004003du,0x00000013u,0x0000013au,0x000000cfu,0x00050081u,0x00000013u,0x0000013bu,0x0000013au,0x00000139u,0x0003003eu,0x000000cfu,0x0000013bu,0x000200f9u,0x000000dcu,0x000200f8u,0x000000dcu,0x0004003du,0x00000006u,0x0000013cu,0x000000d8u,0x00050080u,0x00000006u,0x0000013du,0x0000013cu,0x00000043u,0x0003003eu,0x000000d8u,0x0000013du,0x000200f9u,0x000000d9u,0x000200f8u,0x000000dbu,0x000200f9u,0x000000d4u,0x000200f8u,0x000000d4u,0x0004003du,0x00000006u,0x0000013eu,0x000000d0u,0x00050080u,0x00000006u,0x0000013fu,0x0000013eu,0x00000043u,0x0003003eu,0x000000d0u,0x0000013fu,0x000200f9u,0x000000d1u,0x000200f8u,0x000000d3u,0x0004003du,0x00000013u,0x00000140u,0x000000ccu,0x00050081u,0x00000013u,0x00000141u,0x00000140u,0x000000afu,0x0003003eu,0x000000ccu,0x00000141u,0x0004003du,0x00000013u,0x00000142u,0x000000cdu,0x00050081u,0x00000013u,0x00000143u,0x00000142u,0x000000afu,0x0003003eu,0x000000cdu,0x00000143u,0x0004003du,0x00000013u,0x00000144u,0x000000ceu,0x00050081u,0x00000013u,0x00000145u,0x00000144u,0x000000afu,0x0003003eu,0x000000ceu,0x00000145u,0x0004003du,0x00000013u,0x00000146u,0x000000cfu,0x00050081u,0x00000013u,0x00000147u,0x00000146u,0x000000afu,0x0003003eu,0x000000cfu,0x00000147u,0x0003003eu,0x00000148u,0x00000051u,0x0003003eu,0x00000149u,0x00000051u,0x0004003du,0x00000013u,0x0000014bu,0x000000ccu,0x0004003du,0x00000013u,0x0000014du,0x000000cau,0x00050085u,0x00000013u,0x0000014eu,0x0000014cu,0x0000014du,0x00050083u,0x00000013u,0x0000014fu,0x0000014bu,0x0000014eu,0x0004003du,0x00000013u,0x00000150u,0x000000cdu,0x00050081u,0x00000013u,0x00000151u,0x0000014fu,0x00000150u,0x0003003eu,0x0000014au,0x00000151u,0x0004003du,0x00000013u,0x00000153u,0x000000ceu,0x0004003du,0x00000013u,0x00000154u,0x000000cau,0x00050085u,0x00000013u,0x00000155u,0x0000014cu,0x00000154u,0x00050083u,0x00000013u,0x00000156u,0x00000153u,0x00000155u,0x0004003du,0x00000013u,0x00000157u,0x000000cfu,0x00050081u,0x00000013u,0x00000158u,0x00000156u,0x00000157u,0x0003003eu,0x00000152u,0x00000158u,0x0004003du,0x00000013u,0x00000159u,0x0000014au,0x000500bau,0x00000019u,0x0000015bu,0x00000159u,0x0000015au,0x000300f7u,0x0000015du,0x00000000u,0x000400fau,0x0000015bu,0x0000015cu,0x0000015du,0x000200f8u,0x0000015cu,0x0004003du,0x00000013u,0x0000015eu,0x000000ccu,0x0004003du,0x00000013u,0x0000015fu,0x000000cdu,0x00050083u,0x00000013u,0x00000160u,0x0000015eu,0x0000015fu,0x00050085u,0x00000013u,0x00000161u,0x00000039u,0x00000160u,0x0004003du,0x00000013u,0x00000162u,0x0000014au,0x00050088u,0x00000013u,0x00000163u,0x00000161u,0x00000162u,0x0008000cu,0x00000013u,0x00000165u,0x00000001u,0x0000002bu,0x00000163u,0x00000164u,0x00000039u,0x0003003eu,0x00000148u,0x00000165u,0x000200f9u,0x0000015du,0x000200f8u,0x0000015du,0x0004003du,0x00000013u,0x00000166u,0x00000152u,0x000500bau,0x00000019u,0x00000167u,0x00000166u,0x0000015au,0x000300f7u,0x00000169u,0x00000000u,0x000400fau,0x00000167u,0x00000168u,0x00000169u,0x000200f8u,0x00000168u,0x0004003du,0x00000013u,0x0000016au,0x000000ceu,0x0004003du,0x00000013u,0x0000016bu,0x000000cfu,0x00050083u,0x00000013u,0x0000016cu,0x0000016au,0x0000016bu,0x00050085u,0x00000013u,0x0000016du,0x00000039u,0x0000016cu,0x0004003du,0x00000013u,0x0000016eu,0x00000152u,0x00050088u,0x00000013u,0x0000016fu,0x0000016du,0x0000016eu,0x0008000cu,0x00000013u,0x00000170u,0x00000001u,0x0000002bu,0x0000016fu,0x00000164u,0x00000039u,0x0003003eu,0x00000149u,0x00000170u,0x000200f9u,0x00000169u,0x000200f8u,0x00000169u,0x0004003du,0x00000013u,0x00000171u,0x00000148u,0x0004003du,0x00000013u,0x00000172u,0x00000149u,0x00050050u,0x0000002eu,0x00000173u,0x00000171u,0x00000172u,0x0004003du,0x0000002eu,0x00000174u,0x0000005bu,0x00050081u,0x0000002eu,0x00000175u,0x00000174u,0x00000173u,0x0003003eu,0x0000005bu,0x00000175u,0x000200f9u,0x000000c9u,0x000200f8u,0x000000c9u,0x0004003du,0x0000002eu,0x00000177u,0x0000005bu,0x00050041u,0x00000044u,0x00000178u,0x00000042u,0x00000043u,0x0004003du,0x0000000au,0x00000179u,0x00000178u,0x00040070u,0x00000013u,0x0000017au,0x00000179u,0x0006000cu,0x00000013u,0x0000017bu,0x00000001u,0x0000001du,0x0000017au,0x0005008eu,0x0000002eu,0x0000017cu,0x00000177u,0x0000017bu,0x0003003eu,0x00000176u,0x0000017cu,0x0004003du,0x00000014u,0x0000017du,0x00000016u,0x0004003du,0x00000007u,0x0000017eu,0x00000009u,0x0004003du,0x0000002eu,0x0000017fu,0x00000176u,0x00050051u,0x00000013u,0x00000180u,0x0000017fu,0x00000000u,0x00050051u,0x00000013u,0x00000181u,0x0000017fu,0x00000001u,0x00070050u,0x00000052u,0x00000182u,0x00000180u,0x00000181u,0x00000051u,0x00000051u,0x00040063u,0x0000017du,0x0000017eu,0x00000182u,0x000100fdu,0x00010038u}; -static const size_t OF3_FLOW_LEN = 2253; +static const uint32_t OF3_FLOW_SPV[] = { + 0x07230203u,0x00010300u,0x0008000bu,0x000001feu,0x00000000u,0x00020011u,0x00000001u,0x00020011u, + 0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu, + 0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000000du, + 0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u, + 0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00080005u,0x0000000du,0x475f6c67u, + 0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00040005u,0x00000016u,0x6f6c4675u, + 0x00000077u,0x00030005u,0x00000040u,0x00000055u,0x00060006u,0x00000040u,0x00000000u,0x776f6c66u, + 0x6c616353u,0x00000065u,0x00050006u,0x00000040u,0x00000001u,0x6576656cu,0x0000006cu,0x00050006u, + 0x00000040u,0x00000002u,0x30646170u,0x00000000u,0x00050006u,0x00000040u,0x00000003u,0x31646170u, + 0x00000000u,0x00030005u,0x00000042u,0x00000000u,0x00050005u,0x0000004eu,0x65725075u,0x74636964u, + 0x0000726fu,0x00050005u,0x0000007bu,0x76657270u,0x63746150u,0x00000068u,0x00050005u,0x0000007du, + 0x6d754c75u,0x65725061u,0x00000076u,0x00050005u,0x000000c9u,0x6d754c75u,0x72754361u,0x00000072u, + 0x00040047u,0x0000000du,0x0000000bu,0x0000001cu,0x00030047u,0x00000016u,0x00000019u,0x00040047u, + 0x00000016u,0x00000021u,0x00000030u,0x00040047u,0x00000016u,0x00000022u,0x00000000u,0x00030047u, + 0x00000040u,0x00000002u,0x00050048u,0x00000040u,0x00000000u,0x00000023u,0x00000000u,0x00050048u, + 0x00000040u,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x00000040u,0x00000002u,0x00000023u, + 0x00000008u,0x00050048u,0x00000040u,0x00000003u,0x00000023u,0x0000000cu,0x00040047u,0x00000042u, + 0x00000021u,0x00000000u,0x00040047u,0x00000042u,0x00000022u,0x00000000u,0x00040047u,0x0000004eu, + 0x00000021u,0x00000022u,0x00040047u,0x0000004eu,0x00000022u,0x00000000u,0x00040047u,0x0000007du, + 0x00000021u,0x00000020u,0x00040047u,0x0000007du,0x00000022u,0x00000000u,0x00040047u,0x000000c9u, + 0x00000021u,0x00000021u,0x00040047u,0x000000c9u,0x00000022u,0x00000000u,0x00040047u,0x000001b3u, + 0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u, + 0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040015u, + 0x0000000au,0x00000020u,0x00000000u,0x00040017u,0x0000000bu,0x0000000au,0x00000003u,0x00040020u, + 0x0000000cu,0x00000001u,0x0000000bu,0x0004003bu,0x0000000cu,0x0000000du,0x00000001u,0x00040017u, + 0x0000000eu,0x0000000au,0x00000002u,0x00030016u,0x00000013u,0x00000020u,0x00090019u,0x00000014u, + 0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000002u,0x00040020u, + 0x00000015u,0x00000000u,0x00000014u,0x0004003bu,0x00000015u,0x00000016u,0x00000000u,0x00020014u, + 0x00000019u,0x0004002bu,0x0000000au,0x0000001au,0x00000000u,0x0004002bu,0x0000000au,0x00000024u, + 0x00000001u,0x00040017u,0x0000002eu,0x00000013u,0x00000002u,0x0004002bu,0x00000013u,0x00000031u, + 0x3f800000u,0x0004002bu,0x00000013u,0x00000039u,0x3f000000u,0x00040020u,0x0000003eu,0x00000007u, + 0x00000013u,0x0006001eu,0x00000040u,0x00000013u,0x0000000au,0x0000000au,0x0000000au,0x00040020u, + 0x00000041u,0x00000002u,0x00000040u,0x0004003bu,0x00000041u,0x00000042u,0x00000002u,0x0004002bu, + 0x00000006u,0x00000043u,0x00000001u,0x00040020u,0x00000044u,0x00000002u,0x0000000au,0x00090019u, + 0x0000004bu,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u, + 0x0003001bu,0x0000004cu,0x0000004bu,0x00040020u,0x0000004du,0x00000000u,0x0000004cu,0x0004003bu, + 0x0000004du,0x0000004eu,0x00000000u,0x0004002bu,0x00000013u,0x00000051u,0x00000000u,0x00040017u, + 0x00000052u,0x00000013u,0x00000004u,0x0004002bu,0x00000006u,0x0000005au,0xffffffffu,0x0004002bu, + 0x00000006u,0x0000006du,0x00000003u,0x0004002bu,0x0000000au,0x00000078u,0x00000009u,0x0004001cu, + 0x00000079u,0x00000013u,0x00000078u,0x00040020u,0x0000007au,0x00000007u,0x00000079u,0x0004003bu, + 0x0000004du,0x0000007du,0x00000000u,0x0004002bu,0x00000013u,0x0000008cu,0x7f7fffffu,0x0004002bu, + 0x00000006u,0x00000090u,0xfffffffdu,0x0004003bu,0x0000004du,0x000000c9u,0x00000000u,0x0004002bu, + 0x00000013u,0x000000deu,0x3bc49ba6u,0x0004002bu,0x00000013u,0x00000120u,0xbf800000u,0x0005002cu, + 0x0000002eu,0x00000121u,0x00000120u,0x00000051u,0x0005002cu,0x0000002eu,0x00000125u,0x00000031u, + 0x00000051u,0x0005002cu,0x0000002eu,0x00000129u,0x00000051u,0x00000120u,0x0005002cu,0x0000002eu, + 0x0000012du,0x00000051u,0x00000031u,0x0004002bu,0x00000013u,0x0000017bu,0x40000000u,0x0004002bu, + 0x00000013u,0x00000189u,0x358637bdu,0x0004002bu,0x00000013u,0x00000193u,0xbf000000u,0x0004002bu, + 0x0000000au,0x000001b2u,0x00000010u,0x0006002cu,0x0000000bu,0x000001b3u,0x000001b2u,0x000001b2u, + 0x00000024u,0x0005002cu,0x0000002eu,0x000001efu,0x00000031u,0x00000031u,0x0005002cu,0x0000002eu, + 0x000001f0u,0x00000039u,0x00000039u,0x00040017u,0x000001fbu,0x00000019u,0x00000002u,0x00050036u, + 0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x0000007au, + 0x0000007bu,0x00000007u,0x000300f7u,0x000001b4u,0x00000000u,0x000300fbu,0x0000001au,0x000001b5u, + 0x000200f8u,0x000001b5u,0x0004003du,0x0000000bu,0x0000000fu,0x0000000du,0x0007004fu,0x0000000eu, + 0x00000010u,0x0000000fu,0x0000000fu,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x00000011u, + 0x00000010u,0x0004003du,0x00000014u,0x00000017u,0x00000016u,0x00040068u,0x00000007u,0x00000018u, + 0x00000017u,0x00050051u,0x00000006u,0x0000001du,0x00000011u,0x00000000u,0x00050051u,0x00000006u, + 0x0000001fu,0x00000018u,0x00000000u,0x000500afu,0x00000019u,0x00000020u,0x0000001du,0x0000001fu, + 0x000400a8u,0x00000019u,0x00000021u,0x00000020u,0x000300f7u,0x00000023u,0x00000000u,0x000400fau, + 0x00000021u,0x00000022u,0x00000023u,0x000200f8u,0x00000022u,0x00050051u,0x00000006u,0x00000026u, + 0x00000011u,0x00000001u,0x00050051u,0x00000006u,0x00000028u,0x00000018u,0x00000001u,0x000500afu, + 0x00000019u,0x00000029u,0x00000026u,0x00000028u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u, + 0x000700f5u,0x00000019u,0x0000002au,0x00000020u,0x000001b5u,0x00000029u,0x00000022u,0x000300f7u, + 0x0000002cu,0x00000000u,0x000400fau,0x0000002au,0x0000002bu,0x0000002cu,0x000200f8u,0x0000002bu, + 0x000200f9u,0x000001b4u,0x000200f8u,0x0000002cu,0x0004006fu,0x0000002eu,0x00000033u,0x00000018u, + 0x00050088u,0x0000002eu,0x00000035u,0x000001efu,0x00000033u,0x0004006fu,0x0000002eu,0x00000038u, + 0x00000011u,0x00050081u,0x0000002eu,0x0000003bu,0x00000038u,0x000001f0u,0x00050085u,0x0000002eu, + 0x0000003du,0x0000003bu,0x00000035u,0x00050041u,0x00000044u,0x00000045u,0x00000042u,0x00000043u, + 0x0004003du,0x0000000au,0x00000046u,0x00000045u,0x00040070u,0x00000013u,0x00000047u,0x00000046u, + 0x0004007fu,0x00000013u,0x00000048u,0x00000047u,0x0006000cu,0x00000013u,0x00000049u,0x00000001u, + 0x0000001du,0x00000048u,0x0004003du,0x0000004cu,0x0000004fu,0x0000004eu,0x00070058u,0x00000052u, + 0x00000053u,0x0000004fu,0x0000003du,0x00000002u,0x00000051u,0x0007004fu,0x0000002eu,0x00000054u, + 0x00000053u,0x00000053u,0x00000000u,0x00000001u,0x0005008eu,0x0000002eu,0x00000058u,0x00000054u, + 0x00000049u,0x000200f9u,0x0000005bu,0x000200f8u,0x0000005bu,0x000700f5u,0x00000006u,0x000001beu, + 0x0000005au,0x0000002cu,0x0000008au,0x0000005eu,0x000500b3u,0x00000019u,0x00000061u,0x000001beu, + 0x00000043u,0x000400f6u,0x0000005du,0x0000005eu,0x00000000u,0x000400fau,0x00000061u,0x0000005cu, + 0x0000005du,0x000200f8u,0x0000005cu,0x000200f9u,0x00000063u,0x000200f8u,0x00000063u,0x000700f5u, + 0x00000006u,0x000001e4u,0x0000005au,0x0000005cu,0x00000070u,0x00000064u,0x000500b3u,0x00000019u, + 0x00000069u,0x000001e4u,0x00000043u,0x000400f6u,0x00000065u,0x00000064u,0x00000000u,0x000400fau, + 0x00000069u,0x00000064u,0x00000065u,0x000200f8u,0x00000064u,0x00050080u,0x00000006u,0x0000006cu, + 0x000001beu,0x00000043u,0x00050084u,0x00000006u,0x0000006eu,0x0000006cu,0x0000006du,0x00050080u, + 0x00000006u,0x00000070u,0x000001e4u,0x00000043u,0x00050080u,0x00000006u,0x00000071u,0x0000006eu, + 0x00000070u,0x0004006fu,0x00000013u,0x00000074u,0x000001e4u,0x0004006fu,0x00000013u,0x00000076u, + 0x000001beu,0x00050050u,0x0000002eu,0x00000077u,0x00000074u,0x00000076u,0x0004003du,0x0000004cu, + 0x0000007eu,0x0000007du,0x00050085u,0x0000002eu,0x00000082u,0x00000077u,0x00000035u,0x00050081u, + 0x0000002eu,0x00000083u,0x0000003du,0x00000082u,0x00070058u,0x00000052u,0x00000084u,0x0000007eu, + 0x00000083u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x00000085u,0x00000084u,0x00000000u, + 0x00050041u,0x0000003eu,0x00000086u,0x0000007bu,0x00000071u,0x0003003eu,0x00000086u,0x00000085u, + 0x000200f9u,0x00000063u,0x000200f8u,0x00000065u,0x000200f9u,0x0000005eu,0x000200f8u,0x0000005eu, + 0x00050080u,0x00000006u,0x0000008au,0x000001beu,0x00000043u,0x000200f9u,0x0000005bu,0x000200f8u, + 0x0000005du,0x000200f9u,0x00000091u,0x000200f8u,0x00000091u,0x000700f5u,0x0000002eu,0x000001cfu, + 0x00000058u,0x0000005du,0x000001e6u,0x00000094u,0x000700f5u,0x00000013u,0x000001c0u,0x0000008cu, + 0x0000005du,0x000001dfu,0x00000094u,0x000700f5u,0x00000006u,0x000001bfu,0x00000090u,0x0000005du, + 0x000000f3u,0x00000094u,0x000500b3u,0x00000019u,0x00000097u,0x000001bfu,0x0000006du,0x000400f6u, + 0x00000093u,0x00000094u,0x00000000u,0x000400fau,0x00000097u,0x00000092u,0x00000093u,0x000200f8u, + 0x00000092u,0x000200f9u,0x00000099u,0x000200f8u,0x00000099u,0x000700f5u,0x00000013u,0x000001dfu, + 0x000001c0u,0x00000092u,0x000001fau,0x0000009cu,0x000700f5u,0x00000006u,0x000001d8u,0x00000090u, + 0x00000092u,0x000000f1u,0x0000009cu,0x000700f5u,0x0000002eu,0x000001e6u,0x000001cfu,0x00000092u, + 0x000001fdu,0x0000009cu,0x000500b3u,0x00000019u,0x0000009fu,0x000001d8u,0x0000006du,0x000400f6u, + 0x0000009bu,0x0000009cu,0x00000000u,0x000400fau,0x0000009fu,0x0000009au,0x0000009bu,0x000200f8u, + 0x0000009au,0x0004006fu,0x00000013u,0x000000a3u,0x000001d8u,0x0004006fu,0x00000013u,0x000000a5u, + 0x000001bfu,0x00050050u,0x0000002eu,0x000000a6u,0x000000a3u,0x000000a5u,0x00050081u,0x0000002eu, + 0x000000a7u,0x00000058u,0x000000a6u,0x000200f9u,0x000000aau,0x000200f8u,0x000000aau,0x000700f5u, + 0x00000013u,0x000001ddu,0x00000051u,0x0000009au,0x000001e3u,0x000000adu,0x000700f5u,0x00000006u, + 0x000001dau,0x0000005au,0x0000009au,0x000000ddu,0x000000adu,0x000500b3u,0x00000019u,0x000000b0u, + 0x000001dau,0x00000043u,0x000400f6u,0x000000acu,0x000000adu,0x00000000u,0x000400fau,0x000000b0u, + 0x000000abu,0x000000acu,0x000200f8u,0x000000abu,0x000200f9u,0x000000b2u,0x000200f8u,0x000000b2u, + 0x000700f5u,0x00000013u,0x000001e3u,0x000001ddu,0x000000abu,0x000000d9u,0x000000b3u,0x000700f5u, + 0x00000006u,0x000001e1u,0x0000005au,0x000000abu,0x000000c4u,0x000000b3u,0x000500b3u,0x00000019u, + 0x000000b8u,0x000001e1u,0x00000043u,0x000400f6u,0x000000b4u,0x000000b3u,0x00000000u,0x000400fau, + 0x000000b8u,0x000000b3u,0x000000b4u,0x000200f8u,0x000000b3u,0x0004006fu,0x00000013u,0x000000bbu, + 0x000001e1u,0x0004006fu,0x00000013u,0x000000bdu,0x000001dau,0x00050050u,0x0000002eu,0x000000beu, + 0x000000bbu,0x000000bdu,0x00050080u,0x00000006u,0x000000c1u,0x000001dau,0x00000043u,0x00050084u, + 0x00000006u,0x000000c2u,0x000000c1u,0x0000006du,0x00050080u,0x00000006u,0x000000c4u,0x000001e1u, + 0x00000043u,0x00050080u,0x00000006u,0x000000c5u,0x000000c2u,0x000000c4u,0x00050041u,0x0000003eu, + 0x000000c6u,0x0000007bu,0x000000c5u,0x0004003du,0x00000013u,0x000000c7u,0x000000c6u,0x0004003du, + 0x0000004cu,0x000000cau,0x000000c9u,0x00050081u,0x0000002eu,0x000000ceu,0x000000beu,0x000000a7u, + 0x00050085u,0x0000002eu,0x000000d0u,0x000000ceu,0x00000035u,0x00050081u,0x0000002eu,0x000000d1u, + 0x0000003du,0x000000d0u,0x00070058u,0x00000052u,0x000000d2u,0x000000cau,0x000000d1u,0x00000002u, + 0x00000051u,0x00050051u,0x00000013u,0x000000d3u,0x000000d2u,0x00000000u,0x00050083u,0x00000013u, + 0x000000d6u,0x000000c7u,0x000000d3u,0x0006000cu,0x00000013u,0x000000d7u,0x00000001u,0x00000004u, + 0x000000d6u,0x00050081u,0x00000013u,0x000000d9u,0x000001e3u,0x000000d7u,0x000200f9u,0x000000b2u, + 0x000200f8u,0x000000b4u,0x000200f9u,0x000000adu,0x000200f8u,0x000000adu,0x00050080u,0x00000006u, + 0x000000ddu,0x000001dau,0x00000043u,0x000200f9u,0x000000aau,0x000200f8u,0x000000acu,0x0006000cu, + 0x00000013u,0x000000e1u,0x00000001u,0x00000004u,0x000000a3u,0x0006000cu,0x00000013u,0x000000e4u, + 0x00000001u,0x00000004u,0x000000a5u,0x00050081u,0x00000013u,0x000000e5u,0x000000e1u,0x000000e4u, + 0x00050085u,0x00000013u,0x000000e6u,0x000000deu,0x000000e5u,0x00050081u,0x00000013u,0x000000e8u, + 0x000001ddu,0x000000e6u,0x000500b8u,0x00000019u,0x000000ebu,0x000000e8u,0x000001dfu,0x000600a9u, + 0x00000013u,0x000001fau,0x000000ebu,0x000000e8u,0x000001dfu,0x00050050u,0x000001fbu,0x000001fcu, + 0x000000ebu,0x000000ebu,0x000600a9u,0x0000002eu,0x000001fdu,0x000001fcu,0x000000a7u,0x000001e6u, + 0x000200f9u,0x0000009cu,0x000200f8u,0x0000009cu,0x00050080u,0x00000006u,0x000000f1u,0x000001d8u, + 0x00000043u,0x000200f9u,0x00000099u,0x000200f8u,0x0000009bu,0x000200f9u,0x00000094u,0x000200f8u, + 0x00000094u,0x00050080u,0x00000006u,0x000000f3u,0x000001bfu,0x00000043u,0x000200f9u,0x00000091u, + 0x000200f8u,0x00000093u,0x000500aau,0x00000019u,0x000000f6u,0x00000046u,0x0000001au,0x000300f7u, + 0x000000f8u,0x00000000u,0x000400fau,0x000000f6u,0x000000f7u,0x000000f8u,0x000200f8u,0x000000f7u, + 0x000200f9u,0x00000100u,0x000200f8u,0x00000100u,0x000700f5u,0x00000013u,0x000001c5u,0x00000051u, + 0x000000f7u,0x000001d7u,0x00000103u,0x000700f5u,0x00000013u,0x000001c4u,0x00000051u,0x000000f7u, + 0x000001d6u,0x00000103u,0x000700f5u,0x00000013u,0x000001c3u,0x00000051u,0x000000f7u,0x000001d5u, + 0x00000103u,0x000700f5u,0x00000013u,0x000001c2u,0x00000051u,0x000000f7u,0x000001d4u,0x00000103u, + 0x000700f5u,0x00000006u,0x000001c1u,0x0000005au,0x000000f7u,0x0000016eu,0x00000103u,0x000500b3u, + 0x00000019u,0x00000106u,0x000001c1u,0x00000043u,0x000400f6u,0x00000102u,0x00000103u,0x00000000u, + 0x000400fau,0x00000106u,0x00000101u,0x00000102u,0x000200f8u,0x00000101u,0x000200f9u,0x00000108u, + 0x000200f8u,0x00000108u,0x000700f5u,0x00000013u,0x000001d7u,0x000001c5u,0x00000101u,0x0000016au, + 0x00000109u,0x000700f5u,0x00000013u,0x000001d6u,0x000001c4u,0x00000101u,0x0000015bu,0x00000109u, + 0x000700f5u,0x00000013u,0x000001d5u,0x000001c3u,0x00000101u,0x0000014cu,0x00000109u,0x000700f5u, + 0x00000013u,0x000001d4u,0x000001c2u,0x00000101u,0x0000013du,0x00000109u,0x000700f5u,0x00000006u, + 0x000001d1u,0x0000005au,0x00000101u,0x0000011au,0x00000109u,0x000500b3u,0x00000019u,0x0000010eu, + 0x000001d1u,0x00000043u,0x000400f6u,0x0000010au,0x00000109u,0x00000000u,0x000400fau,0x0000010eu, + 0x00000109u,0x0000010au,0x000200f8u,0x00000109u,0x0004006fu,0x00000013u,0x00000111u,0x000001d1u, + 0x0004006fu,0x00000013u,0x00000113u,0x000001c1u,0x00050050u,0x0000002eu,0x00000114u,0x00000111u, + 0x00000113u,0x00050080u,0x00000006u,0x00000117u,0x000001c1u,0x00000043u,0x00050084u,0x00000006u, + 0x00000118u,0x00000117u,0x0000006du,0x00050080u,0x00000006u,0x0000011au,0x000001d1u,0x00000043u, + 0x00050080u,0x00000006u,0x0000011bu,0x00000118u,0x0000011au,0x00050041u,0x0000003eu,0x0000011cu, + 0x0000007bu,0x0000011bu,0x0004003du,0x00000013u,0x0000011du,0x0000011cu,0x00050081u,0x0000002eu, + 0x00000122u,0x000001cfu,0x00000121u,0x00050081u,0x0000002eu,0x00000126u,0x000001cfu,0x00000125u, + 0x00050081u,0x0000002eu,0x0000012au,0x000001cfu,0x00000129u,0x00050081u,0x0000002eu,0x0000012eu, + 0x000001cfu,0x0000012du,0x0004003du,0x0000004cu,0x00000130u,0x000000c9u,0x00050081u,0x0000002eu, + 0x00000134u,0x00000114u,0x00000122u,0x00050085u,0x0000002eu,0x00000136u,0x00000134u,0x00000035u, + 0x00050081u,0x0000002eu,0x00000137u,0x0000003du,0x00000136u,0x00070058u,0x00000052u,0x00000138u, + 0x00000130u,0x00000137u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x00000139u,0x00000138u, + 0x00000000u,0x00050083u,0x00000013u,0x0000013au,0x0000011du,0x00000139u,0x0006000cu,0x00000013u, + 0x0000013bu,0x00000001u,0x00000004u,0x0000013au,0x00050081u,0x00000013u,0x0000013du,0x000001d4u, + 0x0000013bu,0x0004003du,0x0000004cu,0x0000013fu,0x000000c9u,0x00050081u,0x0000002eu,0x00000143u, + 0x00000114u,0x00000126u,0x00050085u,0x0000002eu,0x00000145u,0x00000143u,0x00000035u,0x00050081u, + 0x0000002eu,0x00000146u,0x0000003du,0x00000145u,0x00070058u,0x00000052u,0x00000147u,0x0000013fu, + 0x00000146u,0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x00000148u,0x00000147u,0x00000000u, + 0x00050083u,0x00000013u,0x00000149u,0x0000011du,0x00000148u,0x0006000cu,0x00000013u,0x0000014au, + 0x00000001u,0x00000004u,0x00000149u,0x00050081u,0x00000013u,0x0000014cu,0x000001d5u,0x0000014au, + 0x0004003du,0x0000004cu,0x0000014eu,0x000000c9u,0x00050081u,0x0000002eu,0x00000152u,0x00000114u, + 0x0000012au,0x00050085u,0x0000002eu,0x00000154u,0x00000152u,0x00000035u,0x00050081u,0x0000002eu, + 0x00000155u,0x0000003du,0x00000154u,0x00070058u,0x00000052u,0x00000156u,0x0000014eu,0x00000155u, + 0x00000002u,0x00000051u,0x00050051u,0x00000013u,0x00000157u,0x00000156u,0x00000000u,0x00050083u, + 0x00000013u,0x00000158u,0x0000011du,0x00000157u,0x0006000cu,0x00000013u,0x00000159u,0x00000001u, + 0x00000004u,0x00000158u,0x00050081u,0x00000013u,0x0000015bu,0x000001d6u,0x00000159u,0x0004003du, + 0x0000004cu,0x0000015du,0x000000c9u,0x00050081u,0x0000002eu,0x00000161u,0x00000114u,0x0000012eu, + 0x00050085u,0x0000002eu,0x00000163u,0x00000161u,0x00000035u,0x00050081u,0x0000002eu,0x00000164u, + 0x0000003du,0x00000163u,0x00070058u,0x00000052u,0x00000165u,0x0000015du,0x00000164u,0x00000002u, + 0x00000051u,0x00050051u,0x00000013u,0x00000166u,0x00000165u,0x00000000u,0x00050083u,0x00000013u, + 0x00000167u,0x0000011du,0x00000166u,0x0006000cu,0x00000013u,0x00000168u,0x00000001u,0x00000004u, + 0x00000167u,0x00050081u,0x00000013u,0x0000016au,0x000001d7u,0x00000168u,0x000200f9u,0x00000108u, + 0x000200f8u,0x0000010au,0x000200f9u,0x00000103u,0x000200f8u,0x00000103u,0x00050080u,0x00000006u, + 0x0000016eu,0x000001c1u,0x00000043u,0x000200f9u,0x00000100u,0x000200f8u,0x00000102u,0x00050081u, + 0x00000013u,0x00000170u,0x000001c2u,0x000000deu,0x00050081u,0x00000013u,0x00000172u,0x000001c3u, + 0x000000deu,0x00050081u,0x00000013u,0x00000174u,0x000001c4u,0x000000deu,0x00050081u,0x00000013u, + 0x00000176u,0x000001c5u,0x000000deu,0x00050085u,0x00000013u,0x0000017du,0x0000017bu,0x000001c0u, + 0x00050083u,0x00000013u,0x0000017eu,0x00000170u,0x0000017du,0x00050081u,0x00000013u,0x00000180u, + 0x0000017eu,0x00000172u,0x00050083u,0x00000013u,0x00000185u,0x00000174u,0x0000017du,0x00050081u, + 0x00000013u,0x00000187u,0x00000185u,0x00000176u,0x000500bau,0x00000019u,0x0000018au,0x00000180u, + 0x00000189u,0x000300f7u,0x0000018cu,0x00000000u,0x000400fau,0x0000018au,0x0000018bu,0x0000018cu, + 0x000200f8u,0x0000018bu,0x00050083u,0x00000013u,0x000001f8u,0x000001c2u,0x000001c3u,0x00050085u, + 0x00000013u,0x00000190u,0x00000039u,0x000001f8u,0x00050088u,0x00000013u,0x00000192u,0x00000190u, + 0x00000180u,0x0008000cu,0x00000013u,0x00000194u,0x00000001u,0x0000002bu,0x00000192u,0x00000193u, + 0x00000039u,0x000200f9u,0x0000018cu,0x000200f8u,0x0000018cu,0x000700f5u,0x00000013u,0x000001c9u, + 0x00000051u,0x00000102u,0x00000194u,0x0000018bu,0x000500bau,0x00000019u,0x00000196u,0x00000187u, + 0x00000189u,0x000300f7u,0x00000198u,0x00000000u,0x000400fau,0x00000196u,0x00000197u,0x00000198u, + 0x000200f8u,0x00000197u,0x00050083u,0x00000013u,0x000001f9u,0x000001c4u,0x000001c5u,0x00050085u, + 0x00000013u,0x0000019cu,0x00000039u,0x000001f9u,0x00050088u,0x00000013u,0x0000019eu,0x0000019cu, + 0x00000187u,0x0008000cu,0x00000013u,0x0000019fu,0x00000001u,0x0000002bu,0x0000019eu,0x00000193u, + 0x00000039u,0x000200f9u,0x00000198u,0x000200f8u,0x00000198u,0x000700f5u,0x00000013u,0x000001cau, + 0x00000051u,0x0000018cu,0x0000019fu,0x00000197u,0x00050050u,0x0000002eu,0x000001a2u,0x000001c9u, + 0x000001cau,0x00050081u,0x0000002eu,0x000001a4u,0x000001cfu,0x000001a2u,0x000200f9u,0x000000f8u, + 0x000200f8u,0x000000f8u,0x000700f5u,0x0000002eu,0x000001d0u,0x000001cfu,0x00000093u,0x000001a4u, + 0x00000198u,0x0006000cu,0x00000013u,0x000001aau,0x00000001u,0x0000001du,0x00000047u,0x0005008eu, + 0x0000002eu,0x000001abu,0x000001d0u,0x000001aau,0x0004003du,0x00000014u,0x000001acu,0x00000016u, + 0x00050051u,0x00000013u,0x000001afu,0x000001abu,0x00000000u,0x00050051u,0x00000013u,0x000001b0u, + 0x000001abu,0x00000001u,0x00070050u,0x00000052u,0x000001b1u,0x000001afu,0x000001b0u,0x00000051u, + 0x00000051u,0x00040063u,0x000001acu,0x00000011u,0x000001b1u,0x000200f9u,0x000001b4u,0x000200f8u, + 0x000001b4u,0x000100fdu,0x00010038u +}; +static const size_t OF3_FLOW_LEN = 1651; static const uint32_t OF3_EXPAND_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000124u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x00000049u,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00080005u,0x0000000eu,0x3564656du,0x3b316628u,0x663b3166u,0x31663b31u,0x3b31663bu,0x00000000u,0x00030005u,0x00000009u,0x00000061u,0x00030005u,0x0000000au,0x00000062u,0x00030005u,0x0000000bu,0x00000063u,0x00030005u,0x0000000cu,0x00000064u,0x00030005u,0x0000000du,0x00000065u,0x00030005u,0x00000010u,0x00000078u,0x00030005u,0x00000034u,0x00000079u,0x00030005u,0x00000045u,0x00646967u,0x00080005u,0x00000049u,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x0000004eu,0x006d6964u,0x00040005u,0x00000051u,0x64774675u,0x00000000u,0x00030005u,0x0000006bu,0x00007675u,0x00030005u,0x00000074u,0x00007366u,0x00050005u,0x00000079u,0x6f6c4675u,0x6e694677u,0x00000065u,0x00030005u,0x00000081u,0x00000063u,0x00030005u,0x00000088u,0x00006d78u,0x00030005u,0x00000091u,0x00007078u,0x00030005u,0x0000009au,0x00006d79u,0x00030005u,0x000000a3u,0x00007079u,0x00030005u,0x000000acu,0x00000064u,0x00040005u,0x000000adu,0x61726170u,0x0000006du,0x00040005u,0x000000b0u,0x61726170u,0x0000006du,0x00040005u,0x000000b3u,0x61726170u,0x0000006du,0x00040005u,0x000000b6u,0x61726170u,0x0000006du,0x00040005u,0x000000b9u,0x61726170u,0x0000006du,0x00040005u,0x000000bdu,0x61726170u,0x0000006du,0x00040005u,0x000000c0u,0x61726170u,0x0000006du,0x00040005u,0x000000c3u,0x61726170u,0x0000006du,0x00040005u,0x000000c6u,0x61726170u,0x0000006du,0x00040005u,0x000000c9u,0x61726170u,0x0000006du,0x00030005u,0x000000ceu,0x00000071u,0x00030005u,0x000000d2u,0x00787067u,0x00030005u,0x000000d3u,0x00004d47u,0x00050006u,0x000000d3u,0x00000000u,0x694c6d67u,0x0000006eu,0x00050006u,0x000000d3u,0x00000001u,0x694c6d67u,0x0000546eu,0x00050006u,0x000000d3u,0x00000002u,0x70416d67u,0x00000070u,0x00050006u,0x000000d3u,0x00000003u,0x70416d67u,0x00005470u,0x00030005u,0x000000d5u,0x00000000u,0x00030005u,0x000000fdu,0x00003241u,0x00040005u,0x0000010bu,0x6c6c7566u,0x00000000u,0x00040005u,0x00000117u,0x64774275u,0x00000000u,0x00030005u,0x00000121u,0x00000055u,0x00060006u,0x00000121u,0x00000000u,0x776f6c66u,0x6c616353u,0x00000065u,0x00050006u,0x00000121u,0x00000001u,0x6576656cu,0x0000006cu,0x00050006u,0x00000121u,0x00000002u,0x30646170u,0x00000000u,0x00050006u,0x00000121u,0x00000003u,0x31646170u,0x00000000u,0x00030005u,0x00000123u,0x00000000u,0x00040047u,0x00000049u,0x0000000bu,0x0000001cu,0x00030047u,0x00000051u,0x00000019u,0x00040047u,0x00000051u,0x00000021u,0x00000030u,0x00040047u,0x00000051u,0x00000022u,0x00000000u,0x00040047u,0x00000079u,0x00000021u,0x00000020u,0x00040047u,0x00000079u,0x00000022u,0x00000000u,0x00030047u,0x000000d3u,0x00000002u,0x00050048u,0x000000d3u,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x000000d3u,0x00000001u,0x00000023u,0x00000010u,0x00050048u,0x000000d3u,0x00000002u,0x00000023u,0x00000020u,0x00050048u,0x000000d3u,0x00000003u,0x00000023u,0x00000030u,0x00040047u,0x000000d5u,0x00000021u,0x00000001u,0x00040047u,0x000000d5u,0x00000022u,0x00000000u,0x00030047u,0x00000117u,0x00000019u,0x00040047u,0x00000117u,0x00000021u,0x00000031u,0x00040047u,0x00000117u,0x00000022u,0x00000000u,0x00040047u,0x00000120u,0x0000000bu,0x00000019u,0x00030047u,0x00000121u,0x00000002u,0x00050048u,0x00000121u,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x00000121u,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x00000121u,0x00000002u,0x00000023u,0x00000008u,0x00050048u,0x00000121u,0x00000003u,0x00000023u,0x0000000cu,0x00040047u,0x00000123u,0x00000021u,0x00000000u,0x00040047u,0x00000123u,0x00000022u,0x00000000u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00030016u,0x00000006u,0x00000020u,0x00040020u,0x00000007u,0x00000007u,0x00000006u,0x00080021u,0x00000008u,0x00000006u,0x00000007u,0x00000007u,0x00000007u,0x00000007u,0x00000007u,0x00040015u,0x00000042u,0x00000020u,0x00000001u,0x00040017u,0x00000043u,0x00000042u,0x00000002u,0x00040020u,0x00000044u,0x00000007u,0x00000043u,0x00040015u,0x00000046u,0x00000020u,0x00000000u,0x00040017u,0x00000047u,0x00000046u,0x00000003u,0x00040020u,0x00000048u,0x00000001u,0x00000047u,0x0004003bu,0x00000048u,0x00000049u,0x00000001u,0x00040017u,0x0000004au,0x00000046u,0x00000002u,0x00090019u,0x0000004fu,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000002u,0x00040020u,0x00000050u,0x00000000u,0x0000004fu,0x0004003bu,0x00000050u,0x00000051u,0x00000000u,0x00020014u,0x00000054u,0x0004002bu,0x00000046u,0x00000055u,0x00000000u,0x00040020u,0x00000056u,0x00000007u,0x00000042u,0x0004002bu,0x00000046u,0x0000005fu,0x00000001u,0x00040017u,0x00000069u,0x00000006u,0x00000002u,0x00040020u,0x0000006au,0x00000007u,0x00000069u,0x0004002bu,0x00000006u,0x0000006eu,0x3f000000u,0x0004002bu,0x00000006u,0x00000075u,0x3f800000u,0x00090019u,0x00000076u,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000077u,0x00000076u,0x00040020u,0x00000078u,0x00000000u,0x00000077u,0x0004003bu,0x00000078u,0x00000079u,0x00000000u,0x0004002bu,0x00000042u,0x0000007bu,0x00000000u,0x0004002bu,0x00000006u,0x00000084u,0x00000000u,0x00040017u,0x00000085u,0x00000006u,0x00000004u,0x0006001eu,0x000000d3u,0x00000085u,0x00000085u,0x00000085u,0x00000085u,0x00040020u,0x000000d4u,0x00000002u,0x000000d3u,0x0004003bu,0x000000d4u,0x000000d5u,0x00000002u,0x0004002bu,0x00000042u,0x000000d6u,0x00000002u,0x00040020u,0x000000d7u,0x00000002u,0x00000006u,0x0004002bu,0x00000046u,0x000000ddu,0x00000002u,0x0004002bu,0x00000042u,0x000000e4u,0x00000003u,0x0004002bu,0x00000046u,0x000000edu,0x00000003u,0x00040018u,0x000000fbu,0x00000069u,0x00000002u,0x00040020u,0x000000fcu,0x00000007u,0x000000fbu,0x0004003bu,0x00000050u,0x00000117u,0x00000000u,0x0004002bu,0x00000046u,0x0000011fu,0x00000010u,0x0006002cu,0x00000047u,0x00000120u,0x0000011fu,0x0000011fu,0x0000005fu,0x0006001eu,0x00000121u,0x00000006u,0x00000046u,0x00000046u,0x00000046u,0x00040020u,0x00000122u,0x00000002u,0x00000121u,0x0004003bu,0x00000122u,0x00000123u,0x00000002u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000044u,0x00000045u,0x00000007u,0x0004003bu,0x00000044u,0x0000004eu,0x00000007u,0x0004003bu,0x0000006au,0x0000006bu,0x00000007u,0x0004003bu,0x0000006au,0x00000074u,0x00000007u,0x0004003bu,0x0000006au,0x00000081u,0x00000007u,0x0004003bu,0x0000006au,0x00000088u,0x00000007u,0x0004003bu,0x0000006au,0x00000091u,0x00000007u,0x0004003bu,0x0000006au,0x0000009au,0x00000007u,0x0004003bu,0x0000006au,0x000000a3u,0x00000007u,0x0004003bu,0x0000006au,0x000000acu,0x00000007u,0x0004003bu,0x00000007u,0x000000adu,0x00000007u,0x0004003bu,0x00000007u,0x000000b0u,0x00000007u,0x0004003bu,0x00000007u,0x000000b3u,0x00000007u,0x0004003bu,0x00000007u,0x000000b6u,0x00000007u,0x0004003bu,0x00000007u,0x000000b9u,0x00000007u,0x0004003bu,0x00000007u,0x000000bdu,0x00000007u,0x0004003bu,0x00000007u,0x000000c0u,0x00000007u,0x0004003bu,0x00000007u,0x000000c3u,0x00000007u,0x0004003bu,0x00000007u,0x000000c6u,0x00000007u,0x0004003bu,0x00000007u,0x000000c9u,0x00000007u,0x0004003bu,0x0000006au,0x000000ceu,0x00000007u,0x0004003bu,0x0000006au,0x000000d2u,0x00000007u,0x0004003bu,0x000000fcu,0x000000fdu,0x00000007u,0x0004003bu,0x0000006au,0x0000010bu,0x00000007u,0x0004003du,0x00000047u,0x0000004bu,0x00000049u,0x0007004fu,0x0000004au,0x0000004cu,0x0000004bu,0x0000004bu,0x00000000u,0x00000001u,0x0004007cu,0x00000043u,0x0000004du,0x0000004cu,0x0003003eu,0x00000045u,0x0000004du,0x0004003du,0x0000004fu,0x00000052u,0x00000051u,0x00040068u,0x00000043u,0x00000053u,0x00000052u,0x0003003eu,0x0000004eu,0x00000053u,0x00050041u,0x00000056u,0x00000057u,0x00000045u,0x00000055u,0x0004003du,0x00000042u,0x00000058u,0x00000057u,0x00050041u,0x00000056u,0x00000059u,0x0000004eu,0x00000055u,0x0004003du,0x00000042u,0x0000005au,0x00000059u,0x000500afu,0x00000054u,0x0000005bu,0x00000058u,0x0000005au,0x000400a8u,0x00000054u,0x0000005cu,0x0000005bu,0x000300f7u,0x0000005eu,0x00000000u,0x000400fau,0x0000005cu,0x0000005du,0x0000005eu,0x000200f8u,0x0000005du,0x00050041u,0x00000056u,0x00000060u,0x00000045u,0x0000005fu,0x0004003du,0x00000042u,0x00000061u,0x00000060u,0x00050041u,0x00000056u,0x00000062u,0x0000004eu,0x0000005fu,0x0004003du,0x00000042u,0x00000063u,0x00000062u,0x000500afu,0x00000054u,0x00000064u,0x00000061u,0x00000063u,0x000200f9u,0x0000005eu,0x000200f8u,0x0000005eu,0x000700f5u,0x00000054u,0x00000065u,0x0000005bu,0x00000005u,0x00000064u,0x0000005du,0x000300f7u,0x00000067u,0x00000000u,0x000400fau,0x00000065u,0x00000066u,0x00000067u,0x000200f8u,0x00000066u,0x000100fdu,0x000200f8u,0x00000067u,0x0004003du,0x00000043u,0x0000006cu,0x00000045u,0x0004006fu,0x00000069u,0x0000006du,0x0000006cu,0x00050050u,0x00000069u,0x0000006fu,0x0000006eu,0x0000006eu,0x00050081u,0x00000069u,0x00000070u,0x0000006du,0x0000006fu,0x0004003du,0x00000043u,0x00000071u,0x0000004eu,0x0004006fu,0x00000069u,0x00000072u,0x00000071u,0x00050088u,0x00000069u,0x00000073u,0x00000070u,0x00000072u,0x0003003eu,0x0000006bu,0x00000073u,0x0004003du,0x00000077u,0x0000007au,0x00000079u,0x00040064u,0x00000076u,0x0000007cu,0x0000007au,0x00050067u,0x00000043u,0x0000007du,0x0000007cu,0x0000007bu,0x0004006fu,0x00000069u,0x0000007eu,0x0000007du,0x00050050u,0x00000069u,0x0000007fu,0x00000075u,0x00000075u,0x00050088u,0x00000069u,0x00000080u,0x0000007fu,0x0000007eu,0x0003003eu,0x00000074u,0x00000080u,0x0004003du,0x00000077u,0x00000082u,0x00000079u,0x0004003du,0x00000069u,0x00000083u,0x0000006bu,0x00070058u,0x00000085u,0x00000086u,0x00000082u,0x00000083u,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x00000087u,0x00000086u,0x00000086u,0x00000000u,0x00000001u,0x0003003eu,0x00000081u,0x00000087u,0x0004003du,0x00000077u,0x00000089u,0x00000079u,0x0004003du,0x00000069u,0x0000008au,0x0000006bu,0x00050041u,0x00000007u,0x0000008bu,0x00000074u,0x00000055u,0x0004003du,0x00000006u,0x0000008cu,0x0000008bu,0x00050050u,0x00000069u,0x0000008du,0x0000008cu,0x00000084u,0x00050083u,0x00000069u,0x0000008eu,0x0000008au,0x0000008du,0x00070058u,0x00000085u,0x0000008fu,0x00000089u,0x0000008eu,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x00000090u,0x0000008fu,0x0000008fu,0x00000000u,0x00000001u,0x0003003eu,0x00000088u,0x00000090u,0x0004003du,0x00000077u,0x00000092u,0x00000079u,0x0004003du,0x00000069u,0x00000093u,0x0000006bu,0x00050041u,0x00000007u,0x00000094u,0x00000074u,0x00000055u,0x0004003du,0x00000006u,0x00000095u,0x00000094u,0x00050050u,0x00000069u,0x00000096u,0x00000095u,0x00000084u,0x00050081u,0x00000069u,0x00000097u,0x00000093u,0x00000096u,0x00070058u,0x00000085u,0x00000098u,0x00000092u,0x00000097u,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x00000099u,0x00000098u,0x00000098u,0x00000000u,0x00000001u,0x0003003eu,0x00000091u,0x00000099u,0x0004003du,0x00000077u,0x0000009bu,0x00000079u,0x0004003du,0x00000069u,0x0000009cu,0x0000006bu,0x00050041u,0x00000007u,0x0000009du,0x00000074u,0x0000005fu,0x0004003du,0x00000006u,0x0000009eu,0x0000009du,0x00050050u,0x00000069u,0x0000009fu,0x00000084u,0x0000009eu,0x00050083u,0x00000069u,0x000000a0u,0x0000009cu,0x0000009fu,0x00070058u,0x00000085u,0x000000a1u,0x0000009bu,0x000000a0u,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x000000a2u,0x000000a1u,0x000000a1u,0x00000000u,0x00000001u,0x0003003eu,0x0000009au,0x000000a2u,0x0004003du,0x00000077u,0x000000a4u,0x00000079u,0x0004003du,0x00000069u,0x000000a5u,0x0000006bu,0x00050041u,0x00000007u,0x000000a6u,0x00000074u,0x0000005fu,0x0004003du,0x00000006u,0x000000a7u,0x000000a6u,0x00050050u,0x00000069u,0x000000a8u,0x00000084u,0x000000a7u,0x00050081u,0x00000069u,0x000000a9u,0x000000a5u,0x000000a8u,0x00070058u,0x00000085u,0x000000aau,0x000000a4u,0x000000a9u,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x000000abu,0x000000aau,0x000000aau,0x00000000u,0x00000001u,0x0003003eu,0x000000a3u,0x000000abu,0x00050041u,0x00000007u,0x000000aeu,0x00000081u,0x00000055u,0x0004003du,0x00000006u,0x000000afu,0x000000aeu,0x0003003eu,0x000000adu,0x000000afu,0x00050041u,0x00000007u,0x000000b1u,0x00000088u,0x00000055u,0x0004003du,0x00000006u,0x000000b2u,0x000000b1u,0x0003003eu,0x000000b0u,0x000000b2u,0x00050041u,0x00000007u,0x000000b4u,0x00000091u,0x00000055u,0x0004003du,0x00000006u,0x000000b5u,0x000000b4u,0x0003003eu,0x000000b3u,0x000000b5u,0x00050041u,0x00000007u,0x000000b7u,0x0000009au,0x00000055u,0x0004003du,0x00000006u,0x000000b8u,0x000000b7u,0x0003003eu,0x000000b6u,0x000000b8u,0x00050041u,0x00000007u,0x000000bau,0x000000a3u,0x00000055u,0x0004003du,0x00000006u,0x000000bbu,0x000000bau,0x0003003eu,0x000000b9u,0x000000bbu,0x00090039u,0x00000006u,0x000000bcu,0x0000000eu,0x000000adu,0x000000b0u,0x000000b3u,0x000000b6u,0x000000b9u,0x00050041u,0x00000007u,0x000000beu,0x00000081u,0x0000005fu,0x0004003du,0x00000006u,0x000000bfu,0x000000beu,0x0003003eu,0x000000bdu,0x000000bfu,0x00050041u,0x00000007u,0x000000c1u,0x00000088u,0x0000005fu,0x0004003du,0x00000006u,0x000000c2u,0x000000c1u,0x0003003eu,0x000000c0u,0x000000c2u,0x00050041u,0x00000007u,0x000000c4u,0x00000091u,0x0000005fu,0x0004003du,0x00000006u,0x000000c5u,0x000000c4u,0x0003003eu,0x000000c3u,0x000000c5u,0x00050041u,0x00000007u,0x000000c7u,0x0000009au,0x0000005fu,0x0004003du,0x00000006u,0x000000c8u,0x000000c7u,0x0003003eu,0x000000c6u,0x000000c8u,0x00050041u,0x00000007u,0x000000cau,0x000000a3u,0x0000005fu,0x0004003du,0x00000006u,0x000000cbu,0x000000cau,0x0003003eu,0x000000c9u,0x000000cbu,0x00090039u,0x00000006u,0x000000ccu,0x0000000eu,0x000000bdu,0x000000c0u,0x000000c3u,0x000000c6u,0x000000c9u,0x00050050u,0x00000069u,0x000000cdu,0x000000bcu,0x000000ccu,0x0003003eu,0x000000acu,0x000000cdu,0x0004003du,0x00000069u,0x000000cfu,0x0000006bu,0x00050050u,0x00000069u,0x000000d0u,0x0000006eu,0x0000006eu,0x00050083u,0x00000069u,0x000000d1u,0x000000cfu,0x000000d0u,0x0003003eu,0x000000ceu,0x000000d1u,0x00060041u,0x000000d7u,0x000000d8u,0x000000d5u,0x000000d6u,0x00000055u,0x0004003du,0x00000006u,0x000000d9u,0x000000d8u,0x00050041u,0x00000007u,0x000000dau,0x000000ceu,0x00000055u,0x0004003du,0x00000006u,0x000000dbu,0x000000dau,0x00050085u,0x00000006u,0x000000dcu,0x000000d9u,0x000000dbu,0x00060041u,0x000000d7u,0x000000deu,0x000000d5u,0x000000d6u,0x000000ddu,0x0004003du,0x00000006u,0x000000dfu,0x000000deu,0x00050041u,0x00000007u,0x000000e0u,0x000000ceu,0x0000005fu,0x0004003du,0x00000006u,0x000000e1u,0x000000e0u,0x00050085u,0x00000006u,0x000000e2u,0x000000dfu,0x000000e1u,0x00050081u,0x00000006u,0x000000e3u,0x000000dcu,0x000000e2u,0x00060041u,0x000000d7u,0x000000e5u,0x000000d5u,0x000000e4u,0x00000055u,0x0004003du,0x00000006u,0x000000e6u,0x000000e5u,0x00050081u,0x00000006u,0x000000e7u,0x000000e3u,0x000000e6u,0x00060041u,0x000000d7u,0x000000e8u,0x000000d5u,0x000000d6u,0x0000005fu,0x0004003du,0x00000006u,0x000000e9u,0x000000e8u,0x00050041u,0x00000007u,0x000000eau,0x000000ceu,0x00000055u,0x0004003du,0x00000006u,0x000000ebu,0x000000eau,0x00050085u,0x00000006u,0x000000ecu,0x000000e9u,0x000000ebu,0x00060041u,0x000000d7u,0x000000eeu,0x000000d5u,0x000000d6u,0x000000edu,0x0004003du,0x00000006u,0x000000efu,0x000000eeu,0x00050041u,0x00000007u,0x000000f0u,0x000000ceu,0x0000005fu,0x0004003du,0x00000006u,0x000000f1u,0x000000f0u,0x00050085u,0x00000006u,0x000000f2u,0x000000efu,0x000000f1u,0x00050081u,0x00000006u,0x000000f3u,0x000000ecu,0x000000f2u,0x00060041u,0x000000d7u,0x000000f4u,0x000000d5u,0x000000e4u,0x0000005fu,0x0004003du,0x00000006u,0x000000f5u,0x000000f4u,0x00050081u,0x00000006u,0x000000f6u,0x000000f3u,0x000000f5u,0x00050050u,0x00000069u,0x000000f7u,0x000000e7u,0x000000f6u,0x0004003du,0x00000043u,0x000000f8u,0x0000004eu,0x0004006fu,0x00000069u,0x000000f9u,0x000000f8u,0x00050085u,0x00000069u,0x000000fau,0x000000f7u,0x000000f9u,0x0003003eu,0x000000d2u,0x000000fau,0x00060041u,0x000000d7u,0x000000feu,0x000000d5u,0x000000d6u,0x00000055u,0x0004003du,0x00000006u,0x000000ffu,0x000000feu,0x00050081u,0x00000006u,0x00000100u,0x00000075u,0x000000ffu,0x00060041u,0x000000d7u,0x00000101u,0x000000d5u,0x000000d6u,0x0000005fu,0x0004003du,0x00000006u,0x00000102u,0x00000101u,0x00060041u,0x000000d7u,0x00000103u,0x000000d5u,0x000000d6u,0x000000ddu,0x0004003du,0x00000006u,0x00000104u,0x00000103u,0x00060041u,0x000000d7u,0x00000105u,0x000000d5u,0x000000d6u,0x000000edu,0x0004003du,0x00000006u,0x00000106u,0x00000105u,0x00050081u,0x00000006u,0x00000107u,0x00000075u,0x00000106u,0x00050050u,0x00000069u,0x00000108u,0x00000100u,0x00000102u,0x00050050u,0x00000069u,0x00000109u,0x00000104u,0x00000107u,0x00050050u,0x000000fbu,0x0000010au,0x00000108u,0x00000109u,0x0003003eu,0x000000fdu,0x0000010au,0x0004003du,0x00000069u,0x0000010cu,0x000000d2u,0x0004003du,0x000000fbu,0x0000010du,0x000000fdu,0x0004003du,0x00000069u,0x0000010eu,0x000000acu,0x00050091u,0x00000069u,0x0000010fu,0x0000010du,0x0000010eu,0x00050081u,0x00000069u,0x00000110u,0x0000010cu,0x0000010fu,0x0003003eu,0x0000010bu,0x00000110u,0x0004003du,0x0000004fu,0x00000111u,0x00000051u,0x0004003du,0x00000043u,0x00000112u,0x00000045u,0x0004003du,0x00000069u,0x00000113u,0x0000010bu,0x00050051u,0x00000006u,0x00000114u,0x00000113u,0x00000000u,0x00050051u,0x00000006u,0x00000115u,0x00000113u,0x00000001u,0x00070050u,0x00000085u,0x00000116u,0x00000114u,0x00000115u,0x00000084u,0x00000075u,0x00040063u,0x00000111u,0x00000112u,0x00000116u,0x0004003du,0x0000004fu,0x00000118u,0x00000117u,0x0004003du,0x00000043u,0x00000119u,0x00000045u,0x0004003du,0x00000069u,0x0000011au,0x0000010bu,0x0004007fu,0x00000069u,0x0000011bu,0x0000011au,0x00050051u,0x00000006u,0x0000011cu,0x0000011bu,0x00000000u,0x00050051u,0x00000006u,0x0000011du,0x0000011bu,0x00000001u,0x00070050u,0x00000085u,0x0000011eu,0x0000011cu,0x0000011du,0x00000084u,0x00000075u,0x00040063u,0x00000118u,0x00000119u,0x0000011eu,0x000100fdu,0x00010038u,0x00050036u,0x00000006u,0x0000000eu,0x00000000u,0x00000008u,0x00030037u,0x00000007u,0x00000009u,0x00030037u,0x00000007u,0x0000000au,0x00030037u,0x00000007u,0x0000000bu,0x00030037u,0x00000007u,0x0000000cu,0x00030037u,0x00000007u,0x0000000du,0x000200f8u,0x0000000fu,0x0004003bu,0x00000007u,0x00000010u,0x00000007u,0x0004003bu,0x00000007u,0x00000034u,0x00000007u,0x0004003du,0x00000006u,0x00000011u,0x00000009u,0x0004003du,0x00000006u,0x00000012u,0x0000000au,0x0007000cu,0x00000006u,0x00000013u,0x00000001u,0x00000025u,0x00000011u,0x00000012u,0x0003003eu,0x00000010u,0x00000013u,0x0004003du,0x00000006u,0x00000014u,0x00000009u,0x0004003du,0x00000006u,0x00000015u,0x0000000au,0x0007000cu,0x00000006u,0x00000016u,0x00000001u,0x00000028u,0x00000014u,0x00000015u,0x0003003eu,0x00000009u,0x00000016u,0x0004003du,0x00000006u,0x00000017u,0x00000010u,0x0003003eu,0x0000000au,0x00000017u,0x0004003du,0x00000006u,0x00000018u,0x0000000bu,0x0004003du,0x00000006u,0x00000019u,0x0000000cu,0x0007000cu,0x00000006u,0x0000001au,0x00000001u,0x00000025u,0x00000018u,0x00000019u,0x0003003eu,0x00000010u,0x0000001au,0x0004003du,0x00000006u,0x0000001bu,0x0000000bu,0x0004003du,0x00000006u,0x0000001cu,0x0000000cu,0x0007000cu,0x00000006u,0x0000001du,0x00000001u,0x00000028u,0x0000001bu,0x0000001cu,0x0003003eu,0x0000000bu,0x0000001du,0x0004003du,0x00000006u,0x0000001eu,0x00000010u,0x0003003eu,0x0000000cu,0x0000001eu,0x0004003du,0x00000006u,0x0000001fu,0x00000009u,0x0004003du,0x00000006u,0x00000020u,0x0000000bu,0x0007000cu,0x00000006u,0x00000021u,0x00000001u,0x00000025u,0x0000001fu,0x00000020u,0x0003003eu,0x00000010u,0x00000021u,0x0004003du,0x00000006u,0x00000022u,0x00000009u,0x0004003du,0x00000006u,0x00000023u,0x0000000bu,0x0007000cu,0x00000006u,0x00000024u,0x00000001u,0x00000028u,0x00000022u,0x00000023u,0x0003003eu,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000025u,0x00000010u,0x0003003eu,0x0000000bu,0x00000025u,0x0004003du,0x00000006u,0x00000026u,0x0000000au,0x0004003du,0x00000006u,0x00000027u,0x0000000cu,0x0007000cu,0x00000006u,0x00000028u,0x00000001u,0x00000025u,0x00000026u,0x00000027u,0x0003003eu,0x00000010u,0x00000028u,0x0004003du,0x00000006u,0x00000029u,0x0000000au,0x0004003du,0x00000006u,0x0000002au,0x0000000cu,0x0007000cu,0x00000006u,0x0000002bu,0x00000001u,0x00000028u,0x00000029u,0x0000002au,0x0003003eu,0x0000000au,0x0000002bu,0x0004003du,0x00000006u,0x0000002cu,0x00000010u,0x0003003eu,0x0000000cu,0x0000002cu,0x0004003du,0x00000006u,0x0000002du,0x0000000au,0x0004003du,0x00000006u,0x0000002eu,0x0000000bu,0x0007000cu,0x00000006u,0x0000002fu,0x00000001u,0x00000025u,0x0000002du,0x0000002eu,0x0003003eu,0x00000010u,0x0000002fu,0x0004003du,0x00000006u,0x00000030u,0x0000000au,0x0004003du,0x00000006u,0x00000031u,0x0000000bu,0x0007000cu,0x00000006u,0x00000032u,0x00000001u,0x00000028u,0x00000030u,0x00000031u,0x0003003eu,0x0000000au,0x00000032u,0x0004003du,0x00000006u,0x00000033u,0x00000010u,0x0003003eu,0x0000000bu,0x00000033u,0x0004003du,0x00000006u,0x00000035u,0x0000000au,0x0004003du,0x00000006u,0x00000036u,0x0000000du,0x0007000cu,0x00000006u,0x00000037u,0x00000001u,0x00000025u,0x00000035u,0x00000036u,0x0003003eu,0x00000034u,0x00000037u,0x0004003du,0x00000006u,0x00000038u,0x0000000au,0x0004003du,0x00000006u,0x00000039u,0x0000000du,0x0007000cu,0x00000006u,0x0000003au,0x00000001u,0x00000028u,0x00000038u,0x00000039u,0x0003003eu,0x00000010u,0x0000003au,0x0004003du,0x00000006u,0x0000003bu,0x00000034u,0x0004003du,0x00000006u,0x0000003cu,0x0000000bu,0x0007000cu,0x00000006u,0x0000003du,0x00000001u,0x00000028u,0x0000003bu,0x0000003cu,0x0004003du,0x00000006u,0x0000003eu,0x00000010u,0x0007000cu,0x00000006u,0x0000003fu,0x00000001u,0x00000025u,0x0000003du,0x0000003eu,0x000200feu,0x0000003fu,0x00010038u}; static const size_t OF3_EXPAND_LEN = 1798; static const uint32_t OF3_FLOW_M4_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000151u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x000000f6u,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00080005u,0x00000010u,0x636f6c62u,0x6461536bu,0x31327328u,0x3132733bu,0x3266763bu,0x0000003bu,0x00030005u,0x0000000du,0x00000061u,0x00030005u,0x0000000eu,0x00000062u,0x00040005u,0x0000000fu,0x646e6163u,0x00000000u,0x00070005u,0x00000016u,0x766c6f73u,0x32732865u,0x32733b31u,0x66763b31u,0x00003b32u,0x00030005u,0x00000013u,0x00000061u,0x00030005u,0x00000014u,0x00000062u,0x00040005u,0x00000015u,0x64657270u,0x00000000u,0x00030005u,0x00000019u,0x00646173u,0x00030005u,0x0000001du,0x00007962u,0x00030005u,0x00000028u,0x00007862u,0x00030005u,0x00000030u,0x00006f62u,0x00030005u,0x00000036u,0x00006170u,0x00030005u,0x00000039u,0x00765567u,0x00050005u,0x0000003cu,0x766e4967u,0x616d754cu,0x00000000u,0x00030005u,0x00000045u,0x00006270u,0x00040005u,0x0000005du,0x74736562u,0x00646153u,0x00050005u,0x0000005fu,0x74736562u,0x70736944u,0x00000000u,0x00030005u,0x00000061u,0x00007973u,0x00030005u,0x0000006bu,0x00007873u,0x00040005u,0x00000073u,0x646e6163u,0x00000000u,0x00030005u,0x0000007bu,0x00646173u,0x00040005u,0x0000007cu,0x61726170u,0x0000006du,0x00030005u,0x00000095u,0x00000055u,0x00060006u,0x00000095u,0x00000000u,0x776f6c66u,0x6c616353u,0x00000065u,0x00050006u,0x00000095u,0x00000001u,0x6576656cu,0x0000006cu,0x00050006u,0x00000095u,0x00000002u,0x6c63636fu,0x00006f4cu,0x00050006u,0x00000095u,0x00000003u,0x6c63636fu,0x00006948u,0x00030005u,0x00000097u,0x00000000u,0x00040005u,0x0000009eu,0x43646173u,0x00000000u,0x00040005u,0x000000a1u,0x58646173u,0x0000006du,0x00040005u,0x000000a6u,0x61726170u,0x0000006du,0x00040005u,0x000000a9u,0x58646173u,0x00000070u,0x00040005u,0x000000aeu,0x61726170u,0x0000006du,0x00040005u,0x000000b1u,0x59646173u,0x0000006du,0x00040005u,0x000000b5u,0x61726170u,0x0000006du,0x00040005u,0x000000b8u,0x59646173u,0x00000070u,0x00040005u,0x000000bcu,0x61726170u,0x0000006du,0x00030005u,0x000000bfu,0x00007864u,0x00030005u,0x000000c0u,0x00007964u,0x00040005u,0x000000c1u,0x6f6e6564u,0x0000586du,0x00040005u,0x000000c9u,0x6f6e6564u,0x0000596du,0x00030005u,0x000000f3u,0x00646967u,0x00080005u,0x000000f6u,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x000000fbu,0x006d6964u,0x00040005u,0x000000feu,0x6f6c4675u,0x00000077u,0x00050005u,0x0000011au,0x6d754c75u,0x72754361u,0x00000072u,0x00040005u,0x00000122u,0x654c6f74u,0x006c6576u,0x00040005u,0x00000129u,0x64657270u,0x00000000u,0x00050005u,0x0000012au,0x65725075u,0x74636964u,0x0000726fu,0x00030005u,0x0000012eu,0x00647766u,0x00050005u,0x0000012fu,0x6d754c75u,0x65725061u,0x00000076u,0x00040005u,0x00000134u,0x61726170u,0x0000006du,0x00030005u,0x00000136u,0x00647762u,0x00040005u,0x0000013bu,0x61726170u,0x0000006du,0x00040005u,0x0000013du,0x75466f74u,0x00006c6cu,0x00030047u,0x00000095u,0x00000002u,0x00050048u,0x00000095u,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x00000095u,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x00000095u,0x00000002u,0x00000023u,0x00000008u,0x00050048u,0x00000095u,0x00000003u,0x00000023u,0x0000000cu,0x00040047u,0x00000097u,0x00000021u,0x00000000u,0x00040047u,0x00000097u,0x00000022u,0x00000000u,0x00040047u,0x000000f6u,0x0000000bu,0x0000001cu,0x00030047u,0x000000feu,0x00000019u,0x00040047u,0x000000feu,0x00000021u,0x00000030u,0x00040047u,0x000000feu,0x00000022u,0x00000000u,0x00040047u,0x0000011au,0x00000021u,0x00000021u,0x00040047u,0x0000011au,0x00000022u,0x00000000u,0x00040047u,0x0000012au,0x00000021u,0x00000022u,0x00040047u,0x0000012au,0x00000022u,0x00000000u,0x00040047u,0x0000012fu,0x00000021u,0x00000020u,0x00040047u,0x0000012fu,0x00000022u,0x00000000u,0x00040047u,0x00000150u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00030016u,0x00000006u,0x00000020u,0x00090019u,0x00000007u,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000008u,0x00000007u,0x00040020u,0x00000009u,0x00000000u,0x00000008u,0x00040017u,0x0000000au,0x00000006u,0x00000002u,0x00040020u,0x0000000bu,0x00000007u,0x0000000au,0x00060021u,0x0000000cu,0x00000006u,0x00000009u,0x00000009u,0x0000000bu,0x00060021u,0x00000012u,0x0000000au,0x00000009u,0x00000009u,0x0000000bu,0x00040020u,0x00000018u,0x00000007u,0x00000006u,0x0004002bu,0x00000006u,0x0000001au,0x00000000u,0x00040015u,0x0000001bu,0x00000020u,0x00000001u,0x00040020u,0x0000001cu,0x00000007u,0x0000001bu,0x0004002bu,0x0000001bu,0x0000001eu,0xffffffffu,0x0004002bu,0x0000001bu,0x00000025u,0x00000001u,0x00020014u,0x00000026u,0x00040020u,0x00000038u,0x00000006u,0x0000000au,0x0004003bu,0x00000038u,0x00000039u,0x00000006u,0x0004003bu,0x00000038u,0x0000003cu,0x00000006u,0x00040017u,0x00000040u,0x00000006u,0x00000004u,0x00040015u,0x00000042u,0x00000020u,0x00000000u,0x0004002bu,0x00000042u,0x00000043u,0x00000000u,0x0004002bu,0x00000006u,0x0000005eu,0x7f7fffffu,0x0004002bu,0x0000001bu,0x00000062u,0xfffffffdu,0x0004002bu,0x0000001bu,0x00000069u,0x00000003u,0x0004002bu,0x00000006u,0x0000007fu,0x3b03126fu,0x0006001eu,0x00000095u,0x00000006u,0x00000042u,0x00000006u,0x00000006u,0x00040020u,0x00000096u,0x00000002u,0x00000095u,0x0004003bu,0x00000096u,0x00000097u,0x00000002u,0x00040020u,0x00000098u,0x00000002u,0x00000042u,0x0004002bu,0x00000006u,0x000000a3u,0xbf800000u,0x0005002cu,0x0000000au,0x000000a4u,0x000000a3u,0x0000001au,0x0004002bu,0x00000006u,0x000000abu,0x3f800000u,0x0005002cu,0x0000000au,0x000000acu,0x000000abu,0x0000001au,0x0005002cu,0x0000000au,0x000000b3u,0x0000001au,0x000000a3u,0x0005002cu,0x0000000au,0x000000bau,0x0000001au,0x000000abu,0x0004002bu,0x00000006u,0x000000c3u,0x40000000u,0x0004002bu,0x00000006u,0x000000d1u,0x358637bdu,0x0004002bu,0x00000006u,0x000000d5u,0x3f000000u,0x0004002bu,0x00000006u,0x000000dcu,0xbf000000u,0x00040017u,0x000000f1u,0x0000001bu,0x00000002u,0x00040020u,0x000000f2u,0x00000007u,0x000000f1u,0x00040017u,0x000000f4u,0x00000042u,0x00000003u,0x00040020u,0x000000f5u,0x00000001u,0x000000f4u,0x0004003bu,0x000000f5u,0x000000f6u,0x00000001u,0x00040017u,0x000000f7u,0x00000042u,0x00000002u,0x00090019u,0x000000fcu,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000002u,0x00040020u,0x000000fdu,0x00000000u,0x000000fcu,0x0004003bu,0x000000fdu,0x000000feu,0x00000000u,0x0004002bu,0x00000042u,0x00000109u,0x00000001u,0x0004003bu,0x00000009u,0x0000011au,0x00000000u,0x0004002bu,0x0000001bu,0x0000011cu,0x00000000u,0x00040020u,0x00000128u,0x00000007u,0x00000040u,0x0004003bu,0x00000009u,0x0000012au,0x00000000u,0x0004003bu,0x00000009u,0x0000012fu,0x00000000u,0x0004002bu,0x00000042u,0x0000014fu,0x00000010u,0x0006002cu,0x000000f4u,0x00000150u,0x0000014fu,0x0000014fu,0x00000109u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x000000f2u,0x000000f3u,0x00000007u,0x0004003bu,0x000000f2u,0x000000fbu,0x00000007u,0x0004003bu,0x00000018u,0x00000122u,0x00000007u,0x0004003bu,0x00000128u,0x00000129u,0x00000007u,0x0004003bu,0x0000000bu,0x0000012eu,0x00000007u,0x0004003bu,0x0000000bu,0x00000134u,0x00000007u,0x0004003bu,0x0000000bu,0x00000136u,0x00000007u,0x0004003bu,0x0000000bu,0x0000013bu,0x00000007u,0x0004003bu,0x00000018u,0x0000013du,0x00000007u,0x0004003du,0x000000f4u,0x000000f8u,0x000000f6u,0x0007004fu,0x000000f7u,0x000000f9u,0x000000f8u,0x000000f8u,0x00000000u,0x00000001u,0x0004007cu,0x000000f1u,0x000000fau,0x000000f9u,0x0003003eu,0x000000f3u,0x000000fau,0x0004003du,0x000000fcu,0x000000ffu,0x000000feu,0x00040068u,0x000000f1u,0x00000100u,0x000000ffu,0x0003003eu,0x000000fbu,0x00000100u,0x00050041u,0x0000001cu,0x00000101u,0x000000f3u,0x00000043u,0x0004003du,0x0000001bu,0x00000102u,0x00000101u,0x00050041u,0x0000001cu,0x00000103u,0x000000fbu,0x00000043u,0x0004003du,0x0000001bu,0x00000104u,0x00000103u,0x000500afu,0x00000026u,0x00000105u,0x00000102u,0x00000104u,0x000400a8u,0x00000026u,0x00000106u,0x00000105u,0x000300f7u,0x00000108u,0x00000000u,0x000400fau,0x00000106u,0x00000107u,0x00000108u,0x000200f8u,0x00000107u,0x00050041u,0x0000001cu,0x0000010au,0x000000f3u,0x00000109u,0x0004003du,0x0000001bu,0x0000010bu,0x0000010au,0x00050041u,0x0000001cu,0x0000010cu,0x000000fbu,0x00000109u,0x0004003du,0x0000001bu,0x0000010du,0x0000010cu,0x000500afu,0x00000026u,0x0000010eu,0x0000010bu,0x0000010du,0x000200f9u,0x00000108u,0x000200f8u,0x00000108u,0x000700f5u,0x00000026u,0x0000010fu,0x00000105u,0x00000005u,0x0000010eu,0x00000107u,0x000300f7u,0x00000111u,0x00000000u,0x000400fau,0x0000010fu,0x00000110u,0x00000111u,0x000200f8u,0x00000110u,0x000100fdu,0x000200f8u,0x00000111u,0x0004003du,0x000000f1u,0x00000113u,0x000000f3u,0x0004006fu,0x0000000au,0x00000114u,0x00000113u,0x00050050u,0x0000000au,0x00000115u,0x000000d5u,0x000000d5u,0x00050081u,0x0000000au,0x00000116u,0x00000114u,0x00000115u,0x0004003du,0x000000f1u,0x00000117u,0x000000fbu,0x0004006fu,0x0000000au,0x00000118u,0x00000117u,0x00050088u,0x0000000au,0x00000119u,0x00000116u,0x00000118u,0x0003003eu,0x00000039u,0x00000119u,0x0004003du,0x00000008u,0x0000011bu,0x0000011au,0x00040064u,0x00000007u,0x0000011du,0x0000011bu,0x00050067u,0x000000f1u,0x0000011eu,0x0000011du,0x0000011cu,0x0004006fu,0x0000000au,0x0000011fu,0x0000011eu,0x00050050u,0x0000000au,0x00000120u,0x000000abu,0x000000abu,0x00050088u,0x0000000au,0x00000121u,0x00000120u,0x0000011fu,0x0003003eu,0x0000003cu,0x00000121u,0x00050041u,0x00000098u,0x00000123u,0x00000097u,0x00000025u,0x0004003du,0x00000042u,0x00000124u,0x00000123u,0x00040070u,0x00000006u,0x00000125u,0x00000124u,0x0004007fu,0x00000006u,0x00000126u,0x00000125u,0x0006000cu,0x00000006u,0x00000127u,0x00000001u,0x0000001du,0x00000126u,0x0003003eu,0x00000122u,0x00000127u,0x0004003du,0x00000008u,0x0000012bu,0x0000012au,0x0004003du,0x0000000au,0x0000012cu,0x00000039u,0x00070058u,0x00000040u,0x0000012du,0x0000012bu,0x0000012cu,0x00000002u,0x0000001au,0x0003003eu,0x00000129u,0x0000012du,0x0004003du,0x00000040u,0x00000130u,0x00000129u,0x0007004fu,0x0000000au,0x00000131u,0x00000130u,0x00000130u,0x00000000u,0x00000001u,0x0004003du,0x00000006u,0x00000132u,0x00000122u,0x0005008eu,0x0000000au,0x00000133u,0x00000131u,0x00000132u,0x0003003eu,0x00000134u,0x00000133u,0x00070039u,0x0000000au,0x00000135u,0x00000016u,0x0000012fu,0x0000011au,0x00000134u,0x0003003eu,0x0000012eu,0x00000135u,0x0004003du,0x00000040u,0x00000137u,0x00000129u,0x0007004fu,0x0000000au,0x00000138u,0x00000137u,0x00000137u,0x00000002u,0x00000003u,0x0004003du,0x00000006u,0x00000139u,0x00000122u,0x0005008eu,0x0000000au,0x0000013au,0x00000138u,0x00000139u,0x0003003eu,0x0000013bu,0x0000013au,0x00070039u,0x0000000au,0x0000013cu,0x00000016u,0x0000011au,0x0000012fu,0x0000013bu,0x0003003eu,0x00000136u,0x0000013cu,0x00050041u,0x00000098u,0x0000013eu,0x00000097u,0x00000025u,0x0004003du,0x00000042u,0x0000013fu,0x0000013eu,0x00040070u,0x00000006u,0x00000140u,0x0000013fu,0x0006000cu,0x00000006u,0x00000141u,0x00000001u,0x0000001du,0x00000140u,0x0003003eu,0x0000013du,0x00000141u,0x0004003du,0x000000fcu,0x00000142u,0x000000feu,0x0004003du,0x000000f1u,0x00000143u,0x000000f3u,0x0004003du,0x0000000au,0x00000144u,0x0000012eu,0x0004003du,0x00000006u,0x00000145u,0x0000013du,0x0005008eu,0x0000000au,0x00000146u,0x00000144u,0x00000145u,0x0004003du,0x0000000au,0x00000147u,0x00000136u,0x0004003du,0x00000006u,0x00000148u,0x0000013du,0x0005008eu,0x0000000au,0x00000149u,0x00000147u,0x00000148u,0x00050051u,0x00000006u,0x0000014au,0x00000146u,0x00000000u,0x00050051u,0x00000006u,0x0000014bu,0x00000146u,0x00000001u,0x00050051u,0x00000006u,0x0000014cu,0x00000149u,0x00000000u,0x00050051u,0x00000006u,0x0000014du,0x00000149u,0x00000001u,0x00070050u,0x00000040u,0x0000014eu,0x0000014au,0x0000014bu,0x0000014cu,0x0000014du,0x00040063u,0x00000142u,0x00000143u,0x0000014eu,0x000100fdu,0x00010038u,0x00050036u,0x00000006u,0x00000010u,0x00000000u,0x0000000cu,0x00030037u,0x00000009u,0x0000000du,0x00030037u,0x00000009u,0x0000000eu,0x00030037u,0x0000000bu,0x0000000fu,0x000200f8u,0x00000011u,0x0004003bu,0x00000018u,0x00000019u,0x00000007u,0x0004003bu,0x0000001cu,0x0000001du,0x00000007u,0x0004003bu,0x0000001cu,0x00000028u,0x00000007u,0x0004003bu,0x0000000bu,0x00000030u,0x00000007u,0x0004003bu,0x00000018u,0x00000036u,0x00000007u,0x0004003bu,0x00000018u,0x00000045u,0x00000007u,0x0003003eu,0x00000019u,0x0000001au,0x0003003eu,0x0000001du,0x0000001eu,0x000200f9u,0x0000001fu,0x000200f8u,0x0000001fu,0x000400f6u,0x00000021u,0x00000022u,0x00000000u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x0004003du,0x0000001bu,0x00000024u,0x0000001du,0x000500b3u,0x00000026u,0x00000027u,0x00000024u,0x00000025u,0x000400fau,0x00000027u,0x00000020u,0x00000021u,0x000200f8u,0x00000020u,0x0003003eu,0x00000028u,0x0000001eu,0x000200f9u,0x00000029u,0x000200f8u,0x00000029u,0x000400f6u,0x0000002bu,0x0000002cu,0x00000000u,0x000200f9u,0x0000002du,0x000200f8u,0x0000002du,0x0004003du,0x0000001bu,0x0000002eu,0x00000028u,0x000500b3u,0x00000026u,0x0000002fu,0x0000002eu,0x00000025u,0x000400fau,0x0000002fu,0x0000002au,0x0000002bu,0x000200f8u,0x0000002au,0x0004003du,0x0000001bu,0x00000031u,0x00000028u,0x0004006fu,0x00000006u,0x00000032u,0x00000031u,0x0004003du,0x0000001bu,0x00000033u,0x0000001du,0x0004006fu,0x00000006u,0x00000034u,0x00000033u,0x00050050u,0x0000000au,0x00000035u,0x00000032u,0x00000034u,0x0003003eu,0x00000030u,0x00000035u,0x0004003du,0x00000008u,0x00000037u,0x0000000du,0x0004003du,0x0000000au,0x0000003au,0x00000039u,0x0004003du,0x0000000au,0x0000003bu,0x00000030u,0x0004003du,0x0000000au,0x0000003du,0x0000003cu,0x00050085u,0x0000000au,0x0000003eu,0x0000003bu,0x0000003du,0x00050081u,0x0000000au,0x0000003fu,0x0000003au,0x0000003eu,0x00070058u,0x00000040u,0x00000041u,0x00000037u,0x0000003fu,0x00000002u,0x0000001au,0x00050051u,0x00000006u,0x00000044u,0x00000041u,0x00000000u,0x0003003eu,0x00000036u,0x00000044u,0x0004003du,0x00000008u,0x00000046u,0x0000000eu,0x0004003du,0x0000000au,0x00000047u,0x00000039u,0x0004003du,0x0000000au,0x00000048u,0x00000030u,0x0004003du,0x0000000au,0x00000049u,0x0000000fu,0x00050081u,0x0000000au,0x0000004au,0x00000048u,0x00000049u,0x0004003du,0x0000000au,0x0000004bu,0x0000003cu,0x00050085u,0x0000000au,0x0000004cu,0x0000004au,0x0000004bu,0x00050081u,0x0000000au,0x0000004du,0x00000047u,0x0000004cu,0x00070058u,0x00000040u,0x0000004eu,0x00000046u,0x0000004du,0x00000002u,0x0000001au,0x00050051u,0x00000006u,0x0000004fu,0x0000004eu,0x00000000u,0x0003003eu,0x00000045u,0x0000004fu,0x0004003du,0x00000006u,0x00000050u,0x00000036u,0x0004003du,0x00000006u,0x00000051u,0x00000045u,0x00050083u,0x00000006u,0x00000052u,0x00000050u,0x00000051u,0x0006000cu,0x00000006u,0x00000053u,0x00000001u,0x00000004u,0x00000052u,0x0004003du,0x00000006u,0x00000054u,0x00000019u,0x00050081u,0x00000006u,0x00000055u,0x00000054u,0x00000053u,0x0003003eu,0x00000019u,0x00000055u,0x000200f9u,0x0000002cu,0x000200f8u,0x0000002cu,0x0004003du,0x0000001bu,0x00000056u,0x00000028u,0x00050080u,0x0000001bu,0x00000057u,0x00000056u,0x00000025u,0x0003003eu,0x00000028u,0x00000057u,0x000200f9u,0x00000029u,0x000200f8u,0x0000002bu,0x000200f9u,0x00000022u,0x000200f8u,0x00000022u,0x0004003du,0x0000001bu,0x00000058u,0x0000001du,0x00050080u,0x0000001bu,0x00000059u,0x00000058u,0x00000025u,0x0003003eu,0x0000001du,0x00000059u,0x000200f9u,0x0000001fu,0x000200f8u,0x00000021u,0x0004003du,0x00000006u,0x0000005au,0x00000019u,0x000200feu,0x0000005au,0x00010038u,0x00050036u,0x0000000au,0x00000016u,0x00000000u,0x00000012u,0x00030037u,0x00000009u,0x00000013u,0x00030037u,0x00000009u,0x00000014u,0x00030037u,0x0000000bu,0x00000015u,0x000200f8u,0x00000017u,0x0004003bu,0x00000018u,0x0000005du,0x00000007u,0x0004003bu,0x0000000bu,0x0000005fu,0x00000007u,0x0004003bu,0x0000001cu,0x00000061u,0x00000007u,0x0004003bu,0x0000001cu,0x0000006bu,0x00000007u,0x0004003bu,0x0000000bu,0x00000073u,0x00000007u,0x0004003bu,0x00000018u,0x0000007bu,0x00000007u,0x0004003bu,0x0000000bu,0x0000007cu,0x00000007u,0x0004003bu,0x00000018u,0x0000009eu,0x00000007u,0x0004003bu,0x00000018u,0x000000a1u,0x00000007u,0x0004003bu,0x0000000bu,0x000000a6u,0x00000007u,0x0004003bu,0x00000018u,0x000000a9u,0x00000007u,0x0004003bu,0x0000000bu,0x000000aeu,0x00000007u,0x0004003bu,0x00000018u,0x000000b1u,0x00000007u,0x0004003bu,0x0000000bu,0x000000b5u,0x00000007u,0x0004003bu,0x00000018u,0x000000b8u,0x00000007u,0x0004003bu,0x0000000bu,0x000000bcu,0x00000007u,0x0004003bu,0x00000018u,0x000000bfu,0x00000007u,0x0004003bu,0x00000018u,0x000000c0u,0x00000007u,0x0004003bu,0x00000018u,0x000000c1u,0x00000007u,0x0004003bu,0x00000018u,0x000000c9u,0x00000007u,0x0003003eu,0x0000005du,0x0000005eu,0x0004003du,0x0000000au,0x00000060u,0x00000015u,0x0003003eu,0x0000005fu,0x00000060u,0x0003003eu,0x00000061u,0x00000062u,0x000200f9u,0x00000063u,0x000200f8u,0x00000063u,0x000400f6u,0x00000065u,0x00000066u,0x00000000u,0x000200f9u,0x00000067u,0x000200f8u,0x00000067u,0x0004003du,0x0000001bu,0x00000068u,0x00000061u,0x000500b3u,0x00000026u,0x0000006au,0x00000068u,0x00000069u,0x000400fau,0x0000006au,0x00000064u,0x00000065u,0x000200f8u,0x00000064u,0x0003003eu,0x0000006bu,0x00000062u,0x000200f9u,0x0000006cu,0x000200f8u,0x0000006cu,0x000400f6u,0x0000006eu,0x0000006fu,0x00000000u,0x000200f9u,0x00000070u,0x000200f8u,0x00000070u,0x0004003du,0x0000001bu,0x00000071u,0x0000006bu,0x000500b3u,0x00000026u,0x00000072u,0x00000071u,0x00000069u,0x000400fau,0x00000072u,0x0000006du,0x0000006eu,0x000200f8u,0x0000006du,0x0004003du,0x0000000au,0x00000074u,0x00000015u,0x0004003du,0x0000001bu,0x00000075u,0x0000006bu,0x0004006fu,0x00000006u,0x00000076u,0x00000075u,0x0004003du,0x0000001bu,0x00000077u,0x00000061u,0x0004006fu,0x00000006u,0x00000078u,0x00000077u,0x00050050u,0x0000000au,0x00000079u,0x00000076u,0x00000078u,0x00050081u,0x0000000au,0x0000007au,0x00000074u,0x00000079u,0x0003003eu,0x00000073u,0x0000007au,0x0004003du,0x0000000au,0x0000007du,0x00000073u,0x0003003eu,0x0000007cu,0x0000007du,0x00070039u,0x00000006u,0x0000007eu,0x00000010u,0x00000013u,0x00000014u,0x0000007cu,0x0003003eu,0x0000007bu,0x0000007eu,0x0004003du,0x0000001bu,0x00000080u,0x0000006bu,0x0004006fu,0x00000006u,0x00000081u,0x00000080u,0x0006000cu,0x00000006u,0x00000082u,0x00000001u,0x00000004u,0x00000081u,0x0004003du,0x0000001bu,0x00000083u,0x00000061u,0x0004006fu,0x00000006u,0x00000084u,0x00000083u,0x0006000cu,0x00000006u,0x00000085u,0x00000001u,0x00000004u,0x00000084u,0x00050081u,0x00000006u,0x00000086u,0x00000082u,0x00000085u,0x00050085u,0x00000006u,0x00000087u,0x0000007fu,0x00000086u,0x0004003du,0x00000006u,0x00000088u,0x0000007bu,0x00050081u,0x00000006u,0x00000089u,0x00000088u,0x00000087u,0x0003003eu,0x0000007bu,0x00000089u,0x0004003du,0x00000006u,0x0000008au,0x0000007bu,0x0004003du,0x00000006u,0x0000008bu,0x0000005du,0x000500b8u,0x00000026u,0x0000008cu,0x0000008au,0x0000008bu,0x000300f7u,0x0000008eu,0x00000000u,0x000400fau,0x0000008cu,0x0000008du,0x0000008eu,0x000200f8u,0x0000008du,0x0004003du,0x00000006u,0x0000008fu,0x0000007bu,0x0003003eu,0x0000005du,0x0000008fu,0x0004003du,0x0000000au,0x00000090u,0x00000073u,0x0003003eu,0x0000005fu,0x00000090u,0x000200f9u,0x0000008eu,0x000200f8u,0x0000008eu,0x000200f9u,0x0000006fu,0x000200f8u,0x0000006fu,0x0004003du,0x0000001bu,0x00000091u,0x0000006bu,0x00050080u,0x0000001bu,0x00000092u,0x00000091u,0x00000025u,0x0003003eu,0x0000006bu,0x00000092u,0x000200f9u,0x0000006cu,0x000200f8u,0x0000006eu,0x000200f9u,0x00000066u,0x000200f8u,0x00000066u,0x0004003du,0x0000001bu,0x00000093u,0x00000061u,0x00050080u,0x0000001bu,0x00000094u,0x00000093u,0x00000025u,0x0003003eu,0x00000061u,0x00000094u,0x000200f9u,0x00000063u,0x000200f8u,0x00000065u,0x00050041u,0x00000098u,0x00000099u,0x00000097u,0x00000025u,0x0004003du,0x00000042u,0x0000009au,0x00000099u,0x000500aau,0x00000026u,0x0000009bu,0x0000009au,0x00000043u,0x000300f7u,0x0000009du,0x00000000u,0x000400fau,0x0000009bu,0x0000009cu,0x0000009du,0x000200f8u,0x0000009cu,0x0004003du,0x00000006u,0x0000009fu,0x0000005du,0x00050083u,0x00000006u,0x000000a0u,0x0000009fu,0x0000001au,0x0003003eu,0x0000009eu,0x000000a0u,0x0004003du,0x0000000au,0x000000a2u,0x0000005fu,0x00050081u,0x0000000au,0x000000a5u,0x000000a2u,0x000000a4u,0x0003003eu,0x000000a6u,0x000000a5u,0x00070039u,0x00000006u,0x000000a7u,0x00000010u,0x00000013u,0x00000014u,0x000000a6u,0x00050081u,0x00000006u,0x000000a8u,0x000000a7u,0x0000007fu,0x0003003eu,0x000000a1u,0x000000a8u,0x0004003du,0x0000000au,0x000000aau,0x0000005fu,0x00050081u,0x0000000au,0x000000adu,0x000000aau,0x000000acu,0x0003003eu,0x000000aeu,0x000000adu,0x00070039u,0x00000006u,0x000000afu,0x00000010u,0x00000013u,0x00000014u,0x000000aeu,0x00050081u,0x00000006u,0x000000b0u,0x000000afu,0x0000007fu,0x0003003eu,0x000000a9u,0x000000b0u,0x0004003du,0x0000000au,0x000000b2u,0x0000005fu,0x00050081u,0x0000000au,0x000000b4u,0x000000b2u,0x000000b3u,0x0003003eu,0x000000b5u,0x000000b4u,0x00070039u,0x00000006u,0x000000b6u,0x00000010u,0x00000013u,0x00000014u,0x000000b5u,0x00050081u,0x00000006u,0x000000b7u,0x000000b6u,0x0000007fu,0x0003003eu,0x000000b1u,0x000000b7u,0x0004003du,0x0000000au,0x000000b9u,0x0000005fu,0x00050081u,0x0000000au,0x000000bbu,0x000000b9u,0x000000bau,0x0003003eu,0x000000bcu,0x000000bbu,0x00070039u,0x00000006u,0x000000bdu,0x00000010u,0x00000013u,0x00000014u,0x000000bcu,0x00050081u,0x00000006u,0x000000beu,0x000000bdu,0x0000007fu,0x0003003eu,0x000000b8u,0x000000beu,0x0003003eu,0x000000bfu,0x0000001au,0x0003003eu,0x000000c0u,0x0000001au,0x0004003du,0x00000006u,0x000000c2u,0x000000a1u,0x0004003du,0x00000006u,0x000000c4u,0x0000009eu,0x00050085u,0x00000006u,0x000000c5u,0x000000c3u,0x000000c4u,0x00050083u,0x00000006u,0x000000c6u,0x000000c2u,0x000000c5u,0x0004003du,0x00000006u,0x000000c7u,0x000000a9u,0x00050081u,0x00000006u,0x000000c8u,0x000000c6u,0x000000c7u,0x0003003eu,0x000000c1u,0x000000c8u,0x0004003du,0x00000006u,0x000000cau,0x000000b1u,0x0004003du,0x00000006u,0x000000cbu,0x0000009eu,0x00050085u,0x00000006u,0x000000ccu,0x000000c3u,0x000000cbu,0x00050083u,0x00000006u,0x000000cdu,0x000000cau,0x000000ccu,0x0004003du,0x00000006u,0x000000ceu,0x000000b8u,0x00050081u,0x00000006u,0x000000cfu,0x000000cdu,0x000000ceu,0x0003003eu,0x000000c9u,0x000000cfu,0x0004003du,0x00000006u,0x000000d0u,0x000000c1u,0x000500bau,0x00000026u,0x000000d2u,0x000000d0u,0x000000d1u,0x000300f7u,0x000000d4u,0x00000000u,0x000400fau,0x000000d2u,0x000000d3u,0x000000d4u,0x000200f8u,0x000000d3u,0x0004003du,0x00000006u,0x000000d6u,0x000000a1u,0x0004003du,0x00000006u,0x000000d7u,0x000000a9u,0x00050083u,0x00000006u,0x000000d8u,0x000000d6u,0x000000d7u,0x00050085u,0x00000006u,0x000000d9u,0x000000d5u,0x000000d8u,0x0004003du,0x00000006u,0x000000dau,0x000000c1u,0x00050088u,0x00000006u,0x000000dbu,0x000000d9u,0x000000dau,0x0008000cu,0x00000006u,0x000000ddu,0x00000001u,0x0000002bu,0x000000dbu,0x000000dcu,0x000000d5u,0x0003003eu,0x000000bfu,0x000000ddu,0x000200f9u,0x000000d4u,0x000200f8u,0x000000d4u,0x0004003du,0x00000006u,0x000000deu,0x000000c9u,0x000500bau,0x00000026u,0x000000dfu,0x000000deu,0x000000d1u,0x000300f7u,0x000000e1u,0x00000000u,0x000400fau,0x000000dfu,0x000000e0u,0x000000e1u,0x000200f8u,0x000000e0u,0x0004003du,0x00000006u,0x000000e2u,0x000000b1u,0x0004003du,0x00000006u,0x000000e3u,0x000000b8u,0x00050083u,0x00000006u,0x000000e4u,0x000000e2u,0x000000e3u,0x00050085u,0x00000006u,0x000000e5u,0x000000d5u,0x000000e4u,0x0004003du,0x00000006u,0x000000e6u,0x000000c9u,0x00050088u,0x00000006u,0x000000e7u,0x000000e5u,0x000000e6u,0x0008000cu,0x00000006u,0x000000e8u,0x00000001u,0x0000002bu,0x000000e7u,0x000000dcu,0x000000d5u,0x0003003eu,0x000000c0u,0x000000e8u,0x000200f9u,0x000000e1u,0x000200f8u,0x000000e1u,0x0004003du,0x00000006u,0x000000e9u,0x000000bfu,0x0004003du,0x00000006u,0x000000eau,0x000000c0u,0x00050050u,0x0000000au,0x000000ebu,0x000000e9u,0x000000eau,0x0004003du,0x0000000au,0x000000ecu,0x0000005fu,0x00050081u,0x0000000au,0x000000edu,0x000000ecu,0x000000ebu,0x0003003eu,0x0000005fu,0x000000edu,0x000200f9u,0x0000009du,0x000200f8u,0x0000009du,0x0004003du,0x0000000au,0x000000eeu,0x0000005fu,0x000200feu,0x000000eeu,0x00010038u}; From 898fdf76066b0507b22bc8f4bf80337cc5f444a9 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 00:04:48 -0400 Subject: [PATCH 004/120] Add conservative OF3_FLOWREG shader optimization variant --- tools/ddfg_compare/of3_flowreg_opt.comp | 138 ++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 tools/ddfg_compare/of3_flowreg_opt.comp diff --git a/tools/ddfg_compare/of3_flowreg_opt.comp b/tools/ddfg_compare/of3_flowreg_opt.comp new file mode 100644 index 0000000000..37392039e3 --- /dev/null +++ b/tools/ddfg_compare/of3_flowreg_opt.comp @@ -0,0 +1,138 @@ +#version 450 +// ───────────────────────────────────────────────────────────────────────────── +// win-fg C2 — FLOW REGULARIZATION (TV-L1 smoothness prior), one iteration. +// +// CLEAN-ROOM STATEMENT +// Written from first principles for win-fg. NO code from LSFG, Max's wnfg_XX +// blobs, GameScope, or any NC-licensed source — equations only, from published +// papers. win-fg is MIT. +// +// WHAT THIS DOES +// C1 (of3_gm_prewarp) removes the CAMERA motion before the dense SAD search, so +// the flow field this shader receives (flowLvl_[kFlowFinest], 1/4-res) is the +// OBJECT-only residual. That residual still carries incoherent / spurious +// per-block vectors on low-texture or ambiguous blocks. C2 applies a variational +// smoothness prior that suppresses those spurious vectors while PRESERVING true +// motion discontinuities at object edges (that is the whole point of using an L1 +// / Total-Variation prior instead of an L2 / Horn-Schunck one — L2 rounds the +// silhouettes off, which is exactly the smear we are trying to remove). +// +// ENERGY (TV-L1 optical-flow denoising of a fixed observation f0): +// min_u Σ g(x)·|∇u(x)| + λ·|u(x) − f0(x)| +// where u is the regularized flow, f0 is the raw SAD flow (the fixed data term), +// |∇u| is the Total-Variation (L1-of-gradient) regularizer, and g(x)∈(0,1] is an +// edge-aware weight from the luma gradient (small across an object silhouette so +// the prior does NOT smooth flow across it). References: +// * Zach, Pock & Bischof 2007, "A Duality Based Approach for Realtime TV-L1 +// Optical Flow" (DAGM) — the TV-L1 energy + the L1 data soft-threshold step. +// * Chambolle & Pock 2011, "A First-Order Primal-Dual Algorithm ..." (JMIV) — +// primal-dual TV framework. +// * Rudin, Osher & Fatemi 1992 — Total Variation regularization (ROF). +// * Vogel & Oman 1996; Chan, Golub & Mulet 1999 — the lagged-diffusivity / +// semi-implicit solver actually used here (see SCHEME note). +// * Perona & Malik 1990; Weickert 1998; Nagel & Enkelmann 1986 — the +// edge-aware (image-gradient) weighting of the smoothness term. +// * Horn & Schunck 1981 — the L2 baseline this L1 variant deliberately replaces. +// +// SCHEME (why not textbook Chambolle-Pock primal-dual): +// The canonical TV-L1 solver keeps a persistent dual field p (2 components per +// flow channel = 8 floats/px) and alternates a dual-ascent + primal-descent with +// step sizes (σ,τ) that must satisfy στL²≤1 or it DIVERGES. That is exactly the +// kind of tuning-sensitive instability we do not want on Turnip, and it breaks +// the one-shader / ping-pong-two-flow-images contract (it needs extra dual +// images). Instead we solve the SAME energy with a lagged-diffusivity +// semi-implicit (Jacobi) step: the TV term is linearized as a divergence of the +// edge-weighted, TV-normalized gradient (dual re-derived in closed form each +// iteration as p = g·∇u/|∇u|_ε, which is exactly the optimal TV dual and has +// |p|≤1 by construction), then a Jacobi update that is UNCONDITIONALLY STABLE for +// any dt>0 (the primal is a convex combination of the centre and its neighbours, +// so it can never blow up or NaN), followed by the exact L1 data-term +// soft-threshold. State carried between iterations is only u itself → ping-pong +// two rgba16f flow images, N iterations. Identity behaviour: with 0 iterations +// the field is untouched (byte-identical to pre-C2). +// +// COMPOSES WITH: +// * quality-tier2's 5-tap median: that median stays in of3_expand(_m4) and runs +// AFTER C2, as a final speckle scrub on the already-coherent field (harmless — +// L1 is already outlier-robust). C2 does not touch expand. +// * C1 global-motion add-back: C2 cleans the residual IN PLACE at +// flowLvl_[kFlowFinest]; of3_expand then medians + confidence-gates + adds the +// global affine back exactly as before, now on the cleaned residual. The +// end-to-end composed flow stays correct; identity affine ⇒ pre-C1 path. +// ───────────────────────────────────────────────────────────────────────────── +layout(local_size_x = 16, local_size_y = 16) in; + +layout(binding = 0) uniform U { + // x = dt : semi-implicit smoothing step (larger ⇒ more smoothing) + // y = lambda : L1 data-fidelity weight (larger ⇒ trust the SAD flow more) + // z = edgeAlpha : luma-gradient edge sensitivity for g (larger ⇒ sharper stop) + // w = epsTV : Charbonnier epsilon for the TV diffusivity (px; larger ⇒ softer) + vec4 params; +}; + +layout(binding = 32) uniform sampler2D uFlowIn; // current iterate u (.xy fwd, .zw bwd), full-res px +layout(binding = 33) uniform sampler2D uFlowObs; // fixed observation f0 (the raw SAD flow) +layout(binding = 34) uniform sampler2D uLuma; // prev luma at this flow level (R32F, Rec.709 [0,1]) +layout(binding = 48, rgba16f) uniform writeonly image2D uFlowOut; + +vec4 fetchU(ivec2 p, ivec2 dim) { + return texelFetch(uFlowIn, clamp(p, ivec2(0), dim - 1), 0); +} +float fetchL(ivec2 p, ivec2 dim) { + return texelFetch(uLuma, clamp(p, ivec2(0), dim - 1), 0).r; +} + +void main() { + ivec2 gid = ivec2(gl_GlobalInvocationID.xy); + ivec2 dim = textureSize(uFlowIn, 0); + if (gid.x >= dim.x || gid.y >= dim.y) return; + + float dt = params.x; + float lambda = params.y; + float edgeAlpha = params.z; + float epsTV = params.w; + + // 4-connected neighbourhood of the current iterate (all 4 flow channels). + vec4 uC = texelFetch(uFlowIn, gid, 0); + vec4 uL = fetchU(gid + ivec2(-1, 0), dim); + vec4 uR = fetchU(gid + ivec2( 1, 0), dim); + vec4 uU = fetchU(gid + ivec2( 0, -1), dim); + vec4 uD = fetchU(gid + ivec2( 0, 1), dim); + + // ── Edge-aware weight g from the luma gradient (Perona-Malik / Weickert) ──── + // Luma level res == flow level res (both at kFlowFinest), so index 1:1. + float lL = fetchL(gid + ivec2(-1, 0), dim); + float lR = fetchL(gid + ivec2( 1, 0), dim); + float lU = fetchL(gid + ivec2( 0,-1), dim); + float lD = fetchL(gid + ivec2( 0, 1), dim); + float gmag = 0.5 * length(vec2(lR - lL, lD - lU)); // |∇I|, central diff + float g = clamp(exp(-edgeAlpha * gmag), 0.05, 1.0); // small across silhouettes + + // ── TV diffusivity per face: w = g / sqrt(|Δu|² + ε²) ─────────────────────── + // |Δu| is the full 4-vector flow difference (vectorial-TV coupling: fwd & bwd + // share the same motion discontinuities). Large across a flow edge ⇒ small w ⇒ + // the edge is preserved; ~0 in flat regions ⇒ large w ⇒ strong smoothing. + vec4 dL = uL - uC, dR = uR - uC, dU = uU - uC, dD = uD - uC; + float e2 = epsTV * epsTV; + float qL = inversesqrt(dot(dL, dL) + e2); + float qR = inversesqrt(dot(dR, dR) + e2); + float qU = inversesqrt(dot(dU, dU) + e2); + float qD = inversesqrt(dot(dD, dD) + e2); + + float sumW = g * (qL + qR + qU + qD); + vec4 sumWU = g * (qL * uL + qR * uR + qU * uU + qD * uD); + + // Semi-implicit (Jacobi) TV step: a convex combination of uC and the + // edge/TV-weighted neighbour mean ⇒ unconditionally stable, always finite. + vec4 uDiff = (uC + dt * sumWU) / (1.0 + dt * sumW); + + // ── L1 data term (exact TV-L1 soft-threshold toward the fixed observation) ── + // r>θ ⇒ u=uDiff−θ , r<−θ ⇒ u=uDiff+θ , |r|≤θ ⇒ u=f0 , with θ = dt·λ. + // The branchless form u = uDiff − clamp(r,−θ,θ) is identical per component. + vec4 f0 = texelFetch(uFlowObs, gid, 0); + float theta = dt * lambda; + vec4 r = uDiff - f0; + vec4 uNew = uDiff - clamp(r, vec4(-theta), vec4(theta)); + + imageStore(uFlowOut, gid, uNew); +} From ea3365232f2444ca99b3adeae8c2e4146b0b16f6 Mon Sep 17 00:00:00 2001 From: EnzoDLofi Date: Fri, 27 Nov 2026 00:09:54 -0400 Subject: [PATCH 005/120] Optimize DD FrameGen flow regularization shader --- app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp b/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp index dba9f7724e..65cb1881d3 100644 --- a/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp +++ b/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp @@ -226,8 +226,8 @@ static const uint32_t OF3_GM_REDUCE_SPV[] = {0x07230203u,0x00010300u,0x0008000bu static const size_t OF3_GM_REDUCE_LEN = 2584; static const uint32_t OF3_GM_PREWARP_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000074u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000000du,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00030005u,0x00000009u,0x00646967u,0x00080005u,0x0000000du,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000016u,0x74734475u,0x00000000u,0x00030005u,0x00000030u,0x00007675u,0x00030005u,0x00000039u,0x00000071u,0x00040005u,0x0000003du,0x6c6f6370u,0x00000030u,0x00030005u,0x0000003fu,0x00004d47u,0x00050006u,0x0000003fu,0x00000000u,0x694c6d67u,0x0000006eu,0x00050006u,0x0000003fu,0x00000001u,0x694c6d67u,0x0000546eu,0x00050006u,0x0000003fu,0x00000002u,0x70416d67u,0x00000070u,0x00050006u,0x0000003fu,0x00000003u,0x70416d67u,0x00005470u,0x00030005u,0x00000041u,0x00000000u,0x00040005u,0x00000049u,0x6c6f6370u,0x00000031u,0x00040005u,0x00000051u,0x72537675u,0x00000063u,0x00030005u,0x00000064u,0x00000076u,0x00040005u,0x00000068u,0x72754375u,0x00000072u,0x00040047u,0x0000000du,0x0000000bu,0x0000001cu,0x00030047u,0x00000016u,0x00000019u,0x00040047u,0x00000016u,0x00000021u,0x00000030u,0x00040047u,0x00000016u,0x00000022u,0x00000000u,0x00030047u,0x0000003fu,0x00000002u,0x00050048u,0x0000003fu,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x0000003fu,0x00000001u,0x00000023u,0x00000010u,0x00050048u,0x0000003fu,0x00000002u,0x00000023u,0x00000020u,0x00050048u,0x0000003fu,0x00000003u,0x00000023u,0x00000030u,0x00040047u,0x00000041u,0x00000021u,0x00000001u,0x00040047u,0x00000041u,0x00000022u,0x00000000u,0x00040047u,0x00000068u,0x00000021u,0x00000020u,0x00040047u,0x00000068u,0x00000022u,0x00000000u,0x00040047u,0x00000073u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00040015u,0x0000000au,0x00000020u,0x00000000u,0x00040017u,0x0000000bu,0x0000000au,0x00000003u,0x00040020u,0x0000000cu,0x00000001u,0x0000000bu,0x0004003bu,0x0000000cu,0x0000000du,0x00000001u,0x00040017u,0x0000000eu,0x0000000au,0x00000002u,0x00030016u,0x00000013u,0x00000020u,0x00090019u,0x00000014u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000003u,0x00040020u,0x00000015u,0x00000000u,0x00000014u,0x0004003bu,0x00000015u,0x00000016u,0x00000000u,0x00020014u,0x00000019u,0x0004002bu,0x0000000au,0x0000001au,0x00000000u,0x00040020u,0x0000001bu,0x00000007u,0x00000006u,0x0004002bu,0x0000000au,0x00000024u,0x00000001u,0x00040017u,0x0000002eu,0x00000013u,0x00000002u,0x00040020u,0x0000002fu,0x00000007u,0x0000002eu,0x0004002bu,0x00000013u,0x00000033u,0x3f000000u,0x00040017u,0x0000003eu,0x00000013u,0x00000004u,0x0006001eu,0x0000003fu,0x0000003eu,0x0000003eu,0x0000003eu,0x0000003eu,0x00040020u,0x00000040u,0x00000002u,0x0000003fu,0x0004003bu,0x00000040u,0x00000041u,0x00000002u,0x0004002bu,0x00000006u,0x00000042u,0x00000002u,0x00040020u,0x00000043u,0x00000002u,0x00000013u,0x0004002bu,0x0000000au,0x0000004au,0x00000002u,0x0004002bu,0x0000000au,0x0000004du,0x00000003u,0x00040020u,0x00000054u,0x00000007u,0x00000013u,0x0004002bu,0x00000006u,0x0000005eu,0x00000003u,0x00040020u,0x0000005fu,0x00000002u,0x0000003eu,0x00090019u,0x00000065u,0x00000013u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000066u,0x00000065u,0x00040020u,0x00000067u,0x00000000u,0x00000066u,0x0004003bu,0x00000067u,0x00000068u,0x00000000u,0x0004002bu,0x00000013u,0x0000006bu,0x00000000u,0x0004002bu,0x0000000au,0x00000072u,0x00000010u,0x0006002cu,0x0000000bu,0x00000073u,0x00000072u,0x00000072u,0x00000024u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000008u,0x00000009u,0x00000007u,0x0004003bu,0x00000008u,0x00000012u,0x00000007u,0x0004003bu,0x0000002fu,0x00000030u,0x00000007u,0x0004003bu,0x0000002fu,0x00000039u,0x00000007u,0x0004003bu,0x0000002fu,0x0000003du,0x00000007u,0x0004003bu,0x0000002fu,0x00000049u,0x00000007u,0x0004003bu,0x0000002fu,0x00000051u,0x00000007u,0x0004003bu,0x00000054u,0x00000064u,0x00000007u,0x0004003du,0x0000000bu,0x0000000fu,0x0000000du,0x0007004fu,0x0000000eu,0x00000010u,0x0000000fu,0x0000000fu,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x00000011u,0x00000010u,0x0003003eu,0x00000009u,0x00000011u,0x0004003du,0x00000014u,0x00000017u,0x00000016u,0x00040068u,0x00000007u,0x00000018u,0x00000017u,0x0003003eu,0x00000012u,0x00000018u,0x00050041u,0x0000001bu,0x0000001cu,0x00000009u,0x0000001au,0x0004003du,0x00000006u,0x0000001du,0x0000001cu,0x00050041u,0x0000001bu,0x0000001eu,0x00000012u,0x0000001au,0x0004003du,0x00000006u,0x0000001fu,0x0000001eu,0x000500afu,0x00000019u,0x00000020u,0x0000001du,0x0000001fu,0x000400a8u,0x00000019u,0x00000021u,0x00000020u,0x000300f7u,0x00000023u,0x00000000u,0x000400fau,0x00000021u,0x00000022u,0x00000023u,0x000200f8u,0x00000022u,0x00050041u,0x0000001bu,0x00000025u,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000026u,0x00000025u,0x00050041u,0x0000001bu,0x00000027u,0x00000012u,0x00000024u,0x0004003du,0x00000006u,0x00000028u,0x00000027u,0x000500afu,0x00000019u,0x00000029u,0x00000026u,0x00000028u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x000700f5u,0x00000019u,0x0000002au,0x00000020u,0x00000005u,0x00000029u,0x00000022u,0x000300f7u,0x0000002cu,0x00000000u,0x000400fau,0x0000002au,0x0000002bu,0x0000002cu,0x000200f8u,0x0000002bu,0x000100fdu,0x000200f8u,0x0000002cu,0x0004003du,0x00000007u,0x00000031u,0x00000009u,0x0004006fu,0x0000002eu,0x00000032u,0x00000031u,0x00050050u,0x0000002eu,0x00000034u,0x00000033u,0x00000033u,0x00050081u,0x0000002eu,0x00000035u,0x00000032u,0x00000034u,0x0004003du,0x00000007u,0x00000036u,0x00000012u,0x0004006fu,0x0000002eu,0x00000037u,0x00000036u,0x00050088u,0x0000002eu,0x00000038u,0x00000035u,0x00000037u,0x0003003eu,0x00000030u,0x00000038u,0x0004003du,0x0000002eu,0x0000003au,0x00000030u,0x00050050u,0x0000002eu,0x0000003bu,0x00000033u,0x00000033u,0x00050083u,0x0000002eu,0x0000003cu,0x0000003au,0x0000003bu,0x0003003eu,0x00000039u,0x0000003cu,0x00060041u,0x00000043u,0x00000044u,0x00000041u,0x00000042u,0x0000001au,0x0004003du,0x00000013u,0x00000045u,0x00000044u,0x00060041u,0x00000043u,0x00000046u,0x00000041u,0x00000042u,0x00000024u,0x0004003du,0x00000013u,0x00000047u,0x00000046u,0x00050050u,0x0000002eu,0x00000048u,0x00000045u,0x00000047u,0x0003003eu,0x0000003du,0x00000048u,0x00060041u,0x00000043u,0x0000004bu,0x00000041u,0x00000042u,0x0000004au,0x0004003du,0x00000013u,0x0000004cu,0x0000004bu,0x00060041u,0x00000043u,0x0000004eu,0x00000041u,0x00000042u,0x0000004du,0x0004003du,0x00000013u,0x0000004fu,0x0000004eu,0x00050050u,0x0000002eu,0x00000050u,0x0000004cu,0x0000004fu,0x0003003eu,0x00000049u,0x00000050u,0x0004003du,0x0000002eu,0x00000052u,0x00000030u,0x0004003du,0x0000002eu,0x00000053u,0x0000003du,0x00050041u,0x00000054u,0x00000055u,0x00000039u,0x0000001au,0x0004003du,0x00000013u,0x00000056u,0x00000055u,0x0005008eu,0x0000002eu,0x00000057u,0x00000053u,0x00000056u,0x00050081u,0x0000002eu,0x00000058u,0x00000052u,0x00000057u,0x0004003du,0x0000002eu,0x00000059u,0x00000049u,0x00050041u,0x00000054u,0x0000005au,0x00000039u,0x00000024u,0x0004003du,0x00000013u,0x0000005bu,0x0000005au,0x0005008eu,0x0000002eu,0x0000005cu,0x00000059u,0x0000005bu,0x00050081u,0x0000002eu,0x0000005du,0x00000058u,0x0000005cu,0x00050041u,0x0000005fu,0x00000060u,0x00000041u,0x0000005eu,0x0004003du,0x0000003eu,0x00000061u,0x00000060u,0x0007004fu,0x0000002eu,0x00000062u,0x00000061u,0x00000061u,0x00000000u,0x00000001u,0x00050081u,0x0000002eu,0x00000063u,0x0000005du,0x00000062u,0x0003003eu,0x00000051u,0x00000063u,0x0004003du,0x00000066u,0x00000069u,0x00000068u,0x0004003du,0x0000002eu,0x0000006au,0x00000051u,0x00070058u,0x0000003eu,0x0000006cu,0x00000069u,0x0000006au,0x00000002u,0x0000006bu,0x00050051u,0x00000013u,0x0000006du,0x0000006cu,0x00000000u,0x0003003eu,0x00000064u,0x0000006du,0x0004003du,0x00000014u,0x0000006eu,0x00000016u,0x0004003du,0x00000007u,0x0000006fu,0x00000009u,0x0004003du,0x00000013u,0x00000070u,0x00000064u,0x00070050u,0x0000003eu,0x00000071u,0x00000070u,0x0000006bu,0x0000006bu,0x0000006bu,0x00040063u,0x0000006eu,0x0000006fu,0x00000071u,0x000100fdu,0x00010038u}; static const size_t OF3_GM_PREWARP_LEN = 706; -static const uint32_t OF3_FLOWREG_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000144u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x00000037u,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00060005u,0x0000000eu,0x63746566u,0x76285568u,0x763b3269u,0x003b3269u,0x00030005u,0x0000000cu,0x00000070u,0x00030005u,0x0000000du,0x006d6964u,0x00060005u,0x00000013u,0x63746566u,0x76284c68u,0x763b3269u,0x003b3269u,0x00030005u,0x00000011u,0x00000070u,0x00030005u,0x00000012u,0x006d6964u,0x00040005u,0x00000018u,0x6f6c4675u,0x006e4977u,0x00040005u,0x00000026u,0x6d754c75u,0x00000061u,0x00030005u,0x00000034u,0x00646967u,0x00080005u,0x00000037u,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x0000003cu,0x006d6964u,0x00030005u,0x00000055u,0x00007464u,0x00030005u,0x00000056u,0x00000055u,0x00050006u,0x00000056u,0x00000000u,0x61726170u,0x0000736du,0x00030005u,0x00000058u,0x00000000u,0x00040005u,0x0000005cu,0x626d616cu,0x00006164u,0x00050005u,0x0000005fu,0x65676465u,0x68706c41u,0x00000061u,0x00040005u,0x00000063u,0x54737065u,0x00000056u,0x00030005u,0x00000068u,0x00004375u,0x00040005u,0x00000069u,0x61726170u,0x0000006du,0x00040005u,0x0000006bu,0x61726170u,0x0000006du,0x00030005u,0x0000006eu,0x00004c75u,0x00040005u,0x00000073u,0x61726170u,0x0000006du,0x00040005u,0x00000074u,0x61726170u,0x0000006du,0x00030005u,0x00000077u,0x00005275u,0x00040005u,0x0000007bu,0x61726170u,0x0000006du,0x00040005u,0x0000007cu,0x61726170u,0x0000006du,0x00030005u,0x0000007fu,0x00005575u,0x00040005u,0x00000083u,0x61726170u,0x0000006du,0x00040005u,0x00000084u,0x61726170u,0x0000006du,0x00030005u,0x00000087u,0x00004475u,0x00040005u,0x0000008bu,0x61726170u,0x0000006du,0x00040005u,0x0000008cu,0x61726170u,0x0000006du,0x00040005u,0x0000008fu,0x6d69646cu,0x00000000u,0x00030005u,0x00000093u,0x00004c6cu,0x00040005u,0x00000096u,0x61726170u,0x0000006du,0x00040005u,0x00000097u,0x61726170u,0x0000006du,0x00030005u,0x0000009au,0x0000526cu,0x00040005u,0x0000009du,0x61726170u,0x0000006du,0x00040005u,0x0000009eu,0x61726170u,0x0000006du,0x00030005u,0x000000a1u,0x0000556cu,0x00040005u,0x000000a4u,0x61726170u,0x0000006du,0x00040005u,0x000000a5u,0x61726170u,0x0000006du,0x00030005u,0x000000a8u,0x0000446cu,0x00040005u,0x000000abu,0x61726170u,0x0000006du,0x00040005u,0x000000acu,0x61726170u,0x0000006du,0x00040005u,0x000000afu,0x67616d67u,0x00000000u,0x00030005u,0x000000bbu,0x00000067u,0x00030005u,0x000000c4u,0x00004c64u,0x00030005u,0x000000c8u,0x00005264u,0x00030005u,0x000000ccu,0x00005564u,0x00030005u,0x000000d0u,0x00004464u,0x00030005u,0x000000d4u,0x00003265u,0x00030005u,0x000000d8u,0x00004c77u,0x00030005u,0x000000e1u,0x00005277u,0x00030005u,0x000000eau,0x00005577u,0x00030005u,0x000000f3u,0x00004477u,0x00040005u,0x000000fcu,0x576d7573u,0x00000000u,0x00040005u,0x00000104u,0x576d7573u,0x00000055u,0x00040005u,0x00000114u,0x66694475u,0x00000066u,0x00030005u,0x00000120u,0x00003066u,0x00050005u,0x00000121u,0x6f6c4675u,0x73624f77u,0x00000000u,0x00040005u,0x0000012au,0x74656874u,0x00000061u,0x00030005u,0x0000012eu,0x00000072u,0x00040005u,0x00000132u,0x77654e75u,0x00000000u,0x00050005u,0x0000013eu,0x6f6c4675u,0x74754f77u,0x00000000u,0x00040047u,0x00000018u,0x00000021u,0x00000020u,0x00040047u,0x00000018u,0x00000022u,0x00000000u,0x00040047u,0x00000026u,0x00000021u,0x00000022u,0x00040047u,0x00000026u,0x00000022u,0x00000000u,0x00040047u,0x00000037u,0x0000000bu,0x0000001cu,0x00030047u,0x00000056u,0x00000002u,0x00050048u,0x00000056u,0x00000000u,0x00000023u,0x00000000u,0x00040047u,0x00000058u,0x00000021u,0x00000000u,0x00040047u,0x00000058u,0x00000022u,0x00000000u,0x00040047u,0x00000121u,0x00000021u,0x00000021u,0x00040047u,0x00000121u,0x00000022u,0x00000000u,0x00030047u,0x0000013eu,0x00000019u,0x00040047u,0x0000013eu,0x00000021u,0x00000030u,0x00040047u,0x0000013eu,0x00000022u,0x00000000u,0x00040047u,0x00000143u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00030016u,0x00000009u,0x00000020u,0x00040017u,0x0000000au,0x00000009u,0x00000004u,0x00050021u,0x0000000bu,0x0000000au,0x00000008u,0x00000008u,0x00050021u,0x00000010u,0x00000009u,0x00000008u,0x00000008u,0x00090019u,0x00000015u,0x00000009u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000016u,0x00000015u,0x00040020u,0x00000017u,0x00000000u,0x00000016u,0x0004003bu,0x00000017u,0x00000018u,0x00000000u,0x0004002bu,0x00000006u,0x0000001bu,0x00000000u,0x0005002cu,0x00000007u,0x0000001cu,0x0000001bu,0x0000001bu,0x0004002bu,0x00000006u,0x0000001eu,0x00000001u,0x0004003bu,0x00000017u,0x00000026u,0x00000000u,0x00040015u,0x0000002fu,0x00000020u,0x00000000u,0x0004002bu,0x0000002fu,0x00000030u,0x00000000u,0x00040017u,0x00000035u,0x0000002fu,0x00000003u,0x00040020u,0x00000036u,0x00000001u,0x00000035u,0x0004003bu,0x00000036u,0x00000037u,0x00000001u,0x00040017u,0x00000038u,0x0000002fu,0x00000002u,0x00020014u,0x00000040u,0x00040020u,0x00000041u,0x00000007u,0x00000006u,0x0004002bu,0x0000002fu,0x0000004au,0x00000001u,0x00040020u,0x00000054u,0x00000007u,0x00000009u,0x0003001eu,0x00000056u,0x0000000au,0x00040020u,0x00000057u,0x00000002u,0x00000056u,0x0004003bu,0x00000057u,0x00000058u,0x00000002u,0x00040020u,0x00000059u,0x00000002u,0x00000009u,0x0004002bu,0x0000002fu,0x00000060u,0x00000002u,0x0004002bu,0x0000002fu,0x00000064u,0x00000003u,0x00040020u,0x00000067u,0x00000007u,0x0000000au,0x0004002bu,0x00000006u,0x00000070u,0xffffffffu,0x0005002cu,0x00000007u,0x00000071u,0x00000070u,0x0000001bu,0x0005002cu,0x00000007u,0x00000079u,0x0000001eu,0x0000001bu,0x0005002cu,0x00000007u,0x00000081u,0x0000001bu,0x00000070u,0x0005002cu,0x00000007u,0x00000089u,0x0000001bu,0x0000001eu,0x0004002bu,0x00000009u,0x000000b0u,0x3f000000u,0x00040017u,0x000000b7u,0x00000009u,0x00000002u,0x0004002bu,0x00000009u,0x000000c1u,0x3d4ccccdu,0x0004002bu,0x00000009u,0x000000c2u,0x3f800000u,0x0004003bu,0x00000017u,0x00000121u,0x00000000u,0x00090019u,0x0000013cu,0x00000009u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000002u,0x00040020u,0x0000013du,0x00000000u,0x0000013cu,0x0004003bu,0x0000013du,0x0000013eu,0x00000000u,0x0004002bu,0x0000002fu,0x00000142u,0x00000010u,0x0006002cu,0x00000035u,0x00000143u,0x00000142u,0x00000142u,0x0000004au,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000008u,0x00000034u,0x00000007u,0x0004003bu,0x00000008u,0x0000003cu,0x00000007u,0x0004003bu,0x00000054u,0x00000055u,0x00000007u,0x0004003bu,0x00000054u,0x0000005cu,0x00000007u,0x0004003bu,0x00000054u,0x0000005fu,0x00000007u,0x0004003bu,0x00000054u,0x00000063u,0x00000007u,0x0004003bu,0x00000067u,0x00000068u,0x00000007u,0x0004003bu,0x00000008u,0x00000069u,0x00000007u,0x0004003bu,0x00000008u,0x0000006bu,0x00000007u,0x0004003bu,0x00000067u,0x0000006eu,0x00000007u,0x0004003bu,0x00000008u,0x00000073u,0x00000007u,0x0004003bu,0x00000008u,0x00000074u,0x00000007u,0x0004003bu,0x00000067u,0x00000077u,0x00000007u,0x0004003bu,0x00000008u,0x0000007bu,0x00000007u,0x0004003bu,0x00000008u,0x0000007cu,0x00000007u,0x0004003bu,0x00000067u,0x0000007fu,0x00000007u,0x0004003bu,0x00000008u,0x00000083u,0x00000007u,0x0004003bu,0x00000008u,0x00000084u,0x00000007u,0x0004003bu,0x00000067u,0x00000087u,0x00000007u,0x0004003bu,0x00000008u,0x0000008bu,0x00000007u,0x0004003bu,0x00000008u,0x0000008cu,0x00000007u,0x0004003bu,0x00000008u,0x0000008fu,0x00000007u,0x0004003bu,0x00000054u,0x00000093u,0x00000007u,0x0004003bu,0x00000008u,0x00000096u,0x00000007u,0x0004003bu,0x00000008u,0x00000097u,0x00000007u,0x0004003bu,0x00000054u,0x0000009au,0x00000007u,0x0004003bu,0x00000008u,0x0000009du,0x00000007u,0x0004003bu,0x00000008u,0x0000009eu,0x00000007u,0x0004003bu,0x00000054u,0x000000a1u,0x00000007u,0x0004003bu,0x00000008u,0x000000a4u,0x00000007u,0x0004003bu,0x00000008u,0x000000a5u,0x00000007u,0x0004003bu,0x00000054u,0x000000a8u,0x00000007u,0x0004003bu,0x00000008u,0x000000abu,0x00000007u,0x0004003bu,0x00000008u,0x000000acu,0x00000007u,0x0004003bu,0x00000054u,0x000000afu,0x00000007u,0x0004003bu,0x00000054u,0x000000bbu,0x00000007u,0x0004003bu,0x00000067u,0x000000c4u,0x00000007u,0x0004003bu,0x00000067u,0x000000c8u,0x00000007u,0x0004003bu,0x00000067u,0x000000ccu,0x00000007u,0x0004003bu,0x00000067u,0x000000d0u,0x00000007u,0x0004003bu,0x00000054u,0x000000d4u,0x00000007u,0x0004003bu,0x00000054u,0x000000d8u,0x00000007u,0x0004003bu,0x00000054u,0x000000e1u,0x00000007u,0x0004003bu,0x00000054u,0x000000eau,0x00000007u,0x0004003bu,0x00000054u,0x000000f3u,0x00000007u,0x0004003bu,0x00000054u,0x000000fcu,0x00000007u,0x0004003bu,0x00000067u,0x00000104u,0x00000007u,0x0004003bu,0x00000067u,0x00000114u,0x00000007u,0x0004003bu,0x00000067u,0x00000120u,0x00000007u,0x0004003bu,0x00000054u,0x0000012au,0x00000007u,0x0004003bu,0x00000067u,0x0000012eu,0x00000007u,0x0004003bu,0x00000067u,0x00000132u,0x00000007u,0x0004003du,0x00000035u,0x00000039u,0x00000037u,0x0007004fu,0x00000038u,0x0000003au,0x00000039u,0x00000039u,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x0000003bu,0x0000003au,0x0003003eu,0x00000034u,0x0000003bu,0x0004003du,0x00000016u,0x0000003du,0x00000018u,0x00040064u,0x00000015u,0x0000003eu,0x0000003du,0x00050067u,0x00000007u,0x0000003fu,0x0000003eu,0x0000001bu,0x0003003eu,0x0000003cu,0x0000003fu,0x00050041u,0x00000041u,0x00000042u,0x00000034u,0x00000030u,0x0004003du,0x00000006u,0x00000043u,0x00000042u,0x00050041u,0x00000041u,0x00000044u,0x0000003cu,0x00000030u,0x0004003du,0x00000006u,0x00000045u,0x00000044u,0x000500afu,0x00000040u,0x00000046u,0x00000043u,0x00000045u,0x000400a8u,0x00000040u,0x00000047u,0x00000046u,0x000300f7u,0x00000049u,0x00000000u,0x000400fau,0x00000047u,0x00000048u,0x00000049u,0x000200f8u,0x00000048u,0x00050041u,0x00000041u,0x0000004bu,0x00000034u,0x0000004au,0x0004003du,0x00000006u,0x0000004cu,0x0000004bu,0x00050041u,0x00000041u,0x0000004du,0x0000003cu,0x0000004au,0x0004003du,0x00000006u,0x0000004eu,0x0000004du,0x000500afu,0x00000040u,0x0000004fu,0x0000004cu,0x0000004eu,0x000200f9u,0x00000049u,0x000200f8u,0x00000049u,0x000700f5u,0x00000040u,0x00000050u,0x00000046u,0x00000005u,0x0000004fu,0x00000048u,0x000300f7u,0x00000052u,0x00000000u,0x000400fau,0x00000050u,0x00000051u,0x00000052u,0x000200f8u,0x00000051u,0x000100fdu,0x000200f8u,0x00000052u,0x00060041u,0x00000059u,0x0000005au,0x00000058u,0x0000001bu,0x00000030u,0x0004003du,0x00000009u,0x0000005bu,0x0000005au,0x0003003eu,0x00000055u,0x0000005bu,0x00060041u,0x00000059u,0x0000005du,0x00000058u,0x0000001bu,0x0000004au,0x0004003du,0x00000009u,0x0000005eu,0x0000005du,0x0003003eu,0x0000005cu,0x0000005eu,0x00060041u,0x00000059u,0x00000061u,0x00000058u,0x0000001bu,0x00000060u,0x0004003du,0x00000009u,0x00000062u,0x00000061u,0x0003003eu,0x0000005fu,0x00000062u,0x00060041u,0x00000059u,0x00000065u,0x00000058u,0x0000001bu,0x00000064u,0x0004003du,0x00000009u,0x00000066u,0x00000065u,0x0003003eu,0x00000063u,0x00000066u,0x0004003du,0x00000007u,0x0000006au,0x00000034u,0x0003003eu,0x00000069u,0x0000006au,0x0004003du,0x00000007u,0x0000006cu,0x0000003cu,0x0003003eu,0x0000006bu,0x0000006cu,0x00060039u,0x0000000au,0x0000006du,0x0000000eu,0x00000069u,0x0000006bu,0x0003003eu,0x00000068u,0x0000006du,0x0004003du,0x00000007u,0x0000006fu,0x00000034u,0x00050080u,0x00000007u,0x00000072u,0x0000006fu,0x00000071u,0x0003003eu,0x00000073u,0x00000072u,0x0004003du,0x00000007u,0x00000075u,0x0000003cu,0x0003003eu,0x00000074u,0x00000075u,0x00060039u,0x0000000au,0x00000076u,0x0000000eu,0x00000073u,0x00000074u,0x0003003eu,0x0000006eu,0x00000076u,0x0004003du,0x00000007u,0x00000078u,0x00000034u,0x00050080u,0x00000007u,0x0000007au,0x00000078u,0x00000079u,0x0003003eu,0x0000007bu,0x0000007au,0x0004003du,0x00000007u,0x0000007du,0x0000003cu,0x0003003eu,0x0000007cu,0x0000007du,0x00060039u,0x0000000au,0x0000007eu,0x0000000eu,0x0000007bu,0x0000007cu,0x0003003eu,0x00000077u,0x0000007eu,0x0004003du,0x00000007u,0x00000080u,0x00000034u,0x00050080u,0x00000007u,0x00000082u,0x00000080u,0x00000081u,0x0003003eu,0x00000083u,0x00000082u,0x0004003du,0x00000007u,0x00000085u,0x0000003cu,0x0003003eu,0x00000084u,0x00000085u,0x00060039u,0x0000000au,0x00000086u,0x0000000eu,0x00000083u,0x00000084u,0x0003003eu,0x0000007fu,0x00000086u,0x0004003du,0x00000007u,0x00000088u,0x00000034u,0x00050080u,0x00000007u,0x0000008au,0x00000088u,0x00000089u,0x0003003eu,0x0000008bu,0x0000008au,0x0004003du,0x00000007u,0x0000008du,0x0000003cu,0x0003003eu,0x0000008cu,0x0000008du,0x00060039u,0x0000000au,0x0000008eu,0x0000000eu,0x0000008bu,0x0000008cu,0x0003003eu,0x00000087u,0x0000008eu,0x0004003du,0x00000016u,0x00000090u,0x00000026u,0x00040064u,0x00000015u,0x00000091u,0x00000090u,0x00050067u,0x00000007u,0x00000092u,0x00000091u,0x0000001bu,0x0003003eu,0x0000008fu,0x00000092u,0x0004003du,0x00000007u,0x00000094u,0x00000034u,0x00050080u,0x00000007u,0x00000095u,0x00000094u,0x00000071u,0x0003003eu,0x00000096u,0x00000095u,0x0004003du,0x00000007u,0x00000098u,0x0000008fu,0x0003003eu,0x00000097u,0x00000098u,0x00060039u,0x00000009u,0x00000099u,0x00000013u,0x00000096u,0x00000097u,0x0003003eu,0x00000093u,0x00000099u,0x0004003du,0x00000007u,0x0000009bu,0x00000034u,0x00050080u,0x00000007u,0x0000009cu,0x0000009bu,0x00000079u,0x0003003eu,0x0000009du,0x0000009cu,0x0004003du,0x00000007u,0x0000009fu,0x0000008fu,0x0003003eu,0x0000009eu,0x0000009fu,0x00060039u,0x00000009u,0x000000a0u,0x00000013u,0x0000009du,0x0000009eu,0x0003003eu,0x0000009au,0x000000a0u,0x0004003du,0x00000007u,0x000000a2u,0x00000034u,0x00050080u,0x00000007u,0x000000a3u,0x000000a2u,0x00000081u,0x0003003eu,0x000000a4u,0x000000a3u,0x0004003du,0x00000007u,0x000000a6u,0x0000008fu,0x0003003eu,0x000000a5u,0x000000a6u,0x00060039u,0x00000009u,0x000000a7u,0x00000013u,0x000000a4u,0x000000a5u,0x0003003eu,0x000000a1u,0x000000a7u,0x0004003du,0x00000007u,0x000000a9u,0x00000034u,0x00050080u,0x00000007u,0x000000aau,0x000000a9u,0x00000089u,0x0003003eu,0x000000abu,0x000000aau,0x0004003du,0x00000007u,0x000000adu,0x0000008fu,0x0003003eu,0x000000acu,0x000000adu,0x00060039u,0x00000009u,0x000000aeu,0x00000013u,0x000000abu,0x000000acu,0x0003003eu,0x000000a8u,0x000000aeu,0x0004003du,0x00000009u,0x000000b1u,0x0000009au,0x0004003du,0x00000009u,0x000000b2u,0x00000093u,0x00050083u,0x00000009u,0x000000b3u,0x000000b1u,0x000000b2u,0x0004003du,0x00000009u,0x000000b4u,0x000000a8u,0x0004003du,0x00000009u,0x000000b5u,0x000000a1u,0x00050083u,0x00000009u,0x000000b6u,0x000000b4u,0x000000b5u,0x00050050u,0x000000b7u,0x000000b8u,0x000000b3u,0x000000b6u,0x0006000cu,0x00000009u,0x000000b9u,0x00000001u,0x00000042u,0x000000b8u,0x00050085u,0x00000009u,0x000000bau,0x000000b0u,0x000000b9u,0x0003003eu,0x000000afu,0x000000bau,0x0004003du,0x00000009u,0x000000bcu,0x0000005fu,0x0004007fu,0x00000009u,0x000000bdu,0x000000bcu,0x0004003du,0x00000009u,0x000000beu,0x000000afu,0x00050085u,0x00000009u,0x000000bfu,0x000000bdu,0x000000beu,0x0006000cu,0x00000009u,0x000000c0u,0x00000001u,0x0000001bu,0x000000bfu,0x0008000cu,0x00000009u,0x000000c3u,0x00000001u,0x0000002bu,0x000000c0u,0x000000c1u,0x000000c2u,0x0003003eu,0x000000bbu,0x000000c3u,0x0004003du,0x0000000au,0x000000c5u,0x0000006eu,0x0004003du,0x0000000au,0x000000c6u,0x00000068u,0x00050083u,0x0000000au,0x000000c7u,0x000000c5u,0x000000c6u,0x0003003eu,0x000000c4u,0x000000c7u,0x0004003du,0x0000000au,0x000000c9u,0x00000077u,0x0004003du,0x0000000au,0x000000cau,0x00000068u,0x00050083u,0x0000000au,0x000000cbu,0x000000c9u,0x000000cau,0x0003003eu,0x000000c8u,0x000000cbu,0x0004003du,0x0000000au,0x000000cdu,0x0000007fu,0x0004003du,0x0000000au,0x000000ceu,0x00000068u,0x00050083u,0x0000000au,0x000000cfu,0x000000cdu,0x000000ceu,0x0003003eu,0x000000ccu,0x000000cfu,0x0004003du,0x0000000au,0x000000d1u,0x00000087u,0x0004003du,0x0000000au,0x000000d2u,0x00000068u,0x00050083u,0x0000000au,0x000000d3u,0x000000d1u,0x000000d2u,0x0003003eu,0x000000d0u,0x000000d3u,0x0004003du,0x00000009u,0x000000d5u,0x00000063u,0x0004003du,0x00000009u,0x000000d6u,0x00000063u,0x00050085u,0x00000009u,0x000000d7u,0x000000d5u,0x000000d6u,0x0003003eu,0x000000d4u,0x000000d7u,0x0004003du,0x00000009u,0x000000d9u,0x000000bbu,0x0004003du,0x0000000au,0x000000dau,0x000000c4u,0x0004003du,0x0000000au,0x000000dbu,0x000000c4u,0x00050094u,0x00000009u,0x000000dcu,0x000000dau,0x000000dbu,0x0004003du,0x00000009u,0x000000ddu,0x000000d4u,0x00050081u,0x00000009u,0x000000deu,0x000000dcu,0x000000ddu,0x0006000cu,0x00000009u,0x000000dfu,0x00000001u,0x00000020u,0x000000deu,0x00050085u,0x00000009u,0x000000e0u,0x000000d9u,0x000000dfu,0x0003003eu,0x000000d8u,0x000000e0u,0x0004003du,0x00000009u,0x000000e2u,0x000000bbu,0x0004003du,0x0000000au,0x000000e3u,0x000000c8u,0x0004003du,0x0000000au,0x000000e4u,0x000000c8u,0x00050094u,0x00000009u,0x000000e5u,0x000000e3u,0x000000e4u,0x0004003du,0x00000009u,0x000000e6u,0x000000d4u,0x00050081u,0x00000009u,0x000000e7u,0x000000e5u,0x000000e6u,0x0006000cu,0x00000009u,0x000000e8u,0x00000001u,0x00000020u,0x000000e7u,0x00050085u,0x00000009u,0x000000e9u,0x000000e2u,0x000000e8u,0x0003003eu,0x000000e1u,0x000000e9u,0x0004003du,0x00000009u,0x000000ebu,0x000000bbu,0x0004003du,0x0000000au,0x000000ecu,0x000000ccu,0x0004003du,0x0000000au,0x000000edu,0x000000ccu,0x00050094u,0x00000009u,0x000000eeu,0x000000ecu,0x000000edu,0x0004003du,0x00000009u,0x000000efu,0x000000d4u,0x00050081u,0x00000009u,0x000000f0u,0x000000eeu,0x000000efu,0x0006000cu,0x00000009u,0x000000f1u,0x00000001u,0x00000020u,0x000000f0u,0x00050085u,0x00000009u,0x000000f2u,0x000000ebu,0x000000f1u,0x0003003eu,0x000000eau,0x000000f2u,0x0004003du,0x00000009u,0x000000f4u,0x000000bbu,0x0004003du,0x0000000au,0x000000f5u,0x000000d0u,0x0004003du,0x0000000au,0x000000f6u,0x000000d0u,0x00050094u,0x00000009u,0x000000f7u,0x000000f5u,0x000000f6u,0x0004003du,0x00000009u,0x000000f8u,0x000000d4u,0x00050081u,0x00000009u,0x000000f9u,0x000000f7u,0x000000f8u,0x0006000cu,0x00000009u,0x000000fau,0x00000001u,0x00000020u,0x000000f9u,0x00050085u,0x00000009u,0x000000fbu,0x000000f4u,0x000000fau,0x0003003eu,0x000000f3u,0x000000fbu,0x0004003du,0x00000009u,0x000000fdu,0x000000d8u,0x0004003du,0x00000009u,0x000000feu,0x000000e1u,0x00050081u,0x00000009u,0x000000ffu,0x000000fdu,0x000000feu,0x0004003du,0x00000009u,0x00000100u,0x000000eau,0x00050081u,0x00000009u,0x00000101u,0x000000ffu,0x00000100u,0x0004003du,0x00000009u,0x00000102u,0x000000f3u,0x00050081u,0x00000009u,0x00000103u,0x00000101u,0x00000102u,0x0003003eu,0x000000fcu,0x00000103u,0x0004003du,0x00000009u,0x00000105u,0x000000d8u,0x0004003du,0x0000000au,0x00000106u,0x0000006eu,0x0005008eu,0x0000000au,0x00000107u,0x00000106u,0x00000105u,0x0004003du,0x00000009u,0x00000108u,0x000000e1u,0x0004003du,0x0000000au,0x00000109u,0x00000077u,0x0005008eu,0x0000000au,0x0000010au,0x00000109u,0x00000108u,0x00050081u,0x0000000au,0x0000010bu,0x00000107u,0x0000010au,0x0004003du,0x00000009u,0x0000010cu,0x000000eau,0x0004003du,0x0000000au,0x0000010du,0x0000007fu,0x0005008eu,0x0000000au,0x0000010eu,0x0000010du,0x0000010cu,0x00050081u,0x0000000au,0x0000010fu,0x0000010bu,0x0000010eu,0x0004003du,0x00000009u,0x00000110u,0x000000f3u,0x0004003du,0x0000000au,0x00000111u,0x00000087u,0x0005008eu,0x0000000au,0x00000112u,0x00000111u,0x00000110u,0x00050081u,0x0000000au,0x00000113u,0x0000010fu,0x00000112u,0x0003003eu,0x00000104u,0x00000113u,0x0004003du,0x0000000au,0x00000115u,0x00000068u,0x0004003du,0x00000009u,0x00000116u,0x00000055u,0x0004003du,0x0000000au,0x00000117u,0x00000104u,0x0005008eu,0x0000000au,0x00000118u,0x00000117u,0x00000116u,0x00050081u,0x0000000au,0x00000119u,0x00000115u,0x00000118u,0x0004003du,0x00000009u,0x0000011au,0x00000055u,0x0004003du,0x00000009u,0x0000011bu,0x000000fcu,0x00050085u,0x00000009u,0x0000011cu,0x0000011au,0x0000011bu,0x00050081u,0x00000009u,0x0000011du,0x000000c2u,0x0000011cu,0x00070050u,0x0000000au,0x0000011eu,0x0000011du,0x0000011du,0x0000011du,0x0000011du,0x00050088u,0x0000000au,0x0000011fu,0x00000119u,0x0000011eu,0x0003003eu,0x00000114u,0x0000011fu,0x0004003du,0x00000016u,0x00000122u,0x00000121u,0x0004003du,0x00000007u,0x00000123u,0x00000034u,0x0004003du,0x00000007u,0x00000124u,0x0000003cu,0x00050050u,0x00000007u,0x00000125u,0x0000001eu,0x0000001eu,0x00050082u,0x00000007u,0x00000126u,0x00000124u,0x00000125u,0x0008000cu,0x00000007u,0x00000127u,0x00000001u,0x0000002du,0x00000123u,0x0000001cu,0x00000126u,0x00040064u,0x00000015u,0x00000128u,0x00000122u,0x0007005fu,0x0000000au,0x00000129u,0x00000128u,0x00000127u,0x00000002u,0x0000001bu,0x0003003eu,0x00000120u,0x00000129u,0x0004003du,0x00000009u,0x0000012bu,0x00000055u,0x0004003du,0x00000009u,0x0000012cu,0x0000005cu,0x00050085u,0x00000009u,0x0000012du,0x0000012bu,0x0000012cu,0x0003003eu,0x0000012au,0x0000012du,0x0004003du,0x0000000au,0x0000012fu,0x00000114u,0x0004003du,0x0000000au,0x00000130u,0x00000120u,0x00050083u,0x0000000au,0x00000131u,0x0000012fu,0x00000130u,0x0003003eu,0x0000012eu,0x00000131u,0x0004003du,0x0000000au,0x00000133u,0x00000114u,0x0004003du,0x0000000au,0x00000134u,0x0000012eu,0x0004003du,0x00000009u,0x00000135u,0x0000012au,0x0004007fu,0x00000009u,0x00000136u,0x00000135u,0x00070050u,0x0000000au,0x00000137u,0x00000136u,0x00000136u,0x00000136u,0x00000136u,0x0004003du,0x00000009u,0x00000138u,0x0000012au,0x00070050u,0x0000000au,0x00000139u,0x00000138u,0x00000138u,0x00000138u,0x00000138u,0x0008000cu,0x0000000au,0x0000013au,0x00000001u,0x0000002bu,0x00000134u,0x00000137u,0x00000139u,0x00050083u,0x0000000au,0x0000013bu,0x00000133u,0x0000013au,0x0003003eu,0x00000132u,0x0000013bu,0x0004003du,0x0000013cu,0x0000013fu,0x0000013eu,0x0004003du,0x00000007u,0x00000140u,0x00000034u,0x0004003du,0x0000000au,0x00000141u,0x00000132u,0x00040063u,0x0000013fu,0x00000140u,0x00000141u,0x000100fdu,0x00010038u,0x00050036u,0x0000000au,0x0000000eu,0x00000000u,0x0000000bu,0x00030037u,0x00000008u,0x0000000cu,0x00030037u,0x00000008u,0x0000000du,0x000200f8u,0x0000000fu,0x0004003du,0x00000016u,0x00000019u,0x00000018u,0x0004003du,0x00000007u,0x0000001au,0x0000000cu,0x0004003du,0x00000007u,0x0000001du,0x0000000du,0x00050050u,0x00000007u,0x0000001fu,0x0000001eu,0x0000001eu,0x00050082u,0x00000007u,0x00000020u,0x0000001du,0x0000001fu,0x0008000cu,0x00000007u,0x00000021u,0x00000001u,0x0000002du,0x0000001au,0x0000001cu,0x00000020u,0x00040064u,0x00000015u,0x00000022u,0x00000019u,0x0007005fu,0x0000000au,0x00000023u,0x00000022u,0x00000021u,0x00000002u,0x0000001bu,0x000200feu,0x00000023u,0x00010038u,0x00050036u,0x00000009u,0x00000013u,0x00000000u,0x00000010u,0x00030037u,0x00000008u,0x00000011u,0x00030037u,0x00000008u,0x00000012u,0x000200f8u,0x00000014u,0x0004003du,0x00000016u,0x00000027u,0x00000026u,0x0004003du,0x00000007u,0x00000028u,0x00000011u,0x0004003du,0x00000007u,0x00000029u,0x00000012u,0x00050050u,0x00000007u,0x0000002au,0x0000001eu,0x0000001eu,0x00050082u,0x00000007u,0x0000002bu,0x00000029u,0x0000002au,0x0008000cu,0x00000007u,0x0000002cu,0x00000001u,0x0000002du,0x00000028u,0x0000001cu,0x0000002bu,0x00040064u,0x00000015u,0x0000002du,0x00000027u,0x0007005fu,0x0000000au,0x0000002eu,0x0000002du,0x0000002cu,0x00000002u,0x0000001bu,0x00050051u,0x00000009u,0x00000031u,0x0000002eu,0x00000000u,0x000200feu,0x00000031u,0x00010038u}; -static const size_t OF3_FLOWREG_LEN = 1936; +static const uint32_t OF3_FLOWREG_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000196u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x00000037u,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00040005u,0x00000018u,0x6f6c4675u,0x006e4977u,0x00040005u,0x00000026u,0x6d754c75u,0x00000061u,0x00080005u,0x00000037u,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000056u,0x00000055u,0x00050006u,0x00000056u,0x00000000u,0x61726170u,0x0000736du,0x00030005u,0x00000058u,0x00000000u,0x00050005u,0x00000118u,0x6f6c4675u,0x73624f77u,0x00000000u,0x00050005u,0x00000131u,0x6f6c4675u,0x74754f77u,0x00000000u,0x00040047u,0x00000018u,0x00000021u,0x00000020u,0x00040047u,0x00000018u,0x00000022u,0x00000000u,0x00040047u,0x00000026u,0x00000021u,0x00000022u,0x00040047u,0x00000026u,0x00000022u,0x00000000u,0x00040047u,0x00000037u,0x0000000bu,0x0000001cu,0x00030047u,0x00000056u,0x00000002u,0x00050048u,0x00000056u,0x00000000u,0x00000023u,0x00000000u,0x00040047u,0x00000058u,0x00000021u,0x00000000u,0x00040047u,0x00000058u,0x00000022u,0x00000000u,0x00040047u,0x00000118u,0x00000021u,0x00000021u,0x00040047u,0x00000118u,0x00000022u,0x00000000u,0x00030047u,0x00000131u,0x00000019u,0x00040047u,0x00000131u,0x00000021u,0x00000030u,0x00040047u,0x00000131u,0x00000022u,0x00000000u,0x00040047u,0x00000136u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00040015u,0x00000006u,0x00000020u,0x00000001u,0x00040017u,0x00000007u,0x00000006u,0x00000002u,0x00030016u,0x00000009u,0x00000020u,0x00040017u,0x0000000au,0x00000009u,0x00000004u,0x00090019u,0x00000015u,0x00000009u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000016u,0x00000015u,0x00040020u,0x00000017u,0x00000000u,0x00000016u,0x0004003bu,0x00000017u,0x00000018u,0x00000000u,0x0004002bu,0x00000006u,0x0000001bu,0x00000000u,0x0005002cu,0x00000007u,0x0000001cu,0x0000001bu,0x0000001bu,0x0004002bu,0x00000006u,0x0000001eu,0x00000001u,0x0004003bu,0x00000017u,0x00000026u,0x00000000u,0x00040015u,0x0000002fu,0x00000020u,0x00000000u,0x0004002bu,0x0000002fu,0x00000030u,0x00000000u,0x00040017u,0x00000035u,0x0000002fu,0x00000003u,0x00040020u,0x00000036u,0x00000001u,0x00000035u,0x0004003bu,0x00000036u,0x00000037u,0x00000001u,0x00040017u,0x00000038u,0x0000002fu,0x00000002u,0x00020014u,0x00000040u,0x0004002bu,0x0000002fu,0x0000004au,0x00000001u,0x0003001eu,0x00000056u,0x0000000au,0x00040020u,0x00000057u,0x00000002u,0x00000056u,0x0004003bu,0x00000057u,0x00000058u,0x00000002u,0x00040020u,0x00000059u,0x00000002u,0x00000009u,0x0004002bu,0x0000002fu,0x00000060u,0x00000002u,0x0004002bu,0x0000002fu,0x00000064u,0x00000003u,0x0004002bu,0x00000006u,0x0000006fu,0xffffffffu,0x0005002cu,0x00000007u,0x00000070u,0x0000006fu,0x0000001bu,0x0005002cu,0x00000007u,0x00000078u,0x0000001eu,0x0000001bu,0x0005002cu,0x00000007u,0x00000080u,0x0000001bu,0x0000006fu,0x0005002cu,0x00000007u,0x00000088u,0x0000001bu,0x0000001eu,0x0004002bu,0x00000009u,0x000000abu,0x3f000000u,0x00040017u,0x000000b2u,0x00000009u,0x00000002u,0x0004002bu,0x00000009u,0x000000bcu,0x3d4ccccdu,0x0004002bu,0x00000009u,0x000000bdu,0x3f800000u,0x0004003bu,0x00000017u,0x00000118u,0x00000000u,0x00090019u,0x0000012fu,0x00000009u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000002u,0x00040020u,0x00000130u,0x00000000u,0x0000012fu,0x0004003bu,0x00000130u,0x00000131u,0x00000000u,0x0004002bu,0x0000002fu,0x00000135u,0x00000010u,0x0006002cu,0x00000035u,0x00000136u,0x00000135u,0x00000135u,0x0000004au,0x0005002cu,0x00000007u,0x00000195u,0x0000001eu,0x0000001eu,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x000300f7u,0x00000137u,0x00000000u,0x000300fbu,0x00000030u,0x00000138u,0x000200f8u,0x00000138u,0x0004003du,0x00000035u,0x00000039u,0x00000037u,0x0007004fu,0x00000038u,0x0000003au,0x00000039u,0x00000039u,0x00000000u,0x00000001u,0x0004007cu,0x00000007u,0x0000003bu,0x0000003au,0x0004003du,0x00000016u,0x0000003du,0x00000018u,0x00040064u,0x00000015u,0x0000003eu,0x0000003du,0x00050067u,0x00000007u,0x0000003fu,0x0000003eu,0x0000001bu,0x00050051u,0x00000006u,0x00000043u,0x0000003bu,0x00000000u,0x00050051u,0x00000006u,0x00000045u,0x0000003fu,0x00000000u,0x000500afu,0x00000040u,0x00000046u,0x00000043u,0x00000045u,0x000400a8u,0x00000040u,0x00000047u,0x00000046u,0x000300f7u,0x00000049u,0x00000000u,0x000400fau,0x00000047u,0x00000048u,0x00000049u,0x000200f8u,0x00000048u,0x00050051u,0x00000006u,0x0000004cu,0x0000003bu,0x00000001u,0x00050051u,0x00000006u,0x0000004eu,0x0000003fu,0x00000001u,0x000500afu,0x00000040u,0x0000004fu,0x0000004cu,0x0000004eu,0x000200f9u,0x00000049u,0x000200f8u,0x00000049u,0x000700f5u,0x00000040u,0x00000050u,0x00000046u,0x00000138u,0x0000004fu,0x00000048u,0x000300f7u,0x00000052u,0x00000000u,0x000400fau,0x00000050u,0x00000051u,0x00000052u,0x000200f8u,0x00000051u,0x000200f9u,0x00000137u,0x000200f8u,0x00000052u,0x00060041u,0x00000059u,0x0000005au,0x00000058u,0x0000001bu,0x00000030u,0x0004003du,0x00000009u,0x0000005bu,0x0000005au,0x00060041u,0x00000059u,0x0000005du,0x00000058u,0x0000001bu,0x0000004au,0x0004003du,0x00000009u,0x0000005eu,0x0000005du,0x00060041u,0x00000059u,0x00000061u,0x00000058u,0x0000001bu,0x00000060u,0x0004003du,0x00000009u,0x00000062u,0x00000061u,0x00060041u,0x00000059u,0x00000065u,0x00000058u,0x0000001bu,0x00000064u,0x0004003du,0x00000009u,0x00000066u,0x00000065u,0x0004003du,0x00000016u,0x00000069u,0x00000018u,0x00040064u,0x00000015u,0x0000006bu,0x00000069u,0x0007005fu,0x0000000au,0x0000006cu,0x0000006bu,0x0000003bu,0x00000002u,0x0000001bu,0x00050080u,0x00000007u,0x00000071u,0x0000003bu,0x00000070u,0x0004003du,0x00000016u,0x0000013fu,0x00000018u,0x00050082u,0x00000007u,0x00000143u,0x0000003fu,0x00000195u,0x0008000cu,0x00000007u,0x00000144u,0x00000001u,0x0000002du,0x00000071u,0x0000001cu,0x00000143u,0x00040064u,0x00000015u,0x00000145u,0x0000013fu,0x0007005fu,0x0000000au,0x00000146u,0x00000145u,0x00000144u,0x00000002u,0x0000001bu,0x00050080u,0x00000007u,0x00000079u,0x0000003bu,0x00000078u,0x0004003du,0x00000016u,0x00000149u,0x00000018u,0x0008000cu,0x00000007u,0x0000014eu,0x00000001u,0x0000002du,0x00000079u,0x0000001cu,0x00000143u,0x00040064u,0x00000015u,0x0000014fu,0x00000149u,0x0007005fu,0x0000000au,0x00000150u,0x0000014fu,0x0000014eu,0x00000002u,0x0000001bu,0x00050080u,0x00000007u,0x00000081u,0x0000003bu,0x00000080u,0x0004003du,0x00000016u,0x00000153u,0x00000018u,0x0008000cu,0x00000007u,0x00000158u,0x00000001u,0x0000002du,0x00000081u,0x0000001cu,0x00000143u,0x00040064u,0x00000015u,0x00000159u,0x00000153u,0x0007005fu,0x0000000au,0x0000015au,0x00000159u,0x00000158u,0x00000002u,0x0000001bu,0x00050080u,0x00000007u,0x00000089u,0x0000003bu,0x00000088u,0x0004003du,0x00000016u,0x0000015du,0x00000018u,0x0008000cu,0x00000007u,0x00000162u,0x00000001u,0x0000002du,0x00000089u,0x0000001cu,0x00000143u,0x00040064u,0x00000015u,0x00000163u,0x0000015du,0x0007005fu,0x0000000au,0x00000164u,0x00000163u,0x00000162u,0x00000002u,0x0000001bu,0x0004003du,0x00000016u,0x00000167u,0x00000026u,0x00040064u,0x00000015u,0x0000016du,0x00000167u,0x0007005fu,0x0000000au,0x0000016eu,0x0000016du,0x00000144u,0x00000002u,0x0000001bu,0x00050051u,0x00000009u,0x0000016fu,0x0000016eu,0x00000000u,0x0004003du,0x00000016u,0x00000172u,0x00000026u,0x00040064u,0x00000015u,0x00000178u,0x00000172u,0x0007005fu,0x0000000au,0x00000179u,0x00000178u,0x0000014eu,0x00000002u,0x0000001bu,0x00050051u,0x00000009u,0x0000017au,0x00000179u,0x00000000u,0x0004003du,0x00000016u,0x0000017du,0x00000026u,0x00040064u,0x00000015u,0x00000183u,0x0000017du,0x0007005fu,0x0000000au,0x00000184u,0x00000183u,0x00000158u,0x00000002u,0x0000001bu,0x00050051u,0x00000009u,0x00000185u,0x00000184u,0x00000000u,0x0004003du,0x00000016u,0x00000188u,0x00000026u,0x00040064u,0x00000015u,0x0000018eu,0x00000188u,0x0007005fu,0x0000000au,0x0000018fu,0x0000018eu,0x00000162u,0x00000002u,0x0000001bu,0x00050051u,0x00000009u,0x00000190u,0x0000018fu,0x00000000u,0x00050083u,0x00000009u,0x000000aeu,0x0000017au,0x0000016fu,0x00050083u,0x00000009u,0x000000b1u,0x00000190u,0x00000185u,0x00050050u,0x000000b2u,0x000000b3u,0x000000aeu,0x000000b1u,0x0006000cu,0x00000009u,0x000000b4u,0x00000001u,0x00000042u,0x000000b3u,0x00050085u,0x00000009u,0x000000b5u,0x000000abu,0x000000b4u,0x0004007fu,0x00000009u,0x000000b8u,0x00000062u,0x00050085u,0x00000009u,0x000000bau,0x000000b8u,0x000000b5u,0x0006000cu,0x00000009u,0x000000bbu,0x00000001u,0x0000001bu,0x000000bau,0x0008000cu,0x00000009u,0x000000beu,0x00000001u,0x0000002bu,0x000000bbu,0x000000bcu,0x000000bdu,0x00050083u,0x0000000au,0x000000c2u,0x00000146u,0x0000006cu,0x00050083u,0x0000000au,0x000000c6u,0x00000150u,0x0000006cu,0x00050083u,0x0000000au,0x000000cau,0x0000015au,0x0000006cu,0x00050083u,0x0000000au,0x000000ceu,0x00000164u,0x0000006cu,0x00050085u,0x00000009u,0x000000d2u,0x00000066u,0x00000066u,0x00050094u,0x00000009u,0x000000d6u,0x000000c2u,0x000000c2u,0x00050081u,0x00000009u,0x000000d8u,0x000000d6u,0x000000d2u,0x0006000cu,0x00000009u,0x000000d9u,0x00000001u,0x00000020u,0x000000d8u,0x00050094u,0x00000009u,0x000000ddu,0x000000c6u,0x000000c6u,0x00050081u,0x00000009u,0x000000dfu,0x000000ddu,0x000000d2u,0x0006000cu,0x00000009u,0x000000e0u,0x00000001u,0x00000020u,0x000000dfu,0x00050094u,0x00000009u,0x000000e4u,0x000000cau,0x000000cau,0x00050081u,0x00000009u,0x000000e6u,0x000000e4u,0x000000d2u,0x0006000cu,0x00000009u,0x000000e7u,0x00000001u,0x00000020u,0x000000e6u,0x00050094u,0x00000009u,0x000000ebu,0x000000ceu,0x000000ceu,0x00050081u,0x00000009u,0x000000edu,0x000000ebu,0x000000d2u,0x0006000cu,0x00000009u,0x000000eeu,0x00000001u,0x00000020u,0x000000edu,0x00050081u,0x00000009u,0x000000f3u,0x000000d9u,0x000000e0u,0x00050081u,0x00000009u,0x000000f5u,0x000000f3u,0x000000e7u,0x00050081u,0x00000009u,0x000000f7u,0x000000f5u,0x000000eeu,0x00050085u,0x00000009u,0x000000f8u,0x000000beu,0x000000f7u,0x0005008eu,0x0000000au,0x000000fdu,0x00000146u,0x000000d9u,0x0005008eu,0x0000000au,0x00000100u,0x00000150u,0x000000e0u,0x00050081u,0x0000000au,0x00000101u,0x000000fdu,0x00000100u,0x0005008eu,0x0000000au,0x00000104u,0x0000015au,0x000000e7u,0x00050081u,0x0000000au,0x00000105u,0x00000101u,0x00000104u,0x0005008eu,0x0000000au,0x00000108u,0x00000164u,0x000000eeu,0x00050081u,0x0000000au,0x00000109u,0x00000105u,0x00000108u,0x0005008eu,0x0000000au,0x0000010au,0x00000109u,0x000000beu,0x0005008eu,0x0000000au,0x0000010fu,0x0000010au,0x0000005bu,0x00050081u,0x0000000au,0x00000110u,0x0000006cu,0x0000010fu,0x00050085u,0x00000009u,0x00000113u,0x0000005bu,0x000000f8u,0x00050081u,0x00000009u,0x00000114u,0x000000bdu,0x00000113u,0x00070050u,0x0000000au,0x00000115u,0x00000114u,0x00000114u,0x00000114u,0x00000114u,0x00050088u,0x0000000au,0x00000116u,0x00000110u,0x00000115u,0x0004003du,0x00000016u,0x00000119u,0x00000118u,0x00040064u,0x00000015u,0x0000011bu,0x00000119u,0x0007005fu,0x0000000au,0x0000011cu,0x0000011bu,0x0000003bu,0x00000002u,0x0000001bu,0x00050085u,0x00000009u,0x00000120u,0x0000005bu,0x0000005eu,0x00050083u,0x0000000au,0x00000124u,0x00000116u,0x0000011cu,0x0004007fu,0x00000009u,0x00000129u,0x00000120u,0x00070050u,0x0000000au,0x0000012au,0x00000129u,0x00000129u,0x00000129u,0x00000129u,0x00070050u,0x0000000au,0x0000012cu,0x00000120u,0x00000120u,0x00000120u,0x00000120u,0x0008000cu,0x0000000au,0x0000012du,0x00000001u,0x0000002bu,0x00000124u,0x0000012au,0x0000012cu,0x00050083u,0x0000000au,0x0000012eu,0x00000116u,0x0000012du,0x0004003du,0x0000012fu,0x00000132u,0x00000131u,0x00040063u,0x00000132u,0x0000003bu,0x0000012eu,0x000200f9u,0x00000137u,0x000200f8u,0x00000137u,0x000100fdu,0x00010038u}; +static const size_t OF3_FLOWREG_LEN = 981; static const uint32_t DDFG_SYNTH_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000208u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x0000001cu,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00050005u,0x0000000bu,0x616d756cu,0x33667628u,0x0000003bu,0x00030005u,0x0000000au,0x00000063u,0x00030005u,0x00000018u,0x00646967u,0x00080005u,0x0000001cu,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x00000021u,0x006d6964u,0x00040005u,0x00000024u,0x74754f75u,0x00000000u,0x00040005u,0x0000003eu,0x44766e69u,0x00006d69u,0x00030005u,0x00000044u,0x00007675u,0x00030005u,0x0000004du,0x00000055u,0x00060006u,0x0000004du,0x00000000u,0x776f6c66u,0x6c616353u,0x00000065u,0x00050006u,0x0000004du,0x00000001u,0x68706c61u,0x00000061u,0x00050006u,0x0000004du,0x00000002u,0x61746562u,0x00000000u,0x00050006u,0x0000004du,0x00000003u,0x626d616cu,0x00006164u,0x00050006u,0x0000004du,0x00000004u,0x69737065u,0x006e6f6cu,0x00060006u,0x0000004du,0x00000005u,0x746f6870u,0x6163536fu,0x0000656cu,0x00050006u,0x0000004du,0x00000006u,0x30646170u,0x00000000u,0x00050006u,0x0000004du,0x00000007u,0x31646170u,0x00000000u,0x00050006u,0x0000004du,0x00000008u,0x52647568u,0x00746365u,0x00030005u,0x0000004fu,0x00000000u,0x00040005u,0x0000008cu,0x72754375u,0x00000072u,0x00030005u,0x00000098u,0x00676264u,0x00030005u,0x0000009fu,0x00007366u,0x00040005u,0x000000a9u,0x64774273u,0x00000000u,0x00050005u,0x000000aau,0x6f6c4675u,0x64774277u,0x00000000u,0x00040005u,0x000000aeu,0x64774673u,0x00000000u,0x00050005u,0x000000afu,0x6f6c4675u,0x64774677u,0x00000000u,0x00030005u,0x000000b3u,0x00313046u,0x00030005u,0x000000bau,0x00303146u,0x00040005u,0x000000c1u,0x31306663u,0x00000000u,0x00040005u,0x000000c5u,0x30316663u,0x00000000u,0x00030005u,0x000000c9u,0x0031306du,0x00030005u,0x000000d5u,0x0030316du,0x00030005u,0x000000e0u,0x00004170u,0x00030005u,0x000000e8u,0x00004270u,0x00030005u,0x000000f0u,0x00003043u,0x00040005u,0x000000f1u,0x65725075u,0x00000076u,0x00030005u,0x000000f6u,0x00003143u,0x00030005u,0x000000fbu,0x00004165u,0x00040005u,0x000000fcu,0x61726170u,0x0000006du,0x00040005u,0x0000010cu,0x61726170u,0x0000006du,0x00030005u,0x00000111u,0x00004265u,0x00040005u,0x00000112u,0x61726170u,0x0000006du,0x00040005u,0x00000122u,0x61726170u,0x0000006du,0x00040005u,0x00000127u,0x76556266u,0x00000000u,0x00040005u,0x0000012bu,0x65526266u,0x00646973u,0x00040005u,0x00000138u,0x736e6f63u,0x00747369u,0x00030005u,0x00000149u,0x0000305au,0x00030005u,0x00000157u,0x0000315au,0x00040005u,0x00000163u,0x30756174u,0x00000000u,0x00040005u,0x00000167u,0x31756174u,0x00000000u,0x00040005u,0x0000016au,0x78616d7au,0x00000000u,0x00030005u,0x0000016eu,0x00003057u,0x00030005u,0x00000179u,0x00003157u,0x00040005u,0x00000183u,0x6d757357u,0x00000000u,0x00040005u,0x00000187u,0x70726177u,0x00006465u,0x00050005u,0x000001a0u,0x736f7263u,0x64616673u,0x00000065u,0x00050005u,0x000001adu,0x746f6870u,0x7272456fu,0x00000000u,0x00050005u,0x000001b1u,0x746f6870u,0x7572546fu,0x00007473u,0x00040005u,0x000001b7u,0x73757274u,0x00000074u,0x00040005u,0x000001c3u,0x76657270u,0x00000043u,0x00040005u,0x000001c8u,0x72727563u,0x00000043u,0x00050005u,0x000001cdu,0x746e6f63u,0x44746e65u,0x00666669u,0x00050005u,0x000001d2u,0x72746e75u,0x65747375u,0x00000064u,0x00040005u,0x000001d7u,0x44676962u,0x00666669u,0x00050005u,0x000001dcu,0x70616e73u,0x75436f54u,0x00007272u,0x00040005u,0x000001e5u,0x6374756fu,0x00000000u,0x00030005u,0x000001eeu,0x0067616du,0x00030005u,0x000001f2u,0x0000006eu,0x00030005u,0x000001f6u,0x00746173u,0x00040047u,0x0000001cu,0x0000000bu,0x0000001cu,0x00030047u,0x00000024u,0x00000019u,0x00040047u,0x00000024u,0x00000021u,0x00000030u,0x00040047u,0x00000024u,0x00000022u,0x00000000u,0x00030047u,0x0000004du,0x00000002u,0x00050048u,0x0000004du,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x0000004du,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x0000004du,0x00000002u,0x00000023u,0x00000008u,0x00050048u,0x0000004du,0x00000003u,0x00000023u,0x0000000cu,0x00050048u,0x0000004du,0x00000004u,0x00000023u,0x00000010u,0x00050048u,0x0000004du,0x00000005u,0x00000023u,0x00000014u,0x00050048u,0x0000004du,0x00000006u,0x00000023u,0x00000018u,0x00050048u,0x0000004du,0x00000007u,0x00000023u,0x0000001cu,0x00050048u,0x0000004du,0x00000008u,0x00000023u,0x00000020u,0x00040047u,0x0000004fu,0x00000021u,0x00000000u,0x00040047u,0x0000004fu,0x00000022u,0x00000000u,0x00040047u,0x0000008cu,0x00000021u,0x00000021u,0x00040047u,0x0000008cu,0x00000022u,0x00000000u,0x00040047u,0x000000aau,0x00000021u,0x00000023u,0x00040047u,0x000000aau,0x00000022u,0x00000000u,0x00040047u,0x000000afu,0x00000021u,0x00000022u,0x00040047u,0x000000afu,0x00000022u,0x00000000u,0x00040047u,0x000000f1u,0x00000021u,0x00000020u,0x00040047u,0x000000f1u,0x00000022u,0x00000000u,0x00040047u,0x00000207u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00030016u,0x00000006u,0x00000020u,0x00040017u,0x00000007u,0x00000006u,0x00000003u,0x00040020u,0x00000008u,0x00000007u,0x00000007u,0x00040021u,0x00000009u,0x00000006u,0x00000008u,0x0004002bu,0x00000006u,0x0000000eu,0x3e59b3d0u,0x0004002bu,0x00000006u,0x0000000fu,0x3f371759u,0x0004002bu,0x00000006u,0x00000010u,0x3d93dd98u,0x0006002cu,0x00000007u,0x00000011u,0x0000000eu,0x0000000fu,0x00000010u,0x00040015u,0x00000015u,0x00000020u,0x00000001u,0x00040017u,0x00000016u,0x00000015u,0x00000002u,0x00040020u,0x00000017u,0x00000007u,0x00000016u,0x00040015u,0x00000019u,0x00000020u,0x00000000u,0x00040017u,0x0000001au,0x00000019u,0x00000003u,0x00040020u,0x0000001bu,0x00000001u,0x0000001au,0x0004003bu,0x0000001bu,0x0000001cu,0x00000001u,0x00040017u,0x0000001du,0x00000019u,0x00000002u,0x00090019u,0x00000022u,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000004u,0x00040020u,0x00000023u,0x00000000u,0x00000022u,0x0004003bu,0x00000023u,0x00000024u,0x00000000u,0x00020014u,0x00000027u,0x0004002bu,0x00000019u,0x00000028u,0x00000000u,0x00040020u,0x00000029u,0x00000007u,0x00000015u,0x0004002bu,0x00000019u,0x00000032u,0x00000001u,0x00040017u,0x0000003cu,0x00000006u,0x00000002u,0x00040020u,0x0000003du,0x00000007u,0x0000003cu,0x0004002bu,0x00000006u,0x0000003fu,0x3f800000u,0x0004002bu,0x00000006u,0x00000047u,0x3f000000u,0x00040017u,0x0000004cu,0x00000006u,0x00000004u,0x000b001eu,0x0000004du,0x00000006u,0x00000006u,0x00000006u,0x00000006u,0x00000006u,0x00000006u,0x00000006u,0x00000006u,0x0000004cu,0x00040020u,0x0000004eu,0x00000002u,0x0000004du,0x0004003bu,0x0000004eu,0x0000004fu,0x00000002u,0x0004002bu,0x00000015u,0x00000050u,0x00000008u,0x00040020u,0x00000051u,0x00000002u,0x00000006u,0x0004002bu,0x00000019u,0x00000054u,0x00000002u,0x0004002bu,0x00000019u,0x0000005cu,0x00000003u,0x00090019u,0x00000089u,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x0000008au,0x00000089u,0x00040020u,0x0000008bu,0x00000000u,0x0000008au,0x0004003bu,0x0000008bu,0x0000008cu,0x00000000u,0x0004002bu,0x00000006u,0x0000008fu,0x00000000u,0x00040020u,0x00000097u,0x00000007u,0x00000027u,0x0004002bu,0x00000015u,0x00000099u,0x00000000u,0x0004002bu,0x00000006u,0x0000009cu,0x40600000u,0x00040020u,0x0000009eu,0x00000007u,0x00000006u,0x00040020u,0x000000a8u,0x00000007u,0x0000004cu,0x0004003bu,0x0000008bu,0x000000aau,0x00000000u,0x0004003bu,0x0000008bu,0x000000afu,0x00000000u,0x0004002bu,0x00000006u,0x000000cdu,0x3dcccccdu,0x0004002bu,0x00000015u,0x000000e2u,0x00000001u,0x0004003bu,0x0000008bu,0x000000f1u,0x00000000u,0x0004002bu,0x00000015u,0x0000014au,0x00000005u,0x0004002bu,0x00000015u,0x0000014fu,0x00000003u,0x0004002bu,0x00000015u,0x00000170u,0x00000002u,0x0004002bu,0x00000006u,0x00000189u,0x322bcc77u,0x0004002bu,0x00000006u,0x000001b2u,0x3d23d70au,0x0004002bu,0x00000006u,0x000001b3u,0x3e3851ecu,0x0004002bu,0x00000015u,0x000001bcu,0x00000004u,0x0004002bu,0x00000006u,0x000001d3u,0x3e800000u,0x0004002bu,0x00000006u,0x000001d8u,0x3e4ccccdu,0x0004002bu,0x00000006u,0x000001d9u,0x3ecccccdu,0x0004002bu,0x00000019u,0x00000206u,0x00000010u,0x0006002cu,0x0000001au,0x00000207u,0x00000206u,0x00000206u,0x00000032u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000017u,0x00000018u,0x00000007u,0x0004003bu,0x00000017u,0x00000021u,0x00000007u,0x0004003bu,0x0000003du,0x0000003eu,0x00000007u,0x0004003bu,0x0000003du,0x00000044u,0x00000007u,0x0004003bu,0x00000097u,0x00000098u,0x00000007u,0x0004003bu,0x0000009eu,0x0000009fu,0x00000007u,0x0004003bu,0x0000009eu,0x000000a1u,0x00000007u,0x0004003bu,0x000000a8u,0x000000a9u,0x00000007u,0x0004003bu,0x000000a8u,0x000000aeu,0x00000007u,0x0004003bu,0x0000003du,0x000000b3u,0x00000007u,0x0004003bu,0x0000003du,0x000000bau,0x00000007u,0x0004003bu,0x0000009eu,0x000000c1u,0x00000007u,0x0004003bu,0x0000009eu,0x000000c5u,0x00000007u,0x0004003bu,0x0000009eu,0x000000c9u,0x00000007u,0x0004003bu,0x0000009eu,0x000000d5u,0x00000007u,0x0004003bu,0x0000003du,0x000000e0u,0x00000007u,0x0004003bu,0x0000003du,0x000000e8u,0x00000007u,0x0004003bu,0x00000008u,0x000000f0u,0x00000007u,0x0004003bu,0x00000008u,0x000000f6u,0x00000007u,0x0004003bu,0x0000009eu,0x000000fbu,0x00000007u,0x0004003bu,0x00000008u,0x000000fcu,0x00000007u,0x0004003bu,0x00000008u,0x0000010cu,0x00000007u,0x0004003bu,0x0000009eu,0x00000111u,0x00000007u,0x0004003bu,0x00000008u,0x00000112u,0x00000007u,0x0004003bu,0x00000008u,0x00000122u,0x00000007u,0x0004003bu,0x0000003du,0x00000127u,0x00000007u,0x0004003bu,0x0000009eu,0x0000012bu,0x00000007u,0x0004003bu,0x0000009eu,0x00000138u,0x00000007u,0x0004003bu,0x0000009eu,0x00000149u,0x00000007u,0x0004003bu,0x0000009eu,0x00000157u,0x00000007u,0x0004003bu,0x0000009eu,0x00000163u,0x00000007u,0x0004003bu,0x0000009eu,0x00000167u,0x00000007u,0x0004003bu,0x0000009eu,0x0000016au,0x00000007u,0x0004003bu,0x0000009eu,0x0000016eu,0x00000007u,0x0004003bu,0x0000009eu,0x00000179u,0x00000007u,0x0004003bu,0x0000009eu,0x00000183u,0x00000007u,0x0004003bu,0x00000008u,0x00000187u,0x00000007u,0x0004003bu,0x00000008u,0x0000018bu,0x00000007u,0x0004003bu,0x00000008u,0x000001a0u,0x00000007u,0x0004003bu,0x0000009eu,0x000001adu,0x00000007u,0x0004003bu,0x0000009eu,0x000001b1u,0x00000007u,0x0004003bu,0x0000009eu,0x000001b7u,0x00000007u,0x0004003bu,0x00000008u,0x000001c3u,0x00000007u,0x0004003bu,0x00000008u,0x000001c8u,0x00000007u,0x0004003bu,0x0000009eu,0x000001cdu,0x00000007u,0x0004003bu,0x0000009eu,0x000001d2u,0x00000007u,0x0004003bu,0x0000009eu,0x000001d7u,0x00000007u,0x0004003bu,0x0000009eu,0x000001dcu,0x00000007u,0x0004003bu,0x00000008u,0x000001e5u,0x00000007u,0x0004003bu,0x0000009eu,0x000001eeu,0x00000007u,0x0004003bu,0x0000009eu,0x000001f2u,0x00000007u,0x0004003bu,0x0000009eu,0x000001f6u,0x00000007u,0x0004003du,0x0000001au,0x0000001eu,0x0000001cu,0x0007004fu,0x0000001du,0x0000001fu,0x0000001eu,0x0000001eu,0x00000000u,0x00000001u,0x0004007cu,0x00000016u,0x00000020u,0x0000001fu,0x0003003eu,0x00000018u,0x00000020u,0x0004003du,0x00000022u,0x00000025u,0x00000024u,0x00040068u,0x00000016u,0x00000026u,0x00000025u,0x0003003eu,0x00000021u,0x00000026u,0x00050041u,0x00000029u,0x0000002au,0x00000018u,0x00000028u,0x0004003du,0x00000015u,0x0000002bu,0x0000002au,0x00050041u,0x00000029u,0x0000002cu,0x00000021u,0x00000028u,0x0004003du,0x00000015u,0x0000002du,0x0000002cu,0x000500afu,0x00000027u,0x0000002eu,0x0000002bu,0x0000002du,0x000400a8u,0x00000027u,0x0000002fu,0x0000002eu,0x000300f7u,0x00000031u,0x00000000u,0x000400fau,0x0000002fu,0x00000030u,0x00000031u,0x000200f8u,0x00000030u,0x00050041u,0x00000029u,0x00000033u,0x00000018u,0x00000032u,0x0004003du,0x00000015u,0x00000034u,0x00000033u,0x00050041u,0x00000029u,0x00000035u,0x00000021u,0x00000032u,0x0004003du,0x00000015u,0x00000036u,0x00000035u,0x000500afu,0x00000027u,0x00000037u,0x00000034u,0x00000036u,0x000200f9u,0x00000031u,0x000200f8u,0x00000031u,0x000700f5u,0x00000027u,0x00000038u,0x0000002eu,0x00000005u,0x00000037u,0x00000030u,0x000300f7u,0x0000003au,0x00000000u,0x000400fau,0x00000038u,0x00000039u,0x0000003au,0x000200f8u,0x00000039u,0x000100fdu,0x000200f8u,0x0000003au,0x0004003du,0x00000016u,0x00000040u,0x00000021u,0x0004006fu,0x0000003cu,0x00000041u,0x00000040u,0x00050050u,0x0000003cu,0x00000042u,0x0000003fu,0x0000003fu,0x00050088u,0x0000003cu,0x00000043u,0x00000042u,0x00000041u,0x0003003eu,0x0000003eu,0x00000043u,0x0004003du,0x00000016u,0x00000045u,0x00000018u,0x0004006fu,0x0000003cu,0x00000046u,0x00000045u,0x00050050u,0x0000003cu,0x00000048u,0x00000047u,0x00000047u,0x00050081u,0x0000003cu,0x00000049u,0x00000046u,0x00000048u,0x0004003du,0x0000003cu,0x0000004au,0x0000003eu,0x00050085u,0x0000003cu,0x0000004bu,0x00000049u,0x0000004au,0x0003003eu,0x00000044u,0x0000004bu,0x00060041u,0x00000051u,0x00000052u,0x0000004fu,0x00000050u,0x00000028u,0x0004003du,0x00000006u,0x00000053u,0x00000052u,0x00060041u,0x00000051u,0x00000055u,0x0000004fu,0x00000050u,0x00000054u,0x0004003du,0x00000006u,0x00000056u,0x00000055u,0x000500b8u,0x00000027u,0x00000057u,0x00000053u,0x00000056u,0x000300f7u,0x00000059u,0x00000000u,0x000400fau,0x00000057u,0x00000058u,0x00000059u,0x000200f8u,0x00000058u,0x00060041u,0x00000051u,0x0000005au,0x0000004fu,0x00000050u,0x00000032u,0x0004003du,0x00000006u,0x0000005bu,0x0000005au,0x00060041u,0x00000051u,0x0000005du,0x0000004fu,0x00000050u,0x0000005cu,0x0004003du,0x00000006u,0x0000005eu,0x0000005du,0x000500b8u,0x00000027u,0x0000005fu,0x0000005bu,0x0000005eu,0x000200f9u,0x00000059u,0x000200f8u,0x00000059u,0x000700f5u,0x00000027u,0x00000060u,0x00000057u,0x0000003au,0x0000005fu,0x00000058u,0x000300f7u,0x00000062u,0x00000000u,0x000400fau,0x00000060u,0x00000061u,0x00000062u,0x000200f8u,0x00000061u,0x00050041u,0x00000029u,0x00000063u,0x00000018u,0x00000028u,0x0004003du,0x00000015u,0x00000064u,0x00000063u,0x0004006fu,0x00000006u,0x00000065u,0x00000064u,0x00060041u,0x00000051u,0x00000066u,0x0000004fu,0x00000050u,0x00000028u,0x0004003du,0x00000006u,0x00000067u,0x00000066u,0x000500beu,0x00000027u,0x00000068u,0x00000065u,0x00000067u,0x000200f9u,0x00000062u,0x000200f8u,0x00000062u,0x000700f5u,0x00000027u,0x00000069u,0x00000060u,0x00000059u,0x00000068u,0x00000061u,0x000300f7u,0x0000006bu,0x00000000u,0x000400fau,0x00000069u,0x0000006au,0x0000006bu,0x000200f8u,0x0000006au,0x00050041u,0x00000029u,0x0000006cu,0x00000018u,0x00000028u,0x0004003du,0x00000015u,0x0000006du,0x0000006cu,0x0004006fu,0x00000006u,0x0000006eu,0x0000006du,0x00060041u,0x00000051u,0x0000006fu,0x0000004fu,0x00000050u,0x00000054u,0x0004003du,0x00000006u,0x00000070u,0x0000006fu,0x000500b8u,0x00000027u,0x00000071u,0x0000006eu,0x00000070u,0x000200f9u,0x0000006bu,0x000200f8u,0x0000006bu,0x000700f5u,0x00000027u,0x00000072u,0x00000069u,0x00000062u,0x00000071u,0x0000006au,0x000300f7u,0x00000074u,0x00000000u,0x000400fau,0x00000072u,0x00000073u,0x00000074u,0x000200f8u,0x00000073u,0x00050041u,0x00000029u,0x00000075u,0x00000018u,0x00000032u,0x0004003du,0x00000015u,0x00000076u,0x00000075u,0x0004006fu,0x00000006u,0x00000077u,0x00000076u,0x00060041u,0x00000051u,0x00000078u,0x0000004fu,0x00000050u,0x00000032u,0x0004003du,0x00000006u,0x00000079u,0x00000078u,0x000500beu,0x00000027u,0x0000007au,0x00000077u,0x00000079u,0x000200f9u,0x00000074u,0x000200f8u,0x00000074u,0x000700f5u,0x00000027u,0x0000007bu,0x00000072u,0x0000006bu,0x0000007au,0x00000073u,0x000300f7u,0x0000007du,0x00000000u,0x000400fau,0x0000007bu,0x0000007cu,0x0000007du,0x000200f8u,0x0000007cu,0x00050041u,0x00000029u,0x0000007eu,0x00000018u,0x00000032u,0x0004003du,0x00000015u,0x0000007fu,0x0000007eu,0x0004006fu,0x00000006u,0x00000080u,0x0000007fu,0x00060041u,0x00000051u,0x00000081u,0x0000004fu,0x00000050u,0x0000005cu,0x0004003du,0x00000006u,0x00000082u,0x00000081u,0x000500b8u,0x00000027u,0x00000083u,0x00000080u,0x00000082u,0x000200f9u,0x0000007du,0x000200f8u,0x0000007du,0x000700f5u,0x00000027u,0x00000084u,0x0000007bu,0x00000074u,0x00000083u,0x0000007cu,0x000300f7u,0x00000086u,0x00000000u,0x000400fau,0x00000084u,0x00000085u,0x00000086u,0x000200f8u,0x00000085u,0x0004003du,0x00000022u,0x00000087u,0x00000024u,0x0004003du,0x00000016u,0x00000088u,0x00000018u,0x0004003du,0x0000008au,0x0000008du,0x0000008cu,0x0004003du,0x0000003cu,0x0000008eu,0x00000044u,0x00070058u,0x0000004cu,0x00000090u,0x0000008du,0x0000008eu,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x00000091u,0x00000090u,0x00000090u,0x00000000u,0x00000001u,0x00000002u,0x00050051u,0x00000006u,0x00000092u,0x00000091u,0x00000000u,0x00050051u,0x00000006u,0x00000093u,0x00000091u,0x00000001u,0x00050051u,0x00000006u,0x00000094u,0x00000091u,0x00000002u,0x00070050u,0x0000004cu,0x00000095u,0x00000092u,0x00000093u,0x00000094u,0x0000003fu,0x00040063u,0x00000087u,0x00000088u,0x00000095u,0x000100fdu,0x000200f8u,0x00000086u,0x00050041u,0x00000051u,0x0000009au,0x0000004fu,0x00000099u,0x0004003du,0x00000006u,0x0000009bu,0x0000009au,0x000500bau,0x00000027u,0x0000009du,0x0000009bu,0x0000009cu,0x0003003eu,0x00000098u,0x0000009du,0x0004003du,0x00000027u,0x000000a0u,0x00000098u,0x000300f7u,0x000000a3u,0x00000000u,0x000400fau,0x000000a0u,0x000000a2u,0x000000a4u,0x000200f8u,0x000000a2u,0x0003003eu,0x000000a1u,0x0000003fu,0x000200f9u,0x000000a3u,0x000200f8u,0x000000a4u,0x00050041u,0x00000051u,0x000000a5u,0x0000004fu,0x00000099u,0x0004003du,0x00000006u,0x000000a6u,0x000000a5u,0x0003003eu,0x000000a1u,0x000000a6u,0x000200f9u,0x000000a3u,0x000200f8u,0x000000a3u,0x0004003du,0x00000006u,0x000000a7u,0x000000a1u,0x0003003eu,0x0000009fu,0x000000a7u,0x0004003du,0x0000008au,0x000000abu,0x000000aau,0x0004003du,0x0000003cu,0x000000acu,0x00000044u,0x00070058u,0x0000004cu,0x000000adu,0x000000abu,0x000000acu,0x00000002u,0x0000008fu,0x0003003eu,0x000000a9u,0x000000adu,0x0004003du,0x0000008au,0x000000b0u,0x000000afu,0x0004003du,0x0000003cu,0x000000b1u,0x00000044u,0x00070058u,0x0000004cu,0x000000b2u,0x000000b0u,0x000000b1u,0x00000002u,0x0000008fu,0x0003003eu,0x000000aeu,0x000000b2u,0x0004003du,0x0000004cu,0x000000b4u,0x000000a9u,0x0007004fu,0x0000003cu,0x000000b5u,0x000000b4u,0x000000b4u,0x00000000u,0x00000001u,0x0004003du,0x00000006u,0x000000b6u,0x0000009fu,0x0005008eu,0x0000003cu,0x000000b7u,0x000000b5u,0x000000b6u,0x0004003du,0x0000003cu,0x000000b8u,0x0000003eu,0x00050085u,0x0000003cu,0x000000b9u,0x000000b7u,0x000000b8u,0x0003003eu,0x000000b3u,0x000000b9u,0x0004003du,0x0000004cu,0x000000bbu,0x000000aeu,0x0007004fu,0x0000003cu,0x000000bcu,0x000000bbu,0x000000bbu,0x00000000u,0x00000001u,0x0004003du,0x00000006u,0x000000bdu,0x0000009fu,0x0005008eu,0x0000003cu,0x000000beu,0x000000bcu,0x000000bdu,0x0004003du,0x0000003cu,0x000000bfu,0x0000003eu,0x00050085u,0x0000003cu,0x000000c0u,0x000000beu,0x000000bfu,0x0003003eu,0x000000bau,0x000000c0u,0x00050041u,0x0000009eu,0x000000c2u,0x000000a9u,0x0000005cu,0x0004003du,0x00000006u,0x000000c3u,0x000000c2u,0x0008000cu,0x00000006u,0x000000c4u,0x00000001u,0x0000002bu,0x000000c3u,0x0000008fu,0x0000003fu,0x0003003eu,0x000000c1u,0x000000c4u,0x00050041u,0x0000009eu,0x000000c6u,0x000000aeu,0x0000005cu,0x0004003du,0x00000006u,0x000000c7u,0x000000c6u,0x0008000cu,0x00000006u,0x000000c8u,0x00000001u,0x0000002bu,0x000000c7u,0x0000008fu,0x0000003fu,0x0003003eu,0x000000c5u,0x000000c8u,0x0004003du,0x0000003cu,0x000000cau,0x000000b3u,0x0006000cu,0x00000006u,0x000000cbu,0x00000001u,0x00000042u,0x000000cau,0x0003003eu,0x000000c9u,0x000000cbu,0x0004003du,0x00000006u,0x000000ccu,0x000000c9u,0x000500bau,0x00000027u,0x000000ceu,0x000000ccu,0x000000cdu,0x000300f7u,0x000000d0u,0x00000000u,0x000400fau,0x000000ceu,0x000000cfu,0x000000d0u,0x000200f8u,0x000000cfu,0x0004003du,0x00000006u,0x000000d1u,0x000000c9u,0x00050088u,0x00000006u,0x000000d2u,0x000000cdu,0x000000d1u,0x0004003du,0x0000003cu,0x000000d3u,0x000000b3u,0x0005008eu,0x0000003cu,0x000000d4u,0x000000d3u,0x000000d2u,0x0003003eu,0x000000b3u,0x000000d4u,0x000200f9u,0x000000d0u,0x000200f8u,0x000000d0u,0x0004003du,0x0000003cu,0x000000d6u,0x000000bau,0x0006000cu,0x00000006u,0x000000d7u,0x00000001u,0x00000042u,0x000000d6u,0x0003003eu,0x000000d5u,0x000000d7u,0x0004003du,0x00000006u,0x000000d8u,0x000000d5u,0x000500bau,0x00000027u,0x000000d9u,0x000000d8u,0x000000cdu,0x000300f7u,0x000000dbu,0x00000000u,0x000400fau,0x000000d9u,0x000000dau,0x000000dbu,0x000200f8u,0x000000dau,0x0004003du,0x00000006u,0x000000dcu,0x000000d5u,0x00050088u,0x00000006u,0x000000ddu,0x000000cdu,0x000000dcu,0x0004003du,0x0000003cu,0x000000deu,0x000000bau,0x0005008eu,0x0000003cu,0x000000dfu,0x000000deu,0x000000ddu,0x0003003eu,0x000000bau,0x000000dfu,0x000200f9u,0x000000dbu,0x000200f8u,0x000000dbu,0x0004003du,0x0000003cu,0x000000e1u,0x00000044u,0x00050041u,0x00000051u,0x000000e3u,0x0000004fu,0x000000e2u,0x0004003du,0x00000006u,0x000000e4u,0x000000e3u,0x0004003du,0x0000003cu,0x000000e5u,0x000000b3u,0x0005008eu,0x0000003cu,0x000000e6u,0x000000e5u,0x000000e4u,0x00050083u,0x0000003cu,0x000000e7u,0x000000e1u,0x000000e6u,0x0003003eu,0x000000e0u,0x000000e7u,0x0004003du,0x0000003cu,0x000000e9u,0x00000044u,0x00050041u,0x00000051u,0x000000eau,0x0000004fu,0x000000e2u,0x0004003du,0x00000006u,0x000000ebu,0x000000eau,0x00050083u,0x00000006u,0x000000ecu,0x0000003fu,0x000000ebu,0x0004003du,0x0000003cu,0x000000edu,0x000000bau,0x0005008eu,0x0000003cu,0x000000eeu,0x000000edu,0x000000ecu,0x00050083u,0x0000003cu,0x000000efu,0x000000e9u,0x000000eeu,0x0003003eu,0x000000e8u,0x000000efu,0x0004003du,0x0000008au,0x000000f2u,0x000000f1u,0x0004003du,0x0000003cu,0x000000f3u,0x000000e0u,0x00070058u,0x0000004cu,0x000000f4u,0x000000f2u,0x000000f3u,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x000000f5u,0x000000f4u,0x000000f4u,0x00000000u,0x00000001u,0x00000002u,0x0003003eu,0x000000f0u,0x000000f5u,0x0004003du,0x0000008au,0x000000f7u,0x0000008cu,0x0004003du,0x0000003cu,0x000000f8u,0x000000e8u,0x00070058u,0x0000004cu,0x000000f9u,0x000000f7u,0x000000f8u,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x000000fau,0x000000f9u,0x000000f9u,0x00000000u,0x00000001u,0x00000002u,0x0003003eu,0x000000f6u,0x000000fau,0x0004003du,0x00000007u,0x000000fdu,0x000000f0u,0x0003003eu,0x000000fcu,0x000000fdu,0x00050039u,0x00000006u,0x000000feu,0x0000000bu,0x000000fcu,0x0004003du,0x0000008au,0x000000ffu,0x0000008cu,0x0004003du,0x0000003cu,0x00000100u,0x000000e0u,0x0004003du,0x0000008au,0x00000101u,0x000000aau,0x0004003du,0x0000003cu,0x00000102u,0x000000e0u,0x00070058u,0x0000004cu,0x00000103u,0x00000101u,0x00000102u,0x00000002u,0x0000008fu,0x0007004fu,0x0000003cu,0x00000104u,0x00000103u,0x00000103u,0x00000000u,0x00000001u,0x00050041u,0x00000051u,0x00000105u,0x0000004fu,0x00000099u,0x0004003du,0x00000006u,0x00000106u,0x00000105u,0x0005008eu,0x0000003cu,0x00000107u,0x00000104u,0x00000106u,0x0004003du,0x0000003cu,0x00000108u,0x0000003eu,0x00050085u,0x0000003cu,0x00000109u,0x00000107u,0x00000108u,0x00050081u,0x0000003cu,0x0000010au,0x00000100u,0x00000109u,0x00070058u,0x0000004cu,0x0000010bu,0x000000ffu,0x0000010au,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x0000010du,0x0000010bu,0x0000010bu,0x00000000u,0x00000001u,0x00000002u,0x0003003eu,0x0000010cu,0x0000010du,0x00050039u,0x00000006u,0x0000010eu,0x0000000bu,0x0000010cu,0x00050083u,0x00000006u,0x0000010fu,0x000000feu,0x0000010eu,0x0006000cu,0x00000006u,0x00000110u,0x00000001u,0x00000004u,0x0000010fu,0x0003003eu,0x000000fbu,0x00000110u,0x0004003du,0x00000007u,0x00000113u,0x000000f6u,0x0003003eu,0x00000112u,0x00000113u,0x00050039u,0x00000006u,0x00000114u,0x0000000bu,0x00000112u,0x0004003du,0x0000008au,0x00000115u,0x000000f1u,0x0004003du,0x0000003cu,0x00000116u,0x000000e8u,0x0004003du,0x0000008au,0x00000117u,0x000000afu,0x0004003du,0x0000003cu,0x00000118u,0x000000e8u,0x00070058u,0x0000004cu,0x00000119u,0x00000117u,0x00000118u,0x00000002u,0x0000008fu,0x0007004fu,0x0000003cu,0x0000011au,0x00000119u,0x00000119u,0x00000000u,0x00000001u,0x00050041u,0x00000051u,0x0000011bu,0x0000004fu,0x00000099u,0x0004003du,0x00000006u,0x0000011cu,0x0000011bu,0x0005008eu,0x0000003cu,0x0000011du,0x0000011au,0x0000011cu,0x0004003du,0x0000003cu,0x0000011eu,0x0000003eu,0x00050085u,0x0000003cu,0x0000011fu,0x0000011du,0x0000011eu,0x00050081u,0x0000003cu,0x00000120u,0x00000116u,0x0000011fu,0x00070058u,0x0000004cu,0x00000121u,0x00000115u,0x00000120u,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x00000123u,0x00000121u,0x00000121u,0x00000000u,0x00000001u,0x00000002u,0x0003003eu,0x00000122u,0x00000123u,0x00050039u,0x00000006u,0x00000124u,0x0000000bu,0x00000122u,0x00050083u,0x00000006u,0x00000125u,0x00000114u,0x00000124u,0x0006000cu,0x00000006u,0x00000126u,0x00000001u,0x00000004u,0x00000125u,0x0003003eu,0x00000111u,0x00000126u,0x0004003du,0x0000003cu,0x00000128u,0x00000044u,0x0004003du,0x0000003cu,0x00000129u,0x000000b3u,0x00050081u,0x0000003cu,0x0000012au,0x00000128u,0x00000129u,0x0003003eu,0x00000127u,0x0000012au,0x0004003du,0x0000003cu,0x0000012cu,0x000000b3u,0x0004003du,0x0000008au,0x0000012du,0x000000afu,0x0004003du,0x0000003cu,0x0000012eu,0x00000127u,0x00070058u,0x0000004cu,0x0000012fu,0x0000012du,0x0000012eu,0x00000002u,0x0000008fu,0x0007004fu,0x0000003cu,0x00000130u,0x0000012fu,0x0000012fu,0x00000000u,0x00000001u,0x00050041u,0x00000051u,0x00000131u,0x0000004fu,0x00000099u,0x0004003du,0x00000006u,0x00000132u,0x00000131u,0x0005008eu,0x0000003cu,0x00000133u,0x00000130u,0x00000132u,0x0004003du,0x0000003cu,0x00000134u,0x0000003eu,0x00050085u,0x0000003cu,0x00000135u,0x00000133u,0x00000134u,0x00050081u,0x0000003cu,0x00000136u,0x0000012cu,0x00000135u,0x0006000cu,0x00000006u,0x00000137u,0x00000001u,0x00000042u,0x00000136u,0x0003003eu,0x0000012bu,0x00000137u,0x0004003du,0x00000006u,0x00000139u,0x000000c1u,0x0004003du,0x00000006u,0x0000013au,0x000000c5u,0x0007000cu,0x00000006u,0x0000013bu,0x00000001u,0x00000025u,0x00000139u,0x0000013au,0x0004003du,0x00000006u,0x0000013cu,0x0000012bu,0x0004007fu,0x00000006u,0x0000013du,0x0000013cu,0x0004003du,0x0000003cu,0x0000013eu,0x000000b3u,0x0006000cu,0x00000006u,0x0000013fu,0x00000001u,0x00000042u,0x0000013eu,0x0004003du,0x0000003cu,0x00000140u,0x000000bau,0x0006000cu,0x00000006u,0x00000141u,0x00000001u,0x00000042u,0x00000140u,0x00050081u,0x00000006u,0x00000142u,0x0000013fu,0x00000141u,0x00050041u,0x0000009eu,0x00000143u,0x0000003eu,0x00000028u,0x0004003du,0x00000006u,0x00000144u,0x00000143u,0x00050081u,0x00000006u,0x00000145u,0x00000142u,0x00000144u,0x00050088u,0x00000006u,0x00000146u,0x0000013du,0x00000145u,0x0006000cu,0x00000006u,0x00000147u,0x00000001u,0x0000001bu,0x00000146u,0x00050085u,0x00000006u,0x00000148u,0x0000013bu,0x00000147u,0x0003003eu,0x00000138u,0x00000148u,0x00050041u,0x00000051u,0x0000014bu,0x0000004fu,0x0000014au,0x0004003du,0x00000006u,0x0000014cu,0x0000014bu,0x0004003du,0x00000006u,0x0000014du,0x000000fbu,0x00050085u,0x00000006u,0x0000014eu,0x0000014cu,0x0000014du,0x00050041u,0x00000051u,0x00000150u,0x0000004fu,0x0000014fu,0x0004003du,0x00000006u,0x00000151u,0x00000150u,0x0004003du,0x00000006u,0x00000152u,0x00000138u,0x00050083u,0x00000006u,0x00000153u,0x0000003fu,0x00000152u,0x00050085u,0x00000006u,0x00000154u,0x00000151u,0x00000153u,0x00050081u,0x00000006u,0x00000155u,0x0000014eu,0x00000154u,0x0004007fu,0x00000006u,0x00000156u,0x00000155u,0x0003003eu,0x00000149u,0x00000156u,0x00050041u,0x00000051u,0x00000158u,0x0000004fu,0x0000014au,0x0004003du,0x00000006u,0x00000159u,0x00000158u,0x0004003du,0x00000006u,0x0000015au,0x00000111u,0x00050085u,0x00000006u,0x0000015bu,0x00000159u,0x0000015au,0x00050041u,0x00000051u,0x0000015cu,0x0000004fu,0x0000014fu,0x0004003du,0x00000006u,0x0000015du,0x0000015cu,0x0004003du,0x00000006u,0x0000015eu,0x00000138u,0x00050083u,0x00000006u,0x0000015fu,0x0000003fu,0x0000015eu,0x00050085u,0x00000006u,0x00000160u,0x0000015du,0x0000015fu,0x00050081u,0x00000006u,0x00000161u,0x0000015bu,0x00000160u,0x0004007fu,0x00000006u,0x00000162u,0x00000161u,0x0003003eu,0x00000157u,0x00000162u,0x00050041u,0x00000051u,0x00000164u,0x0000004fu,0x000000e2u,0x0004003du,0x00000006u,0x00000165u,0x00000164u,0x00050083u,0x00000006u,0x00000166u,0x0000003fu,0x00000165u,0x0003003eu,0x00000163u,0x00000166u,0x00050041u,0x00000051u,0x00000168u,0x0000004fu,0x000000e2u,0x0004003du,0x00000006u,0x00000169u,0x00000168u,0x0003003eu,0x00000167u,0x00000169u,0x0004003du,0x00000006u,0x0000016bu,0x00000149u,0x0004003du,0x00000006u,0x0000016cu,0x00000157u,0x0007000cu,0x00000006u,0x0000016du,0x00000001u,0x00000028u,0x0000016bu,0x0000016cu,0x0003003eu,0x0000016au,0x0000016du,0x0004003du,0x00000006u,0x0000016fu,0x00000163u,0x00050041u,0x00000051u,0x00000171u,0x0000004fu,0x00000170u,0x0004003du,0x00000006u,0x00000172u,0x00000171u,0x0004003du,0x00000006u,0x00000173u,0x00000149u,0x0004003du,0x00000006u,0x00000174u,0x0000016au,0x00050083u,0x00000006u,0x00000175u,0x00000173u,0x00000174u,0x00050085u,0x00000006u,0x00000176u,0x00000172u,0x00000175u,0x0006000cu,0x00000006u,0x00000177u,0x00000001u,0x0000001bu,0x00000176u,0x00050085u,0x00000006u,0x00000178u,0x0000016fu,0x00000177u,0x0003003eu,0x0000016eu,0x00000178u,0x0004003du,0x00000006u,0x0000017au,0x00000167u,0x00050041u,0x00000051u,0x0000017bu,0x0000004fu,0x00000170u,0x0004003du,0x00000006u,0x0000017cu,0x0000017bu,0x0004003du,0x00000006u,0x0000017du,0x00000157u,0x0004003du,0x00000006u,0x0000017eu,0x0000016au,0x00050083u,0x00000006u,0x0000017fu,0x0000017du,0x0000017eu,0x00050085u,0x00000006u,0x00000180u,0x0000017cu,0x0000017fu,0x0006000cu,0x00000006u,0x00000181u,0x00000001u,0x0000001bu,0x00000180u,0x00050085u,0x00000006u,0x00000182u,0x0000017au,0x00000181u,0x0003003eu,0x00000179u,0x00000182u,0x0004003du,0x00000006u,0x00000184u,0x0000016eu,0x0004003du,0x00000006u,0x00000185u,0x00000179u,0x00050081u,0x00000006u,0x00000186u,0x00000184u,0x00000185u,0x0003003eu,0x00000183u,0x00000186u,0x0004003du,0x00000006u,0x00000188u,0x00000183u,0x000500bau,0x00000027u,0x0000018au,0x00000188u,0x00000189u,0x000300f7u,0x0000018du,0x00000000u,0x000400fau,0x0000018au,0x0000018cu,0x00000198u,0x000200f8u,0x0000018cu,0x0004003du,0x00000006u,0x0000018eu,0x0000016eu,0x0004003du,0x00000007u,0x0000018fu,0x000000f0u,0x0005008eu,0x00000007u,0x00000190u,0x0000018fu,0x0000018eu,0x0004003du,0x00000006u,0x00000191u,0x00000179u,0x0004003du,0x00000007u,0x00000192u,0x000000f6u,0x0005008eu,0x00000007u,0x00000193u,0x00000192u,0x00000191u,0x00050081u,0x00000007u,0x00000194u,0x00000190u,0x00000193u,0x0004003du,0x00000006u,0x00000195u,0x00000183u,0x00060050u,0x00000007u,0x00000196u,0x00000195u,0x00000195u,0x00000195u,0x00050088u,0x00000007u,0x00000197u,0x00000194u,0x00000196u,0x0003003eu,0x0000018bu,0x00000197u,0x000200f9u,0x0000018du,0x000200f8u,0x00000198u,0x0004003du,0x00000007u,0x00000199u,0x000000f0u,0x0004003du,0x00000007u,0x0000019au,0x000000f6u,0x00050041u,0x00000051u,0x0000019bu,0x0000004fu,0x000000e2u,0x0004003du,0x00000006u,0x0000019cu,0x0000019bu,0x00060050u,0x00000007u,0x0000019du,0x0000019cu,0x0000019cu,0x0000019cu,0x0008000cu,0x00000007u,0x0000019eu,0x00000001u,0x0000002eu,0x00000199u,0x0000019au,0x0000019du,0x0003003eu,0x0000018bu,0x0000019eu,0x000200f9u,0x0000018du,0x000200f8u,0x0000018du,0x0004003du,0x00000007u,0x0000019fu,0x0000018bu,0x0003003eu,0x00000187u,0x0000019fu,0x0004003du,0x0000008au,0x000001a1u,0x000000f1u,0x0004003du,0x0000003cu,0x000001a2u,0x00000044u,0x00070058u,0x0000004cu,0x000001a3u,0x000001a1u,0x000001a2u,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x000001a4u,0x000001a3u,0x000001a3u,0x00000000u,0x00000001u,0x00000002u,0x0004003du,0x0000008au,0x000001a5u,0x0000008cu,0x0004003du,0x0000003cu,0x000001a6u,0x00000044u,0x00070058u,0x0000004cu,0x000001a7u,0x000001a5u,0x000001a6u,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x000001a8u,0x000001a7u,0x000001a7u,0x00000000u,0x00000001u,0x00000002u,0x00050041u,0x00000051u,0x000001a9u,0x0000004fu,0x000000e2u,0x0004003du,0x00000006u,0x000001aau,0x000001a9u,0x00060050u,0x00000007u,0x000001abu,0x000001aau,0x000001aau,0x000001aau,0x0008000cu,0x00000007u,0x000001acu,0x00000001u,0x0000002eu,0x000001a4u,0x000001a8u,0x000001abu,0x0003003eu,0x000001a0u,0x000001acu,0x0004003du,0x00000006u,0x000001aeu,0x000000fbu,0x0004003du,0x00000006u,0x000001afu,0x00000111u,0x0007000cu,0x00000006u,0x000001b0u,0x00000001u,0x00000025u,0x000001aeu,0x000001afu,0x0003003eu,0x000001adu,0x000001b0u,0x0004003du,0x00000006u,0x000001b4u,0x000001adu,0x0008000cu,0x00000006u,0x000001b5u,0x00000001u,0x00000031u,0x000001b2u,0x000001b3u,0x000001b4u,0x00050083u,0x00000006u,0x000001b6u,0x0000003fu,0x000001b5u,0x0003003eu,0x000001b1u,0x000001b6u,0x0004003du,0x00000006u,0x000001b8u,0x00000138u,0x0008000cu,0x00000006u,0x000001b9u,0x00000001u,0x0000002bu,0x000001b8u,0x0000008fu,0x0000003fu,0x0004003du,0x00000006u,0x000001bau,0x000001b1u,0x00050085u,0x00000006u,0x000001bbu,0x000001b9u,0x000001bau,0x0003003eu,0x000001b7u,0x000001bbu,0x00050041u,0x00000051u,0x000001bdu,0x0000004fu,0x000001bcu,0x0004003du,0x00000006u,0x000001beu,0x000001bdu,0x0004003du,0x00000006u,0x000001bfu,0x00000183u,0x0008000cu,0x00000006u,0x000001c0u,0x00000001u,0x00000031u,0x0000008fu,0x000001beu,0x000001bfu,0x0004003du,0x00000006u,0x000001c1u,0x000001b7u,0x00050085u,0x00000006u,0x000001c2u,0x000001c1u,0x000001c0u,0x0003003eu,0x000001b7u,0x000001c2u,0x0004003du,0x0000008au,0x000001c4u,0x000000f1u,0x0004003du,0x0000003cu,0x000001c5u,0x00000044u,0x00070058u,0x0000004cu,0x000001c6u,0x000001c4u,0x000001c5u,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x000001c7u,0x000001c6u,0x000001c6u,0x00000000u,0x00000001u,0x00000002u,0x0003003eu,0x000001c3u,0x000001c7u,0x0004003du,0x0000008au,0x000001c9u,0x0000008cu,0x0004003du,0x0000003cu,0x000001cau,0x00000044u,0x00070058u,0x0000004cu,0x000001cbu,0x000001c9u,0x000001cau,0x00000002u,0x0000008fu,0x0008004fu,0x00000007u,0x000001ccu,0x000001cbu,0x000001cbu,0x00000000u,0x00000001u,0x00000002u,0x0003003eu,0x000001c8u,0x000001ccu,0x0004003du,0x00000007u,0x000001ceu,0x000001c8u,0x0004003du,0x00000007u,0x000001cfu,0x000001c3u,0x00050083u,0x00000007u,0x000001d0u,0x000001ceu,0x000001cfu,0x0006000cu,0x00000006u,0x000001d1u,0x00000001u,0x00000042u,0x000001d0u,0x0003003eu,0x000001cdu,0x000001d1u,0x0004003du,0x00000006u,0x000001d4u,0x000001b7u,0x0008000cu,0x00000006u,0x000001d5u,0x00000001u,0x00000031u,0x000000cdu,0x000001d3u,0x000001d4u,0x00050083u,0x00000006u,0x000001d6u,0x0000003fu,0x000001d5u,0x0003003eu,0x000001d2u,0x000001d6u,0x0004003du,0x00000006u,0x000001dau,0x000001cdu,0x0008000cu,0x00000006u,0x000001dbu,0x00000001u,0x00000031u,0x000001d8u,0x000001d9u,0x000001dau,0x0003003eu,0x000001d7u,0x000001dbu,0x0004003du,0x00000006u,0x000001ddu,0x000001d2u,0x0004003du,0x00000006u,0x000001deu,0x000001d7u,0x00050085u,0x00000006u,0x000001dfu,0x000001ddu,0x000001deu,0x0003003eu,0x000001dcu,0x000001dfu,0x0004003du,0x00000007u,0x000001e0u,0x000001a0u,0x0004003du,0x00000007u,0x000001e1u,0x000001c8u,0x0004003du,0x00000006u,0x000001e2u,0x000001dcu,0x00060050u,0x00000007u,0x000001e3u,0x000001e2u,0x000001e2u,0x000001e2u,0x0008000cu,0x00000007u,0x000001e4u,0x00000001u,0x0000002eu,0x000001e0u,0x000001e1u,0x000001e3u,0x0003003eu,0x000001a0u,0x000001e4u,0x0004003du,0x00000007u,0x000001e6u,0x000001a0u,0x0004003du,0x00000007u,0x000001e7u,0x00000187u,0x0004003du,0x00000006u,0x000001e8u,0x000001b7u,0x00060050u,0x00000007u,0x000001e9u,0x000001e8u,0x000001e8u,0x000001e8u,0x0008000cu,0x00000007u,0x000001eau,0x00000001u,0x0000002eu,0x000001e6u,0x000001e7u,0x000001e9u,0x0003003eu,0x000001e5u,0x000001eau,0x0004003du,0x00000027u,0x000001ebu,0x00000098u,0x000300f7u,0x000001edu,0x00000000u,0x000400fau,0x000001ebu,0x000001ecu,0x000001edu,0x000200f8u,0x000001ecu,0x0004003du,0x00000006u,0x000001efu,0x000000c9u,0x0004003du,0x00000006u,0x000001f0u,0x000000d5u,0x0007000cu,0x00000006u,0x000001f1u,0x00000001u,0x00000028u,0x000001efu,0x000001f0u,0x0003003eu,0x000001eeu,0x000001f1u,0x0004003du,0x00000006u,0x000001f3u,0x000001eeu,0x00050088u,0x00000006u,0x000001f4u,0x000001f3u,0x000000cdu,0x0008000cu,0x00000006u,0x000001f5u,0x00000001u,0x0000002bu,0x000001f4u,0x0000008fu,0x0000003fu,0x0003003eu,0x000001f2u,0x000001f5u,0x0004003du,0x00000006u,0x000001f7u,0x000001eeu,0x0007000cu,0x00000006u,0x000001f8u,0x00000001u,0x00000030u,0x000000cdu,0x000001f7u,0x0003003eu,0x000001f6u,0x000001f8u,0x0004003du,0x00000022u,0x000001f9u,0x00000024u,0x0004003du,0x00000016u,0x000001fau,0x00000018u,0x0004003du,0x00000006u,0x000001fbu,0x000001f6u,0x0004003du,0x00000006u,0x000001fcu,0x000001f2u,0x00070050u,0x0000004cu,0x000001fdu,0x000001fbu,0x000001fcu,0x0000008fu,0x0000003fu,0x00040063u,0x000001f9u,0x000001fau,0x000001fdu,0x000100fdu,0x000200f8u,0x000001edu,0x0004003du,0x00000022u,0x000001ffu,0x00000024u,0x0004003du,0x00000016u,0x00000200u,0x00000018u,0x0004003du,0x00000007u,0x00000201u,0x000001e5u,0x00050051u,0x00000006u,0x00000202u,0x00000201u,0x00000000u,0x00050051u,0x00000006u,0x00000203u,0x00000201u,0x00000001u,0x00050051u,0x00000006u,0x00000204u,0x00000201u,0x00000002u,0x00070050u,0x0000004cu,0x00000205u,0x00000202u,0x00000203u,0x00000204u,0x0000003fu,0x00040063u,0x000001ffu,0x00000200u,0x00000205u,0x000100fdu,0x00010038u,0x00050036u,0x00000006u,0x0000000bu,0x00000000u,0x00000009u,0x00030037u,0x00000008u,0x0000000au,0x000200f8u,0x0000000cu,0x0004003du,0x00000007u,0x0000000du,0x0000000au,0x00050094u,0x00000006u,0x00000012u,0x0000000du,0x00000011u,0x000200feu,0x00000012u,0x00010038u}; static const size_t DDFG_SYNTH_LEN = 3082; struct Blob { const uint32_t* code; size_t words; }; From c0719a5d9ebe2a3069ca3d4a6ecfea3f60767e72 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 00:14:53 -0400 Subject: [PATCH 006/120] Derive OF3_FLOW_LEN from shader array --- app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp b/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp index 65cb1881d3..af09e777d6 100644 --- a/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp +++ b/app/src/main/cpp/framegen/ddfg/embedded_shaders.hpp @@ -215,7 +215,7 @@ static const uint32_t OF3_FLOW_SPV[] = { 0x00000051u,0x00040063u,0x000001acu,0x00000011u,0x000001b1u,0x000200f9u,0x000001b4u,0x000200f8u, 0x000001b4u,0x000100fdu,0x00010038u }; -static const size_t OF3_FLOW_LEN = 1651; +static const size_t OF3_FLOW_LEN = sizeof(OF3_FLOW_SPV) / sizeof(OF3_FLOW_SPV[0]); static const uint32_t OF3_EXPAND_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000124u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x00000049u,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00080005u,0x0000000eu,0x3564656du,0x3b316628u,0x663b3166u,0x31663b31u,0x3b31663bu,0x00000000u,0x00030005u,0x00000009u,0x00000061u,0x00030005u,0x0000000au,0x00000062u,0x00030005u,0x0000000bu,0x00000063u,0x00030005u,0x0000000cu,0x00000064u,0x00030005u,0x0000000du,0x00000065u,0x00030005u,0x00000010u,0x00000078u,0x00030005u,0x00000034u,0x00000079u,0x00030005u,0x00000045u,0x00646967u,0x00080005u,0x00000049u,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x0000004eu,0x006d6964u,0x00040005u,0x00000051u,0x64774675u,0x00000000u,0x00030005u,0x0000006bu,0x00007675u,0x00030005u,0x00000074u,0x00007366u,0x00050005u,0x00000079u,0x6f6c4675u,0x6e694677u,0x00000065u,0x00030005u,0x00000081u,0x00000063u,0x00030005u,0x00000088u,0x00006d78u,0x00030005u,0x00000091u,0x00007078u,0x00030005u,0x0000009au,0x00006d79u,0x00030005u,0x000000a3u,0x00007079u,0x00030005u,0x000000acu,0x00000064u,0x00040005u,0x000000adu,0x61726170u,0x0000006du,0x00040005u,0x000000b0u,0x61726170u,0x0000006du,0x00040005u,0x000000b3u,0x61726170u,0x0000006du,0x00040005u,0x000000b6u,0x61726170u,0x0000006du,0x00040005u,0x000000b9u,0x61726170u,0x0000006du,0x00040005u,0x000000bdu,0x61726170u,0x0000006du,0x00040005u,0x000000c0u,0x61726170u,0x0000006du,0x00040005u,0x000000c3u,0x61726170u,0x0000006du,0x00040005u,0x000000c6u,0x61726170u,0x0000006du,0x00040005u,0x000000c9u,0x61726170u,0x0000006du,0x00030005u,0x000000ceu,0x00000071u,0x00030005u,0x000000d2u,0x00787067u,0x00030005u,0x000000d3u,0x00004d47u,0x00050006u,0x000000d3u,0x00000000u,0x694c6d67u,0x0000006eu,0x00050006u,0x000000d3u,0x00000001u,0x694c6d67u,0x0000546eu,0x00050006u,0x000000d3u,0x00000002u,0x70416d67u,0x00000070u,0x00050006u,0x000000d3u,0x00000003u,0x70416d67u,0x00005470u,0x00030005u,0x000000d5u,0x00000000u,0x00030005u,0x000000fdu,0x00003241u,0x00040005u,0x0000010bu,0x6c6c7566u,0x00000000u,0x00040005u,0x00000117u,0x64774275u,0x00000000u,0x00030005u,0x00000121u,0x00000055u,0x00060006u,0x00000121u,0x00000000u,0x776f6c66u,0x6c616353u,0x00000065u,0x00050006u,0x00000121u,0x00000001u,0x6576656cu,0x0000006cu,0x00050006u,0x00000121u,0x00000002u,0x30646170u,0x00000000u,0x00050006u,0x00000121u,0x00000003u,0x31646170u,0x00000000u,0x00030005u,0x00000123u,0x00000000u,0x00040047u,0x00000049u,0x0000000bu,0x0000001cu,0x00030047u,0x00000051u,0x00000019u,0x00040047u,0x00000051u,0x00000021u,0x00000030u,0x00040047u,0x00000051u,0x00000022u,0x00000000u,0x00040047u,0x00000079u,0x00000021u,0x00000020u,0x00040047u,0x00000079u,0x00000022u,0x00000000u,0x00030047u,0x000000d3u,0x00000002u,0x00050048u,0x000000d3u,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x000000d3u,0x00000001u,0x00000023u,0x00000010u,0x00050048u,0x000000d3u,0x00000002u,0x00000023u,0x00000020u,0x00050048u,0x000000d3u,0x00000003u,0x00000023u,0x00000030u,0x00040047u,0x000000d5u,0x00000021u,0x00000001u,0x00040047u,0x000000d5u,0x00000022u,0x00000000u,0x00030047u,0x00000117u,0x00000019u,0x00040047u,0x00000117u,0x00000021u,0x00000031u,0x00040047u,0x00000117u,0x00000022u,0x00000000u,0x00040047u,0x00000120u,0x0000000bu,0x00000019u,0x00030047u,0x00000121u,0x00000002u,0x00050048u,0x00000121u,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x00000121u,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x00000121u,0x00000002u,0x00000023u,0x00000008u,0x00050048u,0x00000121u,0x00000003u,0x00000023u,0x0000000cu,0x00040047u,0x00000123u,0x00000021u,0x00000000u,0x00040047u,0x00000123u,0x00000022u,0x00000000u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00030016u,0x00000006u,0x00000020u,0x00040020u,0x00000007u,0x00000007u,0x00000006u,0x00080021u,0x00000008u,0x00000006u,0x00000007u,0x00000007u,0x00000007u,0x00000007u,0x00000007u,0x00040015u,0x00000042u,0x00000020u,0x00000001u,0x00040017u,0x00000043u,0x00000042u,0x00000002u,0x00040020u,0x00000044u,0x00000007u,0x00000043u,0x00040015u,0x00000046u,0x00000020u,0x00000000u,0x00040017u,0x00000047u,0x00000046u,0x00000003u,0x00040020u,0x00000048u,0x00000001u,0x00000047u,0x0004003bu,0x00000048u,0x00000049u,0x00000001u,0x00040017u,0x0000004au,0x00000046u,0x00000002u,0x00090019u,0x0000004fu,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000002u,0x00040020u,0x00000050u,0x00000000u,0x0000004fu,0x0004003bu,0x00000050u,0x00000051u,0x00000000u,0x00020014u,0x00000054u,0x0004002bu,0x00000046u,0x00000055u,0x00000000u,0x00040020u,0x00000056u,0x00000007u,0x00000042u,0x0004002bu,0x00000046u,0x0000005fu,0x00000001u,0x00040017u,0x00000069u,0x00000006u,0x00000002u,0x00040020u,0x0000006au,0x00000007u,0x00000069u,0x0004002bu,0x00000006u,0x0000006eu,0x3f000000u,0x0004002bu,0x00000006u,0x00000075u,0x3f800000u,0x00090019u,0x00000076u,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000077u,0x00000076u,0x00040020u,0x00000078u,0x00000000u,0x00000077u,0x0004003bu,0x00000078u,0x00000079u,0x00000000u,0x0004002bu,0x00000042u,0x0000007bu,0x00000000u,0x0004002bu,0x00000006u,0x00000084u,0x00000000u,0x00040017u,0x00000085u,0x00000006u,0x00000004u,0x0006001eu,0x000000d3u,0x00000085u,0x00000085u,0x00000085u,0x00000085u,0x00040020u,0x000000d4u,0x00000002u,0x000000d3u,0x0004003bu,0x000000d4u,0x000000d5u,0x00000002u,0x0004002bu,0x00000042u,0x000000d6u,0x00000002u,0x00040020u,0x000000d7u,0x00000002u,0x00000006u,0x0004002bu,0x00000046u,0x000000ddu,0x00000002u,0x0004002bu,0x00000042u,0x000000e4u,0x00000003u,0x0004002bu,0x00000046u,0x000000edu,0x00000003u,0x00040018u,0x000000fbu,0x00000069u,0x00000002u,0x00040020u,0x000000fcu,0x00000007u,0x000000fbu,0x0004003bu,0x00000050u,0x00000117u,0x00000000u,0x0004002bu,0x00000046u,0x0000011fu,0x00000010u,0x0006002cu,0x00000047u,0x00000120u,0x0000011fu,0x0000011fu,0x0000005fu,0x0006001eu,0x00000121u,0x00000006u,0x00000046u,0x00000046u,0x00000046u,0x00040020u,0x00000122u,0x00000002u,0x00000121u,0x0004003bu,0x00000122u,0x00000123u,0x00000002u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x00000044u,0x00000045u,0x00000007u,0x0004003bu,0x00000044u,0x0000004eu,0x00000007u,0x0004003bu,0x0000006au,0x0000006bu,0x00000007u,0x0004003bu,0x0000006au,0x00000074u,0x00000007u,0x0004003bu,0x0000006au,0x00000081u,0x00000007u,0x0004003bu,0x0000006au,0x00000088u,0x00000007u,0x0004003bu,0x0000006au,0x00000091u,0x00000007u,0x0004003bu,0x0000006au,0x0000009au,0x00000007u,0x0004003bu,0x0000006au,0x000000a3u,0x00000007u,0x0004003bu,0x0000006au,0x000000acu,0x00000007u,0x0004003bu,0x00000007u,0x000000adu,0x00000007u,0x0004003bu,0x00000007u,0x000000b0u,0x00000007u,0x0004003bu,0x00000007u,0x000000b3u,0x00000007u,0x0004003bu,0x00000007u,0x000000b6u,0x00000007u,0x0004003bu,0x00000007u,0x000000b9u,0x00000007u,0x0004003bu,0x00000007u,0x000000bdu,0x00000007u,0x0004003bu,0x00000007u,0x000000c0u,0x00000007u,0x0004003bu,0x00000007u,0x000000c3u,0x00000007u,0x0004003bu,0x00000007u,0x000000c6u,0x00000007u,0x0004003bu,0x00000007u,0x000000c9u,0x00000007u,0x0004003bu,0x0000006au,0x000000ceu,0x00000007u,0x0004003bu,0x0000006au,0x000000d2u,0x00000007u,0x0004003bu,0x000000fcu,0x000000fdu,0x00000007u,0x0004003bu,0x0000006au,0x0000010bu,0x00000007u,0x0004003du,0x00000047u,0x0000004bu,0x00000049u,0x0007004fu,0x0000004au,0x0000004cu,0x0000004bu,0x0000004bu,0x00000000u,0x00000001u,0x0004007cu,0x00000043u,0x0000004du,0x0000004cu,0x0003003eu,0x00000045u,0x0000004du,0x0004003du,0x0000004fu,0x00000052u,0x00000051u,0x00040068u,0x00000043u,0x00000053u,0x00000052u,0x0003003eu,0x0000004eu,0x00000053u,0x00050041u,0x00000056u,0x00000057u,0x00000045u,0x00000055u,0x0004003du,0x00000042u,0x00000058u,0x00000057u,0x00050041u,0x00000056u,0x00000059u,0x0000004eu,0x00000055u,0x0004003du,0x00000042u,0x0000005au,0x00000059u,0x000500afu,0x00000054u,0x0000005bu,0x00000058u,0x0000005au,0x000400a8u,0x00000054u,0x0000005cu,0x0000005bu,0x000300f7u,0x0000005eu,0x00000000u,0x000400fau,0x0000005cu,0x0000005du,0x0000005eu,0x000200f8u,0x0000005du,0x00050041u,0x00000056u,0x00000060u,0x00000045u,0x0000005fu,0x0004003du,0x00000042u,0x00000061u,0x00000060u,0x00050041u,0x00000056u,0x00000062u,0x0000004eu,0x0000005fu,0x0004003du,0x00000042u,0x00000063u,0x00000062u,0x000500afu,0x00000054u,0x00000064u,0x00000061u,0x00000063u,0x000200f9u,0x0000005eu,0x000200f8u,0x0000005eu,0x000700f5u,0x00000054u,0x00000065u,0x0000005bu,0x00000005u,0x00000064u,0x0000005du,0x000300f7u,0x00000067u,0x00000000u,0x000400fau,0x00000065u,0x00000066u,0x00000067u,0x000200f8u,0x00000066u,0x000100fdu,0x000200f8u,0x00000067u,0x0004003du,0x00000043u,0x0000006cu,0x00000045u,0x0004006fu,0x00000069u,0x0000006du,0x0000006cu,0x00050050u,0x00000069u,0x0000006fu,0x0000006eu,0x0000006eu,0x00050081u,0x00000069u,0x00000070u,0x0000006du,0x0000006fu,0x0004003du,0x00000043u,0x00000071u,0x0000004eu,0x0004006fu,0x00000069u,0x00000072u,0x00000071u,0x00050088u,0x00000069u,0x00000073u,0x00000070u,0x00000072u,0x0003003eu,0x0000006bu,0x00000073u,0x0004003du,0x00000077u,0x0000007au,0x00000079u,0x00040064u,0x00000076u,0x0000007cu,0x0000007au,0x00050067u,0x00000043u,0x0000007du,0x0000007cu,0x0000007bu,0x0004006fu,0x00000069u,0x0000007eu,0x0000007du,0x00050050u,0x00000069u,0x0000007fu,0x00000075u,0x00000075u,0x00050088u,0x00000069u,0x00000080u,0x0000007fu,0x0000007eu,0x0003003eu,0x00000074u,0x00000080u,0x0004003du,0x00000077u,0x00000082u,0x00000079u,0x0004003du,0x00000069u,0x00000083u,0x0000006bu,0x00070058u,0x00000085u,0x00000086u,0x00000082u,0x00000083u,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x00000087u,0x00000086u,0x00000086u,0x00000000u,0x00000001u,0x0003003eu,0x00000081u,0x00000087u,0x0004003du,0x00000077u,0x00000089u,0x00000079u,0x0004003du,0x00000069u,0x0000008au,0x0000006bu,0x00050041u,0x00000007u,0x0000008bu,0x00000074u,0x00000055u,0x0004003du,0x00000006u,0x0000008cu,0x0000008bu,0x00050050u,0x00000069u,0x0000008du,0x0000008cu,0x00000084u,0x00050083u,0x00000069u,0x0000008eu,0x0000008au,0x0000008du,0x00070058u,0x00000085u,0x0000008fu,0x00000089u,0x0000008eu,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x00000090u,0x0000008fu,0x0000008fu,0x00000000u,0x00000001u,0x0003003eu,0x00000088u,0x00000090u,0x0004003du,0x00000077u,0x00000092u,0x00000079u,0x0004003du,0x00000069u,0x00000093u,0x0000006bu,0x00050041u,0x00000007u,0x00000094u,0x00000074u,0x00000055u,0x0004003du,0x00000006u,0x00000095u,0x00000094u,0x00050050u,0x00000069u,0x00000096u,0x00000095u,0x00000084u,0x00050081u,0x00000069u,0x00000097u,0x00000093u,0x00000096u,0x00070058u,0x00000085u,0x00000098u,0x00000092u,0x00000097u,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x00000099u,0x00000098u,0x00000098u,0x00000000u,0x00000001u,0x0003003eu,0x00000091u,0x00000099u,0x0004003du,0x00000077u,0x0000009bu,0x00000079u,0x0004003du,0x00000069u,0x0000009cu,0x0000006bu,0x00050041u,0x00000007u,0x0000009du,0x00000074u,0x0000005fu,0x0004003du,0x00000006u,0x0000009eu,0x0000009du,0x00050050u,0x00000069u,0x0000009fu,0x00000084u,0x0000009eu,0x00050083u,0x00000069u,0x000000a0u,0x0000009cu,0x0000009fu,0x00070058u,0x00000085u,0x000000a1u,0x0000009bu,0x000000a0u,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x000000a2u,0x000000a1u,0x000000a1u,0x00000000u,0x00000001u,0x0003003eu,0x0000009au,0x000000a2u,0x0004003du,0x00000077u,0x000000a4u,0x00000079u,0x0004003du,0x00000069u,0x000000a5u,0x0000006bu,0x00050041u,0x00000007u,0x000000a6u,0x00000074u,0x0000005fu,0x0004003du,0x00000006u,0x000000a7u,0x000000a6u,0x00050050u,0x00000069u,0x000000a8u,0x00000084u,0x000000a7u,0x00050081u,0x00000069u,0x000000a9u,0x000000a5u,0x000000a8u,0x00070058u,0x00000085u,0x000000aau,0x000000a4u,0x000000a9u,0x00000002u,0x00000084u,0x0007004fu,0x00000069u,0x000000abu,0x000000aau,0x000000aau,0x00000000u,0x00000001u,0x0003003eu,0x000000a3u,0x000000abu,0x00050041u,0x00000007u,0x000000aeu,0x00000081u,0x00000055u,0x0004003du,0x00000006u,0x000000afu,0x000000aeu,0x0003003eu,0x000000adu,0x000000afu,0x00050041u,0x00000007u,0x000000b1u,0x00000088u,0x00000055u,0x0004003du,0x00000006u,0x000000b2u,0x000000b1u,0x0003003eu,0x000000b0u,0x000000b2u,0x00050041u,0x00000007u,0x000000b4u,0x00000091u,0x00000055u,0x0004003du,0x00000006u,0x000000b5u,0x000000b4u,0x0003003eu,0x000000b3u,0x000000b5u,0x00050041u,0x00000007u,0x000000b7u,0x0000009au,0x00000055u,0x0004003du,0x00000006u,0x000000b8u,0x000000b7u,0x0003003eu,0x000000b6u,0x000000b8u,0x00050041u,0x00000007u,0x000000bau,0x000000a3u,0x00000055u,0x0004003du,0x00000006u,0x000000bbu,0x000000bau,0x0003003eu,0x000000b9u,0x000000bbu,0x00090039u,0x00000006u,0x000000bcu,0x0000000eu,0x000000adu,0x000000b0u,0x000000b3u,0x000000b6u,0x000000b9u,0x00050041u,0x00000007u,0x000000beu,0x00000081u,0x0000005fu,0x0004003du,0x00000006u,0x000000bfu,0x000000beu,0x0003003eu,0x000000bdu,0x000000bfu,0x00050041u,0x00000007u,0x000000c1u,0x00000088u,0x0000005fu,0x0004003du,0x00000006u,0x000000c2u,0x000000c1u,0x0003003eu,0x000000c0u,0x000000c2u,0x00050041u,0x00000007u,0x000000c4u,0x00000091u,0x0000005fu,0x0004003du,0x00000006u,0x000000c5u,0x000000c4u,0x0003003eu,0x000000c3u,0x000000c5u,0x00050041u,0x00000007u,0x000000c7u,0x0000009au,0x0000005fu,0x0004003du,0x00000006u,0x000000c8u,0x000000c7u,0x0003003eu,0x000000c6u,0x000000c8u,0x00050041u,0x00000007u,0x000000cau,0x000000a3u,0x0000005fu,0x0004003du,0x00000006u,0x000000cbu,0x000000cau,0x0003003eu,0x000000c9u,0x000000cbu,0x00090039u,0x00000006u,0x000000ccu,0x0000000eu,0x000000bdu,0x000000c0u,0x000000c3u,0x000000c6u,0x000000c9u,0x00050050u,0x00000069u,0x000000cdu,0x000000bcu,0x000000ccu,0x0003003eu,0x000000acu,0x000000cdu,0x0004003du,0x00000069u,0x000000cfu,0x0000006bu,0x00050050u,0x00000069u,0x000000d0u,0x0000006eu,0x0000006eu,0x00050083u,0x00000069u,0x000000d1u,0x000000cfu,0x000000d0u,0x0003003eu,0x000000ceu,0x000000d1u,0x00060041u,0x000000d7u,0x000000d8u,0x000000d5u,0x000000d6u,0x00000055u,0x0004003du,0x00000006u,0x000000d9u,0x000000d8u,0x00050041u,0x00000007u,0x000000dau,0x000000ceu,0x00000055u,0x0004003du,0x00000006u,0x000000dbu,0x000000dau,0x00050085u,0x00000006u,0x000000dcu,0x000000d9u,0x000000dbu,0x00060041u,0x000000d7u,0x000000deu,0x000000d5u,0x000000d6u,0x000000ddu,0x0004003du,0x00000006u,0x000000dfu,0x000000deu,0x00050041u,0x00000007u,0x000000e0u,0x000000ceu,0x0000005fu,0x0004003du,0x00000006u,0x000000e1u,0x000000e0u,0x00050085u,0x00000006u,0x000000e2u,0x000000dfu,0x000000e1u,0x00050081u,0x00000006u,0x000000e3u,0x000000dcu,0x000000e2u,0x00060041u,0x000000d7u,0x000000e5u,0x000000d5u,0x000000e4u,0x00000055u,0x0004003du,0x00000006u,0x000000e6u,0x000000e5u,0x00050081u,0x00000006u,0x000000e7u,0x000000e3u,0x000000e6u,0x00060041u,0x000000d7u,0x000000e8u,0x000000d5u,0x000000d6u,0x0000005fu,0x0004003du,0x00000006u,0x000000e9u,0x000000e8u,0x00050041u,0x00000007u,0x000000eau,0x000000ceu,0x00000055u,0x0004003du,0x00000006u,0x000000ebu,0x000000eau,0x00050085u,0x00000006u,0x000000ecu,0x000000e9u,0x000000ebu,0x00060041u,0x000000d7u,0x000000eeu,0x000000d5u,0x000000d6u,0x000000edu,0x0004003du,0x00000006u,0x000000efu,0x000000eeu,0x00050041u,0x00000007u,0x000000f0u,0x000000ceu,0x0000005fu,0x0004003du,0x00000006u,0x000000f1u,0x000000f0u,0x00050085u,0x00000006u,0x000000f2u,0x000000efu,0x000000f1u,0x00050081u,0x00000006u,0x000000f3u,0x000000ecu,0x000000f2u,0x00060041u,0x000000d7u,0x000000f4u,0x000000d5u,0x000000e4u,0x0000005fu,0x0004003du,0x00000006u,0x000000f5u,0x000000f4u,0x00050081u,0x00000006u,0x000000f6u,0x000000f3u,0x000000f5u,0x00050050u,0x00000069u,0x000000f7u,0x000000e7u,0x000000f6u,0x0004003du,0x00000043u,0x000000f8u,0x0000004eu,0x0004006fu,0x00000069u,0x000000f9u,0x000000f8u,0x00050085u,0x00000069u,0x000000fau,0x000000f7u,0x000000f9u,0x0003003eu,0x000000d2u,0x000000fau,0x00060041u,0x000000d7u,0x000000feu,0x000000d5u,0x000000d6u,0x00000055u,0x0004003du,0x00000006u,0x000000ffu,0x000000feu,0x00050081u,0x00000006u,0x00000100u,0x00000075u,0x000000ffu,0x00060041u,0x000000d7u,0x00000101u,0x000000d5u,0x000000d6u,0x0000005fu,0x0004003du,0x00000006u,0x00000102u,0x00000101u,0x00060041u,0x000000d7u,0x00000103u,0x000000d5u,0x000000d6u,0x000000ddu,0x0004003du,0x00000006u,0x00000104u,0x00000103u,0x00060041u,0x000000d7u,0x00000105u,0x000000d5u,0x000000d6u,0x000000edu,0x0004003du,0x00000006u,0x00000106u,0x00000105u,0x00050081u,0x00000006u,0x00000107u,0x00000075u,0x00000106u,0x00050050u,0x00000069u,0x00000108u,0x00000100u,0x00000102u,0x00050050u,0x00000069u,0x00000109u,0x00000104u,0x00000107u,0x00050050u,0x000000fbu,0x0000010au,0x00000108u,0x00000109u,0x0003003eu,0x000000fdu,0x0000010au,0x0004003du,0x00000069u,0x0000010cu,0x000000d2u,0x0004003du,0x000000fbu,0x0000010du,0x000000fdu,0x0004003du,0x00000069u,0x0000010eu,0x000000acu,0x00050091u,0x00000069u,0x0000010fu,0x0000010du,0x0000010eu,0x00050081u,0x00000069u,0x00000110u,0x0000010cu,0x0000010fu,0x0003003eu,0x0000010bu,0x00000110u,0x0004003du,0x0000004fu,0x00000111u,0x00000051u,0x0004003du,0x00000043u,0x00000112u,0x00000045u,0x0004003du,0x00000069u,0x00000113u,0x0000010bu,0x00050051u,0x00000006u,0x00000114u,0x00000113u,0x00000000u,0x00050051u,0x00000006u,0x00000115u,0x00000113u,0x00000001u,0x00070050u,0x00000085u,0x00000116u,0x00000114u,0x00000115u,0x00000084u,0x00000075u,0x00040063u,0x00000111u,0x00000112u,0x00000116u,0x0004003du,0x0000004fu,0x00000118u,0x00000117u,0x0004003du,0x00000043u,0x00000119u,0x00000045u,0x0004003du,0x00000069u,0x0000011au,0x0000010bu,0x0004007fu,0x00000069u,0x0000011bu,0x0000011au,0x00050051u,0x00000006u,0x0000011cu,0x0000011bu,0x00000000u,0x00050051u,0x00000006u,0x0000011du,0x0000011bu,0x00000001u,0x00070050u,0x00000085u,0x0000011eu,0x0000011cu,0x0000011du,0x00000084u,0x00000075u,0x00040063u,0x00000118u,0x00000119u,0x0000011eu,0x000100fdu,0x00010038u,0x00050036u,0x00000006u,0x0000000eu,0x00000000u,0x00000008u,0x00030037u,0x00000007u,0x00000009u,0x00030037u,0x00000007u,0x0000000au,0x00030037u,0x00000007u,0x0000000bu,0x00030037u,0x00000007u,0x0000000cu,0x00030037u,0x00000007u,0x0000000du,0x000200f8u,0x0000000fu,0x0004003bu,0x00000007u,0x00000010u,0x00000007u,0x0004003bu,0x00000007u,0x00000034u,0x00000007u,0x0004003du,0x00000006u,0x00000011u,0x00000009u,0x0004003du,0x00000006u,0x00000012u,0x0000000au,0x0007000cu,0x00000006u,0x00000013u,0x00000001u,0x00000025u,0x00000011u,0x00000012u,0x0003003eu,0x00000010u,0x00000013u,0x0004003du,0x00000006u,0x00000014u,0x00000009u,0x0004003du,0x00000006u,0x00000015u,0x0000000au,0x0007000cu,0x00000006u,0x00000016u,0x00000001u,0x00000028u,0x00000014u,0x00000015u,0x0003003eu,0x00000009u,0x00000016u,0x0004003du,0x00000006u,0x00000017u,0x00000010u,0x0003003eu,0x0000000au,0x00000017u,0x0004003du,0x00000006u,0x00000018u,0x0000000bu,0x0004003du,0x00000006u,0x00000019u,0x0000000cu,0x0007000cu,0x00000006u,0x0000001au,0x00000001u,0x00000025u,0x00000018u,0x00000019u,0x0003003eu,0x00000010u,0x0000001au,0x0004003du,0x00000006u,0x0000001bu,0x0000000bu,0x0004003du,0x00000006u,0x0000001cu,0x0000000cu,0x0007000cu,0x00000006u,0x0000001du,0x00000001u,0x00000028u,0x0000001bu,0x0000001cu,0x0003003eu,0x0000000bu,0x0000001du,0x0004003du,0x00000006u,0x0000001eu,0x00000010u,0x0003003eu,0x0000000cu,0x0000001eu,0x0004003du,0x00000006u,0x0000001fu,0x00000009u,0x0004003du,0x00000006u,0x00000020u,0x0000000bu,0x0007000cu,0x00000006u,0x00000021u,0x00000001u,0x00000025u,0x0000001fu,0x00000020u,0x0003003eu,0x00000010u,0x00000021u,0x0004003du,0x00000006u,0x00000022u,0x00000009u,0x0004003du,0x00000006u,0x00000023u,0x0000000bu,0x0007000cu,0x00000006u,0x00000024u,0x00000001u,0x00000028u,0x00000022u,0x00000023u,0x0003003eu,0x00000009u,0x00000024u,0x0004003du,0x00000006u,0x00000025u,0x00000010u,0x0003003eu,0x0000000bu,0x00000025u,0x0004003du,0x00000006u,0x00000026u,0x0000000au,0x0004003du,0x00000006u,0x00000027u,0x0000000cu,0x0007000cu,0x00000006u,0x00000028u,0x00000001u,0x00000025u,0x00000026u,0x00000027u,0x0003003eu,0x00000010u,0x00000028u,0x0004003du,0x00000006u,0x00000029u,0x0000000au,0x0004003du,0x00000006u,0x0000002au,0x0000000cu,0x0007000cu,0x00000006u,0x0000002bu,0x00000001u,0x00000028u,0x00000029u,0x0000002au,0x0003003eu,0x0000000au,0x0000002bu,0x0004003du,0x00000006u,0x0000002cu,0x00000010u,0x0003003eu,0x0000000cu,0x0000002cu,0x0004003du,0x00000006u,0x0000002du,0x0000000au,0x0004003du,0x00000006u,0x0000002eu,0x0000000bu,0x0007000cu,0x00000006u,0x0000002fu,0x00000001u,0x00000025u,0x0000002du,0x0000002eu,0x0003003eu,0x00000010u,0x0000002fu,0x0004003du,0x00000006u,0x00000030u,0x0000000au,0x0004003du,0x00000006u,0x00000031u,0x0000000bu,0x0007000cu,0x00000006u,0x00000032u,0x00000001u,0x00000028u,0x00000030u,0x00000031u,0x0003003eu,0x0000000au,0x00000032u,0x0004003du,0x00000006u,0x00000033u,0x00000010u,0x0003003eu,0x0000000bu,0x00000033u,0x0004003du,0x00000006u,0x00000035u,0x0000000au,0x0004003du,0x00000006u,0x00000036u,0x0000000du,0x0007000cu,0x00000006u,0x00000037u,0x00000001u,0x00000025u,0x00000035u,0x00000036u,0x0003003eu,0x00000034u,0x00000037u,0x0004003du,0x00000006u,0x00000038u,0x0000000au,0x0004003du,0x00000006u,0x00000039u,0x0000000du,0x0007000cu,0x00000006u,0x0000003au,0x00000001u,0x00000028u,0x00000038u,0x00000039u,0x0003003eu,0x00000010u,0x0000003au,0x0004003du,0x00000006u,0x0000003bu,0x00000034u,0x0004003du,0x00000006u,0x0000003cu,0x0000000bu,0x0007000cu,0x00000006u,0x0000003du,0x00000001u,0x00000028u,0x0000003bu,0x0000003cu,0x0004003du,0x00000006u,0x0000003eu,0x00000010u,0x0007000cu,0x00000006u,0x0000003fu,0x00000001u,0x00000025u,0x0000003du,0x0000003eu,0x000200feu,0x0000003fu,0x00010038u}; static const size_t OF3_EXPAND_LEN = 1798; static const uint32_t OF3_FLOW_M4_SPV[] = {0x07230203u,0x00010300u,0x0008000bu,0x00000151u,0x00000000u,0x00020011u,0x00000001u,0x00020011u,0x00000032u,0x0006000bu,0x00000001u,0x4c534c47u,0x6474732eu,0x3035342eu,0x00000000u,0x0003000eu,0x00000000u,0x00000001u,0x0006000fu,0x00000005u,0x00000004u,0x6e69616du,0x00000000u,0x000000f6u,0x00060010u,0x00000004u,0x00000011u,0x00000010u,0x00000010u,0x00000001u,0x00030003u,0x00000002u,0x000001c2u,0x00040005u,0x00000004u,0x6e69616du,0x00000000u,0x00080005u,0x00000010u,0x636f6c62u,0x6461536bu,0x31327328u,0x3132733bu,0x3266763bu,0x0000003bu,0x00030005u,0x0000000du,0x00000061u,0x00030005u,0x0000000eu,0x00000062u,0x00040005u,0x0000000fu,0x646e6163u,0x00000000u,0x00070005u,0x00000016u,0x766c6f73u,0x32732865u,0x32733b31u,0x66763b31u,0x00003b32u,0x00030005u,0x00000013u,0x00000061u,0x00030005u,0x00000014u,0x00000062u,0x00040005u,0x00000015u,0x64657270u,0x00000000u,0x00030005u,0x00000019u,0x00646173u,0x00030005u,0x0000001du,0x00007962u,0x00030005u,0x00000028u,0x00007862u,0x00030005u,0x00000030u,0x00006f62u,0x00030005u,0x00000036u,0x00006170u,0x00030005u,0x00000039u,0x00765567u,0x00050005u,0x0000003cu,0x766e4967u,0x616d754cu,0x00000000u,0x00030005u,0x00000045u,0x00006270u,0x00040005u,0x0000005du,0x74736562u,0x00646153u,0x00050005u,0x0000005fu,0x74736562u,0x70736944u,0x00000000u,0x00030005u,0x00000061u,0x00007973u,0x00030005u,0x0000006bu,0x00007873u,0x00040005u,0x00000073u,0x646e6163u,0x00000000u,0x00030005u,0x0000007bu,0x00646173u,0x00040005u,0x0000007cu,0x61726170u,0x0000006du,0x00030005u,0x00000095u,0x00000055u,0x00060006u,0x00000095u,0x00000000u,0x776f6c66u,0x6c616353u,0x00000065u,0x00050006u,0x00000095u,0x00000001u,0x6576656cu,0x0000006cu,0x00050006u,0x00000095u,0x00000002u,0x6c63636fu,0x00006f4cu,0x00050006u,0x00000095u,0x00000003u,0x6c63636fu,0x00006948u,0x00030005u,0x00000097u,0x00000000u,0x00040005u,0x0000009eu,0x43646173u,0x00000000u,0x00040005u,0x000000a1u,0x58646173u,0x0000006du,0x00040005u,0x000000a6u,0x61726170u,0x0000006du,0x00040005u,0x000000a9u,0x58646173u,0x00000070u,0x00040005u,0x000000aeu,0x61726170u,0x0000006du,0x00040005u,0x000000b1u,0x59646173u,0x0000006du,0x00040005u,0x000000b5u,0x61726170u,0x0000006du,0x00040005u,0x000000b8u,0x59646173u,0x00000070u,0x00040005u,0x000000bcu,0x61726170u,0x0000006du,0x00030005u,0x000000bfu,0x00007864u,0x00030005u,0x000000c0u,0x00007964u,0x00040005u,0x000000c1u,0x6f6e6564u,0x0000586du,0x00040005u,0x000000c9u,0x6f6e6564u,0x0000596du,0x00030005u,0x000000f3u,0x00646967u,0x00080005u,0x000000f6u,0x475f6c67u,0x61626f6cu,0x766e496cu,0x7461636fu,0x496e6f69u,0x00000044u,0x00030005u,0x000000fbu,0x006d6964u,0x00040005u,0x000000feu,0x6f6c4675u,0x00000077u,0x00050005u,0x0000011au,0x6d754c75u,0x72754361u,0x00000072u,0x00040005u,0x00000122u,0x654c6f74u,0x006c6576u,0x00040005u,0x00000129u,0x64657270u,0x00000000u,0x00050005u,0x0000012au,0x65725075u,0x74636964u,0x0000726fu,0x00030005u,0x0000012eu,0x00647766u,0x00050005u,0x0000012fu,0x6d754c75u,0x65725061u,0x00000076u,0x00040005u,0x00000134u,0x61726170u,0x0000006du,0x00030005u,0x00000136u,0x00647762u,0x00040005u,0x0000013bu,0x61726170u,0x0000006du,0x00040005u,0x0000013du,0x75466f74u,0x00006c6cu,0x00030047u,0x00000095u,0x00000002u,0x00050048u,0x00000095u,0x00000000u,0x00000023u,0x00000000u,0x00050048u,0x00000095u,0x00000001u,0x00000023u,0x00000004u,0x00050048u,0x00000095u,0x00000002u,0x00000023u,0x00000008u,0x00050048u,0x00000095u,0x00000003u,0x00000023u,0x0000000cu,0x00040047u,0x00000097u,0x00000021u,0x00000000u,0x00040047u,0x00000097u,0x00000022u,0x00000000u,0x00040047u,0x000000f6u,0x0000000bu,0x0000001cu,0x00030047u,0x000000feu,0x00000019u,0x00040047u,0x000000feu,0x00000021u,0x00000030u,0x00040047u,0x000000feu,0x00000022u,0x00000000u,0x00040047u,0x0000011au,0x00000021u,0x00000021u,0x00040047u,0x0000011au,0x00000022u,0x00000000u,0x00040047u,0x0000012au,0x00000021u,0x00000022u,0x00040047u,0x0000012au,0x00000022u,0x00000000u,0x00040047u,0x0000012fu,0x00000021u,0x00000020u,0x00040047u,0x0000012fu,0x00000022u,0x00000000u,0x00040047u,0x00000150u,0x0000000bu,0x00000019u,0x00020013u,0x00000002u,0x00030021u,0x00000003u,0x00000002u,0x00030016u,0x00000006u,0x00000020u,0x00090019u,0x00000007u,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000001u,0x00000000u,0x0003001bu,0x00000008u,0x00000007u,0x00040020u,0x00000009u,0x00000000u,0x00000008u,0x00040017u,0x0000000au,0x00000006u,0x00000002u,0x00040020u,0x0000000bu,0x00000007u,0x0000000au,0x00060021u,0x0000000cu,0x00000006u,0x00000009u,0x00000009u,0x0000000bu,0x00060021u,0x00000012u,0x0000000au,0x00000009u,0x00000009u,0x0000000bu,0x00040020u,0x00000018u,0x00000007u,0x00000006u,0x0004002bu,0x00000006u,0x0000001au,0x00000000u,0x00040015u,0x0000001bu,0x00000020u,0x00000001u,0x00040020u,0x0000001cu,0x00000007u,0x0000001bu,0x0004002bu,0x0000001bu,0x0000001eu,0xffffffffu,0x0004002bu,0x0000001bu,0x00000025u,0x00000001u,0x00020014u,0x00000026u,0x00040020u,0x00000038u,0x00000006u,0x0000000au,0x0004003bu,0x00000038u,0x00000039u,0x00000006u,0x0004003bu,0x00000038u,0x0000003cu,0x00000006u,0x00040017u,0x00000040u,0x00000006u,0x00000004u,0x00040015u,0x00000042u,0x00000020u,0x00000000u,0x0004002bu,0x00000042u,0x00000043u,0x00000000u,0x0004002bu,0x00000006u,0x0000005eu,0x7f7fffffu,0x0004002bu,0x0000001bu,0x00000062u,0xfffffffdu,0x0004002bu,0x0000001bu,0x00000069u,0x00000003u,0x0004002bu,0x00000006u,0x0000007fu,0x3b03126fu,0x0006001eu,0x00000095u,0x00000006u,0x00000042u,0x00000006u,0x00000006u,0x00040020u,0x00000096u,0x00000002u,0x00000095u,0x0004003bu,0x00000096u,0x00000097u,0x00000002u,0x00040020u,0x00000098u,0x00000002u,0x00000042u,0x0004002bu,0x00000006u,0x000000a3u,0xbf800000u,0x0005002cu,0x0000000au,0x000000a4u,0x000000a3u,0x0000001au,0x0004002bu,0x00000006u,0x000000abu,0x3f800000u,0x0005002cu,0x0000000au,0x000000acu,0x000000abu,0x0000001au,0x0005002cu,0x0000000au,0x000000b3u,0x0000001au,0x000000a3u,0x0005002cu,0x0000000au,0x000000bau,0x0000001au,0x000000abu,0x0004002bu,0x00000006u,0x000000c3u,0x40000000u,0x0004002bu,0x00000006u,0x000000d1u,0x358637bdu,0x0004002bu,0x00000006u,0x000000d5u,0x3f000000u,0x0004002bu,0x00000006u,0x000000dcu,0xbf000000u,0x00040017u,0x000000f1u,0x0000001bu,0x00000002u,0x00040020u,0x000000f2u,0x00000007u,0x000000f1u,0x00040017u,0x000000f4u,0x00000042u,0x00000003u,0x00040020u,0x000000f5u,0x00000001u,0x000000f4u,0x0004003bu,0x000000f5u,0x000000f6u,0x00000001u,0x00040017u,0x000000f7u,0x00000042u,0x00000002u,0x00090019u,0x000000fcu,0x00000006u,0x00000001u,0x00000000u,0x00000000u,0x00000000u,0x00000002u,0x00000002u,0x00040020u,0x000000fdu,0x00000000u,0x000000fcu,0x0004003bu,0x000000fdu,0x000000feu,0x00000000u,0x0004002bu,0x00000042u,0x00000109u,0x00000001u,0x0004003bu,0x00000009u,0x0000011au,0x00000000u,0x0004002bu,0x0000001bu,0x0000011cu,0x00000000u,0x00040020u,0x00000128u,0x00000007u,0x00000040u,0x0004003bu,0x00000009u,0x0000012au,0x00000000u,0x0004003bu,0x00000009u,0x0000012fu,0x00000000u,0x0004002bu,0x00000042u,0x0000014fu,0x00000010u,0x0006002cu,0x000000f4u,0x00000150u,0x0000014fu,0x0000014fu,0x00000109u,0x00050036u,0x00000002u,0x00000004u,0x00000000u,0x00000003u,0x000200f8u,0x00000005u,0x0004003bu,0x000000f2u,0x000000f3u,0x00000007u,0x0004003bu,0x000000f2u,0x000000fbu,0x00000007u,0x0004003bu,0x00000018u,0x00000122u,0x00000007u,0x0004003bu,0x00000128u,0x00000129u,0x00000007u,0x0004003bu,0x0000000bu,0x0000012eu,0x00000007u,0x0004003bu,0x0000000bu,0x00000134u,0x00000007u,0x0004003bu,0x0000000bu,0x00000136u,0x00000007u,0x0004003bu,0x0000000bu,0x0000013bu,0x00000007u,0x0004003bu,0x00000018u,0x0000013du,0x00000007u,0x0004003du,0x000000f4u,0x000000f8u,0x000000f6u,0x0007004fu,0x000000f7u,0x000000f9u,0x000000f8u,0x000000f8u,0x00000000u,0x00000001u,0x0004007cu,0x000000f1u,0x000000fau,0x000000f9u,0x0003003eu,0x000000f3u,0x000000fau,0x0004003du,0x000000fcu,0x000000ffu,0x000000feu,0x00040068u,0x000000f1u,0x00000100u,0x000000ffu,0x0003003eu,0x000000fbu,0x00000100u,0x00050041u,0x0000001cu,0x00000101u,0x000000f3u,0x00000043u,0x0004003du,0x0000001bu,0x00000102u,0x00000101u,0x00050041u,0x0000001cu,0x00000103u,0x000000fbu,0x00000043u,0x0004003du,0x0000001bu,0x00000104u,0x00000103u,0x000500afu,0x00000026u,0x00000105u,0x00000102u,0x00000104u,0x000400a8u,0x00000026u,0x00000106u,0x00000105u,0x000300f7u,0x00000108u,0x00000000u,0x000400fau,0x00000106u,0x00000107u,0x00000108u,0x000200f8u,0x00000107u,0x00050041u,0x0000001cu,0x0000010au,0x000000f3u,0x00000109u,0x0004003du,0x0000001bu,0x0000010bu,0x0000010au,0x00050041u,0x0000001cu,0x0000010cu,0x000000fbu,0x00000109u,0x0004003du,0x0000001bu,0x0000010du,0x0000010cu,0x000500afu,0x00000026u,0x0000010eu,0x0000010bu,0x0000010du,0x000200f9u,0x00000108u,0x000200f8u,0x00000108u,0x000700f5u,0x00000026u,0x0000010fu,0x00000105u,0x00000005u,0x0000010eu,0x00000107u,0x000300f7u,0x00000111u,0x00000000u,0x000400fau,0x0000010fu,0x00000110u,0x00000111u,0x000200f8u,0x00000110u,0x000100fdu,0x000200f8u,0x00000111u,0x0004003du,0x000000f1u,0x00000113u,0x000000f3u,0x0004006fu,0x0000000au,0x00000114u,0x00000113u,0x00050050u,0x0000000au,0x00000115u,0x000000d5u,0x000000d5u,0x00050081u,0x0000000au,0x00000116u,0x00000114u,0x00000115u,0x0004003du,0x000000f1u,0x00000117u,0x000000fbu,0x0004006fu,0x0000000au,0x00000118u,0x00000117u,0x00050088u,0x0000000au,0x00000119u,0x00000116u,0x00000118u,0x0003003eu,0x00000039u,0x00000119u,0x0004003du,0x00000008u,0x0000011bu,0x0000011au,0x00040064u,0x00000007u,0x0000011du,0x0000011bu,0x00050067u,0x000000f1u,0x0000011eu,0x0000011du,0x0000011cu,0x0004006fu,0x0000000au,0x0000011fu,0x0000011eu,0x00050050u,0x0000000au,0x00000120u,0x000000abu,0x000000abu,0x00050088u,0x0000000au,0x00000121u,0x00000120u,0x0000011fu,0x0003003eu,0x0000003cu,0x00000121u,0x00050041u,0x00000098u,0x00000123u,0x00000097u,0x00000025u,0x0004003du,0x00000042u,0x00000124u,0x00000123u,0x00040070u,0x00000006u,0x00000125u,0x00000124u,0x0004007fu,0x00000006u,0x00000126u,0x00000125u,0x0006000cu,0x00000006u,0x00000127u,0x00000001u,0x0000001du,0x00000126u,0x0003003eu,0x00000122u,0x00000127u,0x0004003du,0x00000008u,0x0000012bu,0x0000012au,0x0004003du,0x0000000au,0x0000012cu,0x00000039u,0x00070058u,0x00000040u,0x0000012du,0x0000012bu,0x0000012cu,0x00000002u,0x0000001au,0x0003003eu,0x00000129u,0x0000012du,0x0004003du,0x00000040u,0x00000130u,0x00000129u,0x0007004fu,0x0000000au,0x00000131u,0x00000130u,0x00000130u,0x00000000u,0x00000001u,0x0004003du,0x00000006u,0x00000132u,0x00000122u,0x0005008eu,0x0000000au,0x00000133u,0x00000131u,0x00000132u,0x0003003eu,0x00000134u,0x00000133u,0x00070039u,0x0000000au,0x00000135u,0x00000016u,0x0000012fu,0x0000011au,0x00000134u,0x0003003eu,0x0000012eu,0x00000135u,0x0004003du,0x00000040u,0x00000137u,0x00000129u,0x0007004fu,0x0000000au,0x00000138u,0x00000137u,0x00000137u,0x00000002u,0x00000003u,0x0004003du,0x00000006u,0x00000139u,0x00000122u,0x0005008eu,0x0000000au,0x0000013au,0x00000138u,0x00000139u,0x0003003eu,0x0000013bu,0x0000013au,0x00070039u,0x0000000au,0x0000013cu,0x00000016u,0x0000011au,0x0000012fu,0x0000013bu,0x0003003eu,0x00000136u,0x0000013cu,0x00050041u,0x00000098u,0x0000013eu,0x00000097u,0x00000025u,0x0004003du,0x00000042u,0x0000013fu,0x0000013eu,0x00040070u,0x00000006u,0x00000140u,0x0000013fu,0x0006000cu,0x00000006u,0x00000141u,0x00000001u,0x0000001du,0x00000140u,0x0003003eu,0x0000013du,0x00000141u,0x0004003du,0x000000fcu,0x00000142u,0x000000feu,0x0004003du,0x000000f1u,0x00000143u,0x000000f3u,0x0004003du,0x0000000au,0x00000144u,0x0000012eu,0x0004003du,0x00000006u,0x00000145u,0x0000013du,0x0005008eu,0x0000000au,0x00000146u,0x00000144u,0x00000145u,0x0004003du,0x0000000au,0x00000147u,0x00000136u,0x0004003du,0x00000006u,0x00000148u,0x0000013du,0x0005008eu,0x0000000au,0x00000149u,0x00000147u,0x00000148u,0x00050051u,0x00000006u,0x0000014au,0x00000146u,0x00000000u,0x00050051u,0x00000006u,0x0000014bu,0x00000146u,0x00000001u,0x00050051u,0x00000006u,0x0000014cu,0x00000149u,0x00000000u,0x00050051u,0x00000006u,0x0000014du,0x00000149u,0x00000001u,0x00070050u,0x00000040u,0x0000014eu,0x0000014au,0x0000014bu,0x0000014cu,0x0000014du,0x00040063u,0x00000142u,0x00000143u,0x0000014eu,0x000100fdu,0x00010038u,0x00050036u,0x00000006u,0x00000010u,0x00000000u,0x0000000cu,0x00030037u,0x00000009u,0x0000000du,0x00030037u,0x00000009u,0x0000000eu,0x00030037u,0x0000000bu,0x0000000fu,0x000200f8u,0x00000011u,0x0004003bu,0x00000018u,0x00000019u,0x00000007u,0x0004003bu,0x0000001cu,0x0000001du,0x00000007u,0x0004003bu,0x0000001cu,0x00000028u,0x00000007u,0x0004003bu,0x0000000bu,0x00000030u,0x00000007u,0x0004003bu,0x00000018u,0x00000036u,0x00000007u,0x0004003bu,0x00000018u,0x00000045u,0x00000007u,0x0003003eu,0x00000019u,0x0000001au,0x0003003eu,0x0000001du,0x0000001eu,0x000200f9u,0x0000001fu,0x000200f8u,0x0000001fu,0x000400f6u,0x00000021u,0x00000022u,0x00000000u,0x000200f9u,0x00000023u,0x000200f8u,0x00000023u,0x0004003du,0x0000001bu,0x00000024u,0x0000001du,0x000500b3u,0x00000026u,0x00000027u,0x00000024u,0x00000025u,0x000400fau,0x00000027u,0x00000020u,0x00000021u,0x000200f8u,0x00000020u,0x0003003eu,0x00000028u,0x0000001eu,0x000200f9u,0x00000029u,0x000200f8u,0x00000029u,0x000400f6u,0x0000002bu,0x0000002cu,0x00000000u,0x000200f9u,0x0000002du,0x000200f8u,0x0000002du,0x0004003du,0x0000001bu,0x0000002eu,0x00000028u,0x000500b3u,0x00000026u,0x0000002fu,0x0000002eu,0x00000025u,0x000400fau,0x0000002fu,0x0000002au,0x0000002bu,0x000200f8u,0x0000002au,0x0004003du,0x0000001bu,0x00000031u,0x00000028u,0x0004006fu,0x00000006u,0x00000032u,0x00000031u,0x0004003du,0x0000001bu,0x00000033u,0x0000001du,0x0004006fu,0x00000006u,0x00000034u,0x00000033u,0x00050050u,0x0000000au,0x00000035u,0x00000032u,0x00000034u,0x0003003eu,0x00000030u,0x00000035u,0x0004003du,0x00000008u,0x00000037u,0x0000000du,0x0004003du,0x0000000au,0x0000003au,0x00000039u,0x0004003du,0x0000000au,0x0000003bu,0x00000030u,0x0004003du,0x0000000au,0x0000003du,0x0000003cu,0x00050085u,0x0000000au,0x0000003eu,0x0000003bu,0x0000003du,0x00050081u,0x0000000au,0x0000003fu,0x0000003au,0x0000003eu,0x00070058u,0x00000040u,0x00000041u,0x00000037u,0x0000003fu,0x00000002u,0x0000001au,0x00050051u,0x00000006u,0x00000044u,0x00000041u,0x00000000u,0x0003003eu,0x00000036u,0x00000044u,0x0004003du,0x00000008u,0x00000046u,0x0000000eu,0x0004003du,0x0000000au,0x00000047u,0x00000039u,0x0004003du,0x0000000au,0x00000048u,0x00000030u,0x0004003du,0x0000000au,0x00000049u,0x0000000fu,0x00050081u,0x0000000au,0x0000004au,0x00000048u,0x00000049u,0x0004003du,0x0000000au,0x0000004bu,0x0000003cu,0x00050085u,0x0000000au,0x0000004cu,0x0000004au,0x0000004bu,0x00050081u,0x0000000au,0x0000004du,0x00000047u,0x0000004cu,0x00070058u,0x00000040u,0x0000004eu,0x00000046u,0x0000004du,0x00000002u,0x0000001au,0x00050051u,0x00000006u,0x0000004fu,0x0000004eu,0x00000000u,0x0003003eu,0x00000045u,0x0000004fu,0x0004003du,0x00000006u,0x00000050u,0x00000036u,0x0004003du,0x00000006u,0x00000051u,0x00000045u,0x00050083u,0x00000006u,0x00000052u,0x00000050u,0x00000051u,0x0006000cu,0x00000006u,0x00000053u,0x00000001u,0x00000004u,0x00000052u,0x0004003du,0x00000006u,0x00000054u,0x00000019u,0x00050081u,0x00000006u,0x00000055u,0x00000054u,0x00000053u,0x0003003eu,0x00000019u,0x00000055u,0x000200f9u,0x0000002cu,0x000200f8u,0x0000002cu,0x0004003du,0x0000001bu,0x00000056u,0x00000028u,0x00050080u,0x0000001bu,0x00000057u,0x00000056u,0x00000025u,0x0003003eu,0x00000028u,0x00000057u,0x000200f9u,0x00000029u,0x000200f8u,0x0000002bu,0x000200f9u,0x00000022u,0x000200f8u,0x00000022u,0x0004003du,0x0000001bu,0x00000058u,0x0000001du,0x00050080u,0x0000001bu,0x00000059u,0x00000058u,0x00000025u,0x0003003eu,0x0000001du,0x00000059u,0x000200f9u,0x0000001fu,0x000200f8u,0x00000021u,0x0004003du,0x00000006u,0x0000005au,0x00000019u,0x000200feu,0x0000005au,0x00010038u,0x00050036u,0x0000000au,0x00000016u,0x00000000u,0x00000012u,0x00030037u,0x00000009u,0x00000013u,0x00030037u,0x00000009u,0x00000014u,0x00030037u,0x0000000bu,0x00000015u,0x000200f8u,0x00000017u,0x0004003bu,0x00000018u,0x0000005du,0x00000007u,0x0004003bu,0x0000000bu,0x0000005fu,0x00000007u,0x0004003bu,0x0000001cu,0x00000061u,0x00000007u,0x0004003bu,0x0000001cu,0x0000006bu,0x00000007u,0x0004003bu,0x0000000bu,0x00000073u,0x00000007u,0x0004003bu,0x00000018u,0x0000007bu,0x00000007u,0x0004003bu,0x0000000bu,0x0000007cu,0x00000007u,0x0004003bu,0x00000018u,0x0000009eu,0x00000007u,0x0004003bu,0x00000018u,0x000000a1u,0x00000007u,0x0004003bu,0x0000000bu,0x000000a6u,0x00000007u,0x0004003bu,0x00000018u,0x000000a9u,0x00000007u,0x0004003bu,0x0000000bu,0x000000aeu,0x00000007u,0x0004003bu,0x00000018u,0x000000b1u,0x00000007u,0x0004003bu,0x0000000bu,0x000000b5u,0x00000007u,0x0004003bu,0x00000018u,0x000000b8u,0x00000007u,0x0004003bu,0x0000000bu,0x000000bcu,0x00000007u,0x0004003bu,0x00000018u,0x000000bfu,0x00000007u,0x0004003bu,0x00000018u,0x000000c0u,0x00000007u,0x0004003bu,0x00000018u,0x000000c1u,0x00000007u,0x0004003bu,0x00000018u,0x000000c9u,0x00000007u,0x0003003eu,0x0000005du,0x0000005eu,0x0004003du,0x0000000au,0x00000060u,0x00000015u,0x0003003eu,0x0000005fu,0x00000060u,0x0003003eu,0x00000061u,0x00000062u,0x000200f9u,0x00000063u,0x000200f8u,0x00000063u,0x000400f6u,0x00000065u,0x00000066u,0x00000000u,0x000200f9u,0x00000067u,0x000200f8u,0x00000067u,0x0004003du,0x0000001bu,0x00000068u,0x00000061u,0x000500b3u,0x00000026u,0x0000006au,0x00000068u,0x00000069u,0x000400fau,0x0000006au,0x00000064u,0x00000065u,0x000200f8u,0x00000064u,0x0003003eu,0x0000006bu,0x00000062u,0x000200f9u,0x0000006cu,0x000200f8u,0x0000006cu,0x000400f6u,0x0000006eu,0x0000006fu,0x00000000u,0x000200f9u,0x00000070u,0x000200f8u,0x00000070u,0x0004003du,0x0000001bu,0x00000071u,0x0000006bu,0x000500b3u,0x00000026u,0x00000072u,0x00000071u,0x00000069u,0x000400fau,0x00000072u,0x0000006du,0x0000006eu,0x000200f8u,0x0000006du,0x0004003du,0x0000000au,0x00000074u,0x00000015u,0x0004003du,0x0000001bu,0x00000075u,0x0000006bu,0x0004006fu,0x00000006u,0x00000076u,0x00000075u,0x0004003du,0x0000001bu,0x00000077u,0x00000061u,0x0004006fu,0x00000006u,0x00000078u,0x00000077u,0x00050050u,0x0000000au,0x00000079u,0x00000076u,0x00000078u,0x00050081u,0x0000000au,0x0000007au,0x00000074u,0x00000079u,0x0003003eu,0x00000073u,0x0000007au,0x0004003du,0x0000000au,0x0000007du,0x00000073u,0x0003003eu,0x0000007cu,0x0000007du,0x00070039u,0x00000006u,0x0000007eu,0x00000010u,0x00000013u,0x00000014u,0x0000007cu,0x0003003eu,0x0000007bu,0x0000007eu,0x0004003du,0x0000001bu,0x00000080u,0x0000006bu,0x0004006fu,0x00000006u,0x00000081u,0x00000080u,0x0006000cu,0x00000006u,0x00000082u,0x00000001u,0x00000004u,0x00000081u,0x0004003du,0x0000001bu,0x00000083u,0x00000061u,0x0004006fu,0x00000006u,0x00000084u,0x00000083u,0x0006000cu,0x00000006u,0x00000085u,0x00000001u,0x00000004u,0x00000084u,0x00050081u,0x00000006u,0x00000086u,0x00000082u,0x00000085u,0x00050085u,0x00000006u,0x00000087u,0x0000007fu,0x00000086u,0x0004003du,0x00000006u,0x00000088u,0x0000007bu,0x00050081u,0x00000006u,0x00000089u,0x00000088u,0x00000087u,0x0003003eu,0x0000007bu,0x00000089u,0x0004003du,0x00000006u,0x0000008au,0x0000007bu,0x0004003du,0x00000006u,0x0000008bu,0x0000005du,0x000500b8u,0x00000026u,0x0000008cu,0x0000008au,0x0000008bu,0x000300f7u,0x0000008eu,0x00000000u,0x000400fau,0x0000008cu,0x0000008du,0x0000008eu,0x000200f8u,0x0000008du,0x0004003du,0x00000006u,0x0000008fu,0x0000007bu,0x0003003eu,0x0000005du,0x0000008fu,0x0004003du,0x0000000au,0x00000090u,0x00000073u,0x0003003eu,0x0000005fu,0x00000090u,0x000200f9u,0x0000008eu,0x000200f8u,0x0000008eu,0x000200f9u,0x0000006fu,0x000200f8u,0x0000006fu,0x0004003du,0x0000001bu,0x00000091u,0x0000006bu,0x00050080u,0x0000001bu,0x00000092u,0x00000091u,0x00000025u,0x0003003eu,0x0000006bu,0x00000092u,0x000200f9u,0x0000006cu,0x000200f8u,0x0000006eu,0x000200f9u,0x00000066u,0x000200f8u,0x00000066u,0x0004003du,0x0000001bu,0x00000093u,0x00000061u,0x00050080u,0x0000001bu,0x00000094u,0x00000093u,0x00000025u,0x0003003eu,0x00000061u,0x00000094u,0x000200f9u,0x00000063u,0x000200f8u,0x00000065u,0x00050041u,0x00000098u,0x00000099u,0x00000097u,0x00000025u,0x0004003du,0x00000042u,0x0000009au,0x00000099u,0x000500aau,0x00000026u,0x0000009bu,0x0000009au,0x00000043u,0x000300f7u,0x0000009du,0x00000000u,0x000400fau,0x0000009bu,0x0000009cu,0x0000009du,0x000200f8u,0x0000009cu,0x0004003du,0x00000006u,0x0000009fu,0x0000005du,0x00050083u,0x00000006u,0x000000a0u,0x0000009fu,0x0000001au,0x0003003eu,0x0000009eu,0x000000a0u,0x0004003du,0x0000000au,0x000000a2u,0x0000005fu,0x00050081u,0x0000000au,0x000000a5u,0x000000a2u,0x000000a4u,0x0003003eu,0x000000a6u,0x000000a5u,0x00070039u,0x00000006u,0x000000a7u,0x00000010u,0x00000013u,0x00000014u,0x000000a6u,0x00050081u,0x00000006u,0x000000a8u,0x000000a7u,0x0000007fu,0x0003003eu,0x000000a1u,0x000000a8u,0x0004003du,0x0000000au,0x000000aau,0x0000005fu,0x00050081u,0x0000000au,0x000000adu,0x000000aau,0x000000acu,0x0003003eu,0x000000aeu,0x000000adu,0x00070039u,0x00000006u,0x000000afu,0x00000010u,0x00000013u,0x00000014u,0x000000aeu,0x00050081u,0x00000006u,0x000000b0u,0x000000afu,0x0000007fu,0x0003003eu,0x000000a9u,0x000000b0u,0x0004003du,0x0000000au,0x000000b2u,0x0000005fu,0x00050081u,0x0000000au,0x000000b4u,0x000000b2u,0x000000b3u,0x0003003eu,0x000000b5u,0x000000b4u,0x00070039u,0x00000006u,0x000000b6u,0x00000010u,0x00000013u,0x00000014u,0x000000b5u,0x00050081u,0x00000006u,0x000000b7u,0x000000b6u,0x0000007fu,0x0003003eu,0x000000b1u,0x000000b7u,0x0004003du,0x0000000au,0x000000b9u,0x0000005fu,0x00050081u,0x0000000au,0x000000bbu,0x000000b9u,0x000000bau,0x0003003eu,0x000000bcu,0x000000bbu,0x00070039u,0x00000006u,0x000000bdu,0x00000010u,0x00000013u,0x00000014u,0x000000bcu,0x00050081u,0x00000006u,0x000000beu,0x000000bdu,0x0000007fu,0x0003003eu,0x000000b8u,0x000000beu,0x0003003eu,0x000000bfu,0x0000001au,0x0003003eu,0x000000c0u,0x0000001au,0x0004003du,0x00000006u,0x000000c2u,0x000000a1u,0x0004003du,0x00000006u,0x000000c4u,0x0000009eu,0x00050085u,0x00000006u,0x000000c5u,0x000000c3u,0x000000c4u,0x00050083u,0x00000006u,0x000000c6u,0x000000c2u,0x000000c5u,0x0004003du,0x00000006u,0x000000c7u,0x000000a9u,0x00050081u,0x00000006u,0x000000c8u,0x000000c6u,0x000000c7u,0x0003003eu,0x000000c1u,0x000000c8u,0x0004003du,0x00000006u,0x000000cau,0x000000b1u,0x0004003du,0x00000006u,0x000000cbu,0x0000009eu,0x00050085u,0x00000006u,0x000000ccu,0x000000c3u,0x000000cbu,0x00050083u,0x00000006u,0x000000cdu,0x000000cau,0x000000ccu,0x0004003du,0x00000006u,0x000000ceu,0x000000b8u,0x00050081u,0x00000006u,0x000000cfu,0x000000cdu,0x000000ceu,0x0003003eu,0x000000c9u,0x000000cfu,0x0004003du,0x00000006u,0x000000d0u,0x000000c1u,0x000500bau,0x00000026u,0x000000d2u,0x000000d0u,0x000000d1u,0x000300f7u,0x000000d4u,0x00000000u,0x000400fau,0x000000d2u,0x000000d3u,0x000000d4u,0x000200f8u,0x000000d3u,0x0004003du,0x00000006u,0x000000d6u,0x000000a1u,0x0004003du,0x00000006u,0x000000d7u,0x000000a9u,0x00050083u,0x00000006u,0x000000d8u,0x000000d6u,0x000000d7u,0x00050085u,0x00000006u,0x000000d9u,0x000000d5u,0x000000d8u,0x0004003du,0x00000006u,0x000000dau,0x000000c1u,0x00050088u,0x00000006u,0x000000dbu,0x000000d9u,0x000000dau,0x0008000cu,0x00000006u,0x000000ddu,0x00000001u,0x0000002bu,0x000000dbu,0x000000dcu,0x000000d5u,0x0003003eu,0x000000bfu,0x000000ddu,0x000200f9u,0x000000d4u,0x000200f8u,0x000000d4u,0x0004003du,0x00000006u,0x000000deu,0x000000c9u,0x000500bau,0x00000026u,0x000000dfu,0x000000deu,0x000000d1u,0x000300f7u,0x000000e1u,0x00000000u,0x000400fau,0x000000dfu,0x000000e0u,0x000000e1u,0x000200f8u,0x000000e0u,0x0004003du,0x00000006u,0x000000e2u,0x000000b1u,0x0004003du,0x00000006u,0x000000e3u,0x000000b8u,0x00050083u,0x00000006u,0x000000e4u,0x000000e2u,0x000000e3u,0x00050085u,0x00000006u,0x000000e5u,0x000000d5u,0x000000e4u,0x0004003du,0x00000006u,0x000000e6u,0x000000c9u,0x00050088u,0x00000006u,0x000000e7u,0x000000e5u,0x000000e6u,0x0008000cu,0x00000006u,0x000000e8u,0x00000001u,0x0000002bu,0x000000e7u,0x000000dcu,0x000000d5u,0x0003003eu,0x000000c0u,0x000000e8u,0x000200f9u,0x000000e1u,0x000200f8u,0x000000e1u,0x0004003du,0x00000006u,0x000000e9u,0x000000bfu,0x0004003du,0x00000006u,0x000000eau,0x000000c0u,0x00050050u,0x0000000au,0x000000ebu,0x000000e9u,0x000000eau,0x0004003du,0x0000000au,0x000000ecu,0x0000005fu,0x00050081u,0x0000000au,0x000000edu,0x000000ecu,0x000000ebu,0x0003003eu,0x0000005fu,0x000000edu,0x000200f9u,0x0000009du,0x000200f8u,0x0000009du,0x0004003du,0x0000000au,0x000000eeu,0x0000005fu,0x000200feu,0x000000eeu,0x00010038u}; From 555df009179fe92753979d51581c1872fc706c85 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 00:19:13 -0400 Subject: [PATCH 007/120] Remove redundant final FLOWREG barrier --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index be365f3368..edaf904c01 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -393,7 +393,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.pipeline); dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.layout, 0, 1, &set, 0, nullptr); dd_->CmdDispatch(cmd, (fe.width + 15) / 16, (fe.height + 15) / 16, 1); - bar(*outImg); + if (it + 1 < cfg_.frIters) bar(*outImg); last = outImg; } VkMemoryBarrier mb{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; From f5bde33adcd2858f1e47aeff6662576f0dd6df8e Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 01:26:45 -0400 Subject: [PATCH 008/120] Add dedicated image initialization barrier --- app/src/main/cpp/framegen/ddfg/framegen.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.hpp b/app/src/main/cpp/framegen/ddfg/framegen.hpp index 70719e7963..8f447be812 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.hpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.hpp @@ -63,6 +63,7 @@ private: const std::vector& bindings); void destroyPipe(Pipe& p); void barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkImageLayout to); + void initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout to); const DeviceDispatch* dd_ = nullptr; const InstanceDispatch* id_ = nullptr; From df2eea39859727d30b73b64c7f2ab6e5c9070622 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 01:26:47 -0400 Subject: [PATCH 009/120] Use precise Vulkan barrier for image initialization --- app/src/main/cpp/framegen/ddfg/framegen.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index 5200f6b094..38a0125fdc 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -211,6 +211,19 @@ void FrameGen::barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkI VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); } +void FrameGen::initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout to) { + VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; + b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + b.newLayout = to; + b.srcAccessMask = 0; + b.dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + b.image = img; + b.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; + b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); +} + void FrameGen::destroy() { if (!device_) return; From 068d7d7fdfd2d6d9059d87cd7fd686acbb32d05f Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 01:26:50 -0400 Subject: [PATCH 010/120] Use initialization barriers for fresh framegen images --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index edaf904c01..1c34af2783 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -314,13 +314,13 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur auto bar = [&](FrameGen::Img& i){ barrier(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL); }; if (!reuseFlow) { - for (auto& i : pyrA_) barrier(cmd, i.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL); - for (auto& i : pyrB_) barrier(cmd, i.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL); - for (int l = flowFinest_; l < kLevels; ++l) barrier(cmd, pyrAs_[l].image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL); - barrier(cmd, flowExpA_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL); - barrier(cmd, flowExpB_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL); - barrier(cmd, flowRegA_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL); - barrier(cmd, flowRegB_.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL); + for (auto& i : pyrA_) initializeImage(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL); + for (auto& i : pyrB_) initializeImage(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL); + for (int l = flowFinest_; l < kLevels; ++l) initializeImage(cmd, pyrAs_[l].image, VK_IMAGE_LAYOUT_GENERAL); + initializeImage(cmd, flowExpA_.image, VK_IMAGE_LAYOUT_GENERAL); + initializeImage(cmd, flowExpB_.image, VK_IMAGE_LAYOUT_GENERAL); + initializeImage(cmd, flowRegA_.image, VK_IMAGE_LAYOUT_GENERAL); + initializeImage(cmd, flowRegB_.image, VK_IMAGE_LAYOUT_GENERAL); { VkClearColorValue zero{}; VkImageSubresourceRange rng{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; From 06717ec356d66c5a9a635678ab99a09be6c8d046 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 01:42:32 -0400 Subject: [PATCH 011/120] Declare FrameGen scratch cleanup helper --- app/src/main/cpp/framegen/ddfg/framegen.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.hpp b/app/src/main/cpp/framegen/ddfg/framegen.hpp index 8f447be812..b984018454 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.hpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.hpp @@ -64,6 +64,7 @@ private: void destroyPipe(Pipe& p); void barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkImageLayout to); void initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout to); + void destroyScratchResources(); const DeviceDispatch* dd_ = nullptr; const InstanceDispatch* id_ = nullptr; From f4cbe28532ee474496c200478a320e080fb90c80 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 01:42:35 -0400 Subject: [PATCH 012/120] Add owned-device scratch cleanup helper --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 1c34af2783..81a2b84d86 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -152,6 +152,10 @@ static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorP S = ScratchState{}; } +void FrameGen::destroyScratchResources() { + destroyScratch(dd_, device_, descPool_); +} + void FrameGen::configure(const Config& c) { cfg_ = c; cfg_.sanitize(); int want = flowFinestForPreset(cfg_.perfPreset); From a9a92dfea0692b95a74ef40823e3a2ebd2494875 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 01:42:38 -0400 Subject: [PATCH 013/120] Release scratch resources before destroying FrameGen --- app/src/main/cpp/framegen/ddfg/framegen.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index 38a0125fdc..3b8d8a1c2e 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -228,6 +228,7 @@ void FrameGen::initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout t void FrameGen::destroy() { if (!device_) return; dd_->DeviceWaitIdle(device_); + destroyScratchResources(); for (auto& i : pyrA_) destroyImage(i); pyrA_.clear(); for (auto& i : pyrB_) destroyImage(i); pyrB_.clear(); for (auto& i : pyrAs_) destroyImage(i); pyrAs_.clear(); From 30e5c27b115a3582f58989a5403436d5cc1b0df9 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:01:28 -0400 Subject: [PATCH 014/120] Check device idle result during FrameGen teardown --- app/src/main/cpp/framegen/ddfg/framegen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index 3b8d8a1c2e..69a2556fb8 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -227,7 +227,9 @@ void FrameGen::initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout t void FrameGen::destroy() { if (!device_) return; - dd_->DeviceWaitIdle(device_); + const VkResult idleResult = dd_->DeviceWaitIdle(device_); + if (idleResult != VK_SUCCESS) + DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); continuing teardown", (int)idleResult); destroyScratchResources(); for (auto& i : pyrA_) destroyImage(i); pyrA_.clear(); for (auto& i : pyrB_) destroyImage(i); pyrB_.clear(); From e9078c4612eeed1c810af6419a8b2f8776be7a6e Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:01:32 -0400 Subject: [PATCH 015/120] Handle device idle failures before scratch cleanup --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 81a2b84d86..97b9f12f87 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -178,7 +178,11 @@ void FrameGen::configure(const Config& c) { - dd_->DeviceWaitIdle(device_); + const VkResult idleResult = dd_->DeviceWaitIdle(device_); + if (idleResult != VK_SUCCESS) { + DDFG_LOGE("framegen configure: DeviceWaitIdle failed (%d); aborting live rebuild", (int)idleResult); + return; + } destroyScratch(dd_, device_, descPool_); if (!onResize(extent_, VK_FORMAT_UNDEFINED, true)) DDFG_LOGE("perf-preset live rebuild: onResize FAILED at %ux%u - FG disabled until next resize", @@ -266,7 +270,11 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur if (!g_scratch.built || g_scratch.builtFor.width != extent_.width || g_scratch.builtFor.height != extent_.height) { if (g_scratch.built) { - dd_->DeviceWaitIdle(device_); + const VkResult idleResult = dd_->DeviceWaitIdle(device_); + if (idleResult != VK_SUCCESS) { + DDFG_LOGE("framegen record: DeviceWaitIdle failed (%d); skipping scratch rebuild", (int)idleResult); + return; + } destroyScratch(dd_, device_, descPool_); } ensureScratch(this, dd_, device_, memProps_, descPool_, linear_, extent_, From 49d470588c91c25e0d147e9eb58fb6ad6b8b1641 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:01:40 -0400 Subject: [PATCH 016/120] Disable FrameGen after idle wait failure --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 97b9f12f87..d011b0af55 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -180,7 +180,8 @@ void FrameGen::configure(const Config& c) { const VkResult idleResult = dd_->DeviceWaitIdle(device_); if (idleResult != VK_SUCCESS) { - DDFG_LOGE("framegen configure: DeviceWaitIdle failed (%d); aborting live rebuild", (int)idleResult); + DDFG_LOGE("framegen configure: DeviceWaitIdle failed (%d); disabling FrameGen live rebuild", (int)idleResult); + ready_ = false; return; } destroyScratch(dd_, device_, descPool_); From e597e01e8e4fe7a10d6690e13b92e5ca99c39dd6 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:09:27 -0400 Subject: [PATCH 017/120] Batch FrameGen image descriptor updates --- .../main/cpp/framegen/ddfg/record_impl.inc | 49 +++++++++++++++++-- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index d011b0af55..282dd739ba 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -58,6 +58,26 @@ static void wImg(const ddfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet s w.dstSet = set; w.dstBinding = binding; w.descriptorCount = 1; w.descriptorType = type; w.pImageInfo = ⅈ dd->UpdateDescriptorSets(dev, 1, &w, 0, nullptr); } +static void wImgBatch(const ddfg::DeviceDispatch* dd, VkDevice dev, + const VkDescriptorSet* sets, const uint32_t* bindings, + const VkDescriptorType* types, const VkImageView* views, + const VkSampler* samplers, const VkImageLayout* layouts, + uint32_t count) { + VkDescriptorImageInfo infos[3]{}; + VkWriteDescriptorSet writes[3]{}; + for (uint32_t i = 0; i < count; ++i) { + infos[i].imageView = views[i]; + infos[i].sampler = samplers[i]; + infos[i].imageLayout = layouts[i]; + writes[i] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET}; + writes[i].dstSet = sets[i]; + writes[i].dstBinding = bindings[i]; + writes[i].descriptorCount = 1; + writes[i].descriptorType = types[i]; + writes[i].pImageInfo = &infos[i]; + } + dd->UpdateDescriptorSets(dev, count, writes, 0, nullptr); +} static void wUbo(const ddfg::DeviceDispatch* dd, VkDevice dev, VkDescriptorSet set, uint32_t binding, VkBuffer buf, VkDeviceSize range) { VkDescriptorBufferInfo bi{}; bi.buffer = buf; bi.range = range; @@ -306,8 +326,16 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur } } - wImg(dd_, device_, g_scratch.sLumaCurr, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, currView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); - wImg(dd_, device_, g_scratch.sLumaPrev, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, prevView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); + const VkDescriptorSet lumaSets[] = {g_scratch.sLumaCurr, g_scratch.sLumaPrev}; + const uint32_t lumaBindings[] = {32, 32}; + const VkDescriptorType lumaTypes[] = { + VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER}; + const VkImageView lumaViews[] = {currView, prevView}; + const VkSampler lumaSamplers[] = {linear_, linear_}; + const VkImageLayout lumaLayouts[] = { + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}; + wImgBatch(dd_, device_, lumaSets, lumaBindings, lumaTypes, lumaViews, + lumaSamplers, lumaLayouts, 2); } SynthUBO su{cfg_.flowScale, alpha, cfg_.beta, cfg_.lambda, cfg_.epsilon, cfg_.photoScale, 0, 0, @@ -315,9 +343,20 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur if (g_scratch.synthUboPtr[synthSlot]) std::memcpy(g_scratch.synthUboPtr[synthSlot], &su, sizeof(su)); const VkDescriptorSet synthSet = g_scratch.sSynth[synthSlot]; - wImg(dd_, device_, synthSet, 32, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, prevView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); - wImg(dd_, device_, synthSet, 33, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, currView, linear_, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); - wImg(dd_, device_, synthSet, 48, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, outView, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_GENERAL); + const VkDescriptorSet synthSets[] = {synthSet, synthSet, synthSet}; + const uint32_t synthBindings[] = {32, 33, 48}; + const VkDescriptorType synthTypes[] = { + VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, + VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, + VK_DESCRIPTOR_TYPE_STORAGE_IMAGE}; + const VkImageView synthViews[] = {prevView, currView, outView}; + const VkSampler synthSamplers[] = {linear_, linear_, VK_NULL_HANDLE}; + const VkImageLayout synthLayouts[] = { + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, + VK_IMAGE_LAYOUT_GENERAL}; + wImgBatch(dd_, device_, synthSets, synthBindings, synthTypes, synthViews, + synthSamplers, synthLayouts, 3); auto disp = [&](const Pipe& p, VkDescriptorSet set, VkExtent2D e) { dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, p.pipeline); From 720a2f56ade72a3fdbe6aca2c74802ab7ffb32c5 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:14:46 -0400 Subject: [PATCH 018/120] Invalidate scratch descriptors when images are recreated --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 282dd739ba..fbf04c5abb 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -21,6 +21,7 @@ struct ScratchState { VkDescriptorSet sGmReduce[ddfg::FrameGen::kGmSlots]{}; std::vector sGmPrewarp[ddfg::FrameGen::kGmSlots]; VkExtent2D builtFor{0,0}; + uint64_t builtGeneration = 0; bool built = false; bool flowInited = false; bool flowReady = false; @@ -153,7 +154,7 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, const FrameGen::Pipe& pSynth, const FrameGen::Pipe& pGmReduce, const FrameGen::Pipe& pGmPrewarp, const FrameGen::Pipe& pFlowReg, FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo, - int kLevels, const Config& cfg); + int kLevels, const Config& cfg, uint64_t imageGeneration); static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorPool pool) { auto freeUbo = [&](VkBuffer& b, VkDeviceMemory& m, void*& p) { @@ -289,7 +290,9 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur const Pipe& flowP = m4 ? pFlowM4_ : pFlow_; const Pipe& expandP = m4 ? pExpandM4_ : pExpand_; - if (!g_scratch.built || g_scratch.builtFor.width != extent_.width || g_scratch.builtFor.height != extent_.height) { + if (!g_scratch.built || g_scratch.builtFor.width != extent_.width || + g_scratch.builtFor.height != extent_.height || + g_scratch.builtGeneration != imageGeneration_) { if (g_scratch.built) { const VkResult idleResult = dd_->DeviceWaitIdle(device_); if (idleResult != VK_SUCCESS) { @@ -301,7 +304,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur ensureScratch(this, dd_, device_, memProps_, descPool_, linear_, extent_, pyrA_, pyrB_, pyrAs_, flowLvl_, flowExpA_, flowExpB_, pLuma_, pDown_, flowP, expandP, pSynth_, pGmReduce_, pGmPrewarp_, - pFlowReg_, flowRegA_, flowRegB_, gmSsbo_, kLevels, cfg_); + pFlowReg_, flowRegA_, flowRegB_, gmSsbo_, kLevels, cfg_, imageGeneration_); } if (reuseFlow && !g_scratch.flowReady) return; @@ -493,7 +496,7 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, const FrameGen::Pipe& pSynth, const FrameGen::Pipe& pGmReduce, const FrameGen::Pipe& pGmPrewarp, const FrameGen::Pipe& pFlowReg, FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo, - int kLevels, const Config& cfg) { + int kLevels, const Config& cfg, uint64_t imageGeneration) { auto& S = g_scratch; S = ScratchState{}; const auto GEN = VK_IMAGE_LAYOUT_GENERAL; @@ -596,7 +599,7 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, wImg(dd, dev, S.sSynth[s], 35, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, expB.view, samp, GEN); } - S.builtFor = ext; S.built = true; + S.builtFor = ext; S.builtGeneration = imageGeneration; S.built = true; return true; } From 9a8bd7b4826af8cca0c765eff2f8e5ce3006ae7c Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:14:49 -0400 Subject: [PATCH 019/120] Track image recreation during FrameGen resize --- app/src/main/cpp/framegen/ddfg/framegen.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index 69a2556fb8..1c82795954 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -168,6 +168,7 @@ bool FrameGen::onResize(VkExtent2D extent, VkFormat , bool force) { if (!force && ready_ && extent.width == extent_.width && extent.height == extent_.height) return true; + ++imageGeneration_; for (auto& i : pyrA_) destroyImage(i); pyrA_.clear(); for (auto& i : pyrB_) destroyImage(i); pyrB_.clear(); for (auto& i : pyrAs_) destroyImage(i); pyrAs_.clear(); From e40f898bb2593e8ffb9596bcff760c6d1d0dca39 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:14:51 -0400 Subject: [PATCH 020/120] Track FrameGen image generation --- app/src/main/cpp/framegen/ddfg/framegen.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.hpp b/app/src/main/cpp/framegen/ddfg/framegen.hpp index b984018454..7dc8310bf9 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.hpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.hpp @@ -78,6 +78,7 @@ private: Config cfg_; VkExtent2D extent_{}; + uint64_t imageGeneration_ = 0; bool ready_ = false; int flowFinest_ = kFlowFinestDefault; From 5b08b4714f4aab30ad493941f6a6566d29a2bb85 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:23:52 -0400 Subject: [PATCH 021/120] Batch fresh FrameGen image initialization barriers --- .../main/cpp/framegen/ddfg/record_impl.inc | 77 +++++++++++-------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index fbf04c5abb..c6d6820142 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -369,40 +369,55 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur auto bar = [&](FrameGen::Img& i){ barrier(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL); }; if (!reuseFlow) { - for (auto& i : pyrA_) initializeImage(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL); - for (auto& i : pyrB_) initializeImage(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL); - for (int l = flowFinest_; l < kLevels; ++l) initializeImage(cmd, pyrAs_[l].image, VK_IMAGE_LAYOUT_GENERAL); - initializeImage(cmd, flowExpA_.image, VK_IMAGE_LAYOUT_GENERAL); - initializeImage(cmd, flowExpB_.image, VK_IMAGE_LAYOUT_GENERAL); - initializeImage(cmd, flowRegA_.image, VK_IMAGE_LAYOUT_GENERAL); - initializeImage(cmd, flowRegB_.image, VK_IMAGE_LAYOUT_GENERAL); + // Batch fresh-image transitions that share the same stage and access masks. + std::vector initBarriers; + auto addInitBarrier = [&](VkImage image) { + VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; + b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + b.newLayout = VK_IMAGE_LAYOUT_GENERAL; + b.srcAccessMask = 0; + b.dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + b.image = image; + b.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; + b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + initBarriers.push_back(b); + }; + for (auto& i : pyrA_) addInitBarrier(i.image); + for (auto& i : pyrB_) addInitBarrier(i.image); + for (int l = flowFinest_; l < kLevels; ++l) addInitBarrier(pyrAs_[l].image); + addInitBarrier(flowExpA_.image); + addInitBarrier(flowExpB_.image); + addInitBarrier(flowRegA_.image); + addInitBarrier(flowRegB_.image); + // The final flow level is cleared through TRANSFER_DST_OPTIMAL below; + // the other levels can use the common initialization barrier. + for (int l = flowFinest_; l < kLevels - 1; ++l) addInitBarrier(flowLvl_[l].image); + if (!initBarriers.empty()) { + dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, + static_cast(initBarriers.size()), initBarriers.data(), 0, nullptr); + } { VkClearColorValue zero{}; VkImageSubresourceRange rng{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; - for (int l = flowFinest_; l < kLevels; ++l) { - VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; - b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - b.srcAccessMask = 0; - b.image = flowLvl_[l].image; - b.subresourceRange = rng; - b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - - if (l == kLevels - 1) { - b.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - b.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); - dd_->CmdClearColorImage(cmd, flowLvl_[l].image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &zero, 1, &rng); - b.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - b.newLayout = VK_IMAGE_LAYOUT_GENERAL; - b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; - dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); - } else { - b.newLayout = VK_IMAGE_LAYOUT_GENERAL; - b.dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT; - dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); - } - } + VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; + b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + b.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + b.srcAccessMask = 0; + b.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + b.image = flowLvl_[kLevels - 1].image; + b.subresourceRange = rng; + b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); + dd_->CmdClearColorImage(cmd, flowLvl_[kLevels - 1].image, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &zero, 1, &rng); + b.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + b.newLayout = VK_IMAGE_LAYOUT_GENERAL; + b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; + dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); } disp(pLuma_, g_scratch.sLumaCurr, levelExtent(extent_, 0)); From 2cb19a34cf112714c66dd7749a2b7c1f24af9dda Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:32:24 -0400 Subject: [PATCH 022/120] Skip unused FLOWREG image initialization --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index c6d6820142..7b43a2d7cf 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -367,6 +367,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur dd_->CmdDispatch(cmd, (e.width + 15) / 16, (e.height + 15) / 16, 1); }; auto bar = [&](FrameGen::Img& i){ barrier(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL); }; + const bool frEngaged = (cfg_.frMode != 2) && (cfg_.frIters > 0); if (!reuseFlow) { // Batch fresh-image transitions that share the same stage and access masks. @@ -387,8 +388,10 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur for (int l = flowFinest_; l < kLevels; ++l) addInitBarrier(pyrAs_[l].image); addInitBarrier(flowExpA_.image); addInitBarrier(flowExpB_.image); - addInitBarrier(flowRegA_.image); - addInitBarrier(flowRegB_.image); + if (frEngaged) { + addInitBarrier(flowRegA_.image); + addInitBarrier(flowRegB_.image); + } // The final flow level is cleared through TRANSFER_DST_OPTIMAL below; // the other levels can use the common initialization barrier. for (int l = flowFinest_; l < kLevels - 1; ++l) addInitBarrier(flowLvl_[l].image); @@ -446,7 +449,6 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur bar(flowLvl_[l]); } - const bool frEngaged = (cfg_.frMode != 2) && (cfg_.frIters > 0); if (frEngaged) { const int F = flowFinest_; const VkExtent2D fe = levelExtent(extent_, F); From 0c7bd64b488f4eda0da6314c985b33c9ee90bbc3 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:34:47 -0400 Subject: [PATCH 023/120] Fix batched image barrier arguments --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 7b43a2d7cf..2e4ab5ffa7 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -398,7 +398,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur if (!initBarriers.empty()) { dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, - static_cast(initBarriers.size()), initBarriers.data(), 0, nullptr); + 0, nullptr, static_cast(initBarriers.size()), initBarriers.data()); } { VkClearColorValue zero{}; From fabbe8137dd97aea27b764ba81325356e2fadf7d Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:40:08 -0400 Subject: [PATCH 024/120] Reserve capacity for image initialization barriers --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 2e4ab5ffa7..da7caff9e1 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -372,6 +372,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur if (!reuseFlow) { // Batch fresh-image transitions that share the same stage and access masks. std::vector initBarriers; + initBarriers.reserve(static_cast(4 * kLevels + 1)); auto addInitBarrier = [&](VkImage image) { VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; From 4352645f3c98bd62bac3fda337893f74be48e620 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:19:13 -0400 Subject: [PATCH 025/120] Batch equivalent compute image barriers --- .../main/cpp/framegen/ddfg/record_impl.inc | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index da7caff9e1..411da044f8 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -367,6 +367,24 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur dd_->CmdDispatch(cmd, (e.width + 15) / 16, (e.height + 15) / 16, 1); }; auto bar = [&](FrameGen::Img& i){ barrier(cmd, i.image, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL); }; + auto barPair = [&](FrameGen::Img& a, FrameGen::Img& b) { + VkImageMemoryBarrier barriers[2]{}; + FrameGen::Img* images[] = {&a, &b}; + for (uint32_t i = 0; i < 2; ++i) { + barriers[i].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[i].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + barriers[i].dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; + barriers[i].oldLayout = VK_IMAGE_LAYOUT_GENERAL; + barriers[i].newLayout = VK_IMAGE_LAYOUT_GENERAL; + barriers[i].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[i].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[i].image = images[i]->image; + barriers[i].subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; + } + dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, + 0, nullptr, 2, barriers); + }; const bool frEngaged = (cfg_.frMode != 2) && (cfg_.frIters > 0); if (!reuseFlow) { @@ -426,11 +444,11 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur disp(pLuma_, g_scratch.sLumaCurr, levelExtent(extent_, 0)); disp(pLuma_, g_scratch.sLumaPrev, levelExtent(extent_, 0)); - bar(pyrA_[0]); bar(pyrB_[0]); + barPair(pyrA_[0], pyrB_[0]); for (int l = 1; l < kLevels; ++l) { disp(pDown_, g_scratch.sDownA[l - 1], levelExtent(extent_, l)); disp(pDown_, g_scratch.sDownB[l - 1], levelExtent(extent_, l)); - bar(pyrA_[l]); bar(pyrB_[l]); + barPair(pyrA_[l], pyrB_[l]); } if (gmBuffersReady_ && g_scratch.sGmReduce[gmSlot]) { dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.pipeline); @@ -497,7 +515,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur } disp(expandP, g_scratch.sExpand[gmSlot], levelExtent(extent_, 0)); - bar(flowExpA_); bar(flowExpB_); + barPair(flowExpA_, flowExpB_); g_scratch.flowReady = true; } disp(pSynth_, synthSet, levelExtent(extent_, 0)); From 300ed8061ffbbf0e98659c8dd8e2b1f277d06fb7 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:25:58 -0400 Subject: [PATCH 026/120] Skip unused global motion reduction sums --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 411da044f8..1d53c50328 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -229,10 +229,10 @@ bool FrameGen::updateGlobalMotion(uint32_t gmSlot, VkExtent2D fullExtent) { bool good = false; if (gmSlotValid_[gmSlot]) { const float* pt = (const float*)gmSsboPtr_[gmSlot]; - double sums[32]; for (int k = 0; k < 32; ++k) sums[k] = 0.0; + double sums[28]{}; for (int t = 0; t < kGmThreads; ++t) { const float* row = pt + (size_t)t * kGmStride; - for (int k = 0; k < kGmStride; ++k) sums[k] += (double)row[k]; + for (int k = 0; k < 28; ++k) sums[k] += (double)row[k]; } double coverage = sums[27]; double lvlpx = double((fullExtent.width >> kGmLevel) * (fullExtent.height >> kGmLevel)); From c1e27b409200ee73075288532013028266cc0caa Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:31:32 -0400 Subject: [PATCH 027/120] Include array for fixed barrier storage --- app/src/main/cpp/framegen/ddfg/framegen.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index 1c82795954..b87ba7fa52 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -3,6 +3,7 @@ #include "log.hpp" #include #include +#include namespace ddfg { From 39ce344c9b5df62c00e4b3bae9af37b897146415 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:31:34 -0400 Subject: [PATCH 028/120] Use fixed storage for image initialization barriers --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 1d53c50328..7db0037ab6 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -389,8 +389,8 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur if (!reuseFlow) { // Batch fresh-image transitions that share the same stage and access masks. - std::vector initBarriers; - initBarriers.reserve(static_cast(4 * kLevels + 1)); + std::array initBarriers{}; + size_t initBarrierCount = 0; auto addInitBarrier = [&](VkImage image) { VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; @@ -400,7 +400,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur b.image = image; b.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - initBarriers.push_back(b); + initBarriers[initBarrierCount++] = b; }; for (auto& i : pyrA_) addInitBarrier(i.image); for (auto& i : pyrB_) addInitBarrier(i.image); @@ -414,10 +414,10 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur // The final flow level is cleared through TRANSFER_DST_OPTIMAL below; // the other levels can use the common initialization barrier. for (int l = flowFinest_; l < kLevels - 1; ++l) addInitBarrier(flowLvl_[l].image); - if (!initBarriers.empty()) { + if (initBarrierCount != 0) { dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, - 0, nullptr, static_cast(initBarriers.size()), initBarriers.data()); + 0, nullptr, static_cast(initBarrierCount), initBarriers.data()); } { VkClearColorValue zero{}; From 0fb426ac458b3c85bd4d4be4ab38b0b4927c5e26 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:39:08 -0400 Subject: [PATCH 029/120] Cover prior compute and transfer work in init barriers --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 7db0037ab6..609fe5e04c 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -415,7 +415,8 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur // the other levels can use the common initialization barrier. for (int l = flowFinest_; l < kLevels - 1; ++l) addInitBarrier(flowLvl_[l].image); if (initBarrierCount != 0) { - dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + dd_->CmdPipelineBarrier(cmd, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, static_cast(initBarrierCount), initBarriers.data()); } @@ -430,7 +431,8 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur b.image = flowLvl_[kLevels - 1].image; b.subresourceRange = rng; b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + dd_->CmdPipelineBarrier(cmd, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); dd_->CmdClearColorImage(cmd, flowLvl_[kLevels - 1].image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &zero, 1, &rng); From 734a2679efeb4bddc985a7b747a28d0a05bbd475 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:40:58 -0400 Subject: [PATCH 030/120] Guard global scratch against cross-device reuse --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 609fe5e04c..e39af35c3a 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -1,6 +1,7 @@ namespace { struct ScratchState { + VkDevice ownerDevice = VK_NULL_HANDLE; VkBuffer synthUbo[ddfg::FrameGen::kSynthSlots]{}; VkDeviceMemory synthUboMem[ddfg::FrameGen::kSynthSlots]{}; void* synthUboPtr[ddfg::FrameGen::kSynthSlots]{}; @@ -157,6 +158,7 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, int kLevels, const Config& cfg, uint64_t imageGeneration); static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorPool pool) { + if (g_scratch.built && g_scratch.ownerDevice != dev) return; auto freeUbo = [&](VkBuffer& b, VkDeviceMemory& m, void*& p) { if (m) dd->UnmapMemory(dev, m); if (b) dd->DestroyBuffer(dev, b, nullptr); @@ -301,12 +303,14 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur } destroyScratch(dd_, device_, descPool_); } - ensureScratch(this, dd_, device_, memProps_, descPool_, linear_, extent_, - pyrA_, pyrB_, pyrAs_, flowLvl_, flowExpA_, flowExpB_, - pLuma_, pDown_, flowP, expandP, pSynth_, pGmReduce_, pGmPrewarp_, - pFlowReg_, flowRegA_, flowRegB_, gmSsbo_, kLevels, cfg_, imageGeneration_); + if (!ensureScratch(this, dd_, device_, memProps_, descPool_, linear_, extent_, + pyrA_, pyrB_, pyrAs_, flowLvl_, flowExpA_, flowExpB_, + pLuma_, pDown_, flowP, expandP, pSynth_, pGmReduce_, pGmPrewarp_, + pFlowReg_, flowRegA_, flowRegB_, gmSsbo_, kLevels, cfg_, imageGeneration_)) + return; } + if (g_scratch.ownerDevice != device_) return; if (reuseFlow && !g_scratch.flowReady) return; if (!reuseFlow) { bool gmEngaged = updateGlobalMotion(gmSlot, extent_); @@ -536,6 +540,7 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo, int kLevels, const Config& cfg, uint64_t imageGeneration) { auto& S = g_scratch; + if (S.built && S.ownerDevice != dev) return false; S = ScratchState{}; const auto GEN = VK_IMAGE_LAYOUT_GENERAL; @@ -637,7 +642,7 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, wImg(dd, dev, S.sSynth[s], 35, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, expB.view, samp, GEN); } - S.builtFor = ext; S.builtGeneration = imageGeneration; S.built = true; + S.builtFor = ext; S.builtGeneration = imageGeneration; S.ownerDevice = dev; S.built = true; return true; } From f337d284e8653c5c089b89eb5e50d3b02811914a Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:41:06 -0400 Subject: [PATCH 031/120] Guard FrameGen teardown and resize on idle failure --- app/src/main/cpp/framegen/ddfg/framegen.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index b87ba7fa52..46e7922855 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -169,6 +169,13 @@ bool FrameGen::onResize(VkExtent2D extent, VkFormat , bool force) { if (!force && ready_ && extent.width == extent_.width && extent.height == extent_.height) return true; + if (ready_) { + const VkResult idleResult = dd_->DeviceWaitIdle(device_); + if (idleResult != VK_SUCCESS) { + DDFG_LOGE("framegen resize: DeviceWaitIdle failed (%d); keeping existing images", (int)idleResult); + return false; + } + } ++imageGeneration_; for (auto& i : pyrA_) destroyImage(i); pyrA_.clear(); for (auto& i : pyrB_) destroyImage(i); pyrB_.clear(); @@ -230,8 +237,10 @@ void FrameGen::initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout t void FrameGen::destroy() { if (!device_) return; const VkResult idleResult = dd_->DeviceWaitIdle(device_); - if (idleResult != VK_SUCCESS) - DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); continuing teardown", (int)idleResult); + if (idleResult != VK_SUCCESS) { + DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); preserving resources for safe retry", (int)idleResult); + return; + } destroyScratchResources(); for (auto& i : pyrA_) destroyImage(i); pyrA_.clear(); for (auto& i : pyrB_) destroyImage(i); pyrB_.clear(); From 62926245a03dccf82b23a8575074a6d96126fd0d Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:41:11 -0400 Subject: [PATCH 032/120] Track device ownership for partial scratch builds --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index e39af35c3a..510deba43a 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -158,7 +158,7 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, int kLevels, const Config& cfg, uint64_t imageGeneration); static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorPool pool) { - if (g_scratch.built && g_scratch.ownerDevice != dev) return; + if (g_scratch.ownerDevice != VK_NULL_HANDLE && g_scratch.ownerDevice != dev) return; auto freeUbo = [&](VkBuffer& b, VkDeviceMemory& m, void*& p) { if (m) dd->UnmapMemory(dev, m); if (b) dd->DestroyBuffer(dev, b, nullptr); @@ -540,8 +540,9 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo, int kLevels, const Config& cfg, uint64_t imageGeneration) { auto& S = g_scratch; - if (S.built && S.ownerDevice != dev) return false; + if (S.ownerDevice != VK_NULL_HANDLE && S.ownerDevice != dev) return false; S = ScratchState{}; + S.ownerDevice = dev; const auto GEN = VK_IMAGE_LAYOUT_GENERAL; for (int s = 0; s < FrameGen::kSynthSlots; ++s) From 31503e610bf426d348a5a40b44eae23dafe09cf0 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:19:32 -0400 Subject: [PATCH 033/120] Fix transactional FrameGen reconfiguration --- .../main/cpp/framegen/ddfg/record_impl.inc | 61 ++++++++++++------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 510deba43a..3de7e4ff65 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -157,7 +157,8 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo, int kLevels, const Config& cfg, uint64_t imageGeneration); -static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorPool pool) { +static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorPool pool, + bool resetPool = true) { if (g_scratch.ownerDevice != VK_NULL_HANDLE && g_scratch.ownerDevice != dev) return; auto freeUbo = [&](VkBuffer& b, VkDeviceMemory& m, void*& p) { if (m) dd->UnmapMemory(dev, m); @@ -171,7 +172,7 @@ static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorP freeUbo(S.flowRegUbo, S.flowRegUboMem, S.flowRegUboPtr); for (size_t i = 0; i < S.flowUbo.size(); ++i) freeUbo(S.flowUbo[i], S.flowUboMem[i], S.flowUboPtr[i]); for (int s = 0; s < FrameGen::kGmSlots; ++s) freeUbo(S.gmUbo[s], S.gmUboMem[s], S.gmUboPtr[s]); - if (pool && dd->ResetDescriptorPool) dd->ResetDescriptorPool(dev, pool, 0); + if (resetPool && pool && dd->ResetDescriptorPool) dd->ResetDescriptorPool(dev, pool, 0); S = ScratchState{}; } @@ -180,40 +181,58 @@ void FrameGen::destroyScratchResources() { } void FrameGen::configure(const Config& c) { - cfg_ = c; cfg_.sanitize(); - int want = flowFinestForPreset(cfg_.perfPreset); + Config nextCfg = c; + nextCfg.sanitize(); + int want = flowFinestForPreset(nextCfg.perfPreset); const int maxFinest = kLevels - 2; if (want > maxFinest) { DDFG_LOGE("perf-preset=%d wants kFlowFinest=%d but only %d pyramid levels exist " - "(need >=2 solved) - clamping to %d", cfg_.perfPreset, want, kLevels, maxFinest); + "(need >=2 solved) - clamping to %d", nextCfg.perfPreset, want, kLevels, maxFinest); want = maxFinest; } if (want < 1) want = 1; const int prevFinest = flowFinest_; - flowFinest_ = want; - const bool live = (flowFinest_ != prevFinest) && ready_; + const bool live = (want != prevFinest) && ready_; DDFG_LOGI("perf-preset=%d -> kFlowFinest=%d (was %d) live-rebuild=%d ready=%d", - cfg_.perfPreset, flowFinest_, prevFinest, live ? 1 : 0, ready_ ? 1 : 0); + nextCfg.perfPreset, want, prevFinest, live ? 1 : 0, ready_ ? 1 : 0); - if (!live) return; - - - - - const VkResult idleResult = dd_->DeviceWaitIdle(device_); - if (idleResult != VK_SUCCESS) { - DDFG_LOGE("framegen configure: DeviceWaitIdle failed (%d); disabling FrameGen live rebuild", (int)idleResult); - ready_ = false; + if (!live) { + cfg_ = nextCfg; + flowFinest_ = want; return; } + + // Keep the previous configuration and image set if the device cannot idle. + const VkResult idleResult = dd_->DeviceWaitIdle(device_); + if (idleResult != VK_SUCCESS) { + DDFG_LOGE("framegen configure: DeviceWaitIdle failed (%d); keeping previous configuration and images", + (int)idleResult); + return; + } + + // The device is already idle. Prevent onResize from issuing a second wait + // and from exposing old images with the new flow level if rebuilding fails. destroyScratch(dd_, device_, descPool_); - if (!onResize(extent_, VK_FORMAT_UNDEFINED, true)) + cfg_ = nextCfg; + flowFinest_ = want; + ready_ = false; + if (!onResize(extent_, VK_FORMAT_UNDEFINED, true)) { + ready_ = false; DDFG_LOGE("perf-preset live rebuild: onResize FAILED at %ux%u - FG disabled until next resize", - extent_.width, extent_.height); + extent_.width, extent_.height); + return; + } + for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0; - for (int s = 0; s < kGmSlots; ++s) { gmSlotValid_[s] = false; for (int i = 0; i < 6; ++i) gmLinAt_[s][i] = 0.0; } - gmHaveEst_ = false; gmEngaged_ = false; gmStableCount_ = 0; gmLastTransPx_ = 0.0f; + for (int s = 0; s < kGmSlots; ++s) { + gmSlotValid_[s] = false; + for (int i = 0; i < 6; ++i) gmLinAt_[s][i] = 0.0; + } + gmHaveEst_ = false; + gmEngaged_ = false; + gmStableCount_ = 0; + gmLastTransPx_ = 0.0f; DDFG_LOGI("perf-preset live rebuild DONE (kFlowFinest=%d, flow predictor reset)", flowFinest_); } From 08b4d9121de8756efc2b8819182ceebb9dbc62aa Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:19:37 -0400 Subject: [PATCH 034/120] Clean up FrameGen resources after device loss --- app/src/main/cpp/framegen/ddfg/framegen.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index 46e7922855..95425a44e9 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -237,11 +237,18 @@ void FrameGen::initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout t void FrameGen::destroy() { if (!device_) return; const VkResult idleResult = dd_->DeviceWaitIdle(device_); - if (idleResult != VK_SUCCESS) { + if (idleResult != VK_SUCCESS && idleResult != VK_ERROR_DEVICE_LOST) { DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); preserving resources for safe retry", (int)idleResult); return; } - destroyScratchResources(); + if (idleResult == VK_ERROR_DEVICE_LOST) { + // A lost device cannot become idle again. Still explicitly destroy its + // child objects; skip descriptor-pool reset and release scratch ownership. + DDFG_LOGE("framegen destroy: device lost; releasing owned resources without waiting"); + destroyScratch(dd_, device_, descPool_, false); + } else { + destroyScratchResources(); + } for (auto& i : pyrA_) destroyImage(i); pyrA_.clear(); for (auto& i : pyrB_) destroyImage(i); pyrB_.clear(); for (auto& i : pyrAs_) destroyImage(i); pyrAs_.clear(); From 4c977a0c9c2d6a496e20c827ee661a253f96f3f9 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:19:44 -0400 Subject: [PATCH 035/120] Allow safe scratch teardown on device loss --- app/src/main/cpp/framegen/ddfg/framegen.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.hpp b/app/src/main/cpp/framegen/ddfg/framegen.hpp index 7dc8310bf9..d40518dd1d 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.hpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.hpp @@ -64,7 +64,7 @@ private: void destroyPipe(Pipe& p); void barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkImageLayout to); void initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout to); - void destroyScratchResources(); + void destroyScratchResources(bool resetPool = true); const DeviceDispatch* dd_ = nullptr; const InstanceDispatch* id_ = nullptr; From 995aea5740bf8b3862aa3577c54a5848a4e0b2b5 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:19:46 -0400 Subject: [PATCH 036/120] Allow safe scratch teardown on device loss --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 3de7e4ff65..5740edd325 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -176,8 +176,8 @@ static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorP S = ScratchState{}; } -void FrameGen::destroyScratchResources() { - destroyScratch(dd_, device_, descPool_); +void FrameGen::destroyScratchResources(bool resetPool) { + destroyScratch(dd_, device_, descPool_, resetPool); } void FrameGen::configure(const Config& c) { From 992f251a6bb501741bb652ac9029a0934f043dad Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:19:50 -0400 Subject: [PATCH 037/120] Route device-loss cleanup through FrameGen helper --- app/src/main/cpp/framegen/ddfg/framegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index 95425a44e9..330f83a7cf 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -245,7 +245,7 @@ void FrameGen::destroy() { // A lost device cannot become idle again. Still explicitly destroy its // child objects; skip descriptor-pool reset and release scratch ownership. DDFG_LOGE("framegen destroy: device lost; releasing owned resources without waiting"); - destroyScratch(dd_, device_, descPool_, false); + destroyScratchResources(false); } else { destroyScratchResources(); } From 00264207edc06b10fd13246b7ff1f4a9870196f2 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:48:24 -0400 Subject: [PATCH 038/120] Reset global motion before FrameGen resize rebuild --- .../main/cpp/framegen/ddfg/record_impl.inc | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 5740edd325..1d9e71df8c 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -211,8 +211,19 @@ void FrameGen::configure(const Config& c) { return; } - // The device is already idle. Prevent onResize from issuing a second wait - // and from exposing old images with the new flow level if rebuilding fails. + // The device is idle, so reset motion history before rebuilding. This + // also leaves the predictor reset if onResize fails. + for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0; + for (int s = 0; s < kGmSlots; ++s) { + gmSlotValid_[s] = false; + for (int i = 0; i < 6; ++i) gmLinAt_[s][i] = 0.0; + } + gmHaveEst_ = false; + gmEngaged_ = false; + gmStableCount_ = 0; + gmLastTransPx_ = 0.0f; + + // Prevent onResize from issuing a second wait. destroyScratch(dd_, device_, descPool_); cfg_ = nextCfg; flowFinest_ = want; @@ -223,16 +234,6 @@ void FrameGen::configure(const Config& c) { extent_.width, extent_.height); return; } - - for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0; - for (int s = 0; s < kGmSlots; ++s) { - gmSlotValid_[s] = false; - for (int i = 0; i < 6; ++i) gmLinAt_[s][i] = 0.0; - } - gmHaveEst_ = false; - gmEngaged_ = false; - gmStableCount_ = 0; - gmLastTransPx_ = 0.0f; DDFG_LOGI("perf-preset live rebuild DONE (kFlowFinest=%d, flow predictor reset)", flowFinest_); } From 9a7a469ed67d6b2fcc769d25776053ff214520b0 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:18:24 -0400 Subject: [PATCH 039/120] Fix present semaphore reuse per swapchain image --- app/src/main/cpp/waylandcomp/src/vk_present.c | 76 ++++++++++++++++--- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.c b/app/src/main/cpp/waylandcomp/src/vk_present.c index 61b2765c5b..a7fc7cbe19 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.c +++ b/app/src/main/cpp/waylandcomp/src/vk_present.c @@ -105,7 +105,10 @@ static uint32_t g_qfam; static VkCommandPool g_pool; #define MAX_PRESENTS (1 + VKP_FG_MAX_GENERATIONS) static VkCommandBuffer g_cmds[MAX_PRESENTS]; -static VkSemaphore g_acqs[MAX_PRESENTS], g_rnds[MAX_PRESENTS]; +static VkSemaphore g_acqs[MAX_PRESENTS]; +/* Present-wait semaphores belong to swapchain images, not frame slots. */ +static VkSemaphore *g_rnds; +static uint32_t g_rnd_count; static VkFence g_fence; static int g_swap_extra; #define SCENE_FMT VK_FORMAT_R8G8B8A8_UNORM @@ -264,12 +267,44 @@ static void reset_sync(void) { VkSemaphoreCreateInfo semci = {.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO}; for (int k = 0; k < MAX_PRESENTS; k++) { if (g_acqs[k]) g_vk.DestroySemaphore(g_dev, g_acqs[k], NULL); - if (g_rnds[k]) g_vk.DestroySemaphore(g_dev, g_rnds[k], NULL); - g_vk.CreateSemaphore(g_dev, &semci, NULL, &g_acqs[k]); - g_vk.CreateSemaphore(g_dev, &semci, NULL, &g_rnds[k]); + g_acqs[k] = VK_NULL_HANDLE; + if (g_vk.CreateSemaphore(g_dev, &semci, NULL, &g_acqs[k]) != VK_SUCCESS) + droiddeck_log("error", "present: failed to recreate acquire semaphore %d", k); } } +static void destroy_present_semaphores(void) { + if (g_dev && g_vk.DestroySemaphore) { + for (uint32_t i = 0; i < g_rnd_count; i++) + if (g_rnds[i]) g_vk.DestroySemaphore(g_dev, g_rnds[i], NULL); + } + free(g_rnds); + g_rnds = NULL; + g_rnd_count = 0; +} + +static int create_present_semaphores(void) { + if (!g_nimg) return -1; + VkSemaphore *sems = calloc(g_nimg, sizeof(*sems)); + if (!sems) return -1; + VkSemaphoreCreateInfo semci = {.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO}; + for (uint32_t i = 0; i < g_nimg; i++) { + VkResult r = g_vk.CreateSemaphore(g_dev, &semci, NULL, &sems[i]); + if (r != VK_SUCCESS) { + droiddeck_log("error", "present: failed to create image semaphore %u (%s)", + i, vk_result_name(r)); + for (uint32_t j = 0; j < i; j++) + if (sems[j]) g_vk.DestroySemaphore(g_dev, sems[j], NULL); + free(sems); + return -1; + } + } + destroy_present_semaphores(); + g_rnds = sems; + g_rnd_count = g_nimg; + return 0; +} + static void destroy_swapchain(void) { g_base_black = 0; if (g_dev_state != 1) return; @@ -279,10 +314,12 @@ static void destroy_swapchain(void) { else quarantine_pending_work(idle, "swapchain idle"); return; } - reset_sync(); for (uint32_t i = 0; i < g_nimg; i++) blendp_forget_image(g_images[i]); if (g_swapchain) g_vk.DestroySwapchainKHR(g_dev, g_swapchain, NULL); g_swapchain = VK_NULL_HANDLE; + /* Keep image semaphores alive until after their swapchain is destroyed. */ + destroy_present_semaphores(); + reset_sync(); g_swap_md_identity = 0; if (g_surface) g_vk.DestroySurfaceKHR(g_inst, g_surface, NULL); g_surface = VK_NULL_HANDLE; @@ -925,9 +962,22 @@ static int swap_init_locked(void) { SWLOGE("present: vkCreateSwapchainKHR failed (%d)", (int)cr); return -1; } - g_vk.GetSwapchainImagesKHR(g_dev, g_swapchain, &g_nimg, NULL); + cr = g_vk.GetSwapchainImagesKHR(g_dev, g_swapchain, &g_nimg, NULL); + if (cr != VK_SUCCESS || !g_nimg) { + SWLOGE("present: vkGetSwapchainImagesKHR count failed (%s)", vk_result_name(cr)); + return -1; + } g_images = calloc(g_nimg, sizeof(VkImage)); - g_vk.GetSwapchainImagesKHR(g_dev, g_swapchain, &g_nimg, g_images); + if (!g_images) { + SWLOGE("present: failed to allocate swapchain image list"); + return -1; + } + cr = g_vk.GetSwapchainImagesKHR(g_dev, g_swapchain, &g_nimg, g_images); + if (cr != VK_SUCCESS || create_present_semaphores() != 0) { + SWLOGE("present: failed to initialize per-image present semaphores (%s)", + vk_result_name(cr)); + return -1; + } droiddeck_log("gpu", "screen output %ux%u, %u buffers, vsync%s", g_extent.width, g_extent.height, g_nimg, g_swap_extra ? " (frame generation: several presents per frame)" : ""); @@ -2397,9 +2447,17 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i } const int last = (k + 1 == presents); VkPipelineStageFlags wait = VK_PIPELINE_STAGE_TRANSFER_BIT; + /* A present-wait semaphore is reused only after this exact swapchain image + * has been acquired again; a frame-slot fence cannot prove present completion. */ + if (img >= g_rnd_count || !g_rnds[img]) { + droiddeck_log("error", "present: image index %u exceeds semaphore count %u", + img, g_rnd_count); + destroy_swapchain(); + return -1; + } VkSubmitInfo si = {.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, .waitSemaphoreCount = 1, .pWaitSemaphores = &g_acqs[k], .pWaitDstStageMask = &wait, .commandBufferCount = 1, - .pCommandBuffers = &g_cmds[k], .signalSemaphoreCount = 1, .pSignalSemaphores = &g_rnds[k]}; + .pCommandBuffers = &g_cmds[k], .signalSemaphoreCount = 1, .pSignalSemaphores = &g_rnds[img]}; VkResult qr = g_vk.QueueSubmit(g_queue, 1, &si, last ? g_fence : VK_NULL_HANDLE); if (qr != VK_SUCCESS) { if (qr == VK_ERROR_DEVICE_LOST) device_lost("submit"); @@ -2409,7 +2467,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i } fence_submitted = last; VkPresentInfoKHR pi = {.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, .waitSemaphoreCount = 1, - .pWaitSemaphores = &g_rnds[k], .swapchainCount = 1, + .pWaitSemaphores = &g_rnds[img], .swapchainCount = 1, .pSwapchains = &g_swapchain, .pImageIndices = &img}; const int64_t t_pres = perf_now(); pr = g_vk.QueuePresentKHR(g_queue, &pi); From b9cc1c80af7b65ec4bbb55e056bf5b6864e94afa Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:18:34 -0400 Subject: [PATCH 040/120] Handle swapchain image setup failures --- app/src/main/cpp/waylandcomp/src/vk_present.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.c b/app/src/main/cpp/waylandcomp/src/vk_present.c index a7fc7cbe19..1aaae9d0db 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.c +++ b/app/src/main/cpp/waylandcomp/src/vk_present.c @@ -965,17 +965,25 @@ static int swap_init_locked(void) { cr = g_vk.GetSwapchainImagesKHR(g_dev, g_swapchain, &g_nimg, NULL); if (cr != VK_SUCCESS || !g_nimg) { SWLOGE("present: vkGetSwapchainImagesKHR count failed (%s)", vk_result_name(cr)); + g_nimg = 0; return -1; } g_images = calloc(g_nimg, sizeof(VkImage)); if (!g_images) { SWLOGE("present: failed to allocate swapchain image list"); + g_nimg = 0; return -1; } cr = g_vk.GetSwapchainImagesKHR(g_dev, g_swapchain, &g_nimg, g_images); - if (cr != VK_SUCCESS || create_present_semaphores() != 0) { - SWLOGE("present: failed to initialize per-image present semaphores (%s)", - vk_result_name(cr)); + if (cr != VK_SUCCESS) { + SWLOGE("present: vkGetSwapchainImagesKHR failed (%s)", vk_result_name(cr)); + free(g_images); + g_images = NULL; + g_nimg = 0; + return -1; + } + if (create_present_semaphores() != 0) { + SWLOGE("present: failed to initialize per-image present semaphores"); return -1; } From e0a20311d5ea7a061c0f8f2988d6ccb592d94980 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:18:51 -0400 Subject: [PATCH 041/120] Log per-image present semaphore setup --- app/src/main/cpp/waylandcomp/src/vk_present.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.c b/app/src/main/cpp/waylandcomp/src/vk_present.c index 1aaae9d0db..2278f10b5f 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.c +++ b/app/src/main/cpp/waylandcomp/src/vk_present.c @@ -989,6 +989,8 @@ static int swap_init_locked(void) { droiddeck_log("gpu", "screen output %ux%u, %u buffers, vsync%s", g_extent.width, g_extent.height, g_nimg, g_swap_extra ? " (frame generation: several presents per frame)" : ""); + droiddeck_log("gpu", "present synchronization: %u render-finished semaphores, one per swapchain image", + g_rnd_count); return 0; } From e20dd00d2940a13b6a2d01f5e437b95f5a18b9e6 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:21:19 -0400 Subject: [PATCH 042/120] Remove two comments from vk_present.c --- app/src/main/cpp/waylandcomp/src/vk_present.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.c b/app/src/main/cpp/waylandcomp/src/vk_present.c index 2278f10b5f..4dfc8c56e9 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.c +++ b/app/src/main/cpp/waylandcomp/src/vk_present.c @@ -106,7 +106,6 @@ static VkCommandPool g_pool; #define MAX_PRESENTS (1 + VKP_FG_MAX_GENERATIONS) static VkCommandBuffer g_cmds[MAX_PRESENTS]; static VkSemaphore g_acqs[MAX_PRESENTS]; -/* Present-wait semaphores belong to swapchain images, not frame slots. */ static VkSemaphore *g_rnds; static uint32_t g_rnd_count; static VkFence g_fence; @@ -317,7 +316,6 @@ static void destroy_swapchain(void) { for (uint32_t i = 0; i < g_nimg; i++) blendp_forget_image(g_images[i]); if (g_swapchain) g_vk.DestroySwapchainKHR(g_dev, g_swapchain, NULL); g_swapchain = VK_NULL_HANDLE; - /* Keep image semaphores alive until after their swapchain is destroyed. */ destroy_present_semaphores(); reset_sync(); g_swap_md_identity = 0; From f3e8ce8de0c10b18a610d1f41c7bc4222160ac51 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:42:36 -0400 Subject: [PATCH 043/120] Fix Vulkan caller test semaphore fixture --- tools/tests/vk_terminal_callers_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/tests/vk_terminal_callers_test.c b/tools/tests/vk_terminal_callers_test.c index 004e7e9da8..bbc24b463e 100644 --- a/tools/tests/vk_terminal_callers_test.c +++ b/tools/tests/vk_terminal_callers_test.c @@ -169,6 +169,8 @@ static void setup(int extra) { g_surface_checked_ns = INT64_MAX; /* no simulated geometry change */ g_scene.img = (VkImage)(uintptr_t)5; g_scene.mem = (VkDeviceMemory)(uintptr_t)6; g_scene.w = g_scene.h = 64; + g_rnds = calloc(MAX_PRESENTS, sizeof(*g_rnds)); assert(g_rnds); + g_rnd_count = MAX_PRESENTS; for (int k = 0; k < MAX_PRESENTS; ++k) { g_cmds[k] = (VkCommandBuffer)(uintptr_t)(10 + k); g_acqs[k] = (VkSemaphore)(uintptr_t)(20 + k); From 22ff7377eaae7d8923a6041ca7c4b918d3671f6d Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:52:53 -0400 Subject: [PATCH 044/120] Fix effects resolution harness semaphore count --- tools/tests/test_effects_source_resolution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tests/test_effects_source_resolution.py b/tools/tests/test_effects_source_resolution.py index 4bbe7bb56b..a55a89fdb9 100644 --- a/tools/tests/test_effects_source_resolution.py +++ b/tools/tests/test_effects_source_resolution.py @@ -196,7 +196,7 @@ static int g_dev_state = 1, g_window = 1, g_swapchain, g_swap_extra; static int g_colorspace_ext, g_swap_hdr_unavailable, g_swap_is_hdr, g_swap_hdr_want; static int g_plain_frame, g_first_frame_done, g_base_black; static int g_qfam, g_queue, g_dev, g_fence, g_swap_fmt = SCENE_FMT; -static int g_cmds[3], g_acqs[3], g_rnds[3], images[1] = {2}, *g_images = images; +static int g_cmds[3], g_acqs[3], g_rnds[3], g_rnd_count = 3, images[1] = {2}, *g_images = images; static uint32_t g_swap_md_identity; static VkExtent2D g_extent = {1920, 1080}; static struct { float kx, ky, off_x, off_y; int rx, ry, rw, rh; } g_map; From f632f2b577903ef2e8be714479cb8ca9279a1fb8 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:52:55 -0400 Subject: [PATCH 045/120] Stub semaphore cleanup in swapchain idle test --- tools/tests/test_vk_pending_completion.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/tests/test_vk_pending_completion.py b/tools/tests/test_vk_pending_completion.py index 8f3dc48eb0..604a2a9648 100644 --- a/tools/tests/test_vk_pending_completion.py +++ b/tools/tests/test_vk_pending_completion.py @@ -134,6 +134,8 @@ static struct { void (*DestroySurfaceKHR)(uintptr_t, uintptr_t, void *); } g_vk={idle_fn, destroy_fn, destroy_fn}; static void reset_sync(void) { ++resets; } +/* The swapchain test isolates idle-failure behavior; semaphore cleanup is tested separately. */ +static void destroy_present_semaphores(void) {} static void blendp_forget_image(uintptr_t img) { (void)img; ++forgotten; } static void device_lost(const char *where) { (void)where; ++lost; g_dev_state=-2; } /* PRODUCTION_FUNCTIONS */ From 0c9b1132906dba55b375cb0b0499c3934014bdb3 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 17:01:19 -0400 Subject: [PATCH 046/120] Fix fake present semaphore handles in effects test --- tools/tests/test_effects_source_resolution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tests/test_effects_source_resolution.py b/tools/tests/test_effects_source_resolution.py index a55a89fdb9..ba840c7fe7 100644 --- a/tools/tests/test_effects_source_resolution.py +++ b/tools/tests/test_effects_source_resolution.py @@ -196,7 +196,7 @@ static int g_dev_state = 1, g_window = 1, g_swapchain, g_swap_extra; static int g_colorspace_ext, g_swap_hdr_unavailable, g_swap_is_hdr, g_swap_hdr_want; static int g_plain_frame, g_first_frame_done, g_base_black; static int g_qfam, g_queue, g_dev, g_fence, g_swap_fmt = SCENE_FMT; -static int g_cmds[3], g_acqs[3], g_rnds[3], g_rnd_count = 3, images[1] = {2}, *g_images = images; +static int g_cmds[3], g_acqs[3], g_rnds[3] = {11, 12, 13}, g_rnd_count = 3, images[1] = {2}, *g_images = images; static uint32_t g_swap_md_identity; static VkExtent2D g_extent = {1920, 1080}; static struct { float kx, ky, off_x, off_y; int rx, ry, rw, rh; } g_map; From 5d276ab461e7fea921b4e7beb03627dbd8bfd920 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sat, 28 Nov 2026 16:09:17 -0500 Subject: [PATCH 047/120] fix(gamescope): direct touch keeps the pointer under the first finger (#3382) * fix(gamescope): only the first finger drives the emulated mouse In the click touch modes every finger warped the X pointer and any finger lifting released the click, so a second finger made the pointer jump between both contacts and dropped whatever the first was dragging. The first finger of a gesture now owns the emulated mouse until it lifts, and later fingers are ignored until every finger is up. * fix(gamescope): motion into the screen edge does not decide the pointer hold A drawn-cursor game whose X pointer sat at the screen edge looked like it held the pointer whenever motion pushed outward, which kept the hold on and turned touch drags into relative motion. The sent motion is clamped to what the pointer can reach before the comparison. * fix(gamescope): touch warps do not decide the pointer hold * fix(gamescope): only touch-down warps are left out of the pointer hold Touch drags are real pointer motion, so they count toward releasing the hold again. Only the jump a touch-down makes is skipped. --- tools/gamescope/PATCHES.md | 30 +++++ ...0143-touch-click-first-finger-drives.patch | 75 +++++++++++ ...er-hold-ignores-motion-into-the-edge.patch | 28 ++++ ...-pointer-hold-skips-touch-down-warps.patch | 73 +++++++++++ .../tests/test_gamescope_pointer_hold_edge.py | 102 +++++++++++++++ .../test_gamescope_pointer_hold_touch_down.py | 109 ++++++++++++++++ .../tests/test_gamescope_touch_click_owner.py | 121 ++++++++++++++++++ 7 files changed, 538 insertions(+) create mode 100644 tools/gamescope/patches/0143-touch-click-first-finger-drives.patch create mode 100644 tools/gamescope/patches/0144-pointer-hold-ignores-motion-into-the-edge.patch create mode 100644 tools/gamescope/patches/0145-pointer-hold-skips-touch-down-warps.patch create mode 100644 tools/tests/test_gamescope_pointer_hold_edge.py create mode 100644 tools/tests/test_gamescope_pointer_hold_touch_down.py create mode 100644 tools/tests/test_gamescope_touch_click_owner.py diff --git a/tools/gamescope/PATCHES.md b/tools/gamescope/PATCHES.md index 8ddddcca22..c416b6aea7 100644 --- a/tools/gamescope/PATCHES.md +++ b/tools/gamescope/PATCHES.md @@ -444,3 +444,33 @@ starts there as before, but no motion is sent for it. The fake pointer position With the patch, the Duo starts with only the bottom bar under the parked pointer hovered and controller focus on the first tile (4 of 4 starts), and returns from a game the same way (3 of 3). Making 0100 ignore the X server's initial pointer instead was tried and rejected: the centre motion still arrived, and the header or search bar ended up hovered. + +## 0143 wlserver: only the first finger drives the emulated mouse + +In the Hover, Left, Right, Middle and Trackpad touch click modes every finger warped the X pointer and any finger lifting +released the click. With a second finger down the pointer jumped between both fingers on every frame while the button +stayed held, so a dragged item followed whichever finger moved last, and lifting the second finger dropped it under the +first. The first finger of a gesture now owns the emulated mouse: only it moves the pointer and only its lift releases the +click. Fingers that land while it is down are ignored, and so are the others once it lifts, until every finger is up. +Touches the click modes never claimed (Passthrough, Disabled, no focused surface) still release a held click when they +lift, and the nested pointer (`bAlwaysWarpCursor`) moves the pointer as before. `tools/tests/test_gamescope_touch_click_owner.py` +compiles the rule from this patch. + +## 0144 steamcompmgr: motion into the screen edge does not decide the pointer hold + +0133 compares the motion gamescope sends with how the X pointer moves. At the edge of the X screen the pointer cannot move +further, so a drawn-cursor game whose pointer sat at an edge while touch or mouse motion pushed outward counted as +holding the pointer: the hold stayed on, every such frame restarted the 30 frames needed to release it, and touch drags +kept turning into relative motion with no button held. The sent motion is now clamped to what the pointer can reach +inside the X screen before it is compared, so motion into an edge counts as no motion. A recentring game is detected as +before, since its pointer stays away from the edges. `tools/tests/test_gamescope_pointer_hold_edge.py` compiles the rule +from this patch with the 0133 rule. + +## 0145 steamcompmgr: touch-down warps do not decide the pointer hold + +In click mode every touch-down warps the X pointer to the finger. 0133 read that jump as the pointer not following the +sent motion, so each new stroke on a drawn-cursor game restarted the 30 following frames needed to release the hold. +Short strokes never released it, and taps kept landing at the relative pointer instead of under the finger. wlserver now +counts its touch-down warps, and a frame that contains one is left out of the hold decision. Touch drags, mouse motion +and mouse warps still count, so a drag on a game that follows the pointer releases the hold and a recentring game is +still held. `tools/tests/test_gamescope_pointer_hold_touch_down.py` compiles the rule with the 0133 rule. diff --git a/tools/gamescope/patches/0143-touch-click-first-finger-drives.patch b/tools/gamescope/patches/0143-touch-click-first-finger-drives.patch new file mode 100644 index 0000000000..2eb9e66487 --- /dev/null +++ b/tools/gamescope/patches/0143-touch-click-first-finger-drives.patch @@ -0,0 +1,75 @@ +diff --git a/src/wlserver.cpp b/src/wlserver.cpp +index 9740875..cb72051 100644 +--- a/src/wlserver.cpp ++++ b/src/wlserver.cpp +@@ -3283,6 +3283,38 @@ static void apply_touchscreen_orientation(GamescopePanelOrientation orientation, + *y = ty; + } + ++struct TouchClickState ++{ ++ std::set ids; ++ int nOwner = -1; ++}; ++ ++static TouchClickState s_TouchClick; ++ ++static bool touch_click_claim( TouchClickState &state, int nTouchId ) ++{ ++ if ( state.ids.empty() ) ++ state.nOwner = nTouchId; ++ state.ids.insert( nTouchId ); ++ return state.nOwner == nTouchId; ++} ++ ++static bool touch_click_drives( const TouchClickState &state, int nTouchId ) ++{ ++ return state.nOwner == nTouchId; ++} ++ ++static bool touch_click_lift( TouchClickState &state, int nTouchId ) ++{ ++ const bool bTracked = state.ids.erase( nTouchId ) > 0; ++ if ( state.nOwner == nTouchId ) ++ { ++ state.nOwner = -1; ++ return true; ++ } ++ return !bTracked && state.nOwner < 0; ++} ++ + void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool bAlwaysWarpCursor, gamescope::IBackendConnector* connector ) + { + assert( wlserver_is_lock_held() ); +@@ -3333,9 +3365,10 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool + } + else if ( eMode == gamescope::TouchClickModes::Trackpad ) + { +- wlserver_mousemotion( trackpad_dx, trackpad_dy, time ); ++ if ( touch_click_drives( s_TouchClick, touch_id ) ) ++ wlserver_mousemotion( trackpad_dx, trackpad_dy, time ); + } +- else ++ else if ( bAlwaysWarpCursor || touch_click_drives( s_TouchClick, touch_id ) ) + { + g_bPendingTouchMovement = true; + +@@ -3389,7 +3422,7 @@ void wlserver_touchdown( double x, double y, int touch_id, uint32_t time, gamesc + { + return; + } +- else ++ else if ( touch_click_claim( s_TouchClick, touch_id ) ) + { + g_bPendingTouchMovement = true; + +@@ -3417,7 +3450,8 @@ void wlserver_touchup( int touch_id, uint32_t time ) + + // Release whatever the touch pressed even if its surface is gone, or the seat keeps the button down. + bool bReleasedAny = false; +- for ( int i = 0; i < WLSERVER_BUTTON_COUNT; i++ ) ++ const bool bClickTouch = touch_click_lift( s_TouchClick, touch_id ); ++ for ( int i = 0; bClickTouch && i < WLSERVER_BUTTON_COUNT; i++ ) + { + if ( wlserver.button_held[ i ] == true ) + { diff --git a/tools/gamescope/patches/0144-pointer-hold-ignores-motion-into-the-edge.patch b/tools/gamescope/patches/0144-pointer-hold-ignores-motion-into-the-edge.patch new file mode 100644 index 0000000000..a7db8bacd0 --- /dev/null +++ b/tools/gamescope/patches/0144-pointer-hold-ignores-motion-into-the-edge.patch @@ -0,0 +1,28 @@ +diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp +index e98d320..85af598 100644 +--- a/src/steamcompmgr.cpp ++++ b/src/steamcompmgr.cpp +@@ -3245,6 +3245,11 @@ static bool pointer_hold_step( PointerHold &state, bool bConstrained, double flS + return state.bHeld; + } + ++static double pointer_reach( int nFrom, double flDelta, int nSize ) ++{ ++ return std::clamp( nFrom + flDelta, 0.0, double( std::max( nSize - 1, 0 ) ) ) - nFrom; ++} ++ + static bool s_bPointerHeld = false; + + static void update_pointer_hold( global_focus_t *pFocus, bool bConstrained, bool bHinted ) +@@ -3311,7 +3316,10 @@ static void update_pointer_hold( global_focus_t *pFocus, bool bConstrained, bool + + if ( s_bTracking ) + { +- s_bPointerHeld = pointer_hold_step( s_Hold, true, flDX, flDY, nRootX - s_nRootX, nRootY - s_nRootY, get_time_in_nanos() ); ++ const xwayland_ctx_t *pCtx = pFocus->cursor->getCtx(); ++ const double flReachX = pointer_reach( s_nRootX, flDX, pCtx->root_width ); ++ const double flReachY = pointer_reach( s_nRootY, flDY, pCtx->root_height ); ++ s_bPointerHeld = pointer_hold_step( s_Hold, true, flReachX, flReachY, nRootX - s_nRootX, nRootY - s_nRootY, get_time_in_nanos() ); + } + else + { diff --git a/tools/gamescope/patches/0145-pointer-hold-skips-touch-down-warps.patch b/tools/gamescope/patches/0145-pointer-hold-skips-touch-down-warps.patch new file mode 100644 index 0000000000..3a71f219dd --- /dev/null +++ b/tools/gamescope/patches/0145-pointer-hold-skips-touch-down-warps.patch @@ -0,0 +1,73 @@ +diff --git a/src/wlserver.hpp b/src/wlserver.hpp +--- a/src/wlserver.hpp ++++ b/src/wlserver.hpp +@@ -173,6 +173,7 @@ + double flFollowDY = 0.0; + double flSentDX = 0.0; + double flSentDY = 0.0; ++ uint64_t ulTouchDownWarps = 0; + + bool button_held[ WLSERVER_BUTTON_COUNT ]; + std::set touch_down_ids; +diff --git a/src/wlserver.cpp b/src/wlserver.cpp +--- a/src/wlserver.cpp ++++ b/src/wlserver.cpp +@@ -3429,6 +3429,7 @@ + if ( eMode != gamescope::TouchClickModes::Trackpad ) + { + wlserver_mousewarp( tx, ty, time, false, true ); ++ wlserver.ulTouchDownWarps++; + } + + uint32_t button = TouchClickModeToLinuxButton( eMode ); +diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp +--- a/src/steamcompmgr.cpp ++++ b/src/steamcompmgr.cpp +@@ -3263,6 +3263,7 @@ + static bool s_bHinted = false; + static const steamcompmgr_win_t *s_pWindow = nullptr; + static const struct wlr_pointer_constraint_v1 *s_pConstraint = nullptr; ++ static uint64_t s_ulTouchDownWarps = 0; + + wlserver_lock(); + const double flX = wlserver.mouse_surface_cursorx; +@@ -3272,8 +3273,12 @@ + const struct wlr_pointer_constraint_v1 *pConstraint = wlserver.GetCursorConstraint(); + wlserver.flSentDX = 0.0; + wlserver.flSentDY = 0.0; ++ const uint64_t ulTouchDownWarps = wlserver.ulTouchDownWarps; + wlserver_unlock(); + ++ const bool bTouchDown = ulTouchDownWarps != s_ulTouchDownWarps; ++ s_ulTouchDownWarps = ulTouchDownWarps; ++ + if ( !bConstrained || !pFocus->cursor ) + { + s_bTracking = false; +@@ -3314,19 +3319,19 @@ + int nRootY = 0; + pFocus->cursor->QueryRootPosition( &nRootX, &nRootY ); + +- if ( s_bTracking ) ++ if ( !s_bTracking ) ++ { ++ s_Hold = PointerHold{}; ++ s_Hold.bHeld = bHinted; ++ s_bPointerHeld = bHinted; ++ } ++ else if ( !bTouchDown ) + { + const xwayland_ctx_t *pCtx = pFocus->cursor->getCtx(); + const double flReachX = pointer_reach( s_nRootX, flDX, pCtx->root_width ); + const double flReachY = pointer_reach( s_nRootY, flDY, pCtx->root_height ); + s_bPointerHeld = pointer_hold_step( s_Hold, true, flReachX, flReachY, nRootX - s_nRootX, nRootY - s_nRootY, get_time_in_nanos() ); + } +- else +- { +- s_Hold = PointerHold{}; +- s_Hold.bHeld = bHinted; +- s_bPointerHeld = bHinted; +- } + + s_bTracking = true; + s_flSeatX = flX; diff --git a/tools/tests/test_gamescope_pointer_hold_edge.py b/tools/tests/test_gamescope_pointer_hold_edge.py new file mode 100644 index 0000000000..e405474e88 --- /dev/null +++ b/tools/tests/test_gamescope_pointer_hold_edge.py @@ -0,0 +1,102 @@ +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +HOLD = ROOT / "tools/gamescope/patches/0133-constraint-relative-when-held.patch" +EDGE = ROOT / "tools/gamescope/patches/0144-pointer-hold-ignores-motion-into-the-edge.patch" + + +def added_source(patch): + return "\n".join(line[1:] for line in patch.read_text().splitlines() if line.startswith("+") and not line.startswith("+++")) + + +def block(text, start): + begin = text.index(start) + return text[begin:text.index("\n}", begin) + 3] + + +PREAMBLE = r''' +#include +#include +#include +#include +''' + +MAIN = r''' +static const uint64_t FRAME = 16'666'667ul; + +struct Pointer { + PointerHold hold; + int x; + int width; + uint64_t now = 1'000'000'000ul; + bool step(double seatDX, int pointerDX) { + now += FRAME; + const double reach = pointer_reach(x, seatDX, width); + x += pointerDX; + return pointer_hold_step(hold, true, reach, 0.0, pointerDX, 0.0, now); + } +}; + +int main() { + assert(pointer_reach(1279, 26.0, 1280) == 0.0); + assert(pointer_reach(1270, 26.0, 1280) == 9.0); + assert(pointer_reach(0, -13.0, 1280) == 0.0); + assert(pointer_reach(640, -13.0, 1280) == -13.0); + assert(pointer_reach(5, 3.0, 0) == -5.0); + + Pointer pinned{{}, 1279, 1280}; + for (int i = 0; i < 20; i++) assert(!pinned.step(26.0, 0)); + + Pointer release{{}, 1279, 1280}; + release.hold.bHeld = true; + for (int i = 0; i < 20; i++) assert(release.step(26.0, 0)); + for (int i = 0; i < 10; i++) assert(release.step(-13.0, -13)); + for (int i = 0; i < 10; i++) assert(release.step(13.0, 13)); + assert(release.x == 1279); + for (int i = 0; i < 20; i++) assert(release.step(26.0, 0)); + for (int i = 0; i < 9; i++) assert(release.step(-13.0, -13)); + assert(!release.step(-13.0, -13)); + bool held = false; + + Pointer recentre{{}, 640, 1280}; + held = false; + for (int i = 0; i < 3; i++) held = recentre.step(26.0, 0); + assert(held); + return 0; +} +''' + + +class GamescopePointerHoldEdgeTest(unittest.TestCase): + def test_motion_into_the_screen_edge_neither_holds_nor_resets_the_release(self): + compiler = shutil.which("c++") or shutil.which("g++") or shutil.which("clang++") + if not compiler: + self.skipTest("no C++ compiler") + hold = added_source(HOLD) + edge = added_source(EDGE) + source = PREAMBLE + "\n".join([ + block(hold, "struct PointerHold"), + block(hold, "static bool pointer_hold_step"), + block(edge, "static double pointer_reach"), + ]) + MAIN + with tempfile.TemporaryDirectory() as tmp: + src = Path(tmp) / "pointer_hold_edge.cpp" + exe = Path(tmp) / "pointer_hold_edge" + src.write_text(source) + subprocess.run([compiler, "-std=c++17", "-Wall", "-Werror", "-UNDEBUG", str(src), "-o", str(exe)], check=True) + subprocess.run([str(exe)], check=True) + + def test_the_hold_rule_compares_against_the_reachable_motion(self): + edge = added_source(EDGE) + self.assertIn("pointer_reach( s_nRootX, flDX, pCtx->root_width )", edge) + self.assertIn("pointer_reach( s_nRootY, flDY, pCtx->root_height )", edge) + self.assertIn("pointer_hold_step( s_Hold, true, flReachX, flReachY,", edge) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/tests/test_gamescope_pointer_hold_touch_down.py b/tools/tests/test_gamescope_pointer_hold_touch_down.py new file mode 100644 index 0000000000..7f8f2b01d7 --- /dev/null +++ b/tools/tests/test_gamescope_pointer_hold_touch_down.py @@ -0,0 +1,109 @@ +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +HOLD = ROOT / "tools/gamescope/patches/0133-constraint-relative-when-held.patch" +DOWN = ROOT / "tools/gamescope/patches/0145-pointer-hold-skips-touch-down-warps.patch" + + +def added_source(patch): + return "\n".join(line[1:] for line in patch.read_text().splitlines() if line.startswith("+") and not line.startswith("+++")) + + +def block(text, start): + begin = text.index(start) + return text[begin:text.index("\n}", begin) + 3] + + +PREAMBLE = r''' +#include +#include +#include +#include +''' + +MAIN = r''' +static const uint64_t FRAME = 16'666'667ul; + +struct Session { + PointerHold hold; + uint64_t now = 1'000'000'000ul; + bool skipTouchDown; + bool frame(double seatDX, double pointerDX, bool touchDown) { + now += FRAME; + if (touchDown && skipTouchDown) return hold.bHeld; + return pointer_hold_step(hold, true, seatDX, 0.0, pointerDX, 0.0, now); + } + void held() { + hold = PointerHold{}; + hold.bHeld = true; + } + bool strokes() { + held(); + bool result = true; + for (int i = 0; i < 17; i++) result = frame(80.0, 80.0, false); + result = frame(41.0, -1106.0, true); + for (int i = 0; i < 15; i++) result = frame(73.3, 73.0, false); + return result; + } +}; + +int main() { + Session counted{{}, 1'000'000'000ul, false}; + assert(counted.strokes()); + + Session skipped{{}, 1'000'000'000ul, true}; + assert(!skipped.strokes()); + + Session drag{{}, 1'000'000'000ul, true}; + drag.held(); + bool result = drag.frame(41.0, -1106.0, true); + assert(result); + for (int i = 0; i < 29; i++) result = drag.frame(12.0, 12.0, false); + assert(result); + result = drag.frame(12.0, 12.0, false); + assert(!result); + + Session recentre{{}, 1'000'000'000ul, true}; + for (int i = 0; i < 3; i++) result = recentre.frame(26.0, 0.0, false); + assert(result); + result = recentre.frame(-400.0, 300.0, true); + assert(result); + for (int i = 0; i < 40; i++) result = recentre.frame(12.0, 0.0, false); + assert(result); + return 0; +} +''' + + +class GamescopePointerHoldTouchDownTest(unittest.TestCase): + def test_touch_down_is_skipped_and_touch_drags_release_the_hold(self): + compiler = shutil.which("c++") or shutil.which("g++") or shutil.which("clang++") + if not compiler: + self.skipTest("no C++ compiler") + hold = added_source(HOLD) + source = PREAMBLE + "\n".join([ + block(hold, "struct PointerHold"), + block(hold, "static bool pointer_hold_step"), + ]) + MAIN + with tempfile.TemporaryDirectory() as tmp: + src = Path(tmp) / "pointer_hold_touch_down.cpp" + exe = Path(tmp) / "pointer_hold_touch_down" + src.write_text(source) + subprocess.run([compiler, "-std=c++17", "-Wall", "-Werror", "-UNDEBUG", str(src), "-o", str(exe)], check=True) + subprocess.run([str(exe)], check=True) + + def test_only_touch_down_warps_are_skipped(self): + added = added_source(DOWN) + self.assertIn(" \t\t\t\twlserver_mousewarp( tx, ty, time, false, true );\n+\t\t\t\twlserver.ulTouchDownWarps++;", DOWN.read_text()) + self.assertEqual(1, added.count("wlserver.ulTouchDownWarps++")) + self.assertIn("const bool bTouchDown = ulTouchDownWarps != s_ulTouchDownWarps;", added) + self.assertIn("else if ( !bTouchDown )", added) + self.assertNotIn("bFromTouch )\n\t\twlserver.ulTouchDownWarps++", added) + +if __name__ == "__main__": + unittest.main() diff --git a/tools/tests/test_gamescope_touch_click_owner.py b/tools/tests/test_gamescope_touch_click_owner.py new file mode 100644 index 0000000000..1063838a35 --- /dev/null +++ b/tools/tests/test_gamescope_touch_click_owner.py @@ -0,0 +1,121 @@ +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +PATCH = ROOT / "tools/gamescope/patches/0143-touch-click-first-finger-drives.patch" + + +def added_source(): + return "\n".join(line[1:] for line in PATCH.read_text().splitlines() if line.startswith("+") and not line.startswith("+++")) + + +def block(text, start): + begin = text.index(start) + return text[begin:text.index("\n}", begin) + 3] + + +PREAMBLE = r''' +#include +#include +''' + +MAIN = r''' +struct Pointer { + TouchClickState state; + int warps = 0; + int presses = 0; + int releases = 0; + void down(int id) { if (touch_click_claim(state, id)) { warps++; presses++; } } + void move(int id, bool nested = false) { if (nested || touch_click_drives(state, id)) warps++; } + void up(int id) { if (touch_click_lift(state, id)) releases++; } +}; + +int main() { + Pointer tap; + tap.down(1); + tap.move(1); + tap.up(1); + assert(tap.presses == 1 && tap.releases == 1 && tap.warps == 2); + + Pointer drag; + drag.down(1); + drag.move(1); + drag.down(2); + drag.move(2); + drag.move(1); + drag.up(2); + assert(drag.presses == 1 && drag.releases == 0 && drag.warps == 3); + drag.move(1); + drag.up(1); + assert(drag.releases == 1 && drag.warps == 4); + + Pointer handover; + handover.down(1); + handover.down(2); + handover.up(1); + assert(handover.releases == 1); + handover.move(2); + handover.down(3); + handover.move(3); + assert(handover.warps == 1 && handover.presses == 1); + handover.up(3); + handover.up(2); + assert(handover.releases == 1); + handover.down(4); + handover.move(4); + handover.up(4); + assert(handover.presses == 2 && handover.releases == 2 && handover.warps == 3); + + Pointer nested; + nested.move(0, true); + nested.down(1); + nested.move(0, true); + assert(nested.warps == 3); + + Pointer stray; + stray.up(7); + assert(stray.releases == 1); + stray.down(1); + stray.up(7); + assert(stray.releases == 1); + stray.up(1); + assert(stray.releases == 2); + return 0; +} +''' + + +class GamescopeTouchClickOwnerTest(unittest.TestCase): + def test_only_the_first_finger_drives_the_emulated_mouse(self): + compiler = shutil.which("c++") or shutil.which("g++") or shutil.which("clang++") + if not compiler: + self.skipTest("no C++ compiler") + added = added_source() + helpers = "\n".join(block(added, start) for start in ( + "struct TouchClickState", + "static bool touch_click_claim", + "static bool touch_click_drives", + "static bool touch_click_lift", + )) + source = PREAMBLE + helpers + MAIN + with tempfile.TemporaryDirectory() as tmp: + src = Path(tmp) / "touch_click_owner.cpp" + exe = Path(tmp) / "touch_click_owner" + src.write_text(source) + subprocess.run([compiler, "-std=c++17", "-Wall", "-Werror", "-UNDEBUG", str(src), "-o", str(exe)], check=True) + subprocess.run([str(exe)], check=True) + + def test_the_patch_gates_every_finger_path(self): + added = added_source() + self.assertIn("else if ( bAlwaysWarpCursor || touch_click_drives( s_TouchClick, touch_id ) )", added) + self.assertIn("if ( touch_click_drives( s_TouchClick, touch_id ) )", added) + self.assertIn("else if ( touch_click_claim( s_TouchClick, touch_id ) )", added) + self.assertIn("bClickTouch && i < WLSERVER_BUTTON_COUNT", added) + + +if __name__ == "__main__": + unittest.main() From 1d4eb2446e78847ce6ce63d0d65ad66c557417cb Mon Sep 17 00:00:00 2001 From: ReVanTis Date: Sun, 29 Nov 2026 05:42:01 +0800 Subject: [PATCH 048/120] fix(input): a captured touchpad drives the pointer (#2802) * fix(input): a captured touchpad drives the pointer Android reports a captured touchpad's events as SOURCE_TOUCHPAD with the finger positions on the pad and the movement in AXIS_RELATIVE_X/Y. The capture handler only accepted SOURCE_MOUSE_RELATIVE, so every captured touchpad event was dropped and the touchpad stopped working in a session. Read the relative axes for a captured touchpad, and count a touchpad as an attached pointer for the Auto relative mouse choice and for pointer capture. A touchpad that declares SOURCE_TOUCHPAD is not captured for the whole session, so Android keeps its cursor and gestures until a game holds the pointer. * fix(input): keep captured touchpad motion without relative axes Some builds do not provide AXIS_RELATIVE_X/Y for a captured touchpad (the AOSP include_relative_axis_values_for_captured_touchpads flag can leave them out). Fall back to the movement between the pointer's successive absolute positions, tracked per pointer id, and clear the positions when capture changes or the pointer ends. * fix(input): key captured touchpad positions by device too A pointer id is only unique within its device, so the fallback positions could collide between two touchpads or a replaced device. Key them by device id and pointer id, and cover it with a test. * fix(input): end only the touchpad that lifted ACTION_UP and ACTION_CANCEL cleared every device's fallback positions. Forget only the device that ended, so a second touchpad keeps its baseline; a capture change still resets all of them. * Give a captured touchpad taps, two-finger scroll and clickpad presses * Keep captured touchpad clicks apart from mouse buttons A tap's synthetic release shared the mouse's held-button owner, so it could release a mouse button that was still held. Captured touchpad presses now use their own owner, released when capture ends. A physical pad press also keeps a later second finger from turning into a right-click tap. * Keep physical touchpad buttons on the mouse owner A press made before capture was released under the captured owner and stayed held. Physical buttons now always use the mouse owner, and only gesture clicks use the touchpad owner. A physical press also releases a pending tap click first, so the two never merge. --------- Co-authored-by: maxjivi05 --- .../com/droiddeck/launcher/SessionActivity.kt | 85 +++++++++++++++---- .../launcher/input/PointerCapture.kt | 33 +++++++ .../launcher/input/TouchpadGestures.kt | 19 ++++- .../launcher/input/PointerCaptureTest.kt | 77 +++++++++++++++++ .../launcher/input/TouchpadGesturesTest.kt | 75 ++++++++++++++++ 5 files changed, 268 insertions(+), 21 deletions(-) create mode 100644 app/src/main/java/com/droiddeck/launcher/input/PointerCapture.kt create mode 100644 app/src/test/java/com/droiddeck/launcher/input/PointerCaptureTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index d6c648c2c0..d332058fb3 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -904,6 +904,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde onCapturedPointer(event) || super.dispatchCapturedPointerEvent(event) override fun dispatchPointerCaptureChanged(hasCapture: Boolean) { super.dispatchPointerCaptureChanged(hasCapture) + capturedTouchpad.cancel() + heldButtons.release(64) Log.i(TAG, "pointer capture " + if (hasCapture) "on" else "off") if (hasCapture) { pointerCaptureRefused = false @@ -3836,7 +3838,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde } else -> return super.dispatchGenericMotionEvent(event) } - if (event.isFromSource(android.view.InputDevice.SOURCE_MOUSE) && !drawerOpen) { + if ((event.isFromSource(android.view.InputDevice.SOURCE_MOUSE) || + event.isFromSource(android.view.InputDevice.SOURCE_TOUCHPAD)) && !drawerOpen) { if (appUiOwnsPointer()) { if (super.dispatchGenericMotionEvent(event)) return true if (touchEditorOpen) return false @@ -4020,7 +4023,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde steamSession = SessionState.mode == SessionService.MODE_STEAM, steamDesktopUi = SessionState.steamUi == "desktop", )) == com.droiddeck.launcher.input.TouchRouter.Route.TOUCHPAD - val mode = com.droiddeck.launcher.input.TouchGestureConfig.gamescopeRelativeMouse(wanted, mouseAttached(), touchpadRoute) + val mode = com.droiddeck.launcher.input.TouchGestureConfig.gamescopeRelativeMouse(wanted, pointerAttached(), touchpadRoute) if (appliedRelativeMouseMode == mode) return if (AgentGuest.setGamescopeConvar(this, "relative_mouse", mode)) appliedRelativeMouseMode = mode else if (relativeMouseRetries++ < RELATIVE_MOUSE_MAX_RETRIES) uiHandler.postDelayed({ requestRelativeMouse() }, 2_000) @@ -4151,6 +4154,27 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde } } + private val capturedTouchpadListener: PointerGestures.Listener = object : PointerGestures.Listener by pointerListener { + override fun onMove(x: Float, y: Float) { + val rect = drawnRect() ?: return + val scale = sceneScale(rect) + capturedTouchpad.place(CAPTURED_PAD_CENTRE, CAPTURED_PAD_CENTRE) + onRelativeMouse((x - CAPTURED_PAD_CENTRE) * scale, (y - CAPTURED_PAD_CENTRE) * scale) + } + override fun onButton(button: Int, pressed: Boolean, x: Float, y: Float) { + heldButtons.set(64, button, pressed) + } + override fun onThreeFingerTap(): Boolean = false + } + + private val capturedTouchpad: TouchpadGestures by lazy { + TouchpadGestures(PointerGestures.slop(this), capturedTouchpadListener, holdDrags = false).apply { + bounds = android.graphics.RectF(0f, 0f, CAPTURED_PAD_CENTRE * 2f, CAPTURED_PAD_CENTRE * 2f) + place(CAPTURED_PAD_CENTRE, CAPTURED_PAD_CENTRE) + } + } + private val capturedPadMatrix = android.graphics.Matrix() + private val scrollListener = object : ScrollTouchGestures.Listener { override fun onMove(x: Float, y: Float) { val rect = pointerSurfaceRect() ?: return @@ -5327,7 +5351,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde private fun handleTouch(event: MotionEvent): Boolean { val pen = PenStream.penIndex(event) val penRouted = if (pen >= 0) routePen(event, pen).takeIf { it != PenRouter.Route.TOUCH } else null - if (penRouted == null && event.isFromSource(android.view.InputDevice.SOURCE_MOUSE)) return onMouse(event) + if (penRouted == null && (event.isFromSource(android.view.InputDevice.SOURCE_MOUSE) || + event.isFromSource(android.view.InputDevice.SOURCE_TOUCHPAD))) return onMouse(event) when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { sessionTouchDown = true @@ -5573,7 +5598,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde private fun isHardwareMouse(d: InputDevice?): Boolean = d != null && !d.isVirtual && !d.supportsSource(InputDevice.SOURCE_STYLUS) && - (d.supportsSource(InputDevice.SOURCE_MOUSE) || d.supportsSource(InputDevice.SOURCE_MOUSE_RELATIVE)) + (d.supportsSource(InputDevice.SOURCE_MOUSE) || d.supportsSource(InputDevice.SOURCE_MOUSE_RELATIVE) || + d.supportsSource(InputDevice.SOURCE_TOUCHPAD)) + + private fun isTouchpad(d: InputDevice?): Boolean = + d?.supportsSource(InputDevice.SOURCE_TOUCHPAD) == true /** Android also sends the Back and Forward buttons as key events, so they are handled as keys. */ private fun guestMouseButton(actionButton: Int): Int? = when (actionButton) { @@ -5583,9 +5612,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde else -> PointerGestures.BTN_LEFT } + private fun pointerAttached(): Boolean = usbMouse.active || InputDevice.getDeviceIds().any { id -> + isHardwareMouse(InputDevice.getDevice(id)) + } + private fun mouseAttached(): Boolean = usbMouse.active || InputDevice.getDeviceIds().any { id -> val d = InputDevice.getDevice(id) - isHardwareMouse(d) && d?.supportsSource(InputDevice.SOURCE_TOUCHPAD) != true + isHardwareMouse(d) && !isTouchpad(d) } private fun externalMouseAttached(): Boolean { @@ -5603,7 +5636,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde private fun updatePointerCapture() { if (!::surfaceView.isInitialized) return val view = window.decorView - val want = (pointerLocked || relativeMouseAttached()) && sessionOwnsInput() && hasWindowFocus() && mouseAttached() + val want = (pointerLocked || relativeMouseAttached()) && sessionOwnsInput() && hasWindowFocus() && pointerAttached() releaseDesktopMouseGrab() updateUsbMouse(want) if (want == view.hasPointerCapture()) return @@ -5656,7 +5689,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde } private fun dropMouseCursor() { - if (!mouseOwnsCursor || mouseAttached()) return + if (!mouseOwnsCursor || pointerAttached()) return mouseOwnsCursor = false uiHandler.removeCallbacks(cursorResync) cursorVisible = false @@ -5707,20 +5740,22 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde } private fun onCapturedPointer(event: MotionEvent): Boolean { - if (!event.isFromSource(InputDevice.SOURCE_MOUSE_RELATIVE)) return false + if (!com.droiddeck.launcher.input.PointerCapture.accepts(event)) return false notePress(event) + val pad = com.droiddeck.launcher.input.PointerCapture.isTouchpad(event) + when (event.actionMasked) { + MotionEvent.ACTION_BUTTON_PRESS, MotionEvent.ACTION_BUTTON_RELEASE -> { + if (pad && event.actionMasked == MotionEvent.ACTION_BUTTON_PRESS) capturedTouchpad.buttonPressed() + guestMouseButton(event.actionButton)?.let { heldButtons.set(8, it, event.actionMasked == MotionEvent.ACTION_BUTTON_PRESS) } + } + else -> if (pad) return onCapturedTouchpad(event) + } when (event.actionMasked) { MotionEvent.ACTION_MOVE -> { - var dx = event.x - var dy = event.y - for (i in 0 until event.historySize) { - dx += event.getHistoricalX(i) - dy += event.getHistoricalY(i) - } - onRelativeMouse(dx, dy) + val delta = com.droiddeck.launcher.input.PointerCapture.delta(event) + onRelativeMouse(delta[0], delta[1]) } - MotionEvent.ACTION_BUTTON_PRESS, MotionEvent.ACTION_BUTTON_RELEASE -> - guestMouseButton(event.actionButton)?.let { heldButtons.set(8, it, event.actionMasked == MotionEvent.ACTION_BUTTON_PRESS) } + MotionEvent.ACTION_BUTTON_PRESS, MotionEvent.ACTION_BUTTON_RELEASE -> {} MotionEvent.ACTION_SCROLL -> { val v = event.getAxisValue(MotionEvent.AXIS_VSCROLL) if (v != 0f) sendSceneWheel(-Math.round(v)) @@ -5731,6 +5766,21 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde return true } + private fun onCapturedTouchpad(event: MotionEvent): Boolean { + if (event.actionMasked == MotionEvent.ACTION_DOWN) { + val metrics = resources.displayMetrics + val scale = com.droiddeck.launcher.input.PointerCapture.touchpadScale(event, metrics.xdpi / 25.4f, metrics.widthPixels) + capturedPadMatrix.setScale(scale, scale) + capturedTouchpad.desktop = SessionState.mode == SessionService.MODE_DESKTOP + if (::touchpad.isInitialized) capturedTouchpad.sensitivity = touchpad.sensitivity + } + val scaled = MotionEvent.obtain(event) + scaled.transform(capturedPadMatrix) + val handled = capturedTouchpad.onTouch(scaled) + scaled.recycle() + return handled + } + private fun logInputDevice(what: String, deviceId: Int) { val d = InputDevice.getDevice(deviceId) ?: return if (!PadBridge.isFromController(d)) return @@ -7162,6 +7212,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde private const val PAD_SCROLL_POINTER_X = 0.985f private const val PAD_SCROLL_HEIGHTS_PER_S = 3f private const val AXIS_UNITS_PER_PIXEL = 3f + private const val CAPTURED_PAD_CENTRE = 1_000_000f private const val KEY_LEFTCTRL = 29 private const val KEY_RIGHTCTRL = 97 private const val KEY_A = 30 diff --git a/app/src/main/java/com/droiddeck/launcher/input/PointerCapture.kt b/app/src/main/java/com/droiddeck/launcher/input/PointerCapture.kt new file mode 100644 index 0000000000..d598a1bc05 --- /dev/null +++ b/app/src/main/java/com/droiddeck/launcher/input/PointerCapture.kt @@ -0,0 +1,33 @@ +package com.droiddeck.launcher.input + +import android.view.InputDevice +import android.view.MotionEvent + +object PointerCapture { + fun accepts(event: MotionEvent): Boolean = + event.isFromSource(InputDevice.SOURCE_MOUSE_RELATIVE) || + event.isFromSource(InputDevice.SOURCE_TOUCHPAD) + + fun isTouchpad(event: MotionEvent): Boolean = event.isFromSource(InputDevice.SOURCE_TOUCHPAD) + + fun delta(event: MotionEvent): FloatArray { + var dx = event.x + var dy = event.y + for (i in 0 until event.historySize) { + dx += event.getHistoricalX(i) + dy += event.getHistoricalY(i) + } + return floatArrayOf(dx, dy) + } + + fun touchpadScale(unitsPerMm: Float, padWidth: Float, pixelsPerMm: Float, screenWidth: Int): Float = when { + unitsPerMm > 0f && pixelsPerMm > 0f -> pixelsPerMm / unitsPerMm + padWidth > 0f && screenWidth > 0 -> screenWidth / padWidth + else -> 1f + } + + fun touchpadScale(event: MotionEvent, pixelsPerMm: Float, screenWidth: Int): Float { + val range = event.device?.getMotionRange(MotionEvent.AXIS_X, InputDevice.SOURCE_TOUCHPAD) + return touchpadScale(range?.resolution ?: 0f, range?.range ?: 0f, pixelsPerMm, screenWidth) + } +} diff --git a/app/src/main/java/com/droiddeck/launcher/input/TouchpadGestures.kt b/app/src/main/java/com/droiddeck/launcher/input/TouchpadGestures.kt index 659b99c0ce..a044469f3b 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/TouchpadGestures.kt +++ b/app/src/main/java/com/droiddeck/launcher/input/TouchpadGestures.kt @@ -9,6 +9,7 @@ import kotlin.math.hypot class TouchpadGestures( private val slopPx: Float, private val listener: PointerGestures.Listener, + private val holdDrags: Boolean = true, ) { var x = 0f private set @@ -33,6 +34,7 @@ class TouchpadGestures( private var held = false private var secondDownAt = 0L private var secondWasTap = false + private var pressed = false private var twoFingers = false private var scrollAnchorX = 0f private var scrollAnchorY = 0f @@ -90,6 +92,15 @@ class TouchpadGestures( lastTapAt = 0L } + fun buttonPressed() { + pressed = true + handler.removeCallbacks(longPress) + releaseClick() + travelled = slopPx + 1f + secondWasTap = false + lastTapAt = 0L + } + fun place(px: Float, py: Float) { x = px.coerceIn(bounds.left, bounds.right) y = py.coerceIn(bounds.top, bounds.bottom) @@ -115,7 +126,7 @@ class TouchpadGestures( releaseClick() lastX = event.x; lastY = event.y downAt = event.eventTime - travelled = 0f; held = false; twoFingers = false; scrolled = false; secondWasTap = false + travelled = 0f; held = false; twoFingers = false; scrolled = false; secondWasTap = false; pressed = false fingers = 1; pinching = false anchorId = event.getPointerId(0); moverId = -1; holdDrag = false; scrollLocked = false if (clicks && event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) { @@ -123,7 +134,7 @@ class TouchpadGestures( press(PointerGestures.BTN_LEFT) } else { dragging = false - if (clicks) handler.postDelayed(longPress, TouchTiming.HOLD_MS) + if (clicks && holdDrags) handler.postDelayed(longPress, TouchTiming.HOLD_MS) } return true } @@ -142,7 +153,7 @@ class TouchpadGestures( if (holdDrag) return true twoFingers = true secondDownAt = event.eventTime - secondWasTap = true + secondWasTap = !pressed scrollAnchorX = (event.getX(0) + event.getX(1)) / 2f scrollAnchorY = (event.getY(0) + event.getY(1)) / 2f pinchSpan = span(event) @@ -153,7 +164,7 @@ class TouchpadGestures( val mi = if (moverId == -1) -1 else event.findPointerIndex(moverId) if (ai >= 0 && mi >= 0) { val mx = event.getX(mi); val my = event.getY(mi) - if (!holdDrag && !scrolled && !scrollLocked) { + if (holdDrags && !holdDrag && !scrolled && !scrollLocked) { val anchorMoved = abs(event.getX(ai) - anchorStartX) + abs(event.getY(ai) - anchorStartY) val moverMoved = abs(mx - moverStartX) + abs(my - moverStartY) if (anchorMoved >= slopPx) { diff --git a/app/src/test/java/com/droiddeck/launcher/input/PointerCaptureTest.kt b/app/src/test/java/com/droiddeck/launcher/input/PointerCaptureTest.kt new file mode 100644 index 0000000000..3d85e8c259 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/input/PointerCaptureTest.kt @@ -0,0 +1,77 @@ +package com.droiddeck.launcher.input + +import android.view.InputDevice +import android.view.MotionEvent +import org.junit.Assert.assertArrayEquals +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [34], manifest = Config.NONE) +class PointerCaptureTest { + @Test fun aCapturedMouseReportsItsPositionAsMovement() { + val event = event(MotionEvent.ACTION_MOVE, InputDevice.SOURCE_MOUSE_RELATIVE, x = 12f, y = -7f) + try { + assertTrue(PointerCapture.accepts(event)) + assertFalse(PointerCapture.isTouchpad(event)) + assertArrayEquals(floatArrayOf(12f, -7f), PointerCapture.delta(event), 0.001f) + } finally { + event.recycle() + } + } + + @Test fun batchedMouseSamplesAddUp() { + val event = event(MotionEvent.ACTION_MOVE, InputDevice.SOURCE_MOUSE_RELATIVE, x = 3f, y = -5f) + try { + event.addBatch(1L, arrayOf(MotionEvent.PointerCoords().apply { x = 2f; y = 4f }), 0) + assertArrayEquals(floatArrayOf(5f, -1f), PointerCapture.delta(event), 0.001f) + } finally { + event.recycle() + } + } + + @Test fun aCapturedTouchpadIsACapturedPointer() { + val event = event(MotionEvent.ACTION_DOWN, InputDevice.SOURCE_TOUCHPAD, x = 800f, y = 400f) + try { + assertTrue(PointerCapture.accepts(event)) + assertTrue(PointerCapture.isTouchpad(event)) + } finally { + event.recycle() + } + } + + @Test fun anUncapturedMouseIsNotACapturedPointer() { + val event = event(MotionEvent.ACTION_HOVER_MOVE, InputDevice.SOURCE_MOUSE, x = 12f, y = -7f) + try { + assertFalse(PointerCapture.accepts(event)) + } finally { + event.recycle() + } + } + + @Test fun touchpadTravelMatchesTheSameDistanceOnScreen() { + assertEquals(0.5f, PointerCapture.touchpadScale(unitsPerMm = 20f, padWidth = 2000f, pixelsPerMm = 10f, screenWidth = 1920), 0.001f) + } + + @Test fun aTouchpadWithoutAResolutionSpansTheScreen() { + assertEquals(1.92f, PointerCapture.touchpadScale(unitsPerMm = 0f, padWidth = 1000f, pixelsPerMm = 10f, screenWidth = 1920), 0.001f) + } + + @Test fun aTouchpadWithoutARangeKeepsItsUnits() { + assertEquals(1f, PointerCapture.touchpadScale(unitsPerMm = 0f, padWidth = 0f, pixelsPerMm = 10f, screenWidth = 1920), 0.001f) + } + + private fun event(action: Int, source: Int, x: Float, y: Float): MotionEvent { + val properties = arrayOf(MotionEvent.PointerProperties().apply { + id = 0 + toolType = MotionEvent.TOOL_TYPE_FINGER + }) + val coords = arrayOf(MotionEvent.PointerCoords().apply { this.x = x; this.y = y }) + return MotionEvent.obtain(0L, 0L, action, 1, properties, coords, 0, 0, 1f, 1f, 0, 0, source, 0) + } +} diff --git a/app/src/test/java/com/droiddeck/launcher/input/TouchpadGesturesTest.kt b/app/src/test/java/com/droiddeck/launcher/input/TouchpadGesturesTest.kt index c967ce02fd..80df39e48c 100644 --- a/app/src/test/java/com/droiddeck/launcher/input/TouchpadGesturesTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/input/TouchpadGesturesTest.kt @@ -331,6 +331,81 @@ class TouchpadGesturesTest { assertEquals(listOf("left down", "left up", "left down"), events) } + @Test fun aRestingFingerNeverDragsWhenHoldDragsAreOff() { + touchpad = TouchpadGestures(SLOP, listener, holdDrags = false) + touchpad.bounds = RectF(0f, 0f, 1920f, 1080f) + touchpad.place(960f, 540f) + touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f)) + advance(TouchTiming.HOLD_MS + 100) + touch(MotionEvent.ACTION_POINTER_DOWN, 1, 1 to (400f to 300f), 2 to (600f to 300f)) + advance(10) + touch(MotionEvent.ACTION_MOVE, 0, 1 to (400f to 300f), 2 to (620f to 300f)) + advance(10) + touch(MotionEvent.ACTION_MOVE, 0, 1 to (400f to 300f), 2 to (640f to 300f)) + assertFalse(events.any { it.startsWith("left") || it == "long press" }) + } + + @Test fun tapsStillClickWhenHoldDragsAreOff() { + touchpad = TouchpadGestures(SLOP, listener, holdDrags = false) + tap() + assertEquals(listOf("left down"), events) + } + + @Test fun aPhysicalButtonPressIsNotAlsoATap() { + touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f)) + touchpad.buttonPressed() + advance(80) + touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f)) + advance(TouchTiming.HOLD_MS + 100) + assertTrue(events.isEmpty()) + } + + @Test fun aPhysicalButtonPressDuringTwoFingersIsNotARightClick() { + touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f)) + advance(10) + touch(MotionEvent.ACTION_POINTER_DOWN, 1, 1 to (400f to 300f), 2 to (600f to 300f)) + touchpad.buttonPressed() + advance(40) + touch(MotionEvent.ACTION_POINTER_UP, 1, 1 to (400f to 300f), 2 to (600f to 300f)) + touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f)) + assertTrue(events.isEmpty()) + } + + @Test fun aSecondFingerAfterAPhysicalButtonPressIsNotARightClick() { + touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f)) + touchpad.buttonPressed() + advance(10) + touch(MotionEvent.ACTION_POINTER_DOWN, 1, 1 to (400f to 300f), 2 to (600f to 300f)) + advance(40) + touch(MotionEvent.ACTION_POINTER_UP, 1, 1 to (400f to 300f), 2 to (600f to 300f)) + touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f)) + advance(TouchTiming.HOLD_MS + 100) + assertTrue(events.isEmpty()) + twoFingerTapStillRightClicks() + } + + @Test fun aPhysicalButtonPressReleasesAPendingTapClickFirst() { + tap() + assertEquals(listOf("left down"), events) + touchpad.buttonPressed() + assertEquals(listOf("left down", "left up"), events) + advance(TouchTiming.CLICK_MS + 100) + assertEquals(listOf("left down", "left up"), events) + } + + private fun twoFingerTapStillRightClicks() { + advance(1000) + events.clear() + touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f)) + advance(10) + touch(MotionEvent.ACTION_POINTER_DOWN, 1, 1 to (400f to 300f), 2 to (600f to 300f)) + advance(40) + touch(MotionEvent.ACTION_POINTER_UP, 1, 1 to (400f to 300f), 2 to (600f to 300f)) + touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f)) + advance(TouchTiming.HOLD_MS + 100) + assertTrue("right down" in events) + } + private fun tap() { touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f)) advance(80) From 01b2527e0ff1adc15650d6eb490fadf3910ab4cd Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:04:03 -0400 Subject: [PATCH 049/120] Add right-stick page scrolling to launcher --- .../droiddeck/launcher/FrontEndActivity.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index 1912828781..db73d436db 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2208,10 +2208,29 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet } private val triggerKeys = com.droiddeck.launcher.input.TriggerKeys { dispatchKeyEvent(it) } + private var rightStickScrollAt = 0L + + private fun scrollPageWithRightStick(event: android.view.MotionEvent): Boolean { + if (event.actionMasked != android.view.MotionEvent.ACTION_MOVE || + !event.isFromSource(android.view.InputDevice.SOURCE_JOYSTICK)) return false + val device = event.device ?: return false + val axis = if (device.getMotionRange(android.view.MotionEvent.AXIS_RY, event.source) != null) + android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ + val value = event.getAxisValue(axis) + if (kotlin.math.abs(value) < 0.55f) return false + val now = android.os.SystemClock.uptimeMillis() + if (now - rightStickScrollAt < 130L) return true + rightStickScrollAt = now + val key = if (value > 0f) android.view.KeyEvent.KEYCODE_PAGE_DOWN else android.view.KeyEvent.KEYCODE_PAGE_UP + dispatchKeyEvent(android.view.KeyEvent(now, now, android.view.KeyEvent.ACTION_DOWN, key, 0)) + dispatchKeyEvent(android.view.KeyEvent(now, now, android.view.KeyEvent.ACTION_UP, key, 0)) + return true + } override fun dispatchGenericMotionEvent(event: android.view.MotionEvent): Boolean { if (compatLaunch != null && !compatLaunch!!.loading.ended && com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return true + if (scrollPageWithRightStick(event)) return true triggerKeys.onMotion(event) return super.dispatchGenericMotionEvent(event) } From 8154a794201c8dcc2225bdfa6e9e0f1dfd15335c Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:06:18 -0400 Subject: [PATCH 050/120] Expose existing right-stick axis detection for launcher scrolling --- app/src/main/java/com/droiddeck/launcher/input/PadBridge.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java index 5c69e9065b..38129f3946 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java +++ b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java @@ -604,7 +604,7 @@ public final class PadBridge { return false; } - static boolean rightStickUsesRxRy(MotionEvent event, InputDevice device, Map layouts) { + public static boolean rightStickUsesRxRy(MotionEvent event, InputDevice device, Map layouts) { int source = event.getSource(); if (wiredXboxLayout(device, source)) return true; boolean hasRxRy = hasAxis(device, source, MotionEvent.AXIS_RX) From efb1b5437abc7fba492363629452bb2d2b8f0d9d Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:06:26 -0400 Subject: [PATCH 051/120] Route right-stick movement as Compose scroll events --- .../droiddeck/launcher/FrontEndActivity.kt | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index db73d436db..1f0d8d17b0 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2208,22 +2208,40 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet } private val triggerKeys = com.droiddeck.launcher.input.TriggerKeys { dispatchKeyEvent(it) } + private val rightStickLayouts = HashMap() private var rightStickScrollAt = 0L private fun scrollPageWithRightStick(event: android.view.MotionEvent): Boolean { if (event.actionMasked != android.view.MotionEvent.ACTION_MOVE || - !event.isFromSource(android.view.InputDevice.SOURCE_JOYSTICK)) return false + !com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return false val device = event.device ?: return false - val axis = if (device.getMotionRange(android.view.MotionEvent.AXIS_RY, event.source) != null) - android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ + val rxRy = com.droiddeck.launcher.input.PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts) + val axis = if (rxRy) android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ val value = event.getAxisValue(axis) if (kotlin.math.abs(value) < 0.55f) return false val now = android.os.SystemClock.uptimeMillis() if (now - rightStickScrollAt < 130L) return true rightStickScrollAt = now - val key = if (value > 0f) android.view.KeyEvent.KEYCODE_PAGE_DOWN else android.view.KeyEvent.KEYCODE_PAGE_UP - dispatchKeyEvent(android.view.KeyEvent(now, now, android.view.KeyEvent.ACTION_DOWN, key, 0)) - dispatchKeyEvent(android.view.KeyEvent(now, now, android.view.KeyEvent.ACTION_UP, key, 0)) + + val properties = android.view.MotionEvent.PointerProperties().apply { + id = 0 + toolType = android.view.MotionEvent.TOOL_TYPE_MOUSE + } + val coordinates = android.view.MotionEvent.PointerCoords().apply { + x = 1f + y = 1f + setAxisValue(android.view.MotionEvent.AXIS_VSCROLL, -value * 3f) + } + val scroll = android.view.MotionEvent.obtain( + now, now, android.view.MotionEvent.ACTION_SCROLL, 1, + arrayOf(properties), arrayOf(coordinates), 0, 0, 1f, 1f, + event.deviceId, 0, android.view.InputDevice.SOURCE_MOUSE, 0, + ) + try { + super.dispatchGenericMotionEvent(scroll) + } finally { + scroll.recycle() + } return true } From 7761d0aba7003a9c7b5f6fcc4407daf82cf3f350 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:18:38 -0400 Subject: [PATCH 052/120] Distinguish undecided right-stick axis layouts --- .../main/java/com/droiddeck/launcher/input/PadBridge.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java index 38129f3946..06d9f010db 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java +++ b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java @@ -530,7 +530,7 @@ public final class PadBridge { float lx = event.getAxisValue(MotionEvent.AXIS_X); float ly = event.getAxisValue(MotionEvent.AXIS_Y); boolean wired = wiredXboxLayout(device, event.getSource()); - boolean rxRyStick = rightStickUsesRxRy(event, device, rightStickLayouts); + boolean rxRyStick = Boolean.TRUE.equals(rightStickUsesRxRy(event, device, rightStickLayouts)); float rx = event.getAxisValue(rxRyStick ? MotionEvent.AXIS_RX : MotionEvent.AXIS_Z); float ry = event.getAxisValue(rxRyStick ? MotionEvent.AXIS_RY : MotionEvent.AXIS_RZ); retainStick(slot, JoyCon.LEFT, lx, ly); @@ -604,14 +604,14 @@ public final class PadBridge { return false; } - public static boolean rightStickUsesRxRy(MotionEvent event, InputDevice device, Map layouts) { + public static Boolean rightStickUsesRxRy(MotionEvent event, InputDevice device, Map layouts) { int source = event.getSource(); if (wiredXboxLayout(device, source)) return true; boolean hasRxRy = hasAxis(device, source, MotionEvent.AXIS_RX) && hasAxis(device, source, MotionEvent.AXIS_RY); boolean hasZRz = hasAxis(device, source, MotionEvent.AXIS_Z) && hasAxis(device, source, MotionEvent.AXIS_RZ); - if (!hasRxRy) return false; + if (!hasRxRy) return hasZRz ? false : null; if (!hasZRz) return true; Boolean cached = layouts.get(event.getDeviceId()); if (cached != null) return cached; @@ -619,7 +619,7 @@ public final class PadBridge { && nearCentre(device, source, event, MotionEvent.AXIS_RX, MotionEvent.AXIS_RY); boolean zRzEvidence = atMinimum(device, source, event, MotionEvent.AXIS_RX, MotionEvent.AXIS_RY) && nearCentre(device, source, event, MotionEvent.AXIS_Z, MotionEvent.AXIS_RZ); - if (rxRyEvidence == zRzEvidence) return false; + if (rxRyEvidence == zRzEvidence) return null; boolean useRxRy = rxRyEvidence; layouts.put(event.getDeviceId(), useRxRy); return useRxRy; From 378c4dc84a5877905f208bae5e6987dde436f245 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:18:44 -0400 Subject: [PATCH 053/120] Fix right-stick scroll routing and trigger event order --- .../main/java/com/droiddeck/launcher/FrontEndActivity.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index 1f0d8d17b0..92c3acff44 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2216,6 +2216,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet !com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return false val device = event.device ?: return false val rxRy = com.droiddeck.launcher.input.PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts) + ?: return false val axis = if (rxRy) android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ val value = event.getAxisValue(axis) if (kotlin.math.abs(value) < 0.55f) return false @@ -2227,9 +2228,11 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet id = 0 toolType = android.view.MotionEvent.TOOL_TYPE_MOUSE } + val root = window.decorView + if (root.width <= 0 || root.height <= 0) return true val coordinates = android.view.MotionEvent.PointerCoords().apply { - x = 1f - y = 1f + x = root.width * 0.65f + y = root.height * 0.5f setAxisValue(android.view.MotionEvent.AXIS_VSCROLL, -value * 3f) } val scroll = android.view.MotionEvent.obtain( @@ -2248,8 +2251,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet override fun dispatchGenericMotionEvent(event: android.view.MotionEvent): Boolean { if (compatLaunch != null && !compatLaunch!!.loading.ended && com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return true - if (scrollPageWithRightStick(event)) return true triggerKeys.onMotion(event) + if (scrollPageWithRightStick(event)) return true return super.dispatchGenericMotionEvent(event) } From a8aafad1459c4c91cd056ec41fc5cbc2a8638782 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sat, 28 Nov 2026 17:33:36 -0500 Subject: [PATCH 054/120] fix(session): the in-game menu opens on the first back tap and scrolls smoothly over a game (#3353) * Open the session menu on the first back tap instead of after the double-tap window * Hold the GPU clock up while a session panel is open over the game * Keep the double back tap working after the first tap opens the menu The first tap opens the menu at once, and opening the menu cleared the pending tap, so a second tap closed the menu instead of opening Steam's quick menu. The tap that opened the menu now keeps its window, and a second back press inside it goes to the double-tap action. Outside Steam both taps toggle the menu, so a double tap no longer opens and then closes it. * fix(session): drop pending back taps on focus loss and departure * fix(session): drop pending back taps when the drawer closes or another panel opens * fix(session): drop the quick-menu input's pending tap when the drawer closes * fix(session): keep a back press already down when the drawer closes --- .../com/droiddeck/launcher/SessionActivity.kt | 87 +++++++----- .../droiddeck/launcher/input/BackQamInput.kt | 23 ++- .../com/droiddeck/launcher/input/BackTaps.kt | 39 +++++ .../droiddeck/launcher/session/GpuClockPin.kt | 25 +++- .../launcher/input/BackQamInputTest.kt | 53 +++++++ .../droiddeck/launcher/input/BackTapsTest.kt | 133 ++++++++++++++++++ .../launcher/session/GpuClockPinTest.kt | 66 ++++++++- 7 files changed, 373 insertions(+), 53 deletions(-) create mode 100644 app/src/main/java/com/droiddeck/launcher/input/BackTaps.kt create mode 100644 app/src/test/java/com/droiddeck/launcher/input/BackTapsTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index d332058fb3..da291701f4 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -450,13 +450,22 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde return true } private val uiHandler = Handler(Looper.getMainLooper()) - private var pendingBackAction: Runnable? = null + private var backTapOpenedDrawer = false + private val backTapsAtOnce: Boolean get() = SessionState.mode != SessionService.MODE_STEAM || !backActionsInverted + private val backTaps = com.droiddeck.launcher.input.BackTaps( + windowMs = { backDoubleTapMs.toLong() }, + atOnce = { backTapsAtOnce }, + onTap = { performBackAction(double = it) }, + sameAction = { SessionState.mode != SessionService.MODE_STEAM }, + ) private val backQamInput = com.droiddeck.launcher.input.BackQamInput( setPressed = { padBridge?.setBackQamPressed(it) }, onTap = { performBackAction(double = it) }, doubleTapMs = { backDoubleTapMs.toLong() }, onCancel = { padBridge?.cancelBackQam() }, holds = { backHold }, + atOnce = { backTapsAtOnce }, + sameAction = { SessionState.mode != SessionService.MODE_STEAM }, ) private val mouseBackInput = com.droiddeck.launcher.input.MouseBackInput( sendRight = { down -> heldButtons.set(32, PointerGestures.BTN_RIGHT, down) }, @@ -1129,11 +1138,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde when { ::loading.isInitialized && loading.ended -> finish() inputSettingsOpen -> inputSettingsOpen = false - dockedTouchOnly -> routeBackAction() + dockedTouchOnly || backTaps.pending -> backTaps.tap() drawerOpen -> drawerOpen = false achievementsOpen -> closeAchievements() pcKeyboardOpen -> pcKeyboardOpen = false - else -> routeBackAction() + else -> backTaps.tap() } } }) @@ -1330,8 +1339,15 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde LaunchedEffect(drawerOpen, menuOwnsController, pcKeyboardOpen, achievementsOpen, gestureSettingsOpen, inputSettingsOpen, pipUi, SessionState.suspended, resumed, appTextFocus) { updateOnScreenControls() padBridge?.setInputEnabled(resumed && !menuOwnsController && !pcKeyboardOpen && !achievementsOpen && !gestureSettingsOpen && !inputSettingsOpen && !pipUi && !appTextFocus && !SessionState.suspended) - if (drawerOpen || pcKeyboardOpen || achievementsOpen || gestureSettingsOpen || inputSettingsOpen || pipUi || appTextFocus || SessionState.suspended) { - backQamInput.cancel() + if (!drawerOpen && backTapOpenedDrawer) { + backTaps.cancel() + backQamInput.cancelTap() + backTapOpenedDrawer = false + } + val otherPanel = pcKeyboardOpen || achievementsOpen || gestureSettingsOpen || inputSettingsOpen || pipUi || appTextFocus || SessionState.suspended + if (drawerOpen || otherPanel) { + if (otherPanel || !backTapOpenedDrawer) backTaps.cancel() + backQamInput.cancel(keepTap = backTapOpenedDrawer && !otherPanel) com.droiddeck.launcher.input.HomeButtonShortcuts.cancel(this@SessionActivity) cancelTouchGestures() } @@ -1385,7 +1401,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde if (drawerOpen) { syncLossless() if (menuOwnsController) { - releasePads() + releasePads(keepBackTap = backTapOpenedDrawer) androidx.compose.runtime.withFrameNanos { } val requested = focusDrawer() Log.i(TAG, "drawer root focus requested=$requested docked=$drawerDocked") @@ -1424,6 +1440,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde LaunchedEffect(pcKeyboardOpen, drawerOpen, achievementsOpen) { if (pcKeyboardOpen || drawerOpen || achievementsOpen) padMouse.reset() } + val panelShown = panelOverGame + LaunchedEffect(panelShown) { boostGpuClock(panelShown && resumed) } if (pcKeyboardOpen) com.droiddeck.launcher.ui.PcKeyboard( sendKey = { code, down -> if (CompositorHost.isStarted) sendGuestKey(code, down, 32) }, onAndroidKeyboard = { pcKeyboardOpen = false; togglePrimaryKeyboard() }, @@ -2118,25 +2136,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde unfoldedPanel?.reload() } - private fun routeBackAction() { - pendingBackAction?.let { pending -> - uiHandler.removeCallbacks(pending) - pendingBackAction = null - performBackAction(double = true) - return - } - val pending = Runnable { - pendingBackAction = null - performBackAction(double = false) - } - pendingBackAction = pending - uiHandler.postDelayed(pending, backDoubleTapMs.toLong()) - } - private fun performBackAction(double: Boolean) { val isSteam = SessionState.mode == SessionService.MODE_STEAM val opensQam = isSteam && (double xor backActionsInverted) - if (opensQam) triggerSteamQam() else if (!dockedTouchOnly) drawerOpen = !drawerOpen + if (opensQam) triggerSteamQam() else if (!dockedTouchOnly) { + drawerOpen = !drawerOpen + backTapOpenedDrawer = drawerOpen && !double + } } private fun handleHomeGuideIntent(incoming: Intent?) { @@ -2621,6 +2627,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde private fun gpuClockHeld() = SessionPrefs.gpuClockPin(this) && !GpuClockPin.failed + private val panelOverGame: Boolean get() = ((drawerOpen && !drawerDocked) || achievementsOpen || gestureSettingsOpen || inputSettingsOpen) && !pipUi + + private fun boostGpuClock(on: Boolean) { + if (!GpuClockPin.boost(on)) return + Thread { GpuClockPin.sync(applicationContext)?.let { Log.i(TAG, it) } }.start() + } + private fun readPrefs() { pipAutoEnter = SessionPrefs.pipAutoEnter(this) unfoldedControls = SessionPrefs.unfoldedControls(this) @@ -3489,11 +3502,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde focusEndedScreen() } - private fun releasePads() { + private fun releasePads(keepBackTap: Boolean = false) { inputMotion.stop() physicalInputBindings?.release() com.droiddeck.launcher.input.HomeButtonShortcuts.cancel(this) - backQamInput.cancel() + backQamInput.cancel(keepTap = keepBackTap) padBridge?.releaseAll() joyConVr?.releaseButtons() } @@ -3653,8 +3666,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde !pcKeyboardOpen && !achievementsOpen && !gestureSettingsOpen && !inputSettingsOpen, steam = SessionState.mode == SessionService.MODE_STEAM, ) { action -> - pendingBackAction?.let(uiHandler::removeCallbacks) - pendingBackAction = null + backTaps.cancel() if (!dockedMenuIdle) drawerControllerActive = true Log.i(TAG, "physical shortcut ${action.name} device=${event.deviceId} key=${event.keyCode} scan=${event.scanCode}") when (action) { @@ -3686,16 +3698,23 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde } } if (mouseBackHandled) return true - val backToQam = !pipUi && !appTextFocus && !menuOwnsController && !pcKeyboardOpen && !achievementsOpen && + val backToQam = !pipUi && !appTextFocus && (!menuOwnsController || backQamInput.awaitingTap) && !pcKeyboardOpen && !achievementsOpen && !inputSettingsOpen && !gestureSettingsOpen && SessionState.mode == SessionService.MODE_STEAM && SessionState.running && SessionState.firstFrameSeen && !SessionState.suspended && padBridge?.canHoldQam() == true if (backQamInput.onKeyEvent(event, backToQam)) { - pendingBackAction?.let(uiHandler::removeCallbacks) - pendingBackAction = null + backTaps.cancel() return true } if (pipUi) return true + if (event.keyCode == KeyEvent.KEYCODE_BACK && backTapOpenedDrawer && backTaps.pending) { + when { + event.action == KeyEvent.ACTION_DOWN -> backTaps.hold() + event.action == KeyEvent.ACTION_UP && !event.isCanceled -> backTaps.tap() + event.action == KeyEvent.ACTION_UP -> backTaps.cancel() + } + return true + } val pad = com.droiddeck.launcher.input.JoyCon.normalize(event) if (pad !== event) return dispatchKeyEvent(pad) val fromController = PadBridge.isControllerKeyEvent(event) @@ -6177,8 +6196,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde drawerOpen = false pcKeyboardOpen = false achievementsOpen = false - pendingBackAction?.let(uiHandler::removeCallbacks) - pendingBackAction = null + backTaps.cancel() releaseDrawerDirection() onScreenControls?.releaseAll() bottomInputControls?.releaseAll() @@ -6341,6 +6359,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde onScreenControls?.reload() controllerSettings = ControllerPrefs.read(this) resumed = true + boostGpuClock(panelOverGame) updateKeyboardRoute() retryFieldKeyboard(hasWindowFocus()) updateDesktopKeyboardButton() @@ -6391,6 +6410,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde if (runtimeRemovalBlocked) return physicalShortcuts.clear() backQamInput.cancel() + backTaps.cancel() mouseBackInput.cancel() capturePausedFrame() padBridge?.setInputEnabled(false) @@ -6424,6 +6444,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde if (::scrollTouch.isInitialized) scrollTouch.cancel() if (::padMouse.isInitialized) padMouse.reset() resumed = false + boostGpuClock(false) updateKeyboardRoute() updatePointerCapture() updatePadMotion() @@ -7006,6 +7027,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde super.onWindowFocusChanged(hasFocus) if (!hasFocus) com.droiddeck.launcher.input.HomeButtonShortcuts.cancel(this) if (!hasFocus) backQamInput.cancel() + if (!hasFocus) backTaps.cancel() if (!hasFocus) mouseBackInput.cancel() if (!hasFocus && ::padMouse.isInitialized) padMouse.reset() if (runtimeRemovalBlocked) return @@ -7079,8 +7101,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde if (runtimeRemovalBlocked) { super.onDestroy(); return } watching = false releaseDrawerDirection() - pendingBackAction?.let(uiHandler::removeCallbacks) - pendingBackAction = null + backTaps.cancel() if (::pip.isInitialized) pip.destroyed() closeSecondScreen(reset = false) glassesScope.cancel() diff --git a/app/src/main/java/com/droiddeck/launcher/input/BackQamInput.kt b/app/src/main/java/com/droiddeck/launcher/input/BackQamInput.kt index 54ae373ae2..3925109a28 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/BackQamInput.kt +++ b/app/src/main/java/com/droiddeck/launcher/input/BackQamInput.kt @@ -6,18 +6,15 @@ import android.os.Looper class BackQamInput(private val setPressed: (Boolean) -> Unit, private val onTap: (Boolean) -> Unit, private val doubleTapMs: () -> Long = { 500 }, private val onCancel: () -> Unit = {}, - private val holds: () -> Boolean = { true }) { + private val holds: () -> Boolean = { true }, atOnce: () -> Boolean = { false }, sameAction: () -> Boolean = { false }) { private class Press(val hold: Runnable, var held: Boolean = false, var used: Boolean = false) private val handler = Handler(Looper.getMainLooper()) private val presses = mutableMapOf() private val cancelled = mutableSetOf() - private var tapPending = false - private val singleTap = Runnable { tapPending = false; onTap(false) } + private val taps = BackTaps(doubleTapMs, atOnce, onTap, sameAction) + val awaitingTap: Boolean get() = taps.pending - private fun cancelTap() { - handler.removeCallbacks(singleTap) - tapPending = false - } + fun cancelTap() = taps.cancel() fun onChordInput() { if (presses.isEmpty()) return @@ -46,7 +43,7 @@ class BackQamInput(private val setPressed: (Boolean) -> Unit, private val onTap: cancelled.remove(device) if (!enabled || event.isCanceled) return false if (device in presses) return true - handler.removeCallbacks(singleTap) + taps.hold() val hold = Runnable { val press = presses[device] ?: return@Runnable if (!holds()) { press.used = true; cancelTap(); return@Runnable } @@ -66,10 +63,8 @@ class BackQamInput(private val setPressed: (Boolean) -> Unit, private val onTap: if (press != null) { handler.removeCallbacks(press.hold) if (press.held && presses.values.none { it.held }) setPressed(false) - if (!press.used && !event.isCanceled) { - if (tapPending) { cancelTap(); onTap(true) } - else { tapPending = true; handler.postDelayed(singleTap, doubleTapMs()) } - } else if (event.isCanceled) cancelTap() + if (!press.used && !event.isCanceled) taps.tap() + else if (event.isCanceled) cancelTap() } press != null || wasCancelled || enabled } @@ -77,8 +72,8 @@ class BackQamInput(private val setPressed: (Boolean) -> Unit, private val onTap: } } - fun cancel() { - cancelTap() + fun cancel(keepTap: Boolean = false) { + if (!keepTap) cancelTap() val wasHeld = presses.values.any { it.held } presses.values.forEach { handler.removeCallbacks(it.hold) } cancelled.addAll(presses.keys) diff --git a/app/src/main/java/com/droiddeck/launcher/input/BackTaps.kt b/app/src/main/java/com/droiddeck/launcher/input/BackTaps.kt new file mode 100644 index 0000000000..4328148bea --- /dev/null +++ b/app/src/main/java/com/droiddeck/launcher/input/BackTaps.kt @@ -0,0 +1,39 @@ +package com.droiddeck.launcher.input + +import android.os.Handler +import android.os.Looper + +class BackTaps( + private val windowMs: () -> Long, + private val atOnce: () -> Boolean, + private val onTap: (Boolean) -> Unit, + private val sameAction: () -> Boolean = { false }, +) { + private val handler = Handler(Looper.getMainLooper()) + private var deferred = false + var pending = false + private set + private val expire = Runnable { + pending = false + if (deferred) onTap(false) + } + + fun tap() { + if (pending) { + cancel() + if (deferred || !sameAction()) onTap(true) + return + } + pending = true + deferred = !atOnce() + handler.postDelayed(expire, windowMs()) + if (!deferred) onTap(false) + } + + fun hold() = handler.removeCallbacks(expire) + + fun cancel() { + handler.removeCallbacks(expire) + pending = false + } +} diff --git a/app/src/main/java/com/droiddeck/launcher/session/GpuClockPin.kt b/app/src/main/java/com/droiddeck/launcher/session/GpuClockPin.kt index e02b3e7bfa..1e0d30828e 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/GpuClockPin.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/GpuClockPin.kt @@ -18,10 +18,24 @@ object GpuClockPin { var failed = false private set - val supported: Boolean by lazy { File(KGSL_NODE).exists() } + var supported: Boolean = File(KGSL_NODE).exists() + internal set + + internal var turbo: (Boolean) -> Unit = { WaylandCompositor.nativeSetGpuTurbo(it) } private var live = false + @Volatile + private var boosted = false + + private fun wanted(context: Context) = boosted || SessionPrefs.gpuClockPin(context) + + fun boost(on: Boolean): Boolean { + if (boosted == on) return false + boosted = on + return true + } + @Synchronized fun start(context: Context): String { live = true @@ -30,11 +44,11 @@ object GpuClockPin { private fun hold(context: Context): String { failed = false - if (!SessionPrefs.gpuClockPin(context)) return "gpu clock: governed" + if (!wanted(context)) return "gpu clock: governed" if (!supported) return "gpu clock: no $KGSL_NODE, left governed" return try { File(context.filesDir, MARKER).createNewFile() - WaylandCompositor.nativeSetGpuTurbo(true) + turbo(true) pinned = true "gpu clock: held at its top" } catch (t: Throwable) { @@ -48,13 +62,14 @@ object GpuClockPin { @Synchronized fun sync(context: Context): String? { if (!live) return null - if (!SessionPrefs.gpuClockPin(context) && pinned) clear(context) + if (!wanted(context) && pinned) clear(context) return hold(context) } @Synchronized fun stop(context: Context) { live = false + boosted = false if (pinned) clear(context) } @@ -66,7 +81,7 @@ object GpuClockPin { private fun clear(context: Context) { if (supported) { try { - WaylandCompositor.nativeSetGpuTurbo(false) + turbo(false) } catch (t: Throwable) { Log.w(TAG, "clear", t) } diff --git a/app/src/test/java/com/droiddeck/launcher/input/BackQamInputTest.kt b/app/src/test/java/com/droiddeck/launcher/input/BackQamInputTest.kt index db813c62df..7a36fe01b0 100644 --- a/app/src/test/java/com/droiddeck/launcher/input/BackQamInputTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/input/BackQamInputTest.kt @@ -63,6 +63,46 @@ class BackQamInputTest { } } + @Test fun anAtOnceSingleTapActsOnReleaseAndADoubleTapStillFollows() { + val direct = BackQamInput(changes::add, taps::add, atOnce = { true }) + fun press(action: Int) = direct.onKeyEvent(KeyEvent(action, KeyEvent.KEYCODE_BACK), true) + press(KeyEvent.ACTION_DOWN) + assertTrue(taps.isEmpty()) + press(KeyEvent.ACTION_UP) + assertEquals(listOf(false), taps) + assertTrue(direct.awaitingTap) + advance(300) + press(KeyEvent.ACTION_DOWN) + advance(400) + assertTrue(direct.awaitingTap) + press(KeyEvent.ACTION_UP) + assertEquals(listOf(false, true), taps) + assertFalse(direct.awaitingTap) + assertTrue(changes.isEmpty()) + } + + @Test fun cancellingOnlyTheTapKeepsAPressThatIsAlreadyDown() { + val direct = BackQamInput(changes::add, taps::add, atOnce = { true }) + fun press(action: Int) = direct.onKeyEvent(KeyEvent(action, KeyEvent.KEYCODE_BACK), true) + press(KeyEvent.ACTION_DOWN) + press(KeyEvent.ACTION_UP) + advance(100) + press(KeyEvent.ACTION_DOWN) + direct.cancelTap() + assertFalse(direct.awaitingTap) + press(KeyEvent.ACTION_UP) + assertEquals(listOf(false, false), taps) + } + + @Test fun anAtOnceTapStopsAwaitingWhenTheWindowEnds() { + val direct = BackQamInput(changes::add, taps::add, atOnce = { true }) + direct.onKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK), true) + direct.onKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK), true) + advance(500) + assertFalse(direct.awaitingTap) + assertEquals(listOf(false), taps) + } + @Test fun aHoldStartsAt700msAndNeverProducesATap() { assertTrue(send(KeyEvent.ACTION_DOWN)) advance(699) @@ -191,6 +231,19 @@ class BackQamInputTest { assertTrue(taps.isEmpty()) } + @Test fun cancellingHeldInputCanKeepThePendingTapForTheDoubleAction() { + val direct = BackQamInput(changes::add, taps::add, atOnce = { true }) + fun press(action: Int) = direct.onKeyEvent(KeyEvent(action, KeyEvent.KEYCODE_BACK), true) + press(KeyEvent.ACTION_DOWN) + press(KeyEvent.ACTION_UP) + direct.cancel(keepTap = true) + assertTrue(direct.awaitingTap) + press(KeyEvent.ACTION_DOWN) + press(KeyEvent.ACTION_UP) + assertEquals(listOf(false, true), taps) + assertFalse(direct.awaitingTap) + } + @Test fun cancellationAlsoDiscardsAPendingSingleTap() { send(KeyEvent.ACTION_DOWN) send(KeyEvent.ACTION_UP) diff --git a/app/src/test/java/com/droiddeck/launcher/input/BackTapsTest.kt b/app/src/test/java/com/droiddeck/launcher/input/BackTapsTest.kt new file mode 100644 index 0000000000..52700c89f4 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/input/BackTapsTest.kt @@ -0,0 +1,133 @@ +package com.droiddeck.launcher.input + +import android.os.Looper +import java.time.Duration +import org.junit.Assert.* +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.Shadows.shadowOf +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [34], manifest = Config.NONE) +class BackTapsTest { + private val seen = mutableListOf() + private var atOnce = true + private var window = 500L + private val taps = BackTaps({ window }, { atOnce }, seen::add) + + @Test fun aSingleTapActsWithoutWaitingForTheWindow() { + taps.tap() + assertEquals(listOf(false), seen) + assertTrue(taps.pending) + advance(500) + assertEquals(listOf(false), seen) + assertFalse(taps.pending) + } + + @Test fun aSecondTapInsideTheWindowAddsTheDoubleAction() { + taps.tap() + advance(499) + taps.tap() + assertEquals(listOf(false, true), seen) + assertFalse(taps.pending) + advance(1000) + assertEquals(listOf(false, true), seen) + } + + @Test fun aTapAfterTheWindowIsANewSingleTap() { + taps.tap() + advance(500) + taps.tap() + assertEquals(listOf(false, false), seen) + } + + @Test fun aDeferredSingleTapWaitsForTheWindow() { + atOnce = false + taps.tap() + advance(499) + assertTrue(seen.isEmpty()) + advance(1) + assertEquals(listOf(false), seen) + } + + @Test fun aDeferredDoubleTapProducesOnlyTheDoubleAction() { + atOnce = false + taps.tap() + advance(100) + taps.tap() + advance(1000) + assertEquals(listOf(true), seen) + } + + @Test fun theConfiguredWindowAppliesInBothModes() { + for (mode in listOf(true, false)) for (ms in listOf(100L, 800L)) { + seen.clear() + atOnce = mode + window = ms + taps.tap() + advance(ms - 1) + taps.tap() + assertEquals(true, seen.last()) + advance(ms) + assertFalse(taps.pending) + } + } + + @Test fun holdKeepsTheWindowOpenUntilTheNextTap() { + taps.tap() + advance(400) + taps.hold() + advance(5000) + assertTrue(taps.pending) + taps.tap() + assertEquals(listOf(false, true), seen) + } + + @Test fun cancelDropsADeferredTapAndClosesTheWindow() { + atOnce = false + taps.tap() + taps.cancel() + advance(1000) + assertTrue(seen.isEmpty()) + assertFalse(taps.pending) + taps.tap() + advance(500) + assertEquals(listOf(false), seen) + } + + @Test fun aDoubleTapWhoseActionMatchesTheImmediateSingleTapIsNotRepeated() { + var same = true + val coalesced = BackTaps({ window }, { atOnce }, seen::add, { same }) + coalesced.tap() + coalesced.tap() + assertEquals(listOf(false), seen) + assertFalse(coalesced.pending) + same = false + coalesced.tap() + coalesced.tap() + assertEquals(listOf(false, false, true), seen) + } + + @Test fun aDeferredDoubleTapStillActsWhenBothActionsMatch() { + atOnce = false + val coalesced = BackTaps({ window }, { atOnce }, seen::add, { true }) + coalesced.tap() + coalesced.tap() + advance(1000) + assertEquals(listOf(true), seen) + } + + @Test fun aHeldTapCancelledBeforeItsReleaseLeavesTheNextTapASingleTap() { + val coalesced = BackTaps({ window }, { atOnce }, seen::add, { true }) + coalesced.tap() + coalesced.hold() + coalesced.cancel() + advance(5000) + coalesced.tap() + assertEquals(listOf(false, false), seen) + } + + private fun advance(ms: Long) = shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(ms)) +} diff --git a/app/src/test/java/com/droiddeck/launcher/session/GpuClockPinTest.kt b/app/src/test/java/com/droiddeck/launcher/session/GpuClockPinTest.kt index 3311df0501..fb081fd847 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/GpuClockPinTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/GpuClockPinTest.kt @@ -2,7 +2,9 @@ package com.droiddeck.launcher.session import org.junit.After import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse import org.junit.Assert.assertNull +import org.junit.Assert.assertTrue import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @@ -14,7 +16,21 @@ import org.robolectric.annotation.Config class GpuClockPinTest { private val context = RuntimeEnvironment.getApplication() - @After fun stop() { GpuClockPin.stop(context) } + private val calls = mutableListOf() + private val node = GpuClockPin.supported + private val turbo = GpuClockPin.turbo + + @After fun stop() { + GpuClockPin.stop(context) + GpuClockPin.supported = node + GpuClockPin.turbo = turbo + SessionPrefs.setGpuClockPin(context, false) + } + + private fun fakeGpu() { + GpuClockPin.supported = true + GpuClockPin.turbo = { calls += it } + } @Test fun aToggleOutsideASessionSaysNothing() { SessionPrefs.setGpuClockPin(context, true) @@ -31,4 +47,52 @@ class GpuClockPinTest { SessionPrefs.setGpuClockPin(context, false) assertEquals(started, GpuClockPin.sync(context)) } + + @Test fun aBoostHoldsTheClockOnlyWhileItLasts() { + fakeGpu() + assertEquals("gpu clock: governed", GpuClockPin.start(context)) + assertTrue(GpuClockPin.boost(true)) + assertEquals("gpu clock: held at its top", GpuClockPin.sync(context)) + assertFalse(GpuClockPin.boost(true)) + assertTrue(GpuClockPin.boost(false)) + assertEquals("gpu clock: governed", GpuClockPin.sync(context)) + assertEquals(listOf(true, false), calls) + } + + @Test fun endingABoostKeepsTheHoldTheUserTurnedOn() { + fakeGpu() + SessionPrefs.setGpuClockPin(context, true) + GpuClockPin.start(context) + GpuClockPin.boost(true) + GpuClockPin.sync(context) + GpuClockPin.boost(false) + assertEquals("gpu clock: held at its top", GpuClockPin.sync(context)) + assertFalse(false in calls) + } + + @Test fun aBoostOutsideASessionDoesNothing() { + fakeGpu() + GpuClockPin.boost(true) + assertNull(GpuClockPin.sync(context)) + assertTrue(calls.isEmpty()) + } + + @Test fun aBoostDoesNotOutliveItsSession() { + fakeGpu() + GpuClockPin.start(context) + GpuClockPin.boost(true) + GpuClockPin.sync(context) + GpuClockPin.stop(context) + assertEquals("gpu clock: governed", GpuClockPin.start(context)) + assertEquals(listOf(true, false), calls) + } + + @Test fun aBoostWithoutTheGpuNodeLeavesTheClockGoverned() { + GpuClockPin.supported = false + GpuClockPin.turbo = { calls += it } + GpuClockPin.start(context) + GpuClockPin.boost(true) + assertEquals("gpu clock: no /dev/kgsl-3d0, left governed", GpuClockPin.sync(context)) + assertTrue(calls.isEmpty()) + } } From d750412e0f121dcfe98cd1e47f3b48c4826d2daf Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:38:14 -0400 Subject: [PATCH 055/120] Repeat right-stick scrolling while held and stop safely --- .../droiddeck/launcher/FrontEndActivity.kt | 85 +++++++++++++------ 1 file changed, 61 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index 92c3acff44..fab18bd103 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2209,7 +2209,54 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet private val triggerKeys = com.droiddeck.launcher.input.TriggerKeys { dispatchKeyEvent(it) } private val rightStickLayouts = HashMap() + private val rightStickScrollHandler = android.os.Handler(android.os.Looper.getMainLooper()) private var rightStickScrollAt = 0L + private var rightStickScrollDeviceId = android.view.InputDevice.INVALID_DEVICE_ID + private var rightStickScrollDeflection = 0f + private val rightStickScrollTick = object : Runnable { + override fun run() { + val deviceId = rightStickScrollDeviceId + if (!hasWindowFocus() || deviceId == android.view.InputDevice.INVALID_DEVICE_ID || + android.view.InputDevice.getDevice(deviceId) == null || + kotlin.math.abs(rightStickScrollDeflection) < 0.55f) { + stopRightStickScroll() + return + } + dispatchRightStickScroll(rightStickScrollDeflection, deviceId) + rightStickScrollHandler.postDelayed(this, 130L) + } + } + + private fun stopRightStickScroll() { + rightStickScrollHandler.removeCallbacks(rightStickScrollTick) + rightStickScrollDeviceId = android.view.InputDevice.INVALID_DEVICE_ID + rightStickScrollDeflection = 0f + } + + private fun dispatchRightStickScroll(value: Float, deviceId: Int) { + val now = android.os.SystemClock.uptimeMillis() + val root = window.decorView + if (root.width <= 0 || root.height <= 0) return + val properties = android.view.MotionEvent.PointerProperties().apply { + id = 0 + toolType = android.view.MotionEvent.TOOL_TYPE_MOUSE + } + val coordinates = android.view.MotionEvent.PointerCoords().apply { + x = root.width * 0.65f + y = root.height * 0.5f + setAxisValue(android.view.MotionEvent.AXIS_VSCROLL, -value * 3f) + } + val scroll = android.view.MotionEvent.obtain( + now, now, android.view.MotionEvent.ACTION_SCROLL, 1, + arrayOf(properties), arrayOf(coordinates), 0, 0, 1f, 1f, + deviceId, 0, android.view.InputDevice.SOURCE_MOUSE, 0, + ) + try { + super.dispatchGenericMotionEvent(scroll) + } finally { + scroll.recycle() + } + } private fun scrollPageWithRightStick(event: android.view.MotionEvent): Boolean { if (event.actionMasked != android.view.MotionEvent.ACTION_MOVE || @@ -2219,31 +2266,15 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet ?: return false val axis = if (rxRy) android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ val value = event.getAxisValue(axis) - if (kotlin.math.abs(value) < 0.55f) return false - val now = android.os.SystemClock.uptimeMillis() - if (now - rightStickScrollAt < 130L) return true - rightStickScrollAt = now - - val properties = android.view.MotionEvent.PointerProperties().apply { - id = 0 - toolType = android.view.MotionEvent.TOOL_TYPE_MOUSE + if (kotlin.math.abs(value) < 0.55f) { + if (rightStickScrollDeviceId == event.deviceId) stopRightStickScroll() + return false } - val root = window.decorView - if (root.width <= 0 || root.height <= 0) return true - val coordinates = android.view.MotionEvent.PointerCoords().apply { - x = root.width * 0.65f - y = root.height * 0.5f - setAxisValue(android.view.MotionEvent.AXIS_VSCROLL, -value * 3f) - } - val scroll = android.view.MotionEvent.obtain( - now, now, android.view.MotionEvent.ACTION_SCROLL, 1, - arrayOf(properties), arrayOf(coordinates), 0, 0, 1f, 1f, - event.deviceId, 0, android.view.InputDevice.SOURCE_MOUSE, 0, - ) - try { - super.dispatchGenericMotionEvent(scroll) - } finally { - scroll.recycle() + rightStickScrollDeviceId = event.deviceId + rightStickScrollDeflection = value + if (!rightStickScrollHandler.hasCallbacks(rightStickScrollTick)) { + dispatchRightStickScroll(value, event.deviceId) + rightStickScrollHandler.postDelayed(rightStickScrollTick, 130L) } return true } @@ -2256,7 +2287,13 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet return super.dispatchGenericMotionEvent(event) } + override fun onWindowFocusChanged(hasFocus: Boolean) { + super.onWindowFocusChanged(hasFocus) + if (!hasFocus) stopRightStickScroll() + } + override fun onPause() { + stopRightStickScroll() compatLaunchVisible = false if (android.os.Build.VERSION.SDK_INT >= 29) com.droiddeck.launcher.ui.DualScreenPanel.ownerPaused(taskId, true) super.onPause() From 3e32e71af41cfeaafcea295e09f91444a97b3f15 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:38:20 -0400 Subject: [PATCH 056/120] Avoid newer Handler callback API for scroll ticks --- .../main/java/com/droiddeck/launcher/FrontEndActivity.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index fab18bd103..aae1f0976a 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2213,6 +2213,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet private var rightStickScrollAt = 0L private var rightStickScrollDeviceId = android.view.InputDevice.INVALID_DEVICE_ID private var rightStickScrollDeflection = 0f + private var rightStickScrollScheduled = false private val rightStickScrollTick = object : Runnable { override fun run() { val deviceId = rightStickScrollDeviceId @@ -2222,8 +2223,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet stopRightStickScroll() return } + rightStickScrollScheduled = false dispatchRightStickScroll(rightStickScrollDeflection, deviceId) rightStickScrollHandler.postDelayed(this, 130L) + rightStickScrollScheduled = true } } @@ -2231,6 +2234,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet rightStickScrollHandler.removeCallbacks(rightStickScrollTick) rightStickScrollDeviceId = android.view.InputDevice.INVALID_DEVICE_ID rightStickScrollDeflection = 0f + rightStickScrollScheduled = false } private fun dispatchRightStickScroll(value: Float, deviceId: Int) { @@ -2272,9 +2276,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet } rightStickScrollDeviceId = event.deviceId rightStickScrollDeflection = value - if (!rightStickScrollHandler.hasCallbacks(rightStickScrollTick)) { + if (!rightStickScrollScheduled) { dispatchRightStickScroll(value, event.deviceId) rightStickScrollHandler.postDelayed(rightStickScrollTick, 130L) + rightStickScrollScheduled = true } return true } From 53bd56429811726a300b76a994398a1a445323bb Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:38:27 -0400 Subject: [PATCH 057/120] Remove obsolete right-stick scroll timestamp --- app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index aae1f0976a..3d3146a3f4 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2210,7 +2210,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet private val triggerKeys = com.droiddeck.launcher.input.TriggerKeys { dispatchKeyEvent(it) } private val rightStickLayouts = HashMap() private val rightStickScrollHandler = android.os.Handler(android.os.Looper.getMainLooper()) - private var rightStickScrollAt = 0L private var rightStickScrollDeviceId = android.view.InputDevice.INVALID_DEVICE_ID private var rightStickScrollDeflection = 0f private var rightStickScrollScheduled = false From ecaec5da0124d360707b8af33a5bc87bd9adb291 Mon Sep 17 00:00:00 2001 From: xlulx <92148312+xlulx@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:40:46 +0300 Subject: [PATCH 058/120] fix(bionic): run games from a DroidDeck-Proton prefix that start through a launcher (#3336) * fix(bionic): run games from a DroidDeck-Proton prefix that start through a launcher Europa Universalis IV, moved from DroidDeck-Proton to DroidDeck-Bionic, never got past its launcher: - The network adapter list (GetAdaptersAddresses) never answered with the layer's default if_nameindex code, so the Paradox Launcher waited forever. launch.sh sets WINE_NEW_NDIS=1 (the layer's getifaddrs code); a game's environment can still set 0. - The game reported "Steam not detected": the prefix still named Proton's steam.exe (PID 0x20) as Steam's running client, and here that PID is the program Steam started, which quits after starting the game. launch.sh writes the PID this tool's own prefixes carry (0xfffe) before Wine starts. - Its Workshop mod was missing: DroidDeck-Proton's s: drive names the guest path of the Steam library, which this Wine cannot follow. proton gives the prefix's guest drive links their Android paths for the launch; a session's start gives them their guest paths back. * fix(bionic): give each launch its own temporary file for the registry and drive rewrites --- tools/bionic-runtime/tool/launch.sh | 18 +++++++++++ tools/bionic-runtime/tool/proton | 16 ++++++++++ tools/tests/test_bionic_paths.py | 47 +++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/tools/bionic-runtime/tool/launch.sh b/tools/bionic-runtime/tool/launch.sh index b6821f7e85..8e52a857da 100644 --- a/tools/bionic-runtime/tool/launch.sh +++ b/tools/bionic-runtime/tool/launch.sh @@ -109,6 +109,9 @@ export NTSYNC_SHM=$COMPAT/ntsync-shm # DroidDeck's Force SSBS (its glibc libssbs.so preload) is bionic Wine's own WINE_FORCE_SSBS on "${DROIDDECK_FORCE_SSBS:-}" && export WINE_FORCE_SSBS=1 export HODLL=libwow64fex.dll WINEDEBUG=err+all,fixme-all +# The network adapter list (GetAdaptersAddresses) from the layer's getifaddrs code: its default if_nameindex code never +# answered here, and the Paradox Launcher (Europa Universalis IV) waited on it forever. +export WINE_NEW_NDIS=${WINE_NEW_NDIS:-1} export XENVIRONMENT=$TOOL/bionic/Xdefaults # The adapter's Wayland swapchain gets its buffers back from gamescope later than DroidDeck-Proton's Turnip does; # with gamescope's default three images the game waits for one about a fifth of the time at high frame rates. @@ -306,6 +309,21 @@ if [ "$verb" != runinprefix ] && prefix_busy; then fi prefix_busy || rm -f "$NTSYNC_SHM".v* +# Steam's running client, as a game's steam_api checks it: Proton names its steam.exe (the prefix's first program, +# alive while the game runs), which this tool does not start. Here the first program is the one Steam started, so a +# launcher that starts the game and quits (EU4's dowser.exe) left a game that reported "Steam not detected". The +# PID is the one this tool's own prefixes carry. +steam_pid() { + R=$COMPAT/pfx/user.reg + [ -f "$R" ] || return 0 + awk '/^\[/ { on = index($0, "[Software\\\\Valve\\\\Steam\\\\ActiveProcess]") == 1 } + on && /^"PID"=dword:/ && $0 != "\"PID\"=dword:0000fffe" { found = 1 } END { exit !found }' "$R" || return 0 + awk '/^\[/ { on = index($0, "[Software\\\\Valve\\\\Steam\\\\ActiveProcess]") == 1 } + on && /^"PID"=dword:/ { print "\"PID\"=dword:0000fffe"; next } { print }' "$R" > "$R.dd-new.$$" && mv -f "$R.dd-new.$$" "$R" && + echo "$(date +%H:%M:%S) Steam's process ID in the registry set to this tool's" +} +prefix_busy || steam_pid + # Links into a tool that is gone (an older DroidDeck-Bionic, a deleted DroidDeck-Proton) or to a file it no longer has. # Wine's update cannot write over them, so drivers (network, controller) and other files stay missing. Drop them and # clear both stamps: prepare_prefix relinks this tool's files and Wine's update puts its own back. diff --git a/tools/bionic-runtime/tool/proton b/tools/bionic-runtime/tool/proton index ef957b1bca..a054905b2f 100644 --- a/tools/bionic-runtime/tool/proton +++ b/tools/bionic-runtime/tool/proton @@ -36,6 +36,21 @@ zpath() { esac } +# Drive links of the prefix in compatdata folder $1 that name guest paths (DroidDeck-Proton's s: for the Steam library) +# -> their Android paths, which this Wine follows. A game's mods on S: were missing otherwise. A session's start +# gives them their guest paths back (NativeGuest.relinkPrefixDrives); z: is launch.sh's. +android_drives() { + local d t a + for d in "$1"/pfx/dosdevices/[a-y]:; do + [ -L "$d" ] || continue + t=$(readlink "$d") + case "$t" in /*) ;; *) continue ;; esac + a=$(real "$t") + [ "$a" = "$t" ] && continue + ln -sfn "$a" "$d.dd-new.$$" && mv -fT "$d.dd-new.$$" "$d" && echo "drive ${d##*/} -> $a" + done +} + # Where a game launch's log goes in DroidDeck's session folder (Share logs takes that folder): the game's log folder # when Detailed graphics logs made one (droiddeck-game-env), else a folder of its own; nothing for other verbs session_logs() { @@ -109,6 +124,7 @@ print(" ".join(sorted(n for n in names if re.fullmatch(r"[A-Za-z_][A-Za-z0-9_]*" PY ) export DROIDDECK_BIONIC_KEEP + [ -n "${STEAM_COMPAT_DATA_PATH:-}" ] && android_drives "$STEAM_COMPAT_DATA_PATH" >&2 exec /system/bin/sh "$tool/bionic/launch.sh" "$verb" "$compat" "$exe" ${args[@]+"${args[@]}"} ;; getcompatpath) p=$(real "${1:-}") diff --git a/tools/tests/test_bionic_paths.py b/tools/tests/test_bionic_paths.py index 1e50a7a477..55c371b303 100644 --- a/tools/tests/test_bionic_paths.py +++ b/tools/tests/test_bionic_paths.py @@ -144,6 +144,53 @@ class LaunchLog(unittest.TestCase): self.assertIn('DXVK_LOG_PATH=${DXVK_LOG_PATH:-$COMPAT}', text) +class PrefixFromProton(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.compat = Path(self.tmp.name) / 'compatdata/236850' + self.drives = self.compat / 'pfx/dosdevices' + self.drives.mkdir(parents=True) + + def test_guest_drive_links_get_android_paths(self): + for name, target in (('c:', '../drive_c'), ('s:', '/root/.local/share/Steam'), ('d:', '/mnt/sd/Steam'), + ('e:', '/storage/emulated/0/Games'), ('z:', '/')): + os.symlink(target, self.drives / name) + out = proton_function('android_drives "$1"', str(self.compat)) + links = {p.name: os.readlink(p) for p in self.drives.iterdir()} + self.assertEqual({'c:': '../drive_c', 's:': ANDROID + '/root/.local/share/Steam', 'd:': '/storage/1234-5678/Steam/Steam', + 'e:': '/storage/emulated/0/Games', 'z:': '/'}, links) + self.assertEqual(2, len(out.splitlines())) + self.assertEqual('', proton_function('android_drives "$1"', str(self.compat))) + + def test_a_prefix_without_drives_is_left_alone(self): + self.assertEqual('', proton_function('android_drives "$1"', str(Path(self.tmp.name) / 'compatdata/1'))) + + def steam_pid(self, reg): + text = LAUNCH.read_text() + function = text[text.index('steam_pid() {'):text.index('prefix_busy || steam_pid')] + (self.compat / 'pfx/user.reg').write_text(reg) + out = subprocess.run(['sh', '-c', function + 'steam_pid'], env=dict(os.environ, COMPAT=str(self.compat)), + capture_output=True, text=True, check=True).stdout + return out, (self.compat / 'pfx/user.reg').read_text() + + def test_steams_process_id_is_this_tools(self): + reg = ('[Software\\\\Valve\\\\Steam\\\\ActiveProcess] 1795314478\n#time=1dd7a2916a0be94\n"PID"=dword:00000020\n' + '"SteamPath"="C:\\\\Program Files (x86)\\\\Steam"\n\n[Software\\\\Other] 1\n"PID"=dword:00000020\n') + out, after = self.steam_pid(reg) + self.assertIn('process ID', out) + self.assertEqual(reg.replace('"PID"=dword:00000020', '"PID"=dword:0000fffe', 1), after) + out, again = self.steam_pid(after) + self.assertEqual(('', after), (out, again)) + + def test_a_prefix_without_steams_key_is_unchanged(self): + reg = '[Software\\\\Wine] 1\n"PID"=dword:00000020\n' + self.assertEqual(('', reg), self.steam_pid(reg)) + + def test_the_network_list_uses_getifaddrs(self): + self.assertIn('export WINE_NEW_NDIS=${WINE_NEW_NDIS:-1}', LAUNCH.read_text()) + + class StorePaths(unittest.TestCase): def setUp(self): self.tmp = tempfile.TemporaryDirectory() From 1a22d2a1bedd226f320957730a75b168e16f2e1e Mon Sep 17 00:00:00 2001 From: The412Banner <205237651+The412Banner@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:01:15 -0500 Subject: [PATCH 059/120] feat(bionic): build DroidDeck-Bionic on the DroidDeck-Proton 11-14.1 Wine layer (#3389) The tool still packed the 12.8 layer (v16-unwind). The v18 layer is the build of DroidDeck-Proton 11-14.1 Bannerlator ships: Valve Wine a47c73f52fd7, the GE-Proton11-14 picks, and the ARM64EC code-map and unwind fixes 12.8 carried. Same layout as 12.8 (three more files), so only the pin changes. Tools are named DroidDeck-Bionic-14.1-rN; the app's version compare offers 14.1 over 12.8. --- tools/bionic-runtime/build.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/bionic-runtime/build.sh b/tools/bionic-runtime/build.sh index bca9ddbd70..9837fbfd3f 100755 --- a/tools/bionic-runtime/build.sh +++ b/tools/bionic-runtime/build.sh @@ -35,10 +35,11 @@ GAMESCOPE_COMMIT=8f212644c46460549035971ab914421180f61a7c GAMESCOPE_PATCHES="0117-wsi-cache-present-bypass-check.patch 0119-wsi-default-images-under-limiter.patch" VULKAN_HEADERS_TAG=v1.4.341 # The bionic DroidDeck-Proton layer the pack is made for: linked against (libwayland-client) and checked against, not packed. -# Layer v16 (067c719d) plus the ARM64EC code-map fix for 39-bit hosts (d4c9ffa7, run 44291095238). -LAYER_URL=https://github.com/The412Banner/proton-wine/releases/download/build-bionic-layers-20261118-v16-unwind/DroidDeck-Proton-11.0-12.8-arm64ec.wcp -LAYER_SHA256=3cc74b877bc8707d75aa2cc22e335373b6a6c0b6b1937c7b3c2cd98e55de2e89 # proton-wine d48e30a1 (a188791d + fecf7376 on d4c9ffa7) -LAYER_VERSION=12.8 +# Layer v18: DroidDeck-Proton 11-14.1 (Valve Wine a47c73f52fd7, as GE-Proton11-14), the build Bannerlator ships; it +# carries the ARM64EC code-map and unwind fixes the 12.8 layer had (5ebfaa6f, 2515a989, e88fab40). +LAYER_URL=https://github.com/The412Banner/proton-wine/releases/download/build-bionic-layers-20261124-v18/DroidDeck-proton-11.0-14.1-arm64ec.wcp +LAYER_SHA256=bf94176180e96584185835f9e80b168666f9fa752aa9583cfedb8fe493134ff6 # proton-wine 1a5735e7 (run 45926928349) +LAYER_VERSION=14.1 # Packed into the DroidDeck-Bionic tool next to the layer: FEX with Android-built unix libraries, and default # DXVK / VKD3D-Proton (DroidDeck components can swap these in files/lib/wine/{dxvk,vkd3d-proton} later). FEX_URL=https://github.com/The412Banner/Nightlies/releases/download/FEXCore-2611.1/FEXCore-2611.1-unix.wcp From b09e2f9ba746410e18de508c7ce57c1d3ef6cecc Mon Sep 17 00:00:00 2001 From: measlesbagel <49631653+measlesbagel@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:07:50 -0500 Subject: [PATCH 060/120] fix(bionic): pack GStreamer's debug plugin, so game videos play (#3294) winegstreamer puts a capssetter, from the debug plugin, at the front of every video stream's conversion chain. Wine creates it by name at run time, so check-needed.py, which follows linked libraries, could not catch the missing plugin, and those videos played nothing on Bionic. --- tools/bionic-runtime/gst-plugins.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/bionic-runtime/gst-plugins.txt b/tools/bionic-runtime/gst-plugins.txt index cb8941a5ae..8d814116a0 100644 --- a/tools/bionic-runtime/gst-plugins.txt +++ b/tools/bionic-runtime/gst-plugins.txt @@ -1,6 +1,7 @@ # GStreamer plugins packed for winegstreamer (game video/audio), from the imagefs's lib/gstreamer-1.0 by name # (libgst.so): Proton's usual set as far as this imagefs has it (no vpx; videoconvert+videoscale are videoconvertscale). coreelements +debug app audioconvert audiorate From e3ba2bc68da0c47d878990506676b3d38f1f8b9d Mon Sep 17 00:00:00 2001 From: The412Banner <205237651+The412Banner@users.noreply.github.com> Date: Sat, 28 Nov 2026 20:12:18 -0500 Subject: [PATCH 061/120] perf(effects): half-precision upscalers, AMD CAS and a gather-based NIS from Bannerlator (#3391) * perf(effects): half-precision upscalers, AMD CAS and a gather-based NIS from Bannerlator The screen-effect chain ran every upscaler and CAS in fp32, and NIS read its 36-tap support and coefficient tables per pixel. Ported from Bannerlator (The412Banner/Bannerlator 16595ed8 + 671feb8c), where the same shaders run in its Wayland compositor: - SGSR, SGSR HQ, FSR EASU and RCAS get a half-precision build of the same source (-DDD_HALF=1, *_half_frag.h). The divide-by-zero guards DroidDeck added to EASU, RCAS and CAS are kept. - CAS: AMD's FidelityFX CAS (ffx_cas.h v1.0.2, 5-tap), half precision. - NIS: a prepass writes the scene with luma in alpha at scene size (nis_luma.frag); nis3.frag gathers that luma and reads its coefficient banks from a 4 KB uniform buffer (nis_coef.h, set 1 of its own pipeline layout). Without the buffer, NIS falls back to nis.frag. - debug.droiddeck.upscale.shaders=old builds the previous fp32 set, for A/B. The half SGSR, SGSR HQ, CAS, NIS luma and nis3 SPIR-V is identical to Bannerlator's (glslang 16.2.0). Notices: AMD CAS added to THIRD_PARTY_NOTICES.txt; NVIDIA NIS covers the new NIS files. * fix(effects): NIS prepass address at full precision; fast NIS only where it is safe From review: - nis_luma.frag: the half build made gl_FragCoord RelaxedPrecision, so a 16-bit load rounds pixel centres past x = 1024 (1279.5 -> 1280) and texelFetch reads the wrong or an outside texel. Only colour and luma are mediump now; the load and the integer address stay full precision (checked in the SPIR-V). - Fast NIS keeps luma in alpha, so it runs only on chain formats with at least 8 alpha bits; the 10-bit HDR composition format (2-bit alpha) uses nis.frag. - A driver that rejects nis3_half or nis_luma_half gets nis.frag instead of a disabled effects chain. - If the NIS luma target cannot be allocated, that frame uses SGSR from the scene instead of skipping every effect. --- .../main/cpp/shaders/THIRD_PARTY_NOTICES.txt | 15 +- app/src/main/cpp/shaders/cas_ffx.frag | 108 ++ app/src/main/cpp/shaders/cas_ffx_half_frag.h | 214 +++ app/src/main/cpp/shaders/fsr_easu.frag | 45 +- app/src/main/cpp/shaders/fsr_easu_half_frag.h | 1157 ++++++++++++++ app/src/main/cpp/shaders/fsr_rcas.frag | 18 +- app/src/main/cpp/shaders/fsr_rcas_half_frag.h | 641 ++++++++ app/src/main/cpp/shaders/gen_shaders.sh | 34 +- app/src/main/cpp/shaders/nis.frag | 36 +- app/src/main/cpp/shaders/nis3.frag | 357 +++++ app/src/main/cpp/shaders/nis3_half_frag.h | 1364 +++++++++++++++++ app/src/main/cpp/shaders/nis_coef.h | 156 ++ app/src/main/cpp/shaders/nis_luma.frag | 36 + app/src/main/cpp/shaders/nis_luma_half_frag.h | 58 + app/src/main/cpp/shaders/sgsr.frag | 28 +- app/src/main/cpp/shaders/sgsr_half_frag.h | 530 +++++++ app/src/main/cpp/shaders/sgsr_quality.frag | 42 +- .../main/cpp/shaders/sgsr_quality_half_frag.h | 612 ++++++++ .../main/cpp/waylandcomp/src/effects_chain.c | 189 ++- 19 files changed, 5564 insertions(+), 76 deletions(-) create mode 100644 app/src/main/cpp/shaders/cas_ffx.frag create mode 100644 app/src/main/cpp/shaders/cas_ffx_half_frag.h create mode 100644 app/src/main/cpp/shaders/fsr_easu_half_frag.h create mode 100644 app/src/main/cpp/shaders/fsr_rcas_half_frag.h create mode 100644 app/src/main/cpp/shaders/nis3.frag create mode 100644 app/src/main/cpp/shaders/nis3_half_frag.h create mode 100644 app/src/main/cpp/shaders/nis_coef.h create mode 100644 app/src/main/cpp/shaders/nis_luma.frag create mode 100644 app/src/main/cpp/shaders/nis_luma_half_frag.h create mode 100644 app/src/main/cpp/shaders/sgsr_half_frag.h create mode 100644 app/src/main/cpp/shaders/sgsr_quality_half_frag.h diff --git a/app/src/main/cpp/shaders/THIRD_PARTY_NOTICES.txt b/app/src/main/cpp/shaders/THIRD_PARTY_NOTICES.txt index 6e2abb890c..761743c464 100644 --- a/app/src/main/cpp/shaders/THIRD_PARTY_NOTICES.txt +++ b/app/src/main/cpp/shaders/THIRD_PARTY_NOTICES.txt @@ -41,7 +41,20 @@ Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: MIT -The MIT License text above applies to both AMD FidelityFX FSR 1.0 and NVIDIA Image Scaling (NIS). +The NIS luma prepass (nis_luma.frag), the gather-based NIS pass (nis3.frag) and its +coefficient banks (nis_coef.h) are from the same NVIDIA reference. + +AMD FidelityFX CAS (Contrast Adaptive Sharpening) +------------------------------------------------- +The CAS fragment shader (cas_ffx.frag) is ported from AMD's reference header +GPUOpen-Effects/FidelityFX-CAS ffx-cas/ffx_cas.h (v1.0.2). + +Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved. + +SPDX-License-Identifier: MIT + +The MIT License text above applies to AMD FidelityFX FSR 1.0, AMD FidelityFX CAS and +NVIDIA Image Scaling (NIS). Snapdragon Game Super Resolution 1 (SGSR1) ------------------------------------------ diff --git a/app/src/main/cpp/shaders/cas_ffx.frag b/app/src/main/cpp/shaders/cas_ffx.frag new file mode 100644 index 0000000000..9e0b68a1f4 --- /dev/null +++ b/app/src/main/cpp/shaders/cas_ffx.frag @@ -0,0 +1,108 @@ +#version 450 + +// ============================================================================= +// AMD FidelityFX CAS (Contrast Adaptive Sharpening) - sharpen-only path. +// +// Ported from AMD's reference header: +// GPUOpen-Effects/FidelityFX-CAS ffx-cas/ffx_cas.h (v1.0.2, CAS 1.20190610) +// CasSetup() sharpness term + CasFilter() with noScaling == true. +// +// Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved. +// SPDX-License-Identifier: MIT +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +// Adapted in Bannerlator (The412Banner/Bannerlator) for its compositors; here +// in the Wayland effects chain, built half only (cas_ffx_half_frag.h): +// - AMD's default build: CAS_BETTER_DIAGONALS, CAS_SLOW and CAS_GO_SLOWER not +// defined -> the 5-tap "circle" (b d e f h) and the green channel's weight +// for all channels. cas.frag (the previous shader) is the BETTER_DIAGONALS +// + CAS_SLOW maths with 9 taps. +// - APrxLoRcp / APrxLoSqrt / APrxMedRcp (bit-trick approximations for AMD +// ALUs) are plain 1/x and sqrt here. +// - Same push constants as cas.frag: ndc, input size, sharpness [0..1]. +// CasSetup's const1.x = -1 / lerp(8, 5, sharpness) is computed here. +// - The input is the effect chain's previous target at the same size, so the +// output pixel reads the input pixel 1:1 (texelFetch, edges clamped). +// ============================================================================= + +// DD_HALF is set for the *_half_frag.h build (gen_shaders.sh): colour and +// weight maths in mediump (RelaxedPrecision, 16-bit on Adreno) as in AMD's +// CasFilterH; positions stay highp. +#ifdef DD_HALF +precision mediump float; +#define BL_MP mediump +#else +#define BL_MP +#endif + +layout(binding = 0) uniform BL_MP sampler2D InputTexture; + +layout(push_constant) uniform PC { + highp vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0) + highp vec2 resolution; // input (= output) size in pixels + float sharpness; // CAS sharpness [0..1] +} pc; + +layout(location = 0) in highp vec2 fragTexCoord; +layout(location = 0) out vec4 outColor; + +vec3 CasLoad(ivec2 p) { + ivec2 sz = textureSize(InputTexture, 0); + return texelFetch(InputTexture, clamp(p, ivec2(0), sz - ivec2(1)), 0).rgb; +} + +float AMin3F1(float x, float y, float z) { return min(x, min(y, z)); } +float AMax3F1(float x, float y, float z) { return max(x, max(y, z)); } + +void main() { + ivec2 sp = ivec2(fragTexCoord * pc.resolution); + + // CasSetup: sharp = -1 / lerp(8.0, 5.0, saturate(sharpness)). + float peak = -1.0 / mix(8.0, 5.0, clamp(pc.sharpness, 0.0, 1.0)); + + // b + // d e f + // h + vec3 b = CasLoad(sp + ivec2( 0, -1)); + vec3 d = CasLoad(sp + ivec2(-1, 0)); + vec3 e = CasLoad(sp); + vec3 f = CasLoad(sp + ivec2( 1, 0)); + vec3 h = CasLoad(sp + ivec2( 0, 1)); + + // Soft min and max of the circle (green only: the weight below uses green). + float mnG = AMin3F1(AMin3F1(d.g, e.g, f.g), b.g, h.g); + float mxG = AMax3F1(AMax3F1(d.g, e.g, f.g), b.g, h.g); + + // Smooth minimum distance to signal limit divided by smooth max. + // AMD's bit-trick reciprocal stays finite at 0; 1/0 here would give 0 * inf + // on black, so the max is floored (below one 8-bit step; mn = 0 there anyway). + float rcpMG = 1.0 / max(mxG, 1.0 / 1024.0); + float ampG = clamp(min(mnG, 1.0 - mxG) * rcpMG, 0.0, 1.0); + + // Shaping amount of sharpening. + ampG = sqrt(ampG); + + // Filter shape: 0 w 0 / w 1 w / 0 w 0 + float wG = ampG * peak; + float rcpWeight = 1.0 / (1.0 + 4.0 * wG); + vec3 pix = clamp((b * wG + d * wG + f * wG + h * wG + e) * rcpWeight, 0.0, 1.0); + + outColor = vec4(pix, 1.0); +} diff --git a/app/src/main/cpp/shaders/cas_ffx_half_frag.h b/app/src/main/cpp/shaders/cas_ffx_half_frag.h new file mode 100644 index 0000000000..22fbf6119b --- /dev/null +++ b/app/src/main/cpp/shaders/cas_ffx_half_frag.h @@ -0,0 +1,214 @@ + // 1116.2.0 + #pragma once +const uint32_t cas_ffx_half_code[] = { + 0x07230203,0x00010000,0x0008000b,0x000000d7,0x00000000,0x00020011,0x00000001,0x00020011, + 0x00000032,0x0006000b,0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e, + 0x00000000,0x00000001,0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000043, + 0x000000d1,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005, + 0x00000004,0x6e69616d,0x00000000,0x00060005,0x0000000d,0x4c736143,0x2864616f,0x3b326976, + 0x00000000,0x00030005,0x0000000c,0x00000070,0x00070005,0x00000014,0x6e694d41,0x28314633, + 0x663b3166,0x31663b31,0x0000003b,0x00030005,0x00000011,0x00000078,0x00030005,0x00000012, + 0x00000079,0x00030005,0x00000013,0x0000007a,0x00070005,0x00000019,0x78614d41,0x28314633, + 0x663b3166,0x31663b31,0x0000003b,0x00030005,0x00000016,0x00000078,0x00030005,0x00000017, + 0x00000079,0x00030005,0x00000018,0x0000007a,0x00030005,0x0000001b,0x00007a73,0x00060005, + 0x0000001f,0x75706e49,0x78655474,0x65727574,0x00000000,0x00030005,0x00000040,0x00007073, + 0x00060005,0x00000043,0x67617266,0x43786554,0x64726f6f,0x00000000,0x00030005,0x00000045, + 0x00004350,0x00040006,0x00000045,0x00000000,0x0063646e,0x00060006,0x00000045,0x00000001, + 0x6f736572,0x6974756c,0x00006e6f,0x00060006,0x00000045,0x00000002,0x72616873,0x73656e70, + 0x00000073,0x00030005,0x00000047,0x00006370,0x00040005,0x0000004d,0x6b616570,0x00000000, + 0x00030005,0x0000005b,0x00000062,0x00040005,0x00000060,0x61726170,0x0000006d,0x00030005, + 0x00000062,0x00000064,0x00040005,0x00000066,0x61726170,0x0000006d,0x00030005,0x00000068, + 0x00000065,0x00040005,0x00000069,0x61726170,0x0000006d,0x00030005,0x0000006c,0x00000066, + 0x00040005,0x00000070,0x61726170,0x0000006d,0x00030005,0x00000072,0x00000068,0x00040005, + 0x00000076,0x61726170,0x0000006d,0x00030005,0x00000078,0x00476e6d,0x00040005,0x00000079, + 0x61726170,0x0000006d,0x00040005,0x0000007e,0x61726170,0x0000006d,0x00040005,0x00000081, + 0x61726170,0x0000006d,0x00040005,0x00000085,0x61726170,0x0000006d,0x00040005,0x00000086, + 0x61726170,0x0000006d,0x00040005,0x00000089,0x61726170,0x0000006d,0x00030005,0x0000008d, + 0x0047786d,0x00040005,0x0000008e,0x61726170,0x0000006d,0x00040005,0x00000091,0x61726170, + 0x0000006d,0x00040005,0x00000094,0x61726170,0x0000006d,0x00040005,0x00000098,0x61726170, + 0x0000006d,0x00040005,0x00000099,0x61726170,0x0000006d,0x00040005,0x0000009c,0x61726170, + 0x0000006d,0x00040005,0x000000a0,0x4d706372,0x00000047,0x00040005,0x000000a5,0x47706d61, + 0x00000000,0x00030005,0x000000af,0x00004777,0x00050005,0x000000b3,0x57706372,0x68676965, + 0x00000074,0x00030005,0x000000b9,0x00786970,0x00050005,0x000000d1,0x4374756f,0x726f6c6f, + 0x00000000,0x00030047,0x0000000d,0x00000000,0x00030047,0x00000011,0x00000000,0x00030047, + 0x00000012,0x00000000,0x00030047,0x00000013,0x00000000,0x00030047,0x00000014,0x00000000, + 0x00030047,0x00000016,0x00000000,0x00030047,0x00000017,0x00000000,0x00030047,0x00000018, + 0x00000000,0x00030047,0x00000019,0x00000000,0x00030047,0x0000001f,0x00000000,0x00040047, + 0x0000001f,0x00000021,0x00000000,0x00040047,0x0000001f,0x00000022,0x00000000,0x00030047, + 0x00000020,0x00000000,0x00030047,0x00000024,0x00000000,0x00030047,0x0000002e,0x00000000, + 0x00030047,0x0000002f,0x00000000,0x00030047,0x00000032,0x00000000,0x00030047,0x00000033, + 0x00000000,0x00030047,0x00000034,0x00000000,0x00030047,0x00000035,0x00000000,0x00030047, + 0x00000036,0x00000000,0x00030047,0x00000039,0x00000000,0x00030047,0x0000003a,0x00000000, + 0x00030047,0x0000003b,0x00000000,0x00030047,0x0000003c,0x00000000,0x00030047,0x0000003d, + 0x00000000,0x00040047,0x00000043,0x0000001e,0x00000000,0x00030047,0x00000045,0x00000002, + 0x00050048,0x00000045,0x00000000,0x00000023,0x00000000,0x00050048,0x00000045,0x00000001, + 0x00000023,0x00000010,0x00040048,0x00000045,0x00000002,0x00000000,0x00050048,0x00000045, + 0x00000002,0x00000023,0x00000018,0x00030047,0x0000004d,0x00000000,0x00030047,0x00000054, + 0x00000000,0x00030047,0x00000057,0x00000000,0x00030047,0x00000058,0x00000000,0x00030047, + 0x00000059,0x00000000,0x00030047,0x0000005b,0x00000000,0x00030047,0x00000061,0x00000000, + 0x00030047,0x00000062,0x00000000,0x00030047,0x00000067,0x00000000,0x00030047,0x00000068, + 0x00000000,0x00030047,0x0000006b,0x00000000,0x00030047,0x0000006c,0x00000000,0x00030047, + 0x00000071,0x00000000,0x00030047,0x00000072,0x00000000,0x00030047,0x00000077,0x00000000, + 0x00030047,0x00000078,0x00000000,0x00030047,0x00000079,0x00000000,0x00030047,0x0000007d, + 0x00000000,0x00030047,0x0000007e,0x00000000,0x00030047,0x00000080,0x00000000,0x00030047, + 0x00000081,0x00000000,0x00030047,0x00000083,0x00000000,0x00030047,0x00000084,0x00000000, + 0x00030047,0x00000085,0x00000000,0x00030047,0x00000086,0x00000000,0x00030047,0x00000088, + 0x00000000,0x00030047,0x00000089,0x00000000,0x00030047,0x0000008b,0x00000000,0x00030047, + 0x0000008c,0x00000000,0x00030047,0x0000008d,0x00000000,0x00030047,0x0000008e,0x00000000, + 0x00030047,0x00000090,0x00000000,0x00030047,0x00000091,0x00000000,0x00030047,0x00000093, + 0x00000000,0x00030047,0x00000094,0x00000000,0x00030047,0x00000096,0x00000000,0x00030047, + 0x00000097,0x00000000,0x00030047,0x00000098,0x00000000,0x00030047,0x00000099,0x00000000, + 0x00030047,0x0000009b,0x00000000,0x00030047,0x0000009c,0x00000000,0x00030047,0x0000009e, + 0x00000000,0x00030047,0x0000009f,0x00000000,0x00030047,0x000000a0,0x00000000,0x00030047, + 0x000000a1,0x00000000,0x00030047,0x000000a3,0x00000000,0x00030047,0x000000a4,0x00000000, + 0x00030047,0x000000a5,0x00000000,0x00030047,0x000000a6,0x00000000,0x00030047,0x000000a7, + 0x00000000,0x00030047,0x000000a8,0x00000000,0x00030047,0x000000a9,0x00000000,0x00030047, + 0x000000aa,0x00000000,0x00030047,0x000000ab,0x00000000,0x00030047,0x000000ac,0x00000000, + 0x00030047,0x000000ad,0x00000000,0x00030047,0x000000ae,0x00000000,0x00030047,0x000000af, + 0x00000000,0x00030047,0x000000b0,0x00000000,0x00030047,0x000000b1,0x00000000,0x00030047, + 0x000000b2,0x00000000,0x00030047,0x000000b3,0x00000000,0x00030047,0x000000b5,0x00000000, + 0x00030047,0x000000b6,0x00000000,0x00030047,0x000000b7,0x00000000,0x00030047,0x000000b8, + 0x00000000,0x00030047,0x000000b9,0x00000000,0x00030047,0x000000ba,0x00000000,0x00030047, + 0x000000bb,0x00000000,0x00030047,0x000000bc,0x00000000,0x00030047,0x000000bd,0x00000000, + 0x00030047,0x000000be,0x00000000,0x00030047,0x000000bf,0x00000000,0x00030047,0x000000c0, + 0x00000000,0x00030047,0x000000c1,0x00000000,0x00030047,0x000000c2,0x00000000,0x00030047, + 0x000000c3,0x00000000,0x00030047,0x000000c4,0x00000000,0x00030047,0x000000c5,0x00000000, + 0x00030047,0x000000c6,0x00000000,0x00030047,0x000000c7,0x00000000,0x00030047,0x000000c8, + 0x00000000,0x00030047,0x000000c9,0x00000000,0x00030047,0x000000ca,0x00000000,0x00030047, + 0x000000cb,0x00000000,0x00030047,0x000000cc,0x00000000,0x00030047,0x000000cd,0x00000000, + 0x00030047,0x000000ce,0x00000000,0x00030047,0x000000cf,0x00000000,0x00030047,0x000000d1, + 0x00000000,0x00040047,0x000000d1,0x0000001e,0x00000000,0x00030047,0x000000d2,0x00000000, + 0x00030047,0x000000d3,0x00000000,0x00030047,0x000000d4,0x00000000,0x00030047,0x000000d5, + 0x00000000,0x00030047,0x000000d6,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003, + 0x00000002,0x00040015,0x00000006,0x00000020,0x00000001,0x00040017,0x00000007,0x00000006, + 0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00030016,0x00000009,0x00000020, + 0x00040017,0x0000000a,0x00000009,0x00000003,0x00040021,0x0000000b,0x0000000a,0x00000008, + 0x00040020,0x0000000f,0x00000007,0x00000009,0x00060021,0x00000010,0x00000009,0x0000000f, + 0x0000000f,0x0000000f,0x00090019,0x0000001c,0x00000009,0x00000001,0x00000000,0x00000000, + 0x00000000,0x00000001,0x00000000,0x0003001b,0x0000001d,0x0000001c,0x00040020,0x0000001e, + 0x00000000,0x0000001d,0x0004003b,0x0000001e,0x0000001f,0x00000000,0x0004002b,0x00000006, + 0x00000021,0x00000000,0x0005002c,0x00000007,0x00000026,0x00000021,0x00000021,0x0004002b, + 0x00000006,0x00000028,0x00000001,0x0005002c,0x00000007,0x00000029,0x00000028,0x00000028, + 0x00040017,0x0000002d,0x00000009,0x00000004,0x00040017,0x00000041,0x00000009,0x00000002, + 0x00040020,0x00000042,0x00000001,0x00000041,0x0004003b,0x00000042,0x00000043,0x00000001, + 0x0005001e,0x00000045,0x0000002d,0x00000041,0x00000009,0x00040020,0x00000046,0x00000009, + 0x00000045,0x0004003b,0x00000046,0x00000047,0x00000009,0x00040020,0x00000048,0x00000009, + 0x00000041,0x0004002b,0x00000009,0x0000004e,0xbf800000,0x0004002b,0x00000009,0x0000004f, + 0x41000000,0x0004002b,0x00000009,0x00000050,0x40a00000,0x0004002b,0x00000006,0x00000051, + 0x00000002,0x00040020,0x00000052,0x00000009,0x00000009,0x0004002b,0x00000009,0x00000055, + 0x00000000,0x0004002b,0x00000009,0x00000056,0x3f800000,0x00040020,0x0000005a,0x00000007, + 0x0000000a,0x0004002b,0x00000006,0x0000005d,0xffffffff,0x0005002c,0x00000007,0x0000005e, + 0x00000021,0x0000005d,0x0005002c,0x00000007,0x00000064,0x0000005d,0x00000021,0x0005002c, + 0x00000007,0x0000006e,0x00000028,0x00000021,0x0005002c,0x00000007,0x00000074,0x00000021, + 0x00000028,0x00040015,0x0000007a,0x00000020,0x00000000,0x0004002b,0x0000007a,0x0000007b, + 0x00000001,0x0004002b,0x00000009,0x000000a2,0x3a800000,0x0004002b,0x00000009,0x000000b4, + 0x40800000,0x00040020,0x000000d0,0x00000003,0x0000002d,0x0004003b,0x000000d0,0x000000d1, + 0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005, + 0x0004003b,0x00000008,0x00000040,0x00000007,0x0004003b,0x0000000f,0x0000004d,0x00000007, + 0x0004003b,0x0000005a,0x0000005b,0x00000007,0x0004003b,0x00000008,0x00000060,0x00000007, + 0x0004003b,0x0000005a,0x00000062,0x00000007,0x0004003b,0x00000008,0x00000066,0x00000007, + 0x0004003b,0x0000005a,0x00000068,0x00000007,0x0004003b,0x00000008,0x00000069,0x00000007, + 0x0004003b,0x0000005a,0x0000006c,0x00000007,0x0004003b,0x00000008,0x00000070,0x00000007, + 0x0004003b,0x0000005a,0x00000072,0x00000007,0x0004003b,0x00000008,0x00000076,0x00000007, + 0x0004003b,0x0000000f,0x00000078,0x00000007,0x0004003b,0x0000000f,0x00000079,0x00000007, + 0x0004003b,0x0000000f,0x0000007e,0x00000007,0x0004003b,0x0000000f,0x00000081,0x00000007, + 0x0004003b,0x0000000f,0x00000085,0x00000007,0x0004003b,0x0000000f,0x00000086,0x00000007, + 0x0004003b,0x0000000f,0x00000089,0x00000007,0x0004003b,0x0000000f,0x0000008d,0x00000007, + 0x0004003b,0x0000000f,0x0000008e,0x00000007,0x0004003b,0x0000000f,0x00000091,0x00000007, + 0x0004003b,0x0000000f,0x00000094,0x00000007,0x0004003b,0x0000000f,0x00000098,0x00000007, + 0x0004003b,0x0000000f,0x00000099,0x00000007,0x0004003b,0x0000000f,0x0000009c,0x00000007, + 0x0004003b,0x0000000f,0x000000a0,0x00000007,0x0004003b,0x0000000f,0x000000a5,0x00000007, + 0x0004003b,0x0000000f,0x000000af,0x00000007,0x0004003b,0x0000000f,0x000000b3,0x00000007, + 0x0004003b,0x0000005a,0x000000b9,0x00000007,0x0004003d,0x00000041,0x00000044,0x00000043, + 0x00050041,0x00000048,0x00000049,0x00000047,0x00000028,0x0004003d,0x00000041,0x0000004a, + 0x00000049,0x00050085,0x00000041,0x0000004b,0x00000044,0x0000004a,0x0004006e,0x00000007, + 0x0000004c,0x0000004b,0x0003003e,0x00000040,0x0000004c,0x00050041,0x00000052,0x00000053, + 0x00000047,0x00000051,0x0004003d,0x00000009,0x00000054,0x00000053,0x0008000c,0x00000009, + 0x00000057,0x00000001,0x0000002b,0x00000054,0x00000055,0x00000056,0x0008000c,0x00000009, + 0x00000058,0x00000001,0x0000002e,0x0000004f,0x00000050,0x00000057,0x00050088,0x00000009, + 0x00000059,0x0000004e,0x00000058,0x0003003e,0x0000004d,0x00000059,0x0004003d,0x00000007, + 0x0000005c,0x00000040,0x00050080,0x00000007,0x0000005f,0x0000005c,0x0000005e,0x0003003e, + 0x00000060,0x0000005f,0x00050039,0x0000000a,0x00000061,0x0000000d,0x00000060,0x0003003e, + 0x0000005b,0x00000061,0x0004003d,0x00000007,0x00000063,0x00000040,0x00050080,0x00000007, + 0x00000065,0x00000063,0x00000064,0x0003003e,0x00000066,0x00000065,0x00050039,0x0000000a, + 0x00000067,0x0000000d,0x00000066,0x0003003e,0x00000062,0x00000067,0x0004003d,0x00000007, + 0x0000006a,0x00000040,0x0003003e,0x00000069,0x0000006a,0x00050039,0x0000000a,0x0000006b, + 0x0000000d,0x00000069,0x0003003e,0x00000068,0x0000006b,0x0004003d,0x00000007,0x0000006d, + 0x00000040,0x00050080,0x00000007,0x0000006f,0x0000006d,0x0000006e,0x0003003e,0x00000070, + 0x0000006f,0x00050039,0x0000000a,0x00000071,0x0000000d,0x00000070,0x0003003e,0x0000006c, + 0x00000071,0x0004003d,0x00000007,0x00000073,0x00000040,0x00050080,0x00000007,0x00000075, + 0x00000073,0x00000074,0x0003003e,0x00000076,0x00000075,0x00050039,0x0000000a,0x00000077, + 0x0000000d,0x00000076,0x0003003e,0x00000072,0x00000077,0x00050041,0x0000000f,0x0000007c, + 0x00000062,0x0000007b,0x0004003d,0x00000009,0x0000007d,0x0000007c,0x0003003e,0x00000079, + 0x0000007d,0x00050041,0x0000000f,0x0000007f,0x00000068,0x0000007b,0x0004003d,0x00000009, + 0x00000080,0x0000007f,0x0003003e,0x0000007e,0x00000080,0x00050041,0x0000000f,0x00000082, + 0x0000006c,0x0000007b,0x0004003d,0x00000009,0x00000083,0x00000082,0x0003003e,0x00000081, + 0x00000083,0x00070039,0x00000009,0x00000084,0x00000014,0x00000079,0x0000007e,0x00000081, + 0x0003003e,0x00000085,0x00000084,0x00050041,0x0000000f,0x00000087,0x0000005b,0x0000007b, + 0x0004003d,0x00000009,0x00000088,0x00000087,0x0003003e,0x00000086,0x00000088,0x00050041, + 0x0000000f,0x0000008a,0x00000072,0x0000007b,0x0004003d,0x00000009,0x0000008b,0x0000008a, + 0x0003003e,0x00000089,0x0000008b,0x00070039,0x00000009,0x0000008c,0x00000014,0x00000085, + 0x00000086,0x00000089,0x0003003e,0x00000078,0x0000008c,0x00050041,0x0000000f,0x0000008f, + 0x00000062,0x0000007b,0x0004003d,0x00000009,0x00000090,0x0000008f,0x0003003e,0x0000008e, + 0x00000090,0x00050041,0x0000000f,0x00000092,0x00000068,0x0000007b,0x0004003d,0x00000009, + 0x00000093,0x00000092,0x0003003e,0x00000091,0x00000093,0x00050041,0x0000000f,0x00000095, + 0x0000006c,0x0000007b,0x0004003d,0x00000009,0x00000096,0x00000095,0x0003003e,0x00000094, + 0x00000096,0x00070039,0x00000009,0x00000097,0x00000019,0x0000008e,0x00000091,0x00000094, + 0x0003003e,0x00000098,0x00000097,0x00050041,0x0000000f,0x0000009a,0x0000005b,0x0000007b, + 0x0004003d,0x00000009,0x0000009b,0x0000009a,0x0003003e,0x00000099,0x0000009b,0x00050041, + 0x0000000f,0x0000009d,0x00000072,0x0000007b,0x0004003d,0x00000009,0x0000009e,0x0000009d, + 0x0003003e,0x0000009c,0x0000009e,0x00070039,0x00000009,0x0000009f,0x00000019,0x00000098, + 0x00000099,0x0000009c,0x0003003e,0x0000008d,0x0000009f,0x0004003d,0x00000009,0x000000a1, + 0x0000008d,0x0007000c,0x00000009,0x000000a3,0x00000001,0x00000028,0x000000a1,0x000000a2, + 0x00050088,0x00000009,0x000000a4,0x00000056,0x000000a3,0x0003003e,0x000000a0,0x000000a4, + 0x0004003d,0x00000009,0x000000a6,0x00000078,0x0004003d,0x00000009,0x000000a7,0x0000008d, + 0x00050083,0x00000009,0x000000a8,0x00000056,0x000000a7,0x0007000c,0x00000009,0x000000a9, + 0x00000001,0x00000025,0x000000a6,0x000000a8,0x0004003d,0x00000009,0x000000aa,0x000000a0, + 0x00050085,0x00000009,0x000000ab,0x000000a9,0x000000aa,0x0008000c,0x00000009,0x000000ac, + 0x00000001,0x0000002b,0x000000ab,0x00000055,0x00000056,0x0003003e,0x000000a5,0x000000ac, + 0x0004003d,0x00000009,0x000000ad,0x000000a5,0x0006000c,0x00000009,0x000000ae,0x00000001, + 0x0000001f,0x000000ad,0x0003003e,0x000000a5,0x000000ae,0x0004003d,0x00000009,0x000000b0, + 0x000000a5,0x0004003d,0x00000009,0x000000b1,0x0000004d,0x00050085,0x00000009,0x000000b2, + 0x000000b0,0x000000b1,0x0003003e,0x000000af,0x000000b2,0x0004003d,0x00000009,0x000000b5, + 0x000000af,0x00050085,0x00000009,0x000000b6,0x000000b4,0x000000b5,0x00050081,0x00000009, + 0x000000b7,0x00000056,0x000000b6,0x00050088,0x00000009,0x000000b8,0x00000056,0x000000b7, + 0x0003003e,0x000000b3,0x000000b8,0x0004003d,0x0000000a,0x000000ba,0x0000005b,0x0004003d, + 0x00000009,0x000000bb,0x000000af,0x0005008e,0x0000000a,0x000000bc,0x000000ba,0x000000bb, + 0x0004003d,0x0000000a,0x000000bd,0x00000062,0x0004003d,0x00000009,0x000000be,0x000000af, + 0x0005008e,0x0000000a,0x000000bf,0x000000bd,0x000000be,0x00050081,0x0000000a,0x000000c0, + 0x000000bc,0x000000bf,0x0004003d,0x0000000a,0x000000c1,0x0000006c,0x0004003d,0x00000009, + 0x000000c2,0x000000af,0x0005008e,0x0000000a,0x000000c3,0x000000c1,0x000000c2,0x00050081, + 0x0000000a,0x000000c4,0x000000c0,0x000000c3,0x0004003d,0x0000000a,0x000000c5,0x00000072, + 0x0004003d,0x00000009,0x000000c6,0x000000af,0x0005008e,0x0000000a,0x000000c7,0x000000c5, + 0x000000c6,0x00050081,0x0000000a,0x000000c8,0x000000c4,0x000000c7,0x0004003d,0x0000000a, + 0x000000c9,0x00000068,0x00050081,0x0000000a,0x000000ca,0x000000c8,0x000000c9,0x0004003d, + 0x00000009,0x000000cb,0x000000b3,0x0005008e,0x0000000a,0x000000cc,0x000000ca,0x000000cb, + 0x00060050,0x0000000a,0x000000cd,0x00000055,0x00000055,0x00000055,0x00060050,0x0000000a, + 0x000000ce,0x00000056,0x00000056,0x00000056,0x0008000c,0x0000000a,0x000000cf,0x00000001, + 0x0000002b,0x000000cc,0x000000cd,0x000000ce,0x0003003e,0x000000b9,0x000000cf,0x0004003d, + 0x0000000a,0x000000d2,0x000000b9,0x00050051,0x00000009,0x000000d3,0x000000d2,0x00000000, + 0x00050051,0x00000009,0x000000d4,0x000000d2,0x00000001,0x00050051,0x00000009,0x000000d5, + 0x000000d2,0x00000002,0x00070050,0x0000002d,0x000000d6,0x000000d3,0x000000d4,0x000000d5, + 0x00000056,0x0003003e,0x000000d1,0x000000d6,0x000100fd,0x00010038,0x00050036,0x0000000a, + 0x0000000d,0x00000000,0x0000000b,0x00030037,0x00000008,0x0000000c,0x000200f8,0x0000000e, + 0x0004003b,0x00000008,0x0000001b,0x00000007,0x0004003d,0x0000001d,0x00000020,0x0000001f, + 0x00040064,0x0000001c,0x00000022,0x00000020,0x00050067,0x00000007,0x00000023,0x00000022, + 0x00000021,0x0003003e,0x0000001b,0x00000023,0x0004003d,0x0000001d,0x00000024,0x0000001f, + 0x0004003d,0x00000007,0x00000025,0x0000000c,0x0004003d,0x00000007,0x00000027,0x0000001b, + 0x00050082,0x00000007,0x0000002a,0x00000027,0x00000029,0x0008000c,0x00000007,0x0000002b, + 0x00000001,0x0000002d,0x00000025,0x00000026,0x0000002a,0x00040064,0x0000001c,0x0000002c, + 0x00000024,0x0007005f,0x0000002d,0x0000002e,0x0000002c,0x0000002b,0x00000002,0x00000021, + 0x0008004f,0x0000000a,0x0000002f,0x0000002e,0x0000002e,0x00000000,0x00000001,0x00000002, + 0x000200fe,0x0000002f,0x00010038,0x00050036,0x00000009,0x00000014,0x00000000,0x00000010, + 0x00030037,0x0000000f,0x00000011,0x00030037,0x0000000f,0x00000012,0x00030037,0x0000000f, + 0x00000013,0x000200f8,0x00000015,0x0004003d,0x00000009,0x00000032,0x00000011,0x0004003d, + 0x00000009,0x00000033,0x00000012,0x0004003d,0x00000009,0x00000034,0x00000013,0x0007000c, + 0x00000009,0x00000035,0x00000001,0x00000025,0x00000033,0x00000034,0x0007000c,0x00000009, + 0x00000036,0x00000001,0x00000025,0x00000032,0x00000035,0x000200fe,0x00000036,0x00010038, + 0x00050036,0x00000009,0x00000019,0x00000000,0x00000010,0x00030037,0x0000000f,0x00000016, + 0x00030037,0x0000000f,0x00000017,0x00030037,0x0000000f,0x00000018,0x000200f8,0x0000001a, + 0x0004003d,0x00000009,0x00000039,0x00000016,0x0004003d,0x00000009,0x0000003a,0x00000017, + 0x0004003d,0x00000009,0x0000003b,0x00000018,0x0007000c,0x00000009,0x0000003c,0x00000001, + 0x00000028,0x0000003a,0x0000003b,0x0007000c,0x00000009,0x0000003d,0x00000001,0x00000028, + 0x00000039,0x0000003c,0x000200fe,0x0000003d,0x00010038 +}; diff --git a/app/src/main/cpp/shaders/fsr_easu.frag b/app/src/main/cpp/shaders/fsr_easu.frag index 6d97a79fe2..dbc66824eb 100644 --- a/app/src/main/cpp/shaders/fsr_easu.frag +++ b/app/src/main/cpp/shaders/fsr_easu.frag @@ -44,23 +44,40 @@ vec3 AMin3F3(vec3 a, vec3 b, vec3 c) { return min(a, min(b, c)); } vec3 AMax3F3(vec3 a, vec3 b, vec3 c) { return max(a, max(b, c)); } // --------------------------------------------------------------------------- -layout(binding = 0) uniform sampler2D InputTexture; +// DD_HALF is set for the *_half_frag.h build (gen_shaders.sh): colour and +// weight maths in mediump (RelaxedPrecision, 16-bit on Adreno) as in AMD's +// FSR_EASU_H / FSR_RCAS_H paths; positions and texture coordinates stay highp. +#ifdef DD_HALF +precision mediump float; +#define BL_MP mediump +#else +#define BL_MP +#endif +#ifdef DD_HALF +// 1/32768 is a 16-bit subnormal (flushed to 0 where denormals are not kept); +// 1/16384 is the smallest normal one. +#define BL_EASU_DIR_ZERO (1.0/16384.0) +#else +#define BL_EASU_DIR_ZERO (1.0/32768.0) +#endif + +layout(binding = 0) uniform BL_MP sampler2D InputTexture; layout(push_constant) uniform PC { - vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0) + highp vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0) uvec4 con0; uvec4 con1; uvec4 con2; uvec4 con3; - vec2 outputSize; // EASU output (this pass's render-target) size in pixels + highp vec2 outputSize; // EASU output (this pass's render-target) size in pixels } pc; -layout(location = 0) in vec2 fragTexCoord; +layout(location = 0) in highp vec2 fragTexCoord; layout(location = 0) out vec4 outColor; -AF4 FsrEasuRF(AF2 p) { return textureGather(InputTexture, p, 0); } -AF4 FsrEasuGF(AF2 p) { return textureGather(InputTexture, p, 1); } -AF4 FsrEasuBF(AF2 p) { return textureGather(InputTexture, p, 2); } +AF4 FsrEasuRF(highp AF2 p) { return textureGather(InputTexture, p, 0); } +AF4 FsrEasuGF(highp AF2 p) { return textureGather(InputTexture, p, 1); } +AF4 FsrEasuBF(highp AF2 p) { return textureGather(InputTexture, p, 2); } void FsrEasuTapF( inout AF3 aC, @@ -122,13 +139,13 @@ void FsrEasuF( AU4 con1, AU4 con2, AU4 con3){ - AF2 pp=AF2(ip)*AF2_AU2(con0.xy)+AF2_AU2(con0.zw); - AF2 fp=floor(pp); + highp AF2 pp=AF2(ip)*AF2_AU2(con0.xy)+AF2_AU2(con0.zw); + highp AF2 fp=floor(pp); pp-=fp; - AF2 p0=fp*AF2_AU2(con1.xy)+AF2_AU2(con1.zw); - AF2 p1=p0+AF2_AU2(con2.xy); - AF2 p2=p0+AF2_AU2(con2.zw); - AF2 p3=p0+AF2_AU2(con3.xy); + highp AF2 p0=fp*AF2_AU2(con1.xy)+AF2_AU2(con1.zw); + highp AF2 p1=p0+AF2_AU2(con2.xy); + highp AF2 p2=p0+AF2_AU2(con2.zw); + highp AF2 p3=p0+AF2_AU2(con3.xy); AF4 bczzR=FsrEasuRF(p0); AF4 bczzG=FsrEasuGF(p0); AF4 bczzB=FsrEasuBF(p0); @@ -165,7 +182,7 @@ void FsrEasuF( FsrEasuSetF(dir,len,pp,false,false,false,true ,gL,jL,kL,lL,oL); AF2 dir2=dir*dir; AF1 dirR=dir2.x+dir2.y; - AP1 zro=dirR _half_frag.h (array _half_code). The compositors +# pick the plain or the half set at start-up (debug.droiddeck.upscale.shaders). +# Names in HALF_ONLY are built half only. # ============================================================================= set -euo pipefail @@ -22,17 +27,34 @@ if ! command -v glslangValidator >/dev/null 2>&1; then exit 1 fi +HALF=(sgsr sgsr_quality fsr_easu fsr_rcas cas_ffx nis_luma nis3) +HALF_ONLY=(cas_ffx nis_luma nis3) + +in_list() { + local x="$1"; shift + for y in "$@"; do [ "$x" = "$y" ] && return 0; done + return 1 +} + gen() { local src="$1" # e.g. nis.frag local base="${src%.*}" # nis local ext="${src##*.}" # frag | vert - local vn="${base}_code" - if [ "$ext" = "vert" ]; then - vn="${base}_vert_code" + if ! in_list "${base}" "${HALF_ONLY[@]}"; then + local vn="${base}_code" + if [ "$ext" = "vert" ]; then + vn="${base}_vert_code" + fi + local out="${base}_${ext}.h" + echo " ${src} -> ${out} (--vn ${vn})" + glslangValidator -V "${src}" --vn "${vn}" -o "${out}" + fi + if in_list "${base}" "${HALF[@]}"; then + local hvn="${base}_half_code" + local hout="${base}_half_${ext}.h" + echo " ${src} -> ${hout} (--vn ${hvn}, -DDD_HALF=1)" + glslangValidator -V -DDD_HALF=1 "${src}" --vn "${hvn}" -o "${hout}" fi - local out="${base}_${ext}.h" - echo " ${src} -> ${out} (--vn ${vn})" - glslangValidator -V "${src}" --vn "${vn}" -o "${out}" } shaders=() diff --git a/app/src/main/cpp/shaders/nis.frag b/app/src/main/cpp/shaders/nis.frag index 23f9bd5c0a..025fa4f251 100644 --- a/app/src/main/cpp/shaders/nis.frag +++ b/app/src/main/cpp/shaders/nis.frag @@ -36,15 +36,25 @@ // then ViewportInfo (xy = 1/inputSize texel size, zw = inputSize px) + sharpness. // ============================================================================= -layout(binding = 0) uniform sampler2D InputTexture; +// DD_HALF is set for the *_half_frag.h build (gen_shaders.sh): colour and +// weight maths in mediump (RelaxedPrecision, 16-bit on Adreno) as NVIDIA's +// NIS_USE_HALF_PRECISION path (pixels, weights, coefficient tables); positions and texture coordinates stay highp. +#ifdef DD_HALF +precision mediump float; +#define BL_MP mediump +#else +#define BL_MP +#endif + +layout(binding = 0) uniform BL_MP sampler2D InputTexture; layout(push_constant) uniform PC { - vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0) - vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels + highp vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0) + highp vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels float sharpness; // "Sharpness" slider mapped to [0..1] (NIS sharpness) } pc; -layout(location = 0) in vec2 fragTexCoord; +layout(location = 0) in highp vec2 fragTexCoord; layout(location = 0) out vec4 outColor; // ---- SDR (HDR mode None) constants, from NVScalerUpdateConfig ----------------- @@ -405,16 +415,16 @@ void main() { float sharpLimitMax = 0.5 + sharpen_slider * LimitScale * 0.6; gSharpLimitScale = sharpLimitMax - gSharpLimitMin; - vec2 inSize = pc.ViewportInfo.zw; - vec2 invIn = pc.ViewportInfo.xy; + highp vec2 inSize = pc.ViewportInfo.zw; + highp vec2 invIn = pc.ViewportInfo.xy; // Source sample position in input-pixel space (output viewport cancels out). - float srcX = fragTexCoord.x * inSize.x - 0.5; - float srcY = fragTexCoord.y * inSize.y - 0.5; - float fsx = floor(srcX); - float fsy = floor(srcY); - float fx = srcX - fsx; - float fy = srcY - fsy; + highp float srcX = fragTexCoord.x * inSize.x - 0.5; + highp float srcY = fragTexCoord.y * inSize.y - 0.5; + highp float fsx = floor(srcX); + highp float fsy = floor(srcY); + highp float fx = srcX - fsx; + highp float fy = srcY - fsy; int fx_int = int(fx * float(kPhaseCount)); int fy_int = int(fy * float(kPhaseCount)); @@ -422,7 +432,7 @@ void main() { float p[6][6]; for (int i = 0; i < 6; ++i) { for (int j = 0; j < 6; ++j) { - vec2 tc = (vec2(fsx + float(j) - 2.0, fsy + float(i) - 2.0) + 0.5) * invIn; + highp vec2 tc = (vec2(fsx + float(j) - 2.0, fsy + float(i) - 2.0) + 0.5) * invIn; p[i][j] = getY(textureLod(InputTexture, tc, 0.0).rgb); } } diff --git a/app/src/main/cpp/shaders/nis3.frag b/app/src/main/cpp/shaders/nis3.frag new file mode 100644 index 0000000000..4439f7a413 --- /dev/null +++ b/app/src/main/cpp/shaders/nis3.frag @@ -0,0 +1,357 @@ +#version 450 + +// ============================================================================= +// nis3.frag (feat/nis-rewrite): nis.frag's NVScaler maths with +// - the 6x6 luma support read from the nis_luma.frag prepass (luma in alpha) +// by 9 textureGather calls instead of 36 textureLod + getY per pixel; +// - the two coefficient banks in a uniform buffer (set 1, nis_coef.h) instead +// of const arrays: indexed by the per-pixel phase, the 384-entry const arrays +// were copied into a per-pixel variable before every lookup (glslang +// OpStore %indexable), several times per pixel. +// Edge maps and filter maths are nis.frag's. Built half only (nis3_half_frag.h); +// the old set keeps nis.frag. +// ============================================================================= + +// ============================================================================= +// NVIDIA Image Scaling (NIS) - NVScaler spatial upscaler + adaptive sharpen. +// +// Ported from NVIDIA's reference NVScaler: +// NVIDIAGameWorks/NVIDIAImageScaling NIS/NIS_Scaler.h (+ NIS_Config.h) +// +// The MIT License (MIT) +// Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: MIT +// +// Adapted for the Winlator native Vulkan compositor: +// - #version 450 (Vulkan GLSL), single-pass FRAGMENT shader (the reference is +// an LDS-tiled compute shader). The block/LDS cooperative tile loads are +// replaced with direct per-fragment texture() fetches of the 6x6 luma +// support, and the edge map is computed inline from that support. The math +// (edge detection + 6-tap directional scale/USM blend) is the reference's. +// - The kPhaseCount x 6 scaler/USM coefficient banks (coef_scale, coef_usm, +// fp32 path) are BAKED below as const arrays - no second descriptor binding +// (the post dsLayout has ONE sampler at binding 0 shared by all pipelines). +// - Config-UBO reads are replaced by push constants + baked SDR constants; the +// sharpness-derived params are recomputed in-shader exactly as +// NVScalerUpdateConfig does, driven by the existing "Sharpness" slider. +// - fp32 only (NOT the fp16/bit-packed NIS_USE_HALF_PRECISION path) so there +// are no bitwise/bvec ops - Adreno-compile-safe. +// - HDR mode = None (SDR). The whole compositor chain is R8G8B8A8_UNORM and +// values are display(gamma)-encoded here, matching NIS LDR expectations. +// - Reuses upscale.vert: fragTexCoord spans [0,1] across the destination rect +// (= normalised output position). With kScaleX = inputW/outputW, the source +// sample position reduces to srcX = fragTexCoord.x*inputW - 0.5 (so the +// output viewport origin/size cancel out and are never needed here). +// +// Conventions match sgsr.frag / cas.frag: combined-image-sampler at binding 0, +// push-constant block leads with vec4 ndc (offset 0, consumed by upscale.vert), +// then ViewportInfo (xy = 1/inputSize texel size, zw = inputSize px) + sharpness. +// ============================================================================= + +// DD_HALF is set for the *_half_frag.h build (gen_shaders.sh): colour and +// weight maths in mediump (RelaxedPrecision, 16-bit on Adreno) as NVIDIA's +// NIS_USE_HALF_PRECISION path (pixels, weights, coefficient tables); positions and texture coordinates stay highp. +#ifdef DD_HALF +precision mediump float; +#define BL_MP mediump +#else +#define BL_MP +#endif + +layout(binding = 0) uniform BL_MP sampler2D InputTexture; + +layout(push_constant) uniform PC { + highp vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0) + highp vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels + float sharpness; // "Sharpness" slider mapped to [0..1] (NIS sharpness) +} pc; + +layout(location = 0) in highp vec2 fragTexCoord; +layout(location = 0) out vec4 outColor; + +// ---- SDR (HDR mode None) constants, from NVScalerUpdateConfig ----------------- +const float kDetectRatio = 2.0 * 1127.0 / 1024.0; // 2.201171875 +const float kDetectThres = 64.0 / 1024.0; // 0.0625 +const float kMinContrastRatio = 2.0; +const float kMaxContrastRatio = 10.0; +const float kRatioNorm = 1.0 / (kMaxContrastRatio - kMinContrastRatio); // 0.125 +const float kContrastBoost = 1.0; +const float kEps = 1.0 / 255.0; +const float kSharpStartY = 0.45; +const float kSharpEndY = 0.9; +const float kSharpScaleY = 1.0 / (kSharpEndY - kSharpStartY); // 2.222... +const int kPhaseCount = 64; + +// Sharpness-derived params (recomputed in main from pc.sharpness, read here). +float gSharpStrengthMin; +float gSharpStrengthScale; +float gSharpLimitMin; +float gSharpLimitScale; + +// NVIDIA NIS coef_scale / coef_usm (64 phases x 6 taps, the values nis.frag bakes), filled by the +// compositor from nis_coef.h: two vec4 per phase (taps 0-3, taps 4-5 + 2 zeros), std140. +layout(std140, set = 1, binding = 0) uniform NisCoef { + vec4 scale[128]; + vec4 usm[128]; +} nisCoef; + +float getY(vec3 rgb) { + return 0.2126 * rgb.x + 0.7152 * rgb.y + 0.0722 * rgb.z; +} + +// GetEdgeMap on a 3x3 luma window (pRC: R=row 0=top, C=col 0=left). +vec4 edgeAt(float p00, float p01, float p02, + float p10, float p11, float p12, + float p20, float p21, float p22) { + float g_0 = abs(p00 + p01 + p02 - p20 - p21 - p22); + float g_45 = abs(p10 + p00 + p01 - p21 - p22 - p12); + float g_90 = abs(p00 + p10 + p20 - p02 - p12 - p22); + float g_135 = abs(p10 + p20 + p21 - p01 - p02 - p12); + + float g_0_90_max = max(g_0, g_90); + float g_0_90_min = min(g_0, g_90); + float g_45_135_max = max(g_45, g_135); + float g_45_135_min = min(g_45, g_135); + + if (g_0_90_max + g_45_135_max == 0.0) { + return vec4(0.0); + } + + float e_0_90 = min(g_0_90_max / (g_0_90_max + g_45_135_max), 1.0); + float e_45_135 = 1.0 - e_0_90; + + bool c_0_90 = (g_0_90_max > (g_0_90_min * kDetectRatio)) && (g_0_90_max > kDetectThres) && (g_0_90_max > g_45_135_min); + bool c_45_135 = (g_45_135_max > (g_45_135_min * kDetectRatio)) && (g_45_135_max > kDetectThres) && (g_45_135_max > g_0_90_min); + bool c_g_0_90 = (g_0_90_max == g_0); + bool c_g_45_135= (g_45_135_max == g_45); + + float f_e_0_90 = (c_0_90 && c_45_135) ? e_0_90 : 1.0; + float f_e_45_135 = (c_0_90 && c_45_135) ? e_45_135 : 1.0; + + float w0 = (c_0_90 && c_g_0_90) ? f_e_0_90 : 0.0; + float w90 = (c_0_90 && !c_g_0_90) ? f_e_0_90 : 0.0; + float w45 = (c_45_135 && c_g_45_135) ? f_e_45_135 : 0.0; + float w135 = (c_45_135 && !c_g_45_135)? f_e_45_135 : 0.0; + + return vec4(w0, w90, w45, w135); +} + +vec4 getInterpEdgeMap(vec4 e00, vec4 e01, vec4 e10, vec4 e11, float fx, float fy) { + vec4 h0 = mix(e00, e01, fx); + vec4 h1 = mix(e10, e11, fx); + return mix(h0, h1, fy); +} + +float calcLTI(float p0, float p1, float p2, float p3, float p4, float p5, int phase_index) { + bool selector = (phase_index <= kPhaseCount / 2); + float sel = selector ? p0 : p3; + float a_min = min(min(p1, p2), sel); + float a_max = max(max(p1, p2), sel); + sel = selector ? p2 : p5; + float b_min = min(min(p3, p4), sel); + float b_max = max(max(p3, p4), sel); + + float a_cont = a_max - a_min; + float b_cont = b_max - b_min; + + float cont_ratio = max(a_cont, b_cont) / (min(a_cont, b_cont) + kEps); + return (1.0 - clamp((cont_ratio - kMinContrastRatio) * kRatioNorm, 0.0, 1.0)) * kContrastBoost; +} + +float evalPoly6(float pxl[6], int phase_int) { + phase_int = clamp(phase_int, 0, 63); + vec4 s0 = nisCoef.scale[phase_int * 2], s1 = nisCoef.scale[phase_int * 2 + 1]; + vec4 u0 = nisCoef.usm[phase_int * 2], u1 = nisCoef.usm[phase_int * 2 + 1]; + float y = 0.0; + y += s0.x * pxl[0]; y += s0.y * pxl[1]; y += s0.z * pxl[2]; + y += s0.w * pxl[3]; y += s1.x * pxl[4]; y += s1.y * pxl[5]; + float y_usm = 0.0; + y_usm += u0.x * pxl[0]; y_usm += u0.y * pxl[1]; y_usm += u0.z * pxl[2]; + y_usm += u0.w * pxl[3]; y_usm += u1.x * pxl[4]; y_usm += u1.y * pxl[5]; + + // piece-wise ramp based on luma (NIS_SCALE_FLOAT == 1) + float y_scale = 1.0 - clamp((y - kSharpStartY) * kSharpScaleY, 0.0, 1.0); + float y_sharpness = y_scale * gSharpStrengthScale + gSharpStrengthMin; + y_usm *= y_sharpness; + + float y_sharpness_limit = (y_scale * gSharpLimitScale + gSharpLimitMin) * y; + y_usm = min(y_sharpness_limit, max(-y_sharpness_limit, y_usm)); + y_usm *= calcLTI(pxl[0], pxl[1], pxl[2], pxl[3], pxl[4], pxl[5], phase_int); + + return y + y_usm; +} + +float filterNormal(float p[6][6], int phase_x_int, int phase_y_int) { + phase_x_int = clamp(phase_x_int, 0, 63); + phase_y_int = clamp(phase_y_int, 0, 63); + vec4 y0 = nisCoef.scale[phase_y_int * 2], y1 = nisCoef.scale[phase_y_int * 2 + 1]; + vec4 x0 = nisCoef.scale[phase_x_int * 2], x1 = nisCoef.scale[phase_x_int * 2 + 1]; + float cy[6] = float[6](y0.x, y0.y, y0.z, y0.w, y1.x, y1.y); + float cx[6] = float[6](x0.x, x0.y, x0.z, x0.w, x1.x, x1.y); + float h_acc = 0.0; + for (int j = 0; j < 6; ++j) { + float v_acc = 0.0; + for (int i = 0; i < 6; ++i) { + v_acc += p[i][j] * cy[i]; + } + h_acc += v_acc * cx[j]; + } + return h_acc; +} + +float addDirFilters(float p[6][6], float phase_x_frac, float phase_y_frac, + int phase_x_frac_int, int phase_y_frac_int, vec4 w) { + float f = 0.0; + if (w.x > 0.0) { + // 0 deg filter + float interp0Deg[6]; + for (int i = 0; i < 6; ++i) { + interp0Deg[i] = mix(p[i][2], p[i][3], phase_x_frac); + } + f += evalPoly6(interp0Deg, phase_y_frac_int) * w.x; + } + if (w.y > 0.0) { + // 90 deg filter + float interp90Deg[6]; + for (int i = 0; i < 6; ++i) { + interp90Deg[i] = mix(p[2][i], p[3][i], phase_y_frac); + } + f += evalPoly6(interp90Deg, phase_x_frac_int) * w.y; + } + if (w.z > 0.0) { + // 45 deg filter + float pphase_b45 = 0.5 + 0.5 * (phase_x_frac - phase_y_frac); + + float temp_interp45Deg[7]; + temp_interp45Deg[1] = mix(p[2][1], p[1][2], pphase_b45); + temp_interp45Deg[3] = mix(p[3][2], p[2][3], pphase_b45); + temp_interp45Deg[5] = mix(p[4][3], p[3][4], pphase_b45); + { + pphase_b45 = pphase_b45 - 0.5; + float a = (pphase_b45 >= 0.0) ? p[0][2] : p[2][0]; + float b = (pphase_b45 >= 0.0) ? p[1][3] : p[3][1]; + float c = (pphase_b45 >= 0.0) ? p[2][4] : p[4][2]; + float d = (pphase_b45 >= 0.0) ? p[3][5] : p[5][3]; + temp_interp45Deg[0] = mix(p[1][1], a, abs(pphase_b45)); + temp_interp45Deg[2] = mix(p[2][2], b, abs(pphase_b45)); + temp_interp45Deg[4] = mix(p[3][3], c, abs(pphase_b45)); + temp_interp45Deg[6] = mix(p[4][4], d, abs(pphase_b45)); + } + + float interp45Deg[6]; + float pphase_p45 = phase_x_frac + phase_y_frac; + if (pphase_p45 >= 1.0) { + for (int i = 0; i < 6; ++i) { + interp45Deg[i] = temp_interp45Deg[i + 1]; + } + pphase_p45 = pphase_p45 - 1.0; + } else { + for (int i = 0; i < 6; ++i) { + interp45Deg[i] = temp_interp45Deg[i]; + } + } + + f += evalPoly6(interp45Deg, int(pphase_p45 * 64.0)) * w.z; + } + if (w.w > 0.0) { + // 135 deg filter + float pphase_b135 = 0.5 * (phase_x_frac + phase_y_frac); + + float temp_interp135Deg[7]; + temp_interp135Deg[1] = mix(p[3][1], p[4][2], pphase_b135); + temp_interp135Deg[3] = mix(p[2][2], p[3][3], pphase_b135); + temp_interp135Deg[5] = mix(p[1][3], p[2][4], pphase_b135); + { + pphase_b135 = pphase_b135 - 0.5; + float a = (pphase_b135 >= 0.0) ? p[5][2] : p[3][0]; + float b = (pphase_b135 >= 0.0) ? p[4][3] : p[2][1]; + float c = (pphase_b135 >= 0.0) ? p[3][4] : p[1][2]; + float d = (pphase_b135 >= 0.0) ? p[2][5] : p[0][3]; + temp_interp135Deg[0] = mix(p[4][1], a, abs(pphase_b135)); + temp_interp135Deg[2] = mix(p[3][2], b, abs(pphase_b135)); + temp_interp135Deg[4] = mix(p[2][3], c, abs(pphase_b135)); + temp_interp135Deg[6] = mix(p[1][4], d, abs(pphase_b135)); + } + + float interp135Deg[6]; + float pphase_p135 = 1.0 + (phase_x_frac - phase_y_frac); + if (pphase_p135 >= 1.0) { + for (int i = 0; i < 6; ++i) { + interp135Deg[i] = temp_interp135Deg[i + 1]; + } + pphase_p135 = pphase_p135 - 1.0; + } else { + for (int i = 0; i < 6; ++i) { + interp135Deg[i] = temp_interp135Deg[i]; + } + } + + f += evalPoly6(interp135Deg, int(pphase_p135 * 64.0)) * w.w; + } + return f; +} + +void main() { + // Sharpness-derived params - mirror NVScalerUpdateConfig (SDR path). + float sharpness = clamp(pc.sharpness, 0.0, 1.0); + float sharpen_slider = sharpness - 0.5; + float MaxScale = (sharpen_slider >= 0.0) ? 1.25 : 1.75; + float MinScale = (sharpen_slider >= 0.0) ? 1.25 : 1.0; + float LimitScale = (sharpen_slider >= 0.0) ? 1.25 : 1.0; + + gSharpStrengthMin = max(0.0, 0.4 + sharpen_slider * MinScale * 1.2); + float sharpStrengthMax = 1.6 + sharpen_slider * MaxScale * 1.8; + gSharpStrengthScale = sharpStrengthMax - gSharpStrengthMin; + gSharpLimitMin = max(0.1, 0.14 + sharpen_slider * LimitScale * 0.32); + float sharpLimitMax = 0.5 + sharpen_slider * LimitScale * 0.6; + gSharpLimitScale = sharpLimitMax - gSharpLimitMin; + + highp vec2 inSize = pc.ViewportInfo.zw; + highp vec2 invIn = pc.ViewportInfo.xy; + + // Source sample position in input-pixel space (output viewport cancels out). + highp float srcX = fragTexCoord.x * inSize.x - 0.5; + highp float srcY = fragTexCoord.y * inSize.y - 0.5; + highp float fsx = floor(srcX); + highp float fsy = floor(srcY); + highp float fx = srcX - fsx; + highp float fy = srcY - fsy; + int fx_int = int(fx * float(kPhaseCount)); + int fy_int = int(fy * float(kPhaseCount)); + + // 6x6 luma support: p[i][j] = luma at source texel (fsx + j - 2, fsy + i - 2), from the + // prepass alpha. A gather at the shared corner of texels (x, y)..(x + 1, y + 1) returns + // .w = (x, y), .z = (x + 1, y), .x = (x, y + 1), .y = (x + 1, y + 1); block (bi, bj) starts + // at x = fsx - 2 + 2 bj, y = fsy - 2 + 2 bi, so its corner is (fsx + 2 bj - 1, fsy + 2 bi - 1). + // Clamp-to-edge clamps each gathered texel like the per-texel fetches did. + float p[6][6]; + for (int bi = 0; bi < 3; ++bi) { + for (int bj = 0; bj < 3; ++bj) { + highp vec2 tc = vec2(fsx + float(2 * bj - 1), fsy + float(2 * bi - 1)) * invIn; + vec4 g = textureGather(InputTexture, tc, 3); + p[2 * bi][2 * bj] = g.w; + p[2 * bi][2 * bj + 1] = g.z; + p[2 * bi + 1][2 * bj] = g.x; + p[2 * bi + 1][2 * bj + 1] = g.y; + } + } + + // 2x2 edge map around the source pixel (3x3 luma window per corner). + vec4 e00 = edgeAt(p[1][1], p[1][2], p[1][3], p[2][1], p[2][2], p[2][3], p[3][1], p[3][2], p[3][3]); + vec4 e01 = edgeAt(p[1][2], p[1][3], p[1][4], p[2][2], p[2][3], p[2][4], p[3][2], p[3][3], p[3][4]); + vec4 e10 = edgeAt(p[2][1], p[2][2], p[2][3], p[3][1], p[3][2], p[3][3], p[4][1], p[4][2], p[4][3]); + vec4 e11 = edgeAt(p[2][2], p[2][3], p[2][4], p[3][2], p[3][3], p[3][4], p[4][2], p[4][3], p[4][4]); + vec4 w = getInterpEdgeMap(e00, e01, e10, e11, fx, fy); // * NIS_SCALE_INT (==1) + + float baseWeight = 1.0 - w.x - w.y - w.z - w.w; // NIS_SCALE_FLOAT - sum + float opY = filterNormal(p, fx_int, fy_int) * baseWeight; + opY += addDirFilters(p, fx, fy, fx_int, fy_int, w); + + // Bilinear color tap from the prepass rgb (= the game image) + luma correction. + vec4 op = texture(InputTexture, fragTexCoord); + float y = getY(op.rgb); + float corr = opY - y; // * (1/NIS_SCALE_FLOAT) == 1 + op.rgb += vec3(corr); + + outColor = vec4(clamp(op.rgb, 0.0, 1.0), 1.0); +} diff --git a/app/src/main/cpp/shaders/nis3_half_frag.h b/app/src/main/cpp/shaders/nis3_half_frag.h new file mode 100644 index 0000000000..7603498099 --- /dev/null +++ b/app/src/main/cpp/shaders/nis3_half_frag.h @@ -0,0 +1,1364 @@ + // 1116.2.0 + #pragma once +const uint32_t nis3_half_code[] = { + 0x07230203,0x00010000,0x0008000b,0x000005a2,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000462,0x00000595,0x00030010, + 0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d, + 0x00000000,0x00050005,0x0000000b,0x59746567,0x33667628,0x0000003b,0x00030005,0x0000000a, + 0x00626772,0x000b0005,0x00000019,0x65676465,0x66287441,0x31663b31,0x3b31663b,0x663b3166, + 0x31663b31,0x3b31663b,0x663b3166,0x00003b31,0x00030005,0x00000010,0x00303070,0x00030005, + 0x00000011,0x00313070,0x00030005,0x00000012,0x00323070,0x00030005,0x00000013,0x00303170, + 0x00030005,0x00000014,0x00313170,0x00030005,0x00000015,0x00323170,0x00030005,0x00000016, + 0x00303270,0x00030005,0x00000017,0x00313270,0x00030005,0x00000018,0x00323270,0x000c0005, + 0x00000023,0x49746567,0x7265746e,0x67644570,0x70614d65,0x34667628,0x3466763b,0x3466763b, + 0x3466763b,0x3b31663b,0x003b3166,0x00030005,0x0000001d,0x00303065,0x00030005,0x0000001e, + 0x00313065,0x00030005,0x0000001f,0x00303165,0x00030005,0x00000020,0x00313165,0x00030005, + 0x00000021,0x00007866,0x00030005,0x00000022,0x00007966,0x000a0005,0x0000002f,0x636c6163, + 0x2849544c,0x663b3166,0x31663b31,0x3b31663b,0x663b3166,0x31693b31,0x0000003b,0x00030005, + 0x00000028,0x00003070,0x00030005,0x00000029,0x00003170,0x00030005,0x0000002a,0x00003270, + 0x00030005,0x0000002b,0x00003370,0x00030005,0x0000002c,0x00003470,0x00030005,0x0000002d, + 0x00003570,0x00050005,0x0000002e,0x73616870,0x6e695f65,0x00786564,0x00070005,0x00000038, + 0x6c617665,0x796c6f50,0x31662836,0x3b5d365b,0x003b3169,0x00030005,0x00000036,0x006c7870, + 0x00050005,0x00000037,0x73616870,0x6e695f65,0x00000074,0x000a0005,0x00000040,0x746c6966, + 0x6f4e7265,0x6c616d72,0x5b316628,0x365b5d36,0x31693b5d,0x3b31693b,0x00000000,0x00030005, + 0x0000003d,0x00000070,0x00050005,0x0000003e,0x73616870,0x5f785f65,0x00746e69,0x00050005, + 0x0000003f,0x73616870,0x5f795f65,0x00746e69,0x000c0005,0x00000049,0x44646461,0x69467269, + 0x7265746c,0x31662873,0x5b5d365b,0x663b5d36,0x31663b31,0x3b31693b,0x763b3169,0x003b3466, + 0x00030005,0x00000043,0x00000070,0x00060005,0x00000044,0x73616870,0x5f785f65,0x63617266, + 0x00000000,0x00060005,0x00000045,0x73616870,0x5f795f65,0x63617266,0x00000000,0x00070005, + 0x00000046,0x73616870,0x5f785f65,0x63617266,0x746e695f,0x00000000,0x00070005,0x00000047, + 0x73616870,0x5f795f65,0x63617266,0x746e695f,0x00000000,0x00030005,0x00000048,0x00000077, + 0x00030005,0x0000005e,0x00305f67,0x00040005,0x0000006b,0x35345f67,0x00000000,0x00040005, + 0x00000078,0x30395f67,0x00000000,0x00040005,0x00000085,0x33315f67,0x00000035,0x00050005, + 0x00000092,0x5f305f67,0x6d5f3039,0x00007861,0x00050005,0x00000096,0x5f305f67,0x6d5f3039, + 0x00006e69,0x00060005,0x0000009a,0x35345f67,0x3533315f,0x78616d5f,0x00000000,0x00060005, + 0x0000009e,0x35345f67,0x3533315f,0x6e696d5f,0x00000000,0x00040005,0x000000ac,0x5f305f65, + 0x00003039,0x00050005,0x000000b4,0x35345f65,0x3533315f,0x00000000,0x00040005,0x000000b8, + 0x5f305f63,0x00003039,0x00050005,0x000000c6,0x35345f63,0x3533315f,0x00000000,0x00050005, + 0x000000d2,0x5f675f63,0x30395f30,0x00000000,0x00050005,0x000000d6,0x5f675f63,0x315f3534, + 0x00003533,0x00050005,0x000000da,0x5f655f66,0x30395f30,0x00000000,0x00050005,0x000000e0, + 0x5f655f66,0x315f3534,0x00003533,0x00030005,0x000000e6,0x00003077,0x00030005,0x000000ec, + 0x00303977,0x00030005,0x000000f3,0x00353477,0x00040005,0x000000f9,0x35333177,0x00000000, + 0x00030005,0x00000107,0x00003068,0x00030005,0x0000010d,0x00003168,0x00050005,0x0000011a, + 0x656c6573,0x726f7463,0x00000000,0x00030005,0x0000011e,0x006c6573,0x00040005,0x00000123, + 0x696d5f61,0x0000006e,0x00040005,0x00000129,0x616d5f61,0x00000078,0x00040005,0x00000133, + 0x696d5f62,0x0000006e,0x00040005,0x00000139,0x616d5f62,0x00000078,0x00040005,0x0000013f, + 0x6f635f61,0x0000746e,0x00040005,0x00000143,0x6f635f62,0x0000746e,0x00050005,0x00000147, + 0x746e6f63,0x7461725f,0x00006f69,0x00030005,0x0000015f,0x00003073,0x00040005,0x00000163, + 0x4373694e,0x0066656f,0x00050006,0x00000163,0x00000000,0x6c616373,0x00000065,0x00040006, + 0x00000163,0x00000001,0x006d7375,0x00040005,0x00000165,0x4373696e,0x0066656f,0x00030005, + 0x0000016c,0x00003173,0x00030005,0x00000173,0x00003075,0x00030005,0x00000178,0x00003175, + 0x00030005,0x0000017e,0x00000079,0x00040005,0x000001ad,0x73755f79,0x0000006d,0x00040005, + 0x000001d8,0x63735f79,0x00656c61,0x00050005,0x000001e0,0x68735f79,0x6e707261,0x00737365, + 0x00070005,0x000001e3,0x61685367,0x74537072,0x676e6572,0x63536874,0x00656c61,0x00070005, + 0x000001e6,0x61685367,0x74537072,0x676e6572,0x694d6874,0x0000006e,0x00070005,0x000001ec, + 0x68735f79,0x6e707261,0x5f737365,0x696d696c,0x00000074,0x00070005,0x000001ee,0x61685367, + 0x694c7072,0x5374696d,0x656c6163,0x00000000,0x00060005,0x000001f1,0x61685367,0x694c7072, + 0x4d74696d,0x00006e69,0x00040005,0x000001fc,0x61726170,0x0000006d,0x00040005,0x000001ff, + 0x61726170,0x0000006d,0x00040005,0x00000202,0x61726170,0x0000006d,0x00040005,0x00000205, + 0x61726170,0x0000006d,0x00040005,0x00000208,0x61726170,0x0000006d,0x00040005,0x0000020b, + 0x61726170,0x0000006d,0x00040005,0x0000020e,0x61726170,0x0000006d,0x00030005,0x0000021c, + 0x00003079,0x00030005,0x00000221,0x00003179,0x00030005,0x00000227,0x00003078,0x00030005, + 0x0000022c,0x00003178,0x00030005,0x00000232,0x00007963,0x00030005,0x00000240,0x00007863, + 0x00040005,0x0000024e,0x63615f68,0x00000063,0x00030005,0x0000024f,0x0000006a,0x00040005, + 0x00000258,0x63615f76,0x00000063,0x00030005,0x00000259,0x00000069,0x00030005,0x00000279, + 0x00000066,0x00030005,0x0000027f,0x00000069,0x00050005,0x00000287,0x65746e69,0x44307072, + 0x00006765,0x00040005,0x00000294,0x61726170,0x0000006d,0x00040005,0x00000296,0x61726170, + 0x0000006d,0x00030005,0x000002a3,0x00000069,0x00050005,0x000002ab,0x65746e69,0x30397072, + 0x00676544,0x00040005,0x000002b8,0x61726170,0x0000006d,0x00040005,0x000002ba,0x61726170, + 0x0000006d,0x00050005,0x000002c7,0x61687070,0x625f6573,0x00003534,0x00070005,0x000002d1, + 0x706d6574,0x746e695f,0x34707265,0x67654435,0x00000000,0x00030005,0x000002e9,0x00000061, + 0x00030005,0x000002f5,0x00000062,0x00030005,0x00000301,0x00000063,0x00030005,0x0000030d, + 0x00000064,0x00050005,0x00000335,0x61687070,0x705f6573,0x00003534,0x00030005,0x0000033d, + 0x00000069,0x00050005,0x00000345,0x65746e69,0x35347072,0x00676544,0x00030005,0x00000351, + 0x00000069,0x00040005,0x00000364,0x61726170,0x0000006d,0x00040005,0x00000366,0x61726170, + 0x0000006d,0x00050005,0x00000372,0x61687070,0x625f6573,0x00353331,0x00070005,0x00000377, + 0x706d6574,0x746e695f,0x31707265,0x65443533,0x00000067,0x00030005,0x0000038f,0x00000061, + 0x00030005,0x0000039b,0x00000062,0x00030005,0x000003a7,0x00000063,0x00030005,0x000003b3, + 0x00000064,0x00050005,0x000003db,0x61687070,0x705f6573,0x00353331,0x00030005,0x000003e4, + 0x00000069,0x00060005,0x000003ec,0x65746e69,0x33317072,0x67654435,0x00000000,0x00030005, + 0x000003f8,0x00000069,0x00040005,0x0000040a,0x61726170,0x0000006d,0x00040005,0x0000040c, + 0x61726170,0x0000006d,0x00050005,0x00000416,0x72616873,0x73656e70,0x00000073,0x00030005, + 0x00000417,0x00004350,0x00040006,0x00000417,0x00000000,0x0063646e,0x00070006,0x00000417, + 0x00000001,0x77656956,0x74726f70,0x6f666e49,0x00000000,0x00060006,0x00000417,0x00000002, + 0x72616873,0x73656e70,0x00000073,0x00030005,0x00000419,0x00006370,0x00060005,0x0000041e, + 0x72616873,0x5f6e6570,0x64696c73,0x00007265,0x00050005,0x00000421,0x5378614d,0x656c6163, + 0x00000000,0x00050005,0x00000427,0x536e694d,0x656c6163,0x00000000,0x00050005,0x0000042b, + 0x696d694c,0x61635374,0x0000656c,0x00070005,0x00000437,0x72616873,0x72745370,0x74676e65, + 0x78614d68,0x00000000,0x00060005,0x0000044b,0x72616873,0x6d694c70,0x614d7469,0x00000078, + 0x00040005,0x00000457,0x69536e69,0x0000657a,0x00040005,0x0000045c,0x49766e69,0x0000006e, + 0x00040005,0x00000460,0x58637273,0x00000000,0x00060005,0x00000462,0x67617266,0x43786554, + 0x64726f6f,0x00000000,0x00040005,0x0000046a,0x59637273,0x00000000,0x00030005,0x00000471, + 0x00787366,0x00030005,0x00000474,0x00797366,0x00030005,0x00000477,0x00007866,0x00030005, + 0x0000047b,0x00007966,0x00040005,0x0000047f,0x695f7866,0x0000746e,0x00040005,0x00000483, + 0x695f7966,0x0000746e,0x00030005,0x00000487,0x00006962,0x00030005,0x0000048f,0x00006a62, + 0x00030005,0x00000497,0x00006374,0x00030005,0x000004a7,0x00000067,0x00060005,0x000004ab, + 0x75706e49,0x78655474,0x65727574,0x00000000,0x00030005,0x000004af,0x00000070,0x00030005, + 0x000004d4,0x00303065,0x00040005,0x000004d5,0x61726170,0x0000006d,0x00040005,0x000004d8, + 0x61726170,0x0000006d,0x00040005,0x000004db,0x61726170,0x0000006d,0x00040005,0x000004de, + 0x61726170,0x0000006d,0x00040005,0x000004e1,0x61726170,0x0000006d,0x00040005,0x000004e4, + 0x61726170,0x0000006d,0x00040005,0x000004e7,0x61726170,0x0000006d,0x00040005,0x000004ea, + 0x61726170,0x0000006d,0x00040005,0x000004ed,0x61726170,0x0000006d,0x00030005,0x000004f1, + 0x00313065,0x00040005,0x000004f2,0x61726170,0x0000006d,0x00040005,0x000004f5,0x61726170, + 0x0000006d,0x00040005,0x000004f8,0x61726170,0x0000006d,0x00040005,0x000004fb,0x61726170, + 0x0000006d,0x00040005,0x000004fe,0x61726170,0x0000006d,0x00040005,0x00000501,0x61726170, + 0x0000006d,0x00040005,0x00000504,0x61726170,0x0000006d,0x00040005,0x00000507,0x61726170, + 0x0000006d,0x00040005,0x0000050a,0x61726170,0x0000006d,0x00030005,0x0000050e,0x00303165, + 0x00040005,0x0000050f,0x61726170,0x0000006d,0x00040005,0x00000512,0x61726170,0x0000006d, + 0x00040005,0x00000515,0x61726170,0x0000006d,0x00040005,0x00000518,0x61726170,0x0000006d, + 0x00040005,0x0000051b,0x61726170,0x0000006d,0x00040005,0x0000051e,0x61726170,0x0000006d, + 0x00040005,0x00000521,0x61726170,0x0000006d,0x00040005,0x00000524,0x61726170,0x0000006d, + 0x00040005,0x00000527,0x61726170,0x0000006d,0x00030005,0x0000052b,0x00313165,0x00040005, + 0x0000052c,0x61726170,0x0000006d,0x00040005,0x0000052f,0x61726170,0x0000006d,0x00040005, + 0x00000532,0x61726170,0x0000006d,0x00040005,0x00000535,0x61726170,0x0000006d,0x00040005, + 0x00000538,0x61726170,0x0000006d,0x00040005,0x0000053b,0x61726170,0x0000006d,0x00040005, + 0x0000053e,0x61726170,0x0000006d,0x00040005,0x00000541,0x61726170,0x0000006d,0x00040005, + 0x00000544,0x61726170,0x0000006d,0x00030005,0x00000548,0x00000077,0x00040005,0x00000549, + 0x61726170,0x0000006d,0x00040005,0x0000054b,0x61726170,0x0000006d,0x00040005,0x0000054d, + 0x61726170,0x0000006d,0x00040005,0x0000054f,0x61726170,0x0000006d,0x00040005,0x00000551, + 0x61726170,0x0000006d,0x00040005,0x00000553,0x61726170,0x0000006d,0x00050005,0x00000556, + 0x65736162,0x67696557,0x00007468,0x00030005,0x00000563,0x0059706f,0x00040005,0x00000564, + 0x61726170,0x0000006d,0x00040005,0x00000566,0x61726170,0x0000006d,0x00040005,0x00000568, + 0x61726170,0x0000006d,0x00040005,0x0000056d,0x61726170,0x0000006d,0x00040005,0x0000056f, + 0x61726170,0x0000006d,0x00040005,0x00000571,0x61726170,0x0000006d,0x00040005,0x00000573, + 0x61726170,0x0000006d,0x00040005,0x00000575,0x61726170,0x0000006d,0x00040005,0x00000577, + 0x61726170,0x0000006d,0x00030005,0x0000057c,0x0000706f,0x00030005,0x00000580,0x00000079, + 0x00040005,0x00000581,0x61726170,0x0000006d,0x00040005,0x00000585,0x72726f63,0x00000000, + 0x00050005,0x00000595,0x4374756f,0x726f6c6f,0x00000000,0x00030047,0x0000000a,0x00000000, + 0x00030047,0x0000000b,0x00000000,0x00030047,0x00000010,0x00000000,0x00030047,0x00000011, + 0x00000000,0x00030047,0x00000012,0x00000000,0x00030047,0x00000013,0x00000000,0x00030047, + 0x00000014,0x00000000,0x00030047,0x00000015,0x00000000,0x00030047,0x00000016,0x00000000, + 0x00030047,0x00000017,0x00000000,0x00030047,0x00000018,0x00000000,0x00030047,0x00000019, + 0x00000000,0x00030047,0x0000001d,0x00000000,0x00030047,0x0000001e,0x00000000,0x00030047, + 0x0000001f,0x00000000,0x00030047,0x00000020,0x00000000,0x00030047,0x00000021,0x00000000, + 0x00030047,0x00000022,0x00000000,0x00030047,0x00000023,0x00000000,0x00030047,0x00000028, + 0x00000000,0x00030047,0x00000029,0x00000000,0x00030047,0x0000002a,0x00000000,0x00030047, + 0x0000002b,0x00000000,0x00030047,0x0000002c,0x00000000,0x00030047,0x0000002d,0x00000000, + 0x00030047,0x0000002f,0x00000000,0x00030047,0x00000036,0x00000000,0x00030047,0x00000038, + 0x00000000,0x00030047,0x0000003d,0x00000000,0x00030047,0x00000040,0x00000000,0x00030047, + 0x00000043,0x00000000,0x00030047,0x00000044,0x00000000,0x00030047,0x00000045,0x00000000, + 0x00030047,0x00000048,0x00000000,0x00030047,0x00000049,0x00000000,0x00030047,0x0000004e, + 0x00000000,0x00030047,0x0000004f,0x00000000,0x00030047,0x00000053,0x00000000,0x00030047, + 0x00000054,0x00000000,0x00030047,0x00000055,0x00000000,0x00030047,0x00000059,0x00000000, + 0x00030047,0x0000005a,0x00000000,0x00030047,0x0000005b,0x00000000,0x00030047,0x0000005e, + 0x00000000,0x00030047,0x0000005f,0x00000000,0x00030047,0x00000060,0x00000000,0x00030047, + 0x00000061,0x00000000,0x00030047,0x00000062,0x00000000,0x00030047,0x00000063,0x00000000, + 0x00030047,0x00000064,0x00000000,0x00030047,0x00000065,0x00000000,0x00030047,0x00000066, + 0x00000000,0x00030047,0x00000067,0x00000000,0x00030047,0x00000068,0x00000000,0x00030047, + 0x00000069,0x00000000,0x00030047,0x0000006a,0x00000000,0x00030047,0x0000006b,0x00000000, + 0x00030047,0x0000006c,0x00000000,0x00030047,0x0000006d,0x00000000,0x00030047,0x0000006e, + 0x00000000,0x00030047,0x0000006f,0x00000000,0x00030047,0x00000070,0x00000000,0x00030047, + 0x00000071,0x00000000,0x00030047,0x00000072,0x00000000,0x00030047,0x00000073,0x00000000, + 0x00030047,0x00000074,0x00000000,0x00030047,0x00000075,0x00000000,0x00030047,0x00000076, + 0x00000000,0x00030047,0x00000077,0x00000000,0x00030047,0x00000078,0x00000000,0x00030047, + 0x00000079,0x00000000,0x00030047,0x0000007a,0x00000000,0x00030047,0x0000007b,0x00000000, + 0x00030047,0x0000007c,0x00000000,0x00030047,0x0000007d,0x00000000,0x00030047,0x0000007e, + 0x00000000,0x00030047,0x0000007f,0x00000000,0x00030047,0x00000080,0x00000000,0x00030047, + 0x00000081,0x00000000,0x00030047,0x00000082,0x00000000,0x00030047,0x00000083,0x00000000, + 0x00030047,0x00000084,0x00000000,0x00030047,0x00000085,0x00000000,0x00030047,0x00000086, + 0x00000000,0x00030047,0x00000087,0x00000000,0x00030047,0x00000088,0x00000000,0x00030047, + 0x00000089,0x00000000,0x00030047,0x0000008a,0x00000000,0x00030047,0x0000008b,0x00000000, + 0x00030047,0x0000008c,0x00000000,0x00030047,0x0000008d,0x00000000,0x00030047,0x0000008e, + 0x00000000,0x00030047,0x0000008f,0x00000000,0x00030047,0x00000090,0x00000000,0x00030047, + 0x00000091,0x00000000,0x00030047,0x00000092,0x00000000,0x00030047,0x00000093,0x00000000, + 0x00030047,0x00000094,0x00000000,0x00030047,0x00000095,0x00000000,0x00030047,0x00000096, + 0x00000000,0x00030047,0x00000097,0x00000000,0x00030047,0x00000098,0x00000000,0x00030047, + 0x00000099,0x00000000,0x00030047,0x0000009a,0x00000000,0x00030047,0x0000009b,0x00000000, + 0x00030047,0x0000009c,0x00000000,0x00030047,0x0000009d,0x00000000,0x00030047,0x0000009e, + 0x00000000,0x00030047,0x0000009f,0x00000000,0x00030047,0x000000a0,0x00000000,0x00030047, + 0x000000a1,0x00000000,0x00030047,0x000000a2,0x00000000,0x00030047,0x000000a3,0x00000000, + 0x00030047,0x000000a4,0x00000000,0x00030047,0x000000ac,0x00000000,0x00030047,0x000000ad, + 0x00000000,0x00030047,0x000000ae,0x00000000,0x00030047,0x000000af,0x00000000,0x00030047, + 0x000000b0,0x00000000,0x00030047,0x000000b1,0x00000000,0x00030047,0x000000b2,0x00000000, + 0x00030047,0x000000b3,0x00000000,0x00030047,0x000000b4,0x00000000,0x00030047,0x000000b5, + 0x00000000,0x00030047,0x000000b6,0x00000000,0x00030047,0x000000b9,0x00000000,0x00030047, + 0x000000ba,0x00000000,0x00030047,0x000000bb,0x00000000,0x00030047,0x000000bc,0x00000000, + 0x00030047,0x000000be,0x00000000,0x00030047,0x000000bf,0x00000000,0x00030047,0x000000c2, + 0x00000000,0x00030047,0x000000c3,0x00000000,0x00030047,0x000000c7,0x00000000,0x00030047, + 0x000000c8,0x00000000,0x00030047,0x000000c9,0x00000000,0x00030047,0x000000cb,0x00000000, + 0x00030047,0x000000ce,0x00000000,0x00030047,0x000000cf,0x00000000,0x00030047,0x000000d3, + 0x00000000,0x00030047,0x000000d4,0x00000000,0x00030047,0x000000d7,0x00000000,0x00030047, + 0x000000d8,0x00000000,0x00030047,0x000000da,0x00000000,0x00030047,0x000000de,0x00000000, + 0x00030047,0x000000e0,0x00000000,0x00030047,0x000000e4,0x00000000,0x00030047,0x000000e6, + 0x00000000,0x00030047,0x000000ea,0x00000000,0x00030047,0x000000ec,0x00000000,0x00030047, + 0x000000f1,0x00000000,0x00030047,0x000000f3,0x00000000,0x00030047,0x000000f7,0x00000000, + 0x00030047,0x000000f9,0x00000000,0x00030047,0x000000fe,0x00000000,0x00030047,0x00000100, + 0x00000000,0x00030047,0x00000101,0x00000000,0x00030047,0x00000102,0x00000000,0x00030047, + 0x00000103,0x00000000,0x00030047,0x00000104,0x00000000,0x00030047,0x00000107,0x00000000, + 0x00030047,0x00000108,0x00000000,0x00030047,0x00000109,0x00000000,0x00030047,0x0000010a, + 0x00000000,0x00030047,0x0000010b,0x00000000,0x00030047,0x0000010c,0x00000000,0x00030047, + 0x0000010d,0x00000000,0x00030047,0x0000010e,0x00000000,0x00030047,0x0000010f,0x00000000, + 0x00030047,0x00000110,0x00000000,0x00030047,0x00000111,0x00000000,0x00030047,0x00000112, + 0x00000000,0x00030047,0x00000113,0x00000000,0x00030047,0x00000114,0x00000000,0x00030047, + 0x00000115,0x00000000,0x00030047,0x00000116,0x00000000,0x00030047,0x00000117,0x00000000, + 0x00030047,0x0000011e,0x00000000,0x00030047,0x00000120,0x00000000,0x00030047,0x00000121, + 0x00000000,0x00030047,0x00000123,0x00000000,0x00030047,0x00000124,0x00000000,0x00030047, + 0x00000125,0x00000000,0x00030047,0x00000126,0x00000000,0x00030047,0x00000127,0x00000000, + 0x00030047,0x00000128,0x00000000,0x00030047,0x00000129,0x00000000,0x00030047,0x0000012a, + 0x00000000,0x00030047,0x0000012b,0x00000000,0x00030047,0x0000012c,0x00000000,0x00030047, + 0x0000012d,0x00000000,0x00030047,0x0000012e,0x00000000,0x00030047,0x00000130,0x00000000, + 0x00030047,0x00000131,0x00000000,0x00030047,0x00000133,0x00000000,0x00030047,0x00000134, + 0x00000000,0x00030047,0x00000135,0x00000000,0x00030047,0x00000136,0x00000000,0x00030047, + 0x00000137,0x00000000,0x00030047,0x00000138,0x00000000,0x00030047,0x00000139,0x00000000, + 0x00030047,0x0000013a,0x00000000,0x00030047,0x0000013b,0x00000000,0x00030047,0x0000013c, + 0x00000000,0x00030047,0x0000013d,0x00000000,0x00030047,0x0000013e,0x00000000,0x00030047, + 0x0000013f,0x00000000,0x00030047,0x00000140,0x00000000,0x00030047,0x00000141,0x00000000, + 0x00030047,0x00000142,0x00000000,0x00030047,0x00000143,0x00000000,0x00030047,0x00000144, + 0x00000000,0x00030047,0x00000145,0x00000000,0x00030047,0x00000146,0x00000000,0x00030047, + 0x00000147,0x00000000,0x00030047,0x00000148,0x00000000,0x00030047,0x00000149,0x00000000, + 0x00030047,0x0000014a,0x00000000,0x00030047,0x0000014b,0x00000000,0x00030047,0x0000014c, + 0x00000000,0x00030047,0x0000014d,0x00000000,0x00030047,0x0000014e,0x00000000,0x00030047, + 0x0000014f,0x00000000,0x00030047,0x00000150,0x00000000,0x00030047,0x00000151,0x00000000, + 0x00030047,0x00000152,0x00000000,0x00030047,0x00000153,0x00000000,0x00030047,0x00000154, + 0x00000000,0x00030047,0x00000155,0x00000000,0x00030047,0x00000156,0x00000000,0x00030047, + 0x00000157,0x00000000,0x00030047,0x00000158,0x00000000,0x00030047,0x0000015f,0x00000000, + 0x00040047,0x00000161,0x00000006,0x00000010,0x00040047,0x00000162,0x00000006,0x00000010, + 0x00030047,0x00000163,0x00000002,0x00040048,0x00000163,0x00000000,0x00000000,0x00050048, + 0x00000163,0x00000000,0x00000023,0x00000000,0x00040048,0x00000163,0x00000001,0x00000000, + 0x00050048,0x00000163,0x00000001,0x00000023,0x00000800,0x00040047,0x00000165,0x00000021, + 0x00000000,0x00040047,0x00000165,0x00000022,0x00000001,0x00030047,0x0000016b,0x00000000, + 0x00030047,0x0000016c,0x00000000,0x00030047,0x00000172,0x00000000,0x00030047,0x00000173, + 0x00000000,0x00030047,0x00000177,0x00000000,0x00030047,0x00000178,0x00000000,0x00030047, + 0x0000017d,0x00000000,0x00030047,0x0000017e,0x00000000,0x00030047,0x00000180,0x00000000, + 0x00030047,0x00000182,0x00000000,0x00030047,0x00000183,0x00000000,0x00030047,0x00000184, + 0x00000000,0x00030047,0x00000185,0x00000000,0x00030047,0x00000187,0x00000000,0x00030047, + 0x00000189,0x00000000,0x00030047,0x0000018a,0x00000000,0x00030047,0x0000018b,0x00000000, + 0x00030047,0x0000018c,0x00000000,0x00030047,0x0000018e,0x00000000,0x00030047,0x00000190, + 0x00000000,0x00030047,0x00000191,0x00000000,0x00030047,0x00000192,0x00000000,0x00030047, + 0x00000193,0x00000000,0x00030047,0x00000196,0x00000000,0x00030047,0x00000199,0x00000000, + 0x00030047,0x0000019a,0x00000000,0x00030047,0x0000019b,0x00000000,0x00030047,0x0000019c, + 0x00000000,0x00030047,0x0000019e,0x00000000,0x00030047,0x000001a1,0x00000000,0x00030047, + 0x000001a2,0x00000000,0x00030047,0x000001a3,0x00000000,0x00030047,0x000001a4,0x00000000, + 0x00030047,0x000001a6,0x00000000,0x00030047,0x000001a9,0x00000000,0x00030047,0x000001aa, + 0x00000000,0x00030047,0x000001ab,0x00000000,0x00030047,0x000001ac,0x00000000,0x00030047, + 0x000001ad,0x00000000,0x00030047,0x000001af,0x00000000,0x00030047,0x000001b1,0x00000000, + 0x00030047,0x000001b2,0x00000000,0x00030047,0x000001b3,0x00000000,0x00030047,0x000001b4, + 0x00000000,0x00030047,0x000001b6,0x00000000,0x00030047,0x000001b8,0x00000000,0x00030047, + 0x000001b9,0x00000000,0x00030047,0x000001ba,0x00000000,0x00030047,0x000001bb,0x00000000, + 0x00030047,0x000001bd,0x00000000,0x00030047,0x000001bf,0x00000000,0x00030047,0x000001c0, + 0x00000000,0x00030047,0x000001c1,0x00000000,0x00030047,0x000001c2,0x00000000,0x00030047, + 0x000001c4,0x00000000,0x00030047,0x000001c6,0x00000000,0x00030047,0x000001c7,0x00000000, + 0x00030047,0x000001c8,0x00000000,0x00030047,0x000001c9,0x00000000,0x00030047,0x000001cb, + 0x00000000,0x00030047,0x000001cd,0x00000000,0x00030047,0x000001ce,0x00000000,0x00030047, + 0x000001cf,0x00000000,0x00030047,0x000001d0,0x00000000,0x00030047,0x000001d2,0x00000000, + 0x00030047,0x000001d4,0x00000000,0x00030047,0x000001d5,0x00000000,0x00030047,0x000001d6, + 0x00000000,0x00030047,0x000001d7,0x00000000,0x00030047,0x000001d8,0x00000000,0x00030047, + 0x000001d9,0x00000000,0x00030047,0x000001da,0x00000000,0x00030047,0x000001db,0x00000000, + 0x00030047,0x000001dc,0x00000000,0x00030047,0x000001dd,0x00000000,0x00030047,0x000001de, + 0x00000000,0x00030047,0x000001df,0x00000000,0x00030047,0x000001e0,0x00000000,0x00030047, + 0x000001e1,0x00000000,0x00030047,0x000001e3,0x00000000,0x00030047,0x000001e4,0x00000000, + 0x00030047,0x000001e5,0x00000000,0x00030047,0x000001e6,0x00000000,0x00030047,0x000001e7, + 0x00000000,0x00030047,0x000001e8,0x00000000,0x00030047,0x000001e9,0x00000000,0x00030047, + 0x000001ea,0x00000000,0x00030047,0x000001eb,0x00000000,0x00030047,0x000001ec,0x00000000, + 0x00030047,0x000001ed,0x00000000,0x00030047,0x000001ee,0x00000000,0x00030047,0x000001ef, + 0x00000000,0x00030047,0x000001f0,0x00000000,0x00030047,0x000001f1,0x00000000,0x00030047, + 0x000001f2,0x00000000,0x00030047,0x000001f3,0x00000000,0x00030047,0x000001f4,0x00000000, + 0x00030047,0x000001f5,0x00000000,0x00030047,0x000001f6,0x00000000,0x00030047,0x000001f7, + 0x00000000,0x00030047,0x000001f8,0x00000000,0x00030047,0x000001f9,0x00000000,0x00030047, + 0x000001fa,0x00000000,0x00030047,0x000001fb,0x00000000,0x00030047,0x000001fc,0x00000000, + 0x00030047,0x000001fe,0x00000000,0x00030047,0x000001ff,0x00000000,0x00030047,0x00000201, + 0x00000000,0x00030047,0x00000202,0x00000000,0x00030047,0x00000204,0x00000000,0x00030047, + 0x00000205,0x00000000,0x00030047,0x00000207,0x00000000,0x00030047,0x00000208,0x00000000, + 0x00030047,0x0000020a,0x00000000,0x00030047,0x0000020b,0x00000000,0x00030047,0x0000020d, + 0x00000000,0x00030047,0x00000210,0x00000000,0x00030047,0x00000211,0x00000000,0x00030047, + 0x00000212,0x00000000,0x00030047,0x00000213,0x00000000,0x00030047,0x00000214,0x00000000, + 0x00030047,0x00000215,0x00000000,0x00030047,0x0000021c,0x00000000,0x00030047,0x00000220, + 0x00000000,0x00030047,0x00000221,0x00000000,0x00030047,0x00000226,0x00000000,0x00030047, + 0x00000227,0x00000000,0x00030047,0x0000022b,0x00000000,0x00030047,0x0000022c,0x00000000, + 0x00030047,0x00000231,0x00000000,0x00030047,0x00000232,0x00000000,0x00030047,0x00000234, + 0x00000000,0x00030047,0x00000236,0x00000000,0x00030047,0x00000238,0x00000000,0x00030047, + 0x0000023a,0x00000000,0x00030047,0x0000023c,0x00000000,0x00030047,0x0000023e,0x00000000, + 0x00030047,0x00000240,0x00000000,0x00030047,0x00000242,0x00000000,0x00030047,0x00000244, + 0x00000000,0x00030047,0x00000246,0x00000000,0x00030047,0x00000248,0x00000000,0x00030047, + 0x0000024a,0x00000000,0x00030047,0x0000024c,0x00000000,0x00030047,0x0000024e,0x00000000, + 0x00030047,0x00000258,0x00000000,0x00030047,0x00000264,0x00000000,0x00030047,0x00000267, + 0x00000000,0x00030047,0x00000268,0x00000000,0x00030047,0x00000269,0x00000000,0x00030047, + 0x0000026a,0x00000000,0x00030047,0x0000026d,0x00000000,0x00030047,0x00000270,0x00000000, + 0x00030047,0x00000271,0x00000000,0x00030047,0x00000272,0x00000000,0x00030047,0x00000273, + 0x00000000,0x00030047,0x00000276,0x00000000,0x00030047,0x00000279,0x00000000,0x00030047, + 0x0000027b,0x00000000,0x00030047,0x00000287,0x00000000,0x00030047,0x0000028b,0x00000000, + 0x00030047,0x0000028e,0x00000000,0x00030047,0x0000028f,0x00000000,0x00030047,0x00000290, + 0x00000000,0x00030047,0x00000294,0x00000000,0x00030047,0x00000295,0x00000000,0x00030047, + 0x00000298,0x00000000,0x00030047,0x0000029a,0x00000000,0x00030047,0x0000029b,0x00000000, + 0x00030047,0x0000029c,0x00000000,0x00030047,0x0000029d,0x00000000,0x00030047,0x0000029f, + 0x00000000,0x00030047,0x000002ab,0x00000000,0x00030047,0x000002af,0x00000000,0x00030047, + 0x000002b2,0x00000000,0x00030047,0x000002b3,0x00000000,0x00030047,0x000002b4,0x00000000, + 0x00030047,0x000002b8,0x00000000,0x00030047,0x000002b9,0x00000000,0x00030047,0x000002bc, + 0x00000000,0x00030047,0x000002be,0x00000000,0x00030047,0x000002bf,0x00000000,0x00030047, + 0x000002c0,0x00000000,0x00030047,0x000002c1,0x00000000,0x00030047,0x000002c3,0x00000000, + 0x00030047,0x000002c7,0x00000000,0x00030047,0x000002c9,0x00000000,0x00030047,0x000002ca, + 0x00000000,0x00030047,0x000002cb,0x00000000,0x00030047,0x000002cc,0x00000000,0x00030047, + 0x000002cd,0x00000000,0x00030047,0x000002d1,0x00000000,0x00030047,0x000002d3,0x00000000, + 0x00030047,0x000002d5,0x00000000,0x00030047,0x000002d6,0x00000000,0x00030047,0x000002d7, + 0x00000000,0x00030047,0x000002da,0x00000000,0x00030047,0x000002dc,0x00000000,0x00030047, + 0x000002dd,0x00000000,0x00030047,0x000002de,0x00000000,0x00030047,0x000002e1,0x00000000, + 0x00030047,0x000002e3,0x00000000,0x00030047,0x000002e4,0x00000000,0x00030047,0x000002e5, + 0x00000000,0x00030047,0x000002e7,0x00000000,0x00030047,0x000002e8,0x00000000,0x00030047, + 0x000002e9,0x00000000,0x00030047,0x000002ea,0x00000000,0x00030047,0x000002ec,0x00000000, + 0x00030047,0x000002f0,0x00000000,0x00030047,0x000002f3,0x00000000,0x00030047,0x000002f4, + 0x00000000,0x00030047,0x000002f5,0x00000000,0x00030047,0x000002f6,0x00000000,0x00030047, + 0x000002f8,0x00000000,0x00030047,0x000002fc,0x00000000,0x00030047,0x000002ff,0x00000000, + 0x00030047,0x00000300,0x00000000,0x00030047,0x00000301,0x00000000,0x00030047,0x00000302, + 0x00000000,0x00030047,0x00000304,0x00000000,0x00030047,0x00000308,0x00000000,0x00030047, + 0x0000030b,0x00000000,0x00030047,0x0000030c,0x00000000,0x00030047,0x0000030d,0x00000000, + 0x00030047,0x0000030e,0x00000000,0x00030047,0x00000310,0x00000000,0x00030047,0x00000314, + 0x00000000,0x00030047,0x00000317,0x00000000,0x00030047,0x00000318,0x00000000,0x00030047, + 0x0000031a,0x00000000,0x00030047,0x0000031b,0x00000000,0x00030047,0x0000031c,0x00000000, + 0x00030047,0x0000031d,0x00000000,0x00030047,0x0000031e,0x00000000,0x00030047,0x00000321, + 0x00000000,0x00030047,0x00000322,0x00000000,0x00030047,0x00000323,0x00000000,0x00030047, + 0x00000324,0x00000000,0x00030047,0x00000325,0x00000000,0x00030047,0x00000328,0x00000000, + 0x00030047,0x00000329,0x00000000,0x00030047,0x0000032a,0x00000000,0x00030047,0x0000032b, + 0x00000000,0x00030047,0x0000032c,0x00000000,0x00030047,0x0000032f,0x00000000,0x00030047, + 0x00000330,0x00000000,0x00030047,0x00000331,0x00000000,0x00030047,0x00000332,0x00000000, + 0x00030047,0x00000333,0x00000000,0x00030047,0x00000335,0x00000000,0x00030047,0x00000336, + 0x00000000,0x00030047,0x00000337,0x00000000,0x00030047,0x00000338,0x00000000,0x00030047, + 0x00000339,0x00000000,0x00030047,0x00000345,0x00000000,0x00030047,0x0000034a,0x00000000, + 0x00030047,0x0000034e,0x00000000,0x00030047,0x0000034f,0x00000000,0x00030047,0x0000035c, + 0x00000000,0x00030047,0x00000360,0x00000000,0x00030047,0x00000362,0x00000000,0x00030047, + 0x00000363,0x00000000,0x00030047,0x00000364,0x00000000,0x00030047,0x00000365,0x00000000, + 0x00030047,0x00000367,0x00000000,0x00030047,0x00000369,0x00000000,0x00030047,0x0000036a, + 0x00000000,0x00030047,0x0000036b,0x00000000,0x00030047,0x0000036c,0x00000000,0x00030047, + 0x0000036e,0x00000000,0x00030047,0x00000372,0x00000000,0x00030047,0x00000373,0x00000000, + 0x00030047,0x00000374,0x00000000,0x00030047,0x00000375,0x00000000,0x00030047,0x00000376, + 0x00000000,0x00030047,0x00000377,0x00000000,0x00030047,0x00000379,0x00000000,0x00030047, + 0x0000037b,0x00000000,0x00030047,0x0000037c,0x00000000,0x00030047,0x0000037d,0x00000000, + 0x00030047,0x00000380,0x00000000,0x00030047,0x00000382,0x00000000,0x00030047,0x00000383, + 0x00000000,0x00030047,0x00000384,0x00000000,0x00030047,0x00000387,0x00000000,0x00030047, + 0x00000389,0x00000000,0x00030047,0x0000038a,0x00000000,0x00030047,0x0000038b,0x00000000, + 0x00030047,0x0000038d,0x00000000,0x00030047,0x0000038e,0x00000000,0x00030047,0x0000038f, + 0x00000000,0x00030047,0x00000390,0x00000000,0x00030047,0x00000392,0x00000000,0x00030047, + 0x00000396,0x00000000,0x00030047,0x00000399,0x00000000,0x00030047,0x0000039a,0x00000000, + 0x00030047,0x0000039b,0x00000000,0x00030047,0x0000039c,0x00000000,0x00030047,0x0000039e, + 0x00000000,0x00030047,0x000003a2,0x00000000,0x00030047,0x000003a5,0x00000000,0x00030047, + 0x000003a6,0x00000000,0x00030047,0x000003a7,0x00000000,0x00030047,0x000003a8,0x00000000, + 0x00030047,0x000003aa,0x00000000,0x00030047,0x000003ae,0x00000000,0x00030047,0x000003b1, + 0x00000000,0x00030047,0x000003b2,0x00000000,0x00030047,0x000003b3,0x00000000,0x00030047, + 0x000003b4,0x00000000,0x00030047,0x000003b6,0x00000000,0x00030047,0x000003ba,0x00000000, + 0x00030047,0x000003bd,0x00000000,0x00030047,0x000003be,0x00000000,0x00030047,0x000003c0, + 0x00000000,0x00030047,0x000003c1,0x00000000,0x00030047,0x000003c2,0x00000000,0x00030047, + 0x000003c3,0x00000000,0x00030047,0x000003c4,0x00000000,0x00030047,0x000003c7,0x00000000, + 0x00030047,0x000003c8,0x00000000,0x00030047,0x000003c9,0x00000000,0x00030047,0x000003ca, + 0x00000000,0x00030047,0x000003cb,0x00000000,0x00030047,0x000003ce,0x00000000,0x00030047, + 0x000003cf,0x00000000,0x00030047,0x000003d0,0x00000000,0x00030047,0x000003d1,0x00000000, + 0x00030047,0x000003d2,0x00000000,0x00030047,0x000003d5,0x00000000,0x00030047,0x000003d6, + 0x00000000,0x00030047,0x000003d7,0x00000000,0x00030047,0x000003d8,0x00000000,0x00030047, + 0x000003d9,0x00000000,0x00030047,0x000003db,0x00000000,0x00030047,0x000003dc,0x00000000, + 0x00030047,0x000003dd,0x00000000,0x00030047,0x000003de,0x00000000,0x00030047,0x000003df, + 0x00000000,0x00030047,0x000003e0,0x00000000,0x00030047,0x000003ec,0x00000000,0x00030047, + 0x000003f1,0x00000000,0x00030047,0x000003f5,0x00000000,0x00030047,0x000003f6,0x00000000, + 0x00030047,0x00000403,0x00000000,0x00030047,0x00000407,0x00000000,0x00030047,0x00000408, + 0x00000000,0x00030047,0x00000409,0x00000000,0x00030047,0x0000040a,0x00000000,0x00030047, + 0x0000040b,0x00000000,0x00030047,0x0000040d,0x00000000,0x00030047,0x0000040f,0x00000000, + 0x00030047,0x00000410,0x00000000,0x00030047,0x00000411,0x00000000,0x00030047,0x00000412, + 0x00000000,0x00030047,0x00000413,0x00000000,0x00030047,0x00000416,0x00000000,0x00030047, + 0x00000417,0x00000002,0x00050048,0x00000417,0x00000000,0x00000023,0x00000000,0x00050048, + 0x00000417,0x00000001,0x00000023,0x00000010,0x00040048,0x00000417,0x00000002,0x00000000, + 0x00050048,0x00000417,0x00000002,0x00000023,0x00000020,0x00030047,0x0000041c,0x00000000, + 0x00030047,0x0000041d,0x00000000,0x00030047,0x0000041e,0x00000000,0x00030047,0x0000041f, + 0x00000000,0x00030047,0x00000420,0x00000000,0x00030047,0x00000421,0x00000000,0x00030047, + 0x00000422,0x00000000,0x00030047,0x00000427,0x00000000,0x00030047,0x00000428,0x00000000, + 0x00030047,0x0000042b,0x00000000,0x00030047,0x0000042c,0x00000000,0x00030047,0x00000430, + 0x00000000,0x00030047,0x00000431,0x00000000,0x00030047,0x00000432,0x00000000,0x00030047, + 0x00000434,0x00000000,0x00030047,0x00000435,0x00000000,0x00030047,0x00000436,0x00000000, + 0x00030047,0x00000437,0x00000000,0x00030047,0x00000439,0x00000000,0x00030047,0x0000043a, + 0x00000000,0x00030047,0x0000043b,0x00000000,0x00030047,0x0000043d,0x00000000,0x00030047, + 0x0000043e,0x00000000,0x00030047,0x0000043f,0x00000000,0x00030047,0x00000440,0x00000000, + 0x00030047,0x00000441,0x00000000,0x00030047,0x00000444,0x00000000,0x00030047,0x00000445, + 0x00000000,0x00030047,0x00000446,0x00000000,0x00030047,0x00000448,0x00000000,0x00030047, + 0x00000449,0x00000000,0x00030047,0x0000044a,0x00000000,0x00030047,0x0000044b,0x00000000, + 0x00030047,0x0000044c,0x00000000,0x00030047,0x0000044d,0x00000000,0x00030047,0x0000044e, + 0x00000000,0x00030047,0x00000450,0x00000000,0x00030047,0x00000451,0x00000000,0x00030047, + 0x00000452,0x00000000,0x00030047,0x00000453,0x00000000,0x00030047,0x00000454,0x00000000, + 0x00040047,0x00000462,0x0000001e,0x00000000,0x00030047,0x000004a7,0x00000000,0x00030047, + 0x000004ab,0x00000000,0x00040047,0x000004ab,0x00000021,0x00000000,0x00040047,0x000004ab, + 0x00000022,0x00000000,0x00030047,0x000004ac,0x00000000,0x00030047,0x000004ae,0x00000000, + 0x00030047,0x000004af,0x00000000,0x00030047,0x000004b5,0x00000000,0x00030047,0x000004bd, + 0x00000000,0x00030047,0x000004c5,0x00000000,0x00030047,0x000004ce,0x00000000,0x00030047, + 0x000004d4,0x00000000,0x00030047,0x000004d5,0x00000000,0x00030047,0x000004d7,0x00000000, + 0x00030047,0x000004d8,0x00000000,0x00030047,0x000004da,0x00000000,0x00030047,0x000004db, + 0x00000000,0x00030047,0x000004dd,0x00000000,0x00030047,0x000004de,0x00000000,0x00030047, + 0x000004e0,0x00000000,0x00030047,0x000004e1,0x00000000,0x00030047,0x000004e3,0x00000000, + 0x00030047,0x000004e4,0x00000000,0x00030047,0x000004e6,0x00000000,0x00030047,0x000004e7, + 0x00000000,0x00030047,0x000004e9,0x00000000,0x00030047,0x000004ea,0x00000000,0x00030047, + 0x000004ec,0x00000000,0x00030047,0x000004ed,0x00000000,0x00030047,0x000004ef,0x00000000, + 0x00030047,0x000004f0,0x00000000,0x00030047,0x000004f1,0x00000000,0x00030047,0x000004f2, + 0x00000000,0x00030047,0x000004f4,0x00000000,0x00030047,0x000004f5,0x00000000,0x00030047, + 0x000004f7,0x00000000,0x00030047,0x000004f8,0x00000000,0x00030047,0x000004fa,0x00000000, + 0x00030047,0x000004fb,0x00000000,0x00030047,0x000004fd,0x00000000,0x00030047,0x000004fe, + 0x00000000,0x00030047,0x00000500,0x00000000,0x00030047,0x00000501,0x00000000,0x00030047, + 0x00000503,0x00000000,0x00030047,0x00000504,0x00000000,0x00030047,0x00000506,0x00000000, + 0x00030047,0x00000507,0x00000000,0x00030047,0x00000509,0x00000000,0x00030047,0x0000050a, + 0x00000000,0x00030047,0x0000050c,0x00000000,0x00030047,0x0000050d,0x00000000,0x00030047, + 0x0000050e,0x00000000,0x00030047,0x0000050f,0x00000000,0x00030047,0x00000511,0x00000000, + 0x00030047,0x00000512,0x00000000,0x00030047,0x00000514,0x00000000,0x00030047,0x00000515, + 0x00000000,0x00030047,0x00000517,0x00000000,0x00030047,0x00000518,0x00000000,0x00030047, + 0x0000051a,0x00000000,0x00030047,0x0000051b,0x00000000,0x00030047,0x0000051d,0x00000000, + 0x00030047,0x0000051e,0x00000000,0x00030047,0x00000520,0x00000000,0x00030047,0x00000521, + 0x00000000,0x00030047,0x00000523,0x00000000,0x00030047,0x00000524,0x00000000,0x00030047, + 0x00000526,0x00000000,0x00030047,0x00000527,0x00000000,0x00030047,0x00000529,0x00000000, + 0x00030047,0x0000052a,0x00000000,0x00030047,0x0000052b,0x00000000,0x00030047,0x0000052c, + 0x00000000,0x00030047,0x0000052e,0x00000000,0x00030047,0x0000052f,0x00000000,0x00030047, + 0x00000531,0x00000000,0x00030047,0x00000532,0x00000000,0x00030047,0x00000534,0x00000000, + 0x00030047,0x00000535,0x00000000,0x00030047,0x00000537,0x00000000,0x00030047,0x00000538, + 0x00000000,0x00030047,0x0000053a,0x00000000,0x00030047,0x0000053b,0x00000000,0x00030047, + 0x0000053d,0x00000000,0x00030047,0x0000053e,0x00000000,0x00030047,0x00000540,0x00000000, + 0x00030047,0x00000541,0x00000000,0x00030047,0x00000543,0x00000000,0x00030047,0x00000544, + 0x00000000,0x00030047,0x00000546,0x00000000,0x00030047,0x00000547,0x00000000,0x00030047, + 0x00000548,0x00000000,0x00030047,0x00000549,0x00000000,0x00030047,0x0000054a,0x00000000, + 0x00030047,0x0000054b,0x00000000,0x00030047,0x0000054c,0x00000000,0x00030047,0x0000054d, + 0x00000000,0x00030047,0x0000054e,0x00000000,0x00030047,0x0000054f,0x00000000,0x00030047, + 0x00000550,0x00000000,0x00030047,0x00000551,0x00000000,0x00030047,0x00000553,0x00000000, + 0x00030047,0x00000555,0x00000000,0x00030047,0x00000556,0x00000000,0x00030047,0x00000558, + 0x00000000,0x00030047,0x00000559,0x00000000,0x00030047,0x0000055b,0x00000000,0x00030047, + 0x0000055c,0x00000000,0x00030047,0x0000055e,0x00000000,0x00030047,0x0000055f,0x00000000, + 0x00030047,0x00000561,0x00000000,0x00030047,0x00000562,0x00000000,0x00030047,0x00000563, + 0x00000000,0x00030047,0x00000564,0x00000000,0x00030047,0x00000565,0x00000000,0x00030047, + 0x0000056a,0x00000000,0x00030047,0x0000056b,0x00000000,0x00030047,0x0000056c,0x00000000, + 0x00030047,0x0000056d,0x00000000,0x00030047,0x0000056e,0x00000000,0x00030047,0x0000056f, + 0x00000000,0x00030047,0x00000571,0x00000000,0x00030047,0x00000577,0x00000000,0x00030047, + 0x00000578,0x00000000,0x00030047,0x00000579,0x00000000,0x00030047,0x0000057a,0x00000000, + 0x00030047,0x0000057b,0x00000000,0x00030047,0x0000057c,0x00000000,0x00030047,0x0000057d, + 0x00000000,0x00030047,0x0000057f,0x00000000,0x00030047,0x00000580,0x00000000,0x00030047, + 0x00000581,0x00000000,0x00030047,0x00000582,0x00000000,0x00030047,0x00000583,0x00000000, + 0x00030047,0x00000584,0x00000000,0x00030047,0x00000585,0x00000000,0x00030047,0x00000586, + 0x00000000,0x00030047,0x00000587,0x00000000,0x00030047,0x00000588,0x00000000,0x00030047, + 0x00000589,0x00000000,0x00030047,0x0000058a,0x00000000,0x00030047,0x0000058b,0x00000000, + 0x00030047,0x0000058c,0x00000000,0x00030047,0x0000058d,0x00000000,0x00030047,0x00000595, + 0x00000000,0x00040047,0x00000595,0x0000001e,0x00000000,0x00030047,0x00000596,0x00000000, + 0x00030047,0x00000597,0x00000000,0x00030047,0x00000598,0x00000000,0x00030047,0x00000599, + 0x00000000,0x00030047,0x0000059a,0x00000000,0x00030047,0x0000059b,0x00000000,0x00030047, + 0x0000059c,0x00000000,0x00030047,0x0000059d,0x00000000,0x00030047,0x0000059e,0x00000000, + 0x00030047,0x0000059f,0x00000000,0x00030047,0x000005a0,0x00000000,0x00020013,0x00000002, + 0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007, + 0x00000006,0x00000003,0x00040020,0x00000008,0x00000007,0x00000007,0x00040021,0x00000009, + 0x00000006,0x00000008,0x00040020,0x0000000d,0x00000007,0x00000006,0x00040017,0x0000000e, + 0x00000006,0x00000004,0x000c0021,0x0000000f,0x0000000e,0x0000000d,0x0000000d,0x0000000d, + 0x0000000d,0x0000000d,0x0000000d,0x0000000d,0x0000000d,0x0000000d,0x00040020,0x0000001b, + 0x00000007,0x0000000e,0x00090021,0x0000001c,0x0000000e,0x0000001b,0x0000001b,0x0000001b, + 0x0000001b,0x0000000d,0x0000000d,0x00040015,0x00000025,0x00000020,0x00000001,0x00040020, + 0x00000026,0x00000007,0x00000025,0x000a0021,0x00000027,0x00000006,0x0000000d,0x0000000d, + 0x0000000d,0x0000000d,0x0000000d,0x0000000d,0x00000026,0x00040015,0x00000031,0x00000020, + 0x00000000,0x0004002b,0x00000031,0x00000032,0x00000006,0x0004001c,0x00000033,0x00000006, + 0x00000032,0x00040020,0x00000034,0x00000007,0x00000033,0x00050021,0x00000035,0x00000006, + 0x00000034,0x00000026,0x0004001c,0x0000003a,0x00000033,0x00000032,0x00040020,0x0000003b, + 0x00000007,0x0000003a,0x00060021,0x0000003c,0x00000006,0x0000003b,0x00000026,0x00000026, + 0x00090021,0x00000042,0x00000006,0x0000003b,0x0000000d,0x0000000d,0x00000026,0x00000026, + 0x0000001b,0x0004002b,0x00000006,0x0000004b,0x3e59b3d0,0x0004002b,0x00000031,0x0000004c, + 0x00000000,0x0004002b,0x00000006,0x00000050,0x3f371759,0x0004002b,0x00000031,0x00000051, + 0x00000001,0x0004002b,0x00000006,0x00000056,0x3d93dd98,0x0004002b,0x00000031,0x00000057, + 0x00000002,0x0004002b,0x00000006,0x000000a5,0x00000000,0x00020014,0x000000a6,0x0007002c, + 0x0000000e,0x000000aa,0x000000a5,0x000000a5,0x000000a5,0x000000a5,0x0004002b,0x00000006, + 0x000000b2,0x3f800000,0x00040020,0x000000b7,0x00000007,0x000000a6,0x0004002b,0x00000006, + 0x000000bb,0x400ce000,0x0004002b,0x00000006,0x000000bf,0x3d800000,0x0004002b,0x00000025, + 0x0000011c,0x00000020,0x0004002b,0x00000006,0x0000014e,0x3b808081,0x0004002b,0x00000006, + 0x00000152,0x40000000,0x0004002b,0x00000006,0x00000154,0x3e000000,0x0004002b,0x00000025, + 0x0000015c,0x00000000,0x0004002b,0x00000025,0x0000015d,0x0000003f,0x0004002b,0x00000031, + 0x00000160,0x00000080,0x0004001c,0x00000161,0x0000000e,0x00000160,0x0004001c,0x00000162, + 0x0000000e,0x00000160,0x0004001e,0x00000163,0x00000161,0x00000162,0x00040020,0x00000164, + 0x00000002,0x00000163,0x0004003b,0x00000164,0x00000165,0x00000002,0x0004002b,0x00000025, + 0x00000167,0x00000002,0x00040020,0x00000169,0x00000002,0x0000000e,0x0004002b,0x00000025, + 0x0000016f,0x00000001,0x0004002b,0x00000031,0x00000194,0x00000003,0x0004002b,0x00000025, + 0x00000197,0x00000003,0x0004002b,0x00000025,0x0000019f,0x00000004,0x0004002b,0x00000025, + 0x000001a7,0x00000005,0x0004002b,0x00000006,0x000001da,0x3ee66666,0x0004002b,0x00000006, + 0x000001dc,0x400e38e4,0x00040020,0x000001e2,0x00000006,0x00000006,0x0004003b,0x000001e2, + 0x000001e3,0x00000006,0x0004003b,0x000001e2,0x000001e6,0x00000006,0x0004003b,0x000001e2, + 0x000001ee,0x00000006,0x0004003b,0x000001e2,0x000001f1,0x00000006,0x0004002b,0x00000025, + 0x00000256,0x00000006,0x0004002b,0x00000006,0x000002c8,0x3f000000,0x0004002b,0x00000031, + 0x000002ce,0x00000007,0x0004001c,0x000002cf,0x00000006,0x000002ce,0x00040020,0x000002d0, + 0x00000007,0x000002cf,0x0004002b,0x00000006,0x00000361,0x42800000,0x0005001e,0x00000417, + 0x0000000e,0x0000000e,0x00000006,0x00040020,0x00000418,0x00000009,0x00000417,0x0004003b, + 0x00000418,0x00000419,0x00000009,0x00040020,0x0000041a,0x00000009,0x00000006,0x0004002b, + 0x00000006,0x00000424,0x3fa00000,0x0004002b,0x00000006,0x00000425,0x3fe00000,0x0004002b, + 0x00000006,0x0000042f,0x3ecccccd,0x0004002b,0x00000006,0x00000433,0x3f99999a,0x0004002b, + 0x00000006,0x00000438,0x3fcccccd,0x0004002b,0x00000006,0x0000043c,0x3fe66666,0x0004002b, + 0x00000006,0x00000442,0x3dcccccd,0x0004002b,0x00000006,0x00000443,0x3e0f5c29,0x0004002b, + 0x00000006,0x00000447,0x3ea3d70a,0x0004002b,0x00000006,0x0000044f,0x3f19999a,0x00040017, + 0x00000455,0x00000006,0x00000002,0x00040020,0x00000456,0x00000007,0x00000455,0x00040020, + 0x00000458,0x00000009,0x0000000e,0x00040020,0x00000461,0x00000001,0x00000455,0x0004003b, + 0x00000461,0x00000462,0x00000001,0x00040020,0x00000463,0x00000001,0x00000006,0x00090019, + 0x000004a8,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000, + 0x0003001b,0x000004a9,0x000004a8,0x00040020,0x000004aa,0x00000000,0x000004a9,0x0004003b, + 0x000004aa,0x000004ab,0x00000000,0x00040020,0x00000594,0x00000003,0x0000000e,0x0004003b, + 0x00000594,0x00000595,0x00000003,0x0004002b,0x00000006,0x0000059f,0x41200000,0x0004002b, + 0x00000006,0x000005a0,0x3f666666,0x0004002b,0x00000025,0x000005a1,0x00000040,0x00050036, + 0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x0000000d, + 0x00000416,0x00000007,0x0004003b,0x0000000d,0x0000041e,0x00000007,0x0004003b,0x0000000d, + 0x00000421,0x00000007,0x0004003b,0x0000000d,0x00000427,0x00000007,0x0004003b,0x0000000d, + 0x0000042b,0x00000007,0x0004003b,0x0000000d,0x00000437,0x00000007,0x0004003b,0x0000000d, + 0x0000044b,0x00000007,0x0004003b,0x00000456,0x00000457,0x00000007,0x0004003b,0x00000456, + 0x0000045c,0x00000007,0x0004003b,0x0000000d,0x00000460,0x00000007,0x0004003b,0x0000000d, + 0x0000046a,0x00000007,0x0004003b,0x0000000d,0x00000471,0x00000007,0x0004003b,0x0000000d, + 0x00000474,0x00000007,0x0004003b,0x0000000d,0x00000477,0x00000007,0x0004003b,0x0000000d, + 0x0000047b,0x00000007,0x0004003b,0x00000026,0x0000047f,0x00000007,0x0004003b,0x00000026, + 0x00000483,0x00000007,0x0004003b,0x00000026,0x00000487,0x00000007,0x0004003b,0x00000026, + 0x0000048f,0x00000007,0x0004003b,0x00000456,0x00000497,0x00000007,0x0004003b,0x0000001b, + 0x000004a7,0x00000007,0x0004003b,0x0000003b,0x000004af,0x00000007,0x0004003b,0x0000001b, + 0x000004d4,0x00000007,0x0004003b,0x0000000d,0x000004d5,0x00000007,0x0004003b,0x0000000d, + 0x000004d8,0x00000007,0x0004003b,0x0000000d,0x000004db,0x00000007,0x0004003b,0x0000000d, + 0x000004de,0x00000007,0x0004003b,0x0000000d,0x000004e1,0x00000007,0x0004003b,0x0000000d, + 0x000004e4,0x00000007,0x0004003b,0x0000000d,0x000004e7,0x00000007,0x0004003b,0x0000000d, + 0x000004ea,0x00000007,0x0004003b,0x0000000d,0x000004ed,0x00000007,0x0004003b,0x0000001b, + 0x000004f1,0x00000007,0x0004003b,0x0000000d,0x000004f2,0x00000007,0x0004003b,0x0000000d, + 0x000004f5,0x00000007,0x0004003b,0x0000000d,0x000004f8,0x00000007,0x0004003b,0x0000000d, + 0x000004fb,0x00000007,0x0004003b,0x0000000d,0x000004fe,0x00000007,0x0004003b,0x0000000d, + 0x00000501,0x00000007,0x0004003b,0x0000000d,0x00000504,0x00000007,0x0004003b,0x0000000d, + 0x00000507,0x00000007,0x0004003b,0x0000000d,0x0000050a,0x00000007,0x0004003b,0x0000001b, + 0x0000050e,0x00000007,0x0004003b,0x0000000d,0x0000050f,0x00000007,0x0004003b,0x0000000d, + 0x00000512,0x00000007,0x0004003b,0x0000000d,0x00000515,0x00000007,0x0004003b,0x0000000d, + 0x00000518,0x00000007,0x0004003b,0x0000000d,0x0000051b,0x00000007,0x0004003b,0x0000000d, + 0x0000051e,0x00000007,0x0004003b,0x0000000d,0x00000521,0x00000007,0x0004003b,0x0000000d, + 0x00000524,0x00000007,0x0004003b,0x0000000d,0x00000527,0x00000007,0x0004003b,0x0000001b, + 0x0000052b,0x00000007,0x0004003b,0x0000000d,0x0000052c,0x00000007,0x0004003b,0x0000000d, + 0x0000052f,0x00000007,0x0004003b,0x0000000d,0x00000532,0x00000007,0x0004003b,0x0000000d, + 0x00000535,0x00000007,0x0004003b,0x0000000d,0x00000538,0x00000007,0x0004003b,0x0000000d, + 0x0000053b,0x00000007,0x0004003b,0x0000000d,0x0000053e,0x00000007,0x0004003b,0x0000000d, + 0x00000541,0x00000007,0x0004003b,0x0000000d,0x00000544,0x00000007,0x0004003b,0x0000001b, + 0x00000548,0x00000007,0x0004003b,0x0000001b,0x00000549,0x00000007,0x0004003b,0x0000001b, + 0x0000054b,0x00000007,0x0004003b,0x0000001b,0x0000054d,0x00000007,0x0004003b,0x0000001b, + 0x0000054f,0x00000007,0x0004003b,0x0000000d,0x00000551,0x00000007,0x0004003b,0x0000000d, + 0x00000553,0x00000007,0x0004003b,0x0000000d,0x00000556,0x00000007,0x0004003b,0x0000000d, + 0x00000563,0x00000007,0x0004003b,0x0000003b,0x00000564,0x00000007,0x0004003b,0x00000026, + 0x00000566,0x00000007,0x0004003b,0x00000026,0x00000568,0x00000007,0x0004003b,0x0000003b, + 0x0000056d,0x00000007,0x0004003b,0x0000000d,0x0000056f,0x00000007,0x0004003b,0x0000000d, + 0x00000571,0x00000007,0x0004003b,0x00000026,0x00000573,0x00000007,0x0004003b,0x00000026, + 0x00000575,0x00000007,0x0004003b,0x0000001b,0x00000577,0x00000007,0x0004003b,0x0000001b, + 0x0000057c,0x00000007,0x0004003b,0x0000000d,0x00000580,0x00000007,0x0004003b,0x00000008, + 0x00000581,0x00000007,0x0004003b,0x0000000d,0x00000585,0x00000007,0x00050041,0x0000041a, + 0x0000041b,0x00000419,0x00000167,0x0004003d,0x00000006,0x0000041c,0x0000041b,0x0008000c, + 0x00000006,0x0000041d,0x00000001,0x0000002b,0x0000041c,0x000000a5,0x000000b2,0x0003003e, + 0x00000416,0x0000041d,0x0004003d,0x00000006,0x0000041f,0x00000416,0x00050083,0x00000006, + 0x00000420,0x0000041f,0x000002c8,0x0003003e,0x0000041e,0x00000420,0x0004003d,0x00000006, + 0x00000422,0x0000041e,0x000500be,0x000000a6,0x00000423,0x00000422,0x000000a5,0x000600a9, + 0x00000006,0x00000426,0x00000423,0x00000424,0x00000425,0x0003003e,0x00000421,0x00000426, + 0x0004003d,0x00000006,0x00000428,0x0000041e,0x000500be,0x000000a6,0x00000429,0x00000428, + 0x000000a5,0x000600a9,0x00000006,0x0000042a,0x00000429,0x00000424,0x000000b2,0x0003003e, + 0x00000427,0x0000042a,0x0004003d,0x00000006,0x0000042c,0x0000041e,0x000500be,0x000000a6, + 0x0000042d,0x0000042c,0x000000a5,0x000600a9,0x00000006,0x0000042e,0x0000042d,0x00000424, + 0x000000b2,0x0003003e,0x0000042b,0x0000042e,0x0004003d,0x00000006,0x00000430,0x0000041e, + 0x0004003d,0x00000006,0x00000431,0x00000427,0x00050085,0x00000006,0x00000432,0x00000430, + 0x00000431,0x00050085,0x00000006,0x00000434,0x00000432,0x00000433,0x00050081,0x00000006, + 0x00000435,0x0000042f,0x00000434,0x0007000c,0x00000006,0x00000436,0x00000001,0x00000028, + 0x000000a5,0x00000435,0x0003003e,0x000001e6,0x00000436,0x0004003d,0x00000006,0x00000439, + 0x0000041e,0x0004003d,0x00000006,0x0000043a,0x00000421,0x00050085,0x00000006,0x0000043b, + 0x00000439,0x0000043a,0x00050085,0x00000006,0x0000043d,0x0000043b,0x0000043c,0x00050081, + 0x00000006,0x0000043e,0x00000438,0x0000043d,0x0003003e,0x00000437,0x0000043e,0x0004003d, + 0x00000006,0x0000043f,0x00000437,0x0004003d,0x00000006,0x00000440,0x000001e6,0x00050083, + 0x00000006,0x00000441,0x0000043f,0x00000440,0x0003003e,0x000001e3,0x00000441,0x0004003d, + 0x00000006,0x00000444,0x0000041e,0x0004003d,0x00000006,0x00000445,0x0000042b,0x00050085, + 0x00000006,0x00000446,0x00000444,0x00000445,0x00050085,0x00000006,0x00000448,0x00000446, + 0x00000447,0x00050081,0x00000006,0x00000449,0x00000443,0x00000448,0x0007000c,0x00000006, + 0x0000044a,0x00000001,0x00000028,0x00000442,0x00000449,0x0003003e,0x000001f1,0x0000044a, + 0x0004003d,0x00000006,0x0000044c,0x0000041e,0x0004003d,0x00000006,0x0000044d,0x0000042b, + 0x00050085,0x00000006,0x0000044e,0x0000044c,0x0000044d,0x00050085,0x00000006,0x00000450, + 0x0000044e,0x0000044f,0x00050081,0x00000006,0x00000451,0x000002c8,0x00000450,0x0003003e, + 0x0000044b,0x00000451,0x0004003d,0x00000006,0x00000452,0x0000044b,0x0004003d,0x00000006, + 0x00000453,0x000001f1,0x00050083,0x00000006,0x00000454,0x00000452,0x00000453,0x0003003e, + 0x000001ee,0x00000454,0x00050041,0x00000458,0x00000459,0x00000419,0x0000016f,0x0004003d, + 0x0000000e,0x0000045a,0x00000459,0x0007004f,0x00000455,0x0000045b,0x0000045a,0x0000045a, + 0x00000002,0x00000003,0x0003003e,0x00000457,0x0000045b,0x00050041,0x00000458,0x0000045d, + 0x00000419,0x0000016f,0x0004003d,0x0000000e,0x0000045e,0x0000045d,0x0007004f,0x00000455, + 0x0000045f,0x0000045e,0x0000045e,0x00000000,0x00000001,0x0003003e,0x0000045c,0x0000045f, + 0x00050041,0x00000463,0x00000464,0x00000462,0x0000004c,0x0004003d,0x00000006,0x00000465, + 0x00000464,0x00050041,0x0000000d,0x00000466,0x00000457,0x0000004c,0x0004003d,0x00000006, + 0x00000467,0x00000466,0x00050085,0x00000006,0x00000468,0x00000465,0x00000467,0x00050083, + 0x00000006,0x00000469,0x00000468,0x000002c8,0x0003003e,0x00000460,0x00000469,0x00050041, + 0x00000463,0x0000046b,0x00000462,0x00000051,0x0004003d,0x00000006,0x0000046c,0x0000046b, + 0x00050041,0x0000000d,0x0000046d,0x00000457,0x00000051,0x0004003d,0x00000006,0x0000046e, + 0x0000046d,0x00050085,0x00000006,0x0000046f,0x0000046c,0x0000046e,0x00050083,0x00000006, + 0x00000470,0x0000046f,0x000002c8,0x0003003e,0x0000046a,0x00000470,0x0004003d,0x00000006, + 0x00000472,0x00000460,0x0006000c,0x00000006,0x00000473,0x00000001,0x00000008,0x00000472, + 0x0003003e,0x00000471,0x00000473,0x0004003d,0x00000006,0x00000475,0x0000046a,0x0006000c, + 0x00000006,0x00000476,0x00000001,0x00000008,0x00000475,0x0003003e,0x00000474,0x00000476, + 0x0004003d,0x00000006,0x00000478,0x00000460,0x0004003d,0x00000006,0x00000479,0x00000471, + 0x00050083,0x00000006,0x0000047a,0x00000478,0x00000479,0x0003003e,0x00000477,0x0000047a, + 0x0004003d,0x00000006,0x0000047c,0x0000046a,0x0004003d,0x00000006,0x0000047d,0x00000474, + 0x00050083,0x00000006,0x0000047e,0x0000047c,0x0000047d,0x0003003e,0x0000047b,0x0000047e, + 0x0004003d,0x00000006,0x00000480,0x00000477,0x00050085,0x00000006,0x00000481,0x00000480, + 0x00000361,0x0004006e,0x00000025,0x00000482,0x00000481,0x0003003e,0x0000047f,0x00000482, + 0x0004003d,0x00000006,0x00000484,0x0000047b,0x00050085,0x00000006,0x00000485,0x00000484, + 0x00000361,0x0004006e,0x00000025,0x00000486,0x00000485,0x0003003e,0x00000483,0x00000486, + 0x0003003e,0x00000487,0x0000015c,0x000200f9,0x00000488,0x000200f8,0x00000488,0x000400f6, + 0x0000048a,0x0000048b,0x00000000,0x000200f9,0x0000048c,0x000200f8,0x0000048c,0x0004003d, + 0x00000025,0x0000048d,0x00000487,0x000500b1,0x000000a6,0x0000048e,0x0000048d,0x00000197, + 0x000400fa,0x0000048e,0x00000489,0x0000048a,0x000200f8,0x00000489,0x0003003e,0x0000048f, + 0x0000015c,0x000200f9,0x00000490,0x000200f8,0x00000490,0x000400f6,0x00000492,0x00000493, + 0x00000000,0x000200f9,0x00000494,0x000200f8,0x00000494,0x0004003d,0x00000025,0x00000495, + 0x0000048f,0x000500b1,0x000000a6,0x00000496,0x00000495,0x00000197,0x000400fa,0x00000496, + 0x00000491,0x00000492,0x000200f8,0x00000491,0x0004003d,0x00000006,0x00000498,0x00000471, + 0x0004003d,0x00000025,0x00000499,0x0000048f,0x00050084,0x00000025,0x0000049a,0x00000167, + 0x00000499,0x00050082,0x00000025,0x0000049b,0x0000049a,0x0000016f,0x0004006f,0x00000006, + 0x0000049c,0x0000049b,0x00050081,0x00000006,0x0000049d,0x00000498,0x0000049c,0x0004003d, + 0x00000006,0x0000049e,0x00000474,0x0004003d,0x00000025,0x0000049f,0x00000487,0x00050084, + 0x00000025,0x000004a0,0x00000167,0x0000049f,0x00050082,0x00000025,0x000004a1,0x000004a0, + 0x0000016f,0x0004006f,0x00000006,0x000004a2,0x000004a1,0x00050081,0x00000006,0x000004a3, + 0x0000049e,0x000004a2,0x00050050,0x00000455,0x000004a4,0x0000049d,0x000004a3,0x0004003d, + 0x00000455,0x000004a5,0x0000045c,0x00050085,0x00000455,0x000004a6,0x000004a4,0x000004a5, + 0x0003003e,0x00000497,0x000004a6,0x0004003d,0x000004a9,0x000004ac,0x000004ab,0x0004003d, + 0x00000455,0x000004ad,0x00000497,0x00060060,0x0000000e,0x000004ae,0x000004ac,0x000004ad, + 0x00000197,0x0003003e,0x000004a7,0x000004ae,0x0004003d,0x00000025,0x000004b0,0x00000487, + 0x00050084,0x00000025,0x000004b1,0x00000167,0x000004b0,0x0004003d,0x00000025,0x000004b2, + 0x0000048f,0x00050084,0x00000025,0x000004b3,0x00000167,0x000004b2,0x00050041,0x0000000d, + 0x000004b4,0x000004a7,0x00000194,0x0004003d,0x00000006,0x000004b5,0x000004b4,0x00060041, + 0x0000000d,0x000004b6,0x000004af,0x000004b1,0x000004b3,0x0003003e,0x000004b6,0x000004b5, + 0x0004003d,0x00000025,0x000004b7,0x00000487,0x00050084,0x00000025,0x000004b8,0x00000167, + 0x000004b7,0x0004003d,0x00000025,0x000004b9,0x0000048f,0x00050084,0x00000025,0x000004ba, + 0x00000167,0x000004b9,0x00050080,0x00000025,0x000004bb,0x000004ba,0x0000016f,0x00050041, + 0x0000000d,0x000004bc,0x000004a7,0x00000057,0x0004003d,0x00000006,0x000004bd,0x000004bc, + 0x00060041,0x0000000d,0x000004be,0x000004af,0x000004b8,0x000004bb,0x0003003e,0x000004be, + 0x000004bd,0x0004003d,0x00000025,0x000004bf,0x00000487,0x00050084,0x00000025,0x000004c0, + 0x00000167,0x000004bf,0x00050080,0x00000025,0x000004c1,0x000004c0,0x0000016f,0x0004003d, + 0x00000025,0x000004c2,0x0000048f,0x00050084,0x00000025,0x000004c3,0x00000167,0x000004c2, + 0x00050041,0x0000000d,0x000004c4,0x000004a7,0x0000004c,0x0004003d,0x00000006,0x000004c5, + 0x000004c4,0x00060041,0x0000000d,0x000004c6,0x000004af,0x000004c1,0x000004c3,0x0003003e, + 0x000004c6,0x000004c5,0x0004003d,0x00000025,0x000004c7,0x00000487,0x00050084,0x00000025, + 0x000004c8,0x00000167,0x000004c7,0x00050080,0x00000025,0x000004c9,0x000004c8,0x0000016f, + 0x0004003d,0x00000025,0x000004ca,0x0000048f,0x00050084,0x00000025,0x000004cb,0x00000167, + 0x000004ca,0x00050080,0x00000025,0x000004cc,0x000004cb,0x0000016f,0x00050041,0x0000000d, + 0x000004cd,0x000004a7,0x00000051,0x0004003d,0x00000006,0x000004ce,0x000004cd,0x00060041, + 0x0000000d,0x000004cf,0x000004af,0x000004c9,0x000004cc,0x0003003e,0x000004cf,0x000004ce, + 0x000200f9,0x00000493,0x000200f8,0x00000493,0x0004003d,0x00000025,0x000004d0,0x0000048f, + 0x00050080,0x00000025,0x000004d1,0x000004d0,0x0000016f,0x0003003e,0x0000048f,0x000004d1, + 0x000200f9,0x00000490,0x000200f8,0x00000492,0x000200f9,0x0000048b,0x000200f8,0x0000048b, + 0x0004003d,0x00000025,0x000004d2,0x00000487,0x00050080,0x00000025,0x000004d3,0x000004d2, + 0x0000016f,0x0003003e,0x00000487,0x000004d3,0x000200f9,0x00000488,0x000200f8,0x0000048a, + 0x00060041,0x0000000d,0x000004d6,0x000004af,0x0000016f,0x0000016f,0x0004003d,0x00000006, + 0x000004d7,0x000004d6,0x0003003e,0x000004d5,0x000004d7,0x00060041,0x0000000d,0x000004d9, + 0x000004af,0x0000016f,0x00000167,0x0004003d,0x00000006,0x000004da,0x000004d9,0x0003003e, + 0x000004d8,0x000004da,0x00060041,0x0000000d,0x000004dc,0x000004af,0x0000016f,0x00000197, + 0x0004003d,0x00000006,0x000004dd,0x000004dc,0x0003003e,0x000004db,0x000004dd,0x00060041, + 0x0000000d,0x000004df,0x000004af,0x00000167,0x0000016f,0x0004003d,0x00000006,0x000004e0, + 0x000004df,0x0003003e,0x000004de,0x000004e0,0x00060041,0x0000000d,0x000004e2,0x000004af, + 0x00000167,0x00000167,0x0004003d,0x00000006,0x000004e3,0x000004e2,0x0003003e,0x000004e1, + 0x000004e3,0x00060041,0x0000000d,0x000004e5,0x000004af,0x00000167,0x00000197,0x0004003d, + 0x00000006,0x000004e6,0x000004e5,0x0003003e,0x000004e4,0x000004e6,0x00060041,0x0000000d, + 0x000004e8,0x000004af,0x00000197,0x0000016f,0x0004003d,0x00000006,0x000004e9,0x000004e8, + 0x0003003e,0x000004e7,0x000004e9,0x00060041,0x0000000d,0x000004eb,0x000004af,0x00000197, + 0x00000167,0x0004003d,0x00000006,0x000004ec,0x000004eb,0x0003003e,0x000004ea,0x000004ec, + 0x00060041,0x0000000d,0x000004ee,0x000004af,0x00000197,0x00000197,0x0004003d,0x00000006, + 0x000004ef,0x000004ee,0x0003003e,0x000004ed,0x000004ef,0x000d0039,0x0000000e,0x000004f0, + 0x00000019,0x000004d5,0x000004d8,0x000004db,0x000004de,0x000004e1,0x000004e4,0x000004e7, + 0x000004ea,0x000004ed,0x0003003e,0x000004d4,0x000004f0,0x00060041,0x0000000d,0x000004f3, + 0x000004af,0x0000016f,0x00000167,0x0004003d,0x00000006,0x000004f4,0x000004f3,0x0003003e, + 0x000004f2,0x000004f4,0x00060041,0x0000000d,0x000004f6,0x000004af,0x0000016f,0x00000197, + 0x0004003d,0x00000006,0x000004f7,0x000004f6,0x0003003e,0x000004f5,0x000004f7,0x00060041, + 0x0000000d,0x000004f9,0x000004af,0x0000016f,0x0000019f,0x0004003d,0x00000006,0x000004fa, + 0x000004f9,0x0003003e,0x000004f8,0x000004fa,0x00060041,0x0000000d,0x000004fc,0x000004af, + 0x00000167,0x00000167,0x0004003d,0x00000006,0x000004fd,0x000004fc,0x0003003e,0x000004fb, + 0x000004fd,0x00060041,0x0000000d,0x000004ff,0x000004af,0x00000167,0x00000197,0x0004003d, + 0x00000006,0x00000500,0x000004ff,0x0003003e,0x000004fe,0x00000500,0x00060041,0x0000000d, + 0x00000502,0x000004af,0x00000167,0x0000019f,0x0004003d,0x00000006,0x00000503,0x00000502, + 0x0003003e,0x00000501,0x00000503,0x00060041,0x0000000d,0x00000505,0x000004af,0x00000197, + 0x00000167,0x0004003d,0x00000006,0x00000506,0x00000505,0x0003003e,0x00000504,0x00000506, + 0x00060041,0x0000000d,0x00000508,0x000004af,0x00000197,0x00000197,0x0004003d,0x00000006, + 0x00000509,0x00000508,0x0003003e,0x00000507,0x00000509,0x00060041,0x0000000d,0x0000050b, + 0x000004af,0x00000197,0x0000019f,0x0004003d,0x00000006,0x0000050c,0x0000050b,0x0003003e, + 0x0000050a,0x0000050c,0x000d0039,0x0000000e,0x0000050d,0x00000019,0x000004f2,0x000004f5, + 0x000004f8,0x000004fb,0x000004fe,0x00000501,0x00000504,0x00000507,0x0000050a,0x0003003e, + 0x000004f1,0x0000050d,0x00060041,0x0000000d,0x00000510,0x000004af,0x00000167,0x0000016f, + 0x0004003d,0x00000006,0x00000511,0x00000510,0x0003003e,0x0000050f,0x00000511,0x00060041, + 0x0000000d,0x00000513,0x000004af,0x00000167,0x00000167,0x0004003d,0x00000006,0x00000514, + 0x00000513,0x0003003e,0x00000512,0x00000514,0x00060041,0x0000000d,0x00000516,0x000004af, + 0x00000167,0x00000197,0x0004003d,0x00000006,0x00000517,0x00000516,0x0003003e,0x00000515, + 0x00000517,0x00060041,0x0000000d,0x00000519,0x000004af,0x00000197,0x0000016f,0x0004003d, + 0x00000006,0x0000051a,0x00000519,0x0003003e,0x00000518,0x0000051a,0x00060041,0x0000000d, + 0x0000051c,0x000004af,0x00000197,0x00000167,0x0004003d,0x00000006,0x0000051d,0x0000051c, + 0x0003003e,0x0000051b,0x0000051d,0x00060041,0x0000000d,0x0000051f,0x000004af,0x00000197, + 0x00000197,0x0004003d,0x00000006,0x00000520,0x0000051f,0x0003003e,0x0000051e,0x00000520, + 0x00060041,0x0000000d,0x00000522,0x000004af,0x0000019f,0x0000016f,0x0004003d,0x00000006, + 0x00000523,0x00000522,0x0003003e,0x00000521,0x00000523,0x00060041,0x0000000d,0x00000525, + 0x000004af,0x0000019f,0x00000167,0x0004003d,0x00000006,0x00000526,0x00000525,0x0003003e, + 0x00000524,0x00000526,0x00060041,0x0000000d,0x00000528,0x000004af,0x0000019f,0x00000197, + 0x0004003d,0x00000006,0x00000529,0x00000528,0x0003003e,0x00000527,0x00000529,0x000d0039, + 0x0000000e,0x0000052a,0x00000019,0x0000050f,0x00000512,0x00000515,0x00000518,0x0000051b, + 0x0000051e,0x00000521,0x00000524,0x00000527,0x0003003e,0x0000050e,0x0000052a,0x00060041, + 0x0000000d,0x0000052d,0x000004af,0x00000167,0x00000167,0x0004003d,0x00000006,0x0000052e, + 0x0000052d,0x0003003e,0x0000052c,0x0000052e,0x00060041,0x0000000d,0x00000530,0x000004af, + 0x00000167,0x00000197,0x0004003d,0x00000006,0x00000531,0x00000530,0x0003003e,0x0000052f, + 0x00000531,0x00060041,0x0000000d,0x00000533,0x000004af,0x00000167,0x0000019f,0x0004003d, + 0x00000006,0x00000534,0x00000533,0x0003003e,0x00000532,0x00000534,0x00060041,0x0000000d, + 0x00000536,0x000004af,0x00000197,0x00000167,0x0004003d,0x00000006,0x00000537,0x00000536, + 0x0003003e,0x00000535,0x00000537,0x00060041,0x0000000d,0x00000539,0x000004af,0x00000197, + 0x00000197,0x0004003d,0x00000006,0x0000053a,0x00000539,0x0003003e,0x00000538,0x0000053a, + 0x00060041,0x0000000d,0x0000053c,0x000004af,0x00000197,0x0000019f,0x0004003d,0x00000006, + 0x0000053d,0x0000053c,0x0003003e,0x0000053b,0x0000053d,0x00060041,0x0000000d,0x0000053f, + 0x000004af,0x0000019f,0x00000167,0x0004003d,0x00000006,0x00000540,0x0000053f,0x0003003e, + 0x0000053e,0x00000540,0x00060041,0x0000000d,0x00000542,0x000004af,0x0000019f,0x00000197, + 0x0004003d,0x00000006,0x00000543,0x00000542,0x0003003e,0x00000541,0x00000543,0x00060041, + 0x0000000d,0x00000545,0x000004af,0x0000019f,0x0000019f,0x0004003d,0x00000006,0x00000546, + 0x00000545,0x0003003e,0x00000544,0x00000546,0x000d0039,0x0000000e,0x00000547,0x00000019, + 0x0000052c,0x0000052f,0x00000532,0x00000535,0x00000538,0x0000053b,0x0000053e,0x00000541, + 0x00000544,0x0003003e,0x0000052b,0x00000547,0x0004003d,0x0000000e,0x0000054a,0x000004d4, + 0x0003003e,0x00000549,0x0000054a,0x0004003d,0x0000000e,0x0000054c,0x000004f1,0x0003003e, + 0x0000054b,0x0000054c,0x0004003d,0x0000000e,0x0000054e,0x0000050e,0x0003003e,0x0000054d, + 0x0000054e,0x0004003d,0x0000000e,0x00000550,0x0000052b,0x0003003e,0x0000054f,0x00000550, + 0x0004003d,0x00000006,0x00000552,0x00000477,0x0003003e,0x00000551,0x00000552,0x0004003d, + 0x00000006,0x00000554,0x0000047b,0x0003003e,0x00000553,0x00000554,0x000a0039,0x0000000e, + 0x00000555,0x00000023,0x00000549,0x0000054b,0x0000054d,0x0000054f,0x00000551,0x00000553, + 0x0003003e,0x00000548,0x00000555,0x00050041,0x0000000d,0x00000557,0x00000548,0x0000004c, + 0x0004003d,0x00000006,0x00000558,0x00000557,0x00050083,0x00000006,0x00000559,0x000000b2, + 0x00000558,0x00050041,0x0000000d,0x0000055a,0x00000548,0x00000051,0x0004003d,0x00000006, + 0x0000055b,0x0000055a,0x00050083,0x00000006,0x0000055c,0x00000559,0x0000055b,0x00050041, + 0x0000000d,0x0000055d,0x00000548,0x00000057,0x0004003d,0x00000006,0x0000055e,0x0000055d, + 0x00050083,0x00000006,0x0000055f,0x0000055c,0x0000055e,0x00050041,0x0000000d,0x00000560, + 0x00000548,0x00000194,0x0004003d,0x00000006,0x00000561,0x00000560,0x00050083,0x00000006, + 0x00000562,0x0000055f,0x00000561,0x0003003e,0x00000556,0x00000562,0x0004003d,0x0000003a, + 0x00000565,0x000004af,0x0003003e,0x00000564,0x00000565,0x0004003d,0x00000025,0x00000567, + 0x0000047f,0x0003003e,0x00000566,0x00000567,0x0004003d,0x00000025,0x00000569,0x00000483, + 0x0003003e,0x00000568,0x00000569,0x00070039,0x00000006,0x0000056a,0x00000040,0x00000564, + 0x00000566,0x00000568,0x0004003d,0x00000006,0x0000056b,0x00000556,0x00050085,0x00000006, + 0x0000056c,0x0000056a,0x0000056b,0x0003003e,0x00000563,0x0000056c,0x0004003d,0x0000003a, + 0x0000056e,0x000004af,0x0003003e,0x0000056d,0x0000056e,0x0004003d,0x00000006,0x00000570, + 0x00000477,0x0003003e,0x0000056f,0x00000570,0x0004003d,0x00000006,0x00000572,0x0000047b, + 0x0003003e,0x00000571,0x00000572,0x0004003d,0x00000025,0x00000574,0x0000047f,0x0003003e, + 0x00000573,0x00000574,0x0004003d,0x00000025,0x00000576,0x00000483,0x0003003e,0x00000575, + 0x00000576,0x0004003d,0x0000000e,0x00000578,0x00000548,0x0003003e,0x00000577,0x00000578, + 0x000a0039,0x00000006,0x00000579,0x00000049,0x0000056d,0x0000056f,0x00000571,0x00000573, + 0x00000575,0x00000577,0x0004003d,0x00000006,0x0000057a,0x00000563,0x00050081,0x00000006, + 0x0000057b,0x0000057a,0x00000579,0x0003003e,0x00000563,0x0000057b,0x0004003d,0x000004a9, + 0x0000057d,0x000004ab,0x0004003d,0x00000455,0x0000057e,0x00000462,0x00050057,0x0000000e, + 0x0000057f,0x0000057d,0x0000057e,0x0003003e,0x0000057c,0x0000057f,0x0004003d,0x0000000e, + 0x00000582,0x0000057c,0x0008004f,0x00000007,0x00000583,0x00000582,0x00000582,0x00000000, + 0x00000001,0x00000002,0x0003003e,0x00000581,0x00000583,0x00050039,0x00000006,0x00000584, + 0x0000000b,0x00000581,0x0003003e,0x00000580,0x00000584,0x0004003d,0x00000006,0x00000586, + 0x00000563,0x0004003d,0x00000006,0x00000587,0x00000580,0x00050083,0x00000006,0x00000588, + 0x00000586,0x00000587,0x0003003e,0x00000585,0x00000588,0x0004003d,0x00000006,0x00000589, + 0x00000585,0x00060050,0x00000007,0x0000058a,0x00000589,0x00000589,0x00000589,0x0004003d, + 0x0000000e,0x0000058b,0x0000057c,0x0008004f,0x00000007,0x0000058c,0x0000058b,0x0000058b, + 0x00000000,0x00000001,0x00000002,0x00050081,0x00000007,0x0000058d,0x0000058c,0x0000058a, + 0x00050041,0x0000000d,0x0000058e,0x0000057c,0x0000004c,0x00050051,0x00000006,0x0000058f, + 0x0000058d,0x00000000,0x0003003e,0x0000058e,0x0000058f,0x00050041,0x0000000d,0x00000590, + 0x0000057c,0x00000051,0x00050051,0x00000006,0x00000591,0x0000058d,0x00000001,0x0003003e, + 0x00000590,0x00000591,0x00050041,0x0000000d,0x00000592,0x0000057c,0x00000057,0x00050051, + 0x00000006,0x00000593,0x0000058d,0x00000002,0x0003003e,0x00000592,0x00000593,0x0004003d, + 0x0000000e,0x00000596,0x0000057c,0x0008004f,0x00000007,0x00000597,0x00000596,0x00000596, + 0x00000000,0x00000001,0x00000002,0x00060050,0x00000007,0x00000598,0x000000a5,0x000000a5, + 0x000000a5,0x00060050,0x00000007,0x00000599,0x000000b2,0x000000b2,0x000000b2,0x0008000c, + 0x00000007,0x0000059a,0x00000001,0x0000002b,0x00000597,0x00000598,0x00000599,0x00050051, + 0x00000006,0x0000059b,0x0000059a,0x00000000,0x00050051,0x00000006,0x0000059c,0x0000059a, + 0x00000001,0x00050051,0x00000006,0x0000059d,0x0000059a,0x00000002,0x00070050,0x0000000e, + 0x0000059e,0x0000059b,0x0000059c,0x0000059d,0x000000b2,0x0003003e,0x00000595,0x0000059e, + 0x000100fd,0x00010038,0x00050036,0x00000006,0x0000000b,0x00000000,0x00000009,0x00030037, + 0x00000008,0x0000000a,0x000200f8,0x0000000c,0x00050041,0x0000000d,0x0000004d,0x0000000a, + 0x0000004c,0x0004003d,0x00000006,0x0000004e,0x0000004d,0x00050085,0x00000006,0x0000004f, + 0x0000004b,0x0000004e,0x00050041,0x0000000d,0x00000052,0x0000000a,0x00000051,0x0004003d, + 0x00000006,0x00000053,0x00000052,0x00050085,0x00000006,0x00000054,0x00000050,0x00000053, + 0x00050081,0x00000006,0x00000055,0x0000004f,0x00000054,0x00050041,0x0000000d,0x00000058, + 0x0000000a,0x00000057,0x0004003d,0x00000006,0x00000059,0x00000058,0x00050085,0x00000006, + 0x0000005a,0x00000056,0x00000059,0x00050081,0x00000006,0x0000005b,0x00000055,0x0000005a, + 0x000200fe,0x0000005b,0x00010038,0x00050036,0x0000000e,0x00000019,0x00000000,0x0000000f, + 0x00030037,0x0000000d,0x00000010,0x00030037,0x0000000d,0x00000011,0x00030037,0x0000000d, + 0x00000012,0x00030037,0x0000000d,0x00000013,0x00030037,0x0000000d,0x00000014,0x00030037, + 0x0000000d,0x00000015,0x00030037,0x0000000d,0x00000016,0x00030037,0x0000000d,0x00000017, + 0x00030037,0x0000000d,0x00000018,0x000200f8,0x0000001a,0x0004003b,0x0000000d,0x0000005e, + 0x00000007,0x0004003b,0x0000000d,0x0000006b,0x00000007,0x0004003b,0x0000000d,0x00000078, + 0x00000007,0x0004003b,0x0000000d,0x00000085,0x00000007,0x0004003b,0x0000000d,0x00000092, + 0x00000007,0x0004003b,0x0000000d,0x00000096,0x00000007,0x0004003b,0x0000000d,0x0000009a, + 0x00000007,0x0004003b,0x0000000d,0x0000009e,0x00000007,0x0004003b,0x0000000d,0x000000ac, + 0x00000007,0x0004003b,0x0000000d,0x000000b4,0x00000007,0x0004003b,0x000000b7,0x000000b8, + 0x00000007,0x0004003b,0x000000b7,0x000000c6,0x00000007,0x0004003b,0x000000b7,0x000000d2, + 0x00000007,0x0004003b,0x000000b7,0x000000d6,0x00000007,0x0004003b,0x0000000d,0x000000da, + 0x00000007,0x0004003b,0x0000000d,0x000000e0,0x00000007,0x0004003b,0x0000000d,0x000000e6, + 0x00000007,0x0004003b,0x0000000d,0x000000ec,0x00000007,0x0004003b,0x0000000d,0x000000f3, + 0x00000007,0x0004003b,0x0000000d,0x000000f9,0x00000007,0x0004003d,0x00000006,0x0000005f, + 0x00000010,0x0004003d,0x00000006,0x00000060,0x00000011,0x00050081,0x00000006,0x00000061, + 0x0000005f,0x00000060,0x0004003d,0x00000006,0x00000062,0x00000012,0x00050081,0x00000006, + 0x00000063,0x00000061,0x00000062,0x0004003d,0x00000006,0x00000064,0x00000016,0x00050083, + 0x00000006,0x00000065,0x00000063,0x00000064,0x0004003d,0x00000006,0x00000066,0x00000017, + 0x00050083,0x00000006,0x00000067,0x00000065,0x00000066,0x0004003d,0x00000006,0x00000068, + 0x00000018,0x00050083,0x00000006,0x00000069,0x00000067,0x00000068,0x0006000c,0x00000006, + 0x0000006a,0x00000001,0x00000004,0x00000069,0x0003003e,0x0000005e,0x0000006a,0x0004003d, + 0x00000006,0x0000006c,0x00000013,0x0004003d,0x00000006,0x0000006d,0x00000010,0x00050081, + 0x00000006,0x0000006e,0x0000006c,0x0000006d,0x0004003d,0x00000006,0x0000006f,0x00000011, + 0x00050081,0x00000006,0x00000070,0x0000006e,0x0000006f,0x0004003d,0x00000006,0x00000071, + 0x00000017,0x00050083,0x00000006,0x00000072,0x00000070,0x00000071,0x0004003d,0x00000006, + 0x00000073,0x00000018,0x00050083,0x00000006,0x00000074,0x00000072,0x00000073,0x0004003d, + 0x00000006,0x00000075,0x00000015,0x00050083,0x00000006,0x00000076,0x00000074,0x00000075, + 0x0006000c,0x00000006,0x00000077,0x00000001,0x00000004,0x00000076,0x0003003e,0x0000006b, + 0x00000077,0x0004003d,0x00000006,0x00000079,0x00000010,0x0004003d,0x00000006,0x0000007a, + 0x00000013,0x00050081,0x00000006,0x0000007b,0x00000079,0x0000007a,0x0004003d,0x00000006, + 0x0000007c,0x00000016,0x00050081,0x00000006,0x0000007d,0x0000007b,0x0000007c,0x0004003d, + 0x00000006,0x0000007e,0x00000012,0x00050083,0x00000006,0x0000007f,0x0000007d,0x0000007e, + 0x0004003d,0x00000006,0x00000080,0x00000015,0x00050083,0x00000006,0x00000081,0x0000007f, + 0x00000080,0x0004003d,0x00000006,0x00000082,0x00000018,0x00050083,0x00000006,0x00000083, + 0x00000081,0x00000082,0x0006000c,0x00000006,0x00000084,0x00000001,0x00000004,0x00000083, + 0x0003003e,0x00000078,0x00000084,0x0004003d,0x00000006,0x00000086,0x00000013,0x0004003d, + 0x00000006,0x00000087,0x00000016,0x00050081,0x00000006,0x00000088,0x00000086,0x00000087, + 0x0004003d,0x00000006,0x00000089,0x00000017,0x00050081,0x00000006,0x0000008a,0x00000088, + 0x00000089,0x0004003d,0x00000006,0x0000008b,0x00000011,0x00050083,0x00000006,0x0000008c, + 0x0000008a,0x0000008b,0x0004003d,0x00000006,0x0000008d,0x00000012,0x00050083,0x00000006, + 0x0000008e,0x0000008c,0x0000008d,0x0004003d,0x00000006,0x0000008f,0x00000015,0x00050083, + 0x00000006,0x00000090,0x0000008e,0x0000008f,0x0006000c,0x00000006,0x00000091,0x00000001, + 0x00000004,0x00000090,0x0003003e,0x00000085,0x00000091,0x0004003d,0x00000006,0x00000093, + 0x0000005e,0x0004003d,0x00000006,0x00000094,0x00000078,0x0007000c,0x00000006,0x00000095, + 0x00000001,0x00000028,0x00000093,0x00000094,0x0003003e,0x00000092,0x00000095,0x0004003d, + 0x00000006,0x00000097,0x0000005e,0x0004003d,0x00000006,0x00000098,0x00000078,0x0007000c, + 0x00000006,0x00000099,0x00000001,0x00000025,0x00000097,0x00000098,0x0003003e,0x00000096, + 0x00000099,0x0004003d,0x00000006,0x0000009b,0x0000006b,0x0004003d,0x00000006,0x0000009c, + 0x00000085,0x0007000c,0x00000006,0x0000009d,0x00000001,0x00000028,0x0000009b,0x0000009c, + 0x0003003e,0x0000009a,0x0000009d,0x0004003d,0x00000006,0x0000009f,0x0000006b,0x0004003d, + 0x00000006,0x000000a0,0x00000085,0x0007000c,0x00000006,0x000000a1,0x00000001,0x00000025, + 0x0000009f,0x000000a0,0x0003003e,0x0000009e,0x000000a1,0x0004003d,0x00000006,0x000000a2, + 0x00000092,0x0004003d,0x00000006,0x000000a3,0x0000009a,0x00050081,0x00000006,0x000000a4, + 0x000000a2,0x000000a3,0x000500b4,0x000000a6,0x000000a7,0x000000a4,0x000000a5,0x000300f7, + 0x000000a9,0x00000000,0x000400fa,0x000000a7,0x000000a8,0x000000a9,0x000200f8,0x000000a8, + 0x000200fe,0x000000aa,0x000200f8,0x000000a9,0x0004003d,0x00000006,0x000000ad,0x00000092, + 0x0004003d,0x00000006,0x000000ae,0x00000092,0x0004003d,0x00000006,0x000000af,0x0000009a, + 0x00050081,0x00000006,0x000000b0,0x000000ae,0x000000af,0x00050088,0x00000006,0x000000b1, + 0x000000ad,0x000000b0,0x0007000c,0x00000006,0x000000b3,0x00000001,0x00000025,0x000000b1, + 0x000000b2,0x0003003e,0x000000ac,0x000000b3,0x0004003d,0x00000006,0x000000b5,0x000000ac, + 0x00050083,0x00000006,0x000000b6,0x000000b2,0x000000b5,0x0003003e,0x000000b4,0x000000b6, + 0x0004003d,0x00000006,0x000000b9,0x00000092,0x0004003d,0x00000006,0x000000ba,0x00000096, + 0x00050085,0x00000006,0x000000bc,0x000000ba,0x000000bb,0x000500ba,0x000000a6,0x000000bd, + 0x000000b9,0x000000bc,0x0004003d,0x00000006,0x000000be,0x00000092,0x000500ba,0x000000a6, + 0x000000c0,0x000000be,0x000000bf,0x000500a7,0x000000a6,0x000000c1,0x000000bd,0x000000c0, + 0x0004003d,0x00000006,0x000000c2,0x00000092,0x0004003d,0x00000006,0x000000c3,0x0000009e, + 0x000500ba,0x000000a6,0x000000c4,0x000000c2,0x000000c3,0x000500a7,0x000000a6,0x000000c5, + 0x000000c1,0x000000c4,0x0003003e,0x000000b8,0x000000c5,0x0004003d,0x00000006,0x000000c7, + 0x0000009a,0x0004003d,0x00000006,0x000000c8,0x0000009e,0x00050085,0x00000006,0x000000c9, + 0x000000c8,0x000000bb,0x000500ba,0x000000a6,0x000000ca,0x000000c7,0x000000c9,0x0004003d, + 0x00000006,0x000000cb,0x0000009a,0x000500ba,0x000000a6,0x000000cc,0x000000cb,0x000000bf, + 0x000500a7,0x000000a6,0x000000cd,0x000000ca,0x000000cc,0x0004003d,0x00000006,0x000000ce, + 0x0000009a,0x0004003d,0x00000006,0x000000cf,0x00000096,0x000500ba,0x000000a6,0x000000d0, + 0x000000ce,0x000000cf,0x000500a7,0x000000a6,0x000000d1,0x000000cd,0x000000d0,0x0003003e, + 0x000000c6,0x000000d1,0x0004003d,0x00000006,0x000000d3,0x00000092,0x0004003d,0x00000006, + 0x000000d4,0x0000005e,0x000500b4,0x000000a6,0x000000d5,0x000000d3,0x000000d4,0x0003003e, + 0x000000d2,0x000000d5,0x0004003d,0x00000006,0x000000d7,0x0000009a,0x0004003d,0x00000006, + 0x000000d8,0x0000006b,0x000500b4,0x000000a6,0x000000d9,0x000000d7,0x000000d8,0x0003003e, + 0x000000d6,0x000000d9,0x0004003d,0x000000a6,0x000000db,0x000000b8,0x0004003d,0x000000a6, + 0x000000dc,0x000000c6,0x000500a7,0x000000a6,0x000000dd,0x000000db,0x000000dc,0x0004003d, + 0x00000006,0x000000de,0x000000ac,0x000600a9,0x00000006,0x000000df,0x000000dd,0x000000de, + 0x000000b2,0x0003003e,0x000000da,0x000000df,0x0004003d,0x000000a6,0x000000e1,0x000000b8, + 0x0004003d,0x000000a6,0x000000e2,0x000000c6,0x000500a7,0x000000a6,0x000000e3,0x000000e1, + 0x000000e2,0x0004003d,0x00000006,0x000000e4,0x000000b4,0x000600a9,0x00000006,0x000000e5, + 0x000000e3,0x000000e4,0x000000b2,0x0003003e,0x000000e0,0x000000e5,0x0004003d,0x000000a6, + 0x000000e7,0x000000b8,0x0004003d,0x000000a6,0x000000e8,0x000000d2,0x000500a7,0x000000a6, + 0x000000e9,0x000000e7,0x000000e8,0x0004003d,0x00000006,0x000000ea,0x000000da,0x000600a9, + 0x00000006,0x000000eb,0x000000e9,0x000000ea,0x000000a5,0x0003003e,0x000000e6,0x000000eb, + 0x0004003d,0x000000a6,0x000000ed,0x000000b8,0x0004003d,0x000000a6,0x000000ee,0x000000d2, + 0x000400a8,0x000000a6,0x000000ef,0x000000ee,0x000500a7,0x000000a6,0x000000f0,0x000000ed, + 0x000000ef,0x0004003d,0x00000006,0x000000f1,0x000000da,0x000600a9,0x00000006,0x000000f2, + 0x000000f0,0x000000f1,0x000000a5,0x0003003e,0x000000ec,0x000000f2,0x0004003d,0x000000a6, + 0x000000f4,0x000000c6,0x0004003d,0x000000a6,0x000000f5,0x000000d6,0x000500a7,0x000000a6, + 0x000000f6,0x000000f4,0x000000f5,0x0004003d,0x00000006,0x000000f7,0x000000e0,0x000600a9, + 0x00000006,0x000000f8,0x000000f6,0x000000f7,0x000000a5,0x0003003e,0x000000f3,0x000000f8, + 0x0004003d,0x000000a6,0x000000fa,0x000000c6,0x0004003d,0x000000a6,0x000000fb,0x000000d6, + 0x000400a8,0x000000a6,0x000000fc,0x000000fb,0x000500a7,0x000000a6,0x000000fd,0x000000fa, + 0x000000fc,0x0004003d,0x00000006,0x000000fe,0x000000e0,0x000600a9,0x00000006,0x000000ff, + 0x000000fd,0x000000fe,0x000000a5,0x0003003e,0x000000f9,0x000000ff,0x0004003d,0x00000006, + 0x00000100,0x000000e6,0x0004003d,0x00000006,0x00000101,0x000000ec,0x0004003d,0x00000006, + 0x00000102,0x000000f3,0x0004003d,0x00000006,0x00000103,0x000000f9,0x00070050,0x0000000e, + 0x00000104,0x00000100,0x00000101,0x00000102,0x00000103,0x000200fe,0x00000104,0x00010038, + 0x00050036,0x0000000e,0x00000023,0x00000000,0x0000001c,0x00030037,0x0000001b,0x0000001d, + 0x00030037,0x0000001b,0x0000001e,0x00030037,0x0000001b,0x0000001f,0x00030037,0x0000001b, + 0x00000020,0x00030037,0x0000000d,0x00000021,0x00030037,0x0000000d,0x00000022,0x000200f8, + 0x00000024,0x0004003b,0x0000001b,0x00000107,0x00000007,0x0004003b,0x0000001b,0x0000010d, + 0x00000007,0x0004003d,0x0000000e,0x00000108,0x0000001d,0x0004003d,0x0000000e,0x00000109, + 0x0000001e,0x0004003d,0x00000006,0x0000010a,0x00000021,0x00070050,0x0000000e,0x0000010b, + 0x0000010a,0x0000010a,0x0000010a,0x0000010a,0x0008000c,0x0000000e,0x0000010c,0x00000001, + 0x0000002e,0x00000108,0x00000109,0x0000010b,0x0003003e,0x00000107,0x0000010c,0x0004003d, + 0x0000000e,0x0000010e,0x0000001f,0x0004003d,0x0000000e,0x0000010f,0x00000020,0x0004003d, + 0x00000006,0x00000110,0x00000021,0x00070050,0x0000000e,0x00000111,0x00000110,0x00000110, + 0x00000110,0x00000110,0x0008000c,0x0000000e,0x00000112,0x00000001,0x0000002e,0x0000010e, + 0x0000010f,0x00000111,0x0003003e,0x0000010d,0x00000112,0x0004003d,0x0000000e,0x00000113, + 0x00000107,0x0004003d,0x0000000e,0x00000114,0x0000010d,0x0004003d,0x00000006,0x00000115, + 0x00000022,0x00070050,0x0000000e,0x00000116,0x00000115,0x00000115,0x00000115,0x00000115, + 0x0008000c,0x0000000e,0x00000117,0x00000001,0x0000002e,0x00000113,0x00000114,0x00000116, + 0x000200fe,0x00000117,0x00010038,0x00050036,0x00000006,0x0000002f,0x00000000,0x00000027, + 0x00030037,0x0000000d,0x00000028,0x00030037,0x0000000d,0x00000029,0x00030037,0x0000000d, + 0x0000002a,0x00030037,0x0000000d,0x0000002b,0x00030037,0x0000000d,0x0000002c,0x00030037, + 0x0000000d,0x0000002d,0x00030037,0x00000026,0x0000002e,0x000200f8,0x00000030,0x0004003b, + 0x000000b7,0x0000011a,0x00000007,0x0004003b,0x0000000d,0x0000011e,0x00000007,0x0004003b, + 0x0000000d,0x00000123,0x00000007,0x0004003b,0x0000000d,0x00000129,0x00000007,0x0004003b, + 0x0000000d,0x00000133,0x00000007,0x0004003b,0x0000000d,0x00000139,0x00000007,0x0004003b, + 0x0000000d,0x0000013f,0x00000007,0x0004003b,0x0000000d,0x00000143,0x00000007,0x0004003b, + 0x0000000d,0x00000147,0x00000007,0x0004003d,0x00000025,0x0000011b,0x0000002e,0x000500b3, + 0x000000a6,0x0000011d,0x0000011b,0x0000011c,0x0003003e,0x0000011a,0x0000011d,0x0004003d, + 0x000000a6,0x0000011f,0x0000011a,0x0004003d,0x00000006,0x00000120,0x00000028,0x0004003d, + 0x00000006,0x00000121,0x0000002b,0x000600a9,0x00000006,0x00000122,0x0000011f,0x00000120, + 0x00000121,0x0003003e,0x0000011e,0x00000122,0x0004003d,0x00000006,0x00000124,0x00000029, + 0x0004003d,0x00000006,0x00000125,0x0000002a,0x0007000c,0x00000006,0x00000126,0x00000001, + 0x00000025,0x00000124,0x00000125,0x0004003d,0x00000006,0x00000127,0x0000011e,0x0007000c, + 0x00000006,0x00000128,0x00000001,0x00000025,0x00000126,0x00000127,0x0003003e,0x00000123, + 0x00000128,0x0004003d,0x00000006,0x0000012a,0x00000029,0x0004003d,0x00000006,0x0000012b, + 0x0000002a,0x0007000c,0x00000006,0x0000012c,0x00000001,0x00000028,0x0000012a,0x0000012b, + 0x0004003d,0x00000006,0x0000012d,0x0000011e,0x0007000c,0x00000006,0x0000012e,0x00000001, + 0x00000028,0x0000012c,0x0000012d,0x0003003e,0x00000129,0x0000012e,0x0004003d,0x000000a6, + 0x0000012f,0x0000011a,0x0004003d,0x00000006,0x00000130,0x0000002a,0x0004003d,0x00000006, + 0x00000131,0x0000002d,0x000600a9,0x00000006,0x00000132,0x0000012f,0x00000130,0x00000131, + 0x0003003e,0x0000011e,0x00000132,0x0004003d,0x00000006,0x00000134,0x0000002b,0x0004003d, + 0x00000006,0x00000135,0x0000002c,0x0007000c,0x00000006,0x00000136,0x00000001,0x00000025, + 0x00000134,0x00000135,0x0004003d,0x00000006,0x00000137,0x0000011e,0x0007000c,0x00000006, + 0x00000138,0x00000001,0x00000025,0x00000136,0x00000137,0x0003003e,0x00000133,0x00000138, + 0x0004003d,0x00000006,0x0000013a,0x0000002b,0x0004003d,0x00000006,0x0000013b,0x0000002c, + 0x0007000c,0x00000006,0x0000013c,0x00000001,0x00000028,0x0000013a,0x0000013b,0x0004003d, + 0x00000006,0x0000013d,0x0000011e,0x0007000c,0x00000006,0x0000013e,0x00000001,0x00000028, + 0x0000013c,0x0000013d,0x0003003e,0x00000139,0x0000013e,0x0004003d,0x00000006,0x00000140, + 0x00000129,0x0004003d,0x00000006,0x00000141,0x00000123,0x00050083,0x00000006,0x00000142, + 0x00000140,0x00000141,0x0003003e,0x0000013f,0x00000142,0x0004003d,0x00000006,0x00000144, + 0x00000139,0x0004003d,0x00000006,0x00000145,0x00000133,0x00050083,0x00000006,0x00000146, + 0x00000144,0x00000145,0x0003003e,0x00000143,0x00000146,0x0004003d,0x00000006,0x00000148, + 0x0000013f,0x0004003d,0x00000006,0x00000149,0x00000143,0x0007000c,0x00000006,0x0000014a, + 0x00000001,0x00000028,0x00000148,0x00000149,0x0004003d,0x00000006,0x0000014b,0x0000013f, + 0x0004003d,0x00000006,0x0000014c,0x00000143,0x0007000c,0x00000006,0x0000014d,0x00000001, + 0x00000025,0x0000014b,0x0000014c,0x00050081,0x00000006,0x0000014f,0x0000014d,0x0000014e, + 0x00050088,0x00000006,0x00000150,0x0000014a,0x0000014f,0x0003003e,0x00000147,0x00000150, + 0x0004003d,0x00000006,0x00000151,0x00000147,0x00050083,0x00000006,0x00000153,0x00000151, + 0x00000152,0x00050085,0x00000006,0x00000155,0x00000153,0x00000154,0x0008000c,0x00000006, + 0x00000156,0x00000001,0x0000002b,0x00000155,0x000000a5,0x000000b2,0x00050083,0x00000006, + 0x00000157,0x000000b2,0x00000156,0x00050085,0x00000006,0x00000158,0x00000157,0x000000b2, + 0x000200fe,0x00000158,0x00010038,0x00050036,0x00000006,0x00000038,0x00000000,0x00000035, + 0x00030037,0x00000034,0x00000036,0x00030037,0x00000026,0x00000037,0x000200f8,0x00000039, + 0x0004003b,0x0000001b,0x0000015f,0x00000007,0x0004003b,0x0000001b,0x0000016c,0x00000007, + 0x0004003b,0x0000001b,0x00000173,0x00000007,0x0004003b,0x0000001b,0x00000178,0x00000007, + 0x0004003b,0x0000000d,0x0000017e,0x00000007,0x0004003b,0x0000000d,0x000001ad,0x00000007, + 0x0004003b,0x0000000d,0x000001d8,0x00000007,0x0004003b,0x0000000d,0x000001e0,0x00000007, + 0x0004003b,0x0000000d,0x000001ec,0x00000007,0x0004003b,0x0000000d,0x000001fc,0x00000007, + 0x0004003b,0x0000000d,0x000001ff,0x00000007,0x0004003b,0x0000000d,0x00000202,0x00000007, + 0x0004003b,0x0000000d,0x00000205,0x00000007,0x0004003b,0x0000000d,0x00000208,0x00000007, + 0x0004003b,0x0000000d,0x0000020b,0x00000007,0x0004003b,0x00000026,0x0000020e,0x00000007, + 0x0004003d,0x00000025,0x0000015b,0x00000037,0x0008000c,0x00000025,0x0000015e,0x00000001, + 0x0000002d,0x0000015b,0x0000015c,0x0000015d,0x0003003e,0x00000037,0x0000015e,0x0004003d, + 0x00000025,0x00000166,0x00000037,0x00050084,0x00000025,0x00000168,0x00000166,0x00000167, + 0x00060041,0x00000169,0x0000016a,0x00000165,0x0000015c,0x00000168,0x0004003d,0x0000000e, + 0x0000016b,0x0000016a,0x0003003e,0x0000015f,0x0000016b,0x0004003d,0x00000025,0x0000016d, + 0x00000037,0x00050084,0x00000025,0x0000016e,0x0000016d,0x00000167,0x00050080,0x00000025, + 0x00000170,0x0000016e,0x0000016f,0x00060041,0x00000169,0x00000171,0x00000165,0x0000015c, + 0x00000170,0x0004003d,0x0000000e,0x00000172,0x00000171,0x0003003e,0x0000016c,0x00000172, + 0x0004003d,0x00000025,0x00000174,0x00000037,0x00050084,0x00000025,0x00000175,0x00000174, + 0x00000167,0x00060041,0x00000169,0x00000176,0x00000165,0x0000016f,0x00000175,0x0004003d, + 0x0000000e,0x00000177,0x00000176,0x0003003e,0x00000173,0x00000177,0x0004003d,0x00000025, + 0x00000179,0x00000037,0x00050084,0x00000025,0x0000017a,0x00000179,0x00000167,0x00050080, + 0x00000025,0x0000017b,0x0000017a,0x0000016f,0x00060041,0x00000169,0x0000017c,0x00000165, + 0x0000016f,0x0000017b,0x0004003d,0x0000000e,0x0000017d,0x0000017c,0x0003003e,0x00000178, + 0x0000017d,0x0003003e,0x0000017e,0x000000a5,0x00050041,0x0000000d,0x0000017f,0x0000015f, + 0x0000004c,0x0004003d,0x00000006,0x00000180,0x0000017f,0x00050041,0x0000000d,0x00000181, + 0x00000036,0x0000015c,0x0004003d,0x00000006,0x00000182,0x00000181,0x00050085,0x00000006, + 0x00000183,0x00000180,0x00000182,0x0004003d,0x00000006,0x00000184,0x0000017e,0x00050081, + 0x00000006,0x00000185,0x00000184,0x00000183,0x0003003e,0x0000017e,0x00000185,0x00050041, + 0x0000000d,0x00000186,0x0000015f,0x00000051,0x0004003d,0x00000006,0x00000187,0x00000186, + 0x00050041,0x0000000d,0x00000188,0x00000036,0x0000016f,0x0004003d,0x00000006,0x00000189, + 0x00000188,0x00050085,0x00000006,0x0000018a,0x00000187,0x00000189,0x0004003d,0x00000006, + 0x0000018b,0x0000017e,0x00050081,0x00000006,0x0000018c,0x0000018b,0x0000018a,0x0003003e, + 0x0000017e,0x0000018c,0x00050041,0x0000000d,0x0000018d,0x0000015f,0x00000057,0x0004003d, + 0x00000006,0x0000018e,0x0000018d,0x00050041,0x0000000d,0x0000018f,0x00000036,0x00000167, + 0x0004003d,0x00000006,0x00000190,0x0000018f,0x00050085,0x00000006,0x00000191,0x0000018e, + 0x00000190,0x0004003d,0x00000006,0x00000192,0x0000017e,0x00050081,0x00000006,0x00000193, + 0x00000192,0x00000191,0x0003003e,0x0000017e,0x00000193,0x00050041,0x0000000d,0x00000195, + 0x0000015f,0x00000194,0x0004003d,0x00000006,0x00000196,0x00000195,0x00050041,0x0000000d, + 0x00000198,0x00000036,0x00000197,0x0004003d,0x00000006,0x00000199,0x00000198,0x00050085, + 0x00000006,0x0000019a,0x00000196,0x00000199,0x0004003d,0x00000006,0x0000019b,0x0000017e, + 0x00050081,0x00000006,0x0000019c,0x0000019b,0x0000019a,0x0003003e,0x0000017e,0x0000019c, + 0x00050041,0x0000000d,0x0000019d,0x0000016c,0x0000004c,0x0004003d,0x00000006,0x0000019e, + 0x0000019d,0x00050041,0x0000000d,0x000001a0,0x00000036,0x0000019f,0x0004003d,0x00000006, + 0x000001a1,0x000001a0,0x00050085,0x00000006,0x000001a2,0x0000019e,0x000001a1,0x0004003d, + 0x00000006,0x000001a3,0x0000017e,0x00050081,0x00000006,0x000001a4,0x000001a3,0x000001a2, + 0x0003003e,0x0000017e,0x000001a4,0x00050041,0x0000000d,0x000001a5,0x0000016c,0x00000051, + 0x0004003d,0x00000006,0x000001a6,0x000001a5,0x00050041,0x0000000d,0x000001a8,0x00000036, + 0x000001a7,0x0004003d,0x00000006,0x000001a9,0x000001a8,0x00050085,0x00000006,0x000001aa, + 0x000001a6,0x000001a9,0x0004003d,0x00000006,0x000001ab,0x0000017e,0x00050081,0x00000006, + 0x000001ac,0x000001ab,0x000001aa,0x0003003e,0x0000017e,0x000001ac,0x0003003e,0x000001ad, + 0x000000a5,0x00050041,0x0000000d,0x000001ae,0x00000173,0x0000004c,0x0004003d,0x00000006, + 0x000001af,0x000001ae,0x00050041,0x0000000d,0x000001b0,0x00000036,0x0000015c,0x0004003d, + 0x00000006,0x000001b1,0x000001b0,0x00050085,0x00000006,0x000001b2,0x000001af,0x000001b1, + 0x0004003d,0x00000006,0x000001b3,0x000001ad,0x00050081,0x00000006,0x000001b4,0x000001b3, + 0x000001b2,0x0003003e,0x000001ad,0x000001b4,0x00050041,0x0000000d,0x000001b5,0x00000173, + 0x00000051,0x0004003d,0x00000006,0x000001b6,0x000001b5,0x00050041,0x0000000d,0x000001b7, + 0x00000036,0x0000016f,0x0004003d,0x00000006,0x000001b8,0x000001b7,0x00050085,0x00000006, + 0x000001b9,0x000001b6,0x000001b8,0x0004003d,0x00000006,0x000001ba,0x000001ad,0x00050081, + 0x00000006,0x000001bb,0x000001ba,0x000001b9,0x0003003e,0x000001ad,0x000001bb,0x00050041, + 0x0000000d,0x000001bc,0x00000173,0x00000057,0x0004003d,0x00000006,0x000001bd,0x000001bc, + 0x00050041,0x0000000d,0x000001be,0x00000036,0x00000167,0x0004003d,0x00000006,0x000001bf, + 0x000001be,0x00050085,0x00000006,0x000001c0,0x000001bd,0x000001bf,0x0004003d,0x00000006, + 0x000001c1,0x000001ad,0x00050081,0x00000006,0x000001c2,0x000001c1,0x000001c0,0x0003003e, + 0x000001ad,0x000001c2,0x00050041,0x0000000d,0x000001c3,0x00000173,0x00000194,0x0004003d, + 0x00000006,0x000001c4,0x000001c3,0x00050041,0x0000000d,0x000001c5,0x00000036,0x00000197, + 0x0004003d,0x00000006,0x000001c6,0x000001c5,0x00050085,0x00000006,0x000001c7,0x000001c4, + 0x000001c6,0x0004003d,0x00000006,0x000001c8,0x000001ad,0x00050081,0x00000006,0x000001c9, + 0x000001c8,0x000001c7,0x0003003e,0x000001ad,0x000001c9,0x00050041,0x0000000d,0x000001ca, + 0x00000178,0x0000004c,0x0004003d,0x00000006,0x000001cb,0x000001ca,0x00050041,0x0000000d, + 0x000001cc,0x00000036,0x0000019f,0x0004003d,0x00000006,0x000001cd,0x000001cc,0x00050085, + 0x00000006,0x000001ce,0x000001cb,0x000001cd,0x0004003d,0x00000006,0x000001cf,0x000001ad, + 0x00050081,0x00000006,0x000001d0,0x000001cf,0x000001ce,0x0003003e,0x000001ad,0x000001d0, + 0x00050041,0x0000000d,0x000001d1,0x00000178,0x00000051,0x0004003d,0x00000006,0x000001d2, + 0x000001d1,0x00050041,0x0000000d,0x000001d3,0x00000036,0x000001a7,0x0004003d,0x00000006, + 0x000001d4,0x000001d3,0x00050085,0x00000006,0x000001d5,0x000001d2,0x000001d4,0x0004003d, + 0x00000006,0x000001d6,0x000001ad,0x00050081,0x00000006,0x000001d7,0x000001d6,0x000001d5, + 0x0003003e,0x000001ad,0x000001d7,0x0004003d,0x00000006,0x000001d9,0x0000017e,0x00050083, + 0x00000006,0x000001db,0x000001d9,0x000001da,0x00050085,0x00000006,0x000001dd,0x000001db, + 0x000001dc,0x0008000c,0x00000006,0x000001de,0x00000001,0x0000002b,0x000001dd,0x000000a5, + 0x000000b2,0x00050083,0x00000006,0x000001df,0x000000b2,0x000001de,0x0003003e,0x000001d8, + 0x000001df,0x0004003d,0x00000006,0x000001e1,0x000001d8,0x0004003d,0x00000006,0x000001e4, + 0x000001e3,0x00050085,0x00000006,0x000001e5,0x000001e1,0x000001e4,0x0004003d,0x00000006, + 0x000001e7,0x000001e6,0x00050081,0x00000006,0x000001e8,0x000001e5,0x000001e7,0x0003003e, + 0x000001e0,0x000001e8,0x0004003d,0x00000006,0x000001e9,0x000001e0,0x0004003d,0x00000006, + 0x000001ea,0x000001ad,0x00050085,0x00000006,0x000001eb,0x000001ea,0x000001e9,0x0003003e, + 0x000001ad,0x000001eb,0x0004003d,0x00000006,0x000001ed,0x000001d8,0x0004003d,0x00000006, + 0x000001ef,0x000001ee,0x00050085,0x00000006,0x000001f0,0x000001ed,0x000001ef,0x0004003d, + 0x00000006,0x000001f2,0x000001f1,0x00050081,0x00000006,0x000001f3,0x000001f0,0x000001f2, + 0x0004003d,0x00000006,0x000001f4,0x0000017e,0x00050085,0x00000006,0x000001f5,0x000001f3, + 0x000001f4,0x0003003e,0x000001ec,0x000001f5,0x0004003d,0x00000006,0x000001f6,0x000001ec, + 0x0004003d,0x00000006,0x000001f7,0x000001ec,0x0004007f,0x00000006,0x000001f8,0x000001f7, + 0x0004003d,0x00000006,0x000001f9,0x000001ad,0x0007000c,0x00000006,0x000001fa,0x00000001, + 0x00000028,0x000001f8,0x000001f9,0x0007000c,0x00000006,0x000001fb,0x00000001,0x00000025, + 0x000001f6,0x000001fa,0x0003003e,0x000001ad,0x000001fb,0x00050041,0x0000000d,0x000001fd, + 0x00000036,0x0000015c,0x0004003d,0x00000006,0x000001fe,0x000001fd,0x0003003e,0x000001fc, + 0x000001fe,0x00050041,0x0000000d,0x00000200,0x00000036,0x0000016f,0x0004003d,0x00000006, + 0x00000201,0x00000200,0x0003003e,0x000001ff,0x00000201,0x00050041,0x0000000d,0x00000203, + 0x00000036,0x00000167,0x0004003d,0x00000006,0x00000204,0x00000203,0x0003003e,0x00000202, + 0x00000204,0x00050041,0x0000000d,0x00000206,0x00000036,0x00000197,0x0004003d,0x00000006, + 0x00000207,0x00000206,0x0003003e,0x00000205,0x00000207,0x00050041,0x0000000d,0x00000209, + 0x00000036,0x0000019f,0x0004003d,0x00000006,0x0000020a,0x00000209,0x0003003e,0x00000208, + 0x0000020a,0x00050041,0x0000000d,0x0000020c,0x00000036,0x000001a7,0x0004003d,0x00000006, + 0x0000020d,0x0000020c,0x0003003e,0x0000020b,0x0000020d,0x0004003d,0x00000025,0x0000020f, + 0x00000037,0x0003003e,0x0000020e,0x0000020f,0x000b0039,0x00000006,0x00000210,0x0000002f, + 0x000001fc,0x000001ff,0x00000202,0x00000205,0x00000208,0x0000020b,0x0000020e,0x0004003d, + 0x00000006,0x00000211,0x000001ad,0x00050085,0x00000006,0x00000212,0x00000211,0x00000210, + 0x0003003e,0x000001ad,0x00000212,0x0004003d,0x00000006,0x00000213,0x0000017e,0x0004003d, + 0x00000006,0x00000214,0x000001ad,0x00050081,0x00000006,0x00000215,0x00000213,0x00000214, + 0x000200fe,0x00000215,0x00010038,0x00050036,0x00000006,0x00000040,0x00000000,0x0000003c, + 0x00030037,0x0000003b,0x0000003d,0x00030037,0x00000026,0x0000003e,0x00030037,0x00000026, + 0x0000003f,0x000200f8,0x00000041,0x0004003b,0x0000001b,0x0000021c,0x00000007,0x0004003b, + 0x0000001b,0x00000221,0x00000007,0x0004003b,0x0000001b,0x00000227,0x00000007,0x0004003b, + 0x0000001b,0x0000022c,0x00000007,0x0004003b,0x00000034,0x00000232,0x00000007,0x0004003b, + 0x00000034,0x00000240,0x00000007,0x0004003b,0x0000000d,0x0000024e,0x00000007,0x0004003b, + 0x00000026,0x0000024f,0x00000007,0x0004003b,0x0000000d,0x00000258,0x00000007,0x0004003b, + 0x00000026,0x00000259,0x00000007,0x0004003d,0x00000025,0x00000218,0x0000003e,0x0008000c, + 0x00000025,0x00000219,0x00000001,0x0000002d,0x00000218,0x0000015c,0x0000015d,0x0003003e, + 0x0000003e,0x00000219,0x0004003d,0x00000025,0x0000021a,0x0000003f,0x0008000c,0x00000025, + 0x0000021b,0x00000001,0x0000002d,0x0000021a,0x0000015c,0x0000015d,0x0003003e,0x0000003f, + 0x0000021b,0x0004003d,0x00000025,0x0000021d,0x0000003f,0x00050084,0x00000025,0x0000021e, + 0x0000021d,0x00000167,0x00060041,0x00000169,0x0000021f,0x00000165,0x0000015c,0x0000021e, + 0x0004003d,0x0000000e,0x00000220,0x0000021f,0x0003003e,0x0000021c,0x00000220,0x0004003d, + 0x00000025,0x00000222,0x0000003f,0x00050084,0x00000025,0x00000223,0x00000222,0x00000167, + 0x00050080,0x00000025,0x00000224,0x00000223,0x0000016f,0x00060041,0x00000169,0x00000225, + 0x00000165,0x0000015c,0x00000224,0x0004003d,0x0000000e,0x00000226,0x00000225,0x0003003e, + 0x00000221,0x00000226,0x0004003d,0x00000025,0x00000228,0x0000003e,0x00050084,0x00000025, + 0x00000229,0x00000228,0x00000167,0x00060041,0x00000169,0x0000022a,0x00000165,0x0000015c, + 0x00000229,0x0004003d,0x0000000e,0x0000022b,0x0000022a,0x0003003e,0x00000227,0x0000022b, + 0x0004003d,0x00000025,0x0000022d,0x0000003e,0x00050084,0x00000025,0x0000022e,0x0000022d, + 0x00000167,0x00050080,0x00000025,0x0000022f,0x0000022e,0x0000016f,0x00060041,0x00000169, + 0x00000230,0x00000165,0x0000015c,0x0000022f,0x0004003d,0x0000000e,0x00000231,0x00000230, + 0x0003003e,0x0000022c,0x00000231,0x00050041,0x0000000d,0x00000233,0x0000021c,0x0000004c, + 0x0004003d,0x00000006,0x00000234,0x00000233,0x00050041,0x0000000d,0x00000235,0x0000021c, + 0x00000051,0x0004003d,0x00000006,0x00000236,0x00000235,0x00050041,0x0000000d,0x00000237, + 0x0000021c,0x00000057,0x0004003d,0x00000006,0x00000238,0x00000237,0x00050041,0x0000000d, + 0x00000239,0x0000021c,0x00000194,0x0004003d,0x00000006,0x0000023a,0x00000239,0x00050041, + 0x0000000d,0x0000023b,0x00000221,0x0000004c,0x0004003d,0x00000006,0x0000023c,0x0000023b, + 0x00050041,0x0000000d,0x0000023d,0x00000221,0x00000051,0x0004003d,0x00000006,0x0000023e, + 0x0000023d,0x00090050,0x00000033,0x0000023f,0x00000234,0x00000236,0x00000238,0x0000023a, + 0x0000023c,0x0000023e,0x0003003e,0x00000232,0x0000023f,0x00050041,0x0000000d,0x00000241, + 0x00000227,0x0000004c,0x0004003d,0x00000006,0x00000242,0x00000241,0x00050041,0x0000000d, + 0x00000243,0x00000227,0x00000051,0x0004003d,0x00000006,0x00000244,0x00000243,0x00050041, + 0x0000000d,0x00000245,0x00000227,0x00000057,0x0004003d,0x00000006,0x00000246,0x00000245, + 0x00050041,0x0000000d,0x00000247,0x00000227,0x00000194,0x0004003d,0x00000006,0x00000248, + 0x00000247,0x00050041,0x0000000d,0x00000249,0x0000022c,0x0000004c,0x0004003d,0x00000006, + 0x0000024a,0x00000249,0x00050041,0x0000000d,0x0000024b,0x0000022c,0x00000051,0x0004003d, + 0x00000006,0x0000024c,0x0000024b,0x00090050,0x00000033,0x0000024d,0x00000242,0x00000244, + 0x00000246,0x00000248,0x0000024a,0x0000024c,0x0003003e,0x00000240,0x0000024d,0x0003003e, + 0x0000024e,0x000000a5,0x0003003e,0x0000024f,0x0000015c,0x000200f9,0x00000250,0x000200f8, + 0x00000250,0x000400f6,0x00000252,0x00000253,0x00000000,0x000200f9,0x00000254,0x000200f8, + 0x00000254,0x0004003d,0x00000025,0x00000255,0x0000024f,0x000500b1,0x000000a6,0x00000257, + 0x00000255,0x00000256,0x000400fa,0x00000257,0x00000251,0x00000252,0x000200f8,0x00000251, + 0x0003003e,0x00000258,0x000000a5,0x0003003e,0x00000259,0x0000015c,0x000200f9,0x0000025a, + 0x000200f8,0x0000025a,0x000400f6,0x0000025c,0x0000025d,0x00000000,0x000200f9,0x0000025e, + 0x000200f8,0x0000025e,0x0004003d,0x00000025,0x0000025f,0x00000259,0x000500b1,0x000000a6, + 0x00000260,0x0000025f,0x00000256,0x000400fa,0x00000260,0x0000025b,0x0000025c,0x000200f8, + 0x0000025b,0x0004003d,0x00000025,0x00000261,0x00000259,0x0004003d,0x00000025,0x00000262, + 0x0000024f,0x00060041,0x0000000d,0x00000263,0x0000003d,0x00000261,0x00000262,0x0004003d, + 0x00000006,0x00000264,0x00000263,0x0004003d,0x00000025,0x00000265,0x00000259,0x00050041, + 0x0000000d,0x00000266,0x00000232,0x00000265,0x0004003d,0x00000006,0x00000267,0x00000266, + 0x00050085,0x00000006,0x00000268,0x00000264,0x00000267,0x0004003d,0x00000006,0x00000269, + 0x00000258,0x00050081,0x00000006,0x0000026a,0x00000269,0x00000268,0x0003003e,0x00000258, + 0x0000026a,0x000200f9,0x0000025d,0x000200f8,0x0000025d,0x0004003d,0x00000025,0x0000026b, + 0x00000259,0x00050080,0x00000025,0x0000026c,0x0000026b,0x0000016f,0x0003003e,0x00000259, + 0x0000026c,0x000200f9,0x0000025a,0x000200f8,0x0000025c,0x0004003d,0x00000006,0x0000026d, + 0x00000258,0x0004003d,0x00000025,0x0000026e,0x0000024f,0x00050041,0x0000000d,0x0000026f, + 0x00000240,0x0000026e,0x0004003d,0x00000006,0x00000270,0x0000026f,0x00050085,0x00000006, + 0x00000271,0x0000026d,0x00000270,0x0004003d,0x00000006,0x00000272,0x0000024e,0x00050081, + 0x00000006,0x00000273,0x00000272,0x00000271,0x0003003e,0x0000024e,0x00000273,0x000200f9, + 0x00000253,0x000200f8,0x00000253,0x0004003d,0x00000025,0x00000274,0x0000024f,0x00050080, + 0x00000025,0x00000275,0x00000274,0x0000016f,0x0003003e,0x0000024f,0x00000275,0x000200f9, + 0x00000250,0x000200f8,0x00000252,0x0004003d,0x00000006,0x00000276,0x0000024e,0x000200fe, + 0x00000276,0x00010038,0x00050036,0x00000006,0x00000049,0x00000000,0x00000042,0x00030037, + 0x0000003b,0x00000043,0x00030037,0x0000000d,0x00000044,0x00030037,0x0000000d,0x00000045, + 0x00030037,0x00000026,0x00000046,0x00030037,0x00000026,0x00000047,0x00030037,0x0000001b, + 0x00000048,0x000200f8,0x0000004a,0x0004003b,0x0000000d,0x00000279,0x00000007,0x0004003b, + 0x00000026,0x0000027f,0x00000007,0x0004003b,0x00000034,0x00000287,0x00000007,0x0004003b, + 0x00000034,0x00000294,0x00000007,0x0004003b,0x00000026,0x00000296,0x00000007,0x0004003b, + 0x00000026,0x000002a3,0x00000007,0x0004003b,0x00000034,0x000002ab,0x00000007,0x0004003b, + 0x00000034,0x000002b8,0x00000007,0x0004003b,0x00000026,0x000002ba,0x00000007,0x0004003b, + 0x0000000d,0x000002c7,0x00000007,0x0004003b,0x000002d0,0x000002d1,0x00000007,0x0004003b, + 0x0000000d,0x000002e9,0x00000007,0x0004003b,0x0000000d,0x000002ec,0x00000007,0x0004003b, + 0x0000000d,0x000002f5,0x00000007,0x0004003b,0x0000000d,0x000002f8,0x00000007,0x0004003b, + 0x0000000d,0x00000301,0x00000007,0x0004003b,0x0000000d,0x00000304,0x00000007,0x0004003b, + 0x0000000d,0x0000030d,0x00000007,0x0004003b,0x0000000d,0x00000310,0x00000007,0x0004003b, + 0x0000000d,0x00000335,0x00000007,0x0004003b,0x00000026,0x0000033d,0x00000007,0x0004003b, + 0x00000034,0x00000345,0x00000007,0x0004003b,0x00000026,0x00000351,0x00000007,0x0004003b, + 0x00000034,0x00000364,0x00000007,0x0004003b,0x00000026,0x00000366,0x00000007,0x0004003b, + 0x0000000d,0x00000372,0x00000007,0x0004003b,0x000002d0,0x00000377,0x00000007,0x0004003b, + 0x0000000d,0x0000038f,0x00000007,0x0004003b,0x0000000d,0x00000392,0x00000007,0x0004003b, + 0x0000000d,0x0000039b,0x00000007,0x0004003b,0x0000000d,0x0000039e,0x00000007,0x0004003b, + 0x0000000d,0x000003a7,0x00000007,0x0004003b,0x0000000d,0x000003aa,0x00000007,0x0004003b, + 0x0000000d,0x000003b3,0x00000007,0x0004003b,0x0000000d,0x000003b6,0x00000007,0x0004003b, + 0x0000000d,0x000003db,0x00000007,0x0004003b,0x00000026,0x000003e4,0x00000007,0x0004003b, + 0x00000034,0x000003ec,0x00000007,0x0004003b,0x00000026,0x000003f8,0x00000007,0x0004003b, + 0x00000034,0x0000040a,0x00000007,0x0004003b,0x00000026,0x0000040c,0x00000007,0x0003003e, + 0x00000279,0x000000a5,0x00050041,0x0000000d,0x0000027a,0x00000048,0x0000004c,0x0004003d, + 0x00000006,0x0000027b,0x0000027a,0x000500ba,0x000000a6,0x0000027c,0x0000027b,0x000000a5, + 0x000300f7,0x0000027e,0x00000000,0x000400fa,0x0000027c,0x0000027d,0x0000027e,0x000200f8, + 0x0000027d,0x0003003e,0x0000027f,0x0000015c,0x000200f9,0x00000280,0x000200f8,0x00000280, + 0x000400f6,0x00000282,0x00000283,0x00000000,0x000200f9,0x00000284,0x000200f8,0x00000284, + 0x0004003d,0x00000025,0x00000285,0x0000027f,0x000500b1,0x000000a6,0x00000286,0x00000285, + 0x00000256,0x000400fa,0x00000286,0x00000281,0x00000282,0x000200f8,0x00000281,0x0004003d, + 0x00000025,0x00000288,0x0000027f,0x0004003d,0x00000025,0x00000289,0x0000027f,0x00060041, + 0x0000000d,0x0000028a,0x00000043,0x00000289,0x00000167,0x0004003d,0x00000006,0x0000028b, + 0x0000028a,0x0004003d,0x00000025,0x0000028c,0x0000027f,0x00060041,0x0000000d,0x0000028d, + 0x00000043,0x0000028c,0x00000197,0x0004003d,0x00000006,0x0000028e,0x0000028d,0x0004003d, + 0x00000006,0x0000028f,0x00000044,0x0008000c,0x00000006,0x00000290,0x00000001,0x0000002e, + 0x0000028b,0x0000028e,0x0000028f,0x00050041,0x0000000d,0x00000291,0x00000287,0x00000288, + 0x0003003e,0x00000291,0x00000290,0x000200f9,0x00000283,0x000200f8,0x00000283,0x0004003d, + 0x00000025,0x00000292,0x0000027f,0x00050080,0x00000025,0x00000293,0x00000292,0x0000016f, + 0x0003003e,0x0000027f,0x00000293,0x000200f9,0x00000280,0x000200f8,0x00000282,0x0004003d, + 0x00000033,0x00000295,0x00000287,0x0003003e,0x00000294,0x00000295,0x0004003d,0x00000025, + 0x00000297,0x00000047,0x0003003e,0x00000296,0x00000297,0x00060039,0x00000006,0x00000298, + 0x00000038,0x00000294,0x00000296,0x00050041,0x0000000d,0x00000299,0x00000048,0x0000004c, + 0x0004003d,0x00000006,0x0000029a,0x00000299,0x00050085,0x00000006,0x0000029b,0x00000298, + 0x0000029a,0x0004003d,0x00000006,0x0000029c,0x00000279,0x00050081,0x00000006,0x0000029d, + 0x0000029c,0x0000029b,0x0003003e,0x00000279,0x0000029d,0x000200f9,0x0000027e,0x000200f8, + 0x0000027e,0x00050041,0x0000000d,0x0000029e,0x00000048,0x00000051,0x0004003d,0x00000006, + 0x0000029f,0x0000029e,0x000500ba,0x000000a6,0x000002a0,0x0000029f,0x000000a5,0x000300f7, + 0x000002a2,0x00000000,0x000400fa,0x000002a0,0x000002a1,0x000002a2,0x000200f8,0x000002a1, + 0x0003003e,0x000002a3,0x0000015c,0x000200f9,0x000002a4,0x000200f8,0x000002a4,0x000400f6, + 0x000002a6,0x000002a7,0x00000000,0x000200f9,0x000002a8,0x000200f8,0x000002a8,0x0004003d, + 0x00000025,0x000002a9,0x000002a3,0x000500b1,0x000000a6,0x000002aa,0x000002a9,0x00000256, + 0x000400fa,0x000002aa,0x000002a5,0x000002a6,0x000200f8,0x000002a5,0x0004003d,0x00000025, + 0x000002ac,0x000002a3,0x0004003d,0x00000025,0x000002ad,0x000002a3,0x00060041,0x0000000d, + 0x000002ae,0x00000043,0x00000167,0x000002ad,0x0004003d,0x00000006,0x000002af,0x000002ae, + 0x0004003d,0x00000025,0x000002b0,0x000002a3,0x00060041,0x0000000d,0x000002b1,0x00000043, + 0x00000197,0x000002b0,0x0004003d,0x00000006,0x000002b2,0x000002b1,0x0004003d,0x00000006, + 0x000002b3,0x00000045,0x0008000c,0x00000006,0x000002b4,0x00000001,0x0000002e,0x000002af, + 0x000002b2,0x000002b3,0x00050041,0x0000000d,0x000002b5,0x000002ab,0x000002ac,0x0003003e, + 0x000002b5,0x000002b4,0x000200f9,0x000002a7,0x000200f8,0x000002a7,0x0004003d,0x00000025, + 0x000002b6,0x000002a3,0x00050080,0x00000025,0x000002b7,0x000002b6,0x0000016f,0x0003003e, + 0x000002a3,0x000002b7,0x000200f9,0x000002a4,0x000200f8,0x000002a6,0x0004003d,0x00000033, + 0x000002b9,0x000002ab,0x0003003e,0x000002b8,0x000002b9,0x0004003d,0x00000025,0x000002bb, + 0x00000046,0x0003003e,0x000002ba,0x000002bb,0x00060039,0x00000006,0x000002bc,0x00000038, + 0x000002b8,0x000002ba,0x00050041,0x0000000d,0x000002bd,0x00000048,0x00000051,0x0004003d, + 0x00000006,0x000002be,0x000002bd,0x00050085,0x00000006,0x000002bf,0x000002bc,0x000002be, + 0x0004003d,0x00000006,0x000002c0,0x00000279,0x00050081,0x00000006,0x000002c1,0x000002c0, + 0x000002bf,0x0003003e,0x00000279,0x000002c1,0x000200f9,0x000002a2,0x000200f8,0x000002a2, + 0x00050041,0x0000000d,0x000002c2,0x00000048,0x00000057,0x0004003d,0x00000006,0x000002c3, + 0x000002c2,0x000500ba,0x000000a6,0x000002c4,0x000002c3,0x000000a5,0x000300f7,0x000002c6, + 0x00000000,0x000400fa,0x000002c4,0x000002c5,0x000002c6,0x000200f8,0x000002c5,0x0004003d, + 0x00000006,0x000002c9,0x00000044,0x0004003d,0x00000006,0x000002ca,0x00000045,0x00050083, + 0x00000006,0x000002cb,0x000002c9,0x000002ca,0x00050085,0x00000006,0x000002cc,0x000002c8, + 0x000002cb,0x00050081,0x00000006,0x000002cd,0x000002c8,0x000002cc,0x0003003e,0x000002c7, + 0x000002cd,0x00060041,0x0000000d,0x000002d2,0x00000043,0x00000167,0x0000016f,0x0004003d, + 0x00000006,0x000002d3,0x000002d2,0x00060041,0x0000000d,0x000002d4,0x00000043,0x0000016f, + 0x00000167,0x0004003d,0x00000006,0x000002d5,0x000002d4,0x0004003d,0x00000006,0x000002d6, + 0x000002c7,0x0008000c,0x00000006,0x000002d7,0x00000001,0x0000002e,0x000002d3,0x000002d5, + 0x000002d6,0x00050041,0x0000000d,0x000002d8,0x000002d1,0x0000016f,0x0003003e,0x000002d8, + 0x000002d7,0x00060041,0x0000000d,0x000002d9,0x00000043,0x00000197,0x00000167,0x0004003d, + 0x00000006,0x000002da,0x000002d9,0x00060041,0x0000000d,0x000002db,0x00000043,0x00000167, + 0x00000197,0x0004003d,0x00000006,0x000002dc,0x000002db,0x0004003d,0x00000006,0x000002dd, + 0x000002c7,0x0008000c,0x00000006,0x000002de,0x00000001,0x0000002e,0x000002da,0x000002dc, + 0x000002dd,0x00050041,0x0000000d,0x000002df,0x000002d1,0x00000197,0x0003003e,0x000002df, + 0x000002de,0x00060041,0x0000000d,0x000002e0,0x00000043,0x0000019f,0x00000197,0x0004003d, + 0x00000006,0x000002e1,0x000002e0,0x00060041,0x0000000d,0x000002e2,0x00000043,0x00000197, + 0x0000019f,0x0004003d,0x00000006,0x000002e3,0x000002e2,0x0004003d,0x00000006,0x000002e4, + 0x000002c7,0x0008000c,0x00000006,0x000002e5,0x00000001,0x0000002e,0x000002e1,0x000002e3, + 0x000002e4,0x00050041,0x0000000d,0x000002e6,0x000002d1,0x000001a7,0x0003003e,0x000002e6, + 0x000002e5,0x0004003d,0x00000006,0x000002e7,0x000002c7,0x00050083,0x00000006,0x000002e8, + 0x000002e7,0x000002c8,0x0003003e,0x000002c7,0x000002e8,0x0004003d,0x00000006,0x000002ea, + 0x000002c7,0x000500be,0x000000a6,0x000002eb,0x000002ea,0x000000a5,0x000300f7,0x000002ee, + 0x00000000,0x000400fa,0x000002eb,0x000002ed,0x000002f1,0x000200f8,0x000002ed,0x00060041, + 0x0000000d,0x000002ef,0x00000043,0x0000015c,0x00000167,0x0004003d,0x00000006,0x000002f0, + 0x000002ef,0x0003003e,0x000002ec,0x000002f0,0x000200f9,0x000002ee,0x000200f8,0x000002f1, + 0x00060041,0x0000000d,0x000002f2,0x00000043,0x00000167,0x0000015c,0x0004003d,0x00000006, + 0x000002f3,0x000002f2,0x0003003e,0x000002ec,0x000002f3,0x000200f9,0x000002ee,0x000200f8, + 0x000002ee,0x0004003d,0x00000006,0x000002f4,0x000002ec,0x0003003e,0x000002e9,0x000002f4, + 0x0004003d,0x00000006,0x000002f6,0x000002c7,0x000500be,0x000000a6,0x000002f7,0x000002f6, + 0x000000a5,0x000300f7,0x000002fa,0x00000000,0x000400fa,0x000002f7,0x000002f9,0x000002fd, + 0x000200f8,0x000002f9,0x00060041,0x0000000d,0x000002fb,0x00000043,0x0000016f,0x00000197, + 0x0004003d,0x00000006,0x000002fc,0x000002fb,0x0003003e,0x000002f8,0x000002fc,0x000200f9, + 0x000002fa,0x000200f8,0x000002fd,0x00060041,0x0000000d,0x000002fe,0x00000043,0x00000197, + 0x0000016f,0x0004003d,0x00000006,0x000002ff,0x000002fe,0x0003003e,0x000002f8,0x000002ff, + 0x000200f9,0x000002fa,0x000200f8,0x000002fa,0x0004003d,0x00000006,0x00000300,0x000002f8, + 0x0003003e,0x000002f5,0x00000300,0x0004003d,0x00000006,0x00000302,0x000002c7,0x000500be, + 0x000000a6,0x00000303,0x00000302,0x000000a5,0x000300f7,0x00000306,0x00000000,0x000400fa, + 0x00000303,0x00000305,0x00000309,0x000200f8,0x00000305,0x00060041,0x0000000d,0x00000307, + 0x00000043,0x00000167,0x0000019f,0x0004003d,0x00000006,0x00000308,0x00000307,0x0003003e, + 0x00000304,0x00000308,0x000200f9,0x00000306,0x000200f8,0x00000309,0x00060041,0x0000000d, + 0x0000030a,0x00000043,0x0000019f,0x00000167,0x0004003d,0x00000006,0x0000030b,0x0000030a, + 0x0003003e,0x00000304,0x0000030b,0x000200f9,0x00000306,0x000200f8,0x00000306,0x0004003d, + 0x00000006,0x0000030c,0x00000304,0x0003003e,0x00000301,0x0000030c,0x0004003d,0x00000006, + 0x0000030e,0x000002c7,0x000500be,0x000000a6,0x0000030f,0x0000030e,0x000000a5,0x000300f7, + 0x00000312,0x00000000,0x000400fa,0x0000030f,0x00000311,0x00000315,0x000200f8,0x00000311, + 0x00060041,0x0000000d,0x00000313,0x00000043,0x00000197,0x000001a7,0x0004003d,0x00000006, + 0x00000314,0x00000313,0x0003003e,0x00000310,0x00000314,0x000200f9,0x00000312,0x000200f8, + 0x00000315,0x00060041,0x0000000d,0x00000316,0x00000043,0x000001a7,0x00000197,0x0004003d, + 0x00000006,0x00000317,0x00000316,0x0003003e,0x00000310,0x00000317,0x000200f9,0x00000312, + 0x000200f8,0x00000312,0x0004003d,0x00000006,0x00000318,0x00000310,0x0003003e,0x0000030d, + 0x00000318,0x00060041,0x0000000d,0x00000319,0x00000043,0x0000016f,0x0000016f,0x0004003d, + 0x00000006,0x0000031a,0x00000319,0x0004003d,0x00000006,0x0000031b,0x000002e9,0x0004003d, + 0x00000006,0x0000031c,0x000002c7,0x0006000c,0x00000006,0x0000031d,0x00000001,0x00000004, + 0x0000031c,0x0008000c,0x00000006,0x0000031e,0x00000001,0x0000002e,0x0000031a,0x0000031b, + 0x0000031d,0x00050041,0x0000000d,0x0000031f,0x000002d1,0x0000015c,0x0003003e,0x0000031f, + 0x0000031e,0x00060041,0x0000000d,0x00000320,0x00000043,0x00000167,0x00000167,0x0004003d, + 0x00000006,0x00000321,0x00000320,0x0004003d,0x00000006,0x00000322,0x000002f5,0x0004003d, + 0x00000006,0x00000323,0x000002c7,0x0006000c,0x00000006,0x00000324,0x00000001,0x00000004, + 0x00000323,0x0008000c,0x00000006,0x00000325,0x00000001,0x0000002e,0x00000321,0x00000322, + 0x00000324,0x00050041,0x0000000d,0x00000326,0x000002d1,0x00000167,0x0003003e,0x00000326, + 0x00000325,0x00060041,0x0000000d,0x00000327,0x00000043,0x00000197,0x00000197,0x0004003d, + 0x00000006,0x00000328,0x00000327,0x0004003d,0x00000006,0x00000329,0x00000301,0x0004003d, + 0x00000006,0x0000032a,0x000002c7,0x0006000c,0x00000006,0x0000032b,0x00000001,0x00000004, + 0x0000032a,0x0008000c,0x00000006,0x0000032c,0x00000001,0x0000002e,0x00000328,0x00000329, + 0x0000032b,0x00050041,0x0000000d,0x0000032d,0x000002d1,0x0000019f,0x0003003e,0x0000032d, + 0x0000032c,0x00060041,0x0000000d,0x0000032e,0x00000043,0x0000019f,0x0000019f,0x0004003d, + 0x00000006,0x0000032f,0x0000032e,0x0004003d,0x00000006,0x00000330,0x0000030d,0x0004003d, + 0x00000006,0x00000331,0x000002c7,0x0006000c,0x00000006,0x00000332,0x00000001,0x00000004, + 0x00000331,0x0008000c,0x00000006,0x00000333,0x00000001,0x0000002e,0x0000032f,0x00000330, + 0x00000332,0x00050041,0x0000000d,0x00000334,0x000002d1,0x00000256,0x0003003e,0x00000334, + 0x00000333,0x0004003d,0x00000006,0x00000336,0x00000044,0x0004003d,0x00000006,0x00000337, + 0x00000045,0x00050081,0x00000006,0x00000338,0x00000336,0x00000337,0x0003003e,0x00000335, + 0x00000338,0x0004003d,0x00000006,0x00000339,0x00000335,0x000500be,0x000000a6,0x0000033a, + 0x00000339,0x000000b2,0x000300f7,0x0000033c,0x00000000,0x000400fa,0x0000033a,0x0000033b, + 0x00000350,0x000200f8,0x0000033b,0x0003003e,0x0000033d,0x0000015c,0x000200f9,0x0000033e, + 0x000200f8,0x0000033e,0x000400f6,0x00000340,0x00000341,0x00000000,0x000200f9,0x00000342, + 0x000200f8,0x00000342,0x0004003d,0x00000025,0x00000343,0x0000033d,0x000500b1,0x000000a6, + 0x00000344,0x00000343,0x00000256,0x000400fa,0x00000344,0x0000033f,0x00000340,0x000200f8, + 0x0000033f,0x0004003d,0x00000025,0x00000346,0x0000033d,0x0004003d,0x00000025,0x00000347, + 0x0000033d,0x00050080,0x00000025,0x00000348,0x00000347,0x0000016f,0x00050041,0x0000000d, + 0x00000349,0x000002d1,0x00000348,0x0004003d,0x00000006,0x0000034a,0x00000349,0x00050041, + 0x0000000d,0x0000034b,0x00000345,0x00000346,0x0003003e,0x0000034b,0x0000034a,0x000200f9, + 0x00000341,0x000200f8,0x00000341,0x0004003d,0x00000025,0x0000034c,0x0000033d,0x00050080, + 0x00000025,0x0000034d,0x0000034c,0x0000016f,0x0003003e,0x0000033d,0x0000034d,0x000200f9, + 0x0000033e,0x000200f8,0x00000340,0x0004003d,0x00000006,0x0000034e,0x00000335,0x00050083, + 0x00000006,0x0000034f,0x0000034e,0x000000b2,0x0003003e,0x00000335,0x0000034f,0x000200f9, + 0x0000033c,0x000200f8,0x00000350,0x0003003e,0x00000351,0x0000015c,0x000200f9,0x00000352, + 0x000200f8,0x00000352,0x000400f6,0x00000354,0x00000355,0x00000000,0x000200f9,0x00000356, + 0x000200f8,0x00000356,0x0004003d,0x00000025,0x00000357,0x00000351,0x000500b1,0x000000a6, + 0x00000358,0x00000357,0x00000256,0x000400fa,0x00000358,0x00000353,0x00000354,0x000200f8, + 0x00000353,0x0004003d,0x00000025,0x00000359,0x00000351,0x0004003d,0x00000025,0x0000035a, + 0x00000351,0x00050041,0x0000000d,0x0000035b,0x000002d1,0x0000035a,0x0004003d,0x00000006, + 0x0000035c,0x0000035b,0x00050041,0x0000000d,0x0000035d,0x00000345,0x00000359,0x0003003e, + 0x0000035d,0x0000035c,0x000200f9,0x00000355,0x000200f8,0x00000355,0x0004003d,0x00000025, + 0x0000035e,0x00000351,0x00050080,0x00000025,0x0000035f,0x0000035e,0x0000016f,0x0003003e, + 0x00000351,0x0000035f,0x000200f9,0x00000352,0x000200f8,0x00000354,0x000200f9,0x0000033c, + 0x000200f8,0x0000033c,0x0004003d,0x00000006,0x00000360,0x00000335,0x00050085,0x00000006, + 0x00000362,0x00000360,0x00000361,0x0004006e,0x00000025,0x00000363,0x00000362,0x0004003d, + 0x00000033,0x00000365,0x00000345,0x0003003e,0x00000364,0x00000365,0x0003003e,0x00000366, + 0x00000363,0x00060039,0x00000006,0x00000367,0x00000038,0x00000364,0x00000366,0x00050041, + 0x0000000d,0x00000368,0x00000048,0x00000057,0x0004003d,0x00000006,0x00000369,0x00000368, + 0x00050085,0x00000006,0x0000036a,0x00000367,0x00000369,0x0004003d,0x00000006,0x0000036b, + 0x00000279,0x00050081,0x00000006,0x0000036c,0x0000036b,0x0000036a,0x0003003e,0x00000279, + 0x0000036c,0x000200f9,0x000002c6,0x000200f8,0x000002c6,0x00050041,0x0000000d,0x0000036d, + 0x00000048,0x00000194,0x0004003d,0x00000006,0x0000036e,0x0000036d,0x000500ba,0x000000a6, + 0x0000036f,0x0000036e,0x000000a5,0x000300f7,0x00000371,0x00000000,0x000400fa,0x0000036f, + 0x00000370,0x00000371,0x000200f8,0x00000370,0x0004003d,0x00000006,0x00000373,0x00000044, + 0x0004003d,0x00000006,0x00000374,0x00000045,0x00050081,0x00000006,0x00000375,0x00000373, + 0x00000374,0x00050085,0x00000006,0x00000376,0x000002c8,0x00000375,0x0003003e,0x00000372, + 0x00000376,0x00060041,0x0000000d,0x00000378,0x00000043,0x00000197,0x0000016f,0x0004003d, + 0x00000006,0x00000379,0x00000378,0x00060041,0x0000000d,0x0000037a,0x00000043,0x0000019f, + 0x00000167,0x0004003d,0x00000006,0x0000037b,0x0000037a,0x0004003d,0x00000006,0x0000037c, + 0x00000372,0x0008000c,0x00000006,0x0000037d,0x00000001,0x0000002e,0x00000379,0x0000037b, + 0x0000037c,0x00050041,0x0000000d,0x0000037e,0x00000377,0x0000016f,0x0003003e,0x0000037e, + 0x0000037d,0x00060041,0x0000000d,0x0000037f,0x00000043,0x00000167,0x00000167,0x0004003d, + 0x00000006,0x00000380,0x0000037f,0x00060041,0x0000000d,0x00000381,0x00000043,0x00000197, + 0x00000197,0x0004003d,0x00000006,0x00000382,0x00000381,0x0004003d,0x00000006,0x00000383, + 0x00000372,0x0008000c,0x00000006,0x00000384,0x00000001,0x0000002e,0x00000380,0x00000382, + 0x00000383,0x00050041,0x0000000d,0x00000385,0x00000377,0x00000197,0x0003003e,0x00000385, + 0x00000384,0x00060041,0x0000000d,0x00000386,0x00000043,0x0000016f,0x00000197,0x0004003d, + 0x00000006,0x00000387,0x00000386,0x00060041,0x0000000d,0x00000388,0x00000043,0x00000167, + 0x0000019f,0x0004003d,0x00000006,0x00000389,0x00000388,0x0004003d,0x00000006,0x0000038a, + 0x00000372,0x0008000c,0x00000006,0x0000038b,0x00000001,0x0000002e,0x00000387,0x00000389, + 0x0000038a,0x00050041,0x0000000d,0x0000038c,0x00000377,0x000001a7,0x0003003e,0x0000038c, + 0x0000038b,0x0004003d,0x00000006,0x0000038d,0x00000372,0x00050083,0x00000006,0x0000038e, + 0x0000038d,0x000002c8,0x0003003e,0x00000372,0x0000038e,0x0004003d,0x00000006,0x00000390, + 0x00000372,0x000500be,0x000000a6,0x00000391,0x00000390,0x000000a5,0x000300f7,0x00000394, + 0x00000000,0x000400fa,0x00000391,0x00000393,0x00000397,0x000200f8,0x00000393,0x00060041, + 0x0000000d,0x00000395,0x00000043,0x000001a7,0x00000167,0x0004003d,0x00000006,0x00000396, + 0x00000395,0x0003003e,0x00000392,0x00000396,0x000200f9,0x00000394,0x000200f8,0x00000397, + 0x00060041,0x0000000d,0x00000398,0x00000043,0x00000197,0x0000015c,0x0004003d,0x00000006, + 0x00000399,0x00000398,0x0003003e,0x00000392,0x00000399,0x000200f9,0x00000394,0x000200f8, + 0x00000394,0x0004003d,0x00000006,0x0000039a,0x00000392,0x0003003e,0x0000038f,0x0000039a, + 0x0004003d,0x00000006,0x0000039c,0x00000372,0x000500be,0x000000a6,0x0000039d,0x0000039c, + 0x000000a5,0x000300f7,0x000003a0,0x00000000,0x000400fa,0x0000039d,0x0000039f,0x000003a3, + 0x000200f8,0x0000039f,0x00060041,0x0000000d,0x000003a1,0x00000043,0x0000019f,0x00000197, + 0x0004003d,0x00000006,0x000003a2,0x000003a1,0x0003003e,0x0000039e,0x000003a2,0x000200f9, + 0x000003a0,0x000200f8,0x000003a3,0x00060041,0x0000000d,0x000003a4,0x00000043,0x00000167, + 0x0000016f,0x0004003d,0x00000006,0x000003a5,0x000003a4,0x0003003e,0x0000039e,0x000003a5, + 0x000200f9,0x000003a0,0x000200f8,0x000003a0,0x0004003d,0x00000006,0x000003a6,0x0000039e, + 0x0003003e,0x0000039b,0x000003a6,0x0004003d,0x00000006,0x000003a8,0x00000372,0x000500be, + 0x000000a6,0x000003a9,0x000003a8,0x000000a5,0x000300f7,0x000003ac,0x00000000,0x000400fa, + 0x000003a9,0x000003ab,0x000003af,0x000200f8,0x000003ab,0x00060041,0x0000000d,0x000003ad, + 0x00000043,0x00000197,0x0000019f,0x0004003d,0x00000006,0x000003ae,0x000003ad,0x0003003e, + 0x000003aa,0x000003ae,0x000200f9,0x000003ac,0x000200f8,0x000003af,0x00060041,0x0000000d, + 0x000003b0,0x00000043,0x0000016f,0x00000167,0x0004003d,0x00000006,0x000003b1,0x000003b0, + 0x0003003e,0x000003aa,0x000003b1,0x000200f9,0x000003ac,0x000200f8,0x000003ac,0x0004003d, + 0x00000006,0x000003b2,0x000003aa,0x0003003e,0x000003a7,0x000003b2,0x0004003d,0x00000006, + 0x000003b4,0x00000372,0x000500be,0x000000a6,0x000003b5,0x000003b4,0x000000a5,0x000300f7, + 0x000003b8,0x00000000,0x000400fa,0x000003b5,0x000003b7,0x000003bb,0x000200f8,0x000003b7, + 0x00060041,0x0000000d,0x000003b9,0x00000043,0x00000167,0x000001a7,0x0004003d,0x00000006, + 0x000003ba,0x000003b9,0x0003003e,0x000003b6,0x000003ba,0x000200f9,0x000003b8,0x000200f8, + 0x000003bb,0x00060041,0x0000000d,0x000003bc,0x00000043,0x0000015c,0x00000197,0x0004003d, + 0x00000006,0x000003bd,0x000003bc,0x0003003e,0x000003b6,0x000003bd,0x000200f9,0x000003b8, + 0x000200f8,0x000003b8,0x0004003d,0x00000006,0x000003be,0x000003b6,0x0003003e,0x000003b3, + 0x000003be,0x00060041,0x0000000d,0x000003bf,0x00000043,0x0000019f,0x0000016f,0x0004003d, + 0x00000006,0x000003c0,0x000003bf,0x0004003d,0x00000006,0x000003c1,0x0000038f,0x0004003d, + 0x00000006,0x000003c2,0x00000372,0x0006000c,0x00000006,0x000003c3,0x00000001,0x00000004, + 0x000003c2,0x0008000c,0x00000006,0x000003c4,0x00000001,0x0000002e,0x000003c0,0x000003c1, + 0x000003c3,0x00050041,0x0000000d,0x000003c5,0x00000377,0x0000015c,0x0003003e,0x000003c5, + 0x000003c4,0x00060041,0x0000000d,0x000003c6,0x00000043,0x00000197,0x00000167,0x0004003d, + 0x00000006,0x000003c7,0x000003c6,0x0004003d,0x00000006,0x000003c8,0x0000039b,0x0004003d, + 0x00000006,0x000003c9,0x00000372,0x0006000c,0x00000006,0x000003ca,0x00000001,0x00000004, + 0x000003c9,0x0008000c,0x00000006,0x000003cb,0x00000001,0x0000002e,0x000003c7,0x000003c8, + 0x000003ca,0x00050041,0x0000000d,0x000003cc,0x00000377,0x00000167,0x0003003e,0x000003cc, + 0x000003cb,0x00060041,0x0000000d,0x000003cd,0x00000043,0x00000167,0x00000197,0x0004003d, + 0x00000006,0x000003ce,0x000003cd,0x0004003d,0x00000006,0x000003cf,0x000003a7,0x0004003d, + 0x00000006,0x000003d0,0x00000372,0x0006000c,0x00000006,0x000003d1,0x00000001,0x00000004, + 0x000003d0,0x0008000c,0x00000006,0x000003d2,0x00000001,0x0000002e,0x000003ce,0x000003cf, + 0x000003d1,0x00050041,0x0000000d,0x000003d3,0x00000377,0x0000019f,0x0003003e,0x000003d3, + 0x000003d2,0x00060041,0x0000000d,0x000003d4,0x00000043,0x0000016f,0x0000019f,0x0004003d, + 0x00000006,0x000003d5,0x000003d4,0x0004003d,0x00000006,0x000003d6,0x000003b3,0x0004003d, + 0x00000006,0x000003d7,0x00000372,0x0006000c,0x00000006,0x000003d8,0x00000001,0x00000004, + 0x000003d7,0x0008000c,0x00000006,0x000003d9,0x00000001,0x0000002e,0x000003d5,0x000003d6, + 0x000003d8,0x00050041,0x0000000d,0x000003da,0x00000377,0x00000256,0x0003003e,0x000003da, + 0x000003d9,0x0004003d,0x00000006,0x000003dc,0x00000044,0x0004003d,0x00000006,0x000003dd, + 0x00000045,0x00050083,0x00000006,0x000003de,0x000003dc,0x000003dd,0x00050081,0x00000006, + 0x000003df,0x000000b2,0x000003de,0x0003003e,0x000003db,0x000003df,0x0004003d,0x00000006, + 0x000003e0,0x000003db,0x000500be,0x000000a6,0x000003e1,0x000003e0,0x000000b2,0x000300f7, + 0x000003e3,0x00000000,0x000400fa,0x000003e1,0x000003e2,0x000003f7,0x000200f8,0x000003e2, + 0x0003003e,0x000003e4,0x0000015c,0x000200f9,0x000003e5,0x000200f8,0x000003e5,0x000400f6, + 0x000003e7,0x000003e8,0x00000000,0x000200f9,0x000003e9,0x000200f8,0x000003e9,0x0004003d, + 0x00000025,0x000003ea,0x000003e4,0x000500b1,0x000000a6,0x000003eb,0x000003ea,0x00000256, + 0x000400fa,0x000003eb,0x000003e6,0x000003e7,0x000200f8,0x000003e6,0x0004003d,0x00000025, + 0x000003ed,0x000003e4,0x0004003d,0x00000025,0x000003ee,0x000003e4,0x00050080,0x00000025, + 0x000003ef,0x000003ee,0x0000016f,0x00050041,0x0000000d,0x000003f0,0x00000377,0x000003ef, + 0x0004003d,0x00000006,0x000003f1,0x000003f0,0x00050041,0x0000000d,0x000003f2,0x000003ec, + 0x000003ed,0x0003003e,0x000003f2,0x000003f1,0x000200f9,0x000003e8,0x000200f8,0x000003e8, + 0x0004003d,0x00000025,0x000003f3,0x000003e4,0x00050080,0x00000025,0x000003f4,0x000003f3, + 0x0000016f,0x0003003e,0x000003e4,0x000003f4,0x000200f9,0x000003e5,0x000200f8,0x000003e7, + 0x0004003d,0x00000006,0x000003f5,0x000003db,0x00050083,0x00000006,0x000003f6,0x000003f5, + 0x000000b2,0x0003003e,0x000003db,0x000003f6,0x000200f9,0x000003e3,0x000200f8,0x000003f7, + 0x0003003e,0x000003f8,0x0000015c,0x000200f9,0x000003f9,0x000200f8,0x000003f9,0x000400f6, + 0x000003fb,0x000003fc,0x00000000,0x000200f9,0x000003fd,0x000200f8,0x000003fd,0x0004003d, + 0x00000025,0x000003fe,0x000003f8,0x000500b1,0x000000a6,0x000003ff,0x000003fe,0x00000256, + 0x000400fa,0x000003ff,0x000003fa,0x000003fb,0x000200f8,0x000003fa,0x0004003d,0x00000025, + 0x00000400,0x000003f8,0x0004003d,0x00000025,0x00000401,0x000003f8,0x00050041,0x0000000d, + 0x00000402,0x00000377,0x00000401,0x0004003d,0x00000006,0x00000403,0x00000402,0x00050041, + 0x0000000d,0x00000404,0x000003ec,0x00000400,0x0003003e,0x00000404,0x00000403,0x000200f9, + 0x000003fc,0x000200f8,0x000003fc,0x0004003d,0x00000025,0x00000405,0x000003f8,0x00050080, + 0x00000025,0x00000406,0x00000405,0x0000016f,0x0003003e,0x000003f8,0x00000406,0x000200f9, + 0x000003f9,0x000200f8,0x000003fb,0x000200f9,0x000003e3,0x000200f8,0x000003e3,0x0004003d, + 0x00000006,0x00000407,0x000003db,0x00050085,0x00000006,0x00000408,0x00000407,0x00000361, + 0x0004006e,0x00000025,0x00000409,0x00000408,0x0004003d,0x00000033,0x0000040b,0x000003ec, + 0x0003003e,0x0000040a,0x0000040b,0x0003003e,0x0000040c,0x00000409,0x00060039,0x00000006, + 0x0000040d,0x00000038,0x0000040a,0x0000040c,0x00050041,0x0000000d,0x0000040e,0x00000048, + 0x00000194,0x0004003d,0x00000006,0x0000040f,0x0000040e,0x00050085,0x00000006,0x00000410, + 0x0000040d,0x0000040f,0x0004003d,0x00000006,0x00000411,0x00000279,0x00050081,0x00000006, + 0x00000412,0x00000411,0x00000410,0x0003003e,0x00000279,0x00000412,0x000200f9,0x00000371, + 0x000200f8,0x00000371,0x0004003d,0x00000006,0x00000413,0x00000279,0x000200fe,0x00000413, + 0x00010038 +}; diff --git a/app/src/main/cpp/shaders/nis_coef.h b/app/src/main/cpp/shaders/nis_coef.h new file mode 100644 index 0000000000..77252c738e --- /dev/null +++ b/app/src/main/cpp/shaders/nis_coef.h @@ -0,0 +1,156 @@ +// NVIDIA Image Scaling coefficient banks for nis3.frag (uniform buffer, set 1, binding 0): +// coef_scale and coef_usm, 64 phases x 6 taps, laid out as two vec4 per phase (taps 0-3, taps 4-5 +// + two zeros) to match the shader's std140 vec4[128] arrays. Values = nis.frag's baked tables. +// +// The MIT License (MIT) +// Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +// associated documentation files (the "Software"), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, publish, distribute, +// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +#pragma once + +static const float kNisCoefScale[64 * 8] = { + 0.0000f, 0.0000f, 1.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, // phase 0 + 0.0029f, -0.0127f, 1.0000f, 0.0132f, -0.0034f, 0.0000f, 0.0000f, 0.0000f, // phase 1 + 0.0063f, -0.0249f, 0.9985f, 0.0269f, -0.0068f, 0.0000f, 0.0000f, 0.0000f, // phase 2 + 0.0088f, -0.0361f, 0.9956f, 0.0415f, -0.0103f, 0.0005f, 0.0000f, 0.0000f, // phase 3 + 0.0117f, -0.0474f, 0.9932f, 0.0562f, -0.0142f, 0.0005f, 0.0000f, 0.0000f, // phase 4 + 0.0142f, -0.0576f, 0.9897f, 0.0713f, -0.0181f, 0.0005f, 0.0000f, 0.0000f, // phase 5 + 0.0166f, -0.0674f, 0.9844f, 0.0874f, -0.0220f, 0.0010f, 0.0000f, 0.0000f, // phase 6 + 0.0186f, -0.0762f, 0.9785f, 0.1040f, -0.0264f, 0.0015f, 0.0000f, 0.0000f, // phase 7 + 0.0205f, -0.0850f, 0.9727f, 0.1206f, -0.0308f, 0.0020f, 0.0000f, 0.0000f, // phase 8 + 0.0225f, -0.0928f, 0.9648f, 0.1382f, -0.0352f, 0.0024f, 0.0000f, 0.0000f, // phase 9 + 0.0239f, -0.1006f, 0.9575f, 0.1558f, -0.0396f, 0.0029f, 0.0000f, 0.0000f, // phase 10 + 0.0254f, -0.1074f, 0.9487f, 0.1738f, -0.0439f, 0.0034f, 0.0000f, 0.0000f, // phase 11 + 0.0264f, -0.1138f, 0.9390f, 0.1929f, -0.0488f, 0.0044f, 0.0000f, 0.0000f, // phase 12 + 0.0278f, -0.1191f, 0.9282f, 0.2119f, -0.0537f, 0.0049f, 0.0000f, 0.0000f, // phase 13 + 0.0288f, -0.1245f, 0.9170f, 0.2310f, -0.0581f, 0.0059f, 0.0000f, 0.0000f, // phase 14 + 0.0293f, -0.1294f, 0.9058f, 0.2510f, -0.0630f, 0.0063f, 0.0000f, 0.0000f, // phase 15 + 0.0303f, -0.1333f, 0.8926f, 0.2710f, -0.0679f, 0.0073f, 0.0000f, 0.0000f, // phase 16 + 0.0308f, -0.1367f, 0.8789f, 0.2915f, -0.0728f, 0.0083f, 0.0000f, 0.0000f, // phase 17 + 0.0308f, -0.1401f, 0.8657f, 0.3120f, -0.0776f, 0.0093f, 0.0000f, 0.0000f, // phase 18 + 0.0313f, -0.1426f, 0.8506f, 0.3330f, -0.0825f, 0.0103f, 0.0000f, 0.0000f, // phase 19 + 0.0313f, -0.1445f, 0.8354f, 0.3540f, -0.0874f, 0.0112f, 0.0000f, 0.0000f, // phase 20 + 0.0313f, -0.1460f, 0.8193f, 0.3755f, -0.0923f, 0.0122f, 0.0000f, 0.0000f, // phase 21 + 0.0313f, -0.1470f, 0.8022f, 0.3965f, -0.0967f, 0.0137f, 0.0000f, 0.0000f, // phase 22 + 0.0308f, -0.1479f, 0.7856f, 0.4185f, -0.1016f, 0.0146f, 0.0000f, 0.0000f, // phase 23 + 0.0303f, -0.1479f, 0.7681f, 0.4399f, -0.1060f, 0.0156f, 0.0000f, 0.0000f, // phase 24 + 0.0298f, -0.1479f, 0.7505f, 0.4614f, -0.1104f, 0.0166f, 0.0000f, 0.0000f, // phase 25 + 0.0293f, -0.1470f, 0.7314f, 0.4829f, -0.1147f, 0.0181f, 0.0000f, 0.0000f, // phase 26 + 0.0288f, -0.1460f, 0.7119f, 0.5049f, -0.1187f, 0.0190f, 0.0000f, 0.0000f, // phase 27 + 0.0278f, -0.1445f, 0.6929f, 0.5264f, -0.1226f, 0.0200f, 0.0000f, 0.0000f, // phase 28 + 0.0273f, -0.1431f, 0.6724f, 0.5479f, -0.1260f, 0.0215f, 0.0000f, 0.0000f, // phase 29 + 0.0264f, -0.1411f, 0.6528f, 0.5693f, -0.1299f, 0.0225f, 0.0000f, 0.0000f, // phase 30 + 0.0254f, -0.1387f, 0.6323f, 0.5903f, -0.1328f, 0.0234f, 0.0000f, 0.0000f, // phase 31 + 0.0244f, -0.1357f, 0.6113f, 0.6113f, -0.1357f, 0.0244f, 0.0000f, 0.0000f, // phase 32 + 0.0234f, -0.1328f, 0.5903f, 0.6323f, -0.1387f, 0.0254f, 0.0000f, 0.0000f, // phase 33 + 0.0225f, -0.1299f, 0.5693f, 0.6528f, -0.1411f, 0.0264f, 0.0000f, 0.0000f, // phase 34 + 0.0215f, -0.1260f, 0.5479f, 0.6724f, -0.1431f, 0.0273f, 0.0000f, 0.0000f, // phase 35 + 0.0200f, -0.1226f, 0.5264f, 0.6929f, -0.1445f, 0.0278f, 0.0000f, 0.0000f, // phase 36 + 0.0190f, -0.1187f, 0.5049f, 0.7119f, -0.1460f, 0.0288f, 0.0000f, 0.0000f, // phase 37 + 0.0181f, -0.1147f, 0.4829f, 0.7314f, -0.1470f, 0.0293f, 0.0000f, 0.0000f, // phase 38 + 0.0166f, -0.1104f, 0.4614f, 0.7505f, -0.1479f, 0.0298f, 0.0000f, 0.0000f, // phase 39 + 0.0156f, -0.1060f, 0.4399f, 0.7681f, -0.1479f, 0.0303f, 0.0000f, 0.0000f, // phase 40 + 0.0146f, -0.1016f, 0.4185f, 0.7856f, -0.1479f, 0.0308f, 0.0000f, 0.0000f, // phase 41 + 0.0137f, -0.0967f, 0.3965f, 0.8022f, -0.1470f, 0.0313f, 0.0000f, 0.0000f, // phase 42 + 0.0122f, -0.0923f, 0.3755f, 0.8193f, -0.1460f, 0.0313f, 0.0000f, 0.0000f, // phase 43 + 0.0112f, -0.0874f, 0.3540f, 0.8354f, -0.1445f, 0.0313f, 0.0000f, 0.0000f, // phase 44 + 0.0103f, -0.0825f, 0.3330f, 0.8506f, -0.1426f, 0.0313f, 0.0000f, 0.0000f, // phase 45 + 0.0093f, -0.0776f, 0.3120f, 0.8657f, -0.1401f, 0.0308f, 0.0000f, 0.0000f, // phase 46 + 0.0083f, -0.0728f, 0.2915f, 0.8789f, -0.1367f, 0.0308f, 0.0000f, 0.0000f, // phase 47 + 0.0073f, -0.0679f, 0.2710f, 0.8926f, -0.1333f, 0.0303f, 0.0000f, 0.0000f, // phase 48 + 0.0063f, -0.0630f, 0.2510f, 0.9058f, -0.1294f, 0.0293f, 0.0000f, 0.0000f, // phase 49 + 0.0059f, -0.0581f, 0.2310f, 0.9170f, -0.1245f, 0.0288f, 0.0000f, 0.0000f, // phase 50 + 0.0049f, -0.0537f, 0.2119f, 0.9282f, -0.1191f, 0.0278f, 0.0000f, 0.0000f, // phase 51 + 0.0044f, -0.0488f, 0.1929f, 0.9390f, -0.1138f, 0.0264f, 0.0000f, 0.0000f, // phase 52 + 0.0034f, -0.0439f, 0.1738f, 0.9487f, -0.1074f, 0.0254f, 0.0000f, 0.0000f, // phase 53 + 0.0029f, -0.0396f, 0.1558f, 0.9575f, -0.1006f, 0.0239f, 0.0000f, 0.0000f, // phase 54 + 0.0024f, -0.0352f, 0.1382f, 0.9648f, -0.0928f, 0.0225f, 0.0000f, 0.0000f, // phase 55 + 0.0020f, -0.0308f, 0.1206f, 0.9727f, -0.0850f, 0.0205f, 0.0000f, 0.0000f, // phase 56 + 0.0015f, -0.0264f, 0.1040f, 0.9785f, -0.0762f, 0.0186f, 0.0000f, 0.0000f, // phase 57 + 0.0010f, -0.0220f, 0.0874f, 0.9844f, -0.0674f, 0.0166f, 0.0000f, 0.0000f, // phase 58 + 0.0005f, -0.0181f, 0.0713f, 0.9897f, -0.0576f, 0.0142f, 0.0000f, 0.0000f, // phase 59 + 0.0005f, -0.0142f, 0.0562f, 0.9932f, -0.0474f, 0.0117f, 0.0000f, 0.0000f, // phase 60 + 0.0005f, -0.0103f, 0.0415f, 0.9956f, -0.0361f, 0.0088f, 0.0000f, 0.0000f, // phase 61 + 0.0000f, -0.0068f, 0.0269f, 0.9985f, -0.0249f, 0.0063f, 0.0000f, 0.0000f, // phase 62 + 0.0000f, -0.0034f, 0.0132f, 1.0000f, -0.0127f, 0.0029f, 0.0000f, 0.0000f, // phase 63 +}; + +static const float kNisCoefUsm[64 * 8] = { + 0.0000f, -0.6001f, 1.2002f, -0.6001f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, // phase 0 + 0.0029f, -0.6084f, 1.1987f, -0.5903f, -0.0029f, 0.0000f, 0.0000f, 0.0000f, // phase 1 + 0.0049f, -0.6147f, 1.1958f, -0.5791f, -0.0068f, 0.0005f, 0.0000f, 0.0000f, // phase 2 + 0.0073f, -0.6196f, 1.1890f, -0.5659f, -0.0103f, 0.0000f, 0.0000f, 0.0000f, // phase 3 + 0.0093f, -0.6235f, 1.1802f, -0.5513f, -0.0151f, 0.0000f, 0.0000f, 0.0000f, // phase 4 + 0.0112f, -0.6265f, 1.1699f, -0.5352f, -0.0195f, 0.0005f, 0.0000f, 0.0000f, // phase 5 + 0.0122f, -0.6270f, 1.1582f, -0.5181f, -0.0259f, 0.0005f, 0.0000f, 0.0000f, // phase 6 + 0.0142f, -0.6284f, 1.1455f, -0.5005f, -0.0317f, 0.0005f, 0.0000f, 0.0000f, // phase 7 + 0.0156f, -0.6265f, 1.1274f, -0.4790f, -0.0386f, 0.0005f, 0.0000f, 0.0000f, // phase 8 + 0.0166f, -0.6235f, 1.1089f, -0.4570f, -0.0454f, 0.0010f, 0.0000f, 0.0000f, // phase 9 + 0.0176f, -0.6187f, 1.0879f, -0.4346f, -0.0532f, 0.0010f, 0.0000f, 0.0000f, // phase 10 + 0.0181f, -0.6138f, 1.0659f, -0.4102f, -0.0615f, 0.0015f, 0.0000f, 0.0000f, // phase 11 + 0.0190f, -0.6069f, 1.0405f, -0.3843f, -0.0698f, 0.0015f, 0.0000f, 0.0000f, // phase 12 + 0.0195f, -0.6006f, 1.0161f, -0.3574f, -0.0796f, 0.0020f, 0.0000f, 0.0000f, // phase 13 + 0.0200f, -0.5928f, 0.9893f, -0.3286f, -0.0898f, 0.0024f, 0.0000f, 0.0000f, // phase 14 + 0.0200f, -0.5820f, 0.9580f, -0.2988f, -0.1001f, 0.0029f, 0.0000f, 0.0000f, // phase 15 + 0.0200f, -0.5728f, 0.9292f, -0.2690f, -0.1104f, 0.0034f, 0.0000f, 0.0000f, // phase 16 + 0.0200f, -0.5620f, 0.8975f, -0.2368f, -0.1226f, 0.0039f, 0.0000f, 0.0000f, // phase 17 + 0.0205f, -0.5498f, 0.8643f, -0.2046f, -0.1343f, 0.0044f, 0.0000f, 0.0000f, // phase 18 + 0.0200f, -0.5371f, 0.8301f, -0.1709f, -0.1465f, 0.0049f, 0.0000f, 0.0000f, // phase 19 + 0.0195f, -0.5239f, 0.7944f, -0.1367f, -0.1587f, 0.0054f, 0.0000f, 0.0000f, // phase 20 + 0.0195f, -0.5107f, 0.7598f, -0.1021f, -0.1724f, 0.0059f, 0.0000f, 0.0000f, // phase 21 + 0.0190f, -0.4966f, 0.7231f, -0.0649f, -0.1865f, 0.0063f, 0.0000f, 0.0000f, // phase 22 + 0.0186f, -0.4819f, 0.6846f, -0.0288f, -0.1997f, 0.0068f, 0.0000f, 0.0000f, // phase 23 + 0.0186f, -0.4668f, 0.6460f, 0.0093f, -0.2144f, 0.0073f, 0.0000f, 0.0000f, // phase 24 + 0.0176f, -0.4507f, 0.6055f, 0.0479f, -0.2290f, 0.0083f, 0.0000f, 0.0000f, // phase 25 + 0.0171f, -0.4370f, 0.5693f, 0.0859f, -0.2446f, 0.0088f, 0.0000f, 0.0000f, // phase 26 + 0.0161f, -0.4199f, 0.5283f, 0.1255f, -0.2598f, 0.0098f, 0.0000f, 0.0000f, // phase 27 + 0.0161f, -0.4048f, 0.4883f, 0.1655f, -0.2754f, 0.0103f, 0.0000f, 0.0000f, // phase 28 + 0.0151f, -0.3887f, 0.4497f, 0.2041f, -0.2910f, 0.0107f, 0.0000f, 0.0000f, // phase 29 + 0.0142f, -0.3711f, 0.4072f, 0.2446f, -0.3066f, 0.0117f, 0.0000f, 0.0000f, // phase 30 + 0.0137f, -0.3555f, 0.3672f, 0.2852f, -0.3228f, 0.0122f, 0.0000f, 0.0000f, // phase 31 + 0.0132f, -0.3394f, 0.3262f, 0.3262f, -0.3394f, 0.0132f, 0.0000f, 0.0000f, // phase 32 + 0.0122f, -0.3228f, 0.2852f, 0.3672f, -0.3555f, 0.0137f, 0.0000f, 0.0000f, // phase 33 + 0.0117f, -0.3066f, 0.2446f, 0.4072f, -0.3711f, 0.0142f, 0.0000f, 0.0000f, // phase 34 + 0.0107f, -0.2910f, 0.2041f, 0.4497f, -0.3887f, 0.0151f, 0.0000f, 0.0000f, // phase 35 + 0.0103f, -0.2754f, 0.1655f, 0.4883f, -0.4048f, 0.0161f, 0.0000f, 0.0000f, // phase 36 + 0.0098f, -0.2598f, 0.1255f, 0.5283f, -0.4199f, 0.0161f, 0.0000f, 0.0000f, // phase 37 + 0.0088f, -0.2446f, 0.0859f, 0.5693f, -0.4370f, 0.0171f, 0.0000f, 0.0000f, // phase 38 + 0.0083f, -0.2290f, 0.0479f, 0.6055f, -0.4507f, 0.0176f, 0.0000f, 0.0000f, // phase 39 + 0.0073f, -0.2144f, 0.0093f, 0.6460f, -0.4668f, 0.0186f, 0.0000f, 0.0000f, // phase 40 + 0.0068f, -0.1997f, -0.0288f, 0.6846f, -0.4819f, 0.0186f, 0.0000f, 0.0000f, // phase 41 + 0.0063f, -0.1865f, -0.0649f, 0.7231f, -0.4966f, 0.0190f, 0.0000f, 0.0000f, // phase 42 + 0.0059f, -0.1724f, -0.1021f, 0.7598f, -0.5107f, 0.0195f, 0.0000f, 0.0000f, // phase 43 + 0.0054f, -0.1587f, -0.1367f, 0.7944f, -0.5239f, 0.0195f, 0.0000f, 0.0000f, // phase 44 + 0.0049f, -0.1465f, -0.1709f, 0.8301f, -0.5371f, 0.0200f, 0.0000f, 0.0000f, // phase 45 + 0.0044f, -0.1343f, -0.2046f, 0.8643f, -0.5498f, 0.0205f, 0.0000f, 0.0000f, // phase 46 + 0.0039f, -0.1226f, -0.2368f, 0.8975f, -0.5620f, 0.0200f, 0.0000f, 0.0000f, // phase 47 + 0.0034f, -0.1104f, -0.2690f, 0.9292f, -0.5728f, 0.0200f, 0.0000f, 0.0000f, // phase 48 + 0.0029f, -0.1001f, -0.2988f, 0.9580f, -0.5820f, 0.0200f, 0.0000f, 0.0000f, // phase 49 + 0.0024f, -0.0898f, -0.3286f, 0.9893f, -0.5928f, 0.0200f, 0.0000f, 0.0000f, // phase 50 + 0.0020f, -0.0796f, -0.3574f, 1.0161f, -0.6006f, 0.0195f, 0.0000f, 0.0000f, // phase 51 + 0.0015f, -0.0698f, -0.3843f, 1.0405f, -0.6069f, 0.0190f, 0.0000f, 0.0000f, // phase 52 + 0.0015f, -0.0615f, -0.4102f, 1.0659f, -0.6138f, 0.0181f, 0.0000f, 0.0000f, // phase 53 + 0.0010f, -0.0532f, -0.4346f, 1.0879f, -0.6187f, 0.0176f, 0.0000f, 0.0000f, // phase 54 + 0.0010f, -0.0454f, -0.4570f, 1.1089f, -0.6235f, 0.0166f, 0.0000f, 0.0000f, // phase 55 + 0.0005f, -0.0386f, -0.4790f, 1.1274f, -0.6265f, 0.0156f, 0.0000f, 0.0000f, // phase 56 + 0.0005f, -0.0317f, -0.5005f, 1.1455f, -0.6284f, 0.0142f, 0.0000f, 0.0000f, // phase 57 + 0.0005f, -0.0259f, -0.5181f, 1.1582f, -0.6270f, 0.0122f, 0.0000f, 0.0000f, // phase 58 + 0.0005f, -0.0195f, -0.5352f, 1.1699f, -0.6265f, 0.0112f, 0.0000f, 0.0000f, // phase 59 + 0.0000f, -0.0151f, -0.5513f, 1.1802f, -0.6235f, 0.0093f, 0.0000f, 0.0000f, // phase 60 + 0.0000f, -0.0103f, -0.5659f, 1.1890f, -0.6196f, 0.0073f, 0.0000f, 0.0000f, // phase 61 + 0.0005f, -0.0068f, -0.5791f, 1.1958f, -0.6147f, 0.0049f, 0.0000f, 0.0000f, // phase 62 + 0.0000f, -0.0029f, -0.5903f, 1.1987f, -0.6084f, 0.0029f, 0.0000f, 0.0000f, // phase 63 +}; diff --git a/app/src/main/cpp/shaders/nis_luma.frag b/app/src/main/cpp/shaders/nis_luma.frag new file mode 100644 index 0000000000..b1bdbebcb7 --- /dev/null +++ b/app/src/main/cpp/shaders/nis_luma.frag @@ -0,0 +1,36 @@ +#version 450 + +// ============================================================================= +// NIS prepass for nis3.frag: the game image copied 1:1 with its NIS luma in +// alpha (the compositor never uses the alpha of these targets). nis3.frag then +// reads four luma texels per textureGather instead of computing luma for each +// of 36 fetches per output pixel. +// +// Runs at the game (input) resolution into a target of the same size, so the +// output pixel reads its input pixel 1:1 (texelFetch at gl_FragCoord). +// Luma weights = nis.frag getY() (NVIDIA NIS, SDR: BT.709). +// ============================================================================= + +// DD_HALF: colour and luma in mediump; the texel address from gl_FragCoord stays highp +// (no default mediump: a 16-bit gl_FragCoord rounds pixel centres past x = 1024, e.g. +// 1279.5 -> 1280, and texelFetch then reads the wrong or an outside texel). +#ifdef DD_HALF +#define BL_MP mediump +#else +#define BL_MP +#endif + +layout(binding = 0) uniform BL_MP sampler2D InputTexture; + +layout(push_constant) uniform PC { + highp vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0); full target +} pc; + +layout(location = 0) in highp vec2 fragTexCoord; +layout(location = 0) out BL_MP vec4 outColor; + +void main() { + highp ivec2 p = ivec2(gl_FragCoord.xy); + BL_MP vec3 c = texelFetch(InputTexture, p, 0).rgb; + outColor = vec4(c, 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b); +} diff --git a/app/src/main/cpp/shaders/nis_luma_half_frag.h b/app/src/main/cpp/shaders/nis_luma_half_frag.h new file mode 100644 index 0000000000..f03f042715 --- /dev/null +++ b/app/src/main/cpp/shaders/nis_luma_half_frag.h @@ -0,0 +1,58 @@ + // 1116.2.0 + #pragma once +const uint32_t nis_luma_half_code[] = { + 0x07230203,0x00010000,0x0008000b,0x0000003e,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000d,0x00000020,0x0000003d, + 0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004, + 0x6e69616d,0x00000000,0x00030005,0x00000009,0x00000070,0x00060005,0x0000000d,0x465f6c67, + 0x43676172,0x64726f6f,0x00000000,0x00030005,0x00000014,0x00000063,0x00060005,0x00000018, + 0x75706e49,0x78655474,0x65727574,0x00000000,0x00050005,0x00000020,0x4374756f,0x726f6c6f, + 0x00000000,0x00030005,0x00000039,0x00004350,0x00040006,0x00000039,0x00000000,0x0063646e, + 0x00030005,0x0000003b,0x00006370,0x00060005,0x0000003d,0x67617266,0x43786554,0x64726f6f, + 0x00000000,0x00040047,0x0000000d,0x0000000b,0x0000000f,0x00030047,0x00000014,0x00000000, + 0x00030047,0x00000018,0x00000000,0x00040047,0x00000018,0x00000021,0x00000000,0x00040047, + 0x00000018,0x00000022,0x00000000,0x00030047,0x00000019,0x00000000,0x00030047,0x0000001d, + 0x00000000,0x00030047,0x0000001e,0x00000000,0x00030047,0x00000020,0x00000000,0x00040047, + 0x00000020,0x0000001e,0x00000000,0x00030047,0x00000021,0x00000000,0x00030047,0x00000027, + 0x00000000,0x00030047,0x00000028,0x00000000,0x00030047,0x0000002c,0x00000000,0x00030047, + 0x0000002d,0x00000000,0x00030047,0x0000002e,0x00000000,0x00030047,0x00000032,0x00000000, + 0x00030047,0x00000033,0x00000000,0x00030047,0x00000034,0x00000000,0x00030047,0x00000035, + 0x00000000,0x00030047,0x00000036,0x00000000,0x00030047,0x00000037,0x00000000,0x00030047, + 0x00000038,0x00000000,0x00030047,0x00000039,0x00000002,0x00050048,0x00000039,0x00000000, + 0x00000023,0x00000000,0x00040047,0x0000003d,0x0000001e,0x00000000,0x00020013,0x00000002, + 0x00030021,0x00000003,0x00000002,0x00040015,0x00000006,0x00000020,0x00000001,0x00040017, + 0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00030016, + 0x0000000a,0x00000020,0x00040017,0x0000000b,0x0000000a,0x00000004,0x00040020,0x0000000c, + 0x00000001,0x0000000b,0x0004003b,0x0000000c,0x0000000d,0x00000001,0x00040017,0x0000000e, + 0x0000000a,0x00000002,0x00040017,0x00000012,0x0000000a,0x00000003,0x00040020,0x00000013, + 0x00000007,0x00000012,0x00090019,0x00000015,0x0000000a,0x00000001,0x00000000,0x00000000, + 0x00000000,0x00000001,0x00000000,0x0003001b,0x00000016,0x00000015,0x00040020,0x00000017, + 0x00000000,0x00000016,0x0004003b,0x00000017,0x00000018,0x00000000,0x0004002b,0x00000006, + 0x0000001b,0x00000000,0x00040020,0x0000001f,0x00000003,0x0000000b,0x0004003b,0x0000001f, + 0x00000020,0x00000003,0x0004002b,0x0000000a,0x00000022,0x3e59b3d0,0x00040015,0x00000023, + 0x00000020,0x00000000,0x0004002b,0x00000023,0x00000024,0x00000000,0x00040020,0x00000025, + 0x00000007,0x0000000a,0x0004002b,0x0000000a,0x00000029,0x3f371759,0x0004002b,0x00000023, + 0x0000002a,0x00000001,0x0004002b,0x0000000a,0x0000002f,0x3d93dd98,0x0004002b,0x00000023, + 0x00000030,0x00000002,0x0003001e,0x00000039,0x0000000b,0x00040020,0x0000003a,0x00000009, + 0x00000039,0x0004003b,0x0000003a,0x0000003b,0x00000009,0x00040020,0x0000003c,0x00000001, + 0x0000000e,0x0004003b,0x0000003c,0x0000003d,0x00000001,0x00050036,0x00000002,0x00000004, + 0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007, + 0x0004003b,0x00000013,0x00000014,0x00000007,0x0004003d,0x0000000b,0x0000000f,0x0000000d, + 0x0007004f,0x0000000e,0x00000010,0x0000000f,0x0000000f,0x00000000,0x00000001,0x0004006e, + 0x00000007,0x00000011,0x00000010,0x0003003e,0x00000009,0x00000011,0x0004003d,0x00000016, + 0x00000019,0x00000018,0x0004003d,0x00000007,0x0000001a,0x00000009,0x00040064,0x00000015, + 0x0000001c,0x00000019,0x0007005f,0x0000000b,0x0000001d,0x0000001c,0x0000001a,0x00000002, + 0x0000001b,0x0008004f,0x00000012,0x0000001e,0x0000001d,0x0000001d,0x00000000,0x00000001, + 0x00000002,0x0003003e,0x00000014,0x0000001e,0x0004003d,0x00000012,0x00000021,0x00000014, + 0x00050041,0x00000025,0x00000026,0x00000014,0x00000024,0x0004003d,0x0000000a,0x00000027, + 0x00000026,0x00050085,0x0000000a,0x00000028,0x00000022,0x00000027,0x00050041,0x00000025, + 0x0000002b,0x00000014,0x0000002a,0x0004003d,0x0000000a,0x0000002c,0x0000002b,0x00050085, + 0x0000000a,0x0000002d,0x00000029,0x0000002c,0x00050081,0x0000000a,0x0000002e,0x00000028, + 0x0000002d,0x00050041,0x00000025,0x00000031,0x00000014,0x00000030,0x0004003d,0x0000000a, + 0x00000032,0x00000031,0x00050085,0x0000000a,0x00000033,0x0000002f,0x00000032,0x00050081, + 0x0000000a,0x00000034,0x0000002e,0x00000033,0x00050051,0x0000000a,0x00000035,0x00000021, + 0x00000000,0x00050051,0x0000000a,0x00000036,0x00000021,0x00000001,0x00050051,0x0000000a, + 0x00000037,0x00000021,0x00000002,0x00070050,0x0000000b,0x00000038,0x00000035,0x00000036, + 0x00000037,0x00000034,0x0003003e,0x00000020,0x00000038,0x000100fd,0x00010038 +}; diff --git a/app/src/main/cpp/shaders/sgsr.frag b/app/src/main/cpp/shaders/sgsr.frag index 5373bf361c..bd273e9ed7 100644 --- a/app/src/main/cpp/shaders/sgsr.frag +++ b/app/src/main/cpp/shaders/sgsr.frag @@ -17,15 +17,25 @@ // destination rect = normalised output position = normalised source position) // ============================================================================= -layout(binding = 0) uniform sampler2D ps0; +// DD_HALF is set for the *_half_frag.h build (gen_shaders.sh): colour and +// weight maths in mediump (RelaxedPrecision, 16-bit on Adreno) as in Qualcomm's +// reference; positions and texture coordinates stay highp. +#ifdef DD_HALF +precision mediump float; +#define BL_MP mediump +#else +#define BL_MP +#endif + +layout(binding = 0) uniform BL_MP sampler2D ps0; layout(push_constant) uniform PC { - vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0) - vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels + highp vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0) + highp vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels float EdgeSharpness; // driven by the "Sharpness" slider (default 2.0) } pc; -layout(location = 0) in vec2 fragTexCoord; +layout(location = 0) in highp vec2 fragTexCoord; layout(location = 0) out vec4 out_Target0; const float EdgeThreshold = 8.0 / 255.0; @@ -44,15 +54,15 @@ vec2 weightY(float dx, float dy, float c, float std) { } void main() { - vec4 ViewportInfo = pc.ViewportInfo; - vec2 uv = fragTexCoord; + highp vec4 ViewportInfo = pc.ViewportInfo; + highp vec2 uv = fragTexCoord; vec4 color; color.xyz = textureLod(ps0, uv, 0.0).xyz; - vec2 imgCoord = ((uv * ViewportInfo.zw) + vec2(-0.5, 0.5)); - vec2 imgCoordPixel = floor(imgCoord); - vec2 coord = (imgCoordPixel * ViewportInfo.xy); + highp vec2 imgCoord = ((uv * ViewportInfo.zw) + vec2(-0.5, 0.5)); + highp vec2 imgCoordPixel = floor(imgCoord); + highp vec2 coord = (imgCoordPixel * ViewportInfo.xy); vec2 pl = (imgCoord + (-imgCoordPixel)); vec4 left = textureGather(ps0, coord, 1); diff --git a/app/src/main/cpp/shaders/sgsr_half_frag.h b/app/src/main/cpp/shaders/sgsr_half_frag.h new file mode 100644 index 0000000000..12438b654b --- /dev/null +++ b/app/src/main/cpp/shaders/sgsr_half_frag.h @@ -0,0 +1,530 @@ + // 1116.2.0 + #pragma once +const uint32_t sgsr_half_code[] = { + 0x07230203,0x00010000,0x0008000b,0x00000216,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000051,0x00000214,0x00030010, + 0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d, + 0x00000000,0x00070005,0x0000000a,0x74736166,0x636e614c,0x32736f7a,0x3b316628,0x00000000, + 0x00030005,0x00000009,0x00000078,0x00080005,0x00000012,0x67696577,0x28597468,0x663b3166, + 0x31663b31,0x3b31663b,0x00000000,0x00030005,0x0000000e,0x00007864,0x00030005,0x0000000f, + 0x00007964,0x00030005,0x00000010,0x00000063,0x00030005,0x00000011,0x00647473,0x00030005, + 0x00000014,0x00004177,0x00030005,0x00000018,0x00004277,0x00030005,0x00000026,0x00000078, + 0x00030005,0x00000038,0x00000077,0x00040005,0x00000039,0x61726170,0x0000006d,0x00060005, + 0x00000045,0x77656956,0x74726f70,0x6f666e49,0x00000000,0x00030005,0x00000046,0x00004350, + 0x00040006,0x00000046,0x00000000,0x0063646e,0x00070006,0x00000046,0x00000001,0x77656956, + 0x74726f70,0x6f666e49,0x00000000,0x00070006,0x00000046,0x00000002,0x65676445,0x72616853, + 0x73656e70,0x00000073,0x00030005,0x00000048,0x00006370,0x00030005,0x0000004f,0x00007675, + 0x00060005,0x00000051,0x67617266,0x43786554,0x64726f6f,0x00000000,0x00040005,0x00000053, + 0x6f6c6f63,0x00000072,0x00030005,0x00000057,0x00307370,0x00050005,0x00000067,0x43676d69, + 0x64726f6f,0x00000000,0x00060005,0x00000070,0x43676d69,0x64726f6f,0x65786950,0x0000006c, + 0x00040005,0x00000073,0x726f6f63,0x00000064,0x00030005,0x00000078,0x00006c70,0x00040005, + 0x0000007d,0x7466656c,0x00000000,0x00050005,0x00000081,0x65676465,0x65746f56,0x00000000, + 0x00040005,0x000000a2,0x68676972,0x00000074,0x00040005,0x000000aa,0x6f447075,0x00006e77, + 0x00040005,0x000000c5,0x6e61656d,0x00000000,0x00030005,0x000000e4,0x006d7573,0x00030005, + 0x00000114,0x00647473,0x00030005,0x00000118,0x00595761,0x00040005,0x0000011c,0x61726170, + 0x0000006d,0x00040005,0x0000011f,0x61726170,0x0000006d,0x00040005,0x00000120,0x61726170, + 0x0000006d,0x00040005,0x00000123,0x61726170,0x0000006d,0x00040005,0x0000012c,0x61726170, + 0x0000006d,0x00040005,0x0000012d,0x61726170,0x0000006d,0x00040005,0x0000012e,0x61726170, + 0x0000006d,0x00040005,0x00000131,0x61726170,0x0000006d,0x00040005,0x0000013d,0x61726170, + 0x0000006d,0x00040005,0x0000013e,0x61726170,0x0000006d,0x00040005,0x0000013f,0x61726170, + 0x0000006d,0x00040005,0x00000142,0x61726170,0x0000006d,0x00040005,0x0000014a,0x61726170, + 0x0000006d,0x00040005,0x0000014d,0x61726170,0x0000006d,0x00040005,0x0000014e,0x61726170, + 0x0000006d,0x00040005,0x00000151,0x61726170,0x0000006d,0x00040005,0x0000015c,0x61726170, + 0x0000006d,0x00040005,0x0000015d,0x61726170,0x0000006d,0x00040005,0x0000015e,0x61726170, + 0x0000006d,0x00040005,0x00000161,0x61726170,0x0000006d,0x00040005,0x00000169,0x61726170, + 0x0000006d,0x00040005,0x0000016c,0x61726170,0x0000006d,0x00040005,0x0000016d,0x61726170, + 0x0000006d,0x00040005,0x00000170,0x61726170,0x0000006d,0x00040005,0x00000175,0x61726170, + 0x0000006d,0x00040005,0x00000178,0x61726170,0x0000006d,0x00040005,0x0000017b,0x61726170, + 0x0000006d,0x00040005,0x0000017e,0x61726170,0x0000006d,0x00040005,0x00000186,0x61726170, + 0x0000006d,0x00040005,0x00000187,0x61726170,0x0000006d,0x00040005,0x0000018a,0x61726170, + 0x0000006d,0x00040005,0x0000018d,0x61726170,0x0000006d,0x00040005,0x00000198,0x61726170, + 0x0000006d,0x00040005,0x00000199,0x61726170,0x0000006d,0x00040005,0x0000019a,0x61726170, + 0x0000006d,0x00040005,0x0000019d,0x61726170,0x0000006d,0x00040005,0x000001a8,0x61726170, + 0x0000006d,0x00040005,0x000001a9,0x61726170,0x0000006d,0x00040005,0x000001aa,0x61726170, + 0x0000006d,0x00040005,0x000001ad,0x61726170,0x0000006d,0x00040005,0x000001b5,0x61726170, + 0x0000006d,0x00040005,0x000001b6,0x61726170,0x0000006d,0x00040005,0x000001b9,0x61726170, + 0x0000006d,0x00040005,0x000001bc,0x61726170,0x0000006d,0x00040005,0x000001c4,0x61726170, + 0x0000006d,0x00040005,0x000001c5,0x61726170,0x0000006d,0x00040005,0x000001c8,0x61726170, + 0x0000006d,0x00040005,0x000001cb,0x61726170,0x0000006d,0x00040005,0x000001d0,0x616e6966, + 0x0000596c,0x00040005,0x000001d6,0x5978616d,0x00000000,0x00040005,0x000001e2,0x596e696d, + 0x00000000,0x00040005,0x000001f7,0x746c6564,0x00005961,0x00050005,0x00000214,0x5f74756f, + 0x67726154,0x00307465,0x00030047,0x00000009,0x00000000,0x00030047,0x0000000a,0x00000000, + 0x00030047,0x0000000e,0x00000000,0x00030047,0x0000000f,0x00000000,0x00030047,0x00000010, + 0x00000000,0x00030047,0x00000011,0x00000000,0x00030047,0x00000012,0x00000000,0x00030047, + 0x00000014,0x00000000,0x00030047,0x00000015,0x00000000,0x00030047,0x00000017,0x00000000, + 0x00030047,0x00000018,0x00000000,0x00030047,0x00000019,0x00000000,0x00030047,0x0000001a, + 0x00000000,0x00030047,0x0000001b,0x00000000,0x00030047,0x0000001c,0x00000000,0x00030047, + 0x0000001d,0x00000000,0x00030047,0x0000001e,0x00000000,0x00030047,0x0000001f,0x00000000, + 0x00030047,0x00000020,0x00000000,0x00030047,0x00000021,0x00000000,0x00030047,0x00000022, + 0x00000000,0x00030047,0x00000023,0x00000000,0x00030047,0x00000026,0x00000000,0x00030047, + 0x00000027,0x00000000,0x00030047,0x00000028,0x00000000,0x00030047,0x00000029,0x00000000, + 0x00030047,0x0000002a,0x00000000,0x00030047,0x0000002b,0x00000000,0x00030047,0x0000002c, + 0x00000000,0x00030047,0x0000002d,0x00000000,0x00030047,0x0000002f,0x00000000,0x00030047, + 0x00000030,0x00000000,0x00030047,0x00000031,0x00000000,0x00030047,0x00000032,0x00000000, + 0x00030047,0x00000033,0x00000000,0x00030047,0x00000036,0x00000000,0x00030047,0x00000037, + 0x00000000,0x00030047,0x00000038,0x00000000,0x00030047,0x00000039,0x00000000,0x00030047, + 0x0000003a,0x00000000,0x00030047,0x0000003b,0x00000000,0x00030047,0x0000003c,0x00000000, + 0x00030047,0x0000003d,0x00000000,0x00030047,0x0000003e,0x00000000,0x00030047,0x0000003f, + 0x00000000,0x00030047,0x00000040,0x00000000,0x00030047,0x00000046,0x00000002,0x00050048, + 0x00000046,0x00000000,0x00000023,0x00000000,0x00050048,0x00000046,0x00000001,0x00000023, + 0x00000010,0x00040048,0x00000046,0x00000002,0x00000000,0x00050048,0x00000046,0x00000002, + 0x00000023,0x00000020,0x00040047,0x00000051,0x0000001e,0x00000000,0x00030047,0x00000053, + 0x00000000,0x00030047,0x00000057,0x00000000,0x00040047,0x00000057,0x00000021,0x00000000, + 0x00040047,0x00000057,0x00000022,0x00000000,0x00030047,0x00000058,0x00000000,0x00030047, + 0x0000005a,0x00000000,0x00030047,0x0000005c,0x00000000,0x00030047,0x00000078,0x00000000, + 0x00030047,0x0000007d,0x00000000,0x00030047,0x0000007e,0x00000000,0x00030047,0x00000080, + 0x00000000,0x00030047,0x00000081,0x00000000,0x00030047,0x00000083,0x00000000,0x00030047, + 0x00000085,0x00000000,0x00030047,0x00000086,0x00000000,0x00030047,0x00000087,0x00000000, + 0x00030047,0x00000089,0x00000000,0x00030047,0x0000008b,0x00000000,0x00030047,0x0000008c, + 0x00000000,0x00030047,0x0000008d,0x00000000,0x00030047,0x0000008e,0x00000000,0x00030047, + 0x00000090,0x00000000,0x00030047,0x00000092,0x00000000,0x00030047,0x00000093,0x00000000, + 0x00030047,0x00000094,0x00000000,0x00030047,0x00000095,0x00000000,0x00030047,0x00000096, + 0x00000000,0x00030047,0x00000097,0x00000000,0x00030047,0x000000a2,0x00000000,0x00030047, + 0x000000a3,0x00000000,0x00030047,0x000000a9,0x00000000,0x00030047,0x000000aa,0x00000000, + 0x00030047,0x000000ab,0x00000000,0x00030047,0x000000b2,0x00000000,0x00030047,0x000000b3, + 0x00000000,0x00030047,0x000000b8,0x00000000,0x00030047,0x000000be,0x00000000,0x00030047, + 0x000000bf,0x00000000,0x00030047,0x000000c5,0x00000000,0x00030047,0x000000c7,0x00000000, + 0x00030047,0x000000c9,0x00000000,0x00030047,0x000000ca,0x00000000,0x00030047,0x000000cc, + 0x00000000,0x00030047,0x000000cd,0x00000000,0x00030047,0x000000cf,0x00000000,0x00030047, + 0x000000d0,0x00000000,0x00030047,0x000000d2,0x00000000,0x00030047,0x000000d3,0x00000000, + 0x00030047,0x000000d4,0x00000000,0x00030047,0x000000d5,0x00000000,0x00030047,0x000000d6, + 0x00000000,0x00030047,0x000000d7,0x00000000,0x00030047,0x000000d8,0x00000000,0x00030047, + 0x000000d9,0x00000000,0x00030047,0x000000da,0x00000000,0x00030047,0x000000db,0x00000000, + 0x00030047,0x000000dc,0x00000000,0x00030047,0x000000dd,0x00000000,0x00030047,0x000000de, + 0x00000000,0x00030047,0x000000e0,0x00000000,0x00030047,0x000000e1,0x00000000,0x00030047, + 0x000000e2,0x00000000,0x00030047,0x000000e4,0x00000000,0x00030047,0x000000e6,0x00000000, + 0x00030047,0x000000e7,0x00000000,0x00030047,0x000000e9,0x00000000,0x00030047,0x000000ea, + 0x00000000,0x00030047,0x000000eb,0x00000000,0x00030047,0x000000ed,0x00000000,0x00030047, + 0x000000ee,0x00000000,0x00030047,0x000000ef,0x00000000,0x00030047,0x000000f1,0x00000000, + 0x00030047,0x000000f2,0x00000000,0x00030047,0x000000f3,0x00000000,0x00030047,0x000000f5, + 0x00000000,0x00030047,0x000000f6,0x00000000,0x00030047,0x000000f8,0x00000000,0x00030047, + 0x000000f9,0x00000000,0x00030047,0x000000fa,0x00000000,0x00030047,0x000000fc,0x00000000, + 0x00030047,0x000000fd,0x00000000,0x00030047,0x000000fe,0x00000000,0x00030047,0x00000100, + 0x00000000,0x00030047,0x00000101,0x00000000,0x00030047,0x00000102,0x00000000,0x00030047, + 0x00000103,0x00000000,0x00030047,0x00000105,0x00000000,0x00030047,0x00000106,0x00000000, + 0x00030047,0x00000108,0x00000000,0x00030047,0x00000109,0x00000000,0x00030047,0x0000010a, + 0x00000000,0x00030047,0x0000010c,0x00000000,0x00030047,0x0000010d,0x00000000,0x00030047, + 0x0000010e,0x00000000,0x00030047,0x00000110,0x00000000,0x00030047,0x00000111,0x00000000, + 0x00030047,0x00000112,0x00000000,0x00030047,0x00000113,0x00000000,0x00030047,0x00000114, + 0x00000000,0x00030047,0x00000116,0x00000000,0x00030047,0x00000117,0x00000000,0x00030047, + 0x00000118,0x00000000,0x00030047,0x0000011a,0x00000000,0x00030047,0x0000011b,0x00000000, + 0x00030047,0x0000011c,0x00000000,0x00030047,0x0000011e,0x00000000,0x00030047,0x0000011f, + 0x00000000,0x00030047,0x00000120,0x00000000,0x00030047,0x00000122,0x00000000,0x00030047, + 0x00000123,0x00000000,0x00030047,0x00000124,0x00000000,0x00030047,0x00000125,0x00000000, + 0x00030047,0x00000127,0x00000000,0x00030047,0x00000128,0x00000000,0x00030047,0x0000012a, + 0x00000000,0x00030047,0x0000012b,0x00000000,0x00030047,0x0000012c,0x00000000,0x00030047, + 0x0000012d,0x00000000,0x00030047,0x0000012e,0x00000000,0x00030047,0x00000130,0x00000000, + 0x00030047,0x00000131,0x00000000,0x00030047,0x00000132,0x00000000,0x00030047,0x00000133, + 0x00000000,0x00030047,0x00000134,0x00000000,0x00030047,0x00000135,0x00000000,0x00030047, + 0x00000137,0x00000000,0x00030047,0x00000138,0x00000000,0x00030047,0x0000013a,0x00000000, + 0x00030047,0x0000013c,0x00000000,0x00030047,0x0000013d,0x00000000,0x00030047,0x0000013e, + 0x00000000,0x00030047,0x0000013f,0x00000000,0x00030047,0x00000141,0x00000000,0x00030047, + 0x00000142,0x00000000,0x00030047,0x00000143,0x00000000,0x00030047,0x00000144,0x00000000, + 0x00030047,0x00000145,0x00000000,0x00030047,0x00000146,0x00000000,0x00030047,0x00000148, + 0x00000000,0x00030047,0x00000149,0x00000000,0x00030047,0x0000014a,0x00000000,0x00030047, + 0x0000014c,0x00000000,0x00030047,0x0000014d,0x00000000,0x00030047,0x0000014e,0x00000000, + 0x00030047,0x00000150,0x00000000,0x00030047,0x00000151,0x00000000,0x00030047,0x00000152, + 0x00000000,0x00030047,0x00000153,0x00000000,0x00030047,0x00000154,0x00000000,0x00030047, + 0x00000155,0x00000000,0x00030047,0x00000157,0x00000000,0x00030047,0x00000158,0x00000000, + 0x00030047,0x0000015a,0x00000000,0x00030047,0x0000015b,0x00000000,0x00030047,0x0000015c, + 0x00000000,0x00030047,0x0000015d,0x00000000,0x00030047,0x0000015e,0x00000000,0x00030047, + 0x00000160,0x00000000,0x00030047,0x00000161,0x00000000,0x00030047,0x00000162,0x00000000, + 0x00030047,0x00000163,0x00000000,0x00030047,0x00000164,0x00000000,0x00030047,0x00000165, + 0x00000000,0x00030047,0x00000167,0x00000000,0x00030047,0x00000168,0x00000000,0x00030047, + 0x00000169,0x00000000,0x00030047,0x0000016b,0x00000000,0x00030047,0x0000016c,0x00000000, + 0x00030047,0x0000016d,0x00000000,0x00030047,0x0000016f,0x00000000,0x00030047,0x00000170, + 0x00000000,0x00030047,0x00000171,0x00000000,0x00030047,0x00000172,0x00000000,0x00030047, + 0x00000173,0x00000000,0x00030047,0x00000174,0x00000000,0x00030047,0x00000175,0x00000000, + 0x00030047,0x00000177,0x00000000,0x00030047,0x00000178,0x00000000,0x00030047,0x0000017a, + 0x00000000,0x00030047,0x0000017b,0x00000000,0x00030047,0x0000017d,0x00000000,0x00030047, + 0x0000017e,0x00000000,0x00030047,0x0000017f,0x00000000,0x00030047,0x00000180,0x00000000, + 0x00030047,0x00000181,0x00000000,0x00030047,0x00000182,0x00000000,0x00030047,0x00000184, + 0x00000000,0x00030047,0x00000185,0x00000000,0x00030047,0x00000186,0x00000000,0x00030047, + 0x00000187,0x00000000,0x00030047,0x00000189,0x00000000,0x00030047,0x0000018a,0x00000000, + 0x00030047,0x0000018c,0x00000000,0x00030047,0x0000018d,0x00000000,0x00030047,0x0000018e, + 0x00000000,0x00030047,0x0000018f,0x00000000,0x00030047,0x00000190,0x00000000,0x00030047, + 0x00000191,0x00000000,0x00030047,0x00000193,0x00000000,0x00030047,0x00000194,0x00000000, + 0x00030047,0x00000196,0x00000000,0x00030047,0x00000197,0x00000000,0x00030047,0x00000198, + 0x00000000,0x00030047,0x00000199,0x00000000,0x00030047,0x0000019a,0x00000000,0x00030047, + 0x0000019c,0x00000000,0x00030047,0x0000019d,0x00000000,0x00030047,0x0000019e,0x00000000, + 0x00030047,0x0000019f,0x00000000,0x00030047,0x000001a0,0x00000000,0x00030047,0x000001a1, + 0x00000000,0x00030047,0x000001a3,0x00000000,0x00030047,0x000001a4,0x00000000,0x00030047, + 0x000001a6,0x00000000,0x00030047,0x000001a7,0x00000000,0x00030047,0x000001a8,0x00000000, + 0x00030047,0x000001a9,0x00000000,0x00030047,0x000001aa,0x00000000,0x00030047,0x000001ac, + 0x00000000,0x00030047,0x000001ad,0x00000000,0x00030047,0x000001ae,0x00000000,0x00030047, + 0x000001af,0x00000000,0x00030047,0x000001b0,0x00000000,0x00030047,0x000001b1,0x00000000, + 0x00030047,0x000001b3,0x00000000,0x00030047,0x000001b4,0x00000000,0x00030047,0x000001b5, + 0x00000000,0x00030047,0x000001b6,0x00000000,0x00030047,0x000001b8,0x00000000,0x00030047, + 0x000001b9,0x00000000,0x00030047,0x000001bb,0x00000000,0x00030047,0x000001bc,0x00000000, + 0x00030047,0x000001bd,0x00000000,0x00030047,0x000001be,0x00000000,0x00030047,0x000001bf, + 0x00000000,0x00030047,0x000001c0,0x00000000,0x00030047,0x000001c2,0x00000000,0x00030047, + 0x000001c3,0x00000000,0x00030047,0x000001c4,0x00000000,0x00030047,0x000001c5,0x00000000, + 0x00030047,0x000001c7,0x00000000,0x00030047,0x000001c8,0x00000000,0x00030047,0x000001ca, + 0x00000000,0x00030047,0x000001cb,0x00000000,0x00030047,0x000001cc,0x00000000,0x00030047, + 0x000001cd,0x00000000,0x00030047,0x000001ce,0x00000000,0x00030047,0x000001cf,0x00000000, + 0x00030047,0x000001d0,0x00000000,0x00030047,0x000001d2,0x00000000,0x00030047,0x000001d4, + 0x00000000,0x00030047,0x000001d5,0x00000000,0x00030047,0x000001d6,0x00000000,0x00030047, + 0x000001d8,0x00000000,0x00030047,0x000001da,0x00000000,0x00030047,0x000001db,0x00000000, + 0x00030047,0x000001dd,0x00000000,0x00030047,0x000001df,0x00000000,0x00030047,0x000001e0, + 0x00000000,0x00030047,0x000001e1,0x00000000,0x00030047,0x000001e2,0x00000000,0x00030047, + 0x000001e4,0x00000000,0x00030047,0x000001e6,0x00000000,0x00030047,0x000001e7,0x00000000, + 0x00030047,0x000001e9,0x00000000,0x00030047,0x000001eb,0x00000000,0x00030047,0x000001ec, + 0x00000000,0x00030047,0x000001ed,0x00000000,0x00030047,0x000001f1,0x00000000,0x00030047, + 0x000001f2,0x00000000,0x00030047,0x000001f3,0x00000000,0x00030047,0x000001f4,0x00000000, + 0x00030047,0x000001f5,0x00000000,0x00030047,0x000001f6,0x00000000,0x00030047,0x000001f7, + 0x00000000,0x00030047,0x000001f8,0x00000000,0x00030047,0x000001fa,0x00000000,0x00030047, + 0x000001fb,0x00000000,0x00030047,0x000001fc,0x00000000,0x00030047,0x000001ff,0x00000000, + 0x00030047,0x00000201,0x00000000,0x00030047,0x00000202,0x00000000,0x00030047,0x00000203, + 0x00000000,0x00030047,0x00000204,0x00000000,0x00030047,0x00000207,0x00000000,0x00030047, + 0x00000208,0x00000000,0x00030047,0x00000209,0x00000000,0x00030047,0x0000020a,0x00000000, + 0x00030047,0x0000020d,0x00000000,0x00030047,0x0000020e,0x00000000,0x00030047,0x0000020f, + 0x00000000,0x00030047,0x00000210,0x00000000,0x00030047,0x00000214,0x00000000,0x00040047, + 0x00000214,0x0000001e,0x00000000,0x00030047,0x00000215,0x00000000,0x00020013,0x00000002, + 0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040020,0x00000007, + 0x00000007,0x00000006,0x00040021,0x00000008,0x00000006,0x00000007,0x00040017,0x0000000c, + 0x00000006,0x00000002,0x00070021,0x0000000d,0x0000000c,0x00000007,0x00000007,0x00000007, + 0x00000007,0x0004002b,0x00000006,0x00000016,0x40800000,0x0004002b,0x00000006,0x0000002e, + 0x3f0ccccd,0x0004002b,0x00000006,0x00000034,0x00000000,0x0004002b,0x00000006,0x00000035, + 0x3f800000,0x00040017,0x00000043,0x00000006,0x00000004,0x00040020,0x00000044,0x00000007, + 0x00000043,0x0005001e,0x00000046,0x00000043,0x00000043,0x00000006,0x00040020,0x00000047, + 0x00000009,0x00000046,0x0004003b,0x00000047,0x00000048,0x00000009,0x00040015,0x00000049, + 0x00000020,0x00000001,0x0004002b,0x00000049,0x0000004a,0x00000001,0x00040020,0x0000004b, + 0x00000009,0x00000043,0x00040020,0x0000004e,0x00000007,0x0000000c,0x00040020,0x00000050, + 0x00000001,0x0000000c,0x0004003b,0x00000050,0x00000051,0x00000001,0x00090019,0x00000054, + 0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b, + 0x00000055,0x00000054,0x00040020,0x00000056,0x00000000,0x00000055,0x0004003b,0x00000056, + 0x00000057,0x00000000,0x00040017,0x0000005b,0x00000006,0x00000003,0x00040015,0x0000005d, + 0x00000020,0x00000000,0x0004002b,0x0000005d,0x0000005e,0x00000000,0x0004002b,0x0000005d, + 0x00000061,0x00000001,0x0004002b,0x0000005d,0x00000064,0x00000002,0x0004002b,0x00000006, + 0x0000006c,0xbf000000,0x0004002b,0x00000006,0x0000006d,0x3f000000,0x0005002c,0x0000000c, + 0x0000006e,0x0000006c,0x0000006d,0x0004002b,0x00000006,0x00000097,0x3d008081,0x00020014, + 0x00000098,0x0004002b,0x0000005d,0x000000c2,0x00000003,0x0004002b,0x00000006,0x000000d1, + 0x3e800000,0x0004002b,0x00000006,0x00000115,0x400ba2e8,0x0004002b,0x00000006,0x0000013b, + 0x40000000,0x0004002b,0x00000049,0x000001ee,0x00000002,0x00040020,0x000001ef,0x00000009, + 0x00000006,0x0004002b,0x00000006,0x000001fd,0xbdb8b8b9,0x0004002b,0x00000006,0x000001fe, + 0x3db8b8b9,0x00040020,0x00000213,0x00000003,0x00000043,0x0004003b,0x00000213,0x00000214, + 0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005, + 0x0004003b,0x00000044,0x00000045,0x00000007,0x0004003b,0x0000004e,0x0000004f,0x00000007, + 0x0004003b,0x00000044,0x00000053,0x00000007,0x0004003b,0x0000004e,0x00000067,0x00000007, + 0x0004003b,0x0000004e,0x00000070,0x00000007,0x0004003b,0x0000004e,0x00000073,0x00000007, + 0x0004003b,0x0000004e,0x00000078,0x00000007,0x0004003b,0x00000044,0x0000007d,0x00000007, + 0x0004003b,0x00000007,0x00000081,0x00000007,0x0004003b,0x00000044,0x000000a2,0x00000007, + 0x0004003b,0x00000044,0x000000aa,0x00000007,0x0004003b,0x00000007,0x000000c5,0x00000007, + 0x0004003b,0x00000007,0x000000e4,0x00000007,0x0004003b,0x00000007,0x00000114,0x00000007, + 0x0004003b,0x0000004e,0x00000118,0x00000007,0x0004003b,0x00000007,0x0000011c,0x00000007, + 0x0004003b,0x00000007,0x0000011f,0x00000007,0x0004003b,0x00000007,0x00000120,0x00000007, + 0x0004003b,0x00000007,0x00000123,0x00000007,0x0004003b,0x00000007,0x0000012c,0x00000007, + 0x0004003b,0x00000007,0x0000012d,0x00000007,0x0004003b,0x00000007,0x0000012e,0x00000007, + 0x0004003b,0x00000007,0x00000131,0x00000007,0x0004003b,0x00000007,0x0000013d,0x00000007, + 0x0004003b,0x00000007,0x0000013e,0x00000007,0x0004003b,0x00000007,0x0000013f,0x00000007, + 0x0004003b,0x00000007,0x00000142,0x00000007,0x0004003b,0x00000007,0x0000014a,0x00000007, + 0x0004003b,0x00000007,0x0000014d,0x00000007,0x0004003b,0x00000007,0x0000014e,0x00000007, + 0x0004003b,0x00000007,0x00000151,0x00000007,0x0004003b,0x00000007,0x0000015c,0x00000007, + 0x0004003b,0x00000007,0x0000015d,0x00000007,0x0004003b,0x00000007,0x0000015e,0x00000007, + 0x0004003b,0x00000007,0x00000161,0x00000007,0x0004003b,0x00000007,0x00000169,0x00000007, + 0x0004003b,0x00000007,0x0000016c,0x00000007,0x0004003b,0x00000007,0x0000016d,0x00000007, + 0x0004003b,0x00000007,0x00000170,0x00000007,0x0004003b,0x00000007,0x00000175,0x00000007, + 0x0004003b,0x00000007,0x00000178,0x00000007,0x0004003b,0x00000007,0x0000017b,0x00000007, + 0x0004003b,0x00000007,0x0000017e,0x00000007,0x0004003b,0x00000007,0x00000186,0x00000007, + 0x0004003b,0x00000007,0x00000187,0x00000007,0x0004003b,0x00000007,0x0000018a,0x00000007, + 0x0004003b,0x00000007,0x0000018d,0x00000007,0x0004003b,0x00000007,0x00000198,0x00000007, + 0x0004003b,0x00000007,0x00000199,0x00000007,0x0004003b,0x00000007,0x0000019a,0x00000007, + 0x0004003b,0x00000007,0x0000019d,0x00000007,0x0004003b,0x00000007,0x000001a8,0x00000007, + 0x0004003b,0x00000007,0x000001a9,0x00000007,0x0004003b,0x00000007,0x000001aa,0x00000007, + 0x0004003b,0x00000007,0x000001ad,0x00000007,0x0004003b,0x00000007,0x000001b5,0x00000007, + 0x0004003b,0x00000007,0x000001b6,0x00000007,0x0004003b,0x00000007,0x000001b9,0x00000007, + 0x0004003b,0x00000007,0x000001bc,0x00000007,0x0004003b,0x00000007,0x000001c4,0x00000007, + 0x0004003b,0x00000007,0x000001c5,0x00000007,0x0004003b,0x00000007,0x000001c8,0x00000007, + 0x0004003b,0x00000007,0x000001cb,0x00000007,0x0004003b,0x00000007,0x000001d0,0x00000007, + 0x0004003b,0x00000007,0x000001d6,0x00000007,0x0004003b,0x00000007,0x000001e2,0x00000007, + 0x0004003b,0x00000007,0x000001f7,0x00000007,0x00050041,0x0000004b,0x0000004c,0x00000048, + 0x0000004a,0x0004003d,0x00000043,0x0000004d,0x0000004c,0x0003003e,0x00000045,0x0000004d, + 0x0004003d,0x0000000c,0x00000052,0x00000051,0x0003003e,0x0000004f,0x00000052,0x0004003d, + 0x00000055,0x00000058,0x00000057,0x0004003d,0x0000000c,0x00000059,0x0000004f,0x00070058, + 0x00000043,0x0000005a,0x00000058,0x00000059,0x00000002,0x00000034,0x0008004f,0x0000005b, + 0x0000005c,0x0000005a,0x0000005a,0x00000000,0x00000001,0x00000002,0x00050041,0x00000007, + 0x0000005f,0x00000053,0x0000005e,0x00050051,0x00000006,0x00000060,0x0000005c,0x00000000, + 0x0003003e,0x0000005f,0x00000060,0x00050041,0x00000007,0x00000062,0x00000053,0x00000061, + 0x00050051,0x00000006,0x00000063,0x0000005c,0x00000001,0x0003003e,0x00000062,0x00000063, + 0x00050041,0x00000007,0x00000065,0x00000053,0x00000064,0x00050051,0x00000006,0x00000066, + 0x0000005c,0x00000002,0x0003003e,0x00000065,0x00000066,0x0004003d,0x0000000c,0x00000068, + 0x0000004f,0x0004003d,0x00000043,0x00000069,0x00000045,0x0007004f,0x0000000c,0x0000006a, + 0x00000069,0x00000069,0x00000002,0x00000003,0x00050085,0x0000000c,0x0000006b,0x00000068, + 0x0000006a,0x00050081,0x0000000c,0x0000006f,0x0000006b,0x0000006e,0x0003003e,0x00000067, + 0x0000006f,0x0004003d,0x0000000c,0x00000071,0x00000067,0x0006000c,0x0000000c,0x00000072, + 0x00000001,0x00000008,0x00000071,0x0003003e,0x00000070,0x00000072,0x0004003d,0x0000000c, + 0x00000074,0x00000070,0x0004003d,0x00000043,0x00000075,0x00000045,0x0007004f,0x0000000c, + 0x00000076,0x00000075,0x00000075,0x00000000,0x00000001,0x00050085,0x0000000c,0x00000077, + 0x00000074,0x00000076,0x0003003e,0x00000073,0x00000077,0x0004003d,0x0000000c,0x00000079, + 0x00000067,0x0004003d,0x0000000c,0x0000007a,0x00000070,0x0004007f,0x0000000c,0x0000007b, + 0x0000007a,0x00050081,0x0000000c,0x0000007c,0x00000079,0x0000007b,0x0003003e,0x00000078, + 0x0000007c,0x0004003d,0x00000055,0x0000007e,0x00000057,0x0004003d,0x0000000c,0x0000007f, + 0x00000073,0x00060060,0x00000043,0x00000080,0x0000007e,0x0000007f,0x0000004a,0x0003003e, + 0x0000007d,0x00000080,0x00050041,0x00000007,0x00000082,0x0000007d,0x00000064,0x0004003d, + 0x00000006,0x00000083,0x00000082,0x00050041,0x00000007,0x00000084,0x0000007d,0x00000061, + 0x0004003d,0x00000006,0x00000085,0x00000084,0x00050083,0x00000006,0x00000086,0x00000083, + 0x00000085,0x0006000c,0x00000006,0x00000087,0x00000001,0x00000004,0x00000086,0x00050041, + 0x00000007,0x00000088,0x00000053,0x00000061,0x0004003d,0x00000006,0x00000089,0x00000088, + 0x00050041,0x00000007,0x0000008a,0x0000007d,0x00000061,0x0004003d,0x00000006,0x0000008b, + 0x0000008a,0x00050083,0x00000006,0x0000008c,0x00000089,0x0000008b,0x0006000c,0x00000006, + 0x0000008d,0x00000001,0x00000004,0x0000008c,0x00050081,0x00000006,0x0000008e,0x00000087, + 0x0000008d,0x00050041,0x00000007,0x0000008f,0x00000053,0x00000061,0x0004003d,0x00000006, + 0x00000090,0x0000008f,0x00050041,0x00000007,0x00000091,0x0000007d,0x00000064,0x0004003d, + 0x00000006,0x00000092,0x00000091,0x00050083,0x00000006,0x00000093,0x00000090,0x00000092, + 0x0006000c,0x00000006,0x00000094,0x00000001,0x00000004,0x00000093,0x00050081,0x00000006, + 0x00000095,0x0000008e,0x00000094,0x0003003e,0x00000081,0x00000095,0x0004003d,0x00000006, + 0x00000096,0x00000081,0x000500ba,0x00000098,0x00000099,0x00000096,0x00000097,0x000300f7, + 0x0000009b,0x00000000,0x000400fa,0x00000099,0x0000009a,0x0000009b,0x000200f8,0x0000009a, + 0x00050041,0x00000007,0x0000009c,0x00000045,0x0000005e,0x0004003d,0x00000006,0x0000009d, + 0x0000009c,0x00050041,0x00000007,0x0000009e,0x00000073,0x0000005e,0x0004003d,0x00000006, + 0x0000009f,0x0000009e,0x00050081,0x00000006,0x000000a0,0x0000009f,0x0000009d,0x00050041, + 0x00000007,0x000000a1,0x00000073,0x0000005e,0x0003003e,0x000000a1,0x000000a0,0x0004003d, + 0x00000055,0x000000a3,0x00000057,0x0004003d,0x0000000c,0x000000a4,0x00000073,0x00050041, + 0x00000007,0x000000a5,0x00000045,0x0000005e,0x0004003d,0x00000006,0x000000a6,0x000000a5, + 0x00050050,0x0000000c,0x000000a7,0x000000a6,0x00000034,0x00050081,0x0000000c,0x000000a8, + 0x000000a4,0x000000a7,0x00060060,0x00000043,0x000000a9,0x000000a3,0x000000a8,0x0000004a, + 0x0003003e,0x000000a2,0x000000a9,0x0004003d,0x00000055,0x000000ab,0x00000057,0x0004003d, + 0x0000000c,0x000000ac,0x00000073,0x00050041,0x00000007,0x000000ad,0x00000045,0x00000061, + 0x0004003d,0x00000006,0x000000ae,0x000000ad,0x0004007f,0x00000006,0x000000af,0x000000ae, + 0x00050050,0x0000000c,0x000000b0,0x00000034,0x000000af,0x00050081,0x0000000c,0x000000b1, + 0x000000ac,0x000000b0,0x00060060,0x00000043,0x000000b2,0x000000ab,0x000000b1,0x0000004a, + 0x0007004f,0x0000000c,0x000000b3,0x000000b2,0x000000b2,0x00000003,0x00000002,0x00050041, + 0x00000007,0x000000b4,0x000000aa,0x0000005e,0x00050051,0x00000006,0x000000b5,0x000000b3, + 0x00000000,0x0003003e,0x000000b4,0x000000b5,0x00050041,0x00000007,0x000000b6,0x000000aa, + 0x00000061,0x00050051,0x00000006,0x000000b7,0x000000b3,0x00000001,0x0003003e,0x000000b6, + 0x000000b7,0x0004003d,0x00000055,0x000000b8,0x00000057,0x0004003d,0x0000000c,0x000000b9, + 0x00000073,0x00050041,0x00000007,0x000000ba,0x00000045,0x00000061,0x0004003d,0x00000006, + 0x000000bb,0x000000ba,0x00050050,0x0000000c,0x000000bc,0x00000034,0x000000bb,0x00050081, + 0x0000000c,0x000000bd,0x000000b9,0x000000bc,0x00060060,0x00000043,0x000000be,0x000000b8, + 0x000000bd,0x0000004a,0x0007004f,0x0000000c,0x000000bf,0x000000be,0x000000be,0x00000001, + 0x00000000,0x00050041,0x00000007,0x000000c0,0x000000aa,0x00000064,0x00050051,0x00000006, + 0x000000c1,0x000000bf,0x00000000,0x0003003e,0x000000c0,0x000000c1,0x00050041,0x00000007, + 0x000000c3,0x000000aa,0x000000c2,0x00050051,0x00000006,0x000000c4,0x000000bf,0x00000001, + 0x0003003e,0x000000c3,0x000000c4,0x00050041,0x00000007,0x000000c6,0x0000007d,0x00000061, + 0x0004003d,0x00000006,0x000000c7,0x000000c6,0x00050041,0x00000007,0x000000c8,0x0000007d, + 0x00000064,0x0004003d,0x00000006,0x000000c9,0x000000c8,0x00050081,0x00000006,0x000000ca, + 0x000000c7,0x000000c9,0x00050041,0x00000007,0x000000cb,0x000000a2,0x0000005e,0x0004003d, + 0x00000006,0x000000cc,0x000000cb,0x00050081,0x00000006,0x000000cd,0x000000ca,0x000000cc, + 0x00050041,0x00000007,0x000000ce,0x000000a2,0x000000c2,0x0004003d,0x00000006,0x000000cf, + 0x000000ce,0x00050081,0x00000006,0x000000d0,0x000000cd,0x000000cf,0x00050085,0x00000006, + 0x000000d2,0x000000d0,0x000000d1,0x0003003e,0x000000c5,0x000000d2,0x0004003d,0x00000043, + 0x000000d3,0x0000007d,0x0004003d,0x00000006,0x000000d4,0x000000c5,0x00070050,0x00000043, + 0x000000d5,0x000000d4,0x000000d4,0x000000d4,0x000000d4,0x00050083,0x00000043,0x000000d6, + 0x000000d3,0x000000d5,0x0003003e,0x0000007d,0x000000d6,0x0004003d,0x00000043,0x000000d7, + 0x000000a2,0x0004003d,0x00000006,0x000000d8,0x000000c5,0x00070050,0x00000043,0x000000d9, + 0x000000d8,0x000000d8,0x000000d8,0x000000d8,0x00050083,0x00000043,0x000000da,0x000000d7, + 0x000000d9,0x0003003e,0x000000a2,0x000000da,0x0004003d,0x00000043,0x000000db,0x000000aa, + 0x0004003d,0x00000006,0x000000dc,0x000000c5,0x00070050,0x00000043,0x000000dd,0x000000dc, + 0x000000dc,0x000000dc,0x000000dc,0x00050083,0x00000043,0x000000de,0x000000db,0x000000dd, + 0x0003003e,0x000000aa,0x000000de,0x00050041,0x00000007,0x000000df,0x00000053,0x00000061, + 0x0004003d,0x00000006,0x000000e0,0x000000df,0x0004003d,0x00000006,0x000000e1,0x000000c5, + 0x00050083,0x00000006,0x000000e2,0x000000e0,0x000000e1,0x00050041,0x00000007,0x000000e3, + 0x00000053,0x000000c2,0x0003003e,0x000000e3,0x000000e2,0x00050041,0x00000007,0x000000e5, + 0x0000007d,0x0000005e,0x0004003d,0x00000006,0x000000e6,0x000000e5,0x0006000c,0x00000006, + 0x000000e7,0x00000001,0x00000004,0x000000e6,0x00050041,0x00000007,0x000000e8,0x0000007d, + 0x00000061,0x0004003d,0x00000006,0x000000e9,0x000000e8,0x0006000c,0x00000006,0x000000ea, + 0x00000001,0x00000004,0x000000e9,0x00050081,0x00000006,0x000000eb,0x000000e7,0x000000ea, + 0x00050041,0x00000007,0x000000ec,0x0000007d,0x00000064,0x0004003d,0x00000006,0x000000ed, + 0x000000ec,0x0006000c,0x00000006,0x000000ee,0x00000001,0x00000004,0x000000ed,0x00050081, + 0x00000006,0x000000ef,0x000000eb,0x000000ee,0x00050041,0x00000007,0x000000f0,0x0000007d, + 0x000000c2,0x0004003d,0x00000006,0x000000f1,0x000000f0,0x0006000c,0x00000006,0x000000f2, + 0x00000001,0x00000004,0x000000f1,0x00050081,0x00000006,0x000000f3,0x000000ef,0x000000f2, + 0x00050041,0x00000007,0x000000f4,0x000000a2,0x0000005e,0x0004003d,0x00000006,0x000000f5, + 0x000000f4,0x0006000c,0x00000006,0x000000f6,0x00000001,0x00000004,0x000000f5,0x00050041, + 0x00000007,0x000000f7,0x000000a2,0x00000061,0x0004003d,0x00000006,0x000000f8,0x000000f7, + 0x0006000c,0x00000006,0x000000f9,0x00000001,0x00000004,0x000000f8,0x00050081,0x00000006, + 0x000000fa,0x000000f6,0x000000f9,0x00050041,0x00000007,0x000000fb,0x000000a2,0x00000064, + 0x0004003d,0x00000006,0x000000fc,0x000000fb,0x0006000c,0x00000006,0x000000fd,0x00000001, + 0x00000004,0x000000fc,0x00050081,0x00000006,0x000000fe,0x000000fa,0x000000fd,0x00050041, + 0x00000007,0x000000ff,0x000000a2,0x000000c2,0x0004003d,0x00000006,0x00000100,0x000000ff, + 0x0006000c,0x00000006,0x00000101,0x00000001,0x00000004,0x00000100,0x00050081,0x00000006, + 0x00000102,0x000000fe,0x00000101,0x00050081,0x00000006,0x00000103,0x000000f3,0x00000102, + 0x00050041,0x00000007,0x00000104,0x000000aa,0x0000005e,0x0004003d,0x00000006,0x00000105, + 0x00000104,0x0006000c,0x00000006,0x00000106,0x00000001,0x00000004,0x00000105,0x00050041, + 0x00000007,0x00000107,0x000000aa,0x00000061,0x0004003d,0x00000006,0x00000108,0x00000107, + 0x0006000c,0x00000006,0x00000109,0x00000001,0x00000004,0x00000108,0x00050081,0x00000006, + 0x0000010a,0x00000106,0x00000109,0x00050041,0x00000007,0x0000010b,0x000000aa,0x00000064, + 0x0004003d,0x00000006,0x0000010c,0x0000010b,0x0006000c,0x00000006,0x0000010d,0x00000001, + 0x00000004,0x0000010c,0x00050081,0x00000006,0x0000010e,0x0000010a,0x0000010d,0x00050041, + 0x00000007,0x0000010f,0x000000aa,0x000000c2,0x0004003d,0x00000006,0x00000110,0x0000010f, + 0x0006000c,0x00000006,0x00000111,0x00000001,0x00000004,0x00000110,0x00050081,0x00000006, + 0x00000112,0x0000010e,0x00000111,0x00050081,0x00000006,0x00000113,0x00000103,0x00000112, + 0x0003003e,0x000000e4,0x00000113,0x0004003d,0x00000006,0x00000116,0x000000e4,0x00050088, + 0x00000006,0x00000117,0x00000115,0x00000116,0x0003003e,0x00000114,0x00000117,0x00050041, + 0x00000007,0x00000119,0x00000078,0x00000061,0x0004003d,0x00000006,0x0000011a,0x00000119, + 0x00050081,0x00000006,0x0000011b,0x0000011a,0x00000035,0x00050041,0x00000007,0x0000011d, + 0x00000078,0x0000005e,0x0004003d,0x00000006,0x0000011e,0x0000011d,0x0003003e,0x0000011c, + 0x0000011e,0x0003003e,0x0000011f,0x0000011b,0x00050041,0x00000007,0x00000121,0x000000aa, + 0x0000005e,0x0004003d,0x00000006,0x00000122,0x00000121,0x0003003e,0x00000120,0x00000122, + 0x0004003d,0x00000006,0x00000124,0x00000114,0x0003003e,0x00000123,0x00000124,0x00080039, + 0x0000000c,0x00000125,0x00000012,0x0000011c,0x0000011f,0x00000120,0x00000123,0x0003003e, + 0x00000118,0x00000125,0x00050041,0x00000007,0x00000126,0x00000078,0x0000005e,0x0004003d, + 0x00000006,0x00000127,0x00000126,0x00050083,0x00000006,0x00000128,0x00000127,0x00000035, + 0x00050041,0x00000007,0x00000129,0x00000078,0x00000061,0x0004003d,0x00000006,0x0000012a, + 0x00000129,0x00050081,0x00000006,0x0000012b,0x0000012a,0x00000035,0x0003003e,0x0000012c, + 0x00000128,0x0003003e,0x0000012d,0x0000012b,0x00050041,0x00000007,0x0000012f,0x000000aa, + 0x00000061,0x0004003d,0x00000006,0x00000130,0x0000012f,0x0003003e,0x0000012e,0x00000130, + 0x0004003d,0x00000006,0x00000132,0x00000114,0x0003003e,0x00000131,0x00000132,0x00080039, + 0x0000000c,0x00000133,0x00000012,0x0000012c,0x0000012d,0x0000012e,0x00000131,0x0004003d, + 0x0000000c,0x00000134,0x00000118,0x00050081,0x0000000c,0x00000135,0x00000134,0x00000133, + 0x0003003e,0x00000118,0x00000135,0x00050041,0x00000007,0x00000136,0x00000078,0x0000005e, + 0x0004003d,0x00000006,0x00000137,0x00000136,0x00050083,0x00000006,0x00000138,0x00000137, + 0x00000035,0x00050041,0x00000007,0x00000139,0x00000078,0x00000061,0x0004003d,0x00000006, + 0x0000013a,0x00000139,0x00050083,0x00000006,0x0000013c,0x0000013a,0x0000013b,0x0003003e, + 0x0000013d,0x00000138,0x0003003e,0x0000013e,0x0000013c,0x00050041,0x00000007,0x00000140, + 0x000000aa,0x00000064,0x0004003d,0x00000006,0x00000141,0x00000140,0x0003003e,0x0000013f, + 0x00000141,0x0004003d,0x00000006,0x00000143,0x00000114,0x0003003e,0x00000142,0x00000143, + 0x00080039,0x0000000c,0x00000144,0x00000012,0x0000013d,0x0000013e,0x0000013f,0x00000142, + 0x0004003d,0x0000000c,0x00000145,0x00000118,0x00050081,0x0000000c,0x00000146,0x00000145, + 0x00000144,0x0003003e,0x00000118,0x00000146,0x00050041,0x00000007,0x00000147,0x00000078, + 0x00000061,0x0004003d,0x00000006,0x00000148,0x00000147,0x00050083,0x00000006,0x00000149, + 0x00000148,0x0000013b,0x00050041,0x00000007,0x0000014b,0x00000078,0x0000005e,0x0004003d, + 0x00000006,0x0000014c,0x0000014b,0x0003003e,0x0000014a,0x0000014c,0x0003003e,0x0000014d, + 0x00000149,0x00050041,0x00000007,0x0000014f,0x000000aa,0x000000c2,0x0004003d,0x00000006, + 0x00000150,0x0000014f,0x0003003e,0x0000014e,0x00000150,0x0004003d,0x00000006,0x00000152, + 0x00000114,0x0003003e,0x00000151,0x00000152,0x00080039,0x0000000c,0x00000153,0x00000012, + 0x0000014a,0x0000014d,0x0000014e,0x00000151,0x0004003d,0x0000000c,0x00000154,0x00000118, + 0x00050081,0x0000000c,0x00000155,0x00000154,0x00000153,0x0003003e,0x00000118,0x00000155, + 0x00050041,0x00000007,0x00000156,0x00000078,0x0000005e,0x0004003d,0x00000006,0x00000157, + 0x00000156,0x00050081,0x00000006,0x00000158,0x00000157,0x00000035,0x00050041,0x00000007, + 0x00000159,0x00000078,0x00000061,0x0004003d,0x00000006,0x0000015a,0x00000159,0x00050083, + 0x00000006,0x0000015b,0x0000015a,0x00000035,0x0003003e,0x0000015c,0x00000158,0x0003003e, + 0x0000015d,0x0000015b,0x00050041,0x00000007,0x0000015f,0x0000007d,0x0000005e,0x0004003d, + 0x00000006,0x00000160,0x0000015f,0x0003003e,0x0000015e,0x00000160,0x0004003d,0x00000006, + 0x00000162,0x00000114,0x0003003e,0x00000161,0x00000162,0x00080039,0x0000000c,0x00000163, + 0x00000012,0x0000015c,0x0000015d,0x0000015e,0x00000161,0x0004003d,0x0000000c,0x00000164, + 0x00000118,0x00050081,0x0000000c,0x00000165,0x00000164,0x00000163,0x0003003e,0x00000118, + 0x00000165,0x00050041,0x00000007,0x00000166,0x00000078,0x00000061,0x0004003d,0x00000006, + 0x00000167,0x00000166,0x00050083,0x00000006,0x00000168,0x00000167,0x00000035,0x00050041, + 0x00000007,0x0000016a,0x00000078,0x0000005e,0x0004003d,0x00000006,0x0000016b,0x0000016a, + 0x0003003e,0x00000169,0x0000016b,0x0003003e,0x0000016c,0x00000168,0x00050041,0x00000007, + 0x0000016e,0x0000007d,0x00000061,0x0004003d,0x00000006,0x0000016f,0x0000016e,0x0003003e, + 0x0000016d,0x0000016f,0x0004003d,0x00000006,0x00000171,0x00000114,0x0003003e,0x00000170, + 0x00000171,0x00080039,0x0000000c,0x00000172,0x00000012,0x00000169,0x0000016c,0x0000016d, + 0x00000170,0x0004003d,0x0000000c,0x00000173,0x00000118,0x00050081,0x0000000c,0x00000174, + 0x00000173,0x00000172,0x0003003e,0x00000118,0x00000174,0x00050041,0x00000007,0x00000176, + 0x00000078,0x0000005e,0x0004003d,0x00000006,0x00000177,0x00000176,0x0003003e,0x00000175, + 0x00000177,0x00050041,0x00000007,0x00000179,0x00000078,0x00000061,0x0004003d,0x00000006, + 0x0000017a,0x00000179,0x0003003e,0x00000178,0x0000017a,0x00050041,0x00000007,0x0000017c, + 0x0000007d,0x00000064,0x0004003d,0x00000006,0x0000017d,0x0000017c,0x0003003e,0x0000017b, + 0x0000017d,0x0004003d,0x00000006,0x0000017f,0x00000114,0x0003003e,0x0000017e,0x0000017f, + 0x00080039,0x0000000c,0x00000180,0x00000012,0x00000175,0x00000178,0x0000017b,0x0000017e, + 0x0004003d,0x0000000c,0x00000181,0x00000118,0x00050081,0x0000000c,0x00000182,0x00000181, + 0x00000180,0x0003003e,0x00000118,0x00000182,0x00050041,0x00000007,0x00000183,0x00000078, + 0x0000005e,0x0004003d,0x00000006,0x00000184,0x00000183,0x00050081,0x00000006,0x00000185, + 0x00000184,0x00000035,0x0003003e,0x00000186,0x00000185,0x00050041,0x00000007,0x00000188, + 0x00000078,0x00000061,0x0004003d,0x00000006,0x00000189,0x00000188,0x0003003e,0x00000187, + 0x00000189,0x00050041,0x00000007,0x0000018b,0x0000007d,0x000000c2,0x0004003d,0x00000006, + 0x0000018c,0x0000018b,0x0003003e,0x0000018a,0x0000018c,0x0004003d,0x00000006,0x0000018e, + 0x00000114,0x0003003e,0x0000018d,0x0000018e,0x00080039,0x0000000c,0x0000018f,0x00000012, + 0x00000186,0x00000187,0x0000018a,0x0000018d,0x0004003d,0x0000000c,0x00000190,0x00000118, + 0x00050081,0x0000000c,0x00000191,0x00000190,0x0000018f,0x0003003e,0x00000118,0x00000191, + 0x00050041,0x00000007,0x00000192,0x00000078,0x0000005e,0x0004003d,0x00000006,0x00000193, + 0x00000192,0x00050083,0x00000006,0x00000194,0x00000193,0x00000035,0x00050041,0x00000007, + 0x00000195,0x00000078,0x00000061,0x0004003d,0x00000006,0x00000196,0x00000195,0x00050083, + 0x00000006,0x00000197,0x00000196,0x00000035,0x0003003e,0x00000198,0x00000194,0x0003003e, + 0x00000199,0x00000197,0x00050041,0x00000007,0x0000019b,0x000000a2,0x0000005e,0x0004003d, + 0x00000006,0x0000019c,0x0000019b,0x0003003e,0x0000019a,0x0000019c,0x0004003d,0x00000006, + 0x0000019e,0x00000114,0x0003003e,0x0000019d,0x0000019e,0x00080039,0x0000000c,0x0000019f, + 0x00000012,0x00000198,0x00000199,0x0000019a,0x0000019d,0x0004003d,0x0000000c,0x000001a0, + 0x00000118,0x00050081,0x0000000c,0x000001a1,0x000001a0,0x0000019f,0x0003003e,0x00000118, + 0x000001a1,0x00050041,0x00000007,0x000001a2,0x00000078,0x0000005e,0x0004003d,0x00000006, + 0x000001a3,0x000001a2,0x00050083,0x00000006,0x000001a4,0x000001a3,0x0000013b,0x00050041, + 0x00000007,0x000001a5,0x00000078,0x00000061,0x0004003d,0x00000006,0x000001a6,0x000001a5, + 0x00050083,0x00000006,0x000001a7,0x000001a6,0x00000035,0x0003003e,0x000001a8,0x000001a4, + 0x0003003e,0x000001a9,0x000001a7,0x00050041,0x00000007,0x000001ab,0x000000a2,0x00000061, + 0x0004003d,0x00000006,0x000001ac,0x000001ab,0x0003003e,0x000001aa,0x000001ac,0x0004003d, + 0x00000006,0x000001ae,0x00000114,0x0003003e,0x000001ad,0x000001ae,0x00080039,0x0000000c, + 0x000001af,0x00000012,0x000001a8,0x000001a9,0x000001aa,0x000001ad,0x0004003d,0x0000000c, + 0x000001b0,0x00000118,0x00050081,0x0000000c,0x000001b1,0x000001b0,0x000001af,0x0003003e, + 0x00000118,0x000001b1,0x00050041,0x00000007,0x000001b2,0x00000078,0x0000005e,0x0004003d, + 0x00000006,0x000001b3,0x000001b2,0x00050083,0x00000006,0x000001b4,0x000001b3,0x0000013b, + 0x0003003e,0x000001b5,0x000001b4,0x00050041,0x00000007,0x000001b7,0x00000078,0x00000061, + 0x0004003d,0x00000006,0x000001b8,0x000001b7,0x0003003e,0x000001b6,0x000001b8,0x00050041, + 0x00000007,0x000001ba,0x000000a2,0x00000064,0x0004003d,0x00000006,0x000001bb,0x000001ba, + 0x0003003e,0x000001b9,0x000001bb,0x0004003d,0x00000006,0x000001bd,0x00000114,0x0003003e, + 0x000001bc,0x000001bd,0x00080039,0x0000000c,0x000001be,0x00000012,0x000001b5,0x000001b6, + 0x000001b9,0x000001bc,0x0004003d,0x0000000c,0x000001bf,0x00000118,0x00050081,0x0000000c, + 0x000001c0,0x000001bf,0x000001be,0x0003003e,0x00000118,0x000001c0,0x00050041,0x00000007, + 0x000001c1,0x00000078,0x0000005e,0x0004003d,0x00000006,0x000001c2,0x000001c1,0x00050083, + 0x00000006,0x000001c3,0x000001c2,0x00000035,0x0003003e,0x000001c4,0x000001c3,0x00050041, + 0x00000007,0x000001c6,0x00000078,0x00000061,0x0004003d,0x00000006,0x000001c7,0x000001c6, + 0x0003003e,0x000001c5,0x000001c7,0x00050041,0x00000007,0x000001c9,0x000000a2,0x000000c2, + 0x0004003d,0x00000006,0x000001ca,0x000001c9,0x0003003e,0x000001c8,0x000001ca,0x0004003d, + 0x00000006,0x000001cc,0x00000114,0x0003003e,0x000001cb,0x000001cc,0x00080039,0x0000000c, + 0x000001cd,0x00000012,0x000001c4,0x000001c5,0x000001c8,0x000001cb,0x0004003d,0x0000000c, + 0x000001ce,0x00000118,0x00050081,0x0000000c,0x000001cf,0x000001ce,0x000001cd,0x0003003e, + 0x00000118,0x000001cf,0x00050041,0x00000007,0x000001d1,0x00000118,0x00000061,0x0004003d, + 0x00000006,0x000001d2,0x000001d1,0x00050041,0x00000007,0x000001d3,0x00000118,0x0000005e, + 0x0004003d,0x00000006,0x000001d4,0x000001d3,0x00050088,0x00000006,0x000001d5,0x000001d2, + 0x000001d4,0x0003003e,0x000001d0,0x000001d5,0x00050041,0x00000007,0x000001d7,0x0000007d, + 0x00000061,0x0004003d,0x00000006,0x000001d8,0x000001d7,0x00050041,0x00000007,0x000001d9, + 0x0000007d,0x00000064,0x0004003d,0x00000006,0x000001da,0x000001d9,0x0007000c,0x00000006, + 0x000001db,0x00000001,0x00000028,0x000001d8,0x000001da,0x00050041,0x00000007,0x000001dc, + 0x000000a2,0x0000005e,0x0004003d,0x00000006,0x000001dd,0x000001dc,0x00050041,0x00000007, + 0x000001de,0x000000a2,0x000000c2,0x0004003d,0x00000006,0x000001df,0x000001de,0x0007000c, + 0x00000006,0x000001e0,0x00000001,0x00000028,0x000001dd,0x000001df,0x0007000c,0x00000006, + 0x000001e1,0x00000001,0x00000028,0x000001db,0x000001e0,0x0003003e,0x000001d6,0x000001e1, + 0x00050041,0x00000007,0x000001e3,0x0000007d,0x00000061,0x0004003d,0x00000006,0x000001e4, + 0x000001e3,0x00050041,0x00000007,0x000001e5,0x0000007d,0x00000064,0x0004003d,0x00000006, + 0x000001e6,0x000001e5,0x0007000c,0x00000006,0x000001e7,0x00000001,0x00000025,0x000001e4, + 0x000001e6,0x00050041,0x00000007,0x000001e8,0x000000a2,0x0000005e,0x0004003d,0x00000006, + 0x000001e9,0x000001e8,0x00050041,0x00000007,0x000001ea,0x000000a2,0x000000c2,0x0004003d, + 0x00000006,0x000001eb,0x000001ea,0x0007000c,0x00000006,0x000001ec,0x00000001,0x00000025, + 0x000001e9,0x000001eb,0x0007000c,0x00000006,0x000001ed,0x00000001,0x00000025,0x000001e7, + 0x000001ec,0x0003003e,0x000001e2,0x000001ed,0x00050041,0x000001ef,0x000001f0,0x00000048, + 0x000001ee,0x0004003d,0x00000006,0x000001f1,0x000001f0,0x0004003d,0x00000006,0x000001f2, + 0x000001d0,0x00050085,0x00000006,0x000001f3,0x000001f1,0x000001f2,0x0004003d,0x00000006, + 0x000001f4,0x000001e2,0x0004003d,0x00000006,0x000001f5,0x000001d6,0x0008000c,0x00000006, + 0x000001f6,0x00000001,0x0000002b,0x000001f3,0x000001f4,0x000001f5,0x0003003e,0x000001d0, + 0x000001f6,0x0004003d,0x00000006,0x000001f8,0x000001d0,0x00050041,0x00000007,0x000001f9, + 0x00000053,0x000000c2,0x0004003d,0x00000006,0x000001fa,0x000001f9,0x00050083,0x00000006, + 0x000001fb,0x000001f8,0x000001fa,0x0003003e,0x000001f7,0x000001fb,0x0004003d,0x00000006, + 0x000001fc,0x000001f7,0x0008000c,0x00000006,0x000001ff,0x00000001,0x0000002b,0x000001fc, + 0x000001fd,0x000001fe,0x0003003e,0x000001f7,0x000001ff,0x00050041,0x00000007,0x00000200, + 0x00000053,0x0000005e,0x0004003d,0x00000006,0x00000201,0x00000200,0x0004003d,0x00000006, + 0x00000202,0x000001f7,0x00050081,0x00000006,0x00000203,0x00000201,0x00000202,0x0008000c, + 0x00000006,0x00000204,0x00000001,0x0000002b,0x00000203,0x00000034,0x00000035,0x00050041, + 0x00000007,0x00000205,0x00000053,0x0000005e,0x0003003e,0x00000205,0x00000204,0x00050041, + 0x00000007,0x00000206,0x00000053,0x00000061,0x0004003d,0x00000006,0x00000207,0x00000206, + 0x0004003d,0x00000006,0x00000208,0x000001f7,0x00050081,0x00000006,0x00000209,0x00000207, + 0x00000208,0x0008000c,0x00000006,0x0000020a,0x00000001,0x0000002b,0x00000209,0x00000034, + 0x00000035,0x00050041,0x00000007,0x0000020b,0x00000053,0x00000061,0x0003003e,0x0000020b, + 0x0000020a,0x00050041,0x00000007,0x0000020c,0x00000053,0x00000064,0x0004003d,0x00000006, + 0x0000020d,0x0000020c,0x0004003d,0x00000006,0x0000020e,0x000001f7,0x00050081,0x00000006, + 0x0000020f,0x0000020d,0x0000020e,0x0008000c,0x00000006,0x00000210,0x00000001,0x0000002b, + 0x0000020f,0x00000034,0x00000035,0x00050041,0x00000007,0x00000211,0x00000053,0x00000064, + 0x0003003e,0x00000211,0x00000210,0x000200f9,0x0000009b,0x000200f8,0x0000009b,0x00050041, + 0x00000007,0x00000212,0x00000053,0x000000c2,0x0003003e,0x00000212,0x00000035,0x0004003d, + 0x00000043,0x00000215,0x00000053,0x0003003e,0x00000214,0x00000215,0x000100fd,0x00010038, + 0x00050036,0x00000006,0x0000000a,0x00000000,0x00000008,0x00030037,0x00000007,0x00000009, + 0x000200f8,0x0000000b,0x0004003b,0x00000007,0x00000014,0x00000007,0x0004003b,0x00000007, + 0x00000018,0x00000007,0x0004003d,0x00000006,0x00000015,0x00000009,0x00050083,0x00000006, + 0x00000017,0x00000015,0x00000016,0x0003003e,0x00000014,0x00000017,0x0004003d,0x00000006, + 0x00000019,0x00000009,0x0004003d,0x00000006,0x0000001a,0x00000014,0x00050085,0x00000006, + 0x0000001b,0x00000019,0x0000001a,0x0004003d,0x00000006,0x0000001c,0x00000014,0x00050083, + 0x00000006,0x0000001d,0x0000001b,0x0000001c,0x0003003e,0x00000018,0x0000001d,0x0004003d, + 0x00000006,0x0000001e,0x00000014,0x0004003d,0x00000006,0x0000001f,0x00000014,0x00050085, + 0x00000006,0x00000020,0x0000001f,0x0000001e,0x0003003e,0x00000014,0x00000020,0x0004003d, + 0x00000006,0x00000021,0x00000018,0x0004003d,0x00000006,0x00000022,0x00000014,0x00050085, + 0x00000006,0x00000023,0x00000021,0x00000022,0x000200fe,0x00000023,0x00010038,0x00050036, + 0x0000000c,0x00000012,0x00000000,0x0000000d,0x00030037,0x00000007,0x0000000e,0x00030037, + 0x00000007,0x0000000f,0x00030037,0x00000007,0x00000010,0x00030037,0x00000007,0x00000011, + 0x000200f8,0x00000013,0x0004003b,0x00000007,0x00000026,0x00000007,0x0004003b,0x00000007, + 0x00000038,0x00000007,0x0004003b,0x00000007,0x00000039,0x00000007,0x0004003d,0x00000006, + 0x00000027,0x0000000e,0x0004003d,0x00000006,0x00000028,0x0000000e,0x00050085,0x00000006, + 0x00000029,0x00000027,0x00000028,0x0004003d,0x00000006,0x0000002a,0x0000000f,0x0004003d, + 0x00000006,0x0000002b,0x0000000f,0x00050085,0x00000006,0x0000002c,0x0000002a,0x0000002b, + 0x00050081,0x00000006,0x0000002d,0x00000029,0x0000002c,0x00050085,0x00000006,0x0000002f, + 0x0000002d,0x0000002e,0x0004003d,0x00000006,0x00000030,0x00000010,0x0006000c,0x00000006, + 0x00000031,0x00000001,0x00000004,0x00000030,0x0004003d,0x00000006,0x00000032,0x00000011, + 0x00050085,0x00000006,0x00000033,0x00000031,0x00000032,0x0008000c,0x00000006,0x00000036, + 0x00000001,0x0000002b,0x00000033,0x00000034,0x00000035,0x00050081,0x00000006,0x00000037, + 0x0000002f,0x00000036,0x0003003e,0x00000026,0x00000037,0x0004003d,0x00000006,0x0000003a, + 0x00000026,0x0003003e,0x00000039,0x0000003a,0x00050039,0x00000006,0x0000003b,0x0000000a, + 0x00000039,0x0003003e,0x00000038,0x0000003b,0x0004003d,0x00000006,0x0000003c,0x00000038, + 0x0004003d,0x00000006,0x0000003d,0x00000038,0x0004003d,0x00000006,0x0000003e,0x00000010, + 0x00050085,0x00000006,0x0000003f,0x0000003d,0x0000003e,0x00050050,0x0000000c,0x00000040, + 0x0000003c,0x0000003f,0x000200fe,0x00000040,0x00010038 +}; diff --git a/app/src/main/cpp/shaders/sgsr_quality.frag b/app/src/main/cpp/shaders/sgsr_quality.frag index 14e1522557..2cab792e5f 100644 --- a/app/src/main/cpp/shaders/sgsr_quality.frag +++ b/app/src/main/cpp/shaders/sgsr_quality.frag @@ -23,15 +23,25 @@ // - reuses window.vert (full-screen quad over the destination rect) // ============================================================================= -layout(binding = 0) uniform sampler2D ps0; +// DD_HALF is set for the *_half_frag.h build (gen_shaders.sh): colour and +// weight maths in mediump (RelaxedPrecision, 16-bit on Adreno) as in Qualcomm's +// reference; positions and texture coordinates stay highp. +#ifdef DD_HALF +precision mediump float; +#define BL_MP mediump +#else +#define BL_MP +#endif + +layout(binding = 0) uniform BL_MP sampler2D ps0; layout(push_constant) uniform PC { - vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0) - vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels + highp vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0) + highp vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels float EdgeSharpness; // driven by the "Sharpness" slider } pc; -layout(location = 0) in vec2 fragTexCoord; +layout(location = 0) in highp vec2 fragTexCoord; layout(location = 0) out vec4 out_Target0; const float EdgeThreshold = 8.0 / 255.0; @@ -60,20 +70,27 @@ vec2 edgeDirection(vec4 left, vec4 right) { vec2 delta; delta.x = RxLz + RwLy; delta.y = RxLz - RwLy; +#ifdef DD_HALF + // 3.07574e-05 is below the smallest normal 16-bit float (6.1e-05) and is + // flushed to 0 where denormals are not kept: 0 * inf on a flat row. Highp here. + highp vec2 dh = delta; + float lengthInv = inversesqrt((dh.x * dh.x + 3.075740e-05) + (dh.y * dh.y)); +#else float lengthInv = inversesqrt((delta.x * delta.x + 3.075740e-05) + (delta.y * delta.y)); +#endif return delta * lengthInv; } void main() { - vec4 ViewportInfo = pc.ViewportInfo; - vec2 uv = fragTexCoord; + highp vec4 ViewportInfo = pc.ViewportInfo; + highp vec2 uv = fragTexCoord; vec4 color; color.xyz = textureLod(ps0, uv, 0.0).xyz; - vec2 imgCoord = ((uv * ViewportInfo.zw) + vec2(-0.5, 0.5)); - vec2 imgCoordPixel = floor(imgCoord); - vec2 coord = (imgCoordPixel * ViewportInfo.xy); + highp vec2 imgCoord = ((uv * ViewportInfo.zw) + vec2(-0.5, 0.5)); + highp vec2 imgCoordPixel = floor(imgCoord); + highp vec2 coord = (imgCoordPixel * ViewportInfo.xy); vec2 pl = (imgCoord + (-imgCoordPixel)); vec4 left = textureGather(ps0, coord, 1); @@ -96,7 +113,14 @@ void main() { + (((abs(right.x) + abs(right.y)) + abs(right.z)) + abs(right.w))) + (((abs(upDown.x) + abs(upDown.y)) + abs(upDown.z)) + abs(upDown.w))); float sumMean = 1.014185e+01 / sum; +#ifdef DD_HALF + // (10.14 / sum)^2 passes 65504 (16-bit max) once sum < ~0.04, and c * c * inf + // is NaN for c == 0. Capped: c * c * cap still saturates the clamp below for + // any c >= 1/255. + float std = min(sumMean * sumMean, 65504.0); +#else float std = sumMean * sumMean; +#endif vec3 data = vec3(std, edgeDirection(left, right)); diff --git a/app/src/main/cpp/shaders/sgsr_quality_half_frag.h b/app/src/main/cpp/shaders/sgsr_quality_half_frag.h new file mode 100644 index 0000000000..d715a73972 --- /dev/null +++ b/app/src/main/cpp/shaders/sgsr_quality_half_frag.h @@ -0,0 +1,612 @@ + // 1116.2.0 + #pragma once +const uint32_t sgsr_quality_half_code[] = { + 0x07230203,0x00010000,0x0008000b,0x0000026d,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000009e,0x0000026b,0x00030010, + 0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d, + 0x00000000,0x00070005,0x0000000a,0x74736166,0x636e614c,0x32736f7a,0x3b316628,0x00000000, + 0x00030005,0x00000009,0x00000078,0x00080005,0x00000014,0x67696577,0x28597468,0x663b3166, + 0x31663b31,0x3366763b,0x0000003b,0x00030005,0x00000010,0x00007864,0x00030005,0x00000011, + 0x00007964,0x00030005,0x00000012,0x00000063,0x00040005,0x00000013,0x61746164,0x00000000, + 0x00080005,0x0000001b,0x65676465,0x65726944,0x6f697463,0x6676286e,0x66763b34,0x00003b34, + 0x00040005,0x00000019,0x7466656c,0x00000000,0x00040005,0x0000001a,0x68676972,0x00000074, + 0x00030005,0x0000001d,0x00004177,0x00030005,0x00000021,0x00004277,0x00030005,0x0000002f, + 0x00647473,0x00030005,0x00000035,0x00726964,0x00040005,0x00000038,0x65676465,0x00736944, + 0x00030005,0x00000043,0x00000078,0x00030005,0x0000005b,0x00000077,0x00040005,0x0000005c, + 0x61726170,0x0000006d,0x00040005,0x00000066,0x7a4c7852,0x00000000,0x00040005,0x0000006d, + 0x794c7752,0x00000000,0x00040005,0x00000074,0x746c6564,0x00000061,0x00030005,0x0000007d, + 0x00006864,0x00050005,0x0000007f,0x676e656c,0x6e496874,0x00000076,0x00060005,0x00000093, + 0x77656956,0x74726f70,0x6f666e49,0x00000000,0x00030005,0x00000094,0x00004350,0x00040006, + 0x00000094,0x00000000,0x0063646e,0x00070006,0x00000094,0x00000001,0x77656956,0x74726f70, + 0x6f666e49,0x00000000,0x00070006,0x00000094,0x00000002,0x65676445,0x72616853,0x73656e70, + 0x00000073,0x00030005,0x00000096,0x00006370,0x00030005,0x0000009c,0x00007675,0x00060005, + 0x0000009e,0x67617266,0x43786554,0x64726f6f,0x00000000,0x00040005,0x000000a0,0x6f6c6f63, + 0x00000072,0x00030005,0x000000a4,0x00307370,0x00050005,0x000000af,0x43676d69,0x64726f6f, + 0x00000000,0x00060005,0x000000b8,0x43676d69,0x64726f6f,0x65786950,0x0000006c,0x00040005, + 0x000000bb,0x726f6f63,0x00000064,0x00030005,0x000000c0,0x00006c70,0x00040005,0x000000c5, + 0x7466656c,0x00000000,0x00050005,0x000000c9,0x65676465,0x65746f56,0x00000000,0x00040005, + 0x000000ea,0x68676972,0x00000074,0x00040005,0x000000f2,0x6f447075,0x00006e77,0x00040005, + 0x0000010c,0x6e61656d,0x00000000,0x00030005,0x0000012b,0x006d7573,0x00040005,0x0000015b, + 0x4d6d7573,0x006e6165,0x00030005,0x0000015f,0x00647473,0x00040005,0x00000165,0x61746164, + 0x00000000,0x00040005,0x00000167,0x61726170,0x0000006d,0x00040005,0x00000169,0x61726170, + 0x0000006d,0x00030005,0x0000016f,0x00595761,0x00040005,0x00000173,0x61726170,0x0000006d, + 0x00040005,0x00000176,0x61726170,0x0000006d,0x00040005,0x00000177,0x61726170,0x0000006d, + 0x00040005,0x0000017a,0x61726170,0x0000006d,0x00040005,0x00000183,0x61726170,0x0000006d, + 0x00040005,0x00000184,0x61726170,0x0000006d,0x00040005,0x00000185,0x61726170,0x0000006d, + 0x00040005,0x00000188,0x61726170,0x0000006d,0x00040005,0x00000194,0x61726170,0x0000006d, + 0x00040005,0x00000195,0x61726170,0x0000006d,0x00040005,0x00000196,0x61726170,0x0000006d, + 0x00040005,0x00000199,0x61726170,0x0000006d,0x00040005,0x000001a1,0x61726170,0x0000006d, + 0x00040005,0x000001a4,0x61726170,0x0000006d,0x00040005,0x000001a5,0x61726170,0x0000006d, + 0x00040005,0x000001a8,0x61726170,0x0000006d,0x00040005,0x000001b3,0x61726170,0x0000006d, + 0x00040005,0x000001b4,0x61726170,0x0000006d,0x00040005,0x000001b5,0x61726170,0x0000006d, + 0x00040005,0x000001b8,0x61726170,0x0000006d,0x00040005,0x000001c0,0x61726170,0x0000006d, + 0x00040005,0x000001c3,0x61726170,0x0000006d,0x00040005,0x000001c4,0x61726170,0x0000006d, + 0x00040005,0x000001c7,0x61726170,0x0000006d,0x00040005,0x000001cc,0x61726170,0x0000006d, + 0x00040005,0x000001cf,0x61726170,0x0000006d,0x00040005,0x000001d2,0x61726170,0x0000006d, + 0x00040005,0x000001d5,0x61726170,0x0000006d,0x00040005,0x000001dd,0x61726170,0x0000006d, + 0x00040005,0x000001de,0x61726170,0x0000006d,0x00040005,0x000001e1,0x61726170,0x0000006d, + 0x00040005,0x000001e4,0x61726170,0x0000006d,0x00040005,0x000001ef,0x61726170,0x0000006d, + 0x00040005,0x000001f0,0x61726170,0x0000006d,0x00040005,0x000001f1,0x61726170,0x0000006d, + 0x00040005,0x000001f4,0x61726170,0x0000006d,0x00040005,0x000001ff,0x61726170,0x0000006d, + 0x00040005,0x00000200,0x61726170,0x0000006d,0x00040005,0x00000201,0x61726170,0x0000006d, + 0x00040005,0x00000204,0x61726170,0x0000006d,0x00040005,0x0000020c,0x61726170,0x0000006d, + 0x00040005,0x0000020d,0x61726170,0x0000006d,0x00040005,0x00000210,0x61726170,0x0000006d, + 0x00040005,0x00000213,0x61726170,0x0000006d,0x00040005,0x0000021b,0x61726170,0x0000006d, + 0x00040005,0x0000021c,0x61726170,0x0000006d,0x00040005,0x0000021f,0x61726170,0x0000006d, + 0x00040005,0x00000222,0x61726170,0x0000006d,0x00040005,0x00000227,0x616e6966,0x0000596c, + 0x00040005,0x0000022d,0x5978616d,0x00000000,0x00040005,0x00000239,0x596e696d,0x00000000, + 0x00040005,0x0000024e,0x746c6564,0x00005961,0x00050005,0x0000026b,0x5f74756f,0x67726154, + 0x00307465,0x00030047,0x00000009,0x00000000,0x00030047,0x0000000a,0x00000000,0x00030047, + 0x00000010,0x00000000,0x00030047,0x00000011,0x00000000,0x00030047,0x00000012,0x00000000, + 0x00030047,0x00000013,0x00000000,0x00030047,0x00000014,0x00000000,0x00030047,0x00000019, + 0x00000000,0x00030047,0x0000001a,0x00000000,0x00030047,0x0000001b,0x00000000,0x00030047, + 0x0000001d,0x00000000,0x00030047,0x0000001e,0x00000000,0x00030047,0x00000020,0x00000000, + 0x00030047,0x00000021,0x00000000,0x00030047,0x00000022,0x00000000,0x00030047,0x00000023, + 0x00000000,0x00030047,0x00000024,0x00000000,0x00030047,0x00000025,0x00000000,0x00030047, + 0x00000026,0x00000000,0x00030047,0x00000027,0x00000000,0x00030047,0x00000028,0x00000000, + 0x00030047,0x00000029,0x00000000,0x00030047,0x0000002a,0x00000000,0x00030047,0x0000002b, + 0x00000000,0x00030047,0x0000002c,0x00000000,0x00030047,0x0000002f,0x00000000,0x00030047, + 0x00000033,0x00000000,0x00030047,0x00000035,0x00000000,0x00030047,0x00000036,0x00000000, + 0x00030047,0x00000037,0x00000000,0x00030047,0x00000038,0x00000000,0x00030047,0x00000039, + 0x00000000,0x00030047,0x0000003c,0x00000000,0x00030047,0x0000003d,0x00000000,0x00030047, + 0x0000003e,0x00000000,0x00030047,0x00000040,0x00000000,0x00030047,0x00000041,0x00000000, + 0x00030047,0x00000042,0x00000000,0x00030047,0x00000043,0x00000000,0x00030047,0x00000044, + 0x00000000,0x00030047,0x00000045,0x00000000,0x00030047,0x00000046,0x00000000,0x00030047, + 0x00000047,0x00000000,0x00030047,0x00000048,0x00000000,0x00030047,0x00000049,0x00000000, + 0x00030047,0x0000004a,0x00000000,0x00030047,0x0000004b,0x00000000,0x00030047,0x0000004c, + 0x00000000,0x00030047,0x0000004d,0x00000000,0x00030047,0x0000004e,0x00000000,0x00030047, + 0x0000004f,0x00000000,0x00030047,0x00000050,0x00000000,0x00030047,0x00000051,0x00000000, + 0x00030047,0x00000052,0x00000000,0x00030047,0x00000055,0x00000000,0x00030047,0x00000057, + 0x00000000,0x00030047,0x00000058,0x00000000,0x00030047,0x00000059,0x00000000,0x00030047, + 0x0000005a,0x00000000,0x00030047,0x0000005b,0x00000000,0x00030047,0x0000005c,0x00000000, + 0x00030047,0x0000005d,0x00000000,0x00030047,0x0000005e,0x00000000,0x00030047,0x0000005f, + 0x00000000,0x00030047,0x00000060,0x00000000,0x00030047,0x00000061,0x00000000,0x00030047, + 0x00000062,0x00000000,0x00030047,0x00000063,0x00000000,0x00030047,0x00000066,0x00000000, + 0x00030047,0x00000068,0x00000000,0x00030047,0x0000006b,0x00000000,0x00030047,0x0000006c, + 0x00000000,0x00030047,0x0000006d,0x00000000,0x00030047,0x00000070,0x00000000,0x00030047, + 0x00000072,0x00000000,0x00030047,0x00000073,0x00000000,0x00030047,0x00000074,0x00000000, + 0x00030047,0x00000075,0x00000000,0x00030047,0x00000076,0x00000000,0x00030047,0x00000077, + 0x00000000,0x00030047,0x00000079,0x00000000,0x00030047,0x0000007a,0x00000000,0x00030047, + 0x0000007b,0x00000000,0x00030047,0x0000007e,0x00000000,0x00030047,0x0000007f,0x00000000, + 0x00030047,0x0000008e,0x00000000,0x00030047,0x0000008f,0x00000000,0x00030047,0x00000090, + 0x00000000,0x00030047,0x00000094,0x00000002,0x00050048,0x00000094,0x00000000,0x00000023, + 0x00000000,0x00050048,0x00000094,0x00000001,0x00000023,0x00000010,0x00040048,0x00000094, + 0x00000002,0x00000000,0x00050048,0x00000094,0x00000002,0x00000023,0x00000020,0x00040047, + 0x0000009e,0x0000001e,0x00000000,0x00030047,0x000000a0,0x00000000,0x00030047,0x000000a4, + 0x00000000,0x00040047,0x000000a4,0x00000021,0x00000000,0x00040047,0x000000a4,0x00000022, + 0x00000000,0x00030047,0x000000a5,0x00000000,0x00030047,0x000000a7,0x00000000,0x00030047, + 0x000000a8,0x00000000,0x00030047,0x000000c0,0x00000000,0x00030047,0x000000c5,0x00000000, + 0x00030047,0x000000c6,0x00000000,0x00030047,0x000000c8,0x00000000,0x00030047,0x000000c9, + 0x00000000,0x00030047,0x000000cb,0x00000000,0x00030047,0x000000cd,0x00000000,0x00030047, + 0x000000ce,0x00000000,0x00030047,0x000000cf,0x00000000,0x00030047,0x000000d1,0x00000000, + 0x00030047,0x000000d3,0x00000000,0x00030047,0x000000d4,0x00000000,0x00030047,0x000000d5, + 0x00000000,0x00030047,0x000000d6,0x00000000,0x00030047,0x000000d8,0x00000000,0x00030047, + 0x000000da,0x00000000,0x00030047,0x000000db,0x00000000,0x00030047,0x000000dc,0x00000000, + 0x00030047,0x000000dd,0x00000000,0x00030047,0x000000de,0x00000000,0x00030047,0x000000df, + 0x00000000,0x00030047,0x000000ea,0x00000000,0x00030047,0x000000eb,0x00000000,0x00030047, + 0x000000f1,0x00000000,0x00030047,0x000000f2,0x00000000,0x00030047,0x000000f3,0x00000000, + 0x00030047,0x000000fa,0x00000000,0x00030047,0x000000fb,0x00000000,0x00030047,0x00000100, + 0x00000000,0x00030047,0x00000106,0x00000000,0x00030047,0x00000107,0x00000000,0x00030047, + 0x0000010c,0x00000000,0x00030047,0x0000010e,0x00000000,0x00030047,0x00000110,0x00000000, + 0x00030047,0x00000111,0x00000000,0x00030047,0x00000113,0x00000000,0x00030047,0x00000114, + 0x00000000,0x00030047,0x00000116,0x00000000,0x00030047,0x00000117,0x00000000,0x00030047, + 0x00000119,0x00000000,0x00030047,0x0000011a,0x00000000,0x00030047,0x0000011b,0x00000000, + 0x00030047,0x0000011c,0x00000000,0x00030047,0x0000011d,0x00000000,0x00030047,0x0000011e, + 0x00000000,0x00030047,0x0000011f,0x00000000,0x00030047,0x00000120,0x00000000,0x00030047, + 0x00000121,0x00000000,0x00030047,0x00000122,0x00000000,0x00030047,0x00000123,0x00000000, + 0x00030047,0x00000124,0x00000000,0x00030047,0x00000125,0x00000000,0x00030047,0x00000127, + 0x00000000,0x00030047,0x00000128,0x00000000,0x00030047,0x00000129,0x00000000,0x00030047, + 0x0000012b,0x00000000,0x00030047,0x0000012d,0x00000000,0x00030047,0x0000012e,0x00000000, + 0x00030047,0x00000130,0x00000000,0x00030047,0x00000131,0x00000000,0x00030047,0x00000132, + 0x00000000,0x00030047,0x00000134,0x00000000,0x00030047,0x00000135,0x00000000,0x00030047, + 0x00000136,0x00000000,0x00030047,0x00000138,0x00000000,0x00030047,0x00000139,0x00000000, + 0x00030047,0x0000013a,0x00000000,0x00030047,0x0000013c,0x00000000,0x00030047,0x0000013d, + 0x00000000,0x00030047,0x0000013f,0x00000000,0x00030047,0x00000140,0x00000000,0x00030047, + 0x00000141,0x00000000,0x00030047,0x00000143,0x00000000,0x00030047,0x00000144,0x00000000, + 0x00030047,0x00000145,0x00000000,0x00030047,0x00000147,0x00000000,0x00030047,0x00000148, + 0x00000000,0x00030047,0x00000149,0x00000000,0x00030047,0x0000014a,0x00000000,0x00030047, + 0x0000014c,0x00000000,0x00030047,0x0000014d,0x00000000,0x00030047,0x0000014f,0x00000000, + 0x00030047,0x00000150,0x00000000,0x00030047,0x00000151,0x00000000,0x00030047,0x00000153, + 0x00000000,0x00030047,0x00000154,0x00000000,0x00030047,0x00000155,0x00000000,0x00030047, + 0x00000157,0x00000000,0x00030047,0x00000158,0x00000000,0x00030047,0x00000159,0x00000000, + 0x00030047,0x0000015a,0x00000000,0x00030047,0x0000015b,0x00000000,0x00030047,0x0000015d, + 0x00000000,0x00030047,0x0000015e,0x00000000,0x00030047,0x0000015f,0x00000000,0x00030047, + 0x00000160,0x00000000,0x00030047,0x00000161,0x00000000,0x00030047,0x00000162,0x00000000, + 0x00030047,0x00000164,0x00000000,0x00030047,0x00000165,0x00000000,0x00030047,0x00000166, + 0x00000000,0x00030047,0x00000167,0x00000000,0x00030047,0x00000168,0x00000000,0x00030047, + 0x00000169,0x00000000,0x00030047,0x0000016a,0x00000000,0x00030047,0x0000016b,0x00000000, + 0x00030047,0x0000016c,0x00000000,0x00030047,0x0000016d,0x00000000,0x00030047,0x0000016e, + 0x00000000,0x00030047,0x0000016f,0x00000000,0x00030047,0x00000171,0x00000000,0x00030047, + 0x00000172,0x00000000,0x00030047,0x00000173,0x00000000,0x00030047,0x00000175,0x00000000, + 0x00030047,0x00000176,0x00000000,0x00030047,0x00000177,0x00000000,0x00030047,0x00000179, + 0x00000000,0x00030047,0x0000017a,0x00000000,0x00030047,0x0000017b,0x00000000,0x00030047, + 0x0000017c,0x00000000,0x00030047,0x0000017e,0x00000000,0x00030047,0x0000017f,0x00000000, + 0x00030047,0x00000181,0x00000000,0x00030047,0x00000182,0x00000000,0x00030047,0x00000183, + 0x00000000,0x00030047,0x00000184,0x00000000,0x00030047,0x00000185,0x00000000,0x00030047, + 0x00000187,0x00000000,0x00030047,0x00000188,0x00000000,0x00030047,0x00000189,0x00000000, + 0x00030047,0x0000018a,0x00000000,0x00030047,0x0000018b,0x00000000,0x00030047,0x0000018c, + 0x00000000,0x00030047,0x0000018e,0x00000000,0x00030047,0x0000018f,0x00000000,0x00030047, + 0x00000191,0x00000000,0x00030047,0x00000193,0x00000000,0x00030047,0x00000194,0x00000000, + 0x00030047,0x00000195,0x00000000,0x00030047,0x00000196,0x00000000,0x00030047,0x00000198, + 0x00000000,0x00030047,0x00000199,0x00000000,0x00030047,0x0000019a,0x00000000,0x00030047, + 0x0000019b,0x00000000,0x00030047,0x0000019c,0x00000000,0x00030047,0x0000019d,0x00000000, + 0x00030047,0x0000019f,0x00000000,0x00030047,0x000001a0,0x00000000,0x00030047,0x000001a1, + 0x00000000,0x00030047,0x000001a3,0x00000000,0x00030047,0x000001a4,0x00000000,0x00030047, + 0x000001a5,0x00000000,0x00030047,0x000001a7,0x00000000,0x00030047,0x000001a8,0x00000000, + 0x00030047,0x000001a9,0x00000000,0x00030047,0x000001aa,0x00000000,0x00030047,0x000001ab, + 0x00000000,0x00030047,0x000001ac,0x00000000,0x00030047,0x000001ae,0x00000000,0x00030047, + 0x000001af,0x00000000,0x00030047,0x000001b1,0x00000000,0x00030047,0x000001b2,0x00000000, + 0x00030047,0x000001b3,0x00000000,0x00030047,0x000001b4,0x00000000,0x00030047,0x000001b5, + 0x00000000,0x00030047,0x000001b7,0x00000000,0x00030047,0x000001b8,0x00000000,0x00030047, + 0x000001b9,0x00000000,0x00030047,0x000001ba,0x00000000,0x00030047,0x000001bb,0x00000000, + 0x00030047,0x000001bc,0x00000000,0x00030047,0x000001be,0x00000000,0x00030047,0x000001bf, + 0x00000000,0x00030047,0x000001c0,0x00000000,0x00030047,0x000001c2,0x00000000,0x00030047, + 0x000001c3,0x00000000,0x00030047,0x000001c4,0x00000000,0x00030047,0x000001c6,0x00000000, + 0x00030047,0x000001c7,0x00000000,0x00030047,0x000001c8,0x00000000,0x00030047,0x000001c9, + 0x00000000,0x00030047,0x000001ca,0x00000000,0x00030047,0x000001cb,0x00000000,0x00030047, + 0x000001cc,0x00000000,0x00030047,0x000001ce,0x00000000,0x00030047,0x000001cf,0x00000000, + 0x00030047,0x000001d1,0x00000000,0x00030047,0x000001d2,0x00000000,0x00030047,0x000001d4, + 0x00000000,0x00030047,0x000001d5,0x00000000,0x00030047,0x000001d6,0x00000000,0x00030047, + 0x000001d7,0x00000000,0x00030047,0x000001d8,0x00000000,0x00030047,0x000001d9,0x00000000, + 0x00030047,0x000001db,0x00000000,0x00030047,0x000001dc,0x00000000,0x00030047,0x000001dd, + 0x00000000,0x00030047,0x000001de,0x00000000,0x00030047,0x000001e0,0x00000000,0x00030047, + 0x000001e1,0x00000000,0x00030047,0x000001e3,0x00000000,0x00030047,0x000001e4,0x00000000, + 0x00030047,0x000001e5,0x00000000,0x00030047,0x000001e6,0x00000000,0x00030047,0x000001e7, + 0x00000000,0x00030047,0x000001e8,0x00000000,0x00030047,0x000001ea,0x00000000,0x00030047, + 0x000001eb,0x00000000,0x00030047,0x000001ed,0x00000000,0x00030047,0x000001ee,0x00000000, + 0x00030047,0x000001ef,0x00000000,0x00030047,0x000001f0,0x00000000,0x00030047,0x000001f1, + 0x00000000,0x00030047,0x000001f3,0x00000000,0x00030047,0x000001f4,0x00000000,0x00030047, + 0x000001f5,0x00000000,0x00030047,0x000001f6,0x00000000,0x00030047,0x000001f7,0x00000000, + 0x00030047,0x000001f8,0x00000000,0x00030047,0x000001fa,0x00000000,0x00030047,0x000001fb, + 0x00000000,0x00030047,0x000001fd,0x00000000,0x00030047,0x000001fe,0x00000000,0x00030047, + 0x000001ff,0x00000000,0x00030047,0x00000200,0x00000000,0x00030047,0x00000201,0x00000000, + 0x00030047,0x00000203,0x00000000,0x00030047,0x00000204,0x00000000,0x00030047,0x00000205, + 0x00000000,0x00030047,0x00000206,0x00000000,0x00030047,0x00000207,0x00000000,0x00030047, + 0x00000208,0x00000000,0x00030047,0x0000020a,0x00000000,0x00030047,0x0000020b,0x00000000, + 0x00030047,0x0000020c,0x00000000,0x00030047,0x0000020d,0x00000000,0x00030047,0x0000020f, + 0x00000000,0x00030047,0x00000210,0x00000000,0x00030047,0x00000212,0x00000000,0x00030047, + 0x00000213,0x00000000,0x00030047,0x00000214,0x00000000,0x00030047,0x00000215,0x00000000, + 0x00030047,0x00000216,0x00000000,0x00030047,0x00000217,0x00000000,0x00030047,0x00000219, + 0x00000000,0x00030047,0x0000021a,0x00000000,0x00030047,0x0000021b,0x00000000,0x00030047, + 0x0000021c,0x00000000,0x00030047,0x0000021e,0x00000000,0x00030047,0x0000021f,0x00000000, + 0x00030047,0x00000221,0x00000000,0x00030047,0x00000222,0x00000000,0x00030047,0x00000223, + 0x00000000,0x00030047,0x00000224,0x00000000,0x00030047,0x00000225,0x00000000,0x00030047, + 0x00000226,0x00000000,0x00030047,0x00000227,0x00000000,0x00030047,0x00000229,0x00000000, + 0x00030047,0x0000022b,0x00000000,0x00030047,0x0000022c,0x00000000,0x00030047,0x0000022d, + 0x00000000,0x00030047,0x0000022f,0x00000000,0x00030047,0x00000231,0x00000000,0x00030047, + 0x00000232,0x00000000,0x00030047,0x00000234,0x00000000,0x00030047,0x00000236,0x00000000, + 0x00030047,0x00000237,0x00000000,0x00030047,0x00000238,0x00000000,0x00030047,0x00000239, + 0x00000000,0x00030047,0x0000023b,0x00000000,0x00030047,0x0000023d,0x00000000,0x00030047, + 0x0000023e,0x00000000,0x00030047,0x00000240,0x00000000,0x00030047,0x00000242,0x00000000, + 0x00030047,0x00000243,0x00000000,0x00030047,0x00000244,0x00000000,0x00030047,0x00000248, + 0x00000000,0x00030047,0x00000249,0x00000000,0x00030047,0x0000024a,0x00000000,0x00030047, + 0x0000024b,0x00000000,0x00030047,0x0000024c,0x00000000,0x00030047,0x0000024d,0x00000000, + 0x00030047,0x0000024e,0x00000000,0x00030047,0x0000024f,0x00000000,0x00030047,0x00000251, + 0x00000000,0x00030047,0x00000252,0x00000000,0x00030047,0x00000253,0x00000000,0x00030047, + 0x00000256,0x00000000,0x00030047,0x00000258,0x00000000,0x00030047,0x00000259,0x00000000, + 0x00030047,0x0000025a,0x00000000,0x00030047,0x0000025b,0x00000000,0x00030047,0x0000025e, + 0x00000000,0x00030047,0x0000025f,0x00000000,0x00030047,0x00000260,0x00000000,0x00030047, + 0x00000261,0x00000000,0x00030047,0x00000264,0x00000000,0x00030047,0x00000265,0x00000000, + 0x00030047,0x00000266,0x00000000,0x00030047,0x00000267,0x00000000,0x00030047,0x0000026b, + 0x00000000,0x00040047,0x0000026b,0x0000001e,0x00000000,0x00030047,0x0000026c,0x00000000, + 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020, + 0x00040020,0x00000007,0x00000007,0x00000006,0x00040021,0x00000008,0x00000006,0x00000007, + 0x00040017,0x0000000c,0x00000006,0x00000003,0x00040020,0x0000000d,0x00000007,0x0000000c, + 0x00040017,0x0000000e,0x00000006,0x00000002,0x00070021,0x0000000f,0x0000000e,0x00000007, + 0x00000007,0x00000007,0x0000000d,0x00040017,0x00000016,0x00000006,0x00000004,0x00040020, + 0x00000017,0x00000007,0x00000016,0x00050021,0x00000018,0x0000000e,0x00000017,0x00000017, + 0x0004002b,0x00000006,0x0000001f,0x40800000,0x00040015,0x00000030,0x00000020,0x00000000, + 0x0004002b,0x00000030,0x00000031,0x00000000,0x00040020,0x00000034,0x00000007,0x0000000e, + 0x0004002b,0x00000030,0x0000003a,0x00000001,0x0004002b,0x00000006,0x00000053,0x00000000, + 0x0004002b,0x00000006,0x00000054,0x3f800000,0x0004002b,0x00000006,0x00000056,0x3f333333, + 0x0004002b,0x00000030,0x00000069,0x00000002,0x0004002b,0x00000030,0x0000006e,0x00000003, + 0x0004002b,0x00000006,0x00000085,0x38010182,0x0005001e,0x00000094,0x00000016,0x00000016, + 0x00000006,0x00040020,0x00000095,0x00000009,0x00000094,0x0004003b,0x00000095,0x00000096, + 0x00000009,0x00040015,0x00000097,0x00000020,0x00000001,0x0004002b,0x00000097,0x00000098, + 0x00000001,0x00040020,0x00000099,0x00000009,0x00000016,0x00040020,0x0000009d,0x00000001, + 0x0000000e,0x0004003b,0x0000009d,0x0000009e,0x00000001,0x00090019,0x000000a1,0x00000006, + 0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x000000a2, + 0x000000a1,0x00040020,0x000000a3,0x00000000,0x000000a2,0x0004003b,0x000000a3,0x000000a4, + 0x00000000,0x0004002b,0x00000006,0x000000b4,0xbf000000,0x0004002b,0x00000006,0x000000b5, + 0x3f000000,0x0005002c,0x0000000e,0x000000b6,0x000000b4,0x000000b5,0x0004002b,0x00000006, + 0x000000df,0x3d008081,0x00020014,0x000000e0,0x0004002b,0x00000006,0x00000118,0x3e800000, + 0x0004002b,0x00000006,0x0000015c,0x41224505,0x0004002b,0x00000006,0x00000163,0x477fe000, + 0x0004002b,0x00000006,0x00000192,0x40000000,0x0004002b,0x00000097,0x00000245,0x00000002, + 0x00040020,0x00000246,0x00000009,0x00000006,0x0004002b,0x00000006,0x00000254,0xbdb8b8b9, + 0x0004002b,0x00000006,0x00000255,0x3db8b8b9,0x00040020,0x0000026a,0x00000003,0x00000016, + 0x0004003b,0x0000026a,0x0000026b,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000, + 0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000017,0x00000093,0x00000007,0x0004003b, + 0x00000034,0x0000009c,0x00000007,0x0004003b,0x00000017,0x000000a0,0x00000007,0x0004003b, + 0x00000034,0x000000af,0x00000007,0x0004003b,0x00000034,0x000000b8,0x00000007,0x0004003b, + 0x00000034,0x000000bb,0x00000007,0x0004003b,0x00000034,0x000000c0,0x00000007,0x0004003b, + 0x00000017,0x000000c5,0x00000007,0x0004003b,0x00000007,0x000000c9,0x00000007,0x0004003b, + 0x00000017,0x000000ea,0x00000007,0x0004003b,0x00000017,0x000000f2,0x00000007,0x0004003b, + 0x00000007,0x0000010c,0x00000007,0x0004003b,0x00000007,0x0000012b,0x00000007,0x0004003b, + 0x00000007,0x0000015b,0x00000007,0x0004003b,0x00000007,0x0000015f,0x00000007,0x0004003b, + 0x0000000d,0x00000165,0x00000007,0x0004003b,0x00000017,0x00000167,0x00000007,0x0004003b, + 0x00000017,0x00000169,0x00000007,0x0004003b,0x00000034,0x0000016f,0x00000007,0x0004003b, + 0x00000007,0x00000173,0x00000007,0x0004003b,0x00000007,0x00000176,0x00000007,0x0004003b, + 0x00000007,0x00000177,0x00000007,0x0004003b,0x0000000d,0x0000017a,0x00000007,0x0004003b, + 0x00000007,0x00000183,0x00000007,0x0004003b,0x00000007,0x00000184,0x00000007,0x0004003b, + 0x00000007,0x00000185,0x00000007,0x0004003b,0x0000000d,0x00000188,0x00000007,0x0004003b, + 0x00000007,0x00000194,0x00000007,0x0004003b,0x00000007,0x00000195,0x00000007,0x0004003b, + 0x00000007,0x00000196,0x00000007,0x0004003b,0x0000000d,0x00000199,0x00000007,0x0004003b, + 0x00000007,0x000001a1,0x00000007,0x0004003b,0x00000007,0x000001a4,0x00000007,0x0004003b, + 0x00000007,0x000001a5,0x00000007,0x0004003b,0x0000000d,0x000001a8,0x00000007,0x0004003b, + 0x00000007,0x000001b3,0x00000007,0x0004003b,0x00000007,0x000001b4,0x00000007,0x0004003b, + 0x00000007,0x000001b5,0x00000007,0x0004003b,0x0000000d,0x000001b8,0x00000007,0x0004003b, + 0x00000007,0x000001c0,0x00000007,0x0004003b,0x00000007,0x000001c3,0x00000007,0x0004003b, + 0x00000007,0x000001c4,0x00000007,0x0004003b,0x0000000d,0x000001c7,0x00000007,0x0004003b, + 0x00000007,0x000001cc,0x00000007,0x0004003b,0x00000007,0x000001cf,0x00000007,0x0004003b, + 0x00000007,0x000001d2,0x00000007,0x0004003b,0x0000000d,0x000001d5,0x00000007,0x0004003b, + 0x00000007,0x000001dd,0x00000007,0x0004003b,0x00000007,0x000001de,0x00000007,0x0004003b, + 0x00000007,0x000001e1,0x00000007,0x0004003b,0x0000000d,0x000001e4,0x00000007,0x0004003b, + 0x00000007,0x000001ef,0x00000007,0x0004003b,0x00000007,0x000001f0,0x00000007,0x0004003b, + 0x00000007,0x000001f1,0x00000007,0x0004003b,0x0000000d,0x000001f4,0x00000007,0x0004003b, + 0x00000007,0x000001ff,0x00000007,0x0004003b,0x00000007,0x00000200,0x00000007,0x0004003b, + 0x00000007,0x00000201,0x00000007,0x0004003b,0x0000000d,0x00000204,0x00000007,0x0004003b, + 0x00000007,0x0000020c,0x00000007,0x0004003b,0x00000007,0x0000020d,0x00000007,0x0004003b, + 0x00000007,0x00000210,0x00000007,0x0004003b,0x0000000d,0x00000213,0x00000007,0x0004003b, + 0x00000007,0x0000021b,0x00000007,0x0004003b,0x00000007,0x0000021c,0x00000007,0x0004003b, + 0x00000007,0x0000021f,0x00000007,0x0004003b,0x0000000d,0x00000222,0x00000007,0x0004003b, + 0x00000007,0x00000227,0x00000007,0x0004003b,0x00000007,0x0000022d,0x00000007,0x0004003b, + 0x00000007,0x00000239,0x00000007,0x0004003b,0x00000007,0x0000024e,0x00000007,0x00050041, + 0x00000099,0x0000009a,0x00000096,0x00000098,0x0004003d,0x00000016,0x0000009b,0x0000009a, + 0x0003003e,0x00000093,0x0000009b,0x0004003d,0x0000000e,0x0000009f,0x0000009e,0x0003003e, + 0x0000009c,0x0000009f,0x0004003d,0x000000a2,0x000000a5,0x000000a4,0x0004003d,0x0000000e, + 0x000000a6,0x0000009c,0x00070058,0x00000016,0x000000a7,0x000000a5,0x000000a6,0x00000002, + 0x00000053,0x0008004f,0x0000000c,0x000000a8,0x000000a7,0x000000a7,0x00000000,0x00000001, + 0x00000002,0x00050041,0x00000007,0x000000a9,0x000000a0,0x00000031,0x00050051,0x00000006, + 0x000000aa,0x000000a8,0x00000000,0x0003003e,0x000000a9,0x000000aa,0x00050041,0x00000007, + 0x000000ab,0x000000a0,0x0000003a,0x00050051,0x00000006,0x000000ac,0x000000a8,0x00000001, + 0x0003003e,0x000000ab,0x000000ac,0x00050041,0x00000007,0x000000ad,0x000000a0,0x00000069, + 0x00050051,0x00000006,0x000000ae,0x000000a8,0x00000002,0x0003003e,0x000000ad,0x000000ae, + 0x0004003d,0x0000000e,0x000000b0,0x0000009c,0x0004003d,0x00000016,0x000000b1,0x00000093, + 0x0007004f,0x0000000e,0x000000b2,0x000000b1,0x000000b1,0x00000002,0x00000003,0x00050085, + 0x0000000e,0x000000b3,0x000000b0,0x000000b2,0x00050081,0x0000000e,0x000000b7,0x000000b3, + 0x000000b6,0x0003003e,0x000000af,0x000000b7,0x0004003d,0x0000000e,0x000000b9,0x000000af, + 0x0006000c,0x0000000e,0x000000ba,0x00000001,0x00000008,0x000000b9,0x0003003e,0x000000b8, + 0x000000ba,0x0004003d,0x0000000e,0x000000bc,0x000000b8,0x0004003d,0x00000016,0x000000bd, + 0x00000093,0x0007004f,0x0000000e,0x000000be,0x000000bd,0x000000bd,0x00000000,0x00000001, + 0x00050085,0x0000000e,0x000000bf,0x000000bc,0x000000be,0x0003003e,0x000000bb,0x000000bf, + 0x0004003d,0x0000000e,0x000000c1,0x000000af,0x0004003d,0x0000000e,0x000000c2,0x000000b8, + 0x0004007f,0x0000000e,0x000000c3,0x000000c2,0x00050081,0x0000000e,0x000000c4,0x000000c1, + 0x000000c3,0x0003003e,0x000000c0,0x000000c4,0x0004003d,0x000000a2,0x000000c6,0x000000a4, + 0x0004003d,0x0000000e,0x000000c7,0x000000bb,0x00060060,0x00000016,0x000000c8,0x000000c6, + 0x000000c7,0x00000098,0x0003003e,0x000000c5,0x000000c8,0x00050041,0x00000007,0x000000ca, + 0x000000c5,0x00000069,0x0004003d,0x00000006,0x000000cb,0x000000ca,0x00050041,0x00000007, + 0x000000cc,0x000000c5,0x0000003a,0x0004003d,0x00000006,0x000000cd,0x000000cc,0x00050083, + 0x00000006,0x000000ce,0x000000cb,0x000000cd,0x0006000c,0x00000006,0x000000cf,0x00000001, + 0x00000004,0x000000ce,0x00050041,0x00000007,0x000000d0,0x000000a0,0x0000003a,0x0004003d, + 0x00000006,0x000000d1,0x000000d0,0x00050041,0x00000007,0x000000d2,0x000000c5,0x0000003a, + 0x0004003d,0x00000006,0x000000d3,0x000000d2,0x00050083,0x00000006,0x000000d4,0x000000d1, + 0x000000d3,0x0006000c,0x00000006,0x000000d5,0x00000001,0x00000004,0x000000d4,0x00050081, + 0x00000006,0x000000d6,0x000000cf,0x000000d5,0x00050041,0x00000007,0x000000d7,0x000000a0, + 0x0000003a,0x0004003d,0x00000006,0x000000d8,0x000000d7,0x00050041,0x00000007,0x000000d9, + 0x000000c5,0x00000069,0x0004003d,0x00000006,0x000000da,0x000000d9,0x00050083,0x00000006, + 0x000000db,0x000000d8,0x000000da,0x0006000c,0x00000006,0x000000dc,0x00000001,0x00000004, + 0x000000db,0x00050081,0x00000006,0x000000dd,0x000000d6,0x000000dc,0x0003003e,0x000000c9, + 0x000000dd,0x0004003d,0x00000006,0x000000de,0x000000c9,0x000500ba,0x000000e0,0x000000e1, + 0x000000de,0x000000df,0x000300f7,0x000000e3,0x00000000,0x000400fa,0x000000e1,0x000000e2, + 0x000000e3,0x000200f8,0x000000e2,0x00050041,0x00000007,0x000000e4,0x00000093,0x00000031, + 0x0004003d,0x00000006,0x000000e5,0x000000e4,0x00050041,0x00000007,0x000000e6,0x000000bb, + 0x00000031,0x0004003d,0x00000006,0x000000e7,0x000000e6,0x00050081,0x00000006,0x000000e8, + 0x000000e7,0x000000e5,0x00050041,0x00000007,0x000000e9,0x000000bb,0x00000031,0x0003003e, + 0x000000e9,0x000000e8,0x0004003d,0x000000a2,0x000000eb,0x000000a4,0x0004003d,0x0000000e, + 0x000000ec,0x000000bb,0x00050041,0x00000007,0x000000ed,0x00000093,0x00000031,0x0004003d, + 0x00000006,0x000000ee,0x000000ed,0x00050050,0x0000000e,0x000000ef,0x000000ee,0x00000053, + 0x00050081,0x0000000e,0x000000f0,0x000000ec,0x000000ef,0x00060060,0x00000016,0x000000f1, + 0x000000eb,0x000000f0,0x00000098,0x0003003e,0x000000ea,0x000000f1,0x0004003d,0x000000a2, + 0x000000f3,0x000000a4,0x0004003d,0x0000000e,0x000000f4,0x000000bb,0x00050041,0x00000007, + 0x000000f5,0x00000093,0x0000003a,0x0004003d,0x00000006,0x000000f6,0x000000f5,0x0004007f, + 0x00000006,0x000000f7,0x000000f6,0x00050050,0x0000000e,0x000000f8,0x00000053,0x000000f7, + 0x00050081,0x0000000e,0x000000f9,0x000000f4,0x000000f8,0x00060060,0x00000016,0x000000fa, + 0x000000f3,0x000000f9,0x00000098,0x0007004f,0x0000000e,0x000000fb,0x000000fa,0x000000fa, + 0x00000003,0x00000002,0x00050041,0x00000007,0x000000fc,0x000000f2,0x00000031,0x00050051, + 0x00000006,0x000000fd,0x000000fb,0x00000000,0x0003003e,0x000000fc,0x000000fd,0x00050041, + 0x00000007,0x000000fe,0x000000f2,0x0000003a,0x00050051,0x00000006,0x000000ff,0x000000fb, + 0x00000001,0x0003003e,0x000000fe,0x000000ff,0x0004003d,0x000000a2,0x00000100,0x000000a4, + 0x0004003d,0x0000000e,0x00000101,0x000000bb,0x00050041,0x00000007,0x00000102,0x00000093, + 0x0000003a,0x0004003d,0x00000006,0x00000103,0x00000102,0x00050050,0x0000000e,0x00000104, + 0x00000053,0x00000103,0x00050081,0x0000000e,0x00000105,0x00000101,0x00000104,0x00060060, + 0x00000016,0x00000106,0x00000100,0x00000105,0x00000098,0x0007004f,0x0000000e,0x00000107, + 0x00000106,0x00000106,0x00000001,0x00000000,0x00050041,0x00000007,0x00000108,0x000000f2, + 0x00000069,0x00050051,0x00000006,0x00000109,0x00000107,0x00000000,0x0003003e,0x00000108, + 0x00000109,0x00050041,0x00000007,0x0000010a,0x000000f2,0x0000006e,0x00050051,0x00000006, + 0x0000010b,0x00000107,0x00000001,0x0003003e,0x0000010a,0x0000010b,0x00050041,0x00000007, + 0x0000010d,0x000000c5,0x0000003a,0x0004003d,0x00000006,0x0000010e,0x0000010d,0x00050041, + 0x00000007,0x0000010f,0x000000c5,0x00000069,0x0004003d,0x00000006,0x00000110,0x0000010f, + 0x00050081,0x00000006,0x00000111,0x0000010e,0x00000110,0x00050041,0x00000007,0x00000112, + 0x000000ea,0x00000031,0x0004003d,0x00000006,0x00000113,0x00000112,0x00050081,0x00000006, + 0x00000114,0x00000111,0x00000113,0x00050041,0x00000007,0x00000115,0x000000ea,0x0000006e, + 0x0004003d,0x00000006,0x00000116,0x00000115,0x00050081,0x00000006,0x00000117,0x00000114, + 0x00000116,0x00050085,0x00000006,0x00000119,0x00000117,0x00000118,0x0003003e,0x0000010c, + 0x00000119,0x0004003d,0x00000016,0x0000011a,0x000000c5,0x0004003d,0x00000006,0x0000011b, + 0x0000010c,0x00070050,0x00000016,0x0000011c,0x0000011b,0x0000011b,0x0000011b,0x0000011b, + 0x00050083,0x00000016,0x0000011d,0x0000011a,0x0000011c,0x0003003e,0x000000c5,0x0000011d, + 0x0004003d,0x00000016,0x0000011e,0x000000ea,0x0004003d,0x00000006,0x0000011f,0x0000010c, + 0x00070050,0x00000016,0x00000120,0x0000011f,0x0000011f,0x0000011f,0x0000011f,0x00050083, + 0x00000016,0x00000121,0x0000011e,0x00000120,0x0003003e,0x000000ea,0x00000121,0x0004003d, + 0x00000016,0x00000122,0x000000f2,0x0004003d,0x00000006,0x00000123,0x0000010c,0x00070050, + 0x00000016,0x00000124,0x00000123,0x00000123,0x00000123,0x00000123,0x00050083,0x00000016, + 0x00000125,0x00000122,0x00000124,0x0003003e,0x000000f2,0x00000125,0x00050041,0x00000007, + 0x00000126,0x000000a0,0x0000003a,0x0004003d,0x00000006,0x00000127,0x00000126,0x0004003d, + 0x00000006,0x00000128,0x0000010c,0x00050083,0x00000006,0x00000129,0x00000127,0x00000128, + 0x00050041,0x00000007,0x0000012a,0x000000a0,0x0000006e,0x0003003e,0x0000012a,0x00000129, + 0x00050041,0x00000007,0x0000012c,0x000000c5,0x00000031,0x0004003d,0x00000006,0x0000012d, + 0x0000012c,0x0006000c,0x00000006,0x0000012e,0x00000001,0x00000004,0x0000012d,0x00050041, + 0x00000007,0x0000012f,0x000000c5,0x0000003a,0x0004003d,0x00000006,0x00000130,0x0000012f, + 0x0006000c,0x00000006,0x00000131,0x00000001,0x00000004,0x00000130,0x00050081,0x00000006, + 0x00000132,0x0000012e,0x00000131,0x00050041,0x00000007,0x00000133,0x000000c5,0x00000069, + 0x0004003d,0x00000006,0x00000134,0x00000133,0x0006000c,0x00000006,0x00000135,0x00000001, + 0x00000004,0x00000134,0x00050081,0x00000006,0x00000136,0x00000132,0x00000135,0x00050041, + 0x00000007,0x00000137,0x000000c5,0x0000006e,0x0004003d,0x00000006,0x00000138,0x00000137, + 0x0006000c,0x00000006,0x00000139,0x00000001,0x00000004,0x00000138,0x00050081,0x00000006, + 0x0000013a,0x00000136,0x00000139,0x00050041,0x00000007,0x0000013b,0x000000ea,0x00000031, + 0x0004003d,0x00000006,0x0000013c,0x0000013b,0x0006000c,0x00000006,0x0000013d,0x00000001, + 0x00000004,0x0000013c,0x00050041,0x00000007,0x0000013e,0x000000ea,0x0000003a,0x0004003d, + 0x00000006,0x0000013f,0x0000013e,0x0006000c,0x00000006,0x00000140,0x00000001,0x00000004, + 0x0000013f,0x00050081,0x00000006,0x00000141,0x0000013d,0x00000140,0x00050041,0x00000007, + 0x00000142,0x000000ea,0x00000069,0x0004003d,0x00000006,0x00000143,0x00000142,0x0006000c, + 0x00000006,0x00000144,0x00000001,0x00000004,0x00000143,0x00050081,0x00000006,0x00000145, + 0x00000141,0x00000144,0x00050041,0x00000007,0x00000146,0x000000ea,0x0000006e,0x0004003d, + 0x00000006,0x00000147,0x00000146,0x0006000c,0x00000006,0x00000148,0x00000001,0x00000004, + 0x00000147,0x00050081,0x00000006,0x00000149,0x00000145,0x00000148,0x00050081,0x00000006, + 0x0000014a,0x0000013a,0x00000149,0x00050041,0x00000007,0x0000014b,0x000000f2,0x00000031, + 0x0004003d,0x00000006,0x0000014c,0x0000014b,0x0006000c,0x00000006,0x0000014d,0x00000001, + 0x00000004,0x0000014c,0x00050041,0x00000007,0x0000014e,0x000000f2,0x0000003a,0x0004003d, + 0x00000006,0x0000014f,0x0000014e,0x0006000c,0x00000006,0x00000150,0x00000001,0x00000004, + 0x0000014f,0x00050081,0x00000006,0x00000151,0x0000014d,0x00000150,0x00050041,0x00000007, + 0x00000152,0x000000f2,0x00000069,0x0004003d,0x00000006,0x00000153,0x00000152,0x0006000c, + 0x00000006,0x00000154,0x00000001,0x00000004,0x00000153,0x00050081,0x00000006,0x00000155, + 0x00000151,0x00000154,0x00050041,0x00000007,0x00000156,0x000000f2,0x0000006e,0x0004003d, + 0x00000006,0x00000157,0x00000156,0x0006000c,0x00000006,0x00000158,0x00000001,0x00000004, + 0x00000157,0x00050081,0x00000006,0x00000159,0x00000155,0x00000158,0x00050081,0x00000006, + 0x0000015a,0x0000014a,0x00000159,0x0003003e,0x0000012b,0x0000015a,0x0004003d,0x00000006, + 0x0000015d,0x0000012b,0x00050088,0x00000006,0x0000015e,0x0000015c,0x0000015d,0x0003003e, + 0x0000015b,0x0000015e,0x0004003d,0x00000006,0x00000160,0x0000015b,0x0004003d,0x00000006, + 0x00000161,0x0000015b,0x00050085,0x00000006,0x00000162,0x00000160,0x00000161,0x0007000c, + 0x00000006,0x00000164,0x00000001,0x00000025,0x00000162,0x00000163,0x0003003e,0x0000015f, + 0x00000164,0x0004003d,0x00000006,0x00000166,0x0000015f,0x0004003d,0x00000016,0x00000168, + 0x000000c5,0x0003003e,0x00000167,0x00000168,0x0004003d,0x00000016,0x0000016a,0x000000ea, + 0x0003003e,0x00000169,0x0000016a,0x00060039,0x0000000e,0x0000016b,0x0000001b,0x00000167, + 0x00000169,0x00050051,0x00000006,0x0000016c,0x0000016b,0x00000000,0x00050051,0x00000006, + 0x0000016d,0x0000016b,0x00000001,0x00060050,0x0000000c,0x0000016e,0x00000166,0x0000016c, + 0x0000016d,0x0003003e,0x00000165,0x0000016e,0x00050041,0x00000007,0x00000170,0x000000c0, + 0x0000003a,0x0004003d,0x00000006,0x00000171,0x00000170,0x00050081,0x00000006,0x00000172, + 0x00000171,0x00000054,0x00050041,0x00000007,0x00000174,0x000000c0,0x00000031,0x0004003d, + 0x00000006,0x00000175,0x00000174,0x0003003e,0x00000173,0x00000175,0x0003003e,0x00000176, + 0x00000172,0x00050041,0x00000007,0x00000178,0x000000f2,0x00000031,0x0004003d,0x00000006, + 0x00000179,0x00000178,0x0003003e,0x00000177,0x00000179,0x0004003d,0x0000000c,0x0000017b, + 0x00000165,0x0003003e,0x0000017a,0x0000017b,0x00080039,0x0000000e,0x0000017c,0x00000014, + 0x00000173,0x00000176,0x00000177,0x0000017a,0x0003003e,0x0000016f,0x0000017c,0x00050041, + 0x00000007,0x0000017d,0x000000c0,0x00000031,0x0004003d,0x00000006,0x0000017e,0x0000017d, + 0x00050083,0x00000006,0x0000017f,0x0000017e,0x00000054,0x00050041,0x00000007,0x00000180, + 0x000000c0,0x0000003a,0x0004003d,0x00000006,0x00000181,0x00000180,0x00050081,0x00000006, + 0x00000182,0x00000181,0x00000054,0x0003003e,0x00000183,0x0000017f,0x0003003e,0x00000184, + 0x00000182,0x00050041,0x00000007,0x00000186,0x000000f2,0x0000003a,0x0004003d,0x00000006, + 0x00000187,0x00000186,0x0003003e,0x00000185,0x00000187,0x0004003d,0x0000000c,0x00000189, + 0x00000165,0x0003003e,0x00000188,0x00000189,0x00080039,0x0000000e,0x0000018a,0x00000014, + 0x00000183,0x00000184,0x00000185,0x00000188,0x0004003d,0x0000000e,0x0000018b,0x0000016f, + 0x00050081,0x0000000e,0x0000018c,0x0000018b,0x0000018a,0x0003003e,0x0000016f,0x0000018c, + 0x00050041,0x00000007,0x0000018d,0x000000c0,0x00000031,0x0004003d,0x00000006,0x0000018e, + 0x0000018d,0x00050083,0x00000006,0x0000018f,0x0000018e,0x00000054,0x00050041,0x00000007, + 0x00000190,0x000000c0,0x0000003a,0x0004003d,0x00000006,0x00000191,0x00000190,0x00050083, + 0x00000006,0x00000193,0x00000191,0x00000192,0x0003003e,0x00000194,0x0000018f,0x0003003e, + 0x00000195,0x00000193,0x00050041,0x00000007,0x00000197,0x000000f2,0x00000069,0x0004003d, + 0x00000006,0x00000198,0x00000197,0x0003003e,0x00000196,0x00000198,0x0004003d,0x0000000c, + 0x0000019a,0x00000165,0x0003003e,0x00000199,0x0000019a,0x00080039,0x0000000e,0x0000019b, + 0x00000014,0x00000194,0x00000195,0x00000196,0x00000199,0x0004003d,0x0000000e,0x0000019c, + 0x0000016f,0x00050081,0x0000000e,0x0000019d,0x0000019c,0x0000019b,0x0003003e,0x0000016f, + 0x0000019d,0x00050041,0x00000007,0x0000019e,0x000000c0,0x0000003a,0x0004003d,0x00000006, + 0x0000019f,0x0000019e,0x00050083,0x00000006,0x000001a0,0x0000019f,0x00000192,0x00050041, + 0x00000007,0x000001a2,0x000000c0,0x00000031,0x0004003d,0x00000006,0x000001a3,0x000001a2, + 0x0003003e,0x000001a1,0x000001a3,0x0003003e,0x000001a4,0x000001a0,0x00050041,0x00000007, + 0x000001a6,0x000000f2,0x0000006e,0x0004003d,0x00000006,0x000001a7,0x000001a6,0x0003003e, + 0x000001a5,0x000001a7,0x0004003d,0x0000000c,0x000001a9,0x00000165,0x0003003e,0x000001a8, + 0x000001a9,0x00080039,0x0000000e,0x000001aa,0x00000014,0x000001a1,0x000001a4,0x000001a5, + 0x000001a8,0x0004003d,0x0000000e,0x000001ab,0x0000016f,0x00050081,0x0000000e,0x000001ac, + 0x000001ab,0x000001aa,0x0003003e,0x0000016f,0x000001ac,0x00050041,0x00000007,0x000001ad, + 0x000000c0,0x00000031,0x0004003d,0x00000006,0x000001ae,0x000001ad,0x00050081,0x00000006, + 0x000001af,0x000001ae,0x00000054,0x00050041,0x00000007,0x000001b0,0x000000c0,0x0000003a, + 0x0004003d,0x00000006,0x000001b1,0x000001b0,0x00050083,0x00000006,0x000001b2,0x000001b1, + 0x00000054,0x0003003e,0x000001b3,0x000001af,0x0003003e,0x000001b4,0x000001b2,0x00050041, + 0x00000007,0x000001b6,0x000000c5,0x00000031,0x0004003d,0x00000006,0x000001b7,0x000001b6, + 0x0003003e,0x000001b5,0x000001b7,0x0004003d,0x0000000c,0x000001b9,0x00000165,0x0003003e, + 0x000001b8,0x000001b9,0x00080039,0x0000000e,0x000001ba,0x00000014,0x000001b3,0x000001b4, + 0x000001b5,0x000001b8,0x0004003d,0x0000000e,0x000001bb,0x0000016f,0x00050081,0x0000000e, + 0x000001bc,0x000001bb,0x000001ba,0x0003003e,0x0000016f,0x000001bc,0x00050041,0x00000007, + 0x000001bd,0x000000c0,0x0000003a,0x0004003d,0x00000006,0x000001be,0x000001bd,0x00050083, + 0x00000006,0x000001bf,0x000001be,0x00000054,0x00050041,0x00000007,0x000001c1,0x000000c0, + 0x00000031,0x0004003d,0x00000006,0x000001c2,0x000001c1,0x0003003e,0x000001c0,0x000001c2, + 0x0003003e,0x000001c3,0x000001bf,0x00050041,0x00000007,0x000001c5,0x000000c5,0x0000003a, + 0x0004003d,0x00000006,0x000001c6,0x000001c5,0x0003003e,0x000001c4,0x000001c6,0x0004003d, + 0x0000000c,0x000001c8,0x00000165,0x0003003e,0x000001c7,0x000001c8,0x00080039,0x0000000e, + 0x000001c9,0x00000014,0x000001c0,0x000001c3,0x000001c4,0x000001c7,0x0004003d,0x0000000e, + 0x000001ca,0x0000016f,0x00050081,0x0000000e,0x000001cb,0x000001ca,0x000001c9,0x0003003e, + 0x0000016f,0x000001cb,0x00050041,0x00000007,0x000001cd,0x000000c0,0x00000031,0x0004003d, + 0x00000006,0x000001ce,0x000001cd,0x0003003e,0x000001cc,0x000001ce,0x00050041,0x00000007, + 0x000001d0,0x000000c0,0x0000003a,0x0004003d,0x00000006,0x000001d1,0x000001d0,0x0003003e, + 0x000001cf,0x000001d1,0x00050041,0x00000007,0x000001d3,0x000000c5,0x00000069,0x0004003d, + 0x00000006,0x000001d4,0x000001d3,0x0003003e,0x000001d2,0x000001d4,0x0004003d,0x0000000c, + 0x000001d6,0x00000165,0x0003003e,0x000001d5,0x000001d6,0x00080039,0x0000000e,0x000001d7, + 0x00000014,0x000001cc,0x000001cf,0x000001d2,0x000001d5,0x0004003d,0x0000000e,0x000001d8, + 0x0000016f,0x00050081,0x0000000e,0x000001d9,0x000001d8,0x000001d7,0x0003003e,0x0000016f, + 0x000001d9,0x00050041,0x00000007,0x000001da,0x000000c0,0x00000031,0x0004003d,0x00000006, + 0x000001db,0x000001da,0x00050081,0x00000006,0x000001dc,0x000001db,0x00000054,0x0003003e, + 0x000001dd,0x000001dc,0x00050041,0x00000007,0x000001df,0x000000c0,0x0000003a,0x0004003d, + 0x00000006,0x000001e0,0x000001df,0x0003003e,0x000001de,0x000001e0,0x00050041,0x00000007, + 0x000001e2,0x000000c5,0x0000006e,0x0004003d,0x00000006,0x000001e3,0x000001e2,0x0003003e, + 0x000001e1,0x000001e3,0x0004003d,0x0000000c,0x000001e5,0x00000165,0x0003003e,0x000001e4, + 0x000001e5,0x00080039,0x0000000e,0x000001e6,0x00000014,0x000001dd,0x000001de,0x000001e1, + 0x000001e4,0x0004003d,0x0000000e,0x000001e7,0x0000016f,0x00050081,0x0000000e,0x000001e8, + 0x000001e7,0x000001e6,0x0003003e,0x0000016f,0x000001e8,0x00050041,0x00000007,0x000001e9, + 0x000000c0,0x00000031,0x0004003d,0x00000006,0x000001ea,0x000001e9,0x00050083,0x00000006, + 0x000001eb,0x000001ea,0x00000054,0x00050041,0x00000007,0x000001ec,0x000000c0,0x0000003a, + 0x0004003d,0x00000006,0x000001ed,0x000001ec,0x00050083,0x00000006,0x000001ee,0x000001ed, + 0x00000054,0x0003003e,0x000001ef,0x000001eb,0x0003003e,0x000001f0,0x000001ee,0x00050041, + 0x00000007,0x000001f2,0x000000ea,0x00000031,0x0004003d,0x00000006,0x000001f3,0x000001f2, + 0x0003003e,0x000001f1,0x000001f3,0x0004003d,0x0000000c,0x000001f5,0x00000165,0x0003003e, + 0x000001f4,0x000001f5,0x00080039,0x0000000e,0x000001f6,0x00000014,0x000001ef,0x000001f0, + 0x000001f1,0x000001f4,0x0004003d,0x0000000e,0x000001f7,0x0000016f,0x00050081,0x0000000e, + 0x000001f8,0x000001f7,0x000001f6,0x0003003e,0x0000016f,0x000001f8,0x00050041,0x00000007, + 0x000001f9,0x000000c0,0x00000031,0x0004003d,0x00000006,0x000001fa,0x000001f9,0x00050083, + 0x00000006,0x000001fb,0x000001fa,0x00000192,0x00050041,0x00000007,0x000001fc,0x000000c0, + 0x0000003a,0x0004003d,0x00000006,0x000001fd,0x000001fc,0x00050083,0x00000006,0x000001fe, + 0x000001fd,0x00000054,0x0003003e,0x000001ff,0x000001fb,0x0003003e,0x00000200,0x000001fe, + 0x00050041,0x00000007,0x00000202,0x000000ea,0x0000003a,0x0004003d,0x00000006,0x00000203, + 0x00000202,0x0003003e,0x00000201,0x00000203,0x0004003d,0x0000000c,0x00000205,0x00000165, + 0x0003003e,0x00000204,0x00000205,0x00080039,0x0000000e,0x00000206,0x00000014,0x000001ff, + 0x00000200,0x00000201,0x00000204,0x0004003d,0x0000000e,0x00000207,0x0000016f,0x00050081, + 0x0000000e,0x00000208,0x00000207,0x00000206,0x0003003e,0x0000016f,0x00000208,0x00050041, + 0x00000007,0x00000209,0x000000c0,0x00000031,0x0004003d,0x00000006,0x0000020a,0x00000209, + 0x00050083,0x00000006,0x0000020b,0x0000020a,0x00000192,0x0003003e,0x0000020c,0x0000020b, + 0x00050041,0x00000007,0x0000020e,0x000000c0,0x0000003a,0x0004003d,0x00000006,0x0000020f, + 0x0000020e,0x0003003e,0x0000020d,0x0000020f,0x00050041,0x00000007,0x00000211,0x000000ea, + 0x00000069,0x0004003d,0x00000006,0x00000212,0x00000211,0x0003003e,0x00000210,0x00000212, + 0x0004003d,0x0000000c,0x00000214,0x00000165,0x0003003e,0x00000213,0x00000214,0x00080039, + 0x0000000e,0x00000215,0x00000014,0x0000020c,0x0000020d,0x00000210,0x00000213,0x0004003d, + 0x0000000e,0x00000216,0x0000016f,0x00050081,0x0000000e,0x00000217,0x00000216,0x00000215, + 0x0003003e,0x0000016f,0x00000217,0x00050041,0x00000007,0x00000218,0x000000c0,0x00000031, + 0x0004003d,0x00000006,0x00000219,0x00000218,0x00050083,0x00000006,0x0000021a,0x00000219, + 0x00000054,0x0003003e,0x0000021b,0x0000021a,0x00050041,0x00000007,0x0000021d,0x000000c0, + 0x0000003a,0x0004003d,0x00000006,0x0000021e,0x0000021d,0x0003003e,0x0000021c,0x0000021e, + 0x00050041,0x00000007,0x00000220,0x000000ea,0x0000006e,0x0004003d,0x00000006,0x00000221, + 0x00000220,0x0003003e,0x0000021f,0x00000221,0x0004003d,0x0000000c,0x00000223,0x00000165, + 0x0003003e,0x00000222,0x00000223,0x00080039,0x0000000e,0x00000224,0x00000014,0x0000021b, + 0x0000021c,0x0000021f,0x00000222,0x0004003d,0x0000000e,0x00000225,0x0000016f,0x00050081, + 0x0000000e,0x00000226,0x00000225,0x00000224,0x0003003e,0x0000016f,0x00000226,0x00050041, + 0x00000007,0x00000228,0x0000016f,0x0000003a,0x0004003d,0x00000006,0x00000229,0x00000228, + 0x00050041,0x00000007,0x0000022a,0x0000016f,0x00000031,0x0004003d,0x00000006,0x0000022b, + 0x0000022a,0x00050088,0x00000006,0x0000022c,0x00000229,0x0000022b,0x0003003e,0x00000227, + 0x0000022c,0x00050041,0x00000007,0x0000022e,0x000000c5,0x0000003a,0x0004003d,0x00000006, + 0x0000022f,0x0000022e,0x00050041,0x00000007,0x00000230,0x000000c5,0x00000069,0x0004003d, + 0x00000006,0x00000231,0x00000230,0x0007000c,0x00000006,0x00000232,0x00000001,0x00000028, + 0x0000022f,0x00000231,0x00050041,0x00000007,0x00000233,0x000000ea,0x00000031,0x0004003d, + 0x00000006,0x00000234,0x00000233,0x00050041,0x00000007,0x00000235,0x000000ea,0x0000006e, + 0x0004003d,0x00000006,0x00000236,0x00000235,0x0007000c,0x00000006,0x00000237,0x00000001, + 0x00000028,0x00000234,0x00000236,0x0007000c,0x00000006,0x00000238,0x00000001,0x00000028, + 0x00000232,0x00000237,0x0003003e,0x0000022d,0x00000238,0x00050041,0x00000007,0x0000023a, + 0x000000c5,0x0000003a,0x0004003d,0x00000006,0x0000023b,0x0000023a,0x00050041,0x00000007, + 0x0000023c,0x000000c5,0x00000069,0x0004003d,0x00000006,0x0000023d,0x0000023c,0x0007000c, + 0x00000006,0x0000023e,0x00000001,0x00000025,0x0000023b,0x0000023d,0x00050041,0x00000007, + 0x0000023f,0x000000ea,0x00000031,0x0004003d,0x00000006,0x00000240,0x0000023f,0x00050041, + 0x00000007,0x00000241,0x000000ea,0x0000006e,0x0004003d,0x00000006,0x00000242,0x00000241, + 0x0007000c,0x00000006,0x00000243,0x00000001,0x00000025,0x00000240,0x00000242,0x0007000c, + 0x00000006,0x00000244,0x00000001,0x00000025,0x0000023e,0x00000243,0x0003003e,0x00000239, + 0x00000244,0x00050041,0x00000246,0x00000247,0x00000096,0x00000245,0x0004003d,0x00000006, + 0x00000248,0x00000247,0x0004003d,0x00000006,0x00000249,0x00000227,0x00050085,0x00000006, + 0x0000024a,0x00000248,0x00000249,0x0004003d,0x00000006,0x0000024b,0x00000239,0x0004003d, + 0x00000006,0x0000024c,0x0000022d,0x0008000c,0x00000006,0x0000024d,0x00000001,0x0000002b, + 0x0000024a,0x0000024b,0x0000024c,0x0003003e,0x00000227,0x0000024d,0x0004003d,0x00000006, + 0x0000024f,0x00000227,0x00050041,0x00000007,0x00000250,0x000000a0,0x0000006e,0x0004003d, + 0x00000006,0x00000251,0x00000250,0x00050083,0x00000006,0x00000252,0x0000024f,0x00000251, + 0x0003003e,0x0000024e,0x00000252,0x0004003d,0x00000006,0x00000253,0x0000024e,0x0008000c, + 0x00000006,0x00000256,0x00000001,0x0000002b,0x00000253,0x00000254,0x00000255,0x0003003e, + 0x0000024e,0x00000256,0x00050041,0x00000007,0x00000257,0x000000a0,0x00000031,0x0004003d, + 0x00000006,0x00000258,0x00000257,0x0004003d,0x00000006,0x00000259,0x0000024e,0x00050081, + 0x00000006,0x0000025a,0x00000258,0x00000259,0x0008000c,0x00000006,0x0000025b,0x00000001, + 0x0000002b,0x0000025a,0x00000053,0x00000054,0x00050041,0x00000007,0x0000025c,0x000000a0, + 0x00000031,0x0003003e,0x0000025c,0x0000025b,0x00050041,0x00000007,0x0000025d,0x000000a0, + 0x0000003a,0x0004003d,0x00000006,0x0000025e,0x0000025d,0x0004003d,0x00000006,0x0000025f, + 0x0000024e,0x00050081,0x00000006,0x00000260,0x0000025e,0x0000025f,0x0008000c,0x00000006, + 0x00000261,0x00000001,0x0000002b,0x00000260,0x00000053,0x00000054,0x00050041,0x00000007, + 0x00000262,0x000000a0,0x0000003a,0x0003003e,0x00000262,0x00000261,0x00050041,0x00000007, + 0x00000263,0x000000a0,0x00000069,0x0004003d,0x00000006,0x00000264,0x00000263,0x0004003d, + 0x00000006,0x00000265,0x0000024e,0x00050081,0x00000006,0x00000266,0x00000264,0x00000265, + 0x0008000c,0x00000006,0x00000267,0x00000001,0x0000002b,0x00000266,0x00000053,0x00000054, + 0x00050041,0x00000007,0x00000268,0x000000a0,0x00000069,0x0003003e,0x00000268,0x00000267, + 0x000200f9,0x000000e3,0x000200f8,0x000000e3,0x00050041,0x00000007,0x00000269,0x000000a0, + 0x0000006e,0x0003003e,0x00000269,0x00000054,0x0004003d,0x00000016,0x0000026c,0x000000a0, + 0x0003003e,0x0000026b,0x0000026c,0x000100fd,0x00010038,0x00050036,0x00000006,0x0000000a, + 0x00000000,0x00000008,0x00030037,0x00000007,0x00000009,0x000200f8,0x0000000b,0x0004003b, + 0x00000007,0x0000001d,0x00000007,0x0004003b,0x00000007,0x00000021,0x00000007,0x0004003d, + 0x00000006,0x0000001e,0x00000009,0x00050083,0x00000006,0x00000020,0x0000001e,0x0000001f, + 0x0003003e,0x0000001d,0x00000020,0x0004003d,0x00000006,0x00000022,0x00000009,0x0004003d, + 0x00000006,0x00000023,0x0000001d,0x00050085,0x00000006,0x00000024,0x00000022,0x00000023, + 0x0004003d,0x00000006,0x00000025,0x0000001d,0x00050083,0x00000006,0x00000026,0x00000024, + 0x00000025,0x0003003e,0x00000021,0x00000026,0x0004003d,0x00000006,0x00000027,0x0000001d, + 0x0004003d,0x00000006,0x00000028,0x0000001d,0x00050085,0x00000006,0x00000029,0x00000028, + 0x00000027,0x0003003e,0x0000001d,0x00000029,0x0004003d,0x00000006,0x0000002a,0x00000021, + 0x0004003d,0x00000006,0x0000002b,0x0000001d,0x00050085,0x00000006,0x0000002c,0x0000002a, + 0x0000002b,0x000200fe,0x0000002c,0x00010038,0x00050036,0x0000000e,0x00000014,0x00000000, + 0x0000000f,0x00030037,0x00000007,0x00000010,0x00030037,0x00000007,0x00000011,0x00030037, + 0x00000007,0x00000012,0x00030037,0x0000000d,0x00000013,0x000200f8,0x00000015,0x0004003b, + 0x00000007,0x0000002f,0x00000007,0x0004003b,0x00000034,0x00000035,0x00000007,0x0004003b, + 0x00000007,0x00000038,0x00000007,0x0004003b,0x00000007,0x00000043,0x00000007,0x0004003b, + 0x00000007,0x0000005b,0x00000007,0x0004003b,0x00000007,0x0000005c,0x00000007,0x00050041, + 0x00000007,0x00000032,0x00000013,0x00000031,0x0004003d,0x00000006,0x00000033,0x00000032, + 0x0003003e,0x0000002f,0x00000033,0x0004003d,0x0000000c,0x00000036,0x00000013,0x0007004f, + 0x0000000e,0x00000037,0x00000036,0x00000036,0x00000001,0x00000002,0x0003003e,0x00000035, + 0x00000037,0x0004003d,0x00000006,0x00000039,0x00000010,0x00050041,0x00000007,0x0000003b, + 0x00000035,0x0000003a,0x0004003d,0x00000006,0x0000003c,0x0000003b,0x00050085,0x00000006, + 0x0000003d,0x00000039,0x0000003c,0x0004003d,0x00000006,0x0000003e,0x00000011,0x00050041, + 0x00000007,0x0000003f,0x00000035,0x00000031,0x0004003d,0x00000006,0x00000040,0x0000003f, + 0x00050085,0x00000006,0x00000041,0x0000003e,0x00000040,0x00050081,0x00000006,0x00000042, + 0x0000003d,0x00000041,0x0003003e,0x00000038,0x00000042,0x0004003d,0x00000006,0x00000044, + 0x00000010,0x0004003d,0x00000006,0x00000045,0x00000010,0x00050085,0x00000006,0x00000046, + 0x00000044,0x00000045,0x0004003d,0x00000006,0x00000047,0x00000011,0x0004003d,0x00000006, + 0x00000048,0x00000011,0x00050085,0x00000006,0x00000049,0x00000047,0x00000048,0x00050081, + 0x00000006,0x0000004a,0x00000046,0x00000049,0x0004003d,0x00000006,0x0000004b,0x00000038, + 0x0004003d,0x00000006,0x0000004c,0x00000038,0x00050085,0x00000006,0x0000004d,0x0000004b, + 0x0000004c,0x0004003d,0x00000006,0x0000004e,0x00000012,0x0004003d,0x00000006,0x0000004f, + 0x00000012,0x00050085,0x00000006,0x00000050,0x0000004e,0x0000004f,0x0004003d,0x00000006, + 0x00000051,0x0000002f,0x00050085,0x00000006,0x00000052,0x00000050,0x00000051,0x0008000c, + 0x00000006,0x00000055,0x00000001,0x0000002b,0x00000052,0x00000053,0x00000054,0x00050085, + 0x00000006,0x00000057,0x00000055,0x00000056,0x00050083,0x00000006,0x00000058,0x00000057, + 0x00000054,0x00050085,0x00000006,0x00000059,0x0000004d,0x00000058,0x00050081,0x00000006, + 0x0000005a,0x0000004a,0x00000059,0x0003003e,0x00000043,0x0000005a,0x0004003d,0x00000006, + 0x0000005d,0x00000043,0x0003003e,0x0000005c,0x0000005d,0x00050039,0x00000006,0x0000005e, + 0x0000000a,0x0000005c,0x0003003e,0x0000005b,0x0000005e,0x0004003d,0x00000006,0x0000005f, + 0x0000005b,0x0004003d,0x00000006,0x00000060,0x0000005b,0x0004003d,0x00000006,0x00000061, + 0x00000012,0x00050085,0x00000006,0x00000062,0x00000060,0x00000061,0x00050050,0x0000000e, + 0x00000063,0x0000005f,0x00000062,0x000200fe,0x00000063,0x00010038,0x00050036,0x0000000e, + 0x0000001b,0x00000000,0x00000018,0x00030037,0x00000017,0x00000019,0x00030037,0x00000017, + 0x0000001a,0x000200f8,0x0000001c,0x0004003b,0x00000007,0x00000066,0x00000007,0x0004003b, + 0x00000007,0x0000006d,0x00000007,0x0004003b,0x00000034,0x00000074,0x00000007,0x0004003b, + 0x00000034,0x0000007d,0x00000007,0x0004003b,0x00000007,0x0000007f,0x00000007,0x00050041, + 0x00000007,0x00000067,0x0000001a,0x00000031,0x0004003d,0x00000006,0x00000068,0x00000067, + 0x00050041,0x00000007,0x0000006a,0x00000019,0x00000069,0x0004003d,0x00000006,0x0000006b, + 0x0000006a,0x00050083,0x00000006,0x0000006c,0x00000068,0x0000006b,0x0003003e,0x00000066, + 0x0000006c,0x00050041,0x00000007,0x0000006f,0x0000001a,0x0000006e,0x0004003d,0x00000006, + 0x00000070,0x0000006f,0x00050041,0x00000007,0x00000071,0x00000019,0x0000003a,0x0004003d, + 0x00000006,0x00000072,0x00000071,0x00050083,0x00000006,0x00000073,0x00000070,0x00000072, + 0x0003003e,0x0000006d,0x00000073,0x0004003d,0x00000006,0x00000075,0x00000066,0x0004003d, + 0x00000006,0x00000076,0x0000006d,0x00050081,0x00000006,0x00000077,0x00000075,0x00000076, + 0x00050041,0x00000007,0x00000078,0x00000074,0x00000031,0x0003003e,0x00000078,0x00000077, + 0x0004003d,0x00000006,0x00000079,0x00000066,0x0004003d,0x00000006,0x0000007a,0x0000006d, + 0x00050083,0x00000006,0x0000007b,0x00000079,0x0000007a,0x00050041,0x00000007,0x0000007c, + 0x00000074,0x0000003a,0x0003003e,0x0000007c,0x0000007b,0x0004003d,0x0000000e,0x0000007e, + 0x00000074,0x0003003e,0x0000007d,0x0000007e,0x00050041,0x00000007,0x00000080,0x0000007d, + 0x00000031,0x0004003d,0x00000006,0x00000081,0x00000080,0x00050041,0x00000007,0x00000082, + 0x0000007d,0x00000031,0x0004003d,0x00000006,0x00000083,0x00000082,0x00050085,0x00000006, + 0x00000084,0x00000081,0x00000083,0x00050081,0x00000006,0x00000086,0x00000084,0x00000085, + 0x00050041,0x00000007,0x00000087,0x0000007d,0x0000003a,0x0004003d,0x00000006,0x00000088, + 0x00000087,0x00050041,0x00000007,0x00000089,0x0000007d,0x0000003a,0x0004003d,0x00000006, + 0x0000008a,0x00000089,0x00050085,0x00000006,0x0000008b,0x00000088,0x0000008a,0x00050081, + 0x00000006,0x0000008c,0x00000086,0x0000008b,0x0006000c,0x00000006,0x0000008d,0x00000001, + 0x00000020,0x0000008c,0x0003003e,0x0000007f,0x0000008d,0x0004003d,0x0000000e,0x0000008e, + 0x00000074,0x0004003d,0x00000006,0x0000008f,0x0000007f,0x0005008e,0x0000000e,0x00000090, + 0x0000008e,0x0000008f,0x000200fe,0x00000090,0x00010038 +}; diff --git a/app/src/main/cpp/waylandcomp/src/effects_chain.c b/app/src/main/cpp/waylandcomp/src/effects_chain.c index 40db5a53ae..d711e565f3 100644 --- a/app/src/main/cpp/waylandcomp/src/effects_chain.c +++ b/app/src/main/cpp/waylandcomp/src/effects_chain.c @@ -27,6 +27,18 @@ #include "ntsc_frag.h" #include "crt_frag.h" #include "deband_frag.h" +/* Half-precision upscaler/CAS set (shaders/gen_shaders.sh -DDD_HALF=1), ported from Bannerlator. */ +#include "sgsr_half_frag.h" +#include "sgsr_quality_half_frag.h" +#include "nis_luma_half_frag.h" +#include "nis3_half_frag.h" +#include "nis_coef.h" +#include "fsr_easu_half_frag.h" +#include "fsr_rcas_half_frag.h" +#include "cas_ffx_half_frag.h" +#ifdef __ANDROID__ +#include +#endif #define FX_FORMAT VK_FORMAT_R8G8B8A8_UNORM @@ -221,9 +233,21 @@ static VkDescriptorSetLayout g_dsl; static VkPipelineLayout g_pl; static VkDescriptorPool g_dpool; static VkSampler g_sampler; -enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_FXAA_TOON, P_SMAA_EDGE, P_SMAA_WEIGHTS, P_SMAA_BLEND, P_TOON, P_TOON_COLOR, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_COUNT }; +enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_FXAA_TOON, P_SMAA_EDGE, P_SMAA_WEIGHTS, P_SMAA_BLEND, P_TOON, P_TOON_COLOR, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_NIS_LUMA, P_COUNT }; static VkPipeline g_pipe[P_COUNT]; static struct fx_target g_t[2], g_mid, g_smaa_edges, g_smaa_weights; +/* Half set: NIS = nis_luma prepass (scene rgb + luma in alpha, scene size) into g_nissrc, then + * nis3 gathers its luma from that alpha, its coefficient banks (nis_coef.h) in a uniform buffer + * at descriptor set 1 (g_pl_nis = {g_dsl, g_coef_dsl}, same push-constant range as g_pl). + * Old set (or no buffer): nis.frag on the scene, P_NIS_LUMA unused. */ +static struct fx_target g_nissrc; +static int g_nis_fast; +static VkDescriptorSetLayout g_coef_dsl; +static VkPipelineLayout g_pl_nis; +static VkDescriptorPool g_coef_pool; +static VkDescriptorSet g_coef_ds; +static VkBuffer g_coef_buf; +static VkDeviceMemory g_coef_mem; static struct { VkImage img; VkImageView view; VkDescriptorSet ds; int w, h; } g_scene; @@ -344,7 +368,7 @@ static VkShaderModule shader(const uint32_t *code, size_t size) { static VkPipeline post_pipeline_for_renderpass(VkShaderModule vert, const uint32_t *frag_code, size_t frag_size, VkRenderPass render_pass, - const char *name) { + const char *name, VkPipelineLayout layout) { VkShaderModule frag = shader(frag_code, frag_size); if (!frag) { droiddeck_log("error", "effects: %s: vkCreateShaderModule failed", name); return VK_NULL_HANDLE; } VkPipelineShaderStageCreateInfo st[2] = { @@ -369,7 +393,7 @@ static VkPipeline post_pipeline_for_renderpass(VkShaderModule vert, VkGraphicsPipelineCreateInfo pi = {.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, .stageCount = 2, .pStages = st, .pVertexInputState = &vi, .pInputAssemblyState = &ia, .pViewportState = &vp, .pRasterizationState = &rs, .pMultisampleState = &ms, - .pColorBlendState = &cb, .pDynamicState = &ds, .layout = g_pl, + .pColorBlendState = &cb, .pDynamicState = &ds, .layout = layout, .renderPass = render_pass, .subpass = 0}; VkPipeline p = VK_NULL_HANDLE; VkResult r = g_vk.CreateGraphicsPipelines(g_dev, VK_NULL_HANDLE, 1, &pi, NULL, &p); @@ -378,19 +402,84 @@ static VkPipeline post_pipeline_for_renderpass(VkShaderModule vert, return p; } -static VkPipeline post_pipeline(VkShaderModule vert, const uint32_t *frag_code, - size_t frag_size, const char *name) { - return post_pipeline_for_renderpass(vert, frag_code, frag_size, g_rp, name); +static void coef_destroy(void) { + if (g_coef_pool) g_vk.DestroyDescriptorPool(g_dev, g_coef_pool, NULL); /* frees g_coef_ds */ + if (g_coef_buf) g_vk.DestroyBuffer(g_dev, g_coef_buf, NULL); + if (g_coef_mem) g_vk.FreeMemory(g_dev, g_coef_mem, NULL); + if (g_pl_nis) g_vk.DestroyPipelineLayout(g_dev, g_pl_nis, NULL); + if (g_coef_dsl) g_vk.DestroyDescriptorSetLayout(g_dev, g_coef_dsl, NULL); + g_coef_pool = VK_NULL_HANDLE; g_coef_ds = VK_NULL_HANDLE; g_coef_buf = VK_NULL_HANDLE; + g_coef_mem = VK_NULL_HANDLE; g_pl_nis = VK_NULL_HANDLE; g_coef_dsl = VK_NULL_HANDLE; +} + +/* nis3's coefficient banks: a 4 KB host-visible uniform buffer (scale then usm), filled once. 0 = ok. */ +static int coef_create(void) { + VkDescriptorSetLayoutBinding b = {.binding = 0, .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, + .descriptorCount = 1, .stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT}; + VkDescriptorSetLayoutCreateInfo dli = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, .bindingCount = 1, .pBindings = &b}; + if (g_vk.CreateDescriptorSetLayout(g_dev, &dli, NULL, &g_coef_dsl) != VK_SUCCESS) goto fail; + VkDescriptorSetLayout sets[2] = {g_dsl, g_coef_dsl}; + VkPushConstantRange pcr = {.stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, .offset = 0, .size = PC_MAX_SIZE}; + VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 2, .pSetLayouts = sets, + .pushConstantRangeCount = 1, .pPushConstantRanges = &pcr}; + if (g_vk.CreatePipelineLayout(g_dev, &pli, NULL, &g_pl_nis) != VK_SUCCESS) goto fail; + VkBufferCreateInfo bci = {.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .size = 4096, + .usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, .sharingMode = VK_SHARING_MODE_EXCLUSIVE}; + if (g_vk.CreateBuffer(g_dev, &bci, NULL, &g_coef_buf) != VK_SUCCESS) goto fail; + VkMemoryRequirements req; + g_vk.GetBufferMemoryRequirements(g_dev, g_coef_buf, &req); + int idx = memtype(req.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); + if (idx < 0) goto fail; + VkMemoryAllocateInfo mai = {.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .allocationSize = req.size, .memoryTypeIndex = (uint32_t)idx}; + if (g_vk.AllocateMemory(g_dev, &mai, NULL, &g_coef_mem) != VK_SUCCESS) goto fail; + if (g_vk.BindBufferMemory(g_dev, g_coef_buf, g_coef_mem, 0) != VK_SUCCESS) goto fail; + void *p = NULL; + if (g_vk.MapMemory(g_dev, g_coef_mem, 0, 4096, 0, &p) != VK_SUCCESS || !p) goto fail; + memcpy(p, kNisCoefScale, sizeof(kNisCoefScale)); + memcpy((char *)p + sizeof(kNisCoefScale), kNisCoefUsm, sizeof(kNisCoefUsm)); + g_vk.UnmapMemory(g_dev, g_coef_mem); + VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1}; + VkDescriptorPoolCreateInfo dpi = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, .maxSets = 1, .poolSizeCount = 1, .pPoolSizes = &ps}; + if (g_vk.CreateDescriptorPool(g_dev, &dpi, NULL, &g_coef_pool) != VK_SUCCESS) goto fail; + VkDescriptorSetAllocateInfo ai = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, .descriptorPool = g_coef_pool, + .descriptorSetCount = 1, .pSetLayouts = &g_coef_dsl}; + if (g_vk.AllocateDescriptorSets(g_dev, &ai, &g_coef_ds) != VK_SUCCESS) goto fail; + VkDescriptorBufferInfo bi = {.buffer = g_coef_buf, .offset = 0, .range = 4096}; + VkWriteDescriptorSet wr = {.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstSet = g_coef_ds, .dstBinding = 0, + .descriptorCount = 1, .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, .pBufferInfo = &bi}; + g_vk.UpdateDescriptorSets(g_dev, 1, &wr, 0, NULL); + return 0; +fail: + coef_destroy(); + return -1; +} + +/* nis_luma keeps luma in the target's alpha: only formats with at least 8 alpha bits (not the + * 2-bit alpha of the 10-bit HDR composition format) can hold it. */ +static int fx_alpha_holds_luma(VkFormat f) { + return f == VK_FORMAT_R8G8B8A8_UNORM || f == VK_FORMAT_B8G8R8A8_UNORM || + f == VK_FORMAT_R16G16B16A16_SFLOAT || f == VK_FORMAT_R16G16B16A16_UNORM; +} + +/* The half-precision upscaler set unless debug.droiddeck.upscale.shaders is "old" (the fp32 + * shaders, for A/B comparisons). */ +static int upscale_half_set(void) { +#ifdef __ANDROID__ + char v[PROP_VALUE_MAX] = {0}; + if (__system_property_get("debug.droiddeck.upscale.shaders", v) > 0 && strcmp(v, "old") == 0) return 0; +#endif + return 1; } static void objects_destroy(void) { if (!g_dev) return; scene_release(); target_destroy(&g_t[0]); target_destroy(&g_t[1]); target_destroy(&g_mid); - target_destroy(&g_smaa_edges); target_destroy(&g_smaa_weights); + target_destroy(&g_smaa_edges); target_destroy(&g_smaa_weights); target_destroy(&g_nissrc); for (int i = 0; i < P_COUNT; i++) { if (g_pipe[i]) g_vk.DestroyPipeline(g_dev, g_pipe[i], NULL); g_pipe[i] = VK_NULL_HANDLE; } if (g_dpool) g_vk.DestroyDescriptorPool(g_dev, g_dpool, NULL); if (g_pl) g_vk.DestroyPipelineLayout(g_dev, g_pl, NULL); + coef_destroy(); if (g_dsl) g_vk.DestroyDescriptorSetLayout(g_dev, g_dsl, NULL); if (g_sampler) g_vk.DestroySampler(g_dev, g_sampler, NULL); if (g_smaa_rp) g_vk.DestroyRenderPass(g_dev, g_smaa_rp, NULL); @@ -467,29 +556,61 @@ static int objects_ensure(void) { VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 2, .pSetLayouts = set_layouts, .pushConstantRangeCount = 1, .pPushConstantRanges = &pcr}; if (g_vk.CreatePipelineLayout(g_dev, &pli, NULL, &g_pl) != VK_SUCCESS) goto fail; - VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 8}; + VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 10}; VkDescriptorPoolCreateInfo dpi = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, - .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, .maxSets = 8, + .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, .maxSets = 10, .poolSizeCount = 1, .pPoolSizes = &ps}; if (g_vk.CreateDescriptorPool(g_dev, &dpi, NULL, &g_dpool) != VK_SUCCESS) goto fail; VkShaderModule vert = shader(upscale_vert_code, sizeof(upscale_vert_code)); if (!vert) goto fail; -#define MK(slot, code, name) do { g_pipe[slot] = post_pipeline(vert, code, sizeof(code), name); if (!g_pipe[slot]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; } } while (0) - MK(P_SGSR, sgsr_code, "sgsr"); - MK(P_SGSR_HQ, sgsr_quality_code, "sgsr_quality"); - MK(P_NIS, nis_code, "nis"); - MK(P_EASU, fsr_easu_code, "fsr_easu"); - MK(P_RCAS, fsr_rcas_code, "fsr_rcas"); - MK(P_CAS, cas_code, "cas"); +#define MKL(slot, code, name, layout) do { g_pipe[slot] = post_pipeline_for_renderpass(vert, code, sizeof(code), g_rp, name, layout); if (!g_pipe[slot]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; } } while (0) +#define MK(slot, code, name) MKL(slot, code, name, g_pl) + const int half = upscale_half_set(); + g_nis_fast = 0; + if (half && !fx_alpha_holds_luma(g_fx_fmt)) + droiddeck_log("effects", "NIS uses nis.frag: the chain format has no 8-bit alpha for the luma prepass"); + else if (half && coef_create() != 0) + droiddeck_log("effects", "NIS coefficient buffer unavailable; NIS uses nis.frag"); + else if (half) + g_nis_fast = 1; + if (half) { + MK(P_SGSR, sgsr_half_code, "sgsr_half"); + MK(P_SGSR_HQ, sgsr_quality_half_code, "sgsr_quality_half"); + if (g_nis_fast) { + /* optional: a driver that rejects either fast NIS pipeline gets nis.frag, not a dead chain */ + g_pipe[P_NIS] = post_pipeline_for_renderpass(vert, nis3_half_code, sizeof(nis3_half_code), g_rp, "nis3_half", g_pl_nis); + g_pipe[P_NIS_LUMA] = g_pipe[P_NIS] + ? post_pipeline_for_renderpass(vert, nis_luma_half_code, sizeof(nis_luma_half_code), g_rp, "nis_luma_half", g_pl) + : VK_NULL_HANDLE; + if (!g_pipe[P_NIS] || !g_pipe[P_NIS_LUMA]) { + if (g_pipe[P_NIS]) g_vk.DestroyPipeline(g_dev, g_pipe[P_NIS], NULL); + g_pipe[P_NIS] = VK_NULL_HANDLE; + coef_destroy(); + g_nis_fast = 0; + droiddeck_log("effects", "fast NIS pipelines failed to build; NIS uses nis.frag"); + } + } + if (!g_nis_fast) MK(P_NIS, nis_code, "nis"); + MK(P_EASU, fsr_easu_half_code, "fsr_easu_half"); + MK(P_RCAS, fsr_rcas_half_code, "fsr_rcas_half"); + MK(P_CAS, cas_ffx_half_code, "cas_ffx_half"); + } else { + MK(P_SGSR, sgsr_code, "sgsr"); + MK(P_SGSR_HQ, sgsr_quality_code, "sgsr_quality"); + MK(P_NIS, nis_code, "nis"); + MK(P_EASU, fsr_easu_code, "fsr_easu"); + MK(P_RCAS, fsr_rcas_code, "fsr_rcas"); + MK(P_CAS, cas_code, "cas"); + } MK(P_COLOR, color_code, "color"); MK(P_FXAA, fxaa_code, "fxaa"); MK(P_FXAA_TOON, fxaa_toon_code, "fxaa_toon"); g_pipe[P_SMAA_EDGE] = post_pipeline_for_renderpass( - vert, smaa_edge_code, sizeof(smaa_edge_code), g_smaa_rp, "smaa_edge"); + vert, smaa_edge_code, sizeof(smaa_edge_code), g_smaa_rp, "smaa_edge", g_pl); if (!g_pipe[P_SMAA_EDGE]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; } g_pipe[P_SMAA_WEIGHTS] = post_pipeline_for_renderpass( - vert, smaa_weights_code, sizeof(smaa_weights_code), g_smaa_rp, "smaa_weights"); + vert, smaa_weights_code, sizeof(smaa_weights_code), g_smaa_rp, "smaa_weights", g_pl); if (!g_pipe[P_SMAA_WEIGHTS]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; } MK(P_SMAA_BLEND, smaa_blend_code, "smaa_blend"); MK(P_TOON, toon_code, "toon"); @@ -499,9 +620,11 @@ static int objects_ensure(void) { MK(P_CRT, crt_code, "crt"); MK(P_DEBAND, deband_code, "deband"); #undef MK +#undef MKL g_vk.DestroyShaderModule(g_dev, vert, NULL); g_ready = 1; - droiddeck_log("effects", "chain ready: 16 pipelines (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, SMAA edge/weights/blend, Toon, HDR, NTSC, CRT, deband) on %s", vkp_gpu_name()); + droiddeck_log("effects", "chain ready: 16 pipelines (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, SMAA edge/weights/blend, Toon, HDR, NTSC, CRT, deband), %s upscalers%s, on %s", + half ? "half-precision" : "old fp32", g_nis_fast ? " + NIS luma prepass" : "", vkp_gpu_name()); return 0; fail: objects_destroy(); @@ -529,6 +652,8 @@ static void pass_renderpass(VkCommandBuffer cmd, VkRenderPass render_pass, g_vk.CmdBeginRenderPass(cmd, &rpi, VK_SUBPASS_CONTENTS_INLINE); g_vk.CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, p); g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl, 0, 1, &src, 0, NULL); + if (g_nis_fast && p == g_pipe[P_NIS] && g_coef_ds) /* nis3: coefficient banks at set 1 */ + g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl_nis, 1, 1, &g_coef_ds, 0, NULL); g_vk.CmdPushConstants(cmd, g_pl, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, pcsz, pc); g_vk.CmdDraw(cmd, 4, 1, 0, 0); g_vk.CmdEndRenderPass(cmd); @@ -633,7 +758,31 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce pc.vp[0] = 1.0f / (float)scene_w; pc.vp[1] = 1.0f / (float)scene_h; pc.vp[2] = (float)scene_w; pc.vp[3] = (float)scene_h; pc.edge = spatial == 7 ? sharp01 : 0.5f + sharp01 * 4.0f; - pass(cmd, g_pipe[spatial == 3 ? P_SGSR : spatial == 8 ? P_SGSR_HQ : P_NIS], dst, g_scene.ds, &pc, sizeof(pc)); + VkDescriptorSet src = g_scene.ds; + int nis_pipe = P_NIS; + if (spatial == 7 && g_nis_fast && + target_ensure(&g_nissrc, scene_w, scene_h, FX_SCRATCH_USAGE, "NIS luma") != 0) { + /* nis3 needs the prepass image; without it this frame takes SGSR from the scene + * instead of dropping every effect */ + static int warned; + if (!__atomic_exchange_n(&warned, 1, __ATOMIC_RELAXED)) + droiddeck_log("error", "effects: NIS luma target allocation failed; SGSR instead"); + nis_pipe = P_SGSR; + pc.edge = 0.5f + sharp01 * 4.0f; + } else if (spatial == 7 && g_nis_fast) { + /* NIS prepass: scene -> g_nissrc 1:1 (rgb + luma in alpha); only ndc is read. */ + struct pc_res pl = {0}; + SET_NDC(pl); + VkViewport scene_vp = {0, 0, (float)scene_w, (float)scene_h, 0, 1}; + VkRect2D scene_sc = {{0, 0}, {(uint32_t)scene_w, (uint32_t)scene_h}}; + g_vk.CmdSetViewport(cmd, 0, 1, &scene_vp); + g_vk.CmdSetScissor(cmd, 0, 1, &scene_sc); + pass(cmd, g_pipe[P_NIS_LUMA], &g_nissrc, g_scene.ds, &pl, sizeof(pl.ndc)); + g_vk.CmdSetViewport(cmd, 0, 1, &chain_vp); + g_vk.CmdSetScissor(cmd, 0, 1, &chain_sc); + src = g_nissrc.ds; + } + pass(cmd, g_pipe[spatial == 3 ? P_SGSR : spatial == 8 ? P_SGSR_HQ : nis_pipe], dst, src, &pc, sizeof(pc)); } else if (spatial == 6) { struct pc_rcas pc = {0}; SET_NDC(pc); From 9e98ed45dd6f0e2bad89cf63b952d9e11d471436 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:26:44 -0400 Subject: [PATCH 062/120] Fix right-stick scroll focus and compatibility handling --- .../com/droiddeck/launcher/FrontEndActivity.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index 3d3146a3f4..045124b701 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2111,7 +2111,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet override fun onWindowFocusChanged(hasFocus: Boolean) { super.onWindowFocusChanged(hasFocus) - if (!hasFocus) triggerKeys.cancel() + if (!hasFocus) { + triggerKeys.cancel() + stopRightStickScroll() + } if (hasFocus) { com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false) applyLauncherFullscreen() @@ -2216,7 +2219,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet private val rightStickScrollTick = object : Runnable { override fun run() { val deviceId = rightStickScrollDeviceId - if (!hasWindowFocus() || deviceId == android.view.InputDevice.INVALID_DEVICE_ID || + if (!hasWindowFocus() || (compatLaunch != null && !compatLaunch!!.loading.ended) || + deviceId == android.view.InputDevice.INVALID_DEVICE_ID || android.view.InputDevice.getDevice(deviceId) == null || kotlin.math.abs(rightStickScrollDeflection) < 0.55f) { stopRightStickScroll() @@ -2285,17 +2289,15 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet override fun dispatchGenericMotionEvent(event: android.view.MotionEvent): Boolean { if (compatLaunch != null && !compatLaunch!!.loading.ended && - com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return true + com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) { + stopRightStickScroll() + return true + } triggerKeys.onMotion(event) if (scrollPageWithRightStick(event)) return true return super.dispatchGenericMotionEvent(event) } - override fun onWindowFocusChanged(hasFocus: Boolean) { - super.onWindowFocusChanged(hasFocus) - if (!hasFocus) stopRightStickScroll() - } - override fun onPause() { stopRightStickScroll() compatLaunchVisible = false From 55d97d82fde612c935cca60a92198f72b540ac61 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:26:48 -0400 Subject: [PATCH 063/120] Handle unknown right-stick layout in mouse mode --- app/src/main/java/com/droiddeck/launcher/input/PadMouse.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/input/PadMouse.kt b/app/src/main/java/com/droiddeck/launcher/input/PadMouse.kt index dccba8a1b6..8f21ad67de 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/PadMouse.kt +++ b/app/src/main/java/com/droiddeck/launcher/input/PadMouse.kt @@ -90,7 +90,7 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S val sticks = physical.getOrPut(event.deviceId) { Sticks() } val device = event.device val wired = wiredLayout.getOrPut(event.deviceId) { PadBridge.wiredXboxLayout(device, event.source) } - val rxRyStick = PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts) + val rxRyStick = PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts) ?: false sticks.leftX = event.getAxisValue(MotionEvent.AXIS_X) sticks.leftY = event.getAxisValue(MotionEvent.AXIS_Y) sticks.rightX = scrollAxis(event, if (rxRyStick) MotionEvent.AXIS_RX else MotionEvent.AXIS_Z) From 771f7cb8c3cd3cc92f586641c61b5d515cca2918 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sat, 28 Nov 2026 23:00:48 -0400 Subject: [PATCH 064/120] Feat: Adds Screen zoom buttons in DD side menu (#3361) --- app/src/main/cpp/waylandcomp/src/compositor.c | 123 ++++++++++- app/src/main/cpp/waylandcomp/src/vk_present.c | 209 +++++++++++++++++- app/src/main/cpp/waylandcomp/src/vk_present.h | 2 + .../cpp/waylandcomp/src/waylandcomp_jni.c | 10 + .../com/droiddeck/launcher/SessionActivity.kt | 30 +++ .../droiddeck/launcher/input/InputProfile.kt | 2 +- .../launcher/session/SessionService.kt | 1 + .../launcher/session/SessionState.kt | 3 + .../launcher/ui/InputBindingWidgets.kt | 2 + .../droiddeck/launcher/ui/SessionOverlay.kt | 42 ++++ .../launcher/wayland/WaylandCompositor.java | 1 + .../main/res/values-ar/input_zoom_strings.xml | 5 + app/src/main/res/values-ar/strings.xml | 2 + .../values-b+es+419/input_zoom_strings.xml | 5 + .../main/res/values-bg/input_zoom_strings.xml | 5 + app/src/main/res/values-bg/strings.xml | 2 + .../main/res/values-cs/input_zoom_strings.xml | 5 + app/src/main/res/values-cs/strings.xml | 2 + .../main/res/values-da/input_zoom_strings.xml | 5 + app/src/main/res/values-da/strings.xml | 2 + .../main/res/values-de/input_zoom_strings.xml | 5 + app/src/main/res/values-de/strings.xml | 2 + .../main/res/values-el/input_zoom_strings.xml | 5 + app/src/main/res/values-el/strings.xml | 2 + .../main/res/values-es/input_zoom_strings.xml | 5 + app/src/main/res/values-es/strings.xml | 2 + .../main/res/values-fi/input_zoom_strings.xml | 5 + app/src/main/res/values-fi/strings.xml | 2 + .../main/res/values-fr/input_zoom_strings.xml | 5 + app/src/main/res/values-fr/strings.xml | 2 + .../main/res/values-hi/input_zoom_strings.xml | 5 + app/src/main/res/values-hi/strings.xml | 2 + .../main/res/values-hu/input_zoom_strings.xml | 5 + app/src/main/res/values-hu/strings.xml | 2 + .../main/res/values-in/input_zoom_strings.xml | 5 + app/src/main/res/values-in/strings.xml | 2 + .../main/res/values-it/input_zoom_strings.xml | 5 + app/src/main/res/values-it/strings.xml | 2 + .../main/res/values-ja/input_zoom_strings.xml | 5 + app/src/main/res/values-ja/strings.xml | 2 + .../main/res/values-ko/input_zoom_strings.xml | 5 + app/src/main/res/values-ko/strings.xml | 2 + .../main/res/values-ms/input_zoom_strings.xml | 5 + app/src/main/res/values-ms/strings.xml | 2 + .../main/res/values-nb/input_zoom_strings.xml | 5 + app/src/main/res/values-nb/strings.xml | 2 + .../main/res/values-nl/input_zoom_strings.xml | 5 + app/src/main/res/values-nl/strings.xml | 2 + .../main/res/values-pl/input_zoom_strings.xml | 5 + app/src/main/res/values-pl/strings.xml | 2 + .../res/values-pt-rPT/input_zoom_strings.xml | 5 + app/src/main/res/values-pt-rPT/strings.xml | 2 + app/src/main/res/values-pt/input_strings.xml | 2 + app/src/main/res/values-pt/strings.xml | 2 + .../main/res/values-ro/input_zoom_strings.xml | 5 + app/src/main/res/values-ro/strings.xml | 2 + .../main/res/values-ru/input_zoom_strings.xml | 5 + app/src/main/res/values-ru/strings.xml | 2 + .../main/res/values-sv/input_zoom_strings.xml | 5 + app/src/main/res/values-sv/strings.xml | 2 + .../main/res/values-th/input_zoom_strings.xml | 5 + app/src/main/res/values-th/strings.xml | 2 + .../main/res/values-tr/input_zoom_strings.xml | 5 + app/src/main/res/values-tr/strings.xml | 2 + .../main/res/values-uk/input_zoom_strings.xml | 5 + app/src/main/res/values-uk/strings.xml | 2 + .../main/res/values-vi/input_zoom_strings.xml | 5 + app/src/main/res/values-vi/strings.xml | 2 + .../res/values-zh-rCN/input_zoom_strings.xml | 5 + .../res/values-zh-rHK/input_zoom_strings.xml | 5 + .../res/values-zh-rTW/input_zoom_strings.xml | 5 + app/src/main/res/values/input_strings.xml | 2 + app/src/main/res/values/strings.xml | 2 + .../launcher/input/InputProfilesTest.kt | 2 + tools/tests/pen_pointer_harness.c | 16 +- tools/tests/test_output_refresh.py | 3 + 76 files changed, 650 insertions(+), 13 deletions(-) create mode 100644 app/src/main/res/values-ar/input_zoom_strings.xml create mode 100644 app/src/main/res/values-b+es+419/input_zoom_strings.xml create mode 100644 app/src/main/res/values-bg/input_zoom_strings.xml create mode 100644 app/src/main/res/values-cs/input_zoom_strings.xml create mode 100644 app/src/main/res/values-da/input_zoom_strings.xml create mode 100644 app/src/main/res/values-de/input_zoom_strings.xml create mode 100644 app/src/main/res/values-el/input_zoom_strings.xml create mode 100644 app/src/main/res/values-es/input_zoom_strings.xml create mode 100644 app/src/main/res/values-fi/input_zoom_strings.xml create mode 100644 app/src/main/res/values-fr/input_zoom_strings.xml create mode 100644 app/src/main/res/values-hi/input_zoom_strings.xml create mode 100644 app/src/main/res/values-hu/input_zoom_strings.xml create mode 100644 app/src/main/res/values-in/input_zoom_strings.xml create mode 100644 app/src/main/res/values-it/input_zoom_strings.xml create mode 100644 app/src/main/res/values-ja/input_zoom_strings.xml create mode 100644 app/src/main/res/values-ko/input_zoom_strings.xml create mode 100644 app/src/main/res/values-ms/input_zoom_strings.xml create mode 100644 app/src/main/res/values-nb/input_zoom_strings.xml create mode 100644 app/src/main/res/values-nl/input_zoom_strings.xml create mode 100644 app/src/main/res/values-pl/input_zoom_strings.xml create mode 100644 app/src/main/res/values-pt-rPT/input_zoom_strings.xml create mode 100644 app/src/main/res/values-ro/input_zoom_strings.xml create mode 100644 app/src/main/res/values-ru/input_zoom_strings.xml create mode 100644 app/src/main/res/values-sv/input_zoom_strings.xml create mode 100644 app/src/main/res/values-th/input_zoom_strings.xml create mode 100644 app/src/main/res/values-tr/input_zoom_strings.xml create mode 100644 app/src/main/res/values-uk/input_zoom_strings.xml create mode 100644 app/src/main/res/values-vi/input_zoom_strings.xml create mode 100644 app/src/main/res/values-zh-rCN/input_zoom_strings.xml create mode 100644 app/src/main/res/values-zh-rHK/input_zoom_strings.xml create mode 100644 app/src/main/res/values-zh-rTW/input_zoom_strings.xml diff --git a/app/src/main/cpp/waylandcomp/src/compositor.c b/app/src/main/cpp/waylandcomp/src/compositor.c index 98b5746037..c9eceed111 100644 --- a/app/src/main/cpp/waylandcomp/src/compositor.c +++ b/app/src/main/cpp/waylandcomp/src/compositor.c @@ -696,6 +696,8 @@ static struct surface *g_key_target; static struct surface *g_ime_click; static int g_input_pipe[2] = {-1, -1}; struct input_msg { int type; int p1; int p2; int p3; int p4; }; +static atomic_int g_zoom_request_percent = 100; +static atomic_int g_zoom_request_pending = 0; struct surface; static void constraints_surface_gone(struct surface *s); @@ -3544,6 +3546,15 @@ static void pointer_input(double x, double y, int relative, uint32_t button, int if (k) confine_clamp(k, &x, &y); g_ptr_x = x; g_ptr_y = y; g_ptr_known = 1; + if (relative && !button && (dx != 0.0 || dy != 0.0)) { + int ow, oh; + double ox, oy; + vkp_output_size(&ow, &oh); + if (ow > 0 && oh > 0 && + vkp_scene_to_output(g_ptr_x, g_ptr_y, &ox, &oy) && + vkp_zoom_pan_cursor(ox, oy)) + schedule_render(); + } if (atomic_load(&g_cursor_composite)) schedule_render(); if (k) { target = k->surface; @@ -3612,15 +3623,38 @@ static void pointer_button(uint32_t button, int pressed) { } static void deliver_pointer(const struct input_msg *m) { + static int last_x, last_y, last_valid; int w, h, ow, oh; double x, y; + int moved = last_valid && (m->p2 != last_x || m->p3 != last_y); + last_x = m->p2; + last_y = m->p3; + last_valid = 1; scene_size(&w, &h); vkp_output_size(&ow, &oh); - if (ow <= 0 || oh <= 0 || - !vkp_output_to_scene((double)m->p2 * ow / INPUT_SPACE_W, (double)m->p3 * oh / INPUT_SPACE_H, &x, &y)) { + + if (ow <= 0 || oh <= 0) { x = (double)m->p2 * w / INPUT_SPACE_W; y = (double)m->p3 * h / INPUT_SPACE_H; + } else { + double ox = (double)m->p2 * ow / INPUT_SPACE_W; + double oy = (double)m->p3 * oh / INPUT_SPACE_H; + if (m->p1 == 1 && !pointer_locked_for_cursor() && + (moved || ox <= 0.0 || oy <= 0.0 || ox >= ow || oy >= oh) && + vkp_zoom_pan_cursor(ox, oy)) + schedule_render(); + if (!vkp_output_to_scene(ox, oy, &x, &y)) { + schedule_render(); + if (g_ptr_known) { + x = g_ptr_x; + y = g_ptr_y; + } else { + x = (double)m->p2 * w / INPUT_SPACE_W; + y = (double)m->p3 * h / INPUT_SPACE_H; + } + } } + if (x < 0) x = 0; if (y < 0) y = 0; if (x > w - 1) x = w - 1; @@ -3632,6 +3666,7 @@ static void input_output_to_scene(double px, double py, double *x, double *y) { int w, h, ow, oh; scene_size(&w, &h); vkp_output_size(&ow, &oh); + if (ow <= 0 || oh <= 0 || !vkp_output_to_scene(px * ow / INPUT_SPACE_W, py * oh / INPUT_SPACE_H, x, y)) { *x = px * w / INPUT_SPACE_W; @@ -3855,12 +3890,63 @@ static void touch_up(int id, double x, double y) { } static void deliver_touch(const struct input_msg *m) { + static int last_x[MAX_TOUCH_POINTS], last_y[MAX_TOUCH_POINTS]; + static int pan_start_x[MAX_TOUCH_POINTS], pan_start_y[MAX_TOUCH_POINTS]; + static unsigned char last_valid[MAX_TOUCH_POINTS]; + static unsigned char pan_started[MAX_TOUCH_POINTS]; double x, y; + int id = m->p2; + int valid_id = id >= 0 && id < MAX_TOUCH_POINTS; + + if (valid_id && m->p1 == 0) { + pan_start_x[id] = m->p3; + pan_start_y[id] = m->p4; + pan_started[id] = 0; + } + if (valid_id && g_touch_points[id].surface && + m->p1 == 1 && last_valid[id] && !pan_started[id]) { + int dx = m->p3 - pan_start_x[id]; + int dy = m->p4 - pan_start_y[id]; + if (dx * dx + dy * dy >= 400) + pan_started[id] = 1; + } + if (valid_id && g_touch_points[id].surface && + m->p1 == 1 && pan_started[id] && last_valid[id] && + (m->p3 != last_x[id] || m->p4 != last_y[id])) { + int ow, oh; + vkp_output_size(&ow, &oh); + if (ow > 0 && oh > 0 && + vkp_zoom_pan_cursor((double)m->p3 * ow / INPUT_SPACE_W, + (double)m->p4 * oh / INPUT_SPACE_H)) + schedule_render(); + } + input_output_to_scene(m->p3, m->p4, &x, &y); - if (m->p1 == 0) touch_down(m->p2, x, y); - else if (m->p1 == 1) touch_motion(m->p2, x, y); - else if (m->p1 == 2) touch_up(m->p2, x, y); - else if (m->p1 == 3) touch_cancel_all(); + if (m->p1 == 0) { + if (valid_id) { + last_x[id] = m->p3; + last_y[id] = m->p4; + last_valid[id] = 1; + } + touch_down(id, x, y); + } else if (m->p1 == 1) { + if (valid_id) { + last_x[id] = m->p3; + last_y[id] = m->p4; + last_valid[id] = 1; + } + touch_motion(id, x, y); + } else if (m->p1 == 2) { + touch_up(id, x, y); + if (valid_id) { + last_valid[id] = 0; + pan_started[id] = 0; + } + } else if (m->p1 == 3) { + touch_cancel_all(); + memset(last_valid, 0, sizeof(last_valid)); + memset(pan_started, 0, sizeof(pan_started)); + } publish_query_state(); } @@ -4067,12 +4153,20 @@ static int on_input_readable(int fd, uint32_t mask, void *data) { case 11: axis_event(m.p1, m.p2, 0); break; case 12: axis_event(m.p1, m.p2, 1); break; case 13: deliver_pen(&m); break; + case 14: + atomic_store(&g_zoom_request_pending, 1); + break; case 20: stream_take(); break; case 21: if (!m.p1) stream_forget_all(); schedule_render(); break; case 22: schedule_render(); break; default: deliver_pointer(&m); break; } } + if (atomic_exchange(&g_zoom_request_pending, 0)) { + int zoom_percent = atomic_load(&g_zoom_request_percent); + vk_present_set_zoom((float)zoom_percent / 100.0f); + schedule_render(); + } if (atomic_exchange(&g_output_refresh_pending, 0) && atomic_load(&g_output_refresh_mhz) != g_output_announced_refresh_mhz) { output_notify_mode(); @@ -4096,6 +4190,23 @@ void droiddeck_wayland_set_scale_mode(int mode, int alignment) { (void)n; } +void droiddeck_wayland_set_zoom(int zoom_percent) { + if (zoom_percent < 100) zoom_percent = 100; + if (zoom_percent > 300) zoom_percent = 300; + if (g_input_pipe[1] < 0) { + vk_present_set_zoom((float)zoom_percent / 100.0f); + return; + } + atomic_store(&g_zoom_request_percent, zoom_percent); + atomic_store(&g_zoom_request_pending, 1); + struct input_msg m = { 14, zoom_percent, 0, 0, 0 }; + ssize_t n; + do { + n = write(g_input_pipe[1], &m, sizeof(m)); + } while (n < 0 && errno == EINTR); + (void)n; +} + void droiddeck_wayland_send_pointer(int action, int x, int y) { if (g_input_pipe[1] < 0) return; struct input_msg m = { 0, action, x, y, 0 }; diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.c b/app/src/main/cpp/waylandcomp/src/vk_present.c index 77da32baf7..9ca0e1d7c3 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.c +++ b/app/src/main/cpp/waylandcomp/src/vk_present.c @@ -268,13 +268,16 @@ static pthread_cond_t g_req_condition = PTHREAD_COND_INITIALIZER; static volatile int g_mode = VKP_MODE_STRETCH, g_align = VKP_ALIGN_CENTER; +static volatile float g_zoom = 1.0f; static struct { int scene_w, scene_h, out_w, out_h, mode, align; float kx, ky, off_x, off_y; + float base_kx, base_ky, base_off_x, base_off_y, zoom; int rx, ry, rw, rh; int valid; } g_map; +static pthread_mutex_t g_map_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t g_game_picture_lock = PTHREAD_MUTEX_INITIALIZER; static float g_game_picture_rect[4]; static int g_game_picture_placed; @@ -429,8 +432,21 @@ int vkp_completion_unknown(void) { return g_dev_state == -3; } void vk_present_set_scale_mode(int mode, int alignment) { if (mode < VKP_MODE_OFF || mode > VKP_MODE_INTEGER) mode = VKP_MODE_FIT; if (alignment < VKP_ALIGN_CENTER || alignment > VKP_ALIGN_PICTURE_RIGHT) alignment = VKP_ALIGN_CENTER; + pthread_mutex_lock(&g_map_lock); g_mode = mode; g_align = alignment; + pthread_mutex_unlock(&g_map_lock); +} + +void vk_present_set_zoom(float zoom) { + if (!(zoom >= 1.0f)) zoom = 1.0f; + if (zoom > 3.0f) zoom = 3.0f; + zoom = 1.0f + roundf((zoom - 1.0f) * 4.0f) * 0.25f; + pthread_mutex_lock(&g_map_lock); + if (g_zoom != zoom) { + g_zoom = zoom; + } + pthread_mutex_unlock(&g_map_lock); } static const char *mode_name(int m) { @@ -456,13 +472,18 @@ static const char *align_name(int a) { } static void update_map(int scene_w, int scene_h) { + pthread_mutex_lock(&g_map_lock); int mode = g_mode, align = g_align; + float zoom = g_zoom; int W = (int)g_extent.width, H = (int)g_extent.height; if (g_map.valid && g_map.scene_w == scene_w && g_map.scene_h == scene_h && g_map.out_w == W && - g_map.out_h == H && g_map.mode == mode && g_map.align == align) + g_map.out_h == H && g_map.mode == mode && g_map.align == align && g_map.zoom == zoom) { + pthread_mutex_unlock(&g_map_lock); return; + } + g_map.valid = 0; g_map.scene_w = scene_w; g_map.scene_h = scene_h; g_map.out_w = W; g_map.out_h = H; - g_map.mode = mode; g_map.align = align; + g_map.mode = mode; g_map.align = align; g_map.zoom = zoom; int half = H / 2; switch (align) { @@ -495,6 +516,82 @@ static void update_map(int scene_w, int scene_h) { else if (align == VKP_ALIGN_PICTURE_BOTTOM) g_map.off_y = H - scene_h * g_map.ky; else if (align == VKP_ALIGN_PICTURE_LEFT) g_map.off_x = 0; else if (align == VKP_ALIGN_PICTURE_RIGHT) g_map.off_x = W - scene_w * g_map.kx; + + g_map.base_kx = g_map.kx; + g_map.base_ky = g_map.ky; + g_map.base_off_x = g_map.off_x; + g_map.base_off_y = g_map.off_y; + + if (!(g_map.base_kx > 0.0f) || !(g_map.base_ky > 0.0f) || + !isfinite(g_map.base_kx) || !isfinite(g_map.base_ky) || + !isfinite(g_map.base_off_x) || !isfinite(g_map.base_off_y)) { + pthread_mutex_lock(&g_game_picture_lock); + g_game_picture_placed = 0; + pthread_mutex_unlock(&g_game_picture_lock); + pthread_mutex_unlock(&g_map_lock); + return; + } + + if (zoom > 1.0f) { + float cx = (float)g_map.rx + (float)g_map.rw * 0.5f; + float cy = (float)g_map.ry + (float)g_map.rh * 0.5f; + float image_w, image_h; + + g_map.kx = g_map.base_kx * zoom; + g_map.ky = g_map.base_ky * zoom; + image_w = scene_w * g_map.kx; + image_h = scene_h * g_map.ky; + + g_map.off_x = cx + (g_map.base_off_x - cx) * zoom; + g_map.off_y = cy + (g_map.base_off_y - cy) * zoom; + + if (image_w >= g_map.rw) { + float min_x = (float)g_map.rx + g_map.rw - image_w; + if (g_map.off_x < min_x) g_map.off_x = min_x; + if (g_map.off_x > g_map.rx) g_map.off_x = (float)g_map.rx; + } else { + g_map.off_x = (float)g_map.rx + (g_map.rw - image_w) * 0.5f; + } + + if (image_h >= g_map.rh) { + float min_y = (float)g_map.ry + g_map.rh - image_h; + if (g_map.off_y < min_y) g_map.off_y = min_y; + if (g_map.off_y > g_map.ry) g_map.off_y = (float)g_map.ry; + } else { + g_map.off_y = (float)g_map.ry + (g_map.rh - image_h) * 0.5f; + } + } + + if (zoom > 1.0f && + (!(g_map.kx > 0.0f) || !(g_map.ky > 0.0f) || + !isfinite(g_map.kx) || !isfinite(g_map.ky) || + !isfinite(g_map.off_x) || !isfinite(g_map.off_y))) { + if (g_map.base_kx > 0.0f && g_map.base_ky > 0.0f && + isfinite(g_map.base_kx) && isfinite(g_map.base_ky) && + isfinite(g_map.base_off_x) && isfinite(g_map.base_off_y)) { + g_map.kx = g_map.base_kx; + g_map.ky = g_map.base_ky; + g_map.off_x = g_map.base_off_x; + g_map.off_y = g_map.base_off_y; + } else { + pthread_mutex_lock(&g_game_picture_lock); + g_game_picture_placed = 0; + pthread_mutex_unlock(&g_game_picture_lock); + pthread_mutex_unlock(&g_map_lock); + return; + } + } + + if (!(g_map.kx > 0.0f) || !(g_map.ky > 0.0f) || + !isfinite(g_map.kx) || !isfinite(g_map.ky) || + !isfinite(g_map.off_x) || !isfinite(g_map.off_y)) { + pthread_mutex_lock(&g_game_picture_lock); + g_game_picture_placed = 0; + pthread_mutex_unlock(&g_game_picture_lock); + pthread_mutex_unlock(&g_map_lock); + return; + } + g_map.valid = 1; pthread_mutex_lock(&g_game_picture_lock); g_game_picture_placed = mode == VKP_MODE_INTEGER || align == VKP_ALIGN_PICTURE_TOP || align == VKP_ALIGN_PICTURE_BOTTOM || align == VKP_ALIGN_PICTURE_LEFT || align == VKP_ALIGN_PICTURE_RIGHT; @@ -507,6 +604,7 @@ static void update_map(int scene_w, int scene_h) { mode_name(mode), align_name(align), scene_w, scene_h, (int)(scene_w * g_map.kx + 0.5f), (int)(scene_h * g_map.ky + 0.5f), (int)g_map.off_x, (int)g_map.off_y, W, H); + pthread_mutex_unlock(&g_map_lock); } int vkp_game_picture_rect(float rect[4]) { @@ -518,16 +616,26 @@ int vkp_game_picture_rect(float rect[4]) { } int vkp_output_to_scene(double ox, double oy, double *sx, double *sy) { - if (!g_map.valid || g_map.kx <= 0 || g_map.ky <= 0) return 0; + pthread_mutex_lock(&g_map_lock); + if (!g_map.valid || g_map.kx <= 0 || g_map.ky <= 0) { + pthread_mutex_unlock(&g_map_lock); + return 0; + } *sx = (ox - g_map.off_x) / g_map.kx; *sy = (oy - g_map.off_y) / g_map.ky; + pthread_mutex_unlock(&g_map_lock); return 1; } int vkp_scene_to_output(double sx, double sy, double *ox, double *oy) { - if (!g_map.valid || g_map.kx <= 0 || g_map.ky <= 0) return 0; + pthread_mutex_lock(&g_map_lock); + if (!g_map.valid || g_map.kx <= 0 || g_map.ky <= 0) { + pthread_mutex_unlock(&g_map_lock); + return 0; + } *ox = sx * g_map.kx + g_map.off_x; *oy = sy * g_map.ky + g_map.off_y; + pthread_mutex_unlock(&g_map_lock); return 1; } @@ -536,6 +644,99 @@ void vkp_output_size(int *w, int *h) { *h = (int)g_extent.height; } +int vkp_zoom_pan_cursor(double ox, double oy) { + double cursor_x, cursor_y; + float next_x, next_y; + float image_w, image_h; + int changed; + + pthread_mutex_lock(&g_map_lock); + if (!g_map.valid || g_map.zoom != g_zoom || g_map.mode != g_mode || + g_map.align != g_align || g_zoom <= 1.0f || g_zoom > 3.0f || + g_map.scene_w <= 0 || g_map.scene_h <= 0 || + g_map.rw <= 0 || g_map.rh <= 0 || + g_map.base_kx <= 0.0f || g_map.base_ky <= 0.0f || + g_map.kx <= 0.0f || g_map.ky <= 0.0f || + !isfinite(g_map.base_kx) || !isfinite(g_map.base_ky) || + !isfinite(g_map.kx) || !isfinite(g_map.ky) || + !isfinite(g_map.off_x) || !isfinite(g_map.off_y)) { + pthread_mutex_unlock(&g_map_lock); + return 0; + } + + if (!isfinite(ox) || !isfinite(oy)) { + pthread_mutex_unlock(&g_map_lock); + return 0; + } + + cursor_x = (ox - g_map.off_x) / g_map.kx; + cursor_y = (oy - g_map.off_y) / g_map.ky; + + if (cursor_x < 0.0) cursor_x = 0.0; + if (cursor_y < 0.0) cursor_y = 0.0; + if (cursor_x > g_map.scene_w - 1) cursor_x = g_map.scene_w - 1; + if (cursor_y > g_map.scene_h - 1) cursor_y = g_map.scene_h - 1; + + next_x = g_map.off_x; + next_y = g_map.off_y; + image_w = g_map.scene_w * g_map.kx; + image_h = g_map.scene_h * g_map.ky; + + if (image_w > g_map.rw) { + float left = ((float)g_map.rx - g_map.off_x) / g_map.kx; + float right = ((float)(g_map.rx + g_map.rw) - g_map.off_x) / g_map.kx; + float margin = (right - left) * 0.2f; + + if (cursor_x < left + margin) + next_x += (float)(left + margin - cursor_x) * g_map.kx * 0.5f; + else if (cursor_x > right - margin) + next_x -= (float)(cursor_x - (right - margin)) * g_map.kx * 0.5f; + + float min_x = (float)g_map.rx + g_map.rw - image_w; + if (next_x < min_x) next_x = min_x; + if (next_x > g_map.rx) next_x = (float)g_map.rx; + } + + if (image_h > g_map.rh) { + float top = ((float)g_map.ry - g_map.off_y) / g_map.ky; + float bottom = ((float)(g_map.ry + g_map.rh) - g_map.off_y) / g_map.ky; + float margin = (bottom - top) * 0.2f; + + if (cursor_y < top + margin) + next_y += (float)(top + margin - cursor_y) * g_map.ky * 0.5f; + else if (cursor_y > bottom - margin) + next_y -= (float)(cursor_y - (bottom - margin)) * g_map.ky * 0.5f; + + float min_y = (float)g_map.ry + g_map.rh - image_h; + if (next_y < min_y) next_y = min_y; + if (next_y > g_map.ry) next_y = (float)g_map.ry; + } + + if (!isfinite(next_x) || !isfinite(next_y)) { + pthread_mutex_unlock(&g_map_lock); + return 0; + } + + changed = fabsf(next_x - g_map.off_x) >= 0.5f || + fabsf(next_y - g_map.off_y) >= 0.5f; + if (!changed) { + pthread_mutex_unlock(&g_map_lock); + return 0; + } + + g_map.off_x = next_x; + g_map.off_y = next_y; + + pthread_mutex_lock(&g_game_picture_lock); + g_game_picture_rect[0] = g_map.off_x; + g_game_picture_rect[1] = g_map.off_y; + g_game_picture_rect[2] = g_map.off_x + g_map.scene_w * g_map.kx; + g_game_picture_rect[3] = g_map.off_y + g_map.scene_h * g_map.ky; + pthread_mutex_unlock(&g_game_picture_lock); + pthread_mutex_unlock(&g_map_lock); + return 1; +} + static void init_black_image(void); static int has_ext(VkExtensionProperties *e, uint32_t n, const char *name) { diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.h b/app/src/main/cpp/waylandcomp/src/vk_present.h index 69af7dca23..bc35ac8b49 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.h +++ b/app/src/main/cpp/waylandcomp/src/vk_present.h @@ -20,6 +20,8 @@ enum vkp_align { VKP_ALIGN_CENTER = 0, VKP_ALIGN_TOP = 1, VKP_ALIGN_BOTTOM = 2, VKP_ALIGN_PICTURE_TOP = 3, VKP_ALIGN_PICTURE_BOTTOM = 4, VKP_ALIGN_PICTURE_LEFT = 5, VKP_ALIGN_PICTURE_RIGHT = 6 }; void vk_present_set_scale_mode(int mode, int alignment); +void vk_present_set_zoom(float zoom); +int vkp_zoom_pan_cursor(double ox, double oy); int vkp_game_picture_rect(float rect[4]); int vkp_output_to_scene(double ox, double oy, double *sx, double *sy); int vkp_scene_to_output(double sx, double sy, double *ox, double *oy); diff --git a/app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c b/app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c index 308332f9b1..d070b8fd6f 100644 --- a/app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c +++ b/app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c @@ -22,6 +22,7 @@ extern int droiddeck_wayland_run(void); extern void droiddeck_wayland_set_scale_mode(int mode, int alignment); +extern void droiddeck_wayland_set_zoom(int zoom_percent); extern void droiddeck_wayland_send_pointer(int action, int x, int y); extern void droiddeck_wayland_send_touch(int action, int pointer_id, int x, int y); extern void droiddeck_wayland_send_pen(int flags, int x, int y); @@ -511,6 +512,15 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetScaleMode(JNIEnv __android_log_print(ANDROID_LOG_INFO, TAG, "scale mode %d alignment %d", mode, alignment); } +JNIEXPORT void JNICALL +Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetZoom(JNIEnv *env, jclass clazz, jfloat zoom) { + (void)env; + (void)clazz; + if (!(zoom >= 1.0f)) zoom = 1.0f; + if (zoom > 3.0f) zoom = 3.0f; + droiddeck_wayland_set_zoom((int)(zoom * 100.0f + 0.5f)); +} + JNIEXPORT jboolean JNICALL Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeGamePictureRect(JNIEnv *env, jclass clazz, jfloatArray out) { diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index da291701f4..11fd6b86f2 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -179,6 +179,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde private var quickButtons by mutableStateOf>(emptyMap()) private var picturePosition by mutableStateOf("center") private var integerScaling by mutableStateOf(false) + private var gameZoom by mutableStateOf(SessionState.gameZoom) private var avoidNotch = false private fun applyNotchInset(insets: android.view.WindowInsets? = window.decorView.rootWindowInsets) { @@ -265,6 +266,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde InputCommand.KEYBOARD -> if (role == InputRole.PRIMARY || secondScreenPresentation?.showKeyboard() != true) togglePcKeyboard() InputCommand.STEAM -> tapSteamButton() InputCommand.QUICK_ACCESS -> tapQam() + InputCommand.GAME_ZOOM_IN -> { + gameZoom = (gameZoom + 0.25f).coerceAtMost(3.0f) + SessionState.gameZoom = gameZoom + runCatching { WaylandCompositor.nativeSetZoom(gameZoom) } + } + InputCommand.GAME_ZOOM_OUT -> { + gameZoom = (gameZoom - 0.25f).coerceAtLeast(1.0f) + SessionState.gameZoom = gameZoom + runCatching { WaylandCompositor.nativeSetZoom(gameZoom) } + } } } } @@ -1154,6 +1165,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde isFocusableInTouchMode = true defaultFocusHighlightEnabled = false setContent { + androidx.compose.runtime.LaunchedEffect(SessionState.running, SessionState.sessionId) { + if (SessionState.running) { + gameZoom = SessionState.gameZoom + runCatching { WaylandCompositor.nativeSetZoom(gameZoom) } + } else { + gameZoom = 1.0f + SessionState.gameZoom = 1.0f + runCatching { WaylandCompositor.nativeSetZoom(1.0f) } + } + } + val activeEffectsProfileId = currentScreenEffectsProfileId() val effectsEditorTarget = if (drawerOpen) screenEffectsTarget else null val effectsEditorProfileId = activeEffectsProfileId.takeIf { @@ -1221,6 +1243,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde CursorOverlay({ cursorPos }, cursorVisible && (!cursorHidden || onlyPcKeyboardOpen()) && !bottomOutputActive, resources.displayMetrics.density, cursorImage, cursorHotX, cursorHotY, cursorImageScale) + if (memoryHud.text.isNotEmpty()) HudText(memoryHud.text, hudColor, hudOpacity) if (bottomOutputActive && !loading.visible) SwappedTopPanel() val phonePanel = glassesOutputActive && !loading.visible && !drawerOpen && !pcKeyboardOpen @@ -1596,6 +1619,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde onHudReset = { hudConfig = DroidDeckHudConfig.reset(this@SessionActivity); hud.applyConfig() }, onHudOrderReset = { hudConfig = DroidDeckHudConfig.clearOrder(this@SessionActivity); hud.applyConfig() }, onHudExport = { exportHudDiagnostics() }, + gameZoomAvailable = SessionState.running, + gameZoom = gameZoom, + onGameZoom = { value -> + gameZoom = value.coerceIn(1.0f, 3.0f) + SessionState.gameZoom = gameZoom + runCatching { WaylandCompositor.nativeSetZoom(gameZoom) } + }, integerScaling = integerScaling, onIntegerScaling = { enabled -> SessionPrefs.setIntegerScaling(this@SessionActivity, enabled) diff --git a/app/src/main/java/com/droiddeck/launcher/input/InputProfile.kt b/app/src/main/java/com/droiddeck/launcher/input/InputProfile.kt index f17076e7ca..e988c39d92 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/InputProfile.kt +++ b/app/src/main/java/com/droiddeck/launcher/input/InputProfile.kt @@ -21,7 +21,7 @@ enum class InputControl(val id: String, val label: String, val dimensions: Int = } } -enum class InputCommand { MENU, KEYBOARD, STEAM, QUICK_ACCESS } +enum class InputCommand { MENU, KEYBOARD, STEAM, QUICK_ACCESS, GAME_ZOOM_IN, GAME_ZOOM_OUT } sealed interface InputAction { data class Native(val target: InputControl? = null) : InputAction diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index 4bb27642e6..18b3d5b4e8 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -420,6 +420,7 @@ class SessionService : Service() { val gen = synchronized(SessionState.startLock) { synchronized(stopLock) { SessionState.steamClientArch = null + SessionState.gameZoom = 1.0f SessionState.running = true ++sessionGen } diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionState.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionState.kt index 92255febec..ac62bde46c 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionState.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionState.kt @@ -47,6 +47,9 @@ object SessionState { @Volatile var running = false + /** Zoom level retained across activity recreation for the active session. */ + @Volatile + var gameZoom = 1.0f @Volatile var activityDisplayId = 0 @Volatile diff --git a/app/src/main/java/com/droiddeck/launcher/ui/InputBindingWidgets.kt b/app/src/main/java/com/droiddeck/launcher/ui/InputBindingWidgets.kt index a8eb95b347..23302a090c 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/InputBindingWidgets.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/InputBindingWidgets.kt @@ -33,6 +33,8 @@ internal fun commandLabel(command: InputCommand) = stringResource(when (command) InputCommand.KEYBOARD -> R.string.input_command_keyboard InputCommand.STEAM -> R.string.input_command_steam InputCommand.QUICK_ACCESS -> R.string.input_command_qam + InputCommand.GAME_ZOOM_IN -> R.string.input_command_zoom_in + InputCommand.GAME_ZOOM_OUT -> R.string.input_command_zoom_out }) @Composable diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt index 296040787b..ae00595556 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SessionOverlay.kt @@ -258,6 +258,9 @@ class DrawerActions( val upscaleSharpness: Int = 75, val integerScaling: Boolean = false, val onIntegerScaling: (Boolean) -> Unit = {}, + val gameZoomAvailable: Boolean = false, + val gameZoom: Float = 1.0f, + val onGameZoom: (Float) -> Unit = {}, val effects: ScreenEffects = ScreenEffects.OFF, val screenEffectsTarget: String = "auto", val screenEffectsTargets: List> = emptyList(), @@ -665,6 +668,45 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont SessionDrawerPage.HUD -> DroidDeckHudSettings(host, a) { key -> focus.track(page, key) } SessionDrawerPage.DISPLAY -> { SettingsGroup(stringResource(R.string.drawer_page_display)) { + if (a.gameZoomAvailable) SettingsRow( + stringResource(R.string.game_zoom_title), + stringResource(R.string.game_zoom_hint), + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(4.dp), + ) { + val zoomOutEnabled = a.gameZoom > 1.0f + val zoomInEnabled = a.gameZoom < 3.0f + val zoomResetEnabled = a.gameZoom > 1.0f + val zoomOut = { a.onGameZoom((a.gameZoom - 0.25f).coerceAtLeast(1.0f)) } + val zoomIn = { a.onGameZoom((a.gameZoom + 0.25f).coerceAtMost(3.0f)) } + val zoomReset = { a.onGameZoom(1.0f) } + + OutlinedButton( + onClick = zoomOut, + enabled = zoomOutEnabled, + modifier = focus.track(page, "game-zoom-out").width(42.dp) + .controllerConfirm(enabled = zoomOutEnabled, onClick = zoomOut), + contentPadding = PaddingValues(horizontal = 4.dp, vertical = 0.dp), + ) { Text("−") } + Text("${(a.gameZoom * 100.0f).toInt()}%", fontSize = 12.sp) + OutlinedButton( + onClick = zoomIn, + enabled = zoomInEnabled, + modifier = focus.track(page, "game-zoom-in").width(42.dp) + .controllerConfirm(enabled = zoomInEnabled, onClick = zoomIn), + contentPadding = PaddingValues(horizontal = 4.dp, vertical = 0.dp), + ) { Text("+") } + OutlinedButton( + onClick = zoomReset, + enabled = zoomResetEnabled, + modifier = focus.track(page, "game-zoom-reset").width(48.dp) + .controllerConfirm(enabled = zoomResetEnabled, onClick = zoomReset), + contentPadding = PaddingValues(horizontal = 2.dp, vertical = 0.dp), + ) { Text("1×") } + } + } val fgOpen = host.open == "fg" val offLabel = stringResource(R.string.frame_gen_off) val fgLabel = FrameGen.label(LocalContext.current, a.frameGen) diff --git a/app/src/main/java/com/droiddeck/launcher/wayland/WaylandCompositor.java b/app/src/main/java/com/droiddeck/launcher/wayland/WaylandCompositor.java index 4e824f6dba..afe0df226f 100644 --- a/app/src/main/java/com/droiddeck/launcher/wayland/WaylandCompositor.java +++ b/app/src/main/java/com/droiddeck/launcher/wayland/WaylandCompositor.java @@ -371,6 +371,7 @@ public final class WaylandCompositor { public static native void nativeHdrNoteHeadroomRequest(float ratio); public static native void nativeSetScaleMode(int fullscreenMode, int screenAlignment); + public static native void nativeSetZoom(float zoom); public static native void nativeSetUpscaler(int mode); diff --git a/app/src/main/res/values-ar/input_zoom_strings.xml b/app/src/main/res/values-ar/input_zoom_strings.xml new file mode 100644 index 0000000000..c96953f664 --- /dev/null +++ b/app/src/main/res/values-ar/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + تكبير عرض اللعبة + تصغير عرض اللعبة + \ No newline at end of file diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 41e7b0f1f7..84d4fc1e30 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -4305,4 +4305,6 @@ أغلق Steam أولاً أوقف تنزيل Steam مؤقتًا أولاً تثبّت هذه اللعبة إصدار Linux الخاص بها. ثبّتها من Steam. + تكبير اللعبة + اضبط تكبير اللعبة من 100% إلى 300% diff --git a/app/src/main/res/values-b+es+419/input_zoom_strings.xml b/app/src/main/res/values-b+es+419/input_zoom_strings.xml new file mode 100644 index 0000000000..b3a9fa6ce7 --- /dev/null +++ b/app/src/main/res/values-b+es+419/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Aumentar el zoom del juego + Reducir el zoom del juego + \ No newline at end of file diff --git a/app/src/main/res/values-bg/input_zoom_strings.xml b/app/src/main/res/values-bg/input_zoom_strings.xml new file mode 100644 index 0000000000..22cd636040 --- /dev/null +++ b/app/src/main/res/values-bg/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Увеличаване на мащаба на играта + Намаляване на мащаба на играта + \ No newline at end of file diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index f7e4f83944..84a2d916ec 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -4145,4 +4145,6 @@ Първо затворете Steam Първо поставете на пауза изтеглянето от Steam Тази игра инсталира версията си за Linux. Инсталирайте я от Steam. + Мащабиране на играта + Регулирайте увеличението на играта от 100% до 300% diff --git a/app/src/main/res/values-cs/input_zoom_strings.xml b/app/src/main/res/values-cs/input_zoom_strings.xml new file mode 100644 index 0000000000..a5fb0ad850 --- /dev/null +++ b/app/src/main/res/values-cs/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Zvětšit přiblížení hry + Zmenšit přiblížení hry + \ No newline at end of file diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index fa3e3c0adc..d18f09faa1 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -4225,4 +4225,6 @@ Nejprve zavřete Steam Nejprve pozastavte stahování ze Steamu Tato hra instaluje svou verzi pro Linux. Nainstalujte ji ze Steamu. + Přiblížení hry + Nastavte zvětšení hry od 100 % do 300 % diff --git a/app/src/main/res/values-da/input_zoom_strings.xml b/app/src/main/res/values-da/input_zoom_strings.xml new file mode 100644 index 0000000000..3e09248776 --- /dev/null +++ b/app/src/main/res/values-da/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Forøg spillets zoom + Formindsk spillets zoom + \ No newline at end of file diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index be75ef09c6..48e476a0a6 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -4145,4 +4145,6 @@ Luk Steam først Sæt Steam-downloaden på pause først Dette spil installerer sin Linux-version. Installer det fra Steam. + Spilzoom + Juster spillets forstørrelse fra 100 % til 300 % diff --git a/app/src/main/res/values-de/input_zoom_strings.xml b/app/src/main/res/values-de/input_zoom_strings.xml new file mode 100644 index 0000000000..1abf75bd99 --- /dev/null +++ b/app/src/main/res/values-de/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Spielzoom vergrößern + Spielzoom verkleinern + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 3488b58e01..cee30dc25d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -4145,4 +4145,6 @@ Schließe zuerst Steam Pausiere zuerst den Steam-Download Dieses Spiel installiert seine Linux-Version. Installiere es über Steam. + Spielzoom + Spielvergrößerung von 100 % bis 300 % anpassen diff --git a/app/src/main/res/values-el/input_zoom_strings.xml b/app/src/main/res/values-el/input_zoom_strings.xml new file mode 100644 index 0000000000..2600c24f56 --- /dev/null +++ b/app/src/main/res/values-el/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Αύξηση ζουμ παιχνιδιού + Μείωση ζουμ παιχνιδιού + \ No newline at end of file diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 0eee9609ef..b3f81ca591 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -4145,4 +4145,6 @@ Κλείστε πρώτα το Steam Θέστε πρώτα σε παύση τη λήψη του Steam Αυτό το παιχνίδι εγκαθιστά την έκδοσή του για Linux. Εγκαταστήστε το από το Steam. + Ζουμ παιχνιδιού + Ρυθμίστε τη μεγέθυνση του παιχνιδιού από 100% έως 300% diff --git a/app/src/main/res/values-es/input_zoom_strings.xml b/app/src/main/res/values-es/input_zoom_strings.xml new file mode 100644 index 0000000000..b3a9fa6ce7 --- /dev/null +++ b/app/src/main/res/values-es/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Aumentar el zoom del juego + Reducir el zoom del juego + \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 3ad2ed95f8..2d2a4244a4 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -4185,4 +4185,6 @@ Cierra Steam primero Pausa primero la descarga de Steam Este juego instala su versión para Linux. Instálalo desde Steam. + Zoom del juego + Ajusta la ampliación del juego del 100 % al 300 % diff --git a/app/src/main/res/values-fi/input_zoom_strings.xml b/app/src/main/res/values-fi/input_zoom_strings.xml new file mode 100644 index 0000000000..497213995a --- /dev/null +++ b/app/src/main/res/values-fi/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Suurenna pelin zoomausta + Pienennä pelin zoomausta + \ No newline at end of file diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index d15dd0f149..7a11c6eaa2 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -4145,4 +4145,6 @@ Sulje Steam ensin Keskeytä Steam-lataus ensin Tämä peli asentaa Linux-versionsa. Asenna se Steamista. + Pelin zoomaus + Säädä pelin suurennusta välillä 100–300 % diff --git a/app/src/main/res/values-fr/input_zoom_strings.xml b/app/src/main/res/values-fr/input_zoom_strings.xml new file mode 100644 index 0000000000..be77bcaf05 --- /dev/null +++ b/app/src/main/res/values-fr/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Augmenter le zoom du jeu + Réduire le zoom du jeu + \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 136b893d15..4326efc5a5 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -4184,4 +4184,6 @@ Fermez d\'abord Steam Mettez d\'abord en pause le téléchargement Steam Ce jeu installe sa version Linux. Installez-le depuis Steam. + Zoom du jeu + Réglez le grossissement du jeu de 100 % à 300 % diff --git a/app/src/main/res/values-hi/input_zoom_strings.xml b/app/src/main/res/values-hi/input_zoom_strings.xml new file mode 100644 index 0000000000..c4d12e84e1 --- /dev/null +++ b/app/src/main/res/values-hi/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + गेम ज़ूम बढ़ाएँ + गेम ज़ूम घटाएँ + \ No newline at end of file diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 64125494a5..325e643f0d 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -4145,4 +4145,6 @@ पहले Steam बंद करें पहले Steam डाउनलोड रोकें यह गेम अपना Linux संस्करण इंस्टॉल करता है। इसे Steam से इंस्टॉल करें। + गेम ज़ूम + गेम का ज़ूम 100% से 300% तक समायोजित करें diff --git a/app/src/main/res/values-hu/input_zoom_strings.xml b/app/src/main/res/values-hu/input_zoom_strings.xml new file mode 100644 index 0000000000..743e49fd58 --- /dev/null +++ b/app/src/main/res/values-hu/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Játék nagyítása + Játék kicsinyítése + \ No newline at end of file diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index eab624a92c..977f9c68a4 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -4145,4 +4145,6 @@ Előbb zárd be a Steamet Előbb szüneteltesd a Steam-letöltést Ez a játék a Linux-verzióját telepíti. Telepítsd a Steamből. + Játék nagyítása + A játék nagyításának beállítása 100% és 300% között diff --git a/app/src/main/res/values-in/input_zoom_strings.xml b/app/src/main/res/values-in/input_zoom_strings.xml new file mode 100644 index 0000000000..dd4cb60c5f --- /dev/null +++ b/app/src/main/res/values-in/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Perbesar zoom game + Perkecil zoom game + \ No newline at end of file diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 2ab5c77951..de40e848c0 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -4115,4 +4115,6 @@ Tutup Steam terlebih dahulu Jeda unduhan Steam terlebih dahulu Game ini memasang versi Linux-nya. Pasang dari Steam. + Zoom game + Sesuaikan pembesaran game dari 100% hingga 300% diff --git a/app/src/main/res/values-it/input_zoom_strings.xml b/app/src/main/res/values-it/input_zoom_strings.xml new file mode 100644 index 0000000000..124ed96d1b --- /dev/null +++ b/app/src/main/res/values-it/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Aumenta lo zoom del gioco + Riduci lo zoom del gioco + \ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 0b74e3e788..8c0ea88499 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -4184,4 +4184,6 @@ Chiudi prima Steam Metti prima in pausa il download di Steam Questo gioco installa la sua versione Linux. Installalo da Steam. + Zoom del gioco + Regola l\'ingrandimento del gioco dal 100% al 300% diff --git a/app/src/main/res/values-ja/input_zoom_strings.xml b/app/src/main/res/values-ja/input_zoom_strings.xml new file mode 100644 index 0000000000..1d82a23541 --- /dev/null +++ b/app/src/main/res/values-ja/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + ゲームのズームを拡大 + ゲームのズームを縮小 + \ No newline at end of file diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 74b7308fa8..be2b3f88a8 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -4115,4 +4115,6 @@ 先に Steam を閉じてください 先に Steam のダウンロードを一時停止してください このゲームは Linux 版をインストールします。Steam からインストールしてください。 + ゲームズーム + ゲームの拡大率を100%から300%の間で調整します diff --git a/app/src/main/res/values-ko/input_zoom_strings.xml b/app/src/main/res/values-ko/input_zoom_strings.xml new file mode 100644 index 0000000000..3011ee320d --- /dev/null +++ b/app/src/main/res/values-ko/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + 게임 확대 + 게임 축소 + \ No newline at end of file diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 0c8a99abfe..3e01fad6aa 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -4115,4 +4115,6 @@ 먼저 Steam을 닫으세요 먼저 Steam 다운로드를 일시 중지하세요 이 게임은 Linux 버전을 설치합니다. Steam에서 설치하세요. + 게임 확대 + 게임 확대율을 100%에서 300%까지 조정합니다 diff --git a/app/src/main/res/values-ms/input_zoom_strings.xml b/app/src/main/res/values-ms/input_zoom_strings.xml new file mode 100644 index 0000000000..b95bb1d04a --- /dev/null +++ b/app/src/main/res/values-ms/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Besarkan zum permainan + Kecilkan zum permainan + \ No newline at end of file diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml index 8754e6605b..ed95fc2b84 100644 --- a/app/src/main/res/values-ms/strings.xml +++ b/app/src/main/res/values-ms/strings.xml @@ -4115,4 +4115,6 @@ Tutup Steam dahulu Jeda muat turun Steam dahulu Permainan ini memasang versi Linuxnya. Pasang daripada Steam. + Zum permainan + Laraskan pembesaran permainan daripada 100% hingga 300% diff --git a/app/src/main/res/values-nb/input_zoom_strings.xml b/app/src/main/res/values-nb/input_zoom_strings.xml new file mode 100644 index 0000000000..44773d82e5 --- /dev/null +++ b/app/src/main/res/values-nb/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Øk spillzoom + Reduser spillzoom + \ No newline at end of file diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 580b3a3616..9857e2440c 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -4145,4 +4145,6 @@ Lukk Steam først Sett Steam-nedlastingen på pause først Dette spillet installerer Linux-versjonen sin. Installer det fra Steam. + Spillzoom + Juster spillforstørrelsen fra 100 % til 300 % diff --git a/app/src/main/res/values-nl/input_zoom_strings.xml b/app/src/main/res/values-nl/input_zoom_strings.xml new file mode 100644 index 0000000000..813a289b53 --- /dev/null +++ b/app/src/main/res/values-nl/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Gamezoom vergroten + Gamezoom verkleinen + \ No newline at end of file diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 3ddd3a2e68..90abb15137 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -4145,4 +4145,6 @@ Sluit eerst Steam Pauzeer eerst de Steam-download Deze game installeert zijn Linux-versie. Installeer hem via Steam. + Gamezoom + Pas de spelvergroting aan van 100% tot 300% diff --git a/app/src/main/res/values-pl/input_zoom_strings.xml b/app/src/main/res/values-pl/input_zoom_strings.xml new file mode 100644 index 0000000000..00a3bca314 --- /dev/null +++ b/app/src/main/res/values-pl/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Zwiększ powiększenie gry + Zmniejsz powiększenie gry + \ No newline at end of file diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index e55e3e728a..4b75546761 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -4225,4 +4225,6 @@ Najpierw zamknij Steam Najpierw wstrzymaj pobieranie ze Steam Ta gra instaluje swoją wersję dla Linuksa. Zainstaluj ją ze Steama. + Powiększenie gry + Dostosuj powiększenie gry w zakresie od 100% do 300% diff --git a/app/src/main/res/values-pt-rPT/input_zoom_strings.xml b/app/src/main/res/values-pt-rPT/input_zoom_strings.xml new file mode 100644 index 0000000000..c19cb15a1f --- /dev/null +++ b/app/src/main/res/values-pt-rPT/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Aumentar o zoom do jogo + Diminuir o zoom do jogo + \ No newline at end of file diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index a63f9ca015..7b4a1207d1 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -4184,4 +4184,6 @@ Feche primeiro o Steam Coloque primeiro em pausa a transferência do Steam Este jogo instala a sua versão para Linux. Instale-o a partir do Steam. + Zoom do jogo + Ajuste a ampliação do jogo de 100% a 300% diff --git a/app/src/main/res/values-pt/input_strings.xml b/app/src/main/res/values-pt/input_strings.xml index 5847aa3ac4..501f635363 100644 --- a/app/src/main/res/values-pt/input_strings.xml +++ b/app/src/main/res/values-pt/input_strings.xml @@ -22,6 +22,8 @@ Mostrar teclado Abrir o menu do Steam Abrir o acesso rápido do Steam + Aumentar zoom do jogo + Diminuir zoom do jogo Remover controle Adicionar controle Botões específicos do dispositivo diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index beb36c5003..a09f4dfe39 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -2532,6 +2532,8 @@ Manter proporções Esticar para a tela Escala de imagem + Ajuste a ampliação do jogo de 100% a 300% + Zoom do jogo Filtro de escala Compartilhado entre Steam e Área de trabalho. Aplicado na hora. Compartilhado entre Steam e Área de trabalho. diff --git a/app/src/main/res/values-ro/input_zoom_strings.xml b/app/src/main/res/values-ro/input_zoom_strings.xml new file mode 100644 index 0000000000..275f3563d8 --- /dev/null +++ b/app/src/main/res/values-ro/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Mărește zoomul jocului + Micșorează zoomul jocului + \ No newline at end of file diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index eea97a453e..32f55fe1be 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -4185,4 +4185,6 @@ Închide mai întâi Steam Pune mai întâi pe pauză descărcarea Steam Acest joc își instalează versiunea pentru Linux. Instalează-l din Steam. + Zoom joc + Reglați mărirea jocului între 100% și 300% diff --git a/app/src/main/res/values-ru/input_zoom_strings.xml b/app/src/main/res/values-ru/input_zoom_strings.xml new file mode 100644 index 0000000000..e5c6c303e6 --- /dev/null +++ b/app/src/main/res/values-ru/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Увеличить масштаб игры + Уменьшить масштаб игры + \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index f90c95f28a..23ee3124fc 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -4226,4 +4226,6 @@ Сначала закройте Steam Сначала приостановите загрузку Steam Эта игра устанавливает свою версию для Linux. Установите её из Steam. + Масштаб игры + Настройте увеличение игры от 100% до 300% diff --git a/app/src/main/res/values-sv/input_zoom_strings.xml b/app/src/main/res/values-sv/input_zoom_strings.xml new file mode 100644 index 0000000000..ddf9701d11 --- /dev/null +++ b/app/src/main/res/values-sv/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Öka spelzoom + Minska spelzoom + \ No newline at end of file diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 5efff6defd..5aafdf9c38 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -4145,4 +4145,6 @@ Stäng Steam först Pausa Steam-nedladdningen först Det här spelet installerar sin Linux-version. Installera det från Steam. + Spelzoom + Justera spelförstoringen från 100 % till 300 % diff --git a/app/src/main/res/values-th/input_zoom_strings.xml b/app/src/main/res/values-th/input_zoom_strings.xml new file mode 100644 index 0000000000..c22c370488 --- /dev/null +++ b/app/src/main/res/values-th/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + เพิ่มการซูมเกม + ลดการซูมเกม + \ No newline at end of file diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 2a6703bcb1..ec38850755 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -4115,4 +4115,6 @@ ปิด Steam ก่อน หยุดการดาวน์โหลด Steam ชั่วคราวก่อน เกมนี้ติดตั้งเวอร์ชัน Linux ของตัวเอง ให้ติดตั้งจาก Steam + ซูมเกม + ปรับการขยายเกมตั้งแต่ 100% ถึง 300% diff --git a/app/src/main/res/values-tr/input_zoom_strings.xml b/app/src/main/res/values-tr/input_zoom_strings.xml new file mode 100644 index 0000000000..f786107728 --- /dev/null +++ b/app/src/main/res/values-tr/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Oyun yakınlaştırmasını artır + Oyun yakınlaştırmasını azalt + \ No newline at end of file diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 68e7c29a2b..444f2d39e6 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -4145,4 +4145,6 @@ Önce Steam\'i kapatın Önce Steam indirmesini duraklatın Bu oyun Linux sürümünü yükler. Steam\'den yükleyin. + Oyun yakınlaştırma + Oyun yakınlaştırmasını %100 ile %300 arasında ayarlayın diff --git a/app/src/main/res/values-uk/input_zoom_strings.xml b/app/src/main/res/values-uk/input_zoom_strings.xml new file mode 100644 index 0000000000..608fb8f973 --- /dev/null +++ b/app/src/main/res/values-uk/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Збільшити масштаб гри + Зменшити масштаб гри + \ No newline at end of file diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index d755474c4c..95f470b86c 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -4225,4 +4225,6 @@ Спочатку закрийте Steam Спочатку призупиніть завантаження Steam Ця гра встановлює свою версію для Linux. Установіть її зі Steam. + Масштаб гри + Налаштуйте збільшення гри від 100% до 300% diff --git a/app/src/main/res/values-vi/input_zoom_strings.xml b/app/src/main/res/values-vi/input_zoom_strings.xml new file mode 100644 index 0000000000..16dbcd0dcf --- /dev/null +++ b/app/src/main/res/values-vi/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + Tăng thu phóng trò chơi + Giảm thu phóng trò chơi + \ No newline at end of file diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index a2f9c8274d..632bc75003 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -4115,4 +4115,6 @@ Hãy đóng Steam trước Hãy tạm dừng tải xuống Steam trước Trò chơi này cài bản dành cho Linux. Hãy cài từ Steam. + Thu phóng trò chơi + Điều chỉnh độ phóng đại trò chơi từ 100% đến 300% diff --git a/app/src/main/res/values-zh-rCN/input_zoom_strings.xml b/app/src/main/res/values-zh-rCN/input_zoom_strings.xml new file mode 100644 index 0000000000..cda779567a --- /dev/null +++ b/app/src/main/res/values-zh-rCN/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + 放大游戏画面 + 缩小游戏画面 + \ No newline at end of file diff --git a/app/src/main/res/values-zh-rHK/input_zoom_strings.xml b/app/src/main/res/values-zh-rHK/input_zoom_strings.xml new file mode 100644 index 0000000000..44fe64edb2 --- /dev/null +++ b/app/src/main/res/values-zh-rHK/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + 放大遊戲畫面 + 縮小遊戲畫面 + \ No newline at end of file diff --git a/app/src/main/res/values-zh-rTW/input_zoom_strings.xml b/app/src/main/res/values-zh-rTW/input_zoom_strings.xml new file mode 100644 index 0000000000..44fe64edb2 --- /dev/null +++ b/app/src/main/res/values-zh-rTW/input_zoom_strings.xml @@ -0,0 +1,5 @@ + + + 放大遊戲畫面 + 縮小遊戲畫面 + \ No newline at end of file diff --git a/app/src/main/res/values/input_strings.xml b/app/src/main/res/values/input_strings.xml index bc18c561a7..69e35ec0e3 100644 --- a/app/src/main/res/values/input_strings.xml +++ b/app/src/main/res/values/input_strings.xml @@ -21,6 +21,8 @@ Show keyboard Open Steam menu Open Steam quick access + Increase game zoom + Decrease game zoom Remove control Add control Device-specific buttons diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 49d7b80ceb..606e625431 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2795,6 +2795,8 @@ Keep proportions Stretch to display Image scaling + Adjust game magnification from 100% to 300% + Game zoom Integer scaling Uses the largest whole-number scale that fits. May crop screen edges. If the source is larger than the output, fractional scaling fits the full image. Resolution is configured separately. Fit diff --git a/app/src/test/java/com/droiddeck/launcher/input/InputProfilesTest.kt b/app/src/test/java/com/droiddeck/launcher/input/InputProfilesTest.kt index e5fc41f09a..1751c6dd54 100644 --- a/app/src/test/java/com/droiddeck/launcher/input/InputProfilesTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/input/InputProfilesTest.kt @@ -50,6 +50,8 @@ class InputProfilesTest { @Test fun bindingsAndDeviceKeysRoundTripWithoutAffectingOtherProfile() { val game = InputProfile.defaults(InputProfile.GAME) .withBinding(InputRole.SECONDARY, InputControl.A, InputAction.Keys(listOf(29, 30))) + .withBinding(InputRole.PRIMARY, InputControl.Y, InputAction.Command(InputCommand.GAME_ZOOM_IN)) + .withBinding(InputRole.PRIMARY, InputControl.B, InputAction.Command(InputCommand.GAME_ZOOM_OUT)) .copy(keys = listOf(PhysicalInputBinding(PhysicalInputKey("1:2:descriptor", "Thor", 131, 59), InputAction.Command(InputCommand.MENU)))) InputProfiles.save(context, game) assertEquals(game, InputProfiles.read(context, InputProfile.GAME)) diff --git a/tools/tests/pen_pointer_harness.c b/tools/tests/pen_pointer_harness.c index 01dd5b45b9..cec9cf72bf 100644 --- a/tools/tests/pen_pointer_harness.c +++ b/tools/tests/pen_pointer_harness.c @@ -52,6 +52,16 @@ static int vkp_output_to_scene(double ox, double oy, double *x, double *y) { (void)ox; (void)oy; (void)x; (void)y; return 0; } +static int vkp_scene_to_output(double sx, double sy, double *ox, double *oy) { + (void)sx; (void)sy; (void)ox; (void)oy; + return 0; +} + +static int vkp_zoom_pan_cursor(double ox, double oy) { + (void)ox; (void)oy; + return 0; +} + static struct surface *toplevel_at(double x, double y) { (void)y; return x < 1000 ? &a : &b; @@ -124,7 +134,8 @@ static void hover_away(void) { assert(!g_grab); pen(PEN_IN, 1500); assert(nevents == 2); - left(0, &pointer_a, &surface_a); focus(1, &pointer_b, &surface_b); + left(0, &pointer_a, &surface_a); + focus(1, &pointer_b, &surface_b); } int main(int argc, char **argv) { @@ -151,7 +162,8 @@ int main(int argc, char **argv) { } else if (!strcmp(c, "swap")) { pen(PEN_IN | PEN_RIGHT, 600); assert(nevents == 2 && g_grab == &a); - button(0, PRESS, BTN_RIGHT); button(1, RELEASE, BTN_LEFT); + button(0, PRESS, BTN_RIGHT); + button(1, RELEASE, BTN_LEFT); pen(PEN_IN | PEN_RIGHT, 1500); assert(nevents == 0 && g_grab == &a); pen(PEN_IN, 1500); diff --git a/tools/tests/test_output_refresh.py b/tools/tests/test_output_refresh.py index 96817b2f4f..e931c4b187 100644 --- a/tools/tests/test_output_refresh.py +++ b/tools/tests/test_output_refresh.py @@ -45,6 +45,8 @@ static int g_input_pipe[2] = {-1, -1}; static atomic_int g_output_refresh_mhz = 60000; static atomic_int g_output_refresh_pending; static atomic_int g_panel_rates_pending; +static atomic_int g_zoom_request_percent = 100; +static atomic_int g_zoom_request_pending; static int g_output_announced_refresh_mhz = 60000; static int g_output_w = 1920, g_output_h = 1080; static int flushes, resizes, pointers, ticks; @@ -77,6 +79,7 @@ static void on_vsync(int64_t ns) { assert(ns > 0); ticks++; } static void vk_present_set_scale_mode(int mode, int alignment) { scale_changes++; scale_mode = mode; scale_alignment = alignment; } +static void vk_present_set_zoom(float zoom) { (void)zoom; } static void schedule_render(void) { renders++; } static void refresh_notify_rates(void) { rate_notifies++; } ''' From 35b72669b6b2a3fab27bb805805a70d88ef253e3 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:02:13 -0500 Subject: [PATCH 065/120] fix(games): keep Proton's log under 64 MiB while the game runs (#3337) --- docs/development/game-environment.md | 5 ++ .../usr/local/bin/droiddeck-game-debug | 45 ++++++++++++++++ .../overlay/usr/local/bin/droiddeck-game-env | 2 + .../tests/test_desktop_program_diagnostics.py | 53 +++++++++++++++++++ 4 files changed, 105 insertions(+) diff --git a/docs/development/game-environment.md b/docs/development/game-environment.md index 916fa30dc6..5d780b1253 100644 --- a/docs/development/game-environment.md +++ b/docs/development/game-environment.md @@ -134,6 +134,11 @@ spaces, quotes, or shell characters stay literal. Existing arguments and settings on the next launch. It does not change Steam probes or native Linux programs, whose ordinary output remains in the session log. +Proton's log is held to its first 64 MiB, whichever setting turned it on: a +watcher checks `steam-.log` and `steam-proton.log` every second while the game runs and +cuts them back, and later output continues after the cut. A game stuck in an exception loop +otherwise writes gigabytes per run. + After reproducing once, stop the session and use **Latest session logs > Share logs**. The archive includes the generated Wine/Proton and graphics logs. Debug logging can reduce performance and consume storage; disable it after collecting diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-debug b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-debug index 9cf741bf87..24147636b7 100644 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-debug +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-debug @@ -3,6 +3,7 @@ import contextlib import json import os import re +import subprocess import sys import tempfile import threading @@ -74,6 +75,50 @@ def apply_game_debug_logs(env, config=None, debug_dir=None): return result +# Proton appends its log through one inherited descriptor and never limits it; a game that loops on an +# exception wrote 3 GB per run. Truncating keeps the first part and frees the rest, and Proton's +# appends continue from the new end. +PROTON_LOG_CAP = 64 * 1024 * 1024 +PROTON_LOG_CHECK_S = 1 +CAP_WATCH = r""" +import os, stat, sys, time +pid, limit, every, paths = int(sys.argv[1]), int(sys.argv[2]), float(sys.argv[3]), sys.argv[4:] +while os.path.isdir("/proc/%d" % pid): + for path in paths: + try: + info = os.lstat(path) + if stat.S_ISREG(info.st_mode) and info.st_size > limit: + os.truncate(path, limit) + except OSError: + pass + time.sleep(every) +""" + + +def proton_log_paths(env): + if env.get("PROTON_LOG", "0") in ("", "0"): + return [] + folder = env.get("PROTON_LOG_DIR") or env.get("HOME") or os.environ.get("HOME") or "/root" + paths = [os.path.join(folder, "steam-proton.log")] + if env.get("SteamGameId"): + paths.insert(0, os.path.join(folder, "steam-%s.log" % env["SteamGameId"])) + return paths + + +def cap_proton_log(env, pid=None, limit=PROTON_LOG_CAP, every=PROTON_LOG_CHECK_S, popen=subprocess.Popen): + """Keep Proton's log under `limit` bytes while process `pid` (this launcher, which becomes Proton) runs.""" + paths = proton_log_paths(env) + if not paths: + return None + try: + return popen([sys.executable, "-c", CAP_WATCH, str(pid or os.getpid()), str(limit), str(every)] + paths, + stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, + start_new_session=True) + except OSError as error: + print("droiddeck-game-env: Proton log size limit unavailable (%s)" % error, file=sys.stderr) + return None + + def capped_log(path, limit, mirror=False): os.makedirs(os.path.dirname(path), exist_ok=True) handle = open(path, "wb") diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env index d309e8e7f0..a71a8edd94 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env @@ -1748,6 +1748,8 @@ def main(): except OSError as undo: print("droiddeck-game-env: DiRT telemetry fix: prefix ws2_32 not put back (%s); Wine uses its own copy " "and the next launch puts the file back" % undo, file=sys.stderr) + if len(command) > 1 and command[1] == "waitforexitandrun": + GAME_DEBUG["cap_proton_log"](env) sync = load_sync() launch, launch_env = select_sync(command, env, sync) if launch[0] != command[0]: diff --git a/tools/tests/test_desktop_program_diagnostics.py b/tools/tests/test_desktop_program_diagnostics.py index aafb89d20b..9124f2a810 100644 --- a/tools/tests/test_desktop_program_diagnostics.py +++ b/tools/tests/test_desktop_program_diagnostics.py @@ -6,6 +6,7 @@ import runpy import subprocess import sys import tempfile +import time import unittest @@ -13,6 +14,58 @@ BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin" DEBUG = runpy.run_path(str(BIN / "droiddeck-game-debug")) +class ProtonLogCapTest(unittest.TestCase): + def test_only_an_enabled_proton_log_is_watched(self): + self.assertEqual(DEBUG["proton_log_paths"]({"PROTON_LOG": "0", "SteamGameId": "1"}), []) + self.assertEqual(DEBUG["proton_log_paths"]({"SteamGameId": "1"}), []) + self.assertEqual(DEBUG["proton_log_paths"]({"PROTON_LOG": "1", "PROTON_LOG_DIR": "/logs", "SteamGameId": "584400"}), + ["/logs/steam-584400.log", "/logs/steam-proton.log"]) + self.assertEqual(DEBUG["proton_log_paths"]({"PROTON_LOG": "+seh", "HOME": "/root"}), ["/root/steam-proton.log"]) + + def test_the_watcher_outlives_nothing_but_the_launcher(self): + calls = [] + DEBUG["cap_proton_log"]({"PROTON_LOG": "1", "PROTON_LOG_DIR": "/logs", "SteamGameId": "7"}, pid=42, + popen=lambda argv, **kw: calls.append((argv, kw))) + argv, kw = calls[0] + self.assertEqual(argv[3:], ["42", str(DEBUG["PROTON_LOG_CAP"]), str(DEBUG["PROTON_LOG_CHECK_S"]), + "/logs/steam-7.log", "/logs/steam-proton.log"]) + self.assertTrue(kw["start_new_session"]) + self.assertIsNone(DEBUG["cap_proton_log"]({"PROTON_LOG": "0"}, popen=lambda *a, **k: self.fail("spawned"))) + + def test_a_flooding_log_is_cut_back_and_appends_continue_after_the_cut(self): + with tempfile.TemporaryDirectory() as folder: + log = Path(folder) / "steam-9.log" + launcher = subprocess.Popen([sys.executable, "-c", "import time; time.sleep(3)"]) + with open(log, "ab") as proton: + proton.write(b"Proton: header\n" + b"x" * 300_000) + proton.flush() + watcher = DEBUG["cap_proton_log"]({"PROTON_LOG": "1", "PROTON_LOG_DIR": folder, "SteamGameId": "9"}, + pid=launcher.pid, limit=1000, every=0.1) + deadline = time.monotonic() + 5 + while log.stat().st_size > 1000 and time.monotonic() < deadline: + time.sleep(0.05) + self.assertEqual(log.stat().st_size, 1000) + proton.write(b"tail") + proton.flush() + self.assertTrue(log.read_bytes().startswith(b"Proton: header")) + self.assertTrue(log.read_bytes().endswith(b"tail")) + self.assertEqual(log.stat().st_size, 1004) + launcher.wait() + watcher.wait(timeout=5) + + def test_symlinks_are_left_alone(self): + with tempfile.TemporaryDirectory() as folder: + target = Path(folder) / "other" + target.write_bytes(b"y" * 5000) + (Path(folder) / "steam-3.log").symlink_to(target) + launcher = subprocess.Popen([sys.executable, "-c", "import time; time.sleep(0.5)"]) + watcher = DEBUG["cap_proton_log"]({"PROTON_LOG": "1", "PROTON_LOG_DIR": folder, "SteamGameId": "3"}, + pid=launcher.pid, limit=10, every=0.1) + launcher.wait() + watcher.wait(timeout=5) + self.assertEqual(target.stat().st_size, 5000) + + class DesktopProgramDiagnosticsTest(unittest.TestCase): def launch(self, folder, desktop=True, **settings): env = dict(os.environ, DD_DEBUG_DIR=folder, WINEDEBUG="-all", PROTON_LOG="0") From a5d57469deb45c04c07456d2b78f19ae0ba45615 Mon Sep 17 00:00:00 2001 From: Ilya Danilkin Date: Sun, 29 Nov 2026 07:07:18 +0400 Subject: [PATCH 066/120] fix(session): recognise Android 17 memory limiter kills (#3218) --- .../droiddeck/launcher/core/DeviceReport.kt | 1 + .../launcher/session/SessionArtifacts.kt | 11 ++++++++++- .../launcher/core/DeviceReportExitTest.kt | 1 + .../launcher/session/MemoryKillTest.kt | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/src/test/java/com/droiddeck/launcher/session/MemoryKillTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt b/app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt index 9cf1871e10..db8ab970a2 100644 --- a/app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt +++ b/app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt @@ -62,6 +62,7 @@ object DeviceReport { 14 -> "FREEZER" 15 -> "PACKAGE_STATE_CHANGE" 16 -> "PACKAGE_UPDATED" + 17 -> "MEMORY_LIMITER" else -> "REASON_$reason" } diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionArtifacts.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionArtifacts.kt index 03c9fddcae..68cb9b4976 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionArtifacts.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionArtifacts.kt @@ -667,10 +667,18 @@ object SessionArtifacts { val am = context.getSystemService(android.app.ActivityManager::class.java) ?: return false am.getHistoricalProcessExitReasons(context.packageName, 0, 3) .firstOrNull { it.processName == context.packageName } - ?.reason == android.app.ApplicationExitInfo.REASON_LOW_MEMORY + ?.let { memoryKill(it.reason, it.description) } == true }.getOrDefault(false) } + // ApplicationExitInfo.REASON_MEMORY_LIMITER (API 37.2), newer than compileSdk. + private const val REASON_MEMORY_LIMITER = 17 + + // The Android 17 behavior changes page instead documents REASON_OTHER with the limiter named in the description. + internal fun memoryKill(reason: Int, description: String?): Boolean = + reason == android.app.ApplicationExitInfo.REASON_LOW_MEMORY || reason == REASON_MEMORY_LIMITER || + reason == android.app.ApplicationExitInfo.REASON_OTHER && description?.contains("MemoryLimiter") == true + private fun exitReasons(context: Context): String { if (android.os.Build.VERSION.SDK_INT < 30) return "" return runCatching { @@ -691,6 +699,7 @@ object SessionArtifacts { private fun reasonName(reason: Int): String = when (reason) { android.app.ApplicationExitInfo.REASON_LOW_MEMORY -> "LOW_MEMORY (killed for memory)" + REASON_MEMORY_LIMITER -> "MEMORY_LIMITER (over the app memory limit)" android.app.ApplicationExitInfo.REASON_SIGNALED -> "SIGNALED" android.app.ApplicationExitInfo.REASON_CRASH -> "CRASH" android.app.ApplicationExitInfo.REASON_CRASH_NATIVE -> "CRASH_NATIVE" diff --git a/app/src/test/java/com/droiddeck/launcher/core/DeviceReportExitTest.kt b/app/src/test/java/com/droiddeck/launcher/core/DeviceReportExitTest.kt index 733b1e4d7a..1552e24f95 100644 --- a/app/src/test/java/com/droiddeck/launcher/core/DeviceReportExitTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/core/DeviceReportExitTest.kt @@ -11,6 +11,7 @@ class DeviceReportExitTest { assertEquals("CRASH_NATIVE", DeviceReport.exitReasonName(5)) assertEquals("EXCESSIVE_RESOURCE_USAGE", DeviceReport.exitReasonName(9)) assertEquals("FREEZER", DeviceReport.exitReasonName(14)) + assertEquals("MEMORY_LIMITER", DeviceReport.exitReasonName(17)) } @Test fun anUnknownCodeStillShowsItsNumber() { diff --git a/app/src/test/java/com/droiddeck/launcher/session/MemoryKillTest.kt b/app/src/test/java/com/droiddeck/launcher/session/MemoryKillTest.kt new file mode 100644 index 0000000000..4f0f369af3 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/session/MemoryKillTest.kt @@ -0,0 +1,18 @@ +package com.droiddeck.launcher.session + +import android.app.ApplicationExitInfo +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test + +class MemoryKillTest { + @Test + fun recognisesLowMemoryAndTheAndroid17Limiter() { + assertTrue(SessionArtifacts.memoryKill(ApplicationExitInfo.REASON_LOW_MEMORY, null)) + assertTrue(SessionArtifacts.memoryKill(17, "kill")) + assertTrue(SessionArtifacts.memoryKill(ApplicationExitInfo.REASON_OTHER, "MemoryLimiter:AnonSwap")) + assertFalse(SessionArtifacts.memoryKill(ApplicationExitInfo.REASON_OTHER, "unstable content provider")) + assertFalse(SessionArtifacts.memoryKill(ApplicationExitInfo.REASON_OTHER, null)) + assertFalse(SessionArtifacts.memoryKill(ApplicationExitInfo.REASON_USER_REQUESTED, "MemoryLimiter:AnonSwap")) + } +} From d4bb8060da8a9c7e302980413edec26201033c0d Mon Sep 17 00:00:00 2001 From: Tushar Gandhe <19225304+2-Shar@users.noreply.github.com> Date: Sun, 29 Nov 2026 08:37:46 +0530 Subject: [PATCH 067/120] fix(ui): in portrait, the Settings section chips sit on their own row under the title (#3199) --- .../main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt index c313b21fbc..d804a4fa56 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt @@ -237,12 +237,17 @@ internal fun SetupPanel( onNext = { pick((tab + 1) % tabs.size) }, ), ) { - PageHeader(stringResource(R.string.setup_title)) { + val sectionBar: @Composable (Modifier) -> Unit = { m -> SettingsPillSearch( - Modifier.weight(1f), searching, query, { query = it }, + m, searching, query, { query = it }, onOpen = { searching = true }, onClose = { searching = false; query = "" }, ) { SheetChips(tabs, tab, chipFocus, onPick = pick) } } + val portrait = androidx.compose.ui.platform.LocalConfiguration.current.orientation == android.content.res.Configuration.ORIENTATION_PORTRAIT + if (portrait) { + PageHeader(stringResource(R.string.setup_title)) + Row(Modifier.fillMaxWidth().padding(bottom = 10.dp)) { sectionBar(Modifier.weight(1f)) } + } else PageHeader(stringResource(R.string.setup_title)) { sectionBar(Modifier.weight(1f)) } val listing = searching && query.isNotBlank() val fixed = tab == CONTROLLER_TAB && !listing Column(modifier = Modifier.weight(1f).fillMaxWidth().then(if (fixed) Modifier else Modifier.verticalScroll(rememberScrollState())).padding(bottom = if (fixed) 0.dp else 24.dp)) { From 2365b77d42d971a04df713c0a9e924f1dee8df1b Mon Sep 17 00:00:00 2001 From: Unixcision Date: Sun, 29 Nov 2026 04:08:53 +0100 Subject: [PATCH 068/120] fix(ui): the sheet handle hints once instead of keeping the home screen redrawing (#3196) --- .../com/droiddeck/launcher/ui/LiftSheet.kt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/LiftSheet.kt b/app/src/main/java/com/droiddeck/launcher/ui/LiftSheet.kt index f58ee90807..66f6ea110a 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/LiftSheet.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/LiftSheet.kt @@ -100,7 +100,6 @@ import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalInputModeManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.Role -import androidx.compose.animation.core.animateFloat import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.font.FontWeight @@ -649,20 +648,20 @@ internal fun Handle(height: Dp, above: Boolean = false) { val pal = LocalPalette.current val shape = if (above) RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp) else RoundedCornerShape(bottomStart = 12.dp, bottomEnd = 12.dp) val still = Motion.scale == 0f - val bob = androidx.compose.animation.core.rememberInfiniteTransition(label = "handle") - val lift by bob.animateFloat( - 0f, 0f, - androidx.compose.animation.core.infiniteRepeatable( + val lift = remember { Animatable(0f) } + LaunchedEffect(still) { + lift.snapTo(0f) + if (!still) lift.animateTo( + 0f, androidx.compose.animation.core.keyframes { - durationMillis = 2400 + durationMillis = 620 0f at 0 1f at 180 using androidx.compose.animation.core.FastOutSlowInEasing -0.25f at 420 0f at 620 }, - ), - label = "handleBob", - ) + ) + } Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp), modifier = Modifier.height(height).clip(shape).background(colors.surface) @@ -672,7 +671,7 @@ internal fun Handle(height: Dp, above: Boolean = false) { Text(stringResource(R.string.sheet_lip), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant, maxLines = 1) Icon( if (above) Icons.Filled.KeyboardArrowDown else Icons.Filled.KeyboardArrowUp, null, tint = colors.onSurfaceVariant, - modifier = Modifier.size(16.dp).graphicsLayer { translationY = if (still) 0f else (if (above) 3.dp else -3.dp).toPx() * lift }, + modifier = Modifier.size(16.dp).graphicsLayer { translationY = if (still) 0f else (if (above) 3.dp else -3.dp).toPx() * lift.value }, ) } } From 9a76e75ee9eafddd1a132417cfcab16de2a0b549 Mon Sep 17 00:00:00 2001 From: The412Banner <205237651+The412Banner@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:22:11 -0500 Subject: [PATCH 069/120] fix(ci): retry other Ubuntu mirrors on runners without the deb822 sources file (#3063) --- tools/ci/install-ubuntu-packages.sh | 25 +++++++++++++++++-------- tools/tests/test_ci_checks.py | 27 +++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/tools/ci/install-ubuntu-packages.sh b/tools/ci/install-ubuntu-packages.sh index d1bd5e698a..4f6c61d882 100644 --- a/tools/ci/install-ubuntu-packages.sh +++ b/tools/ci/install-ubuntu-packages.sh @@ -10,13 +10,13 @@ if [ "${#missing[@]}" = 0 ]; then echo "Ubuntu build dependencies are already installed." exit 0 fi -options=() +source_options=() # Runners without the deb822 Ubuntu sources file keep their own apt configuration. ubuntu_sources=${UBUNTU_SOURCES_FILE:-/etc/apt/sources.list.d/ubuntu.sources} if [ -f "$ubuntu_sources" ]; then - options+=(-o "Dir::Etc::sourcelist=$ubuntu_sources" -o Dir::Etc::sourceparts=-) + source_options=(-o "Dir::Etc::sourcelist=$ubuntu_sources" -o Dir::Etc::sourceparts=-) fi -options+=( +apt_options=( -o Acquire::Retries=1 -o Acquire::http::Timeout=15 -o Acquire::https::Timeout=15 @@ -24,14 +24,23 @@ options+=( ) install_packages() { echo "Updating Ubuntu package indexes." - sudo timeout --kill-after=10s 60s apt-get "${options[@]}" -o APT::Update::Error-Mode=any update -q || return $? + sudo timeout --kill-after=10s 60s apt-get "${source_options[@]}" "${apt_options[@]}" -o APT::Update::Error-Mode=any update -q || return $? echo "Installing: ${missing[*]}" - sudo timeout --kill-after=10s 120s env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get "${options[@]}" install -y -q --no-install-recommends "${missing[@]}" + sudo timeout --kill-after=10s 120s env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get "${source_options[@]}" "${apt_options[@]}" install -y -q --no-install-recommends "${missing[@]}" } if install_packages; then exit 0 fi -[ -f "$ubuntu_sources" ] || exit 1 +if [ -f "$ubuntu_sources" ]; then + template=$(cat "$ubuntu_sources") +else + codename=$(. "${OS_RELEASE_FILE:-/etc/os-release}" && echo "${UBUNTU_CODENAME:-${VERSION_CODENAME:-}}") + [ -n "$codename" ] || exit 1 + template="Types: deb +URIs: - +Suites: $codename $codename-updates $codename-security +Components: main restricted universe multiverse" +fi sources=$(mktemp --suffix=.sources) trap 'rm -f "$sources"' EXIT # The last mirror of each list is outside Canonical's network, so it still answers when runners cannot reach Canonical. @@ -39,12 +48,12 @@ mirrors=(https://archive.ubuntu.com/ubuntu https://mirrors.edge.kernel.org/ubunt case "$(dpkg --print-architecture)" in arm64) mirrors=(https://ports.ubuntu.com/ubuntu-ports https://mirrors.ocf.berkeley.edu/ubuntu-ports) ;; esac +source_options=(-o "Dir::Etc::sourcelist=$sources" -o Dir::Etc::sourceparts=-) status=1 for mirror in "${mirrors[@]}"; do echo "::warning::Ubuntu mirror failed or timed out; retrying with $mirror." - sed -E "s@^URIs:.*@URIs: $mirror@" "$ubuntu_sources" > "$sources" + printf '%s\n' "$template" | sed -E "s@^URIs:.*@URIs: $mirror@" > "$sources" chmod 644 "$sources" - options[1]="Dir::Etc::sourcelist=$sources" status=0 install_packages || status=$? [ "$status" = 0 ] && exit 0 diff --git a/tools/tests/test_ci_checks.py b/tools/tests/test_ci_checks.py index bf3db6ec69..ad6ae6858d 100644 --- a/tools/tests/test_ci_checks.py +++ b/tools/tests/test_ci_checks.py @@ -60,7 +60,7 @@ class CiChecksTest(unittest.TestCase): sudo = root / 'sudo' sudo.write_text('#!/bin/bash\nprintf "%s\\n" "$*" >> "$APT_LOG"\n' 'for arg; do case "$arg" in Dir::Etc::sourcelist=*) ' - 'grep -h "^URIs:" "${arg#*=}" >> "$APT_LOG.mirrors";; esac; done\n' + 'grep -hE "^(URIs|Suites):" "${arg#*=}" >> "$APT_LOG.mirrors";; esac; done\n' 'exit "${APT_RESULT:-0}"\n') sudo.chmod(0o755) query = root / 'dpkg-query' @@ -105,12 +105,35 @@ class CiChecksTest(unittest.TestCase): self.assertIn('install -y -q --no-install-recommends qemu-user', install) log.unlink() - absent = dict(env, UBUNTU_SOURCES_FILE=str(root / 'missing.sources'), APT_RESULT='17') + mirrors.unlink() + release = root / 'os-release' + release.write_text('ID=ubuntu\n') + absent = dict(env, UBUNTU_SOURCES_FILE=str(root / 'missing.sources'), APT_RESULT='17', + OS_RELEASE_FILE=str(release)) result = subprocess.run(['bash', str(installer), 'qemu-user'], env=absent) self.assertEqual(result.returncode, 1) self.assertEqual(len(log.read_text().splitlines()), 1) self.assertNotIn('Dir::Etc::sourceparts', log.read_text()) + log.unlink() + release.write_text('ID=ubuntu\nVERSION_CODENAME=noble\nUBUNTU_CODENAME=noble\n') + result = subprocess.run(['bash', str(installer), 'qemu-user'], env=absent) + self.assertEqual(result.returncode, 17) + first, *fallbacks = log.read_text().splitlines() + self.assertNotIn('Dir::Etc::sourcelist', first) + self.assertEqual(len(fallbacks), 2) + for command in (first, *fallbacks): + self.assertIn('Acquire::Retries=1', command) + self.assertIn('Acquire::https::Timeout=15', command) + for command in fallbacks: + self.assertIn('Dir::Etc::sourceparts=-', command) + self.assertEqual(mirrors.read_text().splitlines(), [ + 'URIs: https://archive.ubuntu.com/ubuntu', + 'Suites: noble noble-updates noble-security', + 'URIs: https://mirrors.edge.kernel.org/ubuntu', + 'Suites: noble noble-updates noble-security', + ]) + def test_required_status_rejects_failed_cancelled_or_skipped_test_jobs(self): jobs = yaml.safe_load((ROOT / '.github/workflows/build.yml').read_text())['jobs'] gate = jobs['checks'] From 6349a171b5884bd5cbb1599587e9d4b11c54a820 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:34:31 -0500 Subject: [PATCH 070/120] feat(stores): editable launch options for EA store games (#2444) --- .../droiddeck/launcher/frontend/AddedGames.kt | 1 + .../droiddeck/launcher/stores/StoreLaunch.kt | 2 +- .../com/droiddeck/launcher/ui/GameDetail.kt | 21 +++++++++++++++++++ .../frontend/AddedGamesStoreScanTest.kt | 17 +++++++++++++++ .../droiddeck/launcher/stores/ea/EaTest.kt | 2 +- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/frontend/AddedGames.kt b/app/src/main/java/com/droiddeck/launcher/frontend/AddedGames.kt index 8b86eccf4e..b26c2536cc 100644 --- a/app/src/main/java/com/droiddeck/launcher/frontend/AddedGames.kt +++ b/app/src/main/java/com/droiddeck/launcher/frontend/AddedGames.kt @@ -499,6 +499,7 @@ object AddedGames { launchOptions = when { sidecar == null -> SessionPrefs.addedGameLaunch(context, folder.path) sidecar.store == Store.UBISOFT -> com.droiddeck.launcher.stores.ubisoft.UbisoftConnect.launchOptions(context) + sidecar.store == Store.EA -> SessionPrefs.addedGameLaunch(context, folder.path) else -> "" }, single = single != null, steamProgram = steamProgram)) diff --git a/app/src/main/java/com/droiddeck/launcher/stores/StoreLaunch.kt b/app/src/main/java/com/droiddeck/launcher/stores/StoreLaunch.kt index 8dfa21a725..e76e5279e1 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/StoreLaunch.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/StoreLaunch.kt @@ -97,7 +97,7 @@ object StoreLaunch { lines += "del \"%~dp0$EA_ENV\"" lines += ":run" lines += "if exist \"$EA_ORIGIN\" start \"\" \"$EA_ORIGIN\"" - lines += run + lines += "$run %*" lines += "taskkill /f /im Origin.exe >nul 2>&1" } else { lines += run diff --git a/app/src/main/java/com/droiddeck/launcher/ui/GameDetail.kt b/app/src/main/java/com/droiddeck/launcher/ui/GameDetail.kt index 5e47621be9..6d64f033b9 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/GameDetail.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/GameDetail.kt @@ -96,6 +96,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import coil.compose.AsyncImage import com.droiddeck.launcher.R +import com.droiddeck.launcher.frontend.AddedGameEdits import com.droiddeck.launcher.frontend.GameRemoval import com.droiddeck.launcher.frontend.Library import com.droiddeck.launcher.runtime.CurseForgeApp @@ -104,6 +105,7 @@ import com.droiddeck.launcher.runtime.WowAddonCatalog import com.droiddeck.launcher.runtime.WowAddons import com.droiddeck.launcher.store.UserAppsState import com.droiddeck.launcher.session.GameSaves +import com.droiddeck.launcher.session.SessionPrefs import com.droiddeck.launcher.session.SessionState import com.droiddeck.launcher.stores.CatalogItem import com.droiddeck.launcher.stores.CloudSaves @@ -1001,6 +1003,25 @@ private fun LaunchTab(game: Library.SteamGame, s: FrontEndState, a: FrontEndActi } val folder = game.gameFiles if (game.library == Library.ADDED && game.source == Library.ADDED && !s.shortcutPicker && folder != null) ShortcutFields(game, folder) + if (game.library == Library.ADDED && Store.byId(game.source) == Store.EA && folder != null) StoreLaunchOptions(folder, a) + } +} + +@Composable +private fun StoreLaunchOptions(folder: File, a: FrontEndActions) { + val app = LocalContext.current.applicationContext + val scope = rememberCoroutineScope() + var saved by remember(folder.path) { mutableStateOf(SessionPrefs.addedGameLaunch(app, folder.path)) } + var editing by remember(folder.path) { mutableStateOf(false) } + Column(Modifier.fillMaxWidth().tabPanel()) { + MenuItem(stringResource(R.string.edit_launch_options), checked = false, detail = saved.ifEmpty { "—" }) { editing = true } + } + if (editing) TextEntryDialog(stringResource(R.string.edit_launch_options), saved, onDismiss = { editing = false }) { value -> + scope.launch { + withContext(Dispatchers.IO) { AddedGameEdits.setLaunchOptions(app, folder.path, value) } + saved = value + a.onAddedGamesChanged(listOf(folder.path)) + } } } diff --git a/app/src/test/java/com/droiddeck/launcher/frontend/AddedGamesStoreScanTest.kt b/app/src/test/java/com/droiddeck/launcher/frontend/AddedGamesStoreScanTest.kt index 8cbe467864..ab93d40d40 100644 --- a/app/src/test/java/com/droiddeck/launcher/frontend/AddedGamesStoreScanTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/frontend/AddedGamesStoreScanTest.kt @@ -103,6 +103,23 @@ class AddedGamesStoreScanTest { assertTrue(listing.contains("\"store\":\"${Store.EPIC.id}\"")) } + @Test fun anEaGamesSavedLaunchOptionsReachTheListingAndOtherStoresIgnoreThem() { + val ea = install(Store.EA, "Origin.OFR.1", "Burnout Paradise", "bin/Game.exe", launcher = true) + val gog = install(Store.GOG, "42", "Plain Gog", "Game.exe") + AddedGames.scan(app) + AddedGameEdits.setLaunchOptions(app, ea.path, "-dx11") + AddedGameEdits.setLaunchOptions(app, gog.path, "-ignored") + val games = AddedGames.scan(app) + assertEquals("-dx11", games.single { it.folder.absolutePath == ea.absolutePath }.launchOptions) + assertEquals("", games.single { it.folder.absolutePath == gog.absolutePath }.launchOptions) + assertTrue(AddedGames.writeListing(app, games).readText().contains("\"launch\":\"-dx11\"")) + } + + @Test fun anEaGameWithoutSavedLaunchOptionsHasNone() { + val ea = install(Store.EA, "Origin.OFR.2", "Other EA", "bin/Game.exe", launcher = true) + assertEquals("", AddedGames.scan(app).single { it.folder.absolutePath == ea.absolutePath }.launchOptions) + } + // GOG runs a task from its declared working directory; the install root when it declares none. @Test fun aTaskWorkingDirectoryBecomesTheShortcutsStartIn() { val folder = install(Store.GOG, "1207658924", "Witcher Game", "System/witcher.exe", workdir = "System") diff --git a/app/src/test/java/com/droiddeck/launcher/stores/ea/EaTest.kt b/app/src/test/java/com/droiddeck/launcher/stores/ea/EaTest.kt index 2a3ed5ce63..84500376ca 100644 --- a/app/src/test/java/com/droiddeck/launcher/stores/ea/EaTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/stores/ea/EaTest.kt @@ -302,7 +302,7 @@ class EaTest { val text = StoreLaunch.launcherText(StoreGameSidecar(Store.EA, "Origin.OFR.1", "Game", exe = "bin/Game.exe", args = listOf("-dx12"))) assertTrue(text.contains("for /f \"usebackq tokens=1,* delims==\" %%a in (\"%~dp0.droiddeck-ea-env\") do set \"%%a=%%b\"")) assertTrue(text.contains("del \"%~dp0.droiddeck-ea-env\"")) - assertTrue(text.contains("start \"\" \"${StoreLaunch.EA_ORIGIN}\"\r\n\"%~dp0bin\\Game.exe\" -dx12\r\n")) + assertTrue(text.contains("start \"\" \"${StoreLaunch.EA_ORIGIN}\"\r\n\"%~dp0bin\\Game.exe\" -dx12 %*\r\n")) assertTrue(text.trimEnd().endsWith("taskkill /f /im Origin.exe >nul 2>&1")) } From e0d9f8537a3d945ed03f5b1c26fd6c40df42446d Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:36:18 -0500 Subject: [PATCH 071/120] fix(components): install the real ARM64 Visual C++ runtime instead of registry entries (#2430) --- .../launcher/session/WinComponents.kt | 11 +-- .../session/WinComponentsSupportTest.kt | 10 ++- .../usr/local/bin/droiddeck-msi-install | 30 +++++-- tools/tests/test_msi_install.py | 89 +++++++++++++++++++ 4 files changed, 121 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/session/WinComponents.kt b/app/src/main/java/com/droiddeck/launcher/session/WinComponents.kt index b309bca43b..207a9921e6 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/WinComponents.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/WinComponents.kt @@ -105,14 +105,9 @@ object WinComponents { const val VCREDIST_ARM64 = "vcredist2022_arm64" internal fun builtInArm64Runtime(): Component { - fun value(view: String, name: String, type: String, data: String) = Step("set_register_key", JSONObject() - .put("action", "set_register_key").put("key", "HKLM\\Software\\${view}Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\arm64") - .put("value", name).put("type", type).put("data", data)) - val steps = listOf("", "Wow6432Node\\").flatMap { view -> - listOf(value(view, "Installed", "REG_DWORD", "1"), value(view, "Major", "REG_DWORD", "14"), value(view, "Minor", "REG_DWORD", "44"), - value(view, "Bld", "REG_DWORD", "35211"), value(view, "Rbld", "REG_DWORD", "0"), value(view, "Version", "REG_SZ", "v14.44.35211.00")) - } - return Component(VCREDIST_ARM64, "Microsoft Visual C++ 2015-2022 ARM64 runtime 14.44.35211 (registry entries only)", "Microsoft", "ready", emptyList(), steps) + val install = Step("install_exe", JSONObject().put("action", "install_exe").put("file_name", "VC_redist.arm64.exe") + .put("url", "https://aka.ms/vs/17/release/vc_redist.arm64.exe")) + return Component(VCREDIST_ARM64, "Microsoft Visual C++ 2015-2022 Redistributable (arm64)", "Microsoft", "ready", emptyList(), listOf(install), revision = 2) } private fun parse(body: String): List? { diff --git a/app/src/test/java/com/droiddeck/launcher/session/WinComponentsSupportTest.kt b/app/src/test/java/com/droiddeck/launcher/session/WinComponentsSupportTest.kt index 8311736999..4d70c02022 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/WinComponentsSupportTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/WinComponentsSupportTest.kt @@ -3,6 +3,7 @@ package com.droiddeck.launcher.session import com.droiddeck.launcher.session.WinComponents.Support import org.json.JSONObject import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @@ -31,12 +32,13 @@ class WinComponentsSupportTest { step("install_msi", "url" to "$base/ps-x86.msi"), step("install_msi", "url" to "$base/ps-x64.msi")))) } - @Test fun builtInArm64RuntimeIsRegistryOnlyInBothViews() { + @Test fun builtInArm64RuntimeInstallsTheRedistributable() { val c = WinComponents.builtInArm64Runtime() assertEquals(Support.READY, support(c)) - assertEquals(12, c.steps.count { it.action == "set_register_key" }) - assertEquals(setOf("HKLM\\Software\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\arm64", - "HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\arm64"), c.steps.map { it.str("key") }.toSet()) + assertEquals(listOf("install_exe"), c.steps.map { it.action }) + assertEquals("VC_redist.arm64.exe", c.steps.single().str("file_name")) + assertEquals(0, c.steps.count { it.action == "set_register_key" }) + assertTrue(c.revision > 0) } @Test fun installerWrappersInstallHere() { diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-msi-install b/tools/linuxfs/overlay/usr/local/bin/droiddeck-msi-install index 681cf4031b..0066f85577 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-msi-install +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-msi-install @@ -51,6 +51,11 @@ SYSTEM_PROPERTIES = { "UILevel": "2", "INSTALLLEVEL": "1", "ProgramFilesFolder": None, "VersionMsi": "5.00", } +NATIVE_ARCHITECTURE = {"intel": "x86", "x64": "AMD64", "amd64": "AMD64", "arm64": "ARM64"} +ARCHITECTURE_VALUE = ("system\\currentcontrolset\\control\\session manager\\environment", "processor_architecture") +REG_LOCATOR_RAW = 2 +REG_ROOT_LOCAL_MACHINE = 2 + COMPONENT_64BIT = 0x100 FILE_NONCOMPRESSED = 0x2000 SET_PROPERTY, SET_DIRECTORY, ERROR_ACTION = 51, 35, 19 @@ -410,6 +415,18 @@ class Installer: return text + def run_app_search(self): + locators = {row["Signature_"]: row for row in self.pkg.table("RegLocator")} + architecture = NATIVE_ARCHITECTURE.get(self.platform) + for row in self.pkg.table("AppSearch"): + locator = locators.get(row["Signature_"]) + if locator is None or architecture is None: + continue + if to_int(locator.get("Root")) != REG_ROOT_LOCAL_MACHINE or to_int(locator.get("Type")) & 0xF != REG_LOCATOR_RAW: + continue + if (locator.get("Key", "").rstrip("\\").casefold(), locator.get("Name", "").casefold()) == ARCHITECTURE_VALUE: + self.props[row["Property"]] = architecture + def run_set_actions(self): actions = {row["Action"]: row for row in self.pkg.table("CustomAction")} sequence = {} @@ -704,6 +721,7 @@ class Installer: def install(self): self.span.report(0.0, "reading %s" % (self.pkg.summary.get("subject") or Path(self.pkg.path).name)) + self.run_app_search() self.run_set_actions() self.select() with tempfile.TemporaryDirectory(dir=str(self.out.parent), prefix=".msi-") as work: @@ -865,13 +883,9 @@ def choose_packages(found, root): names = [entry.name.lower() for entry in top] if any("full" in name for name in names) and any("_core" in name or "_extended" in name for name in names): top = [entry for entry in top if not ("_core" in entry.name.lower() or "_extended" in entry.name.lower())] - chosen = [] - for entry in top: - template = Package(entry).summary.get("template", "").split(";")[0].strip().lower() - if template in SKIP_PLATFORMS: - continue - chosen.append(entry) - return chosen + platforms = [(entry, Package(entry).summary.get("template", "").split(";")[0].strip().lower()) for entry in top] + native = [entry for entry, template in platforms if template not in SKIP_PLATFORMS] + return native or top def install_wrapper(path, out): @@ -901,6 +915,8 @@ def install_wrapper(path, out): for note in result["notes"]: if note not in total["notes"]: total["notes"].append(note) + if not total["packages"]: + raise MsiError("%s installs nothing here" % path.name) total["how"] = how return total diff --git a/tools/tests/test_msi_install.py b/tools/tests/test_msi_install.py index 60d8fc8df4..153c699cbf 100644 --- a/tools/tests/test_msi_install.py +++ b/tools/tests/test_msi_install.py @@ -33,6 +33,62 @@ def installer(tables, out="/tmp/unused", summary=None): return MSI["Installer"]("fake.msi", out, FakePackage(tables, summary)) +class ChoosePackagesTest(unittest.TestCase): + + def choose(self, platforms): + class Stub: + def __init__(self, path): + self.summary = {"template": platforms[Path(path).name] + ";1033"} + + root = Path(tempfile.mkdtemp()) + found = [] + for name in platforms: + (root / name).write_bytes(b"") + found.append(root / name) + choose = MSI["choose_packages"] + previous = choose.__globals__["Package"] + choose.__globals__["Package"] = Stub + try: + return [entry.name for entry in choose(found, root)] + finally: + choose.__globals__["Package"] = previous + + def test_arm_packages_are_dropped_beside_native_ones(self): + self.assertEqual(self.choose({"a.msi": "x64", "b.msi": "Arm64", "c.msi": "Intel"}), ["a.msi", "c.msi"]) + + def test_an_all_arm64_bundle_is_kept(self): + self.assertEqual(self.choose({"min.msi": "Arm64", "extra.msi": "Arm64"}), ["min.msi", "extra.msi"]) + + +class InstallWrapperTest(unittest.TestCase): + + def wrap(self, count): + wrap = MSI["install_wrapper"] + names = wrap.__globals__ + saved = {key: names[key] for key in ("unpack_installer", "packages_in", "choose_packages", "Installer")} + + class Empty: + def __init__(self, *args, **kwargs): + pass + + def install(self): + raise MSI["MsiError"]("the package installs nothing here") + + names["unpack_installer"] = lambda path, dest: "bundle" + names["packages_in"] = lambda dest: [] + names["choose_packages"] = lambda found, root: [Path("p%d.msi" % index) for index in range(count)] + names["Installer"] = Empty + root = Path(tempfile.mkdtemp()) + try: + return wrap(root / "setup.exe", root / "out") + finally: + names.update(saved) + + def test_a_bundle_whose_packages_all_install_nothing_is_rejected(self): + with self.assertRaises(MSI["MsiError"]): + self.wrap(2) + + class ToolsTest(unittest.TestCase): def test_the_tools_find_their_own_libraries(self): paths = MSI["tool_env"]()["LD_LIBRARY_PATH"].split(":") @@ -118,6 +174,39 @@ class LayoutTest(unittest.TestCase): inst.select() self.assertEqual(inst.included_components, {"Up", "Wide"}) + def architecture_package(self, platform, key="SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", name="PROCESSOR_ARCHITECTURE"): + return installer({ + "Feature": rows("Feature Feature_Parent Level", ("Main", "", "1")), + "AppSearch": rows("Property Signature_", ("ARM64CHECK", "arch"), ("OTHER", "unrelated")), + "RegLocator": rows("Signature_ Root Key Name Type", + ("arch", "2", key, name, "2"), + ("unrelated", "2", "SOFTWARE\\Vendor", "Path", "2")), + "Component": rows("Component Directory_ Attributes Condition", + ("Native", "TARGETDIR", "256", 'ARM64CHECK = "ARM64"'), + ("Always", "TARGETDIR", "256", "")), + "FeatureComponents": rows("Feature_ Component_", ("Main", "Native"), ("Main", "Always")), + }, summary={"template": "%s;1033" % platform}) + + def test_the_architecture_lookup_enables_arm64_components_in_an_arm64_package(self): + inst = self.architecture_package("Arm64") + inst.run_app_search() + inst.select() + self.assertEqual(inst.included_components, {"Native", "Always"}) + self.assertNotIn("OTHER", inst.props) + + def test_the_architecture_lookup_ignores_registry_name_case(self): + inst = self.architecture_package("Arm64", "System\\CurrentControlSet\\Control\\Session Manager\\Environment\\", "Processor_Architecture") + inst.run_app_search() + inst.select() + self.assertEqual(inst.props["ARM64CHECK"], "ARM64") + self.assertEqual(inst.included_components, {"Native", "Always"}) + + def test_the_architecture_lookup_leaves_other_packages_alone(self): + inst = self.architecture_package("x64") + inst.run_app_search() + inst.select() + self.assertEqual(inst.included_components, {"Always"}) + def test_a_duplicate_onto_the_file_itself_is_skipped(self): with tempfile.TemporaryDirectory() as tmp: src = Path(tmp) / "cab" / "dotnet.exe" From 16e92db2347efaaf608069a0d1e368ff6f664c56 Mon Sep 17 00:00:00 2001 From: superboo07 <39241538+superboo07@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:48:47 -0500 Subject: [PATCH 072/120] Option to not mount the phones storage to the container (#1443) --- .../com/droiddeck/launcher/agent/AgentHost.kt | 3 +- .../launcher/runtime/GuestCommand.kt | 3 +- .../launcher/runtime/LinuxRuntime.java | 7 +++- .../droiddeck/launcher/runtime/UserApps.kt | 7 ++-- .../launcher/session/BottomDesktop.kt | 6 ++-- .../launcher/session/SessionPrefs.kt | 8 +++++ .../launcher/session/SessionService.kt | 36 ++++++++++++------- .../launcher/session/SettingsReset.kt | 2 +- .../droiddeck/launcher/stores/gog/GogComet.kt | 5 ++- .../droiddeck/launcher/stores/xbox/Xodus.kt | 3 +- .../com/droiddeck/launcher/ui/RomsDialog.kt | 4 ++- .../droiddeck/launcher/ui/SettingsIndex.kt | 1 + .../com/droiddeck/launcher/ui/StoragePage.kt | 15 ++++++++ app/src/main/res/values-ar/strings.xml | 3 ++ app/src/main/res/values-b+es+419/strings.xml | 3 ++ app/src/main/res/values-bg/strings.xml | 3 ++ app/src/main/res/values-cs/strings.xml | 3 ++ app/src/main/res/values-da/strings.xml | 3 ++ app/src/main/res/values-de/strings.xml | 3 ++ app/src/main/res/values-el/strings.xml | 3 ++ app/src/main/res/values-es/strings.xml | 3 ++ app/src/main/res/values-fi/strings.xml | 3 ++ app/src/main/res/values-fr/strings.xml | 3 ++ app/src/main/res/values-hi/strings.xml | 3 ++ app/src/main/res/values-hu/strings.xml | 3 ++ app/src/main/res/values-in/strings.xml | 3 ++ app/src/main/res/values-it/strings.xml | 3 ++ app/src/main/res/values-ja/strings.xml | 3 ++ app/src/main/res/values-ko/strings.xml | 3 ++ app/src/main/res/values-ms/strings.xml | 3 ++ app/src/main/res/values-nb/strings.xml | 3 ++ app/src/main/res/values-nl/strings.xml | 3 ++ app/src/main/res/values-pl/strings.xml | 3 ++ app/src/main/res/values-pt-rPT/strings.xml | 3 ++ app/src/main/res/values-pt/strings.xml | 3 ++ app/src/main/res/values-ro/strings.xml | 3 ++ app/src/main/res/values-ru/strings.xml | 3 ++ app/src/main/res/values-sv/strings.xml | 3 ++ app/src/main/res/values-th/strings.xml | 3 ++ app/src/main/res/values-tr/strings.xml | 3 ++ app/src/main/res/values-uk/strings.xml | 3 ++ app/src/main/res/values-vi/strings.xml | 3 ++ app/src/main/res/values-zh-rCN/strings.xml | 3 ++ app/src/main/res/values-zh-rHK/strings.xml | 3 ++ app/src/main/res/values-zh-rTW/strings.xml | 3 ++ app/src/main/res/values/strings.xml | 3 ++ docs/settings-map.md | 1 + 47 files changed, 172 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentHost.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentHost.kt index 80667afef0..566cfde355 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentHost.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentHost.kt @@ -1,7 +1,6 @@ package com.droiddeck.launcher.agent import android.content.Context -import android.os.Environment import android.os.Handler import android.os.Looper import android.os.SystemClock @@ -564,7 +563,7 @@ object AgentHost { (if (connectAdb) "adb start-server >/dev/null 2>&1; adb connect \"\$ADB_SERIAL\" >/dev/null 2>&1; " else "") + "cd \"$1\" 2>/dev/null; shift; exec \"$@\"", "sh", workdir, ) - val proot = LinuxRuntime.command(app, null, null, Environment.getExternalStorageDirectory(), null, env + shell + command, fakeRoot) + val proot = LinuxRuntime.command(app, null, null, LinuxRuntime.sharedStorage(app), null, env + shell + command, fakeRoot) return ProcessBuilder(proot).redirectErrorStream(true).apply { environment().apply { remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH") diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/GuestCommand.kt b/app/src/main/java/com/droiddeck/launcher/runtime/GuestCommand.kt index 2c5fbad51e..6c0936e679 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/GuestCommand.kt +++ b/app/src/main/java/com/droiddeck/launcher/runtime/GuestCommand.kt @@ -1,7 +1,6 @@ package com.droiddeck.launcher.runtime import android.content.Context -import android.os.Environment import com.droiddeck.launcher.core.DownloadSource import com.droiddeck.launcher.core.HostProcess import com.droiddeck.launcher.session.OrphanReaper @@ -37,7 +36,7 @@ object GuestCommand { SessionFiles.stage(context, root) LinuxNetworkLinkComponent(context, root).publish() val runtimeDir = File(context.filesDir, ".flatpak-rt").apply { mkdirs() } - val binds = LinuxRuntime.binds(context, null, runtimeDir, Environment.getExternalStorageDirectory(), extraBinds) + val binds = LinuxRuntime.binds(context, null, runtimeDir, LinuxRuntime.sharedStorage(context), extraBinds) val native = NativeGuest.forSession(context) val fastPathKey = if (!native && fastPath && !fakeRoot && linkDir == null && ProotFastPath.enabled(context)) ProotFastPath.key(root, binds) else null val guest = mutableListOf( diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java index fd59297b1f..142d4e90bc 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java +++ b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java @@ -185,7 +185,12 @@ public final class LinuxRuntime { public static List lastBinds(Context context) { List binds = lastBinds; if (binds != null) return binds; - return binds(context, null, null, android.os.Environment.getExternalStorageDirectory(), null); + return binds(context, null, null, sharedStorage(context), null); + } + + /** The phone's shared storage, or null when it should stay out of the container. */ + public static File sharedStorage(Context context) { + return SessionPrefs.mountSharedStorage(context) ? android.os.Environment.getExternalStorageDirectory() : null; } public static List prootPrefix(Context context, File root, String cwd) { diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/UserApps.kt b/app/src/main/java/com/droiddeck/launcher/runtime/UserApps.kt index efc460ee04..ea9b0ba699 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/UserApps.kt +++ b/app/src/main/java/com/droiddeck/launcher/runtime/UserApps.kt @@ -14,6 +14,7 @@ import com.droiddeck.launcher.R import com.droiddeck.launcher.core.Downloader import com.droiddeck.launcher.core.FileUtils import com.droiddeck.launcher.core.Hashes +import com.droiddeck.launcher.session.SessionPrefs import com.droiddeck.launcher.store.FlathubApi import org.json.JSONArray import org.json.JSONObject @@ -184,9 +185,10 @@ object UserApps { fun binds(context: Context): List { val internal = Environment.getExternalStorageDirectory().canonicalPath + val mounted = SessionPrefs.mountSharedStorage(context) return root(context).listFiles().orEmpty().mapNotNull { dir -> val target = runCatching { Os.readlink(File(dir, "files").path) }.getOrNull() ?: return@mapNotNull null - target.takeIf { !it.startsWith("$internal/") && File(it).isDirectory } + target.takeIf { !(mounted && it.startsWith("$internal/")) && File(it).isDirectory } }.distinct() } @@ -475,7 +477,8 @@ object UserApps { if (!file.isFile) return context.getString(R.string.user_apps_file_gone) if (!FlatpakManager.ready(context)) FlatpakManager.setup(context, onProgress)?.let { return it } val shared = Environment.getExternalStorageDirectory().canonicalPath - val copy = File(LinuxRuntime.rootDir(context), "tmp/droiddeck-bundle.flatpak").takeIf { !file.canonicalPath.startsWith("$shared/") } + val copy = File(LinuxRuntime.rootDir(context), "tmp/droiddeck-bundle.flatpak") + .takeIf { !SessionPrefs.mountSharedStorage(context) || !file.canonicalPath.startsWith("$shared/") } try { if (copy != null) { onProgress(context.getString(R.string.user_apps_copying, file.name), -1) diff --git a/app/src/main/java/com/droiddeck/launcher/session/BottomDesktop.kt b/app/src/main/java/com/droiddeck/launcher/session/BottomDesktop.kt index b25ed487a2..a8b76934ee 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/BottomDesktop.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/BottomDesktop.kt @@ -40,6 +40,7 @@ object BottomDesktop { val generation: Int, val installed: Boolean, val nativeUserland: Boolean, + val sharedStorage: File?, ) @Volatile private var launch: Launch? = null @@ -91,10 +92,11 @@ object BottomDesktop { sessionDir: File, generation: Int, nativeUserland: Boolean, + sharedStorage: File?, stillCurrent: () -> Boolean, ) { val prepared = Launch(ArrayList(guest), ArrayList(binds), sessionRoot, hostEnvironment.copyOf(), root, sessionDir, generation, - DesktopCatalog.desktopInstalled(root), nativeUserland) + DesktopCatalog.desktopInstalled(root), nativeUserland, sharedStorage) synchronized(launchLock) { if (stillCurrent()) launch = prepared } } @@ -313,7 +315,7 @@ object BottomDesktop { val runtime = runtimeDir(context).apply { mkdirs() } val imeDir = File(current.sessionRoot, "bottom-desktop-ime") main.post { if (generation == guestGeneration) watchIme(imeDir) } - val binds = LinuxRuntime.binds(context, current.sessionRoot, runtime, Environment.getExternalStorageDirectory(), current.binds) + val binds = LinuxRuntime.binds(context, current.sessionRoot, runtime, current.sharedStorage, current.binds) val guest = ArrayList(current.guest).apply { add("DD_WIDTH=$width") add("DD_HEIGHT=$height") diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index a7dffb7e20..5c42132e9e 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -1090,6 +1090,14 @@ object SessionPrefs { fun gameThreadHints(context: Context): Boolean = prefs(context).getBoolean("gameThreadHints", true) + /** Whether the phone's shared storage (/sdcard) is mounted into the Linux container. */ + @JvmStatic + fun mountSharedStorage(context: Context): Boolean = prefs(context).getBoolean("mountSharedStorage", true) + + fun setMountSharedStorage(context: Context, on: Boolean) { + prefs(context).edit().putBoolean("mountSharedStorage", on).apply() + } + fun prootNoSeccomp(context: Context): Boolean = prefs(context).getBoolean("prootNoSeccomp", false) fun setProotNoSeccomp(context: Context, on: Boolean) { diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index 18b3d5b4e8..c2296584e5 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -742,14 +742,15 @@ class SessionService : Service() { SessionEvents.step("shm-clear") { FileUtils.clear(File(LinuxRuntime.liveDir(this), "shm")) } - val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir) + val sharedStorage = LinuxRuntime.sharedStorage(this) + val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir, sharedStorage) val nativeUserland = com.droiddeck.launcher.runtime.NativeGuest.enabled(this) synchronized(stopLock) { if (gen == sessionGen && SessionState.running) com.droiddeck.launcher.runtime.NativeGuest.sessionMode = nativeUserland } val fastPathKey = if (ProotFastPath.enabled(this)) { val prootBinds = LinuxRuntime.binds( - this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds, + this, sessionRoot, runtimeDir, sharedStorage, binds, ) val root = LinuxRuntime.rootDir(this) ProotFastPath.key(root, prootBinds)?.also { key -> @@ -763,12 +764,12 @@ class SessionService : Service() { } } else null - val sessionBindSpecs = LinuxRuntime.binds(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds) + val sessionBindSpecs = LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds) val command = if (nativeUserland) { LinuxRuntime.rememberSessionBinds(sessionBindSpecs) com.droiddeck.launcher.runtime.NativeGuest.command(root, guest.first(), guest.drop(1)) } else { - LinuxRuntime.command(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds, guest) + LinuxRuntime.command(this, sessionRoot, runtimeDir, sharedStorage, binds, guest) } val prootEnv = HostEnvironment() @@ -797,7 +798,7 @@ class SessionService : Service() { val terminalCommand = if (nativeUserland) { com.droiddeck.launcher.runtime.NativeGuest.command(root, shellGuest.first(), shellGuest.drop(1)) } else { - LinuxRuntime.command(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds, shellGuest) + LinuxRuntime.command(this, sessionRoot, runtimeDir, sharedStorage, binds, shellGuest) } val terminalHostEnvironment = LinkedHashMap(System.getenv()) hostEnv.asArray().forEach { entry -> @@ -808,7 +809,7 @@ class SessionService : Service() { SessionTerminal.prepare(terminalCommand, terminalHostEnvironment.map { (key, value) -> "$key=$value" }.toTypedArray(), root, gen) val (fastPathName, _) = ProotFastPath.hostEnv("") BottomDesktop.prepare(desktopGuest, binds, sessionRoot, - prootEnv.asArray().filterNot { it.startsWith("$fastPathName=") }.toTypedArray(), root, sessionDir, gen, nativeUserland, + prootEnv.asArray().filterNot { it.startsWith("$fastPathName=") }.toTypedArray(), root, sessionDir, gen, nativeUserland, sharedStorage, ) { gen == sessionGen && SessionState.running } } @@ -1256,6 +1257,7 @@ class SessionService : Service() { guest: MutableList, sessionRoot: File, runtimeDir: File, + sharedStorage: File?, ): ArrayList { val binds = ArrayList() if (controllersOn) binds.add(fakeInputDir.path + ":/dev/input") @@ -1299,7 +1301,17 @@ class SessionService : Service() { if (controllersOn) components.add(RumbleComponent().also { it.attach(this) }) val home = File(LinuxRuntime.rootDir(this), "root") File(home, "Storage").mkdirs() - binds.add(Environment.getExternalStorageDirectory().path + ":/root/Storage") + if (sharedStorage != null) { + binds.add(sharedStorage.path + ":/root/Storage") + } else { + for (folder in com.droiddeck.launcher.frontend.AddedExes.list(this).map { File(it.folder) }.distinctBy { it.path }) { + val guest = com.droiddeck.launcher.frontend.AddedGames.guestPath(this, folder) ?: continue + if (!guest.startsWith("/root/Storage/") || !folder.isDirectory) continue + File(LinuxRuntime.rootDir(this), guest.removePrefix("/")).mkdirs() + binds.add(folder.path + ":" + guest) + Log.i(TAG, "added game: $folder -> $guest (shared storage not mounted)") + } + } val library = GameStorage.effective(this) steamLibraryMounts = emptyMap() var storageDiagnosticLibrary: File? = null @@ -1373,7 +1385,7 @@ class SessionService : Service() { val gamesLibraries = GameStorage.gamesFolderLibraries(this) if (gamesLibraries.isNotEmpty()) { var room = if (ProotFastPath.enabled(this)) { - ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds).size + ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size } else Int.MAX_VALUE for (games in gamesLibraries) { if (games.host.path + ":" + games.guest !in binds) continue @@ -1415,7 +1427,7 @@ class SessionService : Service() { } try { val room = if (ProotFastPath.enabled(this)) { - ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds).size + ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size } else Int.MAX_VALUE val content = SecondaryLibrary.contentPath(entry.host) val extra = SecondaryLibrary.binds(filesDir, entry.host, listOf(entry.guest), content = content) @@ -1444,7 +1456,7 @@ class SessionService : Service() { Log.w(TAG, "x86-64 steam library: $problem") } else try { val room = if (ProotFastPath.enabled(this)) { - ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds).size + ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size } else Int.MAX_VALUE val extra = SecondaryLibrary.binds(filesDir, x64, listOf(GameStorage.X64_CARD_GUEST)).drop(1) if (extra.size > room) { @@ -1466,7 +1478,7 @@ class SessionService : Service() { } try { val room = if (ProotFastPath.enabled(this)) { - ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds).size + ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size } else Int.MAX_VALUE val extra = SecondaryLibrary.binds(filesDir, entry.x64Host, listOf(entry.x64Guest)).drop(1) if (extra.size > room) { @@ -1502,7 +1514,7 @@ class SessionService : Service() { val listing = File(filesDir, "session/desktop-volumes.json").apply { parentFile?.mkdirs() } val volumes = org.json.JSONArray() var room = if (ProotFastPath.enabled(this)) { - ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds).size + ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size } else Int.MAX_VALUE for (root in com.droiddeck.launcher.files.StorageRoots.list(this)) { if (!root.removable || !root.readable) continue diff --git a/app/src/main/java/com/droiddeck/launcher/session/SettingsReset.kt b/app/src/main/java/com/droiddeck/launcher/session/SettingsReset.kt index 0c1d8ddb1b..dcac4fef89 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SettingsReset.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SettingsReset.kt @@ -22,7 +22,7 @@ object SettingsReset { "gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop", "tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "paceCores", "directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus", - "noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite", + "noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite", "mountSharedStorage", "guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark", "upscaler", "upscaleSharpness", "screenEffects", "blackFrameInsertion", "textureAnisotropy", "textureLodBias", "steamDownloadsInBackground", "steam_offline", "steam_offline_auto", "steam_offline_by_network", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie", diff --git a/app/src/main/java/com/droiddeck/launcher/stores/gog/GogComet.kt b/app/src/main/java/com/droiddeck/launcher/stores/gog/GogComet.kt index 8ad240e651..6f77df7990 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/gog/GogComet.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/gog/GogComet.kt @@ -1,7 +1,6 @@ package com.droiddeck.launcher.stores.gog import android.content.Context -import android.os.Environment import android.util.Log import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -143,9 +142,9 @@ object GogComet { val pb = if (com.droiddeck.launcher.runtime.NativeGuest.forSession(context)) { val root = LinuxRuntime.rootDir(context) com.droiddeck.launcher.runtime.NativeGuest.processBuilder(context, root, - LinuxRuntime.binds(context, null, null, Environment.getExternalStorageDirectory(), null), guest).redirectErrorStream(true) + LinuxRuntime.binds(context, null, null, LinuxRuntime.sharedStorage(context), null), guest).redirectErrorStream(true) } else { - ProcessBuilder(LinuxRuntime.command(context, null, null, Environment.getExternalStorageDirectory(), guest)).redirectErrorStream(true).also { + ProcessBuilder(LinuxRuntime.command(context, null, null, LinuxRuntime.sharedStorage(context), guest)).redirectErrorStream(true).also { it.environment().apply { remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH") put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path) diff --git a/app/src/main/java/com/droiddeck/launcher/stores/xbox/Xodus.kt b/app/src/main/java/com/droiddeck/launcher/stores/xbox/Xodus.kt index 39866fceea..07d47c78cd 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/xbox/Xodus.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/xbox/Xodus.kt @@ -1,7 +1,6 @@ package com.droiddeck.launcher.stores.xbox import android.content.Context -import android.os.Environment import com.droiddeck.launcher.core.AddonPack import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent import com.droiddeck.launcher.runtime.LinuxRuntime @@ -82,7 +81,7 @@ internal object Xodus { networkLink.start() val runtime = (runtimeDirectory ?: File(app.filesDir, "xbox-runtime")).apply { mkdirs() } val root = LinuxRuntime.rootDir(app) - val external = Environment.getExternalStorageDirectory() + val external = LinuxRuntime.sharedStorage(app) val extraBinds = StoreInstallRoot.externalBindSpecsForXodus(app) val binds = LinuxRuntime.binds(app, null, null, external, extraBinds) val fastPathPreloaded = runCatching { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/RomsDialog.kt b/app/src/main/java/com/droiddeck/launcher/ui/RomsDialog.kt index 2504a2eee3..e9e09f7e45 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/RomsDialog.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/RomsDialog.kt @@ -3,6 +3,8 @@ package com.droiddeck.launcher.ui import androidx.compose.foundation.shape.CircleShape import com.droiddeck.launcher.R import androidx.compose.ui.res.stringResource +import androidx.compose.ui.platform.LocalContext +import com.droiddeck.launcher.session.SessionPrefs import androidx.compose.foundation.layout.Column import androidx.compose.ui.Modifier import androidx.compose.foundation.layout.Spacer @@ -22,7 +24,7 @@ fun RomsDialog(path: String?, onChoose: () -> Unit, onClear: () -> Unit, onDismi text = { Column { Text( - stringResource(R.string.roms_text), + stringResource(if (SessionPrefs.mountSharedStorage(LocalContext.current)) R.string.roms_text else R.string.roms_text_unmounted), style = MaterialTheme.typography.bodyMedium, ) Spacer(Modifier.height(10.dp)) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SettingsIndex.kt b/app/src/main/java/com/droiddeck/launcher/ui/SettingsIndex.kt index b95dd6ae1b..a47da769fc 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SettingsIndex.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SettingsIndex.kt @@ -92,6 +92,7 @@ internal object SettingsIndex { s(SettingsSection.CONTROLLER, R.string.setup_tab_controller, "gamepad", "buttons", "mapping", "profile", "remap"), SettingsEntry(SettingsPlace.TAB, R.string.rail_storage, tab = "storage", words = listOf("sd card", "space", "uninstall", "disk")), + SettingsEntry(SettingsPlace.TAB, R.string.storage_shared_mount, tab = "storage", words = listOf("sdcard", "mount", "privacy", "files")), SettingsEntry(SettingsPlace.TAB, R.string.rail_sync, tab = "sync", words = listOf("syncthing", "saves")), SettingsEntry(SettingsPlace.TAB, R.string.rail_decky, tab = "decky", words = listOf("plugins", "plugin store", "homebrew", "loader")), SettingsEntry(SettingsPlace.TAB, R.string.rail_boot_movies, tab = "boot-movies", words = listOf("startup movie", "boot video", "animation", "steamdeckrepo")), diff --git a/app/src/main/java/com/droiddeck/launcher/ui/StoragePage.kt b/app/src/main/java/com/droiddeck/launcher/ui/StoragePage.kt index 00b09f2145..caa629aa55 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/StoragePage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/StoragePage.kt @@ -168,6 +168,20 @@ internal fun StoragePanel(s: FrontEndState, a: FrontEndActions) { } } +@Composable +private fun SharedStorageGroup() { + val ctx = LocalContext.current + var on by remember { mutableStateOf(SessionPrefs.mountSharedStorage(ctx)) } + SettingsGroup(stringResource(R.string.setup_runtime)) { + SettingsRow(stringResource(R.string.storage_shared_mount), stringResource(R.string.storage_shared_mount_hint)) { + ToggleSwitch(on, label = stringResource(R.string.storage_shared_mount), modifier = Modifier.testTag("setting-shared-storage")) { + SessionPrefs.setMountSharedStorage(ctx, it) + on = it + } + } + } +} + @Composable private fun DefaultStorageGroup() { val ctx = LocalContext.current @@ -347,6 +361,7 @@ private fun OverviewContent(report: StorageSummary, sessionRunning: Boolean, wid Note(stringResource(R.string.storage_session_running)) } DefaultStorageGroup() + SharedStorageGroup() SectionTitle(stringResource(R.string.storage_where), null) val unused = report.unusedTools val tiles = listOf<@Composable (Modifier) -> Unit>( diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 84d4fc1e30..6adbf809b9 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1492,6 +1492,7 @@ %1$d%% استئناف %1$s يظهر باسم /root/ROMs في كل جلسة. مساحة التخزين الداخلية متاحة في /root/Storage. + يظهر باسم /root/ROMs في كل جلسة. لم يتم اختيار مجلد يُطبَّق في الجلسة التالية. بطاقات SD مدعومة. اختيار مجلد @@ -3339,6 +3340,8 @@ موقع التثبيت التخزين الافتراضي تُثبَّت ألعاب المتاجر الجديدة في الموقع المحدد. تبقى الألعاب الحالية في مكانها. تحتفظ مكتبات Steam بإعدادها الخاص. + مساحة تخزين الهاتف في Linux + يربط مساحة التخزين الداخلية لهاتفك في /root/Storage. عند إيقافه، تُربط فقط مجلدات الألعاب التي أضفتها منها. لا تتأثر بطاقات SD. يُطبَّق في الجلسة التالية. السؤال في كل مرة اختر وجهة لكل تثبيت مساحة التخزين الداخلية diff --git a/app/src/main/res/values-b+es+419/strings.xml b/app/src/main/res/values-b+es+419/strings.xml index 12acc6385d..bfc1963cb3 100644 --- a/app/src/main/res/values-b+es+419/strings.xml +++ b/app/src/main/res/values-b+es+419/strings.xml @@ -1538,6 +1538,7 @@ %1$d%% Reanudar %1$s Aparece como /root/ROMs en cada sesión. El almacenamiento interno está en /root/Storage. + Aparece como /root/ROMs en cada sesión. Ninguna carpeta elegida Se aplica en la próxima sesión. Las tarjetas SD funcionan. Elegir carpeta @@ -3215,6 +3216,8 @@ Ubicación de instalación Almacenamiento predeterminado Las nuevas instalaciones de las tiendas van a la ubicación seleccionada. Los juegos existentes se quedan donde están. Las bibliotecas de Steam conservan su propio ajuste. + Almacenamiento del teléfono en Linux + Monta el almacenamiento interno de tu teléfono en /root/Storage. Si está desactivado, solo se montan las carpetas de juegos que agregaste desde ahí. No afecta a las tarjetas SD. Se aplica en la próxima sesión. Preguntar siempre Elige un destino para cada instalación Almacenamiento interno diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 84a2d916ec..0eeec70877 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -1460,6 +1460,7 @@ %1$d%% Продължаване на %1$s Показва се като /root/ROMs във всяка сесия. Вътрешната памет е на /root/Storage. + Показва се като /root/ROMs във всяка сесия. Няма избрана папка Прилага се от следващата сесия. SD картите работят. Избор на папка @@ -3219,6 +3220,8 @@ Място за инсталиране Хранилище по подразбиране Новите инсталации от магазини отиват в избраното място. Съществуващите игри остават, където са. Библиотеките на Steam запазват собствената си настройка. + Хранилище на телефона в Linux + Монтира вътрешната памет на телефона ви в /root/Storage. Когато е изключено, се монтират само папките с игри, които сте добавили от нея. SD картите не се засягат. Прилага се от следващата сесия. Питане всеки път Избор на място за всяка инсталация Вътрешна памет diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index d18f09faa1..833c403b0d 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -1476,6 +1476,7 @@ %1$d%% Obnovit %1$s V každé relaci se zobrazí jako /root/ROMs. Vnitřní úložiště je v /root/Storage. + V každé relaci se zobrazí jako /root/ROMs. Nevybrána žádná složka Použije se v další relaci. SD karty fungují. Vybrat složku @@ -3279,6 +3280,8 @@ Umístění instalace Výchozí úložiště Nové instalace z obchodů půjdou do vybraného umístění. Stávající hry zůstanou, kde jsou. Knihovny Steamu mají vlastní nastavení. + Úložiště telefonu v Linuxu + Připojí vnitřní úložiště telefonu do /root/Storage. Když je vypnuto, připojí se jen složky her, které jste z něj přidali. Karet SD se to netýká. Projeví se v příští relaci. Vždy se zeptat Vybrat cíl u každé instalace Interní úložiště diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 48e476a0a6..6efe122eb6 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -1460,6 +1460,7 @@ %1$d%% Genoptag %1$s Vises som /root/ROMs i hver session. Intern lagerplads er på /root/Storage. + Vises som /root/ROMs i hver session. Ingen mappe valgt Gælder fra næste session. SD-kort fungerer. Vælg mappe @@ -3219,6 +3220,8 @@ Installationsplacering Standardlager Nye butiksinstallationer går til den valgte placering. Eksisterende spil bliver, hvor de er. Steam-biblioteker har deres egen indstilling. + Telefonens lager i Linux + Monterer telefonens interne lager på /root/Storage. Når det er slået fra, monteres kun de spilmapper, du har tilføjet derfra. SD-kort påvirkes ikke. Træder i kraft ved næste session. Spørg hver gang Vælg en placering for hver installation Internt lager diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index cee30dc25d..31d8914d6c 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1452,6 +1452,7 @@ %1$d %% %1$s fortsetzen Erscheint in jeder Sitzung als /root/ROMs. Der interne Speicher liegt unter /root/Storage. + Erscheint in jeder Sitzung als /root/ROMs. Kein Ordner ausgewählt Gilt ab der nächsten Sitzung. SD-Karten funktionieren. Ordner auswählen @@ -3219,6 +3220,8 @@ Installationsort Standardspeicher Neue Store-Installationen landen am ausgewählten Ort. Vorhandene Spiele bleiben, wo sie sind. Steam-Bibliotheken behalten ihre eigene Einstellung. + Telefonspeicher in Linux + Bindet den internen Speicher deines Telefons unter /root/Storage ein. Wenn aus, werden nur Spielordner eingebunden, die du daraus hinzugefügt hast. SD-Karten sind nicht betroffen. Gilt ab der nächsten Sitzung. Jedes Mal fragen Für jede Installation ein Ziel wählen Interner Speicher diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index b3f81ca591..5cad897424 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -1460,6 +1460,7 @@ %1$d%% Συνέχιση %1$s Εμφανίζεται ως /root/ROMs σε κάθε συνεδρία. Ο εσωτερικός χώρος αποθήκευσης βρίσκεται στο /root/Storage. + Εμφανίζεται ως /root/ROMs σε κάθε συνεδρία. Δεν έχει επιλεγεί φάκελος Ισχύει από την επόμενη συνεδρία. Οι κάρτες SD λειτουργούν. Επιλογή φακέλου @@ -3219,6 +3220,8 @@ Τοποθεσία εγκατάστασης Προεπιλεγμένος αποθηκευτικός χώρος Οι νέες εγκαταστάσεις από καταστήματα πηγαίνουν στην επιλεγμένη τοποθεσία. Τα υπάρχοντα παιχνίδια μένουν όπου είναι. Οι βιβλιοθήκες Steam διατηρούν τη δική τους ρύθμιση. + Αποθηκευτικός χώρος τηλεφώνου στο Linux + Προσαρτά τον εσωτερικό χώρο αποθήκευσης του τηλεφώνου σας στο /root/Storage. Όταν είναι απενεργοποιημένο, προσαρτώνται μόνο οι φάκελοι παιχνιδιών που προσθέσατε από αυτόν. Οι κάρτες SD δεν επηρεάζονται. Ισχύει από την επόμενη συνεδρία. Ερώτηση κάθε φορά Επιλογή προορισμού για κάθε εγκατάσταση Εσωτερικός αποθηκευτικός χώρος diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 2d2a4244a4..c055194828 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1468,6 +1468,7 @@ %1$d%% Reanudar %1$s Aparece como /root/ROMs en cada sesión. El almacenamiento interno está en /root/Storage. + Aparece como /root/ROMs en cada sesión. Ninguna carpeta elegida Se aplica en la próxima sesión. Las tarjetas SD funcionan. Elegir carpeta @@ -3249,6 +3250,8 @@ Ubicación de instalación Almacenamiento predeterminado Las nuevas instalaciones de las tiendas van a la ubicación seleccionada. Los juegos existentes se quedan donde están. Las bibliotecas de Steam conservan su propio ajuste. + Almacenamiento del teléfono en Linux + Monta el almacenamiento interno del teléfono en /root/Storage. Si está desactivado, solo se montan las carpetas de juegos que has añadido desde ahí. No afecta a las tarjetas SD. Se aplica en la próxima sesión. Preguntar siempre Elige un destino para cada instalación Almacenamiento interno diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 7a11c6eaa2..4fac8b737d 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -1460,6 +1460,7 @@ %1$d %% Jatka: %1$s Näkyy sessiossa polussa /root/ROMs. Sisäinen tallennustila on /root/Storage. + Näkyy sessiossa polussa /root/ROMs. Kansiota ei valittu Vaikuttaa seuraavaan istuntoon. SD-kortit toimivat. Valitse kansio @@ -3219,6 +3220,8 @@ Asennussijainti Oletustallennustila Uudet kauppa-asennukset menevät valittuun sijaintiin. Nykyiset pelit pysyvät paikoillaan. Steam-kirjastoilla on oma asetuksensa. + Puhelimen tallennustila Linuxissa + Liittää puhelimen sisäisen tallennustilan polkuun /root/Storage. Kun pois päältä, liitetään vain sieltä lisäämäsi pelikansiot. SD-kortit eivät muutu. Tulee voimaan seuraavassa istunnossa. Kysy aina Valitse kohde jokaiselle asennukselle Sisäinen tallennustila diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4326efc5a5..05ed77da3c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1467,6 +1467,7 @@ %1$d%% Reprendre %1$s Affiché comme /root/ROMs dans chaque session. Le stockage interne se trouve dans /root/Storage. + Affiché comme /root/ROMs dans chaque session. Aucun dossier sélectionné Prendra effet à la prochaine session. Prend en charge les cartes SD. Choisir un dossier @@ -3248,6 +3249,8 @@ Emplacement d\'installation Stockage par défaut Les nouvelles installations depuis les boutiques vont à l\'emplacement sélectionné. Les jeux existants restent où ils sont. Les bibliothèques Steam gardent leur propre réglage. + Stockage du téléphone dans Linux + Monte le stockage interne de votre téléphone dans /root/Storage. Désactivé, seuls les dossiers de jeux que vous y avez ajoutés sont montés. Les cartes SD ne sont pas concernées. S\'applique à la prochaine session. Toujours demander Choisir une destination pour chaque installation Stockage interne diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 325e643f0d..174f70bfa1 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -1460,6 +1460,7 @@ %1$d%% %1$s फिर से शुरू करें हर सेशन में /root/ROMs के रूप में दिखता है। इंटरनल स्टोरेज /root/Storage पर है। + हर सेशन में /root/ROMs के रूप में दिखता है। कोई फ़ोल्डर नहीं चुना गया अगले सेशन से लागू होता है। SD कार्ड काम करते हैं। फ़ोल्डर चुनें @@ -3219,6 +3220,8 @@ इंस्टॉल की जगह डिफ़ॉल्ट स्टोरेज स्टोर से नए इंस्टॉल चुनी गई जगह पर जाते हैं। मौजूदा गेम जहां हैं वहीं रहते हैं। Steam लाइब्रेरी अपनी सेटिंग रखती हैं। + Linux में फ़ोन स्टोरेज + आपके फ़ोन का इंटरनल स्टोरेज /root/Storage पर माउंट करता है। बंद होने पर केवल वही गेम फ़ोल्डर माउंट होते हैं जो आपने उसमें से जोड़े हैं। SD कार्ड पर असर नहीं पड़ता। अगले सत्र से लागू होता है। हर बार पूछें हर इंस्टॉल के लिए जगह चुनें इंटरनल स्टोरेज diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 977f9c68a4..5fdb4a5a66 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -1460,6 +1460,7 @@ %1$d%% %1$s folytatása Minden munkamenetben /root/ROMs néven jelenik meg. A belső tárhely itt található: /root/Storage. + Minden munkamenetben /root/ROMs néven jelenik meg. Nincs mappa kiválasztva A következő munkamenettől érvényes. SD-kártyák is működnek. Mappa kiválasztása @@ -3219,6 +3220,8 @@ Telepítési hely Alapértelmezett tárhely Az új áruházi telepítések a kiválasztott helyre kerülnek. A meglévő játékok a helyükön maradnak. A Steam-könyvtárak megtartják saját beállításukat. + Telefontárhely a Linuxban + Csatolja a telefon belső tárhelyét a /root/Storage helyre. Kikapcsolva csak az onnan hozzáadott játékmappák lesznek csatolva. Az SD-kártyákat nem érinti. A következő munkamenettől érvényes. Kérdezzen rá minden alkalommal Célhely választása minden telepítésnél Belső tárhely diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index de40e848c0..09891934b8 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -1453,6 +1453,7 @@ %1$d%% Lanjutkan %1$s Muncul sebagai /root/ROMs di setiap sesi. Penyimpanan internal berada di /root/Storage. + Muncul sebagai /root/ROMs di setiap sesi. Belum ada folder yang dipilih Berlaku pada sesi berikutnya. Kartu SD juga bisa. Pilih folder @@ -3190,6 +3191,8 @@ Lokasi instalasi Penyimpanan default Instalasi toko baru akan disimpan di lokasi yang dipilih. Game yang sudah ada tetap di lokasinya. Library Steam memakai pengaturannya sendiri. + Penyimpanan ponsel di Linux + Memasang penyimpanan internal ponsel Anda di /root/Storage. Jika nonaktif, hanya folder game yang Anda tambahkan dari sana yang dipasang. Kartu SD tidak terpengaruh. Berlaku pada sesi berikutnya. Tanyakan setiap kali Pilih target untuk setiap instalasi Penyimpanan internal diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 8c0ea88499..4aaee8b446 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1459,6 +1459,7 @@ %1$d%% Riprendi %1$s Appare come /root/ROMs in ogni sessione. La memoria interna si trova in /root/Storage. + Appare come /root/ROMs in ogni sessione. Nessuna cartella scelta Si applica dalla prossima sessione. Le schede SD funzionano. Scegli cartella @@ -3248,6 +3249,8 @@ Posizione di installazione Archiviazione predefinita Le nuove installazioni dai negozi vanno nella posizione selezionata. I giochi esistenti restano dove sono. Le librerie di Steam mantengono la propria impostazione. + Memoria del telefono in Linux + Monta la memoria interna del telefono in /root/Storage. Se disattivato, vengono montate solo le cartelle dei giochi che hai aggiunto da lì. Le schede SD non sono interessate. Si applica dalla prossima sessione. Chiedi ogni volta Scegli una destinazione per ogni installazione Memoria interna diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index be2b3f88a8..157a2b6627 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -1453,6 +1453,7 @@ %1$d%% %1$sを再開 各セッションで /root/ROMs として表示されます。内部ストレージは /root/Storage にあります。 + 各セッションで /root/ROMs として表示されます。 フォルダが選択されていません 次回のセッションで有効になります。SDカードをサポートしています。 フォルダを選択 @@ -3190,6 +3191,8 @@ インストール先 デフォルトのストレージ ストアからの新しいインストールは選択した場所に保存されます。既存のゲームはそのままです。Steamライブラリは独自の設定を使用します。 + Linux でのスマホのストレージ + スマホの内部ストレージを /root/Storage にマウントします。オフにすると、そこから追加したゲームフォルダーだけがマウントされます。SD カードには影響しません。次のセッションから適用されます。 毎回確認する インストールごとに保存先を選択します 内部ストレージ diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 3e01fad6aa..cd41e8aa47 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -1453,6 +1453,7 @@ %1$d%% %1$s 재개 각 세션에서 /root/ROMs로 표시됩니다. 내부 저장 공간은 /root/Storage에 있습니다. + 각 세션에서 /root/ROMs로 표시됩니다. 선택된 폴더 없음 다음 세션에 적용됩니다. SD 카드를 지원합니다. 폴더 선택 @@ -3190,6 +3191,8 @@ 설치 위치 기본 저장소 새 스토어 설치는 선택한 위치에 저장됩니다. 기존 게임은 그대로 유지됩니다. Steam 라이브러리는 자체 설정을 따릅니다. + Linux에서 휴대폰 저장소 + 휴대폰 내부 저장소를 /root/Storage에 마운트합니다. 끄면 그곳에서 추가한 게임 폴더만 마운트됩니다. SD 카드에는 영향이 없습니다. 다음 세션부터 적용됩니다. 매번 묻기 설치할 때마다 위치 선택 내부 저장소 diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml index ed95fc2b84..92d613f184 100644 --- a/app/src/main/res/values-ms/strings.xml +++ b/app/src/main/res/values-ms/strings.xml @@ -1453,6 +1453,7 @@ %1$d%% Sambung %1$s Muncul sebagai /root/ROMs dalam setiap sesi. Storan dalaman berada di /root/Storage. + Muncul sebagai /root/ROMs dalam setiap sesi. Tiada folder dipilih Berkuat kuasa pada sesi seterusnya. Kad SD berfungsi. Pilih folder @@ -3190,6 +3191,8 @@ Lokasi pemasangan Storan lalai Pemasangan kedai baharu pergi ke lokasi yang dipilih. Permainan sedia ada kekal di tempatnya. Pustaka Steam mengekalkan tetapan sendiri. + Storan telefon dalam Linux + Melekapkan storan dalaman telefon anda di /root/Storage. Apabila dimatikan, hanya folder permainan yang anda tambah dari situ dilekapkan. Kad SD tidak terjejas. Berkuat kuasa pada sesi seterusnya. Tanya setiap kali Pilih destinasi bagi setiap pemasangan Storan dalaman diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 9857e2440c..edc7b5fa51 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -1460,6 +1460,7 @@ %1$d%% Gjenoppta %1$s Vises som /root/ROMs i hver sesjon. Intern lagring er på /root/Storage. + Vises som /root/ROMs i hver sesjon. Ingen mappe valgt Gjelder fra neste sesjon. SD-kort fungerer. Velg mappe @@ -3219,6 +3220,8 @@ Installasjonsplassering Standard lagring Nye butikkinstallasjoner havner på valgt plassering. Eksisterende spill blir der de er. Steam-biblioteker beholder sin egen innstilling. + Telefonlagring i Linux + Monterer telefonens interne lagring på /root/Storage. Når det er av, monteres bare spillmapper du har lagt til derfra. SD-kort påvirkes ikke. Gjelder fra neste økt. Spør hver gang Velg et mål for hver installasjon Intern lagring diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 90abb15137..77808b5f3c 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1460,6 +1460,7 @@ %1$d%% %1$s hervatten Verschijnt in elke sessie als /root/ROMs. Interne opslag staat op /root/Storage. + Verschijnt in elke sessie als /root/ROMs. Geen map gekozen Geldt vanaf de volgende sessie. SD-kaarten werken ook. Map kiezen @@ -3219,6 +3220,8 @@ Installatielocatie Standaardopslag Nieuwe winkelinstallaties gaan naar de gekozen locatie. Bestaande games blijven waar ze zijn. Steam-bibliotheken houden hun eigen instelling. + Telefoonopslag in Linux + Koppelt de interne opslag van je telefoon aan /root/Storage. Als dit uit staat, worden alleen gamemappen gekoppeld die je daaruit hebt toegevoegd. SD-kaarten veranderen niet. Geldt vanaf de volgende sessie. Elke keer vragen Kies voor elke installatie een doel Interne opslag diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 4b75546761..687742d283 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1476,6 +1476,7 @@ %1$d%% Wznów %1$s W każdej sesji widoczny jako /root/ROMs. Pamięć wewnętrzna jest w /root/Storage. + W każdej sesji widoczny jako /root/ROMs. Nie wybrano folderu Zadziała od następnej sesji. Karty SD są obsługiwane. Wybierz folder @@ -3279,6 +3280,8 @@ Miejsce instalacji Domyślna pamięć Nowe instalacje ze sklepów trafiają do wybranego miejsca. Istniejące gry zostają, gdzie są. Biblioteki Steam mają własne ustawienie. + Pamięć telefonu w Linuksie + Montuje pamięć wewnętrzną telefonu w /root/Storage. Po wyłączeniu montowane są tylko dodane z niej foldery gier. Nie dotyczy kart SD. Działa od następnej sesji. Pytaj za każdym razem Wybieraj miejsce przy każdej instalacji Pamięć wewnętrzna diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 7b4a1207d1..c5970fe00b 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -1459,6 +1459,7 @@ %1$d%% Retomar %1$s Aparece como /root/ROMs em cada sessão. O armazenamento interno está em /root/Storage. + Aparece como /root/ROMs em cada sessão. Nenhuma pasta escolhida Aplica-se na próxima sessão. Funciona com cartões SD. Escolher pasta @@ -3263,6 +3264,8 @@ Local de instalação Armazenamento predefinido As novas instalações das lojas vão para o local selecionado. Os jogos existentes ficam onde estão. As bibliotecas do Steam mantêm a sua própria definição. + Armazenamento do telemóvel no Linux + Monta o armazenamento interno do telemóvel em /root/Storage. Desativado, só são montadas as pastas de jogos que adicionou a partir dele. Os cartões SD não são afetados. Aplica-se na próxima sessão. Perguntar sempre Escolha um destino para cada instalação Armazenamento interno diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index a09f4dfe39..df77690a5a 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1467,6 +1467,7 @@ %1$d%% Retomar %1$s Aparece como /root/ROMs em cada sessão. O armazenamento interno fica em /root/Storage. + Aparece como /root/ROMs em cada sessão. Nenhuma pasta escolhida Vale a partir da próxima sessão. Cartões SD funcionam. Escolher pasta @@ -3273,6 +3274,8 @@ Local de instalação Armazenamento padrão Novas instalações das lojas vão para o local selecionado. Jogos existentes ficam onde estão. As bibliotecas da Steam mantêm a própria configuração. + Armazenamento do celular no Linux + Monta o armazenamento interno do celular em /root/Storage. Desativado, só as pastas de jogos que você adicionou dele são montadas. Cartões SD não são afetados. Vale a partir da próxima sessão. Perguntar sempre Escolha um destino para cada instalação Armazenamento interno diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 32f55fe1be..8d6da38074 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -1468,6 +1468,7 @@ %1$d%% Reluare %1$s Apare ca /root/ROMs în fiecare sesiune. Stocarea internă este la /root/Storage. + Apare ca /root/ROMs în fiecare sesiune. Niciun folder ales Se aplică la sesiunea următoare. Cardurile SD funcționează. Alege folderul @@ -3249,6 +3250,8 @@ Locație de instalare Stocare implicită Instalările noi din magazine merg în locația selectată. Jocurile existente rămân unde sunt. Bibliotecile Steam își păstrează propria setare. + Stocarea telefonului în Linux + Montează stocarea internă a telefonului în /root/Storage. Când este dezactivat, se montează doar folderele de jocuri pe care le-ați adăugat de acolo. Cardurile SD nu sunt afectate. Se aplică din următoarea sesiune. Întreabă de fiecare dată Alege o destinație pentru fiecare instalare Stocare internă diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 23ee3124fc..a37ec1a0aa 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1476,6 +1476,7 @@ %1$d%% Продолжить %1$s Отображается как /root/ROMs в каждой сессии. Внутреннее хранилище находится в /root/Storage. + Отображается как /root/ROMs в каждой сессии. Папка не выбрана Вступит в силу в следующей сессии. Поддерживаются SD-карты. Выбрать папку @@ -3280,6 +3281,8 @@ Место установки Хранилище по умолчанию Новые установки из магазинов попадают в выбранное место. Установленные игры остаются на месте. У библиотек Steam своя настройка. + Память телефона в Linux + Подключает внутреннюю память телефона в /root/Storage. Если выключено, подключаются только добавленные из неё папки с играми. На SD-карты не влияет. Применяется со следующего сеанса. Спрашивать каждый раз Выбирать место для каждой установки Внутреннее хранилище diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 5aafdf9c38..506e6226ab 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -1460,6 +1460,7 @@ %1$d %% Återuppta %1$s Visas som /root/ROMs i varje session. Det interna lagringsutrymmet finns på /root/Storage. + Visas som /root/ROMs i varje session. Ingen mapp vald Gäller från nästa session. SD-kort fungerar. Välj mapp @@ -3219,6 +3220,8 @@ Installationsplats Standardlagring Nya butiksinstallationer hamnar på den valda platsen. Befintliga spel stannar där de är. Steam-bibliotek har sin egen inställning. + Telefonens lagring i Linux + Monterar telefonens interna lagring på /root/Storage. När det är av monteras bara spelmappar du har lagt till därifrån. SD-kort påverkas inte. Gäller från nästa session. Fråga varje gång Välj mål för varje installation Intern lagring diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index ec38850755..adca121cf7 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -1453,6 +1453,7 @@ %1$d%% ดำเนินการต่อ %1$s แสดงเป็น /root/ROMs ในแต่ละเซสชัน พื้นที่จัดเก็บภายในอยู่ที่ /root/Storage + แสดงเป็น /root/ROMs ในแต่ละเซสชัน ยังไม่เลือกโฟลเดอร์ มีผลในเซสชันถัดไป ใช้การ์ด SD ได้ เลือกโฟลเดอร์ @@ -3190,6 +3191,8 @@ ตำแหน่งติดตั้ง พื้นที่จัดเก็บเริ่มต้น การติดตั้งใหม่จากสโตร์จะไปยังตำแหน่งที่เลือก เกมที่มีอยู่จะอยู่ที่เดิม ไลบรารี Steam ใช้การตั้งค่าของตัวเอง + ที่เก็บข้อมูลโทรศัพท์ใน Linux + เมานต์ที่เก็บข้อมูลภายในของโทรศัพท์ไว้ที่ /root/Storage เมื่อปิด จะเมานต์เฉพาะโฟลเดอร์เกมที่คุณเพิ่มจากที่นั่น ไม่มีผลกับการ์ด SD มีผลในเซสชันถัดไป ถามทุกครั้ง เลือกปลายทางสำหรับการติดตั้งแต่ละครั้ง พื้นที่จัดเก็บภายใน diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 444f2d39e6..3960ffac55 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -1452,6 +1452,7 @@ %%%1$d Devam et: %1$s Her oturumda /root/ROMs olarak görünür. Dahili depolama /root/Storage konumundadır. + Her oturumda /root/ROMs olarak görünür. Klasör seçilmedi Sonraki oturumda uygulanır. SD kartlar da çalışır. Klasör seç @@ -3219,6 +3220,8 @@ Yükleme konumu Varsayılan depolama Yeni mağaza yüklemeleri seçilen konuma gider. Mevcut oyunlar yerinde kalır. Steam kütüphaneleri kendi ayarlarını korur. + Linux\'ta telefon depolaması + Telefonunuzun dahili depolamasını /root/Storage konumuna bağlar. Kapalıyken yalnızca oradan eklediğiniz oyun klasörleri bağlanır. SD kartlar etkilenmez. Sonraki oturumda uygulanır. Her seferinde sor Her yükleme için bir hedef seçin Dahili depolama diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 95f470b86c..727d6660f4 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -1476,6 +1476,7 @@ %1$d%% Продовжити %1$s У кожному сеансі з’являється як /root/ROMs. Внутрішня пам’ять доступна в /root/Storage. + У кожному сеансі з’являється як /root/ROMs. Папку не вибрано Діє з наступного сеансу. SD-карти підтримуються. Вибрати папку @@ -3279,6 +3280,8 @@ Місце встановлення Сховище за замовчуванням Нові встановлення з магазинів потрапляють у вибране місце. Наявні ігри залишаються на місці. Бібліотеки Steam мають власне налаштування. + Пам\'ять телефона в Linux + Підключає внутрішню пам\'ять телефона в /root/Storage. Якщо вимкнено, підключаються лише додані з неї папки з іграми. На SD-картки не впливає. Застосовується з наступного сеансу. Питати щоразу Вибирати місце для кожного встановлення Внутрішнє сховище diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 632bc75003..6803dd16a0 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -1453,6 +1453,7 @@ %1$d%% Tiếp tục %1$s Hiển thị như /root/ROMs trong mỗi phiên. Bộ nhớ trong ở /root/Storage. + Hiển thị như /root/ROMs trong mỗi phiên. Chưa chọn thư mục Áp dụng từ phiên sau. Thẻ SD hoạt động được. Chọn thư mục @@ -3190,6 +3191,8 @@ Vị trí cài đặt Bộ nhớ mặc định Các bản cài mới từ cửa hàng sẽ vào vị trí đã chọn. Game hiện có vẫn ở nguyên chỗ. Thư viện Steam giữ thiết lập riêng. + Bộ nhớ điện thoại trong Linux + Gắn bộ nhớ trong của điện thoại tại /root/Storage. Khi tắt, chỉ các thư mục trò chơi bạn đã thêm từ đó được gắn. Thẻ SD không bị ảnh hưởng. Áp dụng từ phiên tiếp theo. Luôn hỏi Chọn nơi lưu cho mỗi lần cài Bộ nhớ trong diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 6d32da4efe..e9623375c4 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1536,6 +1536,7 @@ %1$d%% 恢复 %1$s 在每个会话中显示为 /root/ROMs。内部存储位于 /root/Storage。 + 在每个会话中显示为 /root/ROMs。 未选择文件夹 将在下次会话生效。支持 SD 卡。 选择文件夹 @@ -3190,6 +3191,8 @@ 安装位置 默认存储 新的商店安装将保存到所选位置。现有游戏保持原位。Steam 库使用各自的设置。 + 在 Linux 中使用手机存储 + 将手机内部存储挂载到 /root/Storage。关闭后,只会挂载你从中添加的游戏文件夹。不影响 SD 卡。下次会话生效。 每次询问 每次安装时选择目标位置 内部存储 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index eb5f360aca..ab70512c13 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -1452,6 +1452,7 @@ %1$d%% 繼續 %1$s 在每個會話中顯示為 /root/ROMs。內部儲存空間位於 /root/Storage。 + 在每個會話中顯示為 /root/ROMs。 未選擇資料夾 下次會話生效。支援 SD 卡。 選擇資料夾 @@ -3187,6 +3188,8 @@ 安裝位置 預設儲存空間 從商店新安裝的遊戲會安裝到所選位置。現有遊戲維持原位。Steam 收藏庫保有自己的設定。 + 在 Linux 中使用手機儲存空間 + 將手機內部儲存空間掛載到 /root/Storage。關閉後,只會掛載你從中加入的遊戲資料夾。不影響 SD 卡。下次工作階段生效。 每次都詢問 每次安裝時選擇目標位置 內部儲存空間 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 4bbb377ca3..b2e20baea0 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1452,6 +1452,7 @@ %1$d%% 繼續 %1$s 每個工作階段中顯示為 /root/ROMs。內部儲存空間位於 /root/Storage。 + 每個工作階段中顯示為 /root/ROMs。 未選擇資料夾 下次工作階段生效。支援 SD 卡。 選擇資料夾 @@ -3187,6 +3188,8 @@ 安裝位置 預設儲存空間 從商店新安裝的遊戲會安裝到所選位置。現有遊戲維持原位。Steam 收藏庫保有自己的設定。 + 在 Linux 中使用手機儲存空間 + 將手機內部儲存空間掛載到 /root/Storage。關閉後,只會掛載你從中加入的遊戲資料夾。不影響 SD 卡。下次工作階段生效。 每次都詢問 每次安裝時選擇目標位置 內部儲存空間 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 606e625431..9b754f9e5f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1677,6 +1677,7 @@ %1$d%% Resume %1$s Shows up as /root/ROMs in each session. Internal storage is at /root/Storage. + Shows up as /root/ROMs in each session. No folder chosen Applies next session. SD cards work. Choose folder @@ -3563,6 +3564,8 @@ Install location Default storage New store installs go to the selected location. Existing games stay where they are. Steam libraries keep their own setting. + Phone storage in Linux + Mounts your phone\'s internal storage at /root/Storage. When off, only game folders you\'ve added from it are mounted. SD cards are not affected. Applies to the next session. Ask every time Choose a target for each install Internal storage diff --git a/docs/settings-map.md b/docs/settings-map.md index bcef3a25c3..122ab30945 100644 --- a/docs/settings-map.md +++ b/docs/settings-map.md @@ -64,6 +64,7 @@ Links of the form `droiddeck://settings/
` open a Settings section direc | Setting | Where | Also matches | | --- | --- | --- | | Storage | Tabs › Storage | sd card, space, uninstall, disk | +| Phone storage in Linux | Tabs › Storage | sdcard, mount, privacy, files | | Syncthing | Tabs › Syncthing | syncthing, saves | | Decky | Tabs › Decky | plugins, plugin store, homebrew, loader | | Boot movies | Tabs › Boot movies | startup movie, boot video, animation, steamdeckrepo | From cd1e9dde15e30c898bba7260ec17eaeb62ef83c5 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 00:47:47 -0400 Subject: [PATCH 073/120] Fix zero-copy layer transition callback failures --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 37 +++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index 74cd5d6b45..f966abd644 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -397,12 +397,16 @@ static void retire_sc(struct layer *l) { ASurfaceTransaction *tx = api.txCreate(); if (tx) { retire_ops(tx, l->sc); - if (add_complete(tx, l, l->cur_slot, l->cur_token, 1) != 0) api.release(l->sc); + if (add_complete(tx, l, l->cur_slot, l->cur_token, 1) != 0) { + api.txDelete(tx); + droiddeck_log("layer", "%s: retirement deferred because its release callback could not be allocated", l->name); + return; + } api.txApply(tx); api.txDelete(tx); } else { - if (l->cur_token) ahb_swapchain_layer_released(l->cur_token, -1); - api.release(l->sc); + droiddeck_log("layer", "%s: retirement deferred because a transaction could not be allocated", l->name); + return; } droiddeck_log("layer", "%s: SurfaceControl retired (window %p)", l->name, (void *)l->win); l->sc = NULL; l->win = NULL; @@ -832,6 +836,16 @@ static ASurfaceControl *swap_sc_begin(struct layer *l) { return old; } +static void rollback_swap_sc(struct layer *l, ASurfaceControl *old) { + if (!old) return; + ASurfaceControl *fresh = l->sc; + l->sc = old; + l->shown = 1; + l->recreate_pending = 1; + l->geo_valid = 0; + if (fresh) api.release(fresh); +} + static int present_slot(struct layer *l, int idx, const int r[8], const struct droiddeck_color *color, int translucent) { struct slot *s = &l->slots[idx]; @@ -848,8 +862,12 @@ static int present_slot(struct layer *l, int idx, const int r[8], const struct d apply_colour(tx, l, color); if (!l->shown) api.setVisibility(tx, l->sc, ASC_VISIBILITY_SHOW); if (old) retire_ops(tx, old); - if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token, old ? 1 : 0) != 0 && old) - api.release(old); + if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token, old ? 1 : 0) != 0) { + api.txDelete(tx); + rollback_swap_sc(l, old); + droiddeck_log("layer", "%s: frame transition skipped because its release callback could not be allocated", l->name); + return -1; + } pthread_mutex_lock(&g_lock); s->busy = 1; pthread_mutex_unlock(&g_lock); @@ -917,8 +935,9 @@ int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, voi if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token == token ? NULL : l->cur_token, old ? 1 : 0) != 0) { api.txDelete(tx); - if (old) api.release(old); + rollback_swap_sc(l, old); l->ds_applied = -1; l->md_applied = 0; l->hr_applied = -1.0f; + droiddeck_log("layer", "zero-copy: frame transition skipped because its release callback could not be allocated"); return -1; } apply_present_time(tx, 1); @@ -1173,7 +1192,11 @@ static void hide_layer(struct layer *l) { if (!tx) return; replace_with_blank(tx, l); api.setVisibility(tx, l->sc, ASC_VISIBILITY_HIDE); - add_complete(tx, l, l->cur_slot, l->cur_token, 0); + if (add_complete(tx, l, l->cur_slot, l->cur_token, 0) != 0) { + api.txDelete(tx); + droiddeck_log("layer", "%s: hide deferred because its release callback could not be allocated", l->name); + return; + } api.txApply(tx); api.txDelete(tx); l->shown = 0; l->cur_slot = -1; l->cur_token = NULL; } From 3bef9a420007bd5242319d2fc12875a32aad476e Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:03:25 -0400 Subject: [PATCH 074/120] Fix deferred zero-copy layer retirement and rollback --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 95 +++++++++++++++------ 1 file changed, 70 insertions(+), 25 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index f966abd644..bea1c4676e 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -148,6 +148,7 @@ struct slot { uint32_t fmt; int release_fd; int busy; + uint64_t generation; }; struct layer { @@ -222,6 +223,7 @@ struct complete_ctx { ASurfaceControl *sc; int layer; int prev_slot; + uint64_t prev_generation; void *prev_token; int retire; }; @@ -288,10 +290,12 @@ static void on_complete(void *context, ASurfaceTransactionStats *stats) { pthread_mutex_lock(&g_lock); if (ctx->layer >= 0 && ctx->layer < SC_LAYER_COUNT && ctx->prev_slot >= 0 && ctx->prev_slot < POOL_MAX) { struct slot *s = &g_layers[ctx->layer].slots[ctx->prev_slot]; - int fd = (stats && ctx->sc) ? api.prevReleaseFence(stats, ctx->sc) : -1; - if (s->release_fd >= 0) close(s->release_fd); - s->release_fd = fd; - s->busy = 0; + if (s->generation == ctx->prev_generation) { + int fd = (stats && ctx->sc) ? api.prevReleaseFence(stats, ctx->sc) : -1; + if (s->release_fd >= 0) close(s->release_fd); + s->release_fd = fd; + s->busy = 0; + } } if (g_pending_cb > 0) g_pending_cb--; pthread_mutex_unlock(&g_lock); @@ -308,6 +312,11 @@ static int add_complete_on(ASurfaceTransaction *tx, struct layer *l, ASurfaceCon struct complete_ctx *ctx = calloc(1, sizeof(*ctx)); if (!ctx) return -1; ctx->sc = sc; ctx->layer = (int)(l - g_layers); ctx->prev_slot = prev_slot; + if (prev_slot >= 0 && prev_slot < POOL_MAX) { + pthread_mutex_lock(&g_lock); + ctx->prev_generation = l->slots[prev_slot].generation; + pthread_mutex_unlock(&g_lock); + } ctx->prev_token = prev_token; ctx->retire = retire; pthread_mutex_lock(&g_lock); g_pending_cb++; @@ -439,6 +448,26 @@ static void drain_and_free_pools(void) { g_layers[i].logged_w = g_layers[i].logged_h = 0; } pthread_mutex_unlock(&g_lock); + for (int i = 0; i < SC_LAYER_COUNT; i++) { + if (g_layers[i].sc) { + droiddeck_log("layer", "pool drain deferred while %s still owns a SurfaceControl", g_layers[i].name); + return; + } + } + pthread_mutex_lock(&g_lock); + for (int i = 0; i < SC_LAYER_COUNT; i++) { + for (int j = 0; j < POOL_MAX; j++) { + struct slot *s = &g_layers[i].slots[j]; + if (s->release_fd >= 0) { struct pollfd p = {.fd = s->release_fd, .events = POLLIN}; poll(&p, 1, 100); close(s->release_fd); } + if (s->img) vkp_image_destroy(s->img); + if (s->ahb) AHardwareBuffer_release(s->ahb); + memset(s, 0, sizeof(*s)); + s->release_fd = -1; + } + g_layers[i].first_logged = 0; + g_layers[i].logged_w = g_layers[i].logged_h = 0; + } + pthread_mutex_unlock(&g_lock); } static int sniff_modifier(const struct droiddeck_native_handle *h, uint64_t *mod) { @@ -616,7 +645,10 @@ static int take_free_slot(struct layer *l, int w, int h, uint32_t fmt, int *wait if (pending < 0) pending = i; } if (idx < 0) idx = pending; - if (idx >= 0) { fd = l->slots[idx].release_fd; l->slots[idx].release_fd = -1; } + if (idx >= 0) { + fd = l->slots[idx].release_fd; l->slots[idx].release_fd = -1; + l->slots[idx].generation++; + } pthread_mutex_unlock(&g_lock); if (idx < 0) return -1; if (fd >= 0 && fence_signalled(fd)) { close(fd); fd = -1; } @@ -663,7 +695,13 @@ static int ensure_sc(struct layer *l) { if (load_api() != 0) return -1; ANativeWindow *win = vkp_window(); if (!win) return -1; - if (l->sc && l->win != win) retire_sc(l); + if (l->sc && l->win != win) { + retire_sc(l); + if (l->sc) { + droiddeck_log("layer", "%s: keeping the old SurfaceControl until retirement completes", l->name); + return -1; + } + } if (!l->sc) { l->sc = api.createFromWindow(win, l->name); if (!l->sc) { droiddeck_log("error", "layer: ASurfaceControl_createFromWindow(%s) failed", l->name); return -1; } @@ -836,13 +874,15 @@ static ASurfaceControl *swap_sc_begin(struct layer *l) { return old; } -static void rollback_swap_sc(struct layer *l, ASurfaceControl *old) { +static void rollback_swap_sc(struct layer *l, ASurfaceControl *old, int was_shown) { if (!old) return; ASurfaceControl *fresh = l->sc; l->sc = old; - l->shown = 1; + l->shown = was_shown; l->recreate_pending = 1; l->geo_valid = 0; + l->fps_applied = -1.0f; + l->ds_applied = -1; l->md_applied = 0; l->hr_applied = -1.0f; if (fresh) api.release(fresh); } @@ -851,23 +891,24 @@ static int present_slot(struct layer *l, int idx, const int r[8], const struct d struct slot *s = &l->slots[idx]; ASurfaceTransaction *tx = api.txCreate(); if (!tx) return -1; + const int was_shown = l->shown; ASurfaceControl *old = swap_sc_begin(l); if (old) api.setZOrder(tx, l->sc, l->z); api.setBuffer(tx, l->sc, s->ahb, -1); if (api.setEnableBackPressure) api.setEnableBackPressure(tx, l->sc, true); api.setBufferTransparency(tx, l->sc, translucent ? ASC_TRANSPARENCY_TRANSLUCENT : ASC_TRANSPARENCY_OPAQUE); - apply_geometry(tx, l, r); - apply_frame_rate(tx, l); - apply_colour(tx, l, color); if (!l->shown) api.setVisibility(tx, l->sc, ASC_VISIBILITY_SHOW); if (old) retire_ops(tx, old); if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token, old ? 1 : 0) != 0) { api.txDelete(tx); - rollback_swap_sc(l, old); + rollback_swap_sc(l, old, was_shown); droiddeck_log("layer", "%s: frame transition skipped because its release callback could not be allocated", l->name); return -1; } + apply_geometry(tx, l, r); + apply_frame_rate(tx, l); + apply_colour(tx, l, color); pthread_mutex_lock(&g_lock); s->busy = 1; pthread_mutex_unlock(&g_lock); @@ -922,24 +963,24 @@ int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, voi } ASurfaceTransaction *tx = api.txCreate(); if (!tx) goto unavailable; + const int was_shown = l->shown; ASurfaceControl *old = swap_sc_begin(l); if (old) api.setZOrder(tx, l->sc, l->z); api.setBuffer(tx, l->sc, ahb, acquire_fd); if (api.setEnableBackPressure) api.setEnableBackPressure(tx, l->sc, true); api.setBufferTransparency(tx, l->sc, ASC_TRANSPARENCY_OPAQUE); - apply_geometry(tx, l, r); - apply_frame_rate(tx, l); - apply_colour(tx, l, color); if (!l->shown) api.setVisibility(tx, l->sc, ASC_VISIBILITY_SHOW); if (old) retire_ops(tx, old); if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token == token ? NULL : l->cur_token, old ? 1 : 0) != 0) { api.txDelete(tx); - rollback_swap_sc(l, old); - l->ds_applied = -1; l->md_applied = 0; l->hr_applied = -1.0f; + rollback_swap_sc(l, old, was_shown); droiddeck_log("layer", "zero-copy: frame transition skipped because its release callback could not be allocated"); return -1; } + apply_geometry(tx, l, r); + apply_frame_rate(tx, l); + apply_colour(tx, l, color); apply_present_time(tx, 1); api.txApply(tx); api.txDelete(tx); @@ -1186,19 +1227,20 @@ int sc_layer_present_overlay(struct vkp_image *src, const int geo[8], int transl return 0; } -static void hide_layer(struct layer *l) { - if (!l->sc || !l->shown || api.state != 1) return; +static int hide_layer(struct layer *l) { + if (!l->sc || !l->shown || api.state != 1) return 0; ASurfaceTransaction *tx = api.txCreate(); - if (!tx) return; + if (!tx) return -1; replace_with_blank(tx, l); api.setVisibility(tx, l->sc, ASC_VISIBILITY_HIDE); if (add_complete(tx, l, l->cur_slot, l->cur_token, 0) != 0) { api.txDelete(tx); droiddeck_log("layer", "%s: hide deferred because its release callback could not be allocated", l->name); - return; + return -1; } api.txApply(tx); api.txDelete(tx); l->shown = 0; l->cur_slot = -1; l->cur_token = NULL; + return 0; } void sc_layer_hide(void) { @@ -1206,17 +1248,20 @@ void sc_layer_hide(void) { int said = g_layers[SC_LAYER_GAME].shown || g_layers[SC_LAYER_OVERLAY].sc; if (g_layers[SC_LAYER_OVERLAY].sc) sc_layer_hide_overlay(); if (g_layers[SC_LAYER_GAME].shown) hide_layer(&g_layers[SC_LAYER_GAME]); - if (said) droiddeck_log("layer", "layers hidden (scene is not a single fullscreen window)"); + if (said && !g_layers[SC_LAYER_GAME].shown && !g_layers[SC_LAYER_OVERLAY].shown) + droiddeck_log("layer", "layers hidden (scene is not a single fullscreen window)"); } void sc_layer_hide_overlay(void) { layers_init(); struct layer *l = &g_layers[SC_LAYER_OVERLAY]; if (!l->sc) return; - if (l->shown) hide_layer(l); + if (l->shown && hide_layer(l) != 0) return; retire_sc(l); - droiddeck_log("layer", "%s: gone (nothing is above the game any more)", l->name); - if (g_layers[SC_LAYER_GAME].sc) g_layers[SC_LAYER_GAME].recreate_pending = 1; + if (!l->sc) { + droiddeck_log("layer", "%s: gone (nothing is above the game any more)", l->name); + if (g_layers[SC_LAYER_GAME].sc) g_layers[SC_LAYER_GAME].recreate_pending = 1; + } } void sc_layer_window_gone(void) { From 689ecc40ad836b38fd7733cd3db71834e298cea9 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:03:36 -0400 Subject: [PATCH 075/120] Guard pool drain against pending layer callbacks --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 26 +++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index bea1c4676e..ee0e52cdc2 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -427,27 +427,18 @@ static void retire_sc(struct layer *l) { static void drain_and_free_pools(void) { int64_t deadline = now_ns() + 300000000LL; - for (;;) { + int pending; + do { pthread_mutex_lock(&g_lock); - int pending = g_pending_cb; + pending = g_pending_cb; pthread_mutex_unlock(&g_lock); if (!pending || now_ns() > deadline) break; usleep(2000); + } while (1); + if (pending) { + droiddeck_log("layer", "pool drain deferred while %d SurfaceControl callbacks are pending", pending); + return; } - pthread_mutex_lock(&g_lock); - for (int i = 0; i < SC_LAYER_COUNT; i++) { - for (int j = 0; j < POOL_MAX; j++) { - struct slot *s = &g_layers[i].slots[j]; - if (s->release_fd >= 0) { struct pollfd p = {.fd = s->release_fd, .events = POLLIN}; poll(&p, 1, 100); close(s->release_fd); } - if (s->img) vkp_image_destroy(s->img); - if (s->ahb) AHardwareBuffer_release(s->ahb); - memset(s, 0, sizeof(*s)); - s->release_fd = -1; - } - g_layers[i].first_logged = 0; - g_layers[i].logged_w = g_layers[i].logged_h = 0; - } - pthread_mutex_unlock(&g_lock); for (int i = 0; i < SC_LAYER_COUNT; i++) { if (g_layers[i].sc) { droiddeck_log("layer", "pool drain deferred while %s still owns a SurfaceControl", g_layers[i].name); @@ -656,7 +647,8 @@ static int take_free_slot(struct layer *l, int w, int h, uint32_t fmt, int *wait if (s->ahb && (s->w != w || s->h != h || s->fmt != fmt)) { if (fd >= 0) { close(fd); fd = -1; } vkp_image_destroy(s->img); AHardwareBuffer_release(s->ahb); - memset(s, 0, sizeof(*s)); s->release_fd = -1; + const uint64_t generation = s->generation; + memset(s, 0, sizeof(*s)); s->release_fd = -1; s->generation = generation; } if (fd >= 0 && !vkp_can_wait_sync_fd()) { if (fence_wait(fd, 100) == 0) { slot_keep_fence(s, fd); return -1; } From 31ee95250cac7a1a8598c5099fdf8dbad7823095 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:03:58 -0400 Subject: [PATCH 076/120] Keep layer recovery pending when surface creation fails --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index ee0e52cdc2..0e8892eaa3 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -852,6 +852,7 @@ static ASurfaceControl *swap_sc_begin(struct layer *l) { if (!win || win != l->win) return NULL; ASurfaceControl *fresh = api.createFromWindow(win, l->name); if (!fresh) { + l->recreate_pending = 1; droiddeck_log("error", "layer: %s: composition recovery could not create a new SurfaceControl", l->name); return NULL; } From 97a998a3b93147489d86d20a2f9b455e7dae6d5c Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:04:11 -0400 Subject: [PATCH 077/120] Defer pool cleanup only for layers still in use --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 35 +++++++++++---------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index 0e8892eaa3..4848072337 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -176,6 +176,7 @@ struct layer { int votes_rate; float fps_applied; int recreate_pending; + int pending_callbacks; int32_t ds_applied; @@ -298,6 +299,8 @@ static void on_complete(void *context, ASurfaceTransactionStats *stats) { } } if (g_pending_cb > 0) g_pending_cb--; + if (ctx->layer >= 0 && ctx->layer < SC_LAYER_COUNT && g_layers[ctx->layer].pending_callbacks > 0) + g_layers[ctx->layer].pending_callbacks--; pthread_mutex_unlock(&g_lock); if (ctx->prev_token) { int fd = (stats && ctx->sc) ? api.prevReleaseFence(stats, ctx->sc) : -1; @@ -320,6 +323,7 @@ static int add_complete_on(ASurfaceTransaction *tx, struct layer *l, ASurfaceCon ctx->prev_token = prev_token; ctx->retire = retire; pthread_mutex_lock(&g_lock); g_pending_cb++; + l->pending_callbacks++; pthread_mutex_unlock(&g_lock); api.setOnComplete(tx, ctx, on_complete); return 0; @@ -427,38 +431,35 @@ static void retire_sc(struct layer *l) { static void drain_and_free_pools(void) { int64_t deadline = now_ns() + 300000000LL; - int pending; - do { + for (;;) { pthread_mutex_lock(&g_lock); - pending = g_pending_cb; + int pending = g_pending_cb; pthread_mutex_unlock(&g_lock); if (!pending || now_ns() > deadline) break; usleep(2000); - } while (1); - if (pending) { - droiddeck_log("layer", "pool drain deferred while %d SurfaceControl callbacks are pending", pending); - return; } for (int i = 0; i < SC_LAYER_COUNT; i++) { - if (g_layers[i].sc) { - droiddeck_log("layer", "pool drain deferred while %s still owns a SurfaceControl", g_layers[i].name); - return; + struct layer *l = &g_layers[i]; + pthread_mutex_lock(&g_lock); + const int pending = l->pending_callbacks; + if (pending || l->sc) { + pthread_mutex_unlock(&g_lock); + droiddeck_log("layer", "pool drain deferred for %s (%s)", l->name, + pending ? "SurfaceControl callbacks are pending" : "SurfaceControl retirement is deferred"); + continue; } - } - pthread_mutex_lock(&g_lock); - for (int i = 0; i < SC_LAYER_COUNT; i++) { for (int j = 0; j < POOL_MAX; j++) { - struct slot *s = &g_layers[i].slots[j]; + struct slot *s = &l->slots[j]; if (s->release_fd >= 0) { struct pollfd p = {.fd = s->release_fd, .events = POLLIN}; poll(&p, 1, 100); close(s->release_fd); } if (s->img) vkp_image_destroy(s->img); if (s->ahb) AHardwareBuffer_release(s->ahb); memset(s, 0, sizeof(*s)); s->release_fd = -1; } - g_layers[i].first_logged = 0; - g_layers[i].logged_w = g_layers[i].logged_h = 0; + l->first_logged = 0; + l->logged_w = l->logged_h = 0; + pthread_mutex_unlock(&g_lock); } - pthread_mutex_unlock(&g_lock); } static int sniff_modifier(const struct droiddeck_native_handle *h, uint64_t *mod) { From c833514757970638cce1f540962bc4a2ed9d9437 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:17:14 -0400 Subject: [PATCH 078/120] Restore HDR caches when rolling back layer swap --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index 4848072337..a0e3df4941 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -868,7 +868,8 @@ static ASurfaceControl *swap_sc_begin(struct layer *l) { return old; } -static void rollback_swap_sc(struct layer *l, ASurfaceControl *old, int was_shown) { +static void rollback_swap_sc(struct layer *l, ASurfaceControl *old, int was_shown, + int32_t ds_applied, uint32_t md_applied, float hr_applied) { if (!old) return; ASurfaceControl *fresh = l->sc; l->sc = old; @@ -876,7 +877,7 @@ static void rollback_swap_sc(struct layer *l, ASurfaceControl *old, int was_show l->recreate_pending = 1; l->geo_valid = 0; l->fps_applied = -1.0f; - l->ds_applied = -1; l->md_applied = 0; l->hr_applied = -1.0f; + l->ds_applied = ds_applied; l->md_applied = md_applied; l->hr_applied = hr_applied; if (fresh) api.release(fresh); } @@ -886,6 +887,9 @@ static int present_slot(struct layer *l, int idx, const int r[8], const struct d ASurfaceTransaction *tx = api.txCreate(); if (!tx) return -1; const int was_shown = l->shown; + const int32_t ds_applied = l->ds_applied; + const uint32_t md_applied = l->md_applied; + const float hr_applied = l->hr_applied; ASurfaceControl *old = swap_sc_begin(l); if (old) api.setZOrder(tx, l->sc, l->z); api.setBuffer(tx, l->sc, s->ahb, -1); @@ -896,7 +900,7 @@ static int present_slot(struct layer *l, int idx, const int r[8], const struct d if (old) retire_ops(tx, old); if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token, old ? 1 : 0) != 0) { api.txDelete(tx); - rollback_swap_sc(l, old, was_shown); + rollback_swap_sc(l, old, was_shown, ds_applied, md_applied, hr_applied); droiddeck_log("layer", "%s: frame transition skipped because its release callback could not be allocated", l->name); return -1; } @@ -958,6 +962,9 @@ int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, voi ASurfaceTransaction *tx = api.txCreate(); if (!tx) goto unavailable; const int was_shown = l->shown; + const int32_t ds_applied = l->ds_applied; + const uint32_t md_applied = l->md_applied; + const float hr_applied = l->hr_applied; ASurfaceControl *old = swap_sc_begin(l); if (old) api.setZOrder(tx, l->sc, l->z); api.setBuffer(tx, l->sc, ahb, acquire_fd); @@ -968,7 +975,7 @@ int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, voi if (add_complete_on(tx, l, old ? old : l->sc, l->cur_slot, l->cur_token == token ? NULL : l->cur_token, old ? 1 : 0) != 0) { api.txDelete(tx); - rollback_swap_sc(l, old, was_shown); + rollback_swap_sc(l, old, was_shown, ds_applied, md_applied, hr_applied); droiddeck_log("layer", "zero-copy: frame transition skipped because its release callback could not be allocated"); return -1; } From 30fddaf53a57e098106d6d85bdf0b5df214e3304 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:20:58 -0400 Subject: [PATCH 079/120] Preserve motion dispatch and rate-limit right-stick scrolling --- .../droiddeck/launcher/FrontEndActivity.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index 045124b701..e49fefed89 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2216,6 +2216,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet private var rightStickScrollDeviceId = android.view.InputDevice.INVALID_DEVICE_ID private var rightStickScrollDeflection = 0f private var rightStickScrollScheduled = false + private var rightStickNextDispatchAt = 0L private val rightStickScrollTick = object : Runnable { override fun run() { val deviceId = rightStickScrollDeviceId @@ -2228,6 +2229,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet } rightStickScrollScheduled = false dispatchRightStickScroll(rightStickScrollDeflection, deviceId) + rightStickNextDispatchAt = android.os.SystemClock.uptimeMillis() + 130L rightStickScrollHandler.postDelayed(this, 130L) rightStickScrollScheduled = true } @@ -2265,26 +2267,25 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet } } - private fun scrollPageWithRightStick(event: android.view.MotionEvent): Boolean { + private fun scrollPageWithRightStick(event: android.view.MotionEvent) { if (event.actionMasked != android.view.MotionEvent.ACTION_MOVE || - !com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return false - val device = event.device ?: return false + !com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return + val device = event.device ?: return val rxRy = com.droiddeck.launcher.input.PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts) - ?: return false + ?: return val axis = if (rxRy) android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ val value = event.getAxisValue(axis) if (kotlin.math.abs(value) < 0.55f) { if (rightStickScrollDeviceId == event.deviceId) stopRightStickScroll() - return false + return } rightStickScrollDeviceId = event.deviceId rightStickScrollDeflection = value if (!rightStickScrollScheduled) { - dispatchRightStickScroll(value, event.deviceId) - rightStickScrollHandler.postDelayed(rightStickScrollTick, 130L) + val delay = (rightStickNextDispatchAt - android.os.SystemClock.uptimeMillis()).coerceAtLeast(0L) + rightStickScrollHandler.postDelayed(rightStickScrollTick, delay) rightStickScrollScheduled = true } - return true } override fun dispatchGenericMotionEvent(event: android.view.MotionEvent): Boolean { @@ -2294,7 +2295,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet return true } triggerKeys.onMotion(event) - if (scrollPageWithRightStick(event)) return true + scrollPageWithRightStick(event) return super.dispatchGenericMotionEvent(event) } From e9f3d8ec956a8f3c54c0a9c897f070f7d6a9a8a4 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:33:16 -0400 Subject: [PATCH 080/120] Fix invalid input device ID constant --- .../main/java/com/droiddeck/launcher/FrontEndActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index e49fefed89..c9f4161d55 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2213,7 +2213,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet private val triggerKeys = com.droiddeck.launcher.input.TriggerKeys { dispatchKeyEvent(it) } private val rightStickLayouts = HashMap() private val rightStickScrollHandler = android.os.Handler(android.os.Looper.getMainLooper()) - private var rightStickScrollDeviceId = android.view.InputDevice.INVALID_DEVICE_ID + private var rightStickScrollDeviceId = -1 private var rightStickScrollDeflection = 0f private var rightStickScrollScheduled = false private var rightStickNextDispatchAt = 0L @@ -2221,7 +2221,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet override fun run() { val deviceId = rightStickScrollDeviceId if (!hasWindowFocus() || (compatLaunch != null && !compatLaunch!!.loading.ended) || - deviceId == android.view.InputDevice.INVALID_DEVICE_ID || + deviceId == -1 || android.view.InputDevice.getDevice(deviceId) == null || kotlin.math.abs(rightStickScrollDeflection) < 0.55f) { stopRightStickScroll() @@ -2237,7 +2237,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet private fun stopRightStickScroll() { rightStickScrollHandler.removeCallbacks(rightStickScrollTick) - rightStickScrollDeviceId = android.view.InputDevice.INVALID_DEVICE_ID + rightStickScrollDeviceId = -1 rightStickScrollDeflection = 0f rightStickScrollScheduled = false } From d2031ba3849ec712a9cf2a99676f53d8679de4a5 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:43:57 -0400 Subject: [PATCH 081/120] Fix deferred layer hide when callback allocation fails --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index a0e3df4941..546ea82f40 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -1235,9 +1235,16 @@ static int hide_layer(struct layer *l) { replace_with_blank(tx, l); api.setVisibility(tx, l->sc, ASC_VISIBILITY_HIDE); if (add_complete(tx, l, l->cur_slot, l->cur_token, 0) != 0) { + /* + * Hiding does not require a release callback. Apply the visibility + * change now, but keep the current slot/token pinned until a later + * presentation or retirement can attach a completion callback. + */ + api.txApply(tx); api.txDelete(tx); - droiddeck_log("layer", "%s: hide deferred because its release callback could not be allocated", l->name); - return -1; + l->shown = 0; + droiddeck_log("layer", "%s: hidden; buffer release deferred because its callback could not be allocated", l->name); + return 0; } api.txApply(tx); api.txDelete(tx); l->shown = 0; l->cur_slot = -1; l->cur_token = NULL; From 9b7ce457a5c72f36c15c7bf01e83d18b5f75be44 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:51:24 -0400 Subject: [PATCH 082/120] Keep current buffer attached when hide callback allocation fails --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index 546ea82f40..018664f9c3 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -1232,13 +1232,11 @@ static int hide_layer(struct layer *l) { if (!l->sc || !l->shown || api.state != 1) return 0; ASurfaceTransaction *tx = api.txCreate(); if (!tx) return -1; - replace_with_blank(tx, l); api.setVisibility(tx, l->sc, ASC_VISIBILITY_HIDE); if (add_complete(tx, l, l->cur_slot, l->cur_token, 0) != 0) { /* - * Hiding does not require a release callback. Apply the visibility - * change now, but keep the current slot/token pinned until a later - * presentation or retirement can attach a completion callback. + * Keep the current buffer attached when its release callback cannot + * be allocated. The hide can still apply without releasing the slot. */ api.txApply(tx); api.txDelete(tx); @@ -1246,6 +1244,7 @@ static int hide_layer(struct layer *l) { droiddeck_log("layer", "%s: hidden; buffer release deferred because its callback could not be allocated", l->name); return 0; } + replace_with_blank(tx, l); api.txApply(tx); api.txDelete(tx); l->shown = 0; l->cur_slot = -1; l->cur_token = NULL; return 0; From 80fc5dec075a529f6c883e2ce90cedf7c599b433 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sun, 29 Nov 2026 10:17:44 -0500 Subject: [PATCH 083/120] Fix the Steam home's wall and card fan on portrait screens (#3412) --- .../com/droiddeck/launcher/ui/DevPreview.kt | 51 ++++++++++++++ .../droiddeck/launcher/ui/FrontEndContent.kt | 5 +- .../droiddeck/launcher/ui/FrontEndScreen.kt | 5 ++ .../com/droiddeck/launcher/ui/SteamHome.kt | 69 ++++++++++++++----- app/src/main/res/values/strings.xml | 4 ++ 5 files changed, 114 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/DevPreview.kt b/app/src/main/java/com/droiddeck/launcher/ui/DevPreview.kt index 46ea147324..6745afaa01 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/DevPreview.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/DevPreview.kt @@ -57,12 +57,17 @@ import com.droiddeck.launcher.stores.StoresState /** What the Library pretends while a developer previews it. Nothing here is saved: a restart always comes back to [OFF]. */ internal enum class LibraryPreview { OFF, NOTHING_INSTALLED, SIGNED_OUT, SAMPLE } +/** How many games the Steam home pretends are installed. Nothing here is saved. */ +internal enum class SteamHomePreview(val games: Int) { OFF(-1), NONE(0), FEW(3), MANY(12) } + internal enum class DrawerPreview { STEAM, DESKTOP, GAME } /** Developer tools' preview states: screens that are otherwise hard to reach, shown without changing anything real. */ internal object DevPreview { var library by mutableStateOf(LibraryPreview.OFF) var drawer by mutableStateOf(null) + var steamHome by mutableStateOf(SteamHomePreview.OFF) + var openSteam by mutableStateOf(false) /** The UI zoo sheet: where previews are picked, one at a time, only when asked for. */ var zoo by mutableStateOf(false) /** Opt-in: a preview button where its state lives (the Library's toolbar), for switching states without the zoo. */ @@ -87,6 +92,41 @@ internal fun sampleOwned(store: Store): List = internal fun sampleInstalled(owned: Map>): Set = owned.values.flatMap { items -> items.take(SAMPLE_INSTALLED).map { it.key } }.toSet() +/** The Steam home's games while a developer previews it: this many invented titles, no art, nothing installed. */ +internal fun sampleSteamHomeGames(count: Int): List = listOf( + "Portal 2", "Hades", "Celeste", "Stardew Valley", "Hollow Knight", "Balatro", + "Dead Cells", "Terraria", "Vampire Survivors", "Slay the Spire", "Cuphead", "Inscryption", +).take(count).mapIndexed { i, name -> + com.droiddeck.launcher.frontend.Library.SteamGame(1000 + i, name, art = null, library = "steam", lastPlayed = 1_700_000_000_000L - i * 86_400_000L) +} + +/** The pill a previewed Steam home shows, so the fake state is never mistaken for the real one. */ +@Composable +internal fun SteamHomePreviewPill(modifier: Modifier = Modifier) { + val preview = DevPreview.steamHome + if (preview == SteamHomePreview.OFF) return + val colors = MaterialTheme.colorScheme + val pal = LocalPalette.current + val label = stringResource( + when (preview) { + SteamHomePreview.NONE -> R.string.dev_preview_steam_none + SteamHomePreview.FEW -> R.string.dev_preview_steam_few + else -> R.string.dev_preview_steam_many + }, + ) + val end = stringResource(R.string.dev_preview_end) + Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp), + modifier = modifier.background(colors.surface, CircleShape).border(1.dp, pal.signal, CircleShape) + .clickable(role = Role.Button, onClickLabel = end) { DevPreview.steamHome = SteamHomePreview.OFF } + .padding(start = 14.dp, end = 10.dp, top = 8.dp, bottom = 8.dp).testTag("dev-preview-steam-end"), + ) { + Icon(Icons.Outlined.Visibility, null, tint = pal.signal, modifier = Modifier.size(18.dp)) + Text(stringResource(R.string.dev_preview_banner, label), fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground) + Icon(Icons.Filled.Close, end, tint = colors.onSurfaceVariant, modifier = Modifier.size(18.dp)) + } +} + /** The pill a previewed Library shows, so the fake state is never mistaken for the real one. */ @Composable internal fun LibraryPreviewPill(modifier: Modifier = Modifier) { @@ -215,6 +255,17 @@ internal fun UiZooSheet() { DrawerPreview.GAME to R.string.session_title_game, )) ActionRow(stringResource(label), null, show, onClick = { close(); DevPreview.drawer = mode }, modifier = Modifier.testTag("zoo-drawer-${mode.name.lowercase()}")) } + SettingsGroup(stringResource(R.string.dev_preview_steam_home)) { + for ((mode, label) in listOf( + SteamHomePreview.NONE to R.string.dev_preview_steam_none, + SteamHomePreview.FEW to R.string.dev_preview_steam_few, + SteamHomePreview.MANY to R.string.dev_preview_steam_many, + )) ActionRow( + stringResource(label), null, show, + onClick = { close(); DevPreview.steamHome = mode; DevPreview.openSteam = true }, + modifier = Modifier.testTag("zoo-steam-${mode.name.lowercase()}"), + ) + } SettingsGroup(stringResource(R.string.dev_preview_library)) { for ((mode, label) in listOf( LibraryPreview.NOTHING_INSTALLED to R.string.dev_preview_library_nothing_installed, diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndContent.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndContent.kt index bc55af594e..574ad4c56c 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndContent.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndContent.kt @@ -272,7 +272,10 @@ private fun Content( return } if (selected == "steam") { - SteamHome(s, a, modifier) + Box(modifier) { + SteamHome(s, a, Modifier.fillMaxSize()) + SteamHomePreviewPill(Modifier.align(androidx.compose.ui.Alignment.BottomCenter).padding(bottom = 20.dp)) + } return } if (selected == "store") { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 4fea952f34..efe3587660 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -658,6 +658,11 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com LaunchedEffect(SetupTabs.openSection) { if (SetupTabs.openSection != null && (railSelection != "setup" || s.pageKey != null)) showRailPage("setup", true) } + LaunchedEffect(DevPreview.openSteam) { + if (!DevPreview.openSteam) return@LaunchedEffect + DevPreview.openSteam = false + showRailPage("steam", true) + } LaunchedEffect(DevPreview.openLibrary) { if (!DevPreview.openLibrary) return@LaunchedEffect DevPreview.openLibrary = false diff --git a/app/src/main/java/com/droiddeck/launcher/ui/SteamHome.kt b/app/src/main/java/com/droiddeck/launcher/ui/SteamHome.kt index b70345bb2b..6ea5b16cab 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/SteamHome.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/SteamHome.kt @@ -113,7 +113,8 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier) } val owned = remember(ownedAll, concealed) { ownedAll.filter { it.first.toLong() !in concealed } } val featured = remember(featuredAll, concealed) { featuredAll.filter { it.appId.toLong() !in concealed } } - val games = remember(s.steamGames, LibraryHidden.keys, LibraryHidden.steam) { s.steamGames.filterNot { LibraryHidden.isHidden(hideKey(it), it) }.sortedWith(compareByDescending { it.lastPlayed }.thenBy { it.gameId }) } + val previewing = DevPreview.steamHome + val games = remember(s.steamGames, previewing, LibraryHidden.keys, LibraryHidden.steam) { (if (previewing == SteamHomePreview.OFF) s.steamGames else sampleSteamHomeGames(previewing.games)).filterNot { LibraryHidden.isHidden(hideKey(it), it) }.sortedWith(compareByDescending { it.lastPlayed }.thenBy { it.gameId }) } val narrow = LocalNarrowPane.current var words by remember { mutableStateOf(null) } val mode = com.droiddeck.launcher.session.SessionService.MODE_STEAM @@ -163,12 +164,12 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier) games.isEmpty() -> EmptyLibrary( avoid = words, wall = if (owned.isEmpty() && featured.isEmpty()) null else { { CapsuleWall(emptyList(), owned = owned, featured = featured) } }, - ) { Box(Modifier.fillMaxSize().graphicsLayer { scaleX = 1.06f; scaleY = 1.06f }) { WallFade() } } + ) { Box(Modifier.fillMaxSize().graphicsLayer { scaleX = 1.06f; scaleY = 1.06f }) { WallFade(bottomWhenTall = true) } } games.size < WALL_MIN_GAMES -> CapsuleFan(games) else -> CapsuleWall(games, owned = owned, featured = featured) } }, - scrim = { if (games.size >= WALL_MIN_GAMES) WallFade() }, + scrim = { if (games.size >= WALL_MIN_GAMES) WallFade(bottomWhenTall = true) }, words = { val onboardingActive by com.droiddeck.launcher.session.Onboarding.active.collectAsState() val onboardingFailed by com.droiddeck.launcher.session.Onboarding.failed.collectAsState() @@ -232,19 +233,35 @@ internal fun Modifier.overhang(by: androidx.compose.ui.unit.Dp = 4.dp): Modifier } @Composable -internal fun WallFade(modifier: Modifier = Modifier.fillMaxSize().overhang()) { +internal fun WallFade(modifier: Modifier = Modifier.fillMaxSize().overhang(), bottomWhenTall: Boolean = false) { val colors = MaterialTheme.colorScheme - Box( - modifier.background( - Brush.horizontalGradient( - 0f to colors.background.copy(alpha = 0.86f), - 0.34f to colors.background.copy(alpha = 0.6f), - 0.68f to colors.background.copy(alpha = 0.14f), - 1f to colors.background.copy(alpha = 0.04f), - ), - ), - ) - Box(modifier.background(Brush.verticalGradient(0.6f to Color.Transparent, 1f to colors.background.copy(alpha = 0.75f)))) + BoxWithConstraints(modifier) { + if (bottomWhenTall && maxHeight > maxWidth) { + // The words sit at the bottom of a tall page, so the art stays clear above them and darkens only behind them. + Box( + Modifier.fillMaxSize().background( + Brush.verticalGradient( + 0f to colors.background.copy(alpha = 0.12f), + 0.5f to colors.background.copy(alpha = 0.18f), + 0.72f to colors.background.copy(alpha = 0.72f), + 1f to colors.background.copy(alpha = 0.94f), + ), + ), + ) + } else { + Box( + Modifier.fillMaxSize().background( + Brush.horizontalGradient( + 0f to colors.background.copy(alpha = 0.86f), + 0.34f to colors.background.copy(alpha = 0.6f), + 0.68f to colors.background.copy(alpha = 0.14f), + 1f to colors.background.copy(alpha = 0.04f), + ), + ), + ) + Box(Modifier.fillMaxSize().background(Brush.verticalGradient(0.6f to Color.Transparent, 1f to colors.background.copy(alpha = 0.75f)))) + } + } } @Composable @@ -387,31 +404,45 @@ private fun CapsuleFan(games: List) { transition.animateFloat(0f, 1f, infiniteRepeatable(tween(ms, easing = FastOutSlowInEasing), RepeatMode.Reverse), label = "float") } val still = Motion.scale == 0f - val slots = listOf( + val landscape = listOf( FanSlot(0.54f, 0.14f, 0.62f, -9f), FanSlot(0.70f, 0.24f, 0.56f, 5f), FanSlot(0.40f, 0.30f, 0.50f, -17f), ) + // A tall page sizes the cards from its width, so they fit any aspect; heights are fractions of the width. + val portrait = listOf( + FanSlot(0.27f, 0.11f, 0.70f, -9f), + FanSlot(0.55f, 0.19f, 0.64f, 5f), + FanSlot(0.04f, 0.26f, 0.56f, -17f), + ) BoxWithConstraints( Modifier.fillMaxSize().drawBehind { drawRect( Brush.radialGradient( listOf(pal.signal.copy(alpha = 0.14f), Color.Transparent), - center = Offset(size.width * 0.68f, size.height * 0.45f), radius = size.height * 0.6f, + center = if (size.height > size.width) Offset(size.width * 0.55f, size.height * 0.28f) else Offset(size.width * 0.68f, size.height * 0.45f), + radius = if (size.height > size.width) size.width * 0.9f else size.height * 0.6f, ), ) }, ) { val radius = with(density) { 14.dp.toPx() } + val tall = maxHeight > maxWidth + val slots = if (tall) portrait else landscape for (i in games.indices.reversed()) { val slot = slots[i] - val h = maxHeight * slot.height + val h = if (tall) maxWidth * slot.height else maxHeight * slot.height + val x = if (tall) { + // The lean and the float swing the corners out by about h/2 * sin(angle). + val swing = h * kotlin.math.sin(Math.toRadians(kotlin.math.abs(slot.lean) + 2.0)).toFloat() / 2f + (maxWidth * slot.x).coerceIn(swing, (maxWidth - h * 2f / 3f - swing).coerceAtLeast(swing)) + } else maxWidth * slot.x val v: State = floats[i] val look = WallCapsule(artBrush(hueOf(games[i].name)), games[i].art) val art = look.art?.let { rememberCapsuleArt(it, with(density) { Size((h * 2f / 3f).toPx(), h.toPx()) }, radius) } Spacer( Modifier - .offset(x = maxWidth * slot.x, y = maxHeight * slot.y) + .offset(x = x, y = maxHeight * slot.y) .size(h * 2f / 3f, h) .graphicsLayer { val t = if (still) 0f else v.value diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9b754f9e5f..3627ce6603 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4376,6 +4376,10 @@ Open Show Previews change nothing real: nothing is installed, removed or signed out, and the menu\'s switches save nothing. A Library preview stays until you end it from its pill or restart. + Steam home + No games installed + 3 games installed + 12 games installed Library Nothing installed Signed out of every store From fe4f619973e1401682a889221a523bd9873ea285 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 12:51:13 -0400 Subject: [PATCH 084/120] chore: trigger CI rerun From 131a351f3feafde6e7b9484b7163d15bd9cd3276 Mon Sep 17 00:00:00 2001 From: FryMcNugget Date: Sun, 29 Nov 2026 17:55:45 +0000 Subject: [PATCH 085/120] fix(runtime): Unity 5 games no longer crash on their first HTTPS request (#3394) --- .../runtime/LinuxNetworkLinkComponent.kt | 42 +++++++++++++-- .../runtime/LinuxNetworkLinkComponentTest.kt | 53 +++++++++++++++++++ 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxNetworkLinkComponent.kt b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxNetworkLinkComponent.kt index b76172edb1..1f5d1a4d56 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxNetworkLinkComponent.kt +++ b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxNetworkLinkComponent.kt @@ -302,9 +302,9 @@ class LinuxNetworkLinkComponent( val etc = File(rootDir, "etc") replace(File(etc, "resolv.conf"), text) val hosts = File(etc, "hosts") - if (!hosts.isFile || !hosts.readText().contains("localhost")) { - hosts.writeText("127.0.0.1 localhost\n::1 localhost\n") - } + val existing = if (hosts.isFile) hosts.readText() else null + val wanted = hostsText(existing) + if (wanted != existing) replace(hosts, wanted) Log.i(TAG, "resolver: " + servers.joinToString(" ")) } catch (e: IOException) { Log.w(TAG, "Could not write the resolver", e) @@ -338,6 +338,42 @@ class LinuxNetworkLinkComponent( companion object { private val WRITES = Any() + private const val HOSTS_BLOCK_START = "# DroidDeck: Unity telemetry is refused (start)" + private const val HOSTS_BLOCK_END = "# DroidDeck: Unity telemetry is refused (end)" + + // Unity 5's player seeds its bundled OpenSSL before its first HTTPS request, and that code jumps + // to a bad address under FEX (Windlands, 428370). Refusing these telemetry hosts makes the request + // fail before TLS starts; the games run without them. + internal val UNITY_TELEMETRY_HOSTS = listOf( + "config.uca.cloud.unity3d.com", "api.uca.cloud.unity3d.com", "cdp.cloud.unity3d.com", + "stats.unity3d.com", "perf-events.cloud.unity3d.com", + ) + + internal fun hostsText(existing: String?): String { + val kept = mutableListOf() + var block: MutableList? = null + for (line in existing.orEmpty().lines()) { + when { + line == HOSTS_BLOCK_START -> { + block?.let(kept::addAll) + block = mutableListOf() + } + line == HOSTS_BLOCK_END -> block = null + block != null -> block!!.add(line) + else -> kept.add(line) + } + } + block?.let(kept::addAll) + kept.removeAll { it.isBlank() } + return buildString { + if (kept.none { it.substringBefore('#').contains("localhost") }) append("127.0.0.1 localhost\n::1 localhost\n") + kept.forEach { append(it).append('\n') } + append(HOSTS_BLOCK_START).append('\n') + append("0.0.0.0 ").append(UNITY_TELEMETRY_HOSTS.joinToString(" ")).append('\n') + append(HOSTS_BLOCK_END).append('\n') + } + } + internal fun gateways(properties: LinkProperties?, capabilities: NetworkCapabilities?): List = listOf(Inet4Address::class.java, Inet6Address::class.java).mapNotNull { family -> properties?.routes.orEmpty() diff --git a/app/src/test/java/com/droiddeck/launcher/runtime/LinuxNetworkLinkComponentTest.kt b/app/src/test/java/com/droiddeck/launcher/runtime/LinuxNetworkLinkComponentTest.kt index dea3a46859..c0928c4545 100644 --- a/app/src/test/java/com/droiddeck/launcher/runtime/LinuxNetworkLinkComponentTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/runtime/LinuxNetworkLinkComponentTest.kt @@ -188,4 +188,57 @@ class LinuxNetworkLinkComponentTest { ReflectionHelpers.callInstanceMethod(component, "replace", from(java.io.File::class.java, file), from(String::class.java, "nameserver 8.8.8.8\n")) assertEquals("nameserver 8.8.8.8\n", file.readText()) } + + private val telemetryLine = "0.0.0.0 " + LinuxNetworkLinkComponent.UNITY_TELEMETRY_HOSTS.joinToString(" ") + + @Test + fun newHostsFileHasLocalhostAndRefusesUnityTelemetry() { + val text = LinuxNetworkLinkComponent.hostsText(null) + assertTrue(text.startsWith("127.0.0.1 localhost\n::1 localhost\n")) + assertTrue(text.contains("$telemetryLine\n")) + assertTrue("stats.unity3d.com" in LinuxNetworkLinkComponent.UNITY_TELEMETRY_HOSTS) + } + + @Test + fun hostsKeepsTheUsersLinesAndWritesTheBlockOnce() { + val user = "127.0.0.1 localhost\n::1 localhost\n10.0.0.5 nas.lan\n" + val once = LinuxNetworkLinkComponent.hostsText(user) + assertTrue(once.startsWith(user)) + assertEquals(once, LinuxNetworkLinkComponent.hostsText(once)) + assertEquals(1, once.lines().count { it == telemetryLine }) + } + + @Test + fun hostsReplacesAnOlderBlockWithTheCurrentList() { + val old = "127.0.0.1 localhost\n# DroidDeck: Unity telemetry is refused (start)\n0.0.0.0 old.example\n" + + "# DroidDeck: Unity telemetry is refused (end)\n10.0.0.5 nas.lan\n" + val text = LinuxNetworkLinkComponent.hostsText(old) + assertFalse(text.contains("old.example")) + assertTrue(text.contains("10.0.0.5 nas.lan\n")) + assertTrue(text.contains("$telemetryLine\n")) + } + + @Test + fun hostsKeepsTheUsersLinesAfterAStartMarkerWithoutAnEnd() { + val broken = "127.0.0.1 localhost\n# DroidDeck: Unity telemetry is refused (start)\n10.0.0.5 nas.lan\n" + val once = LinuxNetworkLinkComponent.hostsText(broken) + assertTrue(once.contains("10.0.0.5 nas.lan\n")) + assertEquals(1, once.lines().count { it == "# DroidDeck: Unity telemetry is refused (start)" }) + val twice = LinuxNetworkLinkComponent.hostsText(once) + assertTrue(twice.contains("10.0.0.5 nas.lan\n")) + assertEquals(once, twice) + } + + @Test + fun hostsDropsAStrayEndMarker() { + val text = LinuxNetworkLinkComponent.hostsText("127.0.0.1 localhost\n# DroidDeck: Unity telemetry is refused (end)\n10.0.0.5 nas.lan\n") + assertTrue(text.startsWith("127.0.0.1 localhost\n10.0.0.5 nas.lan\n")) + assertEquals(1, text.lines().count { it == "# DroidDeck: Unity telemetry is refused (end)" }) + } + + @Test + fun hostsAddsLocalhostOnlyWhenItIsMissing() { + assertTrue(LinuxNetworkLinkComponent.hostsText("10.0.0.5 nas.lan\n").startsWith("127.0.0.1 localhost\n::1 localhost\n10.0.0.5 nas.lan\n")) + assertEquals(1, LinuxNetworkLinkComponent.hostsText("127.0.0.1 localhost\n").lines().count { "localhost" in it }) + } } From 1d155b2fe08fc36d6a66124bf82da6aa6c3d2078 Mon Sep 17 00:00:00 2001 From: FryMcNugget Date: Sun, 29 Nov 2026 17:56:29 +0000 Subject: [PATCH 086/120] Quest: SteamVR runs cleanly at close to 72 Hz (right-eye glitch, black voids, frame rate) (#3360) --- app/src/main/cpp/questxr/quest_xr.cpp | 7 +- .../droiddeck/launcher/QuestSteamVrWatch.kt | 36 ++++++ .../com/droiddeck/launcher/QuestXrActivity.kt | 15 ++- .../com/droiddeck/launcher/SessionActivity.kt | 12 ++ .../launcher/session/QuestSteamVrLaunch.kt | 35 +++++ .../launcher/session/SessionService.kt | 1 + .../launcher/QuestSteamVrWatchTest.kt | 50 +++++++ .../overlay/usr/local/bin/droiddeck-agent | 12 ++ .../overlay/usr/local/bin/droiddeck-steamvr | 42 +++++- .../usr/local/bin/droiddeck-steamvr-settings | 23 +++- tools/tests/test_steamvr_helper.py | 28 +++- tools/vr/src/driver_droiddeck.cpp | 83 ++++++++---- tools/vr/src/scheduling.c | 35 +++++ tools/vr/src/vk_layer_droiddeck_vr.c | 122 +++++++++++++++++- tools/vr/src/wsi_capture.cpp | 77 +++++++++-- tools/vr/src/wsi_capture.h | 1 + tools/vr/src/xr_gpu_channel.h | 15 +++ tools/vr/src/xr_tracking_file.h | 44 ++++++- 18 files changed, 585 insertions(+), 53 deletions(-) create mode 100644 app/src/main/java/com/droiddeck/launcher/QuestSteamVrWatch.kt create mode 100644 app/src/main/java/com/droiddeck/launcher/session/QuestSteamVrLaunch.kt create mode 100644 app/src/test/java/com/droiddeck/launcher/QuestSteamVrWatchTest.kt diff --git a/app/src/main/cpp/questxr/quest_xr.cpp b/app/src/main/cpp/questxr/quest_xr.cpp index 09423c7d1a..8646bd501c 100644 --- a/app/src/main/cpp/questxr/quest_xr.cpp +++ b/app/src/main/cpp/questxr/quest_xr.cpp @@ -614,10 +614,13 @@ private: XrSessionBeginInfo begin{XR_TYPE_SESSION_BEGIN_INFO}; begin.primaryViewConfigurationType = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO; check(xrBeginSession(session_, &begin), "xrBeginSession"); running_ = true; + // Meta's clock governor scales clocks by the DroidDeck process's overall load and cannot see + // SteamVR missing refreshes inside the guest; holding the top level kept it at 72 Hz. if (setPerformance_) { for (auto domain : {XR_PERF_SETTINGS_DOMAIN_CPU_EXT, XR_PERF_SETTINGS_DOMAIN_GPU_EXT}) { - XrResult request = setPerformance_(session_, domain, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT); - __android_log_print(ANDROID_LOG_INFO, "DroidDeckXR", "sustained performance domain=%d result=%d", domain, request); + XrResult request = setPerformance_(session_, domain, XR_PERF_SETTINGS_LEVEL_BOOST_EXT); + if (XR_FAILED(request)) request = setPerformance_(session_, domain, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT); + __android_log_print(ANDROID_LOG_INFO, "DroidDeckXR", "performance domain=%d result=%d", domain, request); } } } else if (state_ == XR_SESSION_STATE_STOPPING) { diff --git a/app/src/main/java/com/droiddeck/launcher/QuestSteamVrWatch.kt b/app/src/main/java/com/droiddeck/launcher/QuestSteamVrWatch.kt new file mode 100644 index 0000000000..eab1ee2f37 --- /dev/null +++ b/app/src/main/java/com/droiddeck/launcher/QuestSteamVrWatch.kt @@ -0,0 +1,36 @@ +package com.droiddeck.launcher + +import com.droiddeck.launcher.gpu.SteamVr + +internal class QuestSteamVrWatch(start: Long) { + private var startupDeadline = start + STARTUP_MS + private var lastRunning: Long? = null + private var graceUntil = start + private var wasPaused = false + + // A frozen guest cannot answer the status call, so a status read during a freeze, or one that + // started before it, says nothing about SteamVR. + fun stopped(now: Long, status: SteamVr.Status, paused: Boolean): Boolean { + if (paused) { + wasPaused = true + return false + } + if (wasPaused) { + wasPaused = false + graceUntil = now + RESUME_GRACE_MS + } + if (status == SteamVr.Status.RUNNING) { + lastRunning = now + graceUntil = now + return false + } + val deadline = lastRunning?.plus(RUNNING_GRACE_MS) ?: startupDeadline + return now >= maxOf(deadline, graceUntil) + } + + companion object { + const val STARTUP_MS = 30_000L + const val RUNNING_GRACE_MS = 5_000L + const val RESUME_GRACE_MS = 15_000L + } +} diff --git a/app/src/main/java/com/droiddeck/launcher/QuestXrActivity.kt b/app/src/main/java/com/droiddeck/launcher/QuestXrActivity.kt index 98e5a0b227..5bde3ef872 100644 --- a/app/src/main/java/com/droiddeck/launcher/QuestXrActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/QuestXrActivity.kt @@ -52,18 +52,17 @@ class QuestXrActivity : NativeActivity() { if (!closing) leaveXr("SteamVR start failed", sessionAlive()) return@Thread } - val startupDeadline = SystemClock.elapsedRealtime() + 30_000 - var lastRunning: Long? = null + val watch = QuestSteamVrWatch(SystemClock.elapsedRealtime()) while (!closing) { if (!sessionAlive()) { leaveXr("Steam session ended", false) break } - steamVrStatus = SteamVr.status(this) - val now = SystemClock.elapsedRealtime() - if (steamVrStatus == SteamVr.Status.RUNNING) lastRunning = now - val deadline = lastRunning?.plus(5_000) ?: startupDeadline - if (steamVrStatus != SteamVr.Status.RUNNING && now >= deadline) { + val pausedBefore = guestPaused() + val status = SteamVr.status(this) + val paused = pausedBefore || guestPaused() + if (!paused) steamVrStatus = status + if (watch.stopped(SystemClock.elapsedRealtime(), status, paused)) { leaveXr("SteamVR stopped or did not finish starting", true) break } @@ -81,6 +80,8 @@ class QuestXrActivity : NativeActivity() { } } + private fun guestPaused() = SessionState.suspending || SessionState.suspended || SessionState.resuming + private fun sessionAlive() = SessionState.running && !SessionState.stopRequested && sessionId != null && SessionState.sessionId == sessionId diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index 11fd6b86f2..8473957bcd 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -2916,6 +2916,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde val runtimeDir = File(filesDir, ".wayland-rt").apply { mkdirs() } FileUtils.copyAsset(this, "wayland/keymap.xkb", File(runtimeDir, "keymap.xkb")) com.droiddeck.launcher.input.VrControllers.publish(this) + com.droiddeck.launcher.session.QuestSteamVrLaunch.publish(this) val turnip = TurnipDriver(this) com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "surface.driver-setup") @@ -6371,6 +6372,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde } if (CompositorHost.isStarted) applyFrameGen(force = true) applyFollowOrientation(resources.configuration) + uiHandler.removeCallbacks(questSteamVrRequest) + if (com.droiddeck.launcher.session.QuestExperimental.isSupported()) uiHandler.post(questSteamVrRequest) if (runtimeRemovalBlocked) return if (!SessionState.suspended) pausedFrame = null com.droiddeck.launcher.ui.Motion.refresh(this) @@ -6430,10 +6433,19 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde } override fun onPause() { + uiHandler.removeCallbacks(questSteamVrRequest) departureCleanup() super.onPause() } + private val questSteamVrRequest = object : Runnable { + override fun run() { + if (com.droiddeck.launcher.session.QuestSteamVrLaunch.takeRequest(this@SessionActivity) && + SessionState.running && SessionState.mode == SessionService.MODE_STEAM) steamVrAction("start") + uiHandler.postDelayed(this, 1000) + } + } + private fun departureCleanup() { com.droiddeck.launcher.input.SystemKeyCapture.detach(this) com.droiddeck.launcher.input.HomeButtonShortcuts.detach(this) diff --git a/app/src/main/java/com/droiddeck/launcher/session/QuestSteamVrLaunch.kt b/app/src/main/java/com/droiddeck/launcher/session/QuestSteamVrLaunch.kt new file mode 100644 index 0000000000..8f619b86b3 --- /dev/null +++ b/app/src/main/java/com/droiddeck/launcher/session/QuestSteamVrLaunch.kt @@ -0,0 +1,35 @@ +package com.droiddeck.launcher.session + +import android.content.Context +import java.io.File + +/** + * On a Quest, SteamVR has to run inside the immersive activity. A launch from Steam's library happens in the + * guest, so the guest's SteamVR helper leaves a request in the shared runtime directory for the session to act on. + */ +object QuestSteamVrLaunch { + private const val DIR = ".wayland-rt/droiddeck-steamvr" + private const val MARKER = "quest-immersive" + private const val REQUEST = "xr-request" + + fun publish(context: Context) { + val dir = File(context.filesDir, DIR) + val marker = File(dir, MARKER) + if (!QuestExperimental.isSupported()) { + marker.delete() + return + } + runCatching { + dir.mkdirs() + marker.writeText("") + } + } + + /** A request left by an earlier session must not open the immersive view in this one. */ + fun clearRequest(context: Context) { + File(context.filesDir, "$DIR/$REQUEST").delete() + } + + fun takeRequest(context: Context): Boolean = + QuestExperimental.isSupported() && File(context.filesDir, "$DIR/$REQUEST").delete() +} diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index c2296584e5..56c4f27f57 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -417,6 +417,7 @@ class SessionService : Service() { SessionPrefs.screenEffectsProfileId(SessionState.mode, resolvedGameId, SessionState.program), ) com.droiddeck.launcher.stores.battlenet.BattleNetClient.clearRequests(LinuxRuntime.sessionRoot(this)) + QuestSteamVrLaunch.clearRequest(this) val gen = synchronized(SessionState.startLock) { synchronized(stopLock) { SessionState.steamClientArch = null diff --git a/app/src/test/java/com/droiddeck/launcher/QuestSteamVrWatchTest.kt b/app/src/test/java/com/droiddeck/launcher/QuestSteamVrWatchTest.kt new file mode 100644 index 0000000000..e19c65a5cc --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/QuestSteamVrWatchTest.kt @@ -0,0 +1,50 @@ +package com.droiddeck.launcher + +import com.droiddeck.launcher.gpu.SteamVr.Status +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test + +class QuestSteamVrWatchTest { + @Test + fun steamVrThatNeverStartsFailsAfterTheStartupWindow() { + val watch = QuestSteamVrWatch(0) + assertFalse(watch.stopped(29_999, Status.READY, paused = false)) + assertTrue(watch.stopped(30_000, Status.READY, paused = false)) + } + + @Test + fun steamVrThatStopsFailsAfterTheRunningGrace() { + val watch = QuestSteamVrWatch(0) + assertFalse(watch.stopped(10_000, Status.RUNNING, paused = false)) + assertFalse(watch.stopped(14_999, Status.UNAVAILABLE, paused = false)) + assertTrue(watch.stopped(15_000, Status.UNAVAILABLE, paused = false)) + } + + @Test + fun aFrozenGuestNeverCountsAsStopped() { + val watch = QuestSteamVrWatch(0) + assertFalse(watch.stopped(10_000, Status.RUNNING, paused = false)) + for (now in 11_000L..600_000L step 10_000) assertFalse(watch.stopped(now, Status.UNAVAILABLE, paused = true)) + } + + @Test + fun aResumedGuestGetsTheFullGraceFromItsFirstAnswerAfterTheFreeze() { + val watch = QuestSteamVrWatch(0) + watch.stopped(10_000, Status.RUNNING, paused = false) + watch.stopped(300_000, Status.UNAVAILABLE, paused = true) + assertFalse(watch.stopped(310_000, Status.UNAVAILABLE, paused = false)) + assertFalse(watch.stopped(324_999, Status.UNAVAILABLE, paused = false)) + assertTrue(watch.stopped(325_000, Status.UNAVAILABLE, paused = false)) + } + + @Test + fun steamVrAnsweringAfterAResumeKeepsTheSessionOpen() { + val watch = QuestSteamVrWatch(0) + watch.stopped(10_000, Status.RUNNING, paused = false) + watch.stopped(300_000, Status.UNAVAILABLE, paused = true) + assertFalse(watch.stopped(312_000, Status.RUNNING, paused = false)) + assertFalse(watch.stopped(316_999, Status.UNAVAILABLE, paused = false)) + assertTrue(watch.stopped(317_000, Status.UNAVAILABLE, paused = false)) + } +} diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-agent b/tools/linuxfs/overlay/usr/local/bin/droiddeck-agent index df0f4cedf1..449c90ac93 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-agent +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-agent @@ -1,6 +1,7 @@ #!/usr/bin/python3 import base64 +import ctypes import json import math import re @@ -19,6 +20,7 @@ import urllib.parse from pathlib import Path VERSION = 1 +PR_SET_CHILD_SUBREAPER = 36 OUTPUT_CAP = 256 * 1024 REQUEST_CAP = 256 * 1024 RESPONSE_CAP = 1024 * 1024 @@ -1238,7 +1240,17 @@ def answer(agent_dir, path): write_json(agent_dir / "resp" / (rid + ".json"), result) +def stop_adopting_orphans(): + # libddsession makes every session process a child subreaper. The agent never reaps adopted orphans, so + # SteamVR left zombies that its helper's stop counted as still running. The session shell above reaps them. + try: + ctypes.CDLL(None, use_errno=True).prctl(PR_SET_CHILD_SUBREAPER, 0, 0, 0, 0) + except (OSError, AttributeError): + pass + + def serve(agent_dir, focus=True, poll=0.1): + stop_adopting_orphans() (agent_dir / "req").mkdir(parents=True, exist_ok=True) (agent_dir / "resp").mkdir(parents=True, exist_ok=True) can_focus = focus and bool(os.environ.get("DISPLAY")) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr b/tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr index 176f92aad3..8abe106a7f 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr @@ -14,7 +14,16 @@ chmod 700 "$state" PKG_URL=https://steamdeck-packages.steamos.cloud/archlinux-deckard-hotfixes/release/0.3.x/deckard-steamvr-rel-r25358740%2B28b72a4f-1-aarch64.pkg.tar.zst PKG_SHA256=90a600775eb3e8856dc475f83166a93a290a0b1f3b4e82a69c8e2a8f06b9ddc9 -running() { pgrep -x vrserver >/dev/null 2>&1; } +alive() { + for p in $(pgrep -x "$1"); do + case "$(awk '/^State:/ { print $2 }' "/proc/$p/status" 2>/dev/null)" in + Z|'') ;; + *) return 0 ;; + esac + done + return 1 +} +running() { alive vrserver; } installed() { [ -x "$steamvr/bin/linuxarm64/vrstartup" ]; } quest_settings() { backup=$HOME/.local/share/droiddeck/steamvr-quest-settings.json @@ -40,6 +49,19 @@ configure_graphics() { esac } +# On the guest's three cores Steam's web helpers took CPU time from vrcompositor's frames, so while the Quest view +# shows SteamVR they run at a lower priority. +steam_ui_priority() { + status=0 + for p in $(pgrep -x steamwebhelper); do + for t in /proc/"$p"/task/*; do + renice -n "$1" -p "${t##*/}" >/dev/null 2>&1 || [ ! -e "$t" ] || status=1 + done + done + [ "$status" = 0 ] || echo "could not set every Steam web helper thread to priority $1" >&2 + return "$status" +} + unregister() { if grep -qF "\"$steamvr\"" "$HOME/.config/openvr/openvrpaths.vrpath" 2>/dev/null; then rm -f "$HOME/.config/openvr/openvrpaths.vrpath" @@ -50,7 +72,7 @@ unregister() { } idle() { - [ ! -f "$state/active" ] && ! running && ! pgrep -x vrstartup >/dev/null 2>&1 && + [ ! -f "$state/active" ] && ! running && ! alive vrstartup && ( flock -n 9 ) 9>"$state/start.lock" } @@ -61,7 +83,7 @@ stop() { done for p in $(pgrep -f "$steamvr/bin/linuxarm64/vrcompositor-launcher"); do kill "$p" 2>/dev/null; done attempts=0 - while pgrep -x 'vrserver|vrcompositor' >/dev/null 2>&1; do + while alive 'vrserver|vrcompositor'; do attempts=$((attempts + 1)) if [ "$attempts" = 10 ]; then for p in $(pgrep -x 'vrserver|vrcompositor'); do kill -KILL "$p" 2>/dev/null; done @@ -69,8 +91,12 @@ stop() { [ "$attempts" -lt 20 ] || { echo 'SteamVR did not stop; preferences remain backed up' >&2; return 1; } sleep 0.1 done + # A SteamVR process killed while holding the IPC mutex in this file leaves it locked, and the next vrserver + # gives up on it ("failed to acquire SysMgrMutex"), so the headset shows an empty void. + alive 'vrserver|vrcompositor|vrstartup|vrdashboard|vrwebhelper' || rm -f /dev/shm/u*-ValveIPCSharedObj-SteamVR unregister quest_settings restore + steam_ui_priority 0 || : } case "${1:-status}" in @@ -81,6 +107,11 @@ launch) "$0" install || exit $? while [ -f "$state/installing" ]; do sleep 1; done fi + if [ -f "$state/quest-immersive" ]; then + : > "$state/xr-request" + echo "asked DroidDeck to open the Quest's immersive view, which starts SteamVR" + exit 0 + fi "$0" start ;; status) @@ -122,7 +153,7 @@ start) flock -n 9 || { echo "SteamVR start already in progress"; exit 0; } installed || { echo "SteamVR is not installed (droiddeck-steamvr install)"; exit 1; } [ -f "$driver/bin/linuxarm64/driver_droiddeck.so" ] || { echo "the Cardboard driver is missing from $driver"; exit 1; } - if [ -f "$state/active" ] && { running || pgrep -x vrstartup >/dev/null 2>&1; }; then + if [ -f "$state/active" ] && { running || alive vrstartup; }; then echo "DroidDeck SteamVR is already running" exit 0 fi @@ -215,8 +246,9 @@ JSON export LD_PRELOAD="$layer/libdroiddeck_vr_scheduling.so${LD_PRELOAD:+:$LD_PRELOAD}" if [ "${DROIDDECK_VR_PRESENT:-}" = questwsi ]; then quest_settings apply || exit 1 + steam_ui_priority 10 || : startup_handed_off=0 - trap '[ "$startup_handed_off" = 1 ] || quest_settings restore' EXIT + trap '[ "$startup_handed_off" = 1 ] || { quest_settings restore; steam_ui_priority 0 || :; }' EXIT cvp=$steamvr/drivers/cv/bin/linuxarm64/libArcturusPerception.so if [ -f "$cvp" ]; then disabled=$cvp.droiddeck-disabled diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr-settings b/tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr-settings index 723a2b6d5b..b7a4ef457a 100644 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr-settings +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr-settings @@ -4,7 +4,14 @@ import os from pathlib import Path import sys -OVERRIDES = {'enableLinuxVulkanAsync': True, 'motionSmoothing': False} +# SteamVR's arm64 build throttles the compositor to save power and skipped refreshes it had time for. +OVERRIDES = {'enableLinuxVulkanAsync': True, 'motionSmoothing': False, 'framesToThrottle': 0, 'powersaveFramesToThrottle': 0} +# Backups written before the throttle overrides existed do not record them. +ADDED_LATER = {'framesToThrottle', 'powersaveFramesToThrottle'} + + +def saved_entry(section, key): + return [key in section, section.get(key)] def read(path): @@ -33,6 +40,8 @@ def saved_preferences(path): if not isinstance(backup.get('section'), bool) or not isinstance(backup.get('values'), dict): raise ValueError('invalid backup object') for key in OVERRIDES: + if key not in backup['values'] and key in ADDED_LATER: + continue entry = backup['values'].get(key) if not isinstance(entry, list) or len(entry) != 2 or not isinstance(entry[0], bool): raise ValueError('invalid saved preference: ' + key) @@ -45,12 +54,16 @@ def saved_preferences(path): def update(operation, settings_path, backup_path): settings = read(settings_path) if operation == 'apply': + section = settings.get('steamvr', {}) if backup_path.exists(): - saved_preferences(backup_path) + backup = saved_preferences(backup_path) + missing = [key for key in OVERRIDES if key not in backup['values']] + if missing: + backup['values'].update({key: saved_entry(section, key) for key in missing}) + write(backup_path, backup) else: - section = settings.get('steamvr', {}) write(backup_path, {'section': 'steamvr' in settings, - 'values': {key: [key in section, section.get(key)] for key in OVERRIDES}}) + 'values': {key: saved_entry(section, key) for key in OVERRIDES}}) settings.setdefault('steamvr', {}).update(OVERRIDES) write(settings_path, settings) elif operation == 'restore': @@ -59,6 +72,8 @@ def update(operation, settings_path, backup_path): backup = saved_preferences(backup_path) section = settings.setdefault('steamvr', {}) for key in OVERRIDES: + if key not in backup['values']: + continue present, value = backup['values'][key] if present: section[key] = value diff --git a/tools/tests/test_steamvr_helper.py b/tools/tests/test_steamvr_helper.py index f99f5cbdc2..95df651c7f 100644 --- a/tools/tests/test_steamvr_helper.py +++ b/tools/tests/test_steamvr_helper.py @@ -108,7 +108,8 @@ class SteamVrHelperTest(unittest.TestCase): receiver.bind(str(self.runtime / 'droiddeck-xr-frames')) self.assertIn('present=questwsi lease=unset', self.lease_log()) settings = json.loads((self.home / '.local/share/Steam/config/steamvr.vrsettings').read_text()) - self.assertEqual(settings['steamvr'], {'enableLinuxVulkanAsync': True, 'motionSmoothing': False}) + self.assertEqual(settings['steamvr'], {'enableLinuxVulkanAsync': True, 'motionSmoothing': False, + 'framesToThrottle': 0, 'powersaveFramesToThrottle': 0}) self.assertFalse(cvp.exists()) self.assertEqual(Path(str(cvp) + '.droiddeck-disabled').read_bytes(), b'frame-only backend') @@ -172,6 +173,31 @@ class SteamVrHelperTest(unittest.TestCase): self.assertEqual(json.loads(settings.read_text()), original) self.assertFalse(backup.exists()) + def test_backup_saved_before_new_overrides_keeps_their_current_values(self): + settings = self.root / 'steamvr.vrsettings' + backup = self.root / 'quest-backup.json' + helper = SOURCE.with_name('droiddeck-steamvr-settings') + settings.write_text(json.dumps({'steamvr': {'motionSmoothing': True, 'framesToThrottle': 2}})) + backup.write_text(json.dumps({'section': True, 'values': {'enableLinuxVulkanAsync': [False, None], + 'motionSmoothing': [True, True]}})) + subprocess.run([sys.executable, str(helper), 'apply', str(settings), str(backup)], check=True) + self.assertEqual(json.loads(settings.read_text())['steamvr']['framesToThrottle'], 0) + subprocess.run([sys.executable, str(helper), 'restore', str(settings), str(backup)], check=True) + self.assertEqual(json.loads(settings.read_text()), {'steamvr': {'motionSmoothing': True, 'framesToThrottle': 2}}) + self.assertFalse(backup.exists()) + + def test_backup_missing_an_original_override_is_rejected(self): + settings = self.root / 'steamvr.vrsettings' + backup = self.root / 'quest-backup.json' + helper = SOURCE.with_name('droiddeck-steamvr-settings') + settings.write_text(json.dumps({'steamvr': {'motionSmoothing': False}})) + content = json.dumps({'section': True, 'values': {'motionSmoothing': [True, True]}}) + backup.write_text(content) + result = subprocess.run([sys.executable, str(helper), 'restore', str(settings), str(backup)], + capture_output=True, text=True) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(backup.read_text(), content) + def test_quest_update_preserves_previous_cvp_backup(self): self.environment['DROIDDECK_VR_PRESENT'] = 'questwsi' cvp = self.steamvr / 'drivers/cv/bin/linuxarm64/libArcturusPerception.so' diff --git a/tools/vr/src/driver_droiddeck.cpp b/tools/vr/src/driver_droiddeck.cpp index 05f3aec58b..c0b2f92ab1 100644 --- a/tools/vr/src/driver_droiddeck.cpp +++ b/tools/vr/src/driver_droiddeck.cpp @@ -530,6 +530,9 @@ bool JoyConLive(const droiddeck_joycon_hand &hand, int64_t nowNs) { nowNs - hand.time_ns < kJoyConStaleNs && hand.time_ns - nowNs < kJoyConStaleNs; } +// Older SteamVR games pick Touch or Vive controls from the tracking system name and treat anything but "oculus" as Vive. +static const char *TrackingSystemName(bool quest) { return quest ? "oculus" : "droiddeck"; } + class HandController : public ITrackedDeviceServerDriver { public: explicit HandController(bool right) : right_(right), arm_(right), camera_(right), luma_(right) {} @@ -1041,7 +1044,8 @@ public: const char *model = touch_ ? "DroidDeck Quest Touch" : index_ ? "DroidDeck Index Hand" : "DroidDeck Pad Hand"; VRProperties()->SetStringProperty(c, Prop_ModelNumber_String, model); VRProperties()->SetStringProperty(c, Prop_ManufacturerName_String, touch_ ? "Meta" : index_ ? "Valve" : "DroidDeck"); - VRProperties()->SetStringProperty(c, Prop_TrackingSystemName_String, "droiddeck"); + VRProperties()->SetStringProperty(c, Prop_TrackingSystemName_String, TrackingSystemName(xrMode_)); + VRProperties()->SetStringProperty(c, Prop_ActualTrackingSystemName_String, "droiddeck"); VRProperties()->SetStringProperty(c, Prop_RenderModelName_String, touch_ ? (right_ ? "oculus_quest_plus_controller_right" : "oculus_quest_plus_controller_left") : (right_ ? "{indexcontroller}valve_controller_knu_1_0_right" : "{indexcontroller}valve_controller_knu_1_0_left")); @@ -1378,7 +1382,8 @@ public: sentAspect_ = eyeAspect_; VRProperties()->SetStringProperty(c, Prop_ModelNumber_String, xrMode_ ? "DroidDeck Quest OpenXR" : "DroidDeck Cardboard"); VRProperties()->SetStringProperty(c, Prop_ManufacturerName_String, "DroidDeck"); - VRProperties()->SetStringProperty(c, Prop_TrackingSystemName_String, "droiddeck"); + VRProperties()->SetStringProperty(c, Prop_TrackingSystemName_String, TrackingSystemName(xrMode_)); + VRProperties()->SetStringProperty(c, Prop_ActualTrackingSystemName_String, "droiddeck"); VRProperties()->SetFloatProperty(c, Prop_UserIpdMeters_Float, 0.064f); if (xrMode_) { VRServerDriverHost()->SetDisplayEyeToHead(id_, XrEyeToHead(xr.head, xr.eyes[0].pose), XrEyeToHead(xr.head, xr.eyes[1].pose)); @@ -1447,6 +1452,22 @@ public: DriverPose_t GetPose() override { return GetPose(nullptr); } + static DriverPose_t XrHeadPose(const DroidDeckXrTracking &xr, bool fresh) { + DriverPose_t p = {}; + p.qWorldFromDriverRotation.w = 1; + p.qDriverFromHeadRotation.w = 1; + p.qRotation.w = 1; + p.deviceIsConnected = true; + p.poseIsValid = fresh && XrTrackingFile::Tracked(xr.head); + p.result = p.poseIsValid ? TrackingResult_Running_OK : TrackingResult_Running_OutOfRange; + if (p.poseIsValid) { + p.qRotation = {xr.head.orientation[3], xr.head.orientation[0], xr.head.orientation[1], xr.head.orientation[2]}; + for (int axis = 0; axis < 3; axis++) p.vecPosition[axis] = xr.head.position[axis]; + p.poseTimeOffset = XrTrackingFile::PoseTimeOffset(xr.predicted_ns, XrTrackingFile::Now()); + } + return p; + } + DriverPose_t GetPose(droiddeck_spatialpose *snapshot) { std::lock_guard lock(spatialMutex_); DriverPose_t p = {}; @@ -1455,17 +1476,7 @@ public: p.qRotation.w = 1; DroidDeckXrTracking xr; bool freshXr = xr_.Read(&xr) && XrTrackingFile::Fresh(xr); - if (freshXr || xrMode_) { - p.deviceIsConnected = true; - p.poseIsValid = freshXr && XrTrackingFile::Tracked(xr.head); - p.result = p.poseIsValid ? TrackingResult_Running_OK : TrackingResult_Running_OutOfRange; - if (p.poseIsValid) { - p.qRotation = {xr.head.orientation[3], xr.head.orientation[0], xr.head.orientation[1], xr.head.orientation[2]}; - for (int axis = 0; axis < 3; axis++) p.vecPosition[axis] = xr.head.position[axis]; - p.poseTimeOffset = XrTrackingFile::PoseTimeOffset(xr.predicted_ns, XrTrackingFile::Now()); - } - return p; - } + if (freshXr || xrMode_) return XrHeadPose(xr, freshXr); p.vecPosition[1] = 1.6; droiddeck_headpose hp; bool ok = pose_.Read(&hp); @@ -1580,19 +1591,44 @@ private: droiddeck_joycon joyCons = {}; bool haveJoyCons = false; auto lastSent = std::chrono::steady_clock::now(); + uint32_t lastLatch = 0; + bool headInvalid = false; + auto lastHands = lastSent - std::chrono::seconds(1); + auto publishHead = [&](const DriverPose_t &head) { + headInvalid = !head.poseIsValid; + VRServerDriverHost()->TrackedDevicePoseUpdated(id_, head, sizeof(head)); + }; while (running_) { DroidDeckXrTracking xr; if (xrMode_) { - bool fresh = xr_.Read(&xr) && XrTrackingFile::Fresh(xr); - if (fresh) PublishChaperone(xr); - DriverPose_t head = GetPose(); - VRServerDriverHost()->TrackedDevicePoseUpdated(id_, head, sizeof(head)); - for (int hand = 0; hand < 2; hand++) if (CardboardController *pad = ActiveHand(hand)) { - DroidDeckXrHand state = fresh ? xr.hands[hand] : DroidDeckXrHand{}; - pad->UpdateXr(state, fresh ? xr.predicted_ns : 0); + DroidDeckXrTracking latched; + const bool haveLatch = latch_.Read(&latched) && XrTrackingFile::Fresh(latched); + const auto now = std::chrono::steady_clock::now(); + const bool latchAdvanced = haveLatch && latched.seq != lastLatch; + if (haveLatch) { + if (latchAdvanced) { + lastLatch = latched.seq; + publishHead(XrHeadPose(latched, true)); + } + } else if (now - lastHands >= std::chrono::milliseconds(2)) { + publishHead(GetPose()); } - VRDriverInput()->UpdateBooleanComponent(proximity_, fresh, 0); - std::this_thread::sleep_for(std::chrono::milliseconds(2)); + if (now - lastHands >= std::chrono::milliseconds(2)) { + lastHands = now; + bool fresh = xr_.Read(&xr) && XrTrackingFile::Fresh(xr); + if (fresh) PublishChaperone(xr); + if (haveLatch && !latchAdvanced) { + if (!(fresh && XrTrackingFile::Tracked(xr.head))) publishHead(XrHeadPose(xr, fresh)); + else if (!XrTrackingFile::Tracked(latched.head)) publishHead(XrHeadPose(xr, fresh)); + else if (headInvalid) publishHead(XrHeadPose(latched, true)); + } + for (int hand = 0; hand < 2; hand++) if (CardboardController *pad = ActiveHand(hand)) { + DroidDeckXrHand state = fresh ? xr.hands[hand] : DroidDeckXrHand{}; + pad->UpdateXr(state, fresh ? xr.predicted_ns : 0); + } + VRDriverInput()->UpdateBooleanComponent(proximity_, fresh, 0); + } + std::this_thread::sleep_for(std::chrono::microseconds(500)); continue; } droiddeck_headpose hp; @@ -1735,7 +1771,7 @@ private: if (!poses[i].bDeviceIsConnected) continue; PropertyContainerHandle_t c = VRProperties()->TrackedDeviceToPropertyContainer(i); if (VRProperties()->GetInt32Property(c, Prop_DeviceClass_Int32) != TrackedDeviceClass_Controller) continue; - if (VRProperties()->GetStringProperty(c, Prop_TrackingSystemName_String) != "droiddeck") return true; + if (VRProperties()->GetStringProperty(c, Prop_SerialNumber_String).rfind("droiddeck-", 0) != 0) return true; } return false; } @@ -1770,6 +1806,7 @@ private: DriverPose_t lastSpatial_{}; droiddeck_spatialpose lastSpatialSnapshot_{}; XrTrackingFile xr_; + XrTrackingFile latch_{"/run/droiddeck/" DROIDDECK_XR_LATCH_FILE}; XrChaperoneOrigin chaperone_; bool xrMode_ = false; PadRing pad_; diff --git a/tools/vr/src/scheduling.c b/tools/vr/src/scheduling.c index 381397cea7..fd87c20472 100644 --- a/tools/vr/src/scheduling.c +++ b/tools/vr/src/scheduling.c @@ -1,8 +1,11 @@ #define _GNU_SOURCE +#include #include #include #include +#include #include +#include #include #include #include @@ -19,6 +22,38 @@ static int cannot_schedule_realtime(void) { return !(caps[CAP_SYS_NICE / 32].effective & (UINT32_C(1) << (CAP_SYS_NICE % 32))); } +/* Without real-time scheduling, vrcompositor's frame threads ran at the same nice level as Steam's web helpers on + * the guest's three cores and missed refreshes. Its threads at normal priority take the highest nice level instead; + * some are started where they do not inherit it, so they are raised again once a second. */ +static int compositor_without_realtime(void) { + return !strcmp(program_invocation_short_name, "vrcompositor") && cannot_schedule_realtime(); +} + +static void raise_threads(void) { + DIR *tasks = opendir("/proc/self/task"); + if (!tasks) return; + for (struct dirent *task; (task = readdir(tasks));) { + const int tid = atoi(task->d_name); + if (tid <= 0) continue; + errno = 0; + const int nice = getpriority(PRIO_PROCESS, (id_t)tid); + if (!errno && nice <= 0 && nice > -20) setpriority(PRIO_PROCESS, (id_t)tid, -20); + } + closedir(tasks); +} + +static void *raise_loop(void *unused) { + for (;;) { raise_threads(); sleep(1); } + return unused; +} + +__attribute__((constructor)) static void raise_compositor(void) { + if (!compositor_without_realtime()) return; + setpriority(PRIO_PROCESS, 0, -20); + pthread_t thread; + if (!pthread_create(&thread, NULL, raise_loop, NULL)) pthread_detach(thread); +} + int setrlimit(__rlimit_resource_t resource, const struct rlimit *limit) { int (*next)(__rlimit_resource_t, const struct rlimit *) = dlsym(RTLD_NEXT, "setrlimit"); if (!next) { errno = ENOSYS; return -1; } diff --git a/tools/vr/src/vk_layer_droiddeck_vr.c b/tools/vr/src/vk_layer_droiddeck_vr.c index be74139e5f..8eddc8a840 100644 --- a/tools/vr/src/vk_layer_droiddeck_vr.c +++ b/tools/vr/src/vk_layer_droiddeck_vr.c @@ -294,9 +294,12 @@ static void forget_device_semaphores(VkDevice dev); static void track_forget_device(VkDevice dev); static void producer_destroy_device(struct dev *device, const VkAllocationCallbacks *allocator); +static void warp_forget(VkDevice device, VkRenderPass pass); + static void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *alloc) { struct dev *d = dev_for(device); if (!d) return; + warp_forget(device, VK_NULL_HANDLE); #ifdef DROIDDECK_WSI_CAPTURE droiddeck_wsi_destroy(device); #endif @@ -585,9 +588,28 @@ static void VKAPI_CALL DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapc NEXT(device, DestroySwapchainKHR)(device, swapchain, allocator); } +static VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, + VkFence fence, uint32_t *index) { + VkResult r = NEXT(device, AcquireNextImageKHR)(device, swapchain, timeout, semaphore, fence, index); +#ifdef DROIDDECK_WSI_CAPTURE + if (r == VK_SUCCESS || r == VK_SUBOPTIMAL_KHR) droiddeck_wsi_acquired(device, swapchain, *index); +#endif + return r; +} + +static VkResult VKAPI_CALL AcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *info, uint32_t *index) { + VkResult r = NEXT(device, AcquireNextImage2KHR)(device, info, index); +#ifdef DROIDDECK_WSI_CAPTURE + if (r == VK_SUCCESS || r == VK_SUBOPTIMAL_KHR) droiddeck_wsi_acquired(device, info->swapchain, *index); +#endif + return r; +} + static PFN_vkVoidFunction display_device_hook(const char *name) { HOOK_AS("vkCreateSwapchainKHR", CreateSwapchainKHR) HOOK_AS("vkDestroySwapchainKHR", DestroySwapchainKHR) + HOOK_AS("vkAcquireNextImageKHR", AcquireNextImageKHR) + HOOK_AS("vkAcquireNextImage2KHR", AcquireNextImage2KHR) HOOK_AS("vkDisplayPowerControlEXT", DisplayPowerControlEXT) HOOK_AS("vkRegisterDeviceEventEXT", RegisterDeviceEventEXT) HOOK_AS("vkRegisterDisplayEventEXT", RegisterDisplayEventEXT) @@ -1383,6 +1405,100 @@ static VkResult VKAPI_CALL CreateImage(VkDevice d, const VkImageCreateInfo *ci, return r; } +/* vrcompositor renders both eyes through one shared texture and warps each into its half of the output in the + * same command buffer. On Turnip its barrier before the right eye's warp left the texture cache holding the + * left eye, so blocks of the left eye showed in the right one. A full barrier before each warp pass fixes it. */ +#define WARP_PASSES 32 +static struct { VkDevice device; VkRenderPass pass; } g_warp_passes[WARP_PASSES]; +static pthread_mutex_t g_warp_lock = PTHREAD_MUTEX_INITIALIZER; + +static int warp_wanted(void) { + static int wanted = -1; + if (wanted < 0) { + const char *mode = getenv("DROIDDECK_VR_PRESENT"); + wanted = mode && !strcmp(mode, "questwsi") && !strcmp(program_invocation_short_name, "vrcompositor"); + } + return wanted; +} + +static void warp_note(VkDevice device, VkRenderPass pass, uint32_t attachments, VkSampleCountFlagBits samples) { + if (attachments != 1 || samples != VK_SAMPLE_COUNT_1_BIT) return; + pthread_mutex_lock(&g_warp_lock); + for (int i = 0; i < WARP_PASSES; i++) + if (!g_warp_passes[i].pass) { g_warp_passes[i].device = device; g_warp_passes[i].pass = pass; break; } + pthread_mutex_unlock(&g_warp_lock); +} + +static void warp_forget(VkDevice device, VkRenderPass pass) { + pthread_mutex_lock(&g_warp_lock); + for (int i = 0; i < WARP_PASSES; i++) + if (g_warp_passes[i].device == device && (!pass || g_warp_passes[i].pass == pass)) + g_warp_passes[i].device = VK_NULL_HANDLE, g_warp_passes[i].pass = VK_NULL_HANDLE; + pthread_mutex_unlock(&g_warp_lock); +} + +static int warp_pass(VkRenderPass pass) { + int found = 0; + pthread_mutex_lock(&g_warp_lock); + for (int i = 0; i < WARP_PASSES && !found; i++) found = pass && g_warp_passes[i].pass == pass; + pthread_mutex_unlock(&g_warp_lock); + return found; +} + +static VkResult VKAPI_CALL CreateRenderPass(VkDevice d, const VkRenderPassCreateInfo *ci, const VkAllocationCallbacks *a, VkRenderPass *out) { + VkResult r = NEXT(d, CreateRenderPass)(d, ci, a, out); + if (r == VK_SUCCESS) warp_note(d, *out, ci->attachmentCount, ci->attachmentCount ? ci->pAttachments[0].samples : 0); + return r; +} + +static void VKAPI_CALL DestroyRenderPass(VkDevice d, VkRenderPass pass, const VkAllocationCallbacks *a) { + if (pass) warp_forget(d, pass); + NEXT(d, DestroyRenderPass)(d, pass, a); +} + +static VkResult VKAPI_CALL CreateRenderPass2(VkDevice d, const VkRenderPassCreateInfo2 *ci, const VkAllocationCallbacks *a, VkRenderPass *out) { + PFN_vkCreateRenderPass2 next = (PFN_vkCreateRenderPass2)dev_for(d)->gdpa(d, "vkCreateRenderPass2"); + if (!next) next = (PFN_vkCreateRenderPass2)dev_for(d)->gdpa(d, "vkCreateRenderPass2KHR"); + VkResult r = next(d, ci, a, out); + if (r == VK_SUCCESS) warp_note(d, *out, ci->attachmentCount, ci->attachmentCount ? ci->pAttachments[0].samples : 0); + return r; +} + +static void warp_barrier(VkCommandBuffer cb, VkRenderPass pass) { + if (!warp_pass(pass)) return; + struct dev *d = dev_for(cb); + VkMemoryBarrier all = {VK_STRUCTURE_TYPE_MEMORY_BARRIER, NULL, VK_ACCESS_MEMORY_WRITE_BIT, + VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT}; + ((PFN_vkCmdPipelineBarrier)d->gdpa(d->handle, "vkCmdPipelineBarrier"))(cb, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 1, &all, 0, NULL, 0, NULL); +} + +static void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer cb, const VkRenderPassBeginInfo *bi, VkSubpassContents contents) { + warp_barrier(cb, bi->renderPass); + struct dev *d = dev_for(cb); + ((PFN_vkCmdBeginRenderPass)d->gdpa(d->handle, "vkCmdBeginRenderPass"))(cb, bi, contents); +} + +static void VKAPI_CALL CmdBeginRenderPass2(VkCommandBuffer cb, const VkRenderPassBeginInfo *bi, const VkSubpassBeginInfo *si) { + warp_barrier(cb, bi->renderPass); + struct dev *d = dev_for(cb); + PFN_vkCmdBeginRenderPass2 next = (PFN_vkCmdBeginRenderPass2)d->gdpa(d->handle, "vkCmdBeginRenderPass2"); + if (!next) next = (PFN_vkCmdBeginRenderPass2)d->gdpa(d->handle, "vkCmdBeginRenderPass2KHR"); + next(cb, bi, si); +} + +static PFN_vkVoidFunction warp_hook(const char *name) { + if (!warp_wanted()) return NULL; + HOOK_AS("vkCreateRenderPass", CreateRenderPass) + HOOK_AS("vkCreateRenderPass2", CreateRenderPass2) + HOOK_AS("vkCreateRenderPass2KHR", CreateRenderPass2) + HOOK_AS("vkDestroyRenderPass", DestroyRenderPass) + HOOK_AS("vkCmdBeginRenderPass", CmdBeginRenderPass) + HOOK_AS("vkCmdBeginRenderPass2", CmdBeginRenderPass2) + HOOK_AS("vkCmdBeginRenderPass2KHR", CmdBeginRenderPass2) + return NULL; +} + static PFN_vkVoidFunction semaphore_hook(const char *name) { HOOK_AS("vkCreateImage", CreateImage) HOOK_AS("vkCreateSemaphore", CreateSemaphore) @@ -1445,7 +1561,8 @@ EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL DroidDeckVr_GetInstanceProcAddr( if (f) return f; } if (in) { - PFN_vkVoidFunction f = semaphore_hook(name); + PFN_vkVoidFunction f = warp_hook(name); + if (!f) f = semaphore_hook(name); if (f && in->gipa(instance, name)) return f; } return in ? in->gipa(instance, name) : NULL; @@ -1461,7 +1578,8 @@ EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL DroidDeckVr_GetDeviceProcAddr(Vk if (f) return f; } if (d) { - PFN_vkVoidFunction mine = semaphore_hook(name); + PFN_vkVoidFunction mine = warp_hook(name); + if (!mine) mine = semaphore_hook(name); if (mine && d->gdpa(device, name)) return mine; } return d ? d->gdpa(device, name) : NULL; diff --git a/tools/vr/src/wsi_capture.cpp b/tools/vr/src/wsi_capture.cpp index ee7a7266c9..2c9c2f2181 100644 --- a/tools/vr/src/wsi_capture.cpp +++ b/tools/vr/src/wsi_capture.cpp @@ -41,6 +41,7 @@ struct CaptureSlot { bool rgbaInitialized{}; void *mapping{}; VkFence fence{}; + uint64_t uses{}; bool busy{}, queued{}; DroidDeckXrFrameHeader header{}; ~CaptureSlot() { Clear(); } @@ -134,9 +135,13 @@ struct Swapchain { VkFormat format{}; std::vector images; std::vector ready; + std::vector> copying; std::array slots; uint64_t frame{}; XrTrackingFile tracking; + XrLatchWriter latch; + DroidDeckXrTracking previous{}; + bool latched{}; XrFrameSender sender; XrGpuSender gpuSender; bool gpu{}; @@ -158,17 +163,47 @@ struct Swapchain { std::fprintf(stderr, "[droiddeck-vr-layer] WSI worker failed; restart SteamVR\n"); } } + // The headset takes one frame per display refresh, so waiting for each acknowledgement before sending the + // next left SteamVR's frames missing that refresh: up to two frames travel at once, each slot freed by its ack. + static constexpr size_t kInFlight = 2; + std::vector> inFlight; + int64_t oldestSent{}; + bool CollectAcks(int timeout) { + if (!gpu || inFlight.empty()) return true; + bool ok = gpuSender.Acks(timeout, [this](uint64_t ack) { + auto it = std::find_if(inFlight.begin(), inFlight.end(), [ack](const auto &item) { return item.first == ack; }); + if (it == inFlight.end()) return false; + { std::lock_guard lock(sendMutex); it->second->busy = false; } + inFlight.erase(it); + oldestSent = XrTrackingFile::Now(); + return true; + }); + return ok && (inFlight.empty() || XrTrackingFile::Now() - oldestSent < 5000000000LL); + } void Loop() { for (;;) { + if (!CollectAcks(0)) { + std::lock_guard lock(sendMutex); + std::fprintf(stderr, "[droiddeck-vr-layer] WSI headset stopped acknowledging frames; restart SteamVR\n"); + failed = true; return; + } CaptureSlot *slot; { std::unique_lock lock(sendMutex); - sendReady.wait(lock, [this] { - return stopping || std::any_of(slots.begin(), slots.end(), [](const auto &item) { return item.queued; }); - }); + auto ready = [this] { + return stopping || (inFlight.size() < kInFlight + && std::any_of(slots.begin(), slots.end(), [](const auto &item) { return item.queued; })); + }; + if (inFlight.empty()) sendReady.wait(lock, ready); + else if (!ready()) { + lock.unlock(); + CollectAcks(1); + continue; + } + if (stopping) return; slot = nullptr; for (auto &item : slots) if (item.queued && (!slot || item.header.frame_id < slot->header.frame_id)) slot = &item; - if (!slot) return; + if (!slot) continue; slot->queued = false; } auto &d = *device; @@ -182,10 +217,16 @@ struct Swapchain { VkMappedMemoryRange range{VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE}; range.memory = memory; range.size = VK_WHOLE_SIZE; if (result == VK_SUCCESS && !gpu) result = d.InvalidateMappedMemoryRanges(d.handle, 1, &range); int64_t invalidated = XrTrackingFile::Now(); + bool posted = false; if (result == VK_SUCCESS && XrTrackingFile::Now() - header.captured_ns < 200000000LL) { if (gpu) { uint32_t flags = (format == VK_FORMAT_B8G8R8A8_UNORM || format == VK_FORMAT_B8G8R8A8_SRGB) ? XR_GPU_BGRA : 0; - if (!gpuSender.Send(header, static_cast(slot - slots.data()), flags)) result = VK_ERROR_DEVICE_LOST; + if (!gpuSender.Post(header, static_cast(slot - slots.data()), flags)) result = VK_ERROR_DEVICE_LOST; + else { + if (inFlight.empty()) oldestSent = XrTrackingFile::Now(); + inFlight.emplace_back(header.frame_id, slot); + posted = true; + } } else sender.SendShared("/run/droiddeck/" DROIDDECK_XR_FRAME_SOCKET, header, sharedFd); } if (header.frame_id % 120 == 0) std::fprintf(stderr, "[droiddeck-vr-layer] WSI ms wait=%.2f invalidate=%.2f shared=%.2f\n", @@ -195,7 +236,7 @@ struct Swapchain { std::fprintf(stderr, "[droiddeck-vr-layer] WSI buffer quarantined: result=%d leaseLost=%d; restart SteamVR\n", result, sender.SharedLeaseLost()); failed = true; return; } - slot->busy = false; + if (!posted) slot->busy = false; } } bool Initialize(VkSwapchainKHR chain, VkQueue queue) { @@ -211,6 +252,7 @@ struct Swapchain { images.resize(count); if (d.GetSwapchainImagesKHR(d.handle, chain, &count, images.data())) return false; ready.resize(count); + copying.assign(count, {nullptr, 0}); VkSemaphoreCreateInfo semaphoreInfo{VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO}; for (auto &semaphore : ready) if (d.CreateSemaphore(d.handle, &semaphoreInfo, nullptr, &semaphore)) return false; XrGpuPoolInfo info; @@ -236,8 +278,11 @@ struct Swapchain { return result; } bool Header(DroidDeckXrFrameHeader &header) { - DroidDeckXrTracking packet{}; - if (!tracking.Read(&packet) || !XrTrackingFile::Fresh(packet)) return false; + DroidDeckXrTracking latest{}; + if (!tracking.Read(&latest) || !XrTrackingFile::Fresh(latest)) return false; + DroidDeckXrTracking packet = latched && XrTrackingFile::Fresh(previous) ? previous : latest; + previous = latest; latched = true; + latch.Write(latest); header = {}; header.magic = DROIDDECK_XR_FRAME_MAGIC; header.version = DROIDDECK_XR_FRAME_VERSION; header.width = extent.width; header.height = extent.height; @@ -260,6 +305,15 @@ struct Swapchain { } return xr_frame_valid(header); } + // The headless swapchain hands an image back as soon as it is presented, and KGSL has no implicit sync, so + // the compositor drew its next frame into an image this copy still read: blocky panels. The copy is waited + // for when the image is acquired again, by which time it has nearly always finished, rather than stalling + // the compositor in every present. + void Acquired(uint32_t index) { + if (index >= copying.size() || !copying[index].first) return; + CaptureSlot &slot = *copying[index].first; + if (slot.uses == copying[index].second) device->WaitForFences(device->handle, 1, &slot.fence, VK_TRUE, UINT64_MAX); + } VkResult Capture(VkQueue queue, uint32_t index, const VkPresentInfoKHR &present, VkSemaphore *completion) { auto &d = *device; if (index >= images.size()) return VK_ERROR_OUT_OF_DATE_KHR; @@ -329,6 +383,8 @@ struct Swapchain { submit.pWaitDstStageMask = stages.data(); submit.commandBufferCount = 1; submit.pCommandBuffers = &command; submit.signalSemaphoreCount = 1; submit.pSignalSemaphores = &ready[index]; if ((result = d.QueueSubmit(queue, 1, &submit, fence))) return Fail(result, slot); + if (copying.size() < images.size()) copying.resize(images.size(), {nullptr, 0}); + copying[index] = {&slot, ++slot.uses}; rgbaInitialized = true; { std::lock_guard lock(sendMutex); slot.header = header; slot.queued = true; sendReady.notify_all(); } *completion = ready[index]; @@ -379,6 +435,11 @@ extern "C" void droiddeck_wsi_swapchain(VkDevice device, VkSwapchainKHR chain, c chainState->extent = create->imageExtent; chainState->format = create->imageFormat; swapchains[chain] = std::move(chainState); } +extern "C" void droiddeck_wsi_acquired(VkDevice device, VkSwapchainKHR chain, uint32_t index) { + (void)device; std::lock_guard lock(mutex); + auto it = swapchains.find(chain); + if (it != swapchains.end() && it->second->initialized) it->second->Acquired(index); +} extern "C" void droiddeck_wsi_forget(VkDevice device, VkSwapchainKHR chain) { (void)device; std::lock_guard lock(mutex); swapchains.erase(chain); } diff --git a/tools/vr/src/wsi_capture.h b/tools/vr/src/wsi_capture.h index d56aab4eac..887b87a395 100644 --- a/tools/vr/src/wsi_capture.h +++ b/tools/vr/src/wsi_capture.h @@ -10,6 +10,7 @@ void droiddeck_wsi_device(VkDevice device, VkPhysicalDevice physical, VkInstance void droiddeck_wsi_destroy(VkDevice device); void droiddeck_wsi_swapchain(VkDevice device, VkSwapchainKHR swapchain, const VkSwapchainCreateInfoKHR *create); void droiddeck_wsi_forget(VkDevice device, VkSwapchainKHR swapchain); +void droiddeck_wsi_acquired(VkDevice device, VkSwapchainKHR swapchain, uint32_t index); VkResult droiddeck_wsi_present(VkDevice device, VkQueue queue, const VkPresentInfoKHR *present, PFN_vkQueuePresentKHR next); #ifdef __cplusplus diff --git a/tools/vr/src/xr_gpu_channel.h b/tools/vr/src/xr_gpu_channel.h index 52fb5d9d39..c0b9797ff5 100644 --- a/tools/vr/src/xr_gpu_channel.h +++ b/tools/vr/src/xr_gpu_channel.h @@ -111,6 +111,21 @@ public: || !xr_gpu_receive(socket_, &ack, sizeof(ack)) || ack != header.frame_id) { Close(); return false; } return true; } + bool Post(const DroidDeckXrFrameHeader &header, uint32_t slot, uint32_t flags = 0) { + if (socket_ < 0 || slot >= XR_GPU_SLOTS || (flags & ~XR_GPU_BGRA) || !xr_frame_valid(header)) return false; + XrGpuFrame frame; frame.header = header; frame.slot = slot; frame.flags = flags; + if (!xr_gpu_send(socket_, &frame, sizeof(frame))) { Close(); return false; } + return true; + } + template bool Acks(int timeout, Visit visit) { + if (socket_ < 0) return false; + while (xr_gpu_wait(socket_, timeout)) { + uint64_t ack{}; + if (!xr_gpu_receive(socket_, &ack, sizeof(ack)) || !visit(ack)) { Close(); return false; } + timeout = 0; + } + return true; + } void Close() { if (socket_ >= 0) close(socket_); socket_ = -1; } private: int socket_ = -1; diff --git a/tools/vr/src/xr_tracking_file.h b/tools/vr/src/xr_tracking_file.h index 1b122d412d..5bd314fde0 100644 --- a/tools/vr/src/xr_tracking_file.h +++ b/tools/vr/src/xr_tracking_file.h @@ -2,6 +2,7 @@ #include "xr_tracking.h" #include #include +#include #include #include #include @@ -38,8 +39,16 @@ public: } return false; } + // Android stamps these packets with the real monotonic clock. The session's clockpause preload holds the + // guest's clock back by the time spent suspended, so read libc's clock directly. static int64_t Now() { - timespec now{}; clock_gettime(CLOCK_MONOTONIC, &now); + using ClockGettime = int (*)(clockid_t, timespec *); + static const ClockGettime real = [] { + void *libc = dlopen("libc.so.6", RTLD_LAZY | RTLD_NOLOAD); + void *symbol = libc ? dlsym(libc, "clock_gettime") : nullptr; + return symbol ? reinterpret_cast(symbol) : &clock_gettime; + }(); + timespec now{}; real(CLOCK_MONOTONIC, &now); return (int64_t)now.tv_sec * 1000000000LL + now.tv_nsec; } static double PoseTimeOffset(int64_t predicted, int64_t now) { @@ -66,3 +75,36 @@ private: std::mutex mutex_; std::string path_; }; + +#define DROIDDECK_XR_LATCH_FILE "droiddeck-xr-latch" + +// The compositor's capture latches one head pose per frame here; the driver hands SteamVR exactly that pose, +// so the frame drawn next and the pose the headset reprojects it with are the same sample. +class XrLatchWriter { +public: + ~XrLatchWriter() { if (mapping_) munmap(mapping_, sizeof(*mapping_)); } + void Write(const DroidDeckXrTracking &packet) { + if (!mapping_ && !Open()) return; + const uint32_t sequence = __atomic_load_n(&mapping_->seq, __ATOMIC_RELAXED) | 1u; + __atomic_store_n(&mapping_->seq, sequence, __ATOMIC_RELAXED); + __atomic_thread_fence(__ATOMIC_RELEASE); + DroidDeckXrTracking copy = packet; copy.seq = sequence; + std::memcpy(mapping_, ©, sizeof(copy)); + __atomic_store_n(&mapping_->seq, sequence + 1, __ATOMIC_RELEASE); + } +private: + bool Open() { + if (attempted_) return false; + attempted_ = true; + int descriptor = open("/run/droiddeck/" DROIDDECK_XR_LATCH_FILE, O_RDWR | O_CREAT | O_CLOEXEC, 0600); + if (descriptor < 0) return false; + void *mapping = ftruncate(descriptor, sizeof(*mapping_)) == 0 + ? mmap(nullptr, sizeof(*mapping_), PROT_READ | PROT_WRITE, MAP_SHARED, descriptor, 0) : MAP_FAILED; + close(descriptor); + if (mapping == MAP_FAILED) return false; + mapping_ = static_cast(mapping); + return true; + } + DroidDeckXrTracking *mapping_ = nullptr; + bool attempted_ = false; +}; From 422b339af89ca764d7ddcfe222a4aeb673d866d1 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 29 Nov 2026 13:54:16 -0500 Subject: [PATCH 087/120] fix(display): release zero-copy display buffers at latch (#3424) * Release zero-copy display buffers at latch; gamescope waits for scanout before reusing an image * Test that zero-copy releases follow the kernel's fence attach, not the buffer kind * Pin the gamescope build that waits for scanout before reusing an image * Probe the fallback output image for scanout so the composite waits on it too * Pin the gamescope build that probes the fallback output image --- .../main/cpp/waylandcomp/src/ahb_swapchain.c | 4 +- tools/gamescope/PATCHES.md | 10 ++ .../0146-composite-waits-for-scanout.patch | 106 +++++++++++++ tools/gamescope/release.env | 4 +- tools/gamescope/tests/nested-swapchain.cpp | 41 +++++ .../tests/test_zero_copy_release_at_latch.py | 141 ++++++++++++++++++ 6 files changed, 302 insertions(+), 4 deletions(-) create mode 100644 tools/gamescope/patches/0146-composite-waits-for-scanout.patch create mode 100644 tools/tests/test_zero_copy_release_at_latch.py diff --git a/app/src/main/cpp/waylandcomp/src/ahb_swapchain.c b/app/src/main/cpp/waylandcomp/src/ahb_swapchain.c index c31915a45b..3ac9ec78fc 100644 --- a/app/src/main/cpp/waylandcomp/src/ahb_swapchain.c +++ b/app/src/main/cpp/waylandcomp/src/ahb_swapchain.c @@ -133,10 +133,10 @@ static void handle_released(uint64_t id, int fd) { if (fd >= 0) { struct droiddeck_dma_buf_sync_file imp = {.flags = DROIDDECK_DMA_BUF_SYNC_READ, .fd = fd}; int dmabuf_fd = droiddeck_dmabuf_fd(ab->b); - if (!ab->display && dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_IMPORT_SYNC_FILE, &imp) == 0) { + if (dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_IMPORT_SYNC_FILE, &imp) == 0) { close(fd); } else { - if (!ab->display && !g_import_failed_logged) { + if (!g_import_failed_logged) { g_import_failed_logged = 1; droiddeck_log("layer", "zero-copy: DMA_BUF_IOCTL_IMPORT_SYNC_FILE failed (%s): releases wait for the display's fence here instead", strerror(errno)); diff --git a/tools/gamescope/PATCHES.md b/tools/gamescope/PATCHES.md index c416b6aea7..974ba58ab6 100644 --- a/tools/gamescope/PATCHES.md +++ b/tools/gamescope/PATCHES.md @@ -474,3 +474,13 @@ Short strokes never released it, and taps kept landing at the relative pointer i counts its touch-down warps, and a frame that contains one is left out of the hold decision. Touch drags, mouse motion and mouse warps still count, so a drag on a game that follows the pointer releases the hold and a recentring game is still held. `tools/tests/test_gamescope_pointer_hold_touch_down.py` compiles the rule with the 0133 rule. + +## 0146 rendervulkan: composite only into output images the display has finished scanning out + +The host compositor now releases a zero-copy display buffer as soon as the display latches the next one, and attaches +the display's release fence to the buffer's dma-buf instead of waiting for it on the CPU. That wait had held every +release back by about one refresh, so a chain of three buffers ran at two thirds of the refresh rate. KGSL Turnip does +not wait on fences attached to a dma-buf, so the composite now checks each output image's dma-buf with `poll(POLLOUT)`. +It picks the next image that is neither held by the host nor still being scanned out. Only when every free image is +still on the display does it wait for one, up to 100 ms. On kernels that cannot attach the fence, the host keeps +waiting itself and nothing changes. `tools/gamescope/tests/nested-swapchain.cpp` covers the choice and the busy check. diff --git a/tools/gamescope/patches/0146-composite-waits-for-scanout.patch b/tools/gamescope/patches/0146-composite-waits-for-scanout.patch new file mode 100644 index 0000000000..db90cc5ca7 --- /dev/null +++ b/tools/gamescope/patches/0146-composite-waits-for-scanout.patch @@ -0,0 +1,106 @@ +diff --git a/src/output_image_pick.hpp b/src/output_image_pick.hpp +new file mode 100644 +index 0000000..193d9de +--- /dev/null ++++ b/src/output_image_pick.hpp +@@ -0,0 +1,50 @@ ++#pragma once ++#include ++#include ++ ++namespace gamescope ++{ ++struct OutputImagePick ++{ ++ uint32_t image; ++ bool scanoutPending; ++}; ++ ++template ++inline OutputImagePick PickOutputImage( uint32_t count, uint32_t first, uint32_t last, uint32_t deferred, ++ Held &&held, Busy &&busy ) ++{ ++ for ( int pass = 0; pass < 2; pass++ ) ++ { ++ for ( uint32_t i = 0; i < count; i++ ) ++ { ++ const uint32_t image = ( first + i ) % count; ++ if ( count > 3 && ( image == last || image == deferred ) ) ++ continue; ++ if ( held( image ) ) ++ continue; ++ const bool pending = busy( image ); ++ if ( pass == 0 && pending ) ++ continue; ++ return { image, pending }; ++ } ++ } ++ return { first, busy( first ) }; ++} ++ ++inline bool DmabufScanoutPending( int fd ) ++{ ++ if ( fd < 0 ) ++ return false; ++ pollfd p = { .fd = fd, .events = POLLOUT, .revents = 0 }; ++ return poll( &p, 1, 0 ) == 0; ++} ++ ++inline void WaitDmabufScanout( int fd, int timeoutMs ) ++{ ++ if ( fd < 0 ) ++ return; ++ pollfd p = { .fd = fd, .events = POLLOUT, .revents = 0 }; ++ poll( &p, 1, timeoutMs ); ++} ++} +diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp +index 1d3a80c..3668a10 100644 +--- a/src/rendervulkan.cpp ++++ b/src/rendervulkan.cpp +@@ -37,6 +37,7 @@ + #include "steamcompmgr.hpp" + #include "log.hpp" + #include "Utils/Process.h" ++#include "output_image_pick.hpp" + + #include "cs_composite_blit.h" + #include "cs_composite_blur.h" +@@ -4297,18 +4298,29 @@ static bool vulkan_output_image_held( uint32_t nImage ) + return false; + } + ++static bool vulkan_output_image_scanout_pending( uint32_t nImage ) ++{ ++ for ( const auto &pImage : { g_output.outputImages[ nImage ], g_output.outputImagesPartialOverlay[ nImage ] } ) ++ { ++ if ( pImage != nullptr && pImage->GetBackendFb() != nullptr && gamescope::DmabufScanoutPending( pImage->dmabuf().fd[0] ) ) ++ return true; ++ } ++ return false; ++} ++ + static uint32_t vulkan_free_output_image( uint32_t nFirst ) + { +- const uint32_t uCount = g_output.outputImages.size(); +- for ( uint32_t i = 0; i < uCount; i++ ) ++ const gamescope::OutputImagePick pick = gamescope::PickOutputImage( g_output.outputImages.size(), nFirst, ++ g_output.nLastOutImage, g_output.nDeferredOutImage, vulkan_output_image_held, vulkan_output_image_scanout_pending ); ++ if ( pick.scanoutPending ) + { +- const uint32_t nImage = ( nFirst + i ) % uCount; +- if ( uCount > 3 && ( nImage == g_output.nLastOutImage || nImage == g_output.nDeferredOutImage ) ) +- continue; +- if ( !vulkan_output_image_held( nImage ) ) +- return nImage; ++ for ( const auto &pImage : { g_output.outputImages[ pick.image ], g_output.outputImagesPartialOverlay[ pick.image ] } ) ++ { ++ if ( pImage != nullptr && pImage->GetBackendFb() != nullptr ) ++ gamescope::WaitDmabufScanout( pImage->dmabuf().fd[0], 100 ); ++ } + } +- return nFirst; ++ return pick.image; + } + + std::optional vulkan_composite( struct FrameInfo_t *frameInfo, gamescope::Rc pPipewireTexture, bool partial, gamescope::Rc pOutputOverride, bool increment, std::unique_ptr pInCommandBuffer ) diff --git a/tools/gamescope/release.env b/tools/gamescope/release.env index 52d5d20e44..d6d9b277a0 100644 --- a/tools/gamescope/release.env +++ b/tools/gamescope/release.env @@ -1,3 +1,3 @@ GAMESCOPE_REPO=Droid-Deck/DroidDeck-Components -GAMESCOPE_TAG=gamescope-3.16.29-1a29c65d -GAMESCOPE_SHA256=18620dfedb65860da00003e965cc09784a650ef6ecc9a17056405fe0a1392a02 +GAMESCOPE_TAG=gamescope-3.16.29-f3a45b31 +GAMESCOPE_SHA256=3908af87b2ee8a328e9780fc805c6a7bddd11d7405b9992d717b94e16c019313 diff --git a/tools/gamescope/tests/nested-swapchain.cpp b/tools/gamescope/tests/nested-swapchain.cpp index a2054aa746..62f4b6a140 100644 --- a/tools/gamescope/tests/nested-swapchain.cpp +++ b/tools/gamescope/tests/nested-swapchain.cpp @@ -2,6 +2,9 @@ #include "nested_surface_format.hpp" #include "dmabuf_import.hpp" #include "sdl_refresh.hpp" +#include "output_image_pick.hpp" +#include +#include #include #include @@ -152,5 +155,43 @@ int main() assert(DmabufMemoryType(memory, 7, 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) == UINT32_MAX); assert(DmabufMemoryType(memory, 7, 4, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) == UINT32_MAX); + + using gamescope::PickOutputImage; + auto none = [](uint32_t) { return false; }; + auto pick = PickOutputImage(5, 2, 1, 0, none, none); + assert(pick.image == 2 && !pick.scanoutPending); + auto heldTwo = [](uint32_t i) { return i == 2; }; + pick = PickOutputImage(5, 2, 1, 0, heldTwo, none); + assert(pick.image == 3 && !pick.scanoutPending); + auto scanningTwo = [](uint32_t i) { return i == 2; }; + pick = PickOutputImage(5, 2, 1, 0, none, scanningTwo); + assert(pick.image == 3 && !pick.scanoutPending); + auto scanningAll = [](uint32_t) { return true; }; + pick = PickOutputImage(5, 2, 1, 0, heldTwo, scanningAll); + assert(pick.image == 3 && pick.scanoutPending); + auto heldAll = [](uint32_t) { return true; }; + auto scanningOne = [](uint32_t i) { return i == 1; }; + pick = PickOutputImage(5, 2, 1, 0, heldAll, none); + assert(pick.image == 2 && !pick.scanoutPending); + pick = PickOutputImage(5, 1, 0, 1, heldAll, scanningOne); + assert(pick.image == 1 && pick.scanoutPending); + pick = PickOutputImage(3, 1, 0, 2, none, none); + assert(pick.image == 1 && !pick.scanoutPending); + pick = PickOutputImage(3, 1, 0, 2, none, scanningOne); + assert(pick.image == 2 && !pick.scanoutPending); + + int fds[2]; + assert(pipe(fds) == 0); + assert(!gamescope::DmabufScanoutPending(fds[1])); + assert(!gamescope::DmabufScanoutPending(-1)); + fcntl(fds[1], F_SETFL, O_NONBLOCK); + char block[4096] = {}; + while (write(fds[1], block, sizeof(block)) > 0) {} + assert(gamescope::DmabufScanoutPending(fds[1])); + gamescope::WaitDmabufScanout(fds[1], 1); + while (read(fds[0], block, sizeof(block)) == sizeof(block) && gamescope::DmabufScanoutPending(fds[1])) {} + assert(!gamescope::DmabufScanoutPending(fds[1])); + close(fds[0]); + close(fds[1]); std::puts("Gamescope presentation and DMA-BUF import tests passed"); } diff --git a/tools/tests/test_zero_copy_release_at_latch.py b/tools/tests/test_zero_copy_release_at_latch.py new file mode 100644 index 0000000000..6d57d48897 --- /dev/null +++ b/tools/tests/test_zero_copy_release_at_latch.py @@ -0,0 +1,141 @@ +import os +from pathlib import Path +import re +import shutil +import subprocess +import tempfile +import unittest + +from test_vk_pending_completion import function + +ROOT = Path(__file__).resolve().parents[2] +SRC = ROOT / 'app/src/main/cpp/waylandcomp/src' + +HARNESS = r''' +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +struct wl_listener { struct wl_list link; void (*notify)(struct wl_listener *, void *); }; +struct wl_event_source { int unused; }; +struct wl_event_loop; +enum { WL_EVENT_READABLE = 1 }; +struct wl_client; +struct wl_resource { int unused; }; +struct surface; +struct dmabuf_buffer { int fd; }; +typedef struct AHardwareBuffer { int unused; } AHardwareBuffer; +DEFINES +STRUCT +static struct wl_list g_bufs; +static struct wl_event_loop *g_loop; +static int g_import_failed_logged; +static int import_ok, imports, imported_flags, deferred_releases, frees, sources; +static struct wl_event_source g_source; +void wl_list_init(struct wl_list *l) { l->prev = l; l->next = l; } +void wl_list_insert(struct wl_list *l, struct wl_list *e) { + e->next = l->next; e->prev = l; l->next->prev = e; l->next = e; +} +static int fake_ioctl(int fd, unsigned long req, void *arg) { + struct droiddeck_dma_buf_sync_file *f = arg; + (void)fd; + assert(req == DROIDDECK_DMA_BUF_IOCTL_IMPORT_SYNC_FILE); + ++imports; imported_flags = (int)f->flags; + if (import_ok) return 0; + errno = ENOTTY; return -1; +} +#define ioctl fake_ioctl +static int droiddeck_dmabuf_fd(struct dmabuf_buffer *b) { return b->fd; } +static void droiddeck_log(const char *tag, const char *fmt, ...) { (void)tag; (void)fmt; } +static struct wl_event_source *wl_event_loop_add_fd(struct wl_event_loop *l, int fd, uint32_t m, + int (*cb)(int, uint32_t, void *), void *d) { + (void)l; (void)fd; (void)m; (void)cb; (void)d; ++sources; return &g_source; +} +static int on_fence_readable(int fd, uint32_t mask, void *data) { (void)fd; (void)mask; (void)data; return 0; } +static void send_deferred_release(struct ahb_buf *ab) { ++deferred_releases; ab->release_pending = 0; } +static void maybe_free(struct ahb_buf *ab) { (void)ab; ++frees; } +FUNCTIONS +static void reset(void) { import_ok = imports = imported_flags = deferred_releases = frees = sources = 0; } +static void run(int display, int can_import, int fence_signalled) { + reset(); + wl_list_init(&g_bufs); + struct dmabuf_buffer b = {.fd = 7}; + struct ahb_buf ab; + memset(&ab, 0, sizeof(ab)); + ab.id = 42; ab.b = &b; ab.display = display; ab.on_layer = 1; ab.release_pending = 1; ab.fence_fd = -1; + wl_list_insert(&g_bufs, &ab.link); + int fds[2]; assert(pipe(fds) == 0); + if (fence_signalled) assert(write(fds[1], "x", 1) == 1); + import_ok = can_import; + handle_released(42, fds[0]); + assert(!ab.on_layer && imports == 1 && imported_flags == DROIDDECK_DMA_BUF_SYNC_READ); + if (can_import || fence_signalled) { + assert(deferred_releases == 1 && frees == 1 && !ab.fence_src && ab.fence_fd == -1); + errno = 0; assert(fcntl(fds[0], F_GETFD) == -1 && errno == EBADF); + } else { + assert(deferred_releases == 0 && sources == 1 && ab.fence_src == &g_source && ab.fence_fd == fds[0]); + close(fds[0]); + } + close(fds[1]); +} +int main(int argc, char **argv) { + assert(argc == 4); + run(atoi(argv[1]), atoi(argv[2]), atoi(argv[3])); + return 0; +} +''' + + +class ZeroCopyReleaseAtLatchTest(unittest.TestCase): + @classmethod + def setUpClass(cls): + cc = shutil.which(os.environ.get('CC', 'cc')) + if not cc: + raise AssertionError('C compiler required') + source_dir = Path(os.environ.get('DROIDDECK_DMABUF_TEST_SOURCE', SRC)) + ahb = (source_dir / 'ahb_swapchain.c').read_text() + defines = '\n'.join(re.findall(r'^(?:struct droiddeck_dma_buf_sync_file \{.*?\};|#define DROIDDECK_DMA_BUF_\w+ .*)$', + ahb, re.M)) + struct = re.search(r'struct ahb_buf \{.*?\n\};', ahb, re.S).group() + functions = '\n'.join(function(ahb, n) for n in ('find_buf', 'handle_released')) + source = HARNESS.replace('DEFINES', '#include \n#include \n' + defines) + source = source.replace('STRUCT', struct).replace('FUNCTIONS', functions) + cls.tmp = tempfile.TemporaryDirectory(prefix='droiddeck-release-latch-') + cls.addClassCleanup(cls.tmp.cleanup) + probe = Path(cls.tmp.name) / 'probe.c' + probe.write_text(source) + cls.binary = probe.with_suffix('') + built = subprocess.run([cc, '-std=c11', '-Wall', '-Wextra', '-Werror', '-Wno-unused-function', '-UNDEBUG', + '-I', str(SRC.parent / 'prebuilt/include'), str(probe), '-o', str(cls.binary)], + capture_output=True, text=True) + if built.returncode: + raise AssertionError(built.stdout + built.stderr) + + def scenario(self, display, can_import, fence_signalled): + result = subprocess.run([str(self.binary), str(display), str(can_import), str(fence_signalled)], + capture_output=True, text=True, timeout=10) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + + def test_display_buffer_released_at_latch_when_fence_attaches(self): + self.scenario(1, 1, 0) + + def test_swapchain_buffer_released_at_latch_when_fence_attaches(self): + self.scenario(0, 1, 0) + + def test_display_buffer_waits_for_fence_when_kernel_cannot_attach(self): + self.scenario(1, 0, 0) + + def test_swapchain_buffer_waits_for_fence_when_kernel_cannot_attach(self): + self.scenario(0, 0, 0) + + def test_signalled_fence_releases_without_waiting(self): + self.scenario(1, 0, 1) + + +if __name__ == '__main__': + unittest.main() From 12fa3ac343e9708bb8d87083b896198ce74a85db Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 29 Nov 2026 14:20:14 -0500 Subject: [PATCH 088/120] fix(input): a trigger key sent before its axis no longer counts as two presses (#3431) A trigger key that fires before its axis no longer reads as two presses --- .../droiddeck/launcher/input/PadBridge.java | 74 ++++++++++++++++--- .../launcher/input/PadPartialAxesTest.kt | 66 ++++++++++++++++- 2 files changed, 126 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java index 06d9f010db..81a84fcdba 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java +++ b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java @@ -59,7 +59,7 @@ public final class PadBridge { private final PadState[] playerStates = new PadState[SLOTS]; private final float[][] rawSticks = new float[SLOTS][4]; private final Map rightStickLayouts = new HashMap<>(); - private final boolean[][] keyTriggers = new boolean[SLOTS][2]; + private final TriggerKey[][] keyTriggers = TriggerKey.slots(SLOTS); private final int[] retainedSticks = new int[SLOTS]; private final PadState effectiveState = new PadState(); private final PadState homeGuideReport = new PadState(); @@ -484,7 +484,7 @@ public final class PadBridge { stateFor(slot).clear(); retainedSticks[slot] = 0; Arrays.fill(rawSticks[slot], 0f); - Arrays.fill(keyTriggers[slot], false); + for (TriggerKey key : keyTriggers[slot]) key.reset(); } private void mutateState(java.util.function.Consumer mutation) { @@ -570,26 +570,76 @@ public final class PadBridge { return true; } - static float keyTrigger(float current, boolean pressed, int repeatCount, boolean analog, boolean[] held, int side) { + static final class TriggerKey { + static final float RELEASE_FROM_PEAK = 0.05f; + boolean held; + boolean handoff; + boolean axisLive; + boolean axisMovedWhilePressed; + float peak; + float axis; + + static TriggerKey[][] slots(int count) { + TriggerKey[][] keys = new TriggerKey[count][2]; + for (TriggerKey[] pair : keys) { + pair[0] = new TriggerKey(); + pair[1] = new TriggerKey(); + } + return keys; + } + + void reset() { + held = false; + handoff = false; + axisLive = false; + axisMovedWhilePressed = false; + peak = 0f; + axis = 0f; + } + } + + static float keyTrigger(float current, boolean pressed, int repeatCount, boolean analog, TriggerKey[] keys, int side) { + TriggerKey key = keys[side]; if (repeatCount > 0) return current; if (!analog) { - held[side] = pressed; + key.held = pressed; return pressed ? 1f : 0f; } if (pressed) { - if (current != 0f) return current; - held[side] = true; + key.axisMovedWhilePressed = false; + if (key.axisLive || current != 0f) return current; + key.held = true; return 1f; } - if (!held[side]) return current; - held[side] = false; + if (!key.axisMovedWhilePressed) key.axisLive = false; + if (key.handoff) { + key.handoff = false; + return key.axis; + } + if (!key.held) return current; + key.held = false; return 0f; } - static float axisTrigger(float value, boolean[] held, int side) { - if (!held[side]) return value; - if (value == 0f) return 1f; - held[side] = false; + static float axisTrigger(float value, TriggerKey[] keys, int side) { + TriggerKey key = keys[side]; + key.axis = value; + if (value != 0f) { + key.axisLive = true; + key.axisMovedWhilePressed = true; + } + if (key.held) { + if (value == 0f) return 1f; + key.held = false; + key.handoff = true; + key.peak = value; + return 1f; + } + if (key.handoff) { + key.peak = Math.max(key.peak, value); + if (value > key.peak - TriggerKey.RELEASE_FROM_PEAK) return 1f; + key.handoff = false; + } return value; } diff --git a/app/src/test/java/com/droiddeck/launcher/input/PadPartialAxesTest.kt b/app/src/test/java/com/droiddeck/launcher/input/PadPartialAxesTest.kt index b79e813a9e..0e75de36c0 100644 --- a/app/src/test/java/com/droiddeck/launcher/input/PadPartialAxesTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/input/PadPartialAxesTest.kt @@ -259,7 +259,7 @@ class PadPartialAxesTest { } @Test fun keyTriggerDecision() { - val held = BooleanArray(2) + val held = PadBridge.TriggerKey.slots(1)[0] assertEquals(1f, PadBridge.keyTrigger(0f, true, 0, false, held, 0)) assertEquals(0f, PadBridge.keyTrigger(1f, false, 0, false, held, 0)) assertEquals(0.25f, PadBridge.keyTrigger(0.25f, true, 1, false, held, 0)) @@ -271,6 +271,64 @@ class PadPartialAxesTest { assertEquals(0f, PadBridge.axisTrigger(0f, held, 1)) } + @Test fun keyBeforeAxisOnAFullPullIsOnePress() { + val device = device(MotionEvent.AXIS_GAS) + motion(device) + key(device, KeyEvent.KEYCODE_BUTTON_R2) + assertEquals(1f, pad().rightTrigger) + for (value in listOf(0.1f, 0.3f, 0.6f, 1f, 0.98f)) { + motion(device, MotionEvent.AXIS_GAS to value) + assertEquals(1f, pad().rightTrigger) + } + motion(device, MotionEvent.AXIS_GAS to 0.7f) + assertEquals(0.7f, pad().rightTrigger) + key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP) + assertEquals(0.7f, pad().rightTrigger) + motion(device, MotionEvent.AXIS_GAS to 0f) + assertEquals(0f, pad().rightTrigger) + } + + @Test fun releasingDuringTheHandoffFollowsTheAxis() { + val device = device(MotionEvent.AXIS_GAS) + motion(device) + key(device, KeyEvent.KEYCODE_BUTTON_R2) + motion(device, MotionEvent.AXIS_GAS to 0.4f) + assertEquals(1f, pad().rightTrigger) + key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP) + assertEquals(0.4f, pad().rightTrigger) + } + + @Test fun movingTriggerAxisStaysAnalogWhenItsKeyFiresFirst() { + val device = device(MotionEvent.AXIS_GAS) + motion(device, MotionEvent.AXIS_GAS to 0.5f) + motion(device, MotionEvent.AXIS_GAS to 0f) + key(device, KeyEvent.KEYCODE_BUTTON_R2) + assertEquals(0f, pad().rightTrigger) + motion(device, MotionEvent.AXIS_GAS to 0.1f) + assertEquals(0.1f, pad().rightTrigger) + motion(device, MotionEvent.AXIS_GAS to 0.35f) + assertEquals(0.35f, pad().rightTrigger) + key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP) + motion(device, MotionEvent.AXIS_GAS to 0f) + assertEquals(0f, pad().rightTrigger) + } + + @Test fun triggerSwitchedToDigitalPressesAgainAfterOneSilentPress() { + val device = device(MotionEvent.AXIS_GAS) + motion(device, MotionEvent.AXIS_GAS to 0.5f) + motion(device, MotionEvent.AXIS_GAS to 0f) + key(device, KeyEvent.KEYCODE_BUTTON_R2) + motion(device) + key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP) + assertEquals(0f, pad().rightTrigger) + key(device, KeyEvent.KEYCODE_BUTTON_R2) + assertEquals(1f, pad().rightTrigger) + motion(device) + assertEquals(1f, pad().rightTrigger) + key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP) + assertEquals(0f, pad().rightTrigger) + } + @Test fun silentTriggerAxesLetTheirKeysPress() { val device = device(MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_RTRIGGER) motion(device) @@ -294,11 +352,15 @@ class PadPartialAxesTest { key(device, KeyEvent.KEYCODE_BUTTON_L2) assertEquals(1f, pad().leftTrigger) motion(device, MotionEvent.AXIS_LTRIGGER to 0.4f) - assertEquals(0.4f, pad().leftTrigger) + assertEquals(1f, pad().leftTrigger) motion(device, MotionEvent.AXIS_LTRIGGER to 0f) assertEquals(0f, pad().leftTrigger) key(device, KeyEvent.KEYCODE_BUTTON_L2, KeyEvent.ACTION_UP) assertEquals(0f, pad().leftTrigger) + key(device, KeyEvent.KEYCODE_BUTTON_L2) + assertEquals(0f, pad().leftTrigger) + motion(device, MotionEvent.AXIS_LTRIGGER to 0.4f) + assertEquals(0.4f, pad().leftTrigger) } private fun pad(): PadState = requireNotNull(JoyConPadTest.RecordingWriter.pads[0]) From fd93a35b72d8dfb3b94ab95e1f710ff2a3e1dc61 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:02:11 -0500 Subject: [PATCH 089/120] Start Steam by itself when first-run setup finishes (#3430) --- .../droiddeck/launcher/FrontEndActivity.kt | 19 +++++++++++++++++++ .../droiddeck/launcher/session/Onboarding.kt | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index c9f4161d55..ba4cb16ef6 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2020,6 +2020,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet SessionPrefs.setMicAsked(this) } if (wanted.isNotEmpty()) requestPermissions(wanted.toTypedArray(), 1) + com.droiddeck.launcher.session.Onboarding.onFirstRunReady = firstRunReady Thread({ com.droiddeck.launcher.stores.StoreAccounts.encryptAll(this) }, "store-credentials").start() if (!SessionState.running) Thread({ com.droiddeck.launcher.session.LogMigration.run(this) @@ -2299,7 +2300,22 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet return super.dispatchGenericMotionEvent(event) } + @Volatile private var inFront = false + private var autoSteamPending = false + + /** Runs on the worker thread that finishes setup, so the foreground state is read as setup completes, not when the UI thread gets to it. */ + private val firstRunReady: () -> Unit = { + val front = inFront + runOnUiThread { if (front) autoStartSteam() } + } + + private fun autoStartSteam() { + if (isFinishing || isDestroyed || SessionState.running || !inFront) return + if (busy) autoSteamPending = true else playSteam() + } + override fun onPause() { + inFront = false stopRightStickScroll() compatLaunchVisible = false if (android.os.Build.VERSION.SDK_INT >= 29) com.droiddeck.launcher.ui.DualScreenPanel.ownerPaused(taskId, true) @@ -2308,6 +2324,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet override fun onResume() { super.onResume() + inFront = true if (!homeChoiceOpen) { HomeApp.releaseUnusedHomeEntry(this) refreshHomeAppState() @@ -2443,6 +2460,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet override fun onDestroy() { // The queued launch was saved before this; a restored activity keeps its copy, and this one must not start it too. + if (com.droiddeck.launcher.session.Onboarding.onFirstRunReady === firstRunReady) com.droiddeck.launcher.session.Onboarding.onFirstRunReady = null queuedLaunchRunner.destroy() triggerKeys.cancel() launchCoordinator.cancelAll() @@ -3742,6 +3760,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet refresh() com.droiddeck.launcher.agent.AgentHost.refresh(this) if (ok == true && LinuxRuntime.isInstalled(this)) { protons.checkUpdates(); protons.ensureSteamClient() } + if (autoSteamPending) { autoSteamPending = false; autoStartSteam() } } }, "runtime-operation").start() } diff --git a/app/src/main/java/com/droiddeck/launcher/session/Onboarding.kt b/app/src/main/java/com/droiddeck/launcher/session/Onboarding.kt index 2d18a84a30..bbfa7bfc29 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/Onboarding.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/Onboarding.kt @@ -29,6 +29,10 @@ object Onboarding { /** The setup screens belong to the first run; later runtime, Proton and Steam client updates keep the usual Play button. */ val firstRun = MutableStateFlow(true) + /** Called once, when this process finishes the first-run downloads itself; not when everything was already in place. */ + @Volatile var onFirstRunReady: (() -> Unit)? = null + @Volatile private var worked = false + fun attach(context: Context) { appContext = context.applicationContext val prefs = context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE) @@ -52,8 +56,10 @@ object Onboarding { private fun markFirstRunDone() { val context = appContext ?: return + val live = firstRun.value && worked context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putBoolean(KEY_FIRST_RUN_DONE, true).apply() firstRun.value = false + if (live) onFirstRunReady?.invoke() } /** Keeps the process in the foreground, with one notification, while a step downloads and the runtime installer is not already doing so. */ @@ -90,6 +96,7 @@ object Onboarding { } fun report(step: Step, label: String, percent: Int) { + worked = true failed.value = failed.value - step active.value = active.value + (step to Progress(label, percent)) keepAlive() From ae94009382233581634c41687defd6dbb6ab31e1 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:02:25 -0500 Subject: [PATCH 090/120] Ask for all-files access when a shared drive is opened, not on first launch (#3429) --- .../com/droiddeck/launcher/FrontEndActivity.kt | 15 +++------------ .../droiddeck/launcher/files/AllFilesAccess.kt | 7 +++++++ .../droiddeck/launcher/files/FileManagerScreen.kt | 13 +++++++++++-- .../droiddeck/launcher/session/SessionPrefs.kt | 6 ------ .../launcher/files/AllFilesAccessTest.kt | 14 ++++++++++++++ 5 files changed, 35 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index ba4cb16ef6..293b75fea8 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -1993,11 +1993,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet } } - val askAllFiles = Build.VERSION.SDK_INT >= 30 && com.droiddeck.launcher.files.AllFilesAccess.missing() && - !SessionPrefs.allFilesAsked(this) - if (savedInstanceState == null) { - if (!askAllFiles) ui.post { startSteamAtStartupIfEnabled(cold = true) } - } + if (savedInstanceState == null) ui.post { startSteamAtStartupIfEnabled(cold = true) } saved?.let { state -> restoreCompatLaunch(state) pendingSwitch = savedIntent(state, KEY_PENDING_SWITCH) @@ -2005,13 +2001,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet } val wanted = ArrayList() - if (Build.VERSION.SDK_INT >= 30) { - // From targetSdk 30, shared storage outside the app's own folders is all-files access or nothing. - if (askAllFiles) { - SessionPrefs.setAllFilesAsked(this) - com.droiddeck.launcher.files.AllFilesAccess.open(this) - } - } else if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + // From Android 11, shared storage outside the app's own folders is all-files access, which the file picker asks for when a shared drive is opened. + if (Build.VERSION.SDK_INT < 30 && checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { wanted.add(Manifest.permission.WRITE_EXTERNAL_STORAGE) } if (SessionPrefs.micEnabled(this) && !SessionPrefs.micAsked(this) diff --git a/app/src/main/java/com/droiddeck/launcher/files/AllFilesAccess.kt b/app/src/main/java/com/droiddeck/launcher/files/AllFilesAccess.kt index de95eea354..f95df8f059 100644 --- a/app/src/main/java/com/droiddeck/launcher/files/AllFilesAccess.kt +++ b/app/src/main/java/com/droiddeck/launcher/files/AllFilesAccess.kt @@ -8,9 +8,16 @@ import android.os.Environment import android.provider.Settings object AllFilesAccess { + private val APP_FOLDERS = listOf("/Android/data", "/Android/obb") + fun missing(sdk: Int = Build.VERSION.SDK_INT, granted: () -> Boolean = { Environment.isExternalStorageManager() }): Boolean = sdk >= Build.VERSION_CODES.R && !granted() + /** Whether reading [path] takes all-files access: shared storage, outside the per-app folders Android always lets the app use. */ + fun covers(path: String): Boolean = + (path.startsWith("/storage/") || path.startsWith("/sdcard")) && + APP_FOLDERS.none { path.endsWith(it) || path.contains("$it/") } + fun open(context: Context) { val app = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + context.packageName)) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) diff --git a/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt b/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt index 7025769d87..65a30b0fac 100644 --- a/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt @@ -504,13 +504,15 @@ fun FileManagerScreen( } val drives = remember(storageTick) { StorageRoots.list(context) } var accessDrive by remember { mutableStateOf(null) } + var accessWasMissing by remember { mutableStateOf(AllFilesAccess.missing()) } + var accessDeclined by remember { mutableStateOf(false) } fun unreadable(drive: StorageRoot) { if (AllFilesAccess.missing()) accessDrive = drive.label else Toast.makeText(context, context.getString(R.string.fm_drive_not_readable, drive.label), Toast.LENGTH_SHORT).show() } accessDrive?.let { label -> OutlinedAlertDialog( - onDismissRequest = { accessDrive = null }, + onDismissRequest = { accessDrive = null; accessDeclined = true }, title = { Text(stringResource(R.string.fm_drive_access_title, label)) }, text = { Text(stringResource(R.string.fm_drive_access_text)) }, confirmButton = { @@ -519,9 +521,16 @@ fun FileManagerScreen( AllFilesAccess.open(context) }, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.upd_open_settings)) } }, - dismissButton = { TextButton(onClick = { accessDrive = null }, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } }, + dismissButton = { TextButton(onClick = { accessDrive = null; accessDeclined = true }, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } }, ) } + LaunchedEffect(currentDir, storageTick) { + if (!AllFilesAccess.missing()) { + if (accessWasMissing) { accessWasMissing = false; loadDirectory(currentDir, resetScroll = false, record = false) } + } else if (!accessDeclined && accessDrive == null && AllFilesAccess.covers(currentDir.path)) { + accessDrive = drives.firstOrNull { currentDir.path.startsWith(it.dir.path) }?.label ?: context.getString(R.string.fm_drive_internal) + } + } val linuxRoot = remember(storageTick) { com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context).takeIf { File(it, "usr").isDirectory } } diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index 5c42132e9e..fc867959cd 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -960,12 +960,6 @@ object SessionPrefs { fun micAsked(context: Context): Boolean = prefs(context).getBoolean("micAsked", false) - fun allFilesAsked(context: Context): Boolean = prefs(context).getBoolean("allFilesAsked", false) - - fun setAllFilesAsked(context: Context) { - prefs(context).edit().putBoolean("allFilesAsked", true).apply() - } - fun bluetoothAsked(context: Context): Boolean = prefs(context).getBoolean("bluetoothAsked", false) fun setBluetoothAsked(context: Context) { diff --git a/app/src/test/java/com/droiddeck/launcher/files/AllFilesAccessTest.kt b/app/src/test/java/com/droiddeck/launcher/files/AllFilesAccessTest.kt index a5eba9c3e0..349ef9c29b 100644 --- a/app/src/test/java/com/droiddeck/launcher/files/AllFilesAccessTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/files/AllFilesAccessTest.kt @@ -21,4 +21,18 @@ class AllFilesAccessTest { assertTrue(AllFilesAccess.missing(sdk = 35) { false }) assertFalse(AllFilesAccess.missing(sdk = 35) { true }) } + + @Test + fun onlySharedStorageNeedsIt() { + assertTrue(AllFilesAccess.covers("/storage/emulated/0")) + assertTrue(AllFilesAccess.covers("/storage/1A2B-3C4D/Games")) + assertTrue(AllFilesAccess.covers("/sdcard/Download")) + assertFalse(AllFilesAccess.covers("/storage/emulated/0/Android/data")) + assertFalse(AllFilesAccess.covers("/storage/1A2B-3C4D/Android/obb")) + assertTrue(AllFilesAccess.covers("/storage/emulated/0/Android")) + assertTrue(AllFilesAccess.covers("/storage/emulated/0/Android/database")) + assertFalse(AllFilesAccess.covers("/storage/emulated/0/Android/data/com.droiddeck.launcher/files")) + assertFalse(AllFilesAccess.covers("/storage/1A2B-3C4D/Android/obb/com.droiddeck.launcher")) + assertFalse(AllFilesAccess.covers("/data/user/0/com.droiddeck.launcher/files")) + } } From 678057d7279e8fa762d53754a01af4cf66bb807e Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:06:47 -0500 Subject: [PATCH 091/120] Prompt for shared folders named Android/data, and reload after any regrant (#3435) Prompt for shared folders named Android/data, and reload the folder after any regrant --- .../com/droiddeck/launcher/files/AllFilesAccess.kt | 10 ++++++---- .../com/droiddeck/launcher/files/FileManagerScreen.kt | 5 +++-- .../com/droiddeck/launcher/files/AllFilesAccessTest.kt | 2 ++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/files/AllFilesAccess.kt b/app/src/main/java/com/droiddeck/launcher/files/AllFilesAccess.kt index f95df8f059..2c9529f4ed 100644 --- a/app/src/main/java/com/droiddeck/launcher/files/AllFilesAccess.kt +++ b/app/src/main/java/com/droiddeck/launcher/files/AllFilesAccess.kt @@ -8,15 +8,17 @@ import android.os.Environment import android.provider.Settings object AllFilesAccess { + private val VOLUME = Regex("^(/storage/emulated/\\d+|/storage/[^/]+|/sdcard)(/.*)?$") private val APP_FOLDERS = listOf("/Android/data", "/Android/obb") fun missing(sdk: Int = Build.VERSION.SDK_INT, granted: () -> Boolean = { Environment.isExternalStorageManager() }): Boolean = sdk >= Build.VERSION_CODES.R && !granted() - /** Whether reading [path] takes all-files access: shared storage, outside the per-app folders Android always lets the app use. */ - fun covers(path: String): Boolean = - (path.startsWith("/storage/") || path.startsWith("/sdcard")) && - APP_FOLDERS.none { path.endsWith(it) || path.contains("$it/") } + /** Whether reading [path] takes all-files access: shared storage, outside the per-app folders directly under a volume's root, which Android always lets the app use. */ + fun covers(path: String): Boolean { + val inside = VOLUME.matchEntire(path)?.groupValues?.get(2) ?: return false + return APP_FOLDERS.none { inside == it || inside.startsWith("$it/") } + } fun open(context: Context) { val app = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + context.packageName)) diff --git a/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt b/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt index 65a30b0fac..c872096533 100644 --- a/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/files/FileManagerScreen.kt @@ -527,8 +527,9 @@ fun FileManagerScreen( LaunchedEffect(currentDir, storageTick) { if (!AllFilesAccess.missing()) { if (accessWasMissing) { accessWasMissing = false; loadDirectory(currentDir, resetScroll = false, record = false) } - } else if (!accessDeclined && accessDrive == null && AllFilesAccess.covers(currentDir.path)) { - accessDrive = drives.firstOrNull { currentDir.path.startsWith(it.dir.path) }?.label ?: context.getString(R.string.fm_drive_internal) + } else { + accessWasMissing = true + if (!accessDeclined && accessDrive == null && AllFilesAccess.covers(currentDir.path)) accessDrive = drives.firstOrNull { currentDir.path.startsWith(it.dir.path) }?.label ?: context.getString(R.string.fm_drive_internal) } } val linuxRoot = remember(storageTick) { diff --git a/app/src/test/java/com/droiddeck/launcher/files/AllFilesAccessTest.kt b/app/src/test/java/com/droiddeck/launcher/files/AllFilesAccessTest.kt index 349ef9c29b..0737cac0f7 100644 --- a/app/src/test/java/com/droiddeck/launcher/files/AllFilesAccessTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/files/AllFilesAccessTest.kt @@ -31,6 +31,8 @@ class AllFilesAccessTest { assertFalse(AllFilesAccess.covers("/storage/1A2B-3C4D/Android/obb")) assertTrue(AllFilesAccess.covers("/storage/emulated/0/Android")) assertTrue(AllFilesAccess.covers("/storage/emulated/0/Android/database")) + assertTrue(AllFilesAccess.covers("/storage/emulated/0/Download/Android/data")) + assertTrue(AllFilesAccess.covers("/storage/1A2B-3C4D/Games/Android/obb/x")) assertFalse(AllFilesAccess.covers("/storage/emulated/0/Android/data/com.droiddeck.launcher/files")) assertFalse(AllFilesAccess.covers("/storage/1A2B-3C4D/Android/obb/com.droiddeck.launcher")) assertFalse(AllFilesAccess.covers("/data/user/0/com.droiddeck.launcher/files")) From 38c2c00c86f6a42348c8b7a98288da7772bc84e5 Mon Sep 17 00:00:00 2001 From: btns29 Date: Sun, 29 Nov 2026 22:53:48 +0200 Subject: [PATCH 092/120] Keep safe webhelper layout on Mali bridge (#3420) * Keep safe webhelper layout on Mali bridge * Name the zygote regression in the layout test --------- Co-authored-by: btns29 --- .../overlay/usr/local/bin/droiddeck-session | 20 +++++++++++++------ tools/tests/test_session_webhelper_layout.py | 17 ++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index 83777ced29..79b0c149fe 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -224,15 +224,23 @@ if [ -n "${DD_VK_DRIVER:-}" ]; then unset dd_icd_lib fi dd_webhelper_layout() { + local layout if [ -n "${DD_VKBRIDGE_WEBHELPER_ARGS:-}" ]; then printf '%s\n' "$DD_VKBRIDGE_WEBHELPER_ARGS" - elif [ -z "${DD_VKBRIDGE_CEF_ANGLE:-}" ]; then - echo stock - elif [ "$DD_VKBRIDGE_CEF_ANGLE" = vulkan ] && [ "${DD_VKBRIDGE_CEF_VULKAN:-1}" != 0 ]; then - echo "--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan" - else - echo "--use-gl=angle --use-angle=$DD_VKBRIDGE_CEF_ANGLE" + return fi + if [ -z "${DD_VKBRIDGE_CEF_ANGLE:-}" ]; then + echo stock + return + fi + # ANGLE switches must not replace the helper's stable single-process layout. + layout="--no-zygote --in-process-gpu -AudioServiceOutOfProcess" + if [ "$DD_VKBRIDGE_CEF_ANGLE" = vulkan ] && [ "${DD_VKBRIDGE_CEF_VULKAN:-1}" != 0 ]; then + layout="$layout --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan" + else + layout="$layout --use-gl=angle --use-angle=$DD_VKBRIDGE_CEF_ANGLE" + fi + printf '%s\n' "$layout" } dd_now_ms() { if [ -n "${EPOCHREALTIME:-}" ]; then diff --git a/tools/tests/test_session_webhelper_layout.py b/tools/tests/test_session_webhelper_layout.py index fe7b71105c..958051c6a7 100644 --- a/tools/tests/test_session_webhelper_layout.py +++ b/tools/tests/test_session_webhelper_layout.py @@ -6,6 +6,7 @@ from pathlib import Path SESSION = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-session" KEYS = ("DD_VKBRIDGE_WEBHELPER_ARGS", "DD_VKBRIDGE_CEF_ANGLE", "DD_VKBRIDGE_CEF_VULKAN") +BASE = "--no-zygote --in-process-gpu -AudioServiceOutOfProcess" def layout_function(): @@ -27,14 +28,14 @@ class WebhelperLayoutTest(unittest.TestCase): def test_angle_on_vulkan_brings_chromiums_vulkan_compositing(self): self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="vulkan"), - "--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan") + BASE + " --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan") - def test_vulkan_compositing_can_be_left_off(self): + def test_vulkan_compositing_can_be_left_off_without_zygotes(self): self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="vulkan", DD_VKBRIDGE_CEF_VULKAN="0"), - "--use-gl=angle --use-angle=vulkan") + BASE + " --use-gl=angle --use-angle=vulkan") def test_other_angle_backends_get_only_the_angle_switches(self): - self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="gl"), "--use-gl=angle --use-angle=gl") + self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="gl"), BASE + " --use-gl=angle --use-angle=gl") def test_explicit_layout_wins(self): self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="vulkan", DD_VKBRIDGE_WEBHELPER_ARGS="--x +Y"), @@ -57,10 +58,10 @@ class WebhelperLayoutTest(unittest.TestCase): env = {k: v for k, v in os.environ.items() if k not in KEYS} run = lambda **s: subprocess.run(["bash", "-c", "set -u\n" + script], env={**env, **s}, capture_output=True, text=True, check=True).stdout.strip() - self.assertEqual(run(), "--use-gl=angle --use-angle=vulkan") + self.assertEqual(run(), BASE + " --use-gl=angle --use-angle=vulkan") self.assertEqual(run(DD_VKBRIDGE_CEF_VULKAN="1"), - "--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan") - self.assertEqual(run(DD_VKBRIDGE_CEF_ANGLE="gl"), "--use-gl=angle --use-angle=gl") + BASE + " --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan") + self.assertEqual(run(DD_VKBRIDGE_CEF_ANGLE="gl"), BASE + " --use-gl=angle --use-angle=gl") def test_empty_settings_are_kept_as_set(self): script = ': "${DD_VKBRIDGE_CEF_ANGLE=vulkan}" "${DD_VKBRIDGE_CEF_VULKAN=0}"\n' + layout_function() + "dd_webhelper_layout\n" @@ -69,7 +70,7 @@ class WebhelperLayoutTest(unittest.TestCase): capture_output=True, text=True, check=True).stdout.strip() self.assertEqual(run(DD_VKBRIDGE_CEF_ANGLE=""), "stock") self.assertEqual(run(DD_VKBRIDGE_CEF_VULKAN=""), - "--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan") + BASE + " --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan") if __name__ == "__main__": From 2b6ded9fd4faedfc4a16b3976c83d19fb1b9be8f Mon Sep 17 00:00:00 2001 From: devu92 <40060555+devu92@users.noreply.github.com> Date: Mon, 30 Nov 2026 06:18:19 +0900 Subject: [PATCH 093/120] Fix persistent black video after delayed GPU fences (#3400) fix(vulkan): keep presenting after delayed GPU fence completion --- app/src/main/cpp/waylandcomp/src/vk_present.c | 10 ++++++++ tools/tests/test_vk_pending_completion.py | 22 ++++++++++++---- tools/tests/test_vk_terminal_callers.py | 11 +++++--- tools/tests/vk_terminal_callers_test.c | 25 ++++++++++++++----- 4 files changed, 53 insertions(+), 15 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.c b/app/src/main/cpp/waylandcomp/src/vk_present.c index b3784769d7..faa89e89b5 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.c +++ b/app/src/main/cpp/waylandcomp/src/vk_present.c @@ -232,6 +232,16 @@ static VkResult timed_wait(VkFence fence, uint64_t timeout) { return g_dev_state == -2 ? VK_ERROR_DEVICE_LOST : VK_ERROR_UNKNOWN; int64_t t0 = perf_now(); VkResult r = g_vk.WaitForFences(g_dev, 1, &fence, VK_TRUE, timeout); + if (r == VK_TIMEOUT) { + droiddeck_log("gpu", "GPU fence delayed: retaining frame resources until completion"); + /* A scheduling delay does not invalidate the device. Keep this submission's + * resources and call stack alive, as the main render path already does. */ + do { + r = g_vk.WaitForFences(g_dev, 1, &fence, VK_TRUE, UINT64_MAX); + } while (r == VK_TIMEOUT); + if (r == VK_SUCCESS) + droiddeck_log("gpu", "GPU fence completed: continuing presentation"); + } perf_add(&g_perf.wait_ns, &g_perf.wait_max_ns, &g_perf.waits, perf_now() - t0); if (r != VK_SUCCESS && r != VK_ERROR_DEVICE_LOST) quarantine_pending_work(r, "fence wait"); diff --git a/tools/tests/test_vk_pending_completion.py b/tools/tests/test_vk_pending_completion.py index a4d2972d2c..7ad8a6f784 100644 --- a/tools/tests/test_vk_pending_completion.py +++ b/tools/tests/test_vk_pending_completion.py @@ -47,13 +47,18 @@ static int g_dev_state, g_base_black; static uintptr_t g_dev = 1; static struct { int64_t wait_ns, wait_max_ns; unsigned waits; } g_perf; static VkResult answer; +static unsigned timeouts, wait_calls; static unsigned destroyed, unmapped, freed_memory, forgotten, errors; static int64_t perf_now(void) { return 10; } static void perf_add(int64_t *s, int64_t *m, unsigned *c, int64_t d) { *s+=d; *m=d; ++*c; } static void __attribute__((unused)) droiddeck_log(const char *tag, const char *fmt, ...) { (void)tag; (void)fmt; ++errors; } #define LOGE(...) droiddeck_log("error", __VA_ARGS__) static VkResult wait_fn(uintptr_t dev, unsigned n, const VkFence *f, int all, uint64_t timeout) { - (void)dev; (void)n; (void)f; (void)all; (void)timeout; return answer; + (void)dev; (void)n; (void)f; (void)all; + ++wait_calls; + if (wait_calls > 1) assert(timeout == UINT64_MAX); + if (timeouts) { --timeouts; return VK_TIMEOUT; } + return answer; } static void unmap_fn(uintptr_t dev, uintptr_t mem) { (void)dev; (void)mem; ++unmapped; } static void destroy_fn(uintptr_t dev, uintptr_t img, void *allocator) { (void)dev; (void)img; (void)allocator; ++destroyed; } @@ -104,8 +109,15 @@ int main(void) { vkp_image_destroy(image()); assert(destroyed==1 && unmapped==1 && freed_memory==1 && forgotten==1); - g_dev_state=1; g_base_black=1; answer=VK_TIMEOUT; - assert(timed_wait(1, 1000)==VK_TIMEOUT); + for (unsigned delays=1; delays<=3; ++delays) { + g_dev_state=1; g_base_black=1; answer=VK_SUCCESS; + timeouts=delays; wait_calls=0; + assert(timed_wait(1, 1000)==VK_SUCCESS); + assert(g_dev_state==1 && g_base_black==1 && wait_calls==delays+1); + } + + g_dev_state=1; g_base_black=1; answer=VK_ERROR_UNKNOWN; wait_calls=0; + assert(timed_wait(1, 1000)==VK_ERROR_UNKNOWN); assert(g_dev_state!=1 && g_dev_state!=-2); /* pending work is not DEVICE_LOST */ struct vkp_image *pending=image(); vkp_image_destroy(pending); @@ -116,14 +128,14 @@ int main(void) { assert(errors==first_errors); /* one terminal diagnostic, no repeated recovery */ free(pending); /* fake GPU exists only in this test */ - g_dev_state=1; answer=VK_ERROR_OUT_OF_HOST_MEMORY; + g_dev_state=1; answer=VK_ERROR_OUT_OF_HOST_MEMORY; wait_calls=0; timeouts=1; assert(timed_wait(1, 1000)==VK_ERROR_OUT_OF_HOST_MEMORY); assert(g_dev_state!=1 && g_dev_state!=-2); pending=image(); vkp_image_destroy(pending); assert(destroyed==1 && unmapped==1 && freed_memory==1 && forgotten==1); free(pending); - g_dev_state=1; answer=VK_ERROR_DEVICE_LOST; + g_dev_state=1; answer=VK_ERROR_DEVICE_LOST; wait_calls=0; timeouts=2; assert(timed_wait(1, 1000)==VK_ERROR_DEVICE_LOST); assert(g_dev_state==1); /* existing caller performs genuine device-loss cleanup */ return 0; diff --git a/tools/tests/test_vk_terminal_callers.py b/tools/tests/test_vk_terminal_callers.py index ab44e74d7b..c1e08bf6d5 100644 --- a/tools/tests/test_vk_terminal_callers.py +++ b/tools/tests/test_vk_terminal_callers.py @@ -111,15 +111,18 @@ int __android_log_print(int, const char *, const char *, ...); def test_later_framegen_surface_lost_idle_failure(self): self.run_scenario('later-surface-lost') - def test_finite_blit_timeout_same_size_shm_upload(self): - self.run_scenario('shm-timeout') + def test_blit_wait_error_same_size_shm_upload(self): + self.run_scenario('shm-wait-error') - def test_finite_blit_timeout_same_size_pixel_upload(self): - self.run_scenario('pixel-timeout') + def test_blit_wait_error_same_size_pixel_upload(self): + self.run_scenario('pixel-wait-error') def test_lost_device_shm_upload_keeps_cpu_snapshot(self): self.run_scenario('lost-shm-upload') + def test_delayed_blit_completes_and_next_frame_renders(self): + self.run_scenario('blit-delayed') + def test_normal_present(self): self.run_scenario('normal') diff --git a/tools/tests/vk_terminal_callers_test.c b/tools/tests/vk_terminal_callers_test.c index fd7b1c411b..0c6a3311e6 100644 --- a/tools/tests/vk_terminal_callers_test.c +++ b/tools/tests/vk_terminal_callers_test.c @@ -7,7 +7,7 @@ struct vk_api g_vk; static unsigned operations, acquires, submits, markers, waits, idle_calls, resets; static unsigned destroys, releases, lost_notifications, presented_notifications; static VkResult idle_answer, fence_answer, acquire_answer, present_answer; -static unsigned fail_acquire_at; +static unsigned fail_acquire_at, fence_timeouts; static int generated; /* Every work-issuing callback is an oracle: no GPU operation after a terminal @@ -19,7 +19,9 @@ static VkResult acquire(VkDevice d, VkSwapchainKHR s, uint64_t t, VkSemaphore a, } static VkResult idle(VkDevice d) { live(); ++idle_calls; return idle_answer; } static VkResult wait_fences(VkDevice d, uint32_t n, const VkFence *f, VkBool32 all, uint64_t t) { - live(); ++waits; return fence_answer; + live(); ++waits; + if (fence_timeouts) { --fence_timeouts; return VK_TIMEOUT; } + return fence_answer; } static VkResult submit(VkQueue q, uint32_t n, const VkSubmitInfo *s, VkFence f) { live(); ++submits; if (!s->commandBufferCount) ++markers; return VK_SUCCESS; @@ -235,7 +237,7 @@ static void acquire_failure(int later, VkResult result) { free(g_images); /* test-owned fake resources only */ } -static void upload_timeout(int single_pixel) { +static void upload_wait_error(int single_pixel) { setup(0); uint8_t bytes[48], saved[48], data[16]; memset(bytes, 0xa5, sizeof(bytes)); memset(data, 0x3c, sizeof(data)); @@ -251,7 +253,7 @@ static void upload_timeout(int single_pixel) { assert(bytes[3] == 0x3c && bytes[0] == 0xa5 && releases == 1); memcpy(saved, bytes, sizeof(saved)); struct vkp_image dst = {.image = (VkImage)(uintptr_t)9, .blit_dst = 1, .w = img->w, .h = img->h}; - fence_answer = VK_TIMEOUT; + fence_answer = VK_ERROR_OUT_OF_HOST_MEMORY; assert(vkp_blit_image(img, &dst, -1) == -1); assert(g_dev_state == -3 && submits == 1 && waits == 1); memset(data, 0x7e, sizeof(data)); @@ -279,8 +281,8 @@ int main(int argc, char **argv) { else if (!strcmp(name, "first-surface-lost")) acquire_failure(0, VK_ERROR_SURFACE_LOST_KHR); else if (!strcmp(name, "later-out-of-date")) acquire_failure(1, VK_ERROR_OUT_OF_DATE_KHR); else if (!strcmp(name, "later-surface-lost")) acquire_failure(1, VK_ERROR_SURFACE_LOST_KHR); - else if (!strcmp(name, "shm-timeout")) upload_timeout(0); - else if (!strcmp(name, "pixel-timeout")) upload_timeout(1); + else if (!strcmp(name, "shm-wait-error")) upload_wait_error(0); + else if (!strcmp(name, "pixel-wait-error")) upload_wait_error(1); else if (!strcmp(name, "lost-shm-upload")) { setup(0); uint8_t bytes[64], data[16]; @@ -295,6 +297,17 @@ int main(int argc, char **argv) { free(img.recovery_pixels); free(g_images); } else if (!strcmp(name, "pass-terminal")) { setup(0); g_dev_state = -3; assert_stopped(); free(g_images); } + else if (!strcmp(name, "blit-delayed")) { + setup(0); + struct vkp_image src = {.image = (VkImage)(uintptr_t)7, .w = 1, .h = 1}; + struct vkp_image dst = {.image = (VkImage)(uintptr_t)8, .w = 1, .h = 1, .blit_dst = 1}; + fence_timeouts = 3; + assert(vkp_blit_image(&src, &dst, -1) == 0); + assert(g_dev_state == 1 && submits == 1 && waits == 4 && destroys == 0); + assert(vkp_blit_image(&src, &dst, -1) == 0); + assert(g_dev_state == 1 && submits == 2 && waits == 5 && destroys == 0); + free(g_images); + } else if (!strcmp(name, "normal") || !strcmp(name, "framegen")) { int extra = !strcmp(name, "framegen"); setup(extra); assert(vkp_render(64, 64, NULL, 0) == 0 && g_dev_state == 1); From 90df30f4d7053d769b82307428986ab9c93f5e7e Mon Sep 17 00:00:00 2001 From: LarzVader <118484383+LarzVader@users.noreply.github.com> Date: Sun, 29 Nov 2026 22:18:27 +0100 Subject: [PATCH 094/120] fix(venus): OpenGL quads no longer crash Mali's shader compiler through Zink (#3283) * fix(venus): OpenGL quads no longer crash Mali's shader compiler through Zink The Mali-G610's driver crashes compiling Zink's geometry shaders (SIGSEGV at 0x40 in cmpbe_v2_compile_multiple_shaders), and the render server and the application die with it. A plain geometry shader that only passes triangles on does not crash it, but draws nothing. Zink draws GL_QUADS through a geometry shader when the device has the feature, so OpenGL programs died on their first quad. The Mali layer now reports no geometryShader to Zink on ARM GPUs. Mesa then splits quads into triangles itself. DXVK keeps the feature, which it needs for D3D10 and 11. DROIDDECK_MALI_COMPAT_NO_GS=0 keeps it for Zink, =1 hides it from every application. * test(venus): clear DROIDDECK_MALI_COMPAT_NO_GS before the layer tests The geometry shader test checks the default first. With the variable exported in the shell, it failed before it reached its own settings. * test(venus): check that other ARM applications keep the geometry shader --- docs/development/mali-venus.md | 13 +++++++ tools/tests/mali_compat_layer_test.c | 58 +++++++++++++++++++++++++++- tools/venus/layer/layer.c | 26 +++++++++++++ tools/venus/layer/mali_compat.h | 1 + 4 files changed, 97 insertions(+), 1 deletion(-) diff --git a/docs/development/mali-venus.md b/docs/development/mali-venus.md index 5cdc4ab39f..34f97d48b6 100644 --- a/docs/development/mali-venus.md +++ b/docs/development/mali-venus.md @@ -150,6 +150,19 @@ The SPIR-V version the driver gets: - This is what Dawn ("Disable SPIR-V 1.4 on Android ARM"), ANGLE (`supportsSPIRV14`) and naga (`AVOID_SPIRV_COPY_LOGICAL`) do for a proprietary compiler they cannot trust. +Geometry shaders: +- The Mali-G610's driver (r38p1) crashes compiling Zink's geometry shaders, always at the same + place (SIGSEGV at 0x40 in `cmpbe_v2_compile_multiple_shaders`): its shader for `GL_QUADS`, and + a GLSL geometry shader that only passes triangles on. +- A geometry shader that only passes triangles on, from a plain Vulkan program, does not crash it + but draws nothing, in SPIR-V 1.0, 1.3 and 1.6, with and without the layer. +- Zink writes them in SPIR-V 1.6 with the Vulkan memory model, which the version cap leaves alone. + Lowering them would not help, since the plain shader draws nothing at 1.0 and 1.3 either. +- On ARM GPUs the layer reports no `geometryShader` to Zink (engine name `mesa zink`). Mesa then + splits quads into triangles itself, and Zink still offers OpenGL 3.2. DXVK keeps the feature: it + needs it for D3D10 and 11. +- `DROIDDECK_MALI_COMPAT_NO_GS=0` keeps the feature for Zink, `=1` hides it from every application. + Files: - `layer.c`: loader plumbing, feature and limit reporting, device creation, the hook table. - `pipeline.c`: pipelines, shader modules, viewports. diff --git a/tools/tests/mali_compat_layer_test.c b/tools/tests/mali_compat_layer_test.c index 9b29e5c734..421f5524b0 100644 --- a/tools/tests/mali_compat_layer_test.c +++ b/tools/tests/mali_compat_layer_test.c @@ -203,10 +203,17 @@ static void test_handle_map_null_key(void) map_free(&map); } +static int zink_instance_table; +static struct object mock_zink_instance = {&zink_instance_table}; +static struct object mock_arm = {&instance_table}; +static struct object mock_zink_arm = {&zink_instance_table}, mock_zink_other = {&zink_instance_table}; + static VkResult VKAPI_CALL mock_create_instance(const VkInstanceCreateInfo *info, const VkAllocationCallbacks *allocator, VkInstance *instance) { - *instance = (VkInstance)&mock_instance; + const VkApplicationInfo *app = info->pApplicationInfo; + bool zink = app && app->pEngineName && !strcmp(app->pEngineName, "mesa zink"); + *instance = (VkInstance)(zink ? &mock_zink_instance : &mock_instance); return VK_SUCCESS; } @@ -223,6 +230,7 @@ static void VKAPI_CALL mock_features(VkPhysicalDevice physical, VkPhysicalDevice { memset(features, 0, sizeof(*features)); features->dualSrcBlend = physical == (VkPhysicalDevice)&mock_capable; + features->geometryShader = VK_TRUE; } static void VKAPI_CALL mock_features2(VkPhysicalDevice physical, VkPhysicalDeviceFeatures2 *features) @@ -234,6 +242,8 @@ static void VKAPI_CALL mock_properties(VkPhysicalDevice physical, VkPhysicalDevi { memset(properties, 0, sizeof(*properties)); strcpy(properties->deviceName, "mock"); + bool arm = physical == (VkPhysicalDevice)&mock_arm || physical == (VkPhysicalDevice)&mock_zink_arm; + properties->vendorID = arm ? 0x13b5 : 0; properties->limits.maxFragmentDualSrcAttachments = physical == (VkPhysicalDevice)&mock_capable; } @@ -385,6 +395,50 @@ static void destroy_device(VkDevice device) ((PFN_vkDestroyDevice)layer_gdpa(device, "vkDestroyDevice"))(device, NULL); } +static void test_geometry_shader_hidden_from_zink(void) +{ + VkPhysicalDeviceFeatures features; + PFN_vkGetPhysicalDeviceFeatures plain_features = + (PFN_vkGetPhysicalDeviceFeatures)layer_gipa((VkInstance)&mock_instance, "vkGetPhysicalDeviceFeatures"); + PFN_vkGetPhysicalDeviceFeatures2 plain_features2 = + (PFN_vkGetPhysicalDeviceFeatures2)layer_gipa((VkInstance)&mock_instance, "vkGetPhysicalDeviceFeatures2"); + VkPhysicalDeviceFeatures2 queried = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; + plain_features((VkPhysicalDevice)&mock_lacking, &features); + assert(features.geometryShader); + plain_features((VkPhysicalDevice)&mock_arm, &features); + assert(features.geometryShader); + plain_features2((VkPhysicalDevice)&mock_arm, &queried); + assert(queried.features.geometryShader); + + VkApplicationInfo app = {.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pEngineName = "mesa zink"}; + VkLayerInstanceLink link = {NULL, mock_gipa, NULL}; + VkLayerInstanceCreateInfo loader = {VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO, NULL, VK_LAYER_LINK_INFO, {&link}}; + VkInstanceCreateInfo info = {.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = &loader, + .pApplicationInfo = &app}; + VkInstance zink; + assert(((PFN_vkCreateInstance)layer_gipa(NULL, "vkCreateInstance"))(&info, NULL, &zink) == VK_SUCCESS); + assert(zink == (VkInstance)&mock_zink_instance); + PFN_vkGetPhysicalDeviceFeatures zink_features = + (PFN_vkGetPhysicalDeviceFeatures)layer_gipa(zink, "vkGetPhysicalDeviceFeatures"); + PFN_vkGetPhysicalDeviceFeatures2 zink_features2 = + (PFN_vkGetPhysicalDeviceFeatures2)layer_gipa(zink, "vkGetPhysicalDeviceFeatures2"); + zink_features((VkPhysicalDevice)&mock_zink_arm, &features); + assert(!features.geometryShader && features.dualSrcBlend); + zink_features2((VkPhysicalDevice)&mock_zink_arm, &queried); + assert(!queried.features.geometryShader && queried.features.dualSrcBlend); + zink_features((VkPhysicalDevice)&mock_zink_other, &features); + assert(features.geometryShader); + + setenv("DROIDDECK_MALI_COMPAT_NO_GS", "0", 1); + zink_features((VkPhysicalDevice)&mock_zink_arm, &features); + assert(features.geometryShader); + setenv("DROIDDECK_MALI_COMPAT_NO_GS", "1", 1); + plain_features((VkPhysicalDevice)&mock_lacking, &features); + assert(!features.geometryShader); + unsetenv("DROIDDECK_MALI_COMPAT_NO_GS"); + ((PFN_vkDestroyInstance)layer_gipa(zink, "vkDestroyInstance"))(zink, NULL); +} + static const VkPipelineColorBlendAttachmentState dual_attachment = { VK_TRUE, VK_BLEND_FACTOR_ONE, VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR, VK_BLEND_OP_ADD, VK_BLEND_FACTOR_SRC1_ALPHA, VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA, VK_BLEND_OP_ADD, 0xf, @@ -575,6 +629,7 @@ int main(int argc, char **argv) setenv("WINEPREFIX", "/nonexistent", 1); unsetenv("DROIDDECK_MALI_COMPAT"); unsetenv("DROIDDECK_MALI_COMPAT_TRACE"); + unsetenv("DROIDDECK_MALI_COMPAT_NO_GS"); VkNegotiateLayerInterface negotiate = {LAYER_NEGOTIATE_INTERFACE_STRUCT, NULL, 2, NULL, NULL, NULL}; assert(vkNegotiateLoaderLayerInterfaceVersion(&negotiate) == VK_SUCCESS); layer_gipa = negotiate.pfnGetInstanceProcAddr; @@ -587,6 +642,7 @@ int main(int argc, char **argv) PFN_vkCreateInstance create_instance = (PFN_vkCreateInstance)layer_gipa(NULL, "vkCreateInstance"); assert(create_instance(&info, NULL, &instance) == VK_SUCCESS); + test_geometry_shader_hidden_from_zink(); test_lacking_device(); test_capable_device(); test_depth_compare_op(); diff --git a/tools/venus/layer/layer.c b/tools/venus/layer/layer.c index 9aeb0bcf0e..0948fee234 100644 --- a/tools/venus/layer/layer.c +++ b/tools/venus/layer/layer.c @@ -344,12 +344,31 @@ static void report_limits(VkPhysicalDeviceLimits *limits, uint32_t gaps) } } +/* Mali's driver crashes compiling Zink's geometry shaders (SIGSEGV at 0x40 in + * cmpbe_v2_compile_multiple_shaders) and takes the render server and the application with it; a plain + * one draws nothing. Zink draws GL_QUADS through one; without the feature Mesa splits quads into + * triangles itself. DXVK needs the feature for D3D10 and 11, so only Zink loses it. + * DROIDDECK_MALI_COMPAT_NO_GS=0 keeps it for Zink, =1 hides it from every application. */ +static bool hide_geometry_shader(struct instance *inst, VkPhysicalDevice physical_device) +{ + const char *setting = getenv("DROIDDECK_MALI_COMPAT_NO_GS"); + if (setting && *setting) + return strcmp(setting, "1") == 0; + if (!inst->zink) + return false; + VkPhysicalDeviceProperties properties; + inst->GetPhysicalDeviceProperties(physical_device, &properties); + return properties.vendorID == 0x13b5; /* ARM */ +} + static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures *features) { struct instance *inst = instance_from_handle(physical_device); inst->GetPhysicalDeviceFeatures(physical_device, features); report_features(features, physical_device_gaps(inst, physical_device)); + if (hide_geometry_shader(inst, physical_device)) + features->geometryShader = VK_FALSE; } static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2(VkPhysicalDevice physical_device, @@ -363,6 +382,8 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2(VkPhysicalDevice ph inst->GetPhysicalDeviceFeatures2(physical_device, features); relink(dropped, dropped_count); report_features(&features->features, gaps); + if (hide_geometry_shader(inst, physical_device)) + features->features.geometryShader = VK_FALSE; if (tracing()) { char chain[512] = ""; size_t used = 0; @@ -463,6 +484,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo inst->key = dispatch_key(*instance); inst->handle = *instance; inst->active = wanted(); + const char *engine = info->pApplicationInfo ? info->pApplicationInfo->pEngineName : NULL; + inst->zink = engine && strcmp(engine, "mesa zink") == 0; inst->gipa = gipa; pthread_mutex_init(&inst->lock, NULL); #define LOAD(name) inst->name = (PFN_vk##name)gipa(*instance, "vk" #name); @@ -624,6 +647,9 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physical_dev if (properties.limits.maxFragmentInputComponents < components) components = properties.limits.maxFragmentInputComponents; dev->max_varying_locations = components / 4; + if (inst->active && hide_geometry_shader(inst, physical_device)) + layer_log("geometryShader is hidden from %s: the driver crashes compiling geometry shaders", + inst->zink ? "Zink" : "every application"); pthread_mutex_lock(&global_lock); dev->next = devices; diff --git a/tools/venus/layer/mali_compat.h b/tools/venus/layer/mali_compat.h index 073907f41a..4ba59428e1 100644 --- a/tools/venus/layer/mali_compat.h +++ b/tools/venus/layer/mali_compat.h @@ -63,6 +63,7 @@ struct instance { void *key; VkInstance handle; bool active; + bool zink; /* the engine is Mesa's Zink */ PFN_vkGetInstanceProcAddr gipa; PFN_vkDestroyInstance DestroyInstance; PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; From c91b100bc129dc4c292bdde7cdda6d87d590c8db Mon Sep 17 00:00:00 2001 From: Dhiman Seal Date: Mon, 30 Nov 2026 02:48:35 +0530 Subject: [PATCH 095/120] fix(game-env): run Inno Setup installers with the FEX Stability settings (#3069) * fix(game-env): run Inno Setup installers with the FEX Stability settings An Inno Setup installer added as a game stops with Wine's "Path not fpund." dialog under the default FEX preset. The 32-bit setup stub corrupts its own paths before it opens its archive (#1277, #3067). #1174 avoids the stub only for GOG installs, by extracting them natively. droiddeck-game-env now finds the stub by the setup loader's offset-table ID in its resources, or the "Inno" marker older loaders keep at 0x30, and launches it with the Stability preset's FEX settings. A FEX preset chosen for the game itself still wins. Fixes #3067 * fix(game-env): name only the preset seen to corrupt Inno Setup paths The launch note and the docs said the faster presets corrupt the setup stub. Only the default Performance + TSO preset was seen doing it. * fix(game-env): give Inno Setup installers started with run the Stability settings The run verb skips engine_fixes and gets only the sync settings, so an installer started that way kept the inherited Performance + TSO preset. Apply the Stability values on that path too; explicit game settings still win in apply_config. * fix(game-env): keep the game's own FEX settings for installers started with run The run path filtered the game entry down to sync keys, so a FEX preset chosen for the game was replaced by the installer's Stability settings, and a null could not unset a preset key. Copy the game's Stability FEX keys into the synced config before applying it, so the game's own settings still win on every launch path. --------- Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> --- docs/development/game-environment.md | 9 +++ .../overlay/usr/local/bin/droiddeck-game-env | 51 +++++++++++++- tools/tests/test_game_environment.py | 70 +++++++++++++++++++ 3 files changed, 128 insertions(+), 2 deletions(-) diff --git a/docs/development/game-environment.md b/docs/development/game-environment.md index 5d780b1253..6036cc3a7a 100644 --- a/docs/development/game-environment.md +++ b/docs/development/game-environment.md @@ -193,6 +193,15 @@ A Unity game under FEX (`UnityPlayer.dll` for Windows builds under Proton, turns it off: without TSO such games can deadlock or crash (seen with Megabonk and Crab Game). A FEX preset chosen for the game itself still applies. +An Inno Setup installer added as a game runs with the Stability preset's FEX +settings (full TSO, full x87 precision, no multiblock). Under the default +Performance + TSO preset the 32-bit setup stub corrupts its own paths and stops +with Wine's "Path not fpund." dialog (#1277, #3067). The stub is found by the +setup loader's offset-table ID in its resources, or by the `Inno` marker that +loaders older than 5.1.5 keep at offset 0x30. GOG installs avoid the stub by +extracting natively. A FEX preset chosen for the installer's own entry still +applies. + Games launched through Proton get `vblank_mode=0`, so OpenGL does not wait for each screen refresh. Wine asks for a swap interval of 1 on every OpenGL window, and WineD3D's front-buffer drawing (DirectDraw, Direct3D 1–7) never lowers it, so those games ran at the diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env index a71a8edd94..cb7f2d8858 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env @@ -66,6 +66,35 @@ DOTNET_FEX = { "FEX_HALFBARRIERTSOENABLED": "1", "FEX_X87REDUCEDPRECISION": "0", } +STABILITY_FEX = dict(DOTNET_FEX, FEX_MULTIBLOCK="0") +# Setup loader offset-table IDs, as innoextract's known_setup_loader_versions lists them. Loaders +# from 5.1.5 keep the table in a resource; older ones also put "Inno" at file offset 0x30. +INNO_LOADER_IDS = (b"rDlPtS", b"nS5W7dT\x83\xaa\x1b\x0fj") +INNO_RESOURCE_LIMIT = 4 << 20 + + +def is_inno_setup(path): + try: + with open(path, "rb") as exe: + head = exe.read(4096) + if head[:2] != b"MZ": + return False + if head[0x30:0x34] == b"Inno": + return True + pe = int.from_bytes(head[0x3C:0x40], "little") + if head[pe:pe + 4] != b"PE\0\0" or int.from_bytes(head[pe + 4:pe + 6], "little") != 0x14C: + return False + count = int.from_bytes(head[pe + 6:pe + 8], "little") + table = pe + 24 + int.from_bytes(head[pe + 20:pe + 22], "little") + for entry in range(table, table + 40 * count, 40): + if head[entry:entry + 8].rstrip(b"\0") == b".rsrc": + exe.seek(int.from_bytes(head[entry + 20:entry + 24], "little")) + size = int.from_bytes(head[entry + 16:entry + 20], "little") + resources = exe.read(min(size, INNO_RESOURCE_LIMIT)) + return any(marker in resources for marker in INNO_LOADER_IDS) + except OSError: + pass + return False def game_files(exe): @@ -191,6 +220,12 @@ def split_second_x87_fip(game): return {"FEX_JITFEATURES": "enablex87fip"}, [], "Split/Second: FEX x87 FIP emulation on (its SecuROM stops with error 8016 without it)" +@fix +def inno_setup_stability(game): + if is_inno_setup(game.exe): + return STABILITY_FEX, [], "Inno Setup installer: FEX Stability settings (under Performance + TSO the 32-bit setup stub corrupts its own paths)" + + @fix def doom_2016_swapchain_images(game): if "doomx64vk.exe" in game.files and game.stem in ("doomx64", "doomx64vk"): @@ -1676,14 +1711,26 @@ def main(): if note: print("droiddeck-game-env: " + note, file=sys.stderr) else: + # An installer started with the run verb gets the same Stability settings as one started with + # waitforexitandrun; explicit game settings still win over them in apply_config. + installer = {} + if len(command) > 2 and command[1] == "run" and is_inno_setup(command[2]): + installer = dict(STABILITY_FEX) + print("droiddeck-game-env: Inno Setup installer: FEX Stability settings", file=sys.stderr) path = Path.home() / ".config/droiddeck/game-environment.json" try: with path.open(encoding="utf-8") as source: config = json.load(source) - env = apply_config(env, sync_config(config, app_id), app_id) + synced = sync_config(config, app_id) + if installer: + # A FEX preset chosen for the game itself still wins, as on every other launch path. + game = config.get("games", {}).get(app_id, {}) + synced["games"][app_id].update({k: v for k, v in game.items() if k in STABILITY_FEX}) + env = apply_config(env, synced, app_id, installer) except FileNotFoundError: - pass + env = dict(env, **installer) except (OSError, ValueError, TypeError, AttributeError): + env = dict(env, **installer) print("droiddeck-game-env: invalid configuration; using inherited environment", file=sys.stderr) if waiting: before_debug = env diff --git a/tools/tests/test_game_environment.py b/tools/tests/test_game_environment.py index 830b7f2e5d..602c466d53 100644 --- a/tools/tests/test_game_environment.py +++ b/tools/tests/test_game_environment.py @@ -1762,6 +1762,76 @@ class GameEnvironmentTest(unittest.TestCase): config["games"] = {"297860": {"FEX_JITFEATURES": "off"}} self.assertEqual(MODULE["apply_config"]({}, config, "297860", env)["FEX_JITFEATURES"], "off") + def test_inno_setup_installers_get_the_stability_preset_over_the_default(self): + stability = {"FEX_TSOENABLED": "1", "FEX_VECTORTSOENABLED": "1", "FEX_MEMCPYSETTSOENABLED": "1", + "FEX_HALFBARRIERTSOENABLED": "1", "FEX_X87REDUCEDPRECISION": "0", "FEX_MULTIBLOCK": "0"} + performance_tso = {"FEX_TSOENABLED": "1", "FEX_VECTORTSOENABLED": "0", "FEX_MEMCPYSETTSOENABLED": "0", + "FEX_HALFBARRIERTSOENABLED": "0", "FEX_X87REDUCEDPRECISION": "1", "FEX_MULTIBLOCK": "1"} + + def loader(path, resources=b"", machine=0x14C, section=b".rsrc", legacy=False): + dos = bytearray(0x80) + dos[:2] = b"MZ" + dos[0x3C:0x40] = (0x80).to_bytes(4, "little") + if legacy: + dos[0x30:0x34] = b"Inno" + header = b"PE\0\0" + machine.to_bytes(2, "little") + (1).to_bytes(2, "little") + bytes(12) \ + + (0xE0).to_bytes(2, "little") + bytes(2) + entry = section.ljust(8, b"\0") + bytes(8) + len(resources).to_bytes(4, "little") \ + + (0x400).to_bytes(4, "little") + bytes(16) + path.write_bytes((bytes(dos) + header + bytes(0xE0) + entry).ljust(0x400, b"\0") + resources) + return str(path) + + with tempfile.TemporaryDirectory() as tmp: + folder = Path(tmp) + table = bytes(64) + b"rDlPtS\xcd\xe6\xd7{\x0b*" + bytes(64) + installers = [ + loader(folder / "setup.exe", table), + loader(folder / "setup_game_1.0.exe", bytes(64) + b"nS5W7dT\x83\xaa\x1b\x0fj"), + loader(folder / "old_setup.exe", legacy=True), + ] + for installer in installers: + env, extra, notes = MODULE["engine_fixes"](installer, []) + self.assertEqual((env, extra), (stability, []), installer) + self.assertTrue(notes) + config = {"version": 1, "shared": performance_tso} + self.assertEqual({k: v for k, v in MODULE["apply_config"]({}, config, "42", env).items() if k in stability}, + stability) + config["games"] = {"42": {"FEX_MULTIBLOCK": "1"}} + self.assertEqual(MODULE["apply_config"]({}, config, "42", env)["FEX_MULTIBLOCK"], "1") + + not_installers = [ + loader(folder / "Game.exe", bytes(256)), + loader(folder / "Game64.exe", table, machine=0x8664), + loader(folder / "Data.exe", table, section=b".data"), + folder / "missing.exe", + ] + (folder / "notes.exe").write_bytes(b"rDlPtS\xcd\xe6\xd7{\x0b*") + not_installers.append(folder / "notes.exe") + for other in not_installers: + self.assertEqual(MODULE["engine_fixes"](str(other), []), ({}, [], []), other) + + # The run verb skips engine_fixes; an installer started that way still gets Stability. + probe = folder / "proton" + probe.write_text("#!" + sys.executable + "\nimport json, os\nprint(json.dumps(dict(os.environ)))\n") + probe.chmod(0o755) + base = {**os.environ, **performance_tso, "HOME": tmp, "STEAM_COMPAT_DATA_PATH": str(folder / "compatdata/42")} + + def run_verb(program): + out = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"), str(probe), "run", program], + env=base, text=True, capture_output=True, check=True).stdout + return {name: value for name, value in json.loads(out).items() if name in stability} + + self.assertEqual(run_verb(installers[0]), stability) + self.assertEqual(run_verb(str(folder / "Game.exe")), performance_tso) + config_path = folder / ".config/droiddeck/game-environment.json" + config_path.parent.mkdir(parents=True) + config_path.write_text(json.dumps({"version": 1, "shared": {"WINEESYNC": "1"}})) + self.assertEqual(run_verb(installers[0]), stability) + config_path.write_text(json.dumps({"version": 1, "games": {"42": {"FEX_MULTIBLOCK": "1"}}})) + self.assertEqual(run_verb(installers[0]), {**stability, "FEX_MULTIBLOCK": "1"}) + config_path.write_text(json.dumps({"version": 1, "games": {"42": {"FEX_MULTIBLOCK": None}}})) + self.assertNotIn("FEX_MULTIBLOCK", run_verb(installers[0])) + def test_d3dgear_capture_hook_beside_the_game_is_turned_off(self): with tempfile.TemporaryDirectory() as tmp: game = Path(tmp) / "The Crew 2" From 44b429ca203b84f1b3db7aef2ccd6df38f68ae5a Mon Sep 17 00:00:00 2001 From: sergeymetallic Date: Sun, 29 Nov 2026 22:18:43 +0100 Subject: [PATCH 096/120] fix(game-env): resolve store launcher executable from sidecar (#3288) * fix(game-env): resolve store launcher executable from sidecar Store titles launched through .droiddeck-launch.bat passed the wrapper path directly into engine_fixes and other exe-based checks, so stem checks saw .droiddeck-launch and game_files scanned from the install root rather than the executable's folder. For Epic's Batman: Arkham City, Binaries/Win32/BatmanAC.exe sat one level deeper than game_files scans, so arkham_city_x87 never set FEX_X87REDUCEDPRECISION=0. Resolve .droiddeck-launch.bat to the validated exe entry from .droiddeck-store.json when inspecting the game, while keeping the launcher path in the Proton command. * fix(game-env): reject parent segments before normpath in store_game_exe os.path.normpath lexically collapses symlink/../file before the filesystem is consulted, which could validate a different file than a symlinked subdirectory path denotes. Reject any ".." path component after separator normalization before calling os.path.normpath. --------- Co-authored-by: sergeymetallic <6938136+sergeymetallic@users.noreply.github.com> --- .../overlay/usr/local/bin/droiddeck-game-env | 50 +++++++++-- tools/tests/test_game_environment.py | 88 +++++++++++++++++++ 2 files changed, 132 insertions(+), 6 deletions(-) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env index cb7f2d8858..1e02ad4be2 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env @@ -97,6 +97,40 @@ def is_inno_setup(path): return False +STORE_LAUNCHER = ".droiddeck-launch.bat" +STORE_SIDECAR = ".droiddeck-store.json" + + +def store_game_exe(exe): + if os.path.basename(exe).lower() != STORE_LAUNCHER: + return exe + folder = os.path.dirname(exe) + try: + with open(os.path.join(folder, STORE_SIDECAR), encoding="utf-8") as source: + sidecar = json.load(source) + except (OSError, ValueError): + return exe + target = sidecar.get("exe") if isinstance(sidecar, dict) else None + if not isinstance(target, str) or not target.strip() or "\0" in target: + return exe + normalized = target.replace("\\", "/") + if ":" in normalized or normalized.startswith("/") or ".." in normalized.split("/"): + return exe + relative = os.path.normpath(normalized) + if os.path.isabs(relative) or relative in (".", "..") or relative.startswith(".." + os.sep): + return exe + candidate = os.path.join(folder, relative) + if not os.path.isfile(candidate): + return exe + root = os.path.realpath(folder) + try: + if os.path.commonpath((root, os.path.realpath(candidate))) != root: + return exe + except ValueError: + return exe + return candidate + + def game_files(exe): names = set() folder = os.path.dirname(exe) @@ -118,6 +152,7 @@ def game_files(exe): class Game: def __init__(self, exe, args, app_id=""): + exe = store_game_exe(exe) self.exe = exe self.args = args self.app_id = app_id @@ -308,7 +343,7 @@ def with_system_settings(text, settings): # The game ignores -ini: overrides and deletes a writable Engine.ini after reading it, so this runs at every launch. def dragon_quest_monsters_4_mesh_detail(exe, env): - project = Path(exe).stem.split("-", 1)[0] + project = Path(store_game_exe(exe)).stem.split("-", 1)[0] if not project.lower().startswith("dragonquestmonsters4"): return prefix = Path(env.get("STEAM_COMPAT_DATA_PATH", "/nonexistent")) / "pfx" @@ -433,7 +468,7 @@ def zomboid_rewrite(node): def project_zomboid_jvm(command): if len(command) <= 2: return - exe = Path(command[2]) + exe = Path(store_game_exe(command[2])) if not exe.stem.lower().startswith("projectzomboid"): return settings = exe.with_suffix(".json") @@ -756,12 +791,15 @@ def apply_config(env, config, app_id, fixes=None): def render_path_defaults(command, env): - if len(command) < 3 or command[1] != "waitforexitandrun" or Path(command[2]).name.lower() != "spintires.exe": + if len(command) < 3 or command[1] != "waitforexitandrun": + return None + exe = Path(store_game_exe(command[2])) + if exe.name.lower() != "spintires.exe": return None own = env.get("DXVK_CONFIG", "") if re.search(r"(?:^|;)\s*dxvk\.tilerMode\s*=", own) or env.get("DXVK_CONFIG_FILE"): return None - if Path("dxvk.conf").is_file() or Path(command[2]).with_name("dxvk.conf").is_file(): + if Path("dxvk.conf").is_file() or exe.with_name("dxvk.conf").is_file(): return None driver = env.get("VK_DRIVER_FILES", env.get("VK_ICD_FILENAMES", "")) if Path(driver).parent.name != "DD-Turnip_v0.4.0": @@ -1325,7 +1363,7 @@ def dirt_ws2_wanted(command, env): prefix = env.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/") if len(command) < 3 or not prefix or not os.path.isfile(DIRT_WS2): return None - game = DIRT_GAMES.get(os.path.splitext(os.path.basename(command[2]))[0].lower()) + game = DIRT_GAMES.get(os.path.splitext(os.path.basename(store_game_exe(command[2])))[0].lower()) if not game or not dirt_telemetry_on(prefix, game) or proton_has_dirt_fix(command[0]): return None return prefix if os.path.lexists(prefix_ws2(prefix)) else None @@ -1382,7 +1420,7 @@ def ego_core_plan(command, env): count = windows_core_count(env) if not count or len(command) < 3: return None - folder = Path(command[2]).parent + folder = Path(store_game_exe(command[2])).parent path = folder / EGO_RESTRICTIONS try: raw = path.read_bytes() diff --git a/tools/tests/test_game_environment.py b/tools/tests/test_game_environment.py index 602c466d53..b7b658f21b 100644 --- a/tools/tests/test_game_environment.py +++ b/tools/tests/test_game_environment.py @@ -1741,6 +1741,94 @@ class GameEnvironmentTest(unittest.TestCase): (asylum / name).touch() self.assertEqual(MODULE["engine_fixes"](str(asylum / "BmLauncher.exe"), []), ({}, [], [])) + def test_store_launcher_resolves_the_game_executable_from_the_sidecar(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) / "BatmanArkhamCity" + bin_dir = root / "Binaries/Win32" + bin_dir.mkdir(parents=True) + for name in ("Batman2.exe", "BatmanAC.exe"): + (bin_dir / name).touch() + launcher = root / ".droiddeck-launch.bat" + launcher.touch() + (root / ".droiddeck-store.json").write_text(json.dumps({ + "store": "epic", "id": "Egret", "title": "Batman Arkham City", + "exe": "Binaries/Win32/Batman2.exe", "launcher": ".droiddeck-launch.bat", + })) + env, extra, notes = MODULE["engine_fixes"](str(launcher), []) + self.assertEqual((env, extra), ({"FEX_X87REDUCEDPRECISION": "0"}, [])) + self.assertTrue(notes) + + home = Path(tmp) / "home" + config = home / ".config/droiddeck/game-environment.json" + config.parent.mkdir(parents=True) + config.write_text(json.dumps({"version": 1, "shared": {"FEX_X87REDUCEDPRECISION": "1"}})) + probe = home / "proton" + probe.write_text("#!" + sys.executable + "\nimport os, sys\n" + "print(os.environ.get('FEX_X87REDUCEDPRECISION', ''))\n" + "print(sys.argv[2])\n") + probe.chmod(0o755) + base = {k: v for k, v in os.environ.items() if not k.startswith(("FEX_", "WINE", "PROTON", "DROIDDECK", "DD_", "STEAM"))} + base.update(HOME=str(home), STEAM_COMPAT_DATA_PATH=str(home / "compatdata/3648205350")) + result = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"), str(probe), "waitforexitandrun", str(launcher)], + env=base, text=True, capture_output=True, check=True) + self.assertEqual(result.stdout.splitlines(), ["0", str(launcher)]) + self.assertIn("Batman: Arkham City: FEX with full x87 precision", result.stderr) + + rebirth = Path(tmp) / "FF7Rebirth" + rebirth_exe = rebirth / "End/Binaries/Win64/ff7rebirth_.exe" + rebirth_exe.parent.mkdir(parents=True) + rebirth_exe.touch() + rebirth_launcher = rebirth / ".droiddeck-launch.bat" + rebirth_launcher.touch() + (rebirth / ".droiddeck-store.json").write_text(json.dumps({ + "store": "epic", "id": "ff7", "title": "FF7 Rebirth", + "exe": r"End\Binaries\Win64\ff7rebirth_.exe", "launcher": ".droiddeck-launch.bat", + })) + self.assertEqual(MODULE["engine_fixes"](str(rebirth_launcher), [])[0], {"VKD3D_FEATURE_LEVEL": "12_2"}) + + def test_store_launcher_ignores_missing_invalid_or_escaping_sidecar_paths(self): + with tempfile.TemporaryDirectory() as tmp: + outside = Path(tmp) / "Outside" + outside.mkdir() + outside_exe = outside / "BatmanAC.exe" + outside_exe.touch() + + root = Path(tmp) / "Game" + sub = root / "sub" + sub.mkdir(parents=True) + (root / "real.exe").touch() + (sub / "nested.exe").touch() + (root / "escape.exe").symlink_to(outside_exe) + (root / "linkdir").symlink_to(outside) + launcher = root / ".droiddeck-launch.bat" + launcher.touch() + sidecar = root / ".droiddeck-store.json" + + resolve = MODULE["store_game_exe"] + self.assertEqual(resolve(str(launcher)), str(launcher)) + + for payload in ("not-json", "[]", json.dumps({"exe": ""}), json.dumps({"exe": 123}), + json.dumps({"exe": "missing.exe"}), json.dumps({"exe": "sub"}), + json.dumps({"exe": "../Outside/BatmanAC.exe"}), + json.dumps({"exe": "sub/../real.exe"}), + json.dumps({"exe": r"sub\..\real.exe"}), + json.dumps({"exe": "linkdir/../real.exe"}), + json.dumps({"exe": "sub/../../Outside/BatmanAC.exe"}), + json.dumps({"exe": str(outside_exe)}), + json.dumps({"exe": r"C:\Windows\notepad.exe"}), + json.dumps({"exe": "escape.exe"})): + with self.subTest(payload=payload): + sidecar.write_text(payload) + self.assertEqual(resolve(str(launcher)), str(launcher)) + + sidecar.write_text(json.dumps({"exe": "real.exe"})) + self.assertEqual(resolve(str(launcher)), str(root / "real.exe")) + sidecar.write_text(json.dumps({"exe": "sub/nested.exe"})) + self.assertEqual(resolve(str(launcher)), str(sub / "nested.exe")) + other_bat = root / "custom.bat" + other_bat.touch() + self.assertEqual(resolve(str(other_bat)), str(other_bat)) + def test_split_second_gets_x87_fip_unless_the_game_sets_jit_features(self): with tempfile.TemporaryDirectory() as tmp: game = Path(tmp) / "SplitSecond" From d7fcea74b4023ffaf671972e8fc10e3f73ad344d Mon Sep 17 00:00:00 2001 From: Unixcision Date: Sun, 29 Nov 2026 23:17:51 +0100 Subject: [PATCH 097/120] fix(mali): Auto respects Venus turned off and picks the bridge on Mali-G2-Ultra (#3198) * fix(mali): Auto respects Venus turned off and picks the bridge on Mali-G2-Ultra With GPU drivers on Auto, Mali (Venus) was turned back on after the user turned it off. Auto now respects that choice, and picks the bridge on Mali-G2-Ultra, where Steam's web helper dies on its first window through Venus (#2879). When Auto itself turns Venus off it clears the stored key, so its own decision does not read as the user's later. * fix(mali): clear Auto-owned Venus preference when fallback ends --------- Co-authored-by: Unixcision <14082251+Unixcision@users.noreply.github.com> Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> --- .../com/droiddeck/launcher/DriverMenus.kt | 19 ++++++++++----- .../com/droiddeck/launcher/MaliAutoRoute.kt | 6 +++++ .../launcher/session/SessionPrefs.kt | 5 ++++ .../droiddeck/launcher/MaliAutoRouteTest.kt | 24 +++++++++++++++++++ 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/DriverMenus.kt b/app/src/main/java/com/droiddeck/launcher/DriverMenus.kt index 925884b3c3..94b0e6c744 100644 --- a/app/src/main/java/com/droiddeck/launcher/DriverMenus.kt +++ b/app/src/main/java/com/droiddeck/launcher/DriverMenus.kt @@ -430,21 +430,28 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl */ private fun useMaliFallback(missing: String?): String { val oldVulkan = com.droiddeck.launcher.session.VenusComponent.hostVulkanTooOld(activity) - val venus = oldVulkan == null && com.droiddeck.launcher.session.VenusComponent.available(activity) + val venusByUser = venusExplicit() + val venus = MaliAutoRoute.venusStandsIn( + com.droiddeck.launcher.session.VenusComponent.available(activity), oldVulkan == null, + SessionPrefs.venus(activity), venusByUser, gpu.name, + ) if (oldVulkan != null) Log.i(TAG, "auto: Mali driver reports Vulkan $oldVulkan; Venus needs 1.2, the bridge stands in") val ownership = MaliAutoRoute.fallbackOwnership( venus, SessionPrefs.vkBridge(activity), bridgeExplicit(), - SessionPrefs.venus(activity), venusExplicit(), + SessionPrefs.venus(activity), venusByUser, ) if (venus && !SessionPrefs.venus(activity)) { SessionPrefs.setVenus(activity, true) if (SessionPrefs.vkBridge(activity) && !bridgeExplicit()) SessionPrefs.setVkBridge(activity, false) SessionPrefs.setMaliFallbackByAuto(activity, ownership) - } else if (!venus && !SessionPrefs.vkBridge(activity)) { - SessionPrefs.setVkBridge(activity, true) - SessionPrefs.setMaliFallbackByAuto(activity, ownership) + } else if (!venus) { + val venusOff = SessionPrefs.venus(activity) && !venusByUser + val bridgeOn = !SessionPrefs.vkBridge(activity) + if (venusOff) SessionPrefs.clearVenus(activity) + if (bridgeOn) SessionPrefs.setVkBridge(activity, true) + if (venusOff || bridgeOn || ownership != MaliAutoRoute.NONE) SessionPrefs.setMaliFallbackByAuto(activity, ownership) } else if (ownership != MaliAutoRoute.NONE) { SessionPrefs.setMaliFallbackByAuto(activity, ownership) } @@ -467,7 +474,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl /** A pair is installed for this Mali: the route Auto switched on in its place goes off again. */ private fun endMaliFallback() { when (SessionPrefs.maliFallbackByAuto(activity)) { - "venus" -> SessionPrefs.setVenus(activity, false) + "venus" -> SessionPrefs.clearVenus(activity) "bridge" -> SessionPrefs.setVkBridge(activity, false) else -> return } diff --git a/app/src/main/java/com/droiddeck/launcher/MaliAutoRoute.kt b/app/src/main/java/com/droiddeck/launcher/MaliAutoRoute.kt index f4ebf2f0f7..1906b6aa51 100644 --- a/app/src/main/java/com/droiddeck/launcher/MaliAutoRoute.kt +++ b/app/src/main/java/com/droiddeck/launcher/MaliAutoRoute.kt @@ -26,6 +26,12 @@ internal object MaliAutoRoute { fun userChoice(keyStored: Boolean, owner: String, route: String): Boolean = keyStored && owner != route + fun venusStandsIn(available: Boolean, hostVulkanOk: Boolean, venusOn: Boolean, venusExplicit: Boolean, gpuName: String): Boolean = + available && hostVulkanOk && if (venusExplicit) venusOn else !venusStallsOn(gpuName) + + // Steam's web helper dies on its first window through Venus on these (#2879), so the bridge stands in. + fun venusStallsOn(gpuName: String): Boolean = gpuName.contains("G2-Ultra", ignoreCase = true) + fun shouldEnd(ownsRoute: String, mali: Boolean, installedPair: Boolean): Boolean = mali && installedPair && ownsRoute != NONE } diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index fc867959cd..a040ef9de8 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -1229,6 +1229,11 @@ object SessionPrefs { prefs(context).edit().putBoolean("venus", on).apply() } + /** Venus off with no choice stored, so that Auto turning it off does not read as the user's own choice. */ + fun clearVenus(context: Context) { + prefs(context).edit().remove("venus").apply() + } + fun setVkBridge(context: Context, on: Boolean) { prefs(context).edit().putBoolean("vkBridge", on).putBoolean("bridgeFellBack", false).apply() } diff --git a/app/src/test/java/com/droiddeck/launcher/MaliAutoRouteTest.kt b/app/src/test/java/com/droiddeck/launcher/MaliAutoRouteTest.kt index 6e7895c5e5..d30092f25e 100644 --- a/app/src/test/java/com/droiddeck/launcher/MaliAutoRouteTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/MaliAutoRouteTest.kt @@ -50,4 +50,28 @@ class MaliAutoRouteTest { assertTrue(MaliAutoRoute.userChoice(true, MaliAutoRoute.VENUS, MaliAutoRoute.BRIDGE)) assertFalse(MaliAutoRoute.userChoice(false, MaliAutoRoute.NONE, MaliAutoRoute.BRIDGE)) } + + @Test + fun venusTheUserSwitchedOffIsNotSwitchedBackOn() { + assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, true, "Mali-G715")) + assertTrue(MaliAutoRoute.venusStandsIn(true, true, true, true, "Mali-G2-Ultra-NX MC12")) + } + + @Test + fun venusIsAutosStandInOnlyWhereSteamStartsThroughIt() { + assertTrue(MaliAutoRoute.venusStandsIn(true, true, false, false, "Mali-G715")) + assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, false, "Mali-G2-Ultra-NX MC12")) + assertFalse(MaliAutoRoute.venusStandsIn(true, true, true, false, "Mali-G2-Ultra-NX MC16")) + assertFalse(MaliAutoRoute.venusStandsIn(false, true, true, true, "Mali-G715")) + assertFalse(MaliAutoRoute.venusStandsIn(true, false, true, true, "Mali-G715")) + } + + @Test + fun venusThatAutoTurnedOffIsStillAutosToTurnOn() { + // Auto clears the stored key when it moves to the bridge: a stored "off" would read as the user's own choice. + val cleared = MaliAutoRoute.userChoice(keyStored = false, owner = MaliAutoRoute.BRIDGE, route = MaliAutoRoute.VENUS) + val writtenOff = MaliAutoRoute.userChoice(keyStored = true, owner = MaliAutoRoute.BRIDGE, route = MaliAutoRoute.VENUS) + assertTrue(MaliAutoRoute.venusStandsIn(true, true, false, cleared, "Mali-G715")) + assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, writtenOff, "Mali-G715")) + } } From 861121144c7eec508e26e25fadb8f6384b853e50 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 29 Nov 2026 19:33:55 -0500 Subject: [PATCH 098/120] fix(xbox): try the next listed executable when one is missing (#3446) A package can list several PC executables while shipping only some of them. Try each listed executable in order and fail only when none of them exist. --- .../launcher/stores/xbox/XboxManifest.kt | 13 ++++----- .../launcher/stores/xbox/XboxManifestTest.kt | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxManifest.kt b/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxManifest.kt index b33d1d0d77..1f6cb7851d 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxManifest.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/xbox/XboxManifest.kt @@ -94,17 +94,16 @@ internal object XboxManifest { } fun executable(folder: File): String { - for (path in read(folder).executables) { + val listed = read(folder).executables + for (path in listed) { require(!path.startsWith('/') && !path.contains(':') && path.split('/').none { it == ".." || it.isEmpty() }) - var file = folder - for (part in path.split('/')) { - val matches = file.listFiles().orEmpty().filter { it.name.equals(part, true) } - require(matches.size == 1) { "Missing or ambiguous Xbox launch path." } - file = matches.single() - } + val file = path.split('/').fold(folder) { dir, part -> + dir?.listFiles().orEmpty().filter { it.name.equals(part, true) }.singleOrNull() + } ?: continue require(file.canonicalPath.startsWith(folder.canonicalPath + File.separator)) if (file.isFile) return forwarded(folder, file) ?: file.relativeTo(folder).invariantSeparatorsPath } + require(listed.isEmpty()) { "Missing or ambiguous Xbox launch path." } error("The Xbox package has no supported PC launch executable.") } diff --git a/app/src/test/java/com/droiddeck/launcher/stores/xbox/XboxManifestTest.kt b/app/src/test/java/com/droiddeck/launcher/stores/xbox/XboxManifestTest.kt index cb0a7bf0cc..5c3cd5c637 100644 --- a/app/src/test/java/com/droiddeck/launcher/stores/xbox/XboxManifestTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/stores/xbox/XboxManifestTest.kt @@ -16,6 +16,34 @@ class XboxManifestTest { java.io.File(root, "MicrosoftGame.Config").writeText("") assertEquals("Bin/Game.exe", XboxInstaller.executable(root)) } + @Test fun aListedExecutableThePackageDoesNotShipFallsThroughToTheNextOne() { + val root = temporary.newFolder() + java.io.File(root, "bin/x64_dx12").mkdirs() + java.io.File(root, "bin/x64_dx12/game.exe").writeText("encrypted") + java.io.File(root, "MicrosoftGame.config").writeText("" + + "" + + "" + + "") + assertEquals("bin/x64_dx12/game.exe", XboxInstaller.executable(root)) + } + @Test fun anAmbiguouslyCasedExecutableFallsThroughToTheNextOne() { + val root = temporary.newFolder() + java.io.File(root, "Game.exe").writeText("one") + java.io.File(root, "GAME.exe").writeText("two") + java.io.File(root, "Other.exe").writeText("three") + org.junit.Assume.assumeTrue(root.listFiles().orEmpty().count { it.name.equals("game.exe", true) } == 2) + java.io.File(root, "MicrosoftGame.config").writeText("" + + "") + assertEquals("Other.exe", XboxInstaller.executable(root)) + } + @Test fun aPackageWithNoneOfItsListedExecutablesStillFails() { + val root = temporary.newFolder() + java.io.File(root, "Unlisted.exe").writeText("encrypted") + java.io.File(root, "MicrosoftGame.config").writeText("" + + "") + val failure = assertThrows(IllegalArgumentException::class.java) { XboxInstaller.executable(root) } + assertEquals("Missing or ambiguous Xbox launch path.", failure.message) + } @Test fun aLauncherMenuIsSkippedForTheProgramItNames() { val root = temporary.newFolder() java.io.File(root, "EmuMenu").mkdir() From a9e8a01bb6bb700d93edd1a5a53651ef73c4231f Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 29 Nov 2026 19:44:11 -0500 Subject: [PATCH 099/120] fix(native): prepare the rootfs before a helper starts outside a session (#3447) Prepare the rootfs before a native program starts outside a session The linker and libc are patched for Android's seccomp filter only when a session starts. A helper started between sessions, after a runtime update and before the first session, ran the unpatched linker and died of SIGSYS (exit code 159). The shared native process builder now prepares the rootfs itself when no session is running. --- .../droiddeck/launcher/runtime/NativeGuest.kt | 7 +- .../runtime/NativeGuestPrepareTest.kt | 79 +++++++++++++++++++ 2 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 app/src/test/java/com/droiddeck/launcher/runtime/NativeGuestPrepareTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/NativeGuest.kt b/app/src/main/java/com/droiddeck/launcher/runtime/NativeGuest.kt index 49541416eb..babaae550a 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/NativeGuest.kt +++ b/app/src/main/java/com/droiddeck/launcher/runtime/NativeGuest.kt @@ -112,8 +112,9 @@ object NativeGuest { File(BwrapSpawner.hostPath(binds.map { BwrapSpawner.Bind.parse(it) }, root.path, cwd)).takeIf { it.isDirectory } ?: root /** A process for [guest] (argv) started as proot would with [binds], in guest directory [cwd]. */ - fun processBuilder(context: Context, root: File, binds: List, guest: List, cwd: String = "/root"): ProcessBuilder = - ProcessBuilder(command(root, guest.first(), guest.drop(1))) + fun processBuilder(context: Context, root: File, binds: List, guest: List, cwd: String = "/root"): ProcessBuilder { + if (sessionMode == null) prepare(context, root) + return ProcessBuilder(command(root, guest.first(), guest.drop(1))) .directory(workingDirectory(root, binds, cwd)) .also { builder -> builder.environment().apply { @@ -121,6 +122,7 @@ object NativeGuest { putAll(sessionEnvironment(root, binds, guest.first(), SessionPrefs.guestHostname(context))) } } + } private const val RUNPATH_CONF = "etc/ld.so.conf.d/zz-droiddeck-native.conf" private val SCAN_DIRS = listOf("usr/lib", "usr/local/lib", "opt") @@ -149,6 +151,7 @@ object NativeGuest { } /** What a rootfs needs before anything runs in it natively; cheap once done. */ + @Synchronized fun prepare(context: Context, root: File) { val relinked = relinkAbsoluteSymlinks(context, root) if (relinked > 0) android.util.Log.i(TAG, "native userland: $relinked absolute symlinks made relative") diff --git a/app/src/test/java/com/droiddeck/launcher/runtime/NativeGuestPrepareTest.kt b/app/src/test/java/com/droiddeck/launcher/runtime/NativeGuestPrepareTest.kt new file mode 100644 index 0000000000..e5bc975892 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/runtime/NativeGuestPrepareTest.kt @@ -0,0 +1,79 @@ +package com.droiddeck.launcher.runtime + +import androidx.test.core.app.ApplicationProvider +import java.io.File +import java.nio.ByteBuffer +import java.nio.ByteOrder +import java.nio.file.Files +import org.junit.After +import org.junit.Assert.assertArrayEquals +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner + +@RunWith(RobolectricTestRunner::class) +class NativeGuestPrepareTest { + private val svc = 0xd4000001.toInt() + private val rseq = 0xd28024a8.toInt() + private val enosys = 0x928004a0.toInt() + + private fun unpatchedLoader(): ByteArray { + val data = ByteArray(0x200) + val b = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN) + b.put(0, 0x7f); b.put(1, 'E'.code.toByte()); b.put(2, 'L'.code.toByte()); b.put(3, 'F'.code.toByte()) + b.put(4, 2); b.put(5, 1) + b.putShort(18, 183) + b.putLong(32, 64) + b.putShort(54, 56); b.putShort(56, 1) + b.putInt(64, 1); b.putInt(68, 5) + b.putLong(72, 0x100); b.putLong(96, 0x100) + b.putInt(0x100, rseq); b.putInt(0x104, svc) + return data + } + + private fun rootWithUnpatchedLoader(): Pair { + val root = Files.createTempDirectory("native-prepare").toFile() + val loader = File(root, "usr/lib/ld-linux-aarch64.so.1") + loader.parentFile!!.mkdirs() + loader.writeBytes(unpatchedLoader()) + return root to loader + } + + private fun instructionAfterRseq(loader: File): Int = + ByteBuffer.wrap(loader.readBytes()).order(ByteOrder.LITTLE_ENDIAN).getInt(0x104) + + @After + fun endSession() { + NativeGuest.sessionMode = null + } + + @Test + fun aProgramStartedOutsideASessionGetsALoaderThatSurvivesSeccomp() { + val (root, loader) = rootWithUnpatchedLoader() + NativeGuest.sessionMode = null + NativeGuest.processBuilder(ApplicationProvider.getApplicationContext(), root, emptyList(), listOf("/usr/bin/true")) + assertEquals(enosys, instructionAfterRseq(loader)) + } + + @Test + fun aProgramStartedInARunningSessionLeavesTheRootfsAsTheSessionPreparedIt() { + val (root, loader) = rootWithUnpatchedLoader() + val before = loader.readBytes() + NativeGuest.sessionMode = true + NativeGuest.processBuilder(ApplicationProvider.getApplicationContext(), root, emptyList(), listOf("/usr/bin/true")) + assertArrayEquals(before, loader.readBytes()) + } + + @Test + fun anAlreadyPreparedLoaderIsNotRewritten() { + val (root, loader) = rootWithUnpatchedLoader() + NativeGuest.processBuilder(ApplicationProvider.getApplicationContext(), root, emptyList(), listOf("/usr/bin/true")) + val modified = loader.lastModified() + val bytes = loader.readBytes() + loader.setLastModified(modified - 10_000) + NativeGuest.processBuilder(ApplicationProvider.getApplicationContext(), root, emptyList(), listOf("/usr/bin/true")) + assertArrayEquals(bytes, loader.readBytes()) + assertEquals(modified - 10_000, loader.lastModified()) + } +} From 780c5658d0c85a86a11074397d9085c743ec5b5f Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 29 Nov 2026 20:24:20 -0500 Subject: [PATCH 100/120] fix(input): each pad is listed once in Windows games so both triggers read together (#3436) * fix(input): each pad is listed once in Windows games so both triggers read together A pad that Wine's SDL backend also reads was described to Wine's udev backend as a Steam Input virtual pad, so Wine built two devices for one pad. SDL RawInput games could not match the two and read held triggers as released. The pad now keeps the identity the SDL backend sees unless that backend is told to skip it. Rumble that Wine starts through SDL is now held until the next update, matching the udev path, instead of stopping after one second. * fix(input): hold only the rumble Wine starts through SDL, not later SDL rumble in the same process * fix(input): read @file SDL ignore lists when choosing the pad identity SDL reads the ignore and except lists from a file when the value starts with @. Match the ring pad ID against that file's contents too. * fix(input): parse SDL controller ID lists the way SDL does when choosing the pad identity --- tools/linuxfs/preload/inputudev.c | 121 +++++++++++++++++++-- tools/tests/test_inputudev_preload.py | 66 ++++++++++- tools/tests/test_winebus_rumble_preload.py | 73 ++++++++++++- 3 files changed, 246 insertions(+), 14 deletions(-) diff --git a/tools/linuxfs/preload/inputudev.c b/tools/linuxfs/preload/inputudev.c index 346541c347..a8ced09425 100644 --- a/tools/linuxfs/preload/inputudev.c +++ b/tools/linuxfs/preload/inputudev.c @@ -34,6 +34,8 @@ "NAME=\"Xbox 360 Controller (%d)\"\n" \ "PHYS=\"usb-fakeinput/input%d\"\n" +#define RING_SDL_ID 0x045e028eu + #define PARENT_NAME "droiddeck-input" #define PARENT_SYSPATH_FORMAT "/sys/devices/droiddeck%d/" PARENT_NAME "%d" #define EVENT_SYSPATH_FORMAT PARENT_SYSPATH_FORMAT "/event%d" @@ -49,6 +51,8 @@ struct pad { int live; }; +static const char *ring_uevent_format(void); + static struct pad pads[PAD_MAX]; static struct pad parents[PAD_MAX]; static int pad_count; @@ -89,7 +93,7 @@ static void discover_pads(void) { snprintf(pad->syspath, sizeof(pad->syspath), EVENT_SYSPATH_FORMAT, (int)slot, (int)slot, (int)slot); snprintf(pad->devnode, sizeof(pad->devnode), "/dev/input/event%ld", slot); - snprintf(pad->uevent, sizeof(pad->uevent), PAD_UEVENT_FORMAT, (int)slot, (int)slot); + snprintf(pad->uevent, sizeof(pad->uevent), ring_uevent_format(), (int)slot, (int)slot); pad->devnum = makedev(13, EVENT_MINOR_BASE + (unsigned int)slot); pad->node = (int)slot; pad->live = 1; @@ -137,6 +141,68 @@ static int any_virtual_pad(void) { return 0; } +static char *sdl_id_list_text(const char *list) { + char *text = NULL; + char *grown; + size_t length = 0; + size_t got; + FILE *file; + + if (list[0] != '@') return strdup(list); + file = fopen(list + 1, "re"); + if (file == NULL) return NULL; + do { + grown = realloc(text, length + 4097); + if (grown == NULL) { + free(text); + fclose(file); + return NULL; + } + text = grown; + got = fread(text + length, 1, 4096, file); + length += got; + } while (got > 0); + fclose(file); + text[length] = '\0'; + return text; +} + +static int sdl_id_list_entries(const char *list, int *has_ring) { + char *text = sdl_id_list_text(list); + char *spot = text; + uint32_t entry; + int entries = 0; + + *has_ring = 0; + if (text == NULL) return 0; + while ((spot = strstr(spot, "0x")) != NULL) { + entry = (uint32_t)(uint16_t)strtol(spot, &spot, 0) << 16; + spot = strstr(spot, "0x"); + if (spot == NULL) break; + entry |= (uint16_t)strtol(spot, &spot, 0); + entries++; + if (entry == RING_SDL_ID) *has_ring = 1; + } + free(text); + return entries; +} + +static int sdl_bus_skips_ring_pad(void) { + const char *steam_virtual = getenv("FAKE_EVDEV_STEAM_VIRTUAL"); + const char *except = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"); + const char *ignore = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES"); + int has_ring; + + if (steam_virtual != NULL && atoi(steam_virtual) != 0) return 1; + if (except != NULL && sdl_id_list_entries(except, &has_ring) > 0) return !has_ring; + return ignore != NULL && sdl_id_list_entries(ignore, &has_ring) > 0 && has_ring; +} + +static const char *ring_uevent_format(void) { + if (uinput_enabled() && any_virtual_pad()) return PAD_PHYSICAL_UEVENT_FORMAT; + return sdl_bus_skips_ring_pad() ? PAD_UEVENT_FORMAT : PAD_PHYSICAL_UEVENT_FORMAT; +} + static void refresh_locked(int node) { struct pad *pad = &pads[node]; @@ -167,9 +233,7 @@ static void refresh_locked(int node) { } else { snprintf(pad->devnode, sizeof(pad->devnode), "/dev/input/event%d", node); pad->live = 1; - if (uinput_enabled()) - snprintf(pad->uevent, sizeof(pad->uevent), - any_virtual_pad() ? PAD_PHYSICAL_UEVENT_FORMAT : PAD_UEVENT_FORMAT, node, node); + snprintf(pad->uevent, sizeof(pad->uevent), ring_uevent_format(), node, node); } } sync_parent(node); @@ -441,11 +505,48 @@ static void *next_symbol(const char *name) { char *dd_cached_realpath(const char *path, char *resolved, char *(*real)(const char *, char *)) __attribute__((visibility("hidden"))); -static int caller_is_winebus(void *caller) { +static int caller_in_library(void *caller, const char *library) { Dl_info info; if (dladdr(caller, &info) == 0 || info.dli_fname == NULL) return 0; - return strstr(info.dli_fname, "winebus.so") != NULL; + return strstr(info.dli_fname, library) != NULL; +} + +static int caller_is_winebus(void *caller) { return caller_in_library(caller, "winebus.so"); } + +typedef int (*sdl_rumble_fn)(void *, uint16_t, uint16_t, uint32_t); +static _Atomic(sdl_rumble_fn) real_sdl_rumble; +static __thread int winebus_sdl_call; + +static int winebus_sdl_rumble(void *joystick, uint16_t low, uint16_t high, uint32_t duration) { + sdl_rumble_fn real = atomic_load_explicit(&real_sdl_rumble, memory_order_acquire); + int result; + + if (!caller_is_winebus(__builtin_return_address(0))) return real(joystick, low, high, duration); + if (low != 0 || high != 0) duration = 0; + winebus_sdl_call = 1; + result = real(joystick, low, high, duration); + winebus_sdl_call = 0; + return result; +} + +static void *winebus_sdl_rumble_dlsym(void *handle, const char *name) { + (void)handle; + (void)name; + return (void *)winebus_sdl_rumble; +} + +static void *sdl_rumble_target(void *handle, void *(*forward)(void *, const char *)) { + sdl_rumble_fn expected = NULL; + sdl_rumble_fn found; + + if (handle == RTLD_NEXT || handle == RTLD_DEFAULT) return NULL; + found = (sdl_rumble_fn)forward(handle, "SDL_JoystickRumble"); + if (found == NULL) return NULL; + atomic_compare_exchange_strong_explicit(&real_sdl_rumble, &expected, found, memory_order_acq_rel, + memory_order_acquire); + if (atomic_load_explicit(&real_sdl_rumble, memory_order_acquire) != found) return NULL; + return (void *)winebus_sdl_rumble_dlsym; } __attribute__((visibility("hidden"))) int dd_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd, @@ -454,7 +555,8 @@ __attribute__((visibility("hidden"))) int dd_winebus_rumble_ioctl(int (*real)(in struct ff_effect *effect = arg; __u16 length; - if (request != EVIOCSFF || effect == NULL || effect->type != FF_RUMBLE || !caller_is_winebus(caller)) return 0; + if (request != EVIOCSFF || effect == NULL || effect->type != FF_RUMBLE) return 0; + if (!caller_is_winebus(caller) && !(winebus_sdl_call && caller_in_library(caller, "libSDL"))) return 0; length = effect->replay.length; effect->replay.length = 0; *rc = real(fd, request, arg); @@ -1195,7 +1297,10 @@ static void *own_dlsym(void *handle, const char *name) { __attribute__((visibility("hidden"), used)) void *inputudev_dlsym_target(void *handle, const char *name) { void *forward = real_dlsym(); - (void)handle; + if (forward != NULL && name != NULL && strcmp(name, "SDL_JoystickRumble") == 0) { + void *rumble = sdl_rumble_target(handle, forward); + if (rumble != NULL) return rumble; + } if (name != NULL && strncmp(name, "udev_", 5) == 0 && own_udev_symbol(name) != NULL && !steam_client_process()) return (void *)own_dlsym; diff --git a/tools/tests/test_inputudev_preload.py b/tools/tests/test_inputudev_preload.py index 06f8a8f95f..0c4020ab8a 100644 --- a/tools/tests/test_inputudev_preload.py +++ b/tools/tests/test_inputudev_preload.py @@ -260,6 +260,7 @@ static void *(*next)(void *); static void *(*by_name)(void *, const char *); static const char *(*name)(void *); static const char *(*value)(void *); +static const char *(*sysattr)(void *, const char *); static void *sym(const char *symbol) { return dlsym(lib, symbol); } @@ -463,6 +464,20 @@ static void run_every(int count, char **entries) { printf("pad %d real calls %d\n", pad != NULL, real_calls != NULL ? *real_calls : -1); } +static void print_product(const char *label, void *device) { + const char *uevent = device != NULL ? sysattr(device, "uevent") : NULL; + + printf("%s %.*s\n", label, uevent != NULL ? (int)strcspn(uevent, "\n") : 4, uevent != NULL ? uevent : "none"); +} + +static void run_identity(void) { + int udev; + void *device = new_device(&udev, PAD); + + print_product("pad", device); + print_product("parent", device != NULL ? get_parent(device) : NULL); +} + static void run_probe(void) { int udev; @@ -539,7 +554,9 @@ int main(int argc, char **argv) { by_name = sym("udev_list_entry_get_by_name"); name = sym("udev_list_entry_get_name"); value = sym("udev_list_entry_get_value"); + sysattr = sym("udev_device_get_sysattr_value"); if (strcmp(argv[1], "probe") == 0) run_probe(); + else if (strcmp(argv[1], "identity") == 0) run_identity(); else if (strcmp(argv[1], "every") == 0) run_every(argc - 3, argv + 3); else if (strcmp(argv[1], "stable") == 0) run_stable(); else if (strcmp(argv[1], "enumerate") == 0) run_enumerate(); @@ -597,10 +614,13 @@ class InputUdevPreloadTest(unittest.TestCase): (pads / node).write_text("") return pads - def run_program(self, mode, *preloads, pads=None, slots="0=/pad", program=None, args=()): + def run_program(self, mode, *preloads, pads=None, slots="0=/pad", program=None, args=(), extra=None): env = dict(os.environ, LD_PRELOAD=":".join(str(self.dir / name) for name in ("libddsession.so", *preloads)), FAKE_EVDEV_MEMFD_PATHS=slots, FAKE_EVDEV_DIR=str(pads or self.pads)) - env.pop("FAKE_EVDEV_UINPUT", None) + for key in ("FAKE_EVDEV_UINPUT", "FAKE_EVDEV_STEAM_VIRTUAL", "SDL_GAMECONTROLLER_IGNORE_DEVICES", + "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"): + env.pop(key, None) + env.update(extra or {}) result = subprocess.run([str(program or self.program), mode, str(self.udev), *args], env=env, capture_output=True, text=True, timeout=20) self.assertEqual(result.returncode, 0, result.stderr) @@ -684,6 +704,48 @@ class InputUdevPreloadTest(unittest.TestCase): "nothing added scan -1", ]) + def identity(self, pads=None, **extra): + return self.run_program("identity", pads=pads, extra=extra) + + @classmethod + def id_list(cls, name, text): + path = cls.dir / name + path.write_text(text) + return "@" + str(path) + + def test_a_pad_wine_also_reads_through_sdl_is_described_as_the_pad_sdl_sees(self): + xbox = ["pad PRODUCT=3/45e/28e/110", "parent PRODUCT=3/45e/28e/110"] + for extra in ({}, {"FAKE_EVDEV_UINPUT": "1"}, {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x045e/0x028e"}, {"FAKE_EVDEV_STEAM_VIRTUAL": "0"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-other.txt", "0x28de/0x1142\n")}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "@" + str(self.dir / "missing.txt")}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": self.id_list("except-ring.txt", "0x045E/0x028E\n")}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x45e/0x28e"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": ""}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028f"}): + with self.subTest(**extra): + self.assertEqual(self.identity(**extra), xbox) + + def test_a_pad_sdl_skips_keeps_the_steam_input_identity(self): + steam = ["pad PRODUCT=6/28de/11ff/110", "parent PRODUCT=6/28de/11ff/110"] + for extra in ({"FAKE_EVDEV_STEAM_VIRTUAL": "1"}, {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142,0x045E/0x028E"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x28de/0x11ff"}, + {"FAKE_EVDEV_UINPUT": "1", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028e"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-ring.txt", "0x28de/0x1142\n0x045e/0x028e\n")}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": self.id_list("except-other.txt", "0x28de/0x11ff\n")}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-long.txt", "0x28de/0x1142\n" * 400 + "0x045e/0x028e\n")}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x45e/0x28e"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028e"}): + with self.subTest(**extra): + self.assertEqual(self.identity(**extra), steam) + + def test_a_pad_under_steam_inputs_own_virtual_pad_stays_an_xbox_pad(self): + pads = self.pad_dir("under-virtual", "event0", "event16") + (pads / ".uinput-event16.uevent").write_text('PRODUCT=6/28de/11ff/1\nNAME="Microsoft X-Box 360 pad 0"\n') + self.assertEqual(self.identity(pads, FAKE_EVDEV_UINPUT="1", SDL_GAMECONTROLLER_IGNORE_DEVICES="0x045e/0x028e"), + ["pad PRODUCT=3/45e/28e/110", "parent PRODUCT=3/45e/28e/110"]) + def test_a_program_that_closes_and_reopens_libudev_keeps_working(self): self.assertEqual(self.run_program("reload"), ["reload real0 real1"]) diff --git a/tools/tests/test_winebus_rumble_preload.py b/tools/tests/test_winebus_rumble_preload.py index a18f541e7a..71616e7128 100644 --- a/tools/tests/test_winebus_rumble_preload.py +++ b/tools/tests/test_winebus_rumble_preload.py @@ -40,6 +40,39 @@ void upload(unsigned short type, unsigned short length) { } """ +SDL = r""" +#include +#include +#include +#include +#include + +int SDL_JoystickRumble(void *joystick, uint16_t low, uint16_t high, uint32_t duration) { + struct ff_effect effect; + (void)joystick; + printf("sdl %u %u duration %u\n", low, high, duration); + memset(&effect, 0, sizeof(effect)); + effect.id = -1; + effect.type = FF_RUMBLE; + effect.replay.length = 0xffff; + effect.u.rumble.strong_magnitude = low; + effect.u.rumble.weak_magnitude = high; + return ioctl(3, EVIOCSFF, &effect); +} +""" + +SDL_CALLER = r""" +#include +#include + +int rumble(const char *library, uint16_t low, uint16_t high, uint32_t duration) { + void *sdl = dlopen(library, RTLD_NOW | RTLD_LOCAL); + int (*call)(void *, uint16_t, uint16_t, uint32_t) = (int (*)(void *, uint16_t, uint16_t, uint32_t))dlsym(sdl, "SDL_JoystickRumble"); + call(0, low, high, duration); + return 0; +} +""" + PROGRAM = r""" #include #include @@ -47,8 +80,21 @@ PROGRAM = r""" void upload(unsigned short type, unsigned short length); +int rumble(const char *library, unsigned short low, unsigned short high, unsigned int duration); + int main(int argc, char **argv) { void *winebus = dlopen(argv[1], RTLD_NOW); + if (argv[2][0] == 's') { + int (*from_winebus)(const char *, unsigned short, unsigned short, unsigned int) = + (int (*)(const char *, unsigned short, unsigned short, unsigned int))dlsym(winebus, "rumble"); + for (const char *step = argv[3]; *step; step++) { + if (*step == 'w') from_winebus(argv[4], 65535, 32768, 1000); + if (*step == 'z') from_winebus(argv[4], 0, 0, 0); + if (*step == 'p') rumble(argv[4], 65535, 32768, 1000); + } + fflush(stdout); + return 0; + } void (*from_winebus)(unsigned short, unsigned short) = (void (*)(unsigned short, unsigned short))dlsym(winebus, "upload"); if (argv[2][0] == 'w') from_winebus(argv[3][0] == 'r' ? FF_RUMBLE : FF_PERIODIC, 1000); else upload(FF_RUMBLE, 1000); @@ -65,7 +111,8 @@ class WinebusRumblePreloadTest(unittest.TestCase): cls.dir = Path(tempfile.mkdtemp()) build = cls.dir / "build" build.mkdir() - for name, text in (("shim.c", SHIM), ("upload.c", UPLOAD), ("program.c", PROGRAM)): + for name, text in (("shim.c", SHIM), ("upload.c", UPLOAD), ("program.c", PROGRAM), ("sdl.c", SDL), + ("sdl_caller.c", SDL_CALLER)): (build / name).write_text(text) cls.lib = cls.dir / "libddsession.so" subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-Wall", "-pthread", "-o", str(cls.lib), @@ -73,10 +120,13 @@ class WinebusRumblePreloadTest(unittest.TestCase): cls.shim = cls.dir / "libshim.so" subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.shim), str(build / "shim.c")], check=True) cls.winebus = cls.dir / "winebus.so" - subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.winebus), str(build / "upload.c")], check=True) + subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.winebus), str(build / "upload.c"), + str(build / "sdl_caller.c"), "-ldl"], check=True) + cls.sdl_library = cls.dir / "libSDL2-2.0.so.0" + subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.sdl_library), str(build / "sdl.c")], check=True) cls.program = cls.dir / "program" - subprocess.run(["cc", "-O2", "-o", str(cls.program), str(build / "program.c"), str(build / "upload.c"), "-ldl"], - check=True) + subprocess.run(["cc", "-O2", "-o", str(cls.program), str(build / "program.c"), str(build / "upload.c"), + str(build / "sdl_caller.c"), "-ldl"], check=True) @classmethod def tearDownClass(cls): @@ -88,6 +138,21 @@ class WinebusRumblePreloadTest(unittest.TestCase): capture_output=True, text=True, timeout=10, check=True) return result.stdout.splitlines() + def sdl(self, steps): + env = dict(os.environ, LD_PRELOAD="%s:%s" % (self.lib, self.shim)) + result = subprocess.run([str(self.program), str(self.winebus), "sdl", steps, str(self.sdl_library)], env=env, + capture_output=True, text=True, timeout=10, check=True) + return result.stdout.splitlines() + + def test_rumble_winebus_starts_through_sdl_is_held_until_the_next_update(self): + self.assertEqual(self.sdl("wz"), ["sdl 65535 32768 duration 0", "shim type %d length 0" % 0x50, + "sdl 0 0 duration 0", "shim type %d length 0" % 0x50]) + + def test_sdl_rumble_from_other_code_keeps_its_duration_and_length(self): + self.assertEqual(self.sdl("p"), ["sdl 65535 32768 duration 1000", "shim type %d length 65535" % 0x50]) + self.assertEqual(self.sdl("wp"), ["sdl 65535 32768 duration 0", "shim type %d length 0" % 0x50, + "sdl 65535 32768 duration 1000", "shim type %d length 65535" % 0x50]) + def test_winebus_rumble_reaches_the_shim_held_and_comes_back_unchanged(self): self.assertEqual(self.upload("winebus"), ["shim type %d length 0" % 0x50, "caller length 1000"]) From c6743730aa15c78e158a3a2dd534340be5edf51d Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 29 Nov 2026 20:24:34 -0500 Subject: [PATCH 101/120] Keep a signed-in store's Library tab when its game list is empty or failed to load (#3449) --- .../java/com/droiddeck/launcher/ui/LibraryPage.kt | 6 +++++- .../com/droiddeck/launcher/ui/LibraryEntriesTest.kt | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt index f7bd8e9f20..4a7575d275 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt @@ -195,6 +195,10 @@ internal fun librarySources( } } +internal fun alwaysLibraryTabs(signedIn: Collection, stores: Boolean, soundMode: Boolean): Set = + (if (soundMode) emptyList() else signedIn.map { it.librarySource }).toSet() + + listOfNotNull(Library.ADDED.takeIf { stores }, Store.BATTLENET.id.takeIf { stores }) + internal object LibraryDisplay { const val DEFAULT_LEVEL = 2 val scales = listOf(0.75f, 0.875f, 1f, 1.2f, 1.45f) @@ -374,7 +378,7 @@ internal fun LibraryPage(s: FrontEndState, a: FrontEndActions, selected: String, .map { it.store.id }.toSet() val sources = librarySources( all, storeTabs.map { it.store.id }, - listOfNotNull(Store.ITCH.id.takeIf { itchSignedIn && !soundMode }, Store.GAMEJOLT.id.takeIf { gameJoltSignedIn && !soundMode }, Library.ADDED.takeIf { stores }, Store.BATTLENET.id.takeIf { stores }).toSet() + signInChips, + alwaysLibraryTabs(owned.keys, stores, soundMode) + signInChips, favorites, concealed, offStores = if (soundMode) emptySet() else storeTabs.filterNot { it.shown }.map { it.store.id }.toSet(), places = if (soundMode) DEFAULT_LIBRARY_PLACES else StoreTabsState.libraryPlaces, diff --git a/app/src/test/java/com/droiddeck/launcher/ui/LibraryEntriesTest.kt b/app/src/test/java/com/droiddeck/launcher/ui/LibraryEntriesTest.kt index 7cbf6ffc72..a47bc8aa9b 100644 --- a/app/src/test/java/com/droiddeck/launcher/ui/LibraryEntriesTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/ui/LibraryEntriesTest.kt @@ -122,6 +122,19 @@ class LibraryEntriesTest { assertEquals(listOf("steam", "xbox", "itch", "gamejolt"), librarySources(entries, listOf("xbox", "itch", "gamejolt"), setOf("itch", "gamejolt"))) } + @Test fun everySignedInStoreKeepsItsTabWhenItsLibraryIsEmptyOrFailedToLoad() { + val entries = listOf(LibraryEntry("epic:1", "epic", "Game", null, null, true)) + val order = listOf("epic", Store.ROCKSTAR.id, "gog") + val always = alwaysLibraryTabs(listOf(Store.STEAM, Store.ROCKSTAR), stores = true, soundMode = false) + assertEquals(listOf("steam", "epic", "rockstar", "battlenet", "added"), librarySources(entries, order, always)) + } + + @Test fun signedOutStoresAndSoundtrackModeDoNotGainEmptyTabs() { + assertEquals(setOf("added", "battlenet"), alwaysLibraryTabs(emptyList(), stores = true, soundMode = false)) + assertEquals(setOf("added", "battlenet"), alwaysLibraryTabs(listOf(Store.STEAM, Store.ROCKSTAR), stores = true, soundMode = true)) + assertEquals(emptySet(), alwaysLibraryTabs(emptyList(), stores = false, soundMode = false)) + } + @Test fun gameKeysNameEitherAnAppOrAStoreProduct() { GameRef.parse("app:440").let { assertEquals(440, it.appId); assertNull(it.store) } GameRef.parse("app:-12").let { assertEquals(-12, it.appId) } From 57055be6fb1a755a816400955c3a332e3242bf19 Mon Sep 17 00:00:00 2001 From: LarzVader <118484383+LarzVader@users.noreply.github.com> Date: Mon, 30 Nov 2026 03:13:54 +0100 Subject: [PATCH 102/120] fix(ci): Robolectric's jar cache is saved again, and a Maven 429 runs the unit tests again (#3418) * fix(ci): Robolectric's jar cache is saved again, and a Maven 429 runs the unit tests again * fix(ci): retry Gradle artifact download rate limits too * fix(ci): restrict Maven retry to dependency download exceptions --------- Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> --- .github/workflows/build.yml | 22 +++++++++++++++++----- tools/tests/test_ci_checks.py | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b32d1b442..d713d0f493 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -740,7 +740,8 @@ jobs: echo "version=$(grep -o "org.robolectric:robolectric:[0-9.]*" app/build.gradle | cut -d: -f3)" >> "$GITHUB_OUTPUT" # Robolectric downloads these from Maven Central on first use without retrying, and 429s fail whole test classes. # The cache path sits beside the workspace because runner homes are at different depths from it, and - # actions/cache stores paths relative to the workspace. Runners that keep their own ~/.m2 skip the cache. + # actions/cache stores paths relative to the workspace. It is passed as an absolute path: the save action rejects + # "..". Runners that keep their own ~/.m2 skip the cache. - name: Place Robolectric's Android jars beside the workspace id: robolectric-jars run: | @@ -751,7 +752,9 @@ jobs: echo "cache=false" >> "$GITHUB_OUTPUT" else mkdir -p "$jars" "$(dirname "$m2")" - ln -sfn "$(cd "$jars" && pwd)" "$m2" + jars=$(cd "$jars" && pwd) + ln -sfn "$jars" "$m2" + echo "path=$jars" >> "$GITHUB_OUTPUT" echo "cache=true" >> "$GITHUB_OUTPUT" fi - name: Restore Robolectric's Android jars @@ -759,7 +762,7 @@ jobs: if: steps.robolectric-jars.outputs.cache == 'true' uses: actions/cache/restore@v4 with: - path: ../robolectric-jars + path: ${{ steps.robolectric-jars.outputs.path }} key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }} restore-keys: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}- - name: Count the restored Robolectric jars @@ -773,7 +776,16 @@ jobs: run: | set -o pipefail mkdir -p app/build - ./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log + # A Maven 429 fails every test class that needs the missing jar. The jars an attempt did get stay for the next. + for wait in 60 180 0; do + status=0 + ./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log || status=$? + if [ "$status" = 0 ] || [ "$wait" = 0 ] || ! grep -Eq '^[[:space:]]*(Caused by: org\.gradle\.internal\.resource\.transport\.http\.HttpErrorStatusCodeException: Could not GET .*https://repo\.maven\.apache\.org/.*Received status code 429 from server|Caused by: java\.io\.IOException: Server returned HTTP response code: 429 for URL: https://repo\.maven\.apache\.org/)' app/build/unit-tests.log; then + exit "$status" + fi + echo "::warning::Maven Central answered 429; running the unit tests again in ${wait}s" + sleep "$wait" + done # actions/cache only saves when the job succeeds, so a run whose tests died on a Maven 429 never filled the cache. # Save the complete jars even after a failed test step, when this run added some; a partial download is dropped first. @@ -800,7 +812,7 @@ jobs: if: always() && steps.robolectric-jars-final.outputs.save == 'true' uses: actions/cache/save@v4 with: - path: ../robolectric-jars + path: ${{ steps.robolectric-jars.outputs.path }} key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }} - name: Upload unit test diagnostics diff --git a/tools/tests/test_ci_checks.py b/tools/tests/test_ci_checks.py index ad6ae6858d..a5982366ac 100644 --- a/tools/tests/test_ci_checks.py +++ b/tools/tests/test_ci_checks.py @@ -24,6 +24,28 @@ class CiChecksTest(unittest.TestCase): gradle = (ROOT / 'app/build.gradle').read_text() self.assertIn("gitValue(['show', '-s', '--format=%ct', '--end-of-options', sourceCommit])", gradle) + def test_robolectric_cache_saves_and_restores_the_same_absolute_path(self): + steps = yaml.safe_load((ROOT / '.github/workflows/build.yml').read_text())['jobs']['build']['steps'] + caches = [step['with'] for step in steps if step.get('uses', '').startswith('actions/cache')] + for cache in caches: + for path in cache['path'].split('\n'): + self.assertNotIn('..', path.split('/')) + robolectric = [cache['path'] for cache in caches if cache['key'].startswith('robolectric-')] + self.assertEqual(robolectric, ['${{ steps.robolectric-jars.outputs.path }}'] * 2) + + def test_unit_test_retry_requires_maven_exception(self): + steps = yaml.safe_load((ROOT / '.github/workflows/build.yml').read_text())['jobs']['build']['steps'] + run = next(step['run'] for step in steps if step.get('id') == 'unit-tests') + line = next(line for line in run.splitlines() if 'grep -Eq' in line) + pattern = shlex.split(line)[shlex.split(line).index('-Eq') + 1] + for log, expected in ( + ("Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not GET 'https://repo.maven.apache.org/maven2/a.jar'. Received status code 429 from server: Too Many Requests", 0), + ("Caused by: java.io.IOException: Server returned HTTP response code: 429 for URL: https://repo.maven.apache.org/maven2/a.jar", 0), + ("SomeTest > test FAILED: Too Many Requests", 1), + ("Caused by: java.lang.AssertionError: HTTP 429", 1), + ): + self.assertEqual(subprocess.run(['grep', '-Eq', pattern], input=log, text=True).returncode, expected) + def test_report_comment_lookup_ignores_human_marker(self): if not shutil.which('jq'): self.skipTest('jq required to execute comment selection') From 0951b602b7eda3bb8debd6808e57de3fadcb70cf Mon Sep 17 00:00:00 2001 From: Tamim Kabir <204907199+Necomer0920@users.noreply.github.com> Date: Sun, 29 Nov 2026 22:51:30 -0500 Subject: [PATCH 103/120] fix(input): programs built with _FORTIFY_SOURCE read the virtual pads (#2916) * fix(input): programs built with _FORTIFY_SOURCE read the virtual pads Fortified builds, Flatpak runtimes among them, call __read_chk, __poll_chk and __ppoll_chk in place of read, poll and ppoll, and glibc's versions go straight to the kernel. Such programs opened a pad through the shim but read its backing ring file instead of events, so they never saw input: Marathon Recompiled's SDL reads the pad through __read_chk. The shim now provides all three, with glibc's bounds checks, on the same paths as read, poll and ppoll. * fix(input): keep glibc's __read_chk for descriptors that are not pads Only pad descriptors take the shim's read path; the rest go to the next __read_chk, so fortified reads keep libc's cancellation point. The test also polls the empty ring with a zero timeout, which a __poll_chk that bypasses the shim would report as ready. --------- Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> --- app/src/main/cpp/fakeinput_steam.cpp | 22 ++++++++++++++++++++++ tools/tests/test_fakeinput_ring.py | 24 +++++++++++++++++++++--- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/fakeinput_steam.cpp b/app/src/main/cpp/fakeinput_steam.cpp index 2e0aaa927d..2bfcb76202 100644 --- a/app/src/main/cpp/fakeinput_steam.cpp +++ b/app/src/main/cpp/fakeinput_steam.cpp @@ -4130,6 +4130,17 @@ EXPORT ssize_t read(int fd, void *buf, size_t count) { return read_input(fd, buf, count); } +extern "C" [[noreturn]] void __chk_fail(void); + +/* Programs built with _FORTIFY_SOURCE (Flatpak runtimes among them) call these instead of read, poll + * and ppoll, and glibc's versions go straight to the kernel. */ +EXPORT ssize_t __read_chk(int fd, void *buf, size_t count, size_t buflen) { + static auto next_read_chk = reinterpret_cast(dlsym(RTLD_NEXT, "__read_chk")); + if (count > buflen) __chk_fail(); + if (next_read_chk && !is_fake_input_fd(fd)) return next_read_chk(fd, buf, count, buflen); + return read_input(fd, buf, count); +} + EXPORT ssize_t readv(int fd, const struct iovec *iov, int iovcnt) { if (!is_fake_input_fd(fd)) return syscall(SYS_readv, fd, iov, iovcnt); if (iovcnt < 0 || iovcnt > IOV_MAX) { @@ -4378,6 +4389,17 @@ EXPORT int ppoll(struct pollfd *fds, nfds_t nfds, return my_ppoll(fds, nfds, timeout, sigmask); } +EXPORT int __poll_chk(struct pollfd *fds, nfds_t nfds, int timeout, size_t fdslen) { + if (fdslen / sizeof(*fds) < nfds) __chk_fail(); + return poll(fds, nfds, timeout); +} + +EXPORT int __ppoll_chk(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, + const sigset_t *sigmask, size_t fdslen) { + if (fdslen / sizeof(*fds) < nfds) __chk_fail(); + return ppoll(fds, nfds, timeout, sigmask); +} + EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { const auto my_select = next_symbol(Next::select); diff --git a/tools/tests/test_fakeinput_ring.py b/tools/tests/test_fakeinput_ring.py index b032f8ea76..c3d625fbc7 100644 --- a/tools/tests/test_fakeinput_ring.py +++ b/tools/tests/test_fakeinput_ring.py @@ -29,14 +29,21 @@ PAD_TYPE_STEAM = 1 READER = r""" #include #include +#include #include #include #include +ssize_t __read_chk(int fd, void *buffer, size_t size, size_t buffer_size); +int __poll_chk(struct pollfd *fds, nfds_t nfds, int timeout, size_t fds_size); + static int vector_count; +static int fortified; static ssize_t controller_read(int fd, void *buffer, size_t size) { + if (fortified) + return __read_chk(fd, buffer, size, size); if (!vector_count) return read(fd, buffer, size); struct iovec vectors[3] = { @@ -53,7 +60,8 @@ static ssize_t controller_read(int fd, void *buffer, size_t size) int main(int argc, char **argv) { - vector_count = argc > 1 ? (argv[1][0] == '1' ? 1 : 3) : 0; + fortified = argc > 1 && argv[1][0] == 'f'; + vector_count = argc > 1 && !fortified ? (argv[1][0] == '1' ? 1 : 3) : 0; struct input_event events[64]; int fd = open("/dev/input/event16", O_RDONLY | O_NONBLOCK); if (fd < 0) { @@ -62,11 +70,17 @@ int main(int argc, char **argv) } while (controller_read(fd, events, sizeof(events)) > 0) ; + struct pollfd idle = {fd, POLLIN, 0}; + if (fortified && __poll_chk(&idle, 1, 0, sizeof(idle)) != 0) + return 3; puts("ready"); fflush(stdout); char go; if (read(0, &go, 1) != 1) return 1; + struct pollfd ready = {fd, POLLIN, 0}; + if (fortified && (__poll_chk(&ready, 1, 1000, sizeof(ready)) != 1 || !(ready.revents & POLLIN))) + return 2; ssize_t got = controller_read(fd, events, sizeof(events)); for (ssize_t i = 0; i < got / (ssize_t)sizeof(events[0]); i++) printf("%ld.%06ld %u %u %d\n", (long)events[i].time.tv_sec, (long)events[i].time.tv_usec, events[i].type, @@ -345,7 +359,7 @@ class FakeinputRingTest(unittest.TestCase): subprocess.run(["gcc", bits, "-o", str(binary), str(self.tmp / (name + ".c"))], check=True) return library, binary - def read_through(self, bits, vectors=None, overlay=False, virtual=True, program=READER): + def read_through(self, bits, vectors=None, overlay=False, virtual=True, program=READER, fortified=False): if not virtual: program = program.replace("event16", "event0") library, reader = self.build(bits, program, "reader") @@ -359,7 +373,7 @@ class FakeinputRingTest(unittest.TestCase): overlay_library = self.tmp / "overlay.so" subprocess.run(["gcc", bits, "-shared", "-fPIC", "-o", str(overlay_library), str(source)], check=True) env["LD_PRELOAD"] = str(overlay_library) + ":" + str(library) - command = [str(reader)] + ([str(vectors)] if vectors else []) + command = [str(reader)] + (["fortified"] if fortified else [str(vectors)] if vectors else []) process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=env, text=True) self.addCleanup(process.kill) self.assertEqual(process.stdout.readline(), "ready\n") @@ -381,6 +395,10 @@ class FakeinputRingTest(unittest.TestCase): self.assertEqual(self.read_through("-m64"), "1700000000.250000 1 304 1\n1700000001.250000 3 1 -32768\n1700000002.250000 0 0 0\n") + def test_a_fortified_guest_polls_and_reads_the_ring(self): + self.assertEqual(self.read_through("-m64", virtual=False, fortified=True), + "1700000000.250000 1 304 1\n1700000001.250000 3 1 -32768\n1700000002.250000 0 0 0\n") + def test_readv_reads_events_instead_of_the_backing_file(self): self.assertEqual(self.read_through("-m64", vectors=1), "1700000000.250000 1 304 1\n1700000001.250000 3 1 -32768\n1700000002.250000 0 0 0\n") From ff35cce12761e3eb2b7472dbd729e17762cc09eb Mon Sep 17 00:00:00 2001 From: Unixcision Date: Mon, 30 Nov 2026 04:51:35 +0100 Subject: [PATCH 104/120] fix(steam): GTA III on Steam starts a new game (full x87 precision for app 12100) (#3197) The Steam copy (AppID 12100) died on "Start new game" at 0042A703: FEX's reduced x87 precision turns a float into a bad pointer. GameEnvironment.knownGames sets FEX_X87REDUCEDPRECISION=0 for it, above the shared settings and below the game's own, and picking a FEX preset for the game keeps the fix. Co-authored-by: Unixcision <14082251+Unixcision@users.noreply.github.com> Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> --- .../launcher/core/GameEnvironment.kt | 22 ++++++++++++++++--- .../launcher/session/GameEnvironmentStore.kt | 2 +- .../launcher/core/GameEnvironmentTest.kt | 18 +++++++++++++++ .../session/GameEnvironmentStoreTest.kt | 12 ++++++++-- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/core/GameEnvironment.kt b/app/src/main/java/com/droiddeck/launcher/core/GameEnvironment.kt index 55e7e61284..711a50eca3 100644 --- a/app/src/main/java/com/droiddeck/launcher/core/GameEnvironment.kt +++ b/app/src/main/java/com/droiddeck/launcher/core/GameEnvironment.kt @@ -61,7 +61,19 @@ object GameEnvironment { } fun effective(config: Config, preset: String, scope: String, forceSsbs: Boolean = false): Map = - defaults(preset, forceSsbs) + config.shared + if (scope.isEmpty()) emptyMap() else config.games[scope].orEmpty() + defaults(preset, forceSsbs) + config.shared + if (scope.isEmpty()) emptyMap() else knownGames[scope].orEmpty() + config.games[scope].orEmpty() + + /** + * What some Steam games need here whatever the shared settings say; the game's own settings still win. + * GTA III dies at 0042A703 when a new game starts with FEX's reduced x87 precision, as the Rockstar store copy does. + */ + val knownGames: Map> = mapOf( + "12100" to mapOf("FEX_X87REDUCEDPRECISION" to "0"), + ) + + /** [config] with [knownGames] folded under each game's own settings, for the guest to read. */ + fun withKnownGames(config: Config): Config = + config.copy(games = config.games + knownGames.mapValues { (scope, known) -> known + config.games[scope].orEmpty() }) fun hasOverride(config: Config, scope: String, name: String): Boolean = scope.isNotEmpty() && config.entries(scope).containsKey(name) @@ -78,7 +90,7 @@ object GameEnvironment { val entries = config.games[scope].orEmpty() if (FexPreset.environmentKeys.none(entries::containsKey)) return null return FexPreset.all.firstOrNull { preset -> - val expected = FexPreset.environment(preset.id) + val expected = presetFor(scope, preset.id) FexPreset.environmentKeys.all { key -> entries.containsKey(key) && entries[key] == expected[key] } }?.id ?: CUSTOM_FEX_PRESET } @@ -88,12 +100,16 @@ object GameEnvironment { require(preset == null || FexPreset.all.any { it.id == preset }) val entries = config.entries(scope).filterKeys { it !in FexPreset.environmentKeys }.toMutableMap() if (preset != null) { - val values = FexPreset.environment(preset) + val values = presetFor(scope, preset) FexPreset.environmentKeys.forEach { key -> entries[key] = values[key] } } return config.withEntries(scope, entries) } + /** A FEX preset as a game gets it: picking one never undoes a fix the game is known to need. */ + private fun presetFor(scope: String, preset: String): Map = + FexPreset.environment(preset) + knownGames[scope].orEmpty().filterKeys { it in FexPreset.environmentKeys } + const val CUSTOM_FEX_PRESET = "__custom__" val syncBackends = listOf(SessionPrefs.SYNC_NTSYNC, SessionPrefs.SYNC_FSYNC, SessionPrefs.SYNC_ESYNC, SessionPrefs.SYNC_WINESERVER) diff --git a/app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt b/app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt index 708c1bcada..099cf7f46d 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt @@ -114,7 +114,7 @@ object GameEnvironmentStore { ) { publishGameCores(context) val stored = config ?: read(context) - val resolved = stored.copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + stored.shared) + val resolved = GameEnvironment.withKnownGames(stored).copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + stored.shared) val json = encode(resolved) val dxvk = TextureFiltering.dxvkOptions( SessionPrefs.textureAnisotropy(context), SessionPrefs.textureLodBias(context), diff --git a/app/src/test/java/com/droiddeck/launcher/core/GameEnvironmentTest.kt b/app/src/test/java/com/droiddeck/launcher/core/GameEnvironmentTest.kt index 219ecad5a1..f4a27ea825 100644 --- a/app/src/test/java/com/droiddeck/launcher/core/GameEnvironmentTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/core/GameEnvironmentTest.kt @@ -20,6 +20,24 @@ class GameEnvironmentTest { assertEquals("1", GameEnvironment.effective(config, "", "43", forceSsbs = true)[GameEnvironment.FORCE_SSBS]) } + @Test fun knownGameFixesBeatSharedSettingsButNotTheGamesOwn() { + val shared = GameEnvironment.Config(shared = mapOf("FEX_X87REDUCEDPRECISION" to "1")) + assertEquals("0", GameEnvironment.effective(shared, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"]) + assertEquals("1", GameEnvironment.effective(shared, "PERFORMANCE_TSO", "12110")["FEX_X87REDUCEDPRECISION"]) + val own = shared.withEntries("12100", mapOf("FEX_X87REDUCEDPRECISION" to "1")) + assertEquals("1", GameEnvironment.effective(own, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"]) + assertEquals("1", GameEnvironment.withKnownGames(own).games["12100"]?.get("FEX_X87REDUCEDPRECISION")) + assertEquals("0", GameEnvironment.withKnownGames(shared).games["12100"]?.get("FEX_X87REDUCEDPRECISION")) + } + + @Test fun aGamePresetKeepsTheGamesKnownFix() { + val picked = GameEnvironment.withGameFexPreset(GameEnvironment.Config(), "12100", "PERFORMANCE") + assertEquals("0", GameEnvironment.effective(picked, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"]) + assertEquals("PERFORMANCE", GameEnvironment.gameFexPreset(picked, "12100")) + val other = GameEnvironment.withGameFexPreset(GameEnvironment.Config(), "12110", "PERFORMANCE") + assertEquals("1", GameEnvironment.effective(other, "PERFORMANCE_TSO", "12110")["FEX_X87REDUCEDPRECISION"]) + } + @Test fun gameOverridesSharedAndPresetWithoutLeakingToOtherGames() { val config = GameEnvironment.Config( shared = mapOf("FEX_MULTIBLOCK" to "0", "VKD3D_FEATURE_LEVEL" to "12_2"), diff --git a/app/src/test/java/com/droiddeck/launcher/session/GameEnvironmentStoreTest.kt b/app/src/test/java/com/droiddeck/launcher/session/GameEnvironmentStoreTest.kt index 3765997350..f48d51b1ca 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/GameEnvironmentStoreTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/GameEnvironmentStoreTest.kt @@ -202,11 +202,19 @@ class GameEnvironmentStoreTest { assertEquals("false", published.shared["MESA_SHADER_CACHE_DISABLE"]) assertFalse(published.shared.containsKey("VKD3D_FEATURE_LEVEL")) assertFalse(published.shared.containsKey("VKD3D_SHADER_MODEL")) - assertEquals(config.games, published.games) + assertEquals(config.games + GameEnvironment.knownGames, published.games) assertEquals(config.shared["LITERAL"], published.shared["LITERAL"]) assertEquals("", published.shared["EMPTY"]) } + @Test fun aKnownGamesFixReachesTheGuestWithoutBeingSavedAsTheUsersSetting() { + GameEnvironmentStore.save(context, GameEnvironment.Config()) + assertEquals(emptyMap>(), GameEnvironmentStore.read(context).games) + val published = GameEnvironmentStore.decode(JSONObject(guest.readText())) + assertEquals(GameEnvironment.knownGames, published.games) + assertEquals("0", published.entries("12100")["FEX_X87REDUCEDPRECISION"]) + } + @Test fun publishingPreservesExplicitSharedGraphicsCapabilities() { val config = GameEnvironment.Config(shared = mapOf( "VKD3D_FEATURE_LEVEL" to "12_1", "VKD3D_SHADER_MODEL" to "6_6", @@ -266,7 +274,7 @@ class GameEnvironmentStoreTest { assertEquals(original.entries("43"), saved.entries("43")) assertEquals("PERFORMANCE_TSO", SessionPrefs.fexPreset(context)) val published = GameEnvironmentStore.decode(JSONObject(guest.readText())) - assertEquals(saved.games, published.games) + assertEquals(saved.games + GameEnvironment.knownGames, published.games) assertEquals("0", published.shared["FEX_HALFBARRIERTSOENABLED"]) assertEquals("1", published.entries("42")["FEX_HALFBARRIERTSOENABLED"]) } From 4ef23ed0e9aa160e0b996cbd1700813aa5d57aad Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 29 Nov 2026 23:04:31 -0500 Subject: [PATCH 105/120] Return to the DroidDeck UI when logging out of the desktop (#3374) * fix(desktop): Log Out returns to DroidDeck, Return to Gaming Mode opens Steam Both ended Plasma through the same logout call and the desktop script always started Steam afterwards. Return to Gaming Mode now leaves a request that the script reads; a plain Log Out ends the desktop. The app ships the shortcut with the script so both always change together. * Wait for the logout reply so a cold Shutdown service still gets the request * Forget the return to gaming mode when the logout request fails --- .../launcher/session/SessionFiles.kt | 1 + .../droiddeck-return-gaming.desktop | 9 --- tools/linuxfs/desktop/droiddeck-desktop | 6 +- .../desktop/droiddeck-return-gaming.desktop | 9 +++ tools/release/check_session_assets.py | 1 + tools/tests/test_desktop_return_gaming.py | 75 +++++++++++++++++++ .../droiddeck-return-gaming.desktop | 9 --- 7 files changed, 91 insertions(+), 19 deletions(-) delete mode 100644 tools/desktop-kde/overlay/usr/share/applications/droiddeck-return-gaming.desktop create mode 100644 tools/linuxfs/desktop/droiddeck-return-gaming.desktop create mode 100644 tools/tests/test_desktop_return_gaming.py delete mode 100644 tools/ubuntu/overlay-desktop/usr/share/applications/droiddeck-return-gaming.desktop diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionFiles.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionFiles.kt index aa240b6ed0..0858e6fefd 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionFiles.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionFiles.kt @@ -35,6 +35,7 @@ object SessionFiles { "usr/local/bin/kwin_wayland_wrapper" to "usr/local/bin/kwin_wayland_wrapper", "usr/lib/firefox/defaults/pref/droiddeck.js" to "usr/lib/firefox/defaults/pref/droiddeck.js", "etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop", + "usr/share/applications/droiddeck-return-gaming.desktop" to "usr/share/applications/droiddeck-return-gaming.desktop", "etc/xdg/fastfetch/config.jsonc" to "etc/xdg/fastfetch/config.jsonc", ) diff --git a/tools/desktop-kde/overlay/usr/share/applications/droiddeck-return-gaming.desktop b/tools/desktop-kde/overlay/usr/share/applications/droiddeck-return-gaming.desktop deleted file mode 100644 index 67f1d7f218..0000000000 --- a/tools/desktop-kde/overlay/usr/share/applications/droiddeck-return-gaming.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=Return to Gaming Mode -Comment=Log out of the desktop and go back to Steam -Exec=dbus-send --session --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout -Icon=steamdeck-gaming-return -Terminal=false -Type=Application -StartupNotify=false -NoDisplay=true diff --git a/tools/linuxfs/desktop/droiddeck-desktop b/tools/linuxfs/desktop/droiddeck-desktop index 7be3ccab5d..01840825af 100644 --- a/tools/linuxfs/desktop/droiddeck-desktop +++ b/tools/linuxfs/desktop/droiddeck-desktop @@ -229,12 +229,16 @@ fi if ! /usr/local/bin/droiddeck-pipewire start; then echo "== pipewire: not running; screen capture has no picture" fi +return_gaming=/run/droiddeck/return-gaming +mkdir -p /run/droiddeck +rm -f "$return_gaming" echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY" dbus-run-session -- startplasma-wayland rc=$? /usr/local/bin/droiddeck-pipewire stop echo "== droiddeck-desktop: Plasma ended ($rc)" -if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ]; then +if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ] && [ -e "$return_gaming" ]; then + rm -f "$return_gaming" /usr/local/bin/droiddeck-steam-launch bigpicture sleep 30 fi diff --git a/tools/linuxfs/desktop/droiddeck-return-gaming.desktop b/tools/linuxfs/desktop/droiddeck-return-gaming.desktop new file mode 100644 index 0000000000..a4dd347002 --- /dev/null +++ b/tools/linuxfs/desktop/droiddeck-return-gaming.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Return to Gaming Mode +Comment=Log out of the desktop and go back to Steam +Exec=sh -c ": > /run/droiddeck/return-gaming; dbus-send --session --print-reply --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout >/dev/null || rm -f /run/droiddeck/return-gaming" +Icon=steamdeck-gaming-return +Terminal=false +Type=Application +StartupNotify=false +NoDisplay=true diff --git a/tools/release/check_session_assets.py b/tools/release/check_session_assets.py index dc0828bec0..8d2eb0b75a 100644 --- a/tools/release/check_session_assets.py +++ b/tools/release/check_session_assets.py @@ -32,6 +32,7 @@ def source_assets(overlay=OVERLAY): result[desktop / name] = 'assets/linuxfs/usr/local/bin/' + name result[desktop / 'firefox-droiddeck.js'] = 'assets/linuxfs/usr/lib/firefox/defaults/pref/droiddeck.js' result[desktop / 'droiddeck-clipboard.desktop'] = 'assets/linuxfs/etc/xdg/autostart/droiddeck-clipboard.desktop' + result[desktop / 'droiddeck-return-gaming.desktop'] = 'assets/linuxfs/usr/share/applications/droiddeck-return-gaming.desktop' result[desktop / 'fastfetch.jsonc'] = 'assets/linuxfs/etc/xdg/fastfetch/config.jsonc' result[overlay.parent.parent / 'mangoapp/mangoapp'] = 'assets/linuxfs/usr/local/bin/mangoapp' return result diff --git a/tools/tests/test_desktop_return_gaming.py b/tools/tests/test_desktop_return_gaming.py new file mode 100644 index 0000000000..d059205b5f --- /dev/null +++ b/tools/tests/test_desktop_return_gaming.py @@ -0,0 +1,75 @@ +import os +import re +import shlex +import subprocess +import tempfile +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +DESKTOP = ROOT / "tools/linuxfs/desktop" +SCRIPT = (DESKTOP / "droiddeck-desktop").read_text() +ENTRY = (DESKTOP / "droiddeck-return-gaming.desktop").read_text() + + +class DesktopReturnGamingTest(unittest.TestCase): + def session(self, logout, rc=0, bottom=False): + with tempfile.TemporaryDirectory() as tmp: + run = Path(tmp, "run") + launched = Path(tmp, "launched") + exec_line = re.search(r"^Exec=(.*)$", ENTRY, re.M).group(1) + inner = shlex.split(exec_line)[2].replace("dbus-send", "true") + plasma = Path(tmp, "plasma") + plasma.write_text("#!/bin/sh\n%s\nexit %d\n" % (inner if logout == "return" else ":", rc)) + plasma.chmod(0o755) + steam = Path(tmp, "steam-launch") + steam.write_text('#!/bin/sh\necho "$*" > %s\n' % launched) + steam.chmod(0o755) + tail = SCRIPT[SCRIPT.index("return_gaming="):] + tail = tail.replace("dbus-run-session -- startplasma-wayland", str(plasma)) + tail = tail.replace("/usr/local/bin/droiddeck-pipewire stop", ":") + tail = tail.replace("/usr/local/bin/droiddeck-steam-launch", str(steam)) + tail = tail.replace("sleep 30", ":") + tail = tail.replace("/run/droiddeck", str(run)) + plasma.write_text(plasma.read_text().replace("/run/droiddeck", str(run))) + env = {k: v for k, v in os.environ.items() if k != "DD_BOTTOM_DESKTOP"} + if bottom: + env["DD_BOTTOM_DESKTOP"] = "1" + run.mkdir() + (run / "return-gaming").write_text("") + status = subprocess.run(["sh", "-c", tail], env=env, capture_output=True, text=True).returncode + return status, launched.read_text().strip() if launched.exists() else None, (run / "return-gaming").exists() + + def test_return_to_gaming_mode_opens_steam(self): + self.assertEqual(self.session("return"), (0, "bigpicture", False)) + + def test_log_out_goes_back_without_steam_even_after_an_earlier_request(self): + self.assertEqual(self.session("logout"), (0, None, False)) + + def test_a_failed_session_and_the_bottom_desktop_never_open_steam(self): + self.assertEqual(self.session("return", rc=1)[:2], (1, None)) + self.assertEqual(self.session("return", bottom=True)[:2], (0, None)) + + def test_the_logout_request_outlives_starting_the_shutdown_service(self): + exec_line = re.search(r"^Exec=(.*)$", ENTRY, re.M).group(1) + call = shlex.split(shlex.split(exec_line)[2].split(";")[-1]) + self.assertEqual(call[0], "dbus-send") + self.assertIn("--print-reply", call) + + def test_a_rejected_logout_request_forgets_the_return_to_gaming_mode(self): + exec_line = re.search(r"^Exec=(.*)$", ENTRY, re.M).group(1) + with tempfile.TemporaryDirectory() as tmp: + inner = shlex.split(exec_line)[2].replace("/run/droiddeck", tmp) + for sender, kept in (("true", True), ("false", False)): + subprocess.run(["sh", "-c", inner.replace("dbus-send", sender, 1)], check=False) + self.assertEqual(Path(tmp, "return-gaming").exists(), kept) + + def test_the_app_ships_the_shortcut_with_the_script(self): + source = (ROOT / "app/src/main/java/com/droiddeck/launcher/session/SessionFiles.kt").read_text() + self.assertIn('"usr/share/applications/droiddeck-return-gaming.desktop" to ' + '"usr/share/applications/droiddeck-return-gaming.desktop"', source) + self.assertIn("droiddeck-return-gaming.desktop", (ROOT / "tools/release/check_session_assets.py").read_text()) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/ubuntu/overlay-desktop/usr/share/applications/droiddeck-return-gaming.desktop b/tools/ubuntu/overlay-desktop/usr/share/applications/droiddeck-return-gaming.desktop deleted file mode 100644 index 67f1d7f218..0000000000 --- a/tools/ubuntu/overlay-desktop/usr/share/applications/droiddeck-return-gaming.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=Return to Gaming Mode -Comment=Log out of the desktop and go back to Steam -Exec=dbus-send --session --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout -Icon=steamdeck-gaming-return -Terminal=false -Type=Application -StartupNotify=false -NoDisplay=true From 23d7e639ca18e4b7fc3ff51eeafb7164a6388e10 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 29 Nov 2026 23:38:39 -0500 Subject: [PATCH 106/120] fix(steam): mark ARM64-uninstallable tool dependencies installed (#3443) * fix(steam): mark ARM64-uninstallable tool dependencies installed The ARM64 client cannot install Proton EasyAntiCheat Runtime (1826330), which it refuses as an invalid platform, or that tool's Steam Linux Runtime 1.0 (scout) dependency (1070560), which has no ARM64 depot. After the EULA hand-off the client starts the dependency install and aborts in glibc's smallbin check. Write the bare installed manifest DroidDeck already uses for adopted games for those two tools before the client starts: only on the ARM64 client, only when appinfo shows no ARM64 depot, and never over a fully installed manifest. Refs: ValveSoftware/steam-for-linux#13937, DroidDeck #2313 * fix(steam): seed a tool only when no library has it installed, and write manifests atomically A partial manifest in the first library no longer hides a full install in another one, and a failed write leaves no truncated or stray manifest. * fix(steam): publish tool manifests without replacing concurrent installs --- .../overlay/usr/local/bin/droiddeck-session | 1 + .../overlay/usr/local/bin/steam-compatibility | 68 +++++- tools/tests/test_steam_tool_manifest_seed.py | 205 ++++++++++++++++++ 3 files changed, 272 insertions(+), 2 deletions(-) create mode 100644 tools/tests/test_steam_tool_manifest_seed.py diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index 79b0c149fe..c30c3098ec 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -1149,6 +1149,7 @@ case $mode in droiddeck-steam-library "$steam_root" || true step "setting up the ARM64 Proton compatibility tool" steam-compatibility "$steam_root" || true + steam-compatibility "$steam_root" --seed-arm64-tools || true if [ -z "${DD_DESKTOP:-}" ] && [ "${DD_STEAM_UI:-}" != desktop ]; then droiddeck-steam-ui-scale "$steam_root" "${DD_WIDTH:-1280}" "${DD_HEIGHT:-720}" || true fi diff --git a/tools/linuxfs/overlay/usr/local/bin/steam-compatibility b/tools/linuxfs/overlay/usr/local/bin/steam-compatibility index a0a3280d12..4eb7ba26f7 100755 --- a/tools/linuxfs/overlay/usr/local/bin/steam-compatibility +++ b/tools/linuxfs/overlay/usr/local/bin/steam-compatibility @@ -5,6 +5,7 @@ import re import runpy import shutil import sys +import tempfile TOOL = "droiddeck-proton-arm64" TOOL_11 = "droiddeck-proton-11-arm64" @@ -26,6 +27,8 @@ SNIPER_APPID = "1628350" SLR4_APPID = "4183110" FEX_DEPENDENCIES = (FEX_APPID, SNIPER_APPID, SLR4_APPID) REQUIRED_TOOLS = (PROTON_ARM64_APPID,) + FEX_DEPENDENCIES +ARM64_TOOL_DEPENDENCIES = (("1826330", "Proton EasyAntiCheat Runtime"), + ("1070560", "Steam Linux Runtime 1.0 (scout)")) # "0" = the app's "Valve Proton only when needed": Valve's ARM64 Proton is fetched only for a title or # default set to a tool built from it, or while no own Proton build is installed. VALVE_PROTON_ENV = "DD_VALVE_PROTON" @@ -1012,10 +1015,15 @@ def manifest_text(appid, name, installdir, bare=False): return text[:-2] + ' "AutoUpdateBehavior" "1"\n}\n' if bare else text -def app_manifest(steam_root, app): +def manifest_paths(steam_root, app): for library in libraries(steam_root): + yield os.path.join(library, "steamapps", "appmanifest_%s.acf" % app) + + +def app_manifest(steam_root, app): + for path in manifest_paths(steam_root, app): try: - with open(os.path.join(library, "steamapps", "appmanifest_%s.acf" % app), encoding="utf-8", errors="replace") as f: + with open(path, encoding="utf-8", errors="replace") as f: return tokenize(f.read()) except OSError: continue @@ -1030,6 +1038,57 @@ def manifest_flags(tokens): return 0 +def installed_manifest(path): + try: + with open(path, encoding="utf-8", errors="replace") as f: + return bool(manifest_flags(tokenize(f.read())) & FULLY_INSTALLED) + except OSError: + return False + + +def seed_unavailable_arm64_tools(steam_root): + entries = appinfo_entries(os.path.join(steam_root, "appcache", "appinfo.vdf"), + [app for app, _ in ARM64_TOOL_DEPENDENCIES]) + steamapps = os.path.join(steam_root, "steamapps") + os.makedirs(steamapps, exist_ok=True) + seeded = [] + for app, display in ARM64_TOOL_DEPENDENCIES: + entry = entries.get(app) + if entry is not None: + if entry["type"] not in ("", "tool"): + continue + if "arm64" in entry["osarch"] or "aarch64" in entry["osarch"]: + continue + existing = [p for p in manifest_paths(steam_root, app) if os.path.isfile(p)] + if any(installed_manifest(p) for p in existing): + continue + name = (entry or {}).get("name") or display + installdir = (entry or {}).get("installdir") or name + path = existing[0] if existing else os.path.join(steamapps, "appmanifest_%s.acf" % app) + temporary = None + try: + with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", + dir=os.path.dirname(path), + prefix=".appmanifest_", delete=False) as f: + temporary = f.name + f.write(manifest_text(app, name, installdir, True)) + if existing: + os.replace(temporary, path) + else: + os.link(temporary, path) + except OSError as e: + print("steam-compatibility: could not mark %s installed (%s)" % (app, e)) + continue + finally: + if temporary is not None: + try: + os.unlink(temporary) + except OSError: + pass + seeded.append(app) + return seeded + + def valve_proton_on_demand(): return os.environ.get(VALVE_PROTON_ENV) == "0" @@ -1801,6 +1860,11 @@ def main(): steam_root = sys.argv[1] if "--valve-proton-needed" in sys.argv[2:]: sys.exit(0 if valve_proton_needed(steam_root) else 1) + if "--seed-arm64-tools" in sys.argv[2:]: + seeded = seed_unavailable_arm64_tools(steam_root) + if seeded: + print("steam-compatibility: marked unavailable ARM64 tool(s) installed: %s" % ", ".join(seeded)) + return if "--x64" in sys.argv[2:]: x64_repoint(steam_root, os.environ.get("DD_COMPAT_TOOL"), "--live" in sys.argv[2:]) return diff --git a/tools/tests/test_steam_tool_manifest_seed.py b/tools/tests/test_steam_tool_manifest_seed.py new file mode 100644 index 0000000000..54d547c451 --- /dev/null +++ b/tools/tests/test_steam_tool_manifest_seed.py @@ -0,0 +1,205 @@ +import runpy +import tempfile +import unittest +from pathlib import Path +from unittest import mock + +from tools.tests.test_droiddeck_fex import AppInfoTest + +BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin" +SESSION = BIN / "droiddeck-session" +COMPAT = runpy.run_path(str(BIN / "steam-compatibility")) +EAC = 1826330 +SCOUT = 1070560 +EAC_ID = str(EAC) +SCOUT_ID = str(SCOUT) +EAC_NAME = "Proton EasyAntiCheat Runtime" +SCOUT_NAME = "Steam Linux Runtime 1.0 (scout)" + + +def tool(name, osarch="", kind="tool", installdir=None): + return { + "common": {"name": name, "oslist": "linux", "osarch": osarch, "type": kind}, + "config": {"installdir": installdir or name}, + } + + +class SteamToolManifestSeedTest(unittest.TestCase): + def setUp(self): + temporary = tempfile.TemporaryDirectory() + self.addCleanup(temporary.cleanup) + self.root = Path(temporary.name) + self.steam = self.root / "Steam" + (self.steam / "appcache").mkdir(parents=True) + (self.steam / "steamapps").mkdir() + self.entries = {EAC: tool(EAC_NAME), SCOUT: tool(SCOUT_NAME)} + self.write_appinfo() + + def write_appinfo(self, entries=None): + COMPAT["APPINFO_CACHE"].clear() + (self.steam / "appcache/appinfo.vdf").write_bytes( + AppInfoTest.appinfo(self.entries if entries is None else entries)) + + def manifest(self, app, root=None): + return (root or self.steam) / ("steamapps/appmanifest_%s.acf" % app) + + def seed(self): + return COMPAT["seed_unavailable_arm64_tools"](str(self.steam)) + + def test_seeds_bare_manifests_for_unavailable_tool_dependencies(self): + self.assertEqual(self.seed(), [EAC_ID, SCOUT_ID]) + for app, name in ((EAC_ID, EAC_NAME), (SCOUT_ID, SCOUT_NAME)): + text = self.manifest(app).read_text() + for expected in ('"appid" "%s"' % app, '"Universe" "1"', '"StateFlags" "4"', + '"name" "%s"' % name, '"installdir" "%s"' % name, + '"AutoUpdateBehavior" "1"'): + self.assertIn(expected, text) + self.assertFalse(self.manifest("976730").exists()) + + def test_seeding_is_idempotent(self): + self.seed() + first = {app: self.manifest(app).read_text() for app in (EAC_ID, SCOUT_ID)} + self.assertEqual(self.seed(), []) + self.assertEqual({app: self.manifest(app).read_text() for app in first}, first) + + def test_a_real_install_in_another_library_is_never_overwritten(self): + other = self.root / "SD" + (other / "steamapps").mkdir(parents=True) + existing = '"AppState"\n{\n\t"appid"\t"%s"\n\t"StateFlags"\t"4"\n}\n' % SCOUT_ID + (other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).write_text(existing) + (self.steam / "steamapps/libraryfolders.vdf").write_text( + '"libraryfolders"\n{\n\t"0"\n\t{\n\t\t"path"\t\t"%s"\n\t}\n}\n' % other) + self.assertEqual(self.seed(), [EAC_ID]) + self.assertFalse(self.manifest(SCOUT_ID).exists()) + self.assertEqual((other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).read_text(), existing) + + def test_a_partial_install_in_another_library_is_completed_in_place(self): + other = self.root / "SD" + (other / "steamapps").mkdir(parents=True) + partial = '"AppState"\n{\n\t"appid"\t"%s"\n\t"StateFlags"\t"2"\n}\n' % SCOUT_ID + (other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).write_text(partial) + (self.steam / "steamapps/libraryfolders.vdf").write_text( + '"libraryfolders"\n{\n\t"0"\n\t{\n\t\t"path"\t\t"%s"\n\t}\n}\n' % other) + self.assertEqual(self.seed(), [EAC_ID, SCOUT_ID]) + self.assertFalse(self.manifest(SCOUT_ID).exists()) + self.assertIn('"StateFlags" "4"', + (other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).read_text()) + + def test_a_real_install_in_any_library_wins_over_a_partial_one(self): + other = self.root / "SD" + (other / "steamapps").mkdir(parents=True) + partial = '"AppState"\n{\n\t"appid"\t"%s"\n\t"StateFlags"\t"2"\n}\n' % SCOUT_ID + installed = '"AppState"\n{\n\t"appid"\t"%s"\n\t"StateFlags"\t"4"\n}\n' % SCOUT_ID + self.manifest(SCOUT_ID).write_text(partial) + (other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).write_text(installed) + (self.steam / "steamapps/libraryfolders.vdf").write_text( + '"libraryfolders"\n{\n\t"0"\n\t{\n\t\t"path"\t\t"%s"\n\t}\n}\n' % other) + self.assertEqual(self.seed(), [EAC_ID]) + self.assertEqual(self.manifest(SCOUT_ID).read_text(), partial) + self.assertEqual((other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).read_text(), installed) + + def test_a_failed_write_leaves_no_manifest_behind(self): + real_link = COMPAT["os"].link + + def fail_for_scout(source, target): + if SCOUT_ID in str(target): + raise OSError("disk full") + return real_link(source, target) + + with mock.patch.object(COMPAT["os"], "link", side_effect=fail_for_scout): + self.assertEqual(self.seed(), [EAC_ID]) + self.assertFalse(self.manifest(SCOUT_ID).exists()) + self.assertEqual(sorted(p.name for p in (self.steam / "steamapps").iterdir()), + ["appmanifest_%s.acf" % EAC_ID]) + self.assertEqual(self.seed(), [SCOUT_ID]) + self.assertEqual(self.manifest(SCOUT_ID).read_text(), + COMPAT["manifest_text"](SCOUT_ID, SCOUT_NAME, SCOUT_NAME, True)) + + def test_new_manifest_publication_preserves_a_concurrent_install(self): + real_link = COMPAT["os"].link + installed = COMPAT["manifest_text"](SCOUT_ID, "Existing tool", "Existing", False) + + def publish(source, target): + if SCOUT_ID in str(target): + Path(target).write_text(installed) + return real_link(source, target) + + with mock.patch.object(COMPAT["os"], "link", side_effect=publish): + self.assertEqual(self.seed(), [EAC_ID]) + self.assertEqual(self.manifest(SCOUT_ID).read_text(), installed) + self.assertEqual(self.seed(), []) + self.assertFalse(list((self.steam / "steamapps").glob(".appmanifest_*"))) + + def test_partial_staged_write_is_not_published_and_retry_repairs(self): + real_temporary = COMPAT["tempfile"].NamedTemporaryFile + + def temporary(*args, **kwargs): + output = real_temporary(*args, **kwargs) + real_write = output.write + + def write(text): + if SCOUT_ID in text: + real_write(text[:text.index(' "installdir"')]) + output.flush() + raise OSError("disk full") + return real_write(text) + + output.write = write + return output + + with mock.patch.object(COMPAT["tempfile"], "NamedTemporaryFile", side_effect=temporary): + self.assertEqual(self.seed(), [EAC_ID]) + self.assertFalse(self.manifest(SCOUT_ID).exists()) + self.assertFalse(list((self.steam / "steamapps").glob(".appmanifest_*"))) + self.assertEqual(self.seed(), [SCOUT_ID]) + self.assertEqual(self.manifest(SCOUT_ID).read_text(), + COMPAT["manifest_text"](SCOUT_ID, SCOUT_NAME, SCOUT_NAME, True)) + + def test_failed_replacement_preserves_partial_manifest_and_retry_repairs(self): + partial = '"AppState" { "appid" "%s" "StateFlags" "2" }' % SCOUT_ID + self.manifest(SCOUT_ID).write_text(partial) + with mock.patch.object(COMPAT["os"], "replace", side_effect=OSError("disk full")): + self.assertEqual(self.seed(), [EAC_ID]) + self.assertEqual(self.manifest(SCOUT_ID).read_text(), partial) + self.assertFalse(list((self.steam / "steamapps").glob(".appmanifest_*"))) + self.assertEqual(self.seed(), [SCOUT_ID]) + self.assertEqual(self.manifest(SCOUT_ID).read_text(), + COMPAT["manifest_text"](SCOUT_ID, SCOUT_NAME, SCOUT_NAME, True)) + + def test_tools_with_an_arm64_depot_are_skipped(self): + entries = dict(self.entries) + entries[SCOUT] = tool(SCOUT_NAME, osarch="arm64") + self.write_appinfo(entries) + self.assertEqual(self.seed(), [EAC_ID]) + self.assertFalse(self.manifest(SCOUT_ID).exists()) + + def test_an_app_that_is_not_a_tool_is_skipped(self): + entries = dict(self.entries) + entries[SCOUT] = tool(SCOUT_NAME, kind="game") + self.write_appinfo(entries) + self.assertEqual(self.seed(), [EAC_ID]) + self.assertFalse(self.manifest(SCOUT_ID).exists()) + + def test_missing_appinfo_uses_the_display_names(self): + (self.steam / "appcache/appinfo.vdf").unlink() + COMPAT["APPINFO_CACHE"].clear() + self.assertEqual(self.seed(), [EAC_ID, SCOUT_ID]) + self.assertIn('"name" "%s"' % SCOUT_NAME, self.manifest(SCOUT_ID).read_text()) + + def test_flag_seeds_without_running_full_compatibility_setup(self): + with mock.patch.object(COMPAT["sys"], "argv", + ["steam-compatibility", str(self.steam), "--seed-arm64-tools"]): + COMPAT["main"]() + self.assertTrue(self.manifest(EAC_ID).is_file()) + self.assertTrue(self.manifest(SCOUT_ID).is_file()) + self.assertFalse((self.steam / "compatibilitytools.d").exists()) + + def test_session_seeds_only_on_the_arm64_client_path(self): + arm64, x64 = SESSION.read_text().split( + " else\n _dd_x64_tool=$(droiddeck-steam-x64 --default-tool)", 1) + self.assertIn('steam-compatibility "$steam_root" --seed-arm64-tools', arm64) + self.assertNotIn("--seed-arm64-tools", x64) + + +if __name__ == "__main__": + unittest.main() From aaa9fb129c49259723f90a362deb1401a28ed859 Mon Sep 17 00:00:00 2001 From: The412Banner <205237651+The412Banner@users.noreply.github.com> Date: Sun, 29 Nov 2026 23:58:32 -0500 Subject: [PATCH 107/120] fix(nativeguest): programs on a mount kept at its host path start as guest programs (#3211) --- tools/nativeguest/hook/exec.c | 6 ++-- tools/nativeguest/hook/exec_probe.c | 8 +++++ tools/nativeguest/hook/paths.c | 7 +++++ tools/tests/test_native_hook_ldso_spawn.py | 34 ++++++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/tools/nativeguest/hook/exec.c b/tools/nativeguest/hook/exec.c index eb2659f37d..546531c6dd 100644 --- a/tools/nativeguest/hook/exec.c +++ b/tools/nativeguest/hook/exec.c @@ -452,7 +452,8 @@ static int ddnatv_execve(const char *filename, char *const argv[], char *const e char resolved_target[PATH_MAX]; // Only intercept binaries/scripts within DDNATV_ROOT - if ((g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(filename)) { + if ((g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(filename) || + is_bound_guest_program(target)) { struct exec_probe probe; const char *elf_target = select_exec_target(target, resolved_target, sizeof(resolved_target), &probe); if (probe.is_elf && !probe.is_dynamic) static_elf = elf_target; @@ -969,7 +970,8 @@ static int ddnatv_posix_spawn(pid_t *pid, const char *path, } char *const *orig_ep = envp ? envp : environ; - int in_root = (g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(path); + int in_root = (g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(path) || + is_bound_guest_program(target); struct exec_probe probe; char resolved_target[PATH_MAX]; diff --git a/tools/nativeguest/hook/exec_probe.c b/tools/nativeguest/hook/exec_probe.c index be708e9158..32dabeb982 100644 --- a/tools/nativeguest/hook/exec_probe.c +++ b/tools/nativeguest/hook/exec_probe.c @@ -983,6 +983,14 @@ static int is_host_interpreter(const char *interp, const char *rewritten) { return probe.android_interp; } +static int is_bound_guest_program(const char *path) { + if (g_ddnatv_root[0] == '\0' || !is_identity_bound_path(path)) return 0; + struct exec_probe probe; + probe_exec_file(path, &probe); + if (probe.is_elf) return probe.is_dynamic && !probe.android_interp; + return probe.n >= 2 && probe.hdr[0] == '#' && probe.hdr[1] == '!'; +} + // argv for running `script` with its interpreter: interp [arg] script args... (the script's own // argv[0] is dropped, as the kernel does). free() the result. static char **build_script_argv(const char *interp, const char *interp_arg, const char *script, char *const argv[]) { diff --git a/tools/nativeguest/hook/paths.c b/tools/nativeguest/hook/paths.c index 616098df04..89605e1ebb 100644 --- a/tools/nativeguest/hook/paths.c +++ b/tools/nativeguest/hook/paths.c @@ -234,6 +234,13 @@ static int is_mapped_guest_path(const char *path) { return 0; } +static int is_identity_bound_path(const char *path) { + if (!path || path[0] != '/') return 0; + for (int i = 0; i < g_nbinds; i++) + if (g_binds[i].identity && is_path_prefix(path, g_binds[i].dst, g_binds[i].dst_len)) return 1; + return 0; +} + // Android's own mounts and files, which must never be redirected into the rootfs. // `path` starts with '/'; a prefix can only match when its second character does. static int is_android_host_path(const char *path) { diff --git a/tools/tests/test_native_hook_ldso_spawn.py b/tools/tests/test_native_hook_ldso_spawn.py index 8d8b417f82..37cd7402e9 100644 --- a/tools/tests/test_native_hook_ldso_spawn.py +++ b/tools/tests/test_native_hook_ldso_spawn.py @@ -120,6 +120,14 @@ class NativeHookLdsoSpawnTest(unittest.TestCase): script.parent.mkdir(exist_ok=True) script.write_text(f"#!{interpreter}\n") script.chmod(0o755) + cls.app_files = tmp / "app-files" + cls.app_files.mkdir() + shutil.copy(cls.probe, cls.app_files / "tool") + shutil.copy(cls.android / "sh", cls.app_files / "android-tool") + for name, interpreter in (("guest.py", GUEST_TOOL), ("android.sh", f"{ANDROID_DIR}/sh")): + (cls.app_files / name).write_text(f"#!{interpreter}\n") + for entry in cls.app_files.iterdir(): + entry.chmod(0o755) @classmethod def tearDownClass(cls): @@ -220,6 +228,32 @@ class NativeHookLdsoSpawnTest(unittest.TestCase): call = self.call(how, "/opt/host.sh", "x", binds=f"{self.runtime}:{BOUND_DIR}") self.assertEqual([HOST_SHELL, HOST_SHELL, str(self.root / "opt/host.sh"), "x"], call) + def test_a_script_on_a_mount_at_its_host_path_runs_with_the_guest_interpreter(self): + script = str(self.app_files / "guest.py") + for how in ("exec", "spawn"): + with self.subTest(how=how): + call = self.call(how, script, "x", binds=f"{self.app_files}:{self.app_files}") + self.assertEqual(str(self.root / GUEST_LDSO.lstrip("/")), call[0]) + self.assertEqual([str(self.root / GUEST_TOOL.lstrip("/")), script, "x"], call[-3:]) + + def test_a_glibc_program_on_a_mount_at_its_host_path_starts_through_the_guest_ldso(self): + tool = str(self.app_files / "tool") + for how in ("exec", "spawn"): + with self.subTest(how=how): + call = self.call(how, tool, "x", binds=f"{self.app_files}:{self.app_files}") + self.assertEqual(str(self.root / GUEST_LDSO.lstrip("/")), call[0]) + self.assertEqual([tool, "x"], call[-2:]) + + def test_android_programs_on_a_mount_at_its_host_path_stay_on_the_host(self): + tool = str(self.app_files / "android-tool") + script = str(self.app_files / "android.sh") + sh = str(self.android / "sh") + binds = f"{self.app_files}:{self.app_files}|{self.android}:{ANDROID_DIR}" + for how in ("exec", "spawn"): + with self.subTest(how=how): + self.assertEqual([tool, tool, "x"], self.call(how, tool, "x", binds=binds)) + self.assertEqual([sh, sh, script, "x"], self.call(how, script, "x", binds=binds)) + def test_an_android_interpreter_reached_through_a_bind_stays_on_the_host(self): sh = str(self.android / "sh") for how in ("exec", "spawn"): From e101a7879113aa54b9822012c3ae215dbc1869dd Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Mon, 30 Nov 2026 00:02:07 -0500 Subject: [PATCH 108/120] fix(stores): the front end no longer crashes on start when the Steam engine starts on the refresh thread (#3457) Keep the Steam install picker state out of the Steam engine object The picker state lived on SteamStore, which is first touched from the background stores refresh thread. On the Compose runtime in use, a state object created outside a snapshot while the composition holds an open snapshot is unreadable inside it, so the front end crashed on startup with "Reading a state that was created after the snapshot was taken". The state now lives on StoresState next to the other UI-facing store state, and SteamStore holds no Compose state. --- .../droiddeck/launcher/stores/StoresState.kt | 2 + .../launcher/stores/steam/SteamStore.kt | 7 +--- .../droiddeck/launcher/ui/FrontEndScreen.kt | 2 +- .../stores/steam/SteamPickingSnapshotTest.kt | 37 +++++++++++++++++++ 4 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 app/src/test/java/com/droiddeck/launcher/stores/steam/SteamPickingSnapshotTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/stores/StoresState.kt b/app/src/main/java/com/droiddeck/launcher/stores/StoresState.kt index 52a44f34cc..8c0d4198f1 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/StoresState.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/StoresState.kt @@ -121,6 +121,8 @@ object StoresState { var unfinished by mutableStateOf>(emptyList()) internal set + var steamPicking by mutableStateOf(null) + fun isUnfinished(item: CatalogItem): Boolean = unfinished.any { it.store == item.store && (it.id == item.id || (it.id == null && it.folder.name == StoreInstallRoot.folderName(item.title, item.id))) } diff --git a/app/src/main/java/com/droiddeck/launcher/stores/steam/SteamStore.kt b/app/src/main/java/com/droiddeck/launcher/stores/steam/SteamStore.kt index f0ececd00a..bbcd1f425d 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/steam/SteamStore.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/steam/SteamStore.kt @@ -6,9 +6,6 @@ import android.net.Uri import android.util.Log import android.widget.Toast import androidx.annotation.StringRes -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue import com.droiddeck.launcher.R import com.droiddeck.launcher.frontend.Library import com.droiddeck.launcher.session.SessionService @@ -46,8 +43,6 @@ internal object SteamStore { /** InvalidPassword, AccessDenied, AccountNotFound, Revoked, Expired, AccountLogonDenied. */ private val REFUSALS = setOf(5, 15, 18, 26, 27, 63) - var picking by mutableStateOf(null) - class Plan(val installDir: String, val downloadBytes: Long, val installBytes: Long, val buildId: String, val linuxBuild: Boolean) { companion object { fun of(json: JSONObject): Plan? { @@ -222,7 +217,7 @@ internal object SteamStore { toast(context, R.string.steam_store_close_steam) return } - picking = item + StoresState.steamPicking = item } fun install(context: Context, item: CatalogItem, target: SteamClient.Target) { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index efe3587660..fcfc591951 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -847,7 +847,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com com.droiddeck.launcher.stores.StoresState.pendingInstall?.let { item -> StoreTheme(item.store) { InstallWhere(item) } } com.droiddeck.launcher.stores.StoresState.itchPicking?.let { item -> StoreTheme(item.store) { ItchBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.itchPicking = null } } } com.droiddeck.launcher.stores.StoresState.gameJoltPicking?.let { item -> StoreTheme(item.store) { GameJoltBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.gameJoltPicking = null } } } - com.droiddeck.launcher.stores.steam.SteamStore.picking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.steam.SteamStore.picking = null } } } + com.droiddeck.launcher.stores.StoresState.steamPicking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.StoresState.steamPicking = null } } } StepsLayer(screenAt) UiZooSheet() SessionDrawerPreview(s.secondScreenDisplays) diff --git a/app/src/test/java/com/droiddeck/launcher/stores/steam/SteamPickingSnapshotTest.kt b/app/src/test/java/com/droiddeck/launcher/stores/steam/SteamPickingSnapshotTest.kt new file mode 100644 index 0000000000..6193a037bf --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/stores/steam/SteamPickingSnapshotTest.kt @@ -0,0 +1,37 @@ +package com.droiddeck.launcher.stores.steam + +import androidx.compose.runtime.State +import androidx.compose.runtime.snapshots.Snapshot +import androidx.compose.runtime.snapshots.StateObject +import com.droiddeck.launcher.stores.StoresState +import org.junit.Assert.assertNull +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config +import kotlin.concurrent.thread + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [33], manifest = Config.NONE) +class SteamPickingSnapshotTest { + @Test + fun theInstallPickerIsReadableInASnapshotOpenedBeforeTheSteamEngineStarts() { + StoresState.steamPicking = null + val snapshot = Snapshot.takeMutableSnapshot() + try { + thread { SteamStore.hashCode() }.join() + assertNull(snapshot.enter { StoresState.steamPicking }) + } finally { + snapshot.dispose() + } + } + + @Test + fun theSteamEngineHoldsNoComposeState() { + val stateFields = SteamStore::class.java.declaredFields.filter { + StateObject::class.java.isAssignableFrom(it.type) || State::class.java.isAssignableFrom(it.type) + } + assertTrue(stateFields.joinToString { it.name }, stateFields.isEmpty()) + } +} From df2cfa40b3997cc90f93fb6d6311955d909b6ea2 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Mon, 30 Nov 2026 01:38:08 -0500 Subject: [PATCH 109/120] test(xbox): cover device-limit diagnostic routing (#3458) --- .../stores/xbox/XodusDiagnosticsTest.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/src/test/java/com/droiddeck/launcher/stores/xbox/XodusDiagnosticsTest.kt b/app/src/test/java/com/droiddeck/launcher/stores/xbox/XodusDiagnosticsTest.kt index 3e2310be5c..6b9ecb4918 100644 --- a/app/src/test/java/com/droiddeck/launcher/stores/xbox/XodusDiagnosticsTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/stores/xbox/XodusDiagnosticsTest.kt @@ -9,6 +9,25 @@ import org.junit.Test class XodusDiagnosticsTest { private val rejected = Regex(Xodus.SIGN_IN_REJECTED) + @Test fun aDeviceLimitReachesTheInstallerWithoutBecomingASignInFailure() { + val line = "NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-device-limit 200" + val tail = listOf(line).filter { it.matches(Xodus.reportable) } + assertEquals(listOf(line), tail) + assertFalse(line.matches(rejected)) + assertEquals(com.droiddeck.launcher.R.string.stores_xbox_device_group_full, XboxInstaller.licenseRefusal(tail)) + } + + @Test fun aLaterLicenseSuccessClearsTheDeviceLimitThroughTheDiagnosticFilter() { + val stderr = listOf( + "NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-device-limit 200", + "NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-parsed 200", + "NEXUS_EXTRACT_DIAGNOSTIC_V1 extract-failed" + ) + val tail = stderr.filter { it.matches(Xodus.reportable) } + assertEquals(stderr, tail) + assertNull(XboxInstaller.licenseRefusal(tail)) + } + @Test fun aContentLicenseRejectionIsRecognised() { assertTrue("Microsoft content licensing rejected sign-in (HTTP 401). Sign in again in Settings.".matches(rejected)) } From 6dc3d016743b02783bfa83fec7a6d11a945b1e2b Mon Sep 17 00:00:00 2001 From: xlulx <92148312+xlulx@users.noreply.github.com> Date: Mon, 30 Nov 2026 12:23:04 +0300 Subject: [PATCH 110/120] fix(display): apply a client's commit only after its GPU has finished writing the buffer (#3004) --- app/src/main/cpp/waylandcomp/src/compositor.c | 325 +++++++++++++++--- .../test_commit_waits_for_client_writes.py | 293 ++++++++++++++++ tools/tests/test_subsurface_release.py | 2 +- 3 files changed, 580 insertions(+), 40 deletions(-) create mode 100644 tools/tests/test_commit_waits_for_client_writes.py diff --git a/app/src/main/cpp/waylandcomp/src/compositor.c b/app/src/main/cpp/waylandcomp/src/compositor.c index c9eceed111..03f33894cb 100644 --- a/app/src/main/cpp/waylandcomp/src/compositor.c +++ b/app/src/main/cpp/waylandcomp/src/compositor.c @@ -242,6 +242,10 @@ struct surface { enum surface_role role; struct wl_resource *idle_buffer; struct wl_listener idle_buffer_destroy; + struct surface_state *waiting; + struct wl_event_source *waiting_source, *waiting_timer; + int waiting_fd; + int64_t waiting_since_ns; uint32_t *idle_px; int idle_w, idle_h; struct wl_resource *xdg_surface, *xdg_toplevel; @@ -373,6 +377,8 @@ static struct { unsigned copy_scenes; unsigned releases, releases_held; int64_t release_ns, release_max_ns; + unsigned commit_waits, commit_wait_limits; + int64_t commit_wait_ns, commit_wait_max_ns; } g_perf; static void schedule_render(void); @@ -846,6 +852,55 @@ static void on_pending_buffer_destroyed(struct wl_listener *l, void *data) { s->pending_buffer = NULL; } +struct surface_state { + struct wl_resource *buffer; + struct wl_listener buffer_destroy; + int attach; + int src_set, dst_set, opaque_set; + float src[4]; + int dst[2], opaque[4]; + struct damage_list damage_buf, damage_local; + struct wl_list frames, feedback; +}; + +static void on_state_buffer_destroyed(struct wl_listener *l, void *data) { + struct surface_state *st = wl_container_of(l, st, buffer_destroy); + wl_list_remove(&st->buffer_destroy.link); + wl_list_init(&st->buffer_destroy.link); + st->buffer = NULL; + st->attach = 0; +} + +static void surface_state_take(struct surface *s, struct surface_state *st) { + st->attach = s->pending_attach; + st->buffer = s->pending_buffer; + wl_list_init(&st->buffer_destroy.link); + if (st->buffer) { + wl_list_remove(&s->pending_buffer_destroy.link); + wl_list_init(&s->pending_buffer_destroy.link); + st->buffer_destroy.notify = on_state_buffer_destroyed; + wl_resource_add_destroy_listener(st->buffer, &st->buffer_destroy); + } + s->pending_buffer = NULL; + s->pending_attach = 0; + st->src_set = s->pending_src_set; + memcpy(st->src, s->pending_src, sizeof(st->src)); + st->dst_set = s->pending_dst_set; + memcpy(st->dst, s->pending_dst, sizeof(st->dst)); + st->opaque_set = s->pending_opaque_set; + memcpy(st->opaque, s->pending_opaque, sizeof(st->opaque)); + s->pending_src_set = s->pending_dst_set = s->pending_opaque_set = 0; + st->damage_buf = s->pending_damage_buf; + st->damage_local = s->pending_damage_local; + s->pending_damage_buf.n = s->pending_damage_local.n = 0; + wl_list_init(&st->frames); + wl_list_insert_list(&st->frames, &s->pending_frames); + wl_list_init(&s->pending_frames); + wl_list_init(&st->feedback); + wl_list_insert_list(&st->feedback, &s->pending_feedback); + wl_list_init(&s->pending_feedback); +} + static void fire_frames(struct wl_list *frames) { struct wl_resource *cb, *tmp; uint32_t t; @@ -1363,35 +1418,23 @@ static void surface_drop_idle(struct surface *s) { if (buffer) send_buffer_release(buffer); } -static void surface_commit(struct wl_client *c, struct wl_resource *r) { - struct surface *s = wl_resource_get_user_data(r); +static void surface_state_apply(struct surface *s, struct surface_state *st) { struct surface *child; - if (s->xdg_toplevel && !s->toplevel_committed) { - s->toplevel_committed = 1; - send_toplevel_configure(s); + if (st->src_set) { + s->src_set = st->src[2] > 0; + memcpy(s->src, st->src, sizeof(s->src)); } + if (st->dst_set) { + s->dst_set = st->dst[0] > 0; + memcpy(s->dst, st->dst, sizeof(s->dst)); + } + if (st->opaque_set) memcpy(s->opaque, st->opaque, sizeof(s->opaque)); - if (s->pending_src_set) { - s->src_set = s->pending_src[2] > 0; - memcpy(s->src, s->pending_src, sizeof(s->src)); - s->pending_src_set = 0; - } - if (s->pending_dst_set) { - s->dst_set = s->pending_dst[0] > 0; - memcpy(s->dst, s->pending_dst, sizeof(s->dst)); - s->pending_dst_set = 0; - } - if (s->pending_opaque_set) { - memcpy(s->opaque, s->pending_opaque, sizeof(s->opaque)); - s->pending_opaque_set = 0; - } - - s->damage_buf = s->pending_damage_buf; - s->damage_local = s->pending_damage_local; - s->pending_damage_buf.n = s->pending_damage_local.n = 0; - if (s->pending_attach) { - struct wl_resource *buffer = s->pending_buffer; + s->damage_buf = st->damage_buf; + s->damage_local = st->damage_local; + if (st->attach) { + struct wl_resource *buffer = st->buffer; struct dmabuf_buffer *db = get_dmabuf(buffer); struct wl_shm_buffer *shm = buffer && !db ? wl_shm_buffer_get(buffer) : NULL; uint8_t pixel[4]; @@ -1400,12 +1443,10 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) { if (!buffer) g_pace.null_attaches++; else if (!db) s->last_dmabuf = NULL; - if (buffer) { - wl_list_remove(&s->pending_buffer_destroy.link); - wl_list_init(&s->pending_buffer_destroy.link); - } - s->pending_buffer = NULL; - s->pending_attach = 0; + wl_list_remove(&st->buffer_destroy.link); + wl_list_init(&st->buffer_destroy.link); + st->buffer = NULL; + st->attach = 0; surface_drop_idle(s); buf_trace_attach(buffer); @@ -1442,10 +1483,10 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) { } } - wl_list_insert_list(s->frames.prev, &s->pending_frames); - wl_list_init(&s->pending_frames); - wl_list_insert_list(s->feedback.prev, &s->pending_feedback); - wl_list_init(&s->pending_feedback); + wl_list_insert_list(s->frames.prev, &st->frames); + wl_list_init(&st->frames); + wl_list_insert_list(s->feedback.prev, &st->feedback); + wl_list_init(&st->feedback); constraints_surface_commit(s); droiddeck_color_commit(s->resource); @@ -1455,6 +1496,186 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) { } schedule_render(); } + +#define COMMIT_WAIT_LIMIT_MS 1000 + +static struct surface *g_zero_copy_shown, *g_unwaited; + +static int state_unfinished_fd(const struct surface *s, const struct surface_state *st, int *unwaited) { + struct dmabuf_buffer *db = st->attach ? get_dmabuf(st->buffer) : NULL; + int fd = -1; + *unwaited = 0; + for (int i = 0; db && fd < 0 && i < db->n_planes; i++) { + if (db->fd[i] < 0) continue; + struct pollfd p = {.fd = db->fd[i], .events = POLLIN}; + int r; + do { r = poll(&p, 1, 0); } while (r < 0 && errno == EINTR); + if (r == 0) fd = db->fd[i]; + } + if (fd >= 0 && s == g_zero_copy_shown && ahb_swapchain_has_ahb(db)) { + *unwaited = 1; + return -1; + } + return fd; +} + +static void settle_unwaited(void) { + struct surface *s = g_unwaited; + if (!s) return; + g_unwaited = NULL; + struct dmabuf_buffer *db = s->dmabuf_buf; + const int64_t deadline = now_ns() + 100000000LL; + for (int i = 0; db && i < db->n_planes; i++) { + if (db->fd[i] < 0) continue; + struct pollfd p = {.fd = db->fd[i], .events = POLLIN}; + for (;;) { + const int64_t left = deadline - now_ns(); + const int r = poll(&p, 1, left > 0 ? (int)((left + 999999) / 1000000) : 0); + if (r >= 0 || errno != EINTR || left <= 0) break; + } + } +} + +static void surface_state_discard(struct surface_state *st) { + struct wl_resource *cb, *tmp; + wl_list_remove(&st->buffer_destroy.link); + wl_resource_for_each_safe(cb, tmp, &st->frames) wl_resource_destroy(cb); + feedback_discard_all(&st->feedback); + free(st); +} + +static void surface_state_merge(struct surface_state *older, struct surface_state *newer) { + if (older->attach && !newer->attach) { + newer->attach = 1; + newer->buffer = older->buffer; + wl_list_remove(&older->buffer_destroy.link); + wl_list_init(&older->buffer_destroy.link); + if (newer->buffer) { + newer->buffer_destroy.notify = on_state_buffer_destroyed; + wl_resource_add_destroy_listener(newer->buffer, &newer->buffer_destroy); + } + wl_list_insert_list(&newer->feedback, &older->feedback); + wl_list_init(&older->feedback); + } else if (older->attach) { + if (older->buffer && older->buffer != newer->buffer) send_buffer_release(older->buffer); + g_pace.replaced += feedback_discard_all(&older->feedback); + } + if (older->src_set && !newer->src_set) { + newer->src_set = 1; + memcpy(newer->src, older->src, sizeof(newer->src)); + } + if (older->dst_set && !newer->dst_set) { + newer->dst_set = 1; + memcpy(newer->dst, older->dst, sizeof(newer->dst)); + } + if (older->opaque_set && !newer->opaque_set) { + newer->opaque_set = 1; + memcpy(newer->opaque, older->opaque, sizeof(newer->opaque)); + } + for (int i = 0; i < older->damage_buf.n; i++) + note_damage(&newer->damage_buf, older->damage_buf.r[i][0], older->damage_buf.r[i][1], + older->damage_buf.r[i][2], older->damage_buf.r[i][3]); + for (int i = 0; i < older->damage_local.n; i++) + note_damage(&newer->damage_local, older->damage_local.r[i][0], older->damage_local.r[i][1], + older->damage_local.r[i][2], older->damage_local.r[i][3]); + wl_list_insert_list(&newer->frames, &older->frames); + wl_list_init(&older->frames); + surface_state_discard(older); +} + +static void surface_wait_stop(struct surface *s) { + if (s->waiting_source) wl_event_source_remove(s->waiting_source); + if (s->waiting_timer) wl_event_source_remove(s->waiting_timer); + if (s->waiting_fd >= 0) close(s->waiting_fd); + s->waiting_source = s->waiting_timer = NULL; + s->waiting_fd = -1; +} + +static void surface_wait_end(struct surface *s, int over_limit) { + struct surface_state *st = s->waiting; + if (!st) return; + surface_wait_stop(s); + s->waiting = NULL; + const int64_t waited = now_ns() - s->waiting_since_ns; + g_perf.commit_waits++; + g_perf.commit_wait_ns += waited; + if (waited > g_perf.commit_wait_max_ns) g_perf.commit_wait_max_ns = waited; + if (over_limit) g_perf.commit_wait_limits++; + if (st->attach && g_unwaited == s) g_unwaited = NULL; + surface_state_apply(s, st); + free(st); +} + +static int on_commit_ready(int fd, uint32_t mask, void *data) { + surface_wait_end(data, 0); + return 0; +} + +static int on_commit_wait_limit(void *data) { + static int said; + if (!said) { + said = 1; + droiddeck_log("compositor", "a client's GPU writes ran past %d ms; its frame is shown as it is", COMMIT_WAIT_LIMIT_MS); + } + surface_wait_end(data, 1); + return 0; +} + +static int surface_wait_start(struct surface *s, int fd, int timeout_ms) { + struct wl_event_loop *loop = wl_display_get_event_loop(g_display); + s->waiting_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); + if (s->waiting_fd >= 0) { + s->waiting_source = wl_event_loop_add_fd(loop, s->waiting_fd, WL_EVENT_READABLE, on_commit_ready, s); + s->waiting_timer = wl_event_loop_add_timer(loop, on_commit_wait_limit, s); + } + if (!s->waiting_source || !s->waiting_timer || + wl_event_source_timer_update(s->waiting_timer, timeout_ms) != 0) { + surface_wait_stop(s); + return -1; + } + return 0; +} + +static void surface_commit(struct wl_client *c, struct wl_resource *r) { + struct surface *s = wl_resource_get_user_data(r); + + if (s->xdg_toplevel && !s->toplevel_committed) { + s->toplevel_committed = 1; + send_toplevel_configure(s); + } + struct surface_state *st = calloc(1, sizeof(*st)); + if (!st) { + struct surface_state now; + surface_state_take(s, &now); + surface_state_apply(s, &now); + return; + } + surface_state_take(s, st); + const int was_waiting = s->waiting != NULL; + if (was_waiting) { + surface_wait_stop(s); + surface_state_merge(s->waiting, st); + s->waiting = NULL; + } + int unwaited; + const int fd = state_unfinished_fd(s, st, &unwaited); + if (!was_waiting) s->waiting_since_ns = now_ns(); + const int64_t left_ms = COMMIT_WAIT_LIMIT_MS - (now_ns() - s->waiting_since_ns) / 1000000; + if (fd >= 0 && left_ms > 0 && surface_wait_start(s, fd, (int)left_ms) == 0) { + s->waiting = st; + return; + } + const int attaches = st->attach; + if (was_waiting) { + s->waiting = st; + surface_wait_end(s, fd >= 0 && left_ms <= 0); + } else { + surface_state_apply(s, st); + free(st); + } + if (unwaited) g_unwaited = s; + else if (attaches && g_unwaited == s) g_unwaited = NULL; +} static void surface_set_buffer_transform(struct wl_client *c, struct wl_resource *r, int32_t t) {} static void surface_set_buffer_scale(struct wl_client *c, struct wl_resource *r, int32_t s) {} static void surface_damage_buffer(struct wl_client *c, struct wl_resource *r, @@ -1516,6 +1737,13 @@ static void surface_resource_destroy(struct wl_resource *r) { child->parent = NULL; } if (s->pending_buffer) wl_list_remove(&s->pending_buffer_destroy.link); + if (s->waiting) { + surface_wait_stop(s); + surface_state_discard(s->waiting); + s->waiting = NULL; + } + if (g_zero_copy_shown == s) g_zero_copy_shown = NULL; + if (g_unwaited == s) g_unwaited = NULL; pending_releases_forget_surface(s); drop_dmabuf(s, 0); ahb_swapchain_surface_gone(s); @@ -1579,6 +1807,7 @@ static void compositor_create_surface(struct wl_client *c, struct wl_resource *r wl_list_init(&s->child_link); wl_list_init(&s->toplevel_link); wl_list_init(&s->pending_buffer_destroy.link); + s->waiting_fd = -1; wl_list_init(&s->idle_buffer_destroy.link); wl_list_insert(&g_surfaces, &s->link); wl_resource_set_implementation(s->resource, &surface_impl, s, surface_resource_destroy); @@ -2502,7 +2731,13 @@ static int64_t scene_next_due(int64_t now, int64_t due, int limit) { static void render_scene(void) { g_scene_due_ns = scene_next_due(now_ns(), g_scene_due_ns, g_fps_limit); - if (atomic_load(&g_stream_on)) { g_dirty_since_ns = 0; render_stream(); return; } + if (atomic_load(&g_stream_on)) { + g_dirty_since_ns = 0; + g_zero_copy_shown = NULL; + settle_unwaited(); + render_stream(); + return; + } struct draw_list dl = {0}; struct surface *s; int w, h; @@ -2576,6 +2811,8 @@ static void render_scene(void) { } else { cursor_hdr_said = 0; } + g_zero_copy_shown = NULL; + if (hdr_route == 1 || hdr_route == 2) settle_unwaited(); if (hdr_route == 1) { static int fell_back; vkp_apply_window_request(); @@ -2609,6 +2846,7 @@ static void render_scene(void) { } if (hdr_route == 0 && vkp_quest_layer_presentation() && !framegen && !cardboard && !cursor_on && !ahb_only) { + settle_unwaited(); rendered = vkp_render(w, h, dl.d, dl.n) == 0; } else if (hdr_route == 0 || hdr_route == 3) { const int pass_on = fx_on || framegen; @@ -2658,6 +2896,7 @@ static void render_scene(void) { vkp_apply_window_request(); int r = -1; const int fg_pass = framegen && fx_on && li >= 0; + if (framegen && li >= 0) settle_unwaited(); const int generated = (framegen && li >= 0) ? sc_layer_present_generated(&dl.d[li], 1, NULL, w, h, fg_pass, ls ? droiddeck_surface_color(ls) : NULL) : 0; @@ -2671,6 +2910,8 @@ static void render_scene(void) { r = generated >= 0 ? 0 : -1; else if (generated >= 0 && !(fx_on && li >= 0) && ls && ls->dmabuf_buf && ahb_swapchain_has_ahb(ls->dmabuf_buf)) r = ahb_swapchain_present(ls->dmabuf_buf, ls, w, h, ld); + if (r == 0 && !fg_pass) g_zero_copy_shown = ls; + else settle_unwaited(); if (!fg_pass && generated >= 0 && r != 0 && li >= 0) r = fx_on ? sc_layer_present_pass(&dl.d[li], 1, w, h) : sc_layer_present(dl.d[li].img, w, h, ld, ls ? droiddeck_surface_color(ls) : NULL); @@ -2681,6 +2922,7 @@ static void render_scene(void) { ov = sc_layer_present_overlay(dl.d[li + 1].img, go, dl.d[li + 1].blend) == 0 ? 1 : -1; if (ov <= 0) sc_layer_hide_overlay(); if (ov < 0) { + settle_unwaited(); sc_layer_hide(); rendered = vkp_render(w, h, dl.d, dl.n) == 0; copy = 1; @@ -2690,12 +2932,14 @@ static void render_scene(void) { g_scene_queues = sc_layer_queues(); } } else { + settle_unwaited(); sc_layer_hide(); rendered = vkp_render(w, h, dl.d, dl.n) == 0; copy = 1; hdr_copy = "its display layer was unavailable this frame"; } } else { + settle_unwaited(); sc_layer_hide(); rendered = vkp_render(w, h, dl.d, dl.n) == 0; copy = 1; @@ -4344,11 +4588,12 @@ static int on_stats_timer(void *data) { unsigned aimed_next, aimed_later, aimed_even; sc_layer_aim_take(&aimed_next, &aimed_later, &aimed_even); #define PERF_MS(sum, n) ((n) ? (double)(sum) / 1e6 / (double)(n) : 0.0) - if (g_perf.scenes || vp.presents || g_perf.releases || drops) + if (g_perf.scenes || vp.presents || g_perf.releases || drops || g_perf.commit_waits) droiddeck_log("perf", "last 10 s: %u ticks, %u scenes, %u on screen (copy %u, zero-copy %u, layer copy %u) | " "render_scene %.2f/%.2f ms | base %u black kept, %u presented | acquire %.2f/%.2f ms | " "present %.2f/%.2f ms (%u) | fence wait %.2f/%.2f ms (%u, %u GPU release waits) | " - "release %.2f/%.2f ms (%u, %u held) | %u pool drops | layer frames timed for the next refresh %u, " + "release %.2f/%.2f ms (%u, %u held) | commits held for client writes %.2f/%.2f ms (%u, %u past the limit) | " + "%u pool drops | layer frames timed for the next refresh %u, " "the one after %u, held to an even step %u", g_perf.ticks, g_perf.scenes, g_stat_frames, g_perf.copy_scenes, zero_copy, layer_frames, PERF_MS(g_perf.scene_ns, g_perf.scenes), (double)g_perf.scene_max_ns / 1e6, @@ -4357,7 +4602,9 @@ static int on_stats_timer(void *data) { PERF_MS(vp.present_ns, vp.presents), (double)vp.present_max_ns / 1e6, vp.presents, PERF_MS(vp.wait_ns, vp.waits), (double)vp.wait_max_ns / 1e6, vp.waits, vp.gpu_release_waits, PERF_MS(g_perf.release_ns, g_perf.releases), (double)g_perf.release_max_ns / 1e6, - g_perf.releases, g_perf.releases_held, drops, aimed_next, aimed_later, aimed_even); + g_perf.releases, g_perf.releases_held, + PERF_MS(g_perf.commit_wait_ns, g_perf.commit_waits), (double)g_perf.commit_wait_max_ns / 1e6, + g_perf.commit_waits, g_perf.commit_wait_limits, drops, aimed_next, aimed_later, aimed_even); #undef PERF_MS memset(&g_perf, 0, sizeof(g_perf)); } diff --git a/tools/tests/test_commit_waits_for_client_writes.py b/tools/tests/test_commit_waits_for_client_writes.py new file mode 100644 index 0000000000..39b37e93a9 --- /dev/null +++ b/tools/tests/test_commit_waits_for_client_writes.py @@ -0,0 +1,293 @@ +"""A commit whose dma-buf the client's GPU is still writing is held until the buffer polls readable. + +The compiled functions come from compositor.c; libwayland's lists and event loop, poll and the clock are faked. +""" +import os +from pathlib import Path +import re +import shutil +import subprocess +import tempfile +import unittest + +SOURCE = Path(__file__).resolve().parents[2] / 'app/src/main/cpp/waylandcomp/src/compositor.c' + + +def function(text, name): + match = re.search(r'^(?:static )?[^\n;]+\b' + name + r'\([^;]*?\)\s*\{', text, re.M) + if not match: + raise AssertionError('Production function not found: ' + name) + pos = text.index('{', match.start()) + depth, end = 1, pos + 1 + while depth: + depth += (text[end] == '{') - (text[end] == '}') + end += 1 + return text[match.start():end] + + +def block(text, start): + begin = text.index(start) + return text[begin:text.index('\n};\n', begin) + 4] + + +HARNESS = r''' +#include +#include +#include +#include +#include +#include +#define DAMAGE_RECTS 4 +#define POLLIN 1 +#define F_DUPFD_CLOEXEC 1030 +#define WL_EVENT_READABLE 1 +struct pollfd { int fd; short events, revents; }; +struct wl_list { struct wl_list *prev, *next; }; +struct wl_listener { struct wl_list link; void (*notify)(struct wl_listener *, void *); }; +static void wl_list_init(struct wl_list *l) { l->prev = l->next = l; } +static void wl_list_remove(struct wl_list *l) { l->prev->next = l->next; l->next->prev = l->prev; l->prev = l->next = NULL; } +static void wl_list_insert(struct wl_list *list, struct wl_list *elm) { + elm->prev = list; elm->next = list->next; list->next = elm; elm->next->prev = elm; +} +static void wl_list_insert_list(struct wl_list *list, struct wl_list *other) { + if (other->next == other) return; + other->next->prev = list; other->prev->next = list->next; list->next->prev = other->prev; list->next = other->next; +} +static int wl_list_length(const struct wl_list *l) { int n = 0; for (struct wl_list *e = l->next; e != l; e = e->next) n++; return n; } +#define wl_container_of(ptr, sample, member) (__typeof__(sample))((char *)(ptr) - offsetof(__typeof__(*sample), member)) + +struct dmabuf_buffer { int fd[4]; int n_planes; int ahb; }; +struct wl_resource { struct wl_list link; struct wl_listener *listener; struct dmabuf_buffer *db; int released, destroyed; }; +static struct wl_resource *from_link(struct wl_list *l) { return wl_container_of(l, (struct wl_resource *)0, link); } +#define wl_resource_for_each_safe(r, t, list) \ + for (r = from_link((list)->next), t = from_link(r->link.next); &r->link != (list); r = t, t = from_link(t->link.next)) +static void wl_resource_destroy(struct wl_resource *r) { wl_list_remove(&r->link); r->destroyed = 1; } +static void wl_resource_add_destroy_listener(struct wl_resource *r, struct wl_listener *l) { r->listener = l; wl_list_init(&l->link); } +static void client_destroys(struct wl_resource *r) { + if (r->listener) { struct wl_listener *l = r->listener; r->listener = NULL; l->notify(l, r); } +} + +static int ready[64], dup_of[64], next_dup = 40, closed[64]; +static int poll(struct pollfd *p, unsigned n, int timeout) { + if (n != 1 || timeout != 0 || p->events != POLLIN) { puts("FAIL poll args"); exit(1); } + return ready[p->fd] ? 1 : 0; +} +static int fcntl(int fd, int cmd, int arg) { (void)cmd; (void)arg; dup_of[next_dup] = fd; return next_dup++; } +static int close(int fd) { closed[fd]++; return 0; } + +struct wl_event_source { int fd; int (*fd_cb)(int, uint32_t, void *); int (*timer_cb)(void *); void *data; int armed_ms, removed; }; +struct wl_event_loop; +struct wl_display; +static struct wl_display *g_display; +static struct wl_event_source sources[32]; +static int n_sources; +static struct wl_event_loop *wl_display_get_event_loop(struct wl_display *d) { (void)d; return NULL; } +static struct wl_event_source *wl_event_loop_add_fd(struct wl_event_loop *l, int fd, uint32_t mask, + int (*cb)(int, uint32_t, void *), void *data) { + (void)l; (void)mask; struct wl_event_source *s = &sources[n_sources++]; memset(s, 0, sizeof(*s)); + s->fd = fd; s->fd_cb = cb; s->data = data; return s; +} +static struct wl_event_source *wl_event_loop_add_timer(struct wl_event_loop *l, int (*cb)(void *), void *data) { + (void)l; struct wl_event_source *s = &sources[n_sources++]; memset(s, 0, sizeof(*s)); + s->fd = -1; s->timer_cb = cb; s->data = data; return s; +} +static int wl_event_source_timer_update(struct wl_event_source *s, int ms) { s->armed_ms = ms; return 0; } +static int wl_event_source_remove(struct wl_event_source *s) { s->removed = 1; return 0; } +static void dispatch(int timers_expire) { + for (int i = 0; i < n_sources; i++) { + struct wl_event_source *s = &sources[i]; + if (s->removed) continue; + if (s->fd_cb && ready[dup_of[s->fd]]) s->fd_cb(s->fd, WL_EVENT_READABLE, s->data); + else if (s->timer_cb && s->armed_ms && timers_expire) { s->armed_ms = 0; s->timer_cb(s->data); } + } +} + +static int64_t clock_ns; +static int64_t now_ns(void) { return clock_ns; } +static struct { unsigned replaced; } g_pace; +static struct { unsigned commit_waits, commit_wait_limits; int64_t commit_wait_ns, commit_wait_max_ns; } g_perf; +static int logged; +static void droiddeck_log(const char *tag, const char *fmt, ...) { (void)tag; (void)fmt; logged++; } +static void send_buffer_release(struct wl_resource *r) { r->released++; } +static unsigned feedback_discard_all(struct wl_list *list) { + unsigned n = 0; struct wl_resource *r, *t; wl_resource_for_each_safe(r, t, list) { wl_resource_destroy(r); n++; } return n; +} +static struct dmabuf_buffer *get_dmabuf(struct wl_resource *r) { return r ? r->db : NULL; } +static int ahb_swapchain_has_ahb(const struct dmabuf_buffer *b) { return b->ahb; } +static int64_t rect_area(const int32_t *r, int bw, int bh) { (void)bw; (void)bh; return (int64_t)r[2] * r[3]; } + +struct damage_list { int32_t r[DAMAGE_RECTS][4]; int n; }; +struct surface { + struct wl_resource *resource, *xdg_toplevel; + int toplevel_committed; + struct wl_resource *pending_buffer; + struct wl_listener pending_buffer_destroy; + int pending_attach, pending_src_set, pending_dst_set, pending_opaque_set; + float pending_src[4]; + int pending_dst[2], pending_opaque[4]; + struct damage_list pending_damage_buf, pending_damage_local; + struct wl_list pending_frames, pending_feedback; + struct surface_state *waiting; + struct wl_event_source *waiting_source, *waiting_timer; + int waiting_fd; + int64_t waiting_since_ns; +}; +static void send_toplevel_configure(struct surface *s) { (void)s; } +struct wl_client; +static struct surface surf; + +STATE_STRUCT + +static int applies, applied_attach, applied_frames, applied_opaque, applied_damage; +static struct wl_resource *applied_buffer; +static void surface_state_apply(struct surface *s, struct surface_state *st); + +FUNCTIONS + +static void surface_state_apply(struct surface *s, struct surface_state *st) { + (void)s; + applies++; + applied_attach = st->attach; + applied_buffer = st->attach ? st->buffer : NULL; + applied_frames = wl_list_length(&st->frames); + applied_opaque = st->opaque_set ? st->opaque[2] : -1; + applied_damage = st->damage_buf.n; + if (st->attach) { wl_list_remove(&st->buffer_destroy.link); wl_list_init(&st->buffer_destroy.link); } + struct wl_resource *r, *t; + wl_resource_for_each_safe(r, t, &st->frames) wl_resource_destroy(r); + feedback_discard_all(&st->feedback); +} + +static struct wl_resource frame_res[16]; +static int n_frames; +static void attach(struct wl_resource *b) { + if (surf.pending_buffer) wl_list_remove(&surf.pending_buffer_destroy.link); + wl_list_init(&surf.pending_buffer_destroy.link); + surf.pending_buffer = b; surf.pending_attach = 1; +} +static void frame(void) { struct wl_resource *f = &frame_res[n_frames++]; wl_list_insert(surf.pending_frames.prev, &f->link); } +static void damage(int w) { surf.pending_damage_buf.r[surf.pending_damage_buf.n][2] = w; + surf.pending_damage_buf.r[surf.pending_damage_buf.n][3] = 1; surf.pending_damage_buf.n++; } +static void commit(void) { surface_commit(NULL, NULL); } +#define CHECK(c, what) do { if (!(c)) { printf("FAIL %s (line %d)\n", what, __LINE__); return 1; } } while (0) + +int main(void) { + wl_list_init(&surf.pending_frames); wl_list_init(&surf.pending_feedback); + wl_list_init(&surf.pending_buffer_destroy.link); + surf.waiting_fd = -1; + struct dmabuf_buffer d1 = {{10, -1}, 1, 0}, d2 = {{11, -1}, 1, 0}, d3 = {{12, -1}, 1, 0}, dz = {{13, -1}, 1, 1}; + struct wl_resource b1 = {.db = &d1}, b2 = {.db = &d2}, b3 = {.db = &d3}, bz = {.db = &dz}; + + ready[10] = 1; + attach(&b1); frame(); commit(); + CHECK(applies == 1 && applied_buffer == &b1 && applied_frames == 1 && !surf.waiting && n_sources == 0, "ready buffer"); + + ready[11] = 0; + clock_ns = 1000000; + attach(&b2); frame(); damage(5); commit(); + CHECK(applies == 1 && surf.waiting && surf.waiting_fd >= 40 && dup_of[surf.waiting_fd] == 11, "held"); + CHECK(sources[0].armed_ms == 0 && sources[1].armed_ms == 1000, "waits on the buffer with a 1 s limit"); + dispatch(0); + CHECK(applies == 1, "nothing before the writes end"); + clock_ns = 4000000; + ready[11] = 1; + dispatch(0); + CHECK(applies == 2 && applied_buffer == &b2 && applied_frames == 1 && applied_damage == 1 && !surf.waiting, "applied once ready"); + CHECK(closed[40] == 1 && sources[0].removed && sources[1].removed, "wait cleaned up"); + CHECK(g_perf.commit_waits == 1 && g_perf.commit_wait_max_ns == 3000000, "wait counted"); + + ready[11] = 0; ready[12] = 0; + attach(&b2); frame(); damage(7); commit(); + attach(&b3); frame(); damage(9); commit(); + CHECK(applies == 2 && b2.released == 1 && dup_of[surf.waiting_fd] == 12, "replaced while waiting"); + ready[12] = 1; + dispatch(0); + CHECK(applies == 3 && applied_buffer == &b3 && applied_frames == 2 && applied_damage == 2, "newest shown with both callbacks"); + CHECK(g_perf.commit_waits == 2, "merged wait counted once"); + + ready[11] = 0; + attach(&b2); commit(); + surf.pending_opaque[2] = 640; surf.pending_opaque_set = 1; frame(); commit(); + CHECK(applies == 3 && b2.released == 1 && dup_of[surf.waiting_fd] == 11, "the waiting buffer is not released"); + ready[11] = 1; + dispatch(0); + CHECK(applies == 4 && applied_buffer == &b2 && applied_opaque == 640 && applied_frames == 1, "buffer kept, opaque applied"); + + g_zero_copy_shown = &surf; + attach(&bz); commit(); + CHECK(applies == 5 && applied_buffer == &bz && !surf.waiting && g_unwaited == &surf, "zero-copy buffer"); + g_zero_copy_shown = NULL; + ready[13] = 0; + attach(&bz); commit(); + CHECK(applies == 5 && surf.waiting, "a droiddeck-ahb buffer not shown zero-copy waits"); + ready[13] = 1; + dispatch(0); + CHECK(applies == 6 && !g_unwaited, "waited buffer clears the mark"); + ready[13] = 0; + + ready[10] = 0; + attach(&b1); frame(); commit(); + client_destroys(&b1); + ready[10] = 1; + dispatch(0); + CHECK(applies == 7 && !applied_attach && applied_frames == 1, "destroyed buffer dropped from the commit"); + + ready[11] = 0; + attach(&b2); commit(); + dispatch(1); + CHECK(applies == 8 && applied_buffer == &b2 && g_perf.commit_wait_limits == 1 && logged == 1 && !surf.waiting, "limit"); + + ready[11] = 0; ready[12] = 0; + clock_ns = 10000000000; + attach(&b2); commit(); + CHECK(applies == 8 && sources[n_sources - 1].armed_ms == 1000, "held again"); + clock_ns += 600000000; + attach(&b3); commit(); + CHECK(applies == 8 && surf.waiting && sources[n_sources - 1].armed_ms == 400, "a newer commit keeps the first deadline"); + clock_ns += 500000000; + attach(&b2); commit(); + CHECK(applies == 9 && applied_buffer == &b2 && g_perf.commit_wait_limits == 2 && !surf.waiting, "commits past the deadline are applied at once"); + puts("PASS"); + return 0; +} +''' + + +class CommitWaitsForClientWritesTest(unittest.TestCase): + def test_commits_wait_for_the_clients_gpu_writes(self): + compiler = shutil.which(os.environ.get('CC', 'cc')) + if not compiler: + self.skipTest('A host C compiler is required') + source = SOURCE.read_text() + functions = '\n'.join(re.search(pattern, source, re.M).group(0) for pattern in + (r'^#define COMMIT_WAIT_LIMIT_MS .*$', r'^static struct surface \*g_zero_copy_shown, \*g_unwaited;$')) + '\n' + '\n'.join( + function(source, name) for name in + ('note_damage', 'on_state_buffer_destroyed', 'surface_state_take', 'state_unfinished_fd', + 'surface_state_discard', 'surface_state_merge', 'surface_wait_stop', 'surface_wait_end', 'on_commit_ready', + 'on_commit_wait_limit', 'surface_wait_start', 'surface_commit')) + probe = HARNESS.replace('STATE_STRUCT', block(source, 'struct surface_state {')).replace('FUNCTIONS', functions) + probe = probe.replace('struct surface *s = wl_resource_get_user_data(r);', 'struct surface *s = &surf; (void)r;') + with tempfile.TemporaryDirectory(prefix='droiddeck-commit-wait-') as temp: + folder = Path(temp) + (folder / 'probe.c').write_text(probe) + built = subprocess.run([compiler, '-std=gnu11', '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wno-unused-function', + str(folder / 'probe.c'), '-o', str(folder / 'probe')], + capture_output=True, text=True) + self.assertEqual(built.returncode, 0, built.stdout + built.stderr) + run = subprocess.run([str(folder / 'probe')], capture_output=True, text=True, timeout=10) + self.assertEqual(run.returncode, 0, run.stdout + run.stderr) + self.assertEqual(run.stdout.strip(), 'PASS') + + def test_scenes_settle_an_unwaited_buffer_before_copying_it(self): + body = function(SOURCE.read_text(), 'render_scene').splitlines() + copies = [i for i, line in enumerate(body) if 'vkp_render(w, h, dl.d, dl.n)' in line] + self.assertGreaterEqual(len(copies), 4) + for i in copies: + self.assertTrue(any('settle_unwaited();' in line for line in body[max(0, i - 3):i]), body[i]) + text = '\n'.join(body) + self.assertIn('if (hdr_route == 1 || hdr_route == 2) settle_unwaited();', text) + self.assertIn('settle_unwaited();\n render_stream();', text) + self.assertIn('if (r == 0 && !fg_pass) g_zero_copy_shown = ls;\n else settle_unwaited();', text) + +if __name__ == '__main__': + unittest.main() diff --git a/tools/tests/test_subsurface_release.py b/tools/tests/test_subsurface_release.py index ea472be5fe..c8ad7fcf12 100644 --- a/tools/tests/test_subsurface_release.py +++ b/tools/tests/test_subsurface_release.py @@ -95,7 +95,7 @@ class SubsurfaceReleaseTest(unittest.TestCase): def test_compositor_attach_and_commit_use_the_release_hold(self): self.assertIn('pending_releases_cancel(buffer);', function_body(self.source, 'take_dmabuf')) - commit = function_body(self.source, 'surface_commit') + commit = function_body(self.source, 'surface_state_apply') self.assertIn('pending_releases_apply(s);', commit) self.assertLess(commit.index('take_dmabuf(s, db, buffer);'), commit.index('pending_releases_apply(s);')) self.assertLess(commit.index('buf_trace_attach(buffer);'), commit.index('if (s->role == ROLE_CURSOR)')) From 72c8b8426d106a839bc0fb36c603c066f8344e3e Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Mon, 30 Nov 2026 08:53:12 -0500 Subject: [PATCH 111/120] fix(input): Windows games see the gamepad again when the pad is not read through SDL (#3469) Since each pad was described to Wine's udev backend with the identity its SDL backend sees, the udev backend left every pad to SDL. Where SDL does not open the pad, such as a session without proot, Windows games lost both the gamepad and the on-screen controls. The udev backend owns the pads again with the Steam Input identity it had before. SDL inside Wine's bus driver now reads the same identity for those pads and skips them as it skips any Steam Input pad, so each pad is still listed once and both triggers keep reading together. --- tools/linuxfs/preload/inputudev.c | 119 ++++++++++---------- tools/linuxfs/preload/netif.c | 3 + tools/tests/test_inputudev_preload.py | 35 ++---- tools/tests/test_ring_pad_sdl_identity.py | 125 ++++++++++++++++++++++ 4 files changed, 194 insertions(+), 88 deletions(-) create mode 100644 tools/tests/test_ring_pad_sdl_identity.py diff --git a/tools/linuxfs/preload/inputudev.c b/tools/linuxfs/preload/inputudev.c index a8ced09425..77152b105d 100644 --- a/tools/linuxfs/preload/inputudev.c +++ b/tools/linuxfs/preload/inputudev.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -34,7 +36,8 @@ "NAME=\"Xbox 360 Controller (%d)\"\n" \ "PHYS=\"usb-fakeinput/input%d\"\n" -#define RING_SDL_ID 0x045e028eu +#define STEAM_VIRTUAL_VENDOR 0x28de +#define STEAM_VIRTUAL_PRODUCT 0x11ff #define PARENT_NAME "droiddeck-input" #define PARENT_SYSPATH_FORMAT "/sys/devices/droiddeck%d/" PARENT_NAME "%d" @@ -141,66 +144,8 @@ static int any_virtual_pad(void) { return 0; } -static char *sdl_id_list_text(const char *list) { - char *text = NULL; - char *grown; - size_t length = 0; - size_t got; - FILE *file; - - if (list[0] != '@') return strdup(list); - file = fopen(list + 1, "re"); - if (file == NULL) return NULL; - do { - grown = realloc(text, length + 4097); - if (grown == NULL) { - free(text); - fclose(file); - return NULL; - } - text = grown; - got = fread(text + length, 1, 4096, file); - length += got; - } while (got > 0); - fclose(file); - text[length] = '\0'; - return text; -} - -static int sdl_id_list_entries(const char *list, int *has_ring) { - char *text = sdl_id_list_text(list); - char *spot = text; - uint32_t entry; - int entries = 0; - - *has_ring = 0; - if (text == NULL) return 0; - while ((spot = strstr(spot, "0x")) != NULL) { - entry = (uint32_t)(uint16_t)strtol(spot, &spot, 0) << 16; - spot = strstr(spot, "0x"); - if (spot == NULL) break; - entry |= (uint16_t)strtol(spot, &spot, 0); - entries++; - if (entry == RING_SDL_ID) *has_ring = 1; - } - free(text); - return entries; -} - -static int sdl_bus_skips_ring_pad(void) { - const char *steam_virtual = getenv("FAKE_EVDEV_STEAM_VIRTUAL"); - const char *except = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"); - const char *ignore = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES"); - int has_ring; - - if (steam_virtual != NULL && atoi(steam_virtual) != 0) return 1; - if (except != NULL && sdl_id_list_entries(except, &has_ring) > 0) return !has_ring; - return ignore != NULL && sdl_id_list_entries(ignore, &has_ring) > 0 && has_ring; -} - static const char *ring_uevent_format(void) { - if (uinput_enabled() && any_virtual_pad()) return PAD_PHYSICAL_UEVENT_FORMAT; - return sdl_bus_skips_ring_pad() ? PAD_UEVENT_FORMAT : PAD_PHYSICAL_UEVENT_FORMAT; + return uinput_enabled() && any_virtual_pad() ? PAD_PHYSICAL_UEVENT_FORMAT : PAD_UEVENT_FORMAT; } static void refresh_locked(int node) { @@ -514,6 +459,60 @@ static int caller_in_library(void *caller, const char *library) { static int caller_is_winebus(void *caller) { return caller_in_library(caller, "winebus.so"); } +static int note_winebus(struct dl_phdr_info *info, size_t size, void *data) { + (void)size; + if (info->dlpi_name == NULL || strstr(info->dlpi_name, "winebus.so") == NULL) return 0; + *(int *)data = 1; + return 1; +} + +static int winebus_reads_udev(void) { + const char *x360 = getenv("FAKE_EVDEV_STEAM_PAD_AS_X360"); + int loaded = 0; + + if (x360 != NULL && atoi(x360) != 0) return 0; + dl_iterate_phdr(note_winebus, &loaded); + return loaded; +} + +static int ring_pad_fd(int fd) { + const char *spec = getenv("FAKE_EVDEV_MEMFD_PATHS"); + const char *entry; + struct stat opened; + struct stat ring; + char path[PATH_MAX]; + + if (spec == NULL || fstat(fd, &opened) != 0) return 0; + for (entry = spec; *entry != '\0';) { + char *end; + long slot = strtol(entry, &end, 10); + const char *next = strchr(entry, ';'); + size_t length; + + if (end != entry && *end == '=' && slot >= 0 && slot < RING_MAX) { + length = next != NULL ? (size_t)(next - end - 1) : strlen(end + 1); + if (length < sizeof(path)) { + memcpy(path, end + 1, length); + path[length] = '\0'; + if (stat(path, &ring) == 0 && ring.st_dev == opened.st_dev && ring.st_ino == opened.st_ino) return 1; + } + } + if (next == NULL) break; + entry = next + 1; + } + return 0; +} + +__attribute__((visibility("hidden"))) void dd_ring_pad_sdl_id(int fd, unsigned long request, void *arg, + void *caller, int rc) { + struct input_id *id = arg; + + if (rc != 0 || request != EVIOCGID || id == NULL) return; + if (!caller_in_library(caller, "libSDL") || !winebus_reads_udev() || !ring_pad_fd(fd)) return; + id->vendor = STEAM_VIRTUAL_VENDOR; + id->product = STEAM_VIRTUAL_PRODUCT; +} + typedef int (*sdl_rumble_fn)(void *, uint16_t, uint16_t, uint32_t); static _Atomic(sdl_rumble_fn) real_sdl_rumble; static __thread int winebus_sdl_call; diff --git a/tools/linuxfs/preload/netif.c b/tools/linuxfs/preload/netif.c index 38453ba5ab..6cd296b3d6 100644 --- a/tools/linuxfs/preload/netif.c +++ b/tools/linuxfs/preload/netif.c @@ -424,6 +424,8 @@ int dd_venc_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute int dd_vdec_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden"))); int dd_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request, void *arg, void *caller, int *rc) __attribute__((visibility("hidden"))); +void dd_ring_pad_sdl_id(int fd, unsigned long request, void *arg, void *caller, int rc) + __attribute__((visibility("hidden"))); int dd_writewatch_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden"))); @@ -444,6 +446,7 @@ int ioctl(int fd, unsigned long request, ...) { if (dd_winebus_rumble_ioctl(real, fd, request, arg, __builtin_return_address(0), &rc)) return rc; if (dd_writewatch_ioctl(real, fd, request, arg, &rc)) return rc; if (!dd_kgsl_poll(real, fd, request, arg, &rc)) rc = quest_kgsl_ioctl(real, fd, request, arg); + dd_ring_pad_sdl_id(fd, request, arg, __builtin_return_address(0), rc); dd_kgsl_track(real, fd, request, arg, &rc); dd_kgsl_chip_id_fixup(request, arg, rc); if (arg == NULL || !is_link_query(request)) return rc; diff --git a/tools/tests/test_inputudev_preload.py b/tools/tests/test_inputudev_preload.py index 0c4020ab8a..0195e6ff1e 100644 --- a/tools/tests/test_inputudev_preload.py +++ b/tools/tests/test_inputudev_preload.py @@ -707,36 +707,15 @@ class InputUdevPreloadTest(unittest.TestCase): def identity(self, pads=None, **extra): return self.run_program("identity", pads=pads, extra=extra) - @classmethod - def id_list(cls, name, text): - path = cls.dir / name - path.write_text(text) - return "@" + str(path) - - def test_a_pad_wine_also_reads_through_sdl_is_described_as_the_pad_sdl_sees(self): - xbox = ["pad PRODUCT=3/45e/28e/110", "parent PRODUCT=3/45e/28e/110"] - for extra in ({}, {"FAKE_EVDEV_UINPUT": "1"}, {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142"}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x045e/0x028e"}, {"FAKE_EVDEV_STEAM_VIRTUAL": "0"}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-other.txt", "0x28de/0x1142\n")}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "@" + str(self.dir / "missing.txt")}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": self.id_list("except-ring.txt", "0x045E/0x028E\n")}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x45e/0x28e"}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": ""}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142"}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028f"}): - with self.subTest(**extra): - self.assertEqual(self.identity(**extra), xbox) - - def test_a_pad_sdl_skips_keeps_the_steam_input_identity(self): + def test_a_ring_pad_keeps_the_steam_input_identity_whatever_sdl_is_told(self): steam = ["pad PRODUCT=6/28de/11ff/110", "parent PRODUCT=6/28de/11ff/110"] - for extra in ({"FAKE_EVDEV_STEAM_VIRTUAL": "1"}, {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142,0x045E/0x028E"}, + for extra in ({}, {"FAKE_EVDEV_UINPUT": "1"}, {"FAKE_EVDEV_STEAM_VIRTUAL": "0"}, {"FAKE_EVDEV_STEAM_VIRTUAL": "1"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142,0x045E/0x028E"}, + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x045e/0x028e"}, {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x28de/0x11ff"}, - {"FAKE_EVDEV_UINPUT": "1", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028e"}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-ring.txt", "0x28de/0x1142\n0x045e/0x028e\n")}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": self.id_list("except-other.txt", "0x28de/0x11ff\n")}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-long.txt", "0x28de/0x1142\n" * 400 + "0x045e/0x028e\n")}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x45e/0x28e"}, - {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028e"}): + {"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": ""}, + {"FAKE_EVDEV_UINPUT": "1", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028e"}): with self.subTest(**extra): self.assertEqual(self.identity(**extra), steam) diff --git a/tools/tests/test_ring_pad_sdl_identity.py b/tools/tests/test_ring_pad_sdl_identity.py new file mode 100644 index 0000000000..d10ca0257f --- /dev/null +++ b/tools/tests/test_ring_pad_sdl_identity.py @@ -0,0 +1,125 @@ +from pathlib import Path +import os +import shutil +import subprocess +import sys +import tempfile +import unittest + +PRELOAD = Path(__file__).resolve().parents[1] / "linuxfs/preload" + +SHIM = r""" +#include +#include +#include + +int ioctl(int fd, unsigned long request, ...) { + va_list ap; + va_start(ap, request); + struct input_id *id = va_arg(ap, struct input_id *); + va_end(ap); + (void)fd; + if (request != EVIOCGID) return -1; + memset(id, 0, sizeof(*id)); + id->bustype = 3; + id->vendor = 0x045e; + id->product = 0x028e; + return 0; +} +""" + +QUERY = r""" +#include +#include +#include +#include +#include + +void query(const char *path) { + struct input_id id; + int fd = open(path, O_RDONLY | O_CLOEXEC); + int rc = ioctl(fd, EVIOCGID, &id); + printf("%d %04x:%04x\n", rc, id.vendor, id.product); + close(fd); +} +""" + +PROGRAM = r""" +#include +#include +#include + +void query(const char *path); + +int main(int argc, char **argv) { + (void)argc; + if (strcmp(argv[1], "-") != 0) dlopen(argv[1], RTLD_NOW); + if (strcmp(argv[2], "program") == 0) { + query(argv[3]); + } else { + void *sdl = dlopen(argv[2], RTLD_NOW | RTLD_LOCAL); + void (*sdl_query)(const char *) = (void (*)(const char *))dlsym(sdl, "query"); + sdl_query(argv[3]); + } + fflush(stdout); + return 0; +} +""" + + +@unittest.skipUnless(sys.platform == "linux" and shutil.which("cc"), "needs Linux and cc") +class RingPadSdlIdentityTest(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.dir = Path(tempfile.mkdtemp()) + build = cls.dir / "build" + build.mkdir() + for name, text in (("shim.c", SHIM), ("query.c", QUERY), ("program.c", PROGRAM), ("empty.c", "int bus;\n")): + (build / name).write_text(text) + cls.lib = cls.dir / "libddsession.so" + subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-Wall", "-pthread", "-o", str(cls.lib), + *map(str, sorted(PRELOAD.glob("*.c"))), "-ldl"], check=True) + cls.shim = cls.dir / "libshim.so" + subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.shim), str(build / "shim.c")], check=True) + cls.winebus = cls.dir / "winebus.so" + subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.winebus), str(build / "empty.c")], check=True) + cls.sdl_library = cls.dir / "libSDL2-2.0.so.0" + subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.sdl_library), str(build / "query.c")], check=True) + cls.program = cls.dir / "program" + subprocess.run(["cc", "-O2", "-o", str(cls.program), str(build / "program.c"), str(build / "query.c"), "-ldl"], + check=True) + cls.ring = cls.dir / "ring0" + cls.ring.write_text("") + cls.virtual = cls.dir / "ring16" + cls.virtual.write_text("") + + @classmethod + def tearDownClass(cls): + shutil.rmtree(cls.dir, True) + + def query(self, winebus=True, caller="sdl", path=None, **extra): + env = dict(os.environ, LD_PRELOAD="%s:%s" % (self.lib, self.shim), + FAKE_EVDEV_MEMFD_PATHS="0=%s;16=%s" % (self.ring, self.virtual)) + env.pop("FAKE_EVDEV_STEAM_PAD_AS_X360", None) + env.update(extra) + result = subprocess.run([str(self.program), str(self.winebus) if winebus else "-", + str(self.sdl_library) if caller == "sdl" else "program", str(path or self.ring)], + env=env, capture_output=True, text=True, timeout=10, check=True) + return result.stdout.strip() + + def test_sdl_in_a_winebus_process_sees_a_ring_pad_as_the_steam_input_pad(self): + self.assertEqual(self.query(), "0 28de:11ff") + + def test_sdl_outside_winebus_keeps_the_pad_identity(self): + self.assertEqual(self.query(winebus=False), "0 045e:028e") + + def test_other_callers_and_devices_keep_their_identity(self): + self.assertEqual(self.query(caller="program"), "0 045e:028e") + self.assertEqual(self.query(path=self.virtual), "0 045e:028e") + + def test_a_winebus_without_a_udev_bus_keeps_the_pad_for_sdl(self): + self.assertEqual(self.query(FAKE_EVDEV_STEAM_PAD_AS_X360="1"), "0 045e:028e") + + +if __name__ == "__main__": + unittest.main() From 54ca5185535cb18bf8ceb3be463db7cd67c413e8 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Mon, 30 Nov 2026 12:00:05 -0500 Subject: [PATCH 112/120] fix(storage): a card library the session cannot open by its raw path is opened by its storage path (#3475) A game storage folder saved as a raw volume path is opened through the volume's /storage path when only that one is usable, and its private directories are kept under either path. Battle.net is only given a library folder when the configured one is attached, so a missing card no longer moves its install folder to internal storage. --- .../droiddeck/launcher/session/GameStorage.kt | 9 +++-- .../launcher/session/SecondaryLibrary.kt | 11 +++++- .../stores/battlenet/BattleNetStore.kt | 9 ++--- .../launcher/session/GameStorageTest.kt | 13 +++++++ .../launcher/session/SecondaryLibraryTest.kt | 18 ++++++++++ .../stores/battlenet/BattleNetLibraryTest.kt | 34 +++++++++++++++++++ 6 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 app/src/test/java/com/droiddeck/launcher/stores/battlenet/BattleNetLibraryTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/session/GameStorage.kt b/app/src/main/java/com/droiddeck/launcher/session/GameStorage.kt index 263860334c..3c2d722c06 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/GameStorage.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/GameStorage.kt @@ -59,13 +59,18 @@ object GameStorage { return when { pref == SessionPrefs.GAME_STORAGE_OFF -> null pref.isEmpty() -> options(context).firstOrNull()?.let { Option(it.name, it.path) } - else -> Option(SessionPrefs.gameStorageLabel(context), pref).takeIf { attached(File(pref)) } + else -> reachable(pref).let { path -> Option(SessionPrefs.gameStorageLabel(context), path).takeIf { attached(File(path)) } } } } fun disconnected(context: Context): Boolean { val pref = SessionPrefs.gameStorage(context) - return pref.isNotEmpty() && pref != SessionPrefs.GAME_STORAGE_OFF && !attached(File(pref)) + return pref.isNotEmpty() && pref != SessionPrefs.GAME_STORAGE_OFF && !attached(File(reachable(pref))) + } + + internal fun reachable(path: String, usable: (File) -> Boolean = { it.isDirectory && it.canWrite() }): String { + val alias = UsbLink.storagePath(path) + return if (alias != path && !usable(File(path)) && usable(File(alias))) alias else path } internal fun attached( diff --git a/app/src/main/java/com/droiddeck/launcher/session/SecondaryLibrary.kt b/app/src/main/java/com/droiddeck/launcher/session/SecondaryLibrary.kt index 53fc319c26..08fa86f608 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SecondaryLibrary.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SecondaryLibrary.kt @@ -46,7 +46,16 @@ object SecondaryLibrary { } fun privateRoot(files: File, library: File): File { - val digest = MessageDigest.getInstance("SHA-256").digest(library.canonicalPath.toByteArray()) + val own = privateDir(files, library.canonicalPath) + if (own.exists()) return own + val raw = UsbLink.rawPath(library.absolutePath) + val alias = if (raw != library.absolutePath) raw else UsbLink.storagePath(library.absolutePath) + if (alias == library.absolutePath) return own + return privateDir(files, runCatching { File(alias).canonicalPath }.getOrDefault(alias)).takeIf { it.exists() } ?: own + } + + private fun privateDir(files: File, path: String): File { + val digest = MessageDigest.getInstance("SHA-256").digest(path.toByteArray()) .joinToString("") { "%02x".format(it.toInt() and 255) } return File(files, "steam-libraries/$digest") } diff --git a/app/src/main/java/com/droiddeck/launcher/stores/battlenet/BattleNetStore.kt b/app/src/main/java/com/droiddeck/launcher/stores/battlenet/BattleNetStore.kt index 426d3616a9..6ee2f1b16d 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/battlenet/BattleNetStore.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/battlenet/BattleNetStore.kt @@ -7,6 +7,7 @@ import com.droiddeck.launcher.R import com.droiddeck.launcher.frontend.AddedGames import com.droiddeck.launcher.runtime.BattleNet import com.droiddeck.launcher.runtime.LinuxRuntime +import com.droiddeck.launcher.session.GameStorage import com.droiddeck.launcher.stores.CatalogItem import com.droiddeck.launcher.stores.InstalledStoreGame import com.droiddeck.launcher.stores.Store @@ -130,13 +131,13 @@ object BattleNetClient { StoresState.post { opener?.invoke(args) } } - fun library(context: Context, root: File = preferred(context)): List = - AddedGames.guestPath(context, StoreInstallRoot.storeDir(root, Store.BATTLENET))?.let { listOf("--library", it) }.orEmpty() + fun library(context: Context, root: File? = preferred(context)): List = + root?.let { AddedGames.guestPath(context, StoreInstallRoot.storeDir(it, Store.BATTLENET)) }?.let { listOf("--library", it) }.orEmpty() - internal fun preferred(context: Context): File { + internal fun preferred(context: Context): File? { val second = StoreInstallRoot.libraryRoot(context)?.absolutePath return StoreInstallRoot.targets(context).firstOrNull { it.root.absolutePath == second && (it.root.isDirectory || it.root.mkdirs()) }?.root - ?: StoreInstallRoot.internalRoot(context) + ?: StoreInstallRoot.internalRoot(context).takeIf { second == null && !GameStorage.disconnected(context) } } fun installGame(context: Context, uid: String, root: File) { diff --git a/app/src/test/java/com/droiddeck/launcher/session/GameStorageTest.kt b/app/src/test/java/com/droiddeck/launcher/session/GameStorageTest.kt index a6b50eb1cc..c34cf0c854 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/GameStorageTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/GameStorageTest.kt @@ -114,6 +114,19 @@ class GameStorageTest { assertFalse(GameStorage.disconnected(app)) } + @Test fun aRawCardPathTheProcessCannotUseFallsBackToItsStoragePath() { + val usable = setOf("/storage/A042-9B16/Games") + assertEquals("/storage/A042-9B16/Games", GameStorage.reachable("/mnt/media_rw/A042-9B16/Games") { it.path in usable }) + } + + @Test fun aUsableRawPathAndOtherPathsAreKept() { + assertEquals("/mnt/media_rw/A042-9B16/Games", GameStorage.reachable("/mnt/media_rw/A042-9B16/Games") { true }) + assertEquals("/mnt/media_rw/0000-0000/Games", GameStorage.reachable("/mnt/media_rw/0000-0000/Games") { false }) + assertEquals("/storage/A042-9B16/Games", GameStorage.reachable("/storage/A042-9B16/Games") { false }) + val folder = tmp.newFolder("library").path + assertEquals(folder, GameStorage.reachable(folder) { false }) + } + @Test fun onlyAVfatMountCountsAsFat32() { val mounts = """ /dev/fuse /storage/emulated fuse rw 0 0 diff --git a/app/src/test/java/com/droiddeck/launcher/session/SecondaryLibraryTest.kt b/app/src/test/java/com/droiddeck/launcher/session/SecondaryLibraryTest.kt index a58e075380..47c55f349d 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/SecondaryLibraryTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/SecondaryLibraryTest.kt @@ -21,6 +21,24 @@ class SecondaryLibraryTest { assertFalse(SecondaryLibrary.privateRoot(files, content).exists()) } + @Test fun aCardReachedThroughItsOtherPathKeepsItsPrivateDirectories() { + val files = tmp.newFolder("files") + val raw = SecondaryLibrary.privateRoot(files, File("/mnt/media_rw/A042-9B16/Games")).apply { mkdirs() } + assertEquals(raw, SecondaryLibrary.privateRoot(files, File("/storage/A042-9B16/Games"))) + val storage = SecondaryLibrary.privateRoot(files, File("/storage/B2BD-BCFC/Games")).apply { mkdirs() } + assertEquals(storage, SecondaryLibrary.privateRoot(files, File("/mnt/media_rw/B2BD-BCFC/Games"))) + } + + @Test fun aLibraryWithItsOwnPrivateDirectoriesKeepsThem() { + val files = tmp.newFolder("files") + val own = SecondaryLibrary.privateRoot(files, File("/storage/A042-9B16/Games")).apply { mkdirs() } + val raw = File(own.parentFile, SecondaryLibrary.privateRoot(tmp.newFolder("other"), File("/mnt/media_rw/A042-9B16/Games")).name) + raw.mkdirs() + assertEquals(own, SecondaryLibrary.privateRoot(files, File("/storage/A042-9B16/Games"))) + assertEquals(raw, SecondaryLibrary.privateRoot(files, File("/mnt/media_rw/A042-9B16/Games"))) + assertFalse(SecondaryLibrary.privateRoot(files, File("/storage/emulated/0/Games")).exists()) + } + @Test fun aWritableAliasIsSelectedAndItsProbeIsRemoved() { val library = tmp.newFolder("shared") val candidate = File(tmp.root, "direct") diff --git a/app/src/test/java/com/droiddeck/launcher/stores/battlenet/BattleNetLibraryTest.kt b/app/src/test/java/com/droiddeck/launcher/stores/battlenet/BattleNetLibraryTest.kt new file mode 100644 index 0000000000..39f6d59448 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/stores/battlenet/BattleNetLibraryTest.kt @@ -0,0 +1,34 @@ +package com.droiddeck.launcher.stores.battlenet + +import com.droiddeck.launcher.session.SessionPrefs +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Rule +import org.junit.Test +import org.junit.rules.TemporaryFolder +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [33]) +class BattleNetLibraryTest { + private val app get() = RuntimeEnvironment.getApplication() + @get:Rule val tmp = TemporaryFolder() + + @Test fun aMissingLibraryLeavesBattleNetsInstallFolderAlone() { + SessionPrefs.setGameStorage(app, "/storage/0000-0000/Games", "SD card") + assertTrue(BattleNetClient.library(app).isEmpty()) + } + + @Test fun anAttachedLibraryIsHandedToBattleNet() { + SessionPrefs.setGameStorage(app, tmp.newFolder("card").path, "SD card") + assertEquals("--library", BattleNetClient.library(app).firstOrNull()) + } + + @Test fun internalStorageIsHandedToBattleNetWhenItIsTheChoice() { + SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "") + assertEquals("--library", BattleNetClient.library(app).firstOrNull()) + } +} From 7404fba5a3078578e6a3987d5a5ca26855196570 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Mon, 30 Nov 2026 14:24:05 -0500 Subject: [PATCH 113/120] fix(battlenet): an install folder chosen in Battle.net on the library's drive is kept (#3479) * fix(battlenet): an install folder chosen in Battle.net on the library's drive is kept Every open set Battle.net's default install folder back to the library folder whenever the two differed, so a folder the user picked in Battle.net on the same drive was replaced on the next open. The folder is now only moved to the library when it is unset, missing, or on another drive. * fix(battlenet): check the trimmed folder against the rootfs drives --- .../overlay/usr/local/bin/droiddeck-battlenet | 12 +++++++ tools/tests/test_battlenet.py | 31 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet b/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet index 0f426d9029..150013822d 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet @@ -350,6 +350,17 @@ def keeps_open(root): return isinstance(client, dict) and LAUNCH_BEHAVIOR[0] in client and client[LAUNCH_BEHAVIOR[0]] != LAUNCH_BEHAVIOR[1] +def chosen_folder(root, current, library): + current = current.strip() + folder = windows_path(root, current) if current else None + if not folder or rootfs_drive(root, current) or not os.path.isdir(folder): + return False + try: + return volume_root(os.path.realpath(folder)) == volume_root(os.path.realpath(library)) + except OSError: + return False + + def write_config(root, library=None): path = os.path.join(drive_c(root), *CONFIG) key, value = LAUNCH_BEHAVIOR @@ -374,6 +385,7 @@ def write_config(root, library=None): client["HardwareAcceleration"] = "false" changes.append("acceleration") if library and isinstance(client.setdefault("Install", {}), dict) \ + and not chosen_folder(root, str(client["Install"].get("DefaultInstallPath", "")), library) \ and str(client["Install"].get("DefaultInstallPath", "")).rstrip("/\\") != install_path(root, library).rstrip("\\"): client["Install"]["DefaultInstallPath"] = install_path(root, library) changes.append("library") diff --git a/tools/tests/test_battlenet.py b/tools/tests/test_battlenet.py index 06fdc779c4..c06924e42f 100644 --- a/tools/tests/test_battlenet.py +++ b/tools/tests/test_battlenet.py @@ -295,6 +295,37 @@ class DriveTest(Temp): self.assertEqual(BNET["install_path"](self.root, str(self.card)), "D:\\") self.assertEqual(sorted(os.listdir(self.devices)), ["d:"]) + def test_a_folder_chosen_in_battlenet_on_the_library_drive_is_kept(self): + path = Path(BNET["drive_c"](self.root)).joinpath(*BNET["CONFIG"]) + BNET["write_config"](self.root) + self.assertEqual(BNET["write_config"](self.root, str(self.library)), "library") + (self.card / "Battle.net").mkdir() + config = json.loads(path.read_text()) + config["Client"]["Install"]["DefaultInstallPath"] = "D:\\Battle.net" + path.write_text(json.dumps(config)) + self.assertIsNone(BNET["write_config"](self.root, str(self.library))) + self.assertEqual(json.loads(path.read_text())["Client"]["Install"]["DefaultInstallPath"], "D:\\Battle.net") + + def test_a_chosen_folder_inside_the_native_rootfs_is_not_kept_whatever_its_spacing(self): + BNET["write_config"](self.root, str(self.library)) + rootfs = self.card / "files/linuxfs" + (rootfs / "Games").mkdir(parents=True) + with mock.patch.dict(os.environ, {"DDNATV_ROOT": str(rootfs)}): + for current in ("D:\\files\\linuxfs\\Games", " D:\\files\\linuxfs\\Games"): + self.assertFalse(BNET["chosen_folder"](self.root, current, str(self.library))) + + def test_a_folder_on_another_drive_or_missing_moves_to_the_library(self): + path = Path(BNET["drive_c"](self.root)).joinpath(*BNET["CONFIG"]) + BNET["write_config"](self.root, str(self.library)) + internal = self.tmp / "root/Games/Stores/Battle.net" + internal.mkdir(parents=True) + for current in ("Z:" + str(internal), "D:\\Gone"): + config = json.loads(path.read_text()) + config["Client"]["Install"]["DefaultInstallPath"] = current + path.write_text(json.dumps(config)) + self.assertEqual(BNET["write_config"](self.root, str(self.library)), "library") + self.assertEqual(json.loads(path.read_text())["Client"]["Install"]["DefaultInstallPath"], "D:\\Games\\Battle.net") + def test_drives_in_use_and_the_ones_proton_owns_are_left_alone(self): self.devices.mkdir(parents=True) os.symlink("/somewhere/else", self.devices / "d:") From 5f129fb4dbe8ba9c06d4e69075e59fbbf8e899cf Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Mon, 30 Nov 2026 14:24:10 -0500 Subject: [PATCH 114/120] fix(native): allocated getcwd and realpath results name the guest mount (#3481) getcwd(NULL, ...) and realpath(path, NULL) returned the host path of a session mount whenever its guest path was longer than the host path, because the translation had to fit the buffer the C library allocated. Shells export that host path as PWD, and Wine prefers a valid PWD, so a program started from an added game folder on a removable card got a working directory it could not open and started in the Windows folder. Grow the allocated result to fit the guest path. --- tools/nativeguest/hook/fileops.c | 9 ++++----- tools/nativeguest/hook/paths.c | 14 ++++++++++++++ tools/tests/test_native_hook_mounts.py | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/tools/nativeguest/hook/fileops.c b/tools/nativeguest/hook/fileops.c index 840812fe69..a515e6a248 100644 --- a/tools/nativeguest/hook/fileops.c +++ b/tools/nativeguest/hook/fileops.c @@ -739,10 +739,8 @@ char *getcwd(char *buf, size_t size) { static char *(*orig_getcwd)(char *, size_t) = NULL; if (!orig_getcwd) orig_getcwd = (char *(*)(char *, size_t))dlsym(RTLD_NEXT, "getcwd"); char *res = orig_getcwd ? orig_getcwd(buf, size) : NULL; - if (res) { - size_t len = strlen(res); - guest_path_of_mount_source(res, len, buf ? size : len + 1, NULL); - } + if (res && !buf) return guest_path_of_allocated_mount_source(res); + if (res) guest_path_of_mount_source(res, strlen(res), size, NULL); return res; } @@ -790,7 +788,8 @@ char *realpath(const char *path, char *resolved_path) { } } } - if (res) guest_path_of_mount_source(res, strlen(res), resolved_path ? PATH_MAX : strlen(res) + 1, NULL); + if (res && !resolved_path) return guest_path_of_allocated_mount_source(res); + if (res) guest_path_of_mount_source(res, strlen(res), PATH_MAX, NULL); return res; } diff --git a/tools/nativeguest/hook/paths.c b/tools/nativeguest/hook/paths.c index 89605e1ebb..74983a7552 100644 --- a/tools/nativeguest/hook/paths.c +++ b/tools/nativeguest/hook/paths.c @@ -975,6 +975,20 @@ static size_t guest_path_of_mount_source(char *buf, size_t len, size_t cap, int return best->dst_len + rest; } +static char *guest_path_of_allocated_mount_source(char *res) { + size_t len = strlen(res); + char tmp[PATH_MAX]; + if (len >= sizeof(tmp)) return res; + memcpy(tmp, res, len + 1); + int converted = 0; + size_t n = guest_path_of_mount_source(tmp, len, sizeof(tmp), &converted); + if (!converted) return res; + char *grown = realloc(res, n + 1); + if (!grown) return res; + memcpy(grown, tmp, n + 1); + return grown; +} + static ssize_t postprocess_readlink(const char *linkpath, char *buf, ssize_t ret, size_t bufsiz) { if (ret <= 0) return ret; if ((size_t)ret < bufsiz) { diff --git a/tools/tests/test_native_hook_mounts.py b/tools/tests/test_native_hook_mounts.py index 63177f9ba4..0774f059e0 100644 --- a/tools/tests/test_native_hook_mounts.py +++ b/tools/tests/test_native_hook_mounts.py @@ -88,6 +88,18 @@ int main(int argc, char **argv) { printf("%s\t%s\n", argv[i], ok ? cwd : "-"); continue; } + if (strncmp(argv[i], "cdnull:", 7) == 0) { + char *got = chdir(argv[i] + 7) == 0 ? getcwd(NULL, 0) : NULL; + printf("%s\t%s\n", argv[i], got ? got : "-"); + free(got); + continue; + } + if (strncmp(argv[i], "realnull:", 9) == 0) { + char *got = realpath(argv[i] + 9, NULL); + printf("%s\t%s\n", argv[i], got ? got : "-"); + free(got); + continue; + } if (strncmp(argv[i], "lstat:", 6) == 0) { int ok = lstat(argv[i] + 6, &st) == 0; printf("%s\t%d\t%d\n", argv[i], ok, ok && S_ISLNK(st.st_mode)); @@ -324,6 +336,19 @@ class NativeHookMountTest(unittest.TestCase): arg = f"cd:/pfx/native/dosdevices/z:{GAME}/" self.assertEqual(self.run_probe(arg)[arg], [GAME]) + def test_allocated_working_directory_and_real_path_name_a_longer_guest_mount(self): + guest = "/root/Games/" + "g" * len(str(self.library)) + binds = f"{self.library}:{guest}" + args = [f"cd:{guest}/Some Game", f"cdnull:{guest}/Some Game", f"realnull:{guest}/Some Game/game.txt"] + result = self.run_probe(*args, binds=binds) + self.assertEqual(result[args[0]], [f"{guest}/Some Game"]) + self.assertEqual(result[args[1]], [f"{guest}/Some Game"]) + self.assertEqual(result[args[2]], [f"{guest}/Some Game/game.txt"]) + + def test_allocated_working_directory_names_a_shorter_guest_mount(self): + arg = f"cdnull:{GAME}" + self.assertEqual(self.run_probe(arg)[arg], [GAME]) + def test_rootfs_path_under_a_mount_point_reaches_the_mount(self): path = f"{self.root}{GAME}/game.txt" self.assertEqual(self.run_probe(path)[path], ["1", "library"]) From 430d777c5cb77050bc2ea9b3eaa91714eb3c5320 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Mon, 30 Nov 2026 16:02:30 -0400 Subject: [PATCH 115/120] Fix: Fix right stick highlights and preserve zoom bindings (#3440) * fix(input): stop stale right-stick page scrolling * fix(input): preserve other bindings when saving an action * test(input): cover zoom commands on same control category * test(input): remove unnecessary zoom binding cases * style(input): remove added inline comment --- .../main/java/com/droiddeck/launcher/FrontEndActivity.kt | 5 ++++- .../java/com/droiddeck/launcher/ui/InputSettingsPage.kt | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt index 293b75fea8..0a4fbb3b5c 100644 --- a/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/FrontEndActivity.kt @@ -2264,7 +2264,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet !com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return val device = event.device ?: return val rxRy = com.droiddeck.launcher.input.PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts) - ?: return + ?: run { + if (rightStickScrollDeviceId == event.deviceId) stopRightStickScroll() + return + } val axis = if (rxRy) android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ val value = event.getAxisValue(axis) if (kotlin.math.abs(value) < 0.55f) { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/InputSettingsPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/InputSettingsPage.kt index 2fe1346034..1274945a3b 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/InputSettingsPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/InputSettingsPage.kt @@ -174,14 +174,15 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe detail = if (library.usersOfBindings(b.id).size > 1) stringResource(R.string.input_shared_detail, b.name, library.usersOfBindings(b.id).size) else "${profile.name} · ${roleLabel(role)}", onSave = { action -> if (update { l -> + val currentPreset = l.preset(editing.preset) val geometry = if (!editing.click && elementProperties != null && layout != null) l.withLayout(layout.copy(elements = layout.elements.map { if (it.id == elementProperties!!.id) elementProperties!!.copy(name = elementProperties!!.name.trim().ifBlank { it.name }) else it })) else l geometry.withPreset(when { - editing.element != null && editing.click -> b.copy(clicks = b.clicks + (editing.element.id to action)) - editing.element != null -> b.copy(elements = b.elements + (editing.element.id to action)) - editing.key != null -> b.copy(keys = b.keys.filterNot { it.key == editing.key } + PhysicalInputBinding(editing.key, action)) - else -> b.copy(controls = b.controls + (editing.control to action)) + editing.element != null && editing.click -> currentPreset.copy(clicks = currentPreset.clicks + (editing.element.id to action)) + editing.element != null -> currentPreset.copy(elements = currentPreset.elements + (editing.element.id to action)) + editing.key != null -> currentPreset.copy(keys = currentPreset.keys.filterNot { it.key == editing.key } + PhysicalInputBinding(editing.key, action)) + else -> currentPreset.copy(controls = currentPreset.controls + (editing.control to action)) }) }) edit = null }) } else if (!surface) key(page, profileId, role) { From 5c887bfc599a9bbe4902deb4de39af9c57d25700 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Mon, 30 Nov 2026 16:03:30 -0400 Subject: [PATCH 116/120] Perf: Create screen-effect pipelines on demand (#3453) * perf: create screen-effect pipelines on demand * fix: prepare screen-effect fallback pipelines * docs: describe lazy screen-effect pipelines * test: guard lazy screen-effect pipeline setup --- .../main/cpp/waylandcomp/src/effects_chain.c | 158 +++++++++++------- docs/development/screen-effects.md | 28 ++++ tools/tests/test_effects_lazy_pipelines.py | 68 ++++++++ 3 files changed, 192 insertions(+), 62 deletions(-) create mode 100644 docs/development/screen-effects.md create mode 100644 tools/tests/test_effects_lazy_pipelines.py diff --git a/app/src/main/cpp/waylandcomp/src/effects_chain.c b/app/src/main/cpp/waylandcomp/src/effects_chain.c index d711e565f3..7848ecbc56 100644 --- a/app/src/main/cpp/waylandcomp/src/effects_chain.c +++ b/app/src/main/cpp/waylandcomp/src/effects_chain.c @@ -242,6 +242,8 @@ static struct fx_target g_t[2], g_mid, g_smaa_edges, g_smaa_weights; * Old set (or no buffer): nis.frag on the scene, P_NIS_LUMA unused. */ static struct fx_target g_nissrc; static int g_nis_fast; +static int g_nis_attempted; +static int g_upscale_half; static VkDescriptorSetLayout g_coef_dsl; static VkPipelineLayout g_pl_nis; static VkDescriptorPool g_coef_pool; @@ -486,6 +488,7 @@ static void objects_destroy(void) { if (g_rp) g_vk.DestroyRenderPass(g_dev, g_rp, NULL); g_dpool = VK_NULL_HANDLE; g_pl = VK_NULL_HANDLE; g_dsl = VK_NULL_HANDLE; g_sampler = VK_NULL_HANDLE; g_rp = VK_NULL_HANDLE; g_smaa_rp = VK_NULL_HANDLE; + g_nis_fast = 0; g_nis_attempted = 0; g_upscale_half = 0; g_ready = 0; } @@ -562,69 +565,11 @@ static int objects_ensure(void) { .poolSizeCount = 1, .pPoolSizes = &ps}; if (g_vk.CreateDescriptorPool(g_dev, &dpi, NULL, &g_dpool) != VK_SUCCESS) goto fail; - VkShaderModule vert = shader(upscale_vert_code, sizeof(upscale_vert_code)); - if (!vert) goto fail; -#define MKL(slot, code, name, layout) do { g_pipe[slot] = post_pipeline_for_renderpass(vert, code, sizeof(code), g_rp, name, layout); if (!g_pipe[slot]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; } } while (0) -#define MK(slot, code, name) MKL(slot, code, name, g_pl) - const int half = upscale_half_set(); + g_upscale_half = upscale_half_set(); g_nis_fast = 0; - if (half && !fx_alpha_holds_luma(g_fx_fmt)) - droiddeck_log("effects", "NIS uses nis.frag: the chain format has no 8-bit alpha for the luma prepass"); - else if (half && coef_create() != 0) - droiddeck_log("effects", "NIS coefficient buffer unavailable; NIS uses nis.frag"); - else if (half) - g_nis_fast = 1; - if (half) { - MK(P_SGSR, sgsr_half_code, "sgsr_half"); - MK(P_SGSR_HQ, sgsr_quality_half_code, "sgsr_quality_half"); - if (g_nis_fast) { - /* optional: a driver that rejects either fast NIS pipeline gets nis.frag, not a dead chain */ - g_pipe[P_NIS] = post_pipeline_for_renderpass(vert, nis3_half_code, sizeof(nis3_half_code), g_rp, "nis3_half", g_pl_nis); - g_pipe[P_NIS_LUMA] = g_pipe[P_NIS] - ? post_pipeline_for_renderpass(vert, nis_luma_half_code, sizeof(nis_luma_half_code), g_rp, "nis_luma_half", g_pl) - : VK_NULL_HANDLE; - if (!g_pipe[P_NIS] || !g_pipe[P_NIS_LUMA]) { - if (g_pipe[P_NIS]) g_vk.DestroyPipeline(g_dev, g_pipe[P_NIS], NULL); - g_pipe[P_NIS] = VK_NULL_HANDLE; - coef_destroy(); - g_nis_fast = 0; - droiddeck_log("effects", "fast NIS pipelines failed to build; NIS uses nis.frag"); - } - } - if (!g_nis_fast) MK(P_NIS, nis_code, "nis"); - MK(P_EASU, fsr_easu_half_code, "fsr_easu_half"); - MK(P_RCAS, fsr_rcas_half_code, "fsr_rcas_half"); - MK(P_CAS, cas_ffx_half_code, "cas_ffx_half"); - } else { - MK(P_SGSR, sgsr_code, "sgsr"); - MK(P_SGSR_HQ, sgsr_quality_code, "sgsr_quality"); - MK(P_NIS, nis_code, "nis"); - MK(P_EASU, fsr_easu_code, "fsr_easu"); - MK(P_RCAS, fsr_rcas_code, "fsr_rcas"); - MK(P_CAS, cas_code, "cas"); - } - MK(P_COLOR, color_code, "color"); - MK(P_FXAA, fxaa_code, "fxaa"); - MK(P_FXAA_TOON, fxaa_toon_code, "fxaa_toon"); - g_pipe[P_SMAA_EDGE] = post_pipeline_for_renderpass( - vert, smaa_edge_code, sizeof(smaa_edge_code), g_smaa_rp, "smaa_edge", g_pl); - if (!g_pipe[P_SMAA_EDGE]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; } - g_pipe[P_SMAA_WEIGHTS] = post_pipeline_for_renderpass( - vert, smaa_weights_code, sizeof(smaa_weights_code), g_smaa_rp, "smaa_weights", g_pl); - if (!g_pipe[P_SMAA_WEIGHTS]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; } - MK(P_SMAA_BLEND, smaa_blend_code, "smaa_blend"); - MK(P_TOON, toon_code, "toon"); - MK(P_TOON_COLOR, toon_color_code, "toon_color"); - MK(P_HDR, hdr_code, "hdr"); - MK(P_NTSC, ntsc_code, "ntsc"); - MK(P_CRT, crt_code, "crt"); - MK(P_DEBAND, deband_code, "deband"); -#undef MK -#undef MKL - g_vk.DestroyShaderModule(g_dev, vert, NULL); + g_nis_attempted = 0; g_ready = 1; - droiddeck_log("effects", "chain ready: 16 pipelines (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, SMAA edge/weights/blend, Toon, HDR, NTSC, CRT, deband), %s upscalers%s, on %s", - half ? "half-precision" : "old fp32", g_nis_fast ? " + NIS luma prepass" : "", vkp_gpu_name()); + droiddeck_log("effects", "shared resources ready on %s; effect pipelines are created when needed", vkp_gpu_name()); return 0; fail: objects_destroy(); @@ -633,6 +578,95 @@ fail: return -1; } +static int chain_failed(void) { + objects_destroy(); + g_ready = -1; + droiddeck_log("error", "effects: the screen-effect chain could not be built on this driver; effects are off for this session"); + return -1; +} + +static int pipelines_ensure(int spatial, const struct fx_settings *s) { + VkShaderModule vert = VK_NULL_HANDLE; +#define MKL(needed, slot, code, name, render_pass, layout) do { \ + if ((needed) && !g_pipe[slot]) { \ + if (!vert && !(vert = shader(upscale_vert_code, sizeof(upscale_vert_code)))) goto fail; \ + g_pipe[slot] = post_pipeline_for_renderpass(vert, code, sizeof(code), render_pass, name, layout); \ + if (!g_pipe[slot]) goto fail; \ + } \ +} while (0) +#define MK(needed, slot, code, name) MKL(needed, slot, code, name, g_rp, g_pl) + if (spatial == 3) { + if (g_upscale_half) MK(1, P_SGSR, sgsr_half_code, "sgsr_half"); + else MK(1, P_SGSR, sgsr_code, "sgsr"); + } + if (spatial == 8) { + if (g_upscale_half) MK(1, P_SGSR_HQ, sgsr_quality_half_code, "sgsr_quality_half"); + else MK(1, P_SGSR_HQ, sgsr_quality_code, "sgsr_quality"); + } + if (spatial == 4 || spatial == 5) { + if (g_upscale_half) MK(1, P_EASU, fsr_easu_half_code, "fsr_easu_half"); + else MK(1, P_EASU, fsr_easu_code, "fsr_easu"); + if (s->sharp_pct != 0) { + if (g_upscale_half) MK(1, P_RCAS, fsr_rcas_half_code, "fsr_rcas_half"); + else MK(1, P_RCAS, fsr_rcas_code, "fsr_rcas"); + } + } + if (spatial == 6) { + if (g_upscale_half) MK(1, P_RCAS, fsr_rcas_half_code, "fsr_rcas_half"); + else MK(1, P_RCAS, fsr_rcas_code, "fsr_rcas"); + } + if (spatial == 7) { + if (g_upscale_half && !g_nis_attempted) { + g_nis_attempted = 1; + if (!fx_alpha_holds_luma(g_fx_fmt)) + droiddeck_log("effects", "NIS uses nis.frag: the chain format has no 8-bit alpha for the luma prepass"); + else if (coef_create() != 0) + droiddeck_log("effects", "NIS coefficient buffer unavailable; NIS uses nis.frag"); + else { + if (!vert && !(vert = shader(upscale_vert_code, sizeof(upscale_vert_code)))) goto fail; + g_pipe[P_NIS] = post_pipeline_for_renderpass(vert, nis3_half_code, sizeof(nis3_half_code), g_rp, "nis3_half", g_pl_nis); + if (g_pipe[P_NIS]) + g_pipe[P_NIS_LUMA] = post_pipeline_for_renderpass(vert, nis_luma_half_code, sizeof(nis_luma_half_code), g_rp, "nis_luma_half", g_pl); + if (g_pipe[P_NIS] && g_pipe[P_NIS_LUMA]) g_nis_fast = 1; + else { + if (g_pipe[P_NIS]) g_vk.DestroyPipeline(g_dev, g_pipe[P_NIS], NULL); + if (g_pipe[P_NIS_LUMA]) g_vk.DestroyPipeline(g_dev, g_pipe[P_NIS_LUMA], NULL); + g_pipe[P_NIS] = VK_NULL_HANDLE; + g_pipe[P_NIS_LUMA] = VK_NULL_HANDLE; + coef_destroy(); + droiddeck_log("effects", "fast NIS pipelines failed to build; NIS uses nis.frag"); + } + } + } + if (!g_nis_fast) MK(1, P_NIS, nis_code, "nis"); + else if (g_upscale_half) MK(1, P_SGSR, sgsr_half_code, "sgsr_half"); + } + if (cas_active(s)) { + if (g_upscale_half) MK(1, P_CAS, cas_ffx_half_code, "cas_ffx_half"); + else MK(1, P_CAS, cas_code, "cas"); + } + if (s->color_on && !(s->toon && g_fx_fmt == FX_FORMAT)) MK(1, P_COLOR, color_code, "color"); + if (s->aa_mode == 1 || s->aa_mode == 2) MK(1, P_FXAA, fxaa_code, "fxaa"); + if (s->aa_mode == 2) { + MKL(1, P_SMAA_EDGE, smaa_edge_code, "smaa_edge", g_smaa_rp, g_pl); + MKL(1, P_SMAA_WEIGHTS, smaa_weights_code, "smaa_weights", g_smaa_rp, g_pl); + MK(1, P_SMAA_BLEND, smaa_blend_code, "smaa_blend"); + } + if (s->toon && s->color_on && g_fx_fmt == FX_FORMAT) MK(1, P_TOON_COLOR, toon_color_code, "toon_color"); + else if (s->toon) MK(1, P_TOON, toon_code, "toon"); + if (s->hdr_on) MK(1, P_HDR, hdr_code, "hdr"); + if (s->ntsc) MK(1, P_NTSC, ntsc_code, "ntsc"); + if (s->crt) MK(1, P_CRT, crt_code, "crt"); + if (deband_active(s)) MK(1, P_DEBAND, deband_code, "deband"); +#undef MK +#undef MKL + if (vert) g_vk.DestroyShaderModule(g_dev, vert, NULL); + return 0; +fail: + if (vert) g_vk.DestroyShaderModule(g_dev, vert, NULL); + return chain_failed(); +} + static void barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkImageLayout to, VkPipelineStageFlags src_stage, VkAccessFlags src_access, @@ -723,7 +757,7 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce effect_count(s) - (fuse_toon_color ? 1 : 0) - (fuse_fxaa_toon ? 1 : 0); - if ((spatial || nfx) && objects_ensure() == 0 && scene_ensure(scene, scene_w, scene_h) == 0 && + if ((spatial || nfx) && objects_ensure() == 0 && pipelines_ensure(spatial, s) == 0 && scene_ensure(scene, scene_w, scene_h) == 0 && target_ensure(&g_t[0], cw, ch, FX_TARGET_USAGE, "chain") == 0 && (chain_passes < 2 || target_ensure(&g_t[1], cw, ch, FX_TARGET_USAGE, "chain") == 0) && (!(spatial == 4 || spatial == 5) || s->sharp_pct == 0 || target_ensure(&g_mid, cw, ch, FX_SCRATCH_USAGE, "EASU") == 0)) { diff --git a/docs/development/screen-effects.md b/docs/development/screen-effects.md new file mode 100644 index 0000000000..2551c65a38 --- /dev/null +++ b/docs/development/screen-effects.md @@ -0,0 +1,28 @@ +# Screen-effect pipeline creation + +The screen-effect chain creates its shared render passes, sampler, descriptor +layout/pool and pipeline layout when first used. Graphics pipelines are created +only when the frame's settings require them, then reused until output-format +reset or explicit chain teardown. Source-image and size changes keep the cache. + +Pipeline preparation happens before any effect draw is recorded. If a required +pipeline fails to initialize, the chain follows its existing whole-chain +fallback and returns the unprocessed scene; it does not record a partial stack. +Settings are snapshotted at frame entry, so changes during recording apply to +the next invocation. + +Spatial upscalers are prepared only when their dispatch path is active. FSR +creates EASU and creates RCAS only when sharpening is enabled; sharpen-only +mode creates RCAS. SMAA prepares its three passes only when selected, while +keeping FXAA available for the existing SMAA scratch-allocation fallback. +Half-precision shaders remain selected by the existing debug property. The +optional fast NIS path and its coefficient resources are deferred until NIS is +actually used; the existing fragment-shader fallback is retained. + +This reduces unused pipeline creation and first-use setup work. It does not +reduce the shader work performed each frame, and first use of a newly selected +effect may still compile its pipelines. No background precompilation is added. +Pipeline-count reductions are not measurements of startup latency or FPS. + +Validation still requires the native effect-chain tests and on-device visual +testing. Static source checks alone do not establish Vulkan runtime correctness. diff --git a/tools/tests/test_effects_lazy_pipelines.py b/tools/tests/test_effects_lazy_pipelines.py new file mode 100644 index 0000000000..1da6a9c2f6 --- /dev/null +++ b/tools/tests/test_effects_lazy_pipelines.py @@ -0,0 +1,68 @@ +import pathlib +import unittest + + +ROOT = pathlib.Path(__file__).resolve().parents[2] +SOURCE = ROOT / "app/src/main/cpp/waylandcomp/src/effects_chain.c" + + +def function_body(source: str, signature: str) -> str: + start = source.index(signature) + opening = source.index("{", start) + depth = 0 + for pos in range(opening, len(source)): + if source[pos] == "{": + depth += 1 + elif source[pos] == "}": + depth -= 1 + if depth == 0: + return source[opening + 1:pos] + raise AssertionError(f"unterminated function: {signature}") + + +class LazyEffectPipelineSourceTest(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.source = SOURCE.read_text(encoding="utf-8") + + def test_shared_setup_does_not_create_graphics_pipelines(self): + body = function_body(self.source, "static int objects_ensure(void)") + self.assertNotIn("post_pipeline_for_renderpass(", body) + self.assertNotIn("shader(upscale_vert_code", body) + self.assertIn("effect pipelines are created when needed", body) + + def test_pipelines_are_prepared_before_effect_chain_resources_and_draws(self): + body = function_body(self.source, "VkImage vkp_effects_run(") + prepare = body.index("pipelines_ensure(spatial, s)") + scene = body.index("scene_ensure(scene, scene_w, scene_h)") + self.assertLess(prepare, scene) + self.assertIn("objects_ensure() == 0 && pipelines_ensure(spatial, s) == 0", body) + + def test_lazy_path_covers_active_upscalers_and_effects(self): + body = function_body(self.source, "static int pipelines_ensure(") + for required in ( + "spatial == 3", "spatial == 8", "spatial == 4 || spatial == 5", + "spatial == 6", "spatial == 7", "cas_active(s)", + "s->color_on", "s->aa_mode == 1 || s->aa_mode == 2", + "s->aa_mode == 2", "s->toon", "s->hdr_on", "s->ntsc", + "s->crt", "deband_active(s)", + ): + with self.subTest(required=required): + self.assertIn(required, body) + + def test_existing_fallback_pipelines_are_prepared(self): + body = function_body(self.source, "static int pipelines_ensure(") + self.assertIn("s->aa_mode == 1 || s->aa_mode == 2", body) + self.assertIn("else if (g_upscale_half) MK(1, P_SGSR, sgsr_half_code", body) + self.assertIn("if (!g_nis_fast) MK(1, P_NIS, nis_code", body) + + def test_failed_preparation_uses_whole_chain_fallback(self): + body = function_body(self.source, "static int pipelines_ensure(") + self.assertIn("return chain_failed();", body) + failure = function_body(self.source, "static int chain_failed(void)") + self.assertIn("objects_destroy();", failure) + self.assertIn("g_ready = -1;", failure) + + +if __name__ == "__main__": + unittest.main() From 41f15b03bb002c56f22616779c40ed7fa8c5ddc1 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Mon, 30 Nov 2026 16:03:52 -0400 Subject: [PATCH 117/120] feat(framegen): add spatial post-upscale per presentation (#3454) * feat(framegen): add spatial post-upscale per presentation * Fix framegen post-upscale expectations * test: run framegen post-upscale assertions * test: verify framegen postprocessing image handles * test: capture framegen screen blit source --- .../main/cpp/waylandcomp/src/effects_chain.c | 138 +++++++++++++++--- .../main/cpp/waylandcomp/src/effects_chain.h | 6 + .../cpp/waylandcomp/src/framegen_bridge.c | 6 +- app/src/main/cpp/waylandcomp/src/vk_present.c | 35 ++++- docs/development/framegen-post-upscale.md | 68 +++++++++ tools/tests/effects_source_cache_harness.c | 79 +++++++++- tools/tests/test_effects_source_cache.py | 6 + tools/tests/test_effects_source_resolution.py | 93 ++++++++++-- tools/tests/test_framegen_ring_lifetime.py | 59 ++++++++ tools/tests/vk_terminal_callers_test.c | 9 ++ 10 files changed, 457 insertions(+), 42 deletions(-) create mode 100644 docs/development/framegen-post-upscale.md create mode 100644 tools/tests/test_framegen_ring_lifetime.py diff --git a/app/src/main/cpp/waylandcomp/src/effects_chain.c b/app/src/main/cpp/waylandcomp/src/effects_chain.c index 7848ecbc56..a94d7b7906 100644 --- a/app/src/main/cpp/waylandcomp/src/effects_chain.c +++ b/app/src/main/cpp/waylandcomp/src/effects_chain.c @@ -3,6 +3,7 @@ #include "blend_pass.h" #include "vk_loader.h" #include "vk_present.h" +#include "framegen_bridge.h" #include #include #include @@ -69,6 +70,7 @@ static struct fx_settings g_set = { .gamma = 1.0f, .saturation = 1.0f, .s_raw = 100.0f, .look = "Off"}; static volatile int g_changed; static struct fx_settings g_cur; +static struct fx_settings g_generated_settings; static int g_cur_valid; static void set_begin(void) { pthread_mutex_lock(&g_lock); } @@ -235,12 +237,21 @@ static VkDescriptorPool g_dpool; static VkSampler g_sampler; enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_FXAA_TOON, P_SMAA_EDGE, P_SMAA_WEIGHTS, P_SMAA_BLEND, P_TOON, P_TOON_COLOR, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_NIS_LUMA, P_COUNT }; static VkPipeline g_pipe[P_COUNT]; -static struct fx_target g_t[2], g_mid, g_smaa_edges, g_smaa_weights; +struct fx_context { + struct fx_target targets[2], mid, nissrc; + struct { VkImage img; VkImageView view; VkDescriptorSet ds; int w, h; } scene; +}; +#define FX_CONTEXTS (VKP_FG_MAX_GENERATIONS + 2) +static struct fx_context g_contexts[FX_CONTEXTS]; +static int g_context; +#define g_t (g_contexts[g_context].targets) +#define g_mid (g_contexts[g_context].mid) +#define g_nissrc (g_contexts[g_context].nissrc) +static struct fx_target g_smaa_edges, g_smaa_weights; /* Half set: NIS = nis_luma prepass (scene rgb + luma in alpha, scene size) into g_nissrc, then * nis3 gathers its luma from that alpha, its coefficient banks (nis_coef.h) in a uniform buffer * at descriptor set 1 (g_pl_nis = {g_dsl, g_coef_dsl}, same push-constant range as g_pl). * Old set (or no buffer): nis.frag on the scene, P_NIS_LUMA unused. */ -static struct fx_target g_nissrc; static int g_nis_fast; static int g_nis_attempted; static int g_upscale_half; @@ -251,7 +262,7 @@ static VkDescriptorSet g_coef_ds; static VkBuffer g_coef_buf; static VkDeviceMemory g_coef_mem; -static struct { VkImage img; VkImageView view; VkDescriptorSet ds; int w, h; } g_scene; +#define g_scene (g_contexts[g_context].scene) void vkp_effects_bind_device(VkDevice dev, VkPhysicalDevice pd, const VkPhysicalDeviceMemoryProperties *memprops) { @@ -349,7 +360,15 @@ static void scene_release(void) { } void vkp_effects_forget_image(VkImage img) { - if (img && g_scene.img == img) scene_release(); + int saved = g_context; + for (g_context = 0; g_context < FX_CONTEXTS; g_context++) + if (img && g_scene.img == img) scene_release(); + g_context = saved; +} + +void vkp_effects_release_generated_sources(void) { + for (g_context = 1; g_context < FX_CONTEXTS; g_context++) scene_release(); + g_context = 0; } static int scene_ensure(VkImage img, int w, int h) { @@ -475,9 +494,14 @@ static int upscale_half_set(void) { static void objects_destroy(void) { if (!g_dev) return; - scene_release(); - target_destroy(&g_t[0]); target_destroy(&g_t[1]); target_destroy(&g_mid); - target_destroy(&g_smaa_edges); target_destroy(&g_smaa_weights); target_destroy(&g_nissrc); + int saved = g_context; + for (g_context = 0; g_context < FX_CONTEXTS; g_context++) { + scene_release(); + target_destroy(&g_t[0]); target_destroy(&g_t[1]); target_destroy(&g_mid); + target_destroy(&g_nissrc); + } + g_context = saved; + target_destroy(&g_smaa_edges); target_destroy(&g_smaa_weights); for (int i = 0; i < P_COUNT; i++) { if (g_pipe[i]) g_vk.DestroyPipeline(g_dev, g_pipe[i], NULL); g_pipe[i] = VK_NULL_HANDLE; } if (g_dpool) g_vk.DestroyDescriptorPool(g_dev, g_dpool, NULL); if (g_pl) g_vk.DestroyPipelineLayout(g_dev, g_pl, NULL); @@ -508,7 +532,9 @@ void vkp_effects_set_formats(VkFormat scene_fmt, VkFormat target_fmt, int scene_ : target_fmt == VK_FORMAT_R16G16B16A16_SFLOAT ? "the HDR picture for frame generation" : "the HDR composition's picture: PQ, or tone-mapped SDR with HDR output off"); } else if (scene_fmt != g_scene_fmt) { - scene_release(); + int saved = g_context; + for (g_context = 0; g_context < FX_CONTEXTS; g_context++) scene_release(); + g_context = saved; g_scene_fmt = scene_fmt; } } @@ -559,9 +585,9 @@ static int objects_ensure(void) { VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 2, .pSetLayouts = set_layouts, .pushConstantRangeCount = 1, .pPushConstantRanges = &pcr}; if (g_vk.CreatePipelineLayout(g_dev, &pli, NULL, &g_pl) != VK_SUCCESS) goto fail; - VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 10}; + VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, FX_CONTEXTS * 5 + 2}; VkDescriptorPoolCreateInfo dpi = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, - .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, .maxSets = 10, + .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, .maxSets = FX_CONTEXTS * 5 + 2, .poolSizeCount = 1, .pPoolSizes = &ps}; if (g_vk.CreateDescriptorPool(g_dev, &dpi, NULL, &g_dpool) != VK_SUCCESS) goto fail; @@ -715,14 +741,26 @@ static void pass_dual(VkCommandBuffer cmd, VkPipeline p, struct fx_target *dst, static const float FULL_NDC[4] = {-1.0f, -1.0f, 1.0f, 1.0f}; #define SET_NDC(pc) memcpy((pc).ndc, FULL_NDC, sizeof(FULL_NDC)) -VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h, - int out_w, int out_h, int *res_w, int *res_h) { +struct fx_source_state { + VkImageLayout layout; + VkPipelineStageFlags stage; + VkAccessFlags access; +}; + +static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h, + int out_w, int out_h, int *res_w, int *res_h, + VkImageLayout input_layout, const struct fx_settings *frozen, + struct fx_source_state *source_state) { struct fx_settings snapshot; const struct fx_settings *s; - vkp_effects_sync(); - pthread_mutex_lock(&g_lock); - snapshot = g_cur; - pthread_mutex_unlock(&g_lock); + if (frozen) { + snapshot = *frozen; + } else { + vkp_effects_sync(); + pthread_mutex_lock(&g_lock); + snapshot = g_cur; + pthread_mutex_unlock(&g_lock); + } s = &snapshot; *res_w = scene_w; *res_h = scene_h; @@ -782,8 +820,10 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce g_vk.CmdSetScissor(cmd, 0, 1, &chain_sc); if (spatial) { - barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, - VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, + if (source_state) *source_state = (struct fx_source_state){VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, + VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT}; + barrier(cmd, scene, input_layout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT); struct fx_target *dst = FREE_TARGET(); if (spatial == 3 || spatial == 8 || spatial == 7) { @@ -843,8 +883,10 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce cur = dst; cur_ds = dst->ds; } else if (resize) { struct fx_target *dst = FREE_TARGET(); - barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, + if (source_state) *source_state = (struct fx_source_state){VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT}; + barrier(cmd, scene, input_layout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT); barrier(cmd, dst->img, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT); @@ -857,8 +899,10 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT); cur = dst; cur_ds = dst->ds; } else { - barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, - VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, + if (source_state) *source_state = (struct fx_source_state){VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, + VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT}; + barrier(cmd, scene, input_layout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT); cur = NULL; cur_ds = g_scene.ds; } @@ -941,8 +985,54 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce return scene; } - barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, + if (source_state) *source_state = (struct fx_source_state){VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT}; + barrier(cmd, scene, input_layout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT); return scene; } + +VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h, + int out_w, int out_h, int *res_w, int *res_h) { + return effects_run(cmd, scene, scene_w, scene_h, out_w, out_h, res_w, res_h, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, NULL, NULL); +} + +int vkp_effects_prepare_generated(void) { + vkp_effects_sync(); + pthread_mutex_lock(&g_lock); + g_generated_settings = g_cur; + pthread_mutex_unlock(&g_lock); + return spatial_mode(g_generated_settings.scaling) && g_generated_settings.scaling != 6 && + effect_count(&g_generated_settings) == 0; +} + +VkImage vkp_effects_run_before_generated(VkCommandBuffer cmd, VkImage scene, int w, int h, + int *res_w, int *res_h) { + struct fx_settings settings = g_generated_settings; + settings.scaling = 0; + return effects_run(cmd, scene, w, h, w, h, res_w, res_h, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &settings, NULL); +} + +VkImage vkp_effects_run_generated(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h, + int out_w, int out_h, int slot, int *res_w, int *res_h) { + if (slot < 0 || slot > VKP_FG_MAX_GENERATIONS) { + *res_w = scene_w; *res_h = scene_h; + return scene; + } + g_context = slot + 1; + struct fx_source_state source_state = {0}; + VkImage result = effects_run(cmd, scene, scene_w, scene_h, out_w, out_h, res_w, res_h, + VK_IMAGE_LAYOUT_GENERAL, &g_generated_settings, &source_state); + barrier(cmd, result, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_GENERAL, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT); + if (result != scene) + barrier(cmd, scene, source_state.layout, VK_IMAGE_LAYOUT_GENERAL, + source_state.stage, source_state.access, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT); + g_context = 0; + return result; +} diff --git a/app/src/main/cpp/waylandcomp/src/effects_chain.h b/app/src/main/cpp/waylandcomp/src/effects_chain.h index 0617dd954f..99f2ad93d5 100644 --- a/app/src/main/cpp/waylandcomp/src/effects_chain.h +++ b/app/src/main/cpp/waylandcomp/src/effects_chain.h @@ -18,6 +18,12 @@ VkFilter vkp_effects_blit_filter(void); VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h, int out_w, int out_h, int *res_w, int *res_h); +int vkp_effects_prepare_generated(void); +void vkp_effects_release_generated_sources(void); +VkImage vkp_effects_run_before_generated(VkCommandBuffer cmd, VkImage scene, int w, int h, + int *res_w, int *res_h); +VkImage vkp_effects_run_generated(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h, + int out_w, int out_h, int slot, int *res_w, int *res_h); void vkp_effects_destroy(void); diff --git a/app/src/main/cpp/waylandcomp/src/framegen_bridge.c b/app/src/main/cpp/waylandcomp/src/framegen_bridge.c index 007b2dcbde..385475f950 100644 --- a/app/src/main/cpp/waylandcomp/src/framegen_bridge.c +++ b/app/src/main/cpp/waylandcomp/src/framegen_bridge.c @@ -1,6 +1,7 @@ #define _POSIX_C_SOURCE 200809L #include "framegen_bridge.h" #include "framegen_engine.h" +#include "effects_chain.h" #include "vk_loader.h" #include #include @@ -226,7 +227,10 @@ static void destroy_ring(void) { if (vk.DeviceWaitIdle) vk.DeviceWaitIdle(g_dev); for (uint32_t i = 0; i < g_ring_n; i++) { if (g_ring[i].view) vk.DestroyImageView(g_dev, g_ring[i].view, NULL); - if (g_ring[i].img) vk.DestroyImage(g_dev, g_ring[i].img, NULL); + if (g_ring[i].img) { + vkp_effects_forget_image(g_ring[i].img); + vk.DestroyImage(g_dev, g_ring[i].img, NULL); + } if (g_ring[i].mem) vk.FreeMemory(g_dev, g_ring[i].mem, NULL); memset(&g_ring[i], 0, sizeof(g_ring[i])); } diff --git a/app/src/main/cpp/waylandcomp/src/vk_present.c b/app/src/main/cpp/waylandcomp/src/vk_present.c index faa89e89b5..5dba2a5ede 100644 --- a/app/src/main/cpp/waylandcomp/src/vk_present.c +++ b/app/src/main/cpp/waylandcomp/src/vk_present.c @@ -2759,6 +2759,21 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i pass_n = 1; overlay_start = source_end; } + const int upscale_w = (int)(scene_w * g_map.kx + 0.5f); + const int upscale_h = (int)(scene_h * g_map.ky + 0.5f); + const int post_upscale = fx && fg && !hf && !cb && vkp_effects_upscaling() && + vkp_effects_prepare_generated() && + (upscale_w > input_w || upscale_h > input_h); + if (post_upscale) { + static int last_input_w, last_input_h, last_output_w, last_output_h; + if (input_w != last_input_w || input_h != last_input_h || + upscale_w != last_output_w || upscale_h != last_output_h) { + droiddeck_log("framegen", "post-upscale: interpolate %dx%d, spatial filter each present to %dx%d", + input_w, input_h, upscale_w, upscale_h); + last_input_w = input_w; last_input_h = input_h; + last_output_w = upscale_w; last_output_h = upscale_h; + } + } const int deep = hf && n > 0 && fg && g_swap_is_hdr && !hf->tonemap && vkp_framegen_format_ok(FG_HDR_FMT) && ensure_img(&g_fgscene, scene_w, scene_h, FG_HDR_FMT, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | @@ -2894,8 +2909,11 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i if (fx) { int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f); if (fg && !vkp_effects_sharpening()) { mapped_w = scene_w; mapped_h = scene_h; } + if (post_upscale) { mapped_w = input_w; mapped_h = input_h; } vkp_effects_set_formats(scene_fmt, scene_fmt, hdr_how == 1 || hdr_unconverted); - result = vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h, &rw, &rh); + result = post_upscale + ? vkp_effects_run_before_generated(cmd, scene_img, input_w, input_h, &rw, &rh) + : vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h, &rw, &rh); effects_overlay_draws(cmd, result, rw, rh, scene_w, scene_h, draws ? draws + overlay_start : NULL, n - overlay_start); release_external_client_draws(cmd, draws, n); @@ -2918,7 +2936,12 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i if (ngen > VKP_FG_MAX_GENERATIONS) ngen = VKP_FG_MAX_GENERATIONS; } - record_screen_blit(cmd, ngen ? gens[0] : result, rw, rh, scene_w, scene_h, img, blit_filter, cb); + VkImage screen = ngen ? gens[0] : result; + int screen_w = rw, screen_h = rh; + if (post_upscale) + screen = vkp_effects_run_generated(cmd, screen, rw, rh, upscale_w, upscale_h, + 0, &screen_w, &screen_h); + record_screen_blit(cmd, screen, screen_w, screen_h, scene_w, scene_h, img, blit_filter, cb); } g_vk.EndCommandBuffer(cmd); @@ -2942,7 +2965,12 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i VkCommandBuffer ck = g_cmds[k]; g_vk.ResetCommandBuffer(ck, 0); g_vk.BeginCommandBuffer(ck, &bi); - record_screen_blit(ck, k < ngen ? gens[k] : result, rw, rh, scene_w, scene_h, img, blit_filter, cb); + VkImage screen = k < ngen ? gens[k] : result; + int screen_w = rw, screen_h = rh; + if (post_upscale) + screen = vkp_effects_run_generated(ck, screen, rw, rh, upscale_w, upscale_h, + k, &screen_w, &screen_h); + record_screen_blit(ck, screen, screen_w, screen_h, scene_w, scene_h, img, blit_filter, cb); g_vk.EndCommandBuffer(ck); } const int last = (k + 1 == presents); @@ -2988,6 +3016,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i VkResult fr = timed_wait(g_fence, UINT64_MAX); if (fr == VK_ERROR_DEVICE_LOST || pr == VK_ERROR_DEVICE_LOST) { device_lost("present"); return -1; } if (fr != VK_SUCCESS) return -1; + vkp_effects_release_generated_sources(); if (fg) vkp_framegen_presented(presented_gen); if (pr == VK_ERROR_OUT_OF_DATE_KHR || pr == VK_ERROR_SURFACE_LOST_KHR) { droiddeck_log("gpu", "screen surface %s on present: rebuilding the swapchain", vk_result_name(pr)); diff --git a/docs/development/framegen-post-upscale.md b/docs/development/framegen-post-upscale.md new file mode 100644 index 0000000000..084040d96d --- /dev/null +++ b/docs/development/framegen-post-upscale.md @@ -0,0 +1,68 @@ +# Experimental spatial upscaling after frame generation + +The compositor limits effects output to the logical scene size while frame +generation is active. This avoids running interpolation over the full phone +panel, but can make FSR/GSR/NIS see equal input and output sizes and skip their +spatial pass. Version 0.5.0 instead upscaled before interpolation, which made +the interpolation workload scale with panel resolution. + +This experiment keeps the existing source-resolution selection and runs frame +generation at the effects input size. Each generated frame and the final real +frame then uses the selected spatial filter at the mapped display size. +It introduces no extra frame queue or CPU fence wait. Performance and latency +improvements are hypotheses, not measured results. + +## Scope and activation + +Use an SDR game with a real input buffer smaller than the mapped output. +Enable frame generation and select AMD FSR 1, FSR Fit, Snapdragon GSR/GSR HQ, +or NIS in the scaling filter setting. Keep additional effects (CAS, color, +FXAA, CRT, etc.) off for this experiment. Sharpen-only, linear, nearest, +frame-generation-off, HDR and cardboard paths retain their existing behavior. +Combining a spatial filter with additional effects also retains the old path; +this experiment does not claim to fix that combination. + +Source selection remains conservative. A game already rendering a native-size +backbuffer cannot recover its lower internal rendering resolution here. +Overlays included in the low-resolution input are interpolated/upscaled with +that input; this is not a separate native-resolution HUD reconstruction. + +GPU targets and source descriptors are separate for each presentation slot so +recording one generated frame cannot replace another frame's bindings. +Source views are released after the existing frame-completion fence; targets +are cached and destroyed with the effects device. This increases GPU memory +use with interpolation multiplier and panel resolution. Allocation failures +retain the input-sized image and the existing screen blit fallback. + +## Applying and reverting + +Install the test APK produced for this PR. Check its signing/package identity +before replacing an installed release: an Actions test-key APK is not a +release-signed update. An official signed test build requires the repository's +normal publication authorization. Back up session logs and record the exact +APK commit, GPU driver, engine and game settings for comparisons. + +No setting migration is required. Disable frame generation or select Linear +to return to the previous presentation path. Do not mix this test with Vulkan +feature-level or game compatibility changes. + +## Device validation required before merge + +- Compare the same scene on baseline main and this branch: FG off/on, Linear, + FSR, GSR, GSR HQ, NIS, FSR Fit, sharpen-only and nearest. +- Test each supported interpolation multiplier, both engines, warm-up/no + generated frames, 720p-to-1080p and 1080p-to-panel scaling, and no upscale. +- Check real and generated frames for consistent sharpness, halos, ghosting, + text/cursor artifacts, black bars, stretching and frame-order errors. +- Change resolution/filter/engine/multiplier live; open Steam/QAM, rotate, + suspend/resume and stop/restart. Verify no stale image, GPU loss or crash. +- Confirm HDR, cardboard, FG-off and additional-effects fallback behavior. +- Compare sustained frame pacing, generated vs real FPS, GPU load, memory, + temperature and battery use after warm-up; do not treat output FPS alone as + lower input latency. Measure input-to-display latency if equipment permits. +- Test memory pressure and allocation failure fallback; inspect Vulkan + validation for descriptor lifetime, image layouts and synchronization. + +Host harnesses exercise resolution routing, generated/real frame counts, +filter gates, fallback and source descriptor lifetime. They do not validate +shader output, mobile-driver behavior, performance or physical input latency. diff --git a/tools/tests/effects_source_cache_harness.c b/tools/tests/effects_source_cache_harness.c index f947b230b0..475d4b1331 100644 --- a/tools/tests/effects_source_cache_harness.c +++ b/tools/tests/effects_source_cache_harness.c @@ -51,6 +51,70 @@ static VkResult VKAPI_CALL allocate_set(VkDevice dev, const VkDescriptorSetAlloc *out = (VkDescriptorSet)(uintptr_t)(200 + ++sets); return VK_SUCCESS; } + +static VkImageLayout restored_layout; +static VkPipelineStageFlags restored_stage; +static void VKAPI_CALL pipeline_barrier(VkCommandBuffer cmd, VkPipelineStageFlags src, VkPipelineStageFlags dst, + VkDependencyFlags flags, uint32_t nm, const VkMemoryBarrier *m, uint32_t nb, + const VkBufferMemoryBarrier *b, uint32_t ni, const VkImageMemoryBarrier *images) { + for (uint32_t k = 0; k < ni; k++) { + if (images[k].image == (VkImage)(uintptr_t)10 && images[k].newLayout == VK_IMAGE_LAYOUT_GENERAL) { + restored_layout = images[k].oldLayout; + restored_stage = src; + } + } +} +static void VKAPI_CALL begin_pass(VkCommandBuffer c, const VkRenderPassBeginInfo *i, VkSubpassContents s) {} +static void VKAPI_CALL viewport(VkCommandBuffer c, uint32_t f, uint32_t n, const VkViewport *v) {} +static void VKAPI_CALL scissor(VkCommandBuffer c, uint32_t f, uint32_t n, const VkRect2D *v) {} +static void VKAPI_CALL bind_pipeline(VkCommandBuffer c, VkPipelineBindPoint b, VkPipeline p) {} +static void VKAPI_CALL bind_sets(VkCommandBuffer c, VkPipelineBindPoint b, VkPipelineLayout l, uint32_t f, + uint32_t n, const VkDescriptorSet *s, uint32_t nd, const uint32_t *d) {} +static void VKAPI_CALL push(VkCommandBuffer c, VkPipelineLayout l, VkShaderStageFlags s, uint32_t o, + uint32_t n, const void *v) {} +static void VKAPI_CALL draw(VkCommandBuffer c, uint32_t n, uint32_t i, uint32_t f, uint32_t fi) {} +static void VKAPI_CALL end_pass(VkCommandBuffer c) {} +static void VKAPI_CALL blit(VkCommandBuffer c, VkImage a, VkImageLayout al, VkImage b, VkImageLayout bl, + uint32_t n, const VkImageBlit *r, VkFilter f) {} + +static void check_generated_settings_and_layout(void) { + g_vk.CmdPipelineBarrier = pipeline_barrier; + g_vk.CmdBeginRenderPass = begin_pass; + g_vk.CmdSetViewport = viewport; g_vk.CmdSetScissor = scissor; + g_vk.CmdBindPipeline = bind_pipeline; g_vk.CmdBindDescriptorSets = bind_sets; + g_vk.CmdPushConstants = push; g_vk.CmdDraw = draw; g_vk.CmdEndRenderPass = end_pass; + g_vk.CmdBlitImage = blit; + g_ready = 1; + for (int k = 0; k < 2; k++) { + struct fx_target *t = &g_contexts[1].targets[k]; + t->img = (VkImage)(uintptr_t)(30 + k); t->w = 1920; t->h = 1080; + } + vkp_effects_set_scaling(3); + assert(vkp_effects_prepare_generated()); + vkp_effects_set_scaling(0); + vkp_effects_set_cas(1, 75); + vkp_effects_sync(); + assert(g_cur.scaling == 0 && cas_active(&g_cur)); + assert(g_generated_settings.scaling == 3 && !effect_count(&g_generated_settings)); + int w, h; + VkImage input = (VkImage)(uintptr_t)10; + assert(vkp_effects_run_before_generated(VK_NULL_HANDLE, input, 1280, 720, &w, &h) == input); + assert(w == 1280 && h == 720); + assert(vkp_effects_run_generated(VK_NULL_HANDLE, input, 1280, 720, 1920, 1080, 0, &w, &h) != input); + assert(w == 1920 && h == 1080); + assert(restored_layout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); + assert(restored_stage == VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); + g_generated_settings.scaling = 0; + g_generated_settings.color_on = 1; + assert(vkp_effects_run_generated(VK_NULL_HANDLE, input, 1280, 720, 1920, 1080, 0, &w, &h) != input); + assert(restored_layout == VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); + assert(restored_stage == VK_PIPELINE_STAGE_TRANSFER_BIT); + g_ready = -1; + assert(vkp_effects_run_generated(VK_NULL_HANDLE, input, 1280, 720, 1920, 1080, 0, &w, &h) == input); + assert(w == 1280 && h == 720); + assert(restored_layout == VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); + assert(g_context == 0); +} static void VKAPI_CALL update_set(VkDevice dev, uint32_t count, const VkWriteDescriptorSet *writes, uint32_t copies, const VkCopyDescriptorSet *copy) { (void)dev; (void)copies; (void)copy; @@ -84,7 +148,20 @@ int main(int argc, char **argv) { VkImage source = (VkImage)(uintptr_t)10; assert(scene_ensure(source, 1280, 720) == 0); VkImageView original = bound_view; - if (!strcmp(argv[1], "recycled")) { + if (!strcmp(argv[1], "generated-layout")) { + check_generated_settings_and_layout(); + } else if (!strcmp(argv[1], "generated")) { + for (int k = 1; k < FX_CONTEXTS; k++) { + g_context = k; + assert(scene_ensure((VkImage)(uintptr_t)(10 + k), 1280, 720) == 0); + } + assert(sets == FX_CONTEXTS && !freed_sets); + vkp_effects_release_generated_sources(); + assert(g_context == 0 && freed_sets == FX_CONTEXTS - 1); + assert(g_scene.img == source && g_scene.view == original); + vkp_effects_release_generated_sources(); + assert(freed_sets == FX_CONTEXTS - 1); + } else if (!strcmp(argv[1], "recycled")) { vkp_effects_forget_image(source); assert(freed_sets == 1 && freed_views == 1); assert(scene_ensure(source, 1280, 720) == 0); diff --git a/tools/tests/test_effects_source_cache.py b/tools/tests/test_effects_source_cache.py index d42045b1cf..163bef4bb6 100644 --- a/tools/tests/test_effects_source_cache.py +++ b/tools/tests/test_effects_source_cache.py @@ -57,6 +57,12 @@ class EffectsSourceCacheTest(unittest.TestCase): def test_resize_replaces_the_cached_view_and_descriptor(self): self.check_cache('resize') + def test_generated_frames_keep_separate_descriptors_until_completion(self): + self.check_cache('generated') + + def test_generated_settings_snapshot_and_source_layout_restoration(self): + self.check_cache('generated-layout') + if __name__ == '__main__': unittest.main() diff --git a/tools/tests/test_effects_source_resolution.py b/tools/tests/test_effects_source_resolution.py index 0862114a48..fbbff9271e 100644 --- a/tools/tests/test_effects_source_resolution.py +++ b/tools/tests/test_effects_source_resolution.py @@ -106,6 +106,9 @@ class EffectsSourceResolutionTest(unittest.TestCase): def test_frame_generation_keeps_upscaling_and_sharpening_at_panel_size(self): self.check_case('framegen-sharpening') + def test_frame_generation_runs_spatial_post_upscale(self): + self.check_case('framegen-upscale') + TYPES = r''' #include @@ -157,7 +160,7 @@ typedef struct { #define HDR_FMT 101 #define FG_HDR_FMT 102 #define VK_FORMAT_R8G8B8A8_UNORM SCENE_FMT -#define VKP_FG_MAX_GENERATIONS 2 +#define VKP_FG_MAX_GENERATIONS 3 #define HDRC_OUT_PQ 1 #define HDRC_OUT_SDR 2 #define droiddeck_log(...) ((void)0) @@ -204,7 +207,7 @@ static int g_dev_state = 1, g_window = 1, g_swapchain, g_swap_extra; static int g_colorspace_ext, g_swap_hdr_unavailable, g_swap_is_hdr, g_swap_hdr_want; static int g_plain_frame, g_first_frame_done, g_base_black; static int g_qfam, g_queue, g_dev, g_fence, g_swap_fmt = SCENE_FMT; -static int g_cmds[3], g_acqs[3], g_rnds[3] = {11, 12, 13}, g_rnd_count = 3, images[1] = {2}, *g_images = images; +static int g_cmds[4], g_acqs[4], g_rnds[4] = {11, 12, 13, 14}, g_rnd_count = 4, images[1] = {2}, *g_images = images; static uint32_t g_swap_md_identity; static VkExtent2D g_extent = {1920, 1080}; static struct { float kx, ky, off_x, off_y; int rx, ry, rw, rh; } g_map; @@ -277,8 +280,32 @@ static VkImage vkp_effects_run(int cmd, int source, int w, int h, int ow, int oh if (fail_effects) { *rw = w; *rh = h; return source; } *rw = ow; *rh = oh; return 4; } -static int vkp_framegen_run(int cmd, int result, int depth, int w, int h, int format, int *generated) { return 0; } +static int vkp_effects_prepare_generated(void) { + return g_cur.scaling >= 3 && g_cur.scaling <= 8 && g_cur.scaling != 6 && !postprocessing; +} +static VkImage vkp_effects_run_before_generated(int cmd, int source, int w, int h, int *rw, int *rh) { + return vkp_effects_run(cmd, source, w, h, w, h, rw, rh); +} +static int generations, post_count, fg_w, fg_h; +static int post_sources[4], screen_widths[4], screen_heights[4], screen_images[4]; +static int vkp_framegen_run(int cmd, int result, int depth, int w, int h, int format, int *generated) { + fg_w = w; fg_h = h; + for (int i = 0; i < generations; i++) generated[i] = 20 + i; + return generations; +} +static void vkp_effects_release_generated_sources(void) {} +static VkImage vkp_effects_run_generated(int cmd, int source, int w, int h, int ow, int oh, + int slot, int *rw, int *rh) { + assert(slot == post_count && slot < 4); + assert(w == fg_w && h == fg_h); + post_sources[post_count++] = source; + *rw = fail_effects ? w : ow; *rh = fail_effects ? h : oh; + return fail_effects ? source : 40 + slot; +} static void record_screen_blit(int cmd, int result, int w, int h, int sw, int sh, int image, int filter, int cb) { + assert(screen_count < 4); + screen_widths[screen_count] = w; screen_heights[screen_count] = h; + screen_images[screen_count] = result; screen_count++; logical_w = sw; logical_h = sh; } static void device_lost(const char *reason) {} @@ -302,6 +329,7 @@ static void reset(void) { effects_active = 1; g_cur = (struct fx_settings){4}; framegen = cardboard = fail_scene = fail_effects = postprocessing = g_plain_frame = 0; g_pass.active = 0; g_extent = (VkExtent2D){1920, 1080}; + generations = post_count = fg_w = fg_h = 0; image.w = 1280; image.h = 720; } static void check_helper(void) { @@ -575,24 +603,62 @@ static void check_allocation(void) { assert(recorded_blits[1].dstOffsets[1].x == 1920 && recorded_blits[1].dstOffsets[1].y == 1080); assert(target_w == 1920 && target_h == 1080); } -static void check_framegen_output(int scaling, int cas, int grading, int panel) { +static void check_framegen_output(int scaling, int cas, int grading, int panel, int post_upscale) { reset(); framegen = 1; postprocessing = grading; g_cur = (struct fx_settings){scaling, cas, cas ? 60 : 0}; g_extent = (VkExtent2D){2880, 1620}; struct vkp_draw draw = fullscreen(); run_path(0, &draw, 1, NULL); assert(effects_count == 1); - assert(output_w == (panel ? 2880 : 1920) && output_h == (panel ? 1620 : 1080)); + if (post_upscale) { + assert(output_w == 1280 && output_h == 720); + assert(screen_count == 1); + assert(screen_widths[0] == 2880 && screen_heights[0] == 1620); + } else { + assert(output_w == (panel ? 2880 : 1920) && output_h == (panel ? 1620 : 1080)); + } } static void check_framegen_sharpening(void) { - check_framegen_output(4, 0, 0, 1); - check_framegen_output(3, 0, 0, 1); - check_framegen_output(8, 0, 0, 1); - check_framegen_output(0, 1, 1, 1); - check_framegen_output(1, 1, 1, 1); - check_framegen_output(0, 0, 1, 0); - check_framegen_output(6, 0, 0, 0); - check_framegen_output(2, 0, 1, 0); + check_framegen_output(4, 0, 0, 1, 1); + check_framegen_output(3, 0, 0, 1, 1); + check_framegen_output(8, 0, 0, 1, 1); + check_framegen_output(0, 1, 1, 1, 0); + check_framegen_output(1, 1, 1, 1, 0); + check_framegen_output(0, 0, 1, 0, 0); + check_framegen_output(6, 0, 0, 0, 0); + check_framegen_output(2, 0, 1, 0, 0); +} +static void check_framegen_upscale(void) { + for (int count = 0; count <= VKP_FG_MAX_GENERATIONS; count++) { + reset(); framegen = 1; generations = count; + struct vkp_draw draw = fullscreen(); + run_path(0, &draw, 1, NULL); + assert(fg_w == 1280 && fg_h == 720); + assert(post_count == count + 1 && screen_count == count + 1); + for (int k = 0; k < screen_count; k++) { + assert(screen_widths[k] == 1920 && screen_heights[k] == 1080); + assert(post_sources[k] == (k < count ? 20 + k : 4)); + assert(screen_images[k] == 40 + k); + } + } + for (int mode = 0; mode <= 8; mode++) { + reset(); framegen = 1; g_cur.scaling = mode; + struct vkp_draw draw = fullscreen(); + run_path(0, &draw, 1, NULL); + assert(post_count == (mode >= 3 && mode != 6)); + } + reset(); framegen = 1; fail_effects = 1; + struct vkp_draw draw = fullscreen(); + run_path(0, &draw, 1, NULL); + assert(post_count == 1 && screen_widths[0] == 1280 && screen_heights[0] == 720); + assert(screen_images[0] == 1); + reset(); framegen = 1; postprocessing = 1; + run_path(0, &draw, 1, NULL); assert(post_count == 0); + reset(); framegen = 1; cardboard = 1; + run_path(0, &draw, 1, NULL); assert(post_count == 0); + reset(); framegen = 1; + struct vkp_hdr_frame hdr = {0}; + run_path(0, &draw, 1, &hdr); assert(post_count == 0); } int main(int argc, char **argv) { assert(argc == 2); reset(); @@ -610,6 +676,7 @@ int main(int argc, char **argv) { else if (!strcmp(argv[1], "overlay-barriers")) check_overlay_barriers(); else if (!strcmp(argv[1], "postprocessing")) check_postprocessing(); else if (!strcmp(argv[1], "framegen-sharpening")) check_framegen_sharpening(); + else if (!strcmp(argv[1], "framegen-upscale")) check_framegen_upscale(); else assert(0); puts("PASS"); } diff --git a/tools/tests/test_framegen_ring_lifetime.py b/tools/tests/test_framegen_ring_lifetime.py new file mode 100644 index 0000000000..ca39670844 --- /dev/null +++ b/tools/tests/test_framegen_ring_lifetime.py @@ -0,0 +1,59 @@ +import os +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + +from test_vk_pending_completion import function + + +class FramegenRingLifetimeTest(unittest.TestCase): + def test_ring_forgets_effect_sources_before_releasing_images(self): + compiler = shutil.which(os.environ.get('CC', 'cc')) + if not compiler: + self.skipTest('A host C compiler is required') + root = Path(__file__).resolve().parents[2] + source = (root / 'app/src/main/cpp/waylandcomp/src/framegen_bridge.c').read_text() + code = r''' +#include +#include +#include +#include +static int g_dev, g_engine_ok = 1, idle, forgotten[4], images, views, memory, engine; +static uint32_t g_ring_n = 3; +static struct { int img, view, mem; } g_ring[3]; +static void wait_idle(int d) { idle++; } +static void vkp_effects_forget_image(int image) { assert(idle == 1); forgotten[image]++; } +static void destroy_image(int d, int image, const void *a) { + assert(forgotten[image] == 1); images++; +} +static void destroy_view(int d, int view, const void *a) { assert(idle == 1); views++; } +static void free_memory(int d, int mem, const void *a) { assert(images > memory); memory++; } +static void fge_forget_targets(void) { assert(images == 3); engine++; } +static struct { + void (*DeviceWaitIdle)(int); + void (*DestroyImage)(int, int, const void *); + void (*DestroyImageView)(int, int, const void *); + void (*FreeMemory)(int, int, const void *); +} vk = {wait_idle, destroy_image, destroy_view, free_memory}; +''' + code += function(source, 'destroy_ring') + code += r''' +int main(void) { + for (int i = 0; i < 3; i++) g_ring[i].img = g_ring[i].view = g_ring[i].mem = i + 1; + destroy_ring(); + assert(g_ring_n == 0 && images == 3 && views == 3 && memory == 3 && engine == 1); + for (int i = 0; i < 3; i++) assert(!g_ring[i].img && !g_ring[i].view && !g_ring[i].mem); + destroy_ring(); + assert(idle == 1 && engine == 1); +} +''' + with tempfile.TemporaryDirectory() as tmp: + folder = Path(tmp) + probe = folder / 'ring.c' + binary = folder / 'ring' + probe.write_text(code) + subprocess.run([compiler, '-std=c11', str(probe), '-o', str(binary)], check=True, + capture_output=True, text=True) + subprocess.run([str(binary)], check=True, capture_output=True, timeout=10) diff --git a/tools/tests/vk_terminal_callers_test.c b/tools/tests/vk_terminal_callers_test.c index 0c6a3311e6..9ca2ae495e 100644 --- a/tools/tests/vk_terminal_callers_test.c +++ b/tools/tests/vk_terminal_callers_test.c @@ -82,6 +82,15 @@ int vkp_effects_active(void) { return 0; } int vkp_effects_upscaling(void) { return 0; } int vkp_effects_sharpening(void) { return 0; } int vkp_effects_postprocessing(void) { return 0; } +void vkp_effects_release_generated_sources(void) {} +int vkp_effects_prepare_generated(void) { assert(0); return 0; } +VkImage vkp_effects_run_before_generated(VkCommandBuffer c, VkImage i, int w, int h, int *rw, int *rh) { + assert(0); *rw = w; *rh = h; return i; +} +VkImage vkp_effects_run_generated(VkCommandBuffer c, VkImage i, int w, int h, + int ow, int oh, int slot, int *rw, int *rh) { + assert(0); *rw = w; *rh = h; return i; +} VkFilter vkp_effects_blit_filter(void) { return VK_FILTER_NEAREST; } void vkp_effects_set_formats(VkFormat a, VkFormat b, int scene_is_pq) {} VkImage vkp_effects_run(VkCommandBuffer c, VkImage i, int w, int h, int ow, int oh, int *rw, int *rh) { From 18cd1cf07f0b446627127a5865e649c6d589066b Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Mon, 30 Nov 2026 16:04:16 -0400 Subject: [PATCH 118/120] Fix: reclaim DD-FG scratch resources on rebuild (#3456) * Prepare FrameGen for instance-owned scratch lifecycle * Make DD-FG rebuild and teardown completion-aware * Restore DD-FG namespace boundary * Isolate DD-FG scratch state and reclaim resources on rebuild * Declare per-instance scratch builder before recording code * Make DD-FG ring teardown report unsafe GPU completion * Retain DD-FG input ring until GPU completion is confirmed * Add DD-FG lifecycle and resource-isolation tests * Cover DD-FG teardown and rebuild failure cases * Document DD-FG scratch ownership and teardown semantics * Guard DD-FG teardown when GPU completion cannot be queried * docs: clarify DD-FG device-loss teardown * fix: define DD-FG scratch state before resize * fix: define DD-FG scratch state before resize * fix(ddfg): wait for the GPU before replacing the input ring on resize * Fix DD-FG ring cleanup after device loss * Propagate DD-FG device-loss status * Retain DD-FG resources when GPU completion is unknown * Retain DD-FG resources when GPU completion is unknown * Retain DD-FG resources when GPU completion is unknown * Retain DD-FG resources when GPU completion is unknown * Retain DD-FG resources when GPU completion is unknown * Retry DD-FG cleanup after an idle-wait failure * Test DD-FG cleanup retry after GPU wait failure --------- Co-authored-by: maxjivi05 --- .../main/cpp/framegen/ddfg/ddfg_engine.cpp | 82 +++++- app/src/main/cpp/framegen/ddfg/ddfg_engine.h | 4 +- app/src/main/cpp/framegen/ddfg/framegen.cpp | 142 +++++++++-- app/src/main/cpp/framegen/ddfg/framegen.hpp | 18 +- .../main/cpp/framegen/ddfg/record_impl.inc | 184 +++++++------- .../cpp/waylandcomp/src/framegen_engine.cpp | 28 ++- docs/development/dd-fg.md | 28 +++ tools/tests/ddfg_flow_levels_harness.cpp | 235 ++++++++++++++++-- tools/tests/test_ddfg_flow_levels.py | 33 +++ 9 files changed, 602 insertions(+), 152 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/ddfg_engine.cpp b/app/src/main/cpp/framegen/ddfg/ddfg_engine.cpp index 6e87890b3f..034f2c4d55 100644 --- a/app/src/main/cpp/framegen/ddfg/ddfg_engine.cpp +++ b/app/src/main/cpp/framegen/ddfg/ddfg_engine.cpp @@ -27,7 +27,31 @@ VkImageMemoryBarrier bar(VkImage img, VkImageLayout from, VkImageLayout to, } Engine::Engine() = default; -Engine::~Engine() { destroyRing(); fg_.destroy(); } +Engine::~Engine() { (void)destroy(); } + +bool Engine::destroy() { + if (!fg_.destroy()) { + DDFG_LOGE("native: retaining the input ring because GPU completion is unknown"); + return false; + } + if (!destroyRing(true)) { + DDFG_LOGE("native: could not release the input ring during teardown"); + return false; + } + dev_ = VK_NULL_HANDLE; + unavailable_ = true; + return true; +} + +void Engine::abandon() { + fg_.abandon(); + ring_[0] = Slot{}; + ring_[1] = Slot{}; + dev_ = VK_NULL_HANDLE; + queue_ = VK_NULL_HANDLE; + phys_ = VK_NULL_HANDLE; + unavailable_ = true; +} bool Engine::init(const VkTable& table, VkPhysicalDevice phys, VkDevice dev, uint32_t queueFamily, VkQueue queue) { @@ -59,15 +83,29 @@ bool Engine::prepare(uint32_t w, uint32_t h, VkFormat fmt) { if (unavailable_ || w == 0 || h == 0 || fmt == VK_FORMAT_UNDEFINED) return false; if (builtW_ == w && builtH_ == h && builtFmt_ == fmt && fg_.valid()) return true; - - if (!fg_.onResize(VkExtent2D{w, h}, fmt, false)) { + const bool formatChanged = fmt != builtFmt_; + if (!fg_.onResize(VkExtent2D{w, h}, fmt, formatChanged)) { DDFG_LOGE("native: onResize %ux%u failed; frame generation unavailable", w, h); unavailable_ = true; return false; } - destroyRing(); + bool deviceLost = false; + if (!destroyRing(false, &deviceLost)) { + DDFG_LOGE("native: could not safely release the previous input ring"); + unavailable_ = true; + return false; + } + if (deviceLost) { + DDFG_LOGE("native: device lost while releasing the input ring"); + unavailable_ = true; + return false; + } for (Slot& s : ring_) { - if (!makeSlot(s, w, h, fmt)) { destroyRing(); unavailable_ = true; return false; } + if (!makeSlot(s, w, h, fmt)) { + destroyRing(true); + unavailable_ = true; + return false; + } } builtW_ = w; builtH_ = h; builtFmt_ = fmt; history_ = 0; curr_ = 0; frames_ = 0; @@ -178,11 +216,37 @@ void Engine::destroySlot(Slot& s) { s = Slot{}; } -void Engine::destroyRing() { - if (dev_ == VK_NULL_HANDLE || !dd_.DeviceWaitIdle) return; - if (ring_[0].img || ring_[1].img) dd_.DeviceWaitIdle(dev_); - destroySlot(ring_[0]); destroySlot(ring_[1]); +bool Engine::destroyRing(bool deviceIdleConfirmed, bool* deviceLost) { + if (deviceLost) *deviceLost = false; + const bool hasResources = ring_[0].img || ring_[0].mem || ring_[0].view || + ring_[1].img || ring_[1].mem || ring_[1].view; + if (!hasResources) { + history_ = 0; + return true; + } + if (dev_ == VK_NULL_HANDLE) { + DDFG_LOGE("native: cannot release the input ring without a valid device"); + return false; + } + if (!deviceIdleConfirmed) { + if (!dd_.DeviceWaitIdle) { + DDFG_LOGE("native: cannot release the input ring without vkDeviceWaitIdle"); + return false; + } + const VkResult result = dd_.DeviceWaitIdle(dev_); + if (result == VK_ERROR_DEVICE_LOST) { + if (deviceLost) *deviceLost = true; + unavailable_ = true; + } else if (result != VK_SUCCESS) { + DDFG_LOGE("native: DeviceWaitIdle failed (%d); retaining the input ring", (int)result); + unavailable_ = true; + return false; + } + } + destroySlot(ring_[0]); + destroySlot(ring_[1]); history_ = 0; + return true; } } diff --git a/app/src/main/cpp/framegen/ddfg/ddfg_engine.h b/app/src/main/cpp/framegen/ddfg/ddfg_engine.h index 55c1ef8fa0..aff10a9033 100644 --- a/app/src/main/cpp/framegen/ddfg/ddfg_engine.h +++ b/app/src/main/cpp/framegen/ddfg/ddfg_engine.h @@ -36,13 +36,15 @@ public: uint32_t width, uint32_t height); void reset(); + bool destroy(); + void abandon(); private: struct Slot { VkImage img = VK_NULL_HANDLE; VkDeviceMemory mem = VK_NULL_HANDLE; VkImageView view = VK_NULL_HANDLE; bool valid = false; }; bool makeSlot(Slot& s, uint32_t w, uint32_t h, VkFormat fmt); void destroySlot(Slot& s); - void destroyRing(); + bool destroyRing(bool deviceIdleConfirmed = false, bool* deviceLost = nullptr); uint32_t memType(uint32_t bits, VkMemoryPropertyFlags props) const; DeviceDispatch dd_{}; diff --git a/app/src/main/cpp/framegen/ddfg/framegen.cpp b/app/src/main/cpp/framegen/ddfg/framegen.cpp index 330f83a7cf..20cc5e2d4a 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.cpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.cpp @@ -7,6 +7,31 @@ namespace ddfg { +struct ScratchState { + VkDevice ownerDevice = VK_NULL_HANDLE; + VkBuffer synthUbo[ddfg::FrameGen::kSynthSlots]{}; + VkDeviceMemory synthUboMem[ddfg::FrameGen::kSynthSlots]{}; + void* synthUboPtr[ddfg::FrameGen::kSynthSlots]{}; + std::vector flowUbo; std::vector flowUboMem; std::vector flowUboPtr; + VkBuffer expandUbo = VK_NULL_HANDLE; VkDeviceMemory expandUboMem = VK_NULL_HANDLE; void* expandUboPtr = nullptr; + VkBuffer flowRegUbo = VK_NULL_HANDLE; VkDeviceMemory flowRegUboMem = VK_NULL_HANDLE; void* flowRegUboPtr = nullptr; + VkBuffer gmUbo[ddfg::FrameGen::kGmSlots]{}; + VkDeviceMemory gmUboMem[ddfg::FrameGen::kGmSlots]{}; + void* gmUboPtr[ddfg::FrameGen::kGmSlots]{}; + VkDescriptorSet sLumaCurr = VK_NULL_HANDLE, sLumaPrev = VK_NULL_HANDLE; + std::vector sDownA, sDownB, sFlow; + VkDescriptorSet sExpand[ddfg::FrameGen::kGmSlots]{}; + VkDescriptorSet sFlowReg0 = VK_NULL_HANDLE, sFlowRegAB = VK_NULL_HANDLE, sFlowRegBA = VK_NULL_HANDLE; + VkDescriptorSet sSynth[ddfg::FrameGen::kSynthSlots]{}; + VkDescriptorSet sGmReduce[ddfg::FrameGen::kGmSlots]{}; + std::vector sGmPrewarp[ddfg::FrameGen::kGmSlots]; + VkExtent2D builtFor{0,0}; + uint64_t builtGeneration = 0; + bool built = false; + bool flowInited = false; + bool flowReady = false; +}; + #define VKOK(x) do { if ((x) != VK_SUCCESS) { DDFG_LOGE("vk fail: %s", #x); return false; } } while (0) uint32_t FrameGen::findMemType(uint32_t bits, VkMemoryPropertyFlags props) const { @@ -108,6 +133,10 @@ static bool buildSetLayout(const DeviceDispatch* dd, VkDevice dev, bool FrameGen::init(const DeviceDispatch* dd, const InstanceDispatch* id, VkPhysicalDevice phys, VkDevice dev, uint32_t queueFamily, VkQueue queue) { + if (device_ || completionUnknown_ || deviceLost_) { + DDFG_LOGE("framegen: refusing to initialize an instance that still owns device resources"); + return false; + } dd_ = dd; id_ = id; phys_ = phys; device_ = dev; queueFamily_ = queueFamily; queue_ = queue; id_->GetPhysicalDeviceMemoryProperties(phys_, &memProps_); @@ -166,16 +195,19 @@ static VkExtent2D levelExtent(VkExtent2D e, int l) { } bool FrameGen::onResize(VkExtent2D extent, VkFormat , bool force) { - - - if (!force && ready_ && extent.width == extent_.width && extent.height == extent_.height) return true; - if (ready_) { - const VkResult idleResult = dd_->DeviceWaitIdle(device_); - if (idleResult != VK_SUCCESS) { - DDFG_LOGE("framegen resize: DeviceWaitIdle failed (%d); keeping existing images", (int)idleResult); - return false; - } + if (completionUnknown_ || deviceLost_) return false; + if (!device_) { + DDFG_LOGE("framegen: cannot resize before device initialization"); + return false; } + if (!force && ready_ && extent.width == extent_.width && extent.height == extent_.height) return true; + if (ready_ && !waitIdle("resize")) return false; + if (scratch_ && scratch_->ownerDevice != VK_NULL_HANDLE && !destroyScratchResources()) { + DDFG_LOGE("framegen resize: scratch cleanup failed; retaining the previous image set"); + return false; + } + + ready_ = false; ++imageGeneration_; for (auto& i : pyrA_) destroyImage(i); pyrA_.clear(); for (auto& i : pyrB_) destroyImage(i); pyrB_.clear(); @@ -183,7 +215,17 @@ bool FrameGen::onResize(VkExtent2D extent, VkFormat , bool force) { for (auto& i : flowLvl_) destroyImage(i); flowLvl_.clear(); destroyImage(flowExpA_); destroyImage(flowExpB_); destroyImage(flowRegA_); destroyImage(flowRegB_); - extent_ = extent; ready_ = false; + extent_ = extent; + + for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0; + for (int s = 0; s < kGmSlots; ++s) { + gmSlotValid_[s] = false; + for (int i = 0; i < 6; ++i) gmLinAt_[s][i] = 0.0; + } + gmHaveEst_ = false; + gmEngaged_ = false; + gmStableCount_ = 0; + gmLastTransPx_ = 0.0f; const VkImageUsageFlags lumaUsage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT; const VkImageUsageFlags flowUsage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; @@ -234,21 +276,37 @@ void FrameGen::initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout t } -void FrameGen::destroy() { - if (!device_) return; - const VkResult idleResult = dd_->DeviceWaitIdle(device_); - if (idleResult != VK_SUCCESS && idleResult != VK_ERROR_DEVICE_LOST) { - DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); preserving resources for safe retry", (int)idleResult); - return; - } - if (idleResult == VK_ERROR_DEVICE_LOST) { - // A lost device cannot become idle again. Still explicitly destroy its - // child objects; skip descriptor-pool reset and release scratch ownership. - DDFG_LOGE("framegen destroy: device lost; releasing owned resources without waiting"); - destroyScratchResources(false); - } else { - destroyScratchResources(); +bool FrameGen::destroy() { + if (!device_) return true; + if (!deviceLost_) { + // A previous wait failure leaves completion unknown, but a later + // teardown attempt may safely retry the wait before releasing resources. + if (!dd_ || !dd_->DeviceWaitIdle) { + ready_ = false; + completionUnknown_ = true; + DDFG_LOGE("framegen destroy: vkDeviceWaitIdle is unavailable; preserving GPU resources"); + return false; + } + const VkResult idleResult = dd_->DeviceWaitIdle(device_); + if (idleResult == VK_SUCCESS) completionUnknown_ = false; + if (idleResult != VK_SUCCESS) { + ready_ = false; + if (idleResult == VK_ERROR_DEVICE_LOST) { + deviceLost_ = true; + DDFG_LOGE("framegen destroy: device lost; releasing owned resources without waiting"); + } else { + completionUnknown_ = true; + DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); preserving resources because GPU completion is unknown", + (int)idleResult); + return false; + } + } } + + ready_ = false; + if (descPool_) dd_->DestroyDescriptorPool(device_, descPool_, nullptr); + descPool_ = VK_NULL_HANDLE; + releaseScratch(); for (auto& i : pyrA_) destroyImage(i); pyrA_.clear(); for (auto& i : pyrB_) destroyImage(i); pyrB_.clear(); for (auto& i : pyrAs_) destroyImage(i); pyrAs_.clear(); @@ -260,15 +318,45 @@ void FrameGen::destroy() { destroyPipe(pGmReduce_); destroyPipe(pGmPrewarp_); destroyPipe(pFlowReg_); for (int s = 0; s < kGmSlots; ++s) { - if (gmSsboMem_[s]) dd_->UnmapMemory(device_, gmSsboMem_[s]); + if (gmSsboPtr_[s] && gmSsboMem_[s]) dd_->UnmapMemory(device_, gmSsboMem_[s]); if (gmSsbo_[s]) dd_->DestroyBuffer(device_, gmSsbo_[s], nullptr); if (gmSsboMem_[s]) dd_->FreeMemory(device_, gmSsboMem_[s], nullptr); gmSsbo_[s] = VK_NULL_HANDLE; gmSsboMem_[s] = VK_NULL_HANDLE; gmSsboPtr_[s] = nullptr; } gmBuffersReady_ = false; - if (descPool_) dd_->DestroyDescriptorPool(device_, descPool_, nullptr); if (linear_) dd_->DestroySampler(device_, linear_, nullptr); - descPool_ = VK_NULL_HANDLE; linear_ = VK_NULL_HANDLE; device_ = VK_NULL_HANDLE; ready_ = false; + linear_ = VK_NULL_HANDLE; + device_ = VK_NULL_HANDLE; + ready_ = false; + deviceLost_ = false; + return true; +} + +void FrameGen::abandon() { + device_ = VK_NULL_HANDLE; + dd_ = nullptr; + id_ = nullptr; + phys_ = VK_NULL_HANDLE; + queue_ = VK_NULL_HANDLE; + linear_ = VK_NULL_HANDLE; + descPool_ = VK_NULL_HANDLE; + scratch_.reset(); + pyrA_.clear(); pyrB_.clear(); pyrAs_.clear(); flowLvl_.clear(); + flowExpA_ = Img{}; flowExpB_ = Img{}; + flowRegA_ = Img{}; flowRegB_ = Img{}; + pLuma_ = Pipe{}; pDown_ = Pipe{}; pFlow_ = Pipe{}; pFlowM4_ = Pipe{}; + pExpand_ = Pipe{}; pExpandM4_ = Pipe{}; pSynth_ = Pipe{}; + pGmReduce_ = Pipe{}; pGmPrewarp_ = Pipe{}; pFlowReg_ = Pipe{}; + for (int s = 0; s < kGmSlots; ++s) { + gmSsbo_[s] = VK_NULL_HANDLE; + gmSsboMem_[s] = VK_NULL_HANDLE; + gmSsboPtr_[s] = nullptr; + gmSlotValid_[s] = false; + } + gmBuffersReady_ = false; + ready_ = false; + completionUnknown_ = false; + deviceLost_ = false; } } diff --git a/app/src/main/cpp/framegen/ddfg/framegen.hpp b/app/src/main/cpp/framegen/ddfg/framegen.hpp index d40518dd1d..bba77480c7 100644 --- a/app/src/main/cpp/framegen/ddfg/framegen.hpp +++ b/app/src/main/cpp/framegen/ddfg/framegen.hpp @@ -1,12 +1,20 @@ #pragma once #include "vk_dispatch.hpp" #include "config.hpp" +#include #include namespace ddfg { +struct ScratchState; + class FrameGen { public: + FrameGen(); + ~FrameGen(); + FrameGen(const FrameGen&) = delete; + FrameGen& operator=(const FrameGen&) = delete; + bool init(const DeviceDispatch* dd, const InstanceDispatch* id, VkPhysicalDevice phys, VkDevice dev, uint32_t queueFamily, VkQueue queue); void configure(const Config& c); @@ -14,7 +22,8 @@ public: void record(VkCommandBuffer cmd, VkImageView prevView, VkImageView currView, VkImageView outView, float alpha, uint32_t gmSlot = 0, uint32_t synthSlot = 0, bool reuseFlow = false); - void destroy(); + bool destroy(); + void abandon(); bool valid() const { return device_ != VK_NULL_HANDLE && ready_; } const Config& config() const { return cfg_; } @@ -64,7 +73,9 @@ private: void destroyPipe(Pipe& p); void barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkImageLayout to); void initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout to); - void destroyScratchResources(bool resetPool = true); + bool waitIdle(const char* operation); + bool destroyScratchResources(bool resetPool = true); + void releaseScratch(); const DeviceDispatch* dd_ = nullptr; const InstanceDispatch* id_ = nullptr; @@ -80,7 +91,10 @@ private: VkExtent2D extent_{}; uint64_t imageGeneration_ = 0; bool ready_ = false; + bool completionUnknown_ = false; + bool deviceLost_ = false; int flowFinest_ = kFlowFinestDefault; + std::unique_ptr scratch_; Pipe pLuma_, pDown_, pFlow_, pFlowM4_, pExpand_, pExpandM4_, pSynth_; Pipe pGmReduce_, pGmPrewarp_; diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 1d9e71df8c..3922db391b 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -1,33 +1,7 @@ -namespace { -struct ScratchState { - VkDevice ownerDevice = VK_NULL_HANDLE; - VkBuffer synthUbo[ddfg::FrameGen::kSynthSlots]{}; - VkDeviceMemory synthUboMem[ddfg::FrameGen::kSynthSlots]{}; - void* synthUboPtr[ddfg::FrameGen::kSynthSlots]{}; - std::vector flowUbo; std::vector flowUboMem; std::vector flowUboPtr; - VkBuffer expandUbo = VK_NULL_HANDLE; VkDeviceMemory expandUboMem = VK_NULL_HANDLE; void* expandUboPtr = nullptr; - VkBuffer flowRegUbo = VK_NULL_HANDLE; VkDeviceMemory flowRegUboMem = VK_NULL_HANDLE; void* flowRegUboPtr = nullptr; - VkBuffer gmUbo[ddfg::FrameGen::kGmSlots]{}; - VkDeviceMemory gmUboMem[ddfg::FrameGen::kGmSlots]{}; - void* gmUboPtr[ddfg::FrameGen::kGmSlots]{}; - VkDescriptorSet sLumaCurr = VK_NULL_HANDLE, sLumaPrev = VK_NULL_HANDLE; - std::vector sDownA, sDownB, sFlow; - VkDescriptorSet sExpand[ddfg::FrameGen::kGmSlots]{}; - - - - VkDescriptorSet sFlowReg0 = VK_NULL_HANDLE, sFlowRegAB = VK_NULL_HANDLE, sFlowRegBA = VK_NULL_HANDLE; - VkDescriptorSet sSynth[ddfg::FrameGen::kSynthSlots]{}; - VkDescriptorSet sGmReduce[ddfg::FrameGen::kGmSlots]{}; - std::vector sGmPrewarp[ddfg::FrameGen::kGmSlots]; - VkExtent2D builtFor{0,0}; - uint64_t builtGeneration = 0; - bool built = false; - bool flowInited = false; - bool flowReady = false; -}; -ScratchState g_scratch; +namespace ddfg { +FrameGen::FrameGen() : scratch_(std::make_unique()) {} +FrameGen::~FrameGen() { (void)destroy(); } } static bool makeUbo(const ddfg::DeviceDispatch* dd, VkDevice dev, @@ -144,7 +118,7 @@ static void mulAff(const double A[3][3], const double B[3][3], double out[3][3]) namespace ddfg { -static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, +static bool ensureScratch(ScratchState& S, FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, const VkPhysicalDeviceMemoryProperties& mp, VkDescriptorPool pool, VkSampler samp, VkExtent2D ext, std::vector& pyrA, std::vector& pyrB, @@ -157,30 +131,72 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo, int kLevels, const Config& cfg, uint64_t imageGeneration); -static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorPool pool, - bool resetPool = true) { - if (g_scratch.ownerDevice != VK_NULL_HANDLE && g_scratch.ownerDevice != dev) return; +bool FrameGen::waitIdle(const char* operation) { + if (completionUnknown_ || deviceLost_ || !device_) return false; + if (!dd_ || !dd_->DeviceWaitIdle) { + completionUnknown_ = true; + ready_ = false; + DDFG_LOGE("framegen: %s cannot confirm GPU completion; this instance is stopped and its resources are retained", + operation); + return false; + } + const VkResult result = dd_->DeviceWaitIdle(device_); + if (result == VK_SUCCESS) return true; + ready_ = false; + if (result == VK_ERROR_DEVICE_LOST) { + deviceLost_ = true; + DDFG_LOGE("framegen: %s reported device loss; cleanup will skip further waits", operation); + } else { + completionUnknown_ = true; + DDFG_LOGE("framegen: %s vkDeviceWaitIdle failed (%d); this instance is stopped and its GPU resources retained", + operation, (int)result); + } + return false; +} + +bool FrameGen::destroyScratchResources(bool resetPool) { + if (!scratch_) return true; + if (resetPool && descPool_ && !deviceLost_) { + if (!dd_ || !dd_->ResetDescriptorPool) { + ready_ = false; + DDFG_LOGE("framegen: descriptor-pool reset is unavailable; retaining scratch resources"); + return false; + } + const VkResult result = dd_->ResetDescriptorPool(device_, descPool_, 0); + if (result != VK_SUCCESS) { + ready_ = false; + if (result == VK_ERROR_DEVICE_LOST) deviceLost_ = true; + DDFG_LOGE("framegen: descriptor-pool reset failed (%d); retaining scratch resources", + (int)result); + return false; + } + } + releaseScratch(); + return true; +} + +void FrameGen::releaseScratch() { + if (!scratch_) return; + auto& S = *scratch_; auto freeUbo = [&](VkBuffer& b, VkDeviceMemory& m, void*& p) { - if (m) dd->UnmapMemory(dev, m); - if (b) dd->DestroyBuffer(dev, b, nullptr); - if (m) dd->FreeMemory(dev, m, nullptr); - b = VK_NULL_HANDLE; m = VK_NULL_HANDLE; p = nullptr; + if (p && m) dd_->UnmapMemory(device_, m); + if (b) dd_->DestroyBuffer(device_, b, nullptr); + if (m) dd_->FreeMemory(device_, m, nullptr); + b = VK_NULL_HANDLE; + m = VK_NULL_HANDLE; + p = nullptr; }; - auto& S = g_scratch; for (int s = 0; s < FrameGen::kSynthSlots; ++s) freeUbo(S.synthUbo[s], S.synthUboMem[s], S.synthUboPtr[s]); - freeUbo(S.expandUbo, S.expandUboMem, S.expandUboPtr); + freeUbo(S.expandUbo, S.expandUboMem, S.expandUboPtr); freeUbo(S.flowRegUbo, S.flowRegUboMem, S.flowRegUboPtr); for (size_t i = 0; i < S.flowUbo.size(); ++i) freeUbo(S.flowUbo[i], S.flowUboMem[i], S.flowUboPtr[i]); for (int s = 0; s < FrameGen::kGmSlots; ++s) freeUbo(S.gmUbo[s], S.gmUboMem[s], S.gmUboPtr[s]); - if (resetPool && pool && dd->ResetDescriptorPool) dd->ResetDescriptorPool(dev, pool, 0); S = ScratchState{}; } -void FrameGen::destroyScratchResources(bool resetPool) { - destroyScratch(dd_, device_, descPool_, resetPool); -} void FrameGen::configure(const Config& c) { + if (completionUnknown_ || deviceLost_) return; Config nextCfg = c; nextCfg.sanitize(); int want = flowFinestForPreset(nextCfg.perfPreset); @@ -203,16 +219,12 @@ void FrameGen::configure(const Config& c) { return; } - // Keep the previous configuration and image set if the device cannot idle. - const VkResult idleResult = dd_->DeviceWaitIdle(device_); - if (idleResult != VK_SUCCESS) { - DDFG_LOGE("framegen configure: DeviceWaitIdle failed (%d); keeping previous configuration and images", - (int)idleResult); + if (!waitIdle("live preset rebuild")) return; + if (scratch_ && scratch_->ownerDevice != VK_NULL_HANDLE && !destroyScratchResources()) { + DDFG_LOGE("perf-preset live rebuild: scratch cleanup failed; keeping the previous configuration"); return; } - // The device is idle, so reset motion history before rebuilding. This - // also leaves the predictor reset if onResize fails. for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0; for (int s = 0; s < kGmSlots; ++s) { gmSlotValid_[s] = false; @@ -223,20 +235,17 @@ void FrameGen::configure(const Config& c) { gmStableCount_ = 0; gmLastTransPx_ = 0.0f; - // Prevent onResize from issuing a second wait. - destroyScratch(dd_, device_, descPool_); cfg_ = nextCfg; flowFinest_ = want; ready_ = false; if (!onResize(extent_, VK_FORMAT_UNDEFINED, true)) { ready_ = false; - DDFG_LOGE("perf-preset live rebuild: onResize FAILED at %ux%u - FG disabled until next resize", + DDFG_LOGE("perf-preset live rebuild: onResize FAILED at %ux%u - frame generation unavailable", extent_.width, extent_.height); return; } DDFG_LOGI("perf-preset live rebuild DONE (kFlowFinest=%d, flow predictor reset)", flowFinest_); } - bool FrameGen::updateGlobalMotion(uint32_t gmSlot, VkExtent2D fullExtent) { ++gmFrames_; if (!gmBuffersReady_ || cfg_.gmMode == 2 ) { @@ -306,35 +315,33 @@ bool FrameGen::updateGlobalMotion(uint32_t gmSlot, VkExtent2D fullExtent) { void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView currView, VkImageView outView, float alpha, uint32_t gmSlot, uint32_t synthSlot, bool reuseFlow) { if (!valid()) return; + auto& S = *scratch_; if (gmSlot >= (uint32_t)kGmSlots) gmSlot = 0; if (synthSlot >= (uint32_t)kSynthSlots) synthSlot = 0; const bool m4 = (cfg_.model == 4); const Pipe& flowP = m4 ? pFlowM4_ : pFlow_; const Pipe& expandP = m4 ? pExpandM4_ : pExpand_; - if (!g_scratch.built || g_scratch.builtFor.width != extent_.width || - g_scratch.builtFor.height != extent_.height || - g_scratch.builtGeneration != imageGeneration_) { - if (g_scratch.built) { - const VkResult idleResult = dd_->DeviceWaitIdle(device_); - if (idleResult != VK_SUCCESS) { - DDFG_LOGE("framegen record: DeviceWaitIdle failed (%d); skipping scratch rebuild", (int)idleResult); - return; - } - destroyScratch(dd_, device_, descPool_); + if (!S.built || S.builtFor.width != extent_.width || + S.builtFor.height != extent_.height || + S.builtGeneration != imageGeneration_) { + if (S.built && !waitIdle("scratch rebuild")) return; + if (S.ownerDevice != VK_NULL_HANDLE && !destroyScratchResources()) { + DDFG_LOGE("framegen record: scratch cleanup failed; skipping this frame"); + return; } - if (!ensureScratch(this, dd_, device_, memProps_, descPool_, linear_, extent_, + if (!ensureScratch(S, this, dd_, device_, memProps_, descPool_, linear_, extent_, pyrA_, pyrB_, pyrAs_, flowLvl_, flowExpA_, flowExpB_, pLuma_, pDown_, flowP, expandP, pSynth_, pGmReduce_, pGmPrewarp_, pFlowReg_, flowRegA_, flowRegB_, gmSsbo_, kLevels, cfg_, imageGeneration_)) return; } - if (g_scratch.ownerDevice != device_) return; - if (reuseFlow && !g_scratch.flowReady) return; + if (S.ownerDevice != device_) return; + if (reuseFlow && !S.flowReady) return; if (!reuseFlow) { bool gmEngaged = updateGlobalMotion(gmSlot, extent_); - if (g_scratch.gmUboPtr[gmSlot]) { + if (S.gmUboPtr[gmSlot]) { GMUBO g{}; g.lin[0]=(float)gmRun_[0]; g.lin[1]=(float)gmRun_[1]; g.lin[2]=(float)gmRun_[2]; g.lin[3]=(float)gmRun_[3]; g.linT[0]=(float)gmRun_[4]; g.linT[1]=(float)gmRun_[5]; g.linT[2]=gmEngaged?1.0f:0.0f; g.linT[3]=0.0f; @@ -342,7 +349,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur g.app[0]=(float)gmRun_[0]; g.app[1]=(float)gmRun_[1]; g.app[2]=(float)gmRun_[2]; g.app[3]=(float)gmRun_[3]; g.appT[0]=(float)gmRun_[4]; g.appT[1]=(float)gmRun_[5]; } - std::memcpy(g_scratch.gmUboPtr[gmSlot], &g, sizeof(g)); + std::memcpy(S.gmUboPtr[gmSlot], &g, sizeof(g)); } { static int lastEng = -1; @@ -353,7 +360,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur } } - const VkDescriptorSet lumaSets[] = {g_scratch.sLumaCurr, g_scratch.sLumaPrev}; + const VkDescriptorSet lumaSets[] = {S.sLumaCurr, S.sLumaPrev}; const uint32_t lumaBindings[] = {32, 32}; const VkDescriptorType lumaTypes[] = { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER}; @@ -367,9 +374,9 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur SynthUBO su{cfg_.flowScale, alpha, cfg_.beta, cfg_.lambda, cfg_.epsilon, cfg_.photoScale, 0, 0, cfg_.hudX0, cfg_.hudY0, cfg_.hudX1, cfg_.hudY1}; - if (g_scratch.synthUboPtr[synthSlot]) std::memcpy(g_scratch.synthUboPtr[synthSlot], &su, sizeof(su)); + if (S.synthUboPtr[synthSlot]) std::memcpy(S.synthUboPtr[synthSlot], &su, sizeof(su)); - const VkDescriptorSet synthSet = g_scratch.sSynth[synthSlot]; + const VkDescriptorSet synthSet = S.sSynth[synthSlot]; const VkDescriptorSet synthSets[] = {synthSet, synthSet, synthSet}; const uint32_t synthBindings[] = {32, 33, 48}; const VkDescriptorType synthTypes[] = { @@ -468,17 +475,17 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); } - disp(pLuma_, g_scratch.sLumaCurr, levelExtent(extent_, 0)); - disp(pLuma_, g_scratch.sLumaPrev, levelExtent(extent_, 0)); + disp(pLuma_, S.sLumaCurr, levelExtent(extent_, 0)); + disp(pLuma_, S.sLumaPrev, levelExtent(extent_, 0)); barPair(pyrA_[0], pyrB_[0]); for (int l = 1; l < kLevels; ++l) { - disp(pDown_, g_scratch.sDownA[l - 1], levelExtent(extent_, l)); - disp(pDown_, g_scratch.sDownB[l - 1], levelExtent(extent_, l)); + disp(pDown_, S.sDownA[l - 1], levelExtent(extent_, l)); + disp(pDown_, S.sDownB[l - 1], levelExtent(extent_, l)); barPair(pyrA_[l], pyrB_[l]); } - if (gmBuffersReady_ && g_scratch.sGmReduce[gmSlot]) { + if (gmBuffersReady_ && S.sGmReduce[gmSlot]) { dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.pipeline); - dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.layout, 0, 1, &g_scratch.sGmReduce[gmSlot], 0, nullptr); + dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.layout, 0, 1, &S.sGmReduce[gmSlot], 0, nullptr); dd_->CmdDispatch(cmd, (uint32_t)(kGmThreads / 64), 1, 1); VkMemoryBarrier mb{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; mb.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; mb.dstAccessMask = VK_ACCESS_HOST_READ_BIT; @@ -486,27 +493,27 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur 0, 1, &mb, 0, nullptr, 0, nullptr); } for (int l = flowFinest_; l < kLevels; ++l) { - disp(pGmPrewarp_, g_scratch.sGmPrewarp[gmSlot][l], levelExtent(extent_, l)); + disp(pGmPrewarp_, S.sGmPrewarp[gmSlot][l], levelExtent(extent_, l)); bar(pyrAs_[l]); } for (int l = kLevels - 1; l >= flowFinest_; --l) { - disp(flowP, g_scratch.sFlow[l], levelExtent(extent_, l)); + disp(flowP, S.sFlow[l], levelExtent(extent_, l)); bar(flowLvl_[l]); } if (frEngaged) { const int F = flowFinest_; const VkExtent2D fe = levelExtent(extent_, F); - if (g_scratch.flowRegUboPtr) { + if (S.flowRegUboPtr) { FlowRegUBO fu{cfg_.frDt, cfg_.frLambda, cfg_.frEdge, cfg_.frEps}; - std::memcpy(g_scratch.flowRegUboPtr, &fu, sizeof(fu)); + std::memcpy(S.flowRegUboPtr, &fu, sizeof(fu)); } FrameGen::Img* last = nullptr; for (int it = 0; it < cfg_.frIters; ++it) { VkDescriptorSet set; FrameGen::Img* outImg; - if (it == 0) { set = g_scratch.sFlowReg0; outImg = &flowRegA_; } - else if (it % 2 == 1) { set = g_scratch.sFlowRegAB; outImg = &flowRegB_; } - else { set = g_scratch.sFlowRegBA; outImg = &flowRegA_; } + if (it == 0) { set = S.sFlowReg0; outImg = &flowRegA_; } + else if (it % 2 == 1) { set = S.sFlowRegAB; outImg = &flowRegB_; } + else { set = S.sFlowRegBA; outImg = &flowRegA_; } dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.pipeline); dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.layout, 0, 1, &set, 0, nullptr); dd_->CmdDispatch(cmd, (fe.width + 15) / 16, (fe.height + 15) / 16, 1); @@ -540,14 +547,14 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur } } - disp(expandP, g_scratch.sExpand[gmSlot], levelExtent(extent_, 0)); + disp(expandP, S.sExpand[gmSlot], levelExtent(extent_, 0)); barPair(flowExpA_, flowExpB_); - g_scratch.flowReady = true; + S.flowReady = true; } disp(pSynth_, synthSet, levelExtent(extent_, 0)); } -static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, +static bool ensureScratch(ScratchState& S, FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, const VkPhysicalDeviceMemoryProperties& mp, VkDescriptorPool pool, VkSampler samp, VkExtent2D ext, std::vector& pyrA, std::vector& pyrB, @@ -559,7 +566,6 @@ static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev, const FrameGen::Pipe& pGmPrewarp, const FrameGen::Pipe& pFlowReg, FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo, int kLevels, const Config& cfg, uint64_t imageGeneration) { - auto& S = g_scratch; if (S.ownerDevice != VK_NULL_HANDLE && S.ownerDevice != dev) return false; S = ScratchState{}; S.ownerDevice = dev; diff --git a/app/src/main/cpp/waylandcomp/src/framegen_engine.cpp b/app/src/main/cpp/waylandcomp/src/framegen_engine.cpp index 014c7c7ec8..ed16dd4c88 100644 --- a/app/src/main/cpp/waylandcomp/src/framegen_engine.cpp +++ b/app/src/main/cpp/waylandcomp/src/framegen_engine.cpp @@ -31,6 +31,7 @@ bool g_probed = false, g_ready = false; std::unique_ptr g_lsfg; std::unique_ptr g_ddfg; +std::vector> g_retained_ddfg; int g_kind = -1; char g_build[96] = ""; @@ -128,7 +129,14 @@ void fge_device_ready(PFN_vkGetInstanceProcAddr gipa, VkInstance inst, VkPhysica void fge_device_lost(void) { g_lsfg.reset(); - g_ddfg.reset(); + if (g_ddfg) { + if (g_ddfg->destroy()) g_ddfg.reset(); + else g_retained_ddfg.push_back(std::move(g_ddfg)); + } + // The device is being torn down. Unknown-completion resources must not be + // passed to Vulkan destruction calls; the VkDevice teardown reclaims them. + for (auto& engine : g_retained_ddfg) engine->abandon(); + g_retained_ddfg.clear(); g_kind = -1; g_dev = VK_NULL_HANDLE; g_queue = VK_NULL_HANDLE; @@ -193,9 +201,21 @@ int fge_start(int kind, const char *cache_path) { } void fge_stop(void) { - if ((g_lsfg || g_ddfg) && g_table.DeviceWaitIdle && g_dev) g_table.DeviceWaitIdle(g_dev); - g_lsfg.reset(); - g_ddfg.reset(); + if (g_lsfg) { + if (g_table.DeviceWaitIdle && g_dev) g_table.DeviceWaitIdle(g_dev); + g_lsfg.reset(); + } + for (auto it = g_retained_ddfg.begin(); it != g_retained_ddfg.end();) { + if ((*it)->destroy()) it = g_retained_ddfg.erase(it); + else ++it; + } + if (g_ddfg) { + if (g_ddfg->destroy()) g_ddfg.reset(); + else { + ELOGE("ddfg-native: retaining engine until GPU completion is known or device teardown"); + g_retained_ddfg.push_back(std::move(g_ddfg)); + } + } g_kind = -1; } diff --git a/docs/development/dd-fg.md b/docs/development/dd-fg.md index 81cb43a9ea..1275b18758 100644 --- a/docs/development/dd-fg.md +++ b/docs/development/dd-fg.md @@ -27,6 +27,28 @@ bytes for dimensions at least four pixels: These are pixel payloads, not driver allocation sizes or measured FPS gains. +## Scratch ownership and rebuilds + +Each `FrameGen` instance owns its scratch buffers, mappings and descriptor sets. +A size or live-preset rebuild first confirms GPU completion and resets that +instance's descriptor pool, then releases the old scratch and image resources. +Motion/history validity is reset with the rebuilt images. Repeated preparation +at the same size and ordinary frame recording do not add device-idle waits. + +Healthy destruction releases the descriptor pool, mapped scratch buffers and +images. The native engine releases its input ring only after the chain confirms +completion, so an input image is not destroyed before the wait. + +If `vkDeviceWaitIdle` fails with an error other than +`VK_ERROR_DEVICE_LOST`, the affected instance becomes unusable: further +recording and rebuilding stop, and its Vulkan resources and input ring are +intentionally retained because GPU completion is unknown. Device loss follows +a separate teardown path: `FrameGen::destroy()` releases its owned resources +without another wait and returns true, allowing the Engine to release the +input ring. This is local DD-FG containment, not compositor-wide GPU recovery. +A descriptor-pool reset failure also stops that resize without releasing the +resources, but healthy teardown can still release them. + ## Validation Run `python3 -m unittest discover -s tools/tests -p 'test_ddfg_flow_levels.py'`. @@ -35,4 +57,10 @@ selected through the usual SDK/NDK environment variables. It compiles the actual DD-FG chain against a mock Vulkan dispatch table and checks resource counts, dispatch order and sizes, valid descriptor bindings, both models, every preset, 2x/3x/4x generation, small/odd extents, resize and live preset changes. +The same harness enforces descriptor-pool capacity, accounts for all live +resources, and models pending GPU work to reject early cleanup. Lifecycle cases +cover repeated rebuilds, same-size restarts, two simultaneous instances, +automatic/idempotent destruction, partial resize allocation, failed GPU waits, +and failed descriptor-pool resets. The actual native `Engine` is included to +check the input-ring destruction order. It does not execute shaders on a GPU or replace on-device validation. diff --git a/tools/tests/ddfg_flow_levels_harness.cpp b/tools/tests/ddfg_flow_levels_harness.cpp index e5cf7bf701..4c8fdb30d4 100644 --- a/tools/tests/ddfg_flow_levels_harness.cpp +++ b/tools/tests/ddfg_flow_levels_harness.cpp @@ -1,4 +1,5 @@ #include "framegen.hpp" +#include "ddfg_engine.h" #include #include #include @@ -25,12 +26,19 @@ std::map buffers; std::map allocations; std::map buffer_memory; std::map> descriptors; +std::map set_pools; +std::map pool_capacities; std::map pipelines; std::map image_ids; std::map buffer_ids; std::vector dispatches; +std::vector external_views; uintptr_t serial = 100; -unsigned buffer_creates, set_creates; +unsigned buffer_creates, set_creates, pipeline_creates, idle_calls, image_creates, fail_image_at; +bool gpu_pending; +VkResult idle_result = VK_SUCCESS, reset_result = VK_SUCCESS; +const ddfg::DeviceDispatch *engine_dispatch; +const ddfg::InstanceDispatch *engine_instance; VkPipeline bound_pipeline; VkDescriptorSet bound_set; uint64_t command_hash = 14695981039346656037ull; @@ -61,6 +69,7 @@ template void VKAPI_CALL destroy(VkDevice, T, const VkAllocationCallbac VkResult VKAPI_CALL create_image(VkDevice, const VkImageCreateInfo *info, const VkAllocationCallbacks *, VkImage *out) { + if (++image_creates == fail_image_at) return VK_ERROR_OUT_OF_DEVICE_MEMORY; *out = handle(); images[*out] = {info->extent, info->format, info->usage}; return VK_SUCCESS; @@ -73,9 +82,11 @@ VkResult VKAPI_CALL create_view(VkDevice, const VkImageViewCreateInfo *info, return VK_SUCCESS; } void VKAPI_CALL destroy_image(VkDevice, VkImage image, const VkAllocationCallbacks *) { + assert(!gpu_pending); assert(images.erase(image) == 1); } void VKAPI_CALL destroy_view(VkDevice, VkImageView view, const VkAllocationCallbacks *) { + assert(!gpu_pending); assert(views.erase(view) == 1); } VkResult VKAPI_CALL create_buffer(VkDevice, const VkBufferCreateInfo *info, @@ -86,6 +97,7 @@ VkResult VKAPI_CALL create_buffer(VkDevice, const VkBufferCreateInfo *info, return VK_SUCCESS; } void VKAPI_CALL destroy_buffer(VkDevice, VkBuffer buffer, const VkAllocationCallbacks *) { + assert(!gpu_pending); assert(buffers.erase(buffer) == 1); buffer_memory.erase(buffer); } @@ -104,6 +116,7 @@ VkResult VKAPI_CALL allocate(VkDevice, const VkMemoryAllocateInfo *info, return VK_SUCCESS; } void VKAPI_CALL free_memory(VkDevice, VkDeviceMemory memory, const VkAllocationCallbacks *) { + assert(!gpu_pending); assert(allocations.erase(memory) == 1); } VkResult VKAPI_CALL bind_image(VkDevice, VkImage image, VkDeviceMemory memory, VkDeviceSize) { @@ -123,8 +136,14 @@ VkResult VKAPI_CALL map_memory(VkDevice, VkDeviceMemory memory, VkDeviceSize off *out = allocation.data.get(); return VK_SUCCESS; } -void VKAPI_CALL unmap(VkDevice, VkDeviceMemory memory) { assert(allocations.count(memory)); } -VkResult VKAPI_CALL idle(VkDevice) { return VK_SUCCESS; } +void VKAPI_CALL unmap(VkDevice, VkDeviceMemory memory) { + assert(!gpu_pending && allocations.count(memory)); +} +VkResult VKAPI_CALL idle(VkDevice) { + idle_calls++; + if (idle_result == VK_SUCCESS) gpu_pending = false; + return idle_result; +} void VKAPI_CALL memory_properties(VkPhysicalDevice, VkPhysicalDeviceMemoryProperties *out) { *out = {}; out->memoryTypeCount = 1; @@ -132,15 +151,42 @@ void VKAPI_CALL memory_properties(VkPhysicalDevice, VkPhysicalDeviceMemoryProper VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; } VkResult VKAPI_CALL allocate_sets(VkDevice, const VkDescriptorSetAllocateInfo *info, VkDescriptorSet *out) { + const auto used = std::count_if(set_pools.begin(), set_pools.end(), [&](const auto &entry) { + return entry.second == info->descriptorPool; + }); + if (used + info->descriptorSetCount > pool_capacities.at(info->descriptorPool)) + return VK_ERROR_OUT_OF_POOL_MEMORY; for (uint32_t i = 0; i < info->descriptorSetCount; i++) { out[i] = handle(); descriptors[out[i]] = {}; + set_pools[out[i]] = info->descriptorPool; set_creates++; } return VK_SUCCESS; } -VkResult VKAPI_CALL reset_pool(VkDevice, VkDescriptorPool, VkDescriptorPoolResetFlags) { - descriptors.clear(); +VkResult VKAPI_CALL create_pool(VkDevice, const VkDescriptorPoolCreateInfo *info, + const VkAllocationCallbacks *, VkDescriptorPool *out) { + *out = handle(); + pool_capacities[*out] = info->maxSets; + return VK_SUCCESS; +} +void drop_sets(VkDescriptorPool pool) { + assert(!gpu_pending); + for (auto it = set_pools.begin(); it != set_pools.end();) { + if (it->second == pool) { + descriptors.erase(it->first); + it = set_pools.erase(it); + } else ++it; + } +} +void VKAPI_CALL destroy_pool(VkDevice, VkDescriptorPool pool, const VkAllocationCallbacks *) { + drop_sets(pool); + assert(pool_capacities.erase(pool) == 1); +} +VkResult VKAPI_CALL reset_pool(VkDevice, VkDescriptorPool pool, VkDescriptorPoolResetFlags) { + assert(!gpu_pending); + if (reset_result != VK_SUCCESS) return reset_result; + drop_sets(pool); return VK_SUCCESS; } void VKAPI_CALL update_sets(VkDevice, uint32_t count, const VkWriteDescriptorSet *writes, @@ -164,12 +210,15 @@ VkResult VKAPI_CALL create_pipelines(VkDevice, VkPipelineCache, uint32_t count, const VkComputePipelineCreateInfo *, const VkAllocationCallbacks *, VkPipeline *out) { for (uint32_t i = 0; i < count; i++) { - const auto index = static_cast(pipelines.size()); + const auto index = pipeline_creates++ % 10; out[i] = handle(); pipelines[out[i]] = index; } return VK_SUCCESS; } +void VKAPI_CALL destroy_pipeline(VkDevice, VkPipeline pipeline, const VkAllocationCallbacks *) { + assert(!gpu_pending && pipelines.erase(pipeline) == 1); +} void VKAPI_CALL bind_pipeline(VkCommandBuffer, VkPipelineBindPoint, VkPipeline pipeline) { assert(pipelines.count(pipeline)); bound_pipeline = pipeline; @@ -248,10 +297,20 @@ VkImageView external_image(uint32_t width, uint32_t height) { images[image] = {{width, height, 1}, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT}; views[view] = image; + external_views.push_back(view); return view; } +void clear_external_images() { + for (auto view : external_views) { + images.erase(views.at(view)); + views.erase(view); + } + external_views.clear(); +} + void record(ddfg::FrameGen &fg, int model, uint32_t width, uint32_t height, unsigned generations) { + gpu_pending = false; const auto previous = external_image(width, height), current = external_image(width, height); const auto first = dispatches.size(); for (unsigned i = 0; i < generations; i++) @@ -275,14 +334,29 @@ void record(ddfg::FrameGen &fg, int model, uint32_t width, uint32_t height, unsi const auto &actual = dispatches[first + i], &want = expected[i]; assert(actual.pipeline == want.pipeline && actual.x == want.x && actual.y == want.y && actual.z == want.z); } - for (auto it = views.begin(); it != views.end();) { - if (images.at(it->second).format == VK_FORMAT_R8G8B8A8_UNORM) { - images.erase(it->second); - it = views.erase(it); - } else ++it; - } + clear_external_images(); + gpu_pending = true; } +void check_empty() { + assert(images.empty() && views.empty() && buffers.empty() && allocations.empty()); + assert(descriptors.empty() && set_pools.empty() && pool_capacities.empty() && pipelines.empty()); +} + +void check_working_set(const ddfg::FrameGen &fg) { + assert(images.size() == static_cast(32 - 2 * fg.flowFinest())); + assert(buffers.size() == static_cast(18 - fg.flowFinest())); + assert(descriptors.size() == static_cast(54 - 4 * fg.flowFinest())); + assert(allocations.size() == images.size() + buffers.size()); +} + +} + +struct VkTable {}; +bool ddfgVkdInit(const VkTable &, ddfg::DeviceDispatch &dd, ddfg::InstanceDispatch &id) { + dd = *engine_dispatch; + id = *engine_instance; + return true; } int main(int argc, char **argv) { @@ -312,25 +386,145 @@ int main(int argc, char **argv) { dd.DestroyDescriptorSetLayout = destroy; dd.CreatePipelineLayout = create; dd.DestroyPipelineLayout = destroy; - dd.CreateDescriptorPool = create; - dd.DestroyDescriptorPool = destroy; dd.ResetDescriptorPool = reset_pool; + dd.CreateDescriptorPool = create_pool; + dd.DestroyDescriptorPool = destroy_pool; dd.ResetDescriptorPool = reset_pool; dd.AllocateDescriptorSets = allocate_sets; dd.UpdateDescriptorSets = update_sets; - dd.CreateComputePipelines = create_pipelines; dd.DestroyPipeline = destroy; + dd.CreateComputePipelines = create_pipelines; dd.DestroyPipeline = destroy_pipeline; dd.CmdBindPipeline = bind_pipeline; dd.CmdBindDescriptorSets = bind_sets; dd.CmdDispatch = dispatch; dd.CmdPipelineBarrier = barrier; dd.CmdClearColorImage = clear_image; dd.CmdCopyImage = copy_image; - ddfg::FrameGen fg; - assert(fg.init(&dd, &id, reinterpret_cast(1), reinterpret_cast(2), - 0, reinterpret_cast(3))); + engine_dispatch = ⅆ + engine_instance = &id; ddfg::Config cfg; cfg.enabled = true; cfg.model = model; cfg.perfPreset = preset; cfg.flowScale = 0.6f; - fg.configure(cfg); - assert(fg.onResize({width, height}, VK_FORMAT_R8G8B8A8_UNORM)); + auto initialize = [&](ddfg::FrameGen &fg) { + assert(fg.init(&dd, &id, reinterpret_cast(1), reinterpret_cast(2), + 0, reinterpret_cast(3))); + fg.configure(cfg); + assert(fg.onResize({width, height}, VK_FORMAT_R8G8B8A8_UNORM)); + }; + if (mode == "steady" || mode == "automatic") { + const auto waits = idle_calls; + { + ddfg::FrameGen fg; + initialize(fg); + for (unsigned repeat = 0; repeat < repeats; repeat++) { + record(fg, model, width, height, generations); + assert(fg.onResize({width, height}, VK_FORMAT_R8G8B8A8_UNORM)); + assert(idle_calls == waits); + check_working_set(fg); + } + if (mode == "steady") { + fg.destroy(); + fg.destroy(); + assert(idle_calls == waits + 1); + } + } + check_empty(); + assert(idle_calls == waits + 1); + std::puts("PASS lifecycle=steady-and-idempotent-destruction"); + return 0; + } + if (mode == "restart" || mode == "instances") { + for (unsigned repeat = 0; repeat < repeats; repeat++) { + ddfg::FrameGen first; + initialize(first); + record(first, model, width, height, generations); + check_working_set(first); + if (mode == "instances") { + gpu_pending = false; + ddfg::FrameGen second; + initialize(second); + record(second, model, width, height, generations); + first.destroy(); + record(second, model, width, height, generations); + check_working_set(second); + second.destroy(); + } else first.destroy(); + check_empty(); + } + std::puts("PASS lifecycle=restart-and-instance-isolation"); + return 0; + } + if (mode == "engine" || mode == "engine-failure") { + { + ddfg::Engine engine; + assert(engine.init(VkTable{}, reinterpret_cast(1), + reinterpret_cast(2), 0, reinterpret_cast(3))); + engine.configure(generations + 1, model, preset, 0.6f); + assert(engine.prepare(width, height, VK_FORMAT_R8G8B8A8_UNORM)); + for (unsigned frame = 0; frame < 3; frame++) { + gpu_pending = false; + const auto source = external_image(width, height); + const auto output = external_image(width, height); + const auto count = engine.plan(generations); + engine.process(reinterpret_cast(1), views.at(source), width, height, count); + for (unsigned generation = 0; generation < count; generation++) + engine.generateInto(reinterpret_cast(1), generation, count, + views.at(output), output, width, height); + clear_external_images(); + gpu_pending = true; + } + if (mode == "engine-failure") { + idle_result = VK_ERROR_OUT_OF_DEVICE_MEMORY; + assert(!engine.prepare(width + 17, height + 9, VK_FORMAT_R8G8B8A8_UNORM)); + assert(engine.unavailable() && !engine.valid()); + } + } + if (mode == "engine") check_empty(); + else assert(gpu_pending && !images.empty() && !buffers.empty() && !descriptors.empty()); + std::puts("PASS lifecycle=engine-ownership"); + return 0; + } + if (mode == "idle-failure" || mode == "destroy-failure" || mode == "reset-failure" || mode == "partial") { + { + ddfg::FrameGen fg; + initialize(fg); + record(fg, model, width, height, generations); + const auto prior_buffers = buffers.size(), prior_images = images.size(), prior_sets = descriptors.size(); + if (mode == "partial") { + fail_image_at = image_creates + 2; + assert(!fg.onResize({width + 17, height + 9}, VK_FORMAT_R8G8B8A8_UNORM)); + assert(!fg.valid()); + } else { + if (mode == "reset-failure") reset_result = VK_ERROR_OUT_OF_HOST_MEMORY; + else idle_result = VK_ERROR_OUT_OF_DEVICE_MEMORY; + if (mode == "destroy-failure") fg.destroy(); + else assert(!fg.onResize({width + 17, height + 9}, VK_FORMAT_R8G8B8A8_UNORM)); + assert(!fg.valid()); + assert(buffers.size() == prior_buffers && images.size() == prior_images && + descriptors.size() == prior_sets); + const auto prior_dispatches = dispatches.size(); + const auto prior_waits = idle_calls; + fg.record(reinterpret_cast(1), VK_NULL_HANDLE, VK_NULL_HANDLE, VK_NULL_HANDLE, 0.5f); + assert(dispatches.size() == prior_dispatches); + if (mode != "reset-failure") { + assert(!fg.onResize({width, height}, VK_FORMAT_R8G8B8A8_UNORM)); + cfg.perfPreset = (preset + 1) % 3; + fg.configure(cfg); + if (mode == "destroy-failure") { + idle_result = VK_SUCCESS; + assert(fg.destroy()); + } else { + fg.destroy(); + assert(idle_calls == prior_waits + 1); + } + } + } + } + if (mode == "reset-failure" || mode == "partial" || mode == "destroy-failure") check_empty(); + else assert(gpu_pending && !images.empty() && !buffers.empty() && !descriptors.empty()); + std::puts("PASS lifecycle=failure-containment"); + return 0; + } + ddfg::FrameGen fg; + initialize(fg); assert(mode == "resources" || mode == "record" || mode == "resize" || mode == "preset"); for (unsigned repeat = 0; repeat < repeats; repeat++) { const auto old_buffers = buffer_creates, old_sets = set_creates; if (mode != "record") check_images(width, height, fg.flowFinest()); record(fg, model, width, height, generations); if (mode != "record") { + check_working_set(fg); assert(buffer_creates - old_buffers == static_cast(15 - fg.flowFinest())); assert(set_creates - old_sets == static_cast(54 - 4 * fg.flowFinest())); } @@ -356,4 +550,5 @@ int main(int argc, char **argv) { dispatches.size(), static_cast(command_hash)); fg.destroy(); assert(images.empty() && views.empty()); + if (mode != "record") check_empty(); } diff --git a/tools/tests/test_ddfg_flow_levels.py b/tools/tests/test_ddfg_flow_levels.py index d5efd6355d..eb5f5a0186 100644 --- a/tools/tests/test_ddfg_flow_levels.py +++ b/tools/tests/test_ddfg_flow_levels.py @@ -40,6 +40,7 @@ class DdfgFlowLevelsTest(unittest.TestCase): "-Wno-missing-field-initializers", "-Wno-misleading-indentation", "-I" + str(work / "include"), "-I" + str(CHAIN), str(ROOT / "tools/tests/ddfg_flow_levels_harness.cpp"), str(CHAIN / "framegen.cpp"), + str(CHAIN / "ddfg_engine.cpp"), "-o", str(cls.binary), ], capture_output=True, text=True, timeout=120) if build.returncode: @@ -97,6 +98,38 @@ class DdfgFlowLevelsTest(unittest.TestCase): with self.subTest(model=model): self.run_case("preset", model=model, generations=3, repeats=4) + def test_many_resizes_do_not_accumulate_scratch_resources(self): + for model in (3, 4): + for preset in range(3): + with self.subTest(model=model, preset=preset): + self.run_case("resize", model=model, preset=preset, generations=3, repeats=16) + + def test_same_size_engine_restarts_use_fresh_scratch(self): + self.run_case("restart", generations=3, repeats=8) + + def test_instances_do_not_share_or_destroy_each_others_scratch(self): + self.run_case("instances", generations=3, repeats=3) + + def test_engine_teardown_waits_before_destroying_its_input_ring(self): + self.run_case("engine", generations=3) + + def test_failed_gpu_wait_stops_recording_and_retains_resources(self): + for mode in ("idle-failure", "destroy-failure", "engine-failure"): + with self.subTest(mode=mode): + self.run_case(mode, generations=3) + + def test_descriptor_pool_reset_failure_does_not_free_live_scratch(self): + self.run_case("reset-failure", generations=3) + + def test_partial_resize_allocation_is_cleaned_up(self): + self.run_case("partial", generations=3) + + def test_steady_frames_and_same_size_prepare_add_no_gpu_waits(self): + self.run_case("steady", generations=3, repeats=10) + + def test_scope_exit_releases_resources_without_an_explicit_destroy(self): + self.run_case("automatic", generations=3, repeats=3) + if __name__ == "__main__": unittest.main() From 768661928ee7f05edd2f4e5fc8961874d971cf78 Mon Sep 17 00:00:00 2001 From: FryMcNugget Date: Mon, 30 Nov 2026 20:10:08 +0000 Subject: [PATCH 119/120] feat(agent): connect the agent on Quest, which has no pairing screen (#3445) * feat(agent): connect the agent on Quest, which has no pairing screen Quest hides Android's Wireless debugging pairing, so the agent's connection step could not be completed there. On a Quest the step's action is now Allow: DroidDeck connects to adbd on 127.0.0.1:5555 (after a one-time `adb tcpip 5555` from a computer) and the headset asks "Allow debugging?" for DroidDeck's key. Wireless debugging accepts a key allowed that way, so the saved loopback connection then works like a pairing. DroidDeck also declares WRITE_SECURE_SETTINGS. When it is granted over adb, DroidDeck turns Wireless debugging on itself before looking for its port. * fix(agent): keep the Quest setup hint visible and report a declined prompt correctly A late connection lookup no longer overwrites an Allow that is running. On a Quest, the connection row shows its status above the full hint, which holds the one-time commands. The failure message no longer claims port 5555 was silent, since a declined or unanswered prompt fails the same way. * fix(agent): connection checks from before an Allow no longer overwrite it A check started before Allow could land after it and mark the step as not done, or replace the prompt instructions while Allow was still waiting. Each Allow now starts a new generation, and older connection results are dropped, as are results that land while Allow is running. * ci: rerun after the Maven 429 rate limit * fix(quest): turn Wireless debugging on by itself only on Quest Other devices keep exactly their pairing flow even if WRITE_SECURE_SETTINGS is granted. Once connected, the Quest agent row shows its usual short hint instead of the setup instructions. * fix(quest): connect after a reboot without a second Allow After a reboot, turning Wireless debugging on makes the Quest ask again to allow it on this network, and the 2 s wait ran out before that was answered, so the row showed Allow. Allow then failed, since port 5555 is closed after a reboot. The lookup now keeps trying for up to 30 s after turning Wireless debugging on, and Allow first tries the already-trusted key over Wireless debugging before asking on port 5555. * ci: rerun after download timeouts in the Python tests --------- Co-authored-by: FryMcNugget <358046012+FryMcNugget@users.noreply.github.com> --- app/src/main/AndroidManifest.xml | 3 ++ .../droiddeck/launcher/agent/AgentSetup.kt | 35 +++++++++++++++-- .../droiddeck/launcher/core/GlobalSettings.kt | 11 ++++++ .../droiddeck/launcher/core/WirelessAdbFix.kt | 39 ++++++++++++++++--- .../droiddeck/launcher/ui/AgentSetupView.kt | 14 ++++++- .../droiddeck/launcher/ui/FrontEndSetup.kt | 4 +- app/src/main/res/values-ar/strings.xml | 5 +++ app/src/main/res/values-b+es+419/strings.xml | 5 +++ app/src/main/res/values-bg/strings.xml | 5 +++ app/src/main/res/values-cs/strings.xml | 5 +++ app/src/main/res/values-da/strings.xml | 5 +++ app/src/main/res/values-de/strings.xml | 5 +++ app/src/main/res/values-el/strings.xml | 5 +++ app/src/main/res/values-es/strings.xml | 5 +++ app/src/main/res/values-fi/strings.xml | 5 +++ app/src/main/res/values-fr/strings.xml | 5 +++ app/src/main/res/values-hi/strings.xml | 5 +++ app/src/main/res/values-hu/strings.xml | 5 +++ app/src/main/res/values-in/strings.xml | 5 +++ app/src/main/res/values-it/strings.xml | 5 +++ app/src/main/res/values-ja/strings.xml | 5 +++ app/src/main/res/values-ko/strings.xml | 5 +++ app/src/main/res/values-ms/strings.xml | 5 +++ app/src/main/res/values-nb/strings.xml | 5 +++ app/src/main/res/values-nl/strings.xml | 5 +++ app/src/main/res/values-pl/strings.xml | 5 +++ app/src/main/res/values-pt-rPT/strings.xml | 5 +++ app/src/main/res/values-pt/strings.xml | 5 +++ app/src/main/res/values-ro/strings.xml | 5 +++ app/src/main/res/values-ru/strings.xml | 5 +++ app/src/main/res/values-sv/strings.xml | 5 +++ app/src/main/res/values-th/strings.xml | 5 +++ app/src/main/res/values-tr/strings.xml | 5 +++ app/src/main/res/values-uk/strings.xml | 5 +++ app/src/main/res/values-vi/strings.xml | 5 +++ app/src/main/res/values-zh-rCN/strings.xml | 5 +++ app/src/main/res/values-zh-rHK/strings.xml | 5 +++ app/src/main/res/values-zh-rTW/strings.xml | 5 +++ app/src/main/res/values/strings.xml | 5 +++ 39 files changed, 258 insertions(+), 13 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 55b75d36df..566226306e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -33,6 +33,9 @@ + + diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt index 4a2e07b45b..aa2ad40ae7 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt @@ -8,8 +8,11 @@ import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue +import com.droiddeck.launcher.R +import com.droiddeck.launcher.core.WirelessAdbFix import com.droiddeck.launcher.runtime.LinuxRuntime import com.droiddeck.launcher.session.OrphanReaper +import com.droiddeck.launcher.session.QuestExperimental import java.io.File import java.util.concurrent.TimeUnit @@ -88,6 +91,8 @@ object AgentSetup { private fun completedKey(harness: AgentHarness) = "setup_completed_${harness.id}" private val main = Handler(Looper.getMainLooper()) + /** Advanced by every Allow, so a connection check started before it cannot overwrite what it found. */ + private var connectionGeneration = 0 private const val REPO = "https://github.com/Droid-Deck/DroidDeck.git" private const val CHECKOUT = "/root/DroidDeck" private val HELPERS = listOf("android-open", "dd-gh-login", "droiddeckctl", "droiddeck-scenario") @@ -104,6 +109,7 @@ object AgentSetup { val harness = AgentHost.harness keys = harness.keys(LinuxRuntime.rootDir(app)) val probes = mutableListOf>>() + val generation = connectionGeneration for (step in Step.entries) if (status[step] != Status.WORKING) { when (step) { Step.INSTALL -> set(step, if (harness.files.all { AgentHost.guestFileExists(app, it) }) Status.DONE else Status.TODO) @@ -114,7 +120,9 @@ object AgentSetup { detail.remove(step) Thread({ val live = com.droiddeck.launcher.core.WirelessAdbFix.liveConnectAddress(app) != null - set(step, if (live) Status.DONE else Status.TODO) + main.post { + if (generation == connectionGeneration && status[step] != Status.WORKING) status[step] = if (live) Status.DONE else Status.TODO + } }, "agent-connection").start() } else probes += step to listOf("sh", "-c", "for i in 1 2 3; do adb connect \"\$ADB_SERIAL\" >/dev/null 2>&1; " + @@ -123,7 +131,7 @@ object AgentSetup { Step.GITHUB -> probes += step to listOf("gh", "auth", "status") } } - Thread({ for ((step, command) in probes) probe(app, harness, step, command) }, "agent-checks").start() + Thread({ for ((step, command) in probes) probe(app, harness, step, command, generation) }, "agent-checks").start() } /** The last failed refresh ends the script: the installs after it would run from stale indexes and could report success. */ @@ -141,6 +149,22 @@ object AgentSetup { /** Runs [step]'s action. [CONNECTION] is the app's own pairing flow, so the caller opens it. */ fun run(context: Context, step: Step) = run(context, step, null) + /** The [Step.CONNECTION] action on a Quest, which has no pairing screen; see [WirelessAdbFix.trustOnDevice]. */ + fun trustOnDevice(context: Context) { + val app = context.applicationContext + connectionGeneration++ + status[Step.CONNECTION] = Status.WORKING + detail[Step.CONNECTION] = app.getString(R.string.agent_connection_quest_waiting) + Thread({ + val ok = runCatching { WirelessAdbFix.trustOnDevice(app) }.isSuccess + main.post { + status[Step.CONNECTION] = if (ok) Status.DONE else Status.FAILED + if (ok) detail.remove(Step.CONNECTION) else detail[Step.CONNECTION] = app.getString(R.string.agent_connection_quest_failed) + if (ok) check(app) + } + }, "agent-quest-trust").start() + } + /** Opens the page where a provider's key is made, as the sign-in of a harness that takes pasted keys. */ fun openKeyPage(context: Context, page: String) = run(context, Step.SIGN_IN, listOf("/root/.local/bin/android-open", page)) @@ -216,7 +240,7 @@ object AgentSetup { detail.clear() } - private fun probe(app: Context, harness: AgentHarness, step: Step, command: List) { + private fun probe(app: Context, harness: AgentHarness, step: Step, command: List, generation: Int) { var output = "" val ok = runCatching { val child = AgentHost.guest(app, command, connectAdb = step == Step.CONNECTION).start() @@ -232,11 +256,14 @@ object AgentSetup { }.onFailure { output = it.message.orEmpty() }.getOrDefault(false) main.post { if (AgentHost.harness != harness) return@post + // A running or newer Allow owns the row, including the instructions it shows while it waits. + if (step == Step.CONNECTION && (generation != connectionGeneration || status[step] == Status.WORKING)) return@post if (status[step] != Status.WORKING) status[step] = if (ok) Status.DONE else Status.TODO val last = output.lines().lastOrNull { it.isNotBlank() && !noise(it.trim()) }?.trim()?.take(160) when { ok -> detail.remove(step) - step == Step.CONNECTION -> detail[step] = app.getString(com.droiddeck.launcher.R.string.agent_connection_off) + step == Step.CONNECTION -> detail[step] = app.getString( + if (QuestExperimental.isSupported()) R.string.agent_connection_quest_off else R.string.agent_connection_off) step.required && last != null -> detail[step] = last } if (ready) AgentHost.prefs(app).edit().putBoolean(completedKey(harness), true).apply() diff --git a/app/src/main/java/com/droiddeck/launcher/core/GlobalSettings.kt b/app/src/main/java/com/droiddeck/launcher/core/GlobalSettings.kt index 3e4bb53051..1daf377fb7 100644 --- a/app/src/main/java/com/droiddeck/launcher/core/GlobalSettings.kt +++ b/app/src/main/java/com/droiddeck/launcher/core/GlobalSettings.kt @@ -1,6 +1,7 @@ package com.droiddeck.launcher.core import android.content.Context +import android.content.pm.PackageManager import android.net.Uri import android.provider.Settings @@ -19,4 +20,14 @@ object GlobalSettings { fun developerOptionsOn(context: Context): Boolean = isOn(context, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED) fun wirelessDebuggingOn(context: Context): Boolean = isOn(context, "adb_wifi_enabled") + + /** + * True when it was off and is now on. Quest only, where Settings has no switch for it; it needs + * WRITE_SECURE_SETTINGS granted over adb. + */ + fun turnOnWirelessDebugging(context: Context): Boolean { + if (!com.droiddeck.launcher.session.QuestExperimental.isSupported() || wirelessDebuggingOn(context)) return false + if (context.checkSelfPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) != PackageManager.PERMISSION_GRANTED) return false + return runCatching { Settings.Global.putInt(context.contentResolver, "adb_wifi_enabled", 1) }.getOrDefault(false) + } } diff --git a/app/src/main/java/com/droiddeck/launcher/core/WirelessAdbFix.kt b/app/src/main/java/com/droiddeck/launcher/core/WirelessAdbFix.kt index 5c8b32f7ba..64087a24f3 100644 --- a/app/src/main/java/com/droiddeck/launcher/core/WirelessAdbFix.kt +++ b/app/src/main/java/com/droiddeck/launcher/core/WirelessAdbFix.kt @@ -22,6 +22,9 @@ object WirelessAdbFix { private const val HOST_FILE = "wireless-adb-host.txt" private const val CONNECTION_FILE = "wireless-adb-connection.txt" const val LOOPBACK = "127.0.0.1" + private const val TCP_PORT = 5555 + private const val WIRELESS_START_MS = 2_000L + private const val NETWORK_PROMPT_MS = 30_000L private data class SavedConnection(val host: String, val port: Int?) @@ -55,6 +58,23 @@ object WirelessAdbFix { writeAtomically(context, File(context.noBackupFilesDir, CONNECTION_FILE), ByteArray(0)) } + /** + * Quest has no pairing screen. adbd in TCP mode (`adb tcpip 5555`) asks "Allow debugging?" for an + * unknown key, and Wireless debugging accepts a key allowed there, so this stands in for pairing. + * Blocks until the prompt is answered or times out. + */ + fun trustOnDevice(context: Context) { + val app = context.applicationContext + // Already trusted, as after a reboot: Wireless debugging takes the key, and port 5555 is closed by then. + val live = if (savedConnection(app) != null) liveConnectAddress(app) else null + if (live != null && acceptsKey(app, live.substringBeforeLast(':').trim('[', ']'), live.substringAfterLast(':').toInt())) return + GlobalSettings.turnOnWirelessDebugging(app) + loadOrCreateIdentity(app) + Kadb.create(LOOPBACK, TCP_PORT, 2_000, 120_000).use { check(it.shell("true").exitCode == 0) } + writeAtomically(app, File(app.noBackupFilesDir, HOST_FILE), LOOPBACK.toByteArray()) + writeAtomically(app, File(app.noBackupFilesDir, CONNECTION_FILE), ByteArray(0)) + } + private fun savedConnection(context: Context): SavedConnection? { val directory = context.applicationContext.noBackupFilesDir if (!File(directory, CERT_FILE).isFile || !File(directory, KEY_FILE).isFile) return null @@ -78,10 +98,17 @@ object WirelessAdbFix { fun liveConnectAddress(context: Context): String? { val app = context.applicationContext val saved = savedConnection(app) ?: return null + val turnedOn = GlobalSettings.turnOnWirelessDebugging(app) val host = if (':' in saved.host) "[${saved.host}]" else saved.host - saved.port?.takeIf { answers(saved.host, it) }?.let { return "$host:$it" } + if (!turnedOn) saved.port?.takeIf { answers(saved.host, it) }?.let { return "$host:$it" } val loopback = runCatching { InetAddress.getByName(saved.host).isLoopbackAddress }.getOrDefault(false) - val port = if (loopback) loopbackAdbPort(app) else findConnectPort(app, saved.host, accept = { answers(saved.host, it) }) + // Turning it on can first ask "Allow wireless debugging on this network?", so keep looking while that is answered. + val deadline = android.os.SystemClock.elapsedRealtime() + if (turnedOn) NETWORK_PROMPT_MS else 0L + var port: Int? + do { + if (turnedOn) Thread.sleep(WIRELESS_START_MS) + port = if (loopback) loopbackAdbPort(app) else findConnectPort(app, saved.host, accept = { answers(saved.host, it) }) + } while (port == null && android.os.SystemClock.elapsedRealtime() < deadline) port ?: return null saveConnection(app, saved.host, port) return "$host:$port" @@ -105,10 +132,12 @@ object WirelessAdbFix { } }.apply { start() } }.forEach { it.join() } + return open.sorted().firstOrNull { port -> acceptsKey(app, LOOPBACK, port) } + } + + private fun acceptsKey(app: Context, host: String, port: Int): Boolean { loadOrCreateIdentity(app) - return open.sorted().firstOrNull { port -> - runCatching { Kadb.create(LOOPBACK, port, 1_000, 3_000).use { it.shell("true").exitCode == 0 } }.getOrDefault(false) - } + return runCatching { Kadb.create(host, port, 1_000, 3_000).use { it.shell("true").exitCode == 0 } }.getOrDefault(false) } private val EPHEMERAL_PORTS = 32768..60999 diff --git a/app/src/main/java/com/droiddeck/launcher/ui/AgentSetupView.kt b/app/src/main/java/com/droiddeck/launcher/ui/AgentSetupView.kt index 25b01904d8..615d59cb61 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/AgentSetupView.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/AgentSetupView.kt @@ -46,6 +46,7 @@ import androidx.compose.ui.platform.testTag import com.droiddeck.launcher.agent.AgentSetup.Status import com.droiddeck.launcher.agent.AgentSetup.Step import com.droiddeck.launcher.core.WirelessAdbPairingService +import com.droiddeck.launcher.session.QuestExperimental @Composable internal fun AgentSetupView(modifier: Modifier, firstControl: Modifier = Modifier, onDone: () -> Unit = {}) { @@ -104,11 +105,16 @@ internal fun AgentSetupView(modifier: Modifier, firstControl: Modifier = Modifie var keyOpen by rememberSaveable(harness.id) { mutableStateOf(false) } val (title, hint) = labels(step, harness.name, keyed) val lab = AgentHost.lab?.takeIf { it.prepare && it.running } + val questConnection = step == Step.CONNECTION && status != Status.DONE && QuestExperimental.isSupported() val detail = when { step == Step.PREPARE && lab != null -> stringResource(R.string.agent_prepare_progress, lab.permille / 10, clock(lab.etaSeconds.toLong().coerceAtLeast(0))) keyed && status == Status.DONE && AgentSetup.detail[step] == null -> harness.providers.filter { it.id in AgentSetup.keys }.joinToString(" · ") { it.name }.ifEmpty { stringResource(R.string.agent_step_free_models) } + // The Quest hint holds the one-time commands, so it stays under the status until the step passes. + questConnection -> AgentSetup.detail[step]?.let { "$it\n$hint" } ?: hint + // The Quest hint is setup instructions; once connected, the row says what it is for. + step == Step.CONNECTION && QuestExperimental.isSupported() -> AgentSetup.detail[step] ?: stringResource(R.string.agent_step_connection_hint) else -> AgentSetup.detail[step] ?: hint } // Shown while the sign-in is pending, so it is still there after a trip to the browser for the key. @@ -121,6 +127,7 @@ internal fun AgentSetupView(modifier: Modifier, firstControl: Modifier = Modifie Status.TODO, Status.FAILED -> CheckState.WARN }, title, detail, divider = index < steps.lastIndex && !showKey, + detailLines = if (questConnection) Int.MAX_VALUE else 2, ) { val blocked = (step in setOf(Step.SIGN_IN, Step.GITHUB, Step.BUILD_TOOLS) && AgentSetup.status[Step.INSTALL] != Status.DONE) || (step == Step.PREPARE && AgentSetup.status[Step.BUILD_TOOLS] != Status.DONE) @@ -258,7 +265,9 @@ internal fun agentStorageWarning(item: AgentStorage.Item) = when (item) { @Composable private fun labels(step: Step, harness: String, keyed: Boolean = false): Pair = when (step) { - Step.CONNECTION -> stringResource(R.string.agent_step_connection) to stringResource(R.string.agent_step_connection_hint) + Step.CONNECTION -> stringResource(R.string.agent_step_connection) to + if (QuestExperimental.isSupported()) stringResource(R.string.agent_step_connection_quest_hint, LocalContext.current.packageName) + else stringResource(R.string.agent_step_connection_hint) Step.INSTALL -> stringResource(R.string.agent_step_install, harness) to stringResource(R.string.agent_step_install_hint) Step.SIGN_IN -> stringResource(R.string.agent_step_sign_in, harness) to stringResource(if (keyed) R.string.agent_step_sign_in_key_hint else R.string.agent_step_sign_in_hint) Step.GITHUB -> stringResource(R.string.agent_step_github) to stringResource(R.string.agent_step_github_hint) @@ -267,7 +276,7 @@ private fun labels(step: Step, harness: String, keyed: Boolean = false): Pair R.string.agent_action_pair + Step.CONNECTION -> if (QuestExperimental.isSupported()) R.string.agent_action_allow else R.string.agent_action_pair Step.INSTALL -> R.string.agent_action_install Step.SIGN_IN, Step.GITHUB -> R.string.agent_action_sign_in Step.BUILD_TOOLS -> R.string.agent_action_install @@ -276,6 +285,7 @@ private fun action(step: Step): Int = when (step) { /** The pairing DroidDeck already uses for the phantom process fix; the agent reuses its key. */ private fun pair(context: android.content.Context) { + if (QuestExperimental.isSupported()) return AgentSetup.trustOnDevice(context) if (!WirelessAdbPairingService.notificationsEnabled(context)) { context.startActivity(android.content.Intent(android.provider.Settings.ACTION_APP_NOTIFICATION_SETTINGS) .putExtra(android.provider.Settings.EXTRA_APP_PACKAGE, context.packageName) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt index d804a4fa56..8e3727348b 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt @@ -103,7 +103,7 @@ internal object SetupTabs { } @Composable -internal fun CheckRow(state: CheckState, title: String, detail: String?, divider: Boolean = true, action: (@Composable () -> Unit)? = null) { +internal fun CheckRow(state: CheckState, title: String, detail: String?, divider: Boolean = true, detailLines: Int = 2, action: (@Composable () -> Unit)? = null) { val colors = MaterialTheme.colorScheme val pal = LocalPalette.current val tint = when (state) { @@ -135,7 +135,7 @@ internal fun CheckRow(state: CheckState, title: String, detail: String?, divider } Column(modifier = Modifier.weight(1f)) { Text(title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground) - if (detail != null) Text(detail, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis) + if (detail != null) Text(detail, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = detailLines, overflow = TextOverflow.Ellipsis) } if (action != null) action() } diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 6adbf809b9..022f589826 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1265,6 +1265,11 @@ تحضير تعذّر الوصول إلى تصحيح الأخطاء اللاسلكي؛ زر الاقتران يشغّله اقتران + لا يحتوي Quest على شاشة اقتران. من حاسوب، شغّل مرة واحدة: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS و adb tcpip 5555. ثم اضغط «السماح» واقبل الطلب في النظارة + السماح + اقبل «السماح بتصحيح الأخطاء؟» في النظارة مع تحديد «السماح دائمًا» + تعذّر الاتصال. اقبل طلب تصحيح الأخطاء في النظارة، وإن لم يظهر، شغّل adb tcpip 5555 من حاسوب ثم حاول مجددًا + تعذّر الوصول إلى تصحيح الأخطاء اللاسلكي. اضغط «السماح» لإعداده من جديد تثبيت تسجيل الدخول PR #%1$d diff --git a/app/src/main/res/values-b+es+419/strings.xml b/app/src/main/res/values-b+es+419/strings.xml index bfc1963cb3..33a0f918e1 100644 --- a/app/src/main/res/values-b+es+419/strings.xml +++ b/app/src/main/res/values-b+es+419/strings.xml @@ -1280,6 +1280,11 @@ Preparar No se puede acceder a la depuración inalámbrica; Vincular la activa Vincular + Quest no tiene pantalla de vinculación. Desde una computadora, ejecuta una vez: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS y adb tcpip 5555. Luego toca Permitir y acepta el aviso en el visor + Permitir + Acepta «¿Permitir depuración?» en el visor, con Permitir siempre marcado + No se pudo conectar. Acepta el aviso de depuración en el visor o, si no apareció, ejecuta adb tcpip 5555 desde una computadora y vuelve a intentarlo + No se puede acceder a la depuración inalámbrica. Toca Permitir para configurarla de nuevo Instalar Iniciar sesión PR #%1$d diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 0eeec70877..8cf8a2002a 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -1249,6 +1249,11 @@ Подготви Безжичното отстраняване на грешки не е достъпно; сдвояването го включва Сдвой + Quest няма екран за сдвояване. От компютър изпълнете веднъж: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS и adb tcpip 5555. След това докоснете „Разреши“ и приемете запитването в шлема + Разреши + Приемете „Разрешаване на отстраняването на грешки?“ в шлема с отметка „Винаги разрешавай“ + Неуспешно свързване. Приемете запитването за отстраняване на грешки в шлема, а ако не се е появило, изпълнете adb tcpip 5555 от компютър и опитайте отново + Безжичното отстраняване на грешки не е достъпно. Докоснете „Разреши“, за да го настроите отново Инсталирай Влез PR #%1$d diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 833c403b0d..60b90ae035 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -1257,6 +1257,11 @@ Připravit Bezdrátové ladění není dostupné; Spárovat ho zapne Spárovat + Quest nemá obrazovku párování. Z počítače jednou spusťte: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS a adb tcpip 5555. Pak klepněte na Povolit a potvrďte výzvu v headsetu + Povolit + V headsetu potvrďte „Povolit ladění?“ se zaškrtnutým Vždy povolit + Nepodařilo se připojit. Potvrďte výzvu k ladění v headsetu, a pokud se neobjevila, spusťte z počítače adb tcpip 5555 a zkuste to znovu + Bezdrátové ladění není dostupné. Klepnutím na Povolit ho nastavíte znovu Instalovat Přihlásit se PR #%1$d diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 6efe122eb6..c316cfc229 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -1249,6 +1249,11 @@ Forbered Trådløs fejlfinding kan ikke nås; Par slår den til Par + Quest har ingen parringsskærm. Kør én gang fra en computer: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS og adb tcpip 5555. Tryk derefter på Tillad, og godkend prompten i headsettet + Tillad + Godkend “Tillad fejlretning?” i headsettet med Tillad altid markeret + Kunne ikke oprette forbindelse. Godkend fejlretningsprompten i headsettet, eller kør adb tcpip 5555 fra en computer og prøv igen, hvis den ikke dukkede op + Trådløs fejlretning kan ikke nås. Tryk på Tillad for at konfigurere den igen Installer Log ind PR #%1$d diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 31d8914d6c..de3e9c377d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1241,6 +1241,11 @@ Vorbereiten Wireless-Debugging ist nicht erreichbar; Koppeln schaltet es ein Koppeln + Quest hat keinen Kopplungsbildschirm. Führe einmal an einem Computer aus: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS und adb tcpip 5555. Tippe dann auf Zulassen und bestätige die Abfrage im Headset + Zulassen + Bestätige „Debugging zulassen?“ im Headset mit aktiviertem „Immer zulassen“ + Verbindung fehlgeschlagen. Bestätige die Debugging-Abfrage im Headset. Falls keine erschienen ist, führe adb tcpip 5555 an einem Computer aus und versuche es erneut + Kabelloses Debugging ist nicht erreichbar. Tippe auf Zulassen, um es neu einzurichten Installieren Anmelden PR #%1$d diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 5cad897424..655da001c1 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -1249,6 +1249,11 @@ Προετοιμασία Η ασύρματη αποσφαλμάτωση δεν είναι προσβάσιμη · η Σύζευξη την ενεργοποιεί Σύζευξη + Το Quest δεν έχει οθόνη σύζευξης. Από έναν υπολογιστή, εκτελέστε μία φορά: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS και adb tcpip 5555. Μετά πατήστε «Να επιτραπεί» και αποδεχτείτε το μήνυμα στο headset + Να επιτραπεί + Αποδεχτείτε το «Να επιτραπεί ο εντοπισμός σφαλμάτων;» στο headset, με επιλεγμένο το «Να επιτρέπεται πάντα» + Δεν ήταν δυνατή η σύνδεση. Αποδεχτείτε το μήνυμα εντοπισμού σφαλμάτων στο headset ή, αν δεν εμφανίστηκε, εκτελέστε adb tcpip 5555 από υπολογιστή και δοκιμάστε ξανά + Ο ασύρματος εντοπισμός σφαλμάτων δεν είναι προσβάσιμος. Πατήστε «Να επιτραπεί» για να τον ρυθμίσετε ξανά Εγκατάσταση Σύνδεση PR #%1$d diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index c055194828..6a5d9622da 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1253,6 +1253,11 @@ Preparar No se puede acceder a la depuración inalámbrica; Emparejar la activa Emparejar + Quest no tiene pantalla de vinculación. Desde un ordenador, ejecuta una vez: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS y adb tcpip 5555. Después toca Permitir y acepta el aviso en el visor + Permitir + Acepta «¿Permitir depuración?» en el visor, con Permitir siempre marcado + No se pudo conectar. Acepta el aviso de depuración en el visor o, si no apareció, ejecuta adb tcpip 5555 desde un ordenador y vuelve a intentarlo + No se puede acceder a la depuración inalámbrica. Toca Permitir para configurarla de nuevo Instalar Iniciar sesión PR #%1$d diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 4fac8b737d..80c90ff817 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -1249,6 +1249,11 @@ Valmistele Langaton virheenkorjaus ei ole tavoitettavissa; Parita ottaa sen käyttöön Parita + Questissa ei ole laiteparinäkymää. Suorita kerran tietokoneelta: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS ja adb tcpip 5555. Napauta sitten Salli ja hyväksy kehote laseissa + Salli + Hyväksy ”Sallitaanko virheenkorjaus?” laseissa, kun Salli aina on valittuna + Yhteyttä ei saatu. Hyväksy virheenkorjauskehote laseissa, tai jos sitä ei näkynyt, suorita adb tcpip 5555 tietokoneelta ja yritä uudelleen + Langatonta virheenkorjausta ei tavoiteta. Määritä se uudelleen napauttamalla Salli Asenna Kirjaudu sisään PR #%1$d diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 05ed77da3c..db54af05d4 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1252,6 +1252,11 @@ Préparer Le débogage sans fil n\'est pas accessible ; « Associer » l\'active Associer + Le Quest n\'a pas d\'écran d\'association. Depuis un ordinateur, exécutez une fois : adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS et adb tcpip 5555. Touchez ensuite Autoriser et acceptez la demande dans le casque + Autoriser + Acceptez « Autoriser le débogage ? » dans le casque, avec Toujours autoriser coché + Connexion impossible. Acceptez la demande de débogage dans le casque ou, si elle n\'est pas apparue, exécutez adb tcpip 5555 depuis un ordinateur et réessayez + Le débogage sans fil est injoignable. Touchez Autoriser pour le configurer à nouveau Installer Se connecter PR #%1$d diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 174f70bfa1..47b15821d3 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -1249,6 +1249,11 @@ तैयार करें वायरलेस डिबगिंग से कनेक्ट नहीं हो पा रहा; पेयर करने से यह चालू हो जाता है पेयर करें + Quest में पेयरिंग स्क्रीन नहीं है। किसी कंप्यूटर से एक बार चलाएँ: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS और adb tcpip 5555। फिर अनुमति दें पर टैप करें और हेडसेट में संकेत स्वीकार करें + अनुमति दें + हेडसेट में “डीबगिंग की अनुमति दें?” स्वीकार करें, हमेशा अनुमति दें चुना हुआ रखें + कनेक्ट नहीं हो सका। हेडसेट में डीबगिंग संकेत स्वीकार करें, या अगर वह नहीं दिखा, तो कंप्यूटर से adb tcpip 5555 चलाएँ और दोबारा कोशिश करें + वायरलेस डीबगिंग तक नहीं पहुँचा जा सकता। इसे फिर से सेट करने के लिए अनुमति दें पर टैप करें इंस्टॉल करें साइन इन करें PR #%1$d diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 5fdb4a5a66..edc23c97ca 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -1249,6 +1249,11 @@ Előkészítés A vezeték nélküli hibakeresés nem érhető el; a Párosítás bekapcsolja Párosítás + A Quest nem rendelkezik párosítási képernyővel. Egy számítógépről futtasd egyszer: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS és adb tcpip 5555. Ezután koppints az Engedélyezés gombra, és fogadd el a kérdést a headsetben + Engedélyezés + Fogadd el az „Engedélyezed a hibakeresést?” kérdést a headsetben, a Mindig engedélyez bejelölésével + Nem sikerült csatlakozni. Fogadd el a hibakeresési kérdést a headsetben, vagy ha nem jelent meg, futtasd az adb tcpip 5555 parancsot egy számítógépről, és próbáld újra + A vezeték nélküli hibakeresés nem érhető el. Koppints az Engedélyezés gombra az újbóli beállításhoz Telepítés Bejelentkezés PR #%1$d diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 09891934b8..67f801c7bb 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -1246,6 +1246,11 @@ Siapkan Debug nirkabel tidak dapat dijangkau; Pasangkan menyalakannya Pasangkan + Quest tidak memiliki layar penyambungan. Dari komputer, jalankan sekali: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS dan adb tcpip 5555. Lalu ketuk Izinkan dan terima permintaan di headset + Izinkan + Terima “Izinkan debugging?” di headset, dengan Selalu izinkan dicentang + Tidak dapat terhubung. Terima permintaan debugging di headset, atau jika tidak muncul, jalankan adb tcpip 5555 dari komputer lalu coba lagi + Debugging nirkabel tidak dapat dijangkau. Ketuk Izinkan untuk menyiapkannya lagi Pasang Masuk PR #%1$d diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 4aaee8b446..19021c75bf 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1244,6 +1244,11 @@ Prepara Il debug wireless non è raggiungibile; Associa lo attiva Associa + Quest non ha una schermata di accoppiamento. Da un computer, esegui una volta: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS e adb tcpip 5555. Poi tocca Consenti e accetta la richiesta nel visore + Consenti + Accetta «Consentire il debug?» nel visore, con Consenti sempre selezionato + Impossibile connettersi. Accetta la richiesta di debug nel visore oppure, se non è comparsa, esegui adb tcpip 5555 da un computer e riprova + Il debug wireless non è raggiungibile. Tocca Consenti per configurarlo di nuovo Installa Accedi PR #%1$d diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 157a2b6627..199f44f302 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -1246,6 +1246,11 @@ 準備 ワイヤレスデバッグに接続できません。ペアリングで有効になります ペアリング + Quest にはペア設定画面がありません。パソコンから一度だけ adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS と adb tcpip 5555 を実行し、[許可] をタップしてヘッドセットの確認を承認してください + 許可 + ヘッドセットで「デバッグを許可しますか?」を、[常に許可] にチェックを入れて承認してください + 接続できませんでした。ヘッドセットでデバッグの確認を承認してください。表示されなかった場合は、パソコンから adb tcpip 5555 を実行してもう一度お試しください + ワイヤレス デバッグに接続できません。[許可] をタップして設定し直してください インストール サインイン PR #%1$d diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index cd41e8aa47..7d139b289b 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -1246,6 +1246,11 @@ 준비 무선 디버깅에 연결할 수 없습니다. 페어링하면 켜집니다 페어링 + Quest에는 페어링 화면이 없습니다. 컴퓨터에서 한 번 실행하세요: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS 및 adb tcpip 5555. 그런 다음 허용을 탭하고 헤드셋에서 요청을 수락하세요 + 허용 + 헤드셋에서 \'디버깅을 허용하시겠습니까?\'를 항상 허용을 선택한 채로 수락하세요 + 연결하지 못했습니다. 헤드셋에서 디버깅 요청을 수락하거나, 요청이 나타나지 않았다면 컴퓨터에서 adb tcpip 5555를 실행한 뒤 다시 시도하세요 + 무선 디버깅에 연결할 수 없습니다. 허용을 탭해 다시 설정하세요 설치 로그인 PR #%1$d diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml index 92d613f184..73ba644c82 100644 --- a/app/src/main/res/values-ms/strings.xml +++ b/app/src/main/res/values-ms/strings.xml @@ -1246,6 +1246,11 @@ Sediakan Penyahpepijatan wayarles tidak dapat dicapai; Pasangkan menghidupkannya Pasangkan + Quest tiada skrin pasangan. Dari komputer, jalankan sekali: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS dan adb tcpip 5555. Kemudian ketik Benarkan dan terima gesaan dalam set kepala + Benarkan + Terima “Benarkan penyahpepijatan?” dalam set kepala, dengan Sentiasa benarkan ditanda + Tidak dapat bersambung. Terima gesaan penyahpepijatan dalam set kepala, atau jika tiada, jalankan adb tcpip 5555 dari komputer dan cuba lagi + Penyahpepijatan wayarles tidak dapat dicapai. Ketik Benarkan untuk menyediakannya semula Pasang Log masuk PR #%1$d diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index edc7b5fa51..96e5da88c7 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -1249,6 +1249,11 @@ Forbered Trådløs feilsøking er ikke tilgjengelig; Par slår den på Par + Quest har ingen sammenkoblingsskjerm. Kjør én gang fra en datamaskin: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS og adb tcpip 5555. Trykk deretter på Tillat og godta spørsmålet i hodesettet + Tillat + Godta «Vil du tillate feilsøking?» i hodesettet med Tillat alltid avkrysset + Kunne ikke koble til. Godta feilsøkingsspørsmålet i hodesettet, eller kjør adb tcpip 5555 fra en datamaskin og prøv igjen hvis det ikke dukket opp + Trådløs feilsøking kan ikke nås. Trykk på Tillat for å sette den opp på nytt Installer Logg inn PR #%1$d diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 77808b5f3c..0b15dff90d 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1249,6 +1249,11 @@ Voorbereiden Draadloze foutopsporing is niet bereikbaar; Koppelen schakelt dit in Koppelen + Quest heeft geen koppelscherm. Voer vanaf een computer één keer uit: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS en adb tcpip 5555. Tik daarna op Toestaan en accepteer de melding in de headset + Toestaan + Accepteer ‘Foutopsporing toestaan?’ in de headset, met Altijd toestaan aangevinkt + Verbinden mislukt. Accepteer de foutopsporingsmelding in de headset, of voer adb tcpip 5555 uit vanaf een computer en probeer het opnieuw als er geen verscheen + Draadloze foutopsporing is niet bereikbaar. Tik op Toestaan om het opnieuw in te stellen Installeren Inloggen PR #%1$d diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 687742d283..80ca1f1c4b 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1257,6 +1257,11 @@ Przygotuj Debugowanie bezprzewodowe jest niedostępne; Paruj, aby je włączyć Paruj + Quest nie ma ekranu parowania. Na komputerze uruchom raz: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS oraz adb tcpip 5555. Następnie dotknij Zezwól i zaakceptuj monit w goglach + Zezwól + Zaakceptuj „Zezwolić na debugowanie?” w goglach z zaznaczonym Zawsze zezwalaj + Nie udało się połączyć. Zaakceptuj monit debugowania w goglach, a jeśli się nie pojawił, uruchom adb tcpip 5555 na komputerze i spróbuj ponownie + Debugowanie bezprzewodowe jest nieosiągalne. Dotknij Zezwól, aby skonfigurować je ponownie Zainstaluj Zaloguj się PR #%1$d diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index c5970fe00b..9121642799 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -1244,6 +1244,11 @@ Preparar A depuração sem fios não está acessível; Emparelhar ativa-a Emparelhar + O Quest não tem ecrã de emparelhamento. Num computador, execute uma vez: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS e adb tcpip 5555. Depois toque em Permitir e aceite o pedido no headset + Permitir + Aceite “Permitir depuração?” no headset, com Permitir sempre assinalado + Não foi possível ligar. Aceite o pedido de depuração no headset ou, se não apareceu, execute adb tcpip 5555 num computador e tente novamente + A depuração sem fios não está acessível. Toque em Permitir para a configurar de novo Instalar Iniciar sessão PR #%1$d diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index df77690a5a..4ab1890f2a 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1252,6 +1252,11 @@ Preparar A depuração sem fio não está acessível; Parear a ativa Parear + O Quest não tem tela de pareamento. Em um computador, execute uma vez: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS e adb tcpip 5555. Depois toque em Permitir e aceite o aviso no headset + Permitir + Aceite “Permitir depuração?” no headset, com Sempre permitir marcado + Não foi possível conectar. Aceite o aviso de depuração no headset ou, se ele não apareceu, execute adb tcpip 5555 em um computador e tente novamente + A depuração sem fio não está acessível. Toque em Permitir para configurá-la de novo Instalar Entrar PR #%1$d diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 8d6da38074..fe0a3ab63c 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -1253,6 +1253,11 @@ Pregătește Depanarea fără fir nu este accesibilă; „Asociază” o activează Asociază + Quest nu are ecran de asociere. De pe un computer, rulează o dată: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS și adb tcpip 5555. Apoi atinge Permite și acceptă solicitarea în cască + Permite + Acceptă „Permiți remedierea erorilor?” în cască, cu Permite întotdeauna bifat + Conectarea a eșuat. Acceptă solicitarea de remediere a erorilor în cască sau, dacă nu a apărut, rulează adb tcpip 5555 de pe un computer și încearcă din nou + Remedierea wireless a erorilor nu este accesibilă. Atinge Permite pentru a o configura din nou Instalează Conectați-vă PR #%1$d diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index a37ec1a0aa..11939be52a 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1257,6 +1257,11 @@ Подготовить Беспроводная отладка недоступна; «Сопряжение» включит её Сопряжение + В Quest нет экрана сопряжения. Один раз выполните на компьютере: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS и adb tcpip 5555. Затем нажмите «Разрешить» и подтвердите запрос в шлеме + Разрешить + Подтвердите «Разрешить отладку?» в шлеме, отметив «Всегда разрешать» + Не удалось подключиться. Подтвердите запрос на отладку в шлеме, а если он не появился, выполните adb tcpip 5555 на компьютере и повторите попытку + Беспроводная отладка недоступна. Нажмите «Разрешить», чтобы настроить её заново Установить Войти PR #%1$d diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 506e6226ab..66a76edda1 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -1249,6 +1249,11 @@ Förbered Trådlös felsökning kan inte nås; Para slår på den Para + Quest har ingen parkopplingsskärm. Kör en gång från en dator: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS och adb tcpip 5555. Tryck sedan på Tillåt och godkänn frågan i headsetet + Tillåt + Godkänn ”Tillåt felsökning?” i headsetet med Tillåt alltid markerat + Det gick inte att ansluta. Godkänn felsökningsfrågan i headsetet, eller kör adb tcpip 5555 från en dator och försök igen om ingen visades + Trådlös felsökning går inte att nå. Tryck på Tillåt för att konfigurera den igen Installera Logga in PR #%1$d diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index adca121cf7..7e2004c609 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -1246,6 +1246,11 @@ เตรียม เชื่อมต่อการดีบักแบบไร้สายไม่ได้; จับคู่จะเปิดใช้งาน จับคู่ + Quest ไม่มีหน้าจอจับคู่ จากคอมพิวเตอร์ ให้รันหนึ่งครั้ง: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS และ adb tcpip 5555 จากนั้นแตะอนุญาตและยอมรับข้อความในเฮดเซ็ต + อนุญาต + ยอมรับ “อนุญาตการแก้ไขข้อบกพร่องไหม” ในเฮดเซ็ต โดยเลือกอนุญาตเสมอ + เชื่อมต่อไม่ได้ ยอมรับข้อความแก้ไขข้อบกพร่องในเฮดเซ็ต หรือหากไม่มีข้อความขึ้น ให้รัน adb tcpip 5555 จากคอมพิวเตอร์แล้วลองอีกครั้ง + เข้าถึงการแก้ไขข้อบกพร่องแบบไร้สายไม่ได้ แตะอนุญาตเพื่อตั้งค่าใหม่ ติดตั้ง ลงชื่อเข้าใช้ PR #%1$d diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 3960ffac55..6b7b4ce7b0 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -1241,6 +1241,11 @@ Hazırla Kablosuz hata ayıklamaya ulaşılamıyor; Eşleştir ile açılır Eşleştir + Quest\'te eşleme ekranı yok. Bir bilgisayardan bir kez çalıştırın: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS ve adb tcpip 5555. Ardından İzin ver\'e dokunun ve kulaklıktaki istemi kabul edin + İzin ver + Kulaklıkta “Hata ayıklamaya izin verilsin mi?” istemini Her zaman izin ver işaretliyken kabul edin + Bağlanılamadı. Kulaklıktaki hata ayıklama istemini kabul edin veya istem görünmediyse bir bilgisayardan adb tcpip 5555 çalıştırıp tekrar deneyin + Kablosuz hata ayıklamaya ulaşılamıyor. Yeniden ayarlamak için İzin ver\'e dokunun Yükle Giriş yap PR #%1$d diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 727d6660f4..6a0d3b607d 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -1257,6 +1257,11 @@ Підготувати Бездротове налагодження недоступне; «Сполучити» увімкне його Сполучити + У Quest немає екрана підключення. Один раз виконайте на комп’ютері: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS і adb tcpip 5555. Потім торкніться «Дозволити» й підтвердьте запит у шоломі + Дозволити + Підтвердьте «Дозволити налагодження?» у шоломі, позначивши «Завжди дозволяти» + Не вдалося підключитися. Підтвердьте запит на налагодження в шоломі, а якщо його не було, виконайте adb tcpip 5555 на комп’ютері й спробуйте ще раз + Бездротове налагодження недоступне. Торкніться «Дозволити», щоб налаштувати його знову Установити Увійти PR #%1$d diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 6803dd16a0..9353281a09 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -1246,6 +1246,11 @@ Chuẩn bị Không truy cập được gỡ lỗi không dây; Ghép đôi sẽ bật tính năng này Ghép đôi + Quest không có màn hình ghép nối. Từ máy tính, chạy một lần: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS và adb tcpip 5555. Sau đó nhấn Cho phép và chấp nhận lời nhắc trong kính + Cho phép + Chấp nhận “Cho phép gỡ lỗi?” trong kính, với Luôn cho phép được chọn + Không thể kết nối. Chấp nhận lời nhắc gỡ lỗi trong kính, hoặc nếu không thấy lời nhắc, hãy chạy adb tcpip 5555 từ máy tính rồi thử lại + Không thể kết nối gỡ lỗi không dây. Nhấn Cho phép để thiết lập lại Cài đặt Đăng nhập PR #%1$d diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index e9623375c4..58bbf19378 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1329,6 +1329,11 @@ 准备 无线调试无法连接;配对即可开启 配对 + Quest 没有配对界面。请在电脑上运行一次:adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS 和 adb tcpip 5555。然后点按“允许”,并在头显中接受提示 + 允许 + 在头显中接受“允许调试吗?”,并勾选“始终允许” + 无法连接。请在头显中接受调试提示;如果没有出现提示,请在电脑上运行 adb tcpip 5555 后重试 + 无法连接无线调试。点按“允许”重新设置 安装 登录 PR #%1$d diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index ab70512c13..f0a26a39a9 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -1245,6 +1245,11 @@ 準備 無線偵錯無法連線;按「配對」即可開啟 配對 + Quest 沒有配對畫面。請在電腦上執行一次:adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS 及 adb tcpip 5555。然後輕按「允許」,並在頭戴裝置中接受提示 + 允許 + 在頭戴裝置中接受「要允許偵錯嗎?」,並剔選「一律允許」 + 無法連接。請在頭戴裝置中接受偵錯提示;如果沒有出現提示,請在電腦上執行 adb tcpip 5555 後再試一次 + 無法連接無線偵錯。輕按「允許」重新設定 安裝 登入 PR #%1$d diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index b2e20baea0..621d47e5c6 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1245,6 +1245,11 @@ 準備 無線偵錯無法連線;配對即可開啟 配對 + Quest 沒有配對畫面。請在電腦上執行一次:adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS 和 adb tcpip 5555。接著輕觸「允許」,並在頭戴式裝置中接受提示 + 允許 + 在頭戴式裝置中接受「要允許偵錯嗎?」,並勾選「一律允許」 + 無法連線。請在頭戴式裝置中接受偵錯提示;如果沒有出現提示,請在電腦上執行 adb tcpip 5555 後再試一次 + 無法連上無線偵錯。輕觸「允許」重新設定 安裝 登入 PR #%1$d diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3627ce6603..29d2b8d03b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1392,6 +1392,11 @@ Prepare Wireless debugging isn\'t reachable; Pair turns it on Pair + Quest has no pairing screen. From a computer, run once: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS and adb tcpip 5555. Then tap Allow and accept the prompt in the headset + Allow + Accept “Allow debugging?” in the headset, with Always allow ticked + Couldn\'t connect. Accept the debugging prompt in the headset, or if none appeared, run adb tcpip 5555 from a computer and try again + Wireless debugging isn\'t reachable. Tap Allow to set it up again Install Sign in Free models From fcd197934a32fceef40ce50282f3909252b6df6d Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:15:04 -0400 Subject: [PATCH 120/120] test: fix effects source cache harness initialization (#3490) --- tools/tests/effects_source_cache_harness.c | 3 +++ tools/tests/test_effects_lazy_pipelines.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/tests/effects_source_cache_harness.c b/tools/tests/effects_source_cache_harness.c index 475d4b1331..da9615d1c6 100644 --- a/tools/tests/effects_source_cache_harness.c +++ b/tools/tests/effects_source_cache_harness.c @@ -84,6 +84,9 @@ static void check_generated_settings_and_layout(void) { g_vk.CmdBindPipeline = bind_pipeline; g_vk.CmdBindDescriptorSets = bind_sets; g_vk.CmdPushConstants = push; g_vk.CmdDraw = draw; g_vk.CmdEndRenderPass = end_pass; g_vk.CmdBlitImage = blit; + g_rp = (VkRenderPass)(uintptr_t)5; + g_pipe[P_SGSR] = (VkPipeline)(uintptr_t)6; + g_pipe[P_COLOR] = (VkPipeline)(uintptr_t)7; g_ready = 1; for (int k = 0; k < 2; k++) { struct fx_target *t = &g_contexts[1].targets[k]; diff --git a/tools/tests/test_effects_lazy_pipelines.py b/tools/tests/test_effects_lazy_pipelines.py index 1da6a9c2f6..9f2782989d 100644 --- a/tools/tests/test_effects_lazy_pipelines.py +++ b/tools/tests/test_effects_lazy_pipelines.py @@ -32,7 +32,7 @@ class LazyEffectPipelineSourceTest(unittest.TestCase): self.assertIn("effect pipelines are created when needed", body) def test_pipelines_are_prepared_before_effect_chain_resources_and_draws(self): - body = function_body(self.source, "VkImage vkp_effects_run(") + body = function_body(self.source, "static VkImage effects_run(") prepare = body.index("pipelines_ensure(spatial, s)") scene = body.index("scene_ensure(scene, scene_w, scene_h)") self.assertLess(prepare, scene)