Recent

Author Topic: Possible Bug in video.pp (GetVideoMode(aMode);) delivers zero values.  (Read 2945 times)

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
the video.pp from rtl-console is heavily used in fv and it's descendents.

the DetectVideo-Procedure in drivers should detect the current -text-console mode, without changing it.
therefore it's declared as
Code: Pascal  [Select][+][-]
  1. procedure DetectVideo;
  2. VAR
  3.   CurrMode : TVideoMode;
  4. begin
  5.   { Video.InitVideo; Incompatible with BP
  6.     and forces a screen clear which is often a bad thing PM }
  7.   GetVideoMode(CurrMode);
  8.   ScreenMode:=CurrMode;
  9. end;
  10.  

But since video isn't initialized, it returns zero-values.
But on video.initVideo the screen is changed.
Is there a way to init video, another (less invasive) way ?
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Possible Bug in video.pp (GetVideoMode(aMode);) delivers zero values.
« Reply #1 on: April 01, 2016, 12:14:58 am »
I found a possible workaround:

Code: Pascal  [Select][+][-]
  1. procedure DetectVideo;
  2. VAR
  3.   CurrMode : TVideoMode;
  4.   Driver: TVideoDriver;
  5. begin
  6.   { Video.InitVideo; Incompatible with BP
  7.     and forces a screen clear which is often a bad thing PM }
  8.   if video.ScreenWidth = 0 then
  9.     begin
  10.       GetVideoDriver (Driver);
  11.       if Assigned(Driver.InitDriver) then
  12.         driver.InitDriver;
  13.     end;
  14.   GetVideoMode(CurrMode);
  15.   ScreenMode:=CurrMode;
  16. end;
  17.  

Now it detects the color and width but still there is a minor issue about the height, (I allways get 63 instead of 25/43 or 50 )

[Edit:]
Maybe it's a bug in FV and the initialization should be done in the initialization-section of the unit.

The best way to solve it, would be that initVideo has a (DoClearScreen=true) parameter. So you have the option whether to clear the screen, or not.
« Last Edit: April 01, 2016, 08:57:24 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

 

TinyPortal © 2005-2018