Example #1
0
static void WriteFirmConfig(const FirmwareConfig &fwConfig)
{
	char temp_str[27];
	int i;

    WritePrivateProfileInt("Firmware","favColor", fwConfig.favoriteColor,IniName);
    WritePrivateProfileInt("Firmware","bMonth", fwConfig.birthdayMonth,IniName);
    WritePrivateProfileInt("Firmware","bDay",fwConfig.birthdayDay,IniName);
    WritePrivateProfileInt("Firmware","Language",fwConfig.language,IniName);

	/* FIXME: harshly only use the lower byte of the UTF-16 character.
	 * This would cause strange behaviour if the user could set UTF-16 but
	 * they cannot yet.
	 */
	for ( i = 0; i < fwConfig.nicknameLength; i++) {
		temp_str[i] = fwConfig.nickname[i];
	}
	temp_str[i] = '\0';
    WritePrivateProfileString("Firmware", "nickName", temp_str, IniName);

	for ( i = 0; i < fwConfig.messageLength; i++) {
		temp_str[i] = fwConfig.message[i];
	}
	temp_str[i] = '\0';
	WritePrivateProfileString("Firmware","Message", temp_str, IniName);
}
Example #2
0
static void WriteFirmConfig( struct NDS_fw_config_data *fw_config)
{
	char temp_str[27];
	int i;
    GetINIPath(IniName,MAX_PATH);

    WritePrivateProfileInt("Firmware","favColor", fw_config->fav_colour,IniName);
    WritePrivateProfileInt("Firmware","bMonth", fw_config->birth_month,IniName);
    WritePrivateProfileInt("Firmware","bDay",fw_config->birth_day,IniName);
    WritePrivateProfileInt("Firmware","Language",fw_config->language,IniName);

	/* FIXME: harshly only use the lower byte of the UTF-16 character.
	 * This would cause strange behaviour if the user could set UTF-16 but
	 * they cannot yet.
	 */
	for ( i = 0; i < fw_config->nickname_len; i++) {
		temp_str[i] = fw_config->nickname[i];
	}
	temp_str[i] = '\0';
    WritePrivateProfileString("Firmware", "nickName", temp_str, IniName);

	for ( i = 0; i < fw_config->message_len; i++) {
		temp_str[i] = fw_config->message[i];
	}
	temp_str[i] = '\0';
	WritePrivateProfileString("Firmware","Message", temp_str, IniName);
}
Example #3
0
CEditBar::~CEditBar()
{
    WritePrivateProfileInt("Main", "History" , m_nHistorySize, szGLOBAL_PROFILE);
    WritePrivateProfileInt("Main", "ClearInput" , m_bClearInput, szGLOBAL_PROFILE);
	WritePrivateProfileInt("Main", "TokenInput" , m_bTokenInput, szGLOBAL_PROFILE);
	WritePrivateProfileInt("Main", "ScrollEnd" , m_bScrollEnd, szGLOBAL_PROFILE);
	WritePrivateProfileInt("Main", "KillOneToken" , m_bKillOneToken, szGLOBAL_PROFILE);
}
Example #4
0
plExportDlgImp::~plExportDlgImp()
{
    const char* path = plMaxConfig::GetPluginIni();
    WritePrivateProfileInt("Export", "X", fXPos, path);
    WritePrivateProfileInt("Export", "Y", fYPos, path);

    WritePrivateProfileString("Export", "Dir", fExportSourceDir, path);
}
Example #5
0
void SaveConf() {
	const std::string file(s_strIniPath + "/dev9ghz.ini");
	DeleteFile(file.c_str());

	WritePrivateProfileString("DEV9", "Eth", config.Eth, file.c_str());
	WritePrivateProfileString("DEV9", "Hdd", config.Hdd, file.c_str());
	WritePrivateProfileInt("DEV9", "HddSize", config.HddSize, file.c_str());
	WritePrivateProfileInt("DEV9", "ethEnable", config.ethEnable, file.c_str());
	WritePrivateProfileInt("DEV9", "hddEnable", config.hddEnable, file.c_str());
}
Example #6
0
void  WriteFirmConfig(void)
{   
    GetINIPath(IniName,MAX_PATH);

    WritePrivateProfileInt("Firmware","favColor",firmware.favColor,IniName);
    WritePrivateProfileInt("Firmware","bMonth",firmware.bMonth,IniName);
    WritePrivateProfileInt("Firmware","bDay",firmware.bDay,IniName);
    WritePrivateProfileInt("Firmware","Language",firmware.language,IniName);
    WritePrivateProfileString("Firmware","nickName", firmware.nickName, IniName);
    WritePrivateProfileString("Firmware","Message", firmware.message, IniName);
}
Example #7
0
void GBAslotDialog(HWND hwnd)
{
	temp_type = addon_type;
	last_type = temp_type;
	strcpy(tmp_cflash_filename, CFlashName);
	strcpy(tmp_cflash_path, CFlashPath);
	strcpy(tmp_gbagame_filename, GBAgameName);
	tmp_CFlashUseRomPath = CFlashUseRomPath;
	tmp_CFlashUsePath = CFlashUsePath;
	u32 res=DialogBox(hAppInst, MAKEINTRESOURCE(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc);
	if (res)
	{
		switch (temp_type)
		{
			case NDS_ADDON_NONE:
				break;
			case NDS_ADDON_CFLASH:
				CFlashUsePath = tmp_CFlashUsePath;
				WritePrivateProfileInt("GBAslot.CFlash","usePath",CFlashUsePath,IniName);
				if (tmp_CFlashUsePath)
				{
					if (tmp_CFlashUseRomPath)
					{
						CFlashUseRomPath = tmp_CFlashUseRomPath;
						WritePrivateProfileInt("GBAslot.CFlash","useRomPath",CFlashUseRomPath,IniName);
						break;
					}
					strcpy(CFlashPath, tmp_cflash_path);
					WritePrivateProfileString("GBAslot.CFlash","path",CFlashPath,IniName);
					break;
				}
				strcpy(CFlashName, tmp_cflash_filename);
				WritePrivateProfileString("GBAslot.CFlash","filename",CFlashName,IniName);
				break;
			case NDS_ADDON_RUMBLEPAK:
				break;
			case NDS_ADDON_GBAGAME:
				strcpy(GBAgameName, tmp_gbagame_filename);
				WritePrivateProfileString("GBAslot.GBAgame","filename",GBAgameName,IniName);
				break;
			default:
				return;
		}
		WritePrivateProfileInt("GBAslot","type",temp_type,IniName);
		addon_type = temp_type;
		addonsChangePak(addon_type);
		if (romloaded)
			NDS_Reset();
	}
}
Example #8
0
void SaveIniSettings(){

	SaveSettings();

	WritePrivateProfileInt("Video", "aspectratio", pcejin.aspectRatio, IniName);
	WritePrivateProfileInt("Video", "pcejin.windowSize", pcejin.windowSize, IniName);
	WritePrivateProfileInt("Main", "Muted", soundDriver->userMute, IniName);
	WritePrivateProfileInt("Main", "WndX", WndX, IniName);
	WritePrivateProfileInt("Main", "WndY", WndY, IniName);

	//RamWatch Settings
	WritePrivateProfileBool("RamWatch", "AutoRWLoad", AutoRWLoad, IniName);
	WritePrivateProfileBool("RamWatch", "SaveWindowPos", RWSaveWindowPos, IniName);
	WritePrivateProfileInt("RamWatch", "WindowX", ramw_x, IniName);
	WritePrivateProfileInt("RamWatch", "WindowY", ramw_y, IniName);
	
	for(int i = 0; i < MAX_RECENT_WATCHES; i++)
		{
			char str[256];
			sprintf(str, "Recent Watch %d", i+1);
			WritePrivateProfileString("Watches", str, &rw_recent_files[i][0], IniName);	
		}
	RecentROMs.SaveRecentItemsToIni(IniName, "General");
	RecentMovies.SaveRecentItemsToIni(IniName, "General");
	RecentLua.SaveRecentItemsToIni(IniName, "General");

}
Example #9
0
File: sexe.c Project: buzz26/toyBox
//
//	.ini ファイルに書き込み
//
void set_inifile(void)
{
	TCHAR temp[MAX_PATH];

	WritePrivateProfileString(HEADER, KEY_EXE, exe_name, ini_name);
	// 2009/8/26
	encode_copy(temp, option_name);
	WritePrivateProfileString(HEADER, KEY_OPTION, temp, ini_name);
	WritePrivateProfileString(HEADER, KEY_NAME, service_name, ini_name);
	WritePrivateProfileString(HEADER, KEY_DESCRIPTION, description_name, ini_name);
	WritePrivateProfileInt(HEADER, KEY_END, end_pattern, ini_name);
	// 2004/8/9
	WritePrivateProfileInt(HEADER, KEY_AUTO, auto_flag, ini_name);
	WritePrivateProfileInt(HEADER, KEY_DESKTOP, desktop_flag, ini_name);
	WritePrivateProfileInt(HEADER, KEY_RETRY, retry_flag, ini_name);
	// 2009/8/26
	WritePrivateProfileInt(HEADER, KEY_ENCODE, 1, ini_name);
}
Example #10
0
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_CONTEXTMENU:
			TrackPopupMenu(GetSubMenu(GetMenu(hwnd),0),TPM_LEFTALIGN,GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam),0,hwnd,NULL);
		break;
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case ID_EXIT:
					DestroyWindow(hwnd);
				break;
				case 11:
				case 12:
				case 13:
				case 14:
				case 15:
				case 16:
				case 17:
				case 18:
				case 19:
				case 20:
					if (GetMenuState(GetMenu(hwnd), LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED)
						CheckMenuItem(GetMenu(hwnd), LOWORD(wParam), MF_BYCOMMAND | MF_UNCHECKED);
					else
						CheckMenuItem(GetMenu(hwnd),LOWORD(wParam),MF_BYCOMMAND|MF_CHECKED);
				break;
			}
		break;
		case WM_DESTROY:
			WritePrivateProfileInt("window","height",height,configfile);
			WritePrivateProfileInt("window","width",width,configfile);
			PostQuitMessage(0);
		break;
		case WM_SIZE:
			width = LOWORD(lParam);
			height = HIWORD(lParam);
		break;
		default:
			return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}
