Configurate Screen
This commit is contained in:
@@ -1,32 +1,59 @@
|
||||
#ifndef __JABYENGINE_INTERNAL_GPU_HPP__
|
||||
#define __JABYENGINE_INTERNAL_GPU_HPP__
|
||||
#include <PSX/GPU/GPU_Types.hpp>
|
||||
#include <PSX/GPU/GPU.hpp>
|
||||
#include <PSX/System/IOPorts/DMA_IO.hpp>
|
||||
#include <PSX/System/IOPorts/GPU_IO.hpp>
|
||||
|
||||
namespace GPU {
|
||||
struct DisplayMode {
|
||||
enum struct TVEncoding {
|
||||
NTSC = 0,
|
||||
PAL = 1,
|
||||
namespace Display {
|
||||
struct Mode {
|
||||
enum struct TVEncoding {
|
||||
NTSC = 0,
|
||||
PAL = 1,
|
||||
};
|
||||
|
||||
static constexpr auto HorizontalResolution368 = Bit<uint32_t>(6);
|
||||
static constexpr auto VerticalInterlace = Bit<uint32_t>(5);
|
||||
static constexpr auto DisplayAreaColorDepth = BitRange<GPU::DisplayAreaColorDepth>::from_to(4, 4);
|
||||
static constexpr auto VideoMode = BitRange<TVEncoding>::from_to(3, 3);
|
||||
static constexpr auto VerticalResolution = BitRange<GPU::VerticalResolution>::from_to(2, 2);
|
||||
static constexpr auto HorizontalResolution = BitRange<GPU::HorizontalResolution>::from_to(0, 1);
|
||||
|
||||
static constexpr uint32_t PAL() {
|
||||
return ComplexBitMap<uint32_t>::with(
|
||||
Mode::HorizontalResolution.with(GPU::HorizontalResolution::$320),
|
||||
Mode::VerticalResolution.with(GPU::VerticalResolution::$240),
|
||||
Mode::VideoMode.with(TVEncoding::PAL),
|
||||
Mode::DisplayAreaColorDepth.with(GPU::DisplayAreaColorDepth::$15bit)
|
||||
).raw;
|
||||
}
|
||||
|
||||
static constexpr uint32_t NTSC() {
|
||||
return ComplexBitMap<uint32_t>::with(
|
||||
Mode::HorizontalResolution.with(GPU::HorizontalResolution::$320),
|
||||
Mode::VerticalResolution.with(GPU::VerticalResolution::$240),
|
||||
Mode::VideoMode.with(TVEncoding::NTSC),
|
||||
Mode::DisplayAreaColorDepth.with(GPU::DisplayAreaColorDepth::$15bit)
|
||||
).raw;
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr auto HorizontalResolution368 = Bit<uint32_t>(6);
|
||||
static constexpr auto VerticalInterlace = Bit<uint32_t>(5);
|
||||
static constexpr auto DisplayAreaColorDepth = BitRange<GPU::DisplayAreaColorDepth>::from_to(4, 4);
|
||||
static constexpr auto VideoMode = BitRange<TVEncoding>::from_to(3, 3);
|
||||
static constexpr auto VerticalResolution = BitRange<GPU::VerticalResolution>::from_to(2, 2);
|
||||
static constexpr auto HorizontalResolution = BitRange<GPU::HorizontalResolution>::from_to(0, 1);
|
||||
static void configurate() {
|
||||
static constexpr uint16_t FirstVisiblePixelH = 0x260;
|
||||
|
||||
static constexpr uint32_t PAL() {
|
||||
return ComplexBitMap<uint32_t>::with(
|
||||
DisplayMode::HorizontalResolution.with(GPU::HorizontalResolution::$320),
|
||||
DisplayMode::VerticalResolution.with(GPU::VerticalResolution::$240),
|
||||
DisplayMode::VideoMode.with(TVEncoding::PAL),
|
||||
DisplayMode::DisplayAreaColorDepth.with(GPU::DisplayAreaColorDepth::$15bit)
|
||||
).raw;
|
||||
#ifdef JABYENGINE_PAL
|
||||
static constexpr uint16_t FirstVisiblePixelV = 0xA3;
|
||||
|
||||
GP1.write(Command::GP1::DisplayMode(Mode::PAL()));
|
||||
GPU::Display::set_offset(FirstVisiblePixelH, FirstVisiblePixelV);
|
||||
#else
|
||||
static constexpr uint16_t FirstVisiblePixelV = 0x88;
|
||||
|
||||
GP1.write(Command::GP1::DisplayMode(Mode::NTSC()));
|
||||
GPU::Display::set_offset(FirstVisiblePixelH, FirstVisiblePixelV);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void quick_fill_fast(const Color24& color, const PositionU16& pos, const SizeU16& size) {
|
||||
GP0.write(Command::GP0::QuickFill(color));
|
||||
|
Reference in New Issue
Block a user