/* * settings.c * * This file is part of Emu48 * * Copyright (C) 1995 Sebastien Carlier * Copyright (C) 1999 Christoph Gießelink * */ #include "pch.h" #include "Emu48.h" #define EMU48_INI "Emu48.ini" static BOOL WritePrivateProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue, LPCTSTR lpszFilename) { char s[16]; wsprintf(s,"%i",nValue); return WritePrivateProfileString(lpszSection, lpszEntry, s, lpszFilename); } VOID ReadSettings(VOID) { // Files GetPrivateProfileString("Files","Emu48Directory",szCurrentDirectory,szEmu48Directory, sizeof(szEmu48Directory),EMU48_INI); bAutoSave = GetPrivateProfileInt("Files","AutoSave",bAutoSave,EMU48_INI); bAutoSaveOnExit = GetPrivateProfileInt("Files","AutoSaveOnExit",bAutoSaveOnExit,EMU48_INI); // Port2 bPort2IsShared = GetPrivateProfileInt("Port2","IsShared",0,EMU48_INI); GetPrivateProfileString("Port2","Filename","SHARED.BIN",szPort2Filename,sizeof(szPort2Filename),EMU48_INI); // KML bAlwaysDisplayLog = GetPrivateProfileInt("KML","AlwaysDisplayLog",bAlwaysDisplayLog,EMU48_INI); // Emulator bRealSpeed = GetPrivateProfileInt("Emulator","RealSpeed",0,EMU48_INI); dwSXCycles = GetPrivateProfileInt("Emulator","SXCycles",82,EMU48_INI); dwGXCycles = GetPrivateProfileInt("Emulator","GXCycles",123,EMU48_INI); SetSpeed(bRealSpeed); // set speed // Serial GetPrivateProfileString("Serial","Wire",NO_SERIAL,szSerialWire,sizeof(szSerialWire),EMU48_INI); GetPrivateProfileString("Serial","Ir",NO_SERIAL,szSerialIr,sizeof(szSerialIr),EMU48_INI); return; } VOID WriteSettings(VOID) { // Files WritePrivateProfileString("Files","Emu48Directory",szEmu48Directory,EMU48_INI); WritePrivateProfileInt("Files","AutoSave",bAutoSave,EMU48_INI); WritePrivateProfileInt("Files","AutoSaveOnExit",bAutoSaveOnExit,EMU48_INI); // Port2 WritePrivateProfileInt("Port2","IsShared",bPort2IsShared,EMU48_INI); WritePrivateProfileString("Port2","Filename",szPort2Filename,EMU48_INI); // KML WritePrivateProfileInt("KML","AlwaysDisplayLog",bAlwaysDisplayLog,EMU48_INI); // Emulator WritePrivateProfileInt("Emulator","RealSpeed",bRealSpeed,EMU48_INI); WritePrivateProfileInt("Emulator","SXCycles",dwSXCycles,EMU48_INI); WritePrivateProfileInt("Emulator","GXCycles",dwGXCycles,EMU48_INI); // Serial WritePrivateProfileString("Serial","Wire",szSerialWire,EMU48_INI); WritePrivateProfileString("Serial","Ir",szSerialIr,EMU48_INI); return; } VOID ReadLastDocument(LPTSTR szFilename, DWORD nSize) { GetPrivateProfileString("Files","LastDocument","",szFilename,nSize,EMU48_INI); return; } VOID WriteLastDocument(LPCTSTR szFilename) { WritePrivateProfileString("Files","LastDocument",szFilename,EMU48_INI); return; }