Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

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:

share|improve this answer
    
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 2: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. –  DaimyoKirby Jan 10 '13 at 4: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 4: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? –  DaimyoKirby Jan 11 '13 at 3:45
    
Yes, it's /usr/share/applications/VBA-M. –  Josh Jan 13 '13 at 19:43
show 6 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.