Page 1 of 1

[Mac 0.9.8] Cannot launch, failed to initialize the mouse

Posted: Wed Jul 30, 2014 1:53 pm
by SmileyDude
Hi Everyone --

I just purchased a copy based only on the videos posted on the web, a few reviews and a recommendation from a friend who got sucked into the game until 3 AM last night. When I downloaded the 0.9.8 version this morning, I went to launch it and I got this error message:
factorio-failed-to-initialize-mouse.png
factorio-failed-to-initialize-mouse.png (23.6 KiB) Viewed 12565 times
Since I was able to click on the OK button with my mouse, there isn't a problem that I know about with it. Obviously, this is impeding my ability to play the game :D

My machine specs:
  • 2012 Mac mini, 2.6GHz quad Core i7, 16GB RAM
    MacOS X 10.9.4, Mavericks
This machine has HD4000 graphics and can run games like Diablo 3, Minecraft and others without issue, so I wouldn't think that this game wouldn't work on it. I didn't see anything specific about video cards other than having 512MB to 1GB. According to the System Information app, I've currently got 1GB allocated to VRAM.

I have seen references to higher version numbers in the forums, but I've been unable to locate a download yet. Are these only available via auto-update or is there a direct link somewhere?

Thanks!

EDIT: I just found the download for 0.10.4 and I get the same error message with that version as well.

Re: [Mac 0.9.8] Cannot launch, failed to initialize the mous

Posted: Wed Jul 30, 2014 7:39 pm
by SmileyDude
Ok, so I spent *way* too much time tracking this down today, but it looks like it's a bug in the Allegro library for OS X. The mouse detection code was only using the primary HID usage/usage page values and the mouse I have here (Microsoft Comfort Optical Mouse 3000) doesn't report itself primarily as a mouse, oddly enough. I made a quick patch to the Allegro code that I submitted upstream already, but obviously no idea on when that will land in the official git repo for Allegro or into Factorio eventually. I'm attaching the patch here as well, in case the Factorio devs want to apply it on their end.

As an aside, it's a bit unfortunate that the OS X version of Factorio has the Allegro libraries statically linked rather than just using embedded frameworks. I could've patched my copy locally if that was done instead. Just a suggestion for future releases.

For now, I'm off to find another mouse that I can use :D

EDIT: for some reason, this forum isn't allowing me to upload the patch file. I'm putting in inline here in case anyone needs it.

Code: Select all

 src/macosx/hidman.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/macosx/hidman.m b/src/macosx/hidman.m
index 6e5ac65..f62ee07 100644
--- a/src/macosx/hidman.m
+++ b/src/macosx/hidman.m
@@ -372,8 +372,8 @@ HID_DEVICE_COLLECTION *_al_osx_hid_scan(int type, HID_DEVICE_COLLECTION* col)
      /* Add key for device type to refine the matching dictionary. */
      usage_ref = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
      usage_page_ref = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage_page);
-     CFDictionarySetValue(class_dictionary, CFSTR(kIOHIDPrimaryUsageKey), usage_ref);
-     CFDictionarySetValue(class_dictionary, CFSTR(kIOHIDPrimaryUsagePageKey), usage_page_ref);
+     CFDictionarySetValue(class_dictionary, CFSTR(kIOHIDDeviceUsageKey), usage_ref);
+     CFDictionarySetValue(class_dictionary, CFSTR(kIOHIDDeviceUsagePageKey), usage_page_ref);
    }
    result = IOServiceGetMatchingServices(master_port, class_dictionary, &hid_object_iterator);
    if ((result == kIOReturnSuccess) && (hid_object_iterator)) {
-- 
1.9.3 (Apple Git-50)

Re: [Mac 0.9.8] Cannot launch, failed to initialize the mous

Posted: Thu Jul 31, 2014 8:53 am
by kovarex
Wow thank you for the help, we will include it (once we test it).

The static link of allegro has its reasons, and connecting altered allegro version based on the original would work, because we have our own changes in the allegro as well.

Re: [Mac 0.9.8] Cannot launch, failed to initialize the mous

Posted: Thu Jul 31, 2014 9:12 am
by cube
Hi, thanks for the patch. Slpwnd (our OSX guy) is out for a few days, so we can't test it now. I'll ask him to merge this as soon as he returns. Unfortunately this means that your patch won't make it into 0.10.6, so you will have to play Factorio with a different mouse for at least one more week :-)

Re: [Mac 0.9.8] Cannot launch, failed to initialize the mous

Posted: Thu Jul 31, 2014 11:20 am
by SHiRKiT
It's amazing how many bugs shows up in this forum every day, and how different they are.

Re: [Mac 0.9.8] Cannot launch, failed to initialize the mous

Posted: Thu Jul 31, 2014 1:32 pm
by micomico
SHiRKiT wrote:It's amazing how many bugs shows up in this forum every day, and how different they are.
This tells me the game is getting ever more popular, with more players reporting problems. Not that the number of bugs are rising or something like that.

Also, I like to think that people report bugs because they want their game - which they enjoy - fixed, rather than simply pointing the existing bugs with a negative intention.

Re: [Mac 0.9.8] Cannot launch, failed to initialize the mous

Posted: Tue Aug 05, 2014 12:15 pm
by slpwnd
@SmileyDude Thanks for reporting the issue, researching it and solving it yourself! That is the spirit :D I have merged the patch to the 0.10.x branch and it works fine at my setup. It will be present in the next release.
micomico wrote:This tells me the game is getting ever more popular, with more players reporting problems. Not that the number of bugs are rising or something like that.

Also, I like to think that people report bugs because they want their game - which they enjoy - fixed, rather than simply pointing the existing bugs with a negative intention.
I certainly hope that is the reason :D

Re: [Mac 0.9.8] Cannot launch, failed to initialize the mous

Posted: Tue Aug 05, 2014 12:50 pm
by SmileyDude
slpwnd wrote:@SmileyDude Thanks for reporting the issue, researching it and solving it yourself! That is the spirit :D I have merged the patch to the 0.10.x branch and it works fine at my setup. It will be present in the next release.
Not a problem at all. Glad I could be of some assistance here.

BTW, I've since swapped out my machine to a MacBook Pro. And on those, this problem never occurs because there is always at least one mouse device (the trackpad) that passes the Allegro test as a valid mouse. Once that hurdle has been jumped, it doesn't matter what mouse you use -- everything just works.