Make emulator output size properly configurable

This commit is contained in:
wheremyfoodat 2023-10-01 16:28:14 +03:00
parent 27a04a806e
commit c10a3e7160
8 changed files with 30 additions and 7 deletions

View file

@ -524,7 +524,7 @@ void RendererGL::display() {
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
screenFramebuffer.bind(OpenGL::ReadFramebuffer);
glBlitFramebuffer(0, 0, 400, 480, 0, 0, 400, 480, GL_COLOR_BUFFER_BIT, GL_LINEAR);
glBlitFramebuffer(0, 0, 400, 480, 0, 0, outputWindowWidth, outputWindowHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR);
}
void RendererGL::clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) {

View file

@ -28,12 +28,6 @@ Emulator::Emulator()
Helpers::warn("Failed to initialize SDL2 GameController: %s", SDL_GetError());
}
// We need OpenGL for software rendering or for OpenGL if it's enabled
bool needOpenGL = config.rendererType == RendererType::Software;
#ifdef PANDA3DS_ENABLE_OPENGL
needOpenGL = needOpenGL || (config.rendererType == RendererType::OpenGL);
#endif
#ifdef PANDA3DS_ENABLE_DISCORD_RPC
if (config.discordRpcEnabled) {
discordRpc.init();
@ -41,6 +35,12 @@ Emulator::Emulator()
}
#endif
// We need OpenGL for software rendering or for OpenGL if it's enabled
bool needOpenGL = config.rendererType == RendererType::Software;
#ifdef PANDA3DS_ENABLE_OPENGL
needOpenGL = needOpenGL || (config.rendererType == RendererType::OpenGL);
#endif
// Only create SDL Window for SDL frontend
#ifdef PANDA3DS_FRONTEND_SDL
if (needOpenGL) {

View file

@ -27,6 +27,7 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
connect(themeSelect, &QComboBox::currentIndexChanged, this, [&](int index) { setTheme(static_cast<Theme>(index)); });
emu = new Emulator();
emu->setOutputSize(screen.surfaceWidth, screen.surfaceHeight);
// The emulator graphics context for the thread should be initialized in the emulator thread due to how GL contexts work
emuThread = std::thread([&]() {

View file

@ -105,6 +105,9 @@ std::optional<WindowInfo> ScreenWidget::getWindowInfo() {
wi.surface_height = static_cast<u32>(scaledWindowHeight());
wi.surface_scale = static_cast<float>(devicePixelRatioFromScreen());
surfaceWidth = wi.surface_width;
surfaceHeight = wi.surface_height;
return wi;
}
#endif