remove agg and osd stuff from emulator core to a frontend module

This commit is contained in:
zeromus 2016-08-19 23:28:02 -05:00
parent 012b8d9e19
commit 81d1070d9a
23 changed files with 109 additions and 108 deletions

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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() {}

View File

@ -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
}

View File

@ -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_

View File

@ -16,7 +16,7 @@
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GPU_osd.h"
#include "agg_osd.h"
#include "driver.h"
#include "GPU.h"
#include "mem.h"

View File

@ -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)

View File

@ -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();

View File

@ -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();
}

View File

@ -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:

View File

@ -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);

View File

@ -149,6 +149,9 @@
<PreprocessorDefinitions Condition="'$(GDB_STUB)' == 'true'">GDB_STUB=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(EXPERIMENTAL_WIFI_COMM)' == 'true'">EXPERIMENTAL_WIFI_COMM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- desmume configuration: features we always have in windows -->
<PreprocessorDefinitions>HAVE_LIBAGG=1;HAVE_JIT=1;HAVE_LUA=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>

View File

@ -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);}

View File

@ -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

View File

@ -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);
}

View File

@ -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 <unistd.h>
#endif
#if HAVE_LIBAGG
#include "frontend/modules/osd/agg/agg_osd.h"
#endif
#include <assert.h>
#include <vector>
#include <map>
@ -49,7 +53,6 @@
#include "movie.h"
#include "MMU.h"
#include "GPU.h"
#include "GPU_osd.h"
#include "SPU.h"
#include "saves.h"
#include "emufile.h"
@ -2603,6 +2606,7 @@ static void prepare_drawing()
}
static void prepare_reading()
{
#if HAVE_LIBAGG
curGuiData = GetCurrentInfo().guiData;
u32* buf = (u32*)aggDraw.screen->buf().buf();
if(buf)
@ -2618,6 +2622,7 @@ static void prepare_reading()
curGuiData.stridePix = 256;
#endif
}
#endif
}
// note: prepare_drawing or prepare_reading must be called,
@ -4171,8 +4176,6 @@ int dontworry(LuaContextInfo& info)
//agg basic shapes
//TODO polygon and polyline, maybe the overloads for roundedRect and curve
#include "aggdraw.h"
static int line(lua_State *L) {
double x1,y1,x2,y2;

View File

@ -36,7 +36,6 @@
#include "rtc.h"
#include "mic.h"
#include "version.h"
#include "GPU_osd.h"
#include "path.h"
#include "emufile.h"
@ -982,9 +981,9 @@ bool mov_loadstate(EMUFILE* fp, int size)
// this is a mode that behaves like "inactive"
// except it permits switching to play/record by loading an earlier savestate.
// (and we continue to store the finished movie in savestates made while finished)
osd->setLineColor(255,0,0); // let's make the text red too to hopefully catch the user's attention a bit.
driver->SetLineColor(255,0,0); // let's make the text red too to hopefully catch the user's attention a bit.
FinishPlayback();
osd->setLineColor(255,255,255);
driver->SetLineColor(255,255,255);
//FCEU_PrintError("Savestate is from a frame (%d) after the final frame in the movie (%d). This is not permitted.", currFrameCounter, currMovieData.records.size()-1);
//return false;
@ -1022,8 +1021,8 @@ bool mov_loadstate(EMUFILE* fp, int size)
openRecordingMovie(curMovieFilename);
if(!osRecordingMovie)
{
osd->setLineColor(255, 0, 0);
osd->addLine("Can't save movie file!");
driver->SetLineColor(255, 0, 0);
driver->AddLine("Can't save movie file!");
}
//printf("DUMPING MOVIE: %d FRAMES\n",currMovieData.records.size());

View File

@ -41,7 +41,6 @@
#include "render3D.h"
#include "cp15.h"
#include "GPU.h"
#include "GPU_osd.h"
#include "version.h"
#include "readwrite.h"
@ -699,13 +698,13 @@ void savestate_slot(int num)
if (savestate_save(filename))
{
osd->setLineColor(255, 255, 255);
osd->addLine("Saved to %i slot", num);
driver->SetLineColor(255, 255, 255);
driver->AddLine("Saved to %i slot", num);
}
else
{
osd->setLineColor(255, 0, 0);
osd->addLine("Error saving %i slot", num);
driver->SetLineColor(255, 0, 0);
driver->AddLine("Error saving %i slot", num);
return;
}
@ -732,13 +731,13 @@ void loadstate_slot(int num)
sprintf(filename+strlen(filename), ".ds%d", num);
if (savestate_load(filename))
{
osd->setLineColor(255, 255, 255);
osd->addLine("Loaded from %i slot", num);
driver->SetLineColor(255, 255, 255);
driver->AddLine("Loaded from %i slot", num);
}
else
{
osd->setLineColor(255, 0, 0);
osd->addLine("Error loading %i slot", num);
driver->SetLineColor(255, 0, 0);
driver->AddLine("Error loading %i slot", num);
}
}

View File

@ -48,14 +48,6 @@
#define IF_DEVELOPER(X)
#endif
#ifdef HOST_WINDOWS
#define HAVE_LIBAGG
#ifdef DEVELOPER
#define HAVE_LUA
#endif
#define HAVE_JIT
#endif
#ifdef __GNUC__
#ifdef __SSE__
#define ENABLE_SSE