4

I am trying to open a file of an unknown type (Pokemon Gold.gbc). I double click it and get the message "Could not display '/home/josh/Downloads/Pokemon ROMS/Pokemon Gold.gbc'. The file is of an unknown type." I click "Select Application" and then "Show Other Applications." However, not all of my applications are listed there, and neither is the one that I want (VBA-M [package name vbam-gtk]). How can I get all of my installed applications to show in this menu so that I do not have to open the file from the desired program, I can just launch it by double-clicking the file in nautilus?

Update: I found out that the application can be launched from

/usr/bin/vbam

or from

/usr/share/applications/VBA-M

or command line:

gvbam

Additional details: I installed this package from a .deb file I got from Sourceforge, not from the repositories (the GameBoy emulator in the repositories is not satisfactory).

So is there at least a way that I can select the executable file to open the unknown file with?

Update 2:

I have tried everything in the first answer below to no avail. As a temporary fix, I have changed the file extension from .gbc to .gb and so far everything seems to be working fine. However, I do not want to stay this way as I do not know if this will cause any problems.

Josh
  • 708

1 Answers1

2

Solution:

In terminal, run gedit ~/.local/share/applications/mimeapps.list. In the text document that opens, add the line application/octet-stream=gvbam.desktop; underneath "[Added Associates]", which should be at the top. This should force .gbc files, which Ubuntu recognizes as octet-streams, to open using VBA-M.

You will also have to tell VBA-M to load a rom upon launching by using the following steps:

  • In terminal, run gksudo gedit /usr/share/applications/gvbam.desktop
  • In the file that opens, replace Exec=gvbam with Exec=gvbam %U

Following this, you will need to run sudo update-desktop-database in terminal to "apply" the edits.

When you click "Open with other application..." in the right-click menu, and click "Show other applications", VBA-M should now be in the list, and the game should open correctly.

If file is not recognized as a GameBoy Color Rom or isn't opening, rename the extension. For example, if the extension is ".gbc" (i.e. GameBoy Color), renaming it to ".gb" (i.e. GameBoy) should make it recognized as a GameBoy Rom.


How I came to my conclusion

In terminal, run gksudo gedit /usr/share/applications/gvbam.desktop. In the "Exec=gvbam" line, add %U afterwards. So in the end, it should the whole line should be Exec=gvbam %U.

While this did add VBA-M to the "Other Applications" list, (and thus allow me to set VBA-M as the default program for .gbc's) the game doesn't actually run; in fact, the VBA-M window completely fails to show up anywhere. I think that this is because of how VBA-M currently works; in a terminal, I ran gvbam "Pokemon Gold.gbc", and it threw the following error:

The program 'gvbam' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
  (Details: serial 474 error_code 11 request_code 154 minor_code 3)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

To further test this, I downloaded another rom, and I chose The Legend of Zelda: A Link to the Past. Having already done the above instructions to add VBA-M to the application list, I chose it as default for the Zelda game, which was a .gba file; the game loaded fine. I noticed in the properties of the files, the .gbc's type was unknown (application/octet-stream), while the .gba's type was Game Boy Advance ROM (application/x-gba-rom); obviously, something else was missing in the association of GameBoy Color roms, which wasn't missing with GameBoy Advance roms.

I tried adding gbc as an associated filetype with application/octet-stream, and that seemed to fix the issue of the .gbc file not opening. However, I then removed it, and tried opening the .gbc again, and it still worked; I'm not sure what I did, but now it works.


Original Answer

This got an upvote, so since someone thought this was good, I'm leaving it here for anyone else who cares. That being said, the information above is probably more relevant to the question.

To start out, you must be sure that the MIME type for your file extension does not already exist. Open a terminal and enter:

  • grep 'gbc' /etc/mime.types

If there was no output, or the output given did not include your extension, you must add a MIME type.

In a terminal, open the mime.types file by running gksudo gedit /etc/mime.types. In this file, add the following line to the "application" section:

application/gbc gbc

There should be additional spaces between the two gbc's - just make sure to line the second gbc up with the other extensions. I would show, but I'm not sure how to do this on askubuntu.


Sources:

ananaso
  • 3,970
  • 4
  • 31
  • 51
  • I appreciate the effort you but into this answer, but it neither solves my problem nor answers my question. I am sorry to say I cannot accept it. – Josh Jan 10 '13 at 02:18
  • Ok, that's alright. Have you tried just right-clicking on the file you want to open (the .gbc), selecting "Open with other application", clicking "use a custom command" near the bottom of the window that pops up, and typing /usr/bin/vbam into it? If you check "Use as default for this kind of file", it should set it as default. – ananaso Jan 10 '13 at 04:48
  • When I open the window you speak of I do not see "use a custom command." Is this due to a script/some program you have installed? – Josh Jan 10 '13 at 04:52
  • I just booted an Ubuntu liveusb, and now I see what you mean. In /usr/share/applications, there should be a bunch of icons for applications, such as firefox, libreoffice, etc. Is there a "vbam" file? – ananaso Jan 11 '13 at 03:45
  • Yes, it's /usr/share/applications/VBA-M. – Josh Jan 13 '13 at 19:43
  • Woops, durr; missed that in the OP. I'm just shooting in the dark now - try gksu gedit /usr/share/applications/defaults.list, and add the line application/gbc=vba-m.desktop. If that doesn't work, try adding variations of that line instead, like application/gbc=vbam.desktop, application/gbc=gvbam.desktop, application/x-gbc=vba-m.desktop, etc. – ananaso Jan 15 '13 at 02:49
  • When I opened /usr/share/applications/defaults.list, application/gbc=gvbam.desktop already existed. – Josh Jan 17 '13 at 05:16
  • @Josh I updated what I think solved it; has that worked for you? – ananaso Jan 27 '13 at 18:01
  • No, this has not worked. Thanks for all your efforts in solving this (all so I could play a game). I was able to set a custom command gvbam as default for .gba and .gb files using Ubuntu Tweak, but for some reason .gbc files were not on the list. Does this information help? Another small thing that I noticed was that the .gbc file in question has a little lock icon on it. As a temporary fix, I changed the extension from .gbc to .gb and it works. – Josh Jan 29 '13 at 02:10
  • No problem - people help me, so I feel I should help people. That's strange it's not in Ubuntu Tweak, I even looked for octet-stream, which is what .gbc is identified as. After looking here and here, I changed something - the gvbam.desktop should be Exec=gvbam %U, not Exec=gvbam %f. Also, I updated the answer for a second attempt; try that. – ananaso Jan 31 '13 at 23:09
  • Also, if that doesn't work, try this; I just found it, and if it works, it'd be better if we can tag this as duplicate than to have the same question twice. – ananaso Jan 31 '13 at 23:36