Page 3 of 8

Re: PureBasic 6.30 beta 1 is ready !

Posted: Wed Sep 03, 2025 3:42 pm
by PeDe
I have a tool that makes several HID Brymen BC-86X adapters available on the network. I removed my own HID and Libusb code and replaced it with the new PB HID library. On an old notebook with a Pentium M CPU and Linux LMDE6 32-bit, the tool has now been working flawlessly for several hours.

Peter

Re: PureBasic 6.30 beta 1 is ready !

Posted: Wed Sep 03, 2025 3:46 pm
by Fred
Nice !

Re: PureBasic 6.30 beta 1 is ready !

Posted: Wed Sep 03, 2025 7:33 pm
by skywalk
I completely forgot about Placeholder text.
Now I can drop so many tool tips and callbacks. :P

And import c libs is gonna be fun. Need idle's help. 8)

Re: PureBasic 6.30 beta 1 is ready !

Posted: Wed Sep 03, 2025 8:24 pm
by diceman
Thanks, great to see new updates to my favorite language. <3
Please, please, please don't forget about the "RotateSprite"-Bug, though. :)

viewtopic.php?t=87215

Re: PureBasic 6.30 beta 1 is ready !

Posted: Thu Sep 04, 2025 1:17 am
by Quin
Very nice update! Thanks, Fred and team!

Re: PureBasic 6.30 beta 1 is ready !

Posted: Thu Sep 04, 2025 5:12 am
by DeanH
Thank you for the update. I have tweaked the original PackerCallback code to work. Only had to change two lines.

Code: Select all

UseZipPacker()
;UseLZMAPacker()
;UseBriefLZPacker()

