From 264b0987e86d6033b93fbabf468c6800e725ca9a Mon Sep 17 00:00:00 2001 From: riccardom Date: Wed, 17 Feb 2010 14:06:00 +0000 Subject: [PATCH] Let desmume build without libagg libagg is used only by the HUD but the usage of it outside windows is pretty small. So just in case it is not available we can live without it. --- desmume/configure.ac | 2 +- desmume/src/GPU_osd.h | 19 ++++++++++++++++++- desmume/src/GPU_osd_stub.cpp | 32 ++++++++++++++++++++++++++++++++ desmume/src/Makefile.am | 9 +++++---- desmume/src/NDSSystem.cpp | 2 ++ desmume/src/cli/main.cpp | 2 ++ desmume/src/gtk/main.cpp | 2 ++ desmume/src/types.h | 1 + 8 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 desmume/src/GPU_osd_stub.cpp diff --git a/desmume/configure.ac b/desmume/configure.ac index 472ea4006..21624be5e 100644 --- a/desmume/configure.ac +++ b/desmume/configure.ac @@ -195,7 +195,7 @@ AM_CONDITIONAL([HAVE_LIBAGG], [test "${HAVE_LIBAGG}" = "yes"]) if test "x$HAVE_LIBAGG" = "xyes"; then AC_DEFINE([HAVE_LIBAGG]) else - AC_MSG_ERROR([Antigrain library is required to build desmume]) + AC_MSG_WARN([Antigrain library not found, HUD will be disabled]) fi if test "x$FOUND_GLIB" = "xno"; then diff --git a/desmume/src/GPU_osd.h b/desmume/src/GPU_osd.h index a95885e86..4303bb754 100644 --- a/desmume/src/GPU_osd.h +++ b/desmume/src/GPU_osd.h @@ -24,9 +24,11 @@ #ifndef __GPU_OSD_ #define __GPU_OSD_ +#include "types.h" + +#ifdef HAVE_LIBAGG #include #include -#include "types.h" #include "aggdraw.h" @@ -125,4 +127,19 @@ public: }; extern OSDCLASS *osd; +#else /* HAVE_LIBAGG */ +void DrawHUD(); + +class OSDCLASS { +public: + OSDCLASS(u8 core); + ~OSDCLASS(); + void update(); + void clear(); + void setLineColor(u8 r, u8 b, u8 g); + void addLine(const char *fmt, ...); +}; + +extern OSDCLASS *osd; +#endif #endif diff --git a/desmume/src/GPU_osd_stub.cpp b/desmume/src/GPU_osd_stub.cpp new file mode 100644 index 000000000..a3edbe866 --- /dev/null +++ b/desmume/src/GPU_osd_stub.cpp @@ -0,0 +1,32 @@ +/* Copyright (C) 2006-2010 DeSmumE team + + This file is part of DeSmuME + + DeSmuME is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DeSmuME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "types.h" +#include "GPU_osd.h" + +OSDCLASS *osd; + +OSDCLASS::OSDCLASS(u8 core) {} +OSDCLASS::~OSDCLASS() {} +void OSDCLASS::update() {} +void OSDCLASS::clear() {} +void OSDCLASS::setLineColor(u8 r, u8 b, u8 g) {} +void OSDCLASS::addLine(const char *fmt, ...) {} + +void DrawHUD() {} diff --git a/desmume/src/Makefile.am b/desmume/src/Makefile.am index 5ec22b21c..a36759749 100644 --- a/desmume/src/Makefile.am +++ b/desmume/src/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/src/desmume.mk -AM_CPPFLAGS += $(SDL_CFLAGS) $(GTHREAD_CFLAGS) $(X_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS) +AM_CPPFLAGS += $(SDL_CFLAGS) $(GTHREAD_CFLAGS) $(X_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS) EXTRA_DIST = build.bat instruction_tabdef.inc thumb_tabdef.inc fs-linux.cpp fs-windows.cpp if HAVE_GDB_STUB @@ -14,7 +14,6 @@ libdesmume_a_SOURCES = \ armcpu.cpp armcpu.h \ arm_instructions.cpp arm_instructions.h \ agg2d.h agg2d.inl \ - aggdraw.cpp aggdraw.h \ bios.cpp bios.h bits.h cp15.cpp cp15.h \ commandline.h commandline.cpp \ common.cpp common.h \ @@ -22,7 +21,7 @@ libdesmume_a_SOURCES = \ Disassembler.cpp Disassembler.h \ emufile.h emufile.cpp fat.h FIFO.cpp FIFO.h \ firmware.cpp firmware.h GPU.cpp GPU.h \ - GPU_osd.cpp GPU_osd.h \ + GPU_osd.h \ mem.h mc.cpp mc.h \ path.h \ readwrite.cpp readwrite.h \ @@ -66,7 +65,9 @@ endif endif if HAVE_LIBAGG -libdesmume_a_SOURCES += aggdraw.cpp +libdesmume_a_SOURCES += aggdraw.cpp aggdraw.h GPU_osd.cpp +else +libdesmume_a_SOURCES += GPU_osd_stub.cpp endif if HAVE_LUA AM_CPPFLAGS += $(LUA_CFLAGS) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 3c59d2bb9..133d58db5 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -73,8 +73,10 @@ void Desmume_InitOnce() if(initOnce) return; initOnce = true; +#ifdef HAVE_LIBAGG extern void Agg_init(); //no need to include just for this Agg_init(); +#endif } #ifdef GDB_STUB diff --git a/desmume/src/cli/main.cpp b/desmume/src/cli/main.cpp index 5f4b5e101..25200969e 100644 --- a/desmume/src/cli/main.cpp +++ b/desmume/src/cli/main.cpp @@ -825,9 +825,11 @@ int main(int argc, char ** argv) { loadstate_slot(my_config.load_slot); } +#ifdef HAVE_LIBAGG Desmume_InitOnce(); Hud.reset(); aggDraw.hud->attach(GPU_screen, 256, 384, 512); +#endif while(!sdl_quit) { desmume_cycle(&sdl_quit, &boost, &my_config); diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 830457b90..7cfed3a82 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -2043,9 +2043,11 @@ common_gtk_main( struct configured_features *my_config) my_config->disable_sound); /* Init the hud / osd stuff */ +#ifdef HAVE_LIBAGG Desmume_InitOnce(); Hud.reset(); aggDraw.hud->attach(GPU_screen, 256, 384, 512); +#endif /* * Activate the GDB stubs diff --git a/desmume/src/types.h b/desmume/src/types.h index 79c44a45d..85aa2d0ac 100644 --- a/desmume/src/types.h +++ b/desmume/src/types.h @@ -34,6 +34,7 @@ #ifdef _MSC_VER #define HAVE_WX + #define HAVE_LIBAGG #define ENABLE_SSE #define ENABLE_SSE2 #ifdef DEVELOPER