Example #11
0
void WritePathSettings()
{
	WritePrivateProfileString(SECTION, ROMKEY, path.pathToRoms, IniName);
	WritePrivateProfileString(SECTION, BATTERYKEY, path.pathToBattery, IniName);
	WritePrivateProfileString(SECTION, STATEKEY, path.pathToStates, IniName);
	WritePrivateProfileString(SECTION, SCREENSHOTKEY, path.pathToScreenshots, IniName);
	WritePrivateProfileString(SECTION, AVIKEY, path.pathToAviFiles, IniName);
	WritePrivateProfileString(SECTION, CHEATKEY, path.pathToCheats, IniName);
	WritePrivateProfileInt(SECTION, R4FORMATKEY, path.r4Format, IniName);
	WritePrivateProfileString(SECTION, SOUNDKEY, path.pathToSounds, IniName);
	WritePrivateProfileString(SECTION, FIRMWAREKEY, path.pathToFirmware, IniName);
	WritePrivateProfileString(SECTION, LUAKEY, path.pathToLua, IniName);

	WritePrivateProfileString(SECTION, FORMATKEY, path.screenshotFormat, IniName);

	WritePrivateProfileInt(SECTION, LASTVISITKEY, path.savelastromvisit, IniName);
	WritePrivateProfileInt(SECTION, ASSOCIATEKEY, associate, IniName);
//	WritePrivateProfileInt(SECTION, DEFAULTFORMATKEY, defaultFormat, IniName);
//	WritePrivateProfileInt(SECTION, NEEDSSAVINGKEY, needsSaving, IniName);
}
Example #12
0
void DecreaseSpeed(void) {

	if(desiredFpsScalerIndex != sizeof(desiredFpsScalers)/sizeof(desiredFpsScalers[0]) - 1)
		desiredFpsScalerIndex++;
	u64 desiredFpsScaler = desiredFpsScalers[desiredFpsScalerIndex];
	desiredfps = core_desiredfps * desiredFpsScaler / 256;
	desiredspf = 65536.0f / desiredfps;
	printf("Throttle fps scaling decreased to: %f\n",desiredFpsScaler/256.0);
	osd->addLine("Target FPS down to %2.04f",desiredFpsScaler/256.0);
#ifndef ANDROID
	WritePrivateProfileInt("Video","FPS Scaler Index", desiredFpsScalerIndex, IniName);
#endif
}
Example #13
0
void CEpgDataCap_BonDlg::OnDestroy()
{
	this->main.StopServer();
	this->main.CloseBonDriver();
	KillTimer(TIMER_STATUS_UPDATE);

	KillTimer(RETRY_ADD_TRAY);
	DeleteTaskBar(GetSafeHwnd(), TRAYICON_ID);

	WINDOWPLACEMENT Pos;
	Pos.length = sizeof(WINDOWPLACEMENT);
	GetWindowPlacement(m_hWnd, &Pos);

	WritePrivateProfileInt(L"SET_WINDOW", L"top", Pos.rcNormalPosition.top, this->moduleIniPath.c_str());
	WritePrivateProfileInt(L"SET_WINDOW", L"left", Pos.rcNormalPosition.left, this->moduleIniPath.c_str());
	WritePrivateProfileInt(L"SET_WINDOW", L"bottom", Pos.rcNormalPosition.bottom, this->moduleIniPath.c_str());
	WritePrivateProfileInt(L"SET_WINDOW", L"right", Pos.rcNormalPosition.right, this->moduleIniPath.c_str());

	int selONID = -1;
	int selTSID = -1;
	int selSID = -1;
	WCHAR bon[512] = L"";

	GetWindowText(GetDlgItem(IDC_COMBO_TUNER), bon, 512);
	int sel = ComboBox_GetCurSel(GetDlgItem(IDC_COMBO_SERVICE));
	if( sel != CB_ERR ){
		DWORD index = (DWORD)ComboBox_GetItemData(GetDlgItem(IDC_COMBO_SERVICE), sel);
		selONID = this->serviceList[index].originalNetworkID;
		selTSID = this->serviceList[index].transportStreamID;
		selSID = this->serviceList[index].serviceID;
	}

	WritePrivateProfileInt(L"SET", L"LastONID", selONID, this->moduleIniPath.c_str());
	WritePrivateProfileInt(L"SET", L"LastTSID", selTSID, this->moduleIniPath.c_str());
	WritePrivateProfileInt(L"SET", L"LastSID", selSID, this->moduleIniPath.c_str());
	WritePrivateProfileString(L"SET", L"LastBon", bon, this->moduleIniPath.c_str());
	WritePrivateProfileInt(L"SET", L"ChkUDP", Button_GetCheck(GetDlgItem(IDC_CHECK_UDP)), this->moduleIniPath.c_str());
	WritePrivateProfileInt(L"SET", L"ChkTCP", Button_GetCheck(GetDlgItem(IDC_CHECK_TCP)), this->moduleIniPath.c_str());

	// TODO: ここにメッセージ ハンドラー コードを追加します。
}
Example #14
0
void slot1Dialog(HWND hwnd)
{
	strcpy(tmp_fat_path, slot1_GetFatDir().c_str());
	strcpy(tmp_fs_path, path.getpath(path.SLOT1D).c_str());
	temp_type_slot1 = slot1_GetCurrentType();
	last_type_slot1 = temp_type_slot1;
	_OKbutton_slot1 = false;
	needReset_slot1 = true;
	u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_SLOT1CONFIG), hwnd, (DLGPROC)Slot1Box_Proc);
	if (res)
	{
		switch (temp_type_slot1)
		{
			case NDS_SLOT1_NONE:
				if (temp_type_slot1 != slot1_GetCurrentType())
					needReset_slot1 = true;
				else
					needReset_slot1 = false;
				break;
			case NDS_SLOT1_RETAIL_AUTO:
			case NDS_SLOT1_RETAIL_MCROM:
				break;
			case NDS_SLOT1_R4:
				if (strlen(tmp_fat_path))
				{
					slot1_SetFatDir(tmp_fat_path);
					WritePrivateProfileString("Slot1","FAT_path",tmp_fat_path,IniName);
				}
				break;
			case NDS_SLOT1_RETAIL_NAND:
				break;
			case NDS_SLOT1_RETAIL_DEBUG:
				if (strlen(tmp_fs_path))
				{
					path.setpath(path.SLOT1D, tmp_fs_path);
					WritePrivateProfileString(SECTION, SLOT1DKEY, path.pathToSlot1D, IniName);
				}
				break;
			default:
				return;
		}
		WritePrivateProfileInt("Slot1","type",temp_type_slot1,IniName);

		slot1_Change((NDS_SLOT1_TYPE)temp_type_slot1);
		
		return;
	}
}
Example #15
0
void SaveSettings()
{
	WritePrivateProfileInt("MegaEDX", "RomAtStartup", set.romAtStartup, configFile);
	WritePrivateProfileInt("MegaEDX", "LastLevel", set.lastLevel, configFile);
	WritePrivateProfileString("Recent", "Rom1", set.lastroms[0], configFile);
	WritePrivateProfileString("Recent", "Rom1", set.lastroms[0], configFile);
	WritePrivateProfileString("Recent", "Rom2", set.lastroms[1], configFile);
	WritePrivateProfileString("Recent", "Rom3", set.lastroms[2], configFile);
	WritePrivateProfileString("Recent", "Rom4", set.lastroms[3], configFile);
	WritePrivateProfileString("Recent", "Rom5", set.lastroms[4], configFile);
	WritePrivateProfileString("Emulator", "Path", set.emupath, configFile);
	WritePrivateProfileInt(_setDialogsName[0], "SizeX", set.WinMainSize.X, configFile);
	WritePrivateProfileInt(_setDialogsName[0], "SizeY", set.WinMainSize.Y, configFile);
	WritePrivateProfileInt(_setDialogsName[0], "Max", set.max, configFile);
	SHORT* pCoord = (SHORT*)&set + 2;
	for(int i=0; i<6; i++)
	{
		WritePrivateProfileInt(_setDialogsName[i], "PosX", *pCoord++, configFile);
		WritePrivateProfileInt(_setDialogsName[i], "PosY", *pCoord++, configFile);
	}
}
Example #16
0
void GBAslotDialog(HWND hwnd)
{
	temp_type = addon_type;
	last_type = temp_type;
	strcpy(tmp_cflash_filename, win32_CFlash_cfgFileName.c_str());
	strcpy(tmp_cflash_path, win32_CFlash_cfgDirectory.c_str());
	strcpy(tmp_gbagame_filename, GBAgameName);
	memcpy(&tmp_Guitar, &Guitar, sizeof(Guitar));
	memcpy(&tmp_Piano, &Piano, sizeof(Piano));
	tmp_CFlashMode = CFlash_Mode;
	_OKbutton = false;
	needReset = true;
	u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc);
	if (res)
	{
		switch (temp_type)
		{
			case NDS_ADDON_NONE:
				if (temp_type != addon_type)
					needReset = true;
				else
					needReset = false;
				break;
			case NDS_ADDON_CFLASH:
				//save current values for win32 configuration
				win32_CFlash_cfgMode = tmp_CFlashMode;
				win32_CFlash_cfgDirectory = tmp_cflash_path;
				win32_CFlash_cfgFileName = tmp_cflash_filename;
				WritePrivateProfileInt("GBAslot.CFlash","fileMode",tmp_CFlashMode,IniName);
				WritePrivateProfileString("GBAslot.CFlash","path",tmp_cflash_path,IniName);
				WritePrivateProfileString("GBAslot.CFlash","filename",tmp_cflash_filename,IniName);

				WIN_InstallCFlash();

				needReset = true;
				break;
			case NDS_ADDON_RUMBLEPAK:
				if (temp_type != addon_type)
					needReset = true;
				else
					needReset = false;
				break;
			case NDS_ADDON_PADDLE:
				if (temp_type != addon_type)
					needReset = true;
				else
					needReset = false;
				break;
			case NDS_ADDON_GBAGAME:
				strcpy(GBAgameName, tmp_gbagame_filename);
				WritePrivateProfileString("GBAslot.GBAgame","filename",GBAgameName,IniName);
				needReset = true;
				break;
			case NDS_ADDON_GUITARGRIP:
				memcpy(&Guitar, &tmp_Guitar, sizeof(tmp_Guitar));
				Guitar.Enabled = true;
				WritePrivateProfileInt("GBAslot.GuitarGrip","green",Guitar.GREEN,IniName);
				WritePrivateProfileInt("GBAslot.GuitarGrip","red",Guitar.RED,IniName);
				WritePrivateProfileInt("GBAslot.GuitarGrip","yellow",Guitar.YELLOW,IniName);
				WritePrivateProfileInt("GBAslot.GuitarGrip","blue",Guitar.BLUE,IniName);
				if (temp_type != addon_type)
					needReset = true;
				else
					needReset = false;
				break;
			case NDS_ADDON_PIANO:
				memcpy(&Piano, &tmp_Piano, sizeof(tmp_Piano));
				Piano.Enabled = true;
				WritePrivateProfileInt("GBAslot.Piano","C",Piano.C,IniName);
				WritePrivateProfileInt("GBAslot.Piano","CS",Piano.CS,IniName);
				WritePrivateProfileInt("GBAslot.Piano","D",Piano.D,IniName);
				WritePrivateProfileInt("GBAslot.Piano","DS",Piano.DS,IniName);
				WritePrivateProfileInt("GBAslot.Piano","E",Piano.E,IniName);
				WritePrivateProfileInt("GBAslot.Piano","F",Piano.F,IniName);
				WritePrivateProfileInt("GBAslot.Piano","FS",Piano.FS,IniName);
				WritePrivateProfileInt("GBAslot.Piano","G",Piano.G,IniName);
				WritePrivateProfileInt("GBAslot.Piano","GS",Piano.GS,IniName);
				WritePrivateProfileInt("GBAslot.Piano","A",Piano.A,IniName);
				WritePrivateProfileInt("GBAslot.Piano","AS",Piano.AS,IniName);
				WritePrivateProfileInt("GBAslot.Piano","B",Piano.B,IniName);
				WritePrivateProfileInt("GBAslot.Piano","HIC",Piano.HIC,IniName);
				if (temp_type != addon_type)
					needReset = true;
				else
					needReset = false;
				break;
			case NDS_ADDON_EXPMEMORY:
				break;
			default:
				return;
		}
		if (temp_type!=NDS_ADDON_GUITARGRIP) 
			Guitar.Enabled = false;
		WritePrivateProfileInt("GBAslot","type",temp_type,IniName);

		addon_type = (NDS_ADDON_TYPE)temp_type;
		addonsChangePak(addon_type);
		if (romloaded && needReset)
			NDS_Reset();
		return;
	}
}
Example #17
0
void GBAslotDialog(HWND hwnd)
{
	temp_type = addon_type;
	last_type = temp_type;
	strcpy(tmp_cflash_filename, win32_CFlash_cfgFileName.c_str());
	strcpy(tmp_cflash_path, win32_CFlash_cfgDirectory.c_str());
	strcpy(tmp_gbagame_filename, GBAgameName);
	memcpy(&tmp_Guitar, &Guitar, sizeof(Guitar));
	tmp_CFlashMode = CFlash_Mode;
	_OKbutton = false;
	needReset = true;
	u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc);
	if (res)
	{
		switch (temp_type)
		{
			case NDS_ADDON_NONE:
				if (temp_type != addon_type)
					needReset = true;
				else
					needReset = false;
				break;
			case NDS_ADDON_CFLASH:
				//save current values for win32 configuration
				//(no tmp for mode, a little weird but thats just how it evolved)
				win32_CFlash_cfgMode = CFlash_Mode;
				win32_CFlash_cfgDirectory = tmp_cflash_path;
				win32_CFlash_cfgFileName = tmp_cflash_filename;
				WritePrivateProfileInt("GBAslot.CFlash","fileMode",CFlash_Mode,IniName);
				WritePrivateProfileString("GBAslot.CFlash","path",tmp_cflash_path,IniName);
				WritePrivateProfileString("GBAslot.CFlash","filename",tmp_cflash_filename,IniName);

				WIN_InstallCFlash();

				needReset = true;
				break;
			case NDS_ADDON_RUMBLEPAK:
				if (temp_type != addon_type)
					needReset = true;
				else
					needReset = false;
				break;
			case NDS_ADDON_GBAGAME:
				strcpy(GBAgameName, tmp_gbagame_filename);
				WritePrivateProfileString("GBAslot.GBAgame","filename",GBAgameName,IniName);
				needReset = true;
				break;
			case NDS_ADDON_GUITARGRIP:
				memcpy(&Guitar, &tmp_Guitar, sizeof(tmp_Guitar));
				Guitar.Enabled = true;
				WritePrivateProfileInt("GBAslot.GuitarGrip","green",Guitar.GREEN,IniName);
				WritePrivateProfileInt("GBAslot.GuitarGrip","red",Guitar.RED,IniName);
				WritePrivateProfileInt("GBAslot.GuitarGrip","yellow",Guitar.YELLOW,IniName);
				WritePrivateProfileInt("GBAslot.GuitarGrip","blue",Guitar.BLUE,IniName);
				if (temp_type != addon_type)
					needReset = true;
				else
					needReset = false;
				break;
			case NDS_ADDON_EXPMEMORY:
				break;
			default:
				return;
		}
		if (temp_type!=NDS_ADDON_GUITARGRIP) 
			Guitar.Enabled = false;
		WritePrivateProfileInt("GBAslot","type",temp_type,IniName);

		addon_type = temp_type;
		addonsChangePak(addon_type);
		if (romloaded && needReset)
			NDS_Reset();
		return;
	}
}
Example #18
0
void  WriteConfig(void)
{
	FILE *fp;
    int i;
    
    GetINIPath(IniName,MAX_PATH);

    WritePrivateProfileInt("Keys","Key_A",KEY_A,IniName);
    WritePrivateProfileInt("Keys","Key_B",KEY_B,IniName);
    WritePrivateProfileInt("Keys","Key_SELECT",KEY_SELECT,IniName);
    
    if(KEY_START==47)
    WritePrivateProfileInt("Keys","Key_START",13,IniName);
    else
    WritePrivateProfileInt("Keys","Key_START",KEY_START,IniName);
    
    WritePrivateProfileInt("Keys","Key_RIGHT",KEY_RIGHT,IniName);
    WritePrivateProfileInt("Keys","Key_LEFT",KEY_LEFT,IniName);
    WritePrivateProfileInt("Keys","Key_UP",KEY_UP,IniName);
    WritePrivateProfileInt("Keys","Key_DOWN",KEY_DOWN,IniName);
    WritePrivateProfileInt("Keys","Key_R",KEY_R,IniName);
    WritePrivateProfileInt("Keys","Key_L",KEY_L,IniName);
    WritePrivateProfileInt("Keys","Key_X",KEY_X,IniName);
    WritePrivateProfileInt("Keys","Key_Y",KEY_Y,IniName);
    /*WritePrivateProfileInt("Keys","Key_DEBUG",KEY_DEBUG,IniName);*/
}
Example #19
0
void SavePrefs(int iDlg)
{
	/**************************************************************************************************/
	/********** allocate space for our string, and then set it to the currently logged on user ********/
	/**************************************************************************************************/
	DWORD dBuff = 257;
	TCHAR szUser[257];

	GetUserName(szUser, &dBuff);

	/**************************************************************************************************/
	/*********************** Test if the file exists, If it doesn't, Create It ************************/
	/**************************************************************************************************/
	TCHAR XTRAY_INI_FILE[1024];
	
#ifdef UNICODE
	char temp[1024];
    TCHAR TEMP_INI_FILE[1024];
	
	_snprintf(temp, 1024, "%s\\xtray.conf", xchat_get_info(ph, "xchatdir"));
	ConvertString(temp, TEMP_INI_FILE, 1024);

	// ok this one is really ugly
	// it checks to see if the file exists in two locations
	// HexChat default config dir, if that fails it tries hexchat\plugins\config
	// if neither one exists it tries to create it in
	// HexChat default config dir, if that fails it tries hexchat\plugins\config
	// In either case it writes \xFF\xFE to the file ( on creation )
	// so that we can save unicode away messages WritePrivateProfile doesn't 
	// do this for us, though I think it really should

	if(FileExists(TEMP_INI_FILE))
	{
		_tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE);
	}
	else
	{
		if(FileExists(BACKUP_INI_FILE))
		{
			_tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE);
		}
		else
		{
			HANDLE xTemp;
			DWORD dwBytesTemp;

			if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL))
			{
				if(GetLastError() != ERROR_ALREADY_EXISTS)
				{
					WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL);
				}
				CloseHandle(xTemp);
			}

			if(FileExists(TEMP_INI_FILE))
			{
				_tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE);
			}
			else
			{
				HANDLE xBackup;
				DWORD dwBytesBackup;

				if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL))
				{
					if(GetLastError() != ERROR_ALREADY_EXISTS)
					{
						WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL);
					}

					CloseHandle(xBackup);
				}

				if(FileExists(BACKUP_INI_FILE))
				{
					_tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE);
				}
			}
		}
	}

