Blizzard / s2client-api

StarCraft II Client - C++ library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
MIT License
1.66k stars 281 forks source link

Unable to find executable. #157

Open DanielShabarov opened 7 years ago

DanielShabarov commented 7 years ago

Hello!

I downloaded "SC2API_Binary_vs2017" and the build in "Visual Studio 2017" was successful. But at the stage of execution it seems like the program did not find "Starcraft 2". But Starcraft 2 is installed. Maybe to work with Starcraft API requires a specific version of Starcraft2?

Here's what the console says:

                         C O N S O L E

Please run StarCraft II before running this API Command Line Usage: F:\SC2API_Binary_vs2017\project\x64\Debug\bot.exe -e [execut able]

For more options: F:\SC2API_Binary_vs2017\project\x64\Debug\bot.exe --help

Unable to find executable. Executable path can't be found, try running the StarCraft II executable first.

Assertion failed: !"Could not find the executable. Supply a valid path.", file d :\projects\s2client-api\src\sc2api\sc2_coordinator.cc, line 648


KevinCalderone commented 7 years ago

It should work with any recent game version. On Windows it should automatically finds the game executable. Can you try manually launching SC2 once and then test running the bot again?

When you run the game, it writes some configuration information here: C:\Users\username\Documents\StarCraft II\ExecuteInfo.txt

The library reads that file to get the executable path. Do you see that file there?

DanielShabarov commented 7 years ago

KevinCalderone - hi! hmm, i checked the file along the path you provided, the file is present, the path to the game is registered .. maybe the problem is because I have a user name written in cyrillic characters? C:\Users\ицуцу101\Documents\StarCraft II\ExecuteInfo.txt

              ExecuteInfo.txt

executable = F:\Games\StarCraft II\Versions\Base58400\SC2.exe


KevinCalderone commented 7 years ago

hmm yeah that sounds like it may be the cause. I am unsure if we are handling Unicode characters properly everywhere.

It constructs the path to that file in the "ParseSettings" function in sc2_args.cc. Can you debug to see what value "execute_info_filepath" has? The call to "GetUserDirectory" is trying to use the Unicode Win32 calls but maybe there is a bug.

DanielShabarov commented 7 years ago

I'm not very experienced in debugging, as I suspect when debugging I need to get into the "coordinator" class? When debugging, I do "step into", and the debugger just runs the "main.cpp" script to the end, after the line:

coordinator.LoadSettings (argc, argv);

There is a message in the console that Starcraft 2 is not found.

Means it is necessary somehow to get in this code where the function is registered: "LoadSettings (argc, argv)"? But I dont know how?

herodrigues commented 7 years ago

@DanielShabarov try passing your SC2 executable as parameter:

F:\SC2API_Binary_vs2017\project\x64\Debug\bot.exe -e "F:\Games\StarCraft II\Versions\Base58400\SC2.exe"

If it works, you'll have to change your Windows username if you want to run the executable without parameters (I'm pretty sure those cyrillic characters are the problem). This way, LoadSettings method will have access to the executable path inside ExecuteInfo.txt

herodrigues commented 6 years ago

@DanielShabarov was your issue solved?

If yes, please, consider closing this issue

MrCeeJ commented 6 years ago

The problem is that the path is not correct. I had the same problem, my ExecuteInfo.txt is in C:\Users\ucjuk\OneDrive\Documents\StarCraft II but it displays as This PC\Documents\StarCraft II in the explorer.

I copied the file over to C:\Users\ucjuk\Documents\Starcraft II and the problem was solved. It seems that windows is not playing nicely with the hardcoded path values.