diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp
index 94c5737a1..dc7f069a3 100644
--- a/desmume/src/GPU.cpp
+++ b/desmume/src/GPU.cpp
@@ -42,7 +42,6 @@
#include "registers.h"
#include "gfx3d.h"
#include "debug.h"
-#include "GPU_osd.h"
#include "NDSSystem.h"
#include "readwrite.h"
#include "matrix.h"
@@ -6762,9 +6761,10 @@ GPUSubsystem::GPUSubsystem()
_willAutoResolveToCustomBuffer = true;
- OSDCLASS *previousOSD = osd;
- osd = new OSDCLASS(-1);
- delete previousOSD;
+ //TODO OSD
+ //OSDCLASS *previousOSD = osd;
+ //osd = new OSDCLASS(-1);
+ //delete previousOSD;
_displayInfo.colorFormat = NDSColorFormat_BGR555_Rev;
_displayInfo.pixelBytes = sizeof(u16);
@@ -6798,8 +6798,9 @@ GPUSubsystem::GPUSubsystem()
GPUSubsystem::~GPUSubsystem()
{
- delete osd;
- osd = NULL;
+ //TODO OSD
+ //delete osd;
+ //osd = NULL;
free_aligned(this->_customFramebuffer);
free_aligned(this->_customVRAM);
@@ -6876,7 +6877,9 @@ void GPUSubsystem::Reset()
this->_engineSub->Reset();
DISP_FIFOreset();
- osd->clear();
+
+ //historically, we reset the OSD here. maybe because we would want a clean drawing surface? anyway this is not the right point to be doing OSD work
+ //osd->clear();
}
void GPUSubsystem::ForceRender3DFinishAndFlush(bool willFlush)
diff --git a/desmume/src/GPU_osd_stub.cpp b/desmume/src/GPU_osd_stub.cpp
deleted file mode 100644
index b50e211fa..000000000
--- a/desmume/src/GPU_osd_stub.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright (C) 2010 DeSmumE team
-
- This file 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.
-
- This file 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 the this software. If not, see .
-*/
-
-#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/driver.cpp b/desmume/src/driver.cpp
index 558067c5d..0587a6813 100644
--- a/desmume/src/driver.cpp
+++ b/desmume/src/driver.cpp
@@ -22,6 +22,10 @@
#include "gfx3d.h"
#include "texcache.h"
+#if HAVE_LIBAGG
+#include "frontend/modules/osd/agg/agg_osd.h"
+#endif
+
static VIEW3D_Driver nullView3d;
BaseDriver::BaseDriver()
@@ -50,3 +54,15 @@ void BaseDriver::USR_InfoMessage(const char *message)
LOG("%s\n", message);
}
+void BaseDriver::AddLine(const char *fmt, ...)
+{
+#if HAVE_LIBAGG
+ osd->addLine(fmt);
+#endif
+}
+void BaseDriver::SetLineColor(u8 r, u8 b, u8 g)
+{
+#if HAVE_LIBAGG
+ osd->setLineColor(r,b,g);
+#endif
+}
\ No newline at end of file
diff --git a/desmume/src/driver.h b/desmume/src/driver.h
index 0105c7076..647cf29b0 100644
--- a/desmume/src/driver.h
+++ b/desmume/src/driver.h
@@ -70,6 +70,9 @@ public:
VIEW3D_Driver* view3d;
void VIEW3D_Shutdown();
void VIEW3D_Init();
+
+ virtual void AddLine(const char *fmt, ...);
+ virtual void SetLineColor(u8 r, u8 b, u8 g);
};
#endif //_DRIVER_H_
diff --git a/desmume/src/agg2d.h b/desmume/src/frontend/modules/osd/agg/agg2d.h
similarity index 100%
rename from desmume/src/agg2d.h
rename to desmume/src/frontend/modules/osd/agg/agg2d.h
diff --git a/desmume/src/agg2d.inl b/desmume/src/frontend/modules/osd/agg/agg2d.inl
similarity index 100%
rename from desmume/src/agg2d.inl
rename to desmume/src/frontend/modules/osd/agg/agg2d.inl
diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/frontend/modules/osd/agg/agg_osd.cpp
similarity index 99%
rename from desmume/src/GPU_osd.cpp
rename to desmume/src/frontend/modules/osd/agg/agg_osd.cpp
index 36bf9c133..35375f206 100644
--- a/desmume/src/GPU_osd.cpp
+++ b/desmume/src/frontend/modules/osd/agg/agg_osd.cpp
@@ -16,7 +16,7 @@
along with the this software. If not, see .
*/
-#include "GPU_osd.h"
+#include "agg_osd.h"
#include "driver.h"
#include "GPU.h"
#include "mem.h"
diff --git a/desmume/src/GPU_osd.h b/desmume/src/frontend/modules/osd/agg/agg_osd.h
similarity index 100%
rename from desmume/src/GPU_osd.h
rename to desmume/src/frontend/modules/osd/agg/agg_osd.h
diff --git a/desmume/src/aggdraw.cpp b/desmume/src/frontend/modules/osd/agg/aggdraw.cpp
similarity index 100%
rename from desmume/src/aggdraw.cpp
rename to desmume/src/frontend/modules/osd/agg/aggdraw.cpp
diff --git a/desmume/src/aggdraw.h b/desmume/src/frontend/modules/osd/agg/aggdraw.h
similarity index 100%
rename from desmume/src/aggdraw.h
rename to desmume/src/frontend/modules/osd/agg/aggdraw.h
diff --git a/desmume/src/frontend/posix/Makefile.am b/desmume/src/frontend/posix/Makefile.am
index 8f9832641..0b0bb525e 100644
--- a/desmume/src/frontend/posix/Makefile.am
+++ b/desmume/src/frontend/posix/Makefile.am
@@ -215,9 +215,7 @@ libdesmume_a_SOURCES += ../../metaspu/SndOut.cpp ../../metaspu/SndOut.h ../../me
endif
if HAVE_LIBAGG
-libdesmume_a_SOURCES += ../../aggdraw.cpp ../../aggdraw.h ../../GPU_osd.cpp
-else
-libdesmume_a_SOURCES += ../../GPU_osd_stub.cpp
+libdesmume_a_SOURCES += ../../frontend/modules/osd/agg/aggdraw.cpp ../../frontend/modules/osd/agg/aggdraw.h ../../frontend/modules/osd/agg/agg_osd.cpp
endif
if HAVE_LUA
AM_CPPFLAGS += $(LUA_CFLAGS)
diff --git a/desmume/src/frontend/posix/cli/main.cpp b/desmume/src/frontend/posix/cli/main.cpp
index b9419871a..3666f5f36 100644
--- a/desmume/src/frontend/posix/cli/main.cpp
+++ b/desmume/src/frontend/posix/cli/main.cpp
@@ -53,7 +53,7 @@
#include "../render3D.h"
#include "../rasterize.h"
#include "../saves.h"
-#include "../GPU_osd.h"
+#include "../frontend/modules/osd/agg/agg_osd.h"
#include "../shared/desmume_config.h"
#include "../commandline.h"
#include "../slot2.h"
@@ -765,8 +765,11 @@ int main(int argc, char ** argv) {
while(!ctrls_cfg.sdl_quit) {
desmume_cycle(&ctrls_cfg);
+#ifdef HAVE_LIBAGG
osd->update();
DrawHUD();
+#endif
+
#ifdef INCLUDE_OPENGL_2D
if ( my_config.opengl_2d) {
opengl_Draw( screen_texture, my_config.soft_colour_convert);
@@ -775,7 +778,10 @@ int main(int argc, char ** argv) {
else
#endif
Draw();
+
+#ifdef HAVE_LIBAGG
osd->clear();
+#endif
for ( int i = 0; i < my_config.frameskip; i++ ) {
NDS_SkipNextFrame();
diff --git a/desmume/src/frontend/posix/gtk/main.cpp b/desmume/src/frontend/posix/gtk/main.cpp
index 8b5052687..0d0bae2e4 100644
--- a/desmume/src/frontend/posix/gtk/main.cpp
+++ b/desmume/src/frontend/posix/gtk/main.cpp
@@ -51,7 +51,7 @@
#include "dTool.h"
#include "../shared/desmume_config.h"
#include "cheatsGTK.h"
-#include "GPU_osd.h"
+#include "frontend/modules/osd/agg/agg_osd.h"
#include "avout_x264.h"
#include "avout_flac.h"
@@ -2706,10 +2706,10 @@ static void ToggleAudio (GtkToggleAction *action)
config.audio_enabled = gtk_toggle_action_get_active(action);
if (config.audio_enabled) {
SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4);
- osd->addLine("Audio enabled");
+ driver->AddLine("Audio enabled");
} else {
SPU_ChangeSoundCore(0, 0);
- osd->addLine("Audio disabled");
+ driver->AddLine("Audio disabled");
}
RedrawScreen();
}
@@ -2721,9 +2721,9 @@ static void ToggleMicNoise (GtkToggleAction *action)
Mic_DoNoise(doNoise);
if (doNoise)
- osd->addLine("Fake mic enabled");
+ driver->AddLine("Fake mic enabled");
else
- osd->addLine("Fake mic disabled");
+ driver->AddLine("Fake mic disabled");
RedrawScreen();
}
#endif
@@ -2733,9 +2733,9 @@ static void ToggleFpsLimiter (GtkToggleAction *action)
config.fpslimiter = (BOOL)gtk_toggle_action_get_active(action);
if (config.fpslimiter)
- osd->addLine("Fps limiter enabled");
+ driver->AddLine("Fps limiter enabled");
else
- osd->addLine("Fps limiter disabled");
+ driver->AddLine("Fps limiter disabled");
RedrawScreen();
}
@@ -2746,11 +2746,11 @@ static void ToggleAutoFrameskip (GtkToggleAction *action)
if (config.autoframeskip) {
autoframeskip = true;
Frameskip = 0;
- osd->addLine("Auto frameskip enabled");
+ driver->AddLine("Auto frameskip enabled");
} else {
autoframeskip = false;
Frameskip = autoFrameskipMax;
- osd->addLine("Auto frameskip disabled");
+ driver->AddLine("Auto frameskip disabled");
}
RedrawScreen();
}
diff --git a/desmume/src/frontend/posix/shared/ctrlssdl.cpp b/desmume/src/frontend/posix/shared/ctrlssdl.cpp
index 4a7fe677e..9abff2bbe 100644
--- a/desmume/src/frontend/posix/shared/ctrlssdl.cpp
+++ b/desmume/src/frontend/posix/shared/ctrlssdl.cpp
@@ -21,11 +21,15 @@
#include "SPU.h"
#include "commandline.h"
#include "NDSSystem.h"
-#include "GPU_osd.h"
+#include "frontend/modules/osd/agg/agg_osd.h"
+#include "driver.h"
+
#ifdef FAKE_MIC
#include "mic.h"
#endif
+
+
u16 keyboard_cfg[NB_KEYS];
u16 joypad_cfg[NB_KEYS];
u16 nbr_joy;
@@ -481,7 +485,7 @@ process_ctrls_event( SDL_Event& event,
if (event.active.gain) {
cfg->focused = 1;
SPU_Pause(0);
- osd->addLine("Auto pause disabled");
+ driver->AddLine("Auto pause disabled");
} else {
cfg->focused = 0;
SPU_Pause(1);
@@ -515,18 +519,18 @@ process_ctrls_event( SDL_Event& event,
cfg->fake_mic = !cfg->fake_mic;
Mic_DoNoise(cfg->fake_mic);
if (cfg->fake_mic)
- osd->addLine("Fake mic enabled");
+ driver->AddLine("Fake mic enabled");
else
- osd->addLine("Fake mic disabled");
+ driver->AddLine("Fake mic disabled");
break;
#endif
case SDLK_o:
cfg->boost = !cfg->boost;
if (cfg->boost)
- osd->addLine("Boost mode enabled");
+ driver->AddLine("Boost mode enabled");
else
- osd->addLine("Boost mode disabled");
+ driver->AddLine("Boost mode disabled");
break;
case SDLK_LSHIFT:
diff --git a/desmume/src/frontend/windows/aviout.cpp b/desmume/src/frontend/windows/aviout.cpp
index 5bcb86e51..d15d1d6e2 100644
--- a/desmume/src/frontend/windows/aviout.cpp
+++ b/desmume/src/frontend/windows/aviout.cpp
@@ -25,12 +25,13 @@
#include "debug.h"
#include "console.h"
#include "gfx3d.h"
-#include "GPU_osd.h"
#include "SPU.h"
#include "video.h"
#include "windriver.h"
#include "main.h"
+#include "driver.h"
+#include "NDSSystem.h"
extern VideoInfo video;
@@ -397,7 +398,7 @@ bool DRV_AviBegin(const char* fname)
// Don't display at file splits
if(!avi_segnum) {
EMU_PrintMessage("AVI recording started.");
- osd->addLine("AVI recording started.");
+ driver->AddLine("AVI recording started.");
}
strncpy(saved_cur_avi_fnameandext,fname,MAX_PATH);
@@ -483,7 +484,7 @@ void DRV_AviEnd()
// Don't display if we're just starting another segment
if(avi_file->tBytes <= 2097152000) {
EMU_PrintMessage("AVI recording ended.");
- osd->addLine("AVI recording ended.");
+ driver->AddLine("AVI recording ended.");
}
avi_destroy(&avi_file);
diff --git a/desmume/src/frontend/windows/desmume.props b/desmume/src/frontend/windows/desmume.props
index badc6a0fe..26f2ef910 100644
--- a/desmume/src/frontend/windows/desmume.props
+++ b/desmume/src/frontend/windows/desmume.props
@@ -149,6 +149,9 @@
GDB_STUB=1;%(PreprocessorDefinitions)
EXPERIMENTAL_WIFI_COMM=1;%(PreprocessorDefinitions)
+
+ HAVE_LIBAGG=1;HAVE_JIT=1;HAVE_LUA=1;%(PreprocessorDefinitions)
+
diff --git a/desmume/src/frontend/windows/hotkey.cpp b/desmume/src/frontend/windows/hotkey.cpp
index c2873f797..7c61f0da0 100644
--- a/desmume/src/frontend/windows/hotkey.cpp
+++ b/desmume/src/frontend/windows/hotkey.cpp
@@ -29,8 +29,8 @@
#include "movie.h"
#include "SPU.h"
#include "GPU.h"
-#include "GPU_osd.h"
#include "path.h"
+#include "driver.h"
#include "frontend/modules/ImageOut.h"
#include "main.h"
@@ -108,7 +108,7 @@ void HK_CpuMode(int, bool justPressed)
char tmp[256];
sprintf(tmp,"CPU mode: %s", CommonSettings.use_jit?"JIT":"Interpreter");
- osd->addLine(tmp);
+ driver->AddLine(tmp);
//WritePrivateProfileInt("Emulation", "CpuMode", CommonSettings.use_jit, IniName)
}
@@ -120,7 +120,7 @@ void HK_JitBlockSizeDec(int, bool justPressed)
CommonSettings.jit_max_block_size--;
char tmp[256];
sprintf(tmp,"JIT block size changed to: %u", CommonSettings.jit_max_block_size);
- osd->addLine(tmp);
+ driver->AddLine(tmp);
arm_jit_reset(CommonSettings.use_jit, true);
}
@@ -132,7 +132,7 @@ void HK_JitBlockSizeInc(int, bool justPressed)
CommonSettings.jit_max_block_size++;
char tmp[256];
sprintf(tmp,"JIT block size changed to: %u", CommonSettings.jit_max_block_size);
- osd->addLine(tmp);
+ driver->AddLine(tmp);
arm_jit_reset(CommonSettings.use_jit, true);
}
#endif
@@ -278,7 +278,7 @@ void HK_StateSetSlot(int num, bool justPressed)
if (romloaded)
{
lastSaveState = num;
- osd->addLine("State %i selected", num);
+ driver->AddLine("State %i selected", num);
}
}
@@ -370,12 +370,12 @@ void HK_ToggleReadOnly(int, bool justPressed) {
if(movieMode == MOVIEMODE_FINISHED)
pMsg += sprintf(pMsg, " (finished)");
if(movieMode == MOVIEMODE_INACTIVE)
- osd->setLineColor(255,0,0);
+ driver->SetLineColor(255,0,0);
else if(movieMode == MOVIEMODE_FINISHED)
- osd->setLineColor(255,255,0);
+ driver->SetLineColor(255,255,0);
else
- osd->setLineColor(255,255,255);
- osd->addLine(msg);
+ driver->SetLineColor(255,255,255);
+ driver->AddLine(msg);
}
void HK_PlayMovie(int, bool justPressed)
@@ -454,7 +454,7 @@ void HK_NextSaveSlot(int, bool justPressed) {
lastSaveState++;
if(lastSaveState>9)
lastSaveState=0;
- osd->addLine("State %i selected", lastSaveState);
+ driver->AddLine("State %i selected", lastSaveState);
}
void HK_PreviousSaveSlot(int, bool justPressed) {
@@ -463,7 +463,7 @@ void HK_PreviousSaveSlot(int, bool justPressed) {
lastSaveState=9;
else
lastSaveState--;
- osd->addLine("State %i selected", lastSaveState);
+ driver->AddLine("State %i selected", lastSaveState);
}
void HK_Pause(int, bool justPressed) { if(justPressed) TogglePause(); }
@@ -491,18 +491,18 @@ void HK_ToggleRasterizer(int, bool justPressed) {
void HK_IncreasePressure(int, bool justPressed) {
CommonSettings.StylusPressure += 10;
if(CommonSettings.StylusPressure>100) CommonSettings.StylusPressure = 100;
- osd->addLine("Stylus Pressure to %d%%",CommonSettings.StylusPressure);
+ driver->AddLine("Stylus Pressure to %d%%",CommonSettings.StylusPressure);
}
void HK_DecreasePressure(int, bool justPressed) {
CommonSettings.StylusPressure -= 10;
if(CommonSettings.StylusPressure<0) CommonSettings.StylusPressure = 0;
- osd->addLine("Stylus Pressure to %d%%",CommonSettings.StylusPressure);
+ driver->AddLine("Stylus Pressure to %d%%",CommonSettings.StylusPressure);
}
void HK_ToggleStylusJitter(int, bool justPressed) {
CommonSettings.StylusJitter = !CommonSettings.StylusJitter;
nds.stylusJitter = CommonSettings.StylusJitter;
WritePrivateProfileBool("Emulation", "StylusJitter", CommonSettings.StylusJitter, IniName);
- osd->addLine("Stylus Jitter %s",CommonSettings.StylusJitter ? "On" : "Off");
+ driver->AddLine("Stylus Jitter %s",CommonSettings.StylusJitter ? "On" : "Off");
}
void HK_Rotate0(int, bool justPressed) { SetRotate(MainWindow->getHWnd(), 0);}
diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp
index 04c7f01cd..d54414c3f 100644
--- a/desmume/src/frontend/windows/main.cpp
+++ b/desmume/src/frontend/windows/main.cpp
@@ -48,7 +48,6 @@
#include "slot1.h"
#include "slot2.h"
#include "GPU.h"
-#include "GPU_osd.h"
#include "SPU.h"
#include "OGLRender.h"
#include "OGLRender_3_2.h"
@@ -83,8 +82,9 @@
#include "utils/xstring.h"
#include "directx/ddraw.h"
#include "video.h"
-#include "aggdraw.h"
-#include "agg2d.h"
+#include "frontend/modules/osd/agg/agg_osd.h"
+#include "frontend/modules/osd/agg/aggdraw.h"
+#include "frontend/modules/osd/agg/agg2d.h"
#include "winutil.h"
#include "ogl.h"
@@ -2769,6 +2769,8 @@ class WinDriver : public BaseDriver
return inFrameBoundary;
}
+
+
virtual eStepMainLoopResult EMU_StepMainLoop(bool allowSleep, bool allowPause, int frameSkip, bool disableUser, bool disableCore)
{
// this bit is here to handle calls through LUACALL_BEFOREEMULATION and in case Lua errors out while we're processing input
@@ -3196,7 +3198,9 @@ int _main()
CommonSettings.wifi.mode = GetPrivateProfileInt("Wifi", "Mode", 0, IniName);
CommonSettings.wifi.infraBridgeAdapter = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName);
-
+
+ osd = new OSDCLASS(-1);
+
NDS_Init();
GPU->SetCustomFramebufferSize(256*video.prescaleHD,192*video.prescaleHD);
//GPU->SetWillAutoBlitNativeToCustomBuffer(false); //we need to do this right now, because we depend on having one solitary framebuffer
diff --git a/desmume/src/frontend/windows/throttle.cpp b/desmume/src/frontend/windows/throttle.cpp
index bb7a1a033..2e112cd7a 100644
--- a/desmume/src/frontend/windows/throttle.cpp
+++ b/desmume/src/frontend/windows/throttle.cpp
@@ -26,8 +26,8 @@
#include "types.h"
#include "debug.h"
#include "console.h"
-#include "GPU_osd.h"
-
+#include "driver.h"
+#include "NDSSystem.h"
#include "winutil.h"
int FastForward=0;
@@ -60,7 +60,7 @@ void IncreaseSpeed(void) {
desiredfps = core_desiredfps * desiredFpsScaler / 256;
desiredspf = 65536.0f / desiredfps;
printf("Throttle fps scaling increased to: %f\n",desiredFpsScaler/256.0);
- osd->addLine("Target FPS up to %2.04f",desiredFpsScaler/256.0);
+ driver->AddLine("Target FPS up to %2.04f",desiredFpsScaler/256.0);
WritePrivateProfileInt("Video","FPS Scaler Index", desiredFpsScalerIndex, IniName);
}
@@ -72,7 +72,7 @@ void DecreaseSpeed(void) {
desiredfps = core_desiredfps * desiredFpsScaler / 256;
desiredspf = 65536.0f / desiredfps;
printf("Throttle fps scaling decreased to: %f\n",desiredFpsScaler/256.0);
- osd->addLine("Target FPS down to %2.04f",desiredFpsScaler/256.0);
+ driver->AddLine("Target FPS down to %2.04f",desiredFpsScaler/256.0);
WritePrivateProfileInt("Video","FPS Scaler Index", desiredFpsScalerIndex, IniName);
}
diff --git a/desmume/src/lua-engine.cpp b/desmume/src/lua-engine.cpp
index 62e4c5458..0bbd486fa 100644
--- a/desmume/src/lua-engine.cpp
+++ b/desmume/src/lua-engine.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2009-2015 DeSmuME team
+ Copyright (C) 2009-2016 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,6 +35,10 @@
#include
#endif
+#if HAVE_LIBAGG
+#include "frontend/modules/osd/agg/agg_osd.h"
+#endif
+
#include
#include
#include