Recent

Author Topic: Exception Class 'External: SIGSEGV' after importing a procedure [SOLVED]  (Read 2632 times)

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Hello everybody,

I recenlty had a design-issue with one of my tools where it wouldn't adjust to the current screen resolution resulting in a few components (like Buttons) as well as parts of tool itself being outside the screen. I got help, providing me with the external component TFormResizer (EasySize) where I could set the position of buttons as well as set a dynamic view based on the current screen resolution.

That created a new problem (or better said I saw a new issue I did not notice before) - the Background image did not adjust to the EasySize-Code meaning that for smaller monitors the picture would be cut off and bigger monitors would show only the image without adjusting it to the current resolution (a lot of free background was there which should have been covered by the image). I once again got help and fixed this.

I was sent two different code snippets by two different users which were tested by me in two seperate lazarus projects and both worked fine. Now I thought I could simply combine the two and this is where I ran into troubles, again.

This is my code (with explanations):

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
  9.   Buttons, ComCtrls, Menus, EasySize;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     BitBtn1: TBitBtn;
  17.     Button1: TButton;
  18.     Edit1: TEdit;
  19.     ListBox1: TListBox;
  20.     Notebook1: TNotebook;
  21.     Page1: TPage;
  22.     Page2: TPage;
  23.     PaintBox1: TPaintBox;
  24.     PaintBox2: TPaintBox;
  25.     RadioButton1: TRadioButton;
  26.  
  27.     procedure BitBtn1Click(Sender: TObject);
  28.     procedure FormClose(Sender: TObject);
  29.     procedure FormCreate(Sender: TObject);
  30.     procedure FormResize(Sender: TObject);
  31.     procedure PaintBoxPaint(Sender: TObject);
  32.   private
  33.     Sizer: TFormResizer;
  34.  
  35.   public
  36.      img: array[1..2] of TImage;
  37.  
  38.   end;
  39.  
  40. var
  41.   Form1: TForm1;
  42.  
  43. implementation
  44.  
  45. {$R *.lfm}
  46.  
  47. { TForm1 }
  48.  
  49. procedure TForm1.FormCreate(Sender: TObject); //This is where I first combined the two different snippets.
  50. begin
  51.   img[1]:=TImage.create(form1); //here I set the background images (snippet 2)
  52.   img[1].Picture.LoadFromFile('background1.jpg');
  53.   img[2]:=TImage.create(form1);
  54.   img[2].Picture.LoadFromFile('background2.jpg');
  55.  
  56.   Sizer := TFormResizer.Create(self); //and this is the start of the Resizer, which work's fine (snippet1)
  57.   Sizer.EnforceMinSize := false;
  58.   Sizer.ResizeFonts := true;
  59.   Sizer.MinFontSize := 6;
  60.   Sizer.MaxFontSize := 30;
  61.   Sizer.InitializeForm;
  62.  
  63.   Width := round(Screen.Width/2.4);
  64.   Height := round(Screen.Height/2.4);
  65.  
  66.   Position := poScreenCenter;
  67. end;
  68.  
  69. procedure TForm1.FormClose(Sender: TObject); //This is used to free the images used for the background
  70. begin
  71.    img[1].free;
  72.    img[2].free;
  73. end;
  74.  
  75. procedure TForm1.FormResize(Sender: TObject); //Again this is used to resize the window of my tool.
  76. begin
  77.   Sizer.ResizeAll;
  78. end;
  79.  
  80. procedure TForm1.PaintBoxPaint(Sender: TObject); //This is the procedure which troubles me. It should set an background image for each notepad-page
  81. var
  82.   pb : TPaintbox;
  83.   r : TRect;
  84. begin
  85.   pb := TPaintbox(sender);
  86.   r := rect(0,0,pb.width,pb.height);
  87.   pb.canvas.stretchdraw(r,img[pb.tag].Picture.Graphic); //I get an error-message (see below)
  88. end;
  89.  
  90. end.

When I try to run the tool i get the following message:

Code: Pascal  [Select][+][-]
  1. Error: Project raised exception class >>External: SIGSEGV<<
  2. In file 'unit1.pas' in line 87:
  3. pb.canvas.stretchdraw(r,img[pb.tag].Picture.Graphic);

