Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the buffer limit to depend on image size #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Archomeda
Copy link

Allocating 8KB is enough for 32x32 cursors, most of the time only 4KB will used anyway. However, when using larger cursors, 8KB isn't enough to make sure that the hash is unique. Only the first 8KB is hashed, and sometimes these pixels are the same for different cursors and YoloMouse will see them as the same.

As an example, recently Guild Wars 2 has been updated to support DPI scaling. Higher DPI settings will make use of larger cursors that are different from the normal ones, and they scale from 32x32 to 128x128. Starting from 96x96 there are a few cursors that only have transparent pixels in the first 8KB.

This PR changes the fixed 8KB to a dynamic number. It tries to determine the used bytes by multiplying the image width in bytes with the image height.

@PandaTeemo
Copy link
Owner

PandaTeemo commented Oct 20, 2017 via email

@Archomeda
Copy link
Author

I thought as much, judging by how long YoloMouse has existed already. Personally I haven't noticed any performance loss when I was running a debug build, but of course that's just me. I don't really know how many times the hashing method is called, but looking at the method, it's not an expensive method at all thankfully. If performance is really going to be a problem for some people, I suppose a smarter system can be made that gets the hotspots and starts hashing from there and/or around it.

@PandaTeemo
Copy link
Owner

PandaTeemo commented Oct 20, 2017 via email

@Archomeda
Copy link
Author

Ah yes, that will happen with all cursors that are larger than 32x32. The easiest solution would be to include a version number in the .ini files, or somehow include a version number in each hash or each assignment line. That way you'll know which algorithm to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants