I'm not sure where to start with this one... It wasn't hooked up to the frontend at all; the C# side enum doesn't have this flag. It can already be done with a different option in the frontend ("VBA Vivid".) It was stored in savestates, despite having no effect on emulation. Even with some other hypothetical front end, it could only be set at initial load time, despite the fact that our existing palette manipulation can be edited at any time, of course...
This commit is contained in:
parent
2cc092270d
commit
f185f71026
|
@ -52,7 +52,6 @@ public:
|
|||
FORCE_DMG = 1, /**< Treat the ROM as not having CGB support regardless of what its header advertises. */
|
||||
GBA_CGB = 2, /**< Use GBA intial CPU register values when in CGB mode. */
|
||||
MULTICART_COMPAT = 4, /**< Use heuristics to detect and support some multicart MBCs disguised as MBC1. */
|
||||
TRUE_COLOR = 8 /**< Use GBP color conversion instead of GBC-screen approximation */
|
||||
};
|
||||
|
||||
/** Load ROM image.
|
||||
|
|
|
@ -94,7 +94,7 @@ void GB::reset(const std::uint32_t now) {
|
|||
|
||||
SaveState state;
|
||||
p_->cpu.setStatePtrs(state);
|
||||
setInitState(state, !(p_->loadflags & FORCE_DMG), p_->loadflags & GBA_CGB, p_->loadflags & TRUE_COLOR, now);
|
||||
setInitState(state, !(p_->loadflags & FORCE_DMG), p_->loadflags & GBA_CGB, now);
|
||||
p_->cpu.loadState(state);
|
||||
if (length > 0)
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ int GB::load(const char *romfiledata, unsigned romfilelength, const std::uint32_
|
|||
SaveState state;
|
||||
p_->cpu.setStatePtrs(state);
|
||||
p_->loadflags = flags;
|
||||
setInitState(state, !(flags & FORCE_DMG), flags & GBA_CGB, flags & TRUE_COLOR, now);
|
||||
setInitState(state, !(flags & FORCE_DMG), flags & GBA_CGB, now);
|
||||
p_->cpu.loadState(state);
|
||||
//p_->cpu.loadSavedata();
|
||||
}
|
||||
|
|
|
@ -1146,7 +1146,7 @@ static void setInitialDmgIoamhram(unsigned char *const ioamhram) {
|
|||
|
||||
} // anon namespace
|
||||
|
||||
void gambatte::setInitState(SaveState &state, const bool cgb, const bool gbaCgbMode, const bool trueColors, const std::uint32_t now) {
|
||||
void gambatte::setInitState(SaveState &state, const bool cgb, const bool gbaCgbMode, const std::uint32_t now) {
|
||||
static const unsigned char cgbObjpDump[0x40] = {
|
||||
0x00, 0x00, 0xF2, 0xAB,
|
||||
0x61, 0xC2, 0xD9, 0xBA,
|
||||
|
@ -1262,7 +1262,6 @@ void gambatte::setInitState(SaveState &state, const bool cgb, const bool gbaCgbM
|
|||
state.ppu.oldWy = state.mem.ioamhram.get()[0x14A];
|
||||
state.ppu.pendingLcdstatIrq = false;
|
||||
state.ppu.isCgb = cgb;
|
||||
state.ppu.trueColors = !trueColors;
|
||||
|
||||
|
||||
state.spu.cycleCounter = 0; // spu.cycleCounter >> 12 & 7 represents the frame sequencer position.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <cstdint>
|
||||
|
||||
namespace gambatte {
|
||||
void setInitState(struct SaveState &state, bool cgb, bool gbaCgbMode, bool trueColors, std::uint32_t now);
|
||||
void setInitState(struct SaveState &state, bool cgb, bool gbaCgbMode, std::uint32_t now);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,7 @@ struct SaveState {
|
|||
void set(T *ptr, const unsigned long sz) { this->ptr = ptr; this->sz = sz; }
|
||||
|
||||
friend class SaverList;
|
||||
friend void setInitState(SaveState &, bool, bool, bool, std::uint32_t);
|
||||
friend void setInitState(SaveState &, bool, bool, std::uint32_t);
|
||||
};
|
||||
|
||||
struct CPU {
|
||||
|
@ -118,7 +118,6 @@ struct SaveState {
|
|||
bool weMaster;
|
||||
bool pendingLcdstatIrq;
|
||||
bool isCgb;
|
||||
bool trueColors;
|
||||
} ppu;
|
||||
|
||||
struct SPU {
|
||||
|
|
|
@ -36,14 +36,11 @@ void LCD::setCgbPalette(unsigned *lut) {
|
|||
refreshPalettes();
|
||||
}
|
||||
|
||||
unsigned long LCD::gbcToRgb32(const unsigned bgr15, bool trueColor) {
|
||||
unsigned long LCD::gbcToRgb32(const unsigned bgr15) {
|
||||
unsigned long const r = bgr15 & 0x1F;
|
||||
unsigned long const g = bgr15 >> 5 & 0x1F;
|
||||
unsigned long const b = bgr15 >> 10 & 0x1F;
|
||||
|
||||
if (trueColor)
|
||||
return (r << 19) | (g << 11) | (b << 3);
|
||||
|
||||
return cgbColorsRgb32[bgr15 & 0x7FFF];
|
||||
}
|
||||
|
||||
|
@ -151,8 +148,8 @@ void LCD::loadState(const SaveState &state, const unsigned char *const oamram) {
|
|||
void LCD::refreshPalettes() {
|
||||
if (ppu.cgb()) {
|
||||
for (unsigned i = 0; i < 8 * 8; i += 2) {
|
||||
ppu.bgPalette()[i >> 1] = gbcToRgb32( bgpData[i] | bgpData[i + 1] << 8, isTrueColors());
|
||||
ppu.spPalette()[i >> 1] = gbcToRgb32(objpData[i] | objpData[i + 1] << 8, isTrueColors());
|
||||
ppu.bgPalette()[i >> 1] = gbcToRgb32( bgpData[i] | bgpData[i + 1] << 8);
|
||||
ppu.spPalette()[i >> 1] = gbcToRgb32(objpData[i] | objpData[i + 1] << 8);
|
||||
}
|
||||
} else {
|
||||
setDmgPalette(ppu.bgPalette() , dmgColorsRgb32 , bgpData[0]);
|
||||
|
@ -163,10 +160,10 @@ void LCD::refreshPalettes() {
|
|||
|
||||
void LCD::copyCgbPalettesToDmg() {
|
||||
for (unsigned i = 0; i < 4; i++) {
|
||||
dmgColorsRgb32[i] = gbcToRgb32(bgpData[i * 2] | bgpData[i * 2 + 1] << 8, isTrueColors());
|
||||
dmgColorsRgb32[i] = gbcToRgb32(bgpData[i * 2] | bgpData[i * 2 + 1] << 8);
|
||||
}
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
dmgColorsRgb32[i + 4] = gbcToRgb32(objpData[i * 2] | objpData[i * 2 + 1] << 8, isTrueColors());
|
||||
dmgColorsRgb32[i + 4] = gbcToRgb32(objpData[i * 2] | objpData[i * 2 + 1] << 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +202,7 @@ void LCD::updateScreen(const bool blanklcd, const unsigned long cycleCounter) {
|
|||
update(cycleCounter);
|
||||
|
||||
if (blanklcd && ppu.frameBuf().fb()) {
|
||||
const unsigned long color = ppu.cgb() ? gbcToRgb32(0xFFFF, isTrueColors()) : dmgColorsRgb32[0];
|
||||
const unsigned long color = ppu.cgb() ? gbcToRgb32(0xFFFF) : dmgColorsRgb32[0];
|
||||
clear(ppu.frameBuf().fb(), color, ppu.frameBuf().pitch());
|
||||
}
|
||||
}
|
||||
|
@ -319,23 +316,23 @@ bool LCD::cgbpAccessible(const unsigned long cycleCounter) {
|
|||
}
|
||||
|
||||
void LCD::doCgbColorChange(unsigned char *const pdata,
|
||||
unsigned long *const palette, unsigned index, const unsigned data, bool trueColor) {
|
||||
unsigned long *const palette, unsigned index, const unsigned data) {
|
||||
pdata[index] = data;
|
||||
index >>= 1;
|
||||
palette[index] = gbcToRgb32(pdata[index << 1] | pdata[(index << 1) + 1] << 8, trueColor);
|
||||
palette[index] = gbcToRgb32(pdata[index << 1] | pdata[(index << 1) + 1] << 8);
|
||||
}
|
||||
|
||||
void LCD::doCgbBgColorChange(unsigned index, const unsigned data, const unsigned long cycleCounter) {
|
||||
if (cgbpAccessible(cycleCounter)) {
|
||||
update(cycleCounter);
|
||||
doCgbColorChange(bgpData, ppu.bgPalette(), index, data, isTrueColors());
|
||||
doCgbColorChange(bgpData, ppu.bgPalette(), index, data);
|
||||
}
|
||||
}
|
||||
|
||||
void LCD::doCgbSpColorChange(unsigned index, const unsigned data, const unsigned long cycleCounter) {
|
||||
if (cgbpAccessible(cycleCounter)) {
|
||||
update(cycleCounter);
|
||||
doCgbColorChange(objpData, ppu.spPalette(), index, data, isTrueColors());
|
||||
doCgbColorChange(objpData, ppu.spPalette(), index, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ class LCD {
|
|||
static void setDmgPalette(unsigned long *palette, const unsigned long *dmgColors, unsigned data);
|
||||
void setDmgPaletteColor(unsigned index, unsigned long rgb32);
|
||||
|
||||
unsigned long gbcToRgb32(const unsigned bgr15, bool trueColor);
|
||||
void doCgbColorChange(unsigned char *const pdata, unsigned long *const palette, unsigned index, const unsigned data, bool trueColor);
|
||||
unsigned long gbcToRgb32(const unsigned bgr15);
|
||||
void doCgbColorChange(unsigned char *const pdata, unsigned long *const palette, unsigned index, const unsigned data);
|
||||
|
||||
void refreshPalettes();
|
||||
void setDBuffer();
|
||||
|
@ -270,7 +270,6 @@ public:
|
|||
|
||||
bool isCgb() const { return ppu.cgb(); }
|
||||
bool isDoubleSpeed() const { return ppu.lyCounter().isDoubleSpeed(); }
|
||||
bool isTrueColors() const { return ppu.trueColors(); }
|
||||
|
||||
unsigned long *bgPalette() { return ppu.bgPalette(); }
|
||||
unsigned long *spPalette() { return ppu.spPalette(); }
|
||||
|
|
|
@ -1631,7 +1631,6 @@ void PPU::loadState(const SaveState &ss, const unsigned char *const oamram) {
|
|||
p_.winDrawState = ss.ppu.winDrawState & (WIN_DRAW_START | WIN_DRAW_STARTED);
|
||||
p_.lastM0Time = p_.now - ss.ppu.lastM0Time;
|
||||
p_.cgb = ss.ppu.isCgb;
|
||||
p_.trueColors = ss.ppu.trueColors;
|
||||
loadSpriteList(p_, ss);
|
||||
|
||||
if (m3loopState && videoCycles < 144 * 456L && p_.xpos < 168
|
||||
|
@ -1804,7 +1803,6 @@ SYNCFUNC(PPU)
|
|||
NSS(p_.endx);
|
||||
|
||||
NSS(p_.cgb);
|
||||
NSS(p_.trueColors);
|
||||
NSS(p_.weMaster);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@ struct PPUPriv {
|
|||
unsigned char endx;
|
||||
|
||||
bool cgb;
|
||||
bool trueColors;
|
||||
bool weMaster;
|
||||
|
||||
PPUPriv(NextM0Time &nextM0Time, const unsigned char *oamram, const unsigned char *vram);
|
||||
|
@ -108,7 +107,6 @@ public:
|
|||
|
||||
unsigned long * bgPalette() { return p_.bgPalette; }
|
||||
bool cgb() const { return p_.cgb; }
|
||||
bool trueColors() const { return p_.trueColors; }
|
||||
void doLyCountEvent() { p_.lyCounter.doEvent(); }
|
||||
unsigned long doSpriteMapEvent(unsigned long time) { return p_.spriteMapper.doEvent(time); }
|
||||
const PPUFrameBuf & frameBuf() const { return p_.framebuf; }
|
||||
|
@ -136,7 +134,6 @@ public:
|
|||
void update(unsigned long cc);
|
||||
void setLayers(unsigned mask) { p_.layersMask = mask; }
|
||||
void setCgb(bool cgb) { p_.cgb = cgb; }
|
||||
void setTrueColors(bool trueColors) { p_.trueColors = trueColors; }
|
||||
|
||||
template<bool isReader>void SyncState(NewState *ns);
|
||||
};
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue