libgambatte/ppu: unindent
This commit is contained in:
parent
c4b401436f
commit
9f04bbc226
@ -62,13 +62,9 @@ static const unsigned short expand_lut[0x200] = {
|
||||
static unsigned predictCyclesUntilXpos_f##n (const PPUPriv &, int targetxpos, unsigned cycles); \
|
||||
static const PPUState f##n##_ = { f##n, predictCyclesUntilXpos_f##n, ID##n }
|
||||
|
||||
namespace M2 {
|
||||
namespace Ly0 { DECLARE_FUNC(0, 0); }
|
||||
namespace LyNon0 { DECLARE_FUNC(0, 0); DECLARE_FUNC(1, 0); }
|
||||
}
|
||||
|
||||
namespace M2_Ly0 { DECLARE_FUNC(0, 0); }
|
||||
namespace M2_LyNon0 { DECLARE_FUNC(0, 0); DECLARE_FUNC(1, 0); }
|
||||
namespace M3Start { DECLARE_FUNC(0, 0); DECLARE_FUNC(1, 0); }
|
||||
|
||||
namespace M3Loop {
|
||||
namespace Tile {
|
||||
DECLARE_FUNC(0, 0x80);
|
||||
@ -78,7 +74,6 @@ namespace M3Loop {
|
||||
DECLARE_FUNC(4, 0x84);
|
||||
DECLARE_FUNC(5, 0x85);
|
||||
}
|
||||
|
||||
namespace LoadSprites {
|
||||
DECLARE_FUNC(0, 0x88);
|
||||
DECLARE_FUNC(1, 0x89);
|
||||
@ -87,7 +82,6 @@ namespace M3Loop {
|
||||
DECLARE_FUNC(4, 0x8C);
|
||||
DECLARE_FUNC(5, 0x8D);
|
||||
}
|
||||
|
||||
namespace StartWindowDraw {
|
||||
DECLARE_FUNC(0, 0x90);
|
||||
DECLARE_FUNC(1, 0x91);
|
||||
@ -96,12 +90,11 @@ namespace M3Loop {
|
||||
DECLARE_FUNC(4, 0x94);
|
||||
DECLARE_FUNC(5, 0x95);
|
||||
}
|
||||
}
|
||||
} // namespace M3Loop
|
||||
|
||||
#undef DECLARE_FUNC
|
||||
|
||||
enum { WIN_DRAW_START = 1, WIN_DRAW_STARTED = 2 };
|
||||
|
||||
enum { M2_DS_OFFSET = 3 };
|
||||
enum { MAX_M3START_CYCLES = 80 };
|
||||
|
||||
@ -120,8 +113,7 @@ static inline void nextCall(const int cycles, const PPUState &state, PPUPriv &p)
|
||||
p.nextCallPtr = &state;
|
||||
}
|
||||
|
||||
namespace M2 {
|
||||
namespace Ly0 {
|
||||
namespace M2_Ly0 {
|
||||
static void f0(PPUPriv &p) {
|
||||
p.weMaster = (p.lcdc & 0x20) && 0 == p.wy;
|
||||
p.winYPos = 0xFF;
|
||||
@ -129,7 +121,7 @@ namespace M2 {
|
||||
}
|
||||
}
|
||||
|
||||
namespace LyNon0 {
|
||||
namespace M2_LyNon0 {
|
||||
static void f0(PPUPriv &p) {
|
||||
p.weMaster |= (p.lcdc & 0x20) && p.lyCounter.ly() == p.wy;
|
||||
nextCall( weMasterCheckAfterLyIncLineCycle(p.cgb)
|
||||
@ -143,7 +135,9 @@ namespace M2 {
|
||||
}
|
||||
}
|
||||
|
||||
/*struct SpriteLess {
|
||||
/*
|
||||
namespace M2 {
|
||||
struct SpriteLess {
|
||||
bool operator()(const Sprite lhs, const Sprite rhs) const {
|
||||
return lhs.spx < rhs.spx;
|
||||
}
|
||||
@ -193,8 +187,9 @@ namespace M2 {
|
||||
p.nextSprite = 0;
|
||||
nextCall(0, M3Start::f0_, p);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
namespace M3Start {
|
||||
static void f0(PPUPriv &p) {
|
||||
@ -306,6 +301,7 @@ namespace M3Start {
|
||||
}
|
||||
|
||||
namespace M3Loop {
|
||||
|
||||
static void doFullTilesUnrolledDmg(PPUPriv &p, const int xend, uint_least32_t *const dbufline,
|
||||
const unsigned char *const tileMapLine, const unsigned tileline, unsigned tileMapXpos) {
|
||||
const unsigned tileIndexSign = ~p.lcdc << 3 & 0x80;
|
||||
@ -870,7 +866,7 @@ namespace M3Loop {
|
||||
? long((p.now - nextm2) >> p.lyCounter.isDoubleSpeed())
|
||||
: -long((nextm2 - p.now) >> p.lyCounter.isDoubleSpeed());
|
||||
|
||||
nextCall(0, p.lyCounter.ly() == 143 ? M2::Ly0::f0_ : M2::LyNon0::f0_, p);
|
||||
nextCall(0, p.lyCounter.ly() == 143 ? M2_Ly0::f0_ : M2_LyNon0::f0_, p);
|
||||
}
|
||||
|
||||
static bool handleWinDrawStartReq(const PPUPriv &p, const int xpos, unsigned char &winDrawState) {
|
||||
@ -967,7 +963,7 @@ namespace M3Loop {
|
||||
static void f5(PPUPriv &p) {
|
||||
inc(Tile::f0_, p);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace LoadSprites {
|
||||
static void inc(const PPUState &nextf, PPUPriv &p) {
|
||||
@ -1058,7 +1054,7 @@ namespace M3Loop {
|
||||
nextCall(1, Tile::f5_, p);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace Tile {
|
||||
static void inc(const PPUState &nextf, PPUPriv &p) {
|
||||
@ -1186,25 +1182,22 @@ namespace M3Loop {
|
||||
}
|
||||
} while (--p.cycles >= 0);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace M3Loop
|
||||
|
||||
namespace M2 {
|
||||
namespace Ly0 {
|
||||
static unsigned predictCyclesUntilXpos_f0(
|
||||
const PPUPriv &p, unsigned winDrawState,
|
||||
namespace M2_Ly0 {
|
||||
static unsigned predictCyclesUntilXpos_f0(const PPUPriv &p, unsigned winDrawState,
|
||||
int targetxpos, unsigned cycles);
|
||||
}
|
||||
|
||||
namespace LyNon0 {
|
||||
static unsigned predictCyclesUntilXpos_f0(
|
||||
const PPUPriv &p, unsigned winDrawState,
|
||||
namespace M2_LyNon0 {
|
||||
static unsigned predictCyclesUntilXpos_f0(const PPUPriv &p, unsigned winDrawState,
|
||||
int targetxpos, unsigned cycles);
|
||||
}
|
||||
}
|
||||
|
||||
namespace M3Loop {
|
||||
|
||||
static unsigned predictCyclesUntilXposNextLine(
|
||||
const PPUPriv &p, unsigned winDrawState, const int targetx) {
|
||||
if (p.wx == 166 && !p.cgb && p.xpos < 167
|
||||
@ -1215,8 +1208,8 @@ namespace M3Loop {
|
||||
const unsigned cycles = (nextM2Time(p) - p.now) >> p.lyCounter.isDoubleSpeed();
|
||||
|
||||
return p.lyCounter.ly() == 143
|
||||
? M2::Ly0::predictCyclesUntilXpos_f0(p, winDrawState, targetx, cycles)
|
||||
: M2::LyNon0::predictCyclesUntilXpos_f0(p, winDrawState, targetx, cycles);
|
||||
? M2_Ly0::predictCyclesUntilXpos_f0(p, winDrawState, targetx, cycles)
|
||||
: M2_LyNon0::predictCyclesUntilXpos_f0(p, winDrawState, targetx, cycles);
|
||||
}
|
||||
|
||||
namespace StartWindowDraw {
|
||||
@ -1424,7 +1417,8 @@ namespace M3Loop {
|
||||
return predictCyclesUntilXpos_fn(p, 5, targetx, cycles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace M3Loop
|
||||
|
||||
namespace M3Start {
|
||||
static unsigned predictCyclesUntilXpos_f1(const PPUPriv &p, unsigned xpos, unsigned ly,
|
||||
@ -1451,8 +1445,7 @@ namespace M3Start {
|
||||
}
|
||||
}
|
||||
|
||||
namespace M2 {
|
||||
namespace Ly0 {
|
||||
namespace M2_Ly0 {
|
||||
static unsigned predictCyclesUntilXpos_f0(const PPUPriv &p,
|
||||
unsigned winDrawState, int targetx, unsigned cycles) {
|
||||
bool weMaster = (p.lcdc & 0x20) && 0 == p.wy;
|
||||
@ -1468,7 +1461,7 @@ namespace M2 {
|
||||
}
|
||||
}
|
||||
|
||||
namespace LyNon0 {
|
||||
namespace M2_LyNon0 {
|
||||
static unsigned predictCyclesUntilXpos_f1(const PPUPriv &p, bool weMaster,
|
||||
unsigned winDrawState, int targetx, unsigned cycles) {
|
||||
unsigned ly = p.lyCounter.ly() + 1;
|
||||
@ -1495,7 +1488,6 @@ namespace M2 {
|
||||
return predictCyclesUntilXpos_f0(p, p.winDrawState, targetx, cycles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
@ -1505,7 +1497,7 @@ PPUPriv::PPUPriv(NextM0Time &nextM0Time, const unsigned char *const oamram, cons
|
||||
nextSprite(0),
|
||||
currentSprite(0xFF),
|
||||
vram(vram),
|
||||
nextCallPtr(&M2::Ly0::f0_),
|
||||
nextCallPtr(&M2_Ly0::f0_),
|
||||
now(0),
|
||||
lastM0Time(0),
|
||||
cycles(-4396),
|
||||
@ -1705,8 +1697,8 @@ void PPU::loadState(const SaveState &ss, const unsigned char *const oamram) {
|
||||
const CycleState lineCycleStates[] = {
|
||||
{ &M3Start::f0_, m3StartLineCycle(p_.cgb) },
|
||||
{ &M3Start::f1_, m3StartLineCycle(p_.cgb) + MAX_M3START_CYCLES },
|
||||
{ &M2::LyNon0::f0_, weMasterCheckPriorToLyIncLineCycle(p_.cgb) },
|
||||
{ &M2::LyNon0::f1_, weMasterCheckAfterLyIncLineCycle(p_.cgb) },
|
||||
{ &M2_LyNon0::f0_, weMasterCheckPriorToLyIncLineCycle(p_.cgb) },
|
||||
{ &M2_LyNon0::f1_, weMasterCheckAfterLyIncLineCycle(p_.cgb) },
|
||||
{ &M3Start::f0_, m3StartLineCycle(p_.cgb) + 456 }
|
||||
};
|
||||
|
||||
@ -1722,7 +1714,7 @@ void PPU::loadState(const SaveState &ss, const unsigned char *const oamram) {
|
||||
}
|
||||
} else {
|
||||
p_.cycles = vcycs - 70224;
|
||||
p_.nextCallPtr = &M2::Ly0::f0_;
|
||||
p_.nextCallPtr = &M2_Ly0::f0_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1750,7 +1742,7 @@ void PPU::speedChange(const unsigned long cycleCounter) {
|
||||
p_.lyCounter.reset(videoCycles, p_.now);
|
||||
p_.spriteMapper.postSpeedChange(cycleCounter);
|
||||
|
||||
if (&M2::Ly0::f0_ == p_.nextCallPtr || &M2::LyNon0::f0_ == p_.nextCallPtr) {
|
||||
if (&M2_Ly0::f0_ == p_.nextCallPtr || &M2_LyNon0::f0_ == p_.nextCallPtr) {
|
||||
if (p_.lyCounter.isDoubleSpeed()) {
|
||||
p_.cycles -= M2_DS_OFFSET;
|
||||
} else
|
||||
|
Loading…
x
Reference in New Issue
Block a user