Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
Other / Re: Question for people who have built commercial apps
« Last post by BrassGear on Today at 11:12:50 am »
Personally I like to own something if I have to pay for it. I avoid anything with a subscription model for that reason, and another reason is the inflated cost compounded over years.
I think there are a lot of people that feel this way, but the software industry is trying very hard to move to subscriptions, for obvious financial reasons. In my opinion, it is better to support a model that favours reliability and longevity.
2
FPC development / how to see what command string is passed to AS?
« Last post by Key-Real on Today at 11:12:48 am »
i need to see what command string is passed to AS.

is there a switch not to delete the script files

-a only does not delete the .s file
3
FPC development / Re: Warning: Source OS Redefined!
« Last post by Key-Real on Today at 11:07:49 am »
Code: Pascal  [Select][+][-]
  1. unit i_ps1;
  2.  
  3. {$i fpcdefs.inc}
  4.  
  5.   interface
  6.  
  7.     uses
  8.        systems;
  9.  
  10.     const
  11.  
  12.        system_mipsel_ps1_info : tsysteminfo =
  13.           (
  14.             system       : system_mipsel_ps1;
  15.             name         : 'PlayStation 1 for MIPSEL';
  16.             shortname    : 'ps1';
  17.             flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
  18.                             tf_requires_proper_alignment,tf_library_needs_pic,
  19.                             tf_pic_uses_got,tf_safecall_exceptions,
  20.                             tf_smartlink_sections,tf_has_winlike_resources,tf_supports_hidden_symbols];
  21.             cpu          : cpu_mipsel;
  22.             unit_env     : 'LINUXUNITS';
  23.             extradefines : 'UNIX;HASUNIX';
  24.             exeext       : '';
  25.             defext       : '.def';
  26.             scriptext    : '.sh';
  27.             smartext     : '.sl';
  28.             unitext      : '.ppu';
  29.             unitlibext   : '.ppl';
  30.             asmext       : '.s';
  31.             objext       : '.o';
  32.             resext       : '.res';
  33.             resobjext    : '.or';
  34.             sharedlibext : '.so';
  35.             staticlibext : '.a';
  36.             staticlibprefix : 'libp';
  37.             sharedlibprefix : 'lib';
  38.             sharedClibext : '.so';
  39.             staticClibext : '.a';
  40.             staticClibprefix : 'lib';
  41.             sharedClibprefix : 'lib';
  42.             importlibprefix : 'libimp';
  43.             importlibext : '.a';
  44. //            p_ext_support : false;
  45.             Cprefix      : '';
  46.             newline      : #10;
  47.             dirsep       : '/';
  48.             assem        : as_none;
  49.             assemextern  : as_gas;
  50.             link         : ld_none;
  51.             linkextern   : ld_ps1;
  52.             ar           : ar_gnu_ar;
  53.             res          : res_elf;
  54.             dbg          : dbg_dwarf3;
  55.             script       : script_unix;
  56.             endian       : endian_little;
  57.             alignment    :
  58.               (
  59.                 procalign       : 4;
  60.                 loopalign       : 4;
  61.                 jumpalign       : 0;
  62.                 jumpalignskipmax    : 0;
  63.                 coalescealign   : 0;
  64.                 coalescealignskipmax: 0;
  65.                 constalignmin   : 0;
  66.                 constalignmax   : 8;
  67.                 varalignmin     : 0;
  68.                 varalignmax     : 8;
  69.                 localalignmin   : 4;
  70.                 localalignmax   : 8;
  71.                 recordalignmin  : 0;
  72.                 recordalignmax  : 8;
  73.                 maxCrecordalign : 8
  74.               );
  75.             first_parm_offset : 0;
  76.             stacksize    : 32*1024*1024;
  77.             stackalign   : 8;
  78.             abi : abi_default;
  79.             llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64';
  80.           );
  81.  
  82.   implementation
  83.  
  84. initialization
  85.  
  86.     set_source_info(system_mipsel_ps1_info);
  87.  
  88. end.
  89.  


it's not finished jet, but could You pls take a look?
4
I was originally working on a messaging platform, using fpc+laz to make the client, but then I had this idea for a networked game, and built it on top of the messaging platform.
Today I launched an early release. This time, leading up to the early release, it was a real crunch. It has been difficult, but I am super grateful for freepascal, lazarus, blender, and all the other software that gave me this chance to release something commercially.

Has anyone else experience with something like this? Any advice would be appreciated.
I have at times doubted the decision to not use a game engine. But then I think of my messaging queue made out of records and arrays. How could any generalist game engine compete with that kind of simplicity and efficiency? The simple answer is they can't really.

