Skip to content

Commit 208a328

Browse files
committed
Desktop: fix some minor screen split issues
1 parent 0f6fac0 commit 208a328

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/desktop/noo_canvas.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ NooCanvas::NooCanvas(NooFrame *frame): CANVAS_CLASS(frame, wxID_ANY, CANVAS_PARA
7272
SetFocus();
7373
}
7474

75+
NooCanvas::~NooCanvas()
76+
{
77+
// Free the framebuffer if it was allocated
78+
if (frame->mainFrame)
79+
delete[] framebuffer;
80+
}
81+
7582
void NooCanvas::drawScreen(int x, int y, int w, int h, int wb, int hb, uint32_t *buf)
7683
{
7784
#ifdef USE_GL_CANVAS
@@ -165,8 +172,9 @@ void NooCanvas::draw(wxPaintEvent &event)
165172
else if (frame->partner)
166173
{
167174
// Draw one of the DS screens
168-
drawScreen(layout.topX, layout.topY, layout.topWidth, layout.topHeight, 256 << shift,
169-
192 << shift, &framebuffer[!frame->mainFrame * ((256 * 192) << (shift * 2))]);
175+
bool bottom = !frame->mainFrame ^ (ScreenLayout::screenSizing == 2);
176+
drawScreen(layout.topX, layout.topY, layout.topWidth, layout.topHeight,
177+
256 << shift, 192 << shift, &framebuffer[bottom * ((256 * 192) << (shift * 2))]);
170178
}
171179
else
172180
{

src/desktop/noo_canvas.h

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class NooCanvas: public CANVAS_CLASS
4343
bool gbaMode = false;
4444

4545
NooCanvas(NooFrame *frame);
46+
~NooCanvas();
47+
4648
void resetFrame() { sizeReset = 2; }
4749
void finish() { finished = true; }
4850

src/desktop/noo_frame.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ void NooFrame::Refresh()
250250
// Create the partner frame if needed
251251
partner = new NooFrame(app, id, "", this);
252252
partner->core = core;
253+
partner->running = running;
253254
}
254255
else if (!split && partner)
255256
{
@@ -811,13 +812,13 @@ void NooFrame::dropFiles(wxDropFilesEvent &event)
811812
if (event.GetNumberOfFiles() != 1) return;
812813
wxString path = event.GetFiles()[0];
813814
if (!wxFileExists(path)) return;
814-
loadRomPath((const char*)path.mb_str(wxConvUTF8));
815+
(mainFrame ? this : partner)->loadRomPath((const char*)path.mb_str(wxConvUTF8));
815816
}
816817

817818
void NooFrame::close(wxCloseEvent &event)
818819
{
819820
// Properly shut down the emulator
820-
mainFrame ? stopCore(true) : partner->stopCore(true);
821+
(mainFrame ? this : partner)->stopCore(true);
821822
app->removeFrame(id);
822823
canvas->finish();
823824
if (partner) delete partner;

0 commit comments

Comments
 (0)