Announcement

Collapse
No announcement yet.

SDLQuake on Raspberry Pi

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Knappster
    started a topic SDLQuake on Raspberry Pi

    SDLQuake on Raspberry Pi

    Hi,

    I've been trying to get SDLQuake working on my Raspberry Pi computer but have run into an annoying issue. I've successfully got the program to compile and run however when trying to create a new game I receive a segmentation fault.

    I've done some digging and it appears to be caused when trying to load progs.dat. From what I've found on google progs.dat is the compiled game logic in QuakeC. Obviously a very important file, but fails to load when trying to start a new single player or multiplayer game.

    This is the code base I'm using: http://www.libsdl.org/projects/quake/

    and my edited makefile: SDLQuake R-Pi Makefile - Pastebin.com

    I did a little stack trace with gdb which gave me this:
    #0 0xb6def284 in fread () from /lib/arm-linux-gnueabihf/libc.so.6
    #1 0x000475e0 in Sys_FileRead (handle=115, dst=<optimized out>, count=413116) at sys_sdl.c:218
    #2 0x00010f5c in COM_LoadFile (path=0x51c6c "progs.dat", usehunk=<optimized out>) at common.c:1583
    #3 0x0002e004 in PR_LoadProgs () at pr_edict.c:995
    Which lead me to the sys_sdl.c file and this function:
    Code:
    int Sys_FileRead (int handle, void *dst, int count)
    {
       char *data;
       int size, done;
    
       size = 0;
       if ( handle >= 0 ) {
          data = dst;
          while ( count > 0 ) {
             done = fread (data, 1, count, sys_handles[handle]);
             if ( done == 0 ) {
                break;
             }
             data += done;
             count -= done;
             size += done;
          }
       }
       return size;
          
    }
    I don't understand why it's failing when it seems to be loading other files perfectly fine.

    Any assistance on getting this working would be awesome . I can read C and sort of understand what's going on but I don't know the inner workings of the Quake engine (I'm trying to learn as much as I can ). The Raspberry Pi for those that don't know is a small cheap ARM based computer based on ARMv6 with hardware floating point support. I'm trying to get this to run on Raspian Linux.

    Thanks.

  • bluntz
    replied
    I am amazed you fixed all the code to get it running at all.
    You rock.
    At least he can host a dedicated server on his pi...

    Leave a comment:


  • Spike
    replied
    I think the earlier parts of this topic basically discuss how the rasberry pi's opengl support is only through a pi-specific egl layer.
    tbh, I'm not convinced there is any real 'standard' egl, which sucks. either way, it would need to include input which means it would require stupid input hacks...
    the pi supports software rendered glx only, the egl stuff is either fullscreen, or copied into a software buffer and then submitted to the x11 server in some inefficient way.
    I've mentioned the changes that would theoretically be needed to get fte to run properly with egl on the pi, but I don't have one so can't verify that.

    Leave a comment:


  • bluntz
    replied
    I see I was wrong,FTE did not install itself as a user and is writing to $Home as it should.I wonder if the gl render works at all,maybe try to run glxgears and see.I will get a similar error if I don't have the driver installed correctly.And sometimes if the desktop resolution is set to one that is not an option the client can choose it will give a similar error.
    Generally quake will run in a window if that's the case though.
    Last edited by bluntz; 07-19-2013, 07:01 PM.

    Leave a comment:


  • Spike
    replied
    bluntz, I don't see how that could be an issue. If you're refering to FTE, use the -nohome argument if you want to avoid use of the home directory. Its just quake data, the x11 server never sees anything quake writes there.

    Leave a comment:


  • bluntz
    replied
    Spike, I see that it has set itself up to write to it's own home dir ?
    Could this be a permissions problem with the X server? Maybe add --prefix=/usr to the configure section in compilation or adding the user/group?

    Leave a comment:


  • johannesl
    replied
    Hi everyone!
    We have a port effort of Quake 1 going on over at the Raspberry Pi forums.
    The thread is available at:
    Raspberry Pi &bull; View topic - Quake 1 Port, Optimization Questions

    And the github repo is over at:
    https://github.com/welford/qurp

    It's not ready for prime time or regular users yet, but anyone with some development skills is welcome to help.

    Leave a comment:


  • Knappster
    replied
    Typical oh well I'll see what I can do, it'll be a good learning experience. Thanks very much for the help though, you're awesome .

    Leave a comment:


  • Spike
    replied
    looks like the raspberry's gles support is just bugged to hell.
    See:
    https://github.com/benosteen/opengle...ommon/esUtil.c

    Notice the RPI_NO_X define. Apparently it doesn't work without that.
    This means you need both X11 for mouse/key input, and their raspberry pi specific WinCreate function to create a 'window' for graphics output.
    Which sucks.
    Especially if your x11 window manager does some sort of task switching and then you're sending input to some xterm instead of quake and unable to see which window is actually active...
    Also that code doesn't appear to feature any shutdown code. Which suggests that you'll be left with a dodgy resolution when you shut down quake...
    The whole thing sucks tbh.

    So yeah, add the right headers, include a call to bcm_host_init(); Use their CreateWindow function to set the right video mode and create a window that you can use in the egl calls, and you might get something working a bit better.


    Maybe they'll manage to fix the non-standard parts of their context creation some time this century? :s grr.

    On the plus side, the fact that it doesn't 'just work' means that you're learning something! yay... :s

    Leave a comment:


  • Knappster
    replied
    np .

    Spike: Change window to NULL then:

    Console initialized.
    Using home directory "/home/pi/.fte/"
    Client port Initialized
    CDAudio_Init: open of "/dev/cdrom" failed (2)
    couldn't exec default.cfg
    couldn't exec autoexec.cfg
    couldn't exec fte.cfg

    FTE build Feb 17 2013
    Setting mode 1920*1200*32*0 EGL
    Initing ALSA sound device "hw"
    ALSA: Using PCM hw.
    Attempting to dlopen libGLESv2... success
    Attempting to dlopen libEGL... success
    Using XF86-VidModeExtension Ver. 2.2
    Window manager "Openbox" supports fullscreen
    EGL: no surface!Failed to create EGL context.
    GLVID_Shutdown
    Trying 640*480
    GLVID_Shutdown
    Setting mode 640*480*32*0 EGL
    Initing ALSA sound device "hw"
    ALSA: Using PCM hw.
    Attempting to dlopen libGLESv2... success
    Attempting to dlopen libEGL... success
    Using XF86-VidModeExtension Ver. 2.2
    Window manager "Openbox" supports fullscreen
    EGL: no surface!Failed to create EGL context.
    GLVID_Shutdown
    GLVID_Shutdown
    Error: Tried setting dedicated mode

    Leave a comment:


  • Spirit
    replied
    Ah, sorry about the Quakespasm suggestion. I only remembered someone else trying it but he did also not get it to work because of the drivers. Oopsie!

    Leave a comment:


  • Spike
    replied
    for the qeglCreateWindowSurface function, try passing NULL instead of window.

    Leave a comment:


  • Knappster
    replied
    Thanks once again , however new errors:

    Program received signal SIGSEGV, Segmentation fault.
    0xb6e761c0 in platform_get_handle () from /opt/vc/lib/libEGL.so
    (gdb) backtrace
    #0 0xb6e761c0 in platform_get_handle () from /opt/vc/lib/libEGL.so
    #1 0xb6e6be24 in eglCreateWindowSurface () from /opt/vc/lib/libEGL.so
    #2 0x0012e6b4 in EGL_Init (info=0xbeffd358, palette=0xf61f28 "", window=0x1e00002, dpy=0xf89400) at ./gl/gl_videgl.c:221
    #3 0x0012d390 in X11VID_Init (info=0xbeffd358, palette=0xf61f28 "", psl=1) at ./gl/gl_vidlinuxglx.c:1486
    #4 0x0012d7a4 in EGLVID_Init (info=0xbeffd358, palette=0xf61f28 "") at ./gl/gl_vidlinuxglx.c:1559
    #5 0x0021c024 in R_ApplyRenderer_Load (newr=0xbeffd35 at ./client/renderer.c:1134
    #6 0x0021bd50 in R_ApplyRenderer (newr=0xbeffd35 at ./client/renderer.c:1050
    #7 0x0021ca98 in R_RestartRenderer_f () at ./client/renderer.c:1537
    #8 0x0015290c in Cmd_ExecuteString (text=0xbeffd454 "vid_restart\n", level=29) at ./common/cmd.c:1947
    #9 0x0021b794 in Renderer_Start () at ./client/renderer.c:728
    #10 0x001c4608 in Host_Init (parms=0xbefff490) at ./client/cl_main.c:4095
    #11 0x00132d50 in main (c=3, v=0xbefff624) at ./client/sys_linux.c:655

    Leave a comment:


  • Spike
    replied
    EGL: can't get display!

    revision 4212 will stop it from segfaulting from that error, but you've still no gl context.
    revision 4213 should contain the aforementioned tweak.

    Leave a comment:


  • Knappster
    replied
    I haven't tried your suggestion yet, but I've run a debug build and I get this:

    Program received signal SIGSEGV, Segmentation fault.
    0xb6c78af8 in strncmp () from /lib/arm-linux-gnueabihf/libc.so.6
    (gdb) backtrace
    #0 0xb6c78af8 in strncmp () from /lib/arm-linux-gnueabihf/libc.so.6
    #1 0x00093db0 in GL_CheckExtensions (getglfunction=0x12e050 <EGL_Proc>) at ./gl/gl_vidcommon.c:382
    #2 0x00097b40 in GL_Init (getglfunction=0x12e050 <EGL_Proc>) at ./gl/gl_vidcommon.c:1536
    #3 0x0012d364 in X11VID_Init (info=0xbeffd358, palette=0xf61f28 "", psl=1) at ./gl/gl_vidlinuxglx.c:1487
    #4 0x0012d74c in EGLVID_Init (info=0xbeffd358, palette=0xf61f28 "") at ./gl/gl_vidlinuxglx.c:1554
    #5 0x0021bf9c in R_ApplyRenderer_Load (newr=0xbeffd35 at ./client/renderer.c:1134
    #6 0x0021bcc8 in R_ApplyRenderer (newr=0xbeffd35 at ./client/renderer.c:1050
    #7 0x0021ca10 in R_RestartRenderer_f () at ./client/renderer.c:1537
    #8 0x00152884 in Cmd_ExecuteString (text=0xbeffd454 "vid_restart\n", level=29) at ./common/cmd.c:1947
    #9 0x0021b70c in Renderer_Start () at ./client/renderer.c:728
    #10 0x001c4580 in Host_Init (parms=0xbefff490) at ./client/cl_main.c:4095
    #11 0x00132cc8 in main (c=3, v=0xbefff624) at ./client/sys_linux.c:655

    Leave a comment:

Working...
X