2
0
Эх сурвалжийг харах

* Handle video initialization failure.

git-svn-id: trunk@3843 -
daniel 19 жил өмнө
parent
commit
6de9a0ffb2
4 өөрчлөгдсөн 26 нэмэгдсэн , 11 устгасан
  1. 12 4
      fv/app.pas
  2. 11 6
      fv/drivers.pas
  3. 1 0
      fv/str.inc
  4. 2 1
      fv/strtxt.inc

+ 12 - 4
fv/app.pas

@@ -971,16 +971,24 @@ END;
 {  Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 22Oct99 LdB              }
 {  Init -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 22Oct99 LdB              }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 CONSTRUCTOR TApplication.Init;
 CONSTRUCTOR TApplication.Init;
+
 BEGIN
 BEGIN
 {   InitMemory;}                                              { Start memory up }
 {   InitMemory;}                                              { Start memory up }
+   InitResource;
    initkeyboard;
    initkeyboard;
-   Drivers.InitVideo;                                         { Start video up }
+   if not Drivers.InitVideo then                              { Start video up }
+     begin
+       donekeyboard;
+       {Initresource might have failed.}
+       if strings<>nil then
+         writeln(strings^.get(sVideoFailed));
+       halt(1);
+     end;
    Drivers.InitEvents;                                        { Start event drive }
    Drivers.InitEvents;                                        { Start event drive }
    Drivers.InitSysError;                                      { Start system error }
    Drivers.InitSysError;                                      { Start system error }
    InitHistory;                                               { Start history up }
    InitHistory;                                               { Start history up }
-   InitResource;
-   InitMsgBox;
    Inherited Init;                                            { Call ancestor }
    Inherited Init;                                            { Call ancestor }
+   InitMsgBox;
    { init mouse and cursor }
    { init mouse and cursor }
    Video.SetCursorType(crHidden);
    Video.SetCursorType(crHidden);
    Mouse.SetMouseXY(1,1);
    Mouse.SetMouseXY(1,1);
@@ -993,12 +1001,12 @@ DESTRUCTOR TApplication.Done;
 BEGIN
 BEGIN
    Inherited Done;                                    { Call ancestor }
    Inherited Done;                                    { Call ancestor }
    DoneHistory;                                       { Close history }
    DoneHistory;                                       { Close history }
-   DoneResource;
    Drivers.DoneSysError;                                      { Close system error }
    Drivers.DoneSysError;                                      { Close system error }
    Drivers.DoneEvents;                                        { Close event drive }
    Drivers.DoneEvents;                                        { Close event drive }
    drivers.donevideo;
    drivers.donevideo;
 {   DoneMemory;}                                       { Close memory }
 {   DoneMemory;}                                       { Close memory }
    donekeyboard;
    donekeyboard;
+   DoneResource;
 END;
 END;
 
 
 {--TApplication-------------------------------------------------------------}
 {--TApplication-------------------------------------------------------------}

+ 11 - 6
fv/drivers.pas

@@ -488,7 +488,7 @@ Initializes the video manager, Saves the current screen mode in
 StartupMode, and switches to the mode indicated by ScreenMode.
 StartupMode, and switches to the mode indicated by ScreenMode.
 19May98 LdB
 19May98 LdB
 ---------------------------------------------------------------------}
 ---------------------------------------------------------------------}
-PROCEDURE InitVideo;
+function InitVideo:boolean;
 
 
 {-DoneVideo---------------------------------------------------------
 {-DoneVideo---------------------------------------------------------
 Terminates the video manager by restoring the initial screen mode
 Terminates the video manager by restoring the initial screen mode
@@ -1304,10 +1304,12 @@ end;
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 {  InitVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Nov99 LdB         }
 {  InitVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Nov99 LdB         }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
-PROCEDURE InitVideo;
-VAR
-  StoreScreenMode : TVideoMode;
-BEGIN
+function InitVideo:boolean;
+
+var StoreScreenMode : TVideoMode;
+
+begin
+  initvideo:=false;
   if VideoInitialized then
   if VideoInitialized then
     begin
     begin
       StoreScreenMode:=ScreenMode;
       StoreScreenMode:=ScreenMode;
@@ -1317,6 +1319,8 @@ BEGIN
     StoreScreenMode.Col:=0;
     StoreScreenMode.Col:=0;
 
 
   Video.InitVideo;
   Video.InitVideo;
+  if video.errorcode<>viook then
+    exit;
   GetVideoMode(StartupScreenMode);
   GetVideoMode(StartupScreenMode);
   GetVideoMode(ScreenMode);
   GetVideoMode(ScreenMode);
 {$ifdef win32}
 {$ifdef win32}
@@ -1338,7 +1342,8 @@ BEGIN
   ScreenWidth:=Video.ScreenWidth;
   ScreenWidth:=Video.ScreenWidth;
   ScreenHeight:=Video.ScreenHeight;
   ScreenHeight:=Video.ScreenHeight;
   VideoInitialized:=true;
   VideoInitialized:=true;
-END;
+  initvideo:=true;
+end;
 
 
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 {  DoneVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 19May98 LdB         }
 {  DoneVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 19May98 LdB         }

+ 1 - 0
fv/str.inc

@@ -1,4 +1,5 @@
 { Strings }
 { Strings }
+sVideoFailed = 0; {Video initialization failed.}
 sButtonDefault = 1; { Button default }
 sButtonDefault = 1; { Button default }
 sButtonDisabled = 2; { Button disabled }
 sButtonDisabled = 2; { Button disabled }
 sButtonNormal = 3; { Button normal }
 sButtonNormal = 3; { Button normal }

+ 2 - 1
fv/strtxt.inc

@@ -3,8 +3,9 @@ type standard_string=record
        text:Pchar;
        text:Pchar;
      end;
      end;
 
 
-const standard_string_count=106;
+const standard_string_count=107;
       standard_strings:array[0..standard_string_count-1] of standard_string=(
       standard_strings:array[0..standard_string_count-1] of standard_string=(
+          (nr:sVideoFailed;text:'Video initialization failed.'),
           (nr:sButtonDefault;text:'Button default'),
           (nr:sButtonDefault;text:'Button default'),
           (nr:sButtonDisabled;text:'Button disabled'),
           (nr:sButtonDisabled;text:'Button disabled'),
           (nr:sButtonNormal;text:'Button normal'),
           (nr:sButtonNormal;text:'Button normal'),