Optimized/beautified previous committed code. Appears to function identically, and uses a single function throughout 16 files.
This commit is contained in:
parent
9c5a81471e
commit
236708f9b8
|
@ -99,12 +99,7 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
CDLogger_wndy = wrect.top;
|
CDLogger_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(CDLogger_wndx,CDLogger_wndy,wrect.right);
|
||||||
CDLogger_wndx = 0;
|
|
||||||
}
|
|
||||||
if (CDLogger_wndy < -18) {
|
|
||||||
CDLogger_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
|
@ -246,12 +246,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
ChtPosY = wrect.top;
|
ChtPosY = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(ChtPosX,ChtPosY,wrect.right);
|
||||||
ChtPosX = 0;
|
|
||||||
}
|
|
||||||
if (ChtPosY < -18) {
|
|
||||||
ChtPosY = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -634,12 +629,7 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
GGConv_wndy = wrect.top;
|
GGConv_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(GGConv_wndx,GGConv_wndy,wrect.right);
|
||||||
GGConv_wndx = 0;
|
|
||||||
}
|
|
||||||
if (GGConv_wndy < -18) {
|
|
||||||
GGConv_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,3 +6,22 @@ bool directoryExists(const char* dirname)
|
||||||
return res != 0xFFFFFFFF && res & FILE_ATTRIBUTE_DIRECTORY;
|
return res != 0xFFFFFFFF && res & FILE_ATTRIBUTE_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX, long windowRight)
|
||||||
|
{
|
||||||
|
if (windowRight < 59) {
|
||||||
|
windowPosX = 59 - windowSizeX;
|
||||||
|
}
|
||||||
|
if (windowPosY < -18) {
|
||||||
|
windowPosY = -18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowBoundsCheckNoResize(int &windowPosX, int &windowPosY, long windowRight)
|
||||||
|
{
|
||||||
|
if (windowRight < 59) {
|
||||||
|
windowPosX = 0;
|
||||||
|
}
|
||||||
|
if (windowPosY < -18) {
|
||||||
|
windowPosY = -18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -50,4 +50,6 @@ extern int eoptions;
|
||||||
#define EO_FOURSCORE 32768
|
#define EO_FOURSCORE 32768
|
||||||
|
|
||||||
bool directoryExists(const char* dirname);
|
bool directoryExists(const char* dirname);
|
||||||
|
void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX, long windowRight);
|
||||||
|
void WindowBoundsCheckNoResize(int &windowPosX, int &windowPosY, long windowRight);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -317,29 +317,6 @@ void SaveConfig(const char *filename)
|
||||||
}
|
}
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
|
|
||||||
//ugetab: window positions could use some bounds checking.
|
|
||||||
// MemView_wndx and MemView_wndy verified to sometimes end up -32000
|
|
||||||
//CDLogger_wndx
|
|
||||||
//CDLogger_wndy
|
|
||||||
//GGConv_wndx
|
|
||||||
//GGConv_wndy
|
|
||||||
//MainWindow_wndx
|
|
||||||
//MainWindow_wndy
|
|
||||||
//MemFind_wndx
|
|
||||||
//MemFind_wndy
|
|
||||||
//MemView_wndx
|
|
||||||
//MemView_wndy
|
|
||||||
//MemWatch_wndx
|
|
||||||
//MemWatch_wndy
|
|
||||||
//Monitor_wndx
|
|
||||||
//Monitor_wndy
|
|
||||||
//TasEdit_wndx
|
|
||||||
//TasEdit_wndy
|
|
||||||
//Tracer_wndx
|
|
||||||
//Tracer_wndy
|
|
||||||
|
|
||||||
//-----------------------------------
|
|
||||||
|
|
||||||
SaveFCEUConfig(filename,fceuconfig);
|
SaveFCEUConfig(filename,fceuconfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1085,12 +1085,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
DbgPosY = wrect.top;
|
DbgPosY = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckResize(DbgPosX,DbgPosY,DbgSizeX,wrect.right);
|
||||||
DbgPosX = 59 - DbgSizeX;
|
|
||||||
}
|
|
||||||
if (DbgPosY < -18) {
|
|
||||||
DbgPosY = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -88,12 +88,7 @@ BOOL CALLBACK LogCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
MLogPosY = wrect.top;
|
MLogPosY = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(MLogPosX,MLogPosY,wrect.right);
|
||||||
MLogPosX = 0;
|
|
||||||
}
|
|
||||||
if (MLogPosY < -18) {
|
|
||||||
MLogPosY = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1598,12 +1598,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
MemView_wndy = wrect.top;
|
MemView_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckResize(MemView_wndx,MemView_wndy,MemViewSizeX,wrect.right);
|
||||||
MemView_wndx = 59 - MemViewSizeX;
|
|
||||||
}
|
|
||||||
if (MemView_wndy < -18) {
|
|
||||||
MemView_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1706,12 +1701,7 @@ BOOL CALLBACK MemFindCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
MemFind_wndy = wrect.top;
|
MemFind_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(MemFind_wndx,MemFind_wndy,wrect.right);
|
||||||
MemFind_wndx = 0;
|
|
||||||
}
|
|
||||||
if (MemFind_wndy < -18) {
|
|
||||||
MemFind_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -726,12 +726,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
||||||
MemWatch_wndy = wrect.top;
|
MemWatch_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(MemWatch_wndx,MemWatch_wndy,wrect.right);
|
||||||
MemWatch_wndx = 0;
|
|
||||||
}
|
|
||||||
if (MemWatch_wndy < -18) {
|
|
||||||
MemWatch_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -229,12 +229,7 @@ BOOL CALLBACK MonitorCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
Monitor_wndy = wrect.top;
|
Monitor_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(Monitor_wndx,Monitor_wndy,wrect.right);
|
||||||
Monitor_wndx = 0;
|
|
||||||
}
|
|
||||||
if (Monitor_wndy < -18) {
|
|
||||||
Monitor_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -426,12 +426,7 @@ BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
NTViewPosY = wrect.top;
|
NTViewPosY = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(NTViewPosX,NTViewPosY,wrect.right);
|
||||||
NTViewPosX = 0;
|
|
||||||
}
|
|
||||||
if (NTViewPosY < -18) {
|
|
||||||
NTViewPosY = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -272,12 +272,7 @@ BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
PPUViewPosY = wrect.top;
|
PPUViewPosY = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(PPUViewPosX,PPUViewPosY,wrect.right);
|
||||||
PPUViewPosX = 0;
|
|
||||||
}
|
|
||||||
if (PPUViewPosY < -18) {
|
|
||||||
PPUViewPosY = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -832,12 +832,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
ramw_y = wrect.top;
|
ramw_y = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(ramw_x,ramw_y,wrect.right);
|
||||||
ramw_x = 0;
|
|
||||||
}
|
|
||||||
if (ramw_y < -18) {
|
|
||||||
ramw_y = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//regSetDwordValue(RAMWX, ramw_x); TODO
|
//regSetDwordValue(RAMWX, ramw_x); TODO
|
||||||
|
|
|
@ -403,12 +403,7 @@ BOOL CALLBACK ReplayMetadataDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
||||||
MetaPosY = wrect.top;
|
MetaPosY = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(MetaPosX,MetaPosY,wrect.right);
|
||||||
MetaPosX = 0;
|
|
||||||
}
|
|
||||||
if (MetaPosY < -18) {
|
|
||||||
MetaPosY = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1023,12 +1023,7 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
TasEdit_wndy = wrect.top;
|
TasEdit_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(TasEdit_wndx,TasEdit_wndy,wrect.right);
|
||||||
TasEdit_wndx = 0;
|
|
||||||
}
|
|
||||||
if (TasEdit_wndy < -18) {
|
|
||||||
TasEdit_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -877,12 +877,7 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
TextHookerPosY = wrect.top;
|
TextHookerPosY = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(TextHookerPosX,TextHookerPosY,wrect.right);
|
||||||
TextHookerPosX = 0;
|
|
||||||
}
|
|
||||||
if (TextHookerPosY < -18) {
|
|
||||||
TextHookerPosY = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -92,12 +92,7 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
Tracer_wndy = wrect.top;
|
Tracer_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(Tracer_wndx,Tracer_wndy,wrect.right);
|
||||||
Tracer_wndx = 0;
|
|
||||||
}
|
|
||||||
if (Tracer_wndy < -18) {
|
|
||||||
Tracer_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1198,12 +1198,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
MainWindow_wndy = wrect.top;
|
MainWindow_wndy = wrect.top;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (wrect.right < 59) {
|
WindowBoundsCheckNoResize(MainWindow_wndx,MainWindow_wndy,wrect.right);
|
||||||
MainWindow_wndx = 0;
|
|
||||||
}
|
|
||||||
if (MainWindow_wndy < -18) {
|
|
||||||
MainWindow_wndy = -18;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue