Setup Display to standard resolution instead of high res
This commit is contained in:
parent
1e329bb691
commit
32e5b55b0a
|
@ -30,7 +30,11 @@ namespace GPU {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Screen {
|
namespace Screen {
|
||||||
void set_offset(uint16_t x, uint16_t y);
|
extern uint8_t CurrentDisplayAreaID;
|
||||||
|
|
||||||
|
namespace Range {
|
||||||
|
void set_offset(uint16_t x, uint16_t y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,22 @@ namespace GPU {
|
||||||
return ComplexBitMap{(0b101u << 29)};
|
return ComplexBitMap{(0b101u << 29)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr GP0 DrawAreaTemplate(uint8_t code, uint16_t x, uint16_t y) {
|
||||||
|
constexpr auto Command = BitRange<uint32_t>::from_to(24, 31);
|
||||||
|
constexpr auto Y = BitRange<uint32_t>::from_to(10, 18);
|
||||||
|
constexpr auto X = BitRange<uint32_t>::from_to(0, 9);
|
||||||
|
|
||||||
|
return ComplexBitMap<uint32_t>::with(Command.with(code), Y.with(y), X.with(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GP0 DrawAreaTopLeft(uint16_t x, uint16_t y) {
|
||||||
|
return DrawAreaTemplate(0xE3, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GP0 DrawAreaBottomRight(uint16_t x, uint16_t y) {
|
||||||
|
return DrawAreaTemplate(0xE4, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr GP0 TopLeftPosition(uint16_t x, uint16_t y) {
|
static constexpr GP0 TopLeftPosition(uint16_t x, uint16_t y) {
|
||||||
return ComplexBitMap{static_cast<uint32_t>((y << 16u) | x)};
|
return ComplexBitMap{static_cast<uint32_t>((y << 16u) | x)};
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,21 @@ namespace GPU {
|
||||||
static constexpr uint16_t FirstVisiblePixelV = 0xA3;
|
static constexpr uint16_t FirstVisiblePixelV = 0xA3;
|
||||||
|
|
||||||
GP1.write(Command::GP1::DisplayMode(Mode::PAL()));
|
GP1.write(Command::GP1::DisplayMode(Mode::PAL()));
|
||||||
GPU::Screen::set_offset(78, 43);
|
GPU::Screen::Range::set_offset(0, 0);
|
||||||
#else
|
#else
|
||||||
static constexpr uint16_t FirstVisiblePixelV = 0x88;
|
static constexpr uint16_t FirstVisiblePixelV = 0x88;
|
||||||
|
|
||||||
GP1.write(Command::GP1::DisplayMode(Mode::NTSC()));
|
GP1.write(Command::GP1::DisplayMode(Mode::NTSC()));
|
||||||
GPU::Screen::set_offset(78, 45);
|
GPU::Screen::set_offset(0, 5); //< Random values
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void exchange_buffer_and_display();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_draw_area(uint16_t x, uint16_t y) {
|
||||||
|
GP0.write(Command::GP0::DrawAreaTopLeft(x, y));
|
||||||
|
GP0.write(Command::GP0::DrawAreaBottomRight((x + Display::Width), (y + Display::Height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quick_fill_fast(const Color24& color, const PositionU16& pos, const SizeU16& size) {
|
static void quick_fill_fast(const Color24& color, const PositionU16& pos, const SizeU16& size) {
|
||||||
|
|
|
@ -18,8 +18,8 @@ namespace GPU {
|
||||||
void setup() {
|
void setup() {
|
||||||
GP1.write(Command::GP1::Reset());
|
GP1.write(Command::GP1::Reset());
|
||||||
Screen::configurate();
|
Screen::configurate();
|
||||||
|
Screen::exchange_buffer_and_display();
|
||||||
|
|
||||||
quick_fill_fast(Color24::Black(), PositionU16(0, 0), SizeU16(640, 480));
|
quick_fill_fast(Color24::Black(), PositionU16(0, 0), SizeU16(640, 512));
|
||||||
GP1.write(Command::GP1::DisplayArea(0, 0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,23 +1,36 @@
|
||||||
#include <PSX/GPU/GPU.hpp>
|
#include "../include/GPU/GPU.hpp"
|
||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
namespace Screen {
|
namespace Screen {
|
||||||
#ifdef JABYENGINE_PAL
|
uint8_t CurrentDisplayAreaID = 1; //< Setup will call exchange and set it to 0
|
||||||
static constexpr uint16_t ScanlinesV = 288;
|
|
||||||
#else
|
|
||||||
static constexpr uint16_t ScanlinesV = 240;
|
|
||||||
#endif //JABYENGINE_PAL
|
|
||||||
|
|
||||||
#ifndef USE_NO$PSX
|
namespace Range {
|
||||||
void set_offset(uint16_t x, uint16_t y) {
|
#ifdef JABYENGINE_PAL
|
||||||
GP1.write(Command::GP1::HorizontalDisplayRange((x << 3), (x + Display::Width) << 3));
|
static constexpr uint16_t ScanlinesV = 288;
|
||||||
GP1.write(Command::GP1::VerticalDisplayRange(y, y + Display::Height));
|
#else
|
||||||
|
static constexpr uint16_t ScanlinesV = 240;
|
||||||
|
#endif //JABYENGINE_PAL
|
||||||
|
|
||||||
|
#ifndef USE_NO$PSX
|
||||||
|
void set_offset(uint16_t x, uint16_t y) {
|
||||||
|
x += 78;
|
||||||
|
y += 43;
|
||||||
|
|
||||||
|
GP1.write(Command::GP1::HorizontalDisplayRange((x << 3), (x + Display::Width) << 3));
|
||||||
|
GP1.write(Command::GP1::VerticalDisplayRange(y, y + Display::Height));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void set_offset(uint16_t x, uint16_t y) {
|
||||||
|
GP1.write(Command::GP1::HorizontalDisplayRange(x, (x + Display::Width*8)));
|
||||||
|
GP1.write(Command::GP1::VerticalDisplayRange(y - (ScanlinesV/2), y + (ScanlinesV/2)));
|
||||||
|
}
|
||||||
|
#endif //USE_NO$PSX
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void set_offset(uint16_t x, uint16_t y) {
|
void exchange_buffer_and_display() {
|
||||||
GP1.write(Command::GP1::HorizontalDisplayRange(x, (x + Display::Width*8)));
|
GPU::set_draw_area(0, (Display::Height*CurrentDisplayAreaID));
|
||||||
GP1.write(Command::GP1::VerticalDisplayRange(y - (ScanlinesV/2), y + (ScanlinesV/2)));
|
CurrentDisplayAreaID ^= 1;
|
||||||
|
GP1.write(Command::GP1::DisplayArea(0, (Display::Height*CurrentDisplayAreaID)));
|
||||||
}
|
}
|
||||||
#endif //USE_NO$PSX
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue