gambatte: cut out unused OSD cruft
This commit is contained in:
parent
c0b8647e69
commit
209142bea1
|
@ -104,7 +104,6 @@
|
|||
<ClInclude Include="src\mem\memptrs.h" />
|
||||
<ClInclude Include="src\mem\rtc.h" />
|
||||
<ClInclude Include="src\minkeeper.h" />
|
||||
<ClInclude Include="src\osd_element.h" />
|
||||
<ClInclude Include="src\savestate.h" />
|
||||
<ClInclude Include="src\sound.h" />
|
||||
<ClInclude Include="src\sound\channel1.h" />
|
||||
|
@ -118,7 +117,6 @@
|
|||
<ClInclude Include="src\sound\sound_unit.h" />
|
||||
<ClInclude Include="src\sound\static_output_tester.h" />
|
||||
<ClInclude Include="src\statesaver.h" />
|
||||
<ClInclude Include="src\state_osd_elements.h" />
|
||||
<ClInclude Include="src\tima.h" />
|
||||
<ClInclude Include="src\video.h" />
|
||||
<ClInclude Include="src\video\lyc_irq.h" />
|
||||
|
@ -149,7 +147,6 @@
|
|||
<ClCompile Include="src\sound\envelope_unit.cpp" />
|
||||
<ClCompile Include="src\sound\length_counter.cpp" />
|
||||
<ClCompile Include="src\statesaver.cpp" />
|
||||
<ClCompile Include="src\state_osd_elements.cpp" />
|
||||
<ClCompile Include="src\tima.cpp" />
|
||||
<ClCompile Include="src\video.cpp" />
|
||||
<ClCompile Include="src\video\lyc_irq.cpp" />
|
||||
|
|
|
@ -96,9 +96,6 @@
|
|||
<ClInclude Include="include\gbint.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\osd_element.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\sound.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -129,9 +126,6 @@
|
|||
<ClInclude Include="src\video\sprite_mapper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\state_osd_elements.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\sound\static_output_tester.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -224,9 +218,6 @@
|
|||
<ClCompile Include="src\sound.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\state_osd_elements.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\tima.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -99,10 +99,6 @@ public:
|
|||
return memory.saveBasePath();
|
||||
}
|
||||
|
||||
void setOsdElement(std::auto_ptr<OsdElement> osdElement) {
|
||||
memory.setOsdElement(osdElement);
|
||||
}
|
||||
|
||||
int load(const char *romfiledata, unsigned romfilelength, bool forceDmg, bool multicartCompat) {
|
||||
return memory.loadROM(romfiledata, romfilelength, forceDmg, multicartCompat);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "savestate.h"
|
||||
#include "statesaver.h"
|
||||
#include "initstate.h"
|
||||
#include "state_osd_elements.h"
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
|
||||
|
@ -137,7 +136,6 @@ int GB::load(const char *romfiledata, unsigned romfilelength, const std::uint32_
|
|||
//p_->cpu.loadSavedata();
|
||||
|
||||
p_->stateNo = 1;
|
||||
p_->cpu.setOsdElement(std::auto_ptr<OsdElement>());
|
||||
}
|
||||
|
||||
return failed;
|
||||
|
@ -242,9 +240,6 @@ bool GB::saveState(const gambatte::uint_least32_t *const videoBuf, const int pit
|
|||
void GB::selectState(int n) {
|
||||
n -= (n / 10) * 10;
|
||||
p_->stateNo = n < 0 ? n + 10 : n;
|
||||
|
||||
if (p_->cpu.loaded())
|
||||
p_->cpu.setOsdElement(newSaveStateOsdElement(statePath(p_->cpu.saveBasePath(), p_->stateNo), p_->stateNo));
|
||||
}
|
||||
|
||||
int GB::currentState() const { return p_->stateNo; }
|
||||
|
|
|
@ -95,10 +95,6 @@ public:
|
|||
|
||||
bool getMemoryArea(int which, unsigned char **data, int *length); // { return cart.getMemoryArea(which, data, length); }
|
||||
|
||||
void setOsdElement(std::auto_ptr<OsdElement> osdElement) {
|
||||
display.setOsdElement(osdElement);
|
||||
}
|
||||
|
||||
unsigned long stop(unsigned long cycleCounter);
|
||||
bool isCgb() const { return display.isCgb(); }
|
||||
bool ime() const { return intreq.ime(); }
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Sindre Aamås *
|
||||
* aamas@stud.ntnu.no *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License version 2 as *
|
||||
* published by the Free Software Foundation. *
|
||||
* *
|
||||
* This program 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 version 2 for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* version 2 along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef OSD_ELEMENT_H
|
||||
#define OSD_ELEMENT_H
|
||||
|
||||
#include "gbint.h"
|
||||
|
||||
namespace gambatte {
|
||||
|
||||
class OsdElement {
|
||||
public:
|
||||
enum Opacity { SEVEN_EIGHTHS, THREE_FOURTHS };
|
||||
|
||||
private:
|
||||
Opacity opacity_;
|
||||
unsigned x_;
|
||||
unsigned y_;
|
||||
unsigned w_;
|
||||
unsigned h_;
|
||||
|
||||
protected:
|
||||
explicit OsdElement(unsigned x = 0, unsigned y = 0, unsigned w = 0, unsigned h = 0, Opacity opacity = SEVEN_EIGHTHS)
|
||||
: opacity_(opacity), x_(x), y_(y), w_(w), h_(h)
|
||||
{
|
||||
}
|
||||
|
||||
void setPos(unsigned x, unsigned y) {
|
||||
x_ = x;
|
||||
y_ = y;
|
||||
}
|
||||
|
||||
void setSize(unsigned w, unsigned h) {
|
||||
w_ = w;
|
||||
h_ = h;
|
||||
}
|
||||
|
||||
void setOpacity(Opacity opacity) { opacity_ = opacity; }
|
||||
|
||||
public:
|
||||
virtual ~OsdElement() {}
|
||||
unsigned x() const { return x_; }
|
||||
unsigned y() const { return y_; }
|
||||
unsigned w() const { return w_; }
|
||||
unsigned h() const { return h_; }
|
||||
Opacity opacity() const { return opacity_; }
|
||||
|
||||
virtual const uint_least32_t* update() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,183 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Sindre Aamås *
|
||||
* aamas@stud.ntnu.no *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License version 2 as *
|
||||
* published by the Free Software Foundation. *
|
||||
* *
|
||||
* This program 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 version 2 for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* version 2 along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "state_osd_elements.h"
|
||||
#include "bitmap_font.h"
|
||||
#include "statesaver.h"
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace gambatte;
|
||||
using namespace bitmapfont;
|
||||
|
||||
static const char stateLoadedTxt[] = { S,t,a,t,e,SPC,N0,SPC,l,o,a,d,e,d,0 };
|
||||
static const char stateSavedTxt[] = { S,t,a,t,e,SPC,N0,SPC,s,a,v,e,d,0 };
|
||||
static const unsigned stateLoadedTxtWidth = getWidth(stateLoadedTxt);
|
||||
static const unsigned stateSavedTxtWidth = getWidth(stateSavedTxt);
|
||||
|
||||
class ShadedTextOsdElment : public OsdElement {
|
||||
struct ShadeFill {
|
||||
void operator()(uint_least32_t *dest, const unsigned pitch) const {
|
||||
dest[2] = dest[1] = dest[0] = 0x000000ul;
|
||||
dest += pitch;
|
||||
dest[2] = dest[0] = 0x000000ul;
|
||||
dest += pitch;
|
||||
dest[2] = dest[1] = dest[0] = 0x000000ul;
|
||||
}
|
||||
};
|
||||
|
||||
uint_least32_t *const pixels;
|
||||
unsigned life;
|
||||
|
||||
ShadedTextOsdElment(const ShadedTextOsdElment&);
|
||||
ShadedTextOsdElment& operator=(const ShadedTextOsdElment&);
|
||||
public:
|
||||
ShadedTextOsdElment(unsigned w, const char *txt);
|
||||
~ShadedTextOsdElment();
|
||||
const uint_least32_t* update();
|
||||
};
|
||||
|
||||
ShadedTextOsdElment::ShadedTextOsdElment(unsigned width, const char *txt) :
|
||||
OsdElement(MAX_WIDTH, 144 - HEIGHT - HEIGHT, width + 2, HEIGHT + 2, THREE_FOURTHS),
|
||||
pixels(new uint_least32_t[w() * h()]),
|
||||
life(4 * 60) {
|
||||
std::memset(pixels, 0xFF, w() * h() * sizeof(uint_least32_t));
|
||||
|
||||
/*print(pixels + 0 * w() + 0, w(), 0x000000ul, txt);
|
||||
print(pixels + 0 * w() + 1, w(), 0x000000ul, txt);
|
||||
print(pixels + 0 * w() + 2, w(), 0x000000ul, txt);
|
||||
print(pixels + 1 * w() + 0, w(), 0x000000ul, txt);
|
||||
print(pixels + 1 * w() + 2, w(), 0x000000ul, txt);
|
||||
print(pixels + 2 * w() + 0, w(), 0x000000ul, txt);
|
||||
print(pixels + 2 * w() + 1, w(), 0x000000ul, txt);
|
||||
print(pixels + 2 * w() + 2, w(), 0x000000ul, txt);
|
||||
print(pixels + 1 * w() + 1, w(), 0xE0E0E0ul, txt);*/
|
||||
|
||||
print(pixels, w(), ShadeFill(), txt);
|
||||
print(pixels + 1 * w() + 1, w(), 0xE0E0E0ul, txt);
|
||||
}
|
||||
|
||||
ShadedTextOsdElment::~ShadedTextOsdElment() {
|
||||
delete []pixels;
|
||||
}
|
||||
|
||||
const uint_least32_t* ShadedTextOsdElment::update() {
|
||||
if (life--)
|
||||
return pixels;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*class FramedTextOsdElment : public OsdElement {
|
||||
uint_least32_t *const pixels;
|
||||
unsigned life;
|
||||
|
||||
FramedTextOsdElment(const FramedTextOsdElment&);
|
||||
FramedTextOsdElment& operator=(const FramedTextOsdElment&);
|
||||
public:
|
||||
FramedTextOsdElment(unsigned w, const char *txt);
|
||||
~FramedTextOsdElment();
|
||||
const uint_least32_t* update();
|
||||
};
|
||||
|
||||
FramedTextOsdElment::FramedTextOsdElment(unsigned width, const char *txt) :
|
||||
OsdElement(NUMBER_WIDTH, 144 - HEIGHT * 2 - HEIGHT / 2, width + NUMBER_WIDTH * 2, HEIGHT * 2),
|
||||
pixels(new uint_least32_t[w() * h()]),
|
||||
life(4 * 60) {
|
||||
std::memset(pixels, 0x00, w() * h() * sizeof(uint_least32_t));
|
||||
print(pixels + (w() - width) / 2 + ((h() - HEIGHT) / 2) * w(), w(), 0xA0A0A0ul, txt);
|
||||
}
|
||||
|
||||
FramedTextOsdElment::~FramedTextOsdElment() {
|
||||
delete []pixels;
|
||||
}
|
||||
|
||||
const uint_least32_t* FramedTextOsdElment::update() {
|
||||
if (life--)
|
||||
return pixels;
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
class SaveStateOsdElement : public OsdElement {
|
||||
uint_least32_t pixels[StateSaver::SS_WIDTH * StateSaver::SS_HEIGHT];
|
||||
unsigned life;
|
||||
|
||||
public:
|
||||
SaveStateOsdElement(const std::string &fileName, unsigned stateNo);
|
||||
const uint_least32_t* update();
|
||||
};
|
||||
|
||||
SaveStateOsdElement::SaveStateOsdElement(const std::string &fileName, unsigned stateNo) :
|
||||
OsdElement((stateNo ? stateNo - 1 : 9) * ((160 - StateSaver::SS_WIDTH) / 10)
|
||||
+ ((160 - StateSaver::SS_WIDTH) / 10) / 2, 4, StateSaver::SS_WIDTH, StateSaver::SS_HEIGHT),
|
||||
life(4 * 60) {
|
||||
std::ifstream file(fileName.c_str(), std::ios_base::binary);
|
||||
|
||||
if (file.is_open()) {
|
||||
file.ignore(5);
|
||||
file.read(reinterpret_cast<char*>(pixels), sizeof pixels);
|
||||
} else {
|
||||
std::memset(pixels, 0, sizeof pixels);
|
||||
|
||||
{
|
||||
using namespace bitmapfont;
|
||||
|
||||
static const char txt[] = { E,m,p,t,bitmapfont::y,0 };
|
||||
|
||||
print(pixels + 3 + (StateSaver::SS_HEIGHT / 2 - bitmapfont::HEIGHT / 2) * StateSaver::SS_WIDTH, StateSaver::SS_WIDTH, 0x808080ul, txt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const uint_least32_t* SaveStateOsdElement::update() {
|
||||
if (life--)
|
||||
return pixels;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
namespace gambatte {
|
||||
|
||||
std::auto_ptr<OsdElement> newStateLoadedOsdElement(unsigned stateNo) {
|
||||
char txt[sizeof stateLoadedTxt];
|
||||
|
||||
std::memcpy(txt, stateLoadedTxt, sizeof stateLoadedTxt);
|
||||
utoa(stateNo, txt + 6);
|
||||
|
||||
return std::auto_ptr<OsdElement>(new ShadedTextOsdElment(stateLoadedTxtWidth, txt));
|
||||
}
|
||||
|
||||
std::auto_ptr<OsdElement> newStateSavedOsdElement(unsigned stateNo) {
|
||||
char txt[sizeof stateSavedTxt];
|
||||
|
||||
std::memcpy(txt, stateSavedTxt, sizeof stateSavedTxt);
|
||||
utoa(stateNo, txt + 6);
|
||||
|
||||
return std::auto_ptr<OsdElement>(new ShadedTextOsdElment(stateSavedTxtWidth, txt));
|
||||
}
|
||||
|
||||
std::auto_ptr<OsdElement> newSaveStateOsdElement(const std::string &fileName, unsigned stateNo) {
|
||||
return std::auto_ptr<OsdElement>(new SaveStateOsdElement(fileName, stateNo));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Sindre Aamås *
|
||||
* aamas@stud.ntnu.no *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License version 2 as *
|
||||
* published by the Free Software Foundation. *
|
||||
* *
|
||||
* This program 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 version 2 for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* version 2 along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef STATE_OSD_ELEMENTS_H
|
||||
#define STATE_OSD_ELEMENTS_H
|
||||
|
||||
#include "osd_element.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace gambatte {
|
||||
std::auto_ptr<OsdElement> newStateLoadedOsdElement(unsigned stateNo);
|
||||
std::auto_ptr<OsdElement> newStateSavedOsdElement(unsigned stateNo);
|
||||
std::auto_ptr<OsdElement> newSaveStateOsdElement(const std::string &fileName, unsigned stateNo);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -241,21 +241,6 @@ void LCD::updateScreen(const bool blanklcd, const unsigned long cycleCounter) {
|
|||
const unsigned long color = ppu.cgb() ? gbcToRgb32(0xFFFF) : dmgColorsRgb32[0];
|
||||
clear(ppu.frameBuf().fb(), color, ppu.frameBuf().pitch());
|
||||
}
|
||||
|
||||
if (ppu.frameBuf().fb() && osdElement.get()) {
|
||||
if (const uint_least32_t *const s = osdElement->update()) {
|
||||
uint_least32_t *const d = ppu.frameBuf().fb()
|
||||
+ static_cast<long>(osdElement->y()) * ppu.frameBuf().pitch() + osdElement->x();
|
||||
|
||||
switch (osdElement->opacity()) {
|
||||
case OsdElement::SEVEN_EIGHTHS:
|
||||
blitOsdElement(d, s, osdElement->w(), osdElement->h(), ppu.frameBuf().pitch(), Blend<8>()); break;
|
||||
case OsdElement::THREE_FOURTHS:
|
||||
blitOsdElement(d, s, osdElement->w(), osdElement->h(), ppu.frameBuf().pitch(), Blend<4>()); break;
|
||||
}
|
||||
} else
|
||||
osdElement.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void LCD::resetCc(const unsigned long oldCc, const unsigned long newCc) {
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "video/lyc_irq.h"
|
||||
#include "video/next_m0_time.h"
|
||||
#include "interruptrequester.h"
|
||||
#include "osd_element.h"
|
||||
#include "minkeeper.h"
|
||||
#include <memory>
|
||||
|
||||
|
@ -129,8 +128,6 @@ class LCD {
|
|||
LycIrq lycIrq;
|
||||
NextM0Time nextM0Time_;
|
||||
|
||||
std::auto_ptr<OsdElement> osdElement;
|
||||
|
||||
unsigned char statReg;
|
||||
unsigned char m2IrqStatReg_;
|
||||
unsigned char m1IrqStatReg_;
|
||||
|
@ -167,8 +164,6 @@ public:
|
|||
void setCgbPalette(unsigned *lut);
|
||||
void setVideoBuffer(uint_least32_t *videoBuf, int pitch);
|
||||
|
||||
void setOsdElement(std::auto_ptr<OsdElement> osdElement) { this->osdElement = osdElement; }
|
||||
|
||||
void dmgBgPaletteChange(const unsigned data, const unsigned long cycleCounter) {
|
||||
update(cycleCounter);
|
||||
bgpData[0] = data;
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue