mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2025-04-19 20:43:49 +01:00
Compare commits
3 Commits
a7c0bc1620
...
de70cd39cf
Author | SHA1 | Date | |
---|---|---|---|
de70cd39cf | |||
b225ba5cc3 | |||
35335a60aa |
@ -19,5 +19,6 @@ char *kind_as_string(char *s, int kind, int n);
|
|||||||
char *version_as_string(char *s, long v, int n);
|
char *version_as_string(char *s, long v, int n);
|
||||||
bool is_comment(char *s);
|
bool is_comment(char *s);
|
||||||
struct quickcommand *command_in_quickcommands(const char *command, const struct quickcommand *quickcommands, int n);
|
struct quickcommand *command_in_quickcommands(const char *command, const struct quickcommand *quickcommands, int n);
|
||||||
|
void clear(PT_VMR vmr, bool (*f)(PT_VMR));
|
||||||
|
|
||||||
#endif /* __UTIL_H__ */
|
#endif /* __UTIL_H__ */
|
@ -41,6 +41,4 @@ bool is_mdirty(PT_VMR vmr);
|
|||||||
long macrobutton_getstatus(PT_VMR vmr, long n, float *val, long mode);
|
long macrobutton_getstatus(PT_VMR vmr, long n, float *val, long mode);
|
||||||
long macrobutton_setstatus(PT_VMR vmr, long n, float val, long mode);
|
long macrobutton_setstatus(PT_VMR vmr, long n, float val, long mode);
|
||||||
|
|
||||||
void clear_dirty(PT_VMR vmr);
|
|
||||||
|
|
||||||
#endif /* __WRAPPER_H__ */
|
#endif /* __WRAPPER_H__ */
|
14
src/util.c
14
src/util.c
@ -13,6 +13,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <windows.h>
|
||||||
#include "wrapper.h"
|
#include "wrapper.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -104,3 +105,16 @@ struct quickcommand *command_in_quickcommands(const char *command_key, const str
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Continuously polls an is_{}dirty function until it clears.
|
||||||
|
*
|
||||||
|
* @param vmr Pointer to the iVMR interface
|
||||||
|
* @param f Pointer to a polling function
|
||||||
|
*/
|
||||||
|
void clear(PT_VMR vmr, bool (*f)(PT_VMR))
|
||||||
|
{
|
||||||
|
Sleep(30);
|
||||||
|
while (f(vmr))
|
||||||
|
Sleep(1);
|
||||||
|
}
|
@ -175,7 +175,7 @@ int main(int argc, char *argv[])
|
|||||||
log_info("Profile %s loaded", cvalue);
|
log_info("Profile %s loaded", cvalue);
|
||||||
set_parameter_string(vmr, "command.load", cvalue);
|
set_parameter_string(vmr, "command.load", cvalue);
|
||||||
Sleep(300);
|
Sleep(300);
|
||||||
clear_dirty(vmr);
|
clear(vmr, is_pdirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iflag)
|
if (iflag)
|
||||||
@ -237,6 +237,7 @@ enum kind set_kind(char *kval)
|
|||||||
* Each line is passed to parse_input()
|
* Each line is passed to parse_input()
|
||||||
*
|
*
|
||||||
* @param vmr Pointer to the iVMR interface
|
* @param vmr Pointer to the iVMR interface
|
||||||
|
* @param with_prompt If true, prints the interactive prompt '>>'
|
||||||
*/
|
*/
|
||||||
void interactive(PT_VMR vmr, bool with_prompt)
|
void interactive(PT_VMR vmr, bool with_prompt)
|
||||||
{
|
{
|
||||||
@ -372,7 +373,7 @@ void parse_command(PT_VMR vmr, char *command)
|
|||||||
*/
|
*/
|
||||||
void get(PT_VMR vmr, char *command, struct result *res)
|
void get(PT_VMR vmr, char *command, struct result *res)
|
||||||
{
|
{
|
||||||
clear_dirty(vmr);
|
clear(vmr, is_pdirty);
|
||||||
if (get_parameter_float(vmr, command, &res->val.f) != 0)
|
if (get_parameter_float(vmr, command, &res->val.f) != 0)
|
||||||
{
|
{
|
||||||
res->type = STRING_T;
|
res->type = STRING_T;
|
||||||
|
@ -61,7 +61,7 @@ long login(PT_VMR vmr, int kind)
|
|||||||
|
|
||||||
if (rep == 0)
|
if (rep == 0)
|
||||||
{
|
{
|
||||||
clear_dirty(vmr);
|
clear(vmr, is_pdirty);
|
||||||
}
|
}
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
@ -156,10 +156,3 @@ long macrobutton_setstatus(PT_VMR vmr, long n, float val, long mode)
|
|||||||
log_trace("VBVMR_MacroButton_SetStatus(%ld, %d, %ld)", n, (int)val, mode);
|
log_trace("VBVMR_MacroButton_SetStatus(%ld, %d, %ld)", n, (int)val, mode);
|
||||||
return vmr->VBVMR_MacroButton_SetStatus(n, val, mode);
|
return vmr->VBVMR_MacroButton_SetStatus(n, val, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_dirty(PT_VMR vmr)
|
|
||||||
{
|
|
||||||
Sleep(30);
|
|
||||||
while (is_pdirty(vmr))
|
|
||||||
Sleep(1);
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user