Announcement

Collapse
No announcement yet.

SDLQuake on Raspberry Pi

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

  • 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.

  • #2
    Talk to Baker,I think he made a SDL port for Kurok that should work.
    Try Quakespasm too.
    WARNING
    May be too intense for some viewers.
    Stress Relief Device
    ....BANG HEAD HERE....
    ---------------------------
    .
    .
    .
    .
    .--------------------------

    Comment


    • #3
      try -O0 and the stack trace will show the addresses.

      valgrind is much easier to use than gdb for various things, just not sure valgrind is supported on arm.
      would more directly point to the issue though, rather than just saying 'oops segfault'.

      remember that arm has strict alignment requirements, that said I would hope that fread could accept misaligned output, and I would hope that the progs.dat was being read to an aligned location anyway.


      I don't have a raspberry, but fte does already run on arm devices, does support gles, and can already use EGL+X11 (bug-willing).
      In theory its a case of getting the source and compiling:
      svn co https://fteqw.svn.sourceforge.net/svnroot/fteqw/trunk fteqw && cd fteqw/engine && make gl-rel && release/fteqw.gl +vid_renderer egl
      In theory, that is.
      In practise, there's really no guarentee that it'll work at all, and you'll likely need to install some extra dependancies.
      Some Game Thing

      Comment


      • #4
        You'll have to excuse my ignorance when it comes to compiling I'm more of a web developer although I've written a few things in C for AVR chips.

        When you say alignment I assume you mean something to do with address spacing? I had a quick google and apparently ARMv6 and up doesn't require strict alignment.

        Anyway I tried to compile it with -O0 and it now works. Something about the optimisation is causing the problem. Although the game is playable, software rendering still isn't that great. I'll have a look at fteqw and let you know how I get on.

        Thanks

        Comment


        • #5
          No luck with fteqw unfortunately.

          In file included from ./libs/speex/libspeex/arch.h:78:0,
          from ./libs/speex/libspeex/bits.c:40:
          ./libs/speex/include/speex/speex_types.h:122:40: fatal error: speex/speex_config_types.h: No such file or directory
          There is a file in the speex includes folder called 'speex_config_types.h.in' but it looks like it's suppose to be configured by something first.

          Comment


          • #6
            Just install "quake" from the repositories. That is Quakespasm. A solid modern engine. No need to compile anything yourself.
            Quake 1 Singleplayer Maps and Mods

            Comment


            • #7
              Knappster, for vanilla debian, you need to 'apt-get install' these packages:
              libspeex-dev libjpeg-dev libxxf86dga-dev libxxf86vm-dev libasound-dev libpng-dev libvorbis-dev libXext-dev libxi-dev

              mesa-common-dev and libeegl1-mesa-dev may also be required, but you might also need different platform-specific packages instead.

              also, sorry but I forgot part of the make line also.
              make gl-rel CFLAGS=-DUSE_EGL

              there is a speex etc library in fte's svn, but that's intended for win32 builds where there is no system version. linux builds are expected to link against the distro's version to allow distro bugfixes to affect fte's dependancies too (something that gentoo in particular seems pretty big on).
              Some Game Thing

              Comment


              • #8
                I tried Quakespasm from the repos and no luck. The Raspberry Pi is a OpenGL ES 2.0 device and I don't think Quakespasm supports it (well I couldn't find any information about compiling Quakespasm for gles). Plus you don't learn anything if something 'just works' .

                I've removed the flags from the makefile for Speex and other than the occasional dependency issue it seems to be compiling well. I've gone for the mingl-rel as I don't need all the super fancy stuff. Very impressive though .


                Edit: Sorry Spike just missed your post whilst writing the above. Seems likely my current compile will fail. I'll give it another try.

                Comment


                • #9
                  if you're building mingl, you'll need to update to revision 4210, because I just fixed it to actually compile again. :s
                  Some Game Thing

                  Comment


                  • #10
                    Thanks, don't worry I hadn't started compiling yet . I was adding a bunch cpu optimisation stuff for hardfp etc. to the makefile.

                    Comment


                    • #11
                      Well it's finished compiling, however I get this on start up:

                      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 OpenGL
                      Initing ALSA sound device "hw"
                      ALSA: Using PCM hw.
                      Using XF86-VidModeExtension Ver. 2.2
                      Window manager "Openbox" supports fullscreen
                      Error: qkHack: Error couldn't get an RGB, Double-buffered, Depth visual

                      GLVID_Shutdown
                      X Error of failed request: BadWindow (invalid Window parameter)
                      Major opcode of failed request: 18 (X_ChangeProperty)
                      Resource id in failed request: 0x0
                      Serial number of failed request: 29
                      Current serial number in output stream: 31
                      Any ideas?

                      Comment


                      • #12
                        Oops my bad, forgot to include +vid_renderer egl however it segfaults:

                        Console initialized.
                        Using home directory "/home/pi/.fte/"
                        Added packfile ./id1/pak0.pak (339 files)
                        Added packfile ./id1/pak1.pak (85 files)
                        Playing registered version.
                        Client port Initialized
                        CDAudio_Init: open of "/dev/cdrom" failed (2)
                        couldn't exec config.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: can't get display!
                        GL_VENDOR: (null)
                        GL_RENDERER: (null)
                        GL_VERSION: (null)
                        Segmentation fault
                        I'll try and get debug info from this, might be a while.

                        Comment


                        • #13
                          gl/gl_videgl.c
                          find the call to qeglGetDisplay, and change the argument from dpy to EGL_DEFAULT_DISPLAY
                          see if that fixes anything.
                          Some Game Thing

                          Comment


                          • #14
                            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

                            Comment


                            • #15
                              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.
                              Some Game Thing

                              Comment

                              Working...
                              X