Bite the bullet and flip the video buffer in software.
Until a better solution is found. Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
e461847a49
commit
c2f4d8ed34
3 changed files with 28 additions and 4 deletions
6
linux.md
6
linux.md
|
@ -91,7 +91,11 @@ See [sa2](source/frontends/sa2/README.md).
|
||||||
|
|
||||||
### ra2
|
### ra2
|
||||||
|
|
||||||
There is an initial [libretro](https://docs.libretro.com/development/cores/developing-cores/) core, with minimal keyboard support and upside down video.
|
There is an initial [libretro](https://docs.libretro.com/development/cores/developing-cores/) core.
|
||||||
|
|
||||||
|
Keyboard works, but a lot of keys overlap with RetroArch shortcuts.
|
||||||
|
|
||||||
|
Video works, but the vertical flip is done in software.
|
||||||
|
|
||||||
Must be manually configured:
|
Must be manually configured:
|
||||||
``cmake -DLIBRETRO_PATH=/path/to/libretro-common``
|
``cmake -DLIBRETRO_PATH=/path/to/libretro-common``
|
||||||
|
|
|
@ -112,7 +112,10 @@ namespace
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::Game() : mySpeed(true)
|
Game::Game()
|
||||||
|
: mySpeed(true)
|
||||||
|
, myWidth(GetFrameBufferWidth())
|
||||||
|
, myHeight(GetFrameBufferHeight())
|
||||||
{
|
{
|
||||||
EmulatorOptions options;
|
EmulatorOptions options;
|
||||||
options.memclear = g_nMemoryClearType;
|
options.memclear = g_nMemoryClearType;
|
||||||
|
@ -125,6 +128,9 @@ Game::Game() : mySpeed(true)
|
||||||
|
|
||||||
InitializeRegistry(options);
|
InitializeRegistry(options);
|
||||||
initialiseEmulator();
|
initialiseEmulator();
|
||||||
|
|
||||||
|
const size_t size = myWidth * myHeight * sizeof(bgra_t);
|
||||||
|
myVideoBuffer.resize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::~Game()
|
Game::~Game()
|
||||||
|
@ -270,8 +276,18 @@ void Game::processKeyUp(unsigned keycode, uint32_t character, uint16_t key_modif
|
||||||
|
|
||||||
void Game::drawVideoBuffer()
|
void Game::drawVideoBuffer()
|
||||||
{
|
{
|
||||||
const size_t pitch = GetFrameBufferWidth() * 4;
|
const size_t pitch = myWidth * sizeof(bgra_t);
|
||||||
video_cb(g_pFramebufferbits, GetFrameBufferWidth(), GetFrameBufferHeight(), pitch);
|
// 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);
|
||||||
|
}
|
||||||
|
video_cb(myVideoBuffer.data(), myWidth, myHeight, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Game::loadGame(const char * path)
|
bool Game::loadGame(const char * path)
|
||||||
|
|
|
@ -20,7 +20,11 @@ public:
|
||||||
private:
|
private:
|
||||||
Speed mySpeed; // fixed speed
|
Speed mySpeed; // fixed speed
|
||||||
|
|
||||||
|
const size_t myHeight;
|
||||||
|
const size_t myWidth;
|
||||||
|
|
||||||
static void processKeyDown(unsigned keycode, uint32_t character, uint16_t key_modifiers);
|
static void processKeyDown(unsigned keycode, uint32_t character, uint16_t key_modifiers);
|
||||||
static void processKeyUp(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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue