- added custom LCDs layout: vertical, horizontal and one LCD (default hotkeys: End - change layout, PageDown - swap screens);
This commit is contained in:
mtabachenko 2009-11-02 11:56:54 +00:00
parent 0539d6039d
commit 53e61f0ece
6 changed files with 516 additions and 116 deletions

View File

@ -37,6 +37,7 @@
#include "pathsettings.h" #include "pathsettings.h"
#include "GPU_osd.h" #include "GPU_osd.h"
#include "path.h" #include "path.h"
#include "video.h"
extern LRESULT OpenFile(); //adelikat: Made this an extern here instead of main.h Seemed icky not to limit the scope of this function extern LRESULT OpenFile(); //adelikat: Made this an extern here instead of main.h Seemed icky not to limit the scope of this function
@ -206,6 +207,21 @@ void HK_AutoHoldClearKeyDown(int, bool justPressed) {
NDS_releaseTouch(); NDS_releaseTouch();
} }
extern VideoInfo video;
extern void doLCDsLayout();
void HK_LCDsMode(int)
{
video.layout++;
if (video.layout > 2) video.layout = 0;
doLCDsLayout();
}
extern void LCDsSwap();
void HK_LCDsSwap(int)
{
LCDsSwap();
}
void HK_Reset(int, bool justPressed) {ResetGame();} void HK_Reset(int, bool justPressed) {ResetGame();}
void HK_RecordAVI(int, bool justPressed) { if (AVI_IsRecording()) AviEnd(); else AviRecordTo(); } void HK_RecordAVI(int, bool justPressed) { if (AVI_IsRecording()) AviEnd(); else AviRecordTo(); }
@ -621,6 +637,7 @@ void InitCustomKeys (SCustomKeys *keys)
keys->TurboStart.page = HOTKEY_PAGE_TURBO; keys->TurboStart.page = HOTKEY_PAGE_TURBO;
keys->TurboStart.key = NULL; keys->TurboStart.key = NULL;
// Movie/Tools page -----------------------------------------
keys->Rewind.handleKeyDown = HK_RewindKeyDown; keys->Rewind.handleKeyDown = HK_RewindKeyDown;
keys->Rewind.handleKeyUp = HK_RewindKeyUp; keys->Rewind.handleKeyUp = HK_RewindKeyUp;
keys->Rewind.code = "Rewind"; keys->Rewind.code = "Rewind";
@ -646,6 +663,19 @@ void InitCustomKeys (SCustomKeys *keys)
keys->MostRecentLuaScript.page = HOTKEY_PAGE_MOVIE; keys->MostRecentLuaScript.page = HOTKEY_PAGE_MOVIE;
keys->MostRecentLuaScript.key = NULL; keys->MostRecentLuaScript.key = NULL;
keys->LCDsMode.handleKeyUp = HK_LCDsMode;
keys->LCDsMode.code = "LCDsLayoutMode";
keys->LCDsMode.name = L"LCDs layout mode";
keys->LCDsMode.page = HOTKEY_PAGE_MOVIE;
keys->LCDsMode.key = VK_END;
keys->LCDsSwap.handleKeyUp = HK_LCDsSwap;
keys->LCDsSwap.code = "LCDsSwap";
keys->LCDsSwap.name = L"LCDs swap";
keys->LCDsSwap.page = HOTKEY_PAGE_MOVIE;
keys->LCDsSwap.key = VK_NEXT;
//StateSlots Page --------------------------------------------------
keys->NextSaveSlot.handleKeyDown = HK_NextSaveSlot; keys->NextSaveSlot.handleKeyDown = HK_NextSaveSlot;
keys->NextSaveSlot.code = "NextSaveSlot"; keys->NextSaveSlot.code = "NextSaveSlot";
keys->NextSaveSlot.name = L"Next Save Slot"; keys->NextSaveSlot.name = L"Next Save Slot";

View File

@ -91,6 +91,8 @@ struct SCustomKeys
SCustomKey ToggleLag; SCustomKey ToggleLag;
SCustomKey ResetLagCounter; SCustomKey ResetLagCounter;
SCustomKey StylusAutoHold; SCustomKey StylusAutoHold;
SCustomKey LCDsMode;
SCustomKey LCDsSwap;
SCustomKey LastItem; // dummy, must be last SCustomKey LastItem; // dummy, must be last
//--methods-- //--methods--

View File

