| 1 | // for finding memory leaks in debug mode with Visual Studio cxx . . $ `<file>/src/pt2_diskop.c`/ |
| 2 | #if defined _DEBUG && defined _MSC_VER |
| 3 | #include <crtdbg.h> |
| 4 | #endif |
| 5 | |
| 6 | #include <stdio.h> |
| 7 | #include <stdlib.h> |
| 8 | #include <stdint.h> |
| 9 | #include <stdbool.h> |
| 10 | #include <string.h> |
| 11 | #include <math.h> |
| 12 | #include <ctype.h> |
| 13 | #ifdef _WIN32 |
| 14 | #include <direct.h> |
| 15 | #include <io.h> |
| 16 | #define WIN32_MEAN_AND_LEAN |
| 17 | #include <windows.h> |
| 18 | #include <shlobj.h> // SHGetFolderPathW() |
| 19 | #else |
| 20 | #include <unistd.h> |
| 21 | #include <dirent.h> |
| 22 | #endif |
| 23 | #include <fcntl.h> |
| 24 | #include <sys/types.h> |
| 25 | #include <sys/stat.h> |
| 26 | #include <time.h> |
| 27 | #include <limits.h> |
| 28 | #include "pt2_textout.h"cxx . . $ `<file>/src/pt2_textout.h`/ |
| 29 | #include "pt2_diskop.h"cxx . . $ `<file>/src/pt2_diskop.h`/ |
| 30 | #include "pt2_tables.h"cxx . . $ `<file>/src/pt2_tables.h`/ |
| 31 | #include "pt2_module_loader.h"cxx . . $ `<file>/src/pt2_module_loader.h`/ |
| 32 | #include "pt2_config.h"cxx . . $ `<file>/src/pt2_config.h`/ |
| 33 | #include "pt2_visuals.h"cxx . . $ `<file>/src/pt2_visuals.h`/ |
| 34 | #include "pt2_sample_loader.h"cxx . . $ `<file>/src/pt2_sample_loader.h`/ |
| 35 | #include "pt2_bmp.h"cxx . . $ `<file>/src/pt2_bmp.h`/ |
| 36 | #include "pt2_askbox.h"cxx . . $ `<file>/src/pt2_askbox.h`/ |
| 37 | #include "pt2_replayer.h"cxx . . $ `<file>/src/pt2_replayer.h`/ |
| 38 | |
| 39 | typedef struct fileEntry_tcxx . . $ fileEntry_t# |
| 40 | { |
| 41 | UNICHARcxx . . $ UNICHAR# *nameUcxx . . $ fileEntry_t#nameU.; |
| 42 | char firstAnsiCharcxx . . $ fileEntry_t#firstAnsiChar.; // for handleEntryJumping(); |
| 43 | char dateChangedcxx . . $ fileEntry_t#dateChanged.[6 + 1]; |
| 44 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! isDircxx . . $ fileEntry_t#isDir.; |
| 45 | int32_tcxx . . $ int32_t# filesizecxx . . $ fileEntry_t#filesize.; |
| 46 | } fileEntry_tcxx . . $ fileEntry_t#; |
| 47 | |
| 48 | // "look for file" flags |
| 49 | enumcxx . . $ $anonymous_type_5b51120279b42b8f_0# |
| 50 | { |
| 51 | LFF_DONEcxx . . $ LFF_DONE. = 0, |
| 52 | LFF_SKIPcxx . . $ LFF_SKIP. = 1, |
| 53 | LFF_OKcxx . . $ LFF_OK. = 2 |
| 54 | }; |
| 55 | |
| 56 | #ifdef _WIN32 |
| 57 | #define PARENT_DIR_STR L".." |
| 58 | static HANDLE hFind; |
| 59 | #else |
| 60 | #define PARENT_DIR_STRcxx . . $ `src/pt2_diskop.c:60:9`! ".." |
| 61 | static DIRcxx . . $ DIR# *hFindcxx . . $ hFind.; |
| 62 | #endif |
| 63 | |
| 64 | static char fileNameBuffercxx . . $ fileNameBuffer.[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 1]; |
| 65 | static UNICHARcxx . . $ UNICHAR# pathTmpcxx . . $ pathTmp.[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 2]; |
| 66 | static fileEntry_tcxx . . $ fileEntry_t# *diskOpEntrycxx . . $ diskOpEntry.; |
| 67 | |
| 68 | void addSampleFileExtcxx . . $ addSampleFileExt(fda57c8427c60377).(char *fileName) |
| 69 | { |
| 70 | switch (diskopcxx . . $ diskop..smpSaveTypecxx . . $ diskop_t#smpSaveType.) |
| 71 | { |
| 72 | case DISKOP_SMP_WAVcxx . . $ DISKOP_SMP_WAV.: strcatcxx . . $ strcat(b7b3a83273496486).(fileName, ".wav"); break; |
| 73 | case DISKOP_SMP_IFFcxx . . $ DISKOP_SMP_IFF.: strcatcxx . . $ strcat(b7b3a83273496486).(fileName, ".iff"); break; |
| 74 | default: case DISKOP_SMP_RAWcxx . . $ DISKOP_SMP_RAW.: break; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | static fileEntry_tcxx . . $ fileEntry_t# *bufferCreateEmptyDircxx . . $ bufferCreateEmptyDir(2d83065ec3d1664d).(void) // special case: creates a dir entry with a ".." directory |
| 79 | { |
| 80 | fileEntry_tcxx . . $ fileEntry_t# *dirEntry = (fileEntry_tcxx . . $ fileEntry_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof (fileEntry_tcxx . . $ fileEntry_t#)); |
| 81 | if (dirEntry == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 82 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 83 | |
| 84 | dirEntry->nameUcxx . . $ fileEntry_t#nameU. = UNICHAR_STRDUPcxx . . $ `src/pt2_unicode.h:34:9`!(PARENT_DIR_STRcxx . . $ `src/pt2_diskop.c:60:9`!); |
| 85 | if (dirEntry->nameUcxx . . $ fileEntry_t#nameU. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 86 | { |
| 87 | freecxx . . $ free(5d22bdacc48458e8).(dirEntry); |
| 88 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 89 | } |
| 90 | |
| 91 | dirEntry->isDircxx . . $ fileEntry_t#isDir. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 92 | dirEntry->filesizecxx . . $ fileEntry_t#filesize. = 0; |
| 93 | |
| 94 | return dirEntry; |
| 95 | } |
| 96 | |
| 97 | // deciding whether to load this entry into the buffer or not |
| 98 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! listEntrycxx . . $ listEntry(88438d2a276647e7).(fileEntry_tcxx . . $ fileEntry_t# *f) |
| 99 | { |
| 100 | int32_tcxx . . $ int32_t# entryName = (int32_tcxx . . $ int32_t#)UNICHAR_STRLENcxx . . $ `src/pt2_unicode.h:40:9`!(f->nameU); |
| 101 | |
| 102 | #ifdef _WIN32 |
| 103 | if (f->isDir && entryName == 2 && !UNICHAR_STRNICMP(f->nameU, "..", 2)) |
| 104 | return true; // always show ".." directory |
| 105 | #else |
| 106 | if (f->isDircxx . . $ fileEntry_t#isDir. && entryName == 2 && !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, "..", 2) && !(editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath.[0] == '/' && editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath.[1] == '\0')) |
| 107 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; // always show ".." directory (unless in root dir) |
| 108 | #endif |
| 109 | |
| 110 | if (!UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, ".", 1)) |
| 111 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; // skip ".name" entries |
| 112 | |
| 113 | if (f->isDircxx . . $ fileEntry_t#isDir. || diskopcxx . . $ diskop..modecxx . . $ diskop_t#mode. == DISKOP_MODE_SMPcxx . . $ DISKOP_MODE_SMP.) |
| 114 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; // list all entries |
| 115 | |
| 116 | if (entryName >= 4) |
| 117 | { |
| 118 | if (!UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, "MOD.", 4) || !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(&f->nameU[entryName - 4], ".MOD", 4) || |
| 119 | !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, "STK.", 4) || !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(&f->nameU[entryName - 4], ".STK", 4) || |
| 120 | !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, "M15.", 4) || !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(&f->nameU[entryName - 4], ".M15", 4) || |
| 121 | !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, "NST.", 4) || !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(&f->nameU[entryName - 4], ".NST", 4) || |
| 122 | !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, "UST.", 4) || !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(&f->nameU[entryName - 4], ".UST", 4) || |
| 123 | !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, "PP.", 3) || !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(&f->nameU[entryName - 3], ".PP", 3) || |
| 124 | !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(f->nameU, "NT.", 3) || !UNICHAR_STRNICMPcxx . . $ `src/pt2_unicode.h:32:9`!(&f->nameU[entryName - 3], ".NT", 3)) |
| 125 | { |
| 126 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 131 | } |
| 132 | |
| 133 | static int8_tcxx . . $ int8_t# findFirstcxx . . $ findFirst(24a0e90427a55d9a).(fileEntry_tcxx . . $ fileEntry_t# *searchRec) |
| 134 | { |
| 135 | #ifdef _WIN32 |
| 136 | WIN32_FIND_DATAW fData; |
| 137 | SYSTEMTIME sysTime; |
| 138 | #else |
| 139 | struct direntcxx . . $ dirent# *fData; |
| 140 | struct statcxx . . $ stat# st; |
| 141 | #endif |
| 142 | |
| 143 | searchRec->nameUcxx . . $ fileEntry_t#nameU. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; // this one must be initialized |
| 144 | |
| 145 | #ifdef _WIN32 |
| 146 | hFind = FindFirstFileW(L"*", &fData); |
| 147 | if (hFind == NULL || hFind == INVALID_HANDLE_VALUE) |
| 148 | return LFF_DONE; |
| 149 | |
| 150 | searchRec->nameU = UNICHAR_STRDUP(fData.cFileName); |
| 151 | if (searchRec->nameU == NULL) |
| 152 | return LFF_SKIP; |
| 153 | |
| 154 | searchRec->filesize = (fData.nFileSizeHigh > 0) ? -1 : fData.nFileSizeLow; |
| 155 | searchRec->isDir = (fData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false; |
| 156 | #else |
| 157 | hFindcxx . . $ hFind. = opendircxx . . $ opendir(f465d4b65cec8dd2).("."); |
| 158 | if (hFindcxx . . $ hFind. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 159 | return LFF_DONEcxx . . $ LFF_DONE.; |
| 160 | |
| 161 | fData = readdircxx . . $ readdir(ffbaae344e1a615a).(hFindcxx . . $ hFind.); |
| 162 | if (fData == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 163 | return LFF_DONEcxx . . $ LFF_DONE.; |
| 164 | |
| 165 | searchRec->nameUcxx . . $ fileEntry_t#nameU. = UNICHAR_STRDUPcxx . . $ `src/pt2_unicode.h:34:9`!(fData->d_name); |
| 166 | if (searchRec->nameUcxx . . $ fileEntry_t#nameU. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 167 | return LFF_SKIPcxx . . $ LFF_SKIP.; |
| 168 | |
| 169 | searchRec->filesizecxx . . $ fileEntry_t#filesize. = 0; |
| 170 | searchRec->isDircxx . . $ fileEntry_t#isDir. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 171 | |
| 172 | if (statcxx . . $ stat(a9cd1e23e96f423c).(fData->d_namecxx . . $ dirent#d_name., &st) == 0) |
| 173 | { |
| 174 | searchRec->isDircxx . . $ fileEntry_t#isDir. = !!(st.st_modecxx . . $ stat#st_mode. & S_IFDIRcxx . . $ `<external>/531885356569766532/stat.h:105:10`!); |
| 175 | searchRec->filesizecxx . . $ fileEntry_t#filesize. = ((int64_tcxx . . $ int64_t#)st.st_sizecxx . . $ stat#st_size. > INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:112:10`!) ? -1 : (int32_tcxx . . $ int32_t#)st.st_sizecxx . . $ stat#st_size.; |
| 176 | } |
| 177 | #endif |
| 178 | |
| 179 | if (searchRec->filesizecxx . . $ fileEntry_t#filesize. < -1) |
| 180 | searchRec->filesizecxx . . $ fileEntry_t#filesize. = -1; |
| 181 | |
| 182 | if (!listEntrycxx . . $ listEntry(88438d2a276647e7).(searchRec)) |
| 183 | { |
| 184 | // skip entry |
| 185 | freecxx . . $ free(5d22bdacc48458e8).(searchRec->nameUcxx . . $ fileEntry_t#nameU.); |
| 186 | searchRec->nameUcxx . . $ fileEntry_t#nameU. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 187 | return LFF_SKIPcxx . . $ LFF_SKIP.; |
| 188 | } |
| 189 | |
| 190 | #ifdef _WIN32 |
| 191 | FileTimeToSystemTime(&fData.ftLastWriteTime, &sysTime); |
| 192 | snprintf(searchRec->dateChanged, 7, "%02d%02d%02d", sysTime.wDay, sysTime.wMonth, sysTime.wYear % 100); |
| 193 | unicharToAnsi(&searchRec->firstAnsiChar, searchRec->nameU, 1); |
| 194 | #else |
| 195 | strftimecxx . . $ strftime(98e75925167c4f1b).(searchRec->dateChangedcxx . . $ fileEntry_t#dateChanged., 7, "%d%m%y", localtimecxx . . $ localtime(9477a1348abbbc5).(&st.st_mtimecxx . . $ `<external>/16045971866008360577/struct_stat.h:78:11`!)); |
| 196 | searchRec->firstAnsiCharcxx . . $ fileEntry_t#firstAnsiChar. = (char)searchRec->nameUcxx . . $ fileEntry_t#nameU.[0]; |
| 197 | #endif |
| 198 | |
| 199 | return LFF_OKcxx . . $ LFF_OK.; |
| 200 | } |
| 201 | |
| 202 | static int8_tcxx . . $ int8_t# findNextcxx . . $ findNext(24a0e90427a55d9a).(fileEntry_tcxx . . $ fileEntry_t# *searchRec) |
| 203 | { |
| 204 | #ifdef _WIN32 |
| 205 | WIN32_FIND_DATAW fData; |
| 206 | SYSTEMTIME sysTime; |
| 207 | #else |
| 208 | struct direntcxx . . $ dirent# *fData; |
| 209 | struct statcxx . . $ stat# st; |
| 210 | #endif |
| 211 | |
| 212 | searchRec->nameUcxx . . $ fileEntry_t#nameU. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; // important |
| 213 | |
| 214 | #ifdef _WIN32 |
| 215 | if (hFind == NULL || FindNextFileW(hFind, &fData) == 0) |
| 216 | return LFF_DONE; |
| 217 | |
| 218 | searchRec->nameU = UNICHAR_STRDUP(fData.cFileName); |
| 219 | if (searchRec->nameU == NULL) |
| 220 | return LFF_SKIP; |
| 221 | |
| 222 | searchRec->filesize = (fData.nFileSizeHigh > 0) ? -1 : fData.nFileSizeLow; |
| 223 | searchRec->isDir = (fData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false; |
| 224 | |
| 225 | FileTimeToSystemTime(&fData.ftLastWriteTime, &sysTime); |
| 226 | #else |
| 227 | if (hFindcxx . . $ hFind. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || (fData = readdircxx . . $ readdir(ffbaae344e1a615a).(hFindcxx . . $ hFind.)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 228 | return LFF_DONEcxx . . $ LFF_DONE.; |
| 229 | |
| 230 | searchRec->nameUcxx . . $ fileEntry_t#nameU. = UNICHAR_STRDUPcxx . . $ `src/pt2_unicode.h:34:9`!(fData->d_name); |
| 231 | if (searchRec->nameUcxx . . $ fileEntry_t#nameU. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 232 | return LFF_SKIPcxx . . $ LFF_SKIP.; |
| 233 | |
| 234 | searchRec->filesizecxx . . $ fileEntry_t#filesize. = 0; |
| 235 | searchRec->isDircxx . . $ fileEntry_t#isDir. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 236 | |
| 237 | if (statcxx . . $ stat(a9cd1e23e96f423c).(fData->d_namecxx . . $ dirent#d_name., &st) == 0) |
| 238 | { |
| 239 | searchRec->isDircxx . . $ fileEntry_t#isDir. = !!(st.st_modecxx . . $ stat#st_mode. & S_IFDIRcxx . . $ `<external>/531885356569766532/stat.h:105:10`!); |
| 240 | searchRec->filesizecxx . . $ fileEntry_t#filesize. = ((int64_tcxx . . $ int64_t#)st.st_sizecxx . . $ stat#st_size. > INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:112:10`!) ? -1 : (int32_tcxx . . $ int32_t#)st.st_sizecxx . . $ stat#st_size.; |
| 241 | } |
| 242 | #endif |
| 243 | |
| 244 | if (searchRec->filesizecxx . . $ fileEntry_t#filesize. < -1) |
| 245 | searchRec->filesizecxx . . $ fileEntry_t#filesize. = -1; |
| 246 | |
| 247 | if (!listEntrycxx . . $ listEntry(88438d2a276647e7).(searchRec)) |
| 248 | { |
| 249 | // skip entry |
| 250 | freecxx . . $ free(5d22bdacc48458e8).(searchRec->nameUcxx . . $ fileEntry_t#nameU.); |
| 251 | searchRec->nameUcxx . . $ fileEntry_t#nameU. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 252 | return LFF_SKIPcxx . . $ LFF_SKIP.; |
| 253 | } |
| 254 | |
| 255 | #ifdef _WIN32 |
| 256 | FileTimeToSystemTime(&fData.ftLastWriteTime, &sysTime); |
| 257 | snprintf(searchRec->dateChanged, 7, "%02d%02d%02d", sysTime.wDay, sysTime.wMonth, sysTime.wYear % 100); |
| 258 | unicharToAnsi(&searchRec->firstAnsiChar, searchRec->nameU, 1); |
| 259 | #else |
| 260 | strftimecxx . . $ strftime(98e75925167c4f1b).(searchRec->dateChangedcxx . . $ fileEntry_t#dateChanged., 7, "%d%m%y", localtimecxx . . $ localtime(9477a1348abbbc5).(&st.st_mtimecxx . . $ `<external>/16045971866008360577/struct_stat.h:78:11`!)); |
| 261 | searchRec->firstAnsiCharcxx . . $ fileEntry_t#firstAnsiChar. = (char)searchRec->nameUcxx . . $ fileEntry_t#nameU.[0]; |
| 262 | #endif |
| 263 | |
| 264 | return LFF_OKcxx . . $ LFF_OK.; |
| 265 | } |
| 266 | |
| 267 | static void findClosecxx . . $ findClose(49f6e7a06ebc5aa8).(void) |
| 268 | { |
| 269 | if (hFindcxx . . $ hFind. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 270 | { |
| 271 | #ifdef _WIN32 |
| 272 | FindClose(hFind); |
| 273 | #else |
| 274 | closedircxx . . $ closedir(ac30a447bc7c2f80).(hFindcxx . . $ hFind.); |
| 275 | #endif |
| 276 | hFindcxx . . $ hFind. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | void diskOpShowSelectTextcxx . . $ diskOpShowSelectText(49f6e7a06ebc5aa8).(void) |
| 281 | { |
| 282 | if (uicxx . . $ ui..pointerModecxx . . $ ui_t#pointerMode. == POINTER_MODE_MSG1cxx . . $ POINTER_MODE_MSG1. || editorcxx . . $ editor..errorMsgActivecxx . . $ editor_t#errorMsgActive.) |
| 283 | return; |
| 284 | |
| 285 | if (diskopcxx . . $ diskop..modecxx . . $ diskop_t#mode. == DISKOP_MODE_MODcxx . . $ DISKOP_MODE_MOD.) |
| 286 | setStatusMessagecxx . . $ setStatusMessage(90ef5b561fbcb8de).("SELECT MODULE", NO_CARRYcxx . . $ NO_CARRY.); |
| 287 | else |
| 288 | setStatusMessagecxx . . $ setStatusMessage(90ef5b561fbcb8de).("SELECT SAMPLE", NO_CARRYcxx . . $ NO_CARRY.); |
| 289 | } |
| 290 | |
| 291 | void handleEntryJumpingcxx . . $ handleEntryJumping(d4f767463ce0a6b3).(SDL_Keycodecxx . . $ SDL_Keycode# jumpToChar) // SHIFT+character |
| 292 | { |
| 293 | if (diskOpEntrycxx . . $ diskOpEntry. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 294 | { |
| 295 | fileEntry_tcxx . . $ fileEntry_t# *f; |
| 296 | |
| 297 | // if last jump key was the same, go to next page of matching character |
| 298 | if (diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries. > DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`! && diskopcxx . . $ diskop..lastEntryJumpKeycxx . . $ diskop_t#lastEntryJumpKey. == jumpToChar) |
| 299 | { |
| 300 | for (int32_tcxx . . $ int32_t# i = 0; i < DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!; i++) |
| 301 | { |
| 302 | int32_tcxx . . $ int32_t# offset = diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset.+DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!; |
| 303 | if (offset > diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.-DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!) |
| 304 | offset = diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.-DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!; |
| 305 | |
| 306 | f = &diskOpEntrycxx . . $ diskOpEntry.[offset]; |
| 307 | |
| 308 | if (!f->isDircxx . . $ fileEntry_t#isDir. && tolowercxx . . $ `<external>/17904084882347303253/ctype.h:220:11`!(f->firstAnsiChar) == jumpToChar) |
| 309 | { |
| 310 | diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset. += DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!; |
| 311 | if (diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset. > diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.-DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!) |
| 312 | diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset. = diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.-DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!; |
| 313 | |
| 314 | uicxx . . $ ui..updateDiskOpFileListcxx . . $ ui_t#updateDiskOpFileList. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 315 | return; |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | diskopcxx . . $ diskop..lastEntryJumpKeycxx . . $ diskop_t#lastEntryJumpKey. = jumpToChar; |
| 321 | |
| 322 | // jump to first match from the beginning of file list |
| 323 | |
| 324 | f = diskOpEntrycxx . . $ diskOpEntry.; |
| 325 | for (int32_tcxx . . $ int32_t# i = 0; i < diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.; i++, f++) |
| 326 | { |
| 327 | if (!f->isDircxx . . $ fileEntry_t#isDir. && tolowercxx . . $ `<external>/17904084882347303253/ctype.h:220:11`!(f->firstAnsiChar) == jumpToChar) |
| 328 | { |
| 329 | if (diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries. > DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!) |
| 330 | { |
| 331 | diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset. = i; |
| 332 | if (diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset. > diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.-DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!) |
| 333 | diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset. = diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.-DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!; |
| 334 | |
| 335 | uicxx . . $ ui..updateDiskOpFileListcxx . . $ ui_t#updateDiskOpFileList. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 336 | } |
| 337 | |
| 338 | return; |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | // character not found in file list, show red mouse pointer (error) |
| 344 | editorcxx . . $ editor..errorMsgActivecxx . . $ editor_t#errorMsgActive. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 345 | editorcxx . . $ editor..errorMsgBlockcxx . . $ editor_t#errorMsgBlock. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 346 | editorcxx . . $ editor..errorMsgCountercxx . . $ editor_t#errorMsgCounter. = 0; |
| 347 | |
| 348 | setErrPointercxx . . $ setErrPointer(49f6e7a06ebc5aa8).(); |
| 349 | } |
| 350 | |
| 351 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! diskOpEntryIsEmptycxx . . $ diskOpEntryIsEmpty(83c267b20bac841a).(int32_tcxx . . $ int32_t# fileIndex) |
| 352 | { |
| 353 | if (diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset.+fileIndex >= diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.) |
| 354 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 355 | |
| 356 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 357 | } |
| 358 | |
| 359 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! diskOpEntryIsDircxx . . $ diskOpEntryIsDir(83c267b20bac841a).(int32_tcxx . . $ int32_t# fileIndex) |
| 360 | { |
| 361 | if (diskOpEntrycxx . . $ diskOpEntry. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 362 | { |
| 363 | if (!diskOpEntryIsEmptycxx . . $ diskOpEntryIsEmpty(83c267b20bac841a).(fileIndex)) |
| 364 | return diskOpEntrycxx . . $ diskOpEntry.[diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset.+fileIndex].isDircxx . . $ fileEntry_t#isDir.; |
| 365 | } |
| 366 | |
| 367 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; // couldn't look up entry |
| 368 | } |
| 369 | |
| 370 | char *diskOpGetAnsiEntrycxx . . $ diskOpGetAnsiEntry(ff224f080444ee45).(int32_tcxx . . $ int32_t# fileIndex) |
| 371 | { |
| 372 | if (diskOpEntrycxx . . $ diskOpEntry. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && !diskOpEntryIsEmptycxx . . $ diskOpEntryIsEmpty(83c267b20bac841a).(fileIndex)) |
| 373 | { |
| 374 | UNICHARcxx . . $ UNICHAR# *filenameU = diskOpEntrycxx . . $ diskOpEntry.[diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset.+fileIndex].nameUcxx . . $ fileEntry_t#nameU.; |
| 375 | if (filenameU != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 376 | { |
| 377 | unicharToAnsicxx . . $ unicharToAnsi(9105ef05e8145e1).(fileNameBuffercxx . . $ fileNameBuffer., filenameU, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!); |
| 378 | return fileNameBuffercxx . . $ fileNameBuffer.; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 383 | } |
| 384 | |
| 385 | UNICHARcxx . . $ UNICHAR# *diskOpGetUnicodeEntrycxx . . $ diskOpGetUnicodeEntry(ff224f080444ee45).(int32_tcxx . . $ int32_t# fileIndex) |
| 386 | { |
| 387 | if (diskOpEntrycxx . . $ diskOpEntry. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && !diskOpEntryIsEmptycxx . . $ diskOpEntryIsEmpty(83c267b20bac841a).(fileIndex)) |
| 388 | return diskOpEntrycxx . . $ diskOpEntry.[diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset.+fileIndex].nameUcxx . . $ fileEntry_t#nameU.; |
| 389 | |
| 390 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 391 | } |
| 392 | |
| 393 | static void setVisualPathToCwdcxx . . $ setVisualPathToCwd(49f6e7a06ebc5aa8).(void) |
| 394 | { |
| 395 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath., 0, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 10); |
| 396 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(editorcxx . . $ editor..currPathUcxx . . $ editor_t#currPathU., 0, (PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 2) * sizeof (UNICHARcxx . . $ UNICHAR#)); |
| 397 | UNICHAR_GETCWDcxx . . $ `src/pt2_unicode.h:37:9`!(editor.currPathU, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!); |
| 398 | |
| 399 | if (diskopcxx . . $ diskop..modecxx . . $ diskop_t#mode. == DISKOP_MODE_MODcxx . . $ DISKOP_MODE_MOD.) |
| 400 | UNICHAR_STRCPYcxx . . $ `src/pt2_unicode.h:27:9`!(editor.modulesPathU, editor.currPathU); |
| 401 | else |
| 402 | UNICHAR_STRCPYcxx . . $ `src/pt2_unicode.h:27:9`!(editor.samplesPathU, editor.currPathU); |
| 403 | |
| 404 | unicharToAnsicxx . . $ unicharToAnsi(9105ef05e8145e1).(editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath., editorcxx . . $ editor..currPathUcxx . . $ editor_t#currPathU., PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!); |
| 405 | uicxx . . $ ui..updateDiskOpPathTextcxx . . $ ui_t#updateDiskOpPathText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 406 | } |
| 407 | |
| 408 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! changePathToDesktopcxx . . $ changePathToDesktop(c9857a73d68e59ba).(void) |
| 409 | { |
| 410 | #ifdef _WIN32 |
| 411 | UNICHAR pathU[PATH_MAX + 2]; |
| 412 | if (SHGetFolderPathW(NULL, CSIDL_DESKTOPDIRECTORY, NULL, 0, pathU) >= 0) |
| 413 | { |
| 414 | if (UNICHAR_CHDIR(pathU) == 0) |
| 415 | return true; |
| 416 | } |
| 417 | |
| 418 | return false; |
| 419 | #else |
| 420 | char *homePath = getenvcxx . . $ getenv(a8b8e32347182212).("HOME"); |
| 421 | if (homePath != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && chdircxx . . $ chdir(5c4306d8553b3696).(homePath) == 0) |
| 422 | { |
| 423 | chdircxx . . $ chdir(5c4306d8553b3696).("Desktop"); // keep home dir in case we couldn't change the dir to desktop |
| 424 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 425 | } |
| 426 | |
| 427 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 428 | #endif |
| 429 | } |
| 430 | |
| 431 | #ifndef _WIN32 |
| 432 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! changePathToHomecxx . . $ changePathToHome(c9857a73d68e59ba).(void) |
| 433 | { |
| 434 | char *homePath = getenvcxx . . $ getenv(a8b8e32347182212).("HOME"); |
| 435 | if (homePath != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && chdircxx . . $ chdir(5c4306d8553b3696).(homePath) == 0) |
| 436 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 437 | |
| 438 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 439 | } |
| 440 | #endif |
| 441 | |
| 442 | void setPathFromDiskOpModecxx . . $ setPathFromDiskOpMode(49f6e7a06ebc5aa8).(void) |
| 443 | { |
| 444 | UNICHAR_CHDIRcxx . . $ `src/pt2_unicode.h:36:9`!((diskop.mode == DISKOP_MODE_MOD) ? editor.modulesPathU : editor.samplesPathU); |
| 445 | setVisualPathToCwdcxx . . $ setVisualPathToCwd(49f6e7a06ebc5aa8).(); |
| 446 | } |
| 447 | |
| 448 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! diskOpSetPathcxx . . $ diskOpSetPath(b66281b8031ad34f).(UNICHARcxx . . $ UNICHAR# *path, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cache) |
| 449 | { |
| 450 | if (path != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && UNICHAR_CHDIRcxx . . $ `src/pt2_unicode.h:36:9`!(path) == 0) |
| 451 | { |
| 452 | setVisualPathToCwdcxx . . $ setVisualPathToCwd(49f6e7a06ebc5aa8).(); |
| 453 | |
| 454 | if (cache) |
| 455 | diskopcxx . . $ diskop..cachedcxx . . $ diskop_t#cached. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 456 | |
| 457 | if (uicxx . . $ ui..diskOpScreenShowncxx . . $ ui_t#diskOpScreenShown.) |
| 458 | uicxx . . $ ui..updateDiskOpFileListcxx . . $ ui_t#updateDiskOpFileList. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 459 | |
| 460 | diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset. = 0; |
| 461 | diskopcxx . . $ diskop..lastEntryJumpKeycxx . . $ diskop_t#lastEntryJumpKey. = SDLK_UNKNOWNcxx . . $ SDLK_UNKNOWN.; |
| 462 | |
| 463 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 464 | } |
| 465 | else |
| 466 | { |
| 467 | setVisualPathToCwdcxx . . $ setVisualPathToCwd(49f6e7a06ebc5aa8).(); |
| 468 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("CAN'T OPEN DIR !"); |
| 469 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | void diskOpSetInitPathcxx . . $ diskOpSetInitPath(49f6e7a06ebc5aa8).(void) |
| 474 | { |
| 475 | // default module path |
| 476 | if (configcxx . . $ config..defModulesDircxx . . $ config_t#defModulesDir.[0] != '\0') |
| 477 | { |
| 478 | #ifdef _WIN32 |
| 479 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.defModulesDir, -1, pathTmp, PATH_MAX); |
| 480 | #else |
| 481 | strcpycxx . . $ strcpy(b7b3a83273496486).(pathTmpcxx . . $ pathTmp., configcxx . . $ config..defModulesDircxx . . $ config_t#defModulesDir.); |
| 482 | #endif |
| 483 | UNICHAR_STRCPYcxx . . $ `src/pt2_unicode.h:27:9`!(editor.modulesPathU, pathTmp); |
| 484 | } |
| 485 | else |
| 486 | { |
| 487 | // no path set in config, set to current working directory |
| 488 | UNICHAR_GETCWDcxx . . $ `src/pt2_unicode.h:37:9`!(editor.modulesPathU, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!); |
| 489 | } |
| 490 | |
| 491 | // default sample path |
| 492 | if (configcxx . . $ config..defSamplesDircxx . . $ config_t#defSamplesDir.[0] != '\0') |
| 493 | { |
| 494 | #ifdef _WIN32 |
| 495 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, config.defSamplesDir, -1, pathTmp, PATH_MAX); |
| 496 | #else |
| 497 | strcpycxx . . $ strcpy(b7b3a83273496486).(pathTmpcxx . . $ pathTmp., configcxx . . $ config..defSamplesDircxx . . $ config_t#defSamplesDir.); |
| 498 | #endif |
| 499 | UNICHAR_STRCPYcxx . . $ `src/pt2_unicode.h:27:9`!(editor.samplesPathU, pathTmp); |
| 500 | } |
| 501 | else |
| 502 | { |
| 503 | // no path set in config, set to current working directory |
| 504 | UNICHAR_GETCWDcxx . . $ `src/pt2_unicode.h:37:9`!(editor.samplesPathU, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!); |
| 505 | } |
| 506 | |
| 507 | setPathFromDiskOpModecxx . . $ setPathFromDiskOpMode(49f6e7a06ebc5aa8).(); |
| 508 | } |
| 509 | |
| 510 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allocDiskOpVarscxx . . $ allocDiskOpVars(c9857a73d68e59ba).(void) |
| 511 | { |
| 512 | editorcxx . . $ editor..fileNameTmpUcxx . . $ editor_t#fileNameTmpU. = (UNICHARcxx . . $ UNICHAR# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 2, sizeof (UNICHARcxx . . $ UNICHAR#)); |
| 513 | editorcxx . . $ editor..entryNameTmpcxx . . $ editor_t#entryNameTmp. = (char *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 10, sizeof (char)); |
| 514 | editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath. = (char *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 10, sizeof (char)); |
| 515 | editorcxx . . $ editor..currPathUcxx . . $ editor_t#currPathU. = (UNICHARcxx . . $ UNICHAR# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 2, sizeof (UNICHARcxx . . $ UNICHAR#)); |
| 516 | editorcxx . . $ editor..modulesPathUcxx . . $ editor_t#modulesPathU. = (UNICHARcxx . . $ UNICHAR# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 2, sizeof (UNICHARcxx . . $ UNICHAR#)); |
| 517 | editorcxx . . $ editor..samplesPathUcxx . . $ editor_t#samplesPathU. = (UNICHARcxx . . $ UNICHAR# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 2, sizeof (UNICHARcxx . . $ UNICHAR#)); |
| 518 | |
| 519 | if (editorcxx . . $ editor..fileNameTmpUcxx . . $ editor_t#fileNameTmpU. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || editorcxx . . $ editor..entryNameTmpcxx . . $ editor_t#entryNameTmp. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || |
| 520 | editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || editorcxx . . $ editor..currPathUcxx . . $ editor_t#currPathU. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || |
| 521 | editorcxx . . $ editor..modulesPathUcxx . . $ editor_t#modulesPathU. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || editorcxx . . $ editor..samplesPathUcxx . . $ editor_t#samplesPathU. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 522 | { |
| 523 | // allocated leftovers are free'd lateron |
| 524 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 525 | } |
| 526 | |
| 527 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 528 | } |
| 529 | |
| 530 | void freeDiskOpMemcxx . . $ freeDiskOpMem(49f6e7a06ebc5aa8).(void) |
| 531 | { |
| 532 | if (editorcxx . . $ editor..fileNameTmpUcxx . . $ editor_t#fileNameTmpU. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) freecxx . . $ free(5d22bdacc48458e8).(editorcxx . . $ editor..fileNameTmpUcxx . . $ editor_t#fileNameTmpU.); |
| 533 | if (editorcxx . . $ editor..entryNameTmpcxx . . $ editor_t#entryNameTmp. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) freecxx . . $ free(5d22bdacc48458e8).(editorcxx . . $ editor..entryNameTmpcxx . . $ editor_t#entryNameTmp.); |
| 534 | if (editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) freecxx . . $ free(5d22bdacc48458e8).(editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath.); |
| 535 | if (editorcxx . . $ editor..currPathUcxx . . $ editor_t#currPathU. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) freecxx . . $ free(5d22bdacc48458e8).(editorcxx . . $ editor..currPathUcxx . . $ editor_t#currPathU.); |
| 536 | if (editorcxx . . $ editor..modulesPathUcxx . . $ editor_t#modulesPathU. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) freecxx . . $ free(5d22bdacc48458e8).(editorcxx . . $ editor..modulesPathUcxx . . $ editor_t#modulesPathU.); |
| 537 | if (editorcxx . . $ editor..samplesPathUcxx . . $ editor_t#samplesPathU. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) freecxx . . $ free(5d22bdacc48458e8).(editorcxx . . $ editor..samplesPathUcxx . . $ editor_t#samplesPathU.); |
| 538 | } |
| 539 | |
| 540 | void freeDiskOpEntryMemcxx . . $ freeDiskOpEntryMem(49f6e7a06ebc5aa8).(void) |
| 541 | { |
| 542 | if (diskOpEntrycxx . . $ diskOpEntry. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 543 | { |
| 544 | for (int32_tcxx . . $ int32_t# i = 0; i < diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.; i++) |
| 545 | { |
| 546 | if (diskOpEntrycxx . . $ diskOpEntry.[i].nameUcxx . . $ fileEntry_t#nameU. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 547 | freecxx . . $ free(5d22bdacc48458e8).(diskOpEntrycxx . . $ diskOpEntry.[i].nameUcxx . . $ fileEntry_t#nameU.); |
| 548 | } |
| 549 | |
| 550 | freecxx . . $ free(5d22bdacc48458e8).(diskOpEntrycxx . . $ diskOpEntry.); |
| 551 | diskOpEntrycxx . . $ diskOpEntry. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 552 | } |
| 553 | |
| 554 | diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries. = 0; |
| 555 | } |
| 556 | |
| 557 | // thanks to aTc for creating this simplified routine for qsort() (I edited it a little bit) |
| 558 | static int32_tcxx . . $ int32_t# fileEntryComparecxx . . $ fileEntryCompare(9148c8c3ff42c9d8).(const void *f1, const void *f2) |
| 559 | { |
| 560 | static char fn_1[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!+1], fn_2[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!+1]; |
| 561 | |
| 562 | fileEntry_tcxx . . $ fileEntry_t# *fe1 = (fileEntry_tcxx . . $ fileEntry_t# *)f1; |
| 563 | fileEntry_tcxx . . $ fileEntry_t# *fe2 = (fileEntry_tcxx . . $ fileEntry_t# *)f2; |
| 564 | |
| 565 | unicharToAnsicxx . . $ unicharToAnsi(9105ef05e8145e1).(fn_1, fe1->nameUcxx . . $ fileEntry_t#nameU., PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!); |
| 566 | unicharToAnsicxx . . $ unicharToAnsi(9105ef05e8145e1).(fn_2, fe2->nameUcxx . . $ fileEntry_t#nameU., PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!); |
| 567 | |
| 568 | // ".." directories are always sorted first |
| 569 | if (fe1->isDircxx . . $ fileEntry_t#isDir. && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(fn_1, "..") == 0) return -1; |
| 570 | if (fe2->isDircxx . . $ fileEntry_t#isDir. && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(fn_2, "..") == 0) return 1; |
| 571 | |
| 572 | /* ProTracker handles names in upper case during sorting, |
| 573 | ** convert the string case. |
| 574 | */ |
| 575 | const int32_tcxx . . $ int32_t# fe1_l = (int32_tcxx . . $ int32_t#)strlencxx . . $ strlen(751346f8406fd082).(fn_1); |
| 576 | const int32_tcxx . . $ int32_t# fe2_l = (int32_tcxx . . $ int32_t#)strlencxx . . $ strlen(751346f8406fd082).(fn_2); |
| 577 | for (int32_tcxx . . $ int32_t# i = 0; i < fe1_l; i++) fn_1[i] = (char)touppercxx . . $ `<external>/17904084882347303253/ctype.h:221:11`!(fn_1[i]); |
| 578 | for (int32_tcxx . . $ int32_t# i = 0; i < fe2_l; i++) fn_2[i] = (char)touppercxx . . $ `<external>/17904084882347303253/ctype.h:221:11`!(fn_2[i]); |
| 579 | |
| 580 | // if both entries are the same type |
| 581 | if (fe1->isDircxx . . $ fileEntry_t#isDir. == fe2->isDircxx . . $ fileEntry_t#isDir.) |
| 582 | return strcmpcxx . . $ strcmp(5ae29d726ae57f88).(fn_1, fn_2); |
| 583 | |
| 584 | // different types, so one of them is a dir |
| 585 | if (fe1->isDircxx . . $ fileEntry_t#isDir.) |
| 586 | return -1; // first one is a dir |
| 587 | |
| 588 | return 1; // second one is a dir |
| 589 | } |
| 590 | |
| 591 | static void sortEntriescxx . . $ sortEntries(49f6e7a06ebc5aa8).(void) |
| 592 | { |
| 593 | if (diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries. >= 2) |
| 594 | qsortcxx . . $ qsort(ebb60b13a65e77d7).(diskOpEntrycxx . . $ diskOpEntry., diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries., sizeof (fileEntry_tcxx . . $ fileEntry_t#), fileEntryComparecxx . . $ fileEntryCompare(9148c8c3ff42c9d8).); |
| 595 | } |
| 596 | |
| 597 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! diskOpFillBuffercxx . . $ diskOpFillBuffer(c9857a73d68e59ba).(void) |
| 598 | { |
| 599 | fileEntry_tcxx . . $ fileEntry_t# tmpBuffer; |
| 600 | |
| 601 | diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset. = 0; |
| 602 | diskopcxx . . $ diskop..lastEntryJumpKeycxx . . $ diskop_t#lastEntryJumpKey. = SDLK_UNKNOWNcxx . . $ SDLK_UNKNOWN.; |
| 603 | |
| 604 | // do we have a path set? |
| 605 | if (editorcxx . . $ editor..currPathUcxx . . $ editor_t#currPathU.[0] == '\0') |
| 606 | setVisualPathToCwdcxx . . $ setVisualPathToCwd(49f6e7a06ebc5aa8).(); |
| 607 | |
| 608 | freeDiskOpEntryMemcxx . . $ freeDiskOpEntryMem(49f6e7a06ebc5aa8).(); |
| 609 | |
| 610 | // fill disk op. buffer (type, size, path, file name, date changed) |
| 611 | |
| 612 | // read first file |
| 613 | uint8_tcxx . . $ uint8_t# lastFindFileFlag = findFirstcxx . . $ findFirst(24a0e90427a55d9a).(&tmpBuffer); |
| 614 | if (lastFindFileFlag != LFF_DONEcxx . . $ LFF_DONE. && lastFindFileFlag != LFF_SKIPcxx . . $ LFF_SKIP.) |
| 615 | { |
| 616 | diskOpEntrycxx . . $ diskOpEntry. = (fileEntry_tcxx . . $ fileEntry_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof (fileEntry_tcxx . . $ fileEntry_t#) * (diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries. + 1)); |
| 617 | if (diskOpEntrycxx . . $ diskOpEntry. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 618 | { |
| 619 | findClosecxx . . $ findClose(49f6e7a06ebc5aa8).(); |
| 620 | freeDiskOpEntryMemcxx . . $ freeDiskOpEntryMem(49f6e7a06ebc5aa8).(); |
| 621 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 622 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 623 | } |
| 624 | |
| 625 | memcpycxx . . $ memcpy(cc817cb175f282d).(&diskOpEntrycxx . . $ diskOpEntry.[diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.], &tmpBuffer, sizeof (fileEntry_tcxx . . $ fileEntry_t#)); |
| 626 | diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.++; |
| 627 | } |
| 628 | |
| 629 | // read remaining files |
| 630 | while (lastFindFileFlag != LFF_DONEcxx . . $ LFF_DONE.) |
| 631 | { |
| 632 | lastFindFileFlag = findNextcxx . . $ findNext(24a0e90427a55d9a).(&tmpBuffer); |
| 633 | if (lastFindFileFlag != LFF_DONEcxx . . $ LFF_DONE. && lastFindFileFlag != LFF_SKIPcxx . . $ LFF_SKIP.) |
| 634 | { |
| 635 | fileEntry_tcxx . . $ fileEntry_t# *newPtr = (fileEntry_tcxx . . $ fileEntry_t# *)realloccxx . . $ realloc(417ab160f6baadc6).(diskOpEntrycxx . . $ diskOpEntry., sizeof (fileEntry_tcxx . . $ fileEntry_t#) * (diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries. + 1)); |
| 636 | if (newPtr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 637 | { |
| 638 | findClosecxx . . $ findClose(49f6e7a06ebc5aa8).(); |
| 639 | freeDiskOpEntryMemcxx . . $ freeDiskOpEntryMem(49f6e7a06ebc5aa8).(); |
| 640 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 641 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 642 | } |
| 643 | diskOpEntrycxx . . $ diskOpEntry. = newPtr; |
| 644 | |
| 645 | memcpycxx . . $ memcpy(cc817cb175f282d).(&diskOpEntrycxx . . $ diskOpEntry.[diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.], &tmpBuffer, sizeof (fileEntry_tcxx . . $ fileEntry_t#)); |
| 646 | diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.++; |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | findClosecxx . . $ findClose(49f6e7a06ebc5aa8).(); |
| 651 | |
| 652 | if (diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries. > 0) |
| 653 | { |
| 654 | sortEntriescxx . . $ sortEntries(49f6e7a06ebc5aa8).(); |
| 655 | } |
| 656 | else |
| 657 | { |
| 658 | // access denied or out of memory - create parent directory link |
| 659 | diskOpEntrycxx . . $ diskOpEntry. = bufferCreateEmptyDircxx . . $ bufferCreateEmptyDir(2d83065ec3d1664d).(); |
| 660 | if (diskOpEntrycxx . . $ diskOpEntry. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 661 | diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries. = 1; |
| 662 | else |
| 663 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 664 | } |
| 665 | |
| 666 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 667 | } |
| 668 | |
| 669 | static int32_tcxx . . $ int32_t# diskOpFillThreadFunccxx . . $ diskOpFillThreadFunc(dedf1e9b1c614a07).(void *ptr) |
| 670 | { |
| 671 | (void)ptr; |
| 672 | |
| 673 | diskopcxx . . $ diskop..isFillingcxx . . $ diskop_t#isFilling. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 674 | diskOpFillBuffercxx . . $ diskOpFillBuffer(c9857a73d68e59ba).(); |
| 675 | diskopcxx . . $ diskop..isFillingcxx . . $ diskop_t#isFilling. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 676 | |
| 677 | uicxx . . $ ui..updateDiskOpFileListcxx . . $ ui_t#updateDiskOpFileList. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 678 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 679 | } |
| 680 | |
| 681 | static void printFileSizecxx . . $ printFileSize(e024800d0cc7df14).(fileEntry_tcxx . . $ fileEntry_t# *entry, uint16_tcxx . . $ uint16_t# x, uint16_tcxx . . $ uint16_t# y) |
| 682 | { |
| 683 | char tmpStr[7]; |
| 684 | |
| 685 | if (entry->filesizecxx . . $ fileEntry_t#filesize. == -1) // -1 means that the original filesize is above 2GB in our directory reader |
| 686 | { |
| 687 | textOutcxx . . $ textOut(ecc378a7b29cfb5a).(x, y, " >2GB", videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]); |
| 688 | return; |
| 689 | } |
| 690 | |
| 691 | uint32_tcxx . . $ uint32_t# fileSize = (uint32_tcxx . . $ uint32_t#)entry->filesizecxx . . $ fileEntry_t#filesize.; |
| 692 | if (fileSize <= 999999) |
| 693 | { |
| 694 | // bytes |
| 695 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(tmpStr, 7, "%06d", fileSize); |
| 696 | } |
| 697 | else if (fileSize <= 9999999) |
| 698 | { |
| 699 | // kilobytes |
| 700 | fileSize /= 1000; |
| 701 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(tmpStr, 7, "%04dKB", fileSize); |
| 702 | } |
| 703 | else |
| 704 | { |
| 705 | // megabytes |
| 706 | fileSize /= 1000000; |
| 707 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(tmpStr, 7, "%04dMB", fileSize); |
| 708 | } |
| 709 | |
| 710 | // turn zeroes on the left side into spaces |
| 711 | for (int32_tcxx . . $ int32_t# i = 0; i < 7; i++) |
| 712 | { |
| 713 | if (tmpStr[i] != '0') |
| 714 | break; |
| 715 | |
| 716 | tmpStr[i] = ' '; |
| 717 | } |
| 718 | |
| 719 | textOutcxx . . $ textOut(ecc378a7b29cfb5a).(x, y, tmpStr, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]); |
| 720 | } |
| 721 | |
| 722 | static void printEntryNamecxx . . $ printEntryName(4d97746abf11de2f).(char *entryName, int32_tcxx . . $ int32_t# entryLength, int32_tcxx . . $ int32_t# maxLength, uint16_tcxx . . $ uint16_t# x, uint16_tcxx . . $ uint16_t# y) |
| 723 | { |
| 724 | if (entryLength > maxLength) |
| 725 | { |
| 726 | // shorten name and add ".." to end |
| 727 | for (int32_tcxx . . $ int32_t# i = 0; i < maxLength-2; i++) |
| 728 | charOutcxx . . $ charOut(e6c1e39bfc2b37).(x + (i * FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!), y, entryName[i], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]); |
| 729 | |
| 730 | textOutcxx . . $ textOut(ecc378a7b29cfb5a).(x + ((maxLength - 2) * FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!), y, "..", videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]); |
| 731 | } |
| 732 | else |
| 733 | { |
| 734 | // print whole name |
| 735 | textOutcxx . . $ textOut(ecc378a7b29cfb5a).(x, y, entryName, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]); |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | void diskOpRenderFileListcxx . . $ diskOpRenderFileList(49f6e7a06ebc5aa8).(void) |
| 740 | { |
| 741 | uint8_tcxx . . $ uint8_t# maxFilenameChars, maxDirNameChars; |
| 742 | uint16_tcxx . . $ uint16_t# textXStart; |
| 743 | |
| 744 | if (configcxx . . $ config..hideDiskOpDatescxx . . $ config_t#hideDiskOpDates.) |
| 745 | { |
| 746 | textXStart = 8; |
| 747 | maxFilenameChars = 30; |
| 748 | maxDirNameChars = 31; |
| 749 | } |
| 750 | else |
| 751 | { |
| 752 | textXStart = 64; |
| 753 | maxFilenameChars = 23; |
| 754 | maxDirNameChars = 24; |
| 755 | } |
| 756 | |
| 757 | diskOpShowSelectTextcxx . . $ diskOpShowSelectText(49f6e7a06ebc5aa8).(); |
| 758 | |
| 759 | if (diskopcxx . . $ diskop..forceStopReadingcxx . . $ diskop_t#forceStopReading.) |
| 760 | return; |
| 761 | |
| 762 | // if needed, update the file list and add entries |
| 763 | if (!diskopcxx . . $ diskop..cachedcxx . . $ diskop_t#cached.) |
| 764 | { |
| 765 | diskopcxx . . $ diskop..fillThreadcxx . . $ diskop_t#fillThread. = SDL_CreateThreadcxx . . $ SDL_CreateThread(6bda6645e1e04984).(diskOpFillThreadFunccxx . . $ diskOpFillThreadFunc(dedf1e9b1c614a07)., "file lister thread", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 766 | if (diskopcxx . . $ diskop..fillThreadcxx . . $ diskop_t#fillThread. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 767 | return; |
| 768 | |
| 769 | SDL_DetachThreadcxx . . $ SDL_DetachThread(892b99e67b469720).(diskopcxx . . $ diskop..fillThreadcxx . . $ diskop_t#fillThread.); |
| 770 | diskopcxx . . $ diskop..cachedcxx . . $ diskop_t#cached. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 771 | |
| 772 | return; |
| 773 | } |
| 774 | |
| 775 | // clear list |
| 776 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(8, 35, 295, 59, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_BACKGRDcxx . . $ PAL_BACKGRD.]); |
| 777 | |
| 778 | if (diskopcxx . . $ diskop..isFillingcxx . . $ diskop_t#isFilling. || diskOpEntrycxx . . $ diskOpEntry. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 779 | return; |
| 780 | |
| 781 | // list entries |
| 782 | for (int32_tcxx . . $ int32_t# i = 0; i < DISKOP_LINEScxx . . $ `src/pt2_diskop.h:13:9`!; i++) |
| 783 | { |
| 784 | if (diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset.+i >= diskopcxx . . $ diskop..numEntriescxx . . $ diskop_t#numEntries.) |
| 785 | break; |
| 786 | |
| 787 | fileEntry_tcxx . . $ fileEntry_t# *entry = &diskOpEntrycxx . . $ diskOpEntry.[diskopcxx . . $ diskop..scrollOffsetcxx . . $ diskop_t#scrollOffset.+i]; |
| 788 | char *entryName = diskOpGetAnsiEntrycxx . . $ diskOpGetAnsiEntry(ff224f080444ee45).(i); |
| 789 | int32_tcxx . . $ int32_t# entryLength = (int32_tcxx . . $ int32_t#)strlencxx . . $ strlen(751346f8406fd082).(entryName); |
| 790 | |
| 791 | uint16_tcxx . . $ uint16_t# x = textXStart; |
| 792 | uint16_tcxx . . $ uint16_t# y = (uint8_tcxx . . $ uint8_t#)(35 + (i * (FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`! + 1))); |
| 793 | |
| 794 | if (!entry->isDircxx . . $ fileEntry_t#isDir.) |
| 795 | { |
| 796 | printEntryNamecxx . . $ printEntryName(4d97746abf11de2f).(entryName, entryLength, maxFilenameChars, x, y); |
| 797 | |
| 798 | // print modification date |
| 799 | if (!configcxx . . $ config..hideDiskOpDatescxx . . $ config_t#hideDiskOpDates.) |
| 800 | textOutcxx . . $ textOut(ecc378a7b29cfb5a).(8, y, entry->dateChangedcxx . . $ fileEntry_t#dateChanged., videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]); |
| 801 | |
| 802 | // print file size |
| 803 | printFileSizecxx . . $ printFileSize(e024800d0cc7df14).(entry, 256, y); |
| 804 | } |
| 805 | else |
| 806 | { |
| 807 | printEntryNamecxx . . $ printEntryName(4d97746abf11de2f).(entryName, entryLength, maxDirNameChars, x, y); |
| 808 | textOutcxx . . $ textOut(ecc378a7b29cfb5a).(264, y, "(DIR)", videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]); |
| 809 | } |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | void diskOpLoadFilecxx . . $ diskOpLoadFile(ee2069353d7cc01f).(uint32_tcxx . . $ uint32_t# fileEntryRow, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! songModifiedCheck) |
| 814 | { |
| 815 | // if we clicked on an empty space, return... |
| 816 | if (diskOpEntryIsEmptycxx . . $ diskOpEntryIsEmpty(83c267b20bac841a).(fileEntryRow)) |
| 817 | return; |
| 818 | |
| 819 | if (diskOpEntryIsDircxx . . $ diskOpEntryIsDir(83c267b20bac841a).(fileEntryRow)) |
| 820 | { |
| 821 | diskOpSetPathcxx . . $ diskOpSetPath(b66281b8031ad34f).(diskOpGetUnicodeEntrycxx . . $ diskOpGetUnicodeEntry(ff224f080444ee45).(fileEntryRow), DISKOP_CACHEcxx . . $ DISKOP_CACHE.); |
| 822 | } |
| 823 | else |
| 824 | { |
| 825 | UNICHARcxx . . $ UNICHAR# *filePath = diskOpGetUnicodeEntrycxx . . $ diskOpGetUnicodeEntry(ff224f080444ee45).(fileEntryRow); |
| 826 | if (filePath != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 827 | { |
| 828 | if (diskopcxx . . $ diskop..modecxx . . $ diskop_t#mode. == DISKOP_MODE_MODcxx . . $ DISKOP_MODE_MOD.) |
| 829 | { |
| 830 | if (songModifiedCheck && songcxx . . $ song.->modifiedcxx . . $ module_t#modified.) |
| 831 | { |
| 832 | if (!askBoxcxx . . $ askBox(7371ee129cebb502).(ASKBOX_YES_NOcxx . . $ ASKBOX_YES_NO., "SONG IS UNSAVED !")) |
| 833 | return; |
| 834 | } |
| 835 | |
| 836 | module_tcxx . . $ module_t# *newSong = modLoadcxx . . $ modLoad(eee069cd8a65e1b3).(filePath); |
| 837 | if (newSong != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 838 | { |
| 839 | uint8_tcxx . . $ uint8_t# oldMode = editorcxx . . $ editor..currModecxx . . $ editor_t#currMode.; |
| 840 | uint8_tcxx . . $ uint8_t# oldPlayMode = editorcxx . . $ editor..playModecxx . . $ editor_t#playMode.; |
| 841 | |
| 842 | modStopcxx . . $ modStop(49f6e7a06ebc5aa8).(); |
| 843 | modFreecxx . . $ modFree(49f6e7a06ebc5aa8).(); |
| 844 | |
| 845 | songcxx . . $ song. = newSong; |
| 846 | setupLoadedModcxx . . $ setupLoadedMod(49f6e7a06ebc5aa8).(); |
| 847 | songcxx . . $ song.->loadedcxx . . $ module_t#loaded. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 848 | |
| 849 | statusAllRightcxx . . $ statusAllRight(49f6e7a06ebc5aa8).(); |
| 850 | |
| 851 | if (configcxx . . $ config..autoCloseDiskOpcxx . . $ config_t#autoCloseDiskOp.) |
| 852 | uicxx . . $ ui..diskOpScreenShowncxx . . $ ui_t#diskOpScreenShown. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 853 | |
| 854 | if (configcxx . . $ config..rememberPlayModecxx . . $ config_t#rememberPlayMode.) |
| 855 | { |
| 856 | if (oldMode == MODE_PLAYcxx . . $ MODE_PLAY. || oldMode == MODE_RECORDcxx . . $ MODE_RECORD.) |
| 857 | { |
| 858 | editorcxx . . $ editor..playModecxx . . $ editor_t#playMode. = oldPlayMode; |
| 859 | |
| 860 | if (oldPlayMode == PLAY_MODE_PATTERNcxx . . $ PLAY_MODE_PATTERN. || oldMode == MODE_RECORDcxx . . $ MODE_RECORD.) |
| 861 | modPlaycxx . . $ modPlay(7b7bc4ff97a2e5fe).(0, 0, 0); |
| 862 | else |
| 863 | modPlaycxx . . $ modPlay(7b7bc4ff97a2e5fe).(DONT_SET_PATTERNcxx . . $ DONT_SET_PATTERN., 0, 0); |
| 864 | |
| 865 | if (oldMode == MODE_RECORDcxx . . $ MODE_RECORD.) |
| 866 | pointerSetModecxx . . $ pointerSetMode(f2ac3508b56cd10).(POINTER_MODE_RECORDcxx . . $ POINTER_MODE_RECORD., DO_CARRYcxx . . $ DO_CARRY.); |
| 867 | else |
| 868 | pointerSetModecxx . . $ pointerSetMode(f2ac3508b56cd10).(POINTER_MODE_PLAYcxx . . $ POINTER_MODE_PLAY., DO_CARRYcxx . . $ DO_CARRY.); |
| 869 | |
| 870 | editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. = oldMode; |
| 871 | } |
| 872 | } |
| 873 | else |
| 874 | { |
| 875 | editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. = MODE_IDLEcxx . . $ MODE_IDLE.; |
| 876 | editorcxx . . $ editor..playModecxx . . $ editor_t#playMode. = PLAY_MODE_NORMALcxx . . $ PLAY_MODE_NORMAL.; |
| 877 | editorcxx . . $ editor..songPlayingcxx . . $ editor_t#songPlaying. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 878 | |
| 879 | pointerSetModecxx . . $ pointerSetMode(f2ac3508b56cd10).(POINTER_MODE_IDLEcxx . . $ POINTER_MODE_IDLE., DO_CARRYcxx . . $ DO_CARRY.); |
| 880 | } |
| 881 | |
| 882 | displayMainScreencxx . . $ displayMainScreen(49f6e7a06ebc5aa8).(); |
| 883 | } |
| 884 | else |
| 885 | { |
| 886 | editorcxx . . $ editor..errorMsgActivecxx . . $ editor_t#errorMsgActive. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 887 | editorcxx . . $ editor..errorMsgBlockcxx . . $ editor_t#errorMsgBlock. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 888 | editorcxx . . $ editor..errorMsgCountercxx . . $ editor_t#errorMsgCounter. = 0; |
| 889 | |
| 890 | // status/error message is set in the mod loader |
| 891 | setErrPointercxx . . $ setErrPointer(49f6e7a06ebc5aa8).(); |
| 892 | } |
| 893 | } |
| 894 | else if (diskopcxx . . $ diskop..modecxx . . $ diskop_t#mode. == DISKOP_MODE_SMPcxx . . $ DISKOP_MODE_SMP.) |
| 895 | { |
| 896 | loadSamplecxx . . $ loadSample(14223ed414283e68).(filePath, diskOpGetAnsiEntrycxx . . $ diskOpGetAnsiEntry(ff224f080444ee45).(fileEntryRow)); |
| 897 | } |
| 898 | } |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | void renderDiskOpScreencxx . . $ renderDiskOpScreen(49f6e7a06ebc5aa8).(void) |
| 903 | { |
| 904 | blit32cxx . . $ blit32(5f3dcb304cf8bfc1).(0, 0, 320, 99, diskOpScreenBMPcxx . . $ diskOpScreenBMP.); |
| 905 | |
| 906 | uicxx . . $ ui..updateDiskOpPathTextcxx . . $ ui_t#updateDiskOpPathText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 907 | uicxx . . $ ui..updatePackTextcxx . . $ ui_t#updatePackText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 908 | uicxx . . $ ui..updateSaveFormatTextcxx . . $ ui_t#updateSaveFormatText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 909 | uicxx . . $ ui..updateLoadModecxx . . $ ui_t#updateLoadMode. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 910 | uicxx . . $ ui..updateDiskOpFileListcxx . . $ ui_t#updateDiskOpFileList. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 911 | } |
| 912 | |
| 913 | void updateDiskOpcxx . . $ updateDiskOp(49f6e7a06ebc5aa8).(void) |
| 914 | { |
| 915 | if (!uicxx . . $ ui..diskOpScreenShowncxx . . $ ui_t#diskOpScreenShown. || uicxx . . $ ui..posEdScreenShowncxx . . $ ui_t#posEdScreenShown. || uicxx . . $ ui..askBoxShowncxx . . $ ui_t#askBoxShown.) |
| 916 | return; |
| 917 | |
| 918 | if (uicxx . . $ ui..updateDiskOpFileListcxx . . $ ui_t#updateDiskOpFileList.) |
| 919 | { |
| 920 | uicxx . . $ ui..updateDiskOpFileListcxx . . $ ui_t#updateDiskOpFileList. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 921 | diskOpRenderFileListcxx . . $ diskOpRenderFileList(49f6e7a06ebc5aa8).(); |
| 922 | } |
| 923 | |
| 924 | if (uicxx . . $ ui..updateLoadModecxx . . $ ui_t#updateLoadMode.) |
| 925 | { |
| 926 | uicxx . . $ ui..updateLoadModecxx . . $ ui_t#updateLoadMode. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 927 | |
| 928 | // clear boxes |
| 929 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(147, 3, FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!, FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 930 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(147, 14, FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!, FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 931 | |
| 932 | // draw load mode arrow |
| 933 | if (diskopcxx . . $ diskop..modecxx . . $ diskop_t#mode. == 0) |
| 934 | charOutcxx . . $ charOut(e6c1e39bfc2b37).(147, 3, ARROW_RIGHTcxx . . $ `src/pt2_textout.h:7:9`!, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]); |
| 935 | else |
| 936 | charOutcxx . . $ charOut(e6c1e39bfc2b37).(147,14, ARROW_RIGHTcxx . . $ `src/pt2_textout.h:7:9`!, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]); |
| 937 | } |
| 938 | |
| 939 | if (uicxx . . $ ui..updatePackTextcxx . . $ ui_t#updatePackText.) |
| 940 | { |
| 941 | uicxx . . $ ui..updatePackTextcxx . . $ ui_t#updatePackText. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 942 | textOutBgcxx . . $ textOutBg(14940e7ead0326d3).(120, 3, diskopcxx . . $ diskop..modPackFlgcxx . . $ diskop_t#modPackFlg. ? "ON " : "OFF", videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 943 | } |
| 944 | |
| 945 | if (uicxx . . $ ui..updateSaveFormatTextcxx . . $ ui_t#updateSaveFormatText.) |
| 946 | { |
| 947 | uicxx . . $ ui..updateSaveFormatTextcxx . . $ ui_t#updateSaveFormatText. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 948 | if (diskopcxx . . $ diskop..smpSaveTypecxx . . $ diskop_t#smpSaveType. == DISKOP_SMP_WAVcxx . . $ DISKOP_SMP_WAV.) textOutBgcxx . . $ textOutBg(14940e7ead0326d3).(120, 14, "WAV", videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 949 | else if (diskopcxx . . $ diskop..smpSaveTypecxx . . $ diskop_t#smpSaveType. == DISKOP_SMP_IFFcxx . . $ DISKOP_SMP_IFF.) textOutBgcxx . . $ textOutBg(14940e7ead0326d3).(120, 14, "IFF", videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 950 | else if (diskopcxx . . $ diskop..smpSaveTypecxx . . $ diskop_t#smpSaveType. == DISKOP_SMP_RAWcxx . . $ DISKOP_SMP_RAW.) textOutBgcxx . . $ textOutBg(14940e7ead0326d3).(120, 14, "RAW", videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 951 | } |
| 952 | |
| 953 | if (uicxx . . $ ui..updateDiskOpPathTextcxx . . $ ui_t#updateDiskOpPathText.) |
| 954 | { |
| 955 | uicxx . . $ ui..updateDiskOpPathTextcxx . . $ ui_t#updateDiskOpPathText. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 956 | |
| 957 | // print disk op. path |
| 958 | for (int32_tcxx . . $ int32_t# i = 0; i < 26; i++) |
| 959 | { |
| 960 | char ch; |
| 961 | |
| 962 | if (uicxx . . $ ui..editTextFlagcxx . . $ ui_t#editTextFlag.) |
| 963 | ch = editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath.[textEditcxx . . $ textEdit..scrollOffsetcxx . . $ textEdit_t#scrollOffset. + i]; |
| 964 | else |
| 965 | ch = editorcxx . . $ editor..currPathcxx . . $ editor_t#currPath.[i]; |
| 966 | |
| 967 | if (ch == '\0') |
| 968 | ch = '_'; |
| 969 | |
| 970 | charOutBgcxx . . $ charOutBg(585309c1ae331a9b).(24 + (i * FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!), 25, ch, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 971 | } |
| 972 | } |
| 973 | } |