https://forum.gamer.com.tw/C.php?bsn=31587&snA=4622&tnum=1昨天剛寫的心得文,想說要等到邏輯分析儀到才能繼續
不過後來搜尋到國外大神把描述符給寫好了
https://github.com/shinyquagsire23/Switch-Fightstick/blob/master/HORI_Descriptors於是花一個小時改寫一下Code
目前是完成了
今天開始嘗試寫異域神劍的自動抽神劍程式
倒是在按鈕上面發生一些問題
原來是在傳按鍵後,需要再傳一個待命指令
不然他會認為是按著不放,另外按鍵與按鍵需要間格一些時間(我是設定100ms)
不然會出現奇怪的錯誤
之前寫的按鍵我在這裡一併附上
uint8_t buf_standby[8] ={0x00,0x00,0x0f,0x80,0x80,0x80,0x80,0x00};//
uint8_t buf2_up[8] = {0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00};//上
uint8_t buf2_down[8] = {0x00,0x00,0x04,0x80,0x80,0x80,0x80,0x00};//下
uint8_t buf2_left[8] = {0x00,0x00,0x06,0x80,0x80,0x80,0x80,0x00};//左
uint8_t buf2_right[8] = {0x00,0x00,0x02,0x80,0x80,0x80,0x80,0x00};//右
uint8_t buf3_L[8] = {0x10,0x00,0x00,0x80,0x80,0x80,0x80,0x00};//L
uint8_t buf3_R[8] = {0x20,0x00,0x00,0x80,0x80,0x80,0x80,0x00};//R
uint8_t buf3_LR[8] = {0x30,0x00,0x00,0x80,0x80,0x80,0x80,0x00};//L+R
uint8_t buf3_L2[8]= {0x40,0x00,0x00,0x80,0x80,0x80,0x80,0x00};//L2
uint8_t buf3_R2[8]= {0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x00};//R2
uint8_t buf3_A[8] = {0x04,0x00,0x0f,0x80,0x80,0x80,0x80,0x00};//A
uint8_t buf3_B[8] = {0x02,0x00,0x0f,0x80,0x80,0x80,0x80,0x00};//B
uint8_t buf3_X[8] = {0x08,0x00,0x0f,0x80,0x80,0x80,0x80,0x00};//X
uint8_t buf3_Y[8] = {0x01,0x00,0x0f,0x80,0x80,0x80,0x80,0x00};//Y
uint8_t buf3_HOME[8]= {0x00,0x10,0x0f,0x80,0x80,0x80,0x80,0x00};//HOME
int8_t buf3_capture[8]= {0x00,0x20,0x0f,0x80,0x80,0x80,0x80,0x00};//捕捉
uint8_t buf3_plus[8]= {0x00,0x02,0x0f,0x80,0x80,0x80,0x80,0x00};//+
uint8_t buf3_Minus[8]= {0x00,0x01,0x0f,0x80,0x80,0x80,0x80,0x00};//-
以下為HID描述符
usbd_hid0_report_descriptor[] = {
HID_UsagePage(0x01),
HID_Usage ( 0x05 ),
HID_Collection ( HID_Application ),
HID_LogicalMin ( 0 ),
HID_LogicalMaxS ( 1 ),
HID_PhysicalMin ( 0 ),
HID_PhysicalMaxS (1 ),
HID_ReportSize ( 1 ),
HID_ReportCount(13),
HID_UsagePage ( 0x09 ),
HID_UsageMin(0x01),
HID_UsageMax(0x0d),
HID_Input(0x02),
HID_ReportCount(0x03),
HID_Input(0x01),
HID_UsagePage(0x01),
HID_LogicalMax(0x07),
HID_PhysicalMaxS(0x3b01),
HID_ReportSize(0x04),
HID_ReportCount(0x01),
HID_Unit(0x14),
HID_Usage(0x39),
HID_Input(0x42),
HID_Unit(0x00),
HID_ReportCount(0x01),
HID_Input(0x01),
HID_LogicalMaxS(0xff00),
HID_PhysicalMaxS(0xff00),
HID_Usage(0x30),
HID_Usage(0x31),
HID_Usage(0x32),
HID_Usage(0x35),
HID_ReportSize(0x08),
HID_ReportCount(0x04),
HID_Input(0x02),
HID_UsagePage(0x00ff),
HID_Usage(0x20),
HID_ReportCount(0x01),
HID_Input(0x02),
HID_Usage(0x2126),
HID_ReportCount(0x08),
HID_Output(0x02),
HID_EndCollection
HID_ReportSize(0x08),
HID_ReportCount(0x04),
HID_Input(0x02),
HID_UsagePage(0x00ff),
HID_Usage(0x20),
HID_ReportCount(0x01),
HID_Input(0x02),
HID_Usage(0x2126),
HID_ReportCount(0x08),
HID_Output(0x02),
HID_EndCollection
};
另外有人問說,這跟市面上賣的n100有何不同
我個人不知道n100是否可以在電腦上寫腳本
如果不能,只能手動按手把錄影腳本的話
想一下你按七冰的任務,任務做完十分鐘後你還要再按第二次的不方便姓
或者有些並不是固定按A的遊戲
像是這個
https://unwire.hk/2017/12/04/switchjoyconpatch/game-channel/
這樣的話錄製腳本就不行了,如果是MCU自己寫,我可以在按鍵間格上
寫一些時間的公式等等