diff -Nur instead-3.2.0/Rules.caanoo instead-3.2.0-caanoo/Rules.caanoo
--- instead-3.2.0/Rules.caanoo	1970-01-01 03:00:00.000000000 +0300
+++ instead-3.2.0-caanoo/Rules.caanoo	2018-01-14 09:06:18.044628618 +0300
@@ -0,0 +1,45 @@
+VERSION := 3.2.1
+
+PREFIX  = /home/peter/Devel/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi
+CC        = $(PREFIX)/bin/arm-gph-linux-gnueabi-gcc
+STRIP     = $(PREFIX)/bin/arm-gph-linux-gnueabi-strip
+
+CFLAGS     += -DARM_ARCH -DGP2X_BUILD
+CFLAGS     += -DWIZ_BUILD -DCAANOO
+CFLAGS     += -O3 -std=c99 -msoft-float -funsigned-char -fno-common -fno-builtin -Wl,--allow-multiple-definition
+CFLAGS     += -I../SDL-1.2.13/include `$(PREFIX)/arm-gph-linux-gnueabi/sys-root/usr/bin/sdl-config --cflags` -I$(PREFIX)/include
+
+DESTDIR=
+BIN=
+DATAPATH=.
+STEADPATH=$(DATAPATH)/stead
+THEMESPATH=$(DATAPATH)/themes
+GAMESPATH=$(DATAPATH)/games
+ICONPATH=$(DATAPATH)/icon
+LANGPATH=$(DATAPATH)/lang
+DOCPATH=
+MANPATH=
+SYSTEMSETUP=no
+
+ZLIB_CFLAGS=
+ZLIB_LFLAGS=-lz
+
+LUA_CFLAGS=-I./caanoo/lua/
+LUA_LFLAGS=./caanoo/lua/liblua.a
+
+SDL_CFLAGS=
+SDL_LFLAGS=-lSDL -lSDL_mixer -lSDL_image -lSDL_ttf -lm -ldl -lpthread -lz
+
+CFLAGS	+= -g -Wall -Dunix -D_USE_UNPACK -D_LOCAL_APPDATA -D_HAVE_ICONV -D_SDL_MOD_BUG
+
+INSTALLD=echo "Do not install standalone version!"
+INSTALLB=echo "Do not install standalone version!"
+INSTALL=echo "Do not install standalone version!"
+LN=echo "Do not install standalone version!"
+
+EXE=
+PLATFORM=unix.c
+RESOURCES=
+RM=rm
+AR=ar rc
+RANLIB=ranlib
diff -Nur instead-3.2.0/src/game.c instead-3.2.0-caanoo/src/game.c
--- instead-3.2.0/src/game.c	2018-01-14 09:04:22.000000000 +0300
+++ instead-3.2.0-caanoo/src/game.c	2018-01-14 09:06:18.044628618 +0300
@@ -3300,7 +3300,7 @@
 #else
 		game_menu(menu_askquit);
 #endif
