Search found 19 matches

by r-i-v-e-r
Fri Sep 06, 2024 6:34 pm
Forum: Coding Questions
Topic: Divide and Modulo with one operation?
Replies: 11
Views: 2288

Re: Divide and Modulo with one operation?


Edit: I just found out that the accuracy of the calculation is highly dependent of the divisor. So I guess one has to find a better way here.


This topic has some insights on superfast integer division tricks, if that's something really dominating the hot path.

If you're interested in speeding ...
by r-i-v-e-r
Tue Jul 23, 2024 5:25 pm
Forum: Coding Questions
Topic: Windows built-in antivirus
Replies: 7
Views: 1375

Re: Windows built-in antivirus

Windows Defender's been quite a nuisance today for apps it was completely fine with before, so definitely a bad definition update made it out...

I'm submitting my executables to MS, and I urge everyone else to do the same using the link @Fred's posted ↑4.
by r-i-v-e-r
Mon Jun 24, 2024 10:59 am
Forum: Feature Requests and Wishlists
Topic: #PB_Compiler constants for Endianness
Replies: 3
Views: 1992

Re: #PB_Compiler constants for Endianness

Big endian AArch64 is rare: iOS, Android, Windows, macOS, and most Linux distros run in LE mode on AArch64 hardware. AFAIK, BE is primarily useful for maximising performance of networking code (albeit this is serious min-maxing), but is otherwise mostly a hassle.

Given there's no big endian ...
by r-i-v-e-r
Sun Jun 16, 2024 1:50 am
Forum: Coding Questions
Topic: module question
Replies: 6
Views: 1494

Re: module question


Thanks, so I'm doing something wrong.


Is the module you're trying to invoke a method from declared prior to the caller module? E.g., in @jassing's example, mod2 may access mod1, but not the other way around due to how they're declared.

If both modules happen to be interdependent (which IMO is ...
by r-i-v-e-r
Sun Jun 09, 2024 3:50 am
Forum: Coding Questions
Topic: Bunch of gamedev bugs which are annoying + very awaited functions
Replies: 5
Views: 1641

Re: Bunch of gamedev bugs which are annoying + very awaited functions



Why the sprites are loaded in bitmap ? Is there a way to make it much more compact ?

As far as I know, all compression formats are designed for compact storage on a hard drive. A raster image is always required to display an image on the screen.


Most GPUs nowadays do support several types ...
by r-i-v-e-r
Sun Jun 02, 2024 8:07 pm
Forum: Coding Questions
Topic: C vs ASM math. (again)
Replies: 6
Views: 2259

Re: C vs ASM math. (again)



Where is the disagreement in terms of math operations?

You're computing modulo 32 of a random memory address, so you can't really expect agreement even when using the same BE.

This isn't a typical thing you'd expect guarantees from the language for (unlike, e.g., that distinct variables have ...
by r-i-v-e-r
Sun Jun 02, 2024 7:54 pm
Forum: Coding Questions
Topic: C vs ASM math. (again)
Replies: 6
Views: 2259

Re: C vs ASM math. (again)

Where is the disagreement in terms of math operations?

You're computing modulo 32 of a random memory address, so you can't really expect agreement even when using the same BE.

This isn't a typical thing you'd expect codified in language guarantees (unlike, e.g., that distinct variables have ...
by r-i-v-e-r
Sun Jun 02, 2024 5:53 pm
Forum: Feature Requests and Wishlists
Topic: SwiftMessage function the horizon?
Replies: 4
Views: 1550

Re: SwiftMessage function the horizon?


Did you encounter any methods you can't call ?

From what I understand both Swift and Objective-C use objc_msgSend which is also what CocoaMessage does.


This isn't strictly accurate.

Swift code can interop with Obj-C APIs relatively simply (using objc_* / sel_* / class_* functions under-the ...
by r-i-v-e-r
Sun May 26, 2024 12:50 am
Forum: Windows
Topic: [NO BUG]6.10 Name Space problem
Replies: 3
Views: 2397

Re: 6.10 Name Space problem

This is by (Microsoft's) design, not necessarily a PB Windows bug.

From the CreateMutexW documentation on MSDN:


If lpName matches the name of an existing event, semaphore, waitable timer, job, or file-mapping object, the function fails and the GetLastError function returns ERROR_INVALID_HANDLE ...
by r-i-v-e-r
Sun May 19, 2024 4:54 am
Forum: Off Topic
Topic: Chat GPT 4o Code
Replies: 34
Views: 15732

Re: Chat GPT 4o Code


What if the user already had an "Untitled - Notepad" window open? Then you'll likely reposition that while opening a new blank window as well.

If you read ChatGPT's code, you'll see that it uses the newly-opened Notepad handle, thus ensuring no existing Notepad window would be affected.

I'm ...
by r-i-v-e-r
Sun May 19, 2024 12:47 am
Forum: Off Topic
Topic: Chat GPT 4o Code
Replies: 34
Views: 15732

Re: Chat GPT 4o Code


Works great until you realise it fails if the client isn't using English Windows

That's not an issue, because it's no different to asking here how to do it and someone replying with an English answer (which happens all the time).

There's a profound difference between receiving help on a ...
by r-i-v-e-r
Sat May 18, 2024 3:30 am
Forum: Off Topic
Topic: Chat GPT 4o Code
Replies: 34
Views: 15732

Re: Chat GPT 4o Code

It's serviceable, but there are still several problems that have to be fixed manually.



Repeat
Event = WindowEvent()
ExamineKeyboard()
; Handle input
; ... (snip)
UpdateGame()
RenderGame()

FlipBuffers()
Delay(1000 / #FPS)

Until Event = #PB_Event_CloseWindow
End



The event loop is ...
by r-i-v-e-r
Thu May 16, 2024 11:41 pm
Forum: Mac OSX
Topic: Cocoa - how to block popup menu for WebGadget
Replies: 2
Views: 3156

Re: Cocoa - how to block popup menu for WebGadget

It'd probably be easiest to handle the contextmenu event on the JS side instead, that way you avoid having to write more platform-specific code. It'd also be easier to get information on the DOM node target this way.

Still, if you want to go the Cocoa route, you can respond to the WebUIDelegate 's ...
by r-i-v-e-r
Thu May 16, 2024 8:36 pm
Forum: Coding Questions
Topic: Resize and resave images
Replies: 7
Views: 1107

Re: Resize and resave images



If Not SaveImage(#Image1, file$ + ".png", #PB_ImagePlugin_PNG)



You've attempted to save with the PNG encoder ( #PB_ImagePlugin_PNG ), however you've only used the decoder:



UseJPEGImageDecoder()
UsePNGImageDecoder()



If you add a UsePNGImageEncoder() call, it should function just ...
by r-i-v-e-r
Thu May 16, 2024 6:33 pm
Forum: Bugs - Windows
Topic: GetGadgetItemText does not read changed text from WebGadget
Replies: 4
Views: 1647

Re: GetGadgetItemText does not read changed text from WebGadget


Not a bug,
Nothing changes in the loaded HTML code. It is an edit field. To get to the entered data it is better to use the WebViewGadget and JScript.

Only the document view changes


It's like an edit field, but a user mutating contenteditable elements does necessarily change the HTML.

The ...