Today I am working on the windows version. The game is on itch.io if you want to check it out. I would love to hear any thoughts you may have.
5
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by KodeZwerg on Today at 10:53:20 am »
I did a 1:1 copy of @KodeZwerg's test case.
I am not aware about how you implemented MessageBox() so I added that and GetLastError and two constants to have a minimal feedback.
Now after each operation you get a messagebox saying success or failed.
Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. type
  6.   LPCSTR = PAnsiChar;
  7.   DWORD = Cardinal;
  8.   LongWord = Cardinal;
  9.   ULONG_PTR = UIntPtr;
  10.   LongBool = False..Boolean(4294967295);
  11.   BOOL = LongBool;
  12.   UINT = LongWord;
  13.   HWND = UIntPtr;
  14.   THandle = UIntPtr;
  15.   POverlapped = ^TOverlapped;
  16.   _OVERLAPPED = record
  17.     Internal: ULONG_PTR;
  18.     InternalHigh: ULONG_PTR;
  19.     Offset: DWORD;
  20.     OffsetHigh: DWORD;
  21.     hEvent: THandle;
  22.   end;
  23.   TOverlapped = _OVERLAPPED;
  24.   PSecurityAttributes = ^TSecurityAttributes;
  25.   _SECURITY_ATTRIBUTES = record
  26.     nLength: DWORD;
  27.     lpSecurityDescriptor: Pointer;
  28.     bInheritHandle: BOOL;
  29.   end;
  30.   TSecurityAttributes = _SECURITY_ATTRIBUTES;
  31.  
  32. const
  33.   GENERIC_WRITE = $40000000;
  34.   FILE_SHARE_READ = $00000001;
  35.   FILE_SHARE_WRITE = $00000002;
  36.   CREATE_NEW = 1;
  37.   OPEN_EXISTING = 3;
  38.   FILE_END = 2;
  39.   FILE_ATTRIBUTE_NORMAL = $00000080;
  40.   INVALID_HANDLE_VALUE = THandle(-1);
  41.   INVALID_SET_FILE_POINTER = DWORD(-1);
  42.   NO_ERROR = 0;
  43.  
  44. function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD; var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; stdcall; external 'kernel32.dll' name 'WriteFile';
  45. function CreateFileA(lpFileName: LPCSTR; dwDesiredAccess, dwShareMode: DWORD; lpSecurityAttributes: PSecurityAttributes; dwCreationDisposition, dwFlagsAndAttributes: DWORD; hTemplateFile: THandle): THandle; stdcall; external 'kernel32.dll' name 'CreateFileA';
  46. function SetFilePointer(hFile: THandle; lDistanceToMove: Longint; lpDistanceToMoveHigh: Pointer; dwMoveMethod: DWORD): DWORD; stdcall; external 'kernel32.dll' name 'SetFilePointer';
  47. function CloseHandle(hObject: THandle): BOOL; stdcall; external 'kernel32.dll' name 'CloseHandle';
  48. function MessageBoxA(hWnd: HWND; lpText, lpCaption: LPCSTR; uType: UINT): Integer; stdcall; external 'user32.dll' name 'MessageBoxA';
  49. function GetLastError: DWORD; stdcall; external 'kernel32.dll' name 'GetLastError';
  50.  
  51. procedure PutDataToFile(const AFileName: string; AData: PAnsiChar);
  52. var
  53.   hFile: THandle;
  54.   cnt: Cardinal;
  55.   DataSize: Integer;
  56.   dummy: DWORD;
  57.   error: DWORD;
  58. begin
  59.   DataSize := StrLen(AData);
  60.   hFile := CreateFileA(PAnsiChar(AFileName), GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, nil,
  61.              OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
  62.   if (hFile = INVALID_HANDLE_VALUE) then
  63.     hFile := CreateFileA(PAnsiChar(AFileName), GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, nil,
  64.                CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
  65.   if (hFile <> INVALID_HANDLE_VALUE) then
  66.     begin
  67.       dummy := MessageBoxA(0, PAnsiChar('CreateFileA() success!'), PAnsiChar('Information'), 0);
  68.       dummy := SetFilePointer(hFile, 0, nil, FILE_END);
  69.       error := GetLastError;
  70.       if ((dummy <> INVALID_SET_FILE_POINTER) and (error = NO_ERROR)) then
  71.         begin
  72.           dummy := MessageBoxA(0, PAnsiChar('SetFilePointer() success!'), PAnsiChar('Information'), 0);
  73.           if WriteFile(hFile, AData^, DataSize, cnt, nil) then
  74.             dummy := MessageBoxA(0, PAnsiChar('WriteFile() success!'), PAnsiChar('Information'), 0)
  75.           else
  76.             dummy := MessageBoxA(0, PAnsiChar('WriteFile() failed.'), PAnsiChar('Information'), 0)
  77.         end
  78.       else
  79.         dummy := MessageBoxA(0, PAnsiChar('SetFilePointer() failed.'), PAnsiChar('Information'), 0);
  80.       if CloseHandle(hFile) then
  81.         dummy := MessageBoxA(0, PAnsiChar('CloseHandle() success!'), PAnsiChar('Information'), 0)
  82.       else
  83.         dummy := MessageBoxA(0, PAnsiChar('CloseHandle() failed.'), PAnsiChar('Information'), 0);
  84.     end
  85.   else
  86.     dummy := MessageBoxA(0, PAnsiChar('CreateFileA() failed.'), PAnsiChar('Information'), 0);
  87. end;
  88.  
  89. begin
  90.   PutDataToFile('test.txt', 'Test file created');
  91.   ReadLn;
  92. end.
You can extend this code with more constants as the MSDN sites showing, right now I just encapsulated SetFilePointer as an example how-to work with the feedback correct and how GetLastError is involved.

Tested successful with Lazarus 3.99 (rev main_3_99-1801-gca71aeb4e4) FPC 3.2.2 x86_64-win64-win32/win64
(all original unmodified files including RTL)
6
General / Re: Assign (textfile) not compiling - sometimes.
« Last post by Thaddy on Today at 10:51:18 am »
Or use AssignFile and CloseFile procedures from the SysUtils.
Those two do not belong there. They are simple aliases to system.assign() and system.close().
Should never have been introduced unless Delphi has them.

Hiding them from being documented in a wood of ifdefs is actually a good idea.... O:-)  Brilliant!
7
FPC development / Re: Warning: Source OS Redefined!
« Last post by Laksen on Today at 10:41:10 am »
The warning is generated in set_source_info

set_source_info is called from systems/i*.pas to indicate what the cpu+os compiler was built FROM. It should only be called once
For example in i_linux.pas

Code: Pascal  [Select][+][-]
  1. {$ifdef CPUI386}
  2.   {$ifdef linux}
  3.     { some FreeBSD versions define linux as well }
  4.     {$ifndef FreeBSD}
  5.       set_source_info(system_i386_linux_info);
  6.     {$endif FreeBSD}
  7.   {$endif}
  8. {$endif CPUI386}
  9. ...
  10. {$ifdef CPUX86_64}
  11.   {$ifdef linux}
  12.     set_source_info(system_x86_64_linux_info);
  13.   {$endif linux}
  14. {$endif CPUX86_64}
  15. ...
  16.  

linux might be defined, but only one of CPUI386 and CPUX86_64 should be defined. Since you can't build a compiler that runs on both (well it can but it will be built for one ISA or the other)
8
FPC development / Re: Warning: Source OS Redefined!
« Last post by Key-Real on Today at 10:34:21 am »
can you provide more info? pls


I'm porting it to a new target
9
FPC development / Re: Warning: Source OS Redefined!
« Last post by Laksen on Today at 10:28:26 am »
It would indicate that you have a compiler bug, or some messed up compiler defines while rebuilding the compiler. How did you build the compiler?
10
General / Re: Text orientation in TMemo?
« Last post by wp on Today at 10:27:54 am »
you might also notice, that Label2 changes its caption when clicking/dragging on places which are too far from the axises.
Well, a reaction on such clicks is expected when you click on one of the grid lines associated with an axis. You can hide the axis grid, and the click will no longer be assigned to this axis. But I see that it is not always an option to turn off the axis grid, and therefore I just committed a change to the chart axis in which a new property EnabledHitTests (of type TChartHitTests = set of (ahtTitle, ahtLine, ahtLabels, ahtGrid, ahtAxisStart, ahtAxisCenter, ahtAxisEnd) ) is available. When you here remove an element, a click on the corresponding part of the axis will no longer be registered as an axis-click.

In your code:
Code: Pascal  [Select][+][-]
  1. // Note: TAChart from Laz/main 02d8ea0bde or newer required!)
  2.   Chart1.BottomAxis.EnabledHitTests := Chart1.BottomAxis.EnabledHitTests - [ahtGrid];
  3.   Chart1.LeftAxis.EnabledHitTests := Chart1.LeftAxis.EnabledHitTests - [ahtGrid];  
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018