-	} else if ((alt_pressed | control_pressed) && (!is_key(ev, "q") || !is_key(ev, "f4"))) {
+	} else if (!is_key(ev, "quit") || ((alt_pressed | control_pressed) && (!is_key(ev, "q") || !is_key(ev, "f4")))) {
 		game_running = 0;
 		return -1;
 	} else if (alt_pressed &&
diff -Nur instead-3.2.0/src/graphics.c instead-3.2.0-caanoo/src/graphics.c
--- instead-3.2.0/src/graphics.c	2018-01-14 09:04:22.000000000 +0300
+++ instead-3.2.0-caanoo/src/graphics.c	2018-01-14 09:07:34.697288401 +0300
@@ -2219,18 +2219,25 @@
 #else
 int gfx_set_mode(int w, int h, int fs)
 {
+	int maxbpp = 32;
 	int hw = (software_sw)?0:SDL_HWSURFACE;
 	SDL_Surface *scr;
 	game_reset_name();
 	if (gfx_width == w && gfx_height == h && gfx_fs == fs) {
 		return 0; /* already done */
 	}
+#ifdef CAANOO
+	maxbpp = 16;
+#endif
 	vid_modes = NULL;
 	gfx_fs = fs;
 	gfx_width = w;
 	gfx_height = h;
 	if (!nocursor_sw)
 		SDL_ShowCursor(SDL_DISABLE);
+#ifdef CAANOO
+ 	scr = SDL_SetVideoMode(gfx_width, gfx_height, maxbpp, ((gfx_fs)?SDL_HWSURFACE:0) | ( ( fs ) ? SDL_FULLSCREEN : 0 ) );
+#else
 #ifdef S60
 	scr = SDL_SetVideoMode(gfx_width, gfx_height, 0, SDL_ANYFORMAT | hw | ( ( fs ) ? SDL_FULLSCREEN : 0 ) );
 #else
@@ -2258,6 +2265,7 @@
   #endif
  #endif
 #endif
+#endif
 	screen = GFX_IMG_REL(scr);
 	if (scr == NULL || screen == NULL) {
 		fprintf(stderr, "Unable to set %dx%d video: %s\n", w, h, SDL_GetError());
@@ -5663,7 +5671,7 @@
 		SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
 #endif
 #endif
-	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
+	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) < 0) {
 		fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
 		return -1;
 	}
diff -Nur instead-3.2.0/src/input.c instead-3.2.0-caanoo/src/input.c
--- instead-3.2.0/src/input.c	2018-01-14 09:04:22.000000000 +0300
+++ instead-3.2.0-caanoo/src/input.c	2018-01-14 09:06:18.044628618 +0300
@@ -30,6 +30,41 @@
 static int m_focus = 1;
 static int m_minimized = 0;
 
+#ifdef CAANOO
+static const char *joy_map(int button)
+{
+	switch(button) {
+	case 2:
+		return "left";
+	case 6:
+		return "right";
+	case 0:
+		return "up";
+	case 4:
+		return "down";
+	case 15:
+		return "space"; //y
+	case 14:
+		return "tab"; //x
+	case 12:
+		return "escape"; // a
+	case 18:
+	case 13:
+		return "return"; // b
+	case 8:
+		return "quit";
+	case 10:
+		return "page up";
+	case 11:
+		return "page down";
+	case 9:
+	case 20:
+		return "f1";
+	}
+	return "";
+}
+#endif
+
 int minimized(void)
 {
 	if (nopause_sw)
@@ -182,6 +217,10 @@
 #if defined(IOS) || defined(ANDROID)
 	SDL_SetEventFilter(HandleAppEvents, NULL);
 #endif
+	if(SDL_NumJoysticks() > 0) {
+		SDL_JoystickOpen(0);
+		SDL_JoystickEventState(SDL_ENABLE);
+	}
 	return 0;
 }
 
@@ -414,6 +453,20 @@
 	case SDL_QUIT:
 		game_running = 0;
 		return -1;
+#ifdef CAANOO
+	case SDL_JOYBUTTONDOWN:
+		inp->type = KEY_DOWN;
+		inp->code = event.jbutton.button;
+		strncpy(inp->sym, joy_map(event.jbutton.button), sizeof(inp->sym));
+		inp->sym[sizeof(inp->sym) - 1] = 0;
+		break;
+	case SDL_JOYBUTTONUP:
+		inp->type = KEY_UP;
+		inp->code = event.jbutton.button;
+		strncpy(inp->sym, joy_map(event.jbutton.button), sizeof(inp->sym));
+		inp->sym[sizeof(inp->sym) - 1] = 0;
+		break;
+#endif
 	case SDL_KEYDOWN:	/* A key has been pressed */
 #if SDL_VERSION_ATLEAST(2,0,0)
 		if (event.key.repeat) {
