#!/usr/bin/make
-CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11 xsp) -I/usr/include/hgw
-LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11 xsp) -lpopt -lhgw
-
-# Default CFLAGS for building in N8x0
-ARCH ?= armel
-CFLAGS ?= -DMAEMO -DMAEMO_VERSION=4 -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -O2 -g -Wall -static-libgcc
-ASFLAGS ?= -march=armv6j -mfpu=vfp -mfloat-abi=softfp -g
-CXXFLAGS ?= $(CFLAGS)
-
-# Default CFLAGS for building in PC
-#ARCH := i386
-#CFLAGS := -DMAEMO -DMAEMO_VERSION=4 -O2 -g -Wall
-#ASFLAGS := -g
-#CXXFLAGS := $(CFLAGS)
-
-GAME_VERSION ?= $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g')-git
-export GAME_VERSION
+CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11) -I/usr/include/hgw
+LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11) -lpopt -lhgw
+
+-include config.mk
+
+# GUI needs this
export DESTDIR
# Configuration settings
CONF_BUILD_ASM_CPU=0
CONF_BUILD_ASM_SPC700=0
CONF_BUILD_ASM_SA1=0 # Still not there
+CONF_XSP=0
+# Sane defaults (override if needed)
ifeq ($(ARCH),armel)
CONF_BUILD_ASM_CPU=1
CONF_BUILD_ASM_SPC700=1
+ CONF_XSP=1
CONF_BUILD_MISC_ROUTINES=misc_armel
else ifeq ($(ARCH),i386)
CONF_BUILD_MISC_ROUTINES=misc_i386
OBJS += sa1cpu.o
endif
+ifeq ($(CONF_XSP), 1)
+ CPPFLAGS += -DCONF_XSP=1 $(shell pkg-config --cflags xsp)
+ LDLIBS += $(shell pkg-config --libs xsp)
+endif
+
OBJS += $(CONF_BUILD_MISC_ROUTINES).o
# from open-whatever sdk
gui:
$(MAKE) -C gui all
-
+
gui_clean:
$(MAKE) -C gui clean
-
+
.PHONY: all clean remake deps install gui gui_clean
Standards-Version: 3.7.2
Package: drnoksnes
-Architecture: armel
+Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, osso-games-startup
ifelse(eval(MAEMO_MAJOR < 5), 1, `Pre-Depends: maemo-select-menu-location', `dnl')
Description: Super Nintendo Entertainment System emulator
')dnl
Package: drnoksnes-dbg
-Architecture: armel
+Architecture: any
Section: devel
Depends: drnoksnes (= ${Source-Version})
Description: Debug symbols for the DrNokSnes emulator
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
# Determine Maemo version
MAEMO_VERSION := $(shell cut -d"." -f1 /etc/maemo_version)
# Determine app version from debian changelog
GAME_VERSION := $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g')
+# Default CFLAGS
CFLAGS = -Wall -g -DMAEMO -DMAEMO_VERSION=$(MAEMO_VERSION)
-GUI_CFLAGS := $(CFLAGS)
+GUI_CFLAGS := -fPIC -shared $(CFLAGS)
LDFLAGS = -Wl,-z,defs
+GUI_LDFLAGS := -export-dynamic -avoid-version -module -shared $(LDFLAGS)
+ASFLAGS = -g
M4=m4
M4DEFS=-DMAEMO_MAJOR=$(MAEMO_VERSION)
+# Architecture specific CFLAGS
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
-else ifneq (,$(findstring arm,$(DEB_BUILD_GNU_TYPE)))
+else ifneq (,$(findstring armel,$(ARCH)))
CFLAGS += -O2
GUI_CFLAGS += -Os
ifneq (,$(findstring vfp,$(DEB_BUILD_OPTIONS)))
CFLAGS += -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp
+ ASFLAGS += -march=armv6j -mfpu=vfp -mfloat-abi=softfp
endif
- # Fixes hang while exiting on Diablo.
+ # Fixes hang while exiting in Diablo.
CFLAGS += -static-libgcc
-else # x86
- crash ## Cannot build in x86
+else ifneq (,$(findstring i386,$(ARCH)))
+ CFLAGS += -O2
+ GUI_CFLAGS += -O2
+else
+ # Don't support anything else yet
+ crash
endif
debian/control: debian/control.m4
dh_testdir
$(M4) $(M4DEFS) debian/control.m4 > debian/control
$(M4) $(M4DEFS) debian/drnoksnes.postinst.m4 > debian/drnoksnes.postinst
+
+ echo ARCH="$(ARCH)" > config.mk
+ echo ASFLAGS="$(ASFLAGS)" >> config.mk
+ echo CFLAGS="$(CFLAGS)" >> config.mk
+ echo CXXFLAGS="$(CFLAGS)" >> config.mk
+ echo LDFLAGS="$(LDFLAGS)" >> config.mk
+
+ echo CFLAGS="$(GUI_CFLAGS)" > gui/config.mk
+ echo LDFLAGS="$(GUI_LDFLAGS)" >> gui/config.mk
+ echo GAME_VERSION="$(GAME_VERSION)" >> gui/config.mk
+
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
- $(MAKE) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" GUI_CFLAGS="$(GUI_CFLAGS)" GAME_VERSION="$(GAME_VERSION)"
+ $(MAKE)
touch $@
clean:
dh_testroot
rm -f build-stamp configure-stamp
-$(MAKE) clean
+ rm -f config.mk gui/config.mk
dh_clean
install: build
CPPFLAGS:=$(shell pkg-config --cflags $(PKGS)) -DGAME_VERSION=$(GAME_VERSION)
LDLIBS:=$(shell pkg-config --libs $(PKGS))
-ifdef GUI_CFLAGS
- override CFLAGS:=$(GUI_CFLAGS)
-else
- override CFLAGS:= -g -Os -Wall -fpic -shared -DMAEMO
-endif
-ifdef GUI_LDFLAGS
- override LDFLAGS:=$(GUI_LDFLAGS)
-else
- override LDFLAGS:= -export-dynamic -avoid-version -module -shared -Wl,-z,defs
-endif
+-include config.mk
#GAME_VERSION
GAME_SHARE_PATH=/usr/share/games/drnoksnes
gtk_box_pack_start(framerate_box, GTK_WIDGET(framerate_combo), FALSE, FALSE, 0);
#endif
- gtk_combo_box_append_text(framerate_combo, "Best");
+ gtk_combo_box_append_text(framerate_combo, "Auto");
for (i = 1; i < 10; i++) {
gchar buffer[20];
sprintf(buffer, "%d-%d", 50/i, 60/i);
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include <X11/extensions/Xsp.h>
#include <SDL.h>
#include <SDL_syswm.h>
+#if CONF_XSP
+# include <X11/extensions/Xsp.h>
+#endif
+
#include "snes9x.h"
#include "platform.h"
#include "display.h"
/** Inside the surface, where are we drawing */
static SDL_Rect renderArea;
-#ifdef MAEMO
+#if CONF_XSP
static void setDoubling(bool enable)
{
SDL_SysWMinfo wminfo;
GUI.Width = windowSize.w;
GUI.Height = windowSize.h;
}
-
+#else
+ GUI.Width = gameWidth;
+ GUI.Height = gameHeight;
+#endif
+#if CONF_XSP
// So, can we enable Xsp?
if (gameWidth * 2 < GUI.Width && gameHeight * 2 < GUI.Height) {
Config.xsp = true;
setDoubling(false); // Before switching video modes; avoids flicker.
}
#else
- GUI.Width = gameWidth;
- GUI.Height = gameHeight;
+ Config.xsp = false;
#endif
// Safeguard
GFX.PixSize = screen->format->BitsPerPixel / 8;
// Ok, calculate renderArea
-#ifdef MAEMO
+#if CONF_XSP
if (Config.xsp) {
setDoubling(true);
centerRectangle(renderArea, GUI.Width, GUI.Height,
GUI.RenderW = renderArea.w;
GUI.RenderH = renderArea.h;
-#ifdef MAEMO
+#if CONF_XSP
if (Config.xsp) {
// Do not update 2x the area.
renderArea.w /= 2;
void S9xVideoOutputFocus(bool hasFocus)
{
+#if CONF_XSP
if (Config.xsp) {
setDoubling(hasFocus);
}
+#endif
}
// This is here for completeness, but palette mode is useless on N8x0