Godot PCK Encryption
- Godot PCK files are not encrypted by default!
- APK and AAB files are not encrypted!
Sample: https://badegg.io/OneBadEgg.pck
How to unpack:
- https://github.com/hhyyrylainen/GodotPckTool
- https://github.com/bruvzg/gdsdecomp
- Extract encryption key from godot binaries externally with a gui: https://github.com/pozm/gdke
How to encrypt:
- Official: https://docs.godotengine.org/en/4.2/contributing/development/compiling/compiling_with_script_encryption_key.html
- Simple Howto: https://forum.godotengine.org/t/easy-to-follow-tutorial-for-encrypting-your-pck-file/50349
- https://godot.community/topic/35/protecting-your-godot-project-from-decompilation
How to fix: Windows Search Not Working
Windows 10 “Type here to search” not working? Always loading? Never finding?
- Disable/enable network connection
- Kill/open explorer.exe
- Rebuild Search Index
Propriety vs Proprietary
- Propriety: Behavior or actions that are socially acceptable, proper, or in line with established norms or standards.
For example, “She always behaves with propriety in formal settings.” - Proprietary: Commonly used in the context of ownership or rights to something, especially intellectual property. It refers to something that is privately owned or exclusive to a particular entity.
For example, “The company has a proprietary software solution that they developed in-house.”
Delphi: Excel Row and Column Count
How to get correct row and column numbers of any Excel file (XLS or XLSX):
var
Excel, Book, Sheet: OleVariant;
RowNumber: integer;
ColNumber: integer;
const
xlCellTypeLastCell = $0000000B; // ExcelXP
begin
...
Book := Excel.Workbooks.Open(ExcelFilename,
False, // ConfirmConversions
True ); // ReadOnly
Sheet := Book.Worksheets[1];
//RowNumber := Sheet.UsedRange.EntireRow.Count; // May be wrong!
//ColNumber := Sheet.UsedRange.EntireColumn.Count; // May be wrong!
RowNumber := Sheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row;
ColNumber := Sheet.UsedRange.SpecialCells(xlCellTypeLastCell).Column;
end;
Read more: https://stackoverflow.com/questions/11886284/usedrange-count-counting-wrong
Example software:
XLS to CSV Converter
CSV to VCF Converter
Delphi: TCamera Tips
How to get live cam without crash
- Use synchronized thread
- FMX app with Windows, Android, IOS support.
procedure TForm1.CameraSampleBufferReady(Sender: TObject; const ATime: TMediaTime);
begin
TThread.Synchronize(TThread.CurrentThread, GetImage);
end;
procedure TForm1.GetImage;
begin
Camera.SampleBufferToBitmap(Image1.Bitmap,True);
end;
Delphi: Pos Functions
Pos function (case-sensitive)
- The
Pos
function returns the position of a substring within a string. If the substring is found,Pos
returns the 1-based index of the first occurrence of the substring; otherwise, it returns 0. PosEx
is equivalent toSystem.Pos
.- You should ideally use
AnsiPos
instead ofPos
since the former supports wide character sets!
var
MainStr, SubStr: string;
Position: Integer;
begin
MainStr := 'Hello World';
SubStr := 'World';
Position := Pos(SubStr, MainStr);
if Position > 0 then
ShowMessage('Substring found at position: ' + IntToStr(Position))
else
ShowMessage('Substring not found');
end;
AnsiPos function (case-sensitive)
var
MainStr, SubStr: string;
Position: Integer;
begin
MainStr := 'Hello World';
SubStr := 'World';
Position := AnsiPos(SubStr, MainStr);
if Position > 0 then
ShowMessage('Substring found at position: ' + IntToStr(Position))
else
ShowMessage('Substring not found');
end;
StrPos function (case-sensitive)
var
MainStr, SubStr: string;
Position: Integer;
begin
MainStr := 'Hello World';
SubStr := 'World';
if StrPos(PChar(MainStr), PChar(SubStr)) <> nil then
ShowMessage('Substring found')
else
ShowMessage('Substring not found');
end;
AnsiStrPos function (case-sensitive)
Unlike the StrPos
function, AnsiStrPos
works with multi-byte characters sets (MBCS).
var
MainStr, SubStr: string;
Position: Integer;
begin
MainStr := 'Hello World';
SubStr := 'World';
if AnsiStrPos(PChar(MainStr), PChar(SubStr)) <> nil then
ShowMessage('Substring found')
else
ShowMessage('Substring not found');
end;
TextPos function (case-insensitive)
var
MainStr, SubStr: string;
Position: Integer;
begin
MainStr := 'Hello World';
SubStr := 'World';
if TextPos(PChar(MainStr), PChar(SubStr)) <> nil then
ShowMessage('Substring found')
else
ShowMessage('Substring not found');
end;
Other Useful Functions
.Contains | Case-Sensitive |
.StartsWith | Case-Sensitive |
.EndsWith | Case-Sensitive |
AnsiContainsStr | Case-Sensitive |
AnsiStartsStr | Case-Sensitive |
AnsiEndsStr | Case-Sensitive |
AnsiContainsText | Case-Insensitive |
AnsiStrings.ContainsText | Case-Insensitive |
StrUtils.ContainsText | Case-Insensitive |
Delphi: Run DOS Commands
ShellExecute
Results can’t be read easily!
https://engineertips.wordpress.com/2021/02/22/delphi-shellexecute-alternatives/
TDOSCommand Component
https://github.com/TurboPack/DOSCommand
Results can be read by using OnNewLine event!
https://engineertips.wordpress.com/2022/04/21/delphi-tdoscommand-eassertionfailed-error/
GetDosOutput Procedure
Results can be read by using a Memo or RichEdit!
procedure GetDosOutput(CommandLine, WorkDir: string; aMemo: TMemo);
var
SA: TSecurityAttributes;
SI: TStartupInfo;
PI: TProcessInformation;
StdOutPipeRead, StdOutPipeWrite: THandle;
WasOK: Boolean;
Buffer: array[0..255] of AnsiChar;
BytesRead: Cardinal;
Handle: Boolean;
begin
//AMemo.Lines.Add('Commencing processing...');
with SA do begin
nLength := SizeOf(SA);
bInheritHandle := True;
lpSecurityDescriptor := nil;
end;
CreatePipe(StdOutPipeRead, StdOutPipeWrite, @SA, 0);
try
with SI do
begin
FillChar(SI, SizeOf(SI), 0);
cb := SizeOf(SI);
dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
wShowWindow := SW_HIDE;
hStdInput := GetStdHandle(STD_INPUT_HANDLE); // don't redirect stdin
hStdOutput := StdOutPipeWrite;
hStdError := StdOutPipeWrite;
end;
Handle := CreateProcess(nil, PChar('cmd.exe /C ' + CommandLine),
nil, nil, True, 0, nil,
PChar(WorkDir), SI, PI);
CloseHandle(StdOutPipeWrite);
if Handle then
try
repeat
WasOK := ReadFile(StdOutPipeRead, Buffer, 255, BytesRead, nil);
if BytesRead > 0 then
begin
Buffer[BytesRead] := #0;
AMemo.Text := AMemo.Text + String(Buffer);
end;
until not WasOK or (BytesRead = 0);
WaitForSingleObject(PI.hProcess, INFINITE);
finally
CloseHandle(PI.hThread);
CloseHandle(PI.hProcess);
end;
finally
CloseHandle(StdOutPipeRead);
//AMemo.Lines.Add('Processing completed successfully.');
//AMemo.Lines.Add('**********************************');
//AMemo.Lines.Add('');
end;
end;
How to Fix HTTP 426 Error
HTTP 426 Upgrade Required
Solution 1
If you are using HTTP/1.0, use HTTP/1.1
Example: Delphi ICS component
SslHttpCli1.RequestVer := '1.1';
Solution 2
If you are using SSL3, use TLS
Delphi: TStringGrid Tips
Fix “horizontal scroll requires releasing mouse button”
StringGrid1.Options := StringGrid1.Options + [goThumbTracking];
Go to top and select first cell
StringGrid1.Selection := TGridRect(Rect(1, 1, 1, 1));
StringGrid1.TopRow := 1;
StringGrid1.LeftCol := 1;
Example Software: Container Loading Calculator