Ha, dicks. Well I lost the .TSI.
The basic premise though is that the encoder controls two modifiers along with the loop size.
If I recall correctly, there are 12 loop size states. Assuming you set the loop with size of 8, this will also set modifier 2 to a value of 5 (m1 will also be zero until later). Turning the encoder right will increase loop size as well as the state of modifier 2. Once loop size 32 is reached modifier 2 state will be 7, at this point the encoder has no effect when turned to the right. Turning it to the left will decrease loop size along with modifier two's state. Once loop size 2 has been reached (m2=3), modifer 2 needs to go a zero state, while modifier 1 goes from it's zero state to 1. Continuing to turn left will decreasing loop size while increasing modifier 1. Its all very complicated but it ensures the modifiers stay synced to the loop size. To get the loop size displayed you simply make an output maping for each modifier state.
Ill try to whip up a TSI for you soon, I still dont fully understand how I got it to work so it may take a bit. Im sure Stewe could do it in his sleep though...