parent
31a9cb55de
commit
b464ea0461
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2008-2011 DeSmuME team
|
||||
Copyright 2008-2013 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,7 +24,8 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////// Console
|
||||
#define BUFFER_SIZE 100
|
||||
HANDLE hConsole = NULL;
|
||||
HANDLE hConsole = NULL;
|
||||
HWND gConsoleWnd = NULL;
|
||||
void printlog(const char *fmt, ...);
|
||||
|
||||
std::wstring SkipEverythingButProgramInCommandLine(wchar_t* cmdLine)
|
||||
|
@ -112,7 +113,6 @@ void OpenConsole()
|
|||
|
||||
//newer and improved console title:
|
||||
SetConsoleTitleW(SkipEverythingButProgramInCommandLine(GetCommandLineW()).c_str());
|
||||
|
||||
if(shouldRedirectStdout)
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
|
@ -120,19 +120,47 @@ void OpenConsole()
|
|||
freopen("CONIN$", "r", stdin);
|
||||
}
|
||||
|
||||
gConsoleWnd = GetConsoleWindow();
|
||||
if (gConsoleWnd)
|
||||
{
|
||||
RECT rc = {0};
|
||||
if (GetWindowRect(gConsoleWnd, &rc))
|
||||
{
|
||||
rc.left = GetPrivateProfileInt("Console", "PosX", rc.left, IniName);
|
||||
rc.top = GetPrivateProfileInt("Console", "PosY", rc.top, IniName);
|
||||
rc.right = GetPrivateProfileInt("Console", "Width", (rc.right - rc.left), IniName);
|
||||
rc.bottom = GetPrivateProfileInt("Console", "Height", (rc.bottom - rc.top), IniName);
|
||||
SetWindowPos(gConsoleWnd, NULL, rc.left, rc.top, rc.right, rc.bottom, SWP_NOACTIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
printlog("%s\n",EMU_DESMUME_NAME_AND_VERSION());
|
||||
printlog("- compiled: %s %s\n",__DATE__,__TIME__);
|
||||
if(attached) printf("\nuse cmd /c desmume.exe to get more sensible console behaviour\n");
|
||||
printlog("\n");
|
||||
}
|
||||
|
||||
void CloseConsole() {
|
||||
if (hConsole == NULL) return;
|
||||
printlog("Closing...");
|
||||
FreeConsole();
|
||||
void CloseConsole()
|
||||
{
|
||||
RECT pos = {0};
|
||||
|
||||
if (GetWindowRect(gConsoleWnd, &pos))
|
||||
{
|
||||
WritePrivateProfileInt("Console", "PosX", pos.left, IniName);
|
||||
WritePrivateProfileInt("Console", "PosY", pos.top, IniName);
|
||||
WritePrivateProfileInt("Console", "Width", (pos.right - pos.left), IniName);
|
||||
WritePrivateProfileInt("Console", "Height", (pos.bottom - pos.top), IniName);
|
||||
}
|
||||
FreeConsole();
|
||||
hConsole = NULL;
|
||||
}
|
||||
|
||||
void ConsoleTop(bool top)
|
||||
{
|
||||
if (!gConsoleWnd) return;
|
||||
SetWindowPos(gConsoleWnd, (top?HWND_TOPMOST:HWND_NOTOPMOST), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
||||
}
|
||||
|
||||
void printlog(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2008-2009 DeSmuME team
|
||||
Copyright 2008-2013 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,5 +32,6 @@
|
|||
|
||||
void OpenConsole();
|
||||
void CloseConsole();
|
||||
void ConsoleAlwaysTop(bool top);
|
||||
|
||||
#endif
|
|
@ -441,6 +441,8 @@ int romnum = 0;
|
|||
DWORD threadID;
|
||||
|
||||
WINCLASS *MainWindow=NULL;
|
||||
bool gShowConsole = false;
|
||||
bool gConsoleTopmost = false;
|
||||
|
||||
//HWND hwnd;
|
||||
//HDC hdc;
|
||||
|
@ -2543,8 +2545,9 @@ int MenuInit()
|
|||
|
||||
ResetSaveStateTimes();
|
||||
|
||||
HMENU configMenu = GetSubMenuByIdOfFirstChild(mainMenu,IDM_3DCONFIG);
|
||||
HMENU advancedMenu = GetSubMenuByIdOfFirstChild(configMenu,ID_ADVANCED);
|
||||
HMENU configMenu = GetSubMenuByIdOfFirstChild(mainMenu, IDM_3DCONFIG);
|
||||
HMENU advancedMenu = GetSubMenuByIdOfFirstChild(configMenu, ID_ADVANCED);
|
||||
HMENU toolsMenu = GetSubMenuByIdOfFirstChild(mainMenu, IDM_DISASSEMBLER);
|
||||
DeleteMenu(advancedMenu,ID_ADVANCED,MF_BYCOMMAND);
|
||||
|
||||
#ifndef DEVELOPER_MENU_ITEMS
|
||||
|
@ -2575,6 +2578,9 @@ int MenuInit()
|
|||
DeleteMenu(configMenu,GetSubMenuIndexByHMENU(configMenu,advancedMenu),MF_BYPOSITION);
|
||||
#endif
|
||||
|
||||
if (!gShowConsole)
|
||||
DeleteMenu(toolsMenu, IDM_CONSOLE_ALWAYS_ON_TOP, MF_BYCOMMAND);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3532,8 +3538,14 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
|||
static const bool defaultConsoleEnable = false;
|
||||
#endif
|
||||
|
||||
if(GetPrivateProfileBool("Display", "Show Console", defaultConsoleEnable, IniName))
|
||||
gShowConsole = GetPrivateProfileBool("Display", "Show Console", defaultConsoleEnable, IniName);
|
||||
gConsoleTopmost = GetPrivateProfileBool("Console", "Always On Top", false, IniName);
|
||||
|
||||
if (gShowConsole)
|
||||
{
|
||||
OpenConsole(); // Init debug console
|
||||
ConsoleAlwaysTop(gConsoleTopmost);
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
int ret = _main();
|
||||
|
@ -4526,7 +4538,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
MainWindow->checkMenu(IDM_RENDER_LQ2X, video.currentfilter == video.LQ2X );
|
||||
MainWindow->checkMenu(IDM_RENDER_LQ2XS, video.currentfilter == video.LQ2XS );
|
||||
MainWindow->checkMenu(IDM_RENDER_HQ2X, video.currentfilter == video.HQ2X );
|
||||
MainWindow->checkMenu(IDM_RENDER_HQ4X, video.currentfilter == video.HQ4X );
|
||||
MainWindow->checkMenu(IDM_RENDER_HQ4X, video.currentfilter == video.HQ4X );
|
||||
MainWindow->checkMenu(IDM_RENDER_HQ2XS, video.currentfilter == video.HQ2XS );
|
||||
MainWindow->checkMenu(IDM_RENDER_2XSAI, video.currentfilter == video._2XSAI );
|
||||
MainWindow->checkMenu(IDM_RENDER_SUPER2XSAI, video.currentfilter == video.SUPER2XSAI );
|
||||
|
@ -4580,6 +4592,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORBLACK, false);
|
||||
}
|
||||
|
||||
// Tools
|
||||
MainWindow->checkMenu(IDM_CONSOLE_ALWAYS_ON_TOP, gConsoleTopmost);
|
||||
|
||||
UpdateHotkeyAssignments(); //Add current hotkey mappings to menu item names
|
||||
|
||||
CallRegisteredLuaFunctions(LUACALL_ONINITMENU);
|
||||
|
@ -6064,6 +6079,14 @@ DOKEYDOWN:
|
|||
}
|
||||
return 0;
|
||||
|
||||
case IDM_CONSOLE_ALWAYS_ON_TOP:
|
||||
{
|
||||
gConsoleTopmost = !gConsoleTopmost;
|
||||
ConsoleAlwaysTop(gConsoleTopmost);
|
||||
WritePrivateProfileBool("Console", "Always On Top", gConsoleTopmost, IniName);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case IDM_SHOWTOOLBAR:
|
||||
{
|
||||
bool maximized = IsZoomed(hwnd)==TRUE;
|
||||
|
|
|
@ -710,6 +710,7 @@
|
|||
#define IDC_SNDCTRL_LEFTOUTTEXT 1468
|
||||
#define IDC_SNDCTRL_RIGHTOUT 1469
|
||||
#define IDC_SNDCTRL_RIGHTOUTTEXT 1470
|
||||
#define IDM_CONSOLE_ALWAYS_ON_TOP 1500
|
||||
#define IDC_SOUND0MUTE 2001
|
||||
#define IDC_SOUND1MUTE 2002
|
||||
#define IDC_SOUND2MUTE 2003
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue