Browse Source

* initialized some fields and data to -1 to make the results more similar to the slave chm (merged_chapter/example1/slave1) example.

Now only
  - the checksum at $4
  - the number of topics (different issue)
  - the offset of framename in #strings differs.
marcoonthegit 3 years ago
parent
commit
54c95288f8
2 changed files with 12 additions and 9 deletions
  1. 3 0
      packages/chm/src/chmsitemap.pas
  2. 9 9
      packages/chm/src/chmwriter.pas

+ 3 - 0
packages/chm/src/chmsitemap.pas

@@ -409,6 +409,9 @@ begin
   FSiteMapBodyTags := [smbtNone];
   FHTMLParser:=nil;
   FItems := TChmSiteMapItems.Create(Self, nil);  ;
+  BackgroundColor:=-1;
+  ForegroundColor:=-1;
+  ExWindowStyles:=-1;
 end;
 
 destructor TChmSiteMap.Destroy;

+ 9 - 9
packages/chm/src/chmwriter.pas

@@ -1180,7 +1180,7 @@ begin
    FIDXHdrStream.setsize(4096);
    FIDXHdrStream.position:=0;
    FIDXHdrStream.write(idxhdrmagic[1],4);     //  0 Magic
-   FIDXHdrStream.writedword(ntole(1));        //  4 Unknown timestamp/checksum
+   FIDXHdrStream.writedword(ntole(0));        //  4 Unknown timestamp/checksum
    FIDXHdrStream.writedword(ntole(1));        //  8 1 (unknown)
    FIDXHdrStream.writedword(ntole(FNrTopics));        //  C Number of topic nodes including the contents & index files
    FIDXHdrStream.writedword(ntole(0));        // 10 0 (unknown)
@@ -1189,7 +1189,7 @@ begin
    if assigned(ftocsm) and (ftocsm.ImageList<>'') then
      FIDXHdrStream.writedwordLE(addstring(ftocsm.ImageList))
    else
-     FIDXHdrStream.writedwordLE(0);
+     FIDXHdrStream.writedwordLE(-1);
 
    // 18 0 (unknown)
    FIDXHdrStream.writedwordLE(0);
@@ -1204,25 +1204,25 @@ begin
    if assigned(ftocsm) then
      FIDXHdrStream.writedwordLE(ftocsm.Backgroundcolor)
    else
-     FIDXHdrStream.writedwordLE(0);
+     FIDXHdrStream.writedwordLE(-1);
 
    // 24 The value of the Foreground param of the "text/site properties" object of the sitemap contents
    if assigned(ftocsm) then
      FIDXHdrStream.writedwordLE(ftocsm.Foregroundcolor)
    else
-     FIDXHdrStream.writedwordLE(0);
+     FIDXHdrStream.writedwordLE(-1);
 
    // 28 Offset in the #STRINGS file of the Font param of the "text/site properties" object of the sitemap contents (0/-1 = none)
    if assigned(ftocsm) and (ftocsm.Font<>'') then
      FIDXHdrStream.writedwordLE(addstring(ftocsm.font))
    else
-     FIDXHdrStream.writedwordLE(0);
+     FIDXHdrStream.writedwordLE(-1);
 
    // 2C The value of the Window Styles param of the "text/site properties" object of the sitemap contents
    if assigned(ftocsm) then
      FIDXHdrStream.writedwordLE(FTocsm.WindowStyles)
    else
-     FIDXHdrStream.writedwordLE(0);
+     FIDXHdrStream.writedwordLE(-1);
 
    // 30 The value of the EXWindow Styles param of the "text/site properties" object of the sitemap contents
    if assigned(ftocsm) then
@@ -1231,7 +1231,7 @@ begin
      FIDXHdrStream.writedwordLE(0);
 
    // 34 Unknown. Often -1. Sometimes 0.
-   FIDXHdrStream.writedwordLE(0);
+   FIDXHdrStream.writedwordLE(-1);
 
    // 38 Offset in the #STRINGS file of the FrameName param of the "text/site properties" object of the sitemap contents (0/-1 = none)
    if assigned(ftocsm) and (ftocsm.framename<>'') then
@@ -1243,9 +1243,9 @@ begin
    if assigned(ftocsm) and (ftocsm.windowname<>'') then
      FIDXHdrStream.writedwordLE(addstring(FTocsm.windowname))
    else
-     FIDXHdrStream.writedwordLE(0);
+     FIDXHdrStream.writedwordLE(-1);
    FIDXHdrStream.writedword(ntole(0));        // 40 Number of information types.
-   FIDXHdrStream.writedword(ntole(0));        // 44 Unknown. Often 1. Also 0, 3.
+   FIDXHdrStream.writedword(ntole(1));        // 44 Unknown. Often 1. Also 0, 3.
    FIDXHdrStream.writedword(ntole(fmergefiles.count));        // 48 Number of files in the [MERGE FILES] list.
 
    // 4C Unknown. Often 0. Non-zero mostly in files with some files in the merge files list.