Skip to content

Commit

Permalink
Merge pull request #12 from snowdogz/VCC_2.0.1c
Browse files Browse the repository at this point in the history
Moved Vcc.ini file to users AppData folder
  • Loading branch information
BGPierce committed Sep 5, 2020
2 parents 28b3a4a + ddc2879 commit a33dd47
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions config.c
Expand Up @@ -22,6 +22,9 @@ This file is part of VCC (Virtual Color Computer).
#include <commctrl.h>
#include <stdio.h>
#include <Richedit.h>
#include <iostream>

#include <direct.h>

#include "defines.h"
#include "resource.h"
Expand All @@ -38,10 +41,11 @@ This file is part of VCC (Virtual Color Computer).
#include "keyboard.h"
#include "fileops.h"
#include "Cassette.h"
#include "shlobj.h"

//#include "logger.h"
#include <assert.h>

using namespace std;
//
// forward declarations
//
Expand All @@ -62,6 +66,7 @@ LRESULT CALLBACK JoyStickConfig(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK TapeConfig(HWND , UINT , WPARAM , LPARAM );
LRESULT CALLBACK BitBanger(HWND , UINT , WPARAM , LPARAM );


//
// global variables
//
Expand All @@ -79,6 +84,9 @@ static char ExecDirectory[MAX_PATH]="";
static char SerialCaptureFile[MAX_PATH]="";
static char TextMode=1,PrtMon=0;;
static unsigned char NumberofJoysticks=0;

TCHAR AppDataPath[MAX_PATH];

char OutBuffer[MAX_PATH]="";
char AppName[MAX_LOADSTRING]="";
STRConfig CurrentConfig;
Expand All @@ -96,6 +104,7 @@ static JoyStick TempLeft, TempRight;
static SndCardList SoundCards[MAXCARDS];
static HWND hDlgBar=NULL,hDlgTape=NULL;


CHARFORMAT CounterText;
CHARFORMAT ModeText;

Expand Down Expand Up @@ -164,10 +173,15 @@ void LoadConfig(SystemState *LCState)
LoadString(NULL, IDS_APP_TITLE,AppName, MAX_LOADSTRING);
GetModuleFileName(NULL,ExecDirectory,MAX_PATH);
PathRemoveFileSpec(ExecDirectory);
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, AppDataPath)))
OutputDebugString(AppDataPath);
strcpy(CurrentConfig.PathtoExe,ExecDirectory);
strcpy(IniFilePath,ExecDirectory);
strcat(AppDataPath, "\\VCC");
if (_mkdir(AppDataPath) != 0) { OutputDebugString("Unable to create VCC config folder."); }
strcpy(IniFilePath, AppDataPath);
strcat(IniFilePath,"\\");
strcat(IniFilePath,IniFileName);

LCState->ScanLines=0;
NumberOfSoundCards=GetSoundCardList(SoundCards);
ReadIniFile();
Expand Down Expand Up @@ -1058,4 +1072,4 @@ int SelectFile(char *FileName)
MessageBox(0,"Can't Open File","Can't open the file specified.",0);
strcpy(FileName,TempFileName);
return(1);
}
}

0 comments on commit a33dd47

Please sign in to comment.