mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-02 11:05:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03d16e5c58 |
No files matched your search
@@ -39,7 +39,7 @@
|
||||
// - 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 (texel centres, edges clamped).
|
||||
// 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
|
||||
@@ -64,8 +64,8 @@ layout(location = 0) in highp vec2 fragTexCoord;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
vec3 CasLoad(ivec2 p) {
|
||||
highp vec2 uv = (vec2(p) + 0.5) / pc.resolution;
|
||||
return textureLod(InputTexture, uv, 0.0).rgb;
|
||||
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)); }
|
||||
|
||||
@@ -1,213 +1,214 @@
|
||||
// 1115.1.0
|
||||
// 1116.2.0
|
||||
#pragma once
|
||||
const uint32_t cas_ffx_half_code[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x000000d7,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000047,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,0x0000001d,0x00007675,0x00030005,0x00000024,0x00004350,
|
||||
0x00040006,0x00000024,0x00000000,0x0063646e,0x00060006,0x00000024,0x00000001,0x6f736572,
|
||||
0x6974756c,0x00006e6f,0x00060006,0x00000024,0x00000002,0x72616873,0x73656e70,0x00000073,
|
||||
0x00030005,0x00000026,0x00006370,0x00060005,0x0000002f,0x75706e49,0x78655474,0x65727574,
|
||||
0x00000000,0x00030005,0x00000045,0x00007073,0x00060005,0x00000047,0x67617266,0x43786554,
|
||||
0x64726f6f,0x00000000,0x00040005,0x0000004d,0x6b616570,0x00000000,0x00030005,0x0000005a,
|
||||
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,0x00000024,0x00000002,0x00050048,0x00000024,0x00000000,
|
||||
0x00000023,0x00000000,0x00050048,0x00000024,0x00000001,0x00000023,0x00000010,0x00040048,
|
||||
0x00000024,0x00000002,0x00000000,0x00050048,0x00000024,0x00000002,0x00000023,0x00000018,
|
||||
0x00030047,0x0000002f,0x00000000,0x00040047,0x0000002f,0x00000021,0x00000000,0x00040047,
|
||||
0x0000002f,0x00000022,0x00000000,0x00030047,0x00000030,0x00000000,0x00030047,0x00000033,
|
||||
0x00000000,0x00030047,0x00000034,0x00000000,0x00030047,0x00000037,0x00000000,0x00030047,
|
||||
0x00000038,0x00000000,0x00030047,0x00000039,0x00000000,0x00030047,0x0000003a,0x00000000,
|
||||
0x00030047,0x0000003b,0x00000000,0x00030047,0x0000003e,0x00000000,0x00030047,0x0000003f,
|
||||
0x00000000,0x00030047,0x00000040,0x00000000,0x00030047,0x00000041,0x00000000,0x00030047,
|
||||
0x00000042,0x00000000,0x00040047,0x00000047,0x0000001e,0x00000000,0x00030047,0x0000004d,
|
||||
0x00000000,0x00030047,0x00000054,0x00000000,0x00030047,0x00000056,0x00000000,0x00030047,
|
||||
0x00000057,0x00000000,0x00030047,0x00000058,0x00000000,0x00030047,0x0000005a,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,0x00040017,0x0000001b,0x00000009,
|
||||
0x00000002,0x00040020,0x0000001c,0x00000007,0x0000001b,0x0004002b,0x00000009,0x00000020,
|
||||
0x3f000000,0x00040017,0x00000023,0x00000009,0x00000004,0x0005001e,0x00000024,0x00000023,
|
||||
0x0000001b,0x00000009,0x00040020,0x00000025,0x00000009,0x00000024,0x0004003b,0x00000025,
|
||||
0x00000026,0x00000009,0x0004002b,0x00000006,0x00000027,0x00000001,0x00040020,0x00000028,
|
||||
0x00000009,0x0000001b,0x00090019,0x0000002c,0x00000009,0x00000001,0x00000000,0x00000000,
|
||||
0x00000000,0x00000001,0x00000000,0x0003001b,0x0000002d,0x0000002c,0x00040020,0x0000002e,
|
||||
0x00000000,0x0000002d,0x0004003b,0x0000002e,0x0000002f,0x00000000,0x0004002b,0x00000009,
|
||||
0x00000032,0x00000000,0x00040020,0x00000046,0x00000001,0x0000001b,0x0004003b,0x00000046,
|
||||
0x00000047,0x00000001,0x0004002b,0x00000009,0x0000004e,0xbf800000,0x0004002b,0x00000009,
|
||||
0x0000004f,0x41000000,0x0004002b,0x00000009,0x00000050,0x40a00000,0x0004002b,0x00000006,
|
||||
0x00000051,0x00000002,0x00040020,0x00000052,0x00000009,0x00000009,0x0004002b,0x00000009,
|
||||
0x00000055,0x3f800000,0x00040020,0x00000059,0x00000007,0x0000000a,0x0004002b,0x00000006,
|
||||
0x0000005c,0x00000000,0x0004002b,0x00000006,0x0000005d,0xffffffff,0x0005002c,0x00000007,
|
||||
0x0000005e,0x0000005c,0x0000005d,0x0005002c,0x00000007,0x00000064,0x0000005d,0x0000005c,
|
||||
0x0005002c,0x00000007,0x0000006e,0x00000027,0x0000005c,0x0005002c,0x00000007,0x00000074,
|
||||
0x0000005c,0x00000027,0x00040015,0x0000007a,0x00000020,0x00000000,0x0004002b,0x0000007a,
|
||||
0x0000007b,0x00000001,0x0004002b,0x00000009,0x000000a2,0x3a800000,0x0004002b,0x00000009,
|
||||
0x000000b4,0x40800000,0x00040020,0x000000d0,0x00000003,0x00000023,0x0004003b,0x000000d0,
|
||||
0x000000d1,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
|
||||
0x00000005,0x0004003b,0x00000008,0x00000045,0x00000007,0x0004003b,0x0000000f,0x0000004d,
|
||||
0x00000007,0x0004003b,0x00000059,0x0000005a,0x00000007,0x0004003b,0x00000008,0x00000060,
|
||||
0x00000007,0x0004003b,0x00000059,0x00000062,0x00000007,0x0004003b,0x00000008,0x00000066,
|
||||
0x00000007,0x0004003b,0x00000059,0x00000068,0x00000007,0x0004003b,0x00000008,0x00000069,
|
||||
0x00000007,0x0004003b,0x00000059,0x0000006c,0x00000007,0x0004003b,0x00000008,0x00000070,
|
||||
0x00000007,0x0004003b,0x00000059,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,0x00000059,0x000000b9,0x00000007,0x0004003d,0x0000001b,0x00000048,
|
||||
0x00000047,0x00050041,0x00000028,0x00000049,0x00000026,0x00000027,0x0004003d,0x0000001b,
|
||||
0x0000004a,0x00000049,0x00050085,0x0000001b,0x0000004b,0x00000048,0x0000004a,0x0004006e,
|
||||
0x00000007,0x0000004c,0x0000004b,0x0003003e,0x00000045,0x0000004c,0x00050041,0x00000052,
|
||||
0x00000053,0x00000026,0x00000051,0x0004003d,0x00000009,0x00000054,0x00000053,0x0008000c,
|
||||
0x00000009,0x00000056,0x00000001,0x0000002b,0x00000054,0x00000032,0x00000055,0x0008000c,
|
||||
0x00000009,0x00000057,0x00000001,0x0000002e,0x0000004f,0x00000050,0x00000056,0x00050088,
|
||||
0x00000009,0x00000058,0x0000004e,0x00000057,0x0003003e,0x0000004d,0x00000058,0x0004003d,
|
||||
0x00000007,0x0000005b,0x00000045,0x00050080,0x00000007,0x0000005f,0x0000005b,0x0000005e,
|
||||
0x0003003e,0x00000060,0x0000005f,0x00050039,0x0000000a,0x00000061,0x0000000d,0x00000060,
|
||||
0x0003003e,0x0000005a,0x00000061,0x0004003d,0x00000007,0x00000063,0x00000045,0x00050080,
|
||||
0x00000007,0x00000065,0x00000063,0x00000064,0x0003003e,0x00000066,0x00000065,0x00050039,
|
||||
0x0000000a,0x00000067,0x0000000d,0x00000066,0x0003003e,0x00000062,0x00000067,0x0004003d,
|
||||
0x00000007,0x0000006a,0x00000045,0x0003003e,0x00000069,0x0000006a,0x00050039,0x0000000a,
|
||||
0x0000006b,0x0000000d,0x00000069,0x0003003e,0x00000068,0x0000006b,0x0004003d,0x00000007,
|
||||
0x0000006d,0x00000045,0x00050080,0x00000007,0x0000006f,0x0000006d,0x0000006e,0x0003003e,
|
||||
0x00000070,0x0000006f,0x00050039,0x0000000a,0x00000071,0x0000000d,0x00000070,0x0003003e,
|
||||
0x0000006c,0x00000071,0x0004003d,0x00000007,0x00000073,0x00000045,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,0x0000005a,
|
||||
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,0x0000005a,
|
||||
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,0x00000055,0x000000a3,0x0003003e,0x000000a0,
|
||||
0x000000a4,0x0004003d,0x00000009,0x000000a6,0x00000078,0x0004003d,0x00000009,0x000000a7,
|
||||
0x0000008d,0x00050083,0x00000009,0x000000a8,0x00000055,0x000000a7,0x0007000c,0x00000009,
|
||||
0x000000a9,0x00000001,0x00000025,0x000000a6,0x000000a8,0x0004003d,0x00000009,0x000000aa,
|
||||
0x000000a0,0x00050085,0x00000009,0x000000ab,0x000000a9,0x000000aa,0x0008000c,0x00000009,
|
||||
0x000000ac,0x00000001,0x0000002b,0x000000ab,0x00000032,0x00000055,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,0x00000055,0x000000b6,0x00050088,0x00000009,0x000000b8,0x00000055,
|
||||
0x000000b7,0x0003003e,0x000000b3,0x000000b8,0x0004003d,0x0000000a,0x000000ba,0x0000005a,
|
||||
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,0x00000032,0x00000032,0x00000032,0x00060050,
|
||||
0x0000000a,0x000000ce,0x00000055,0x00000055,0x00000055,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,0x00000023,0x000000d6,0x000000d3,0x000000d4,
|
||||
0x000000d5,0x00000055,0x0003003e,0x000000d1,0x000000d6,0x000100fd,0x00010038,0x00050036,
|
||||
0x0000000a,0x0000000d,0x00000000,0x0000000b,0x00030037,0x00000008,0x0000000c,0x000200f8,
|
||||
0x0000000e,0x0004003b,0x0000001c,0x0000001d,0x00000007,0x0004003d,0x00000007,0x0000001e,
|
||||
0x0000000c,0x0004006f,0x0000001b,0x0000001f,0x0000001e,0x00050050,0x0000001b,0x00000021,
|
||||
0x00000020,0x00000020,0x00050081,0x0000001b,0x00000022,0x0000001f,0x00000021,0x00050041,
|
||||
0x00000028,0x00000029,0x00000026,0x00000027,0x0004003d,0x0000001b,0x0000002a,0x00000029,
|
||||
0x00050088,0x0000001b,0x0000002b,0x00000022,0x0000002a,0x0003003e,0x0000001d,0x0000002b,
|
||||
0x0004003d,0x0000002d,0x00000030,0x0000002f,0x0004003d,0x0000001b,0x00000031,0x0000001d,
|
||||
0x00070058,0x00000023,0x00000033,0x00000030,0x00000031,0x00000002,0x00000032,0x0008004f,
|
||||
0x0000000a,0x00000034,0x00000033,0x00000033,0x00000000,0x00000001,0x00000002,0x000200fe,
|
||||
0x00000034,0x00010038,0x00050036,0x00000009,0x00000014,0x00000000,0x00000010,0x00030037,
|
||||
0x0000000f,0x00000011,0x00030037,0x0000000f,0x00000012,0x00030037,0x0000000f,0x00000013,
|
||||
0x000200f8,0x00000015,0x0004003d,0x00000009,0x00000037,0x00000011,0x0004003d,0x00000009,
|
||||
0x00000038,0x00000012,0x0004003d,0x00000009,0x00000039,0x00000013,0x0007000c,0x00000009,
|
||||
0x0000003a,0x00000001,0x00000025,0x00000038,0x00000039,0x0007000c,0x00000009,0x0000003b,
|
||||
0x00000001,0x00000025,0x00000037,0x0000003a,0x000200fe,0x0000003b,0x00010038,0x00050036,
|
||||
0x00000009,0x00000019,0x00000000,0x00000010,0x00030037,0x0000000f,0x00000016,0x00030037,
|
||||
0x0000000f,0x00000017,0x00030037,0x0000000f,0x00000018,0x000200f8,0x0000001a,0x0004003d,
|
||||
0x00000009,0x0000003e,0x00000016,0x0004003d,0x00000009,0x0000003f,0x00000017,0x0004003d,
|
||||
0x00000009,0x00000040,0x00000018,0x0007000c,0x00000009,0x00000041,0x00000001,0x00000028,
|
||||
0x0000003f,0x00000040,0x0007000c,0x00000009,0x00000042,0x00000001,0x00000028,0x0000003e,
|
||||
0x00000041,0x000200fe,0x00000042,0x00010038
|
||||
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
|
||||
};
|
||||
@@ -283,7 +283,8 @@ public final class PadBridge {
|
||||
int sources = device.getSources();
|
||||
if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) return true;
|
||||
if ((sources & InputDevice.SOURCE_JOYSTICK) != InputDevice.SOURCE_JOYSTICK) return false;
|
||||
if (device.getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC) return true;
|
||||
if (device.getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC
|
||||
&& !device.supportsSource(InputDevice.SOURCE_MOUSE)) return true;
|
||||
for (int axis : JOYSTICK_AXES) {
|
||||
InputDevice.MotionRange range = device.getMotionRange(axis, InputDevice.SOURCE_JOYSTICK);
|
||||
if (range != null && range.getMax() > range.getMin()) return true;
|
||||
|
||||
@@ -2640,7 +2640,8 @@ class SessionService : Service() {
|
||||
for (id in android.view.InputDevice.getDeviceIds()) {
|
||||
val d = android.view.InputDevice.getDevice(id) ?: continue
|
||||
if (!com.droiddeck.launcher.input.PadBridge.isFromController(d)) continue
|
||||
pads.add(String.format(java.util.Locale.ROOT, "\"%s\" (%04x:%04x)", d.name, d.vendorId, d.productId))
|
||||
pads.add(String.format(java.util.Locale.ROOT, "\"%s\" (%04x:%04x, sources 0x%x, keyboard type %d)",
|
||||
d.name, d.vendorId, d.productId, d.sources, d.keyboardType))
|
||||
}
|
||||
Log.i(TAG, "controllers at start: " + (if (pads.isEmpty()) "none" else pads.joinToString(", ")) +
|
||||
"; presented to the guest as " + if (SessionState.deckPad) "switchable, starting as " + SessionPrefs.steamController(this)
|
||||
|
||||
@@ -47,7 +47,31 @@ class PadBridgeRoutingTest {
|
||||
|
||||
@Test fun aJoystickWithoutKeyboardCapabilitiesRemainsAController() {
|
||||
assertTrue(PadBridge.isFromController(device(InputDevice.SOURCE_JOYSTICK, InputDevice.KEYBOARD_TYPE_NONE)))
|
||||
assertTrue(PadBridge.isFromController(device(COMPOSITE, InputDevice.KEYBOARD_TYPE_NON_ALPHABETIC)))
|
||||
assertTrue(PadBridge.isFromController(device(InputDevice.SOURCE_JOYSTICK or InputDevice.SOURCE_KEYBOARD or InputDevice.SOURCE_DPAD,
|
||||
InputDevice.KEYBOARD_TYPE_NON_ALPHABETIC)))
|
||||
}
|
||||
|
||||
@Test fun aMouseReceiverWithIncidentalJoystickBitsIsNotAController() {
|
||||
for (type in listOf(InputDevice.KEYBOARD_TYPE_NON_ALPHABETIC, InputDevice.KEYBOARD_TYPE_NONE)) {
|
||||
val receiver = device(COMPOSITE, type, keys = intArrayOf(KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_VOLUME_UP),
|
||||
name = "CX Wireless mouse -1k dongle Mouse")
|
||||
assertFalse(PadBridge.isFromController(receiver))
|
||||
assertTrue(MouseBackInput.isExternalMouse(receiver))
|
||||
for (action in listOf(KeyEvent.ACTION_DOWN, KeyEvent.ACTION_UP)) {
|
||||
assertFalse(PadBridge.isControllerKeyEvent(key(receiver, KeyEvent.KEYCODE_BACK, action)))
|
||||
}
|
||||
}
|
||||
assertFalse(PadBridge.anyControllerConnected())
|
||||
}
|
||||
|
||||
@Test fun aControllerWithAPointerInterfaceRemainsAController() {
|
||||
val type = InputDevice.KEYBOARD_TYPE_NON_ALPHABETIC
|
||||
for (axis in listOf(MotionEvent.AXIS_X, MotionEvent.AXIS_RZ, MotionEvent.AXIS_HAT_X, MotionEvent.AXIS_LTRIGGER)) {
|
||||
assertTrue(PadBridge.isFromController(device(COMPOSITE, type, rangeSource = InputDevice.SOURCE_JOYSTICK, axis = axis)))
|
||||
}
|
||||
assertTrue(PadBridge.isFromController(device(COMPOSITE, type, keys = intArrayOf(KeyEvent.KEYCODE_BUTTON_A))))
|
||||
assertTrue(PadBridge.isFromController(device(COMPOSITE or InputDevice.SOURCE_GAMEPAD, type)))
|
||||
assertTrue(PadBridge.isFromController(device(InputDevice.SOURCE_GAMEPAD or InputDevice.SOURCE_MOUSE, InputDevice.KEYBOARD_TYPE_NONE)))
|
||||
}
|
||||
|
||||
@Test fun joystickRangesDistinguishAHybridFromIncidentalSourceBits() {
|
||||
|
||||
@@ -258,10 +258,8 @@ and `--rate` (120 samples a second); `--pressure` and tilt take `FROM:TO` ranges
|
||||
`--tilt-x=-30:30` when they start negative. A gesture lasts at most 30 s. `UINPUT_UNAVAILABLE`
|
||||
means the shell has no `uinput` or cannot write `/dev/uinput`, `NO_VIEWPORT` that there is no
|
||||
internal display or it is off, and `UINPUT_FAILED` that `uinput` stopped early; all three exit 3.
|
||||
The `uinput` of Android 12 to 14 QPR1 takes only numeric codes, the USB or Bluetooth bus and no
|
||||
`sync` command. Below SDK 34 the pen and the gamepad send that form, with the pen on the USB bus,
|
||||
and success is a clean exit. On SDK 34, which spans both sides of QPR2, the named form goes first
|
||||
and is resent in that form when `uinput` rejects it before registering the device.
|
||||
It needs Android 14 QPR2 or later: the `uinput` of Android 12 to 14 QPR1 takes only numeric codes
|
||||
and the USB or Bluetooth bus, so there the pen ends with `UINPUT_FAILED`.
|
||||
|
||||
## State (schema 2)
|
||||
|
||||
|
||||
+17
-83
@@ -750,16 +750,13 @@ def uinput_commands(samples: list[dict], tool: str, viewport: dict) -> list[dict
|
||||
return {"code": code, "info": {"value": 0, "minimum": low, "maximum": high, "fuzz": 0, "flat": 0, "resolution": 0}}
|
||||
|
||||
commands = [
|
||||
# The bus comes after the codes: a `uinput` without the virtual bus fails on it with no "Error reading in
|
||||
# object", while symbolic codes read first produce that message and send the script round again as numbers.
|
||||
{"id": 1, "command": "register", "name": "DroidDeck agent pen", "configuration": [
|
||||
{"id": 1, "command": "register", "name": "DroidDeck agent pen", "bus": "virtual", "configuration": [
|
||||
{"type": "UI_SET_EVBIT", "data": ["EV_KEY", "EV_ABS"]},
|
||||
{"type": "UI_SET_KEYBIT", "data": ["BTN_TOOL_PEN", "BTN_TOOL_RUBBER", "BTN_TOUCH", "BTN_STYLUS", "BTN_STYLUS2"]},
|
||||
{"type": "UI_SET_ABSBIT", "data": ["ABS_X", "ABS_Y", "ABS_PRESSURE", "ABS_DISTANCE", "ABS_TILT_X", "ABS_TILT_Y"]},
|
||||
{"type": "UI_SET_PROPBIT", "data": ["INPUT_PROP_DIRECT"]},
|
||||
], "abs_info": [axis("ABS_X", 0, width - 1), axis("ABS_Y", 0, height - 1), axis("ABS_PRESSURE", 0, UINPUT_PRESSURE),
|
||||
axis("ABS_DISTANCE", 0, UINPUT_DISTANCE), axis("ABS_TILT_X", -90, 90), axis("ABS_TILT_Y", -90, 90)],
|
||||
"bus": "virtual"},
|
||||
axis("ABS_DISTANCE", 0, UINPUT_DISTANCE), axis("ABS_TILT_X", -90, 90), axis("ABS_TILT_Y", -90, 90)]},
|
||||
{"id": 1, "command": "delay", "duration": UINPUT_REGISTER_MS},
|
||||
]
|
||||
sent = {tool_key: 0, "BTN_TOUCH": 0, "BTN_STYLUS": 0, "BTN_STYLUS2": 0}
|
||||
@@ -795,91 +792,27 @@ def uinput_commands(samples: list[dict], tool: str, viewport: dict) -> list[dict
|
||||
{"id": 1, "command": "sync", "syncToken": UINPUT_SYNC}]
|
||||
|
||||
|
||||
def uinput_check(adb: str, serial: str) -> int:
|
||||
"""Checks the device can inject through `uinput` and returns its SDK level."""
|
||||
def uinput_check(adb: str, serial: str) -> None:
|
||||
probe = run_adb(adb, serial, "shell",
|
||||
"command -v uinput >/dev/null 2>&1 || echo no-uinput; [ -w /dev/uinput ] || echo no-dev-uinput; "
|
||||
"echo sdk=$(getprop ro.build.version.sdk)")
|
||||
"command -v uinput >/dev/null 2>&1 || echo no-uinput; [ -w /dev/uinput ] || echo no-dev-uinput")
|
||||
if probe.returncode != 0:
|
||||
raise ControlError((probe.stdout + probe.stderr).decode(errors="replace").strip() or "adb shell failed", "ADB_FAILED")
|
||||
words = probe.stdout.decode(errors="replace").split()
|
||||
if "no-uinput" in words:
|
||||
missing = probe.stdout.decode(errors="replace").split()
|
||||
if "no-uinput" in missing:
|
||||
raise ControlError("This device's shell has no `uinput` command", "UINPUT_UNAVAILABLE")
|
||||
if "no-dev-uinput" in words:
|
||||
if "no-dev-uinput" in missing:
|
||||
raise ControlError("The ADB shell cannot write /dev/uinput on this device", "UINPUT_UNAVAILABLE")
|
||||
sdk = next((w[4:] for w in words if w.startswith("sdk=")), "")
|
||||
return int(sdk) if sdk.isdigit() else UINPUT_NAMED_SDK
|
||||
|
||||
|
||||
# Android 14 QPR2 taught `uinput` symbolic event names, the `sync` command and the virtual bus. Earlier versions stop at
|
||||
# the register line with "Error reading in object" before any device exists, so their scripts carry Linux's numeric
|
||||
# codes, register on the USB bus and end without `sync`. SDK 34 covers both sides of QPR2, so it is tried named first.
|
||||
UINPUT_NAMED_SDK = 34
|
||||
UINPUT_REJECTED = "Error reading in object"
|
||||
UINPUT_CODES = {
|
||||
"EV_SYN": 0, "EV_KEY": 1, "EV_ABS": 3, "SYN_REPORT": 0, "INPUT_PROP_DIRECT": 1,
|
||||
"BTN_SOUTH": 304, "BTN_EAST": 305, "BTN_NORTH": 307, "BTN_WEST": 308, "BTN_TL": 310, "BTN_TR": 311,
|
||||
"BTN_SELECT": 314, "BTN_START": 315, "BTN_MODE": 316, "BTN_THUMBL": 317, "BTN_THUMBR": 318,
|
||||
"BTN_TOOL_PEN": 320, "BTN_TOOL_RUBBER": 321, "BTN_TOUCH": 330, "BTN_STYLUS": 331, "BTN_STYLUS2": 332,
|
||||
"ABS_X": 0, "ABS_Y": 1, "ABS_RX": 3, "ABS_RY": 4, "ABS_HAT0X": 16, "ABS_HAT0Y": 17,
|
||||
"ABS_PRESSURE": 24, "ABS_DISTANCE": 25, "ABS_TILT_X": 26, "ABS_TILT_Y": 27,
|
||||
}
|
||||
UINPUT_CONFIG_CODES = {"UI_SET_EVBIT": 100, "UI_SET_KEYBIT": 101, "UI_SET_ABSBIT": 103, "UI_SET_PROPBIT": 110}
|
||||
|
||||
|
||||
def uinput_script(commands: list[dict], legacy: bool) -> str:
|
||||
"""The `uinput -` input: as written, or for [legacy] `uinput` numeric, on the USB bus and without `sync`."""
|
||||
if legacy:
|
||||
def code(value):
|
||||
return UINPUT_CODES[value] if isinstance(value, str) else value
|
||||
|
||||
numeric = []
|
||||
for command in commands:
|
||||
if command["command"] == "sync":
|
||||
continue
|
||||
command = dict(command)
|
||||
if command["command"] == "register":
|
||||
if command.get("bus") == "virtual":
|
||||
command["bus"] = "usb"
|
||||
command["configuration"] = [{"type": UINPUT_CONFIG_CODES[c["type"]], "data": [code(d) for d in c["data"]]}
|
||||
for c in command["configuration"]]
|
||||
command["abs_info"] = [dict(a, code=code(a["code"])) for a in command.get("abs_info", [])]
|
||||
elif command["command"] == "inject":
|
||||
command["events"] = [code(e) for e in command["events"]]
|
||||
numeric.append(command)
|
||||
commands = numeric
|
||||
return "".join(json.dumps(command) + "\n" for command in commands)
|
||||
|
||||
|
||||
def uinput_finished(result: subprocess.CompletedProcess, token: str, legacy: bool) -> bool:
|
||||
"""Whether `uinput` ran the whole script: by its sync token, or for [legacy] `uinput` by a clean exit."""
|
||||
out = result.stdout.decode(errors="replace")
|
||||
if not legacy:
|
||||
return token in out
|
||||
text = out + (result.stderr or b"").decode(errors="replace")
|
||||
return result.returncode == 0 and "Error" not in text and "Exception" not in text
|
||||
|
||||
|
||||
def uinput_run(adb: str, serial: str, sdk: int, commands: list[dict], token: str,
|
||||
timeout: float) -> tuple[subprocess.CompletedProcess, bool]:
|
||||
"""Runs [commands] through `uinput -` in the form the device reads; returns the result and whether it finished."""
|
||||
legacy = sdk < UINPUT_NAMED_SDK
|
||||
result = run_adb(adb, serial, "shell", "uinput", "-", stdin=uinput_script(commands, legacy).encode(), timeout=timeout)
|
||||
out = result.stdout.decode(errors="replace")
|
||||
if not legacy and UINPUT_REJECTED in out and token not in out:
|
||||
legacy = True
|
||||
result = run_adb(adb, serial, "shell", "uinput", "-", stdin=uinput_script(commands, legacy).encode(), timeout=timeout)
|
||||
return result, uinput_finished(result, token, legacy)
|
||||
|
||||
|
||||
def pen_uinput(adb: str, serial: str, samples: list[dict], tool: str) -> dict:
|
||||
sdk = uinput_check(adb, serial)
|
||||
uinput_check(adb, serial)
|
||||
viewport = input_viewport(run_adb(adb, serial, "shell", "dumpsys", "input").stdout.decode(errors="replace"))
|
||||
script = "".join(json.dumps(command) + "\n" for command in uinput_commands(samples, tool, viewport))
|
||||
started = time.monotonic()
|
||||
result, finished = uinput_run(adb, serial, sdk, uinput_commands(samples, tool, viewport), UINPUT_SYNC,
|
||||
(UINPUT_REGISTER_MS + samples[-1]["t"] + UINPUT_TAIL_MS) / 1000 + 30)
|
||||
result = run_adb(adb, serial, "shell", "uinput", "-", stdin=script.encode(),
|
||||
timeout=(UINPUT_REGISTER_MS + samples[-1]["t"] + UINPUT_TAIL_MS) / 1000 + 30)
|
||||
elapsed = round((time.monotonic() - started) * 1000)
|
||||
if not finished:
|
||||
if UINPUT_SYNC not in result.stdout.decode(errors="replace"):
|
||||
detail = (result.stderr or result.stdout).decode(errors="replace").strip()[-400:]
|
||||
raise ControlError(f"uinput stopped before the end of the gesture (exit {result.returncode})"
|
||||
+ (f": {detail}" if detail else "") + "; `adb logcat -s UINPUT UinputDevice` tells why",
|
||||
@@ -936,12 +869,13 @@ def gamepad_commands(buttons: list[str], hold: int, gap: int) -> list[dict]:
|
||||
|
||||
def gamepad_uinput(adb: str, serial: str, buttons: list[str], hold: int, gap: int) -> dict:
|
||||
commands = gamepad_commands(buttons, hold, gap)
|
||||
sdk = uinput_check(adb, serial)
|
||||
uinput_check(adb, serial)
|
||||
script = "".join(json.dumps(command) + "\n" for command in commands)
|
||||
started = time.monotonic()
|
||||
result, finished = uinput_run(adb, serial, sdk, commands, GAMEPAD_SYNC,
|
||||
(UINPUT_REGISTER_MS + len(buttons) * (hold + gap) + UINPUT_TAIL_MS) / 1000 + 30)
|
||||
result = run_adb(adb, serial, "shell", "uinput", "-", stdin=script.encode(),
|
||||
timeout=(UINPUT_REGISTER_MS + len(buttons) * (hold + gap) + UINPUT_TAIL_MS) / 1000 + 30)
|
||||
elapsed = round((time.monotonic() - started) * 1000)
|
||||
if not finished:
|
||||
if GAMEPAD_SYNC not in result.stdout.decode(errors="replace"):
|
||||
detail = (result.stderr or result.stdout).decode(errors="replace").strip()[-400:]
|
||||
raise ControlError(f"uinput stopped before the last button (exit {result.returncode})"
|
||||
+ (f": {detail}" if detail else "") + "; `adb logcat -s UINPUT UinputDevice` tells why",
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "named_semaphores.h"
|
||||
#endif
|
||||
@@ -1,127 +0,0 @@
|
||||
static int posix_shm_path(const char *name, const char *prefix, char *path, size_t size) {
|
||||
if (!name) { errno = EINVAL; return -1; }
|
||||
while (*name == '/') name++;
|
||||
size_t len = strlen(name) + strlen(prefix);
|
||||
if (len == strlen(prefix) || len > NAME_MAX || strchr(name, '/') || strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
||||
errno = len > NAME_MAX ? ENAMETOOLONG : EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (snprintf(path, size, "/dev/shm/%s%s", prefix, name) >= (int)size) { errno = ENAMETOOLONG; return -1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct posix_sem {
|
||||
dev_t dev;
|
||||
ino_t ino;
|
||||
sem_t *addr;
|
||||
unsigned int refs;
|
||||
struct posix_sem *next;
|
||||
};
|
||||
static struct posix_sem *g_posix_sems;
|
||||
static pthread_mutex_t g_posix_sems_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static void posix_sems_unlock(void) { pthread_mutex_unlock(&g_posix_sems_lock); }
|
||||
|
||||
static void posix_sems_hold(void) { pthread_mutex_lock(&g_posix_sems_lock); }
|
||||
|
||||
__attribute__((constructor)) static void posix_sems_across_fork(void) {
|
||||
pthread_atfork(posix_sems_hold, posix_sems_unlock, posix_sems_unlock);
|
||||
}
|
||||
|
||||
static void close_keeping_errno(int fd) {
|
||||
int saved = errno;
|
||||
close(fd);
|
||||
errno = saved;
|
||||
}
|
||||
|
||||
static sem_t *posix_sem_map(int fd) {
|
||||
struct stat st;
|
||||
if (fstat(fd, &st) < 0) return SEM_FAILED;
|
||||
sem_t *sem = SEM_FAILED;
|
||||
posix_sems_hold();
|
||||
struct posix_sem *e = g_posix_sems;
|
||||
while (e && (e->dev != st.st_dev || e->ino != st.st_ino)) e = e->next;
|
||||
if (e) {
|
||||
e->refs++;
|
||||
sem = e->addr;
|
||||
} else {
|
||||
void *addr = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
e = addr == MAP_FAILED ? NULL : malloc(sizeof(*e));
|
||||
if (e) {
|
||||
*e = (struct posix_sem){st.st_dev, st.st_ino, addr, 1, g_posix_sems};
|
||||
g_posix_sems = e;
|
||||
sem = addr;
|
||||
} else if (addr != MAP_FAILED) {
|
||||
munmap(addr, sizeof(sem_t));
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
posix_sems_unlock();
|
||||
return sem;
|
||||
}
|
||||
|
||||
static sem_t *posix_sem_open_fd(int fd) {
|
||||
if (fd < 0) return SEM_FAILED;
|
||||
sem_t *sem = posix_sem_map(fd);
|
||||
close_keeping_errno(fd);
|
||||
return sem;
|
||||
}
|
||||
|
||||
sem_t *sem_open(const char *name, int oflag, ...) {
|
||||
char path[PATH_MAX];
|
||||
if (posix_shm_path(name, "sem.", path, sizeof(path)) < 0) return SEM_FAILED;
|
||||
if (!(oflag & O_CREAT)) return posix_sem_open_fd(open(path, O_RDWR | O_NOFOLLOW | O_CLOEXEC));
|
||||
va_list args;
|
||||
va_start(args, oflag);
|
||||
mode_t mode = va_arg(args, mode_t);
|
||||
unsigned int value = va_arg(args, unsigned int);
|
||||
va_end(args);
|
||||
static unsigned int serial;
|
||||
for (;;) {
|
||||
if (!(oflag & O_EXCL)) {
|
||||
int fd = open(path, O_RDWR | O_NOFOLLOW | O_CLOEXEC);
|
||||
if (fd >= 0 || errno != ENOENT) return posix_sem_open_fd(fd);
|
||||
}
|
||||
if (value > SEM_VALUE_MAX) { errno = EINVAL; return SEM_FAILED; }
|
||||
sem_t initial;
|
||||
memset(&initial, 0, sizeof(initial));
|
||||
sem_init(&initial, 1, value);
|
||||
char temp[PATH_MAX];
|
||||
int fd;
|
||||
do {
|
||||
snprintf(temp, sizeof(temp), "/dev/shm/.sem-%d-%u", (int)getpid(), __atomic_fetch_add(&serial, 1, __ATOMIC_RELAXED));
|
||||
fd = open(temp, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, mode);
|
||||
} while (fd < 0 && errno == EEXIST);
|
||||
if (fd < 0) return SEM_FAILED;
|
||||
errno = EIO;
|
||||
sem_t *sem = write(fd, &initial, sizeof(initial)) == (ssize_t)sizeof(initial) ? posix_sem_map(fd) : SEM_FAILED;
|
||||
close_keeping_errno(fd);
|
||||
if (sem != SEM_FAILED && renameat2(AT_FDCWD, temp, AT_FDCWD, path, RENAME_NOREPLACE) == 0) return sem;
|
||||
int saved = errno;
|
||||
if (sem != SEM_FAILED) sem_close(sem);
|
||||
unlink(temp);
|
||||
errno = saved;
|
||||
if (errno != EEXIST || (oflag & O_EXCL)) return SEM_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
int sem_close(sem_t *sem) {
|
||||
posix_sems_hold();
|
||||
struct posix_sem **link = &g_posix_sems;
|
||||
while (*link && (*link)->addr != sem) link = &(*link)->next;
|
||||
struct posix_sem *e = *link;
|
||||
if (e && --e->refs == 0) {
|
||||
*link = e->next;
|
||||
munmap(e->addr, sizeof(sem_t));
|
||||
free(e);
|
||||
}
|
||||
posix_sems_unlock();
|
||||
if (!e) { errno = EINVAL; return -1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sem_unlink(const char *name) {
|
||||
char path[PATH_MAX];
|
||||
if (posix_shm_path(name, "sem.", path, sizeof(path)) < 0) return -1;
|
||||
return unlink(path);
|
||||
}
|
||||
@@ -6,7 +6,17 @@
|
||||
|
||||
#ifndef DDNATV_HOST_TEST
|
||||
|
||||
#include "../../linuxfs/preload/named_semaphores.h"
|
||||
static int posix_shm_path(const char *name, const char *prefix, char *path, size_t size) {
|
||||
if (!name) { errno = EINVAL; return -1; }
|
||||
while (*name == '/') name++;
|
||||
size_t len = strlen(name) + strlen(prefix);
|
||||
if (len == strlen(prefix) || len > NAME_MAX || strchr(name, '/') || strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
||||
errno = len > NAME_MAX ? ENAMETOOLONG : EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (snprintf(path, size, "/dev/shm/%s%s", prefix, name) >= (int)size) { errno = ENAMETOOLONG; return -1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
int shm_open(const char *name, int oflag, mode_t mode) {
|
||||
char path[PATH_MAX];
|
||||
@@ -20,6 +30,121 @@ int shm_unlink(const char *name) {
|
||||
return unlink(path);
|
||||
}
|
||||
|
||||
struct posix_sem {
|
||||
dev_t dev;
|
||||
ino_t ino;
|
||||
sem_t *addr;
|
||||
unsigned int refs;
|
||||
struct posix_sem *next;
|
||||
};
|
||||
static struct posix_sem *g_posix_sems;
|
||||
static pthread_mutex_t g_posix_sems_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static void posix_sems_unlock(void) { pthread_mutex_unlock(&g_posix_sems_lock); }
|
||||
|
||||
static void posix_sems_hold(void) { pthread_mutex_lock(&g_posix_sems_lock); }
|
||||
|
||||
__attribute__((constructor)) static void posix_sems_across_fork(void) {
|
||||
pthread_atfork(posix_sems_hold, posix_sems_unlock, posix_sems_unlock);
|
||||
}
|
||||
|
||||
static void close_keeping_errno(int fd) {
|
||||
int saved = errno;
|
||||
close(fd);
|
||||
errno = saved;
|
||||
}
|
||||
|
||||
static sem_t *posix_sem_map(int fd) {
|
||||
struct stat st;
|
||||
if (fstat(fd, &st) < 0) return SEM_FAILED;
|
||||
sem_t *sem = SEM_FAILED;
|
||||
posix_sems_hold();
|
||||
struct posix_sem *e = g_posix_sems;
|
||||
while (e && (e->dev != st.st_dev || e->ino != st.st_ino)) e = e->next;
|
||||
if (e) {
|
||||
e->refs++;
|
||||
sem = e->addr;
|
||||
} else {
|
||||
void *addr = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
e = addr == MAP_FAILED ? NULL : malloc(sizeof(*e));
|
||||
if (e) {
|
||||
*e = (struct posix_sem){st.st_dev, st.st_ino, addr, 1, g_posix_sems};
|
||||
g_posix_sems = e;
|
||||
sem = addr;
|
||||
} else if (addr != MAP_FAILED) {
|
||||
munmap(addr, sizeof(sem_t));
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
posix_sems_unlock();
|
||||
return sem;
|
||||
}
|
||||
|
||||
static sem_t *posix_sem_open_fd(int fd) {
|
||||
if (fd < 0) return SEM_FAILED;
|
||||
sem_t *sem = posix_sem_map(fd);
|
||||
close_keeping_errno(fd);
|
||||
return sem;
|
||||
}
|
||||
|
||||
sem_t *sem_open(const char *name, int oflag, ...) {
|
||||
char path[PATH_MAX];
|
||||
if (posix_shm_path(name, "sem.", path, sizeof(path)) < 0) return SEM_FAILED;
|
||||
if (!(oflag & O_CREAT)) return posix_sem_open_fd(open(path, O_RDWR | O_NOFOLLOW | O_CLOEXEC));
|
||||
va_list args;
|
||||
va_start(args, oflag);
|
||||
mode_t mode = va_arg(args, mode_t);
|
||||
unsigned int value = va_arg(args, unsigned int);
|
||||
va_end(args);
|
||||
static unsigned int serial;
|
||||
for (;;) {
|
||||
if (!(oflag & O_EXCL)) {
|
||||
int fd = open(path, O_RDWR | O_NOFOLLOW | O_CLOEXEC);
|
||||
if (fd >= 0 || errno != ENOENT) return posix_sem_open_fd(fd);
|
||||
}
|
||||
if (value > SEM_VALUE_MAX) { errno = EINVAL; return SEM_FAILED; }
|
||||
sem_t initial;
|
||||
memset(&initial, 0, sizeof(initial));
|
||||
sem_init(&initial, 1, value);
|
||||
char temp[PATH_MAX];
|
||||
int fd;
|
||||
do {
|
||||
snprintf(temp, sizeof(temp), "/dev/shm/.sem-%d-%u", (int)getpid(), __atomic_fetch_add(&serial, 1, __ATOMIC_RELAXED));
|
||||
fd = open(temp, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, mode);
|
||||
} while (fd < 0 && errno == EEXIST);
|
||||
if (fd < 0) return SEM_FAILED;
|
||||
errno = EIO;
|
||||
sem_t *sem = write(fd, &initial, sizeof(initial)) == (ssize_t)sizeof(initial) ? posix_sem_map(fd) : SEM_FAILED;
|
||||
close_keeping_errno(fd);
|
||||
if (sem != SEM_FAILED && renameat2(AT_FDCWD, temp, AT_FDCWD, path, RENAME_NOREPLACE) == 0) return sem;
|
||||
int saved = errno;
|
||||
if (sem != SEM_FAILED) sem_close(sem);
|
||||
unlink(temp);
|
||||
errno = saved;
|
||||
if (errno != EEXIST || (oflag & O_EXCL)) return SEM_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
int sem_close(sem_t *sem) {
|
||||
posix_sems_hold();
|
||||
struct posix_sem **link = &g_posix_sems;
|
||||
while (*link && (*link)->addr != sem) link = &(*link)->next;
|
||||
struct posix_sem *e = *link;
|
||||
if (e && --e->refs == 0) {
|
||||
*link = e->next;
|
||||
munmap(e->addr, sizeof(sem_t));
|
||||
free(e);
|
||||
}
|
||||
posix_sems_unlock();
|
||||
if (!e) { errno = EINVAL; return -1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sem_unlink(const char *name) {
|
||||
char path[PATH_MAX];
|
||||
if (posix_shm_path(name, "sem.", path, sizeof(path)) < 0) return -1;
|
||||
return unlink(path);
|
||||
}
|
||||
|
||||
#endif /* !DDNATV_HOST_TEST */
|
||||
|
||||
|
||||
@@ -59,10 +59,7 @@ FAKE_ADB = textwrap.dedent('''\
|
||||
print(config.get("dumpsys_input", ""))
|
||||
elif args[:3] == ["shell", "uinput", "-"]:
|
||||
entry["stdin"] = sys.stdin.read()
|
||||
if config.get("uinput_numeric_only") and '"UI_SET_EVBIT"' in entry["stdin"]:
|
||||
print("Error reading in object, ignoring.")
|
||||
entry["denied"] = True
|
||||
elif "uinput_stdout" in config:
|
||||
if "uinput_stdout" in config:
|
||||
print(config["uinput_stdout"])
|
||||
else:
|
||||
for line in entry["stdin"].splitlines():
|
||||
|
||||
@@ -86,46 +86,6 @@ class GamepadTest(FakeAdbTest):
|
||||
code, out = self.gamepad("a")
|
||||
self.assertEqual((3, "UINPUT_FAILED"), (code, out["error"]["code"]))
|
||||
|
||||
def test_android_13_gets_numeric_codes_and_no_sync(self):
|
||||
self.configure({}, uinput_probe="sdk=33")
|
||||
code, out = self.gamepad("guide", "down", "--hold", "50", "--gap", "100")
|
||||
self.assertEqual((0, True), (code, out["ok"]))
|
||||
commands = self.script()
|
||||
register = commands[0]
|
||||
bits = {c["type"]: c["data"] for c in register["configuration"]}
|
||||
self.assertEqual([1, 3], bits[100])
|
||||
self.assertIn(316, bits[101])
|
||||
self.assertEqual({0, 1, 3, 4, 16, 17}, set(bits[103]))
|
||||
self.assertEqual(set(bits[103]), {a["code"] for a in register["abs_info"]})
|
||||
injected = [c["events"] for c in commands if c["command"] == "inject"]
|
||||
self.assertEqual([[1, 316, 1, 0, 0, 0], [1, 316, 0, 0, 0, 0], [3, 17, 1, 0, 0, 0], [3, 17, 0, 0, 0, 0]], injected)
|
||||
self.assertEqual([], [c for c in commands if c["command"] == "sync"])
|
||||
self.assertFalse(any(isinstance(v, str) for c in commands for v in c.get("events", [])))
|
||||
|
||||
def test_android_13_uinput_that_rejects_the_script_fails(self):
|
||||
self.configure({}, uinput_probe="sdk=33", uinput_stdout="Error reading in object, ignoring.")
|
||||
code, out = self.gamepad("a")
|
||||
self.assertEqual((3, "UINPUT_FAILED"), (code, out["error"]["code"]))
|
||||
self.assertIn("Error reading in object", out["error"]["message"])
|
||||
|
||||
def test_android_14_before_qpr2_is_retried_with_numeric_codes(self):
|
||||
self.configure({}, uinput_probe="sdk=34", uinput_numeric_only=True)
|
||||
code, out = self.gamepad("guide")
|
||||
self.assertEqual((0, True), (code, out["ok"]))
|
||||
named, numeric = [c for c in self.calls() if c["args"][:3] == ["shell", "uinput", "-"]]
|
||||
self.assertIn('"UI_SET_EVBIT"', named["stdin"])
|
||||
commands = [json.loads(line) for line in numeric["stdin"].splitlines()]
|
||||
self.assertEqual(100, commands[0]["configuration"][0]["type"])
|
||||
self.assertEqual([], [c for c in commands if c["command"] == "sync"])
|
||||
|
||||
def test_android_14_keeps_named_codes_and_sync(self):
|
||||
self.configure({}, uinput_probe="sdk=34")
|
||||
code, _ = self.gamepad("a")
|
||||
self.assertEqual(0, code)
|
||||
commands = self.script()
|
||||
self.assertEqual("UI_SET_EVBIT", commands[0]["configuration"][0]["type"])
|
||||
self.assertEqual("sync", commands[-1]["command"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -225,30 +225,6 @@ class PenUinputTest(FakeAdbTest):
|
||||
self.assertIn(message, out["error"]["message"])
|
||||
self.assertFalse([c for c in self.calls() if c["args"][:2] == ["shell", "uinput"]])
|
||||
|
||||
def test_android_13_gets_numeric_codes_and_no_sync(self):
|
||||
self.configure({}, dumpsys_input=dumpsys_input(), uinput_probe="sdk=33")
|
||||
code, out = self.pen("tap", "0.5", "0.5")
|
||||
self.assertEqual((0, True), (code, out["ok"]))
|
||||
commands = self.script()
|
||||
bits = {c["type"]: c["data"] for c in commands[0]["configuration"]}
|
||||
# Android 13 has no virtual bus.
|
||||
self.assertEqual("usb", commands[0]["bus"])
|
||||
self.assertEqual({100: [1, 3], 101: [320, 321, 330, 331, 332], 103: [0, 1, 24, 25, 26, 27], 110: [1]}, bits)
|
||||
self.assertEqual({0, 1, 24, 25, 26, 27}, {a["code"] for a in commands[0]["abs_info"]})
|
||||
self.assertEqual([], [c for c in commands if c["command"] == "sync"])
|
||||
self.assertFalse(any(isinstance(v, str) for c in commands for v in c.get("events", [])))
|
||||
|
||||
def test_android_14_before_qpr2_is_retried_with_numeric_codes_on_the_usb_bus(self):
|
||||
self.configure({}, dumpsys_input=dumpsys_input(), uinput_probe="sdk=34", uinput_numeric_only=True)
|
||||
code, out = self.pen("tap", "0.5", "0.5")
|
||||
self.assertEqual((0, True), (code, out["ok"]))
|
||||
named, numeric = [c for c in self.calls() if c["args"][:3] == ["shell", "uinput", "-"]]
|
||||
register = named["stdin"].splitlines()[0]
|
||||
# Its codes are read before the virtual bus, which an older `uinput` rejects without the retry message.
|
||||
self.assertLess(register.index('"configuration"'), register.index('"bus": "virtual"'))
|
||||
commands = [json.loads(line) for line in numeric["stdin"].splitlines()]
|
||||
self.assertEqual(("usb", 100), (commands[0]["bus"], commands[0]["configuration"][0]["type"]))
|
||||
|
||||
def test_uinput_that_stops_early_fails(self):
|
||||
self.configure({}, dumpsys_input=dumpsys_input(), uinput_stdout="")
|
||||
code, out = self.pen("tap", "0.5", "0.5")
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
from pathlib import Path
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from tools.tests.test_native_hook_named_semaphores import CALLS, KEEP, PROBE
|
||||
|
||||
PRELOAD = Path(__file__).resolve().parents[1] / "linuxfs/preload"
|
||||
|
||||
DENY_LINKS = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <linux/filter.h>
|
||||
#include <linux/seccomp.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
struct sock_filter filter[] = {
|
||||
BPF_STMT(BPF_LD | BPF_W | BPF_ABS, offsetof(struct seccomp_data, nr)),
|
||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, SYS_link, 1, 0),
|
||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, SYS_linkat, 0, 1),
|
||||
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | EPERM),
|
||||
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
|
||||
};
|
||||
struct sock_fprog prog = {sizeof(filter) / sizeof(filter[0]), filter};
|
||||
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) || prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) return 125;
|
||||
execvp(argv[1], argv + 1);
|
||||
return 126;
|
||||
}
|
||||
"""
|
||||
|
||||
OPEN_EXISTING = r"""
|
||||
#include <fcntl.h>
|
||||
#include <semaphore.h>
|
||||
#include <stdlib.h>
|
||||
int main(int argc, char **argv) {
|
||||
sem_t *sem = sem_open(argv[1], 0);
|
||||
int value;
|
||||
if (sem == SEM_FAILED || sem_getvalue(sem, &value) || value != atoi(argv[2])) return 1;
|
||||
return sem_trywait(sem) || sem_close(sem);
|
||||
}
|
||||
"""
|
||||
|
||||
PYTHON_PROBE = '''
|
||||
import multiprocessing as mp
|
||||
import _multiprocessing
|
||||
import os
|
||||
import sys
|
||||
|
||||
def square(n):
|
||||
return n * n
|
||||
|
||||
if __name__ == "__main__":
|
||||
name = "/dd-py-sem-" + str(os.getpid())
|
||||
sem = _multiprocessing.SemLock(1, 1, 1, name, True)
|
||||
assert sem.acquire(False)
|
||||
assert not sem.acquire(False)
|
||||
sem.release()
|
||||
for method in mp.get_all_start_methods():
|
||||
ctx = mp.get_context(method)
|
||||
lock = ctx.Lock()
|
||||
with lock:
|
||||
assert not lock.acquire(False)
|
||||
queue = ctx.Queue()
|
||||
queue.put(7)
|
||||
assert queue.get(timeout=10) == 7
|
||||
queue.close()
|
||||
queue.join_thread()
|
||||
with ctx.Pool(2) as pool:
|
||||
assert pool.map(square, [1, 2, 3]) == [1, 4, 9]
|
||||
print(method, flush=True)
|
||||
'''
|
||||
|
||||
|
||||
@unittest.skipUnless(platform.machine() == "x86_64" and shutil.which("cc"), "needs an x86-64 compiler and host")
|
||||
class NamedSemaphoresPreloadTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.tmp = tempfile.TemporaryDirectory()
|
||||
cls.addClassCleanup(cls.tmp.cleanup)
|
||||
cls.root = Path(cls.tmp.name)
|
||||
cls.lib = cls.root / "semaphores.so"
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-Wall", "-Werror", "-pthread", "-o", str(cls.lib),
|
||||
str(PRELOAD / "named_semaphores.c")], check=True)
|
||||
for name, source in (("deny", DENY_LINKS), ("probe", PROBE), ("keep", KEEP), ("existing", OPEN_EXISTING)):
|
||||
path = cls.root / (name + ".c")
|
||||
path.write_text(source)
|
||||
subprocess.run(["cc", "-pthread", "-o", str(cls.root / name), str(path)], check=True)
|
||||
cls.script = cls.root / "pool.py"
|
||||
cls.script.write_text(PYTHON_PROBE)
|
||||
|
||||
def run_program(self, args, hooked=True, denied=True):
|
||||
env = dict(os.environ)
|
||||
env.pop("LD_PRELOAD", None)
|
||||
if hooked:
|
||||
env["LD_PRELOAD"] = str(self.lib)
|
||||
command = ([str(self.root / "deny")] if denied else []) + list(map(str, args))
|
||||
return subprocess.run(command, env=env, text=True, capture_output=True, timeout=60)
|
||||
|
||||
def test_glibc_semlock_fails_when_hard_links_are_denied(self):
|
||||
result = self.run_program([sys.executable, "-c",
|
||||
"import multiprocessing; multiprocessing.Lock()"], hooked=False)
|
||||
self.assertNotEqual(0, result.returncode)
|
||||
self.assertIn("PermissionError: [Errno 1]", result.stderr)
|
||||
|
||||
def test_named_semaphore_contract_with_and_without_hard_links(self):
|
||||
for denied in (True, False):
|
||||
with self.subTest(denied=denied):
|
||||
result = self.run_program([self.root / "probe", f"/dd-preload-{os.getpid()}-{int(denied)}"], denied=denied)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
self.assertEqual({call: "1" for call in CALLS}, dict(line.split("\t") for line in result.stdout.splitlines()))
|
||||
|
||||
def test_semaphores_remain_compatible_with_glibc_and_keep_the_requested_mode(self):
|
||||
for hooked in (True, False):
|
||||
with self.subTest(creator_hooked=hooked):
|
||||
name = f"/dd-preload-existing-{os.getpid()}-{int(hooked)}"
|
||||
path = Path("/dev/shm/sem." + name[1:])
|
||||
self.addCleanup(path.unlink, missing_ok=True)
|
||||
result = self.run_program([self.root / "keep", name], hooked=hooked, denied=hooked)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
umask = os.umask(0)
|
||||
os.umask(umask)
|
||||
self.assertEqual(0o640 & ~umask, path.stat().st_mode & 0o777)
|
||||
for reader, value in ((not hooked, 3), (hooked, 2)):
|
||||
result = self.run_program([self.root / "existing", name, value], hooked=reader, denied=reader)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
|
||||
def test_python_semlock_queues_and_explicit_pool_contexts(self):
|
||||
for denied in (True, False):
|
||||
with self.subTest(denied=denied):
|
||||
result = self.run_program([sys.executable, self.script], denied=denied)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
self.assertEqual({"fork", "forkserver", "spawn"}, set(result.stdout.splitlines()))
|
||||
Reference in new issue
Block a user