From dd05ece216b1fb052cf7b16c263d2e26e08cb541 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 12 Jul 2009 03:43:28 +0000 Subject: [PATCH] fix linux compiling and add hud to gtk. wont display anything until someone adds menu items for CommonOptions toggles, but it will eventually. --- desmume/src/GPU_osd.cpp | 6 ++++-- desmume/src/NDSSystem.cpp | 9 +++++++++ desmume/src/NDSSystem.h | 2 ++ desmume/src/gtk/Makefile.am | 2 +- desmume/src/gtk/main.cpp | 3 +++ desmume/src/mic.h | 3 ++- desmume/src/windows/main.cpp | 3 +-- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/GPU_osd.cpp index 300971c66..e37c3255a 100644 --- a/desmume/src/GPU_osd.cpp +++ b/desmume/src/GPU_osd.cpp @@ -50,7 +50,7 @@ bool IsHudDummy (HudCoordinates *hud) void EditHud(s32 x, s32 y, HudStruct *hudstruct) { - UINT i = 0; + u32 i = 0; while (!IsHudDummy(&hudstruct->hud(i))) { HudCoordinates &hud = hudstruct->hud(i); @@ -89,7 +89,7 @@ void EditHud(s32 x, s32 y, HudStruct *hudstruct) { void HudClickRelease(HudStruct *hudstruct) { - UINT i = 0; + u32 i = 0; while (!IsHudDummy(&hudstruct->hud(i))) { HudCoordinates &hud = hudstruct->hud(i); @@ -238,10 +238,12 @@ void DrawHUD() osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames); } + #ifdef WIN32 if (CommonSettings.hud.ShowMicrophone) { osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay); } + #endif DrawStateSlots(); } diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index d2ace4b0e..e0d97e156 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -478,6 +478,15 @@ copy_firmware_user_data( u8 *dest_buffer, const u8 *fw_data) { return copy_good; } +void Desmume_InitOnce() +{ + static bool initOnce = false; + if(initOnce) return; + initOnce = true; + + extern void Agg_init(); //no need to include just for this + Agg_init(); +} #ifdef GDB_STUB int NDS_Init( struct armcpu_memory_iface *arm9_mem_if, diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 9f5cd1e56..0b2193eba 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -267,6 +267,8 @@ int NDS_Init( struct armcpu_memory_iface *arm9_mem_if, int NDS_Init ( void); #endif +void Desmume_InitOnce(); + void NDS_DeInit(void); void NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config); diff --git a/desmume/src/gtk/Makefile.am b/desmume/src/gtk/Makefile.am index fd9195051..432903bbe 100644 --- a/desmume/src/gtk/Makefile.am +++ b/desmume/src/gtk/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = doc include $(top_srcdir)/src/desmume.mk -AM_CPPFLAGS += $(SDL_CFLAGS) $(GTK_CFLAGS) $(GTHREAD_CFLAGS) $(ALSA_CFLAGS) +AM_CPPFLAGS += $(SDL_CFLAGS) $(GTK_CFLAGS) $(GTHREAD_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS) Applicationsdir = $(datadir)/applications Applications_DATA = desmume.desktop diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 3b3a6a23d..5faa64f04 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -46,6 +46,7 @@ #include "dTool.h" #include "desmume_config.h" #include "cheatsGTK.h" +#include "GPU_osd.h" #include "commandline.h" @@ -1088,6 +1089,7 @@ static int ExposeDrawingArea (GtkWidget *widget, GdkEventExpose *event, gpointer yd = yoff; } + DrawHUD(); gpu_screen_to_rgb(rgb, SCREENS_PIXEL_SIZE*SCREEN_BYTES_PER_PIXEL); origPixbuf = gdk_pixbuf_new_from_data(rgb, GDK_COLORSPACE_RGB, 0, 8, imgW, imgH, imgW*SCREEN_BYTES_PER_PIXEL, NULL, NULL); @@ -1742,6 +1744,7 @@ static gboolean timeout_exit_cb(gpointer data) static int common_gtk_main( struct configured_features *my_config) { + Desmume_InitOnce(); SDL_TimerID limiter_timer = NULL; GtkAccelGroup * accel_group; diff --git a/desmume/src/mic.h b/desmume/src/mic.h index c7478c145..b2d8e117c 100644 --- a/desmume/src/mic.h +++ b/desmume/src/mic.h @@ -6,9 +6,10 @@ extern int MicButtonPressed; #ifdef WIN32 static char MicSampleName[256]; char* LoadSample(const char *name); -extern int MicDisplay; #endif +extern int MicDisplay; + #ifdef FAKE_MIC void Mic_DoNoise(BOOL); #endif diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 82161be72..7a4534e25 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1342,8 +1342,7 @@ std::string GetPrivateProfileStdString(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR int _main() { - extern void Agg_init(); - Agg_init(); + Desmume_InitOnce(); InitDecoder(); #ifdef WX_STUB