mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
Make emulator output size properly configurable
This commit is contained in:
parent
27a04a806e
commit
c10a3e7160
8 changed files with 30 additions and 7 deletions
|
@ -113,6 +113,9 @@ class GPU {
|
|||
u32 readInternalReg(u32 index);
|
||||
void writeInternalReg(u32 index, u32 value, u32 mask);
|
||||
|
||||
// Used for setting the size of the window we'll be outputting graphics to
|
||||
void setOutputSize(u32 width, u32 height) { renderer->setOutputSize(width, height); }
|
||||
|
||||
// TODO: Emulate the transfer engine & its registers
|
||||
// Then this can be emulated by just writing the appropriate values there
|
||||
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) { renderer->clearBuffer(startAddress, endAddress, value, control); }
|
||||
|
|
|
@ -120,5 +120,7 @@ class Emulator {
|
|||
void initGraphicsContext() { gpu.initGraphicsContext(window); }
|
||||
#endif
|
||||
|
||||
void setOutputSize(u32 width, u32 height) { gpu.setOutputSize(width, height); }
|
||||
|
||||
EmulatorConfig& getConfig() { return config; }
|
||||
};
|
||||
|
|
|
@ -13,6 +13,10 @@ class ScreenWidget : public QWidget {
|
|||
ScreenWidget(QWidget* parent = nullptr);
|
||||
GL::Context* getGLContext() { return glContext.get(); }
|
||||
|
||||
// Dimensions of our output surface
|
||||
u32 surfaceWidth = 0;
|
||||
u32 surfaceHeight = 0;
|
||||
|
||||
private:
|
||||
std::unique_ptr<GL::Context> glContext = nullptr;
|
||||
bool createGLContext();
|
||||
|
|
|
@ -40,6 +40,11 @@ class Renderer {
|
|||
u32 depthBufferLoc;
|
||||
PICA::DepthFmt depthBufferFormat;
|
||||
|
||||
// Width and height of the window we're outputting to, needed for properly scaling the final image
|
||||
// We initialize it to the 3DS resolution by default and the frontend can notify us if it changes via the setOutputSize function
|
||||
u32 outputWindowWidth = 400;
|
||||
u32 outputWindowHeight = 240 * 2;
|
||||
|
||||
public:
|
||||
Renderer(GPU& gpu, const std::array<u32, regNum>& internalRegs, const std::array<u32, extRegNum>& externalRegs);
|
||||
virtual ~Renderer();
|
||||
|
@ -78,4 +83,9 @@ class Renderer {
|
|||
|
||||
void setColourBufferLoc(u32 loc) { colourBufferLoc = loc; }
|
||||
void setDepthBufferLoc(u32 loc) { depthBufferLoc = loc; }
|
||||
|
||||
void setOutputSize(u32 width, u32 height) {
|
||||
outputWindowWidth = width;
|
||||
outputWindowHeight = height;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue