remember window size.

fix extra shit.
This commit is contained in:
StapleButter 2017-03-29 20:12:03 +02:00
parent 2ae2fedf21
commit f88226c99f
4 changed files with 32 additions and 12 deletions

View File

@ -28,6 +28,11 @@ namespace Config
int KeyMapping[12];
int JoyMapping[12];
int WindowWidth;
int WindowHeight;
int DirectBoot;
typedef struct
{
char Name[16];
@ -67,6 +72,11 @@ ConfigEntry ConfigFile[] =
{"Joy_X", 0, &JoyMapping[10], -1, NULL, 0},
{"Joy_Y", 0, &JoyMapping[11], -1, NULL, 0},
{"WindowWidth", 0, &WindowWidth, 256, NULL, 0},
{"WindowHeight", 0, &WindowHeight, 384, NULL, 0},
{"DirectBoot", 0, &DirectBoot, 1, NULL, 0},
{"", -1, NULL, 0, NULL, 0}
};

View File

@ -30,6 +30,11 @@ void Save();
extern int KeyMapping[12];
extern int JoyMapping[12];
extern int WindowWidth;
extern int WindowHeight;
extern int DirectBoot;
}
#endif // CONFIG_H

View File

@ -26,12 +26,6 @@
#include "InputConfig.h"
bool Touching;
int WindowX, WindowY;
int WindowW, WindowH;
wxIMPLEMENT_APP_NO_MAIN(wxApp_melonDS);
@ -153,8 +147,6 @@ MainFrame::MainFrame()
GetMenuBar()->Enable(ID_PAUSE, false);
GetMenuBar()->Enable(ID_RESET, false);
Touching = false;
joy = NULL;
joyid = -1;
}
@ -169,6 +161,7 @@ void MainFrame::OnClose(wxCloseEvent& event)
{
if (emuthread)
{
emuthread->EmuPause();
emuthread->EmuExit();
emuthread->Wait();
@ -188,6 +181,8 @@ void MainFrame::OnClose(wxCloseEvent& event)
SDL_Quit();
Destroy();
Config::Save();
}
void MainFrame::OnCloseFromMenu(wxCommandEvent& event)
@ -320,7 +315,7 @@ wxThread::ExitCode EmuThread::Entry()
sdlwin = SDL_CreateWindow("melonDS " MELONDS_VERSION,
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
256, 384,
Config::WindowWidth, Config::WindowHeight,
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
SDL_SetWindowMinimumSize(sdlwin, 256, 384);
@ -344,6 +339,7 @@ wxThread::ExitCode EmuThread::Entry()
botdst.x = 0; botdst.y = 192;
botdst.w = 256; botdst.h = 192;
Touching = false;
axismask = 0;
u32 nframes = 0;
@ -356,6 +352,8 @@ wxThread::ExitCode EmuThread::Entry()
ProcessEvents();
if (emustatus == 0) break;
if (emustatus == 1)
{
u32 starttick = SDL_GetTicks();
@ -413,7 +411,6 @@ wxThread::ExitCode EmuThread::Entry()
lasttick = SDL_GetTicks();
fpslimitcount = 0;
emupaused = true;
Sleep(50);
SDL_RenderCopy(sdlrend, sdltex, NULL, NULL);
@ -424,6 +421,8 @@ wxThread::ExitCode EmuThread::Entry()
char* melontitle = "Paused - melonDS " MELONDS_VERSION;
SDL_SetWindowTitle(sdlwin, melontitle);
}
emupaused = true;
}
}
@ -449,7 +448,7 @@ void EmuThread::ProcessEvents()
wxThread* thread = parent->emuthread;
parent->CloseFromOutside();
EmuExit();
delete thread;
//delete thread;
return;
}
if (evt.window.event != SDL_WINDOWEVENT_EXPOSED)
@ -486,10 +485,12 @@ void EmuThread::ProcessEvents()
botdst.x = 0; botdst.y = screenh + gap;
botdst.w = w; botdst.h = screenh;
}
Config::WindowWidth = w;
Config::WindowHeight = h;
}
SDL_GetWindowPosition(sdlwin, &WindowX, &WindowY);
SDL_GetWindowSize(sdlwin, &WindowW, &WindowH);
}
break;

View File

@ -102,6 +102,10 @@ protected:
SDL_Rect topsrc, topdst;
SDL_Rect botsrc, botdst;
bool Touching;
int WindowX, WindowY;
void* texpixels;
int texstride;