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;
|
2016-06-05 22:10:01 +00:00
|
|
|
if(!enabled()) return;
|
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;
|
2016-06-05 22:10:01 +00:00
|
|
|
if(enabled()) {
|
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
|
|
|
runBackgroundCGB();
|
|
|
|
if(status.windowDisplayEnable) runWindowCGB();
|
|
|
|
if(status.obEnable) runObjectsCGB();
|
2013-12-11 11:19:17 +00:00
|
|
|
|
|
|
|
if(ob.palette == 0) {
|
|
|
|
color = bg.color;
|
|
|
|
} else if(bg.palette == 0) {
|
|
|
|
color = ob.color;
|
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
|
|
|
} else if(status.bgEnable == 0) {
|
2013-12-11 11:19:17 +00:00
|
|
|
color = ob.color;
|
|
|
|
} else if(bg.priority) {
|
|
|
|
color = bg.color;
|
|
|
|
} else if(ob.priority) {
|
|
|
|
color = ob.color;
|
|
|
|
} else {
|
|
|
|
color = bg.color;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|