HearthSim / Hearthstone-Deck-Tracker

A deck tracker and deck manager for Hearthstone on Windows
https://hsreplay.net/downloads/
4.76k stars 1.12k forks source link

Overlay not the same size as Hearthstone #4

Closed azeier closed 10 years ago

azeier commented 10 years ago

This seems to be an issue with notebooks for some reason. Also something I couldn't manage to reproduce. Apparently the overlay is bigger that the actual hearthstone window, causing the playerdeck to be displayed out of place (or not at all).

Also setting the custom width/height values to hearthstones resolution does not "fix" the problem but setting them to about 80% of that does.

For reference: http://www.reddit.com/r/hearthstone/comments/26seey/automatic_deck_tracker_and_more_with_ingame/chv32lx

michaelb7k commented 10 years ago

I've got a glitch where the card ages of the opponents cards doesn't line up - this seems to be a similar problem. Also, the horizontal position of the player's deck is set to 80% to get it to show on screen.

This glitch occurs with the latest version of the program, 0.3.11 and earlier versions.

Desktop resolution (Win7x64) is set to 1920_1200 Hearthstone resolution (windowed) is set to 1920_1080

Curiously, the resolution of the window that Hearthstone has set is not as above but rather ~1845*1080.

Adjusting the CustomWidth and CustomHeight values in the config does alter where overlay sits but not by much - I'm unable to get the overlay to matchup.

azeier commented 10 years ago

You can also set VisibleOverlay to true, that will make the overlay have a blue tint instead of being transparent and move it with OffsetX and OffsetY. You should be able to make it line up with hearthstone using those.

I still don't have the slightest clue why this happens :/. Or how to get the "correct" resolution, for that matter.

azeier commented 10 years ago

Could you clear the custom values in the config (or just rename your config for the time being) and try if replacing your exe with this one fixes it?

michaelb7k commented 10 years ago

Running with that unfortunately didn't fix the problem. Config was renamed, no config settings altered running new exe, restarted Hearthstone aswell to no luck.

azeier commented 10 years ago

Well it was worth a try. Then I'm all out of ideas again.

michaelb7k commented 10 years ago

It looks like the tracker is just making the overlay bigger than it should be.

Desktop resolution (Win7x64) is set to 1920_1200 Hearthstone resolution (windowed) is set to 1920_1080

The dimensions of the window that Hearthstone has set is not as above resolution but rather ~1845*1080px.

But setting:-

0 0 1460 860

Will give correctish results.

When setting the tracker to auto-detecting size (custom values of -1) the overlay is also bigger than window.

Also, occasionally when alt-tabbing into Hearthstone card ages are shifting position upon x-axis by some smallish amount (other overlays are fine and are staying put when this occurs).

azeier commented 10 years ago

This is what's used to get the window size. And that seems to be for some reason incorrect in some cases. All reports I got on this were laptop users, is that the case with you as well? Not sure what that means but it sure means something.

Does the cardage shifting happen after the opponent hand changed (play/draw)? That happens because the labels are on a parabola that shifts to the left/right depending on the handcount, to match the card locations. So the same thing should happen without alt-tabbing.

michaelb7k commented 10 years ago

Using a desktop computer with a widescreen 24inch monitor (1920*1200).

No action has been taken when the card ages have shifted.

Some further resolution testings: 1920_1080 resolution 1460_860 overlay

1650_1080 1320_860

1600_900 1280_720

Is the result of the call to User32.GetWindowRect logged at all? The rest of the overlay sizes and variables?

azeier commented 10 years ago

So I guess the shifting is then somehow related to the resolution problems.

No logging of that currently. Before I add that, your hearthstone window actually the resolution it says it is? (screenshot -> paint, draw selection)

michaelb7k commented 10 years ago

They are with the exception of the 1920_1080 resolution which is 1845_1080.

It seems like the overlay is out by 0.2 almost exactly in all cases - not sure if that's a hint to anything.

azeier commented 10 years ago

So that's probably all the logging will tell us anyway then. I mean.. I could just add an option to scale the overlay down by 20% if that's consistent (which is the problem, since I haven't heard too many reports about it and I can't reproduce it either)... is the offset 0,0 in all cases?

michaelb7k commented 10 years ago

Each resolution has a different offset - they're not all offset by the same.

If it's just a few people experiencing this then perhaps there are other priorites to get to - no need to worry too much I guess.

azeier commented 10 years ago

Is the offset at least consistent with the 20%?

Yeah, if I could think of a soution I would probably try to fix it asap, but I really can't. And once you set the custom values it would work just fine, so that's okay I suppose.

michaelb7k commented 10 years ago

Source of bug discovered.

If the dpi setting within Windows is not set to 100% (ie. font scaling is set to something other) then the overlay will not be the same size as the game window.

In Windows 7 right-click desktop -> Screen Resolution -> Make text and other items larger or smaller -> Setting to 100% fixes sizes issues for all resolutions.

The code fix would be to take current dpi of screen into account. This also seems to fix all offsets issues - no offset adjustments required so far.

azeier commented 10 years ago

You are awesome :).

Got it fixed now.

azeier commented 10 years ago

yay!

michaelb7k commented 10 years ago

Awesome!

Glad we were able to tackle that one - can the faq on the front page be updated now?

azeier commented 10 years ago

Completely forgot about that, yes, thanks.