| Author |
Message |
|
ganzzz
|
Post subject: BagTrack Posted: Wed May 20, 2009 8:49 am |
|
Joined: Tue May 19, 2009 5:57 pm Posts: 4
|
|
Greetings!, here has found some errors:
1. At a game quit on escape the heap of memory the lost,
Engine.Free not working...
change:
function TG2Mdl_Tss.Quit(const P: G2Array; const Script: TG2Execute): TG2Variant;
begin
Result:=nil;
if G2ParamMaxError(0, P, Script) then Exit;
Engine.Running := False;// PostQuitMessage(0);
end;
and in main loop:
function CTssApp.MsgProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT;
begin
if Engine.Running = False then SendMessage(m_hWnd,WM_CLOSE,0,0);
...
end;
|
|
| Top |
|
 |
|
PimpDaddy
|
Post subject: Posted: Wed May 20, 2009 8:05 pm |
|
Joined: Mon May 04, 2009 8:46 am Posts: 28
|
Thanks for that, but what is Engine.Running? Is this a custom variable you have added, as I cannot find it in my version of the source.
EDIT: Never mind, I got it working 
|
|
| Top |
|
 |
|
ganzzz
|
Post subject: Posted: Wed May 20, 2009 10:00 pm |
|
Joined: Tue May 19, 2009 5:57 pm Posts: 4
|
|
This variable should be added, I have forgotten about it to write)
|
|
| Top |
|
 |
|
PimpDaddy
|
Post subject: Posted: Thu May 21, 2009 1:02 am |
|
Joined: Mon May 04, 2009 8:46 am Posts: 28
|
Yep, I added the variable and got it working, thanks for that
So does doing this prevent a memory leak or something?
|
|
| Top |
|
 |
|
ganzzz
|
Post subject: Posted: Thu May 21, 2009 5:03 am |
|
Joined: Tue May 19, 2009 5:57 pm Posts: 4
|
|
Then i write small stuff to save console command bufer to file:
destructor TTssConsole.Destroy;
var
FileName: string;
begin
...
FileName := ChangeFileExt(ParamStr(0),'.lst');
FOldCommands.SaveToFile(FileName);
FOldCommands.Free;
inherited;
end;
then file game.lst not exist!
interesting that at Alt+F4 all work corect...
|
|
| Top |
|
 |
|
PimpDaddy
|
Post subject: Posted: Fri May 22, 2009 2:43 am |
|
Joined: Mon May 04, 2009 8:46 am Posts: 28
|
|
I would assume it's because you are trying to change the currently running program to a .lst file.
|
|
| Top |
|
 |
|
ganzzz
|
Post subject: Posted: Fri May 22, 2009 5:57 am |
|
Joined: Tue May 19, 2009 5:57 pm Posts: 4
|
PimpDaddy wrote: I would assume it's because you are trying to change the currently running program to a .lst file.
HeHe))), no, a'm save console command bufer to file named like program(with full path), and extension .lst)))
example: ChangeFileExt(ParamStr(0),'.lst') return:
d:\prj\tss\tss_demo\game.lst
same as i use: ChangeFileExt(ParamStr(0),'.log') to get log file name.
pascal I know normally, that not say about Direct3D and English...(((
|
|
| Top |
|
 |
|
PimpDaddy
|
Post subject: Posted: Fri May 22, 2009 9:48 am |
|
Joined: Mon May 04, 2009 8:46 am Posts: 28
|
Oh ok, now I get it
That's interesting about the .lst file though, from using your code, it worked for me.
This is what I used:
Code: destructor TTssConsole.Destroy; var str : string; begin FTickCount.Free; FBuffer.Free; str := ChangeFileExt(ParamStr(0),'.lst'); FOldCommands.SaveToFile(str); FOldCommands.Free; FreeMem(FCommands); inherited; end;
It created an empty .lst file in the directory of the exe.
|
|
| Top |
|
 |