summaryrefslogtreecommitdiff
path: root/recipes/kobodeluxe/files
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/kobodeluxe/files')
-rw-r--r--recipes/kobodeluxe/files/debian-kobo.patch72
-rw-r--r--recipes/kobodeluxe/files/default-config70
-rw-r--r--recipes/kobodeluxe/files/fighter-48.xpm442
-rw-r--r--recipes/kobodeluxe/files/kobodeluxe-dimension-autoswap.patch236
-rw-r--r--recipes/kobodeluxe/files/kobodeluxe-menu-pointer.patch266
-rw-r--r--recipes/kobodeluxe/files/kobodeluxe-putenv.patch69
-rw-r--r--recipes/kobodeluxe/files/kobodeluxe-sysconf-support.patch84
7 files changed, 1239 insertions, 0 deletions
diff --git a/recipes/kobodeluxe/files/debian-kobo.patch b/recipes/kobodeluxe/files/debian-kobo.patch
new file mode 100644
index 0000000000..90b1d84080
--- /dev/null
+++ b/recipes/kobodeluxe/files/debian-kobo.patch
@@ -0,0 +1,72 @@
+--- kobodeluxe-0.5.1.orig/kobo.cpp
++++ kobodeluxe-0.5.1/kobo.cpp
+@@ -141,21 +141,21 @@
+ * Graphics data
+ */
+ /* Current dir; from within the build tree */
+- fmap->addpath("GFX", "./data/gfx");
++ //fmap->addpath("GFX", "./data/gfx");
+ /* Real data dir */
+ fmap->addpath("GFX", "DATA>>gfx");
+ /* Current dir */
+- fmap->addpath("GFX", "./gfx");
++ //fmap->addpath("GFX", "./gfx");
+
+ /*
+ * Sound data
+ */
+ /* Current dir; from within the build tree */
+- fmap->addpath("SFX", "./data/sfx");
++ //fmap->addpath("SFX", "./data/sfx");
+ /* Real data dir */
+ fmap->addpath("SFX", "DATA>>sfx");
+ /* Current dir */
+- fmap->addpath("SFX", "./sfx");
++ //fmap->addpath("SFX", "./sfx");
+
+ /*
+ * Score files (user and global)
+@@ -173,7 +173,7 @@
+ /* System local */
+ fmap->addpath("CONFIG", SYSCONF_DIR);
+ /* In current dir (last resort) */
+- fmap->addpath("CONFIG", "./");
++ //fmap->addpath("CONFIG", "./");
+ }
+
+
+--- kobodeluxe-0.5.1.orig/graphics/window.cpp
++++ kobodeluxe-0.5.1/graphics/window.cpp
+@@ -331,7 +331,7 @@
+ }
+
+
+-void window_t::center_token(int _x, int _y, const char *txt, char token)
++void window_t::center_token(int _x, int _y, const char *txt, signed char token)
+ {
+ center_token_fxp(PIXEL2CS(_x), PIXEL2CS(_y), txt, token);
+ }
+@@ -374,7 +374,7 @@
+ }
+
+
+-void window_t::center_token_fxp(int _x, int _y, const char *txt, char token)
++void window_t::center_token_fxp(int _x, int _y, const char *txt, signed char token)
+ {
+ _x = CS2PIXEL((_x * xs + 128) >> 8);
+ _y = CS2PIXEL((_y * ys + 128) >> 8);
+--- kobodeluxe-0.5.1.orig/graphics/window.h
++++ kobodeluxe-0.5.1/graphics/window.h
+@@ -265,10 +265,10 @@
+ void font(int fnt);
+ void string(int _x, int _y, const char *txt);
+ void center(int _y, const char *txt);
+- void center_token(int _x, int _y, const char *txt, char token = 0);
++ void center_token(int _x, int _y, const char *txt, signed char token = 0);
+ void string_fxp(int _x, int _y, const char *txt);
+ void center_fxp(int _y, const char *txt);
+- void center_token_fxp(int _x, int _y, const char *txt, char token = 0);
++ void center_token_fxp(int _x, int _y, const char *txt, signed char token = 0);
+ int textwidth(const char *txt, int min = 0, int max = 255);
+ int textwidth_fxp(const char *txt, int min = 0, int max = 255);
+ int fontheight();
diff --git a/recipes/kobodeluxe/files/default-config b/recipes/kobodeluxe/files/default-config
new file mode 100644
index 0000000000..4a8f5f7a96
--- /dev/null
+++ b/recipes/kobodeluxe/files/default-config
@@ -0,0 +1,70 @@
+#--------------------------------------------
+# Kobo Deluxe 0.5.1 Configuration File
+#--------------------------------------------
+# Switches - [no]<switch>
+# Values - <key> [<value>|"<string>"]
+#--------------------------------------------
+#--- System options --------------------------
+nologfile
+logformat 0
+logverbosity 2
+#--- Input options --------------------------
+nojoystick
+joystick_no 0
+mouse
+mousemode 1
+nobroken_numdia
+dia_emphasis 0
+noalways_fire
+mousecapture
+#--- Game options ---------------------------
+scrollradar 2
+filter
+timefilter 50
+countdown 5
+starfield 2
+stars 250
+overheatloud 100
+cannonloud 100
+#--- Sound settings -------------------------
+nosound
+music
+nocached_sounds
+samplerate 8000
+latency 50
+mixquality 1
+vol 100
+intro_vol 100
+sfx_vol 100
+music_vol 30
+reverb 100
+vol_boost 0
+#--- Video settings -------------------------
+fullscreen
+videodriver 0
+width WIDTH_HERE
+height HEIGHT_HERE
+autoswap
+aspect 1
+depth 0
+maxfps 100
+maxfpsstrict 0
+buffer 0
+shadow
+videomode -1
+vsync
+videopages -1
+#--- Graphics settings ----------------------
+scalemode 0
+nodither
+dither_type 2
+nobroken_rgba8
+alpha
+brightness 100
+contrast 100
+#--- File paths -----------------------------
+files ""
+gfx ""
+sfx ""
+scores ""
+wait 30
diff --git a/recipes/kobodeluxe/files/fighter-48.xpm b/recipes/kobodeluxe/files/fighter-48.xpm
new file mode 100644
index 0000000000..3c1e8c8b7a
--- /dev/null
+++ b/recipes/kobodeluxe/files/fighter-48.xpm
@@ -0,0 +1,442 @@
+/* XPM */
+static char * fighter_48_xpm[] = {
+"40 40 399 2",
+" c None",
+". c #C8E2CD",
+"+ c #8AB7A3",
+"@ c #408474",
+"# c #023D3D",
+"$ c #F2FBEA",
+"% c #CEE5D1",
+"& c #7DB09B",
+"* c #063E32",
+"= c #002320",
+"- c #D0E6D2",
+"; c #F6FEEE",
+"> c #C7E0CC",
+", c #639C89",
+"' c #054137",
+") c #002629",
+"! c #A6C9B3",
+"~ c #E8F6E4",
+"{ c #EEF8E8",
+"] c #92BDA9",
+"^ c #3A7F6F",
+"/ c #074847",
+"( c #002924",
+"_ c #00286F",
+": c #9CC2AD",
+"< c #F0F9E9",
+"[ c #C8E0CC",
+"} c #6FA894",
+"| c #377F6E",
+"1 c #105251",
+"2 c #002F23",
+"3 c #002863",
+"4 c #ACCDB8",
+"5 c #F0F8E8",
+"6 c #ABCDB8",
+"7 c #62A28E",
+"8 c #3B8572",
+"9 c #195B5D",
+"0 c #003729",
+"a c #002750",
+"b c #8AB4A0",
+"c c #C4DDC9",
+"d c #E8F4E3",
+"e c #99C1AC",
+"f c #569D89",
+"g c #3D8876",
+"h c #23645D",
+"i c #013F3A",
+"j c #00273F",
+"k c #81B09C",
+"l c #CAE1CE",
+"m c #D1E7D3",
+"n c #86B4A0",
+"o c #4E9885",
+"p c #3F8A76",
+"q c #2A6C60",
+"r c #064646",
+"s c #002831",
+"t c #7AAD99",
+"u c #C8E1CD",
+"v c #BAD8C3",
+"w c #77AC98",
+"x c #4B9783",
+"y c #408B77",
+"z c #307465",
+"A c #094B4E",
+"B c #002A24",
+"C c #7EB09C",
+"D c #CCE4D0",
+"E c #AFD0BB",
+"F c #6BA693",
+"G c #489581",
+"H c #418E7A",
+"I c #337868",
+"J c #0D4F54",
+"K c #002C22",
+"L c #7AAE9A",
+"M c #C4E0CB",
+"N c #A4C8B2",
+"O c #66A490",
+"P c #46947F",
+"Q c #428F7A",
+"R c #357C6B",
+"S c #115355",
+"T c #002E22",
+"U c #002869",
+"V c #88B9A8",
+"W c #87B6A2",
+"X c #C5E1CC",
+"Y c #9FC4AF",
+"Z c #5DA08D",
+"` c #428F7B",
+" . c #377E6D",
+".. c #135555",
+"+. c #003124",
+"@. c #00275F",
+"#. c #001B3C",
+"$. c #8DBCAE",
+"%. c #7EB19D",
+"&. c #B9D9C2",
+"*. c #95BDA8",
+"=. c #5A9988",
+"-. c #4F7666",
+";. c #466F5F",
+">. c #357868",
+",. c #18595A",
+"'. c #003426",
+"). c #00275D",
+"!. c #001931",
+"~. c #9CC4B8",
+"{. c #75AC98",
+"]. c #AFD1BB",
+"^. c #8CAD9A",
+"/. c #B2ACA7",
+"(. c #C08F8E",
+"_. c #792D2C",
+":. c #271C19",
+"<. c #174A50",
+"[. c #003628",
+"}. c #00275C",
+"|. c #02202F",
+"1. c #D3E4DE",
+"2. c #80B5A4",
+"3. c #73AA97",
+"4. c #A9CBB6",
+"5. c #BDB3AC",
+"6. c #F7F0F0",
+"7. c #CB9B9B",
+"8. c #6B2222",
+"9. c #1B0404",
+"0. c #131112",
+"a. c #012E23",
+"b. c #002559",
+"c. c #042C31",
+"d. c #01120F",
+"e. c #ECEEEA",
+"f. c #C5DAD1",
+"g. c #76B09E",
+"h. c #75AC97",
+"i. c #A6AA9B",
+"j. c #E2C8C8",
+"k. c #DEC0C0",
+"l. c #AE6C6C",
+"m. c #460E0E",
+"n. c #150303",
+"o. c #110303",
+"p. c #07120D",
+"q. c #001F47",
+"r. c #042E2B",
+"s. c #03231D",
+"t. c #01110D",
+"u. c #E3E9E4",
+"v. c #82B7A5",
+"w. c #78B19E",
+"x. c #78AD98",
+"y. c #A88E86",
+"z. c #BF8686",
+"A. c #8D3E3E",
+"B. c #2F0808",
+"C. c #140303",
+"D. c #0D0604",
+"E. c #000F22",
+"F. c #04251F",
+"G. c #052D25",
+"H. c #032B23",
+"I. c #EFEFEC",
+"J. c #8ABCAB",
+"K. c #82B6A4",
+"L. c #7BB2A0",
+"M. c #79AB98",
+"N. c #A56F6B",
+"O. c #B77878",
+"P. c #AD6868",
+"Q. c #7C2A2A",
+"R. c #2C0707",
+"S. c #100403",
+"T. c #000A15",
+"U. c #041411",
+"V. c #052922",
+"W. c #064034",
+"X. c #04362C",
+"Y. c #EBEDEA",
+"Z. c #92C0B1",
+"`. c #7CB3A1",
+" + c #7EB4A2",
+".+ c #76A391",
+"++ c #9F5B5A",
+"@+ c #AA6363",
+"#+ c #A35959",
+"$+ c #742323",
+"%+ c #2A0707",
+"&+ c #020B13",
+"*+ c #050F0C",
+"=+ c #05201B",
+"-+ c #063D32",
+";+ c #095747",
+">+ c #064135",
+",+ c #DDE6E1",
+"'+ c #8ABBAA",
+")+ c #80B5A3",
+"!+ c #6EA18F",
+"~+ c #975150",
+"{+ c #A65E5E",
+"]+ c #9F5353",
+"^+ c #712020",
+"/+ c #280606",
+"(+ c #130303",
+"_+ c #280707",
+":+ c #030B13",
+"<+ c #050E0B",
+"[+ c #051914",
+"}+ c #06352B",
+"|+ c #095545",
+"1+ c #0A5A4A",
+"2+ c #084E3F",
+"3+ c #BAD5CB",
+"4+ c #81B6A5",
+"5+ c #80B6A3",
+"6+ c #6FA795",
+"7+ c #8A4846",
+"8+ c #9A4C4C",
+"9+ c #974747",
+"0+ c #671A1A",
+"a+ c #220606",
+"b+ c #120303",
+"c+ c #631818",
+"d+ c #030B15",
+"e+ c #050E0C",
+"f+ c #051712",
+"g+ c #052C24",
+"h+ c #074D3F",
+"i+ c #0A5C4C",
+"j+ c #0A5848",
+"k+ c #0A5C4B",
+"l+ c #0A6350",
+"m+ c #8DBFAE",
+"n+ c #84B8A7",
+"o+ c #7FB5A2",
+"p+ c #7BB3A0",
+"q+ c #7AB2A0",
+"r+ c #7DB4A2",
+"s+ c #81B6A3",
+"t+ c #6CA996",
+"u+ c #6F4C45",
+"v+ c #792222",
+"w+ c #802A2A",
+"x+ c #591111",
+"y+ c #1D0505",
+"z+ c #420D0D",
+"A+ c #572020",
+"B+ c #020D14",
+"C+ c #051512",
+"D+ c #052720",
+"E+ c #095A4B",
+"F+ c #095646",
+"G+ c #0A5849",
+"H+ c #0A5B4B",
+"I+ c #0A5A49",
+"J+ c #7FB5A3",
+"K+ c #6BA795",
+"L+ c #6E8173",
+"M+ c #470F0E",
+"N+ c #571010",
+"O+ c #3B0A0A",
+"P+ c #170404",
+"Q+ c #1C0505",
+"R+ c #5A1111",
+"S+ c #200E10",
+"T+ c #030C12",
+"U+ c #051612",
+"V+ c #05251F",
+"W+ c #063A2F",
+"X+ c #095848",
+"Y+ c #0A5949",
+"Z+ c #085142",
+"`+ c #7BB3A1",
+" @ c #6EA997",
+".@ c #74A794",
+"+@ c #423430",
+"@@ c #1C0404",
+"#@ c #360909",
+"$@ c #280909",
+"%@ c #010A12",
+"&@ c #030D10",
+"*@ c #050F0D",
+"=@ c #051814",
+"-@ c #052721",
+";@ c #06382E",
+">@ c #095546",
+",@ c #074C3E",
+"'@ c #58A894",
+")@ c #6CAE9B",
+"!@ c #81B6A4",
+"~@ c #6DA695",
+"{@ c #5B9B88",
+"]@ c #789888",
+"^@ c #221715",
+"/@ c #2C0808",
+"(@ c #2D0A0A",
+"_@ c #040D0A",
+":@ c #000B18",
+"<@ c #040D0F",
+"[@ c #05110F",
+"}@ c #051C16",
+"|@ c #063A30",
+"1@ c #095344",
+"2@ c #0A5B4A",
+"3@ c #095647",
+"4@ c #074B3D",
+"5@ c #053D32",
+"6@ c #18866E",
+"7@ c #3C9681",
+"8@ c #6DAE9B",
+"9@ c #7DB3A1",
+"0@ c #70A998",
+"a@ c #428776",
+"b@ c #82B09C",
+"c@ c #658E7D",
+"d@ c #342E28",
+"e@ c #3E1A17",
+"f@ c #141616",
+"g@ c #000E0A",
+"h@ c #000C1E",
+"i@ c #040E0E",
+"j@ c #051511",
+"k@ c #063E33",
+"l@ c #085344",
+"m@ c #084C3E",
+"n@ c #042F26",
+"o@ c #021F19",
+"p@ c #084D3E",
+"q@ c #0C5344",
+"r@ c #2F806E",
+"s@ c #60A895",
+"t@ c #75AD9B",
+"u@ c #307365",
+"v@ c #6DA793",
+"w@ c #76AA97",
+"x@ c #4C7E6F",
+"y@ c #34332C",
+"z@ c #091616",
+"A@ c #000C0D",
+"B@ c #000C21",
+"C@ c #041311",
+"D@ c #051B16",
+"E@ c #052821",
+"F@ c #05362C",
+"G@ c #032C24",
+"H@ c #021D18",
+"I@ c #02211B",
+"J@ c #042B23",
+"K@ c #145345",
+"L@ c #38806F",
+"M@ c #5DA592",
+"N@ c #72AE9C",
+"O@ c #24635D",
+"P@ c #4C927F",
+"Q@ c #70A995",
+"R@ c #529784",
+"S@ c #29524A",
+"T@ c #021B19",
+"U@ c #000E1A",
+"V@ c #00112E",
+"W@ c #041916",
+"X@ c #031B16",
+"Y@ c #021B16",
+"Z@ c #011411",
+"`@ c #011915",
+" # c #021E19",
+".# c #021C17",
+"+# c #03221C",
+"@# c #083B31",
+"## c #11525B",
+"$# c #2C7166",
+"%# c #5FA08D",
+"&# c #559A87",
+"*# c #195957",
+"=# c #00281E",
+"-# c #001B46",
+";# c #00173B",
+"># c #010C0B",
+",# c #010F0C",
+"'# c #01110F",
+")# c #023637",
+"!# c #0D5058",
+"~# c #377D6D",
+"{# c #2E7369",
+"]# c #05443F",
+"^# c #002742",
+"/# c #00276C",
+"(# c #001D42",
+"_# c #003E2F",
+":# c #05413A",
+"<# c #023930",
+"[# c #002A31",
+"}# c #00286B",
+"|# c #002727",
+"1# c #002651",
+"2# c #00286C",
+" ",
+" ",
+" . + @ # ",
+" . $ % & * = ",
+" - ; > , ' ) ",
+" ! ~ { ] ^ / ( _ ",
+" : < [ } | 1 2 3 ",
+" 4 5 6 7 8 9 0 a ",
+" b c d e f g h i j _ ",
+" k l m n o p q r s _ ",
+" t u v w x y z A B _ ",
+" C D E F G H I J K _ ",
+" L M N O P Q R S T U ",
+" V W X Y Z P ` ...+.@.#. ",
+" $.%.&.*.=.-.;.>.,.'.).!. ",
+" ~.{.].^./.(._.:.<.[.}.|. ",
+" 1.2.3.4.5.6.7.8.9.0.a.b.c.d. ",
+" e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t. ",
+" u.v.w.x.y.7.z.A.B.C.o.D.E.F.G.H. ",
+" I.J.K.L.M.N.O.P.Q.R.C.o.S.T.U.V.W.X. ",
+" Y.Z.`. + +.+++@+#+$+%+C.o.o.&+*+=+-+;+>+ ",
+" ,+'+`.)+`.)+!+~+{+]+^+/+(+(+_+:+<+[+}+|+1+2+ ",
+" I.3+4+K.`.)+L.5+6+7+8+9+0+a+b+a+c+d+e+f+g+h+i+j+k+l+ ",
+" m+n+o+`.p+q+r+s+`.t+u+v+w+x+y+b+z+A+B+e+C+D+W.E+F+G+H+I+ ",
+" J+`.K.q+)+L.)+ +q+K+L+M+N+O+P+Q+R+S+T+*+U+V+W+X+Y+;+i+Z+ ",
+" q+`.`+`+o+ +`.J+`+ @.@+@%+@@(+#@$@%@&@*@=@-@;@>@Y+X+i+,@ ",
+" '@)@`.!@`+r+`+J+r+~@{@]@^@(+/@(@_@:@<@[@}@V.|@1@2@3@4@5@ ",
+" 6@7@8@q+)+`. +9@0@a@b@c@d@e@f@g@h@i@j@=+g+k@l@m@n@o@ ",
+" p@q@r@s@r+L.5+t@u@v@w@x@y@z@A@B@C@D@E@G.F@G@o@H@ ",
+" I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ # ",
+" .#+#@###$#%#&#*#=#-#;#>#,#'# ",
+" )#!#~#{#]#^#/#(# ",
+" _#:#<#[#}#_ ",
+" |#1#2#_ ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/recipes/kobodeluxe/files/kobodeluxe-dimension-autoswap.patch b/recipes/kobodeluxe/files/kobodeluxe-dimension-autoswap.patch
new file mode 100644
index 0000000000..273e523103
--- /dev/null
+++ b/recipes/kobodeluxe/files/kobodeluxe-dimension-autoswap.patch
@@ -0,0 +1,236 @@
+Index: KoboDeluxe-0.5.1/graphics/gfxengine.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/graphics/gfxengine.cpp 2008-02-11 13:17:27.000000000 +0100
++++ KoboDeluxe-0.5.1/graphics/gfxengine.cpp 2008-02-11 15:27:57.000000000 +0100
+@@ -135,11 +135,13 @@
+
+ _width = w;
+ _height = h;
++
+ if(csengine)
+ cs_engine_set_size(csengine, w, h);
+
+ if(was_showing)
+ show();
++
+ }
+
+ void gfxengine_t::centered(int c)
+@@ -759,33 +761,13 @@
+ Display show/hide
+ ----------------------------------------------------------*/
+
+-int gfxengine_t::show()
++/** Helper method that returns the flags value needed for
++ * SDL_SetVideoMode() and SDL_VideoModeOK().
++ */
++int gfxengine_t::video_flags()
+ {
+ int flags = 0;
+
+- if(!is_open)
+- return -1;
+-
+- if(is_showing)
+- return 0;
+-
+- if(_centered && !_fullscreen)
+-#if HAVE_DECL_SDL_PUTENV
+- SDL_putenv("SDL_VIDEO_CENTERED=1");
+-#elif defined(HAVE_PUTENV)
+- putenv("SDL_VIDEO_CENTERED=1");
+-#else
+- #error Neither SDL_putenv() nor putenv() are available. Fix it!
+-#endif
+-
+- log_printf(DLOG, "Opening screen...\n");
+- if(!SDL_WasInit(SDL_INIT_VIDEO))
+- if(SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
+- {
+- log_printf(ELOG, "Failed to initialize SDL!\n");
+- return -2;
+- }
+-
+ switch(_driver)
+ {
+ case GFX_DRIVER_SDL2D:
+@@ -830,11 +812,72 @@
+ glSDL_VSync(_vsync);
+ flags |= xflags;
+
++ return flags;
++}
++
++bool gfxengine_t::check_mode_autoswap(int *w, int *h)
++{
++ log_printf(VLOG, "Trying display modes %dx%d and %dx%d if the first fails.\n", *w, *h, *h, *w);
++
++ int flags = video_flags();
++
++ SDL_Surface *test_surface = NULL;
++
++ // On some platforms SDL_VideoModeOK() cannot be trusted unfortunately.
++ if(!(test_surface = SDL_SetVideoMode(*w, *h, _depth, flags)))
++ {
++ if(!(test_surface = SDL_SetVideoMode(*h, *w, _depth, flags)))
++ {
++ log_printf(ELOG, "Failed with both display mode. Giving up!\n");
++ return false;
++ }
++
++ int temp = *w;
++ *w = *h;
++ *h = temp;
++
++ log_printf(VLOG, "Display dimensions swapped. Using %dx%d!\n", *w, *h);
++ }
++ else
++ log_printf(VLOG, "Stored display dimension worked. Using %dx%d!\n", *w, *h);
++
++ SDL_FreeSurface(test_surface);
++
++ return true;
++}
++
++int gfxengine_t::show()
++{
++ if(!is_open)
++ return -1;
++
++ if(is_showing)
++ return 0;
++
++ if(_centered && !_fullscreen)
++#if HAVE_DECL_SDL_PUTENV
++ SDL_putenv("SDL_VIDEO_CENTERED=1");
++#elif defined(HAVE_PUTENV)
++ putenv("SDL_VIDEO_CENTERED=1");
++#else
++ #error Neither SDL_putenv() nor putenv() are available. Fix it!
++#endif
++
++ log_printf(DLOG, "Opening screen...\n");
++ if(!SDL_WasInit(SDL_INIT_VIDEO))
++ if(SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
++ {
++ log_printf(ELOG, "Failed to initialize SDL!\n");
++ return -2;
++ }
++
++ int flags = video_flags();
++
+ screen_surface = SDL_SetVideoMode(_width, _height, _depth, flags);
+ if(!screen_surface)
+ {
+- log_printf(ELOG, "Failed to open display!\n");
+- return -3;
++ log_printf(ELOG, "Failed to open display with %dx%d! Giving up.\n", _width, _height);
++ return -3;
+ }
+
+ if(_driver != GFX_DRIVER_GLSDL)
+Index: KoboDeluxe-0.5.1/graphics/gfxengine.h
+===================================================================
+--- KoboDeluxe-0.5.1.orig/graphics/gfxengine.h 2008-02-11 13:24:51.000000000 +0100
++++ KoboDeluxe-0.5.1/graphics/gfxengine.h 2008-02-11 15:15:50.000000000 +0100
+@@ -54,6 +54,9 @@
+ class gfxengine_t
+ {
+ friend class window_t;
++
++ int video_flags();
++
+ public:
+ gfxengine_t();
+ virtual ~gfxengine_t();
+@@ -135,6 +138,7 @@
+ void title(const char *win, const char *icon);
+
+ /* Display show/hide */
++ bool check_mode_autoswap(int *, int *);
+ int show();
+ void hide();
+
+Index: KoboDeluxe-0.5.1/kobo.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/kobo.cpp 2008-02-11 13:16:24.000000000 +0100
++++ KoboDeluxe-0.5.1/kobo.cpp 2008-02-11 14:57:29.000000000 +0100
+@@ -641,8 +641,27 @@
+ gengine->title("Kobo Deluxe " VERSION, "kobodl");
+ gengine->driver((gfx_drivers_t)p->videodriver);
+
++ // Initializes gfxengine with all kinds of display properties.
++ // We need this at this point to make the autoswap check work
++ // properly. Since these properties are independent of other
++ // values that is no problem.
++ gengine->mode(0, p->fullscreen);
++ gengine->doublebuffer(p->doublebuf);
++ gengine->pages(p->pages);
++ gengine->vsync(p->vsync);
++ gengine->shadow(p->shadow);
++ gengine->cursor(0);
++
++ // Do the auto swap dance only if configured so.
++ if (prefs->autoswap)
++ {
++ if (!gengine->check_mode_autoswap(&p->width, &p->height))
++ return -1;
++ }
++
+ dw = p->width;
+ dh = p->height;
++
+ if(p->fullscreen)
+ {
+ // This game assumes 1:1 pixel aspect ratio, or 4:3
+@@ -696,13 +715,6 @@
+ yoffs = (int)((dh - gh) / 2 / gengine->yscale());
+ gengine->size(dw, dh);
+
+- gengine->mode(0, p->fullscreen);
+- gengine->doublebuffer(p->doublebuf);
+- gengine->pages(p->pages);
+- gengine->vsync(p->vsync);
+- gengine->shadow(p->shadow);
+- gengine->cursor(0);
+-
+ gengine->period(game.speed);
+ sound.period(game.speed);
+ gengine->timefilter(p->timefilter * 0.01f);
+Index: KoboDeluxe-0.5.1/prefs.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/prefs.cpp 2008-02-11 14:28:01.000000000 +0100
++++ KoboDeluxe-0.5.1/prefs.cpp 2008-02-11 14:30:15.000000000 +0100
+@@ -86,6 +86,7 @@
+ desc("Display Driver");
+ key("width", width, 640); desc("Horizontal Resolution");
+ key("height", height, 480); desc("Vertical Resolution");
++ yesno("autoswap", autoswap, 0); desc("Automatically swap display dimension");
+ key("aspect", aspect, 1000); desc("Pixel Aspect Ratio");
+ key("depth", depth, 0); desc("Display Depth");
+ key("maxfps", max_fps, 100); desc("Maximum fps");
+Index: KoboDeluxe-0.5.1/prefs.h
+===================================================================
+--- KoboDeluxe-0.5.1.orig/prefs.h 2008-02-11 14:28:01.000000000 +0100
++++ KoboDeluxe-0.5.1/prefs.h 2008-02-11 14:31:24.000000000 +0100
+@@ -76,6 +76,7 @@
+ int videodriver; //Internal video driver
+ int width; //Screen/window width
+ int height; //Screen/window height
++ int autoswap; // Automatically swap dimensions if initialization fails
+ int aspect; //Pixel aspect ratio * 1000
+ int depth; //Bits per pixel
+ int max_fps; //Maximum fps
+Index: KoboDeluxe-0.5.1/states.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/states.cpp 2008-02-11 14:32:13.000000000 +0100
++++ KoboDeluxe-0.5.1/states.cpp 2008-02-11 15:00:13.000000000 +0100
+@@ -117,6 +117,8 @@
+ switch (button)
+ {
+ case BTN_EXIT:
++ gsm.push(&st_ask_exit);
++ break;
+ case BTN_CLOSE:
+ gsm.push(&st_main_menu);
+ break;
diff --git a/recipes/kobodeluxe/files/kobodeluxe-menu-pointer.patch b/recipes/kobodeluxe/files/kobodeluxe-menu-pointer.patch
new file mode 100644
index 0000000000..160d3ce896
--- /dev/null
+++ b/recipes/kobodeluxe/files/kobodeluxe-menu-pointer.patch
@@ -0,0 +1,266 @@
+Index: KoboDeluxe-0.5.1/README
+===================================================================
+--- KoboDeluxe-0.5.1.orig/README 2008-02-11 01:10:23.000000000 +0100
++++ KoboDeluxe-0.5.1/README 2008-02-11 01:17:30.000000000 +0100
+@@ -39,6 +39,12 @@
+ key diagonals. Escape enters the meny system, from where it is possi-
+ ble to change settings, start a new game or exit the game.
+
++ In case the touchscreen support has been compiled in the menu can be
++ controlled by clicking the frame borders. Touching the inner part of
++ the screen is like a button press. In the game mode a click in the
++ upper right corner activates pause mode and the lower right corner es-
++ capes to the menu.
++
+ OPTIONS
+ Note that all relevant options can be also configured in the config
+ file, which can be edited directly, or using the options menus in the
+Index: KoboDeluxe-0.5.1/config.h
+===================================================================
+--- KoboDeluxe-0.5.1.orig/config.h 2008-02-11 00:23:20.000000000 +0100
++++ KoboDeluxe-0.5.1/config.h 2008-02-11 02:01:17.000000000 +0100
+@@ -95,6 +95,15 @@
+ #define MARGIN 8
+
+ /*
++ * Fraction of the screen size in which clicks are not considered
++ * clicks but movements in that direction (as regarded from the
++ * center of the screen) or other special things (pause & exit).
++ *
++ * Used only in touchscreen mode.
++ */
++#define POINTER_MARGIN_PERCENT 10
++
++/*
+ * (In XKobo, WSIZE was used where this is
+ * used now; in the game logic code.)
+ *
+Index: KoboDeluxe-0.5.1/configure.in
+===================================================================
+--- KoboDeluxe-0.5.1.orig/configure.in 2008-02-11 00:37:18.000000000 +0100
++++ KoboDeluxe-0.5.1/configure.in 2008-02-11 00:48:59.000000000 +0100
+@@ -195,6 +195,16 @@
+ CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
+ fi
+
++AC_ARG_ENABLE(
++ touchscreen,
++ [AS_HELP_STRING(
++ [--enable-touchscreen],
++ [Compile menu control support suitable for touchscreens (default is no)])],
++ AC_DEFINE(
++ [ENABLE_TOUCHSCREEN],
++ [1],
++ [Set to 1 if the menusystem should support touchscreen input]),
++ [])
+
+ dnl-------------------------------------------------------
+ dnl Checks for header files.
+Index: KoboDeluxe-0.5.1/kobo.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/kobo.cpp 2008-02-11 00:24:57.000000000 +0100
++++ KoboDeluxe-0.5.1/kobo.cpp 2008-02-11 16:02:23.000000000 +0100
+@@ -28,6 +28,8 @@
+ // Use this to benchmark and create a new percentage table!
+ #undef TIME_PROGRESS
+
++#include <aconfig.h>
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+@@ -671,6 +673,10 @@
+ gh = dh;
+ }
+
++#if ENABLE_TOUCHSCREEN
++ gengine->setup_pointer_margin(dw, dh);
++#endif
++
+ // Scaling has 16ths granularity, so tiles scale properly!
+ gengine->scale((int)((gw * 16 + 8) / SCREEN_WIDTH) / 16.f,
+ (int)((gh * 16 + 8) / SCREEN_HEIGHT) / 16.f);
+@@ -1599,6 +1605,23 @@
+ {
+ }
+
++#ifdef ENABLE_TOUCHSCREEN
++void kobo_gfxengine_t::setup_pointer_margin(int dw, int dh)
++{
++ // Precalculates the border ranges. Mouse clicks outside these are handled
++ // specially.
++ pointer_margin_width_min = dw * POINTER_MARGIN_PERCENT / 100;
++ pointer_margin_width_max = dw - dw * POINTER_MARGIN_PERCENT / 100;
++ pointer_margin_height_min = dh * POINTER_MARGIN_PERCENT / 100;
++ pointer_margin_height_max = dh - dh * POINTER_MARGIN_PERCENT / 100;
++
++ log_printf(VLOG, "Pointer margin range [%d, %d, %d, %d]\n",
++ pointer_margin_width_min,
++ pointer_margin_width_max,
++ pointer_margin_height_min,
++ pointer_margin_height_max);
++}
++#endif
+
+ void kobo_gfxengine_t::frame()
+ {
+@@ -1800,11 +1823,57 @@
+ mouse_y - MARGIN - WSIZE/2);
+ break;
+ case SDL_MOUSEBUTTONDOWN:
+- mouse_x = (int)(ev.motion.x / gengine->xscale()) - km.xoffs;
+- mouse_y = (int)(ev.motion.y / gengine->yscale()) - km.yoffs;
+- gsm.press(BTN_FIRE);
++ mouse_x = (int)(ev.button.x / gengine->xscale()) - km.xoffs;
++ mouse_y = (int)(ev.button.y / gengine->yscale()) - km.yoffs;
+ if(prefs->use_mouse)
+ {
++#if ENABLE_TOUCHSCREEN
++ if (ev.motion.x <= pointer_margin_width_min)
++ {
++ gsm.press(BTN_LEFT);
++ pointer_margin_used = true;
++ } else if (ev.motion.x >= pointer_margin_width_max)
++ {
++ // Upper right corner invokes pause.
++ // Lower right corner invokes exit.
++ // Otherwise it is just 'right'. :)
++ if (ev.motion.y <= pointer_margin_height_min)
++ {
++ gsm.press(BTN_PAUSE);
++ gamecontrol.press(BTN_PAUSE);
++ }
++ else
++ gsm.press((ev.motion.y >= pointer_margin_height_max
++ ? BTN_EXIT
++ : BTN_RIGHT));
++
++ pointer_margin_used = true;
++
++ }
++
++ if (ev.motion.y <= pointer_margin_height_min)
++ {
++ // Handle as 'up' only if it was not in the 'pause' area.
++ // Still handle as clicked, so 'fire' will not kick in.
++ if (ev.motion.x < pointer_margin_width_max)
++ gsm.press(BTN_UP);
++ pointer_margin_used = true;
++ } else if (ev.motion.y >= pointer_margin_height_max)
++ {
++ // Handle as 'down' only if it was not in the 'exit' area.
++ // Still handle as clicked, so 'fire' will not kick in.
++ if (ev.motion.x < pointer_margin_width_max)
++ gsm.press(BTN_DOWN);
++
++ pointer_margin_used = true;
++ }
++
++ if (!pointer_margin_used)
++ gsm.press(BTN_FIRE);
++#else
++ gsm.press(BTN_FIRE);
++#endif
++
+ gamecontrol.mouse_position(
+ mouse_x - 8 - MARGIN - WSIZE/2,
+ mouse_y - MARGIN - WSIZE/2);
+@@ -1824,10 +1893,24 @@
+ }
+ break;
+ case SDL_MOUSEBUTTONUP:
+- mouse_x = (int)(ev.motion.x / gengine->xscale()) - km.xoffs;
+- mouse_y = (int)(ev.motion.y / gengine->yscale()) - km.yoffs;
++ mouse_x = (int)(ev.button.x / gengine->xscale()) - km.xoffs;
++ mouse_y = (int)(ev.button.y / gengine->yscale()) - km.yoffs;
+ if(prefs->use_mouse)
+ {
++#if ENABLE_TOUCHSCREEN
++ // Resets all kinds of buttons that might have been activated by
++ // clicking in the pointer margin.
++ if (pointer_margin_used)
++ {
++ gsm.release(BTN_EXIT);
++ gsm.release(BTN_LEFT);
++ gsm.release(BTN_RIGHT);
++ gsm.release(BTN_UP);
++ gsm.release(BTN_DOWN);
++ pointer_margin_used = false;
++ }
++#endif
++
+ gamecontrol.mouse_position(
+ mouse_x - 8 - MARGIN - WSIZE/2,
+ mouse_y - MARGIN - WSIZE/2);
+@@ -2078,6 +2161,19 @@
+ int main(int argc, char *argv[])
+ {
+ int cmd_exit = 0;
++
++ printf(PACKAGE " - " VERSION " (touchscreen support: %s)\n",
++ (ENABLE_TOUCHSCREEN ? "yes" : "no"));
++ puts("Copyright (c) 1995, 1996 Akira Higuchi\n"
++ "Copyright (C) 1997 Masanao Izumo\n"
++ "Copyright (C) 1999-2001 Simon Peter\n"
++ "Copyright (C) 2002 Florian Schulze\n"
++ "Copyright (C) 2002 Jeremy Sheeley\n"
++ "Copyright (C) 2005 Erik Auerswald\n"
++ "Copyright (c) 1999-2007 David Olofson\n"
++ "This is free software; see the source for copying conditions. There is NO\n"
++ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
++
+ atexit(emergency_close);
+ signal(SIGTERM, breakhandler);
+ signal(SIGINT, breakhandler);
+Index: KoboDeluxe-0.5.1/kobo.h
+===================================================================
+--- KoboDeluxe-0.5.1.orig/kobo.h 2008-02-11 00:31:23.000000000 +0100
++++ KoboDeluxe-0.5.1/kobo.h 2008-02-11 02:19:29.000000000 +0100
+@@ -23,6 +23,8 @@
+ #ifndef _KOBO_H_
+ #define _KOBO_H_
+
++#include <aconfig.h>
++
+ #include "gfxengine.h"
+ #include "window.h"
+ #include "display.h"
+@@ -45,11 +47,25 @@
+
+ class kobo_gfxengine_t : public gfxengine_t
+ {
++#if ENABLE_TOUCHSCREEN
++ bool pointer_margin_used;
++
++ int pointer_margin_width_min;
++ int pointer_margin_width_max;
++ int pointer_margin_height_min;
++ int pointer_margin_height_max;
++#endif
++
+ void frame();
+ void pre_render();
+ void post_render();
+ public:
+ kobo_gfxengine_t();
++
++#if ENABLE_TOUCHSCREEN
++ void setup_pointer_margin(int, int);
++#endif
++
+ };
+
+ extern kobo_gfxengine_t *gengine;
+Index: KoboDeluxe-0.5.1/states.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/states.cpp 2008-02-11 03:06:41.000000000 +0100
++++ KoboDeluxe-0.5.1/states.cpp 2008-02-11 15:42:55.000000000 +0100
+@@ -963,8 +963,6 @@
+ break;
+
+ case BTN_FIRE:
+- if(!prefs->use_joystick)
+- break;
+ case BTN_START:
+ case BTN_SELECT:
+ sound.ui_ok();
diff --git a/recipes/kobodeluxe/files/kobodeluxe-putenv.patch b/recipes/kobodeluxe/files/kobodeluxe-putenv.patch
new file mode 100644
index 0000000000..05f7c72f81
--- /dev/null
+++ b/recipes/kobodeluxe/files/kobodeluxe-putenv.patch
@@ -0,0 +1,69 @@
+Index: KoboDeluxe-0.5.1/configure.in
+===================================================================
+--- KoboDeluxe-0.5.1.orig/configure.in 2008-02-10 12:27:11.000000000 +0100
++++ KoboDeluxe-0.5.1/configure.in 2008-02-10 15:50:11.000000000 +0100
+@@ -159,7 +159,6 @@
+ )
+ LIBS="$LIBS -lSDL_image"
+
+-
+ dnl-------------------------------------------------------
+ dnl Checks for OpenGL
+ dnl-------------------------------------------------------
+@@ -214,13 +213,18 @@
+ dnl-------------------------------------------------------
+ dnl Checks for library functions.
+ dnl-------------------------------------------------------
++dnl SDL_putenv may not be available in all SDL ports
++AC_CHECK_DECLS(SDL_putenv,,,[#include <SDL.h>])
++
+ AC_CHECK_FUNCS(strdup strstr strchr strrchr)
+ AC_CHECK_FUNCS(snprintf _snprintf vsnprintf _vsnprintf)
+ AC_CHECK_FUNCS(pow sqrt)
+ AC_CHECK_FUNCS(munmap mkdir select stat)
+ AC_CHECK_FUNCS(atexit floor memmove memset memcmp)
+-AC_CHECK_FUNCS(gettimeofday)
++AC_CHECK_FUNCS(gettimeofday putenv)
+ AC_CHECK_FUNCS(getegid setgid)
++
++
+ AC_FUNC_MEMCMP
+ AC_FUNC_STRTOD
+ AC_FUNC_VPRINTF
+Index: KoboDeluxe-0.5.1/graphics/gfxengine.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/graphics/gfxengine.cpp 2008-02-10 12:41:31.000000000 +0100
++++ KoboDeluxe-0.5.1/graphics/gfxengine.cpp 2008-02-10 15:58:06.000000000 +0100
+@@ -21,10 +21,15 @@
+
+ #define DBG(x) x
+
++#include <aconfig.h>
++
+ #include "logger.h"
+
+ #include <string.h>
+ #include <math.h>
++#if not (HAVE_DECL_SDL_PUTENV) and defined (HAVE_PUTENV)
++#include <stdlib.h>
++#endif
+
+ #include "gfxengine.h"
+ #include "filters.h"
+@@ -764,8 +769,14 @@
+ if(is_showing)
+ return 0;
+
+- if(_centered && !_fullscreen)
+- SDL_putenv((char *)"SDL_VIDEO_CENTERED=1");
++ if(_centered && !_fullscreen)
++#if HAVE_DECL_SDL_PUTENV
++ SDL_putenv("SDL_VIDEO_CENTERED=1");
++#elif defined(HAVE_PUTENV)
++ putenv("SDL_VIDEO_CENTERED=1");
++#else
++ #error Neither SDL_putenv() nor putenv() are available. Fix it!
++#endif
+
+ log_printf(DLOG, "Opening screen...\n");
+ if(!SDL_WasInit(SDL_INIT_VIDEO))
diff --git a/recipes/kobodeluxe/files/kobodeluxe-sysconf-support.patch b/recipes/kobodeluxe/files/kobodeluxe-sysconf-support.patch
new file mode 100644
index 0000000000..1f62b31d71
--- /dev/null
+++ b/recipes/kobodeluxe/files/kobodeluxe-sysconf-support.patch
@@ -0,0 +1,84 @@
+Index: KoboDeluxe-0.5.1/configure.in
+===================================================================
+--- KoboDeluxe-0.5.1.orig/configure.in 2008-02-10 20:51:37.000000000 +0100
++++ KoboDeluxe-0.5.1/configure.in 2008-02-10 21:40:09.000000000 +0100
+@@ -36,6 +36,7 @@
+ SCOREDIR='$(sharedstatedir)/kobo-deluxe/scores'
+ CONFIGDIR='HOME>>'
+ CONFIGFILE='.kobodlrc'
++USE_SYSCONF=1
+ EXEFILE=kobodl
+ case "$target_os" in
+ linux*)
+@@ -57,6 +58,7 @@
+ SCOREDIR='EXE>>scores'
+ CONFIGDIR='EXE>>'
+ CONFIGFILE='kobodl.cfg'
++ USE_SYSCONF=0
+ EXEFILE=kobodl.exe
+ MATHLIB=""
+ ;;
+@@ -68,6 +70,7 @@
+ SCOREDIR='EXE>>scores'
+ CONFIGDIR='EXE>>'
+ CONFIGFILE='kobodl.cfg'
++ USE_SYSCONF=0
+ EXEFILE=kobodl.exe
+ MATHLIB=""
+ ;;
+@@ -105,10 +108,12 @@
+ AM_CONDITIONAL(BUILD_MACOSX_BUNDLE, test x$build_macosx_bundle = xyes)
+ AM_CONDITIONAL(BUILD_SIMPLE_BUNDLE, test x$build_simple_bundle = xyes)
+ AM_CONDITIONAL(UNIX_SCOREDIR, test x$unix_scoredir = xyes)
++AC_DEFINE_UNQUOTED([USE_SYSCONF], [$USE_SYSCONF], [Define to 1 to use Unix-style sysconf dir for default configuration.])
+ AC_SUBST(DATADIR)
+ AC_SUBST(SCOREDIR)
+ AC_SUBST(CONFIGDIR)
+ AC_SUBST(CONFIGFILE)
++AC_SUBST(KOBO_SYSCONF)
+ AC_SUBST(EXEFILE)
+ AC_SUBST(MATHLIB)
+
+Index: KoboDeluxe-0.5.1/kobo.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/kobo.cpp 2008-02-10 20:57:32.000000000 +0100
++++ KoboDeluxe-0.5.1/kobo.cpp 2008-02-10 21:27:22.000000000 +0100
+@@ -1293,9 +1293,38 @@
+ FILE *f = fmap->fopen(KOBO_CONFIG_DIR "/" KOBO_CONFIG_FILE, "r");
+ if(f)
+ {
++ log_puts(VLOG, "Loading personal configuration from: "\
++ KOBO_CONFIG_DIR "/" KOBO_CONFIG_FILE "\n");
+ p->read(f);
+ fclose(f);
+ }
++#if USE_SYSCONF
++ /* On Unixen, where they have SYSCONF_DIR (usually /etc) try to get
++ * the default configuration from a file stored there before
++ * giving up.
++ *
++ * This gives packagers a chance to provide a proper default
++ * (playable) configuration for all those little Linux-based
++ * gadgets that are flying around.
++ */
++ else
++ {
++ f = fmap->fopen(SYSCONF_DIR "/kobo-deluxe/default-config", "r");
++ if(f)
++ {
++ log_puts(VLOG, "Loading configuration defaults from: "\
++ SYSCONF_DIR "/kobo-deluxe/default-config\n");
++
++ p->read(f);
++ fclose(f);
++ }
++ else
++ log_puts(VLOG, "Using built-in configuration defaults.\n");
++
++ }
++#else
++ log_puts(VLOG, "Using built-in configuration defaults.\n");
++#endif
+ }
+
+