Kiibohd Controller
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Dieses Repo ist archiviert. Du kannst Dateien sehen und es klonen, kannst aber nicht pushen oder Issues/Pull-Requests öffnen.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. /* Copyright (C) 2014 by Jacob Alexander
  2. *
  3. * This file is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This file is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this file. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. // ----- Includes -----
  17. // Compiler Includes
  18. #include <Lib/MacroLib.h>
  19. // Project Includes
  20. #include <cli.h>
  21. #include <led.h>
  22. #include <print.h>
  23. #include <scan_loop.h>
  24. #include <output_com.h>
  25. // Keymaps
  26. #include "usb_hid.h"
  27. #include <defaultMap.h>
  28. #include "generatedKeymap.h" // TODO Use actual generated version
  29. // Local Includes
  30. #include "macro.h"
  31. // ----- Function Declarations -----
  32. void cliFunc_capList ( char* args );
  33. void cliFunc_capSelect ( char* args );
  34. void cliFunc_keyPress ( char* args );
  35. void cliFunc_keyRelease( char* args );
  36. void cliFunc_layerLatch( char* args );
  37. void cliFunc_layerList ( char* args );
  38. void cliFunc_layerLock ( char* args );
  39. void cliFunc_macroDebug( char* args );
  40. void cliFunc_macroList ( char* args );
  41. void cliFunc_macroProc ( char* args );
  42. void cliFunc_macroShow ( char* args );
  43. void cliFunc_macroStep ( char* args );
  44. // ----- Variables -----
  45. // Macro Module command dictionary
  46. char* macroCLIDictName = "Macro Module Commands";
  47. CLIDictItem macroCLIDict[] = {
  48. { "capList", "Prints an indexed list of all non USB keycode capabilities.", cliFunc_capList },
  49. { "capSelect", "Triggers the specified capability." NL "\t\t\033[35mU10\033[0m USB Code 0x0A, \033[35mK11\033[0m Keyboard Capability 0x0B", cliFunc_capSelect },
  50. { "keyPress", "Send key-presses to the macro module. Held until released. Duplicates have undefined behaviour." NL "\t\t\033[35mS10\033[0m Scancode 0x0A", cliFunc_keyPress },
  51. { "keyRelease", "Release a key-press from the macro module. Duplicates have undefined behaviour." NL "\t\t\033[35mS10\033[0m Scancode 0x0A", cliFunc_keyRelease },
  52. { "layerLatch", "Latch the specified indexed layer." NL "\t\t\033[35mL15\033[0m Indexed Layer 0x0F", cliFunc_layerLatch },
  53. { "layerList", "List available layers.", cliFunc_layerList },
  54. { "layerLock", "Lock the specified indexed layer." NL "\t\t\033[35mL2\033[0m Indexed Layer 0x02", cliFunc_layerLock },
  55. { "macroDebug", "Disables/Enables sending USB keycodes to the Output Module and prints U/K codes.", cliFunc_macroDebug },
  56. { "macroList", "List the defined trigger and result macros.", cliFunc_macroList },
  57. { "macroProc", "Pause/Resume macro processing.", cliFunc_macroProc },
  58. { "macroShow", "Show the macro corresponding to the given index or scan-code." NL "\t\t\033[35mT16\033[0m Indexed Trigger Macro 0x10, \033[35mR12\033[0m Indexed Result Macro 0x0C", cliFunc_macroShow },
  59. { "macroStep", "Do N macro processing steps. Defaults to 1.", cliFunc_macroStep },
  60. { 0, 0, 0 } // Null entry for dictionary end
  61. };
  62. // Macro debug flag - If set, clears the USB Buffers after signalling processing completion
  63. uint8_t macroDebugMode = 0;
  64. // Macro pause flag - If set, the macro module pauses processing, unless unset, or the step counter is non-zero
  65. uint8_t macroPauseMode = 0;
  66. // Macro step counter - If non-zero, the step counter counts down every time the macro module does one processing loop
  67. unsigned int macroStepCounter = 0;
  68. // Key Trigger List Buffer
  69. // * Item 1: scan code
  70. // * Item 2: state
  71. // ...
  72. uint8_t macroTriggerListBuffer[MaxScanCode * 2] = { 0 }; // Each key has a state to be cached
  73. uint8_t macroTriggerListBufferSize = 0;
  74. // TODO, figure out a good way to scale this array size without wasting too much memory, but not rejecting macros
  75. // Possibly could be calculated by the KLL compiler
  76. // XXX It may be possible to calculate the worst case using the KLL compiler
  77. TriggerMacro *triggerMacroPendingList[TriggerMacroNum];
  78. // ----- Functions -----
  79. // Looks up the trigger list for the given scan code (from the active layer)
  80. unsigned int *Macro_layerLookup( uint8_t scanCode )
  81. {
  82. // TODO - No layer fallthrough lookup
  83. return default_scanMap[ scanCode ];
  84. }
  85. // Update the scancode key state
  86. // States:
  87. // * 0x00 - Reserved
  88. // * 0x01 - Pressed
  89. // * 0x02 - Held
  90. // * 0x03 - Released
  91. // * 0x04 - Unpressed (this is currently ignored)
  92. inline void Macro_keyState( uint8_t scanCode, uint8_t state )
  93. {
  94. // Only add to macro trigger list if one of three states
  95. switch ( state )
  96. {
  97. case 0x01: // Pressed
  98. case 0x02: // Held
  99. case 0x03: // Released
  100. macroTriggerListBuffer[ macroTriggerListBufferSize++ ] = scanCode;
  101. macroTriggerListBuffer[ macroTriggerListBufferSize++ ] = state;
  102. break;
  103. }
  104. }
  105. // Update the scancode analog state
  106. // States:
  107. // * 0x00 - Reserved
  108. // * 0x01 - Released
  109. // * 0x02-0xFF - Analog value (low to high)
  110. inline void Macro_analogState( uint8_t scanCode, uint8_t state )
  111. {
  112. // TODO
  113. }
  114. // Update led state
  115. // States:
  116. // * 0x00 - Reserved
  117. // * 0x01 - On
  118. // * 0x02 - Off
  119. inline void Macro_ledState( uint8_t ledCode, uint8_t state )
  120. {
  121. // TODO
  122. }
  123. // Evaluate/Update the TriggerMacro
  124. void Macro_evalTriggerMacro( TriggerMacro *triggerMacro )
  125. {
  126. // Which combo in the sequence is being evaluated
  127. unsigned int comboPos = triggerMacro->pos;
  128. // If combo length is more than 1, cancel trigger macro if an incorrect key is found
  129. uint8_t comboLength = triggerMacro->guide[ comboPos ];
  130. // Iterate over list of keys currently pressed
  131. for ( uint8_t keyPressed = 0; keyPressed < macroTriggerListBufferSize; keyPressed += 2 )
  132. {
  133. // Compare with keys in combo
  134. for ( unsigned int comboKey = 0; comboKey < comboLength; comboKey++ )
  135. {
  136. // Lookup key in combo
  137. uint8_t guideKey = triggerMacro->guide[ comboPos + comboKey + 2 ]; // TODO Only Press/Hold/Release atm
  138. // Sequence Case
  139. if ( comboLength == 1 )
  140. {
  141. // If key matches and only 1 key pressed, increment the TriggerMacro combo position
  142. if ( guideKey == macroTriggerListBuffer[ keyPressed ] && macroTriggerListBufferSize == 1 )
  143. {
  144. triggerMacro->pos += comboLength * 2 + 1;
  145. // TODO check if TriggerMacro is finished, register ResultMacro
  146. return;
  147. }
  148. // If key does not match or more than 1 key pressed, reset the TriggerMacro combo position
  149. triggerMacro->pos = 0;
  150. return;
  151. }
  152. // Combo Case
  153. else
  154. {
  155. // TODO
  156. }
  157. }
  158. }
  159. }
  160. /*
  161. inline void Macro_bufferAdd( uint8_t byte )
  162. {
  163. // Make sure we haven't overflowed the key buffer
  164. // Default function for adding keys to the KeyIndex_Buffer, does a DefaultMap_Lookup
  165. if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER )
  166. {
  167. uint8_t key = DefaultMap_Lookup[byte];
  168. for ( uint8_t c = 0; c < KeyIndex_BufferUsed; c++ )
  169. {
  170. // Key already in the buffer
  171. if ( KeyIndex_Buffer[c] == key )
  172. return;
  173. }
  174. // Add to the buffer
  175. KeyIndex_Buffer[KeyIndex_BufferUsed++] = key;
  176. }
  177. }
  178. inline void Macro_bufferRemove( uint8_t byte )
  179. {
  180. uint8_t key = DefaultMap_Lookup[byte];
  181. // Check for the released key, and shift the other keys lower on the buffer
  182. for ( uint8_t c = 0; c < KeyIndex_BufferUsed; c++ )
  183. {
  184. // Key to release found
  185. if ( KeyIndex_Buffer[c] == key )
  186. {
  187. // Shift keys from c position
  188. for ( uint8_t k = c; k < KeyIndex_BufferUsed - 1; k++ )
  189. KeyIndex_Buffer[k] = KeyIndex_Buffer[k + 1];
  190. // Decrement Buffer
  191. KeyIndex_BufferUsed--;
  192. return;
  193. }
  194. }
  195. // Error case (no key to release)
  196. erro_msg("Could not find key to release: ");
  197. printHex( key );
  198. }
  199. */
  200. inline void Macro_finishWithUSBBuffer( uint8_t sentKeys )
  201. {
  202. }
  203. inline void Macro_process()
  204. {
  205. // Only do one round of macro processing between Output Module timer sends
  206. if ( USBKeys_Sent != 0 )
  207. return;
  208. // If the pause flag is set, only process if the step counter is non-zero
  209. if ( macroPauseMode && macroStepCounter == 0 )
  210. {
  211. return;
  212. }
  213. // Proceed, decrementing the step counter
  214. else
  215. {
  216. macroStepCounter--;
  217. }
  218. // Loop through macro trigger buffer
  219. for ( uint8_t index = 0; index < macroTriggerListBufferSize; index += 2 )
  220. {
  221. // Get scanCode, first item of macroTriggerListBuffer pairs
  222. uint8_t scanCode = macroTriggerListBuffer[ index ];
  223. // Lookup trigger list for this key
  224. unsigned int *triggerList = Macro_layerLookup( scanCode );
  225. // The first element is the length of the trigger list
  226. unsigned int triggerListSize = triggerList[0];
  227. // Loop through the trigger list
  228. for ( unsigned int trigger = 0; trigger < triggerListSize; trigger++ )
  229. {
  230. // Lookup TriggerMacro
  231. TriggerMacro *triggerMacro = (TriggerMacro*)triggerList[ trigger + 1 ];
  232. // Get triggered state of scan code, second item of macroTriggerListBuffer pairs
  233. uint8_t state = macroTriggerListBuffer[ index + 1 ];
  234. // Evaluate Macro
  235. Macro_evalTriggerMacro( triggerMacro );
  236. }
  237. }
  238. /* TODO
  239. // Loop through input buffer
  240. for ( uint8_t index = 0; index < KeyIndex_BufferUsed && !macroDebugMode; index++ )
  241. {
  242. //print(" KEYS: ");
  243. //printInt8( KeyIndex_BufferUsed );
  244. // Get the keycode from the buffer
  245. uint8_t key = KeyIndex_Buffer[index];
  246. // Set the modifier bit if this key is a modifier
  247. if ( (key & KEY_LCTRL) == KEY_LCTRL ) // AND with 0xE0
  248. {
  249. USBKeys_Modifiers |= 1 << (key ^ KEY_LCTRL); // Left shift 1 by key XOR 0xE0
  250. // Modifier processed, move on to the next key
  251. continue;
  252. }
  253. // Too many keys
  254. if ( USBKeys_Sent >= USBKeys_MaxSize )
  255. {
  256. warn_msg("USB Key limit reached");
  257. errorLED( 1 );
  258. break;
  259. }
  260. // Allow ignoring keys with 0's
  261. if ( key != 0 )
  262. {
  263. USBKeys_Array[USBKeys_Sent++] = key;
  264. }
  265. else
  266. {
  267. // Key was not mapped
  268. erro_msg( "Key not mapped... - " );
  269. printHex( key );
  270. errorLED( 1 );
  271. }
  272. }
  273. */
  274. // Signal buffer that we've used it
  275. Scan_finishedWithBuffer( KeyIndex_BufferUsed );
  276. // If Macro debug mode is set, clear the USB Buffer
  277. if ( macroDebugMode )
  278. {
  279. USBKeys_Modifiers = 0;
  280. USBKeys_Sent = 0;
  281. }
  282. }
  283. inline void Macro_setup()
  284. {
  285. // Register Macro CLI dictionary
  286. CLI_registerDictionary( macroCLIDict, macroCLIDictName );
  287. // Disable Macro debug mode
  288. macroDebugMode = 0;
  289. // Disable Macro pause flag
  290. macroPauseMode = 0;
  291. // Set Macro step counter to zero
  292. macroStepCounter = 0;
  293. // Make sure macro trigger buffer is empty
  294. macroTriggerListBufferSize = 0;
  295. }
  296. // ----- CLI Command Functions -----
  297. void cliFunc_capList( char* args )
  298. {
  299. // TODO
  300. }
  301. void cliFunc_capSelect( char* args )
  302. {
  303. // Parse code from argument
  304. // NOTE: Only first argument is used
  305. char* arg1Ptr;
  306. char* arg2Ptr;
  307. CLI_argumentIsolation( args, &arg1Ptr, &arg2Ptr );
  308. // Depending on the first character, the lookup changes
  309. switch ( arg1Ptr[0] )
  310. {
  311. // Keyboard Capability
  312. case 'K':
  313. // TODO
  314. break;
  315. // USB Code
  316. case 'U':
  317. // Just add the key to the USB Buffer
  318. if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER )
  319. {
  320. KeyIndex_Buffer[KeyIndex_BufferUsed++] = decToInt( &arg1Ptr[1] );
  321. }
  322. break;
  323. }
  324. }
  325. void cliFunc_keyPress( char* args )
  326. {
  327. // Parse codes from arguments
  328. char* curArgs;
  329. char* arg1Ptr;
  330. char* arg2Ptr = args;
  331. // Process all args
  332. for ( ;; )
  333. {
  334. curArgs = arg2Ptr;
  335. CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
  336. // Stop processing args if no more are found
  337. if ( *arg1Ptr == '\0' )
  338. break;
  339. // Ignore non-Scancode numbers
  340. switch ( arg1Ptr[0] )
  341. {
  342. // Scancode
  343. case 'S':
  344. Macro_keyState( (uint8_t)decToInt( &arg1Ptr[1] ), 0x01 ); // Press scancode
  345. break;
  346. }
  347. }
  348. }
  349. void cliFunc_keyRelease( char* args )
  350. {
  351. // Parse codes from arguments
  352. char* curArgs;
  353. char* arg1Ptr;
  354. char* arg2Ptr = args;
  355. // Process all args
  356. for ( ;; )
  357. {
  358. curArgs = arg2Ptr;
  359. CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
  360. // Stop processing args if no more are found
  361. if ( *arg1Ptr == '\0' )
  362. break;
  363. // Ignore non-Scancode numbers
  364. switch ( arg1Ptr[0] )
  365. {
  366. // Scancode
  367. case 'S':
  368. Macro_keyState( (uint8_t)decToInt( &arg1Ptr[1] ), 0x03 ); // Release scancode
  369. break;
  370. }
  371. }
  372. }
  373. void cliFunc_layerLatch( char* args )
  374. {
  375. // TODO
  376. }
  377. void cliFunc_layerList( char* args )
  378. {
  379. // TODO
  380. }
  381. void cliFunc_layerLock( char* args )
  382. {
  383. // TODO
  384. }
  385. void cliFunc_macroDebug( char* args )
  386. {
  387. // Toggle macro debug mode
  388. macroDebugMode = macroDebugMode ? 0 : 1;
  389. print( NL );
  390. info_msg("Macro Debug Mode: ");
  391. printInt8( macroDebugMode );
  392. }
  393. void cliFunc_macroList( char* args )
  394. {
  395. // TODO
  396. }
  397. void cliFunc_macroProc( char* args )
  398. {
  399. // Toggle macro pause mode
  400. macroPauseMode = macroPauseMode ? 0 : 1;
  401. print( NL );
  402. info_msg("Macro Processing Mode: ");
  403. printInt8( macroPauseMode );
  404. }
  405. void macroDebugShowTrigger( unsigned int index )
  406. {
  407. // Only proceed if the macro exists
  408. if ( index >= TriggerMacroNum )
  409. return;
  410. // Trigger Macro Show
  411. TriggerMacro *macro = &TriggerMacroList[ index ];
  412. print( NL );
  413. info_msg("Trigger Macro Index: ");
  414. printInt16( (uint16_t)index ); // Hopefully large enough :P (can't assume 32-bit)
  415. print( NL );
  416. // Read the comboLength for combo in the sequence (sequence of combos)
  417. unsigned int pos = 0;
  418. uint8_t comboLength = macro->guide[ pos ];
  419. // Iterate through and interpret the guide
  420. while ( comboLength != 0 )
  421. {
  422. // Initial position of the combo
  423. unsigned int comboPos = ++pos;
  424. // Iterate through the combo
  425. while ( pos < comboLength * TriggerGuideSize + comboPos )
  426. {
  427. // Assign TriggerGuide element (key type, state and scancode)
  428. TriggerGuide *guide = (TriggerGuide*)(&macro->guide[ pos ]);
  429. // Display guide information about trigger key
  430. printHex( guide->scancode );
  431. print("|");
  432. printHex( guide->type );
  433. print("|");
  434. printHex( guide->state );
  435. // Increment position
  436. pos += TriggerGuideSize;
  437. // Only show combo separator if there are combos left in the sequence element
  438. if ( pos < comboLength * TriggerGuideSize + comboPos )
  439. print("+");
  440. }
  441. // Read the next comboLength
  442. comboLength = macro->guide[ pos ];
  443. // Only show sequence separator if there is another combo to process
  444. if ( comboLength != 0 )
  445. print(";");
  446. }
  447. // Display current position
  448. print( NL "Position: " );
  449. printInt16( (uint16_t)macro->pos ); // Hopefully large enough :P (can't assume 32-bit)
  450. // Display result macro index
  451. print( NL "Result Macro Index: " );
  452. printInt16( (uint16_t)macro->result ); // Hopefully large enough :P (can't assume 32-bit)
  453. }
  454. void macroDebugShowResult( unsigned int index )
  455. {
  456. // Only proceed if the macro exists
  457. if ( index >= ResultMacroNum )
  458. return;
  459. // Trigger Macro Show
  460. ResultMacro *macro = &ResultMacroList[ index ];
  461. print( NL );
  462. info_msg("Result Macro Index: ");
  463. printInt16( (uint16_t)index ); // Hopefully large enough :P (can't assume 32-bit)
  464. print( NL );
  465. // Read the comboLength for combo in the sequence (sequence of combos)
  466. unsigned int pos = 0;
  467. uint8_t comboLength = macro->guide[ pos++ ];
  468. // Iterate through and interpret the guide
  469. while ( comboLength != 0 )
  470. {
  471. // Function Counter, used to keep track of the combos processed
  472. unsigned int funcCount = 0;
  473. // Iterate through the combo
  474. while ( funcCount < comboLength )
  475. {
  476. // Assign TriggerGuide element (key type, state and scancode)
  477. ResultGuide *guide = (ResultGuide*)(&macro->guide[ pos ]);
  478. // Display Function Ptr Address
  479. printHex( (unsigned int)guide->function );
  480. print("|");
  481. // Display/Lookup Capability Name (utilize debug mode of capability)
  482. void (*capability)(uint8_t, uint8_t, uint8_t*) = (void(*)(uint8_t, uint8_t, uint8_t*))(guide->function);
  483. capability( 0xFF, 0xFF, 0 );
  484. // Display Argument(s)
  485. print("(");
  486. for ( unsigned int arg = 0; arg < guide->argCount; arg++ )
  487. {
  488. // Arguments are only 8 bit values (guides are 32 bit for function pointers)
  489. printHex( (uint8_t)(unsigned int)(&guide->args)[ arg ] );
  490. // Only show arg separator if there are args left
  491. if ( arg + 1 < guide->argCount )
  492. print(",");
  493. }
  494. print(")");
  495. // Increment position
  496. pos += ResultGuideSize( guide );
  497. // Increment function count
  498. funcCount++;
  499. // Only show combo separator if there are combos left in the sequence element
  500. if ( funcCount < comboLength )
  501. print("+");
  502. }
  503. // Read the next comboLength
  504. comboLength = macro->guide[ pos++ ];
  505. // Only show sequence separator if there is another combo to process
  506. if ( comboLength != 0 )
  507. print(";");
  508. }
  509. // Display current position
  510. print( NL "Position: " );
  511. printInt16( (uint16_t)macro->pos ); // Hopefully large enough :P (can't assume 32-bit)
  512. // Display final trigger state/type
  513. print( NL "Final Trigger State (State/Type): " );
  514. printHex( macro->state );
  515. print("/");
  516. printHex( macro->stateType );
  517. }
  518. void cliFunc_macroShow( char* args )
  519. {
  520. // Parse codes from arguments
  521. char* curArgs;
  522. char* arg1Ptr;
  523. char* arg2Ptr = args;
  524. // Process all args
  525. for ( ;; )
  526. {
  527. curArgs = arg2Ptr;
  528. CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
  529. // Stop processing args if no more are found
  530. if ( *arg1Ptr == '\0' )
  531. break;
  532. // Ignore invalid codes
  533. switch ( arg1Ptr[0] )
  534. {
  535. // Indexed Trigger Macro
  536. case 'T':
  537. macroDebugShowTrigger( decToInt( &arg1Ptr[1] ) );
  538. break;
  539. // Indexed Result Macro
  540. case 'R':
  541. macroDebugShowResult( decToInt( &arg1Ptr[1] ) );
  542. break;
  543. }
  544. }
  545. }
  546. void cliFunc_macroStep( char* args )
  547. {
  548. // Parse number from argument
  549. // NOTE: Only first argument is used
  550. char* arg1Ptr;
  551. char* arg2Ptr;
  552. CLI_argumentIsolation( args, &arg1Ptr, &arg2Ptr );
  553. // Set the macro step counter, negative int's are cast to uint
  554. macroStepCounter = (unsigned int)decToInt( arg1Ptr );
  555. }