<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; Библиотека для Wii Remote]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=10279</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=10279&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Библиотека для Wii Remote».]]></description>
		<lastBuildDate>Mon, 19 Jan 2015 08:51:26 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90708#p90708</link>
			<description><![CDATA[<div class="quotebox"><cite>kharlashkin пишет:</cite><blockquote><p>Нашлась такая - называется <a href="http://wiki.unity3d.com/index.php?title=UniWii">UniWii</a>, и вроде как намного проще функции, без сложных структур и прочего. Надо попробовать вызывать функции из неё - может так:<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>Wiimote_start := DllCall(&quot;uniwii.dll\wiimote_start&quot;)
Wiimote_count := DllCall(&quot;uniwii.dll\wiimote_count&quot;, &quot;Cdecl Int&quot;)
Wiimote_rumble := DllCall(&quot;uniwii.dll\wiimote_rumble&quot;, &quot;Int&quot;, Wiimote_count, &quot;Float&quot;, 2)</code></pre></div></div></div></blockquote></div><p>Не взлетело...</p><p>Копаясь, нашел вот такой отзыв о wiiuse:<br /></p><div class="quotebox"><blockquote><p>if you will use multiple wiimotes, don&#039;t use wiiuse library. i am working on a stereo system with two wiimotes using wiiuse library but wiiuse made me crazy( it gives delayed ir tracking data ) and i decided to change my library wiiuse from wiiyourself</p></blockquote></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;мнение</div><div class="fancy_spoiler"><p>Кстати тестируя примеры для wiiuse из консоли на С и python, видел что связь между контроллером и ПК действительно &quot;не внушает доверия&quot; и довольно часто пропадают пакеты.</p></div></div><p>Исследую библиотеку <a href="http://wiiyourself.gl.tter.org/">wiiyourself</a>.</p>]]></description>
			<author><![CDATA[null@example.com (kharlashkin)]]></author>
			<pubDate>Mon, 19 Jan 2015 08:51:26 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90708#p90708</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90601#p90601</link>
			<description><![CDATA[<p>Предыстория: сегодня свалилось письмо в почту от мелокомягких как обычно с новостями и прочей лабудой. Пройдя по ссылке с <a href="http://blogs.msdn.com/b/rudevnews/archive/2014/12/23/10582615.aspx">конкурсом игр с поддержкой геймпада</a> и просмотрев пару уроков заинтересовался &quot;А есть ли библиотека для Unity под Wiimote?&quot;.<br />Нашлась такая - называется <a href="http://wiki.unity3d.com/index.php?title=UniWii">UniWii</a>, и вроде как намного проще функции, без сложных структур и прочего. Надо попробовать вызывать функции из неё - может так:<br /></p><div class="codebox"><pre><code>Wiimote_start := DllCall(&quot;uniwii.dll\wiimote_start&quot;)
Wiimote_count := DllCall(&quot;uniwii.dll\wiimote_count&quot;, &quot;Cdecl Int&quot;)
Wiimote_rumble := DllCall(&quot;uniwii.dll\wiimote_rumble&quot;, &quot;Int&quot;, Wiimote_count, &quot;Float&quot;, 2)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (kharlashkin)]]></author>
			<pubDate>Fri, 16 Jan 2015 13:48:06 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90601#p90601</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90548#p90548</link>
			<description><![CDATA[<div class="quotebox"><cite>kharlashkin пишет:</cite><blockquote><p>1. Каким образом читать структуру expansion_t:<br /></p><div class="codebox"><pre><code>int     type
union {
   struct nunchuk_t   nunchuk
   struct classic_ctrl_t   classic
   struct guitar_hero_3_t   gh3
} </code></pre></div></blockquote></div><p>Сегодня открылись доки по <a href="http://www.autohotkey.net/~HotKeyIt/AutoHotkey/_Struct.htm">_Struct</a> (вчера было недоступно), там есть описание каким образом сделать с помощью этой библиотеки в union вставить внутрь структуры.<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p>Union	<br />Using {} you can create union, for example: <br />AHKVar:=&quot;{Int64 ContentsInt64,Double ContentsDouble,object},...</p><p>Struct	<br />Using struct{} you can create structures in union.</p></div></div><p>Так есть упоминание о вложении структур в структуры, но непонятно мне, кому понятно поделитесь примером с комментариями.<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p>Same way you can have a structure in structure so you can call for example Label.NextLabel.NextLabel.JumpToLine</p></div></div><div class="quotebox"><cite>kharlashkin пишет:</cite><blockquote><p>2. Каким образом сделать вот это, я так понимаю нужно считать 18 байт:<br /></p><div class="codebox"><pre><code>
WCONST char wiimote_t::bdaddr_str[18]
readable bt address</code></pre></div></blockquote></div><p>С этим что поделать - не знаю.</p>]]></description>
			<author><![CDATA[null@example.com (kharlashkin)]]></author>
			<pubDate>Thu, 15 Jan 2015 08:33:29 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90548#p90548</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90507#p90507</link>
			<description><![CDATA[<p>Начал приводить в нормальный вид библиотеку (аналог Xinput), появилось несколько вопросов:<br />1. Каким образом читать структуру expansion_t:<br /></p><div class="codebox"><pre><code>int     type
union {
   struct nunchuk_t   nunchuk
   struct classic_ctrl_t   classic
   struct guitar_hero_3_t   gh3
} </code></pre></div><p>2. Каким образом сделать вот это, я так понимаю нужно считать 18 байт:<br /></p><div class="codebox"><pre><code>
WCONST char wiimote_t::bdaddr_str[18]
readable bt address</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (kharlashkin)]]></author>
			<pubDate>Wed, 14 Jan 2015 11:34:18 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90507#p90507</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90505#p90505</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Как так нет? Читаем:<br /></p><div class="quotebox"><blockquote><p>Char 	An 8-bit integer, whose range is -128 (-0x80) to 127 (0x7F). An unsigned character (UChar) can be used with functions that expect a BYTE.</p></blockquote></div><p><em>8-bit integer</em> — это и есть размер, 8 бит = 1 байт.</p></blockquote></div><p>Точно. Спасибо!</p><p>Теперь если &quot;вернуться к нашим баранам&quot;, а именно к библиотеке Xinput от уважаемого Lexikos:<br />1. _XInput_hm - указатель на dll.<br />2. _XInput_GetState - указатель на функцию, при вызове которой получаем указатель на структуру XINPUT_STATE.<br />3. И соответственно считываем данные этой структуры и разбираем по байтово:<br /></p><div class="codebox"><pre><code>return {
    (Join,
        dwPacketNumber: NumGet(xiState,  0, &quot;UInt&quot;)
        wButtons:       NumGet(xiState,  4, &quot;UShort&quot;)
        bLeftTrigger:   NumGet(xiState,  6, &quot;UChar&quot;)
        bRightTrigger:  NumGet(xiState,  7, &quot;UChar&quot;)
        sThumbLX:       NumGet(xiState,  8, &quot;Short&quot;)
        sThumbLY:       NumGet(xiState, 10, &quot;Short&quot;)
        sThumbRX:       NumGet(xiState, 12, &quot;Short&quot;)
        sThumbRY:       NumGet(xiState, 14, &quot;Short&quot;)
    )}</code></pre></div><p>Если я правильно себе это представляют - то нужно делать по аналогии?</p>]]></description>
			<author><![CDATA[null@example.com (kharlashkin)]]></author>
			<pubDate>Wed, 14 Jan 2015 10:31:57 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90505#p90505</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90504#p90504</link>
			<description><![CDATA[<div class="quotebox"><cite>kharlashkin пишет:</cite><blockquote><p>Заканчиваем оффтопить, а то сейчас teadrinker накажет <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p></blockquote></div><p>Сам себя?</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Wed, 14 Jan 2015 10:31:51 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90504#p90504</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90501#p90501</link>
			<description><![CDATA[<p>Как так нет? Читаем:<br /></p><div class="quotebox"><blockquote><p>Char 	An 8-bit integer, whose range is -128 (-0x80) to 127 (0x7F). An unsigned character (UChar) can be used with functions that expect a BYTE.</p></blockquote></div><p><em>8-bit integer</em> — это и есть размер, 8 бит = 1 байт.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 14 Jan 2015 10:22:35 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90501#p90501</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90500#p90500</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Вообще-то <a href="http://ahkscript.org/docs/commands/DllCall.htm#types">есть</a>.</p></blockquote></div><p>Да ну эту &quot;табличку&quot;, я уже почти на память помню <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /> Но размеров то там нет. (т.е. UChar = 1, FLOAT = 4 и т.п.)</p><p>Заканчиваем оффтопить, а то сейчас teadrinker накажет <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (kharlashkin)]]></author>
			<pubDate>Wed, 14 Jan 2015 10:19:40 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90500#p90500</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90499#p90499</link>
			<description><![CDATA[<p>Ну, если этого хватит, то отлично.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Wed, 14 Jan 2015 10:15:54 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90499#p90499</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90498#p90498</link>
			<description><![CDATA[<p>Вообще-то <a href="http://ahkscript.org/docs/commands/DllCall.htm#types">есть</a>.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 14 Jan 2015 10:14:24 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90498#p90498</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90497#p90497</link>
			<description><![CDATA[<p>Таблички нет, но по каким-то конкретным типам могу подсказать.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Wed, 14 Jan 2015 10:12:11 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90497#p90497</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90495#p90495</link>
			<description><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>Есть ведь сишные определения этих структур, верно? Там типы понятные, размеры не проблема узнать. Зачем с Питоном путаться?</p></blockquote></div><p>Вот и спрашиваю табличку С-шных значений и AHK-соответсвий.</p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Так это от задачи зависит. Я могу привести пример для какой-либо функции из WinApi, если скажете, какая именно интересует.</p></blockquote></div><p>По WinAPI нашел очень много всего ещё на этапе копания по DllCall - <a href="https://github.com/jNizM/AHK_DllCall_WinAPI">AHK_DllCall_WinAPI</a><br />Но сходу не нашел структуру включающую в себя другую структуру (которая используется и в другом месте).</p>]]></description>
			<author><![CDATA[null@example.com (kharlashkin)]]></author>
			<pubDate>Wed, 14 Jan 2015 10:03:25 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90495#p90495</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90493#p90493</link>
			<description><![CDATA[<p>Есть ведь сишные определения этих структур, верно? Там типы понятные, размеры не проблема узнать. Зачем с Питоном путаться?</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Wed, 14 Jan 2015 09:57:49 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90493#p90493</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90492#p90492</link>
			<description><![CDATA[<p>Так это от задачи зависит. Я могу привести пример для какой-либо функции из WinApi, если скажете, какая именно интересует.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 14 Jan 2015 09:54:28 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90492#p90492</guid>
		</item>
		<item>
			<title><![CDATA[Re: Библиотека для Wii Remote]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=90489#p90489</link>
			<description><![CDATA[<p>Хотя наверное можно и не создавать дубликаты, а считать её непосредственно из dll.<br /></p><div class="codebox"><pre><code>_Wiiuse_hm                := DllCall(&quot;LoadLibrary&quot;, &quot;Str&quot;, dll)
_Wiimote                := DllCall(&quot;GetProcAddress&quot;, &quot;Ptr&quot;, _Wiiuse_hm, &quot;AStr&quot;, &quot;wiimote_t&quot;)

Wiimote()
{
    global _Wiimote
    
    VarSetCapacity(wiimote,78)    
    
    if ErrorLevel := DllCall(_Wiimote, &quot;UInt&quot;, &amp;wiimote)
        return 0

    return {
    (Join,
        unid:                NumGet(wiimote, 0, &quot;Int&quot;)
        bdaddr:                NumGet(wiimote, 4, &quot;Int*&quot;)
        bdaddr_Str:            NumGet(wiimote, 8, &quot;UChar&quot;)*16
        out_sock:            NumGet(wiimote, 27, &quot;Int&quot;)
        in_sock:            NumGet(wiimote, 31, &quot;Int&quot;)
        state:                NumGet(wiimote, 35, &quot;Int&quot;)
        leds:                NumGet(wiimote, 39, &quot;UChar&quot;)
        battery_level:        NumGet(wiimote, 40, &quot;Float&quot;)
        flags:                NumGet(wiimote, 42, &quot;Int&quot;)
        handshake_state:    NumGet(wiimote, 46, &quot;UChar&quot;)
        read_req:            NumGet(wiimote, 47, &quot;UInt*&quot;)
        accel_calib:        StrGet(wiimote, 50, &quot;Str&quot;)
        orient:                StrGet(wiimote, 53, &quot;Str&quot;)
        gforce:                StrGet(wiimote, 57, &quot;Str&quot;)
        ir:                    StrGet(wiimote, 59, &quot;Str&quot;)    
        btns:                NumGet(wiimote, 57, &quot;UShort&quot;)
        btns_held:            NumGet(wiimote, 57, &quot;UShort&quot;)
        btns_released:      NumGet(wiimote, 57, &quot;UShort&quot;)
        orient_threshold:   NumGet(wiimote, 57, &quot;Float&quot;)
        accel_threshold:    NumGet(wiimote, 35, &quot;Int&quot;)
        lstate:                StrGet(wiimote, 57, &quot;Str&quot;)
        event:                NumGet(wiimote, 27, &quot;Int&quot;)
        event_buf:            NumGet(wiimote, 8, &quot;UChar&quot;)*32
    )}
}</code></pre></div><p>Если такой вариант правильный. подскажите как правильно посчитать размеры (может есть табличка - а то разрозненными кусками по интурнету искать сложно)?</p>]]></description>
			<author><![CDATA[null@example.com (kharlashkin)]]></author>
			<pubDate>Wed, 14 Jan 2015 09:40:54 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=90489#p90489</guid>
		</item>
	</channel>
</rss>
