emuWriteState(szFile);
ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hWindow; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter =  winLoadFilter(IDS_FILTER_SGM); ofn.nFilterIndex = 0; ofn.lpstrFileTitle = NULL; ofn.lpstrDefExt = "SGM"; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = (const char *)saveDir; ofn.lpstrTitle = winResLoadString(IDS_SELECT_SAVE_GAME_NAME); ofn.Flags = OFN_PATHMUSTEXIST;
void writeSaveGame(int num){  char * p = strrchr(filename,'\\');  if(p)    p++;  else    p = filename;  char * saveDir = regQueryStringValue("saveDir", NULL);  if(!saveDir)    saveDir = getDirFromFile(filename);  if(isDriveRoot(saveDir))    sprintf(szFile, "%s%s%d.sgm", saveDir, p, num);  else    sprintf(szFile, "%s\\%s%d.sgm", saveDir, p, num);  emuWriteState(szFile);  sprintf(winBuffer, winResLoadString(IDS_WROTE_STATE_N), num);  systemScreenMessage(winBuffer);}