@ -188,7 +188,7 @@ LPDIRECTDRAWCLIPPER lpDDClipBack=NULL;
#define WM_CUSTINVOKE (WM_USER+52) #define WM_CUSTINVOKE (WM_USER+52)
void DesEnableMenuItem(HMENU hMenu, UINT uIDEnableItem, bool enable);
inline bool IsDlgCheckboxChecked(HWND hDlg, int id) inline bool IsDlgCheckboxChecked(HWND hDlg, int id)
{ {
return IsDlgButtonChecked(hDlg,id) == BST_CHECKED; return IsDlgButtonChecked(hDlg,id) == BST_CHECKED;
@ -395,8 +395,26 @@ void ScaleScreen(float factor)
int defh = GetPrivateProfileInt("Video", "Window height", 384, IniName); int defh = GetPrivateProfileInt("Video", "Window height", 384, IniName);
// fix for wrong rotation // fix for wrong rotation
int w1x = video.rotatedwidthgap(); int w1x = 0;
int h1x = video.rotatedheightgap(); int h1x = 0;
if (video.layout == 0)
{
w1x = video.rotatedwidthgap();
h1x = video.rotatedheightgap();
}
else
if (video.layout == 1)
{
w1x = video.rotatedwidthgap() * 2;
h1x = video.rotatedheightgap() / 2;
}
else
if (video.layout == 2)
{
w1x = video.rotatedwidthgap();
h1x = video.rotatedheightgap() / 2;
}
if((defw > defh) != (w1x > h1x)) if((defw > defh) != (w1x > h1x))
{ {
int temp = defw; int temp = defw;
@ -404,6 +422,7 @@ void ScaleScreen(float factor)
defh = temp; defh = temp;
} }
// fix for wrong gap // fix for wrong gap
if(defh*w1x < h1x*defw) if(defh*w1x < h1x*defw)
defh = defw*h1x/w1x; defh = defw*h1x/w1x;
else if(defw*h1x < w1x*defh) else if(defw*h1x < w1x*defh)
@ -417,7 +436,14 @@ void ScaleScreen(float factor)
factor = 1.5f; factor = 1.5f;
else if(factor==65534) else if(factor==65534)
factor = 2.5f; factor = 2.5f;
MainWindow->setClientSize((int)(video.rotatedwidthgap() * factor), (int)(video.rotatedheightgap() * factor)); if (video.layout == 0)
MainWindow->setClientSize((int)(video.rotatedwidthgap() * factor), (int)(video.rotatedheightgap() * factor));
else
if (video.layout == 1)
MainWindow->setClientSize((int)(video.rotatedwidthgap() * factor * 2), (int)(video.rotatedheightgap() * factor / 2));
else
if (video.layout == 2)
MainWindow->setClientSize((int)(video.rotatedwidthgap() * factor), (int)(video.rotatedheightgap() * factor / 2));
} }
} }
@ -434,23 +460,43 @@ void UnscaleScreenCoords(s32& x, s32& y)
RECT r; RECT r;
HWND hwnd = MainWindow->getHWnd(); HWND hwnd = MainWindow->getHWnd();
GetClientRect(hwnd,&r); GetClientRect(hwnd,&r);
int defwidth = video.width, defheight = (video.height+video.screengap); int defwidth = video.width;
int defheight = video.height;
int winwidth = (r.right-r.left), winheight = (r.bottom-r.top); int winwidth = (r.right-r.left), winheight = (r.bottom-r.top);
// translate from scaling (screen resolution to 256x384 or 512x192) if (video.layout == 0)
switch (video.rotation)
{ {
case 0: defheight += video.screengap;
case 180:
x = (x*defwidth) / winwidth; // translate from scaling (screen resolution to 256x384 or 512x192)
y = (y*defheight) / winheight; switch (video.rotation)
break ; {
case 90: case 0:
case 270: case 180:
x = (x*defheight) / winwidth; x = (x*defwidth) / winwidth;
y = (y*defwidth) / winheight; y = (y*defheight) / winheight;
break ; break ;
case 90:
case 270:
x = (x*defheight) / winwidth;
y = (y*defwidth) / winheight;
break ;
}
} }
else
if (video.layout == 1)
{
//INFO("----- coords x = %i, y = %i\n", x, y);
x = (x*defwidth) / winwidth * 2;
y = (y*defheight) / winheight / 2;
}
else
if (video.layout == 2)
{
//INFO("----- coords x = %i, y = %i\n", x, y);
x = (x*defwidth) / winwidth;
y = (y*defheight) / winheight / 2;
}
x = x/video.ratio(); x = x/video.ratio();
y = y/video.ratio(); y = y/video.ratio();
@ -462,36 +508,54 @@ void UnscaleScreenCoords(s32& x, s32& y)
void ToDSScreenRelativeCoords(s32& x, s32& y, bool bottomScreen) void ToDSScreenRelativeCoords(s32& x, s32& y, bool bottomScreen)
{ {
s32 tx=x, ty=y; s32 tx=x, ty=y;
int gapSize = video.screengap / video.ratio();
// first deal with rotation if (video.layout == 0)
switch(video.rotation)
{ {
case 90: int gapSize = video.screengap / video.ratio();
x = ty; // first deal with rotation
y = (383+gapSize)-tx; switch(video.rotation)
break; {
case 180: case 90:
x = 255-tx; x = ty;
y = (383+gapSize)-ty; y = (383+gapSize)-tx;
break; break;
case 270: case 180:
x = 255-ty; x = 255-tx;
y = tx; y = (383+gapSize)-ty;
break; break;
case 270:
x = 255-ty;
y = tx;
break;
}
// then deal with screen gap
if(y > 191 + gapSize)
y -= gapSize;
else if(y > 191 + gapSize/2)
y = 192;
else if(y > 191)
y = 191;
// finally, make it relative to the correct screen
if(bottomScreen)
y -= 192;
} }
else
// then deal with screen gap if (video.layout == 1)
if(y > 191 + gapSize) {
y -= gapSize; if (video.swap == 0)
else if(y > 191 + gapSize/2) x = tx - 255;
y = 192; else
else if(y > 191) x = tx;
y = 191; //INFO("X=%i, Y=%i (tx = %i, ty = %i)\n", x, y, tx, ty);
}
// finally, make it relative to the correct screen else
if(bottomScreen) if (video.layout == 2)
y -= 192; {
x = tx;
//INFO("X=%i, Y=%i (tx = %i, ty = %i)\n", x, y, tx, ty);
}
} }
// END Rotation definitions // END Rotation definitions
@ -888,6 +952,135 @@ template<typename T, int bpp> static void doRotate(void* dst)
} }
} }
void UpdateWndRects(HWND hwnd);
void LCDsSwap()
{
video.swap = !video.swap;
MainWindow->checkMenu(ID_LCDS_SWAP, !video.swap);
WritePrivateProfileInt("Video", "LCDsSwap", video.swap, IniName);
}
void doLCDsLayout()
{
RECT rc = { 0 };
int oldheight, oldwidth;
int newheight, newwidth;
GetClientRect(MainWindow->getHWnd(), &rc);
oldwidth = (rc.right - rc.left);
oldheight = (rc.bottom - rc.top);
newwidth = oldwidth;
newheight = oldheight;
if (video.layout == 0)
{
DesEnableMenuItem(mainMenu, IDC_ROTATE0, true);
DesEnableMenuItem(mainMenu, IDC_ROTATE90, true);
DesEnableMenuItem(mainMenu, IDC_ROTATE180, true);
DesEnableMenuItem(mainMenu, IDC_ROTATE270, true);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NONE, true);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_BORDER, true);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NDSGAP, true);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NDSGAP2, true);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_DRAGEDIT, true);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORWHITE, true);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORGRAY, true);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORBLACK, true);
if (video.layout_old == 1)
{
newwidth = oldwidth / 2;
newheight = oldheight * 2;
}
else
if (video.layout_old == 2)
{
newwidth = oldwidth;
newheight = oldheight * 2;
}
else
{
newwidth = oldwidth;
newheight = oldheight;
}
MainWindow->checkMenu(ID_LCDS_VERTICAL, true);
MainWindow->checkMenu(ID_LCDS_HORIZONTAL, false);
MainWindow->checkMenu(ID_LCDS_ONE, false);
}
else
{
DesEnableMenuItem(mainMenu, IDC_ROTATE0, false);
DesEnableMenuItem(mainMenu, IDC_ROTATE90, false);
DesEnableMenuItem(mainMenu, IDC_ROTATE180, false);
DesEnableMenuItem(mainMenu, IDC_ROTATE270, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NONE, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_BORDER, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NDSGAP, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NDSGAP2, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_DRAGEDIT, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORWHITE, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORGRAY, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORBLACK, false);
if (video.layout == 1)
{
if (video.layout_old == 0)
{
newwidth = oldwidth * 2;
newheight = oldheight / 2;
}
else
if (video.layout_old == 2)
{
newwidth = oldwidth * 2;
newheight = oldheight;
}
else
{
newwidth = oldwidth;
newheight = oldheight;
}
MainWindow->checkMenu(ID_LCDS_HORIZONTAL, false);
MainWindow->checkMenu(ID_LCDS_VERTICAL, true);
MainWindow->checkMenu(ID_LCDS_ONE, false);
}
else
if (video.layout == 2)
{
if (video.layout_old == 0)
{
newwidth = oldwidth;
newheight = oldheight / 2;
}
else
if (video.layout_old == 1)
{
newwidth = oldwidth / 2;
newheight = oldheight;
}
else
{
newwidth = oldwidth;
newheight = oldheight;
}
MainWindow->checkMenu(ID_LCDS_HORIZONTAL, false);
MainWindow->checkMenu(ID_LCDS_VERTICAL, false);
MainWindow->checkMenu(ID_LCDS_ONE, true);
}
else
return;
}
video.layout_old = video.layout;
WritePrivateProfileInt("Video", "LCDsLayout", video.layout, IniName);
SetMinWindowSize();
MainWindow->setClientSize(newwidth, newheight);
UpdateWndRects(MainWindow->getHWnd());
}
//the directdraw final presentation portion of display, including rotating //the directdraw final presentation portion of display, including rotating
static void DD_DoDisplay() static void DD_DoDisplay()
{ {
@ -923,21 +1116,27 @@ static void DD_DoDisplay()
lpBackSurface->Unlock((LPRECT)ddsd.lpSurface); lpBackSurface->Unlock((LPRECT)ddsd.lpSurface);
// Main screen if (video.layout != 2)
if(lpPrimarySurface->Blt(&MainScreenRect, lpBackSurface, &MainScreenSrcRect, DDBLT_WAIT, 0) == DDERR_SURFACELOST) {
// Main screen
if(lpPrimarySurface->Blt(&MainScreenRect, lpBackSurface, (video.swap == 0)?&MainScreenSrcRect:&SubScreenSrcRect, DDBLT_WAIT, 0) == DDERR_SURFACELOST)
{
LOG("DirectDraw buffers is lost\n");
if(IDirectDrawSurface7_Restore(lpPrimarySurface) == DD_OK)
IDirectDrawSurface7_Restore(lpBackSurface);
}
}
// Sub screen
if(lpPrimarySurface->Blt(video.layout == 2?&MainScreenRect:&SubScreenRect, lpBackSurface, (video.swap == 0)?&SubScreenSrcRect:&MainScreenSrcRect, DDBLT_WAIT, 0) == DDERR_SURFACELOST)
{ {
LOG("DirectDraw buffers is lost\n"); LOG("DirectDraw buffers is lost\n");
if(IDirectDrawSurface7_Restore(lpPrimarySurface) == DD_OK) if(IDirectDrawSurface7_Restore(lpPrimarySurface) == DD_OK)
IDirectDrawSurface7_Restore(lpBackSurface); IDirectDrawSurface7_Restore(lpBackSurface);
} }
// Sub screen if (video.layout == 1) return;
if(lpPrimarySurface->Blt(&SubScreenRect, lpBackSurface, &SubScreenSrcRect, DDBLT_WAIT, 0) == DDERR_SURFACELOST) if (video.layout == 2) return;
{
LOG("DirectDraw buffers is lost\n");
if(IDirectDrawSurface7_Restore(lpPrimarySurface) == DD_OK)
IDirectDrawSurface7_Restore(lpBackSurface);
}
// Gap // Gap
if(video.screengap > 0) if(video.screengap > 0)
@ -1396,7 +1595,7 @@ DWORD WINAPI run()
InitSpeedThrottle(); InitSpeedThrottle();
osd->setRotate(video.rotation); osd->setRotate(video.rotation);
//doLCDsLayout();
if (DirectDrawCreateEx(NULL, (LPVOID*)&lpDDraw, IID_IDirectDraw7, NULL) != DD_OK) if (DirectDrawCreateEx(NULL, (LPVOID*)&lpDDraw, IID_IDirectDraw7, NULL) != DD_OK)
{ {
MessageBox(hwnd,"Unable to initialize DirectDraw","Error",MB_OK); MessageBox(hwnd,"Unable to initialize DirectDraw","Error",MB_OK);
@ -1899,6 +2098,13 @@ int _main()
if(WndY < -10000) WndY = CW_USEDEFAULT; // (happens if you close desmume while it's minimized) if(WndY < -10000) WndY = CW_USEDEFAULT; // (happens if you close desmume while it's minimized)
video.width = GetPrivateProfileInt("Video", "Width", 256, IniName); video.width = GetPrivateProfileInt("Video", "Width", 256, IniName);
video.height = GetPrivateProfileInt("Video", "Height", 384, IniName); video.height = GetPrivateProfileInt("Video", "Height", 384, IniName);
video.layout_old = video.layout = GetPrivateProfileInt("Video", "LCDsLayout", 0, IniName);
if (video.layout > 2)
{
video.layout = video.layout_old = 0;
}
video.swap = GetPrivateProfileInt("Video", "LCDsSwap", 0, IniName);
if (video.swap > 1) video.swap = 1;
CommonSettings.hud.FpsDisplay = GetPrivateProfileBool("Display","Display Fps", false, IniName); CommonSettings.hud.FpsDisplay = GetPrivateProfileBool("Display","Display Fps", false, IniName);
CommonSettings.hud.FrameCounterDisplay = GetPrivateProfileBool("Display","FrameCounter", false, IniName); CommonSettings.hud.FrameCounterDisplay = GetPrivateProfileBool("Display","FrameCounter", false, IniName);
@ -2317,23 +2523,14 @@ void UpdateWndRects(HWND hwnd)
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
if((video.rotation == 90) || (video.rotation == 270)) if (video.layout == 1)
{ {
wndWidth = (rc.bottom - rc.top); wndWidth = (rc.bottom - rc.top);
wndHeight = (rc.right - rc.left); wndHeight = (rc.right - rc.left);
}
else
{
wndWidth = (rc.right - rc.left);
wndHeight = (rc.bottom - rc.top);
}
ratio = ((float)wndHeight / (float)defHeight); ratio = ((float)wndHeight / (float)defHeight);
oneScreenHeight = (int)((video.height/2) * ratio); oneScreenHeight = (int)((video.height/2) * ratio);
gapHeight = (wndHeight - (oneScreenHeight * 2));
if((video.rotation == 90) || (video.rotation == 270))
{
// Main screen // Main screen
ptClient.x = rc.left; ptClient.x = rc.left;
ptClient.y = rc.top; ptClient.y = rc.top;
@ -2346,81 +2543,134 @@ void UpdateWndRects(HWND hwnd)
MainScreenRect.right = ptClient.x; MainScreenRect.right = ptClient.x;
MainScreenRect.bottom = ptClient.y; MainScreenRect.bottom = ptClient.y;
//if there was no specified screen gap, extend the top screen to cover the extra column
if(video.screengap == 0) MainScreenRect.right += gapHeight;
// Sub screen // Sub screen
ptClient.x = (rc.left + oneScreenHeight + gapHeight); ptClient.x = (rc.left + oneScreenHeight);
ptClient.y = rc.top; ptClient.y = rc.top;
ClientToScreen(hwnd, &ptClient); ClientToScreen(hwnd, &ptClient);
SubScreenRect.left = ptClient.x; SubScreenRect.left = ptClient.x;
SubScreenRect.top = ptClient.y; SubScreenRect.top = ptClient.y;
ptClient.x = (rc.left + oneScreenHeight + gapHeight + oneScreenHeight); ptClient.x = (rc.left + oneScreenHeight + oneScreenHeight);
ptClient.y = (rc.top + wndWidth); ptClient.y = (rc.top + wndWidth);
ClientToScreen(hwnd, &ptClient); ClientToScreen(hwnd, &ptClient);
SubScreenRect.right = ptClient.x; SubScreenRect.right = ptClient.x;
SubScreenRect.bottom = ptClient.y; SubScreenRect.bottom = ptClient.y;
// Gap
GapRect.left = (rc.left + oneScreenHeight);
GapRect.top = rc.top;
GapRect.right = (rc.left + oneScreenHeight + gapHeight);
GapRect.bottom = (rc.top + wndWidth);
} }
else else
if (video.layout == 2)
{ {
wndWidth = (rc.bottom - rc.top);
wndHeight = (rc.right - rc.left);
ratio = ((float)wndHeight / (float)defHeight);
oneScreenHeight = (int)((video.height) * ratio);
// Main screen // Main screen
ptClient.x = rc.left; ptClient.x = rc.left;
ptClient.y = rc.top; ptClient.y = rc.top;
ClientToScreen(hwnd, &ptClient); ClientToScreen(hwnd, &ptClient);
MainScreenRect.left = ptClient.x; MainScreenRect.left = ptClient.x;
MainScreenRect.top = ptClient.y; MainScreenRect.top = ptClient.y;
ptClient.x = (rc.left + wndWidth); ptClient.x = (rc.left + oneScreenHeight);
ptClient.y = (rc.top + oneScreenHeight); ptClient.y = (rc.top + wndWidth);
ClientToScreen(hwnd, &ptClient); ClientToScreen(hwnd, &ptClient);
MainScreenRect.right = ptClient.x; MainScreenRect.right = ptClient.x;
MainScreenRect.bottom = ptClient.y; MainScreenRect.bottom = ptClient.y;
}
else
if (video.layout == 0)
{
if((video.rotation == 90) || (video.rotation == 270))
{
wndWidth = (rc.bottom - rc.top);
wndHeight = (rc.right - rc.left);
}
else
{
wndWidth = (rc.right - rc.left);
wndHeight = (rc.bottom - rc.top);
}
//if there was no specified screen gap, extend the top screen to cover the extra row ratio = ((float)wndHeight / (float)defHeight);
if(video.screengap == 0) MainScreenRect.bottom += gapHeight; oneScreenHeight = (int)((video.height/2) * ratio);
gapHeight = (wndHeight - (oneScreenHeight * 2));
// Sub screen if((video.rotation == 90) || (video.rotation == 270))
ptClient.x = rc.left; {
ptClient.y = (rc.top + oneScreenHeight + gapHeight); // Main screen
ClientToScreen(hwnd, &ptClient); ptClient.x = rc.left;
SubScreenRect.left = ptClient.x; ptClient.y = rc.top;
SubScreenRect.top = ptClient.y; ClientToScreen(hwnd, &ptClient);
ptClient.x = (rc.left + wndWidth); MainScreenRect.left = ptClient.x;
ptClient.y = (rc.top + oneScreenHeight + gapHeight + oneScreenHeight); MainScreenRect.top = ptClient.y;
ClientToScreen(hwnd, &ptClient); ptClient.x = (rc.left + oneScreenHeight);
SubScreenRect.right = ptClient.x; ptClient.y = (rc.top + wndWidth);
SubScreenRect.bottom = ptClient.y; ClientToScreen(hwnd, &ptClient);
MainScreenRect.right = ptClient.x;
MainScreenRect.bottom = ptClient.y;
// Gap //if there was no specified screen gap, extend the top screen to cover the extra column
GapRect.left = rc.left; if(video.screengap == 0) MainScreenRect.right += gapHeight;
GapRect.top = (rc.top + oneScreenHeight);
GapRect.right = (rc.left + wndWidth); // Sub screen
GapRect.bottom = (rc.top + oneScreenHeight + gapHeight); ptClient.x = (rc.left + oneScreenHeight + gapHeight);
ptClient.y = rc.top;
ClientToScreen(hwnd, &ptClient);
SubScreenRect.left = ptClient.x;
SubScreenRect.top = ptClient.y;
ptClient.x = (rc.left + oneScreenHeight + gapHeight + oneScreenHeight);
ptClient.y = (rc.top + wndWidth);
ClientToScreen(hwnd, &ptClient);
SubScreenRect.right = ptClient.x;
SubScreenRect.bottom = ptClient.y;
// Gap
GapRect.left = (rc.left + oneScreenHeight);
GapRect.top = rc.top;
GapRect.right = (rc.left + oneScreenHeight + gapHeight);
GapRect.bottom = (rc.top + wndWidth);
}
else
{
// Main screen
ptClient.x = rc.left;
ptClient.y = rc.top;
ClientToScreen(hwnd, &ptClient);
MainScreenRect.left = ptClient.x;
MainScreenRect.top = ptClient.y;
ptClient.x = (rc.left + wndWidth);
ptClient.y = (rc.top + oneScreenHeight);
ClientToScreen(hwnd, &ptClient);
MainScreenRect.right = ptClient.x;
MainScreenRect.bottom = ptClient.y;
//if there was no specified screen gap, extend the top screen to cover the extra row
if(video.screengap == 0) MainScreenRect.bottom += gapHeight;
// Sub screen
ptClient.x = rc.left;
ptClient.y = (rc.top + oneScreenHeight + gapHeight);
ClientToScreen(hwnd, &ptClient);
SubScreenRect.left = ptClient.x;
SubScreenRect.top = ptClient.y;
ptClient.x = (rc.left + wndWidth);
ptClient.y = (rc.top + oneScreenHeight + gapHeight + oneScreenHeight);
ClientToScreen(hwnd, &ptClient);
SubScreenRect.right = ptClient.x;
SubScreenRect.bottom = ptClient.y;
// Gap
GapRect.left = rc.left;
GapRect.top = (rc.top + oneScreenHeight);
GapRect.right = (rc.left + wndWidth);
GapRect.bottom = (rc.top + oneScreenHeight + gapHeight);
}
} }
} }
void UpdateScreenRects() void UpdateScreenRects()
{ {
if((video.rotation == 90) || (video.rotation == 270)) if (video.layout == 1)
{
// Main screen
MainScreenSrcRect.left = 0;
MainScreenSrcRect.top = 0;
MainScreenSrcRect.right = video.height/2;
MainScreenSrcRect.bottom = video.width;
// Sub screen
SubScreenSrcRect.left = video.height/2;
SubScreenSrcRect.top = 0;
SubScreenSrcRect.right = video.height;
SubScreenSrcRect.bottom = video.width;
}
else
{ {
// Main screen // Main screen
MainScreenSrcRect.left = 0; MainScreenSrcRect.left = 0;
@ -2434,6 +2684,52 @@ void UpdateScreenRects()
SubScreenSrcRect.right = video.width; SubScreenSrcRect.right = video.width;
SubScreenSrcRect.bottom = video.height; SubScreenSrcRect.bottom = video.height;
} }
else
if (video.layout == 2)
{
// Main screen
MainScreenSrcRect.left = 0;
MainScreenSrcRect.top = 0;
MainScreenSrcRect.right = video.width;
MainScreenSrcRect.bottom = video.height/2;
// Sub screen
SubScreenSrcRect.left = 0;
SubScreenSrcRect.top = video.height/2;
SubScreenSrcRect.right = video.width;
SubScreenSrcRect.bottom = video.height;
}
else
{
if((video.rotation == 90) || (video.rotation == 270))
{
// Main screen
MainScreenSrcRect.left = 0;
MainScreenSrcRect.top = 0;
MainScreenSrcRect.right = video.height/2;
MainScreenSrcRect.bottom = video.width;
// Sub screen
SubScreenSrcRect.left = video.height/2;
SubScreenSrcRect.top = 0;
SubScreenSrcRect.right = video.height;
SubScreenSrcRect.bottom = video.width;
}
else
{
// Main screen
MainScreenSrcRect.left = 0;
MainScreenSrcRect.top = 0;
MainScreenSrcRect.right = video.width;
MainScreenSrcRect.bottom = video.height/2;
// Sub screen
SubScreenSrcRect.left = 0;
SubScreenSrcRect.top = video.height/2;
SubScreenSrcRect.right = video.width;
SubScreenSrcRect.bottom = video.height;
}
}
} }
// re-run the aspect ratio calculations if enabled // re-run the aspect ratio calculations if enabled
@ -3065,6 +3361,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
//Pause //Pause
MainWindow->checkMenu(IDM_PAUSE, ((paused))); MainWindow->checkMenu(IDM_PAUSE, ((paused)));
// LCDs layout
MainWindow->checkMenu(ID_LCDS_VERTICAL, ((video.layout==0)));
MainWindow->checkMenu(ID_LCDS_HORIZONTAL, ((video.layout==1)));
MainWindow->checkMenu(ID_LCDS_ONE, ((video.layout==2)));
MainWindow->checkMenu(ID_LCDS_SWAP, video.swap);
//Force Maintain Ratio //Force Maintain Ratio
MainWindow->checkMenu(IDC_FORCERATIO, ((ForceRatio))); MainWindow->checkMenu(IDC_FORCERATIO, ((ForceRatio)));
//Screen rotation //Screen rotation
@ -3146,6 +3447,22 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
// recent/active scripts menu // recent/active scripts menu
PopulateLuaSubmenu(); PopulateLuaSubmenu();
if (video.layout != 0)
{
DesEnableMenuItem(mainMenu, IDC_ROTATE0, false);
DesEnableMenuItem(mainMenu, IDC_ROTATE90, false);
DesEnableMenuItem(mainMenu, IDC_ROTATE180, false);
DesEnableMenuItem(mainMenu, IDC_ROTATE270, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NONE, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_BORDER, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NDSGAP, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_NDSGAP2, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_DRAGEDIT, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORWHITE, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORGRAY, false);
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORBLACK, false);
}
return 0; return 0;
} }
@ -3264,9 +3581,28 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{ {
bool horizontalDrag = (wParam == WMSZ_LEFT) || (wParam == WMSZ_RIGHT); bool horizontalDrag = (wParam == WMSZ_LEFT) || (wParam == WMSZ_RIGHT);
bool verticalDrag = (wParam == WMSZ_TOP) || (wParam == WMSZ_BOTTOM); bool verticalDrag = (wParam == WMSZ_TOP) || (wParam == WMSZ_BOTTOM);
int minX = video.rotatedwidthgap(); int minX = 0;
int minY = video.rotatedheightgap(); int minY = 0;
if(verticalDrag && !sideways && SeparationBorderDrag)
if (video.layout == 0)
{
minX = video.rotatedwidthgap();
minY = video.rotatedheightgap();
}
else
if (video.layout == 1)
{
minX = video.rotatedwidthgap() * 2;
minY = video.rotatedheightgap() / 2;
}
else
if (video.layout == 2)
{
minX = video.rotatedwidthgap();
minY = video.rotatedheightgap() / 2;
}
if(verticalDrag && sideways && SeparationBorderDrag)
{ {
forceRatioFlags |= WINCLASS::KEEPX; forceRatioFlags |= WINCLASS::KEEPX;
minY = (MainScreenRect.bottom - MainScreenRect.top) + (SubScreenRect.bottom - SubScreenRect.top); minY = (MainScreenRect.bottom - MainScreenRect.top) + (SubScreenRect.bottom - SubScreenRect.top);
@ -3289,6 +3625,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
MainWindow->sizingMsg(wParam, lParam, forceRatioFlags); MainWindow->sizingMsg(wParam, lParam, forceRatioFlags);
if (video.layout == 1) return 1;
if (video.layout == 2) return 1;
if(setGap) if(setGap)
{ {
@ -3500,6 +3838,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
} }
else else
{ {
if ((video.layout == 2) && (video.swap == 1)) return 0;
ToDSScreenRelativeCoords(x,y,true); ToDSScreenRelativeCoords(x,y,true);
if(x<0) x = 0; else if(x>255) x = 255; if(x<0) x = 0; else if(x>255) x = 255;
if(y<0) y = 0; else if(y>192) y = 192; if(y<0) y = 0; else if(y>192) y = 192;
@ -4099,6 +4438,28 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDM_STOPMOVIE: case IDM_STOPMOVIE:
FCEUI_StopMovie(); FCEUI_StopMovie();
return 0; return 0;
case ID_LCDS_VERTICAL:
if (video.layout == 0) return 0;
video.layout = 0;
doLCDsLayout();
return 0;
case ID_LCDS_HORIZONTAL:
if (video.layout == 1) return 0;
video.layout = 1;
doLCDsLayout();
return 0;
case ID_LCDS_ONE:
if (video.layout == 2) return 0;
video.layout = 2;
doLCDsLayout();
return 0;
case ID_LCDS_SWAP:
LCDsSwap();
return 0;
case ID_VIEW_FRAMECOUNTER: case ID_VIEW_FRAMECOUNTER:
CommonSettings.hud.FrameCounterDisplay ^= true; CommonSettings.hud.FrameCounterDisplay ^= true;
WritePrivateProfileBool("Display", "Display Fps", CommonSettings.hud.FpsDisplay, IniName); WritePrivateProfileBool("Display", "Display Fps", CommonSettings.hud.FpsDisplay, IniName);
@ -5000,7 +5361,7 @@ static LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam
void ResetGame() void ResetGame()
{ {
if(movieMode != MOVIEMODE_PLAY) if(movieMode != MOVIEMODE_PLAY)
NDS_Reset(); NDS_Reset();
} }
//adelikat: This function changes a menu item's text //adelikat: This function changes a menu item's text

View File

@ -704,6 +704,10 @@
#define IDC_BGMAP_ROTSCALE 40052 #define IDC_BGMAP_ROTSCALE 40052
#define IDM_SHUT_UP 40053 #define IDM_SHUT_UP 40053
#define IDC_WINDOW2_5X 40054 #define IDC_WINDOW2_5X 40054
#define ID_LCDS_VERTICAL 40055
#define ID_LCDS_HORIZONTAL 40056
#define ID_LCDS_ONE 40057
#define ID_LCDS_SWAP 40058
#define IDC_LABEL_UP 50000 #define IDC_LABEL_UP 50000
#define IDC_LABEL_RIGHT 50001 #define IDC_LABEL_RIGHT 50001
#define IDC_LABEL_LEFT 50002 #define IDC_LABEL_LEFT 50002

Binary file not shown.

View File

@ -9,6 +9,9 @@ public:
int rotation; int rotation;
int screengap; int screengap;
int layout;
int layout_old;
int swap;
int currentfilter; int currentfilter;