Difference between revisions of "Deep Sea Knowledge:Sandbox"
Jump to navigation
Jump to search
OatmealDome (talk | contribs) (create sandbox page) |
GamingTeen (talk | contribs) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
'''This is a sandbox for testing edits - content can be added and deleted by anybody at any time, so don't store anything important here. Make your changes below this line.''' | '''This is a sandbox for testing edits - content can be added and deleted by anybody at any time, so don't store anything important here. Make your changes below this line.''' | ||
+ | |||
+ | <syntaxhighlight lang="csharp" line='line'> | ||
+ | public static InputPkg ReadPkg(UsbCtx ctx) | ||
+ | { | ||
+ | if (!ctx.isSet) SetCtx(ctx); | ||
+ | |||
+ | var buf = new byte[0x10]; | ||
+ | var pkg = new InputPkg(); | ||
+ | |||
+ | ctx.Read.Read(buf, 1000, out int len); | ||
+ | |||
+ | pkg.HeldKeys = BitConverter.ToUInt64(buf, 0); | ||
+ | pkg.LJoyX = BitConverter.ToInt16(buf, 8); | ||
+ | pkg.LJoyY = BitConverter.ToInt16(buf, 10); | ||
+ | pkg.RJoyX = BitConverter.ToInt16(buf, 12); | ||
+ | pkg.RJoyY = BitConverter.ToInt16(buf, 14); | ||
+ | |||
+ | return pkg; | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | Hi! Anyone here? |
Latest revision as of 03:10, 9 June 2019
This is a sandbox for testing edits - content can be added and deleted by anybody at any time, so don't store anything important here. Make your changes below this line.
1 public static InputPkg ReadPkg(UsbCtx ctx)
2 {
3 if (!ctx.isSet) SetCtx(ctx);
4
5 var buf = new byte[0x10];
6 var pkg = new InputPkg();
7
8 ctx.Read.Read(buf, 1000, out int len);
9
10 pkg.HeldKeys = BitConverter.ToUInt64(buf, 0);
11 pkg.LJoyX = BitConverter.ToInt16(buf, 8);
12 pkg.LJoyY = BitConverter.ToInt16(buf, 10);
13 pkg.RJoyX = BitConverter.ToInt16(buf, 12);
14 pkg.RJoyY = BitConverter.ToInt16(buf, 14);
15
16 return pkg;
17 }
Hi! Anyone here?