#else
	_tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE);
#endif

	WritePrivateProfileInt(szUser, _T("SETTINGS"),		g_dwPrefs,		XTRAY_INI_FILE);
	WritePrivateProfileInt(szUser, _T("AOT"),			g_iTime,		XTRAY_INI_FILE);
	WritePrivateProfileInt(szUser, _T("KEY"),			g_hHotKey.key,	XTRAY_INI_FILE);
	WritePrivateProfileInt(szUser, _T("MOD"),			g_hHotKey.mod,	XTRAY_INI_FILE);
	WritePrivateProfileString(szUser, _T("AWAY"),		g_szAway,		XTRAY_INI_FILE);
}
Example #20
0
File: config.c Project: VCCE/VCC
unsigned char WriteIniFile(void)
{
	vccPakGetCurrentModule(CurrentConfig.ModulePath);
	ValidatePath(CurrentConfig.ModulePath);
	ValidatePath(CurrentConfig.ExternalBasicImage);
	WritePrivateProfileString("Version","Release",AppName,IniFilePath);

	WritePrivateProfileInt("CPU","DoubleSpeedClock",CurrentConfig.CPUMultiplyer,IniFilePath);
	WritePrivateProfileInt("CPU","FrameSkip",CurrentConfig.FrameSkip,IniFilePath);
	WritePrivateProfileInt("CPU","Throttle",CurrentConfig.SpeedThrottle,IniFilePath);
	WritePrivateProfileInt("CPU","CpuType",CurrentConfig.CpuType,IniFilePath);
	WritePrivateProfileInt("CPU", "MaxOverClock", CurrentConfig.MaxOverclock, IniFilePath);

	WritePrivateProfileString("Audio","SndCard",CurrentConfig.SoundCardName,IniFilePath);
	WritePrivateProfileInt("Audio","Rate",CurrentConfig.AudioRate,IniFilePath);

	WritePrivateProfileInt("Video","MonitorType",CurrentConfig.MonitorType,IniFilePath);
	WritePrivateProfileInt("Video","ScanLines",CurrentConfig.ScanLines,IniFilePath);
	WritePrivateProfileInt("Video","AllowResize",CurrentConfig.Resize,IniFilePath);
	WritePrivateProfileInt("Video","ForceAspect",CurrentConfig.Aspect,IniFilePath);

	Cassette::writeConfig(IniFilePath);

	WritePrivateProfileInt("Memory","RamSize",CurrentConfig.RamSize,IniFilePath);
	WritePrivateProfileString("Memory", "ExternalBasicImage", CurrentConfig.ExternalBasicImage, IniFilePath);

	WritePrivateProfileInt("Misc","AutoStart",CurrentConfig.AutoStart,IniFilePath);
	WritePrivateProfileInt("Misc","CartAutoStart",CurrentConfig.CartAutoStart,IniFilePath);
	WritePrivateProfileInt("Misc","KeyMapIndex",CurrentConfig.KeyMap,IniFilePath);
	WritePrivateProfileString("Misc", "LastPakPath", vccPakGetLastPath(), IniFilePath);
	WritePrivateProfileString("Misc", "LastPrnPath", LastPrnPath, IniFilePath);

	WritePrivateProfileString("Module", "OnBoot", CurrentConfig.ModulePath, IniFilePath);

	WritePrivateProfileInt("LeftJoyStick","UseMouse",Left.UseMouse,IniFilePath);
	WritePrivateProfileInt("LeftJoyStick","Left",Left.Left,IniFilePath);
	WritePrivateProfileInt("LeftJoyStick","Right",Left.Right,IniFilePath);
	WritePrivateProfileInt("LeftJoyStick","Up",Left.Up,IniFilePath);
	WritePrivateProfileInt("LeftJoyStick","Down",Left.Down,IniFilePath);
	WritePrivateProfileInt("LeftJoyStick","Fire1",Left.Fire1,IniFilePath);
	WritePrivateProfileInt("LeftJoyStick","Fire2",Left.Fire2,IniFilePath);
	WritePrivateProfileInt("LeftJoyStick","DiDevice",Left.DiDevice,IniFilePath);
	WritePrivateProfileInt("LeftJoyStick", "HiResDevice", Left.HiRes, IniFilePath);
	WritePrivateProfileInt("RightJoyStick","UseMouse",Right.UseMouse,IniFilePath);
	WritePrivateProfileInt("RightJoyStick","Left",Right.Left,IniFilePath);
	WritePrivateProfileInt("RightJoyStick","Right",Right.Right,IniFilePath);
	WritePrivateProfileInt("RightJoyStick","Up",Right.Up,IniFilePath);
	WritePrivateProfileInt("RightJoyStick","Down",Right.Down,IniFilePath);
	WritePrivateProfileInt("RightJoyStick","Fire1",Right.Fire1,IniFilePath);
	WritePrivateProfileInt("RightJoyStick","Fire2",Right.Fire2,IniFilePath);
	WritePrivateProfileInt("RightJoyStick","DiDevice",Right.DiDevice,IniFilePath);
	WritePrivateProfileInt("RightJoyStick", "HiResDevice", Right.HiRes, IniFilePath);

	return(0);
}
Example #21
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	switch(Message)
	{
	case WM_INITMENU:
		recentromsmenu = LoadMenu(g_hInstance, "RECENTROMS");
		GetRecentRoms();
		break;
	case WM_KEYDOWN:
		if(wParam != VK_PAUSE)
			break;
		// case WM_SYSKEYDOWN:
	case WM_CUSTKEYDOWN:
		{
			int modifiers = GetModifiers(wParam);
			if(!HandleKeyMessage(wParam,lParam, modifiers))
				return 0;
			break;
		}
	case WM_KEYUP:
		if(wParam != VK_PAUSE)
			break;
	case WM_SYSKEYUP:
	case WM_CUSTKEYUP:
		{
			int modifiers = GetModifiers(wParam);
			HandleKeyUp(wParam, lParam, modifiers);
		}
		break;
	case WM_SIZE:
		switch(wParam)
		{
		case SIZE_MINIMIZED:
			break;
		case SIZE_MAXIMIZED:
			pcejin.maximized = true;
			break;
		case SIZE_RESTORED:
			pcejin.maximized = false;
			break;
		default:
			break;
		}
		return 0;
	case WM_MOVE:
		RECT rect;
		GetWindowRect(hWnd,&rect);
		WndX = rect.left;
		WndY = rect.top;
		return 0;
	case WM_DROPFILES:
		{
			char filename[MAX_PATH] = "";
			DragQueryFile((HDROP)wParam,0,filename,MAX_PATH);
			DragFinish((HDROP)wParam);
			
			std::string fileDropped = filename;
			//-------------------------------------------------------
			//Check if Movie file
			//-------------------------------------------------------
			if (!(fileDropped.find(".mc2") == std::string::npos) && (fileDropped.find(".mc2") == fileDropped.length()-4))
			{
				if (!pcejin.romLoaded)	//If no ROM is loaded, prompt for one
				{
					soundDriver->pause();
					LoadGame();
					pcejin.tempUnPause();
				}	
				if (pcejin.romLoaded && !(fileDropped.find(".mc2") == std::string::npos))	
					FCEUI_LoadMovie(fileDropped.c_str(), 1, false, false);		 
			}
			
			//-------------------------------------------------------
			//Check if Savestate file
			//-------------------------------------------------------
			else if (!(fileDropped.find(".mc") == std::string::npos))	//Note: potential clash, mc2 will be loaded a movie file first
			{
				if (fileDropped.find(".mc") == fileDropped.length()-4)
				{
					if ((fileDropped[fileDropped.length()-1] >= '0' && fileDropped[fileDropped.length()-1] <= '9'))
					{
						extern int MDFNSS_Load(const char *fname, const char *suffix);
						MDFNSS_Load(filename, NULL);
						ClearDirectDrawOutput();
						UpdateToolWindows();
					}
				}
			}
			
			//-------------------------------------------------------
			//Check if Lua script file
			//-------------------------------------------------------
			else if (!(fileDropped.find(".lua") == std::string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4))	 //ROM is already loaded and .dsm in filename
			{
				if(LuaScriptHWnds.size() < 16)
				{
					char temp [1024];
					strcpy(temp, fileDropped.c_str());
					HWND IsScriptFileOpen(const char* Path);
					if(!IsScriptFileOpen(temp))
					{
						HWND hDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), hWnd, (DLGPROC) LuaScriptProc);
						SendDlgItemMessage(hDlg,IDC_EDIT_LUAPATH,WM_SETTEXT,0,(LPARAM)temp);
					}
				}
			}
			
			//-------------------------------------------------------
			//Check if watchlist file
			//-------------------------------------------------------
			else if (!(fileDropped.find(".wch") == std::string::npos) && (fileDropped.find(".wch") == fileDropped.length()-4))	 //ROM is already loaded and .dsm in filename
			{
				if(!RamWatchHWnd)
				{
					RamWatchHWnd = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc);
				}
				else
					SetForegroundWindow(RamWatchHWnd);
				Load_Watches(true, fileDropped.c_str());
			}
			
			//-------------------------------------------------------
			//Else load it as a ROM
			//-------------------------------------------------------
			else if(MDFNI_LoadGame(NULL,filename))
			{
				pcejin.romLoaded = true;
				pcejin.started = true;
				//TODO: adelikat: This code is copied directly from the LoadGame() function, it should be come a separate function and called in both places
				////////////////////////////////
				if (AutoRWLoad)
				{
					//Open Ram Watch if its auto-load setting is checked
					OpenRWRecentFile(0);
					RamWatchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), g_hWnd, (DLGPROC) RamWatchProc);
				}
				UpdateRecentRoms(filename);
				////////////////////////////////
			}
		}
		return 0;
	case WM_ENTERMENULOOP:
		soundDriver->pause();
		EnableMenuItem(GetMenu(hWnd), IDM_RECORD_MOVIE, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), ID_RAM_WATCH, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), ID_RAM_SEARCH, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), IDM_MEMORY, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), IDM_PLAY_MOVIE, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), IDM_STOPMOVIE, MF_BYCOMMAND | (movieMode != MOVIEMODE_INACTIVE) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), IDM_FILE_STOPAVI, MF_BYCOMMAND | (DRV_AviIsRecording()) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), IDM_FILE_RECORDAVI, MF_BYCOMMAND | (!DRV_AviIsRecording()) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), IDM_FILE_STOPWAV, MF_BYCOMMAND | (DRV_WaveRecordActive()) ? MF_ENABLED : MF_GRAYED);
		EnableMenuItem(GetMenu(hWnd), IDM_FILE_RECORDWAV, MF_BYCOMMAND | (!DRV_WaveRecordActive()) ? MF_ENABLED : MF_GRAYED);

		//Window Size
		checkMenu(IDC_WINDOW1X,  ((pcejin.windowSize==1)));
		checkMenu(IDC_WINDOW15X, ((pcejin.windowSize==65535)));
		checkMenu(IDC_WINDOW2X,  ((pcejin.windowSize==2)));
		checkMenu(IDC_WINDOW25X, ((pcejin.windowSize==65534)));
		checkMenu(IDC_WINDOW3X,  ((pcejin.windowSize==3)));
		checkMenu(IDC_WINDOW4X,  ((pcejin.windowSize==4)));
		checkMenu(IDC_ASPECT, ((pcejin.aspectRatio)));
		checkMenu(ID_VIEW_MIXLEFTRIGHT,MixVideoOutput);
		checkMenu(ID_COLOR_MODE_REDBLUE, ((MDFN_IEN_VB::GetColorMode()==0)));
		checkMenu(ID_COLOR_MODE_REDCYAN, ((MDFN_IEN_VB::GetColorMode()==1)));
		checkMenu(ID_COLOR_MODE_REDELECTRICCYAN, ((MDFN_IEN_VB::GetColorMode()==2)));
		checkMenu(ID_COLOR_MODE_REDGREEN, ((MDFN_IEN_VB::GetColorMode()==3)));
		checkMenu(ID_COLOR_MODE_GREENMAGENTA, ((MDFN_IEN_VB::GetColorMode()==4)));
		checkMenu(ID_COLOR_MODE_YELLOWBLUE, ((MDFN_IEN_VB::GetColorMode()==5)));
		checkMenu(ID_COLOR_MODE_GREYSCALE, ((MDFN_IEN_VB::GetColorMode()==6)));
		checkMenu(ID_SPLIT_MODE_ANAGLYPH, ((MDFN_IEN_VB::GetSplitMode()==MDFN_IEN_VB::VB3DMODE_ANAGLYPH)));
		checkMenu(ID_SPLIT_MODE_CSCOPE, ((MDFN_IEN_VB::GetSplitMode()==MDFN_IEN_VB::VB3DMODE_CSCOPE)));
		checkMenu(ID_SPLIT_MODE_SIDEBYSIDE, ((MDFN_IEN_VB::GetSplitMode()==MDFN_IEN_VB::VB3DMODE_SIDEBYSIDE)));
		checkMenu(ID_SPLIT_MODE_PBARRIER, ((MDFN_IEN_VB::GetSplitMode()==MDFN_IEN_VB::VB3DMODE_PBARRIER)));
		checkMenu(ID_VIEW_DISP_BOTH, ((DisplayLeftRightOutput==0)));
		checkMenu(ID_VIEW_DISP_LEFT, ((DisplayLeftRightOutput==1)));
		checkMenu(ID_VIEW_DISP_RIGHT, ((DisplayLeftRightOutput==2)));
		checkMenu(ID_VIEW_DISP_DISABLE, ((DisplayLeftRightOutput==3)));
		checkMenu(ID_VIEW_FRAMECOUNTER,Hud.FrameCounterDisplay);
		checkMenu(ID_VIEW_DISPLAYINPUT,Hud.ShowInputDisplay);
		checkMenu(ID_VIEW_OPENCONSOLE,OpenConsoleWindow);
		checkMenu(ID_VIEW_DISPLAYSTATESLOTS,Hud.DisplayStateSlots);
		checkMenu(ID_VIEW_DISPLAYLAG,Hud.ShowLagFrameCounter);
		checkMenu(IDM_MUTE,soundDriver->userMute);
		break;
	case WM_EXITMENULOOP:
		pcejin.tempUnPause();
		break;

	case WM_CLOSE:
		{
			SaveIniSettings();
			PostQuitMessage(0);
		}

	case WM_DESTROY:
		{
			PostQuitMessage(0);
		}
		// HANDLE_MSG(hWnd, WM_DESTROY, OnDestroy);
		// HANDLE_MSG(hWnd, WM_PAINT, OnPaint);
		// HANDLE_MSG(hwnd, WM_COMMAND, OnCommand);
	case WM_COMMAND:
		if(wParam >= baseid && wParam <= baseid + MAX_RECENT_ROMS - 1)
			{
				int x = wParam - baseid;
				soundDriver->resume();
				OpenRecentROM(x);

			}
			else if(wParam == clearid)
			{
				/* Clear all the recent ROMs */
				if(IDOK == MessageBox(g_hWnd, "OK to clear recent ROMs list?","VBJin",MB_OKCANCEL))
					ClearRecentRoms();
			}
		wmId = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDC_WINDOW1X:
			pcejin.windowSize=1;
			ScaleScreen((float)pcejin.windowSize);
			break;
		case IDC_WINDOW15X:
			pcejin.windowSize=65535;
			ScaleScreen((float)pcejin.windowSize);
			break;
		case IDC_WINDOW2X:
			pcejin.windowSize=2;
			ScaleScreen((float)pcejin.windowSize);
			break;
		case IDC_WINDOW25X:
			pcejin.windowSize=65534;
			ScaleScreen((float)pcejin.windowSize);
			break;
		case IDC_WINDOW3X:
			pcejin.windowSize=3;
			ScaleScreen((float)pcejin.windowSize);
			break;
		case IDC_WINDOW4X:
			pcejin.windowSize=4;
			ScaleScreen((float)pcejin.windowSize);
			break;
		case IDC_ASPECT:
			pcejin.aspectRatio ^= 1;
			ScaleScreen((float)pcejin.windowSize);
			break;
		case IDM_EXIT:
			SaveIniSettings();
			PostQuitMessage(0);
			break;
		case IDM_RESET:
