From 16cfcf42b26f1f70284c9e2b8f1f262329103a46 Mon Sep 17 00:00:00 2001 From: Jaby Date: Sun, 4 Feb 2024 21:27:11 -0500 Subject: [PATCH] Add proper NTSC conversion values --- include/PSX/GPU/gpu.hpp | 2 +- src/Library/internal-include/GPU/gpu_internal.hpp | 10 ++++++---- src/Library/src/GPU/gpu.cpp | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/PSX/GPU/gpu.hpp b/include/PSX/GPU/gpu.hpp index b12490f2..0bb5b075 100644 --- a/include/PSX/GPU/gpu.hpp +++ b/include/PSX/GPU/gpu.hpp @@ -39,7 +39,7 @@ namespace JabyEngine { GPU_IO::GP1.write(GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::Off)); } - static void set_offset(uint16_t x, uint16_t y); + static void set_offset(int16_t x, int16_t y); }; static uint32_t update_id() { diff --git a/src/Library/internal-include/GPU/gpu_internal.hpp b/src/Library/internal-include/GPU/gpu_internal.hpp index 7ab48da9..01e1e914 100644 --- a/src/Library/internal-include/GPU/gpu_internal.hpp +++ b/src/Library/internal-include/GPU/gpu_internal.hpp @@ -13,11 +13,13 @@ namespace JabyEngine { static constexpr auto Height = PublicDisplay::Height; #ifdef JABYENGINE_PAL - static constexpr auto DisplayMode = GPU_IO::DisplayMode::PAL(); - static constexpr uint16_t ScanlinesV = 288; + static constexpr auto DisplayMode = GPU_IO::DisplayMode::PAL(); + static constexpr uint16_t ScanlinesV = 288; + static constexpr auto DisplayRange = PositionI16::create(78, 35); #else - static constexpr auto DisplayMode = GPU_IO::DisplayMode::NTSC(); - static constexpr uint16_t ScanlinesV = 240; + static constexpr auto DisplayMode = GPU_IO::DisplayMode::NTSC(); + static constexpr uint16_t ScanlinesV = 240; + static constexpr auto DisplayRange = PositionI16::create(76, 16); #endif //JABYENGINE_PAL static uint32_t exchange_buffer_and_display(); diff --git a/src/Library/src/GPU/gpu.cpp b/src/Library/src/GPU/gpu.cpp index bdf903d1..43ece9cd 100644 --- a/src/Library/src/GPU/gpu.cpp +++ b/src/Library/src/GPU/gpu.cpp @@ -73,9 +73,9 @@ namespace JabyEngine { } } - void Display :: set_offset(uint16_t x, uint16_t y) { - x += 78; - y += 35; + void Display :: set_offset(int16_t x, int16_t y) { + x += internal::Display::DisplayRange.x; + y += internal::Display::DisplayRange.y; GPU_IO::GP1.write(GPU_IO::Command::HorizontalDisplayRange((x << 3), (x + Display::Width) << 3)); GPU_IO::GP1.write(GPU_IO::Command::VerticalDisplayRange(y, y + Display::Height));