2 Revīzijas 26752a6525 ... 2a6746c3e4

Autors SHA1 Ziņojums Datums
  CYBERDEV 2a6746c3e4 New string found in the WiseScript.bin header. 1 mēnesi atpakaļ
  CYBERDEV ecc985a30a Forget to stage the 0x30 struct 1 mēnesi atpakaļ
2 mainītis faili ar 30 papildinājumiem un 11 dzēšanām
  1. 21 10
      src/wisescript.c
  2. 9 1
      src/wisescript.h

+ 21 - 10
src/wisescript.c

@@ -56,8 +56,9 @@ const WiseScriptParseState *getWiseScriptState(void)
 
 REWError readWiseScriptHeader(FILE *fp, WiseScriptHeader *header) {
   // init struct
+  header->url = NULL;
   header->logPath = NULL;
-  header->font    = NULL;
+  header->font = NULL;
 
   REWError status;
 
@@ -91,12 +92,18 @@ REWError readWiseScriptHeader(FILE *fp, WiseScriptHeader *header) {
     return false;
   }
 
-  // Read 23 unknown bytes
-  if ((status = readBytesInto(fp, header->unknown_23, 23)) != REWERR_OK) {
-    printError("Failed to read 23 unknown bytes\n");
+  // Read 22 unknown bytes
+  if ((status = readBytesInto(fp, header->unknown_22, 22)) != REWERR_OK) {
+    printError("Failed to read 22 unknown bytes\n");
     return false;
   }
 
+  status = readCString(fp, &header->url);
+  if (status != REWERR_OK) {
+    printError("Failed to read WiseScriptHeader url: %d\n", status);
+    return status;
+  }
+
   status = readCString(fp, &header->logPath);
   if (status != REWERR_OK) {
     printError("Failed to read WiseScriptHeader logpath: %d\n", status);
@@ -902,6 +909,10 @@ REWError readWiseScriptUnknown0x30(FILE *fp, WiseScriptUnknown0x30 *data)
 
 
 void freeWiseScriptHeader(WiseScriptHeader * header) {
+  if (header->url != NULL) {
+    free(header->url);
+    header->url = NULL;
+  }
   if (header->logPath != NULL) {
     free(header->logPath);
     header->logPath = NULL;
@@ -1243,16 +1254,16 @@ void printWiseScriptHeader(WiseScriptHeader * header) {
 
   printf("datetime    : 0x%08X (%u)\n", header->datetime, header->datetime);
 
-  printf("unknown_23  : ");
-  for (int i = 0; i < 23; i++) {
-    printf("%02X ", header->unknown_23[i]);
+  printf("unknown_22  : ");
+  for (int i = 0; i < 22; i++) {
+    printf("%02X ", header->unknown_22[i]);
   }
   printf("\n");
 
-
-  printf("'%s': '%s'\n", header->font, header->logPath);
+  printf("header->url    : '%s'\n", header->url);
+  printf("header->font   : '%s'\n", header->font);
+  printf("header->logPath: '%s'\n", header->logPath);
   printf("-----------------\n");
-  
 }
 
 void printWiseScriptLanguages(CStrings *languages)

+ 9 - 1
src/wisescript.h

@@ -136,8 +136,9 @@ typedef struct {
   // Creation of this WiseScript.bin since UNIX epoch.
   uint32_t datetime;
 
-  unsigned char unknown_23[23];
+  unsigned char unknown_22[22];
 
+  char * url;     // only seen in glsetup.exe, others just \0
   char * logPath; // \0 terminated string
   char * font;    // \0 terminated string
 
@@ -401,6 +402,13 @@ typedef struct {
   char * varValue;
 } WiseScriptUnknown0x23;
 
+/* WiseScriptUnknown0x30 */
+typedef struct {
+  unsigned char unknown_1;
+  char *unknownString_1;
+  char *unknownString_2;
+} WiseScriptUnknown0x30;
+
 
 REWError readWiseScriptHeader(FILE * fp, WiseScriptHeader * header);
 REWError readWiseScriptFileHeader(FILE * fp, WiseScriptFileHeader * data, uint32_t langCount);