Advertisement
tomkiewicz

abgx360-1.0.6

Jul 18th, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 15.87 KB | None | 0 0
  1. --- src/abgx360.c   1.0.6
  2. +++ src/abgx360.c   patched
  3. @@ -302,8 +302,8 @@
  4.  long connectiontimeout = 20, dvdtimeout = 20, userlang = 0;
  5.  float speed = 0.0;
  6.  unsigned long curlprogressstartmsecs, userregion = 0L;
  7. -char *green = "\033[1;32;40m", *yellow = "\033[1;33;40m", *red = "\033[1;31;40m", *cyan = "\033[1;36;40m", *blue = "\033[1;34;40m";
  8. -char *darkblue = "\033[0;34;40m", *white = "\033[1;37;40m", *arrow = "\033[1;34;40m", *box = "\033[1;34;40m", *normal = "\033[0;37;40m";
  9. +char *green = "\033[32m", *yellow = "\033[33m", *red = "\033[1;31m", *cyan = "\033[1;36m", *blue = "\033[1;34m";
  10. +char *darkblue = "\033[0;34;40m", *white = "\033[1m", *arrow = "\033[1;34;40m", *box = "\033[1;34;40m", *boxblue = "\033[1;34;40m", *normal = "\033[0m";
  11.  char *wtfhexcolor = "\033[1;31;40m", *wtfcharcolor = "\033[1;37;41m", *reset = "\033[0m", *brown = "\033[0;33;40m", *filename = "\033[0;37;44m";
  12.  char *blackonyellow = "\033[0;30;43m", *blackonred = "\033[0;30;41m";
  13.  #ifdef __APPLE__
  14. @@ -5503,9 +5503,10 @@
  15.      color(normal); printf(" %06lXh %06lXh ", endpsnL0, startpsnL1); color(arrow);
  16.      if (terminal) printf("ÄÄÄÄÄÄÄ PSN ÄÄÄÄÄÄ%s", greaterthan);
  17.      else printf("------- PSN ------%s", greaterthan);
  18. -    color(normal); printf(" %06lXh%s", endpsnL1, newline); color(box);
  19. -    if (terminal) printf("%sÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿%s%s", sp5, newline, sp5);
  20. -    else printf("%s+----------------------------------+----------------------------------+%s%s", sp5, newline, sp5);
  21. +    color(normal); printf(" %06lXh%s%s", endpsnL1, newline, sp5); color(box);
  22. +    if (terminal) printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿");
  23. +    else printf("+----------------------------------+----------------------------------+");
  24. +    color(normal); printf("%s%s", newline, sp5); color(box);
  25.      if (terminal && !html) printf("³");
  26.      else printf("|");
  27.      color(normal); printf("%sL0 Data Area = %07lu sectors%s", sp2, sectorsL0, sp2); color(box);
  28. @@ -5514,21 +5515,24 @@
  29.      color(normal); printf("%sL1 Data Area = %07lu sectors%s", sp2, sectorsL1, sp2); color(box);
  30.      if (terminal && !html) printf("³");
  31.      else printf("|");
  32. -    if (terminal) printf("%s%sÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ%s", newline, sp5, newline);
  33. -    else printf("%s%s+----------------------------------+----------------------------------+%s", newline, sp5, newline);
  34. +    color(normal); printf("%s%s", newline, sp5); color(box);
  35. +    if (terminal) printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ");
  36. +    else printf("+----------------------------------+----------------------------------+");
  37. +    color(normal); printf("%s", newline);
  38.      color(normal); printf("%s0x%010"LL"X ", sp5, offsetL0); color(arrow);
  39.      if (terminal) printf("ÄÄÄÄÄÄÄÄ%s", greaterthan);
  40.      else printf("--------%s", greaterthan);
  41.      color(normal); printf(" 0x%010"LL"X 0x%010"LL"X ", offsetL0end, offsetL1); color(arrow);
  42.      if (terminal) printf("ÄÄÄÄÄÄÄÄ%s", greaterthan);
  43.      else printf("--------%s", greaterthan);
  44. -    color(normal); printf(" 0x%010"LL"X%s", offsetend, newline); color(arrow);
  45. -    if (terminal) printf("%s%sÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ", sp5, lessthan);
  46. -    else printf("%s%s-----------------", sp5, lessthan);
  47. +    color(normal); printf(" 0x%010"LL"X", offsetend);
  48. +    color(normal); printf("%s%s", newline, sp5); color(arrow);
  49. +    if (terminal) printf("%sÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ", lessthan);
  50. +    else printf("%s-----------------", lessthan);
  51.      color(normal); printf(" %07lu sectors (%010"LL"u bytes) ", sectorstotal, (unsigned long long) sectorstotal * 2048); color(arrow);
  52. -    if (terminal) printf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ%s%s%s", greaterthan, newline, newline);
  53. -    else printf("----------------%s%s%s", greaterthan, newline, newline);
  54. -    color(normal);
  55. +    if (terminal) printf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ%s", greaterthan);
  56. +    else printf("----------------%s", greaterthan);
  57. +    color(normal); printf("%s%s", newline, newline);
  58.    return;
  59.  }
  60.  
  61. @@ -7505,7 +7509,7 @@
  62.          if (padzeros(rebuiltisofile, rebuiltisofilename, 0, gamestartoffset) != 0) return 1;
  63.          fprintf(stderr, "Done\n");
  64.          
  65. -        void *unusedptr;
  66. +        void *reallocatedptr;
  67.          if (!keeporiginaliso) {
  68.              // close original iso file and delete it
  69.              if (fp != NULL) fclose(fp);
  70. @@ -7514,13 +7518,14 @@
  71.                  printf("ERROR: Removing %s%s%s failed! (%s) However, your ISO has been successfully rebuilt to %s%s%s%s",
  72.                         quotation, filename, quotation, strerror(errno), quotation, rebuiltisofilename, quotation, newline);
  73.                  color(normal);
  74. -                unusedptr = realloc(isofilename, (strlen(rebuiltisofilename) + 1) * sizeof(char));
  75. -                if (isofilename == NULL) {
  76. +                reallocatedptr = realloc(isofilename, (strlen(rebuiltisofilename) + 1) * sizeof(char));
  77. +                if (reallocatedptr == NULL) {
  78.                      color(red);
  79.                      printf("ERROR: Failed to reallocate memory for isofilename! Game over man... Game over!%s", newline);
  80.                      color(normal);
  81.                    exit(1);
  82.                  }
  83. +                isofilename = reallocatedptr;
  84.                  strcpy(isofilename, rebuiltisofilename);
  85.                  if (rebuiltisofile != NULL) fclose(rebuiltisofile);
  86.                  fp = fopen(rebuiltisofilename, "rb+");
  87. @@ -7550,13 +7555,14 @@
  88.                         quotation, rebuiltisofilename, quotation, quotation, filename, quotation, strerror(errno),
  89.                         quotation, rebuiltisofilename, quotation, newline);
  90.                  color(normal);
  91. -                unusedptr = realloc(isofilename, (strlen(rebuiltisofilename) + 1) * sizeof(char));
  92. -                if (isofilename == NULL) {
  93. +                reallocatedptr = realloc(isofilename, (strlen(rebuiltisofilename) + 1) * sizeof(char));
  94. +                if (reallocatedptr == NULL) {
  95.                      color(red);
  96.                      printf("ERROR: Failed to reallocate memory for isofilename! Game over man... Game over!%s", newline);
  97.                      color(normal);
  98.                    exit(1);
  99.                  }
  100. +                isofilename = reallocatedptr;
  101.                  strcpy(isofilename, rebuiltisofilename);
  102.                  fp = fopen(rebuiltisofilename, "rb+");
  103.                  if (fp == NULL) {
  104. @@ -7601,13 +7607,14 @@
  105.              // keep original iso, just change isofilename and fp to the rebuilt iso
  106.              if (fp != NULL) fclose(fp);
  107.              if (rebuiltisofile != NULL) fclose(rebuiltisofile);
  108. -            unusedptr = realloc(isofilename, (strlen(rebuiltisofilename) + 1) * sizeof(char));
  109. -            if (isofilename == NULL) {
  110. +            reallocatedptr = realloc(isofilename, (strlen(rebuiltisofilename) + 1) * sizeof(char));
  111. +            if (reallocatedptr == NULL) {
  112.                  color(red);
  113.                  printf("ERROR: Failed to reallocate memory for isofilename! Game over man... Game over!%s", newline);
  114.                  color(normal);
  115.                exit(1);
  116.              }
  117. +            isofilename = reallocatedptr;
  118.              strcpy(isofilename, rebuiltisofilename);
  119.              fp = fopen(rebuiltisofilename, "rb+");
  120.              if (fp == NULL) {
  121. @@ -10355,16 +10362,20 @@
  122.  void printheader() {
  123.      int i;
  124.      if (!noheader) {
  125. -        color(blue);
  126. -        if (terminal) printf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ%s", newline);
  127. -        else printf("-------------------------------------------------------------------------------%s", newline);
  128. +        color(boxblue);
  129. +        if (terminal) printf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");
  130. +        else printf("-------------------------------------------------------------------------------");
  131. +        color(normal);
  132. +        printf("%s", newline);
  133.          color(darkblue); printf("\\\\//\\\\//\\\\//\\\\//");
  134.          if (terminal) { printf("\\\\/"); color(normal); printf("Û"); color(darkblue); printf("\\\\//\\ "); }
  135.          else { color(white); printf("%s_ |_%s_ ", sp2, sp2); }
  136.          color(green); printf("\\ \\/ /"); color(white);
  137.          if (terminal) printf("ÚÄ¿ÚÄ¿ÚÄ¿");
  138.          else printf("_%s_%s_%s", sp2, sp2, sp2);
  139. -        color(darkblue); printf("\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\%s//\\\\//\\\\//\\\\//\\", newline);
  140. +        color(darkblue); printf("\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\");
  141. +        color(normal); printf("%s", newline);
  142. +        color(darkblue); printf("//\\\\//\\\\//\\\\//\\");
  143.          if (!terminal) printf("\\");
  144.          if (terminal) { color(normal); printf("ÛßÛ"); color(darkblue); printf("\\"); color(normal); printf("ÛßÛ");
  145.                          color(darkblue); printf("\\"); color(normal); printf("ÛßÛ"); }
  146. @@ -10373,28 +10384,30 @@
  147.          if (terminal && html) printf(" Ä´ÃÄ¿| |");
  148.          else if (terminal) printf(" Ä´ÃÄ¿³ ³");
  149.          else printf("_||_ | | ");
  150. -        color(darkblue); printf("//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//%s", newline); color(blue);
  151. -        if (terminal) { printf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ"); color(normal); printf("ßßß"); color(blue); printf("Ä");
  152. -                        color(normal); printf("ßßß"); color(blue); printf("Ä"); color(normal); printf("ßßÛ"); }
  153. +        color(darkblue); printf("//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//");
  154. +        color(normal); printf("%s", newline);
  155. +        color(boxblue);
  156. +        if (terminal) { printf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ"); color(normal); printf("ßßß"); color(boxblue); printf("Ä");
  157. +                        color(normal); printf("ßßß"); color(boxblue); printf("Ä"); color(normal); printf("ßßÛ"); }
  158.          else { printf("------------------------"); color(white); printf("_|"); }
  159. -        color(blue);
  160. +        color(boxblue);
  161.          if (terminal) printf("ÄÄÄÄÄÄ");
  162.          else printf("------");
  163.          color(white);
  164.          if (terminal) printf("ÀÄÙÀÄÙÀÄÙ");
  165. -        else printf("_||_||_|"); color(blue);
  166. +        else printf("_||_||_|"); color(boxblue);
  167.          if (terminal) printf("Ä");
  168.          else printf("--");
  169. -        color(normal); printf("%s", headerversion); color(blue);
  170. +        color(normal); printf("%s", headerversion); color(boxblue);
  171.          for (i=0;i<13 - (int) strlen(headerversion);i++) {
  172.              if (terminal) printf("Ä");
  173.              else printf("-");
  174.          }
  175. -        color(normal); printf("[http://abgx360.net]"); color(blue);
  176. +        color(normal); printf("[http://abgx360.net]"); color(boxblue);
  177.          if (terminal) printf("ÄÄÄÄ");
  178.          else printf("----");
  179. -        printf("%s", newline);
  180.          color(normal);
  181. +        printf("%s", newline);
  182.          if (terminal) printf("%s%s%s ßßß", sp10, sp10, sp2);
  183.          printf("%s", newline);
  184.      }
  185. @@ -10440,6 +10453,7 @@
  186.          else if (strcmp(color, white) == 0)          SetConsoleTextAttribute(hConsoleOutput, 15);
  187.          else if (strcmp(color, green) == 0)          SetConsoleTextAttribute(hConsoleOutput, 10);
  188.          else if (strcmp(color, blue) == 0)           SetConsoleTextAttribute(hConsoleOutput, 9);
  189. +        else if (strcmp(color, boxblue) == 0)        SetConsoleTextAttribute(hConsoleOutput, 9);
  190.          else if (strcmp(color, darkblue) == 0)       SetConsoleTextAttribute(hConsoleOutput, 1);
  191.          else if (strcmp(color, yellow) == 0)         SetConsoleTextAttribute(hConsoleOutput, 14);
  192.          else if (strcmp(color, red) == 0)            SetConsoleTextAttribute(hConsoleOutput, 12);
  193. @@ -15773,6 +15787,7 @@
  194.                  else printf("Unencrypted%s", newline);
  195.              }
  196.              else {
  197. +                (void)xex_is_compressed_unknown; /* xex_is_compressed_unknown should be positive here */
  198.                  printf("Unrecognized Compression Method ");
  199.                  if (xex_is_encrypted) printf("(Encrypted)%s", newline);
  200.                  else printf("(Unencrypted)%s", newline);
  201. @@ -16363,7 +16378,7 @@
  202.          color(normal);
  203.        return 1;
  204.      }
  205. -    printstderr = true; color(white);
  206. +    printstderr = true; color(normal); color(white);
  207.      if (verbose) fprintf(stderr, "\n");
  208.      fprintf(stderr, "Checking Game CRC...");
  209.      color(normal);
  210. @@ -17759,11 +17774,9 @@
  211.          if (badcpr_mai.count) color(normal);
  212.          printf("%s", newline);
  213.      }
  214. -    bool triedtofix = false;
  215.      if (ssv2) {
  216.          if (foundangle359_count && fixangle359) {
  217.              // the only thing we are willing to 'fix' in ss v2
  218. -            triedtofix = true;
  219.              if (verbose) printf("%s", newline);
  220.              if (!writefile) {
  221.                  printf("Unable to fix the following item(s) because writing is disabled:%s", newline);
  222. @@ -17793,7 +17806,6 @@
  223.      else if ( ( fixDRT && (badCD.count || badResponse.count || badcpr_mai.count || baddriveangle.count) ) ||
  224.                ( fixdeviation && (highangledev.count || mediumangledev.count || userangledev.count) ) ||
  225.                ( foundangle359_count && fixangle359 ) ) {
  226. -        triedtofix = true;
  227.          if (verbose) printf("%s", newline);
  228.          printf("Fixing SS Challenge / Response Data...%s", newline);
  229.          if (!writefile) {
  230. @@ -20558,14 +20570,13 @@
  231.          donecheckread("L0 Video padding");
  232.          if (videoL0zeropadding) {
  233.              color(green);
  234. -            printf("L0 Video is zero padded%s", newline);
  235. -            color(normal);
  236. +            printf("L0 Video is zero padded");
  237. +            color(normal); printf("%s", newline);
  238.              goto skipL0videopadding;
  239.          }
  240.          if (!xgd3 && !padL0) {
  241. -            fprintf(stderr, "\n");
  242.              color(yellow);
  243. -            printf("-------------------------------------------------------------------------------%s"
  244. +            printf("%s-------------------------------------------------------------------------------%s"
  245.                     "L0 Video padding contains data but this is normal for XGD2 (The old way of\n"
  246.                     "putting L1 video on L0). Add command line option --pL0 if you want to blank it\n"
  247.                     "out (the data hasn't actually been checked that it matches L1 video... it could\n"
  248. @@ -20578,8 +20589,8 @@
  249.                     "disable \"Check/Fix Video padding\", as it still makes no difference in terms\n"
  250.                     "of stealth... this option only exists as a way to make sure ISOs are \"clean\",\n"
  251.                     "with no extra data in areas that aren't CRC checked.%s"
  252. -                   "-------------------------------------------------------------------------------%s", newline, newline, newline);
  253. -            color(normal);
  254. +                   "-------------------------------------------------------------------------------", newline, newline, newline);
  255. +            color(normal); printf("%s", newline);
  256.              goto skipL0videopadding;
  257.          }
  258.          if (!writefile) {
  259. @@ -20664,8 +20675,8 @@
  260.          donecheckwrite("L0 Video Padding");
  261.          color(green);
  262.          if (verbose) printf("%s", sp5);
  263. -        printf("L0 Video padding zeroed successfully%s", newline);
  264. -        color(normal);
  265. +        printf("L0 Video padding zeroed successfully");
  266. +        color(normal); printf("%s", newline);
  267.          
  268.          skipL0videopadding:
  269.          // check L1 video padding
  270. @@ -20759,8 +20770,8 @@
  271.          donecheckread("L1 Video padding");
  272.          if (videoL1zeropadding) {
  273.              color(green);
  274. -            printf("L1 Video is zero padded%s", newline);
  275. -            color(normal);
  276. +            printf("L1 Video is zero padded");
  277. +            color(normal); printf("%s", newline);
  278.              goto skipvideopadding;
  279.          }
  280.          if (!writefile) {
  281. @@ -20903,8 +20914,8 @@
  282.              donecheckread("XGD3 Stealth padding");
  283.              if (xgd3stealthzeropadding) {
  284.                  color(green);
  285. -                printf("XGD3 Stealth is zero padded%s", newline);
  286. -                color(normal);
  287. +                printf("XGD3 Stealth is zero padded");
  288. +                color(normal); printf("%s", newline);
  289.                  goto skippadding;
  290.              }
  291.              if (!writefile) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement