2013-12-11 11:19:17 +00:00
|
|
|
//BG attributes:
|
2011-10-27 00:00:17 +00:00
|
|
|
//0x80: 0 = OAM priority, 1 = BG priority
|
|
|
|
//0x40: vertical flip
|
|
|
|
//0x20: horizontal flip
|
|
|
|
//0x08: VRAM bank#
|
|
|
|
//0x07: palette#
|
2013-12-11 11:19:17 +00:00
|
|
|
|
|
|
|
//OB attributes:
|
|
|
|
//0x80: 0 = OBJ above BG, 1 = BG above OBJ
|
|
|
|
//0x40: vertical flip
|
|
|
|
//0x20: horizontal flip
|
|
|
|
//0x08: VRAM bank#
|
|
|
|
//0x07: palette#
|
|
|
|
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
auto PPU::readTileCGB(bool select, uint x, uint y, uint& attr, uint& data) -> void {
|
2015-11-21 07:36:48 +00:00
|
|
|
uint tmaddr = 0x1800 + (select << 10);
|
2011-10-27 00:00:17 +00:00
|
|
|
tmaddr += (((y >> 3) << 5) + (x >> 3)) & 0x03ff;
|
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
uint tile = vram[0x0000 + tmaddr];
|
2011-10-27 00:00:17 +00:00
|
|
|
attr = vram[0x2000 + tmaddr];
|
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
uint tdaddr = attr & 0x08 ? 0x2000 : 0x0000;
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
if(status.bgTiledataSelect == 0) {
|
2011-10-27 00:00:17 +00:00
|
|
|
tdaddr += 0x1000 + ((int8)tile << 4);
|
|
|
|
} else {
|
|
|
|
tdaddr += 0x0000 + (tile << 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
y &= 7;
|
|
|
|
if(attr & 0x40) y ^= 7;
|
|
|
|
tdaddr += y << 1;
|
|
|
|
|
|
|
|
data = vram[tdaddr++] << 0;
|
|
|
|
data |= vram[tdaddr++] << 8;
|
|
|
|
if(attr & 0x20) data = hflip(data);
|
|
|
|
}
|
|
|
|
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
auto PPU::scanlineCGB() -> void {
|
2013-12-11 11:19:17 +00:00
|
|
|
px = 0;
|
2011-10-27 00:00:17 +00:00
|
|
|
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
const uint Height = (status.obSize == 0 ? 8 : 16);
|
2013-12-11 11:19:17 +00:00
|
|
|
sprites = 0;
|
2011-10-27 00:00:17 +00:00
|
|
|
|
2013-12-11 11:19:17 +00:00
|
|
|
//find first ten sprites on this scanline
|
2015-11-21 07:36:48 +00:00
|
|
|
for(uint n = 0; n < 40 * 4; n += 4) {
|
2013-12-11 11:19:17 +00:00
|
|
|
Sprite& s = sprite[sprites];
|
|
|
|
s.y = oam[n + 0] - 16;
|
|
|
|
s.x = oam[n + 1] - 8;
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
s.tile = oam[n + 2] & ~status.obSize;
|
2013-12-11 11:19:17 +00:00
|
|
|
s.attr = oam[n + 3];
|
|
|
|
|
|
|
|
s.y = status.ly - s.y;
|
|
|
|
if(s.y >= Height) continue;
|
|
|
|
|
|
|
|
if(s.attr & 0x40) s.y ^= (Height - 1);
|
2015-11-21 07:36:48 +00:00
|
|
|
uint tdaddr = (s.attr & 0x08 ? 0x2000 : 0x0000) + (s.tile << 4) + (s.y << 1);
|
2013-12-11 11:19:17 +00:00
|
|
|
s.data = vram[tdaddr + 0] << 0;
|
|
|
|
s.data |= vram[tdaddr + 1] << 8;
|
|
|
|
if(s.attr & 0x20) s.data = hflip(s.data);
|
|
|
|
|
|
|
|
if(++sprites == 10) break;
|
2011-10-27 00:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
auto PPU::runCGB() -> void {
|
2013-12-11 11:19:17 +00:00
|
|
|
ob.color = 0;
|
|
|
|
ob.palette = 0;
|
|
|
|
ob.priority = 0;
|
2011-10-27 00:00:17 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
uint color = 0x7fff;
|
Update to v103r24 release.
byuu says:
Changelog:
- gb/mbc6: mapper is now functional, but Net de Get has some text
corruption¹
- gb/mbc7: mapper is now functional²
- gb/cpu: HDMA syncs other components after each byte transfer now
- gb/ppu: LY,LX forced to zero when LCDC.d7 is lowered (eg disabled),
not when it's raised (eg enabled)
- gb/ppu: the LCD does not run at all when LCDC.d7 is clear³
- fixes graphical corruption between scene transitions in Legend
of Zelda - Oracle of Ages
- thanks to Cydrak, Shonumi, gekkio for their input on the cause
of this issue
- md/controller: renamed "Gamepad" to "Control Pad" per official
terminology
- md/controller: added "Fighting Pad" (6-button controller) emulation
[hex\_usr]
- processor/m68k: fixed TAS to set data.d7 when
EA.mode==DataRegisterDirect; fixes Asterix
- hiro/windows: removed carriage returns from mouse.cpp and
desktop.cpp
- ruby/audio/alsa: added device driver selection [SuperMikeMan]
- ruby/audio/ao: set format.matrix=nullptr to prevent a crash on some
systems [SuperMikeMan]
- ruby/video/cgl: rename term() to terminate() to fix a crash on macOS
[Sintendo]
¹: The observation that this mapper split $4000-7fff into two banks
came from MAME's implementation. But their implementation was quite
broken and incomplete, so I didn't actually use any of it. The
observation that this mapper split $a000-bfff into two banks came from
Tauwasser, and I did directly use that information, plus the knowledge
that $0400/$0800 are the RAM bank select registers.
The text corruption is due to a race condition with timing. The game is
transferring font letters via HDMA, but the game code ends up setting
the bank# with the font a bit too late after the HDMA has already
occurred. I'm not sure how to fix this ... as a whole, I assumed my Game
Boy timing was pretty good, but apparently it's not that good.
²: The entire design of this mapper comes from endrift's notes.
endrift gets full credit for higan being able to emulate this mapper.
Note that the accelerometer implementation is still not tested, and
probably won't work right until I tweak the sensitivity a lot.
³: So the fun part of this is ... it breaks the strict 60fps rate of
the Game Boy. This was always inevitable: certain timing conditions can
stretch frames, too. But this is pretty much an absolute deal breaker
for something like Vsync timing. This pretty much requires adaptive sync
to run well without audio stuttering during the transition.
There's currently one very important detail missing: when the LCD is
turned off, presumably the image on the screen fades to white. I do not
know how long this process takes, or how to really go about emulating
it. Right now as an incomplete patch, I'm simply leaving the last
displayed image on the screen until the LCD is turned on again. But I
will have to output white, as well as add code to break out of the
emulation loop periodically when the LCD is left off eg indefinitely, or
bad things would happen. I'll work something out and then implement.
Another detail is I'm not sure how long it takes for the LCD to start
rendering again once enabled. Right now, it's immediate. I've heard it's
as long as 1/60th of a second, but that really seems incredibly
excessive? I'd like to know at least a reasonably well-supported
estimate before I implement that.
2017-08-01 11:41:27 +00:00
|
|
|
runBackgroundCGB();
|
|
|
|
if(status.windowDisplayEnable) runWindowCGB();
|
|
|
|
if(status.obEnable) runObjectsCGB();
|
|
|
|
|
|
|
|
if(ob.palette == 0) {
|
|
|
|
color = bg.color;
|
|
|
|
} else if(bg.palette == 0) {
|
|
|
|
color = ob.color;
|
|
|
|
} else if(status.bgEnable == 0) {
|
|
|
|
color = ob.color;
|
|
|
|
} else if(bg.priority) {
|
|
|
|
color = bg.color;
|
|
|
|
} else if(ob.priority) {
|
|
|
|
color = ob.color;
|
|
|
|
} else {
|
|
|
|
color = bg.color;
|
2013-12-11 11:19:17 +00:00
|
|
|
}
|
2011-10-27 00:00:17 +00:00
|
|
|
|
2013-12-11 11:19:17 +00:00
|
|
|
uint32* output = screen + status.ly * 160 + px++;
|
2013-12-20 11:40:39 +00:00
|
|
|
*output = color;
|
2013-12-11 11:19:17 +00:00
|
|
|
}
|
2011-10-27 00:00:17 +00:00
|
|
|
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
auto PPU::runBackgroundCGB() -> void {
|
2015-11-21 07:36:48 +00:00
|
|
|
uint scrolly = (status.ly + status.scy) & 255;
|
|
|
|
uint scrollx = (px + status.scx) & 255;
|
|
|
|
uint tx = scrollx & 7;
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
if(tx == 0 || px == 0) readTileCGB(status.bgTilemapSelect, scrollx, scrolly, background.attr, background.data);
|
2013-12-11 11:19:17 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
uint index = 0;
|
2013-12-11 11:19:17 +00:00
|
|
|
index |= (background.data & (0x0080 >> tx)) ? 1 : 0;
|
|
|
|
index |= (background.data & (0x8000 >> tx)) ? 2 : 0;
|
2015-11-21 07:36:48 +00:00
|
|
|
uint palette = ((background.attr & 0x07) << 2) + index;
|
|
|
|
uint color = 0;
|
2013-12-11 11:19:17 +00:00
|
|
|
color |= bgpd[(palette << 1) + 0] << 0;
|
|
|
|
color |= bgpd[(palette << 1) + 1] << 8;
|
|
|
|
color &= 0x7fff;
|
|
|
|
|
|
|
|
bg.color = color;
|
|
|
|
bg.palette = index;
|
|
|
|
bg.priority = background.attr & 0x80;
|
|
|
|
}
|
2011-10-27 00:00:17 +00:00
|
|
|
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
auto PPU::runWindowCGB() -> void {
|
2015-11-21 07:36:48 +00:00
|
|
|
uint scrolly = status.ly - status.wy;
|
|
|
|
uint scrollx = px + 7 - status.wx;
|
2013-12-20 11:40:39 +00:00
|
|
|
if(scrolly >= 144u) return; //also matches underflow (scrolly < 0)
|
|
|
|
if(scrollx >= 160u) return; //also matches underflow (scrollx < 0)
|
2015-11-21 07:36:48 +00:00
|
|
|
uint tx = scrollx & 7;
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
if(tx == 0 || px == 0) readTileCGB(status.windowTilemapSelect, scrollx, scrolly, window.attr, window.data);
|
2013-12-11 11:19:17 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
uint index = 0;
|
2013-12-11 11:19:17 +00:00
|
|
|
index |= (window.data & (0x0080 >> tx)) ? 1 : 0;
|
|
|
|
index |= (window.data & (0x8000 >> tx)) ? 2 : 0;
|
2015-11-21 07:36:48 +00:00
|
|
|
uint palette = ((window.attr & 0x07) << 2) + index;
|
|
|
|
uint color = 0;
|
2013-12-11 11:19:17 +00:00
|
|
|
color |= bgpd[(palette << 1) + 0] << 0;
|
|
|
|
color |= bgpd[(palette << 1) + 1] << 8;
|
|
|
|
color &= 0x7fff;
|
|
|
|
|
|
|
|
bg.color = color;
|
|
|
|
bg.palette = index;
|
|
|
|
bg.priority = window.attr & 0x80;
|
2011-10-27 00:00:17 +00:00
|
|
|
}
|
|
|
|
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
auto PPU::runObjectsCGB() -> void {
|
2013-12-11 11:19:17 +00:00
|
|
|
//render backwards, so that first sprite has priority
|
2015-11-21 07:36:48 +00:00
|
|
|
for(int n = sprites - 1; n >= 0; n--) {
|
2013-12-11 11:19:17 +00:00
|
|
|
Sprite& s = sprite[n];
|
2011-10-27 00:00:17 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
int tx = px - s.x;
|
2013-12-11 11:19:17 +00:00
|
|
|
if(tx < 0 || tx > 7) continue;
|
2011-10-27 00:00:17 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
uint index = 0;
|
2013-12-11 11:19:17 +00:00
|
|
|
index |= (s.data & (0x0080 >> tx)) ? 1 : 0;
|
|
|
|
index |= (s.data & (0x8000 >> tx)) ? 2 : 0;
|
|
|
|
if(index == 0) continue;
|
2011-10-27 00:00:17 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
uint palette = ((s.attr & 0x07) << 2) + index;
|
|
|
|
uint color = 0;
|
2013-12-11 11:19:17 +00:00
|
|
|
color |= obpd[(palette << 1) + 0] << 0;
|
|
|
|
color |= obpd[(palette << 1) + 1] << 8;
|
|
|
|
color &= 0x7fff;
|
2011-10-27 00:00:17 +00:00
|
|
|
|
2013-12-11 11:19:17 +00:00
|
|
|
ob.color = color;
|
|
|
|
ob.palette = index;
|
|
|
|
ob.priority = !(s.attr & 0x80);
|
2011-10-27 00:00:17 +00:00
|
|
|
}
|
|
|
|
}
|