Index: oup/current/DataAccess/Access_OUP_ADB.pas
===================================================================
--- oup/current/DataAccess/Access_OUP_ADB.pas	(revision 112)
+++ oup/current/DataAccess/Access_OUP_ADB.pas	(revision 113)
@@ -32,4 +32,5 @@
     procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TStream); overload; override;
 
+    function GetDatLinks(FileID: Integer): TDatLinkList; override;
     function GetRawList(FileID: Integer): TRawDataList; override;
     function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override;
@@ -56,6 +57,4 @@
 
 constructor TAccess_OUP_ADB.Create(DBFilename: String; ConnectionID: Integer; var Msg: TStatusMessages);
-var
-  i: Integer;
 begin
   Msg := SM_UnknownError;
@@ -142,5 +141,5 @@
       Fdat_files[i].Extension := FQuery.FieldByName('extension').AsString;
       Fdat_files[i].Size := FQuery.FieldByName('size').AsInteger;
-      Fdat_files[i].FileType := HexToLong(FQuery.FieldByName('contenttype').AsString);
+      Fdat_files[i].FileType := StrToInt('$'+FQuery.FieldByName('contenttype').AsString);
       Fdat_files[i].DatAddr := 0;
       Inc(i);
@@ -294,5 +293,6 @@
     end;
   end;
-  Result := TStringList.Create;
+  if not Assigned(Result) then
+    Result := TStringList.Create;
   if list.Count > 0 then
   begin
@@ -328,5 +328,8 @@
   i: Integer;
 begin
-  Result := TStringList.Create;
+  if not Assigned(Result) then
+    Result := TStringList.Create;
+  if Result is TStringList then
+    TStringList(Result).Sorted := True;
   for i := 0 to Length(Fdat_extensionsmap) - 1 do
   begin
Index: oup/current/DataAccess/Access_OniArchive.pas
===================================================================
--- oup/current/DataAccess/Access_OniArchive.pas	(revision 112)
+++ oup/current/DataAccess/Access_OniArchive.pas	(revision 113)
@@ -34,4 +34,5 @@
     procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TStream); overload; override;
 
+    function GetDatLinks(FileID: Integer): TDatLinkList; override;
     function GetRawList(FileID: Integer): TRawDataList; override;
     function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override;
@@ -60,16 +61,4 @@
 
 constructor TAccess_OniArchive.Create(DatFilename: String; ConnectionID: Integer; var Msg: TStatusMessages);
-const
-  header_ident1_pc: array[0..$13] of Byte =
-    ($1F, $27, $DC, $33, $DF, $BC, $03, $00, $31, $33, $52, $56, $40, $00,
-    $14, $00, $10, $00, $08, $00);
-  header_ident1_mac: array[0..$13] of Byte =
-    ($61, $30, $C1, $23, $DF, $BC, $03, $00, $31, $33, $52, $56, $40, $00,
-    $14, $00, $10, $00, $08, $00);
-  header_ident1_macbeta: array[0..$13] of Byte =
-    ($81, $11, $8D, $23, $DF, $BC, $03, $00, $31, $33, $52, $56, $40, $00,
-    $14, $00, $10, $00, $08, $00);
-  header_ident2: array[0..$F] of Byte =
-    ($99, $CF, $40, $00, $90, $4F, $63, $00, $F4, $55, $5F, $00, $90, $4F, $63, $00);
 var
   i: Integer;
@@ -94,12 +83,18 @@
   header_mac := True;
   header_macbeta := True;
-  for i := 0 to High(Fdat_header.Ident) do
-  begin
-//    FLevelInfo.Ident[i] := Fdat_header.Ident[i];
-    if Fdat_header.Ident[i] <> header_ident1_pc[i] then
+  for i := 0 to High(Fdat_header.GlobalIdent) do
+    if Fdat_header.GlobalIdent[i] <> HeaderGlobalIdent[i] then
+    begin
+      Msg := SM_IncompatibleFile;
+      Exit;
+    end;
+
+  for i := 0 to High(Fdat_header.OSIdent) do
+  begin
+    if Fdat_header.OSIdent[i] <> HeaderOSIdentWin[i] then
       header_pc := False;
-    if Fdat_header.Ident[i] <> header_ident1_mac[i] then
+    if Fdat_header.OSIdent[i] <> HeaderOSIdentMac[i] then
       header_mac := False;
-    if Fdat_header.Ident[i] <> header_ident1_macbeta[i] then
+    if Fdat_header.OSIdent[i] <> HeaderOSIdentMacBeta[i] then
       header_macbeta := False;
   end;
@@ -259,5 +254,6 @@
     end;
   end;
-  Result := TStringList.Create;
+  if not Assigned(Result) then
+    Result := TStringList.Create;
   if list.Count > 0 then
   begin
@@ -295,5 +291,8 @@
   i: Integer;
 begin
-  Result := TStringList.Create;
+  if not Assigned(Result) then
+    Result := TStringList.Create;
+  if Result is TStringList then
+    TStringList(Result).Sorted := True;
   for i := 0 to Length(Fdat_extensionsmap) - 1 do
   begin
Index: oup/current/DataAccess/DataAccess.pas
===================================================================
--- oup/current/DataAccess/DataAccess.pas	(revision 112)
+++ oup/current/DataAccess/DataAccess.pas	(revision 113)
@@ -44,4 +44,5 @@
     procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: Pointer); overload;
 
+    function GetDatLinks(FileID: Integer): TDatLinkList; virtual; abstract;
     function GetRawList(FileID: Integer): TRawDataList; virtual; abstract;
     function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; virtual; abstract;
@@ -272,5 +273,5 @@
   data.Write(Src[0], Length(Src));
   data.Seek(0, soFromBeginning);
-  AppendRawFile(LocSep, data);
+  Result := AppendRawFile(LocSep, data);
   data.Free;
 end;
@@ -283,5 +284,5 @@
   data.Write(Src^, Size);
   data.Seek(0, soFromBeginning);
-  AppendRawFile(LocSep, data);
+  Result := AppendRawFile(LocSep, data);
   data.Free;
 end;