//NEWTODO			PCE_Power();
			OpenRecentROM(0);
			break;
		case IDM_OPEN_ROM:
			soundDriver->pause();
			LoadGame();
			pcejin.tempUnPause();
			break;
		case IDM_RECORD_MOVIE:
			soundDriver->pause();
			MovieRecordTo();
			pcejin.tempUnPause();
			return 0;
		case IDM_PLAY_MOVIE:
			soundDriver->pause();
			Replay_LoadMovie();
			pcejin.tempUnPause();
			return 0;
		case IDM_INPUT_CONFIG:
			soundDriver->pause();
			DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_INPUTCONFIG), hWnd, DlgInputConfig);
			pcejin.tempUnPause();
			// RunInputConfig();
			break;
		case IDM_HOTKEY_CONFIG:
			{
				soundDriver->pause();

				DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_KEYCUSTOM), hWnd, DlgHotkeyConfig);
				pcejin.tempUnPause();

			}
			break;

		case ID_VIEW_MIXLEFTRIGHT:
			MixVideoOutput ^= true;
			MDFN_IEN_VB::SetMixVideoOutput(MixVideoOutput);
			WritePrivateProfileBool("Display", "MixLeftRight", MixVideoOutput, IniName);
			return 0;

		case ID_SPLIT_MODE_ANAGLYPH:
			MDFN_IEN_VB::SetSplitMode(MDFN_IEN_VB::VB3DMODE_ANAGLYPH);
			WritePrivateProfileInt("Display", "SplitMode", MDFN_IEN_VB::VB3DMODE_ANAGLYPH, IniName);
			break;
		case ID_SPLIT_MODE_CSCOPE:
			MDFN_IEN_VB::SetSplitMode(MDFN_IEN_VB::VB3DMODE_CSCOPE);
			WritePrivateProfileInt("Display", "SplitMode", MDFN_IEN_VB::VB3DMODE_CSCOPE, IniName);
			//Clear the DirectDraw buffers
			ClearDirectDrawOutput();
			break;
		case ID_SPLIT_MODE_SIDEBYSIDE:
			MDFN_IEN_VB::SetSplitMode(MDFN_IEN_VB::VB3DMODE_SIDEBYSIDE);
			WritePrivateProfileInt("Display", "SplitMode", MDFN_IEN_VB::VB3DMODE_SIDEBYSIDE, IniName);
			//Clear the DirectDraw buffers
			ClearDirectDrawOutput();
			break;
		case ID_SPLIT_MODE_PBARRIER:
			MDFN_IEN_VB::SetSplitMode(MDFN_IEN_VB::VB3DMODE_PBARRIER);
			WritePrivateProfileInt("Display", "SplitMode", MDFN_IEN_VB::VB3DMODE_PBARRIER, IniName);
			break;
		case ID_PIXEL_SEP_16:
			SideBySidePixels = 16;
			MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels);
			ClearDirectDrawOutput();
			WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName);
			break;
		case ID_PIXEL_SEP_32:
			SideBySidePixels = 32;
			MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels);
			ClearDirectDrawOutput();
			WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName);
			break;
		case ID_PIXEL_SEP_48:
			SideBySidePixels = 48;
			MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels);
			ClearDirectDrawOutput();
			WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName);
			break;
		case ID_PIXEL_SEP_64:
			SideBySidePixels = 64;
			MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels);
			ClearDirectDrawOutput();
			WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName);
			break;
		case ID_PIXEL_SEP_80:
			SideBySidePixels = 80;
			MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels);
			ClearDirectDrawOutput();
			WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName);
			break;
		case ID_PIXEL_SEP_96:
			SideBySidePixels = 96;
			MDFN_IEN_VB::SetSideBySidePixels(SideBySidePixels);
			ClearDirectDrawOutput();
			WritePrivateProfileInt("Display", "SideBySidePixels", SideBySidePixels, IniName);
			break;
		case ID_COLOR_MODE_REDBLUE:
			MDFN_IEN_VB::SetColorMode(0);
			WritePrivateProfileInt("Display", "ColorMode", 0, IniName);
			break;
		case ID_COLOR_MODE_REDCYAN:
			MDFN_IEN_VB::SetColorMode(1);
			WritePrivateProfileInt("Display", "ColorMode", 1, IniName);
			break;
		case ID_COLOR_MODE_REDELECTRICCYAN:
			MDFN_IEN_VB::SetColorMode(2);
			WritePrivateProfileInt("Display", "ColorMode", 2, IniName);
			break;
		case ID_COLOR_MODE_REDGREEN:
			MDFN_IEN_VB::SetColorMode(3);
			WritePrivateProfileInt("Display", "ColorMode", 3, IniName);
			break;
		case ID_COLOR_MODE_GREENMAGENTA:
			MDFN_IEN_VB::SetColorMode(4);
			WritePrivateProfileInt("Display", "ColorMode", 4, IniName);
			break;
		case ID_COLOR_MODE_YELLOWBLUE:
			MDFN_IEN_VB::SetColorMode(5);
			WritePrivateProfileInt("Display", "ColorMode", 5, IniName);
			break;
		case ID_COLOR_MODE_GREYSCALE:
			MDFN_IEN_VB::SetColorMode(6);
			WritePrivateProfileInt("Display", "ColorMode", 6, IniName);
			break;
		case ID_VIEW_DISP_BOTH:
			DisplayLeftRightOutput = 0;
			MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput);
			WritePrivateProfileInt("Display", "ViewDisplay", DisplayLeftRightOutput, IniName);
			return 0;

		case ID_VIEW_DISP_LEFT:
			DisplayLeftRightOutput = 1;
			MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput);
			WritePrivateProfileInt("Display", "ViewDisplay", DisplayLeftRightOutput, IniName);
			return 0;

		case ID_VIEW_DISP_RIGHT:
			DisplayLeftRightOutput = 2;
			MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput);
			WritePrivateProfileInt("Display", "ViewDisplay", DisplayLeftRightOutput, IniName);
			return 0;

		case ID_VIEW_DISP_DISABLE:
			DisplayLeftRightOutput = 3;
			MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput);
			// We're not saving this. Too many people would set it and forget it, then compain.
			// Someone can still set it manually in the ini file though.
			return 0;

		case ID_VIEW_FRAMECOUNTER:
			Hud.FrameCounterDisplay ^= true;
			WritePrivateProfileBool("Display", "FrameCounter", Hud.FrameCounterDisplay, IniName);
			return 0;

		case ID_VIEW_DISPLAYINPUT:
			Hud.ShowInputDisplay ^= true;
			WritePrivateProfileBool("Display", "Display Input", Hud.ShowInputDisplay, IniName);
			osd->clear();
			return 0;

		case ID_VIEW_OPENCONSOLE:
			OpenConsoleWindow ^= true;
			WritePrivateProfileBool("Display", "OpenConsoleWindow", OpenConsoleWindow, IniName);
			return 0;

		case ID_VIEW_DISPLAYSTATESLOTS:
			Hud.DisplayStateSlots ^= true;
			WritePrivateProfileBool("Display", "Display State Slots", Hud.DisplayStateSlots, IniName);
			osd->clear();
			return 0;

		case ID_VIEW_DISPLAYLAG:
			Hud.ShowLagFrameCounter ^= true;
			WritePrivateProfileBool("Display", "Display Lag Counter", Hud.ShowLagFrameCounter, IniName);
			osd->clear();
			return 0;
		case IDC_NEW_LUA_SCRIPT:
			if(LuaScriptHWnds.size() < 16)
			{
				CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), g_hWnd, (DLGPROC) LuaScriptProc);
			}
			break;

			break;
		case IDM_MUTE:
			soundDriver->doUserMute();
			break;
		case IDM_STOPMOVIE:
			FCEUI_StopMovie();
			return 0;
			break;
		case ID_RAM_SEARCH:
			if(!RamSearchHWnd)
			{
				if (pcejin.romLoaded)
				{
					InitRamSearch(false);
					RamSearchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMSEARCH), hWnd, (DLGPROC) RamSearchProc);
				}
			}
			else
				SetForegroundWindow(RamSearchHWnd);
			break;

		case ID_RAM_WATCH:
			if(!RamWatchHWnd)
			{
				if(pcejin.romLoaded)
					RamWatchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc);
			}
			else
				SetForegroundWindow(RamWatchHWnd);
			return 0;
		case IDM_MEMORY:
			if (!RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*)))
				return 0;

			OpenToolWindow(new CMemView());
			return 0;
		case IDM_ABOUT:
			soundDriver->pause();

			DialogBox(winClass.hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			pcejin.tempUnPause();
			break;
		case IDM_FILE_RECORDAVI:
			soundDriver->pause();
			RecordAvi();
			pcejin.tempUnPause();
			break;
		case IDM_FILE_STOPAVI:
			StopAvi();
			break;
		case IDM_FILE_RECORDWAV:
			soundDriver->pause();
			CreateSoundSave();
			pcejin.tempUnPause();
			break;
		case IDM_FILE_STOPWAV:
			DRV_EndWaveRecord();
			break;
		}
		break;
	}
	return DefWindowProc(hWnd, Message, wParam, lParam);
}
Example #22
0
void CPrefsDlg::SaveAppSettings (bool bSaveFolders)
{
    char	szMoveRate [20];

    if (bSaveFolders) {
        WritePrivateProfileString ("DLE-XP", "DescentDirectory", descent_path, "dle-xp.ini");
        WritePrivateProfileString ("DLE-XP", "Descent2Directory", descent2_path, "dle-xp.ini");
        WritePrivateProfileString ("DLE-XP", "levelsDirectory", levels_path, "dle-xp.ini");
    }
    WritePrivateProfileString ("DLE-XP", "PlayerProfile", player_profile, "dle-xp.ini");
    WritePrivateProfileInt ("DepthPerception", m_iDepthPerception);
    WritePrivateProfileInt ("RotateRate", m_iRotateRate);
    sprintf (szMoveRate, "%1.3f", m_moveRate);
    WritePrivateProfileDouble ("MoveRate", m_moveRate);
    WritePrivateProfileInt ("ExpertMode", m_bExpertMode);
    WritePrivateProfileInt ("SplashScreen", m_bSplashScreen);
    WritePrivateProfileInt ("MineViewFlags", m_mineViewFlags);
    WritePrivateProfileInt ("ObjViewFlags", m_objViewFlags);
    WritePrivateProfileInt ("TexViewFlags", m_texViewFlags);
    WritePrivateProfileInt ("UseTexColors", m_bUseTexColors);
    WritePrivateProfileInt ("ViewDistance", m_nViewDist);
    WritePrivateProfileInt ("MineCenter", *theApp.MineView ()->MineCenter ());
    WritePrivateProfileInt ("MaxUndo", m_nMaxUndo);
    WritePrivateProfileInt ("TxtFilter", theApp.TextureView ()->TxtFilter ());
}
Example #23
0
void CPrefsDlg::SetLayout (int nLayout)
{
    WritePrivateProfileInt ("Layout", nLayout);
}
Example #24
0
void CSetDlgApp::SaveIni(void)
{
	if( m_hWnd == NULL ){
		return;
	}

	WritePrivateProfileInt( L"SET", L"AllService", Button_GetCheck(GetDlgItem(IDC_CHECK_ALL_SERVICE)), appIniPath.c_str() );
	WritePrivateProfileInt( L"SET", L"Scramble", Button_GetCheck(GetDlgItem(IDC_CHECK_ENABLE_DECODE)), appIniPath.c_str() );
	WritePrivateProfileInt( L"SET", L"EMM", Button_GetCheck(GetDlgItem(IDC_CHECK_EMM)), appIniPath.c_str() );
	WritePrivateProfileInt( L"SET", L"Caption", Button_GetCheck(GetDlgItem(IDC_CHECK_NEED_CAPTION)), appIniPath.c_str() );
	WritePrivateProfileInt( L"SET", L"Data", Button_GetCheck(GetDlgItem(IDC_CHECK_NEED_DATA)), appIniPath.c_str() );

	WritePrivateProfileInt( L"SET", L"StartMargine", GetDlgItemInt(m_hWnd, IDC_EDIT_START_MARGINE, NULL, FALSE), appIniPath.c_str() );
	WritePrivateProfileInt( L"SET", L"EndMargine", GetDlgItemInt(m_hWnd, IDC_EDIT_END_MARGINE, NULL, FALSE), appIniPath.c_str() );

	WritePrivateProfileInt( L"SET", L"OverWrite", Button_GetCheck(GetDlgItem(IDC_CHECK_OVER_WRITE)), appIniPath.c_str() );

	WritePrivateProfileInt( L"SET", L"EpgCapLive", Button_GetCheck(GetDlgItem(IDC_CHECK_EPGCAP_LIVE)), appIniPath.c_str() );
	WritePrivateProfileInt( L"SET", L"EpgCapRec", Button_GetCheck(GetDlgItem(IDC_CHECK_EPGCAP_REC)), appIniPath.c_str() );
	WritePrivateProfileInt( L"SET", L"MinTask", Button_GetCheck(GetDlgItem(IDC_CHECK_TASKMIN)), appIniPath.c_str() );
	WritePrivateProfileInt( L"SET", L"OpenLast", Button_GetCheck(GetDlgItem(IDC_CHECK_OPENLAST)), appIniPath.c_str() );

	WritePrivateProfileInt( L"SET", L"EpgCapBackStartWaitSec", GetDlgItemInt(m_hWnd, IDC_EDIT_BACKSTART_WAITSEC, NULL, TRUE), appIniPath.c_str() );

}
void GBAslotDialog(HWND hwnd)
{
	temp_type = (u8)slot2_GetCurrentType();
	last_type = temp_type;
	strcpy(tmp_cflash_filename, win32_CFlash_cfgFileName.c_str());
	strcpy(tmp_cflash_path, win32_CFlash_cfgDirectory.c_str());
	strcpy(tmp_gbagame_filename, win32_GBA_cfgRomPath.c_str());
	memcpy(&tmp_Guitar, &Guitar, sizeof(Guitar));
	memcpy(&tmp_Piano, &Piano, sizeof(Piano));
	memcpy(&tmp_Paddle, &Paddle, sizeof(Paddle));
	tmp_CFlashMode = CFlash_Mode;
	_OKbutton = false;
	
	u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc);
	if (res)
	{
		switch (temp_type)
		{
			case NDS_SLOT2_NONE:
			break;

			case NDS_SLOT2_AUTO:
			break;

			case NDS_SLOT2_CFLASH:
				//save current values for win32 configuration
				win32_CFlash_cfgMode = tmp_CFlashMode;
				win32_CFlash_cfgDirectory = tmp_cflash_path;
				win32_CFlash_cfgFileName = tmp_cflash_filename;
				WritePrivateProfileInt("Slot2.CFlash","fileMode",tmp_CFlashMode,IniName);
				WritePrivateProfileString("Slot2.CFlash","path",tmp_cflash_path,IniName);
				WritePrivateProfileString("Slot2.CFlash","filename",tmp_cflash_filename,IniName);

				WIN_InstallCFlash();
				break;
			case NDS_SLOT2_RUMBLEPAK:
				break;
			case NDS_SLOT2_PADDLE:
				memcpy(&Paddle, &tmp_Paddle, sizeof(tmp_Paddle));
				WritePrivateProfileInt("Slot2.Paddle","DEC",Paddle.DEC,IniName);
				WritePrivateProfileInt("Slot2.Paddle","INC",Paddle.INC,IniName);
				break;
			case NDS_SLOT2_GBACART:
				win32_GBA_cfgRomPath = tmp_gbagame_filename;
				WritePrivateProfileString("Slot2.GBAgame", "filename", tmp_gbagame_filename, IniName);
				WIN_InstallGBACartridge();
				break;
			case NDS_SLOT2_GUITARGRIP:
				memcpy(&Guitar, &tmp_Guitar, sizeof(tmp_Guitar));
				WritePrivateProfileInt("Slot2.GuitarGrip","green",Guitar.GREEN,IniName);
				WritePrivateProfileInt("Slot2.GuitarGrip","red",Guitar.RED,IniName);
				WritePrivateProfileInt("Slot2.GuitarGrip","yellow",Guitar.YELLOW,IniName);
				WritePrivateProfileInt("Slot2.GuitarGrip","blue",Guitar.BLUE,IniName);
				break;
			case NDS_SLOT2_EASYPIANO:
				memcpy(&Piano, &tmp_Piano, sizeof(tmp_Piano));
				WritePrivateProfileInt("Slot2.Piano","C",Piano.C,IniName);
				WritePrivateProfileInt("Slot2.Piano","CS",Piano.CS,IniName);
				WritePrivateProfileInt("Slot2.Piano","D",Piano.D,IniName);
				WritePrivateProfileInt("Slot2.Piano","DS",Piano.DS,IniName);
				WritePrivateProfileInt("Slot2.Piano","E",Piano.E,IniName);
				WritePrivateProfileInt("Slot2.Piano","F",Piano.F,IniName);
				WritePrivateProfileInt("Slot2.Piano","FS",Piano.FS,IniName);
				WritePrivateProfileInt("Slot2.Piano","G",Piano.G,IniName);
				WritePrivateProfileInt("Slot2.Piano","GS",Piano.GS,IniName);
				WritePrivateProfileInt("Slot2.Piano","A",Piano.A,IniName);
				WritePrivateProfileInt("Slot2.Piano","AS",Piano.AS,IniName);
				WritePrivateProfileInt("Slot2.Piano","B",Piano.B,IniName);
				WritePrivateProfileInt("Slot2.Piano","HIC",Piano.HIC,IniName);
				break;
			case NDS_SLOT2_EXPMEMORY:
				break;
			case NDS_SLOT2_PASSME:
				break;
			default:
				return;
		}

		slot2_Change((NDS_SLOT2_TYPE)temp_type);

		WritePrivateProfileInt("Slot2", "id", slot2_List[(u8)slot2_GetCurrentType()]->info()->id(), IniName);

		Guitar.Enabled	= (slot2_GetCurrentType() == NDS_SLOT2_GUITARGRIP)?true:false;
		Piano.Enabled	= (slot2_GetCurrentType() == NDS_SLOT2_EASYPIANO)?true:false;
		Paddle.Enabled	= (slot2_GetCurrentType() == NDS_SLOT2_PADDLE)?true:false;
	}
}
Example #26
0
/* Save the state of WinAmp */
void save_state()
{
	int ii;
	int eq;
	char eq_string[EQSIZE];
	int string_pos = 0;
	int list_pos;
	char *song_title;
	char *song_filename;
	char *str_to_write;
	char *tmpstr;
	int str_to_write_len;

	/* Only save if configured to do so currently */
	if ( SendMessage(module.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING) != 1 ) {
		/* WinAmp is not playing */
		/* Exit this procedure if we're not supposed to save while not playing */
		if ( GetPrivateProfileInt(INI_SECTNAME, KEY_SAVEWHILEPLAYING, DEFAULT_SAVEWHILEPLAYING, ini_path) == 1 )
			/* We're not supposed to save while not playing */
			return;
	}

	/* Write out the playlist */
	SendMessage(module.hwndParent, WM_WA_IPC, 0, IPC_WRITEPLAYLIST);

	/* Write out the current playlist position */
	list_pos = SendMessage(module.hwndParent, WM_WA_IPC, 0, IPC_GETLISTPOS);
	WritePrivateProfileInt(INI_SECTNAME, KEY_PLAYLISTLOC, list_pos, ini_path);

	/* Write out the position in the current song */
	/* If we're only supposed to resume from the beginning, always write 0. */
	if ( GetPrivateProfileInt(INI_SECTNAME, KEY_RESUMEATBEGINNING, DEFAULT_RESUMEATBEGINNING, ini_path) == 1 )
		WritePrivateProfileInt(INI_SECTNAME, KEY_SONGLOC, 0, ini_path);
	else
		WritePrivateProfileInt(INI_SECTNAME, KEY_SONGLOC, SendMessage(module.hwndParent, WM_WA_IPC, 0, IPC_GETOUTPUTTIME), ini_path);

	/* Write out the current equalizer settings */

	for ( ii = 0 ; ii < NUM_EQS ; ii++ ) {
		eq = SendMessage(module.hwndParent, WM_WA_IPC, ii, IPC_GETEQDATA);
		if (ii == 0) 
			sprintf(eq_string+string_pos, "%d", eq);
		else
			sprintf(eq_string+string_pos, ",%d", eq);
		/* Add to the length of the string the number of digits + the comma */
		string_pos += num_digits(eq) + (ii!=0);
	}

	/* Write out the EQ settings */
	WritePrivateProfileString(INI_SECTNAME, KEY_EQ, eq_string, ini_path);
	WritePrivateProfileInt(INI_SECTNAME, KEY_EQPREAMP, SendMessage(module.hwndParent, WM_WA_IPC, PREAMP, IPC_GETEQDATA), ini_path);
	WritePrivateProfileInt(INI_SECTNAME, KEY_EQENABLED, SendMessage(module.hwndParent, WM_WA_IPC, EQENABLED, IPC_GETEQDATA), ini_path);

	/* Write out the song name */
	tmpstr = (char*)SendMessage(module.hwndParent, WM_WA_IPC, list_pos, IPC_GETPLAYLISTFILE);
	if ( !tmpstr ) {
		/* Can't get filename, don't save state.  This is most likely because the playlist has been cleared. */
		WritePrivateProfileInt(INI_SECTNAME, KEY_SONGLOC, 0, ini_path);
		return;
	}
	else
		song_filename = strdup(tmpstr);

	tmpstr = (char*)SendMessage(module.hwndParent, WM_WA_IPC, list_pos, IPC_GETPLAYLISTTITLE);
	if ( !tmpstr ) {
		/* Again, playlist has probably be cleared.  Don't save state. */
		WritePrivateProfileInt(INI_SECTNAME, KEY_SONGLOC, 0, ini_path);		
		return;
	}
	else
		song_title = strdup(tmpstr);

	str_to_write_len = strlen(song_title) + strlen(song_filename) + 1;

	str_to_write = (char*)malloc(sizeof(char)*(str_to_write_len+1));
	_snprintf(str_to_write, SONG_NAME_BUF, "%s-%s", song_filename, song_title);
	
	WritePrivateProfileString(INI_SECTNAME, KEY_SONG_NAME, str_to_write, ini_path);
	free(song_filename);
	free(song_title);
	free(str_to_write);

	/* Force disk cache flush if requested */
	if ( GetPrivateProfileInt(INI_SECTNAME, KEY_FORCEFLUSH, DEFAULT_FORCEFLUSH, ini_path) ) 
		/* Note:  this feature only works because I'm linking to commode.obj! */
		_flushall();
}
Example #27
0
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	ofn.hwndOwner = hwnd;
	switch (msg)
	{
	case WM_CONTEXTMENU:
		TrackPopupMenu(GetSubMenu(GetMenu(hwnd), 0), TPM_LEFTALIGN, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, hwnd, NULL);
		break;
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case ID_EXIT:
			DestroyWindow(hwnd);
			break;
		case ID_OPEN:
			;
			if (GetOpenFileName(&ofn) == TRUE)
			{
				if (_stricmp(".txt", PathFindExtension(ofn.lpstrFile)) == 0)
					MessageBox(hwnd, "Text file", "message", MB_OK);
				//developmassive(ofn.lpstrFile);
			}
			break;
		case ID_SAVE:
			;
			if (GetSaveFileName(&ofn) == TRUE)
			{
				if (_stricmp(".txt", PathFindExtension(ofn.lpstrFile)) == 0)
					MessageBox(hwnd, "Text file", "message", MB_OK);
				//developmassive(ofn.lpstrFile);
			}
			break;
		case ID_DIALOG:
			DialogBox(GetModuleHandle(NULL), "MainDialog", hwnd, (DLGPROC)DialogFunc);
			break;
		case 11:
		case 12:
		case 13:
		case 14:
		case 15:
		case 16:
		case 17:
		case 18:
		case 19:
		case 20:
			if (GetMenuState(GetMenu(hwnd), LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED)
				CheckMenuItem(GetMenu(hwnd), LOWORD(wParam), MF_BYCOMMAND | MF_UNCHECKED);
			else
				CheckMenuItem(GetMenu(hwnd), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED);
			break;
		}
		break;
	case WM_CREATE:
		DragAcceptFiles(hwnd, TRUE);
		break;
	case WM_DESTROY:
		WritePrivateProfileInt("window", "height", height, configfile);
		WritePrivateProfileInt("window", "width", width, configfile);
		PostQuitMessage(0);
		break;
	case WM_DROPFILES:
		;
		TCHAR lpszFile[MAX_PATH] = { 0 };
		UINT uFile = 0;
		HDROP hDrop = (HDROP)wParam;

		uFile = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, NULL);
		if (uFile != 1) {
			MessageBox(hwnd, "Dropping multiple files is not supported.", NULL, MB_ICONERROR);
			DragFinish(hDrop);
			break;
		}
		lpszFile[0] = '\0';
		if (DragQueryFile(hDrop, 0, lpszFile, MAX_PATH))
		{
			MessageBox(NULL, lpszFile, NULL, MB_ICONINFORMATION);
		}

		DragFinish(hDrop);
		break;
	case WM_SIZE:
		width = LOWORD(lParam);
		height = HIWORD(lParam);
		break;
	default:
		return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}