I don't know why this occurs since both snippets run just fine for themselves. If it's helpful to answer my question, I added the snippets I got sent as attachments.
« Last Edit: April 15, 2021, 08:44:28 am by AlphaInc. »

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #1 on: April 14, 2021, 04:19:32 pm »
Just my guess. Don't put anything that access the the screen on OnCreate event. OnCreate event is for initialize default values, many things are not fully prepared including the screen object, so reading the screen information may cause error.

If my guess is correct. The solution is, move the code to OnActivate but make sure it only runs once.

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #2 on: April 14, 2021, 04:19:46 pm »
that "pb.Tag" you use as an array-index irritates me
according to
https://lazarus-ccr.sourceforge.io/docs/rtl/classes/tcomponent.tag.html
https://lazarus-ccr.sourceforge.io/docs/lcl/extctrls/tpaintbox-2.html
Tag (inherited from TComponent) is of Type PtrInt, and in your code i don't see anywhere you assigning a value to Tag, so it wouldn't surprise me, if Tag is Nil

Nevermind, that if Tag is really a (valid) pointer, i'm pretty sure it's not going to be in the range of 1..2 you need as an array-index

Can you check the Value of Tag just before you call your troublesome function?
« Last Edit: April 14, 2021, 04:23:04 pm by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #3 on: April 14, 2021, 04:49:53 pm »
I agree with @Zvoni, tag has 0, while the array expects 1 or 2.

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #4 on: April 14, 2021, 05:28:00 pm »
Just my guess. Don't put anything that access the the screen on OnCreate event. OnCreate event is for initialize default values, many things are not fully prepared including the screen object, so reading the screen information may cause error.

If my guess is correct. The solution is, move the code to OnActivate but make sure it only runs once.

Do you mean to put the Code of procedure TForm1.FormCreate anything else or do you mean something else?

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #5 on: April 14, 2021, 05:28:28 pm »
that "pb.Tag" you use as an array-index irritates me
according to
https://lazarus-ccr.sourceforge.io/docs/rtl/classes/tcomponent.tag.html
https://lazarus-ccr.sourceforge.io/docs/lcl/extctrls/tpaintbox-2.html
Tag (inherited from TComponent) is of Type PtrInt, and in your code i don't see anywhere you assigning a value to Tag, so it wouldn't surprise me, if Tag is Nil

Nevermind, that if Tag is really a (valid) pointer, i'm pretty sure it's not going to be in the range of 1..2 you need as an array-index

Can you check the Value of Tag just before you call your troublesome function?

Do I check the Value with a ShowMessage-command or how do I check it?

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #6 on: April 14, 2021, 05:46:17 pm »
I tested this code:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. var
  3.   i: Integer;
  4. begin
  5.   i := Screen.Width;
  6. end;

I checked the value of i using breakpoint. The result is 32767  :o

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #7 on: April 14, 2021, 05:55:30 pm »
I tested this code:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. var
  3.   i: Integer;
  4. begin
  5.   i := Screen.Width;
  6. end;

I checked the value of i using breakpoint. The result is 32767  :o

What does that mean ?

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #8 on: April 14, 2021, 05:58:38 pm »
Don't put Screen.Width nor Screen.Height inside OnCreate event.

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #9 on: April 14, 2021, 06:01:26 pm »
Don't put Screen.Width nor Screen.Height inside OnCreate event.

Okay, so where should I put it, a new procedure ?

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #10 on: April 14, 2021, 06:04:45 pm »
Scroll up and read the Reply #1.

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #11 on: April 14, 2021, 08:02:00 pm »
Scroll up and read the Reply #1.
I went to Form1 -> Events and entered FormCreate on onActivate and deleted it from OnCreate, did you mean that?
Anyway, this didn't work.

BUT while i was waiting for your reply (I noticed afterwards that you alreay replied but i did not see it) I copied the whole code from the resizer.zip file and copied it into the project file included in the background_image.zip. And that worked flawlessly. Since, I have ported my entire tool in the meantime, I'm finished with it. Yet I'd still like to know why the error occured when i did the reverse thing (copied the code form background_image.zip to resizer.zip). This would help me if I need to do something like that again.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #12 on: April 14, 2021, 08:08:32 pm »
Maybe it will be easier if you provide the source code.

