Only draw the borderless video buffer.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
986cf9b896
commit
e6532deea3
3 changed files with 27 additions and 16 deletions
|
@ -47,8 +47,6 @@ namespace
|
|||
|
||||
Game::Game()
|
||||
: mySpeed(true)
|
||||
, myWidth(GetFrameBufferWidth())
|
||||
, myHeight(GetFrameBufferHeight())
|
||||
{
|
||||
EmulatorOptions options;
|
||||
options.memclear = g_nMemoryClearType;
|
||||
|
@ -62,7 +60,17 @@ Game::Game()
|
|||
InitializeRegistry(options);
|
||||
initialiseEmulator();
|
||||
|
||||
const size_t size = myWidth * myHeight * sizeof(bgra_t);
|
||||
myBorderlessWidth = GetFrameBufferBorderlessWidth();
|
||||
myBorderlessHeight = GetFrameBufferBorderlessHeight();
|
||||
const size_t borderWidth = GetFrameBufferBorderWidth();
|
||||
const size_t borderHeight = GetFrameBufferBorderHeight();
|
||||
const size_t width = GetFrameBufferWidth();
|
||||
myHeight = GetFrameBufferHeight();
|
||||
|
||||
myPitch = width * sizeof(bgra_t);
|
||||
myOffset = (width * borderHeight + borderWidth) * sizeof(bgra_t);
|
||||
|
||||
const size_t size = myHeight * myPitch;
|
||||
myVideoBuffer.resize(size);
|
||||
}
|
||||
|
||||
|
@ -209,18 +217,18 @@ void Game::processKeyUp(unsigned keycode, uint32_t character, uint16_t key_modif
|
|||
|
||||
void Game::drawVideoBuffer()
|
||||
{
|
||||
const size_t pitch = myWidth * sizeof(bgra_t);
|
||||
// this should not be necessary
|
||||
// either libretro handles it
|
||||
// or we should change AW
|
||||
// but for now, there is no alternative
|
||||
for (size_t row = 0; row < myHeight; ++row)
|
||||
{
|
||||
const uint8_t * src = g_pFramebufferbits + row * pitch;
|
||||
uint8_t * dst = myVideoBuffer.data() + (myHeight - row - 1) * pitch;
|
||||
memcpy(dst, src, pitch);
|
||||
const uint8_t * src = g_pFramebufferbits + row * myPitch;
|
||||
uint8_t * dst = myVideoBuffer.data() + (myHeight - row - 1) * myPitch;
|
||||
memcpy(dst, src, myPitch);
|
||||
}
|
||||
video_cb(myVideoBuffer.data(), myWidth, myHeight, pitch);
|
||||
|
||||
video_cb(myVideoBuffer.data() + myOffset, myBorderlessWidth, myBorderlessHeight, myPitch);
|
||||
}
|
||||
|
||||
bool Game::loadGame(const char * path)
|
||||
|
|
|
@ -19,12 +19,15 @@ public:
|
|||
|
||||
private:
|
||||
Speed mySpeed; // fixed speed
|
||||
std::vector<uint8_t> myVideoBuffer;
|
||||
|
||||
size_t myPitch;
|
||||
size_t myOffset;
|
||||
size_t myHeight;
|
||||
size_t myBorderlessWidth;
|
||||
size_t myBorderlessHeight;
|
||||
|
||||
const size_t myHeight;
|
||||
const size_t myWidth;
|
||||
|
||||
static void processKeyDown(unsigned keycode, uint32_t character, uint16_t key_modifiers);
|
||||
static void processKeyUp(unsigned keycode, uint32_t character, uint16_t key_modifiers);
|
||||
|
||||
std::vector<uint8_t> myVideoBuffer;
|
||||
};
|
||||
|
|
|
@ -62,10 +62,10 @@ void retro_get_system_av_info(retro_system_av_info *info)
|
|||
{
|
||||
log_cb(RETRO_LOG_INFO, "RA2: %s\n", __FUNCTION__);
|
||||
|
||||
info->geometry.base_width = GetFrameBufferWidth();
|
||||
info->geometry.base_height = GetFrameBufferHeight();
|
||||
info->geometry.max_width = GetFrameBufferWidth();
|
||||
info->geometry.max_height = GetFrameBufferHeight();
|
||||
info->geometry.base_width = GetFrameBufferBorderlessWidth();
|
||||
info->geometry.base_height = GetFrameBufferBorderlessHeight();
|
||||
info->geometry.max_width = GetFrameBufferBorderlessWidth();
|
||||
info->geometry.max_height = GetFrameBufferBorderlessHeight();
|
||||
info->geometry.aspect_ratio = 0;
|
||||
|
||||
info->timing.fps = 60;
|
||||
|
|
Loading…
Add table
Reference in a new issue