| 1 | #cxx . . $ `<file>/src/pt2_askbox.c`/include <stdint.h> |
| 2 | #include <stdbool.h> |
| 3 | #include <string.h> |
| 4 | #include "pt2_textout.h"cxx . . $ `<file>/src/pt2_textout.h`/ |
| 5 | #include "pt2_visuals.h"cxx . . $ `<file>/src/pt2_visuals.h`/ |
| 6 | #include "pt2_mouse.h"cxx . . $ `<file>/src/pt2_mouse.h`/ |
| 7 | #include "pt2_structs.h"cxx . . $ `<file>/src/pt2_structs.h`/ |
| 8 | #include "pt2_visuals_sync.h"cxx . . $ `<file>/src/pt2_visuals_sync.h`/ |
| 9 | #include "pt2_keyboard.h"cxx . . $ `<file>/src/pt2_keyboard.h`/ |
| 10 | #include "pt2_diskop.h"cxx . . $ `<file>/src/pt2_diskop.h`/ |
| 11 | #include "pt2_mod2wav.h"cxx . . $ `<file>/src/pt2_mod2wav.h`/ |
| 12 | #include "pt2_pat2smp.h"cxx . . $ `<file>/src/pt2_pat2smp.h`/ |
| 13 | #include "pt2_askbox.h"cxx . . $ `<file>/src/pt2_askbox.h`/ |
| 14 | #include "pt2_posed.h"cxx . . $ `<file>/src/pt2_posed.h`/ |
| 15 | |
| 16 | #define INIT_BUTTONScxx . . $ `src/pt2_askbox.c:16:9`!(num, abortRetVal, defRetVal) \ |
| 17 | d.numButtons = num; \ |
| 18 | d.abortReturnValue = abortRetVal; \ |
| 19 | d.defaultReturnValue = defRetVal; |
| 20 | |
| 21 | #define SET_DIALOGcxx . . $ `src/pt2_askbox.c:21:9`!(xx, yy, ww, hh) \ |
| 22 | d.x = xx; \ |
| 23 | d.y = yy; \ |
| 24 | d.w = ww; \ |
| 25 | d.h = hh; |
| 26 | |
| 27 | #define SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(i, invert, label, key, retVal, xx1, xx2, yy1, yy2) \ |
| 28 | strcpy(d.buttons[i].text, label); \ |
| 29 | d.buttons[i].repeat = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; \ |
| 30 | d.buttons[i].inverted = invert; \ |
| 31 | d.buttons[i].callback = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; \ |
| 32 | d.buttons[i].keyBinding = key; \ |
| 33 | d.buttons[i].returnValue = retVal; \ |
| 34 | d.buttons[i].clickableWidth = 0; \ |
| 35 | d.buttons[i].x1 = xx1; \ |
| 36 | d.buttons[i].x2 = xx2; \ |
| 37 | d.buttons[i].y1 = yy1; \ |
| 38 | d.buttons[i].y2 = yy2; |
| 39 | |
| 40 | #define SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(i, label, func, clickWidth, xx1, xx2, yy1, yy2, doRepeat) \ |
| 41 | strcpy(d.buttons[i].text, label); \ |
| 42 | d.buttons[i].repeat = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; \ |
| 43 | d.buttons[i].inverted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; \ |
| 44 | d.buttons[i].callback = func; \ |
| 45 | d.buttons[i].clickableWidth = clickWidth; \ |
| 46 | d.buttons[i].x1 = xx1; \ |
| 47 | d.buttons[i].x2 = xx2; \ |
| 48 | d.buttons[i].y1 = yy1; \ |
| 49 | d.buttons[i].y2 = yy2; |
| 50 | |
| 51 | typedef struct choice_tcxx . . $ choice_t# |
| 52 | { |
| 53 | void (*callbackcxx . . $ choice_t#callback.)(void); |
| 54 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! invertedcxx . . $ choice_t#inverted., repeatcxx . . $ choice_t#repeat.; |
| 55 | int16_tcxx . . $ int16_t# x1cxx . . $ choice_t#x1., y1cxx . . $ choice_t#y1., x2cxx . . $ choice_t#x2., y2cxx . . $ choice_t#y2., clickableWidthcxx . . $ choice_t#clickableWidth.; |
| 56 | SDL_Keycodecxx . . $ SDL_Keycode# keyBindingcxx . . $ choice_t#keyBinding.; |
| 57 | int16_tcxx . . $ int16_t# returnValuecxx . . $ choice_t#returnValue.; |
| 58 | char textcxx . . $ choice_t#text.[32]; |
| 59 | } button_tcxx . . $ button_t#; |
| 60 | |
| 61 | typedef struct dialog_tcxx . . $ dialog_t# |
| 62 | { |
| 63 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! bigDialogcxx . . $ dialog_t#bigDialog.; |
| 64 | int16_tcxx . . $ int16_t# xcxx . . $ dialog_t#x., ycxx . . $ dialog_t#y., wcxx . . $ dialog_t#w., hcxx . . $ dialog_t#h., numButtonscxx . . $ dialog_t#numButtons., defaultReturnValuecxx . . $ dialog_t#defaultReturnValue., abortReturnValuecxx . . $ dialog_t#abortReturnValue.; |
| 65 | button_tcxx . . $ button_t# buttonscxx . . $ dialog_t#buttons.[16]; |
| 66 | } dialog_tcxx . . $ dialog_t#; |
| 67 | |
| 68 | typedef struct askBoxData_tcxx . . $ askBoxData_t# // for thread-safe version of askBox() |
| 69 | { |
| 70 | volatile boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! activecxx . . $ askBoxData_t#active.; |
| 71 | uint32_tcxx . . $ uint32_t# dialogTypecxx . . $ askBoxData_t#dialogType., returnValuecxx . . $ askBoxData_t#returnValue.; |
| 72 | const char *statusTextcxx . . $ askBoxData_t#statusText.; |
| 73 | } askBoxData_tcxx . . $ askBoxData_t#; |
| 74 | |
| 75 | static int32_tcxx . . $ int32_t# buttonToRepeatcxx . . $ buttonToRepeat. = -1; |
| 76 | static askBoxData_tcxx . . $ askBoxData_t# askBoxDatacxx . . $ askBoxData.; |
| 77 | |
| 78 | static void drawDialogcxx . . $ drawDialog(801ba35e0beadf82).(dialog_tcxx . . $ dialog_t# *d) |
| 79 | { |
| 80 | // render dialog |
| 81 | drawFramework3cxx . . $ drawFramework3(748afa4755bc9595).(d->xcxx . . $ dialog_t#x., d->ycxx . . $ dialog_t#y., d->wcxx . . $ dialog_t#w., d->hcxx . . $ dialog_t#h.); |
| 82 | |
| 83 | // render buttons |
| 84 | for (int32_tcxx . . $ int32_t# i = 0; i < d->numButtonscxx . . $ dialog_t#numButtons.; i++) |
| 85 | { |
| 86 | button_tcxx . . $ button_t# *b = &d->buttonscxx . . $ dialog_t#buttons.[i]; |
| 87 | if (b->invertedcxx . . $ choice_t#inverted.) |
| 88 | drawButton2cxx . . $ drawButton2(8c3222651be003c9).(b->x1cxx . . $ choice_t#x1., b->y1cxx . . $ choice_t#y1., (b->x2cxx . . $ choice_t#x2. - b->x1cxx . . $ choice_t#x1.) + 1, (b->y2cxx . . $ choice_t#y2. - b->y1cxx . . $ choice_t#y1.) + 1, b->textcxx . . $ choice_t#text.); |
| 89 | else |
| 90 | drawButton1cxx . . $ drawButton1(8c3222651be003c9).(b->x1cxx . . $ choice_t#x1., b->y1cxx . . $ choice_t#y1., (b->x2cxx . . $ choice_t#x2. - b->x1cxx . . $ choice_t#x1.) + 1, (b->y2cxx . . $ choice_t#y2. - b->y1cxx . . $ choice_t#y1.) + 1, b->textcxx . . $ choice_t#text.); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | void removeAskBoxcxx . . $ removeAskBox(49f6e7a06ebc5aa8).(void) |
| 95 | { |
| 96 | uicxx . . $ ui..disableVisualizercxx . . $ ui_t#disableVisualizer. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 97 | uicxx . . $ ui..askBoxShowncxx . . $ ui_t#askBoxShown. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 98 | |
| 99 | if (uicxx . . $ ui..diskOpScreenShowncxx . . $ ui_t#diskOpScreenShown.) |
| 100 | { |
| 101 | renderDiskOpScreencxx . . $ renderDiskOpScreen(49f6e7a06ebc5aa8).(); // also sets update flags |
| 102 | updateDiskOpcxx . . $ updateDiskOp(49f6e7a06ebc5aa8).(); // redraw requested updates |
| 103 | } |
| 104 | else if (uicxx . . $ ui..posEdScreenShowncxx . . $ ui_t#posEdScreenShown.) |
| 105 | { |
| 106 | renderPosEdScreencxx . . $ renderPosEdScreen(49f6e7a06ebc5aa8).(); // also sets update flags |
| 107 | updatePosEdcxx . . $ updatePosEd(49f6e7a06ebc5aa8).(); // redraw requested updates |
| 108 | } |
| 109 | else if (uicxx . . $ ui..editOpScreenShowncxx . . $ ui_t#editOpScreenShown.) |
| 110 | { |
| 111 | renderEditOpScreencxx . . $ renderEditOpScreen(49f6e7a06ebc5aa8).(); // also sets update flags |
| 112 | updateEditOpcxx . . $ updateEditOp(49f6e7a06ebc5aa8).(); // redraw requested updates |
| 113 | } |
| 114 | else if (uicxx . . $ ui..aboutScreenShowncxx . . $ ui_t#aboutScreenShown.) |
| 115 | { |
| 116 | renderAboutScreencxx . . $ renderAboutScreen(49f6e7a06ebc5aa8).(); |
| 117 | } |
| 118 | else |
| 119 | { |
| 120 | if (uicxx . . $ ui..visualizerModecxx . . $ ui_t#visualizerMode. == VISUAL_QUADRASCOPEcxx . . $ VISUAL_QUADRASCOPE.) |
| 121 | renderQuadrascopeBgcxx . . $ renderQuadrascopeBg(49f6e7a06ebc5aa8).(); |
| 122 | else if (uicxx . . $ ui..visualizerModecxx . . $ ui_t#visualizerMode. == VISUAL_SPECTRUMcxx . . $ VISUAL_SPECTRUM.) |
| 123 | renderSpectrumAnalyzerBgcxx . . $ renderSpectrumAnalyzerBg(49f6e7a06ebc5aa8).(); |
| 124 | |
| 125 | updateVisualizercxx . . $ updateVisualizer(49f6e7a06ebc5aa8).(); // will draw one frame of the visualizer in use |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | void handleThreadedAskBoxcxx . . $ handleThreadedAskBox(49f6e7a06ebc5aa8).(void) // rain from main input/video loop |
| 130 | { |
| 131 | if (askBoxDatacxx . . $ askBoxData..activecxx . . $ askBoxData_t#active.) |
| 132 | { |
| 133 | askBoxDatacxx . . $ askBoxData..returnValuecxx . . $ askBoxData_t#returnValue. = askBoxcxx . . $ askBox(7371ee129cebb502).(askBoxDatacxx . . $ askBoxData..dialogTypecxx . . $ askBoxData_t#dialogType., askBoxDatacxx . . $ askBoxData..statusTextcxx . . $ askBoxData_t#statusText.); |
| 134 | askBoxDatacxx . . $ askBoxData..activecxx . . $ askBoxData_t#active. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | uint32_tcxx . . $ uint32_t# askBoxThreadSafecxx . . $ askBoxThreadSafe(7371ee129cebb502).(uint32_tcxx . . $ uint32_t# dialogType, const char *statusText) |
| 139 | { |
| 140 | if (!editorcxx . . $ editor..mainLoopOngoingcxx . . $ editor_t#mainLoopOngoing.) |
| 141 | return 0; // main loop was not even started yet, bail out. |
| 142 | |
| 143 | // block multiple calls before they are completed (for safety) |
| 144 | while (askBoxDatacxx . . $ askBoxData..activecxx . . $ askBoxData_t#active.) |
| 145 | SDL_Delaycxx . . $ SDL_Delay(cb2f890c2fdad230).(1000 / VBLANK_HZcxx . . $ `src/pt2_header.h:58:9`!); // accuracy is not important here |
| 146 | |
| 147 | askBoxDatacxx . . $ askBoxData..dialogTypecxx . . $ askBoxData_t#dialogType. = dialogType; |
| 148 | askBoxDatacxx . . $ askBoxData..statusTextcxx . . $ askBoxData_t#statusText. = statusText; |
| 149 | askBoxDatacxx . . $ askBoxData..activecxx . . $ askBoxData_t#active. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 150 | |
| 151 | while (askBoxDatacxx . . $ askBoxData..activecxx . . $ askBoxData_t#active.) |
| 152 | SDL_Delaycxx . . $ SDL_Delay(cb2f890c2fdad230).(1000 / VBLANK_HZcxx . . $ `src/pt2_header.h:58:9`!); // accuracy is not important here |
| 153 | |
| 154 | return askBoxDatacxx . . $ askBoxData..returnValuecxx . . $ askBoxData_t#returnValue.; |
| 155 | } |
| 156 | |
| 157 | uint32_tcxx . . $ uint32_t# askBoxcxx . . $ askBox(7371ee129cebb502).(uint32_tcxx . . $ uint32_t# dialogType, const char *statusText) |
| 158 | { |
| 159 | uint32_tcxx . . $ uint32_t# returnValue = 0; |
| 160 | dialog_tcxx . . $ dialog_t# d; |
| 161 | |
| 162 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(dialogType < ASKBOX_NUM); |
| 163 | if (dialogType >= ASKBOX_NUMcxx . . $ ASKBOX_NUM.) |
| 164 | return ASKBOX_NOcxx . . $ ASKBOX_NO.; |
| 165 | |
| 166 | editorcxx . . $ editor..errorMsgActivecxx . . $ editor_t#errorMsgActive. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 167 | editorcxx . . $ editor..errorMsgBlockcxx . . $ editor_t#errorMsgBlock. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 168 | editorcxx . . $ editor..errorMsgCountercxx . . $ editor_t#errorMsgCounter. = 0; |
| 169 | |
| 170 | editorcxx . . $ editor..blockMarkFlagcxx . . $ editor_t#blockMarkFlag. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 171 | uicxx . . $ ui..disableVisualizercxx . . $ ui_t#disableVisualizer. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 172 | uicxx . . $ ui..askBoxShowncxx . . $ ui_t#askBoxShown. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 173 | |
| 174 | SDL_EventStatecxx . . $ SDL_EventState(a6bcbd86f19dd260).(SDL_DROPFILEcxx . . $ SDL_DROPFILE., SDL_DISABLEcxx . . $ `<external>/12778062723415653681/SDL_events.h:1142:9`!); |
| 175 | |
| 176 | // setup dialog based on type |
| 177 | switch (dialogType) |
| 178 | { |
| 179 | default: |
| 180 | case ASKBOX_YES_NOcxx . . $ ASKBOX_YES_NO.: |
| 181 | { |
| 182 | // input: x, y, width, height |
| 183 | SET_DIALOGcxx . . $ `src/pt2_askbox.c:21:9`!(160, 51, 104, 39); |
| 184 | |
| 185 | // input: number of buttons, abort return-value (esc / right mouse button), default return-value (enter/return) |
| 186 | INIT_BUTTONScxx . . $ `src/pt2_askbox.c:16:9`!(2, ASKBOX_NO, ASKBOX_YES); |
| 187 | |
| 188 | // input: button number, inverted type, keybinding, return-value, x1, x2, y1, y2 |
| 189 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(0, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "YES", SDLK_y, ASKBOX_YES, 171, 196, 71, 81); |
| 190 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(1, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "NO", SDLK_n, ASKBOX_NO, 234, 252, 71, 81); |
| 191 | |
| 192 | drawDialogcxx . . $ drawDialog(801ba35e0beadf82).(&d); |
| 193 | |
| 194 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(166, 59, "ARE YOU SURE?"); |
| 195 | } |
| 196 | break; |
| 197 | |
| 198 | case ASKBOX_CLEARcxx . . $ ASKBOX_CLEAR.: |
| 199 | { |
| 200 | SET_DIALOGcxx . . $ `src/pt2_askbox.c:21:9`!(160, 51, 104, 39); |
| 201 | INIT_BUTTONScxx . . $ `src/pt2_askbox.c:16:9`!(4, ASKBOX_CLEAR_CANCEL, ASKBOX_CLEAR_CANCEL); |
| 202 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(0, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "SONG", SDLK_o, ASKBOX_CLEAR_SONG, 166, 198, 57, 67); |
| 203 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(1, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "SAMPLES", SDLK_s, ASKBOX_CLEAR_SAMPLES, 204, 257, 57, 67); |
| 204 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(2, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "ALL", SDLK_a, ASKBOX_CLEAR_ALL, 166, 198, 73, 83); |
| 205 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(3, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "CANCEL", SDLK_c, ASKBOX_CLEAR_CANCEL, 204, 257, 73, 83); |
| 206 | drawDialogcxx . . $ drawDialog(801ba35e0beadf82).(&d); |
| 207 | } |
| 208 | break; |
| 209 | |
| 210 | case ASKBOX_PAT2SMPcxx . . $ ASKBOX_PAT2SMP.: |
| 211 | { |
| 212 | SET_DIALOGcxx . . $ `src/pt2_askbox.c:21:9`!(120, 44, 200, 55); |
| 213 | INIT_BUTTONScxx . . $ `src/pt2_askbox.c:16:9`!(10, 0, 1); |
| 214 | |
| 215 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(0, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, "RENDER TO SAMPLE", SDLK_r, 1, 124, 246, 84, 94); |
| 216 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(1, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, "EXIT", SDLK_e, 0, 258, 315, 84, 94); |
| 217 | |
| 218 | // input: button number, text, keybinding, return-value, x1, x2, y1, y2, repeat button |
| 219 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(2, ARROW_UP_STRcxx . . $ `src/pt2_textout.h:13:9`!, pat2SmpNoteUp, 0, 191, 201, 48, 58, true); |
| 220 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(3, ARROW_DOWN_STRcxx . . $ `src/pt2_textout.h:14:9`!, pat2SmpNoteDown, 0, 202, 212, 48, 58, true); |
| 221 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(4, ARROW_UP_STRcxx . . $ `src/pt2_textout.h:13:9`!, pat2SmpStartRowUp, 0, 294, 304, 48, 58, true); |
| 222 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(5, ARROW_DOWN_STRcxx . . $ `src/pt2_textout.h:14:9`!, pat2SmpStartRowDown, 0, 305, 315, 48, 58, true); |
| 223 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(6, ARROW_UP_STRcxx . . $ `src/pt2_textout.h:13:9`!, pat2SmpFinetuneUp, 0, 191, 201, 59, 69, true); |
| 224 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(7, ARROW_DOWN_STRcxx . . $ `src/pt2_textout.h:14:9`!, pat2SmpFinetuneDown, 0, 202, 212, 59, 69, true); |
| 225 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(8, ARROW_UP_STRcxx . . $ `src/pt2_textout.h:13:9`!, pat2SmpRowsUp, 0, 294, 304, 59, 69, true); |
| 226 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(9, ARROW_DOWN_STRcxx . . $ `src/pt2_textout.h:14:9`!, pat2SmpRowsDown, 0, 305, 315, 59, 69, true); |
| 227 | |
| 228 | drawDialogcxx . . $ drawDialog(801ba35e0beadf82).(&d); |
| 229 | |
| 230 | drawFramework1cxx . . $ drawFramework1(748afa4755bc9595).(163, 48, 28, 11); |
| 231 | drawFramework1cxx . . $ drawFramework1(748afa4755bc9595).(274, 48, 20, 11); |
| 232 | drawFramework1cxx . . $ drawFramework1(748afa4755bc9595).(163, 59, 28, 11); |
| 233 | drawFramework1cxx . . $ drawFramework1(748afa4755bc9595).(274, 59, 20, 11); |
| 234 | |
| 235 | pat2SmpDrawNotecxx . . $ pat2SmpDrawNote(49f6e7a06ebc5aa8).(); |
| 236 | pat2SmpDrawStartRowcxx . . $ pat2SmpDrawStartRow(49f6e7a06ebc5aa8).(); |
| 237 | pat2SmpDrawRowscxx . . $ pat2SmpDrawRows(49f6e7a06ebc5aa8).(); |
| 238 | pat2SmpDrawFinetunecxx . . $ pat2SmpDrawFinetune(49f6e7a06ebc5aa8).(); |
| 239 | pat2SmpCalculateFreqcxx . . $ pat2SmpCalculateFreq(49f6e7a06ebc5aa8).(); |
| 240 | |
| 241 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(127, 50, "NOTE"); |
| 242 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(217, 50, "ROW BEG."); |
| 243 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(124, 61, "FTUNE"); |
| 244 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(223, 61, "# ROWS"); |
| 245 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(124, 74, "FREQ."); |
| 246 | } |
| 247 | break; |
| 248 | |
| 249 | case ASKBOX_DOWNSAMPLEcxx . . $ ASKBOX_DOWNSAMPLE.: // sample loader (AIFF/WAV w/ rate >22kHz) |
| 250 | { |
| 251 | SET_DIALOGcxx . . $ `src/pt2_askbox.c:21:9`!(120, 44, 200, 55); |
| 252 | INIT_BUTTONScxx . . $ `src/pt2_askbox.c:16:9`!(2, ASKBOX_NO, ASKBOX_YES); |
| 253 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(0, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "YES", SDLK_y, ASKBOX_YES, 179, 204, 83, 93); |
| 254 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(1, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "NO", SDLK_n, ASKBOX_NO, 242, 260, 83, 93); |
| 255 | drawDialogcxx . . $ drawDialog(801ba35e0beadf82).(&d); |
| 256 | |
| 257 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(133, 49, "THE SAMPLE'S FREQUENCY IS"); |
| 258 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(154, 57, "HIGH (ABOVE 22KHZ)."); |
| 259 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(133, 65, "DO YOU WANT TO DOWNSAMPLE"); |
| 260 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(156, 73, "BEFORE LOADING IT?"); |
| 261 | } |
| 262 | break; |
| 263 | |
| 264 | case ASKBOX_MOD2WAVcxx . . $ ASKBOX_MOD2WAV.: |
| 265 | { |
| 266 | SET_DIALOGcxx . . $ `src/pt2_askbox.c:21:9`!(138, 44, 165, 55); |
| 267 | INIT_BUTTONScxx . . $ `src/pt2_askbox.c:16:9`!(7, ASKBOX_NO, ASKBOX_YES); |
| 268 | |
| 269 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(0, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, "RENDER TO WAV", SDLK_r, ASKBOX_YES, 142, 246, 84, 94); |
| 270 | SET_BUTTONcxx . . $ `src/pt2_askbox.c:27:9`!(1, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, "EXIT", SDLK_e, ASKBOX_NO, 257, 298, 84, 94); |
| 271 | |
| 272 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(2, " ", toggleMod2WavFadeout, 152, 142, 151, 48, 56, false); |
| 273 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(3, ARROW_UP_STRcxx . . $ `src/pt2_textout.h:13:9`!, mod2WavFadeoutUp, 0, 277, 287, 59, 69, true); |
| 274 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(4, ARROW_DOWN_STRcxx . . $ `src/pt2_textout.h:14:9`!, mod2WavFadeoutDown, 0, 288, 298, 59, 69, true); |
| 275 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(5, ARROW_UP_STRcxx . . $ `src/pt2_textout.h:13:9`!, mod2WavLoopCountUp, 0, 277, 287, 70, 80, true); |
| 276 | SET_CALLBACK_BUTTONcxx . . $ `src/pt2_askbox.c:40:9`!(6, ARROW_DOWN_STRcxx . . $ `src/pt2_textout.h:14:9`!, mod2WavLoopCountDown, 0, 288, 298, 70, 80, true); |
| 277 | |
| 278 | drawDialogcxx . . $ drawDialog(801ba35e0beadf82).(&d); |
| 279 | |
| 280 | drawFramework1cxx . . $ drawFramework1(748afa4755bc9595).(257, 59, 20, 11); |
| 281 | drawFramework1cxx . . $ drawFramework1(748afa4755bc9595).(257, 70, 20, 11); |
| 282 | |
| 283 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(154, 50, "FADE OUT END OF SONG"); |
| 284 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(142, 62, "FADEOUT SECONDS"); |
| 285 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(142, 73, "SONG LOOP COUNT"); |
| 286 | |
| 287 | mod2WavDrawFadeoutTogglecxx . . $ mod2WavDrawFadeoutToggle(49f6e7a06ebc5aa8).(); |
| 288 | mod2WavDrawFadeoutSecondscxx . . $ mod2WavDrawFadeoutSeconds(49f6e7a06ebc5aa8).(); |
| 289 | mod2WavDrawLoopCountcxx . . $ mod2WavDrawLoopCount(49f6e7a06ebc5aa8).(); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | pointerSetModecxx . . $ pointerSetMode(f2ac3508b56cd10).(POINTER_MODE_MSG1cxx . . $ POINTER_MODE_MSG1., NO_CARRYcxx . . $ NO_CARRY.); |
| 294 | if (statusText != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 295 | setStatusMessagecxx . . $ setStatusMessage(90ef5b561fbcb8de).(statusText, NO_CARRYcxx . . $ NO_CARRY.); |
| 296 | |
| 297 | mousecxx . . $ mouse..leftButtonPressedcxx . . $ mouse_t#leftButtonPressed. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 298 | mousecxx . . $ mouse..buttonWaitingcxx . . $ mouse_t#buttonWaiting. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 299 | mousecxx . . $ mouse..buttonWaitCountercxx . . $ mouse_t#buttonWaitCounter. = 0; |
| 300 | mousecxx . . $ mouse..repeatCountercxx . . $ mouse_t#repeatCounter. = 0; |
| 301 | |
| 302 | // main loop here |
| 303 | // XXX: if you change anything in the main rendering loop, make sure it goes in here too (if needed) |
| 304 | |
| 305 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! loopRunning = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 306 | while (loopRunning) |
| 307 | { |
| 308 | SDL_Eventcxx . . $ SDL_Event# event; |
| 309 | |
| 310 | beginFPSCountercxx . . $ beginFPSCounter(49f6e7a06ebc5aa8).(); |
| 311 | sinkVisualizerBarscxx . . $ sinkVisualizerBars(49f6e7a06ebc5aa8).(); |
| 312 | updateChannelSyncBuffercxx . . $ updateChannelSyncBuffer(49f6e7a06ebc5aa8).(); |
| 313 | readMouseXYcxx . . $ readMouseXY(49f6e7a06ebc5aa8).(); |
| 314 | |
| 315 | while (SDL_PollEventcxx . . $ SDL_PollEvent(c228975526fb3e93).(&event)) |
| 316 | { |
| 317 | if (event.typecxx . . $ SDL_Event#type. == SDL_WINDOWEVENTcxx . . $ SDL_WINDOWEVENT.) |
| 318 | { |
| 319 | if (event.windowcxx . . $ SDL_Event#window..eventcxx . . $ SDL_WindowEvent#event. == SDL_WINDOWEVENT_HIDDENcxx . . $ SDL_WINDOWEVENT_HIDDEN.) |
| 320 | videocxx . . $ video..windowHiddencxx . . $ video_t#windowHidden. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 321 | else if (event.windowcxx . . $ SDL_Event#window..eventcxx . . $ SDL_WindowEvent#event. == SDL_WINDOWEVENT_SHOWNcxx . . $ SDL_WINDOWEVENT_SHOWN.) |
| 322 | videocxx . . $ video..windowHiddencxx . . $ video_t#windowHidden. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 323 | |
| 324 | // reset vblank end time if we minimize window |
| 325 | if (event.windowcxx . . $ SDL_Event#window..eventcxx . . $ SDL_WindowEvent#event. == SDL_WINDOWEVENT_MINIMIZEDcxx . . $ SDL_WINDOWEVENT_MINIMIZED. || event.windowcxx . . $ SDL_Event#window..eventcxx . . $ SDL_WindowEvent#event. == SDL_WINDOWEVENT_FOCUS_LOSTcxx . . $ SDL_WINDOWEVENT_FOCUS_LOST.) |
| 326 | hpc_ResetCounterscxx . . $ hpc_ResetCounters(efacbc4df292ea9a).(&videocxx . . $ video..vblankHpccxx . . $ video_t#vblankHpc.); |
| 327 | } |
| 328 | else if (event.typecxx . . $ SDL_Event#type. == SDL_KEYDOWNcxx . . $ SDL_KEYDOWN.) |
| 329 | { |
| 330 | SDL_Keycodecxx . . $ SDL_Keycode# key = event.keycxx . . $ SDL_Event#key..keysymcxx . . $ SDL_KeyboardEvent#keysym..symcxx . . $ SDL_Keysym#sym.; |
| 331 | |
| 332 | // abort (escape key) |
| 333 | if (key == SDLK_ESCAPEcxx . . $ SDLK_ESCAPE.) |
| 334 | { |
| 335 | returnValue = d.abortReturnValuecxx . . $ dialog_t#abortReturnValue.; |
| 336 | |
| 337 | loopRunning = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 338 | break; |
| 339 | } |
| 340 | |
| 341 | // default action (return/enter key) |
| 342 | if (key == SDLK_RETURNcxx . . $ SDLK_RETURN. || key == SDLK_KP_ENTERcxx . . $ SDLK_KP_ENTER.) |
| 343 | { |
| 344 | returnValue = d.defaultReturnValuecxx . . $ dialog_t#defaultReturnValue.; |
| 345 | |
| 346 | loopRunning = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 347 | break; |
| 348 | } |
| 349 | |
| 350 | // test keybindings |
| 351 | for (int32_tcxx . . $ int32_t# i = 0; i < d.numButtonscxx . . $ dialog_t#numButtons.; i++) |
| 352 | { |
| 353 | button_tcxx . . $ button_t# *b = &d.buttonscxx . . $ dialog_t#buttons.[i]; |
| 354 | if (b->callbackcxx . . $ choice_t#callback. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! && key == b->keyBindingcxx . . $ choice_t#keyBinding.) |
| 355 | { |
| 356 | returnValue = b->returnValuecxx . . $ choice_t#returnValue.; |
| 357 | |
| 358 | loopRunning = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 359 | break; |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | else if (event.typecxx . . $ SDL_Event#type. == SDL_MOUSEBUTTONDOWNcxx . . $ SDL_MOUSEBUTTONDOWN.) |
| 364 | { |
| 365 | if (event.buttoncxx . . $ SDL_Event#button..buttoncxx . . $ SDL_MouseButtonEvent#button. == SDL_BUTTON_LEFTcxx . . $ `<external>/13849749812924280863/SDL_mouse.h:445:9`!) |
| 366 | { |
| 367 | mousecxx . . $ mouse..leftButtonPressedcxx . . $ mouse_t#leftButtonPressed. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 368 | mousecxx . . $ mouse..buttonWaitingcxx . . $ mouse_t#buttonWaiting. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 369 | mousecxx . . $ mouse..repeatCountercxx . . $ mouse_t#repeatCounter. = 0; |
| 370 | } |
| 371 | |
| 372 | // abort (right mouse button) |
| 373 | if (event.buttoncxx . . $ SDL_Event#button..buttoncxx . . $ SDL_MouseButtonEvent#button. == SDL_BUTTON_RIGHTcxx . . $ `<external>/13849749812924280863/SDL_mouse.h:447:9`!) |
| 374 | { |
| 375 | returnValue = d.abortReturnValuecxx . . $ dialog_t#abortReturnValue.; |
| 376 | |
| 377 | loopRunning = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 378 | break; |
| 379 | } |
| 380 | |
| 381 | // test buttons |
| 382 | if (event.buttoncxx . . $ SDL_Event#button..buttoncxx . . $ SDL_MouseButtonEvent#button. == SDL_BUTTON_LEFTcxx . . $ `<external>/13849749812924280863/SDL_mouse.h:445:9`!) |
| 383 | { |
| 384 | for (int32_tcxx . . $ int32_t# i = 0; i < d.numButtonscxx . . $ dialog_t#numButtons.; i++) |
| 385 | { |
| 386 | button_tcxx . . $ button_t# *b = &d.buttonscxx . . $ dialog_t#buttons.[i]; |
| 387 | |
| 388 | const int32_tcxx . . $ int32_t# x2 = (b->clickableWidthcxx . . $ choice_t#clickableWidth. > 0) ? (b->x1cxx . . $ choice_t#x1. + b->clickableWidthcxx . . $ choice_t#clickableWidth.) : b->x2cxx . . $ choice_t#x2.; |
| 389 | if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. >= b->x1cxx . . $ choice_t#x1. && mousecxx . . $ mouse..xcxx . . $ mouse_t#x. <= x2 && mousecxx . . $ mouse..ycxx . . $ mouse_t#y. >= b->y1cxx . . $ choice_t#y1. && mousecxx . . $ mouse..ycxx . . $ mouse_t#y. <= b->y2cxx . . $ choice_t#y2.) |
| 390 | { |
| 391 | if (b->callbackcxx . . $ choice_t#callback. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 392 | { |
| 393 | b->callbackcxx . . $ choice_t#callback.(); |
| 394 | if (b->repeatcxx . . $ choice_t#repeat.) |
| 395 | { |
| 396 | buttonToRepeatcxx . . $ buttonToRepeat. = i; |
| 397 | } |
| 398 | } |
| 399 | else |
| 400 | { |
| 401 | returnValue = b->returnValuecxx . . $ choice_t#returnValue.; |
| 402 | |
| 403 | loopRunning = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 404 | break; |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | else if (event.typecxx . . $ SDL_Event#type. == SDL_MOUSEBUTTONUPcxx . . $ SDL_MOUSEBUTTONUP.) |
| 411 | { |
| 412 | #if defined __APPLE__ && defined __aarch64__ |
| 413 | armMacGhostMouseCursorFix(); |
| 414 | #endif |
| 415 | mousecxx . . $ mouse..buttonWaitCountercxx . . $ mouse_t#buttonWaitCounter. = 0; |
| 416 | mousecxx . . $ mouse..buttonWaitingcxx . . $ mouse_t#buttonWaiting. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 417 | buttonToRepeatcxx . . $ buttonToRepeat. = -1; |
| 418 | |
| 419 | if (event.buttoncxx . . $ SDL_Event#button..buttoncxx . . $ SDL_MouseButtonEvent#button. == SDL_BUTTON_LEFTcxx . . $ `<external>/13849749812924280863/SDL_mouse.h:445:9`!) |
| 420 | mousecxx . . $ mouse..leftButtonPressedcxx . . $ mouse_t#leftButtonPressed. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 421 | } |
| 422 | #if defined __APPLE__ && defined __aarch64__ |
| 423 | else if (event.type == SDL_MOUSEMOTION) |
| 424 | { |
| 425 | armMacGhostMouseCursorFix(); |
| 426 | } |
| 427 | #endif |
| 428 | } |
| 429 | |
| 430 | if (!mousecxx . . $ mouse..buttonWaitingcxx . . $ mouse_t#buttonWaiting. && buttonToRepeatcxx . . $ buttonToRepeat. > -1) |
| 431 | { |
| 432 | button_tcxx . . $ button_t# *b = &d.buttonscxx . . $ dialog_t#buttons.[buttonToRepeatcxx . . $ buttonToRepeat.]; |
| 433 | |
| 434 | if (++mousecxx . . $ mouse..repeatCountercxx . . $ mouse_t#repeatCounter. >= 3) |
| 435 | { |
| 436 | const int32_tcxx . . $ int32_t# x2 = (b->clickableWidthcxx . . $ choice_t#clickableWidth. > 0) ? (b->x1cxx . . $ choice_t#x1. + b->clickableWidthcxx . . $ choice_t#clickableWidth.) : b->x2cxx . . $ choice_t#x2.; |
| 437 | if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. >= b->x1cxx . . $ choice_t#x1. && mousecxx . . $ mouse..xcxx . . $ mouse_t#x. <= x2 && mousecxx . . $ mouse..ycxx . . $ mouse_t#y. >= b->y1cxx . . $ choice_t#y1. && mousecxx . . $ mouse..ycxx . . $ mouse_t#y. <= b->y2cxx . . $ choice_t#y2.) |
| 438 | { |
| 439 | if (b->callbackcxx . . $ choice_t#callback. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 440 | b->callbackcxx . . $ choice_t#callback.(); |
| 441 | } |
| 442 | |
| 443 | mousecxx . . $ mouse..repeatCountercxx . . $ mouse_t#repeatCounter. = 0; |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | updateMouseCounterscxx . . $ updateMouseCounters(49f6e7a06ebc5aa8).(); |
| 448 | renderFrame2cxx . . $ renderFrame2(49f6e7a06ebc5aa8).(); |
| 449 | flipFramecxx . . $ flipFrame(49f6e7a06ebc5aa8).(); |
| 450 | endFPSCountercxx . . $ endFPSCounter(49f6e7a06ebc5aa8).(); |
| 451 | } |
| 452 | |
| 453 | mousecxx . . $ mouse..leftButtonPressedcxx . . $ mouse_t#leftButtonPressed. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 454 | mousecxx . . $ mouse..buttonWaitingcxx . . $ mouse_t#buttonWaiting. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 455 | mousecxx . . $ mouse..buttonWaitCountercxx . . $ mouse_t#buttonWaitCounter. = 0; |
| 456 | mousecxx . . $ mouse..repeatCountercxx . . $ mouse_t#repeatCounter. = 0; |
| 457 | |
| 458 | removeAskBoxcxx . . $ removeAskBox(49f6e7a06ebc5aa8).(); |
| 459 | pointerSetPreviousModecxx . . $ pointerSetPreviousMode(49f6e7a06ebc5aa8).(); |
| 460 | setPrevStatusMessagecxx . . $ setPrevStatusMessage(49f6e7a06ebc5aa8).(); |
| 461 | |
| 462 | SDL_EventStatecxx . . $ SDL_EventState(a6bcbd86f19dd260).(SDL_DROPFILEcxx . . $ SDL_DROPFILE., SDL_ENABLEcxx . . $ `<external>/12778062723415653681/SDL_events.h:1143:9`!); |
| 463 | return returnValue; |
| 464 | } |