I downloaded the sources you provided but they are not causing the error as what you mentioned. Also, as Zvoni said, there could be an error on the tag you used.

So, for me and others to better understand the issue you're having, please provide us the compile-able source that can show the issue. If you are not willing to publicize it on the forum, you can contact me personally.

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #13 on: April 14, 2021, 08:29:51 pm »
Maybe it will be easier if you provide the source code.

I downloaded the sources you provided but they are not causing the error as what you mentioned. Also, as Zvoni said, there could be an error on the tag you used.

So, for me and others to better understand the issue you're having, please provide us the compile-able source that can show the issue. If you are not willing to publicize it on the forum, you can contact me personally.

Thank you, that's very nice of you.
I can post my code, that's no problem.

This is the tool that works fine:

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls,
  9.   ExtCtrls, Buttons, ShellAPI, MMSystem, EasySize;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     Button9: TButton;
  17.     Notebook1: TNotebook;
  18.     PaintBox1: TPaintBox;
  19.     PaintBox2: TPaintBox;
  20.     Button1: TButton;
  21.     Button2: TButton;
  22.     Button3: TButton;
  23.     Button4: TButton;
  24.     Button5: TButton;
  25.     Button6: TButton;
  26.     Button7: TButton;
  27.     Button8: TButton;
  28.     Image1: TImage;
  29.     Image2: TImage;
  30.     Page1: TPage;
  31.     Page2: TPage;
  32.  
  33.     procedure Button9Click(Sender: TObject);
  34.     procedure PaintBoxPaint(Sender: TObject);
  35.     procedure Button1Click(Sender: TObject);
  36.     procedure Button2Click(Sender: TObject);
  37.     procedure Button3Click(Sender: TObject);
  38.     procedure Button4Click(Sender: TObject);
  39.     procedure Button5Click(Sender: TObject);
  40.     procedure Button6Click(Sender: TObject);
  41.     procedure Button7Click(Sender: TObject);
  42.     procedure Button8Click(Sender: TObject);
  43.     procedure FormCreate(Sender: TObject);
  44.     procedure FormResize(Sender: TObject);
  45.     procedure FormClose(Sender: TObject);
  46.     procedure confCheck();
  47.     procedure music();
  48.     procedure init();
  49.  
  50.   private
  51.     sEnhancementsLine:String;
  52.     sLanguageLine:String;
  53.     sVersionLine:String;
  54.     sModsLine:String;
  55.  
  56.     Sizer: TFormResizer;
  57.  
  58.   public
  59.     img : array [1..2] of TImage;
  60.   end;
  61.  
  62. var
  63.   Form1: TForm1;
  64.  
  65. implementation
  66.  
  67. {$R *.lfm}
  68.  
  69. { TForm1 }
  70.  
  71. const cMyFileName='../Binaries/conf.ini';
  72.  
  73. //"Systemcontrol"
  74.  
  75. procedure TForm1.Button1Click(Sender: TObject);
  76. begin
  77.    ShellExecute(0,nil,PChar('cmd'),PChar('/c cd ../Binaries && start.bat'),nil,1);
  78.    Close;
  79. end;
  80.  
  81. procedure TForm1.Button2Click(Sender: TObject);
  82. begin
  83.    Notebook1.PageIndex := 1;
  84. end;
  85.  
  86. procedure TForm1.Button3Click(Sender: TObject);
  87. begin
  88.    ShellExecute(0,nil,PChar('cmd'),PChar('/c cd ../Binaries && start init.bat'),nil,1);
  89.    Button3.Enabled:=false
  90. end;
  91.  
  92. procedure TForm1.Button4Click(Sender: TObject);
  93. begin
  94.    Close();
  95. end;
  96.  
  97. procedure TForm1.Button5Click(Sender: TObject);
  98. var slMyFileStrings:TStringList;
  99. begin
  100.    case sLanguageLine of
  101.       'lang=deu':sLanguageLine:='lang=eng';
  102.       'lang=eng':sLanguageLine:='lang=deu';
  103.    end;
  104.  
  105.    slMyFileStrings:=TStringList.Create;
  106.    try
  107.       slMyFileStrings.LoadFromFile(cMyFileName);
  108.       If slMyFileStrings.Count>1 then
  109.       slMyFileStrings[1]:=sLanguageLine;
  110.       slMyFileStrings.SaveToFile(cMyFileName);
  111.    finally
  112.       slMyFileStrings.Free;
  113.    end;
  114.    confCheck();
  115. end;
  116.  
  117. procedure TForm1.Button6Click(Sender: TObject);
  118. var slMyFileStrings:TStringList;
  119. begin
  120.    case sVersionLine of
  121.       'vers=orig':sVersionLine:='vers=rem';
  122.       'vers=rem':sVersionLine:='vers=orig';
  123.    end;
  124.  
  125.    slMyFileStrings:=TStringList.Create;
  126.    try
  127.       slMyFileStrings.LoadFromFile(cMyFileName);
  128.       If slMyFileStrings.Count>1 then
  129.       slMyFileStrings[2]:=sVersionLine;
  130.       slMyFileStrings.SaveToFile(cMyFileName);
  131.    finally
  132.       slMyFileStrings.Free;
  133.    end;
  134.    confCheck();
  135. end;
  136.  
  137. procedure TForm1.Button7Click(Sender: TObject);
  138. var slMyFileStrings:TStringList;
  139. begin
  140.    case sEnhancementsLine of
  141.       'enhancements=0':sEnhancementsLine:='enhancements=1';
  142.       'enhancements=1':sEnhancementsLine:='enhancements=0';
  143.    end;
  144.  
  145.    slMyFileStrings:=TStringList.Create;
  146.    try
  147.       slMyFileStrings.LoadFromFile(cMyFileName);
  148.       If slMyFileStrings.Count>1 then
  149.       slMyFileStrings[3]:=sEnhancementsLine;
  150.       slMyFileStrings.SaveToFile(cMyFileName);
  151.    finally
  152.       slMyFileStrings.Free;
  153.    end;
  154.    confCheck();
  155. end;
  156.  
  157. procedure TForm1.Button8Click(Sender: TObject);
  158. var slMyFileStrings:TStringList;
  159. begin
  160.    case sModsLine of
  161.       'mods=0':sModsLine:='mods=1';
  162.       'mods=1':sModsLine:='mods=0';
  163.    end;
  164.  
  165.    slMyFileStrings:=TStringList.Create;
  166.    try
  167.       slMyFileStrings.LoadFromFile(cMyFileName);
  168.       If slMyFileStrings.Count>1 then
  169.       slMyFileStrings[4]:=sModsLine;
  170.       slMyFileStrings.SaveToFile(cMyFileName);
  171.    finally
  172.       slMyFileStrings.Free;
  173.    end;
  174.    confCheck();
  175. end;
  176.  
  177. procedure TForm1.Button9Click(Sender: TObject);
  178. begin
  179.    Notebook1.PageIndex := 0;
  180. end;
  181.  
  182.  
  183. //"Systemfiles"
  184.  
  185. //music
  186.  
  187. procedure TForm1.music();
  188. begin
  189.   PlaySound('../Binaries/theme.wav',0,SND_ASYNC or SND_LOOP);
  190. end;
  191.  
  192. //Loading Components
  193.  
  194. procedure TForm1.init();
  195. var
  196.    i: Integer;
  197. begin
  198.    For i:=0 to Form1.ComponentCount-1 do
  199.       If Components[i] is TButton then
  200.          begin
  201.             (Form1.Components[i] as TButton).Font.Name:='Arial';
  202.             (Form1.Components[i] as TButton).Font.Size:=12;
  203.          end;
  204.   Image1.Picture.LoadFromFile('../Binaries/logo.png');
  205.   Image2.Picture.LoadFromFile('../Binaries/logo.png');
  206. end;
  207.  
  208. //Fixing Objects
  209.  
  210. procedure TForm1.FormCreate(Sender: TObject);
  211. begin
  212.    img[1] := TImage.create(form1);
  213.    img[1].Picture.LoadFromFile('../Binaries/background.jpg');
  214.    img[2] := TImage.create(form1);
  215.    img[2].Picture.LoadFromFile('../Binaries/background.jpg');
  216.  
  217.    Sizer := TFormResizer.Create(self);
  218.    Sizer.EnforceMinSize := false;
  219.    Sizer.ResizeFonts := true;
  220.    Sizer.MinFontSize := 6;
  221.    Sizer.MaxFontSize := 30;
  222.    Sizer.InitializeForm;
  223.  
  224.    Width := round(Screen.Width/2.4);
  225.    Height := round(Screen.Height/2.4);
  226.  
  227.    Position := poScreenCenter;
  228. end;
  229.  
  230. procedure TForm1.FormResize(Sender: TObject);
  231. begin
  232.    Sizer.ResizeAll;
  233. end;
  234.  
  235. //Background-Image
  236.  
  237. procedure TForm1.PaintBoxPaint(Sender: TObject);
  238. var
  239.    pb : TPaintbox;
  240.    r : TRect;
  241. begin
  242.    pb := TPaintbox(sender);
  243.    r := rect(0,0,pb.width,pb.height);
  244.    pb.canvas.stretchdraw(r,img[pb.tag].Picture.Graphic);
  245. end;
  246.  
  247. procedure TForm1.FormClose(Sender: TObject);
  248. begin
  249.    img[1].free;
  250.    img[2].free;
  251. end;
  252.  
  253. //Configuration-Check
  254.  
  255. procedure TForm1.confCheck();
  256. var
  257.    MyFile:Text;
  258.    Line1,Line2,Line3,Line4,Line5:String;
  259. begin
  260.    AssignFile(MyFile,cMyFileName);
  261.    Reset(MyFile);
  262.    ReadLn(MyFile,Line1);
  263.    ReadLn(MyFile,Line2);
  264.    ReadLn(MyFile,Line3);
  265.    ReadLn(MyFile,Line4);
  266.    ReadLn(MyFile,Line5);
  267.    sLanguageLine:=Line2;
  268.    sVersionLine:=Line3;
  269.    sEnhancementsLine:=Line4;
  270.    sModsLine:=Line5;
  271.    CloseFile(MyFile);
  272.  
  273.    if Line1='init=1' then
  274.       Button3.Enabled:=false
  275.    else
  276.       Button3.Enabled:=true;
  277.  
  278.    if sLanguageLine ='lang=deu' then
  279.       begin
  280.          Button1.Caption:='Starten';
  281.          Button2.Caption:='Eintellungen';
  282.          Button3.Caption:='Initialisieren';
  283.          Button4.Caption:='Beenden';
  284.          Button5.Caption:='Sprache ändern';
  285.          Button9.Caption:='Zurück';
  286.             if Line3='vers=rem' then
  287.                if Line4='enhancements=0' then
  288.                   if Line5='mods=0' then
  289.                      begin
  290.                         Button6.Caption:='Original laden';
  291.                         Button7.Caption:='Enhancements aktivieren';
  292.                         Button8.Caption:='Mods aktivieren';
  293.                      end
  294.                   else
  295.                      begin
  296.                         Button6.Caption:='Original laden';
  297.                         Button7.Caption:='Enhancements aktivieren';
  298.                         Button8.Caption:='Mods deaktivieren';
  299.                      end
  300.                else
  301.                   if Line5='mods=0' then
  302.                      begin
  303.                         Button6.Caption:='Original laden';
  304.                         Button7.Caption:='Enhancements deaktivieren';
  305.                         Button8.Caption:='Mods aktivieren';
  306.                      end
  307.                   else
  308.                      begin
  309.                         Button6.Caption:='Original laden';
  310.                         Button7.Caption:='Enhancements deaktivieren';
  311.                         Button8.Caption:='Mods deaktivieren';
  312.                      end
  313.  
  314.             else
  315.                if Line4='enhancements=0' then
  316.                   if Line5='mods=0' then
  317.                      begin
  318.                         Button6.Caption:='Remastered laden';
  319.                         Button7.Caption:='Enhancements aktivieren';
  320.                         Button8.Caption:='Mods aktivieren';
  321.                      end
  322.                   else
  323.                      begin
  324.                         Button6.Caption:='Remastered laden';
  325.                         Button7.Caption:='Enhancements aktivieren';
  326.                         Button8.Caption:='Mods deaktivieren';
  327.                      end
  328.                else
  329.                   if Line5='mods=0' then
  330.                      begin
  331.                         Button6.Caption:='Remastered laden';
  332.                         Button7.Caption:='Enhancements dekativieren';
  333.                         Button8.Caption:='Mods aktivieren';
  334.                      end
  335.                   else
  336.                      begin
  337.                         Button6.Caption:='Remastered laden';
  338.                         Button7.Caption:='Enhancements deaktivieren';
  339.                         Button8.Caption:='Mods deaktivieren';
  340.                      end
  341.       end
  342.    else if sLanguageLine ='lang=eng' then
  343.       begin
  344.          Button1.Caption:='Start';
  345.          Button2.Caption:='Settings';
  346.          Button3.Caption:='Initialize';
  347.          Button4.Caption:='Close';
  348.          BUtton5.Caption:='Change Langauge';
  349.          Button9.Caption:='Back';
  350.             if Line3='vers=rem' then
  351.                if Line4='enhancements=0' then
  352.                   if Line5='mods=0' then
  353.                      begin
  354.                         Button6.Caption:='Load Original';
  355.                         Button7.Caption:='Activate Enhancements';
  356.                         Button8.Caption:='Activate Mods';
  357.                      end
  358.                   else
  359.                      begin
  360.                         Button6.Caption:='Load Original';
  361.                         Button7.Caption:='Activate Enhancements';
  362.                         Button8.Caption:='Deactivate Mods';
  363.                      end
  364.                else
  365.                   if Line5='mods=0' then
  366.                      begin
  367.                         Button6.Caption:='Load Original';
  368.                         Button7.Caption:='Deactivate Enhancements';
  369.                         Button8.Caption:='Activate Mods';
  370.                      end
  371.                   else
  372.                      begin
  373.                         Button6.Caption:='Load Original';
  374.                         Button7.Caption:='Deactivate Enhancements';
  375.                         Button8.Caption:='Deactivate Mods';
  376.                      end
  377.             else
  378.                if Line4='enhancements=0' then
  379.                   if Line5='mods=0' then
  380.                      begin
  381.                         Button6.Caption:='Load Remastered';
  382.                         Button7.Caption:='Activate Enhancements';
  383.                         Button8.Caption:='Activate Mods';
  384.                      end
  385.                   else
  386.                      begin
  387.                         Button6.Caption:='Load Remastered';
  388.                         Button7.Caption:='Activate Enhancements';
  389.                         Button8.Caption:='Deactivate Mods';
  390.                      end
  391.                else
  392.                   if Line5='mods=0' then
  393.                      begin
  394.                         Button6.Caption:='Load Remastered';
  395.                         Button7.Caption:='Deactivate Enhancements';
  396.                         Button8.Caption:='Activate Mods';
  397.                      end
  398.                   else
  399.                      begin
  400.                         Button6.Caption:='Load Remastered';
  401.                         Button7.Caption:='Deactivate Enhancements';
  402.                         Button8.Caption:='Deactivate Mods';
  403.                      end
  404.    end
  405. end;
  406.  
  407. end.
  408.  

To better understand what this tool does (or is supposed to do) - it's a little software-launcher that starts a batch-script which starts the actual game. I've been told that I can also implement that with Lazarus but with batches I'm able to modify them later if something changes (like a config-file of that game or something).

At the beginning, it reads a config for different buttons and sets the Caption of it and changes both the .ini and the Captions of my buttons during runtime. Everytime has only two differnt states.

Also the tool sets to about 46% of the screen size and fixes all the objects on it, so when I re-size the window all the objects change individual with it. Also there are two different notepad-pages which contain different objects.

I hope this descirbes it well enough :D

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Exception Class 'External: SIGSEGV' after importing a procedure
« Reply #14 on: April 14, 2021, 08:48:36 pm »
You didn't provide the compile-able source code. I can copy/paste your code to my Lazarus IDE, but it can't be compiled because you haven't provide all the required files.

If you don't know how to provide the compile-able source code, here is how to do it:

Create a new folder, copy and paste all the necessary files except: the binary (exe file), *.bak, lib and backup folders. Compress the folder and send the zip to the forum.


Please provide the source code that has issue, I'm more interested to know what caused the error.
« Last Edit: April 14, 2021, 08:55:47 pm by Handoko »

 

TinyPortal © 2005-2018