win32: add background pause
This commit is contained in:
parent
197392788a
commit
dd704aa865
|
@ -1719,14 +1719,14 @@ void NDS_exec(s32 nb)
|
||||||
// but by a 22 mhz oscillator.
|
// but by a 22 mhz oscillator.
|
||||||
|
|
||||||
//zeromus way: i did this in a rush and it is not perfect, but it is more like what it needs to be
|
//zeromus way: i did this in a rush and it is not perfect, but it is more like what it needs to be
|
||||||
nds.wifiCycle += (nds.ARM7Cycle-nds7old)<<16;
|
//nds.wifiCycle += (nds.ARM7Cycle-nds7old)<<16;
|
||||||
while(nds.wifiCycle > 0)
|
//while(nds.wifiCycle > 0)
|
||||||
{
|
//{
|
||||||
nds.wifiCycle -= 946453; //22*22000000*65536/ARM7_CLOCK;
|
// nds.wifiCycle -= 946453; //22*22000000*65536/ARM7_CLOCK;
|
||||||
WIFI_usTrigger(&wifiMac);
|
// WIFI_usTrigger(&wifiMac);
|
||||||
WIFI_SoftAP_usTrigger(&wifiMac);
|
// WIFI_SoftAP_usTrigger(&wifiMac);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
//luigi's way>
|
//luigi's way>
|
||||||
/*if(nds7old < nds.ARM7Cycle)
|
/*if(nds7old < nds.ARM7Cycle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -199,7 +199,8 @@ int WndY = 0;
|
||||||
|
|
||||||
int ScreenGap = 0;
|
int ScreenGap = 0;
|
||||||
extern HWND RamSearchHWnd;
|
extern HWND RamSearchHWnd;
|
||||||
|
static BOOL lostFocusPause = TRUE;
|
||||||
|
static BOOL lastPauseFromLostFocus = FALSE;
|
||||||
static int FrameLimit = 1;
|
static int FrameLimit = 1;
|
||||||
|
|
||||||
//=========================== view tools
|
//=========================== view tools
|
||||||
|
@ -1647,6 +1648,7 @@ int _main()
|
||||||
FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName);
|
FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName);
|
||||||
CommonSettings.showGpu.main = GetPrivateProfileInt("Display", "MainGpu", 1, IniName) != 0;
|
CommonSettings.showGpu.main = GetPrivateProfileInt("Display", "MainGpu", 1, IniName) != 0;
|
||||||
CommonSettings.showGpu.sub = GetPrivateProfileInt("Display", "SubGpu", 1, IniName) != 0;
|
CommonSettings.showGpu.sub = GetPrivateProfileInt("Display", "SubGpu", 1, IniName) != 0;
|
||||||
|
lostFocusPause = GetPrivateProfileInt("Focus", "BackgroundPause", 0, IniName);
|
||||||
|
|
||||||
|
|
||||||
//Get Ram-Watch values
|
//Get Ram-Watch values
|
||||||
|
@ -2501,8 +2503,16 @@ int HandleKeyMessage(WPARAM wParam, LPARAM lParam, int modifiers)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Unpause()
|
||||||
|
{
|
||||||
|
lastPauseFromLostFocus = FALSE;
|
||||||
|
if (emu_paused) NDS_UnPause();
|
||||||
|
emu_paused = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Pause()
|
void Pause()
|
||||||
{
|
{
|
||||||
|
lastPauseFromLostFocus = FALSE;
|
||||||
if (emu_paused) NDS_UnPause();
|
if (emu_paused) NDS_UnPause();
|
||||||
else NDS_Pause();
|
else NDS_Pause();
|
||||||
emu_paused ^= 1;
|
emu_paused ^= 1;
|
||||||
|
@ -2697,6 +2707,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
//Language selection
|
//Language selection
|
||||||
|
|
||||||
|
MainWindow->checkMenu(IDC_BACKGROUNDPAUSE, MF_BYCOMMAND | ((lostFocusPause)?MF_CHECKED:MF_UNCHECKED));
|
||||||
|
|
||||||
//Save type
|
//Save type
|
||||||
const int savelist[] = {IDC_SAVETYPE1,IDC_SAVETYPE2,IDC_SAVETYPE3,IDC_SAVETYPE4,IDC_SAVETYPE5,IDC_SAVETYPE6,IDC_SAVETYPE7};
|
const int savelist[] = {IDC_SAVETYPE1,IDC_SAVETYPE2,IDC_SAVETYPE3,IDC_SAVETYPE4,IDC_SAVETYPE5,IDC_SAVETYPE6,IDC_SAVETYPE7};
|
||||||
for(int i=0;i<7;i++) MainWindow->checkMenu(savelist[i], MF_BYCOMMAND | MF_UNCHECKED);
|
for(int i=0;i<7;i++) MainWindow->checkMenu(savelist[i], MF_BYCOMMAND | MF_UNCHECKED);
|
||||||
|
@ -2773,6 +2785,23 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
UpdateWndRects(hwnd);
|
UpdateWndRects(hwnd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_KILLFOCUS:
|
||||||
|
if(lostFocusPause) {
|
||||||
|
if(!emu_paused) {
|
||||||
|
Pause();
|
||||||
|
lastPauseFromLostFocus = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
case WM_SETFOCUS:
|
||||||
|
if(lostFocusPause) {
|
||||||
|
if(lastPauseFromLostFocus) {
|
||||||
|
Unpause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
case WM_SIZING:
|
case WM_SIZING:
|
||||||
{
|
{
|
||||||
InvalidateRect(hwnd, NULL, FALSE); UpdateWindow(hwnd);
|
InvalidateRect(hwnd, NULL, FALSE); UpdateWindow(hwnd);
|
||||||
|
@ -3393,6 +3422,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
SetForegroundWindow(RamWatchHWnd);
|
SetForegroundWindow(RamWatchHWnd);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case IDC_BACKGROUNDPAUSE:
|
||||||
|
lostFocusPause = !lostFocusPause;
|
||||||
|
WritePrivateProfileInt("Focus", "BackgroundPause", (int)lostFocusPause, IniName);
|
||||||
|
return 0;
|
||||||
|
|
||||||
case IDC_SAVETYPE1: backup_setManualBackupType(0); return 0;
|
case IDC_SAVETYPE1: backup_setManualBackupType(0); return 0;
|
||||||
case IDC_SAVETYPE2: backup_setManualBackupType(1); return 0;
|
case IDC_SAVETYPE2: backup_setManualBackupType(1); return 0;
|
||||||
case IDC_SAVETYPE3: backup_setManualBackupType(2); return 0;
|
case IDC_SAVETYPE3: backup_setManualBackupType(2); return 0;
|
||||||
|
|
|
@ -100,6 +100,7 @@
|
||||||
#define IDC_8_BIT 302
|
#define IDC_8_BIT 302
|
||||||
#define IDC_16_BIT 303
|
#define IDC_16_BIT 303
|
||||||
#define IDC_32_BIT 304
|
#define IDC_32_BIT 304
|
||||||
|
#define IDC_BACKGROUNDPAUSE 305
|
||||||
#define IDC_DES_BOX 402
|
#define IDC_DES_BOX 402
|
||||||
#define IDC_R0 403
|
#define IDC_R0 403
|
||||||
#define IDC_R1 404
|
#define IDC_R1 404
|
||||||
|
@ -613,6 +614,7 @@
|
||||||
#define IDM_ABOUT 40003
|
#define IDM_ABOUT 40003
|
||||||
#define IDM_EMULATIONSETTINGS 40004
|
#define IDM_EMULATIONSETTINGS 40004
|
||||||
#define IDC_FRAMELIMIT 40005
|
#define IDC_FRAMELIMIT 40005
|
||||||
|
#define ID_CONFIG_PAUSEWHENFOCUSLOST 40005
|
||||||
#define IDC_WINDOW1_5X 40006
|
#define IDC_WINDOW1_5X 40006
|
||||||
#define IDM_WIFISETTINGS 40007
|
#define IDM_WIFISETTINGS 40007
|
||||||
#define IDM_ALWAYS_ON_TOP 40008
|
#define IDM_ALWAYS_ON_TOP 40008
|
||||||
|
@ -727,7 +729,7 @@
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40003
|
#define _APS_NEXT_COMMAND_VALUE 40008
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue