| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#include <libconfig.h> |
| 6 |
#include "../curve.h" |
| 7 |
#include "../script.h" |
| 8 |
#include "../script_internal.h" |
| 9 |
#include "config.h" |
| 10 |
#include "utils/misc.h" |
| 11 |
static struct script *script_template__disappear(int *output_slots) { |
| 12 |
static const struct instruction instrs[] = { |
| 13 |
{.type = INST_BRANCH_ONCE, .rel = 59}, |
| 14 |
{.type = INST_LOAD, .slot = 14}, |
| 15 |
{.type = INST_LOAD, .slot = 13}, |
| 16 |
{.type = INST_OP, .op = OP_SUB}, |
| 17 |
{.type = INST_LOAD, .slot = 11}, |
| 18 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 19 |
{.type = INST_OP, .op = OP_SUB}, |
| 20 |
{.type = INST_LOAD, .slot = 15}, |
| 21 |
{.type = INST_OP, .op = OP_DIV}, |
| 22 |
{ |
| 23 |
.type = INST_CURVE, |
| 24 |
.curve = {.type = CURVE_LINEAR}, |
| 25 |
}, |
| 26 |
{.type = INST_OP, .op = OP_MUL}, |
| 27 |
{.type = INST_LOAD, .slot = 13}, |
| 28 |
{.type = INST_OP, .op = OP_ADD}, |
| 29 |
{.type = INST_STORE, .slot = 0}, |
| 30 |
{.type = INST_LOAD, .slot = 0}, |
| 31 |
{.type = INST_STORE, .slot = 1}, |
| 32 |
{.type = INST_LOAD, .slot = 0}, |
| 33 |
{.type = INST_STORE, .slot = 2}, |
| 34 |
{.type = INST_LOAD, .slot = 17}, |
| 35 |
{.type = INST_LOAD, .slot = 16}, |
| 36 |
{.type = INST_OP, .op = OP_SUB}, |
| 37 |
{.type = INST_LOAD, .slot = 11}, |
| 38 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 39 |
{.type = INST_OP, .op = OP_SUB}, |
| 40 |
{.type = INST_LOAD, .slot = 18}, |
| 41 |
{.type = INST_OP, .op = OP_DIV}, |
| 42 |
{ |
| 43 |
.type = INST_CURVE, |
| 44 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 45 |
.bezier = {.ax = -0x1.4cccccccccccep-1, |
| 46 |
.bx = 0x1.051eb851eb852p+0, |
| 47 |
.cx = 0x1.428f5c28f5c2ap-1, |
| 48 |
.ay = -0x1.47ae147ae148p-6, |
| 49 |
.by = 0x1.eb851eb851eb8p-1, |
| 50 |
.cy = 0x1.eb851eb851ebap-5}}, |
| 51 |
}, |
| 52 |
{.type = INST_OP, .op = OP_MUL}, |
| 53 |
{.type = INST_LOAD, .slot = 16}, |
| 54 |
{.type = INST_OP, .op = OP_ADD}, |
| 55 |
{.type = INST_STORE, .slot = 5}, |
| 56 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 57 |
{.type = INST_LOAD, .slot = 5}, |
| 58 |
{.type = INST_OP, .op = OP_SUB}, |
| 59 |
{.type = INST_IMM, .imm = 0x1p+1}, |
| 60 |
{.type = INST_OP, .op = OP_DIV}, |
| 61 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 62 |
{.type = INST_OP, .op = OP_MUL}, |
| 63 |
{.type = INST_STORE, .slot = 3}, |
| 64 |
{.type = INST_LOAD, .slot = 5}, |
| 65 |
{.type = INST_STORE, .slot = 6}, |
| 66 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 67 |
{.type = INST_LOAD, .slot = 6}, |
| 68 |
{.type = INST_OP, .op = OP_SUB}, |
| 69 |
{.type = INST_IMM, .imm = 0x1p+1}, |
| 70 |
{.type = INST_OP, .op = OP_DIV}, |
| 71 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 72 |
{.type = INST_OP, .op = OP_MUL}, |
| 73 |
{.type = INST_STORE, .slot = 4}, |
| 74 |
{.type = INST_LOAD, .slot = 5}, |
| 75 |
{.type = INST_STORE, .slot = 7}, |
| 76 |
{.type = INST_LOAD, .slot = 6}, |
| 77 |
{.type = INST_STORE, .slot = 8}, |
| 78 |
{.type = INST_LOAD, .slot = 3}, |
| 79 |
{.type = INST_STORE, .slot = 9}, |
| 80 |
{.type = INST_LOAD, .slot = 4}, |
| 81 |
{.type = INST_STORE, .slot = 10}, |
| 82 |
{.type = INST_BRANCH_ONCE, .rel = 15}, |
| 83 |
{.type = INST_HALT}, |
| 84 |
{.type = INST_LOAD_CTX, .ctx = 64}, |
| 85 |
{.type = INST_STORE_OVER_NAN, .slot = 13}, |
| 86 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 87 |
{.type = INST_STORE, .slot = 15}, |
| 88 |
{.type = INST_LOAD_CTX, .ctx = 72}, |
| 89 |
{.type = INST_STORE, .slot = 14}, |
| 90 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 91 |
{.type = INST_STORE_OVER_NAN, .slot = 16}, |
| 92 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 93 |
{.type = INST_STORE, .slot = 18}, |
| 94 |
{.type = INST_LOAD_CTX, .ctx = 1073741828}, |
| 95 |
{.type = INST_STORE, .slot = 17}, |
| 96 |
{.type = INST_BRANCH, .rel = -70}, |
| 97 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 98 |
{.type = INST_STORE, .slot = 12}, |
| 99 |
{.type = INST_LOAD, .slot = 15}, |
| 100 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 101 |
{.type = INST_OP, .op = OP_ADD}, |
| 102 |
{.type = INST_LOAD, .slot = 12}, |
| 103 |
{.type = INST_OP, .op = OP_MAX}, |
| 104 |
{.type = INST_STORE, .slot = 12}, |
| 105 |
{.type = INST_LOAD, .slot = 18}, |
| 106 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 107 |
{.type = INST_OP, .op = OP_ADD}, |
| 108 |
{.type = INST_LOAD, .slot = 12}, |
| 109 |
{.type = INST_OP, .op = OP_MAX}, |
| 110 |
{.type = INST_STORE, .slot = 12}, |
| 111 |
{.type = INST_HALT}, |
| 112 |
}; |
| 113 |
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs)); |
| 114 |
ret->len = ARR_SIZE(instrs); |
| 115 |
ret->elapsed_slot = 11; |
| 116 |
ret->n_slots = 19; |
| 117 |
ret->stack_size = 3; |
| 118 |
ret->vars = NULL; |
| 119 |
ret->overrides = NULL; |
| 120 |
memcpy(ret->instrs, instrs, sizeof(instrs)); |
| 121 |
{ |
| 122 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 123 |
*var = (struct variable_allocation){ |
| 124 |
.name = strdup("opacity"), .slot = 0, .index = 0}; |
| 125 |
HASH_ADD_STR(ret->vars, name, var); |
| 126 |
} |
| 127 |
{ |
| 128 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 129 |
*var = (struct variable_allocation){ |
| 130 |
.name = strdup("blur-opacity"), .slot = 1, .index = 1}; |
| 131 |
HASH_ADD_STR(ret->vars, name, var); |
| 132 |
} |
| 133 |
{ |
| 134 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 135 |
*var = (struct variable_allocation){ |
| 136 |
.name = strdup("shadow-opacity"), .slot = 2, .index = 2}; |
| 137 |
HASH_ADD_STR(ret->vars, name, var); |
| 138 |
} |
| 139 |
{ |
| 140 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 141 |
*var = (struct variable_allocation){ |
| 142 |
.name = strdup("offset-x"), .slot = 3, .index = 3}; |
| 143 |
HASH_ADD_STR(ret->vars, name, var); |
| 144 |
} |
| 145 |
{ |
| 146 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 147 |
*var = (struct variable_allocation){ |
| 148 |
.name = strdup("offset-y"), .slot = 4, .index = 4}; |
| 149 |
HASH_ADD_STR(ret->vars, name, var); |
| 150 |
} |
| 151 |
{ |
| 152 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 153 |
*var = (struct variable_allocation){ |
| 154 |
.name = strdup("scale-x"), .slot = 5, .index = 5}; |
| 155 |
HASH_ADD_STR(ret->vars, name, var); |
| 156 |
} |
| 157 |
{ |
| 158 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 159 |
*var = (struct variable_allocation){ |
| 160 |
.name = strdup("scale-y"), .slot = 6, .index = 6}; |
| 161 |
HASH_ADD_STR(ret->vars, name, var); |
| 162 |
} |
| 163 |
{ |
| 164 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 165 |
*var = (struct variable_allocation){ |
| 166 |
.name = strdup("shadow-scale-x"), .slot = 7, .index = 7}; |
| 167 |
HASH_ADD_STR(ret->vars, name, var); |
| 168 |
} |
| 169 |
{ |
| 170 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 171 |
*var = (struct variable_allocation){ |
| 172 |
.name = strdup("shadow-scale-y"), .slot = 8, .index = 8}; |
| 173 |
HASH_ADD_STR(ret->vars, name, var); |
| 174 |
} |
| 175 |
{ |
| 176 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 177 |
*var = (struct variable_allocation){ |
| 178 |
.name = strdup("shadow-offset-x"), .slot = 9, .index = 9}; |
| 179 |
HASH_ADD_STR(ret->vars, name, var); |
| 180 |
} |
| 181 |
{ |
| 182 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 183 |
*var = (struct variable_allocation){ |
| 184 |
.name = strdup("shadow-offset-y"), .slot = 10, .index = 10}; |
| 185 |
HASH_ADD_STR(ret->vars, name, var); |
| 186 |
} |
| 187 |
{ |
| 188 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 189 |
*override = (struct overridable_slot){.name = strdup("opacity"), .slot = 13}; |
| 190 |
HASH_ADD_STR(ret->overrides, name, override); |
| 191 |
} |
| 192 |
{ |
| 193 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 194 |
*override = (struct overridable_slot){.name = strdup("scale-x"), .slot = 16}; |
| 195 |
HASH_ADD_STR(ret->overrides, name, override); |
| 196 |
} |
| 197 |
output_slots[0] = 3; |
| 198 |
output_slots[1] = 4; |
| 199 |
output_slots[2] = 9; |
| 200 |
output_slots[3] = 10; |
| 201 |
output_slots[4] = 0; |
| 202 |
output_slots[5] = 1; |
| 203 |
output_slots[6] = 2; |
| 204 |
output_slots[7] = 5; |
| 205 |
output_slots[8] = 6; |
| 206 |
output_slots[9] = 7; |
| 207 |
output_slots[10] = 8; |
| 208 |
output_slots[11] = -1; |
| 209 |
output_slots[12] = -1; |
| 210 |
output_slots[13] = -1; |
| 211 |
output_slots[14] = -1; |
| 212 |
output_slots[15] = -1; |
| 213 |
output_slots[16] = -1; |
| 214 |
output_slots[17] = -1; |
| 215 |
output_slots[18] = -1; |
| 216 |
return ret; |
| 217 |
} |
| 218 |
|
| 219 |
static bool |
| 220 |
win_script_preset__disappear(struct win_script *output, config_setting_t *setting) { |
| 221 |
output->script = script_template__disappear(output->output_indices); |
| 222 |
double knob_duration = 0x1.999999999999ap-3; |
| 223 |
config_setting_lookup_float(setting, "duration", &knob_duration); |
| 224 |
double knob_scale = 0x1.e666666666666p-1; |
| 225 |
config_setting_lookup_float(setting, "scale", &knob_scale); |
| 226 |
struct script_specialization_context spec[] = { |
| 227 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 0, .value = knob_duration}, |
| 228 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 4, .value = knob_scale}, |
| 229 |
}; |
| 230 |
script_specialize(output->script, spec, ARR_SIZE(spec)); |
| 231 |
return true; |
| 232 |
} |
| 233 |
static struct script *script_template__appear(int *output_slots) { |
| 234 |
static const struct instruction instrs[] = { |
| 235 |
{.type = INST_BRANCH_ONCE, .rel = 59}, |
| 236 |
{.type = INST_LOAD, .slot = 14}, |
| 237 |
{.type = INST_LOAD, .slot = 13}, |
| 238 |
{.type = INST_OP, .op = OP_SUB}, |
| 239 |
{.type = INST_LOAD, .slot = 11}, |
| 240 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 241 |
{.type = INST_OP, .op = OP_SUB}, |
| 242 |
{.type = INST_LOAD, .slot = 15}, |
| 243 |
{.type = INST_OP, .op = OP_DIV}, |
| 244 |
{ |
| 245 |
.type = INST_CURVE, |
| 246 |
.curve = {.type = CURVE_LINEAR}, |
| 247 |
}, |
| 248 |
{.type = INST_OP, .op = OP_MUL}, |
| 249 |
{.type = INST_LOAD, .slot = 13}, |
| 250 |
{.type = INST_OP, .op = OP_ADD}, |
| 251 |
{.type = INST_STORE, .slot = 0}, |
| 252 |
{.type = INST_LOAD, .slot = 0}, |
| 253 |
{.type = INST_STORE, .slot = 1}, |
| 254 |
{.type = INST_LOAD, .slot = 0}, |
| 255 |
{.type = INST_STORE, .slot = 2}, |
| 256 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 257 |
{.type = INST_LOAD, .slot = 16}, |
| 258 |
{.type = INST_OP, .op = OP_SUB}, |
| 259 |
{.type = INST_LOAD, .slot = 11}, |
| 260 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 261 |
{.type = INST_OP, .op = OP_SUB}, |
| 262 |
{.type = INST_LOAD, .slot = 17}, |
| 263 |
{.type = INST_OP, .op = OP_DIV}, |
| 264 |
{ |
| 265 |
.type = INST_CURVE, |
| 266 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 267 |
.bezier = {.ax = -0x1.4cccccccccccep-1, |
| 268 |
.bx = 0x1.dc28f5c28f5c3p-1, |
| 269 |
.cx = 0x1.70a3d70a3d70bp-1, |
| 270 |
.ay = -0x1.47ae147ae14p-6, |
| 271 |
.by = -0x1.cccccccccccd4p-1, |
| 272 |
.cy = 0x1.eb851eb851ebap+0}}, |
| 273 |
}, |
| 274 |
{.type = INST_OP, .op = OP_MUL}, |
| 275 |
{.type = INST_LOAD, .slot = 16}, |
| 276 |
{.type = INST_OP, .op = OP_ADD}, |
| 277 |
{.type = INST_STORE, .slot = 5}, |
| 278 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 279 |
{.type = INST_LOAD, .slot = 5}, |
| 280 |
{.type = INST_OP, .op = OP_SUB}, |
| 281 |
{.type = INST_IMM, .imm = 0x1p+1}, |
| 282 |
{.type = INST_OP, .op = OP_DIV}, |
| 283 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 284 |
{.type = INST_OP, .op = OP_MUL}, |
| 285 |
{.type = INST_STORE, .slot = 3}, |
| 286 |
{.type = INST_LOAD, .slot = 5}, |
| 287 |
{.type = INST_STORE, .slot = 6}, |
| 288 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 289 |
{.type = INST_LOAD, .slot = 6}, |
| 290 |
{.type = INST_OP, .op = OP_SUB}, |
| 291 |
{.type = INST_IMM, .imm = 0x1p+1}, |
| 292 |
{.type = INST_OP, .op = OP_DIV}, |
| 293 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 294 |
{.type = INST_OP, .op = OP_MUL}, |
| 295 |
{.type = INST_STORE, .slot = 4}, |
| 296 |
{.type = INST_LOAD, .slot = 5}, |
| 297 |
{.type = INST_STORE, .slot = 7}, |
| 298 |
{.type = INST_LOAD, .slot = 6}, |
| 299 |
{.type = INST_STORE, .slot = 8}, |
| 300 |
{.type = INST_LOAD, .slot = 3}, |
| 301 |
{.type = INST_STORE, .slot = 9}, |
| 302 |
{.type = INST_LOAD, .slot = 4}, |
| 303 |
{.type = INST_STORE, .slot = 10}, |
| 304 |
{.type = INST_BRANCH_ONCE, .rel = 13}, |
| 305 |
{.type = INST_HALT}, |
| 306 |
{.type = INST_LOAD_CTX, .ctx = 64}, |
| 307 |
{.type = INST_STORE_OVER_NAN, .slot = 13}, |
| 308 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 309 |
{.type = INST_STORE, .slot = 15}, |
| 310 |
{.type = INST_LOAD_CTX, .ctx = 72}, |
| 311 |
{.type = INST_STORE, .slot = 14}, |
| 312 |
{.type = INST_LOAD_CTX, .ctx = 1073741828}, |
| 313 |
{.type = INST_STORE_OVER_NAN, .slot = 16}, |
| 314 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 315 |
{.type = INST_STORE, .slot = 17}, |
| 316 |
{.type = INST_BRANCH, .rel = -68}, |
| 317 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 318 |
{.type = INST_STORE, .slot = 12}, |
| 319 |
{.type = INST_LOAD, .slot = 15}, |
| 320 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 321 |
{.type = INST_OP, .op = OP_ADD}, |
| 322 |
{.type = INST_LOAD, .slot = 12}, |
| 323 |
{.type = INST_OP, .op = OP_MAX}, |
| 324 |
{.type = INST_STORE, .slot = 12}, |
| 325 |
{.type = INST_LOAD, .slot = 17}, |
| 326 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 327 |
{.type = INST_OP, .op = OP_ADD}, |
| 328 |
{.type = INST_LOAD, .slot = 12}, |
| 329 |
{.type = INST_OP, .op = OP_MAX}, |
| 330 |
{.type = INST_STORE, .slot = 12}, |
| 331 |
{.type = INST_HALT}, |
| 332 |
}; |
| 333 |
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs)); |
| 334 |
ret->len = ARR_SIZE(instrs); |
| 335 |
ret->elapsed_slot = 11; |
| 336 |
ret->n_slots = 18; |
| 337 |
ret->stack_size = 3; |
| 338 |
ret->vars = NULL; |
| 339 |
ret->overrides = NULL; |
| 340 |
memcpy(ret->instrs, instrs, sizeof(instrs)); |
| 341 |
{ |
| 342 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 343 |
*var = (struct variable_allocation){ |
| 344 |
.name = strdup("opacity"), .slot = 0, .index = 0}; |
| 345 |
HASH_ADD_STR(ret->vars, name, var); |
| 346 |
} |
| 347 |
{ |
| 348 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 349 |
*var = (struct variable_allocation){ |
| 350 |
.name = strdup("blur-opacity"), .slot = 1, .index = 1}; |
| 351 |
HASH_ADD_STR(ret->vars, name, var); |
| 352 |
} |
| 353 |
{ |
| 354 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 355 |
*var = (struct variable_allocation){ |
| 356 |
.name = strdup("shadow-opacity"), .slot = 2, .index = 2}; |
| 357 |
HASH_ADD_STR(ret->vars, name, var); |
| 358 |
} |
| 359 |
{ |
| 360 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 361 |
*var = (struct variable_allocation){ |
| 362 |
.name = strdup("offset-x"), .slot = 3, .index = 3}; |
| 363 |
HASH_ADD_STR(ret->vars, name, var); |
| 364 |
} |
| 365 |
{ |
| 366 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 367 |
*var = (struct variable_allocation){ |
| 368 |
.name = strdup("offset-y"), .slot = 4, .index = 4}; |
| 369 |
HASH_ADD_STR(ret->vars, name, var); |
| 370 |
} |
| 371 |
{ |
| 372 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 373 |
*var = (struct variable_allocation){ |
| 374 |
.name = strdup("scale-x"), .slot = 5, .index = 5}; |
| 375 |
HASH_ADD_STR(ret->vars, name, var); |
| 376 |
} |
| 377 |
{ |
| 378 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 379 |
*var = (struct variable_allocation){ |
| 380 |
.name = strdup("scale-y"), .slot = 6, .index = 6}; |
| 381 |
HASH_ADD_STR(ret->vars, name, var); |
| 382 |
} |
| 383 |
{ |
| 384 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 385 |
*var = (struct variable_allocation){ |
| 386 |
.name = strdup("shadow-scale-x"), .slot = 7, .index = 7}; |
| 387 |
HASH_ADD_STR(ret->vars, name, var); |
| 388 |
} |
| 389 |
{ |
| 390 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 391 |
*var = (struct variable_allocation){ |
| 392 |
.name = strdup("shadow-scale-y"), .slot = 8, .index = 8}; |
| 393 |
HASH_ADD_STR(ret->vars, name, var); |
| 394 |
} |
| 395 |
{ |
| 396 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 397 |
*var = (struct variable_allocation){ |
| 398 |
.name = strdup("shadow-offset-x"), .slot = 9, .index = 9}; |
| 399 |
HASH_ADD_STR(ret->vars, name, var); |
| 400 |
} |
| 401 |
{ |
| 402 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 403 |
*var = (struct variable_allocation){ |
| 404 |
.name = strdup("shadow-offset-y"), .slot = 10, .index = 10}; |
| 405 |
HASH_ADD_STR(ret->vars, name, var); |
| 406 |
} |
| 407 |
{ |
| 408 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 409 |
*override = (struct overridable_slot){.name = strdup("opacity"), .slot = 13}; |
| 410 |
HASH_ADD_STR(ret->overrides, name, override); |
| 411 |
} |
| 412 |
{ |
| 413 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 414 |
*override = (struct overridable_slot){.name = strdup("scale-x"), .slot = 16}; |
| 415 |
HASH_ADD_STR(ret->overrides, name, override); |
| 416 |
} |
| 417 |
output_slots[0] = 3; |
| 418 |
output_slots[1] = 4; |
| 419 |
output_slots[2] = 9; |
| 420 |
output_slots[3] = 10; |
| 421 |
output_slots[4] = 0; |
| 422 |
output_slots[5] = 1; |
| 423 |
output_slots[6] = 2; |
| 424 |
output_slots[7] = 5; |
| 425 |
output_slots[8] = 6; |
| 426 |
output_slots[9] = 7; |
| 427 |
output_slots[10] = 8; |
| 428 |
output_slots[11] = -1; |
| 429 |
output_slots[12] = -1; |
| 430 |
output_slots[13] = -1; |
| 431 |
output_slots[14] = -1; |
| 432 |
output_slots[15] = -1; |
| 433 |
output_slots[16] = -1; |
| 434 |
output_slots[17] = -1; |
| 435 |
output_slots[18] = -1; |
| 436 |
return ret; |
| 437 |
} |
| 438 |
|
| 439 |
static bool win_script_preset__appear(struct win_script *output, config_setting_t *setting) { |
| 440 |
output->script = script_template__appear(output->output_indices); |
| 441 |
double knob_duration = 0x1.999999999999ap-3; |
| 442 |
config_setting_lookup_float(setting, "duration", &knob_duration); |
| 443 |
double knob_scale = 0x1.e666666666666p-1; |
| 444 |
config_setting_lookup_float(setting, "scale", &knob_scale); |
| 445 |
struct script_specialization_context spec[] = { |
| 446 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 0, .value = knob_duration}, |
| 447 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 4, .value = knob_scale}, |
| 448 |
}; |
| 449 |
script_specialize(output->script, spec, ARR_SIZE(spec)); |
| 450 |
return true; |
| 451 |
} |
| 452 |
static struct script *script_template__slide_out(int *output_slots) { |
| 453 |
static const struct instruction instrs[] = { |
| 454 |
{.type = INST_BRANCH_ONCE, .rel = 55}, |
| 455 |
{.type = INST_LOAD, .slot = 15}, |
| 456 |
{.type = INST_LOAD, .slot = 14}, |
| 457 |
{.type = INST_OP, .op = OP_SUB}, |
| 458 |
{.type = INST_LOAD, .slot = 12}, |
| 459 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 460 |
{.type = INST_OP, .op = OP_SUB}, |
| 461 |
{.type = INST_LOAD, .slot = 16}, |
| 462 |
{.type = INST_OP, .op = OP_DIV}, |
| 463 |
{ |
| 464 |
.type = INST_CURVE, |
| 465 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 466 |
.bezier = {.ax = -0x1.4cccccccccccep-1, |
| 467 |
.bx = 0x1.051eb851eb852p+0, |
| 468 |
.cx = 0x1.428f5c28f5c2ap-1, |
| 469 |
.ay = -0x1.47ae147ae148p-6, |
| 470 |
.by = 0x1.eb851eb851eb8p-1, |
| 471 |
.cy = 0x1.eb851eb851ebap-5}}, |
| 472 |
}, |
| 473 |
{.type = INST_OP, .op = OP_MUL}, |
| 474 |
{.type = INST_LOAD, .slot = 14}, |
| 475 |
{.type = INST_OP, .op = OP_ADD}, |
| 476 |
{.type = INST_STORE, .slot = 0}, |
| 477 |
{.type = INST_LOAD, .slot = 0}, |
| 478 |
{.type = INST_LOAD_CTX, .ctx = 1073741836}, |
| 479 |
{.type = INST_OP, .op = OP_MUL}, |
| 480 |
{.type = INST_STORE, .slot = 1}, |
| 481 |
{.type = INST_LOAD, .slot = 0}, |
| 482 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 483 |
{.type = INST_LOAD_CTX, .ctx = 1073741836}, |
| 484 |
{.type = INST_OP, .op = OP_SUB}, |
| 485 |
{.type = INST_OP, .op = OP_MUL}, |
| 486 |
{.type = INST_STORE, .slot = 2}, |
| 487 |
{.type = INST_LOAD, .slot = 1}, |
| 488 |
{.type = INST_STORE, .slot = 3}, |
| 489 |
{.type = INST_LOAD, .slot = 2}, |
| 490 |
{.type = INST_STORE, .slot = 4}, |
| 491 |
{.type = INST_LOAD_CTX, .ctx = 0}, |
| 492 |
{.type = INST_STORE, .slot = 5}, |
| 493 |
{.type = INST_LOAD_CTX, .ctx = 8}, |
| 494 |
{.type = INST_STORE, .slot = 6}, |
| 495 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 496 |
{.type = INST_STORE, .slot = 7}, |
| 497 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 498 |
{.type = INST_STORE, .slot = 8}, |
| 499 |
{.type = INST_LOAD, .slot = 18}, |
| 500 |
{.type = INST_LOAD, .slot = 17}, |
| 501 |
{.type = INST_OP, .op = OP_SUB}, |
| 502 |
{.type = INST_LOAD, .slot = 12}, |
| 503 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 504 |
{.type = INST_OP, .op = OP_SUB}, |
| 505 |
{.type = INST_LOAD, .slot = 19}, |
| 506 |
{.type = INST_OP, .op = OP_DIV}, |
| 507 |
{ |
| 508 |
.type = INST_CURVE, |
| 509 |
.curve = {.type = CURVE_LINEAR}, |
| 510 |
}, |
| 511 |
{.type = INST_OP, .op = OP_MUL}, |
| 512 |
{.type = INST_LOAD, .slot = 17}, |
| 513 |
{.type = INST_OP, .op = OP_ADD}, |
| 514 |
{.type = INST_STORE, .slot = 9}, |
| 515 |
{.type = INST_LOAD, .slot = 9}, |
| 516 |
{.type = INST_STORE, .slot = 10}, |
| 517 |
{.type = INST_LOAD, .slot = 9}, |
| 518 |
{.type = INST_STORE, .slot = 11}, |
| 519 |
{.type = INST_BRANCH_ONCE, .rel = 21}, |
| 520 |
{.type = INST_HALT}, |
| 521 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 522 |
{.type = INST_STORE_OVER_NAN, .slot = 14}, |
| 523 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 524 |
{.type = INST_STORE, .slot = 16}, |
| 525 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 526 |
{.type = INST_LOAD_CTX, .ctx = 1073741828}, |
| 527 |
{.type = INST_OP, .op = OP_MUL}, |
| 528 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 529 |
{.type = INST_LOAD_CTX, .ctx = 1073741832}, |
| 530 |
{.type = INST_OP, .op = OP_MUL}, |
| 531 |
{.type = INST_OP, .op = OP_ADD}, |
| 532 |
{.type = INST_STORE, .slot = 15}, |
| 533 |
{.type = INST_LOAD_CTX, .ctx = 64}, |
| 534 |
{.type = INST_STORE_OVER_NAN, .slot = 17}, |
| 535 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 536 |
{.type = INST_STORE, .slot = 19}, |
| 537 |
{.type = INST_LOAD_CTX, .ctx = 64}, |
| 538 |
{.type = INST_STORE, .slot = 18}, |
| 539 |
{.type = INST_BRANCH, .rel = -72}, |
| 540 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 541 |
{.type = INST_STORE, .slot = 13}, |
| 542 |
{.type = INST_LOAD, .slot = 16}, |
| 543 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 544 |
{.type = INST_OP, .op = OP_ADD}, |
| 545 |
{.type = INST_LOAD, .slot = 13}, |
| 546 |
{.type = INST_OP, .op = OP_MAX}, |
| 547 |
{.type = INST_STORE, .slot = 13}, |
| 548 |
{.type = INST_LOAD, .slot = 19}, |
| 549 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 550 |
{.type = INST_OP, .op = OP_ADD}, |
| 551 |
{.type = INST_LOAD, .slot = 13}, |
| 552 |
{.type = INST_OP, .op = OP_MAX}, |
| 553 |
{.type = INST_STORE, .slot = 13}, |
| 554 |
{.type = INST_HALT}, |
| 555 |
}; |
| 556 |
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs)); |
| 557 |
ret->len = ARR_SIZE(instrs); |
| 558 |
ret->elapsed_slot = 12; |
| 559 |
ret->n_slots = 20; |
| 560 |
ret->stack_size = 3; |
| 561 |
ret->vars = NULL; |
| 562 |
ret->overrides = NULL; |
| 563 |
memcpy(ret->instrs, instrs, sizeof(instrs)); |
| 564 |
{ |
| 565 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 566 |
*var = (struct variable_allocation){ |
| 567 |
.name = strdup("v-timing"), .slot = 0, .index = 0}; |
| 568 |
HASH_ADD_STR(ret->vars, name, var); |
| 569 |
} |
| 570 |
{ |
| 571 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 572 |
*var = (struct variable_allocation){ |
| 573 |
.name = strdup("offset-x"), .slot = 1, .index = 1}; |
| 574 |
HASH_ADD_STR(ret->vars, name, var); |
| 575 |
} |
| 576 |
{ |
| 577 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 578 |
*var = (struct variable_allocation){ |
| 579 |
.name = strdup("offset-y"), .slot = 2, .index = 2}; |
| 580 |
HASH_ADD_STR(ret->vars, name, var); |
| 581 |
} |
| 582 |
{ |
| 583 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 584 |
*var = (struct variable_allocation){ |
| 585 |
.name = strdup("shadow-offset-x"), .slot = 3, .index = 3}; |
| 586 |
HASH_ADD_STR(ret->vars, name, var); |
| 587 |
} |
| 588 |
{ |
| 589 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 590 |
*var = (struct variable_allocation){ |
| 591 |
.name = strdup("shadow-offset-y"), .slot = 4, .index = 4}; |
| 592 |
HASH_ADD_STR(ret->vars, name, var); |
| 593 |
} |
| 594 |
{ |
| 595 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 596 |
*var = (struct variable_allocation){ |
| 597 |
.name = strdup("crop-x"), .slot = 5, .index = 5}; |
| 598 |
HASH_ADD_STR(ret->vars, name, var); |
| 599 |
} |
| 600 |
{ |
| 601 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 602 |
*var = (struct variable_allocation){ |
| 603 |
.name = strdup("crop-y"), .slot = 6, .index = 6}; |
| 604 |
HASH_ADD_STR(ret->vars, name, var); |
| 605 |
} |
| 606 |
{ |
| 607 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 608 |
*var = (struct variable_allocation){ |
| 609 |
.name = strdup("crop-width"), .slot = 7, .index = 7}; |
| 610 |
HASH_ADD_STR(ret->vars, name, var); |
| 611 |
} |
| 612 |
{ |
| 613 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 614 |
*var = (struct variable_allocation){ |
| 615 |
.name = strdup("crop-height"), .slot = 8, .index = 8}; |
| 616 |
HASH_ADD_STR(ret->vars, name, var); |
| 617 |
} |
| 618 |
{ |
| 619 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 620 |
*var = (struct variable_allocation){ |
| 621 |
.name = strdup("opacity"), .slot = 9, .index = 9}; |
| 622 |
HASH_ADD_STR(ret->vars, name, var); |
| 623 |
} |
| 624 |
{ |
| 625 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 626 |
*var = (struct variable_allocation){ |
| 627 |
.name = strdup("blur-opacity"), .slot = 10, .index = 10}; |
| 628 |
HASH_ADD_STR(ret->vars, name, var); |
| 629 |
} |
| 630 |
{ |
| 631 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 632 |
*var = (struct variable_allocation){ |
| 633 |
.name = strdup("shadow-opacity"), .slot = 11, .index = 11}; |
| 634 |
HASH_ADD_STR(ret->vars, name, var); |
| 635 |
} |
| 636 |
{ |
| 637 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 638 |
*override = (struct overridable_slot){.name = strdup("v-timing"), .slot = 14}; |
| 639 |
HASH_ADD_STR(ret->overrides, name, override); |
| 640 |
} |
| 641 |
{ |
| 642 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 643 |
*override = (struct overridable_slot){.name = strdup("opacity"), .slot = 17}; |
| 644 |
HASH_ADD_STR(ret->overrides, name, override); |
| 645 |
} |
| 646 |
output_slots[0] = 1; |
| 647 |
output_slots[1] = 2; |
| 648 |
output_slots[2] = 3; |
| 649 |
output_slots[3] = 4; |
| 650 |
output_slots[4] = 9; |
| 651 |
output_slots[5] = 10; |
| 652 |
output_slots[6] = 11; |
| 653 |
output_slots[7] = -1; |
| 654 |
output_slots[8] = -1; |
| 655 |
output_slots[9] = -1; |
| 656 |
output_slots[10] = -1; |
| 657 |
output_slots[11] = 5; |
| 658 |
output_slots[12] = 6; |
| 659 |
output_slots[13] = 7; |
| 660 |
output_slots[14] = 8; |
| 661 |
output_slots[15] = -1; |
| 662 |
output_slots[16] = -1; |
| 663 |
output_slots[17] = -1; |
| 664 |
output_slots[18] = -1; |
| 665 |
return ret; |
| 666 |
} |
| 667 |
|
| 668 |
static bool |
| 669 |
win_script_preset__slide_out(struct win_script *output, config_setting_t *setting) { |
| 670 |
output->script = script_template__slide_out(output->output_indices); |
| 671 |
double knob_duration = 0x1.999999999999ap-3; |
| 672 |
config_setting_lookup_float(setting, "duration", &knob_duration); |
| 673 |
const char *knob_direction = "left"; |
| 674 |
config_setting_lookup_string(setting, "direction", &knob_direction); |
| 675 |
double placeholder1_direction; |
| 676 |
double placeholder2_direction; |
| 677 |
double placeholder3_direction; |
| 678 |
if (strcmp(knob_direction, "up") == 0) { |
| 679 |
placeholder1_direction = 0x0p+0; |
| 680 |
placeholder2_direction = -0x1p+0; |
| 681 |
placeholder3_direction = 0x0p+0; |
| 682 |
} else if (strcmp(knob_direction, "down") == 0) { |
| 683 |
placeholder1_direction = 0x0p+0; |
| 684 |
placeholder2_direction = 0x1p+0; |
| 685 |
placeholder3_direction = 0x0p+0; |
| 686 |
} else if (strcmp(knob_direction, "left") == 0) { |
| 687 |
placeholder1_direction = -0x1p+0; |
| 688 |
placeholder2_direction = 0x0p+0; |
| 689 |
placeholder3_direction = 0x1p+0; |
| 690 |
} else if (strcmp(knob_direction, "right") == 0) { |
| 691 |
placeholder1_direction = 0x1p+0; |
| 692 |
placeholder2_direction = 0x0p+0; |
| 693 |
placeholder3_direction = 0x1p+0; |
| 694 |
} else { |
| 695 |
log_error("Invalid choice \"%s\" for option \"direction\". Line %d.", |
| 696 |
knob_direction, |
| 697 |
config_setting_source_line( |
| 698 |
config_setting_get_member(setting, "direction"))); |
| 699 |
log_error(" Valid ones are: \"up\", \"down\", \"left\", \"right\""); |
| 700 |
script_free(output->script); |
| 701 |
output->script = NULL; |
| 702 |
return false; |
| 703 |
} |
| 704 |
struct script_specialization_context spec[] = { |
| 705 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 0, .value = knob_duration}, |
| 706 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 4, .value = placeholder1_direction}, |
| 707 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 8, .value = placeholder2_direction}, |
| 708 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 12, .value = placeholder3_direction}, |
| 709 |
}; |
| 710 |
script_specialize(output->script, spec, ARR_SIZE(spec)); |
| 711 |
return true; |
| 712 |
} |
| 713 |
static struct script *script_template__slide_in(int *output_slots) { |
| 714 |
static const struct instruction instrs[] = { |
| 715 |
{.type = INST_BRANCH_ONCE, .rel = 38}, |
| 716 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 717 |
{.type = INST_LOAD, .slot = 11}, |
| 718 |
{.type = INST_OP, .op = OP_SUB}, |
| 719 |
{.type = INST_LOAD, .slot = 9}, |
| 720 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 721 |
{.type = INST_OP, .op = OP_SUB}, |
| 722 |
{.type = INST_LOAD, .slot = 12}, |
| 723 |
{.type = INST_OP, .op = OP_DIV}, |
| 724 |
{ |
| 725 |
.type = INST_CURVE, |
| 726 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 727 |
.bezier = {.ax = -0x1.4cccccccccccep-1, |
| 728 |
.bx = 0x1.dc28f5c28f5c3p-1, |
| 729 |
.cx = 0x1.70a3d70a3d70bp-1, |
| 730 |
.ay = -0x1.47ae147ae14p-6, |
| 731 |
.by = -0x1.cccccccccccd4p-1, |
| 732 |
.cy = 0x1.eb851eb851ebap+0}}, |
| 733 |
}, |
| 734 |
{.type = INST_OP, .op = OP_MUL}, |
| 735 |
{.type = INST_LOAD, .slot = 11}, |
| 736 |
{.type = INST_OP, .op = OP_ADD}, |
| 737 |
{.type = INST_STORE, .slot = 0}, |
| 738 |
{.type = INST_LOAD, .slot = 0}, |
| 739 |
{.type = INST_LOAD_CTX, .ctx = 1073741836}, |
| 740 |
{.type = INST_OP, .op = OP_MUL}, |
| 741 |
{.type = INST_STORE, .slot = 1}, |
| 742 |
{.type = INST_LOAD, .slot = 0}, |
| 743 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 744 |
{.type = INST_LOAD_CTX, .ctx = 1073741836}, |
| 745 |
{.type = INST_OP, .op = OP_SUB}, |
| 746 |
{.type = INST_OP, .op = OP_MUL}, |
| 747 |
{.type = INST_STORE, .slot = 2}, |
| 748 |
{.type = INST_LOAD, .slot = 1}, |
| 749 |
{.type = INST_STORE, .slot = 3}, |
| 750 |
{.type = INST_LOAD, .slot = 2}, |
| 751 |
{.type = INST_STORE, .slot = 4}, |
| 752 |
{.type = INST_LOAD_CTX, .ctx = 0}, |
| 753 |
{.type = INST_STORE, .slot = 5}, |
| 754 |
{.type = INST_LOAD_CTX, .ctx = 8}, |
| 755 |
{.type = INST_STORE, .slot = 6}, |
| 756 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 757 |
{.type = INST_STORE, .slot = 7}, |
| 758 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 759 |
{.type = INST_STORE, .slot = 8}, |
| 760 |
{.type = INST_BRANCH_ONCE, .rel = 13}, |
| 761 |
{.type = INST_HALT}, |
| 762 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 763 |
{.type = INST_LOAD_CTX, .ctx = 1073741828}, |
| 764 |
{.type = INST_OP, .op = OP_MUL}, |
| 765 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 766 |
{.type = INST_LOAD_CTX, .ctx = 1073741832}, |
| 767 |
{.type = INST_OP, .op = OP_MUL}, |
| 768 |
{.type = INST_OP, .op = OP_ADD}, |
| 769 |
{.type = INST_STORE_OVER_NAN, .slot = 11}, |
| 770 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 771 |
{.type = INST_STORE, .slot = 12}, |
| 772 |
{.type = INST_BRANCH, .rel = -47}, |
| 773 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 774 |
{.type = INST_STORE, .slot = 10}, |
| 775 |
{.type = INST_LOAD, .slot = 12}, |
| 776 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 777 |
{.type = INST_OP, .op = OP_ADD}, |
| 778 |
{.type = INST_LOAD, .slot = 10}, |
| 779 |
{.type = INST_OP, .op = OP_MAX}, |
| 780 |
{.type = INST_STORE, .slot = 10}, |
| 781 |
{.type = INST_HALT}, |
| 782 |
}; |
| 783 |
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs)); |
| 784 |
ret->len = ARR_SIZE(instrs); |
| 785 |
ret->elapsed_slot = 9; |
| 786 |
ret->n_slots = 13; |
| 787 |
ret->stack_size = 3; |
| 788 |
ret->vars = NULL; |
| 789 |
ret->overrides = NULL; |
| 790 |
memcpy(ret->instrs, instrs, sizeof(instrs)); |
| 791 |
{ |
| 792 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 793 |
*var = (struct variable_allocation){ |
| 794 |
.name = strdup("v-timing"), .slot = 0, .index = 0}; |
| 795 |
HASH_ADD_STR(ret->vars, name, var); |
| 796 |
} |
| 797 |
{ |
| 798 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 799 |
*var = (struct variable_allocation){ |
| 800 |
.name = strdup("offset-x"), .slot = 1, .index = 1}; |
| 801 |
HASH_ADD_STR(ret->vars, name, var); |
| 802 |
} |
| 803 |
{ |
| 804 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 805 |
*var = (struct variable_allocation){ |
| 806 |
.name = strdup("offset-y"), .slot = 2, .index = 2}; |
| 807 |
HASH_ADD_STR(ret->vars, name, var); |
| 808 |
} |
| 809 |
{ |
| 810 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 811 |
*var = (struct variable_allocation){ |
| 812 |
.name = strdup("shadow-offset-x"), .slot = 3, .index = 3}; |
| 813 |
HASH_ADD_STR(ret->vars, name, var); |
| 814 |
} |
| 815 |
{ |
| 816 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 817 |
*var = (struct variable_allocation){ |
| 818 |
.name = strdup("shadow-offset-y"), .slot = 4, .index = 4}; |
| 819 |
HASH_ADD_STR(ret->vars, name, var); |
| 820 |
} |
| 821 |
{ |
| 822 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 823 |
*var = (struct variable_allocation){ |
| 824 |
.name = strdup("crop-x"), .slot = 5, .index = 5}; |
| 825 |
HASH_ADD_STR(ret->vars, name, var); |
| 826 |
} |
| 827 |
{ |
| 828 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 829 |
*var = (struct variable_allocation){ |
| 830 |
.name = strdup("crop-y"), .slot = 6, .index = 6}; |
| 831 |
HASH_ADD_STR(ret->vars, name, var); |
| 832 |
} |
| 833 |
{ |
| 834 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 835 |
*var = (struct variable_allocation){ |
| 836 |
.name = strdup("crop-width"), .slot = 7, .index = 7}; |
| 837 |
HASH_ADD_STR(ret->vars, name, var); |
| 838 |
} |
| 839 |
{ |
| 840 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 841 |
*var = (struct variable_allocation){ |
| 842 |
.name = strdup("crop-height"), .slot = 8, .index = 8}; |
| 843 |
HASH_ADD_STR(ret->vars, name, var); |
| 844 |
} |
| 845 |
{ |
| 846 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 847 |
*override = (struct overridable_slot){.name = strdup("v-timing"), .slot = 11}; |
| 848 |
HASH_ADD_STR(ret->overrides, name, override); |
| 849 |
} |
| 850 |
output_slots[0] = 1; |
| 851 |
output_slots[1] = 2; |
| 852 |
output_slots[2] = 3; |
| 853 |
output_slots[3] = 4; |
| 854 |
output_slots[4] = -1; |
| 855 |
output_slots[5] = -1; |
| 856 |
output_slots[6] = -1; |
| 857 |
output_slots[7] = -1; |
| 858 |
output_slots[8] = -1; |
| 859 |
output_slots[9] = -1; |
| 860 |
output_slots[10] = -1; |
| 861 |
output_slots[11] = 5; |
| 862 |
output_slots[12] = 6; |
| 863 |
output_slots[13] = 7; |
| 864 |
output_slots[14] = 8; |
| 865 |
output_slots[15] = -1; |
| 866 |
output_slots[16] = -1; |
| 867 |
output_slots[17] = -1; |
| 868 |
output_slots[18] = -1; |
| 869 |
return ret; |
| 870 |
} |
| 871 |
|
| 872 |
static bool win_script_preset__slide_in(struct win_script *output, config_setting_t *setting) { |
| 873 |
output->script = script_template__slide_in(output->output_indices); |
| 874 |
double knob_duration = 0x1.999999999999ap-3; |
| 875 |
config_setting_lookup_float(setting, "duration", &knob_duration); |
| 876 |
const char *knob_direction = "left"; |
| 877 |
config_setting_lookup_string(setting, "direction", &knob_direction); |
| 878 |
double placeholder1_direction; |
| 879 |
double placeholder2_direction; |
| 880 |
double placeholder3_direction; |
| 881 |
if (strcmp(knob_direction, "up") == 0) { |
| 882 |
placeholder1_direction = 0x0p+0; |
| 883 |
placeholder2_direction = -0x1p+0; |
| 884 |
placeholder3_direction = 0x0p+0; |
| 885 |
} else if (strcmp(knob_direction, "down") == 0) { |
| 886 |
placeholder1_direction = 0x0p+0; |
| 887 |
placeholder2_direction = 0x1p+0; |
| 888 |
placeholder3_direction = 0x0p+0; |
| 889 |
} else if (strcmp(knob_direction, "left") == 0) { |
| 890 |
placeholder1_direction = -0x1p+0; |
| 891 |
placeholder2_direction = 0x0p+0; |
| 892 |
placeholder3_direction = 0x1p+0; |
| 893 |
} else if (strcmp(knob_direction, "right") == 0) { |
| 894 |
placeholder1_direction = 0x1p+0; |
| 895 |
placeholder2_direction = 0x0p+0; |
| 896 |
placeholder3_direction = 0x1p+0; |
| 897 |
} else { |
| 898 |
log_error("Invalid choice \"%s\" for option \"direction\". Line %d.", |
| 899 |
knob_direction, |
| 900 |
config_setting_source_line( |
| 901 |
config_setting_get_member(setting, "direction"))); |
| 902 |
log_error(" Valid ones are: \"up\", \"down\", \"left\", \"right\""); |
| 903 |
script_free(output->script); |
| 904 |
output->script = NULL; |
| 905 |
return false; |
| 906 |
} |
| 907 |
struct script_specialization_context spec[] = { |
| 908 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 0, .value = knob_duration}, |
| 909 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 4, .value = placeholder1_direction}, |
| 910 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 8, .value = placeholder2_direction}, |
| 911 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 12, .value = placeholder3_direction}, |
| 912 |
}; |
| 913 |
script_specialize(output->script, spec, ARR_SIZE(spec)); |
| 914 |
return true; |
| 915 |
} |
| 916 |
static struct script *script_template__fly_out(int *output_slots) { |
| 917 |
static const struct instruction instrs[] = { |
| 918 |
{.type = INST_BRANCH_ONCE, .rel = 47}, |
| 919 |
{.type = INST_LOAD, .slot = 11}, |
| 920 |
{.type = INST_LOAD, .slot = 10}, |
| 921 |
{.type = INST_OP, .op = OP_SUB}, |
| 922 |
{.type = INST_LOAD, .slot = 8}, |
| 923 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 924 |
{.type = INST_OP, .op = OP_SUB}, |
| 925 |
{.type = INST_LOAD, .slot = 12}, |
| 926 |
{.type = INST_OP, .op = OP_DIV}, |
| 927 |
{ |
| 928 |
.type = INST_CURVE, |
| 929 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 930 |
.bezier = {.ax = -0x1.d70a3d70a3d75p-1, |
| 931 |
.bx = 0x1.c51eb851eb854p+0, |
| 932 |
.cx = 0x1.3333333333334p-3, |
| 933 |
.ay = 0x1.2666666666666p+0, |
| 934 |
.by = -0x1.3333333333334p-3, |
| 935 |
.cy = 0x0p+0}}, |
| 936 |
}, |
| 937 |
{.type = INST_OP, .op = OP_MUL}, |
| 938 |
{.type = INST_LOAD, .slot = 10}, |
| 939 |
{.type = INST_OP, .op = OP_ADD}, |
| 940 |
{.type = INST_STORE, .slot = 0}, |
| 941 |
{.type = INST_LOAD, .slot = 0}, |
| 942 |
{.type = INST_LOAD_CTX, .ctx = 1073741836}, |
| 943 |
{.type = INST_OP, .op = OP_MUL}, |
| 944 |
{.type = INST_STORE, .slot = 1}, |
| 945 |
{.type = INST_LOAD, .slot = 0}, |
| 946 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 947 |
{.type = INST_LOAD_CTX, .ctx = 1073741836}, |
| 948 |
{.type = INST_OP, .op = OP_SUB}, |
| 949 |
{.type = INST_OP, .op = OP_MUL}, |
| 950 |
{.type = INST_STORE, .slot = 2}, |
| 951 |
{.type = INST_LOAD, .slot = 1}, |
| 952 |
{.type = INST_STORE, .slot = 3}, |
| 953 |
{.type = INST_LOAD, .slot = 2}, |
| 954 |
{.type = INST_STORE, .slot = 4}, |
| 955 |
{.type = INST_LOAD, .slot = 14}, |
| 956 |
{.type = INST_LOAD, .slot = 13}, |
| 957 |
{.type = INST_OP, .op = OP_SUB}, |
| 958 |
{.type = INST_LOAD, .slot = 8}, |
| 959 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 960 |
{.type = INST_OP, .op = OP_SUB}, |
| 961 |
{.type = INST_LOAD, .slot = 15}, |
| 962 |
{.type = INST_OP, .op = OP_DIV}, |
| 963 |
{ |
| 964 |
.type = INST_CURVE, |
| 965 |
.curve = {.type = CURVE_LINEAR}, |
| 966 |
}, |
| 967 |
{.type = INST_OP, .op = OP_MUL}, |
| 968 |
{.type = INST_LOAD, .slot = 13}, |
| 969 |
{.type = INST_OP, .op = OP_ADD}, |
| 970 |
{.type = INST_STORE, .slot = 5}, |
| 971 |
{.type = INST_LOAD, .slot = 5}, |
| 972 |
{.type = INST_STORE, .slot = 6}, |
| 973 |
{.type = INST_LOAD, .slot = 5}, |
| 974 |
{.type = INST_STORE, .slot = 7}, |
| 975 |
{.type = INST_BRANCH_ONCE, .rel = 29}, |
| 976 |
{.type = INST_HALT}, |
| 977 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 978 |
{.type = INST_STORE_OVER_NAN, .slot = 10}, |
| 979 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 980 |
{.type = INST_STORE, .slot = 12}, |
| 981 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 982 |
{.type = INST_LOAD_CTX, .ctx = 1073741832}, |
| 983 |
{.type = INST_OP, .op = OP_MUL}, |
| 984 |
{.type = INST_LOAD_CTX, .ctx = 8}, |
| 985 |
{.type = INST_LOAD_CTX, .ctx = 1073741844}, |
| 986 |
{.type = INST_OP, .op = OP_MUL}, |
| 987 |
{.type = INST_OP, .op = OP_ADD}, |
| 988 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 989 |
{.type = INST_LOAD_CTX, .ctx = 1073741828}, |
| 990 |
{.type = INST_OP, .op = OP_MUL}, |
| 991 |
{.type = INST_OP, .op = OP_ADD}, |
| 992 |
{.type = INST_LOAD_CTX, .ctx = 0}, |
| 993 |
{.type = INST_LOAD_CTX, .ctx = 1073741840}, |
| 994 |
{.type = INST_OP, .op = OP_MUL}, |
| 995 |
{.type = INST_OP, .op = OP_ADD}, |
| 996 |
{.type = INST_STORE, .slot = 11}, |
| 997 |
{.type = INST_LOAD_CTX, .ctx = 64}, |
| 998 |
{.type = INST_STORE_OVER_NAN, .slot = 13}, |
| 999 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 1000 |
{.type = INST_STORE, .slot = 15}, |
| 1001 |
{.type = INST_LOAD_CTX, .ctx = 64}, |
| 1002 |
{.type = INST_STORE, .slot = 14}, |
| 1003 |
{.type = INST_BRANCH, .rel = -72}, |
| 1004 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1005 |
{.type = INST_STORE, .slot = 9}, |
| 1006 |
{.type = INST_LOAD, .slot = 12}, |
| 1007 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1008 |
{.type = INST_OP, .op = OP_ADD}, |
| 1009 |
{.type = INST_LOAD, .slot = 9}, |
| 1010 |
{.type = INST_OP, .op = OP_MAX}, |
| 1011 |
{.type = INST_STORE, .slot = 9}, |
| 1012 |
{.type = INST_LOAD, .slot = 15}, |
| 1013 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1014 |
{.type = INST_OP, .op = OP_ADD}, |
| 1015 |
{.type = INST_LOAD, .slot = 9}, |
| 1016 |
{.type = INST_OP, .op = OP_MAX}, |
| 1017 |
{.type = INST_STORE, .slot = 9}, |
| 1018 |
{.type = INST_HALT}, |
| 1019 |
}; |
| 1020 |
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs)); |
| 1021 |
ret->len = ARR_SIZE(instrs); |
| 1022 |
ret->elapsed_slot = 8; |
| 1023 |
ret->n_slots = 16; |
| 1024 |
ret->stack_size = 3; |
| 1025 |
ret->vars = NULL; |
| 1026 |
ret->overrides = NULL; |
| 1027 |
memcpy(ret->instrs, instrs, sizeof(instrs)); |
| 1028 |
{ |
| 1029 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1030 |
*var = (struct variable_allocation){ |
| 1031 |
.name = strdup("v-timing"), .slot = 0, .index = 0}; |
| 1032 |
HASH_ADD_STR(ret->vars, name, var); |
| 1033 |
} |
| 1034 |
{ |
| 1035 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1036 |
*var = (struct variable_allocation){ |
| 1037 |
.name = strdup("offset-x"), .slot = 1, .index = 1}; |
| 1038 |
HASH_ADD_STR(ret->vars, name, var); |
| 1039 |
} |
| 1040 |
{ |
| 1041 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1042 |
*var = (struct variable_allocation){ |
| 1043 |
.name = strdup("offset-y"), .slot = 2, .index = 2}; |
| 1044 |
HASH_ADD_STR(ret->vars, name, var); |
| 1045 |
} |
| 1046 |
{ |
| 1047 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1048 |
*var = (struct variable_allocation){ |
| 1049 |
.name = strdup("shadow-offset-x"), .slot = 3, .index = 3}; |
| 1050 |
HASH_ADD_STR(ret->vars, name, var); |
| 1051 |
} |
| 1052 |
{ |
| 1053 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1054 |
*var = (struct variable_allocation){ |
| 1055 |
.name = strdup("shadow-offset-y"), .slot = 4, .index = 4}; |
| 1056 |
HASH_ADD_STR(ret->vars, name, var); |
| 1057 |
} |
| 1058 |
{ |
| 1059 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1060 |
*var = (struct variable_allocation){ |
| 1061 |
.name = strdup("opacity"), .slot = 5, .index = 5}; |
| 1062 |
HASH_ADD_STR(ret->vars, name, var); |
| 1063 |
} |
| 1064 |
{ |
| 1065 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1066 |
*var = (struct variable_allocation){ |
| 1067 |
.name = strdup("shadow-opacity"), .slot = 6, .index = 6}; |
| 1068 |
HASH_ADD_STR(ret->vars, name, var); |
| 1069 |
} |
| 1070 |
{ |
| 1071 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1072 |
*var = (struct variable_allocation){ |
| 1073 |
.name = strdup("blur-opacity"), .slot = 7, .index = 7}; |
| 1074 |
HASH_ADD_STR(ret->vars, name, var); |
| 1075 |
} |
| 1076 |
{ |
| 1077 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 1078 |
*override = (struct overridable_slot){.name = strdup("v-timing"), .slot = 10}; |
| 1079 |
HASH_ADD_STR(ret->overrides, name, override); |
| 1080 |
} |
| 1081 |
{ |
| 1082 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 1083 |
*override = (struct overridable_slot){.name = strdup("opacity"), .slot = 13}; |
| 1084 |
HASH_ADD_STR(ret->overrides, name, override); |
| 1085 |
} |
| 1086 |
output_slots[0] = 1; |
| 1087 |
output_slots[1] = 2; |
| 1088 |
output_slots[2] = 3; |
| 1089 |
output_slots[3] = 4; |
| 1090 |
output_slots[4] = 5; |
| 1091 |
output_slots[5] = 7; |
| 1092 |
output_slots[6] = 6; |
| 1093 |
output_slots[7] = -1; |
| 1094 |
output_slots[8] = -1; |
| 1095 |
output_slots[9] = -1; |
| 1096 |
output_slots[10] = -1; |
| 1097 |
output_slots[11] = -1; |
| 1098 |
output_slots[12] = -1; |
| 1099 |
output_slots[13] = -1; |
| 1100 |
output_slots[14] = -1; |
| 1101 |
output_slots[15] = -1; |
| 1102 |
output_slots[16] = -1; |
| 1103 |
output_slots[17] = -1; |
| 1104 |
output_slots[18] = -1; |
| 1105 |
return ret; |
| 1106 |
} |
| 1107 |
|
| 1108 |
static bool win_script_preset__fly_out(struct win_script *output, config_setting_t *setting) { |
| 1109 |
output->script = script_template__fly_out(output->output_indices); |
| 1110 |
double knob_duration = 0x1.999999999999ap-3; |
| 1111 |
config_setting_lookup_float(setting, "duration", &knob_duration); |
| 1112 |
const char *knob_direction = "up"; |
| 1113 |
config_setting_lookup_string(setting, "direction", &knob_direction); |
| 1114 |
double placeholder1_direction; |
| 1115 |
double placeholder2_direction; |
| 1116 |
double placeholder3_direction; |
| 1117 |
double placeholder4_direction; |
| 1118 |
double placeholder5_direction; |
| 1119 |
if (strcmp(knob_direction, "up") == 0) { |
| 1120 |
placeholder1_direction = 0x0p+0; |
| 1121 |
placeholder2_direction = -0x1p+0; |
| 1122 |
placeholder3_direction = 0x0p+0; |
| 1123 |
placeholder4_direction = 0x0p+0; |
| 1124 |
placeholder5_direction = -0x1p+0; |
| 1125 |
} else if (strcmp(knob_direction, "down") == 0) { |
| 1126 |
placeholder1_direction = 0x0p+0; |
| 1127 |
placeholder2_direction = 0x1p+0; |
| 1128 |
placeholder3_direction = 0x0p+0; |
| 1129 |
placeholder4_direction = 0x0p+0; |
| 1130 |
placeholder5_direction = 0x0p+0; |
| 1131 |
} else if (strcmp(knob_direction, "left") == 0) { |
| 1132 |
placeholder1_direction = -0x1p+0; |
| 1133 |
placeholder2_direction = 0x0p+0; |
| 1134 |
placeholder3_direction = 0x1p+0; |
| 1135 |
placeholder4_direction = -0x1p+0; |
| 1136 |
placeholder5_direction = 0x0p+0; |
| 1137 |
} else if (strcmp(knob_direction, "right") == 0) { |
| 1138 |
placeholder1_direction = 0x1p+0; |
| 1139 |
placeholder2_direction = 0x0p+0; |
| 1140 |
placeholder3_direction = 0x1p+0; |
| 1141 |
placeholder4_direction = 0x0p+0; |
| 1142 |
placeholder5_direction = 0x0p+0; |
| 1143 |
} else { |
| 1144 |
log_error("Invalid choice \"%s\" for option \"direction\". Line %d.", |
| 1145 |
knob_direction, |
| 1146 |
config_setting_source_line( |
| 1147 |
config_setting_get_member(setting, "direction"))); |
| 1148 |
log_error(" Valid ones are: \"up\", \"down\", \"left\", \"right\""); |
| 1149 |
script_free(output->script); |
| 1150 |
output->script = NULL; |
| 1151 |
return false; |
| 1152 |
} |
| 1153 |
struct script_specialization_context spec[] = { |
| 1154 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 0, .value = knob_duration}, |
| 1155 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 4, .value = placeholder1_direction}, |
| 1156 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 8, .value = placeholder2_direction}, |
| 1157 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 12, .value = placeholder3_direction}, |
| 1158 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 16, .value = placeholder4_direction}, |
| 1159 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 20, .value = placeholder5_direction}, |
| 1160 |
}; |
| 1161 |
script_specialize(output->script, spec, ARR_SIZE(spec)); |
| 1162 |
return true; |
| 1163 |
} |
| 1164 |
static struct script *script_template__fly_in(int *output_slots) { |
| 1165 |
static const struct instruction instrs[] = { |
| 1166 |
{.type = INST_BRANCH_ONCE, .rel = 30}, |
| 1167 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1168 |
{.type = INST_LOAD, .slot = 7}, |
| 1169 |
{.type = INST_OP, .op = OP_SUB}, |
| 1170 |
{.type = INST_LOAD, .slot = 5}, |
| 1171 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1172 |
{.type = INST_OP, .op = OP_SUB}, |
| 1173 |
{.type = INST_LOAD, .slot = 8}, |
| 1174 |
{.type = INST_OP, .op = OP_DIV}, |
| 1175 |
{ |
| 1176 |
.type = INST_CURVE, |
| 1177 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 1178 |
.bezier = {.ax = -0x1.0f5c28f5c28f8p-1, |
| 1179 |
.bx = 0x1.051eb851eb853p+0, |
| 1180 |
.cx = 0x1.051eb851eb852p-1, |
| 1181 |
.ay = -0x1.47ae147ae146p-4, |
| 1182 |
.by = -0x1.dc28f5c28f5ccp-1, |
| 1183 |
.cy = 0x1.0147ae147ae16p+1}}, |
| 1184 |
}, |
| 1185 |
{.type = INST_OP, .op = OP_MUL}, |
| 1186 |
{.type = INST_LOAD, .slot = 7}, |
| 1187 |
{.type = INST_OP, .op = OP_ADD}, |
| 1188 |
{.type = INST_STORE, .slot = 0}, |
| 1189 |
{.type = INST_LOAD, .slot = 0}, |
| 1190 |
{.type = INST_LOAD_CTX, .ctx = 1073741836}, |
| 1191 |
{.type = INST_OP, .op = OP_MUL}, |
| 1192 |
{.type = INST_STORE, .slot = 1}, |
| 1193 |
{.type = INST_LOAD, .slot = 0}, |
| 1194 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 1195 |
{.type = INST_LOAD_CTX, .ctx = 1073741836}, |
| 1196 |
{.type = INST_OP, .op = OP_SUB}, |
| 1197 |
{.type = INST_OP, .op = OP_MUL}, |
| 1198 |
{.type = INST_STORE, .slot = 2}, |
| 1199 |
{.type = INST_LOAD, .slot = 1}, |
| 1200 |
{.type = INST_STORE, .slot = 3}, |
| 1201 |
{.type = INST_LOAD, .slot = 2}, |
| 1202 |
{.type = INST_STORE, .slot = 4}, |
| 1203 |
{.type = INST_BRANCH_ONCE, .rel = 21}, |
| 1204 |
{.type = INST_HALT}, |
| 1205 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 1206 |
{.type = INST_LOAD_CTX, .ctx = 1073741832}, |
| 1207 |
{.type = INST_OP, .op = OP_MUL}, |
| 1208 |
{.type = INST_LOAD_CTX, .ctx = 8}, |
| 1209 |
{.type = INST_LOAD_CTX, .ctx = 1073741844}, |
| 1210 |
{.type = INST_OP, .op = OP_MUL}, |
| 1211 |
{.type = INST_OP, .op = OP_ADD}, |
| 1212 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 1213 |
{.type = INST_LOAD_CTX, .ctx = 1073741828}, |
| 1214 |
{.type = INST_OP, .op = OP_MUL}, |
| 1215 |
{.type = INST_OP, .op = OP_ADD}, |
| 1216 |
{.type = INST_LOAD_CTX, .ctx = 0}, |
| 1217 |
{.type = INST_LOAD_CTX, .ctx = 1073741840}, |
| 1218 |
{.type = INST_OP, .op = OP_MUL}, |
| 1219 |
{.type = INST_OP, .op = OP_ADD}, |
| 1220 |
{.type = INST_STORE_OVER_NAN, .slot = 7}, |
| 1221 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 1222 |
{.type = INST_STORE, .slot = 8}, |
| 1223 |
{.type = INST_BRANCH, .rel = -47}, |
| 1224 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1225 |
{.type = INST_STORE, .slot = 6}, |
| 1226 |
{.type = INST_LOAD, .slot = 8}, |
| 1227 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1228 |
{.type = INST_OP, .op = OP_ADD}, |
| 1229 |
{.type = INST_LOAD, .slot = 6}, |
| 1230 |
{.type = INST_OP, .op = OP_MAX}, |
| 1231 |
{.type = INST_STORE, .slot = 6}, |
| 1232 |
{.type = INST_HALT}, |
| 1233 |
}; |
| 1234 |
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs)); |
| 1235 |
ret->len = ARR_SIZE(instrs); |
| 1236 |
ret->elapsed_slot = 5; |
| 1237 |
ret->n_slots = 9; |
| 1238 |
ret->stack_size = 3; |
| 1239 |
ret->vars = NULL; |
| 1240 |
ret->overrides = NULL; |
| 1241 |
memcpy(ret->instrs, instrs, sizeof(instrs)); |
| 1242 |
{ |
| 1243 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1244 |
*var = (struct variable_allocation){ |
| 1245 |
.name = strdup("v-timing"), .slot = 0, .index = 0}; |
| 1246 |
HASH_ADD_STR(ret->vars, name, var); |
| 1247 |
} |
| 1248 |
{ |
| 1249 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1250 |
*var = (struct variable_allocation){ |
| 1251 |
.name = strdup("offset-x"), .slot = 1, .index = 1}; |
| 1252 |
HASH_ADD_STR(ret->vars, name, var); |
| 1253 |
} |
| 1254 |
{ |
| 1255 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1256 |
*var = (struct variable_allocation){ |
| 1257 |
.name = strdup("offset-y"), .slot = 2, .index = 2}; |
| 1258 |
HASH_ADD_STR(ret->vars, name, var); |
| 1259 |
} |
| 1260 |
{ |
| 1261 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1262 |
*var = (struct variable_allocation){ |
| 1263 |
.name = strdup("shadow-offset-x"), .slot = 3, .index = 3}; |
| 1264 |
HASH_ADD_STR(ret->vars, name, var); |
| 1265 |
} |
| 1266 |
{ |
| 1267 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1268 |
*var = (struct variable_allocation){ |
| 1269 |
.name = strdup("shadow-offset-y"), .slot = 4, .index = 4}; |
| 1270 |
HASH_ADD_STR(ret->vars, name, var); |
| 1271 |
} |
| 1272 |
{ |
| 1273 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 1274 |
*override = (struct overridable_slot){.name = strdup("v-timing"), .slot = 7}; |
| 1275 |
HASH_ADD_STR(ret->overrides, name, override); |
| 1276 |
} |
| 1277 |
output_slots[0] = 1; |
| 1278 |
output_slots[1] = 2; |
| 1279 |
output_slots[2] = 3; |
| 1280 |
output_slots[3] = 4; |
| 1281 |
output_slots[4] = -1; |
| 1282 |
output_slots[5] = -1; |
| 1283 |
output_slots[6] = -1; |
| 1284 |
output_slots[7] = -1; |
| 1285 |
output_slots[8] = -1; |
| 1286 |
output_slots[9] = -1; |
| 1287 |
output_slots[10] = -1; |
| 1288 |
output_slots[11] = -1; |
| 1289 |
output_slots[12] = -1; |
| 1290 |
output_slots[13] = -1; |
| 1291 |
output_slots[14] = -1; |
| 1292 |
output_slots[15] = -1; |
| 1293 |
output_slots[16] = -1; |
| 1294 |
output_slots[17] = -1; |
| 1295 |
output_slots[18] = -1; |
| 1296 |
return ret; |
| 1297 |
} |
| 1298 |
|
| 1299 |
static bool win_script_preset__fly_in(struct win_script *output, config_setting_t *setting) { |
| 1300 |
output->script = script_template__fly_in(output->output_indices); |
| 1301 |
double knob_duration = 0x1.999999999999ap-3; |
| 1302 |
config_setting_lookup_float(setting, "duration", &knob_duration); |
| 1303 |
const char *knob_direction = "up"; |
| 1304 |
config_setting_lookup_string(setting, "direction", &knob_direction); |
| 1305 |
double placeholder1_direction; |
| 1306 |
double placeholder2_direction; |
| 1307 |
double placeholder3_direction; |
| 1308 |
double placeholder4_direction; |
| 1309 |
double placeholder5_direction; |
| 1310 |
if (strcmp(knob_direction, "up") == 0) { |
| 1311 |
placeholder1_direction = 0x0p+0; |
| 1312 |
placeholder2_direction = -0x1p+0; |
| 1313 |
placeholder3_direction = 0x0p+0; |
| 1314 |
placeholder4_direction = 0x0p+0; |
| 1315 |
placeholder5_direction = -0x1p+0; |
| 1316 |
} else if (strcmp(knob_direction, "down") == 0) { |
| 1317 |
placeholder1_direction = 0x0p+0; |
| 1318 |
placeholder2_direction = 0x1p+0; |
| 1319 |
placeholder3_direction = 0x0p+0; |
| 1320 |
placeholder4_direction = 0x0p+0; |
| 1321 |
placeholder5_direction = 0x0p+0; |
| 1322 |
} else if (strcmp(knob_direction, "left") == 0) { |
| 1323 |
placeholder1_direction = -0x1p+0; |
| 1324 |
placeholder2_direction = 0x0p+0; |
| 1325 |
placeholder3_direction = 0x1p+0; |
| 1326 |
placeholder4_direction = -0x1p+0; |
| 1327 |
placeholder5_direction = 0x0p+0; |
| 1328 |
} else if (strcmp(knob_direction, "right") == 0) { |
| 1329 |
placeholder1_direction = 0x1p+0; |
| 1330 |
placeholder2_direction = 0x0p+0; |
| 1331 |
placeholder3_direction = 0x1p+0; |
| 1332 |
placeholder4_direction = 0x0p+0; |
| 1333 |
placeholder5_direction = 0x0p+0; |
| 1334 |
} else { |
| 1335 |
log_error("Invalid choice \"%s\" for option \"direction\". Line %d.", |
| 1336 |
knob_direction, |
| 1337 |
config_setting_source_line( |
| 1338 |
config_setting_get_member(setting, "direction"))); |
| 1339 |
log_error(" Valid ones are: \"up\", \"down\", \"left\", \"right\""); |
| 1340 |
script_free(output->script); |
| 1341 |
output->script = NULL; |
| 1342 |
return false; |
| 1343 |
} |
| 1344 |
struct script_specialization_context spec[] = { |
| 1345 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 0, .value = knob_duration}, |
| 1346 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 4, .value = placeholder1_direction}, |
| 1347 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 8, .value = placeholder2_direction}, |
| 1348 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 12, .value = placeholder3_direction}, |
| 1349 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 16, .value = placeholder4_direction}, |
| 1350 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 20, .value = placeholder5_direction}, |
| 1351 |
}; |
| 1352 |
script_specialize(output->script, spec, ARR_SIZE(spec)); |
| 1353 |
return true; |
| 1354 |
} |
| 1355 |
static struct script *script_template__geometry_change(int *output_slots) { |
| 1356 |
static const struct instruction instrs[] = { |
| 1357 |
{.type = INST_BRANCH_ONCE, .rel = 76}, |
| 1358 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 1359 |
{.type = INST_LOAD, .slot = 11}, |
| 1360 |
{.type = INST_OP, .op = OP_SUB}, |
| 1361 |
{.type = INST_LOAD, .slot = 9}, |
| 1362 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1363 |
{.type = INST_OP, .op = OP_SUB}, |
| 1364 |
{.type = INST_LOAD, .slot = 12}, |
| 1365 |
{.type = INST_OP, .op = OP_DIV}, |
| 1366 |
{ |
| 1367 |
.type = INST_CURVE, |
| 1368 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 1369 |
.bezier = {.ax = 0x1.35c28f5c28f5cp+0, |
| 1370 |
.bx = -0x1.ae147ae147ae2p-2, |
| 1371 |
.cx = 0x1.ae147ae147ae2p-3, |
| 1372 |
.ay = -0x1.999999999996p-5, |
| 1373 |
.by = -0x1.cccccccccccd4p-1, |
| 1374 |
.cy = 0x1.f333333333335p+0}}, |
| 1375 |
}, |
| 1376 |
{.type = INST_OP, .op = OP_MUL}, |
| 1377 |
{.type = INST_LOAD, .slot = 11}, |
| 1378 |
{.type = INST_OP, .op = OP_ADD}, |
| 1379 |
{.type = INST_STORE, .slot = 0}, |
| 1380 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 1381 |
{.type = INST_LOAD, .slot = 13}, |
| 1382 |
{.type = INST_OP, .op = OP_SUB}, |
| 1383 |
{.type = INST_LOAD, .slot = 9}, |
| 1384 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1385 |
{.type = INST_OP, .op = OP_SUB}, |
| 1386 |
{.type = INST_LOAD, .slot = 14}, |
| 1387 |
{.type = INST_OP, .op = OP_DIV}, |
| 1388 |
{ |
| 1389 |
.type = INST_CURVE, |
| 1390 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 1391 |
.bezier = {.ax = 0x1.35c28f5c28f5cp+0, |
| 1392 |
.bx = -0x1.ae147ae147ae2p-2, |
| 1393 |
.cx = 0x1.ae147ae147ae2p-3, |
| 1394 |
.ay = -0x1.999999999996p-5, |
| 1395 |
.by = -0x1.cccccccccccd4p-1, |
| 1396 |
.cy = 0x1.f333333333335p+0}}, |
| 1397 |
}, |
| 1398 |
{.type = INST_OP, .op = OP_MUL}, |
| 1399 |
{.type = INST_LOAD, .slot = 13}, |
| 1400 |
{.type = INST_OP, .op = OP_ADD}, |
| 1401 |
{.type = INST_STORE, .slot = 1}, |
| 1402 |
{.type = INST_LOAD, .slot = 0}, |
| 1403 |
{.type = INST_STORE, .slot = 2}, |
| 1404 |
{.type = INST_LOAD, .slot = 1}, |
| 1405 |
{.type = INST_STORE, .slot = 3}, |
| 1406 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1407 |
{.type = INST_LOAD, .slot = 15}, |
| 1408 |
{.type = INST_OP, .op = OP_SUB}, |
| 1409 |
{.type = INST_LOAD, .slot = 9}, |
| 1410 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1411 |
{.type = INST_OP, .op = OP_SUB}, |
| 1412 |
{.type = INST_LOAD, .slot = 16}, |
| 1413 |
{.type = INST_OP, .op = OP_DIV}, |
| 1414 |
{ |
| 1415 |
.type = INST_CURVE, |
| 1416 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 1417 |
.bezier = {.ax = 0x1.35c28f5c28f5cp+0, |
| 1418 |
.bx = -0x1.ae147ae147ae2p-2, |
| 1419 |
.cx = 0x1.ae147ae147ae2p-3, |
| 1420 |
.ay = -0x1.999999999996p-5, |
| 1421 |
.by = -0x1.cccccccccccd4p-1, |
| 1422 |
.cy = 0x1.f333333333335p+0}}, |
| 1423 |
}, |
| 1424 |
{.type = INST_OP, .op = OP_MUL}, |
| 1425 |
{.type = INST_LOAD, .slot = 15}, |
| 1426 |
{.type = INST_OP, .op = OP_ADD}, |
| 1427 |
{.type = INST_STORE, .slot = 4}, |
| 1428 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1429 |
{.type = INST_LOAD, .slot = 17}, |
| 1430 |
{.type = INST_OP, .op = OP_SUB}, |
| 1431 |
{.type = INST_LOAD, .slot = 9}, |
| 1432 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1433 |
{.type = INST_OP, .op = OP_SUB}, |
| 1434 |
{.type = INST_LOAD, .slot = 18}, |
| 1435 |
{.type = INST_OP, .op = OP_DIV}, |
| 1436 |
{ |
| 1437 |
.type = INST_CURVE, |
| 1438 |
.curve = {.type = CURVE_CUBIC_BEZIER, |
| 1439 |
.bezier = {.ax = 0x1.35c28f5c28f5cp+0, |
| 1440 |
.bx = -0x1.ae147ae147ae2p-2, |
| 1441 |
.cx = 0x1.ae147ae147ae2p-3, |
| 1442 |
.ay = -0x1.999999999996p-5, |
| 1443 |
.by = -0x1.cccccccccccd4p-1, |
| 1444 |
.cy = 0x1.f333333333335p+0}}, |
| 1445 |
}, |
| 1446 |
{.type = INST_OP, .op = OP_MUL}, |
| 1447 |
{.type = INST_LOAD, .slot = 17}, |
| 1448 |
{.type = INST_OP, .op = OP_ADD}, |
| 1449 |
{.type = INST_STORE, .slot = 5}, |
| 1450 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1451 |
{.type = INST_LOAD, .slot = 19}, |
| 1452 |
{.type = INST_OP, .op = OP_SUB}, |
| 1453 |
{.type = INST_LOAD, .slot = 9}, |
| 1454 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1455 |
{.type = INST_OP, .op = OP_SUB}, |
| 1456 |
{.type = INST_LOAD, .slot = 20}, |
| 1457 |
{.type = INST_OP, .op = OP_DIV}, |
| 1458 |
{ |
| 1459 |
.type = INST_CURVE, |
| 1460 |
.curve = {.type = CURVE_LINEAR}, |
| 1461 |
}, |
| 1462 |
{.type = INST_OP, .op = OP_MUL}, |
| 1463 |
{.type = INST_LOAD, .slot = 19}, |
| 1464 |
{.type = INST_OP, .op = OP_ADD}, |
| 1465 |
{.type = INST_STORE, .slot = 6}, |
| 1466 |
{.type = INST_LOAD, .slot = 4}, |
| 1467 |
{.type = INST_STORE, .slot = 7}, |
| 1468 |
{.type = INST_LOAD, .slot = 5}, |
| 1469 |
{.type = INST_STORE, .slot = 8}, |
| 1470 |
{.type = INST_BRANCH_ONCE, .rel = 31}, |
| 1471 |
{.type = INST_HALT}, |
| 1472 |
{.type = INST_LOAD_CTX, .ctx = 48}, |
| 1473 |
{.type = INST_LOAD_CTX, .ctx = 16}, |
| 1474 |
{.type = INST_OP, .op = OP_DIV}, |
| 1475 |
{.type = INST_STORE_OVER_NAN, .slot = 11}, |
| 1476 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 1477 |
{.type = INST_STORE, .slot = 12}, |
| 1478 |
{.type = INST_LOAD_CTX, .ctx = 56}, |
| 1479 |
{.type = INST_LOAD_CTX, .ctx = 24}, |
| 1480 |
{.type = INST_OP, .op = OP_DIV}, |
| 1481 |
{.type = INST_STORE_OVER_NAN, .slot = 13}, |
| 1482 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 1483 |
{.type = INST_STORE, .slot = 14}, |
| 1484 |
{.type = INST_LOAD_CTX, .ctx = 32}, |
| 1485 |
{.type = INST_LOAD_CTX, .ctx = 0}, |
| 1486 |
{.type = INST_OP, .op = OP_SUB}, |
| 1487 |
{.type = INST_STORE_OVER_NAN, .slot = 15}, |
| 1488 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 1489 |
{.type = INST_STORE, .slot = 16}, |
| 1490 |
{.type = INST_LOAD_CTX, .ctx = 40}, |
| 1491 |
{.type = INST_LOAD_CTX, .ctx = 8}, |
| 1492 |
{.type = INST_OP, .op = OP_SUB}, |
| 1493 |
{.type = INST_STORE_OVER_NAN, .slot = 17}, |
| 1494 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 1495 |
{.type = INST_STORE, .slot = 18}, |
| 1496 |
{.type = INST_IMM, .imm = 0x1p+0}, |
| 1497 |
{.type = INST_STORE_OVER_NAN, .slot = 19}, |
| 1498 |
{.type = INST_LOAD_CTX, .ctx = 1073741824}, |
| 1499 |
{.type = INST_STORE, .slot = 20}, |
| 1500 |
{.type = INST_BRANCH, .rel = -103}, |
| 1501 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1502 |
{.type = INST_STORE, .slot = 10}, |
| 1503 |
{.type = INST_LOAD, .slot = 12}, |
| 1504 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1505 |
{.type = INST_OP, .op = OP_ADD}, |
| 1506 |
{.type = INST_LOAD, .slot = 10}, |
| 1507 |
{.type = INST_OP, .op = OP_MAX}, |
| 1508 |
{.type = INST_STORE, .slot = 10}, |
| 1509 |
{.type = INST_LOAD, .slot = 14}, |
| 1510 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1511 |
{.type = INST_OP, .op = OP_ADD}, |
| 1512 |
{.type = INST_LOAD, .slot = 10}, |
| 1513 |
{.type = INST_OP, .op = OP_MAX}, |
| 1514 |
{.type = INST_STORE, .slot = 10}, |
| 1515 |
{.type = INST_LOAD, .slot = 16}, |
| 1516 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1517 |
{.type = INST_OP, .op = OP_ADD}, |
| 1518 |
{.type = INST_LOAD, .slot = 10}, |
| 1519 |
{.type = INST_OP, .op = OP_MAX}, |
| 1520 |
{.type = INST_STORE, .slot = 10}, |
| 1521 |
{.type = INST_LOAD, .slot = 18}, |
| 1522 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1523 |
{.type = INST_OP, .op = OP_ADD}, |
| 1524 |
{.type = INST_LOAD, .slot = 10}, |
| 1525 |
{.type = INST_OP, .op = OP_MAX}, |
| 1526 |
{.type = INST_STORE, .slot = 10}, |
| 1527 |
{.type = INST_LOAD, .slot = 20}, |
| 1528 |
{.type = INST_IMM, .imm = 0x0p+0}, |
| 1529 |
{.type = INST_OP, .op = OP_ADD}, |
| 1530 |
{.type = INST_LOAD, .slot = 10}, |
| 1531 |
{.type = INST_OP, .op = OP_MAX}, |
| 1532 |
{.type = INST_STORE, .slot = 10}, |
| 1533 |
{.type = INST_HALT}, |
| 1534 |
}; |
| 1535 |
struct script *ret = malloc(offsetof(struct script, instrs) + sizeof(instrs)); |
| 1536 |
ret->len = ARR_SIZE(instrs); |
| 1537 |
ret->elapsed_slot = 9; |
| 1538 |
ret->n_slots = 21; |
| 1539 |
ret->stack_size = 3; |
| 1540 |
ret->vars = NULL; |
| 1541 |
ret->overrides = NULL; |
| 1542 |
memcpy(ret->instrs, instrs, sizeof(instrs)); |
| 1543 |
{ |
| 1544 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1545 |
*var = (struct variable_allocation){ |
| 1546 |
.name = strdup("scale-x"), .slot = 0, .index = 0}; |
| 1547 |
HASH_ADD_STR(ret->vars, name, var); |
| 1548 |
} |
| 1549 |
{ |
| 1550 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1551 |
*var = (struct variable_allocation){ |
| 1552 |
.name = strdup("scale-y"), .slot = 1, .index = 1}; |
| 1553 |
HASH_ADD_STR(ret->vars, name, var); |
| 1554 |
} |
| 1555 |
{ |
| 1556 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1557 |
*var = (struct variable_allocation){ |
| 1558 |
.name = strdup("shadow-scale-x"), .slot = 2, .index = 2}; |
| 1559 |
HASH_ADD_STR(ret->vars, name, var); |
| 1560 |
} |
| 1561 |
{ |
| 1562 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1563 |
*var = (struct variable_allocation){ |
| 1564 |
.name = strdup("shadow-scale-y"), .slot = 3, .index = 3}; |
| 1565 |
HASH_ADD_STR(ret->vars, name, var); |
| 1566 |
} |
| 1567 |
{ |
| 1568 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1569 |
*var = (struct variable_allocation){ |
| 1570 |
.name = strdup("offset-x"), .slot = 4, .index = 4}; |
| 1571 |
HASH_ADD_STR(ret->vars, name, var); |
| 1572 |
} |
| 1573 |
{ |
| 1574 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1575 |
*var = (struct variable_allocation){ |
| 1576 |
.name = strdup("offset-y"), .slot = 5, .index = 5}; |
| 1577 |
HASH_ADD_STR(ret->vars, name, var); |
| 1578 |
} |
| 1579 |
{ |
| 1580 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1581 |
*var = (struct variable_allocation){ |
| 1582 |
.name = strdup("saved-image-blend"), .slot = 6, .index = 6}; |
| 1583 |
HASH_ADD_STR(ret->vars, name, var); |
| 1584 |
} |
| 1585 |
{ |
| 1586 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1587 |
*var = (struct variable_allocation){ |
| 1588 |
.name = strdup("shadow-offset-x"), .slot = 7, .index = 7}; |
| 1589 |
HASH_ADD_STR(ret->vars, name, var); |
| 1590 |
} |
| 1591 |
{ |
| 1592 |
struct variable_allocation *var = malloc(sizeof(*var)); |
| 1593 |
*var = (struct variable_allocation){ |
| 1594 |
.name = strdup("shadow-offset-y"), .slot = 8, .index = 8}; |
| 1595 |
HASH_ADD_STR(ret->vars, name, var); |
| 1596 |
} |
| 1597 |
{ |
| 1598 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 1599 |
*override = (struct overridable_slot){.name = strdup("scale-x"), .slot = 11}; |
| 1600 |
HASH_ADD_STR(ret->overrides, name, override); |
| 1601 |
} |
| 1602 |
{ |
| 1603 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 1604 |
*override = (struct overridable_slot){.name = strdup("scale-y"), .slot = 13}; |
| 1605 |
HASH_ADD_STR(ret->overrides, name, override); |
| 1606 |
} |
| 1607 |
{ |
| 1608 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 1609 |
*override = (struct overridable_slot){.name = strdup("offset-x"), .slot = 15}; |
| 1610 |
HASH_ADD_STR(ret->overrides, name, override); |
| 1611 |
} |
| 1612 |
{ |
| 1613 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 1614 |
*override = (struct overridable_slot){.name = strdup("offset-y"), .slot = 17}; |
| 1615 |
HASH_ADD_STR(ret->overrides, name, override); |
| 1616 |
} |
| 1617 |
{ |
| 1618 |
struct overridable_slot *override = malloc(sizeof(*override)); |
| 1619 |
*override = (struct overridable_slot){.name = strdup("saved-image-blend"), |
| 1620 |
.slot = 19}; |
| 1621 |
HASH_ADD_STR(ret->overrides, name, override); |
| 1622 |
} |
| 1623 |
output_slots[0] = 4; |
| 1624 |
output_slots[1] = 5; |
| 1625 |
output_slots[2] = 7; |
| 1626 |
output_slots[3] = 8; |
| 1627 |
output_slots[4] = -1; |
| 1628 |
output_slots[5] = -1; |
| 1629 |
output_slots[6] = -1; |
| 1630 |
output_slots[7] = 0; |
| 1631 |
output_slots[8] = 1; |
| 1632 |
output_slots[9] = 2; |
| 1633 |
output_slots[10] = 3; |
| 1634 |
output_slots[11] = -1; |
| 1635 |
output_slots[12] = -1; |
| 1636 |
output_slots[13] = -1; |
| 1637 |
output_slots[14] = -1; |
| 1638 |
output_slots[15] = 6; |
| 1639 |
output_slots[16] = -1; |
| 1640 |
output_slots[17] = -1; |
| 1641 |
output_slots[18] = -1; |
| 1642 |
return ret; |
| 1643 |
} |
| 1644 |
|
| 1645 |
static bool |
| 1646 |
win_script_preset__geometry_change(struct win_script *output, config_setting_t *setting) { |
| 1647 |
output->script = script_template__geometry_change(output->output_indices); |
| 1648 |
double knob_duration = 0x1.999999999999ap-2; |
| 1649 |
config_setting_lookup_float(setting, "duration", &knob_duration); |
| 1650 |
struct script_specialization_context spec[] = { |
| 1651 |
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 0, .value = knob_duration}, |
| 1652 |
}; |
| 1653 |
script_specialize(output->script, spec, ARR_SIZE(spec)); |
| 1654 |
return true; |
| 1655 |
} |
| 1656 |
struct { |
| 1657 |
const char *name; |
| 1658 |
bool (*func)(struct win_script *output, config_setting_t *setting); |
| 1659 |
} win_script_presets[] = { |
| 1660 |
{"disappear", win_script_preset__disappear}, |
| 1661 |
{"appear", win_script_preset__appear}, |
| 1662 |
{"slide-out", win_script_preset__slide_out}, |
| 1663 |
{"slide-in", win_script_preset__slide_in}, |
| 1664 |
{"fly-out", win_script_preset__fly_out}, |
| 1665 |
{"fly-in", win_script_preset__fly_in}, |
| 1666 |
{"geometry-change", win_script_preset__geometry_change}, |
| 1667 |
{NULL, NULL}, |
| 1668 |
}; |