Example #28
0
void HK_FrameLimitToggle(int, bool justPressed) {
	FrameLimit ^= 1;
	WritePrivateProfileInt("FrameLimit", "FrameLimit", FrameLimit, IniName);
}
Example #29
0
void SaveWindowPosition(CRect &pRect) {
	WritePrivateProfileInt(SZ_WINPOS_TOP , pRect.top );
	WritePrivateProfileInt(SZ_WINPOS_LEFT, pRect.left);
}
Example #30
0
void SaveSettings() {
	WritePrivateProfileInt(SZ_SAMPLERATE    , g_nSampleRate);
	WritePrivateProfileInt(SZ_AVERAGEWINDOW , g_nAveragingWindow);
	WritePrivateProfileInt(SZ_RANGE_RECV    , g_Range_Recv);
	WritePrivateProfileInt(SZ_RANGE_SENT    , g_Range_Sent);
	WritePrivateProfileInt(SZ_GRAPHOPTIONS  , g_GraphOptions);
	WritePrivateProfileInt(SZ_DISPLAYBYTES  , g_DisplayBytes);
	WritePrivateProfileInt(SZ_STARTUP       , g_bStartWithWindows);
	WritePrivateProfileInt(SZ_ONTOP         , g_bOnTop);
	WritePrivateProfileInt(SZ_BARGRAPH      , g_bShowBarGraph);
	WritePrivateProfileInt(SZ_AUTOSCALE_RECV, g_bAutoScaleRecv);
	WritePrivateProfileInt(SZ_AUTOSCALE_SENT, g_bAutoScaleSent);
	WritePrivateProfileInt(SZ_COLOR_BACK    , g_ColorBack);
	WritePrivateProfileInt(SZ_COLOR_RECV    , g_ColorRecv);
	WritePrivateProfileInt(SZ_COLOR_SENT    , g_ColorSent);
	WritePrivateProfileInt(SZ_COLOR_AVE     , g_ColorAve);
	WritePrivateProfileInt(SZ_COLOR_ICON    , g_ColorIconBack);
	WritePrivateProfileInt(SZ_ICON_STYLE    , g_IconStyle);
	WritePrivateProfileInt(SZ_MONITOR_MODE  , g_MonitorMode);
	WritePrivateProfileInt(SZ_ADAPTER_INDEX , g_dwAdapter);
	SetStartupOptions();
}