more idiomatic types
This commit is contained in:
parent
3d3de54485
commit
2e4f68b29f
|
@ -87,7 +87,7 @@ public:
|
|||
* @param samples in: number of stereo samples to produce, out: actual number of samples produced
|
||||
* @return sample number at which the video frame was produced. -1 means no frame was produced.
|
||||
*/
|
||||
long runFor(gambatte::uint_least32_t *soundBuf, unsigned &samples);
|
||||
std::ptrdiff_t runFor(gambatte::uint_least32_t *soundBuf, std::size_t &samples);
|
||||
|
||||
void blitTo(gambatte::uint_least32_t *videoBuf, std::ptrdiff_t pitch);
|
||||
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
/** @param palNum 0 <= palNum < 3. One of BG_PALETTE, SP1_PALETTE and SP2_PALETTE.
|
||||
* @param colorNum 0 <= colorNum < 4
|
||||
*/
|
||||
void setDmgPaletteColor(unsigned palNum, unsigned colorNum, unsigned rgb32);
|
||||
void setDmgPaletteColor(int palNum, int colorNum, unsigned long rgb32);
|
||||
|
||||
void setCgbPalette(unsigned *lut);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ GBEXPORT int gambatte_loaddmgbios(GB* g, const char* biosfiledata)
|
|||
|
||||
GBEXPORT int gambatte_runfor(GB *g, short *soundbuf, unsigned *samples)
|
||||
{
|
||||
unsigned sampv = *samples;
|
||||
std::size_t sampv = *samples;
|
||||
int ret = g->runFor((unsigned int *) soundbuf, sampv);
|
||||
*samples = sampv;
|
||||
return ret;
|
||||
|
|
|
@ -49,7 +49,7 @@ GB::~GB() {
|
|||
delete p_;
|
||||
}
|
||||
|
||||
long GB::runFor(gambatte::uint_least32_t *const soundBuf, unsigned &samples) {
|
||||
std::ptrdiff_t GB::runFor(gambatte::uint_least32_t *const soundBuf, std::size_t &samples) {
|
||||
if (!p_->cpu.loaded()) {
|
||||
samples = 0;
|
||||
return -1;
|
||||
|
@ -60,7 +60,7 @@ long GB::runFor(gambatte::uint_least32_t *const soundBuf, unsigned &samples) {
|
|||
const long cyclesSinceBlit = p_->cpu.runFor(samples * 2);
|
||||
samples = p_->cpu.fillSoundBuffer();
|
||||
|
||||
return cyclesSinceBlit < 0 ? cyclesSinceBlit : static_cast<long>(samples) - (cyclesSinceBlit >> 1);
|
||||
return cyclesSinceBlit < 0 ? cyclesSinceBlit : static_cast<std::ptrdiff_t>(samples) - (cyclesSinceBlit >> 1);
|
||||
}
|
||||
|
||||
void GB::setLayers(unsigned mask)
|
||||
|
@ -211,7 +211,7 @@ void GB::ExternalWrite(unsigned short addr, unsigned char val) {
|
|||
}
|
||||
|
||||
|
||||
void GB::setDmgPaletteColor(unsigned palNum, unsigned colorNum, unsigned rgb32) {
|
||||
void GB::setDmgPaletteColor(int palNum, int colorNum, unsigned long rgb32) {
|
||||
p_->cpu.setDmgPaletteColor(palNum, colorNum, rgb32);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
class Cartridge {
|
||||
MemPtrs memptrs;
|
||||
Rtc rtc;
|
||||
std::auto_ptr<Mbc> mbc;
|
||||
std::unique_ptr<Mbc> mbc;
|
||||
|
||||
public:
|
||||
void setStatePtrs(SaveState &);
|
||||
|
|
|
@ -1068,15 +1068,11 @@ LoadRes Memory::loadROM(const char *romfiledata, unsigned romfilelength, const b
|
|||
return LOADRES_OK;
|
||||
}
|
||||
|
||||
unsigned Memory::fillSoundBuffer(const unsigned long cycleCounter) {
|
||||
std::size_t Memory::fillSoundBuffer(const unsigned long cycleCounter) {
|
||||
sound.generateSamples(cycleCounter, isDoubleSpeed());
|
||||
return sound.fillBuffer();
|
||||
}
|
||||
|
||||
void Memory::setDmgPaletteColor(unsigned palNum, unsigned colorNum, unsigned long rgb32) {
|
||||
display.setDmgPaletteColor(palNum, colorNum, rgb32);
|
||||
}
|
||||
|
||||
void Memory::setCgbPalette(unsigned *lut) {
|
||||
display.setCgbPalette(lut);
|
||||
}
|
||||
|
|
|
@ -330,13 +330,16 @@ public:
|
|||
void setEndtime(unsigned long cc, unsigned long inc);
|
||||
|
||||
void setSoundBuffer(uint_least32_t *const buf) { sound.setBuffer(buf); }
|
||||
unsigned fillSoundBuffer(unsigned long cc);
|
||||
std::size_t fillSoundBuffer(unsigned long cc);
|
||||
|
||||
void setVideoBuffer(uint_least32_t *const videoBuf, const std::ptrdiff_t pitch) {
|
||||
display.setVideoBuffer(videoBuf, pitch);
|
||||
}
|
||||
|
||||
void setDmgPaletteColor(unsigned palNum, unsigned colorNum, unsigned long rgb32);
|
||||
void setDmgPaletteColor(int palNum, int colorNum, unsigned long rgb32) {
|
||||
display.setDmgPaletteColor(palNum, colorNum, rgb32);
|
||||
}
|
||||
|
||||
void setCgbPalette(unsigned *lut);
|
||||
|
||||
void blackScreen() {
|
||||
|
|
|
@ -55,7 +55,7 @@ LCD::LCD(unsigned char const *oamram, unsigned char const *vram,
|
|||
, scanlinecallbacksl(0)
|
||||
{
|
||||
for (std::size_t i = 0; i < sizeof dmgColorsRgb32_ / sizeof dmgColorsRgb32_[0]; ++i)
|
||||
setDmgPaletteColor(i, (3 - (i & 3)) * 85 * 0x010101);
|
||||
dmgColorsRgb32_[i] = (3 - (i & 3)) * 85 * 0x010101ul;
|
||||
std::memset( bgpData_, 0, sizeof bgpData_);
|
||||
std::memset(objpData_, 0, sizeof objpData_);
|
||||
|
||||
|
@ -867,15 +867,11 @@ void LCD::setVideoBuffer(uint_least32_t *videoBuf, std::ptrdiff_t pitch) {
|
|||
ppu_.setFrameBuf(videoBuf, pitch);
|
||||
}
|
||||
|
||||
void LCD::setDmgPaletteColor(unsigned index, unsigned long rgb32) {
|
||||
dmgColorsRgb32_[index] = rgb32;
|
||||
}
|
||||
|
||||
void LCD::setDmgPaletteColor(unsigned palNum, unsigned colorNum, unsigned long rgb32) {
|
||||
if (palNum > 2 || colorNum > 3)
|
||||
return;
|
||||
|
||||
setDmgPaletteColor(palNum * 4 | colorNum, rgb32);
|
||||
dmgColorsRgb32_[palNum * 4 + colorNum] = rgb32;
|
||||
refreshPalettes();
|
||||
}
|
||||
|
||||
|
|
|
@ -226,8 +226,9 @@ public:
|
|||
unsigned char m2IrqStatReg_;
|
||||
unsigned char m1IrqStatReg_;
|
||||
|
||||
static void setDmgPalette(unsigned long palette[], const unsigned long dmgColors[], unsigned data);
|
||||
void setDmgPaletteColor(unsigned index, unsigned long rgb32);
|
||||
static void setDmgPalette(unsigned long palette[],
|
||||
unsigned long const dmgColors[],
|
||||
unsigned data);
|
||||
|
||||
unsigned long gbcToRgb32(const unsigned bgr15);
|
||||
void doCgbColorChange(unsigned char *const pdata, unsigned long *const palette, unsigned index, const unsigned data);
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue