You are not logged in.

#1 2010-05-15 18:14:18

Firestone
Member
From: Amsterdam
Registered: 2009-07-26
Posts: 20

[Request] dosbox w/ patch

Due to an ilness, I need a left-hand mouse setup. Dosbox, however, does not seem to have the option of switching mouse buttons and it does not follows xmodmap either.
Recently I found a mouse-button-swap patch which I am trying to use:

diff -ruN dosbox-0.73/src/gui/sdlmain.cpp dosbox-0.73-buttonswap/src/gui/sdlmain.cpp
--- dosbox-0.73/src/gui/sdlmain.cpp     2007-08-26 12:03:25.000000000 -0600
+++ dosbox-0.73-buttonswap/src/gui/sdlmain.cpp  2008-09-01 23:13:36.000000000 -0600
@@ -203,6 +203,7 @@
                bool autoenable;
                bool requestlock;
                bool locked;
+               bool buttonswap;
                Bitu sensitivity;
        } mouse;
        SDL_Rect updateRects[1024];
@@ -1058,6 +1059,7 @@
 #endif
        }
        sdl.mouse.autoenable=section->Get_bool("autolock");
+       sdl.mouse.buttonswap=section->Get_bool("buttonswap");
        if (!sdl.mouse.autoenable) SDL_ShowCursor(SDL_DISABLE);
        sdl.mouse.autolock=false;
        sdl.mouse.sensitivity=section->Get_int("sensitivity");
@@ -1171,10 +1173,16 @@
                }
                switch (button->button) {
                case SDL_BUTTON_LEFT:
-                       Mouse_ButtonPressed(0);
+                       if(sdl.mouse.buttonswap)
+                               Mouse_ButtonPressed(1);
+                       else
+                               Mouse_ButtonPressed(0);
                        break;
                case SDL_BUTTON_RIGHT:
-                       Mouse_ButtonPressed(1);
+                       if(sdl.mouse.buttonswap)
+                               Mouse_ButtonPressed(0);
+                       else
+                               Mouse_ButtonPressed(1);
                        break;
                case SDL_BUTTON_MIDDLE:
                        Mouse_ButtonPressed(2);
@@ -1480,6 +1488,7 @@
                        "            Second entry behind the comma is for when dosbox is not focused/minimized.\n"
                        "mapperfile -- File used to load/save the key/event mappings from.\n"
                        "usescancodes -- Avoid usage of symkeys, might not work on all operating systems.\n"
+                       "buttonswap -- Swaps left and right buttons on the mouse.\n"
                        );
                /* Init all the dosbox subsystems */
                DOSBOX_Init();

I get the first diff-lines need to be altered(right?), but I can't seem to get it right.
Although the diff compares the src with the src-buttonswap, I read that this is the only file needed. Google isn't very helpful though.

I already made a PKGBUILD which I modelled after the debug-version in AUR :

pkgname=dosbox-buttonswap
pkgver=0.73
pkgrel=1
pkgdesc="An x86 emulator with builtin FreeDOS (buttonswap version)"
arch=('i686' 'x86_64')
url="http://dosbox.sourceforge.net/"
license=('GPL')
depends=('sdl_net' 'sdl_sound' 'libgl' 'libpng')
makedepends=('make')
provides=('dosbox')
conflicts=('dosbox')
source=(http://downloads.sourceforge.net/dosbox/dosbox-$pkgver.tar.gz \
    dosbox.conf.default \
    buttonswap.patch)
md5sums=('0823a11242db711ac3d6ebfff6aff572'
         'b1b114829a8e92342363b6d34e8b50f1'
         '1dce3cbe2814bc43d86329d19a954d78')

build() {
  cd dosbox-$pkgver

  patch -Np1 -i ../buttonswap.patch || return 1

  ./configure    --prefix=/usr \
        --sysconfdir=/etc/dosbox \
        --mandir=/usr/share/man \
        --disable-alsa-midi

  make || return 1
  make DESTDIR="$pkgdir" install

  install -Dm644 ../dosbox.conf.default "$pkgdir"/usr/share/$pkgname/dosbox.conf.default
}

# vim: ts=2 sw=2 et ft=sh

My first question: is the PKBUILD correct. I think it is, although it is my first time of creating one.
Secondly; how can I alter the patch so that it can be used.

As of now I get the following during 'makepkg -s' :

...
==> Starting build()...
patching file src/gui/sdlmain.cpp
Hunk #1 FAILED at 203.
Hunk #2 FAILED at 1058.
Hunk #3 FAILED at 1171.
Hunk #4 FAILED at 1480.
4 out of 4 hunks FAILED -- saving rejects to file src/gui/sdlmain.cpp.rej
==> ERROR: Build Failed.
    Aborting...

Offline

Board footer

Powered by FluxBB