1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 03:46:40 +00:00

add hidread function to script

This commit is contained in:
suchmememanyskill 2021-09-16 23:44:20 +02:00
parent b5f5701e58
commit 785549a9c8

View file

@ -234,13 +234,8 @@ char *powNames[] = {
"volminus",
};
// Takes [int]. Returns dict[a,b,x,y,down,up,right,left,power,volplus,volminus,raw]. int: mask for hidWaitMask
ClassFunction(stdPauseMask){
Variable_t *hidToVar(u32 raw){
Variable_t ret = {.variableType = DictionaryClass, .dictionary.vector = newVec(sizeof(Dict_t), 9)};
Input_t *i = hidWaitMask((u32)getIntValue(*args));
u32 raw = i->buttons;
addIntToDict(&ret, "raw", raw);
for (int i = 0; i < ARRAY_SIZE(abxyNames); i++){
@ -265,6 +260,19 @@ ClassFunction(stdPauseMask){
return copyVariableToPtr(ret);
}
ClassFunction(stdRead){
Input_t *i = hidRead();
u32 raw = i->buttons;
return hidToVar(raw);
}
// Takes [int]. Returns dict[a,b,x,y,down,up,right,left,power,volplus,volminus,raw]. int: mask for hidWaitMask
ClassFunction(stdPauseMask){
Input_t *i = hidWaitMask((u32)getIntValue(*args));
u32 raw = i->buttons;
return hidToVar(raw);
}
// Takes none. Returns dict (same as stdPauseMask).
ClassFunction(stdPause){
Variable_t a = {.integer.value = 0xFFFFFFFF};
@ -541,6 +549,7 @@ ClassFunctionTableEntry_t standardFunctionDefenitions[] = {
{"timer", stdGetMs, 0, 0},
{"pause", stdPauseMask, 1, threeIntsStd},
{"pause", stdPause, 0, 0},
{"hidread", stdRead, 0, 0},
{"color", stdColor, 1, threeIntsStd},
{"menu", stdMenuFull, 3, menuArgsStd},
{"menu", stdMenuFull, 2, menuArgsStd},