git @ Cat's Eye Technologies linapple / 460728a
First pass at making "the registry" (linapple.conf) read-only. Chris Pressey 4 years ago
3 changed file(s) with 15 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1212 - recording location of resource files at build time instead of
1313 assuming they always reside in the current directory. This permits
1414 the executable to be started from any directory.
15 - treating the configuration file as read-only (planned)
15 - treating the configuration file as read-only.
1616
1717 It also contains changes for building and running under OSX, taken from
1818 other forks of linapple on Github, however, keeping these changes tested
410410 {
411411 DWORD dwComputerType;
412412
413 if(registry==NULL)
414 {
415 // int i=DlgAlert_Notice("NO CONFIGURATION FILE OPENED");
413 if(registry==NULL)
414 {
415 printf("File " REGISTRY " could not be opened. Using default configuration.\n");
416416 return;
417 }
417 }
418418 LOAD(TEXT("Computer Emulation"),&dwComputerType);
419419 switch (dwComputerType)
420420 {
759759 bool bSetFullScreen = false;
760760 bool bBoot = false;
761761
762 registry = fopen(REGISTRY, "a+t"); // open conf file (linapple.conf by default)
762 registry = fopen(REGISTRY, "rt"); // open conf file (linapple.conf by default)
763763 spMono = fopen("speakersmono.pcm","wb");
764764 spStereo = fopen("speakersstereo.pcm","wb");
765765
10501050 }
10511051
10521052 RiffFinishWriteFile();
1053 fclose(registry); //close conf file (linapple.conf by default)
1053 if(registry!=NULL) {
1054 fclose(registry); //close conf file (linapple.conf by default)
1055 }
10541056 fclose(spMono);
10551057 fclose(spStereo);
10561058
174174 }
175175
176176
177 #define REGISTRY_READ_ONLY 1
178
177179 void RegSaveKeyValue(char * NKey, char * NValue)
178180 {
181 #ifdef REGISTRY_READ_ONLY
182 printf("Attempt to set '%s' to '%s' ignored (registry is read-only)\n", NKey, NValue);
183 #else
179184 char MyStr[BUFSIZE];
180185 char line[BUFSIZE];
181186 char templine[BUFSIZE];
218223 fclose(tempf);
219224 // fflush(registry); // for chance... --bb
220225 // do not close registry, it should be open while emu working...
226 #endif
221227 }
222228
223229 //===========================================================================