Comments (6)
The --exec parameter no longer launches the game.
it does, as long as you already have battle.net.exe running...
from bnetlauncher.
Battle.net client 1.23 has had some usability fixes so some progress by blizzard is being made, however enter still does not default to launching the game.
Tested in 1.25.0.12296 beta
from bnetlauncher.
Update on the issue, beta is now released with enter key functionality still removed. So launching alternative versions of games is still broken.
A proof of concept been done on trying to find a button in a window and sending a mouse click event but it's not very elegant or robust.
That said I currently not inclined to invest the time into bnetlauncher to re-implement the feature.
from bnetlauncher.
So had some time this long weekend and made an experimental fix for those brave enough to try it
from bnetlauncher.
I would suggest looking for more than one pixel color match to make it more robust in the case there is a pixel with a same color somewhere else in the Battle.net client window.
The code below should be able to find the button location within the Bnet client in few milliseconds, given the bitmap of the client window.
unsafe Point? FindButtonLocation(Bitmap bitmap, Color btnColor)
{
int bytesPerPixel = 4;
const int neededMatchPixelColors = 100;
Size focusSize = new Size(10, 10);
System.Drawing.Imaging.BitmapData mapSource = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, bitmap.PixelFormat);
int scanStride = bitmap.Width * bytesPerPixel;
byte* scanFirstPixel = (byte*)mapSource.Scan0;
Point? btnLocation = null;
for(int y = bitmap.Height / 2; y < bitmap.Height; y++)
{
byte* currentLine = scanFirstPixel + (y * scanStride);
for (int x = 0; x < scanStride / 3; x += bytesPerPixel)
{
var currentScreenPosition = new Point(x / bytesPerPixel, y);
byte A = currentLine[x + 3];
byte R = currentLine[x + 2];
byte G = currentLine[x + 1];
byte B = currentLine[x];
bool mainPixelFound = A == btnColor.A && R == btnColor.R && G == btnColor.G && B == btnColor.B;
if (!mainPixelFound)
continue;
int checkPixelsFound = 0;
bool allcheckPixelsFound = checkPixelsFound == neededMatchPixelColors;
if (!allcheckPixelsFound)
{
var mainPixelLocation = new Point(x / bytesPerPixel, y);//relative to the scan region
var focusRegion = GetScanRegionAroundMainPixel(mainPixelLocation, focusSize);//relative to the scan region
byte* focusFirstPixel = scanFirstPixel + (focusRegion.Y * scanStride) + focusRegion.X * bytesPerPixel;
int focusStride = focusRegion.Width * bytesPerPixel;
for (int j = 0; j < focusRegion.Height; j++)
{
byte* focustLine = focusFirstPixel + (j * scanStride);
for (int i = 0; i < focusStride; i += bytesPerPixel)
{
A = focustLine[i + 3];
R = focustLine[i + 2];
G = focustLine[i + 1];
B = focustLine[i];
bool checkPixelFound = A == btnColor.A && R == btnColor.R && G == btnColor.G && B == btnColor.B;
if (checkPixelFound)
{
checkPixelsFound++;
allcheckPixelsFound = checkPixelsFound == neededMatchPixelColors;
}
if (allcheckPixelsFound)
{
bitmap.UnlockBits(mapSource);
btnLocation = currentScreenPosition;
return btnLocation;
}
}
}
}
}
}
bitmap.UnlockBits(mapSource);
return btnLocation;
Rectangle GetScanRegionAroundMainPixel(Point currentLocation, Size focusScanSize)
{
Point centerPoint = new Point(currentLocation.X - focusScanSize.Width / 2, currentLocation.Y - focusScanSize.Height / 2);//adjust point to be center of rectangle
return new Rectangle(centerPoint, focusScanSize);
}
}
from bnetlauncher.
@SilverSaw has done some testing in #56 (comment) which shows the flaws of current implementation.
Issues to resolve
- Unreliable method to obtain main game window
- Single pixel match instead of "zone"
I'm opening the project to Pull request targeted at fixing this issue.
from bnetlauncher.
Related Issues (20)
- cold war issue HOT 1
- WoW Classic not launching HOT 1
- WoW Classic TBC HOT 9
- Crash Bandicoot 4 doesn't launch. HOT 12
- CoD: MW 2019 not launching properly HOT 2
- Cannot launch warzone with bnetlauncher. HOT 2
- Add support for Blizzard Arcade Collection HOT 3
- Add support for Call of Duty: Vanguard HOT 1
- Add support for SoM version of Classic WOW HOT 5
- Add support for Classic World of Warcraft HOT 3
- A way to launch overwatch 2 beta HOT 5
- Add support for Diablo Immortal HOT 2
- Breaks XInput in Overwatch HOT 7
- Not Launching Overwatch 2 HOT 32
- Add support for COD Modern Warfare 2 (CODhq) HOT 5
- Modern Warfare II does not launch properly HOT 4
- Vanguard launches with error HOT 3
- Steam Deck support HOT 5
- Spelling error in program.cs
- Diablo 4 Support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bnetlauncher.