git @ Cat's Eye Technologies linapple / 58409ab
Merge pull request #4 from catseye/read-only-linapple-conf Read-only linapple.conf Chris Pressey authored 4 years ago GitHub committed 4 years ago
4 changed file(s) with 15 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
00 /linapple
11 /src/linapple
22 *.o
3 *.pcm
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 {
1055 fclose(registry); //close conf file (linapple.conf by default)
1056 }
10541057 fclose(spMono);
10551058 fclose(spStereo);
10561059
176176
177177 void RegSaveKeyValue(char * NKey, char * NValue)
178178 {
179 #ifdef REGISTRY_WRITEABLE
179180 char MyStr[BUFSIZE];
180181 char line[BUFSIZE];
181182 char templine[BUFSIZE];
218219 fclose(tempf);
219220 // fflush(registry); // for chance... --bb
220221 // do not close registry, it should be open while emu working...
222 #else
223 printf("Attempt to set '%s' to '%s' ignored (registry is read-only)\n", NKey, NValue);
224 #endif /* REGISTRY_WRITEABLE */
221225 }
222226
223227 //===========================================================================