Marcus Sundberg wrote:

> Jay <[EMAIL PROTECTED]> writes:
>
> > I can't show everything just yet, but here is what I can. This is all of the gii
> > stuff:
>
> Ok, should be enough.
>
> >       /* This is where I have to do stuff wrong or my keyboard doesn't work
> >          Keep in mind I am useing the SVGALIB target; it might be the problem */
> >       giiInit();
> >       inp=giiOpen("input-null", NULL);
> >       if (inp==NULL) {
> >               fprintf(stderr, "Error in input libgii, bailing out...");
> >               S9xExit();
> >       }
> >       kbd=giiOpen("input-linux-kbd",NULL);
> >       if (kbd==NULL) {
> >               fprintf(stderr, "Error getting keyboard, bailing out...");
> >               S9xExit();
> >       }
> >       mouse=giiOpen("input-linux-mouse",NULL);
> >       /* I don't think the mouse has ever accually worked */
> >       if (mouse==NULL) {
> >               fprintf(stderr, "Error getting mouse, oh well...");
> >               inp=giiJoinInputs(inp, kbd);
> >       } else {
> >               inp=giiJoinInputs(inp, kbd);
> >               inp=giiJoinInputs(inp, mouse);
> >       }
> >       ggiInit();
> >       vis=ggiOpen(NULL);
> >       if (vis==NULL) {
> >               fprintf(stderr, "Error getting visual");
> >               S9xExit();
> >       }
>
> Ok, this code is utterly broken. You can't open inputs allready used
> by LibGGI. Start by removing _all_ occurences of gii* functions. If
> there's still a problem, run your program with GGI_DEBUG=255 and we
> can start debugging things.

Yes, this code was utterly borken, but it is fixed now.

> >               if (ggiSetGraphMode(vis, 640, 480, 640, 480, GT_32BIT)) {
> >                       fprintf(stderr, "Error getting visual");
> >                       S9xExit();
> >               }
> >       } else {
> >               halfxres=320/2;
> >               halfyres=240/2;
> >
> >               if (ggiSetGraphMode(vis, 320, 240, 320, 240, GT_32BIT)) {
> >                       fprintf(stderr, "Error getting visual");
> >                       S9xExit();
> >               }
>
> Also never hardcode values which you don't care about, like in this
> case the virtual size.

GGI_AUTO is now put in their place

>
> >       case GIIK_P4:   byte4 = 1;      break;
> >       case GIIK_P6:   byte4 = 2;      break;
> >       case GIIK_P2:   byte4 = 4;      break;
> >       case GIIK_P8:   byte4 = 8;      break;
>
> The sym filed of a key event can never contain any of these. The sym
> field describes the meaning of the key, which would be plain '4', '6',
> '2' and '8' respectively for the above keys.
>
> >       case GIIK_PEnter:               byte4 = 16;     break; // Start
> >       case GIIK_PPlus:                byte4 = 32;     break; // Select
>
> Neither can it contain any of these. Sym field would be GIIK_Enter and
> GIIK_Plus (which is equivalent to '+').

Then how can I get keys from the keypad?

> >       case 27:        S9xExit ();     break;
>
> Broken assumption, use GIIK_Escape.

I think you mean GIIUC_Escape. Done

> You might want to consider using the label field as the sym field
> will change for many keys when you have a modifier pressed. For
> things like '+', '-' and other non-alphanumeric symbols it is however
> wise to check the sym field as many keyboard maps don't have these
> on an unshifted keys.

What does label accually do? I tried that, but none of the letter keys worked. So
your saying I need to check both sym and label? I beleve my only problem now is that
the GIIK_P* keys don't work. what do I need to check for that? label doesn't seem to
have any effect on that.

By the way, thanks for helping me clean up the code. I haven't had much of a need for
input in my GGI programs until now, so I knew absolutly nothing about gii events
other than the fact that they existed.

ALLRIGHT!!! ggisnes9x is now ready for release!
I don't know what my problem was, but I suspect it was this:

The way I fixed the problem was to simply "export GGI_DISPLAY=display-svgalib" on the
command line. Also, libggi segfaults in X unless I use "export GGI_DISPLAY=display-x"
or "export GGI_DISPLAY=display-xlib"

I don't really want to speculate, but this is all I can think of that could happen:
When ggiInit() is called, it goes through a list of targets in a certian order until
it finds a working target. The problem is for each target it attempts to open, it
calls libgii before it knows if the target works. That means everytime it fails to
get a display (such as fb-dev) libgii is called before libggi knows whats going on!
libgii cannot backout, and therefore, the running app segfaults. This might be due to
threads.

I don't accually beleave this is what was happening, but thats what I came up with.
Can you come up with something better?

Oh, and the ggisnes9x isn't released on the snes9x main page yet because the snes9x
guys take a really long time to check their e-mail (2 days maybe), but they have
asked me if I was done several times after I had it working, but I didn't want to
release it until I cleaned out the libgii code. Hopefully I can have it up latter
tonight, but for anyone who wants a copy, mail me directly (
mailto:[EMAIL PROTECTED] ) and I will personaly send you a binary or the source
along with a freeware ROM, Pacman.smc


Reply via email to