; ------------------------------------------------------------
;
;   PureBasic - Compressor example file
;
;    (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
; This procedure is a 'Callback'. This means there will be called
; automatically by the program at regular interval, so we could
; see the progress of the compression
; 
Procedure PackerProgress(SourcePosition, DestinationPosition)
	Shared FileLength 
	Result.f = (SourcePosition/FileLength)*100
	SetGadgetState(0, Round(Result,0))
	While (WindowEvent()) : Wend  ; Process all the window event befor quit
	ProcedureReturn 1
EndProcedure

If OpenWindow(0, 100, 200, 300, 40, "Packer - Progress Window")
	ProgressBarGadget(0, 10, 10, 280, 20, 0, 100)
	If ReadFile(0, OpenFileRequester("Choose a file to compress", "", "*.*", 0))
		FileLength = Lof(0)
		; Allocate the 2 memory buffers needed for compression..
		*Source = AllocateMemory(FileLength)
		*Target = AllocateMemory(FileLength+8)
		If FileLength And *Source And *Target
			ReadData(0, *Source, FileLength) ; Read the whole file in the memory buffer
			PackerCallback(@PackerProgress())
			; Compress our file, which is in memory (and use a timer to see the time spend by compression..)
			CompressedLength = CompressMemory(*Source, FileLength, *Target, FileLength)
			If CompressedLength
				DecompressedLength = UncompressMemory(*Target, CompressedLength, *Source, FileLength)
				If DecompressedLength = FileLength
					MessageRequester("Info", "De/Compression succeded:"+#LF$+#LF$+"Old size: "+Str(FileLength)+#LF$+"New size:"+Str(CompressedLength))
				EndIf      
			Else
				MessageRequester("Error", "Can't compress the file")
			EndIf 
		EndIf
		FreeMemory(*Source)
		FreeMemory(*Target)
		CloseFile(0)
	EndIf
EndIf

Re: PureBasic 6.30 beta 1 is ready !

Posted: Thu Sep 04, 2025 5:54 am
by jacdelad
Does PackerCallback work for unpacking too? Does it support all packing (and maybe unpacking) routines (memory, file...)?

Re: PureBasic 6.30 beta 1 is ready !

Posted: Thu Sep 04, 2025 6:49 am
by PeDe
DeanH wrote: Thu Sep 04, 2025 5:12 am Thank you for the update. I have tweaked the original PackerCallback code to work.
With PB x86, you need the Quad data type for the parameters of the callback procedure, otherwise you will get an error message:

Code: Select all

[ERROR] PackerCallback(): The Procedure specified in '@ProcedureName()' does not have the required argument or returntype.

Procedure PackerProgress(SourcePosition.q, DestinationPosition.q) -> OK for 32/64-bit
Peter

Re: PureBasic 6.30 beta 1 is ready !

Posted: Thu Sep 04, 2025 7:03 am
by DeanH
PeDe wrote: Thu Sep 04, 2025 6:49 am
DeanH wrote: Thu Sep 04, 2025 5:12 am Thank you for the update. I have tweaked the original PackerCallback code to work.
With PB x86, you need the Quad data type for the parameters of the callback procedure, otherwise you will get an error message:

Code: Select all

[ERROR] PackerCallback(): The Procedure specified in '@ProcedureName()' does not have the required argument or returntype.

Procedure PackerProgress(SourcePosition.q, DestinationPosition.q) -> OK for 32/64-bit
Peter
I just took the exact code in the original documentation with PB4.6, copied that into the 64-bit version of 6.30 beta 1 and changed the two lines. The revised doc should reflect what you have said.

It does not show a progressbar when unpacking. I tried it. The original doc says it only does when packing but not unpacking. That's what I found. It would be nice if it could. I am grateful for this new bit, though. As a test, I packed two files, each about 500Mb. Showed progress for each one separately.

Re: PureBasic 6.30 beta 1 is ready !

Posted: Thu Sep 04, 2025 9:43 am
by zikitrake
Thank you so much!
This is a never-ending process of improving and improving Purebasic.
Thank you very much for all your hard work over the years!

Re: PureBasic 6.30 beta 1 is ready !

Posted: Thu Sep 04, 2025 2:26 pm
by PeDe
DeanH wrote: Thu Sep 04, 2025 7:03 am I just took the exact code in the original documentation with PB4.6, copied that into the 64-bit version of 6.30 beta 1 and changed the two lines. The revised doc should reflect what you have said.
It's interesting that this function already existed in PB v4.61 or earlier. However, the second parameter ‘DestinationPosition’ now returns the total size of the uncompressed data.

Peter

Re: PureBasic 6.30 beta 1 is ready !

Posted: Fri Sep 05, 2025 4:00 pm
by User_Russian
The function HIDError() is not supported in Linux? The function return text not implemented yet instead of an error description.
Strange situation. Function ExamineHIDs(#USB_VID, #USB_PID) found the device and returns the number 1. But function OpenHID(#HID, #USB_VID, #USB_PID) cannot open the device and returns 0. Running on superuser (sudo in terminal) does not solve the problem.

In MacOS, similar problem. Function ExamineHIDs() found the device, but function OpenHID() cannot open the device and returns 0. HIDError() return text Device with requested VID/PID/(SerialNumber) not found

On Windows this code works great.

Re: PureBasic 6.30 beta 1 is ready !

Posted: Fri Sep 05, 2025 5:00 pm
by User_Russian
Test code.

Code: Select all

Debug OpenHID(0, #USB_VID, #USB_PID)

ExamineHIDs(#USB_VID, #USB_PID)
If NextHID()
  Debug OpenHIDPath(0, HIDInfo(#PB_HID_Path))
  Debug HIDInfo(#PB_HID_Path)
EndIf
In MacOS function OpenHID() returs 0, but the function OpenHIDPath() returns non-zero and successfully opens the device and successfully transfers data with it using ReceiveHIDFeatureReport(). Probably in function OpenHID() there is a bug.

In Linux functions OpenHID() and OpenHIDPath() returns 0.

Added.
If in Linux, run the application with superuser rights, then the function OpenHIDPath() opens the device. OpenHID() return 0.
This is probably a bug function OpenHID() in Linux and MacOS.

Re: PureBasic 6.30 beta 1 is ready !

Posted: Sat Sep 06, 2025 6:09 pm
by Clanzer
Same here, HID commands work great in Windows 10 but under not Ubuntu 20.0.4

Ubuntu can Enumerate the plugged in HID devices and display them but connection error when using OpenHid

Image

Re: PureBasic 6.30 beta 1 is ready !

Posted: Tue Sep 09, 2025 10:44 pm
by USCode
Thank you Fred and team for your continued diligence with PB! :mrgreen: