-Frameskipping is now configurable. Settings are also loaded and saved from/to the ini file

This commit is contained in:
cyberwarriorx 2006-12-09 23:47:01 +00:00
parent 3aa8497c47
commit dcdfbd1411
3 changed files with 89 additions and 1 deletions

View File

@ -91,6 +91,9 @@ SoundInterface_struct *SNDCoreList[] = {
NULL
};
int autoframeskipenab=1;
int frameskiprate=0;
LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam);
@ -102,7 +105,6 @@ DWORD WINAPI run( LPVOID lpParameter)
int wait=0;
u64 freq;
u64 OneFrameTime;
int autoframeskipenab=1;
int framestoskip=0;
int framesskipped=0;
int skipnextframe=0;
@ -215,6 +217,11 @@ DWORD WINAPI run( LPVOID lpParameter)
onesecondticks += diffticks;
lastticks = curticks;
}
else
{
if (framestoskip < 1)
framestoskip = frameskiprate + 1;
}
CWindow_RefreshALL();
Sleep(0);
@ -296,6 +303,21 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
NDS_Init();
GetPrivateProfileString("Video", "FrameSkip", "AUTO", text, 80, IniName);
if (strcmp(text, "AUTO") == 0)
{
autoframeskipenab=1;
frameskiprate=0;
CheckMenuItem(menu, IDC_FRAMESKIPAUTO, MF_BYCOMMAND | MF_CHECKED);
}
else
{
autoframeskipenab=0;
frameskiprate=atoi(text);
CheckMenuItem(menu, frameskiprate + IDC_FRAMESKIP0, MF_BYCOMMAND | MF_CHECKED);
}
sndcoretype = GetPrivateProfileInt("Sound","SoundCore", SNDCORE_DIRECTX, IniName);
sndbuffersize = GetPrivateProfileInt("Sound","SoundBufferSize", 735 * 4, IniName);
@ -989,6 +1011,46 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
return 0;
case IDC_FRAMESKIPAUTO:
case IDC_FRAMESKIP0:
case IDC_FRAMESKIP1:
case IDC_FRAMESKIP2:
case IDC_FRAMESKIP3:
case IDC_FRAMESKIP4:
case IDC_FRAMESKIP5:
case IDC_FRAMESKIP6:
case IDC_FRAMESKIP7:
case IDC_FRAMESKIP8:
case IDC_FRAMESKIP9:
{
if(LOWORD(wParam) == IDC_FRAMESKIPAUTO)
{
autoframeskipenab = 1;
WritePrivateProfileString("Video", "FrameSkip", "AUTO", IniName);
}
else
{
char text[80];
autoframeskipenab = 0;
frameskiprate = LOWORD(wParam) - IDC_FRAMESKIP0;
sprintf(text, "%d", frameskiprate);
WritePrivateProfileString("Video", "FrameSkip", text, IniName);
}
CheckMenuItem(menu, IDC_FRAMESKIPAUTO, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP0, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP1, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP2, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP3, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP4, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP5, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP6, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP7, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP8, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, IDC_FRAMESKIP9, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menu, LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED);
}
return 0;
case IDM_WEBSITE:
ShellExecute(NULL, "open", "http://desmume.sourceforge.net", NULL, NULL, SW_SHOWNORMAL);
return 0;

View File

@ -119,6 +119,18 @@ void refreshAll();
#define IDC_SAVETYPE5 186
#define IDC_SAVETYPE6 187
#define IDC_FRAMESKIPAUTO 190
#define IDC_FRAMESKIP0 191
#define IDC_FRAMESKIP1 192
#define IDC_FRAMESKIP2 193
#define IDC_FRAMESKIP3 194
#define IDC_FRAMESKIP4 195
#define IDC_FRAMESKIP5 196
#define IDC_FRAMESKIP6 197
#define IDC_FRAMESKIP7 198
#define IDC_FRAMESKIP8 199
#define IDC_FRAMESKIP9 200
#define IDD_MEM_VIEWER 301
#define IDC_8_BIT 302
#define IDC_16_BIT 303

View File

@ -347,6 +347,20 @@ MENU_PRINCIPAL MENU
}
MENUITEM "Control Config", IDM_CONFIG
MENUITEM "Sound Settings", IDM_SOUNDSETTINGS
POPUP "&Frame Skip"
{
MENUITEM "Auto", IDC_FRAMESKIPAUTO
MENUITEM "0", IDC_FRAMESKIP0
MENUITEM "1", IDC_FRAMESKIP1
MENUITEM "2", IDC_FRAMESKIP2
MENUITEM "3", IDC_FRAMESKIP3
MENUITEM "4", IDC_FRAMESKIP4
MENUITEM "5", IDC_FRAMESKIP5
MENUITEM "6", IDC_FRAMESKIP6
MENUITEM "7", IDC_FRAMESKIP7
MENUITEM "8", IDC_FRAMESKIP8
MENUITEM "9", IDC_FRAMESKIP9
}
}
POPUP "&Tools"
{