+/* Keeps files from modules/extra up to date if theyre copied into modules/ */
+void CopyExtras()
+{
+ char dest[65535];
+ char src[65535];
+
+ printf("\nUpdating extra modules in src/modules...\n");
+
+ WIN32_FIND_DATA fd;
+ HANDLE fh = FindFirstFile("..\\src\\modules\\extra\\*.*", &fd);
+
+ if(fh == INVALID_HANDLE_VALUE)
+ return;
+
+ do
+ {
+ strcpy(dest, "..\\src\\modules\\");
+ strcat(dest, fd.cFileName);
+ strcpy(src, "..\\src\\modules\\extra\\");
+ strcat(src, fd.cFileName);
+ FILE* x = fopen(dest, "r");
+ if (x)
+ {
+ fclose(x);
+ CopyFile(src, dest, false);
+ sc(TGREEN); printf(" %s", fd.cFileName); sc(TNORMAL);
+ printf("...\n");
+ }
+ }
+ while (FindNextFile(fh, &fd));
+
+ FindClose(fh);
+
+ printf("\n\n");
+}
+
+
+void Rebase()
+{
+ char dest[65535];
+ char command[65535];
+
+ *dest = 0;
+
+ WIN32_FIND_DATA fd;
+#ifdef _DEBUG
+ HANDLE fh = FindFirstFile("..\\bin\\debug\\lib\\*.so", &fd);
+#else
+ HANDLE fh = FindFirstFile("..\\bin\\release\\lib\\*.so", &fd);
+#endif
+ if(fh == INVALID_HANDLE_VALUE)
+ return;
+
+ do
+ {
+#ifdef _DEBUG
+ strcat(dest, " ..\\bin\\debug\\lib\\");
+#else
+ strcat(dest, " ..\\bin\\release\\lib\\");
+#endif
+ strcat(dest, fd.cFileName);
+ }
+ while (FindNextFile(fh, &fd));
+
+ FindClose(fh);
+
+ sprintf(command, "rebase.exe -v -b 10000000 -c baseaddr_commands.txt %s", dest);
+ printf("%s\n", command);
+ system(command);
+
+#ifdef _DEBUG
+ fh = FindFirstFile("..\\bin\\debug\\modules\\*.so", &fd);
+#else
+ fh = FindFirstFile("..\\bin\\release\\modules\\*.so", &fd);
+#endif
+ if(fh == INVALID_HANDLE_VALUE)
+ return;
+
+ *dest = 0;
+
+ do
+ {
+#ifdef _DEBUG
+ strcat(dest, " ..\\bin\\debug\\modules\\");
+#else
+ strcat(dest, " ..\\bin\\release\\modules\\");
+#endif
+ strcat(dest, fd.cFileName);
+ }
+ while (FindNextFile(fh, &fd));
+
+ sprintf(command, "rebase.exe -v -b 11000000 -c baseaddr_modules.txt %s", dest);
+ printf("%s\n", command);
+ system(command);
+
+ FindClose(fh);
+
+}
+