| 159 | else |
| 160 | { |
| 161 | if (InputHookT::State()) |
| 162 | { |
| 163 | timeEndPeriod(1); |
| 164 | InputHookT::Close(); |
| 165 | #ifdef Q_KEYEDIT_PAD_ENABLED |
| 166 | if (Qi::set.pad) Qi::xboxpad.closeStateEvent(); |
| 167 | #endif |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | void QiState(bool state) |
| 172 | { |
| 173 | srand(clock()); |
| 174 | if (state) |
| 175 | { |
| 176 | Qi::curBlock = 0; |
| 177 | Qi::keyBlock.clear(); |
| 178 | Qi::macroActive.clear(); |
| 179 | for (auto& g : Qi::macroGroups) for (auto& m : g.macros) if (m.state && (m.key1 || m.key2)) |
| 180 | { |
| 181 | if (m.keyBlock) |
| 182 | { |
| 183 | if (m.key1) Qi::keyBlock.set(m.key1, true); |
| 184 | if (m.key2) Qi::keyBlock.set(m.key2, true); |
| 185 | } |
| 186 | m.range = { 0,0,10000,10000 }; |
| 187 | Qi::macroActive.append(&m); |
| 188 | } |
| 189 | |
| 190 | Qi::state = true; |
| 191 | if (Qi::fun.wndActive.state) { if (!Qi::fun.wndActive.thread.active()) Qi::fun.wndActive.thread.start(); } |
| 192 | else Qi::run = true; |
| 193 | if (Qi::set.showTips && !Qi::ui.pop.qe.t.isEmpty()) QiFn::StatePop(true); |
| 194 | if (Qi::set.audFx) QiFn::SoundPlay(Qi::ui.pop.qe.s, false); |
| 195 | } |
| 196 | else |
| 197 | { |
| 198 | Qi::state = false, Qi::run = false; |
| 199 | for (auto& m : Qi::macroActive) m->thread.stop(); |
| 200 | if (Qi::fun.wndActive.state) { if (Qi::fun.wndActive.thread.active()) Qi::fun.wndActive.thread.stop(); } |
| 201 | if (Qi::set.showTips && !Qi::ui.pop.qd.t.isEmpty()) QiFn::StatePop(false); |
| 202 | if (Qi::set.audFx) QiFn::SoundPlay(Qi::ui.pop.qd.s, false); |
| 203 | QiScriptInterpreter::clearMutex(); |