-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSource.cpp
893 lines (797 loc) · 35.2 KB
/
Source.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include <iostream>
#include <cctype>
#include <filesystem>
#include <fstream>
#include <vector>
#include <string>
#include <cstdio>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <functional>
#include <Windows.h>
#include <atlstr.h>
#include <locale>
#include <codecvt>
#include "MainDisplay.h"
#include "Button.h"
#include "Filescanner.h"
#pragma comment(lib, "Shlwapi.lib")
#include <shlwapi.h>
//i know, i know, i shouldnt use namespace std due to naming collisions, but i dont care and it's useful on a solo project
using namespace std;
//variables
const int width{ 1600 };
const int height{ 800 };
int header_ticker = 0;
int header_anim_ticker = 0;
float version = 3.0;
bool windowheld = false;
bool needs_update = false;
bool installer{ true };
#pragma region METHODS
void Log(string message)
{
std::cout << message + "::" << endl;
std::wstring wide_message(message.begin(), message.end());
LPCWSTR long_message = wide_message.c_str();
OutputDebugString(long_message);
}
bool is_bep_installed(string directory)
{
//if there is a folder named bepinex in the directory, return true.
//else return false.
if (filesystem::exists(directory + "/BepInEx"))
{
return true;
}
else
{
return false;
}
}
void run_command(string command)
{
string data;
FILE* stream;
const int max_buffer = 256;
char buffer[max_buffer];
command.append(" 2>&1");
#ifdef _WIN32
stream = _popen(command.c_str(), "r");
#else
stream = popen(command.c_str(), "r");
#endif
if (stream)
{
while (!feof(stream))
if (fgets(buffer, max_buffer, stream) != NULL) data.append(buffer);
#ifdef _WIN32
_pclose(stream);
#else
pclose(stream);
#endif
}
std::cout << data << endl;
return;
}
string run_command_string(string command)
{
string data;
FILE* stream;
const int max_buffer = 256;
char buffer[max_buffer];
command.append(" 2>&1");
#ifdef _WIN32
stream = _popen(command.c_str(), "r");
#else
stream = popen(command.c_str(), "r");
#endif
if (stream)
{
while (!feof(stream))
if (fgets(buffer, max_buffer, stream) != NULL) data.append(buffer);
#ifdef _WIN32
_pclose(stream);
#else
pclose(stream);
#endif
}
return data;
}
void cleanup()
{
}
bool check_for_update()
{
//get username from environment
char* username = getenv("USERNAME");
string username_str(username);
//read version.txt from http://daltonyx.com/loader/version.txt
//if version.txt is not the same as the version variable, return true
//else return false
//download version.txt with curl
string curl_command;
if (username_str == "dalto" || username_str == "calli")
curl_command = "curl http://192.168.1.48:8000/loader/version.txt -o version.txt && curl http://192.168.1.48:8000/loader/changelog.txt -o changelog.txt";
else
curl_command = "curl http://97.88.21.85:8000/loader/version.txt -o version.txt && curl http://97.88.21.85:8000/loader/changelog.txt -o changelog.txt";
system(curl_command.c_str());
//read version.txt
ifstream version_file2;
version_file2.open("version.txt");
string version_string;
version_file2 >> version_string;
version_file2.close();
//convert changelog.txt to string
ifstream changelog_file;
changelog_file.open("changelog.txt");
string changelog_string;
string line;
while (getline(changelog_file, line))
{
changelog_string += line;
changelog_string += "\n";
}
changelog_file.close();
std::cout << "\n" << "version.txt and changelog downloaded from server! Checking for update..." << "\nYour version: " << version << "\nNew version: " << version_string << endl;
std::cout << "\n" << changelog_string << endl;
//convert version_string to float
float version_float = stof(version_string);
//compare version_float to version
if (version_float > version)
{
return true;
}
else
{
return false;
}
}
void swap_vector_indexes(int index1, int index2, vector<string> sayings_vector)
{
//swap the indexes of two buttons in the vector
string temp = sayings_vector[index1];
sayings_vector[index1] = sayings_vector[index2];
sayings_vector[index2] = temp;
}
void populate_sayings(vector<string>& sayings)
{
sayings.push_back("we are totem");
sayings.push_back("spood beest");
sayings.push_back("gassytexan loves bigfoot");
sayings.push_back("ba dum tiss");
sayings.push_back("boganisanerd");
sayings.push_back("potato patreason");
sayings.push_back("is it data or data");
sayings.push_back("wallaby is a banned word");
sayings.push_back("walla walla washington");
sayings.push_back("willy bum bum");
sayings.push_back("a cop needed my mouse");
sayings.push_back("do ya got any sayings");
sayings.push_back("two stevens walk into a bar");
sayings.push_back("and they say ouch");
sayings.push_back("no lol");
sayings.push_back("we're gonna need a bigger boat");
sayings.push_back("welp, that's grounded");
sayings.push_back("daltonyx, the dandelion hunter");
sayings.push_back("Oh, you're finally awake!");
sayings.push_back("noot, noot never changes");
sayings.push_back("this is an uwu free zone");
sayings.push_back("uwu");
sayings.push_back("well i'm no car scientist but-");
sayings.push_back("i think that's just a mechanic");
sayings.push_back("try out Havendock!");
sayings.push_back("man, i really need some more sayings, don't i?.");
sayings.push_back("now with extra milk!");
sayings.push_back("well, that's just like, your opinion and stuff, man");
sayings.push_back("melon > lemon");
sayings.push_back("i like to eat, eat, eat");
sayings.push_back("eeples and baneenees");
sayings.push_back("screw the nether");
sayings.push_back("ya ever just eat a potato raw");
sayings.push_back("think about this next time you blink");
sayings.push_back("t-pose for dominance!");
sayings.push_back("'i am the milkman, my milk is delicious' - the milkman");
sayings.push_back("segmentation fault (core dumped)");
sayings.push_back("i [] unicode");
sayings.push_back("c++ is best++");
sayings.push_back("how much do YOU like ramen noodles?");
sayings.push_back("how's my driving?");
sayings.push_back("feel free to request unity games to mod on discord!");
sayings.push_back("programmer socks? check");
sayings.push_back("feel free to request mods for unity games on discord!");
sayings.push_back("UnityExplorer is really good for modding unity games!");
sayings.push_back("Now with file management!");
sayings.push_back("spinny head machine go brrrrrr");
sayings.push_back("domo origato");
sayings.push_back("what even is curds and whey");
sayings.push_back("16 // 16 // 16 // 16 // 16 // 16");
sayings.push_back("oops! all console commands!");
sayings.push_back("vscode is pretty good");
sayings.push_back("made entirely on windows!");
sayings.push_back("DNSpy and ILSpy are really powerful tools!");
sayings.push_back("now with 100% more sayings!");
sayings.push_back("ramen ramen ramen");
sayings.push_back("my dang batteries are always dead");
sayings.push_back("this is just an echo chamber tbh");
sayings.push_back("she goes to another school");
sayings.push_back("sayings.push_back(message) lol");
sayings.push_back("the ink spots are a really soothing band");
sayings.push_back("GODSPEED, SPIDERMAN");
sayings.push_back("samus mains ftw");
sayings.push_back("rip @ the leaderboard");
sayings.push_back("they called him the drift king in college");
sayings.push_back("she blinded me, with science!");
sayings.push_back("i'm not a real doctor, but i am a real worm");
sayings.push_back("why can't it be plum fields forever?");
sayings.push_back("i'd rather have a bottle in front of me than a frontal lobotomy");
sayings.push_back("report bugs in the discord with /bug or !bug, it's appreciated!");
sayings.push_back("avid achievement unlocker");
sayings.push_back("63 achievements, 0.0hrs playtime :^)");
sayings.push_back("i really dig this font");
sayings.push_back("*angry skyscraper noises*");
}
bool is_dll_installed(string dll, string directory)
{
string path = directory + "/" + dll;
ifstream file(path);
//Log(to_string(file.good()));
return file.good();
}
void open_directory_in_explorer(string directory)
{
string command = "explorer " + directory;
system(command.c_str());
}
#pragma endregion
int main()
{
#pragma region VARIABLE_CREATION
sf::RenderWindow window(sf::VideoMode(width, height), "DDLoader", sf::Style::None);
sf::Event event;
srand(time(NULL));
sf::Image icon;
if (!icon.loadFromFile("resources/Icon.png"))
{
//std::cout << "icon not found" << endl;
}
window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
bool running = true;
vector<sf::Texture> credit_textures;
sf::Texture texture;
sf::Texture help_cc_texture;
sf::Texture help_ue_texture;
texture.loadFromFile("resources/images/hollowknight.png");
help_cc_texture.loadFromFile("resources/images/help.png");
help_ue_texture.loadFromFile("resources/images/help.png");
sf::Font font;
font.loadFromFile("resources/RobotoMono-Light.ttf");
//add images for logo
for (int i = 0; i < 90; i++)
{
sf::Texture texture;
texture.loadFromFile("resources/credit/loader_" + to_string(i + 1) + ".png");
credit_textures.push_back(texture);
}
//create vector of sayings for titlebar
vector<string> sayings;
populate_sayings(sayings);
for (int i = 0; i < sayings.size(); i++)
{
swap_vector_indexes((rand() % sayings.size()), (rand() % sayings.size()), sayings);
}
for (int i = 0; i < sayings.size(); i++)
{
swap_vector_indexes((rand() % sayings.size()), (rand() % sayings.size()), sayings);
}
for (int i = 0; i < sayings.size(); i++)
{
swap_vector_indexes((rand() % sayings.size()), (rand() % sayings.size()), sayings);
}
MainDisplay mainDisplay = MainDisplay("DDLoader", 6, sf::Vector2f(950, 415), sf::Vector2f(1250, 720), texture);
#pragma region UIOBJECTS
//set up text objects and shapes for titlebar/UI
sf::Text program_title;
program_title.setFont(font);
program_title.setString("DDLoader");
program_title.setCharacterSize(16);
program_title.setStyle(sf::Text::Bold);
program_title.setFillColor(sf::Color::White);
program_title.setPosition(10,5);
sf::Text program_close;
program_close.setFont(font);
program_close.setString("X");
program_close.setCharacterSize(16);
program_close.setStyle(sf::Text::Bold);
program_close.setFillColor(sf::Color::White);
program_close.setPosition(1580, 5);
sf::RectangleShape program_titlebar;
program_titlebar.setSize(sf::Vector2f(1600, 30));
program_titlebar.setFillColor(sf::Color(30,30,30));
program_titlebar.setPosition(0, 0);
sf::RectangleShape program_ui_bar;
program_ui_bar.setSize(sf::Vector2f(300, 800));
program_ui_bar.setFillColor(sf::Color(40, 40, 40));
program_ui_bar.setPosition(0, 0);
sf::Sprite header_sprite;
header_sprite.setTexture(credit_textures[0]);
header_sprite.setOrigin(header_sprite.getGlobalBounds().width / 2, header_sprite.getGlobalBounds().height / 2);
header_sprite.setPosition(width/2,height/2);
sf::Text sayings_text;
sayings_text.setFont(font);
sayings_text.setString(sayings[rand()%sayings.size()]);
sayings_text.setCharacterSize(16);
sayings_text.setStyle(sf::Text::Bold);
sayings_text.setFillColor(sf::Color::White);
sayings_text.setPosition(width/2-(sayings_text.getGlobalBounds().width/2), 5);
sf::Text titlename;
titlename.setFont(font);
titlename.setString("DDLoader");
titlename.setCharacterSize(40);
titlename.setStyle(sf::Text::Bold);
titlename.setFillColor(sf::Color::White);
titlename.setOrigin(titlename.getGlobalBounds().width / 2, titlename.getGlobalBounds().height / 2);
titlename.setPosition(150, 280);
sf::Text discord_text;
discord_text.setFont(font);
discord_text.setString("request Unity mods at:");
discord_text.setCharacterSize(16);
//discord_text.setStyle(sf::Text::Bold);
discord_text.setFillColor(sf::Color::White);
discord_text.setOrigin(discord_text.getGlobalBounds().width / 2, discord_text.getGlobalBounds().height / 2);
discord_text.setPosition(150, 320);
sf::Text console_commands_text;
console_commands_text.setFont(font);
console_commands_text.setString("console commands installed!");
console_commands_text.setCharacterSize(16);
console_commands_text.setStyle(sf::Text::Bold);
console_commands_text.setFillColor(sf::Color::White);
console_commands_text.setOrigin(console_commands_text.getGlobalBounds().width / 2, console_commands_text.getGlobalBounds().height / 2);
console_commands_text.setPosition(1385, 705);
sf::Text unityexplorer_text;
unityexplorer_text.setFont(font);
unityexplorer_text.setString("unityexplorer installed!");
unityexplorer_text.setCharacterSize(16);
unityexplorer_text.setStyle(sf::Text::Bold);
unityexplorer_text.setFillColor(sf::Color::White);
unityexplorer_text.setOrigin(unityexplorer_text.getGlobalBounds().width / 2, unityexplorer_text.getGlobalBounds().height / 2);
unityexplorer_text.setPosition(1385, 645);
sf::Text credit_text;
credit_text.setFont(font);
credit_text.setString("<3 daltonyx");
credit_text.setCharacterSize(16);
credit_text.setStyle(sf::Text::Bold);
credit_text.setFillColor(sf::Color::White);
credit_text.setOrigin(credit_text.getGlobalBounds().width / 2, credit_text.getGlobalBounds().height / 2);
credit_text.setPosition(width - (credit_text.getGlobalBounds().width / 2 + 12),height-16);
sf::Text bep_installed_text;
bep_installed_text.setFont(font);
bep_installed_text.setCharacterSize(16);
bep_installed_text.setStyle(sf::Text::Bold);
bep_installed_text.setString("BepInEx Installed");
bep_installed_text.setFillColor(sf::Color::Green);
bep_installed_text.setOrigin(bep_installed_text.getGlobalBounds().width / 2, bep_installed_text.getGlobalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y+75);
sf::Text instructions1;
instructions1.setFont(font);
instructions1.setCharacterSize(20);
instructions1.setStyle(sf::Text::Bold);
instructions1.setString("to install a mod not listed here:");
instructions1.setFillColor(sf::Color::White);
instructions1.setOrigin(instructions1.getGlobalBounds().width / 2, instructions1.getGlobalBounds().height / 2);
instructions1.setPosition(1225, 190);
sf::Text instructions2;
instructions2.setFont(font);
instructions2.setCharacterSize(16);
//instructions2.setStyle(sf::Text::Bold);
instructions2.setString("1) download mod zip from nexusMods");
instructions2.setFillColor(sf::Color::White);
instructions2.setOrigin(instructions2.getGlobalBounds().width / 2, instructions2.getGlobalBounds().height / 2);
instructions2.setPosition(1225, 230);
sf::Text instructions3;
instructions3.setFont(font);
instructions3.setCharacterSize(16);
//instructions3.setStyle(sf::Text::Bold);
instructions3.setString("2) copy .DLL from inside the zip you downloaded");
instructions3.setFillColor(sf::Color::White);
instructions3.setOrigin(instructions3.getGlobalBounds().width / 2, instructions3.getGlobalBounds().height / 2);
instructions3.setPosition(1225, 260);
sf::Text instructions4;
instructions4.setFont(font);
instructions4.setCharacterSize(16);
//instructions4.setStyle(sf::Text::Bold);
instructions4.setString("3) click \"MODS FOLDER\"");
instructions4.setFillColor(sf::Color::White);
instructions4.setOrigin(instructions4.getGlobalBounds().width / 2, instructions4.getGlobalBounds().height / 2);
instructions4.setPosition(1225, 290);
sf::Text instructions5;
instructions5.setFont(font);
instructions5.setCharacterSize(16);
//instructions5.setStyle(sf::Text::Bold);
instructions5.setString("4) paste the .DLL into the mods folder that opens!");
instructions5.setFillColor(sf::Color::White);
instructions5.setOrigin(instructions5.getGlobalBounds().width / 2, instructions5.getGlobalBounds().height / 2);
instructions5.setPosition(1225, 320);
sf::Texture discord_texture;
discord_texture.loadFromFile("resources/images/discord.png");
#pragma endregion UIOBJECTS
//create game buttons
vector<Button> buttons;
Button discord = Button(discord_texture, sf::Vector2f(150, 360), -1);
Button mods_folder = Button("MODS FOLDER", sf::Vector2f(1225, 130), -6, 6,sf::Vector2f(560,50), 20);
Button filepicker_install = Button("CHOOSE A FILE TO INSTALL", sf::Vector2f(1225, 190), -7, 6, sf::Vector2f(560, 50), 20);
Button bep_install = Button("INSTALL", sf::Vector2f(580, 650), -2, 6);
Button bep_uninstall = Button("UNINSTALL", sf::Vector2f(580, 710), -3, 6);
Button button1 = Button("HAVENDOCK", sf::Vector2f(150, 500+40),0,6);
Button button2 = Button("MUCK", sf::Vector2f(150, 570+40),1,6);
Button button3 = Button("HOLLOW KNIGHT", sf::Vector2f(150, 640+40),2,6);
Button button4 = Button("REGIONS OF RUIN", sf::Vector2f(150, 710+40),3,5);
Button unityexplorer_install = Button("UNITYEXPLORER", sf::Vector2f(1070,650),-4,6);
Button consolecommands_install = Button("CONSOLE COMMANDS", sf::Vector2f(1070, 710), -5, 6);
Button help_cc = Button(help_cc_texture, sf::Vector2f(910,710), -8);
Button help_ue = Button(help_ue_texture, sf::Vector2f(910, 650), -9);
Button windowflip_mods = Button("install panel", sf::Vector2f(1050, 80), -10, 6, sf::Vector2f(340,35), 16);
Button windowflip_manager = Button("mods panel", sf::Vector2f(1398, 80), -11, 6, sf::Vector2f(340, 35), 16);
Filescanner filescanner = Filescanner(font);
//make sure we're actually zero-ed out in state
mainDisplay.setName("havendock");
mainDisplay.bep_version = 6;
mainDisplay.texture.loadFromFile("resources/images/havendock.png");
mainDisplay.function_last_used = 0;
#pragma endregion
while (running)
{
#pragma region EVENT_HANDLING
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
//free memory and close window
std::atexit(cleanup);
running = false;
window.close();
}
if (event.type == sf::Event::MouseButtonPressed)
{
if (event.mouseButton.button == sf::Mouse::Left)
{
//check if mouse is within 50px of the top of the window
if (sf::Mouse::getPosition(window).y < 50)
{
//check if mouse is within 50px of the right of the window
if (sf::Mouse::getPosition(window).x > window.getSize().x - 50)
{
//free memory and close window
std::atexit(cleanup);
running = false;
window.close();
}
else
{
windowheld = true;
}
}
}
}
if (event.type == sf::Event::MouseButtonReleased)
{
if (event.mouseButton.button == sf::Mouse::Left)
{
windowheld = false;
}
}
if (event.type == sf::Event::KeyPressed)
{
if (event.key.code == sf::Keyboard::Escape)
{
std::atexit(cleanup);
running = false;
window.close();
}
}
}
if (windowheld)
window.setPosition(sf::Mouse::getPosition() - sf::Vector2i(window.getSize().x / 2, 25));
#pragma endregion
#pragma region DISPLAY_LOOP
//clear the window
window.clear(sf::Color(50,50,50));
header_ticker++;
if (header_ticker > 1)
{
header_ticker = 0;
header_anim_ticker++;
if (header_anim_ticker > 89)
header_anim_ticker = 0;
}
header_sprite.setTexture(credit_textures[header_anim_ticker]);
header_sprite.setPosition(150,160);
window.draw(program_ui_bar);
window.draw(header_sprite);
window.draw(program_titlebar);
window.draw(program_close);
window.draw(program_title);
window.draw(sayings_text);
mainDisplay.draw(window);
window.draw(titlename);
window.draw(credit_text);
button1.draw(window);
button2.draw(window);
button3.draw(window);
button4.draw(window);
discord.draw(window);
//switch for what text to display
switch (mainDisplay.function_last_used)
{
case(0):
if (is_bep_installed("C:/Program Files (x86)/Steam/steamapps/common/Havendock") ||
is_bep_installed("D:/SteamLibrary/steamapps/common/Havendock") ||
is_bep_installed("E:/SteamLibrary/steamapps/common/Havendock") ||
is_bep_installed("F:/SteamLibrary/steamapps/common/Havendock") ||
is_bep_installed("G:/SteamLibrary/steamapps/common/Havendock"))
{
bep_installed_text.setString("BepInEx Installed");
bep_installed_text.setFillColor(sf::Color::Green);
bep_installed_text.setOrigin(bep_installed_text.getLocalBounds().width / 2, bep_installed_text.getLocalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y + 75);
}
else
{
bep_installed_text.setString("BepInEx Not Installed");
bep_installed_text.setFillColor(sf::Color::Red);
bep_installed_text.setOrigin(bep_installed_text.getLocalBounds().width / 2, bep_installed_text.getLocalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y + 75);
}
if (is_dll_installed("ConsoleCommands.dll", "C:/Program Files (x86)/Steam/steamapps/common/Havendock/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "D:/SteamLibrary/steamapps/common/Havendock/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "E:/SteamLibrary/steamapps/common/Havendock/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "F:/SteamLibrary/steamapps/common/Havendock/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "G:/SteamLibrary/steamapps/common/Havendock/BepInEx/plugins"))
{
console_commands_text.setString("CONSOLE COMMANDS Installed!");
console_commands_text.setFillColor(sf::Color::Green);
console_commands_text.setOrigin(console_commands_text.getLocalBounds().width / 2, console_commands_text.getLocalBounds().height / 2);
}
else
{
console_commands_text.setString("CONSOLE COMMANDS Not Installed");
console_commands_text.setFillColor(sf::Color::Red);
console_commands_text.setOrigin(console_commands_text.getLocalBounds().width / 2, console_commands_text.getLocalBounds().height / 2);
}
if (is_dll_installed("UnityExplorer.BIE6.Mono.dll", "C:/Program Files (x86)/Steam/steamapps/common/Havendock/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "D:/SteamLibrary/steamapps/common/Havendock/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "E:/SteamLibrary/steamapps/common/Havendock/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "F:/SteamLibrary/steamapps/common/Havendock/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "G:/SteamLibrary/steamapps/common/Havendock/BepInEx/plugins/sinai-dev-UnityExplorer"))
{
unityexplorer_text.setString("UNITYEXPLORER Installed!");
unityexplorer_text.setFillColor(sf::Color::Green);
unityexplorer_text.setOrigin(unityexplorer_text.getLocalBounds().width / 2, unityexplorer_text.getLocalBounds().height / 2);
}
else
{
unityexplorer_text.setString("UNITYEXPLORER Not Installed");
unityexplorer_text.setFillColor(sf::Color::Red);
unityexplorer_text.setOrigin(unityexplorer_text.getLocalBounds().width / 2, unityexplorer_text.getLocalBounds().height / 2);
}
break;
case(1):
if (is_bep_installed("C:/Program Files (x86)/Steam/steamapps/common/Muck") ||
is_bep_installed("D:/SteamLibrary/steamapps/common/Muck") ||
is_bep_installed("E:/SteamLibrary/steamapps/common/Muck") ||
is_bep_installed("F:/SteamLibrary/steamapps/common/Muck") ||
is_bep_installed("G:/SteamLibrary/steamapps/common/Muck"))
{
bep_installed_text.setString("BepInEx Installed");
bep_installed_text.setFillColor(sf::Color::Green);
bep_installed_text.setOrigin(bep_installed_text.getLocalBounds().width / 2, bep_installed_text.getLocalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y + 75);
}
else
{
bep_installed_text.setString("BepInEx Not Installed");
bep_installed_text.setFillColor(sf::Color::Red);
bep_installed_text.setOrigin(bep_installed_text.getLocalBounds().width / 2, bep_installed_text.getLocalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y + 75);
}
//check for ConsoleCommands.dll
if (is_dll_installed("ConsoleCommands.dll", "C:/Program Files (x86)/Steam/steamapps/common/Muck/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "D:/SteamLibrary/steamapps/common/Muck/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "E:/SteamLibrary/steamapps/common/Muck/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "F:/SteamLibrary/steamapps/common/Muck/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "G:/SteamLibrary/steamapps/common/Muck/BepInEx/plugins"))
{
console_commands_text.setString("CONSOLE COMMANDS Installed!");
console_commands_text.setFillColor(sf::Color::Green);
console_commands_text.setOrigin(console_commands_text.getLocalBounds().width / 2, console_commands_text.getLocalBounds().height / 2);
}
else
{
console_commands_text.setString("CONSOLE COMMANDS Not Installed");
console_commands_text.setFillColor(sf::Color::Red);
console_commands_text.setOrigin(console_commands_text.getLocalBounds().width / 2, console_commands_text.getLocalBounds().height / 2);
}
//check for UnityExplorer.BIE6.Mono.dll
if (is_dll_installed("UnityExplorer.BIE6.Mono.dll", "C:/Program Files (x86)/Steam/steamapps/common/Muck/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "D:/SteamLibrary/steamapps/common/Muck/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "E:/SteamLibrary/steamapps/common/Muck/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "F:/SteamLibrary/steamapps/common/Muck/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "G:/SteamLibrary/steamapps/common/Muck/BepInEx/plugins/sinai-dev-UnityExplorer"))
{
unityexplorer_text.setString("UNITYEXPLORER Installed!");
unityexplorer_text.setFillColor(sf::Color::Green);
unityexplorer_text.setOrigin(unityexplorer_text.getLocalBounds().width / 2, unityexplorer_text.getLocalBounds().height / 2);
}
else
{
unityexplorer_text.setString("UNITYEXPLORER Not Installed");
unityexplorer_text.setFillColor(sf::Color::Red);
unityexplorer_text.setOrigin(unityexplorer_text.getLocalBounds().width / 2, unityexplorer_text.getLocalBounds().height / 2);
}
break;
case(2):
if (is_bep_installed("C:/Program Files (x86)/Steam/steamapps/common/Hollow Knight") ||
is_bep_installed("D:/SteamLibrary/steamapps/common/Hollow Knight") ||
is_bep_installed("E:/SteamLibrary/steamapps/common/Hollow Knight") ||
is_bep_installed("F:/SteamLibrary/steamapps/common/Hollow Knight") ||
is_bep_installed("G:/SteamLibrary/steamapps/common/Hollow Knight"))
{
bep_installed_text.setString("BepInEx Installed");
bep_installed_text.setFillColor(sf::Color::Green);
bep_installed_text.setOrigin(bep_installed_text.getLocalBounds().width / 2, bep_installed_text.getLocalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y + 75);
}
else
{
bep_installed_text.setString("BepInEx Not Installed");
bep_installed_text.setFillColor(sf::Color::Red);
bep_installed_text.setOrigin(bep_installed_text.getLocalBounds().width / 2, bep_installed_text.getLocalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y + 75);
}
//check for ConsoleCommands.dll
if (is_dll_installed("ConsoleCommands.dll", "C:/Program Files (x86)/Steam/steamapps/common/Hollow Knight/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "D:/SteamLibrary/steamapps/common/Hollow Knight/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "E:/SteamLibrary/steamapps/common/Hollow Knight/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "F:/SteamLibrary/steamapps/common/Hollow Knight/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "G:/SteamLibrary/steamapps/common/Hollow Knight/BepInEx/plugins"))
{
console_commands_text.setString("CONSOLE COMMANDS Installed!");
console_commands_text.setFillColor(sf::Color::Green);
console_commands_text.setOrigin(console_commands_text.getLocalBounds().width / 2, console_commands_text.getLocalBounds().height / 2);
}
else
{
console_commands_text.setString("CONSOLE COMMANDS Not Installed");
console_commands_text.setFillColor(sf::Color::Red);
console_commands_text.setOrigin(console_commands_text.getLocalBounds().width / 2, console_commands_text.getLocalBounds().height / 2);
}
//check for UnityExplorer.BIE6.Mono.dll
if (is_dll_installed("UnityExplorer.BIE6.Mono.dll", "C:/Program Files (x86)/Steam/steamapps/common/Hollow Knight/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "D:/SteamLibrary/steamapps/common/Hollow Knight/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "E:/SteamLibrary/steamapps/common/Hollow Knight/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "F:/SteamLibrary/steamapps/common/Hollow Knight/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE6.Mono.dll", "G:/SteamLibrary/steamapps/common/Hollow Knight/BepInEx/plugins/sinai-dev-UnityExplorer"))
{
unityexplorer_text.setString("UNITYEXPLORER Installed!");
unityexplorer_text.setFillColor(sf::Color::Green);
unityexplorer_text.setOrigin(unityexplorer_text.getLocalBounds().width / 2, unityexplorer_text.getLocalBounds().height / 2);
}
else
{
unityexplorer_text.setString("UNITYEXPLORER Not Installed");
unityexplorer_text.setFillColor(sf::Color::Red);
unityexplorer_text.setOrigin(unityexplorer_text.getLocalBounds().width / 2, unityexplorer_text.getLocalBounds().height / 2);
}
break;
case(3):
if (is_bep_installed("C:/Program Files (x86)/Steam/steamapps/common/Regions of Ruin") ||
is_bep_installed("D:/SteamLibrary/steamapps/common/Regions of Ruin") ||
is_bep_installed("E:/SteamLibrary/steamapps/common/Regions of Ruin") ||
is_bep_installed("F:/SteamLibrary/steamapps/common/Regions of Ruin") ||
is_bep_installed("G:/SteamLibrary/steamapps/common/Regions of Ruin"))
{
bep_installed_text.setString("BepInEx Installed");
bep_installed_text.setFillColor(sf::Color::Green);
bep_installed_text.setOrigin(bep_installed_text.getLocalBounds().width / 2, bep_installed_text.getLocalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y + 75);
}
else
{
bep_installed_text.setString("BepInEx Not Installed");
bep_installed_text.setFillColor(sf::Color::Red);
bep_installed_text.setOrigin(bep_installed_text.getLocalBounds().width / 2, bep_installed_text.getLocalBounds().height / 2);
bep_installed_text.setPosition(mainDisplay.text_position.x, mainDisplay.text_position.y + 75);
}
//check for RegionsOfRuin_ConsoleCommands.dll
if (is_dll_installed("ConsoleCommands.dll", "C:/Program Files (x86)/Steam/steamapps/common/Regions of Ruin/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "D:/SteamLibrary/steamapps/common/Regions of Ruin/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "E:/SteamLibrary/steamapps/common/Regions of Ruin/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "F:/SteamLibrary/steamapps/common/Regions of Ruin/BepInEx/plugins") ||
is_dll_installed("ConsoleCommands.dll", "G:/SteamLibrary/steamapps/common/Regions of Ruin/BepInEx/plugins"))
{
console_commands_text.setString("CONSOLE COMMANDS Installed!");
console_commands_text.setFillColor(sf::Color::Green);
console_commands_text.setOrigin(console_commands_text.getLocalBounds().width / 2, console_commands_text.getLocalBounds().height / 2);
}
else
{
console_commands_text.setString("CONSOLE COMMANDS Not Installed");
console_commands_text.setFillColor(sf::Color::Red);
console_commands_text.setOrigin(console_commands_text.getLocalBounds().width / 2, console_commands_text.getLocalBounds().height / 2);
}
//check for UnityExplorer.BIE5.Mono.dll
if (is_dll_installed("UnityExplorer.BIE5.Mono.dll", "C:/Program Files (x86)/Steam/steamapps/common/Regions of Ruin/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE5.Mono.dll", "D:/SteamLibrary/steamapps/common/Regions of Ruin/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE5.Mono.dll", "E:/SteamLibrary/steamapps/common/Regions of Ruin/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE5.Mono.dll", "F:/SteamLibrary/steamapps/common/Regions of Ruin/BepInEx/plugins/sinai-dev-UnityExplorer") ||
is_dll_installed("UnityExplorer.BIE5.Mono.dll", "G:/SteamLibrary/steamapps/common/Regions of Ruin/BepInEx/plugins/sinai-dev-UnityExplorer"))
{
unityexplorer_text.setString("UNITYEXPLORER Installed!");
unityexplorer_text.setFillColor(sf::Color::Green);
unityexplorer_text.setOrigin(unityexplorer_text.getLocalBounds().width / 2, unityexplorer_text.getLocalBounds().height / 2);
}
else
{
unityexplorer_text.setString("UNITYEXPLORER Not Installed");
unityexplorer_text.setFillColor(sf::Color::Red);
unityexplorer_text.setOrigin(unityexplorer_text.getLocalBounds().width / 2, unityexplorer_text.getLocalBounds().height / 2);
}
break;
}
if (installer)
{
//if in installer mode
window.draw(instructions1);
window.draw(instructions2);
window.draw(instructions3);
window.draw(instructions4);
window.draw(instructions5);
mods_folder.draw(window);
help_cc.draw(window);
help_ue.draw(window);
unityexplorer_install.draw(window);
consolecommands_install.draw(window);
window.draw(console_commands_text);
window.draw(unityexplorer_text);
mods_folder.update(window, mainDisplay, installer, filescanner);
help_cc.update(window, mainDisplay, installer, filescanner);
help_ue.update(window, mainDisplay, installer, filescanner);
unityexplorer_install.update(window, mainDisplay, installer, filescanner);
consolecommands_install.update(window, mainDisplay, installer, filescanner);
}
else
{
//if in mod filescanner mode
filescanner.draw(window);
filescanner.update(window);
}
//draw the window
bep_install.draw(window);
bep_uninstall.draw(window);
window.draw(bep_installed_text);
window.draw(discord_text);
windowflip_manager.draw(window);
windowflip_mods.draw(window);
//update the window
windowflip_manager.update(window, mainDisplay, installer, filescanner);
windowflip_mods.update(window, mainDisplay, installer, filescanner);
bep_install.update(window, mainDisplay, installer, filescanner);
bep_uninstall.update(window, mainDisplay, installer, filescanner);
button1.update(window, mainDisplay, installer, filescanner);
button2.update(window, mainDisplay, installer, filescanner);
button3.update(window, mainDisplay, installer, filescanner);
button4.update(window, mainDisplay, installer, filescanner);
discord.update(window, mainDisplay, installer, filescanner);
mainDisplay.update("havendock");
window.setFramerateLimit(60);
window.display();
#pragma endregion
}
//return okay if the program exits properly
return 0;
}