From a4972abe61de6c6f25650616e23bbd040b661752 Mon Sep 17 00:00:00 2001 From: rogerman Date: Mon, 4 Jan 2016 23:12:40 +0000 Subject: [PATCH] Linux Port: - Fix compiling for GTK and Glade ports. --- desmume/src/gtk-glade/callbacks.cpp | 2 +- desmume/src/gtk-glade/callbacks_IO.cpp | 2 +- desmume/src/gtk/main.cpp | 58 ++++++-------------------- 3 files changed, 14 insertions(+), 48 deletions(-) diff --git a/desmume/src/gtk-glade/callbacks.cpp b/desmume/src/gtk-glade/callbacks.cpp index b697ec757..13a642694 100755 --- a/desmume/src/gtk-glade/callbacks.cpp +++ b/desmume/src/gtk-glade/callbacks.cpp @@ -221,7 +221,7 @@ static void Printscreen() gchar *filename; GError *error = NULL; u8 *rgb; - u16 *gpuFramebuffer = GPU->GetNativeFramebuffer(); + u16 *gpuFramebuffer = GPU->GetDisplayInfo().masterNativeBuffer; static int seq = 0; rgb = (u8 *) malloc(SCREENS_PIXEL_SIZE*3); diff --git a/desmume/src/gtk-glade/callbacks_IO.cpp b/desmume/src/gtk-glade/callbacks_IO.cpp index 4ffac4f09..f707ba939 100755 --- a/desmume/src/gtk-glade/callbacks_IO.cpp +++ b/desmume/src/gtk-glade/callbacks_IO.cpp @@ -117,7 +117,7 @@ static void decode_screen () { int x,y, m, W,H,L,BL; u32 image[RAW_H*2][RAW_W], pix; - u16 * pixel = GPU->GetNativeFramebuffer(); + u16 * pixel = GPU->GetDisplayInfo().masterNativeBuffer; u32 * rgb32 = &on_screen_image32[0]; /* decode colors */ diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 78b84a661..750ac15de 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -2414,36 +2414,17 @@ gboolean EmuLoop(gpointer data) // HUD display things (copied from Windows main.cpp) #ifdef HAVE_LIBAGG - gfx3d.frameCtrRaw++; - if(gfx3d.frameCtrRaw == 60) { - Hud.fps3d = gfx3d.frameCtr; - gfx3d.frameCtrRaw = 0; - gfx3d.frameCtr = 0; - } + Hud.fps3d = Render3DFramesPerSecond; + if(nds.idleFrameCounter==0 || oneSecond) { - //calculate a 16 frame arm9 load average - for(int cpu=0;cpu<2;cpu++) - { - int load = 0; - //printf("%d: ",cpu); - for(int i=0;i<16;i++) - { - //blend together a few frames to keep low-framerate games from having a jittering load average - //(they will tend to work 100% for a frame and then sleep for a while) - //4 frames should handle even the slowest of games - s32 sample = - nds.runCycleCollector[cpu][(i+0+nds.idleFrameCounter)&15] - + nds.runCycleCollector[cpu][(i+1+nds.idleFrameCounter)&15] - + nds.runCycleCollector[cpu][(i+2+nds.idleFrameCounter)&15] - + nds.runCycleCollector[cpu][(i+3+nds.idleFrameCounter)&15]; - sample /= 4; - load = load/8 + sample*7/8; - } - //printf("\n"); - load = std::min(100,std::max(0,(int)(load*100/1120380))); - Hud.cpuload[cpu] = load; - } + u32 loadAvgARM9; + u32 loadAvgARM7; + NDS_GetCPULoadAverage(loadAvgARM9, loadAvgARM7); + + Hud.cpuload[ARMCPU_ARM9] = (int)loadAvgARM9; + Hud.cpuload[ARMCPU_ARM7] = (int)loadAvgARM7; + } Hud.cpuloopIterationCount = nds.cpuloopIterationCount; #endif @@ -2466,12 +2447,7 @@ gboolean EmuLoop(gpointer data) for (i = 0; i < Frameskip; i++) { NDS_SkipNextFrame(); #ifdef HAVE_LIBAGG - gfx3d.frameCtrRaw++; - if(gfx3d.frameCtrRaw == 60) { - Hud.fps3d = gfx3d.frameCtr; - gfx3d.frameCtrRaw = 0; - gfx3d.frameCtr = 0; - } + Hud.fps3d = Render3DFramesPerSecond; #endif desmume_cycle(); skipped_frames++; @@ -2484,12 +2460,7 @@ gboolean EmuLoop(gpointer data) for (i = 0; i < Frameskip; i++) { NDS_SkipNextFrame(); #ifdef HAVE_LIBAGG - gfx3d.frameCtrRaw++; - if(gfx3d.frameCtrRaw == 60) { - Hud.fps3d = gfx3d.frameCtr; - gfx3d.frameCtrRaw = 0; - gfx3d.frameCtr = 0; - } + Hud.fps3d = Render3DFramesPerSecond; #endif desmume_cycle(); skipped_frames++; @@ -2511,12 +2482,7 @@ gboolean EmuLoop(gpointer data) // Aggressively skip frames to avoid delay NDS_SkipNextFrame(); #ifdef HAVE_LIBAGG - gfx3d.frameCtrRaw++; - if(gfx3d.frameCtrRaw == 60) { - Hud.fps3d = gfx3d.frameCtr; - gfx3d.frameCtrRaw = 0; - gfx3d.frameCtr = 0; - } + Hud.fps3d = Render3DFramesPerSecond; #endif desmume_cycle(); skipped_frames++;