Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

Prefs.cpp

Go to the documentation of this file.
00001 /*
00002  *  Prefs.cpp - Global preferences
00003  *
00004  *  Frodo (C) 1994-1997 Christian Bauer
00005  */
00006 
00007 #include "sysdeps.h"
00008 
00009 #include "Prefs.h"
00010 #include "Display.h"
00011 #include "C64.h"
00012 #include "main.h"
00013 
00014 
00015 #ifndef __SYMBIAN32__
00016 // These are the active preferences
00017 Prefs ThePrefs;
00018 
00019 // These are the preferences on disk
00020 Prefs ThePrefsOnDisk;
00021 #endif // !__SYMBIAN32__
00022 
00023 
00024 // 
00025 // The default color mappings are defined here (C64 -> Epoc)
00026 //
00027 
00028 #if COLOR_DEPTH == 4
00029 const uint8 colorRefTable[16] = 
00030         {
00031                                 // --C64--
00032                 0x00,   // black
00033                 0x0f,   // white
00034                 0x02,   // dark red
00035                 0x0a,   // cyan
00036                 0x08,   // purple
00037                 0x04,   // dark green
00038                 0x0c,   // dark blue
00039                 0x06,   // yellow
00040                 0x03,   // light brown
00041                 0x0b,   // dark brown
00042                 0x05,   // light red
00043                 0x01,   // dark grey
00044                 0x0d,   // med grey
00045                 0x07,   // light green
00046                 0x09,   // light blue
00047                 0x0e    // light grey
00048         };
00049 #elif COLOR_DEPTH == 8
00050 
00051 //
00052 // ER6 means Crystal and 12 bits color depth.
00053 //
00054 #ifdef __ER6__
00055 const uint8 colorRefTable[16] = 
00056         {
00057                         // --C64--
00058                 0,      // black
00059                 15,     // white
00060                 2,      // dark red
00061                 10,     // cyan
00062                 8,      // purple       
00063                 4,      // dark green
00064                 12,     // dark blue
00065                 6,      // yellow
00066                 3,      // brown
00067                 11,     // dark brown
00068                 5,      // light red
00069                 1,      // dark grey
00070                 13,     // med grey
00071                 7,      // light green
00072                 9,      // light blue
00073                 14      // light grey
00074         };
00075 #else
00076 const uint8 colorRefTable[16] = 
00077         {
00078                                 // --C64--
00079                 0x00,   // black
00080                 0xff,   // white
00081                 0x03,   // dark red
00082                 0xd2,   // cyan
00083                 0xc8,   // purple       
00084                 0x19,   // dark green
00085                 0x82,   // dark blue
00086                 0x23,   // yellow
00087                 0x0f,   // brown
00088                 0x12,   // dark brown
00089                 0x05,   // light red
00090                 0x54,   // dark grey
00091                 0x55,   // med grey
00092                 0x1e,   // light green
00093                 0xf0,   // light blue
00094                 0xff    // light grey
00095         };
00096 #endif
00097 
00098 #else
00099 ERROR!
00100 #endif  // COLOR_DEPTH
00101 
00102 
00103 
00104 
00105 /*
00106  *  Constructor: Set up preferences with defaults
00107  */
00108 
00109 Prefs::Prefs()
00110 {
00111 
00112         // 1541
00113         Emul1541Proc = false;
00114         for (int i=0; i<4; i++)
00115                 DriveType[i] = DRVTYPE_DIR;
00116 
00117         strcpy(DrivePath[0], "c:\\c64");
00118         strcpy(DrivePath[1], "");
00119         strcpy(DrivePath[2], "");
00120         strcpy(DrivePath[3], "");
00121 
00122         // Joystick
00123         Joystick1On = false;
00124         Joystick2On = false;
00125 
00126         // VIC
00127         SkipFrames = 2;
00128         SpritesOn = true;
00129         SpriteCollisions = true;
00130 
00131         // SID
00132         SIDType = SIDTYPE_DIGITAL;
00133         SIDFilters = true;
00134 #ifdef __ER6__
00135         LatencyMin = 0;
00136         LatencyMax = 3;
00137         LatencyAvg = 0;
00138 #else
00139         LatencyMin = 80;
00140         LatencyMax = 120;
00141         LatencyAvg = 280;
00142 #endif
00143         // CPU
00144         NormalCycles = 63;
00145         BadLineCycles = 23;
00146         CIACycles = 63;
00147         FloppyCycles = 64;
00148 
00149         // Stuff
00150         REUSize = REU_NONE;
00151         LimitSpeed = false;
00152         FastReset = false;
00153         iShowToolbar = true;
00154 
00155         // Colors
00156         for(int j=0;j<16;j++)
00157                 ColorTbl[j] = colorRefTable[j];
00158 
00159 #ifdef __SYMBIAN32__
00160 
00161         // offset
00162         TSize screensize = TSize(0, 200);
00163         TMachineInfoV1Buf machine;
00164         const TInt ret = UserHal::MachineInfo(machine);
00165         if(ret == KErrNone)
00166                 {
00167                 screensize = machine().iDisplaySizeInPixels;
00168                 }
00169 
00170         iOffset.SetXY(0, ((screensize.iHeight-DISPLAY_Y) / 2) +1);
00171 #ifdef __ER6__
00172         iVolume = 5;
00173 #else
00174         iVolume = 7; 
00175 #endif
00176         
00177 #else // __SYMBIAN32__
00178 
00179         CIAIRQHack = false;
00180         MapSlash = true;
00181         JoystickSwap = false;
00182         ScalingNumerator = 2;
00183         ScalingDenominator = 2;
00184         DisplayType = DISPTYPE_WINDOW;
00185         strcpy(ViewPort, "Default");
00186         strcpy(DisplayMode, "Default");
00187         DoubleScan = true;
00188         HideCursor = false;
00189         DirectSound = true;     
00190         ExclusiveSound = false;
00191         AutoPause = false;
00192         PrefsAtStartup = false;
00193         SystemMemory = false;
00194         AlwaysCopy = false;
00195         SystemKeys = true;
00196         ShowLEDs = true;
00197 
00198 #endif // __SYMBIAN32__
00199 
00200         CTOR(Prefs);
00201 
00202 } // end, Prefs::Prefs
00203 
00204 
00205 Prefs::~Prefs()
00209         {
00210         DTOR(Prefs);
00211         }
00212 
00213 
00214 bool Prefs::operator==(const Prefs &rhs) const
00218 {
00219         return (1
00220                 && NormalCycles == rhs.NormalCycles
00221                 && BadLineCycles == rhs.BadLineCycles
00222                 && CIACycles == rhs.CIACycles
00223                 && FloppyCycles == rhs.FloppyCycles
00224                 && SkipFrames == rhs.SkipFrames
00225                 && LatencyMin == rhs.LatencyMin
00226                 && LatencyMax == rhs.LatencyMax
00227                 && LatencyAvg == rhs.LatencyAvg
00228                 && DriveType[0] == rhs.DriveType[0]
00229                 && DriveType[1] == rhs.DriveType[1]
00230                 && DriveType[2] == rhs.DriveType[2]
00231                 && DriveType[3] == rhs.DriveType[3]
00232                 && strcmp(DrivePath[0], rhs.DrivePath[0]) == 0
00233                 && strcmp(DrivePath[1], rhs.DrivePath[1]) == 0
00234                 && strcmp(DrivePath[2], rhs.DrivePath[2]) == 0
00235                 && strcmp(DrivePath[3], rhs.DrivePath[3]) == 0
00236                 && SIDType == rhs.SIDType
00237                 && REUSize == rhs.REUSize
00238                 && SpritesOn == rhs.SpritesOn
00239                 && SpriteCollisions == rhs.SpriteCollisions
00240                 && Joystick1On == rhs.Joystick1On
00241                 && Joystick2On == rhs.Joystick2On
00242                 && LimitSpeed == rhs.LimitSpeed
00243                 && FastReset == rhs.FastReset
00244                 && Emul1541Proc == rhs.Emul1541Proc
00245                 && SIDFilters == rhs.SIDFilters
00246 
00247 #ifdef __SYMBIAN32__
00248 
00249                 && iShowToolbar == rhs.iShowToolbar
00250                 && !Mem::Compare(ColorTbl, 16, rhs.ColorTbl, 16)        // colors
00251                 && iOffset == rhs.iOffset // XY offset
00252                 && iVolume == rhs.iVolume // XY offset
00253 
00254 #else // __SYMBIAN32__
00255 
00256         && CIAIRQHack == rhs.CIAIRQHack
00257                 && MapSlash == rhs.MapSlash
00258                 && ScalingNumerator == rhs.ScalingNumerator
00259                 && ScalingDenominator == rhs.ScalingNumerator
00260                 && strcmp(ViewPort, rhs.ViewPort) == 0
00261                 && strcmp(DisplayMode, rhs.DisplayMode) == 0
00262                 && DisplayType == rhs.DisplayType
00263                 && JoystickSwap == rhs.JoystickSwap
00264                 && DoubleScan == rhs.DoubleScan
00265                 && HideCursor == rhs.HideCursor
00266                 && DirectSound == rhs.DirectSound
00267                 && ExclusiveSound == rhs.ExclusiveSound
00268                 && AutoPause == rhs.AutoPause
00269                 && PrefsAtStartup == rhs.PrefsAtStartup
00270                 && SystemMemory == rhs.SystemMemory
00271                 && AlwaysCopy == rhs.AlwaysCopy
00272                 && SystemKeys == rhs.SystemKeys
00273                 && ShowLEDs == rhs.ShowLEDs
00274 
00275 #endif // !__SYMBIAN32__
00276 
00277         );
00278 }
00279 
00280 bool Prefs::operator!=(const Prefs &rhs) const
00281 {
00282         return !operator==(rhs);
00283 }
00284 
00285 
00286 /*
00287  *  Check preferences for validity and correct if necessary
00288  */
00289 
00290 void Prefs::Check(void)
00291 {
00292         if (SkipFrames <= 0) SkipFrames = 1;
00293 
00294         if (SIDType < SIDTYPE_NONE || SIDType > SIDTYPE_SIDCARD)
00295                 SIDType = SIDTYPE_NONE;
00296 
00297         if (REUSize < REU_NONE || REUSize > REU_512K)
00298                 REUSize = REU_NONE;
00299 
00300 #ifndef __SYMBIAN32__
00301         if (DisplayType < DISPTYPE_WINDOW || DisplayType > DISPTYPE_SCREEN)
00302                 DisplayType = DISPTYPE_WINDOW;
00303 #endif
00304 
00305         for (int i=0; i<4; i++)
00306                 if (DriveType[i] < DRVTYPE_DIR || DriveType[i] > DRVTYPE_T64)
00307                         DriveType[i] = DRVTYPE_DIR;
00308 }
00309 
00310 
00311 /*
00312  *  Load preferences from file
00313  */
00314 
00315 bool Prefs::Load(char *filename)
00316 {
00317         FILE *file;
00318         char line[256], keyword[256], value[256];
00319 
00320         if ((file = fopen(filename, "r")) != NULL) {
00321                 while(fgets(line, 255, file)) {
00322                         if (sscanf(line, "%s = %s\n", keyword, value) == 2) 
00323                                 {
00324 
00325                                 // 1541
00326                                 if (!strcmp(keyword, "Emul1541Proc"))
00327                                         Emul1541Proc = !strcmp(value, "TRUE");
00328                                 else if (!strcmp(keyword, "DriveType8"))
00329                                         if (!strcmp(value, "DIR"))
00330                                                 DriveType[0] = DRVTYPE_DIR;
00331                                         else if (!strcmp(value, "D64"))
00332                                                 DriveType[0] = DRVTYPE_D64;
00333                                         else
00334                                                 DriveType[0] = DRVTYPE_T64;
00335                                 else if (!strcmp(keyword, "DriveType9"))
00336                                         if (!strcmp(value, "DIR"))
00337                                                 DriveType[1] = DRVTYPE_DIR;
00338                                         else if (!strcmp(value, "D64"))
00339                                                 DriveType[1] = DRVTYPE_D64;
00340                                         else
00341                                                 DriveType[1] = DRVTYPE_T64;
00342                                 else if (!strcmp(keyword, "DriveType10"))
00343                                         if (!strcmp(value, "DIR"))
00344                                                 DriveType[2] = DRVTYPE_DIR;
00345                                         else if (!strcmp(value, "D64"))
00346                                                 DriveType[2] = DRVTYPE_D64;
00347                                         else
00348                                                 DriveType[2] = DRVTYPE_T64;
00349                                 else if (!strcmp(keyword, "DriveType11"))
00350                                         if (!strcmp(value, "DIR"))
00351                                                 DriveType[3] = DRVTYPE_DIR;
00352                                         else if (!strcmp(value, "D64"))
00353                                                 DriveType[3] = DRVTYPE_D64;
00354                                         else
00355                                                 DriveType[3] = DRVTYPE_T64;
00356                                 else if (!strcmp(keyword, "DrivePath8"))
00357                                         strcpy(DrivePath[0], value);
00358                                 else if (!strcmp(keyword, "DrivePath9"))
00359                                         strcpy(DrivePath[1], value);
00360                                 else if (!strcmp(keyword, "DrivePath10"))
00361                                         strcpy(DrivePath[2], value);
00362                                 else if (!strcmp(keyword, "DrivePath11"))
00363                                         strcpy(DrivePath[3], value);
00364 
00365                                 // Joystick
00366                                 else if (!strcmp(keyword, "Joystick1On"))
00367                                         Joystick1On = !strcmp(value, "TRUE");
00368                                 else if (!strcmp(keyword, "Joystick2On"))
00369                                         Joystick2On = !strcmp(value, "TRUE");
00370 
00371                                 // VIC
00372                                 else if (!strcmp(keyword, "SkipFrames"))
00373                                         SkipFrames = atoi(value);
00374                                 else if (!strcmp(keyword, "SpritesOn"))
00375                                         SpritesOn = !strcmp(value, "TRUE");
00376                                 else if (!strcmp(keyword, "SpriteCollisions"))
00377                                         SpriteCollisions = !strcmp(value, "TRUE");
00378 
00379                                 // SID
00380                                 else if (!strcmp(keyword, "SIDType"))
00381                                         if (!strcmp(value, "DIGITAL"))
00382                                                 SIDType = SIDTYPE_DIGITAL;
00383                                         else if (!strcmp(value, "SIDCARD"))
00384                                                 SIDType = SIDTYPE_SIDCARD;
00385                                         else
00386                                                 SIDType = SIDTYPE_NONE;
00387                                 else if (!strcmp(keyword, "SIDFilters"))
00388                                         SIDFilters = !strcmp(value, "TRUE");
00389                                 else if (!strcmp(keyword, "LatencyMin"))
00390                                         LatencyMin = atoi(value);
00391                                 else if (!strcmp(keyword, "LatencyMax"))
00392                                         LatencyMax = atoi(value);
00393                                 else if (!strcmp(keyword, "LatencyAvg"))
00394                                         LatencyAvg = atoi(value);
00395 
00396                                 // CPU
00397                                 else if (!strcmp(keyword, "NormalCycles"))
00398                                         NormalCycles = atoi(value);
00399                                 else if (!strcmp(keyword, "BadLineCycles"))
00400                                         BadLineCycles = atoi(value);
00401                                 else if (!strcmp(keyword, "CIACycles"))
00402                                         CIACycles = atoi(value);
00403                                 else if (!strcmp(keyword, "FloppyCycles"))
00404                                         FloppyCycles = atoi(value);
00405 
00406                                 // Stuff
00407                                 else if (!strcmp(keyword, "REUSize")) {
00408                                         if (!strcmp(value, "128K"))
00409                                                 REUSize = REU_128K;
00410                                         else if (!strcmp(value, "256K"))
00411                                                 REUSize = REU_256K;
00412                                         else if (!strcmp(value, "512K"))
00413                                                 REUSize = REU_512K;
00414                                         else
00415                                                 REUSize = REU_NONE;
00416                                 } 
00417                                 else if (!strcmp(keyword, "LimitSpeed"))
00418                                         LimitSpeed = !strcmp(value, "TRUE");
00419                                 else if (!strcmp(keyword, "FastReset"))
00420                                         FastReset = !strcmp(value, "TRUE");
00421                                 else if (!strcmp(keyword, "ShowToolbar"))
00422                                         iShowToolbar = !strcmp(value, "TRUE");
00423 
00424                                 // Colors
00425                                 else if (!strcmp(keyword, "Color0Black"))
00426                                         ColorTbl[0] = atoi(value);
00427                                 else if (!strcmp(keyword, "Color1White"))
00428                                         ColorTbl[1] = atoi(value);
00429                                 else if (!strcmp(keyword, "Color2DarkRed"))
00430                                         ColorTbl[2] = atoi(value);
00431                                 else if (!strcmp(keyword, "Color3Cyan"))
00432                                         ColorTbl[3] = atoi(value);
00433                                 else if (!strcmp(keyword, "Color4Purple"))
00434                                         ColorTbl[4] = atoi(value);
00435                                 else if (!strcmp(keyword, "Color5DarkGreen"))
00436                                         ColorTbl[5] = atoi(value);
00437                                 else if (!strcmp(keyword, "Color6DarkBlue"))
00438                                         ColorTbl[6] = atoi(value);
00439                                 else if (!strcmp(keyword, "Color7Yellow"))
00440                                         ColorTbl[7] = atoi(value);
00441                                 else if (!strcmp(keyword, "Color8LightBrown"))
00442                                         ColorTbl[8] = atoi(value);
00443                                 else if (!strcmp(keyword, "Color9DarkBrown"))
00444                                         ColorTbl[9] = atoi(value);
00445                                 else if (!strcmp(keyword, "Color10LightRed"))
00446                                         ColorTbl[10] = atoi(value);
00447                                 else if (!strcmp(keyword, "Color11DarkGrey"))
00448                                         ColorTbl[11] = atoi(value);
00449                                 else if (!strcmp(keyword, "Color12MediumGrey"))
00450                                         ColorTbl[12] = atoi(value);
00451                                 else if (!strcmp(keyword, "Color13LightGreen"))
00452                                         ColorTbl[13] = atoi(value);
00453                                 else if (!strcmp(keyword, "Color14LightBlue"))
00454                                         ColorTbl[14] = atoi(value);
00455                                 else if (!strcmp(keyword, "Color15LightGrey"))
00456                                         ColorTbl[15] = atoi(value);
00457 
00458 #ifdef __SYMBIAN32__
00459 
00460                                 // XY offset
00461                                 else if (!strcmp(keyword, "Offset_X"))
00462                                         iOffset.iX = atoi(value);
00463                                 else if (!strcmp(keyword, "Offset_Y"))
00464                                         iOffset.iY = atoi(value);
00465                                 else if (!strcmp(keyword, "Volume"))
00466                                         iVolume = atoi(value);
00467 
00468 #else // __SYMBIAN32__
00469 
00470                                 else if (!strcmp(keyword, "CIAIRQHack"))
00471                                         CIAIRQHack = !strcmp(value, "TRUE");
00472                                 else if (!strcmp(keyword, "MapSlash"))
00473                                         MapSlash = !strcmp(value, "TRUE");
00474                                 else if (!strcmp(keyword, "ScalingNumerator"))
00475                                         ScalingNumerator = atoi(value);
00476                                 else if (!strcmp(keyword, "ScalingDenominator"))
00477                                         ScalingDenominator = atoi(value);
00478                                 else if (!strcmp(keyword, "ViewPort"))
00479                                         strcpy(ViewPort, value);
00480                                 else if (!strcmp(keyword, "DisplayMode"))
00481                                         strcpy(DisplayMode, value);
00482                                 else if (!strcmp(keyword, "DisplayType"))
00483                                         DisplayType = strcmp(value, "SCREEN") ? DISPTYPE_WINDOW : DISPTYPE_SCREEN;
00484                                 else if (!strcmp(keyword, "JoystickSwap"))
00485                                         JoystickSwap = !strcmp(value, "TRUE");
00486                                 else if (!strcmp(keyword, "DoubleScan"))
00487                                         DoubleScan = !strcmp(value, "TRUE");
00488                                 else if (!strcmp(keyword, "HideCursor"))
00489                                         HideCursor = !strcmp(value, "TRUE");
00490                                 else if (!strcmp(keyword, "DirectSound"))
00491                                         DirectSound = !strcmp(value, "TRUE");
00492                                 else if (!strcmp(keyword, "ExclusiveSound"))
00493                                         ExclusiveSound = !strcmp(value, "TRUE");
00494                                 else if (!strcmp(keyword, "AutoPause"))
00495                                         AutoPause = !strcmp(value, "TRUE");
00496                                 else if (!strcmp(keyword, "PrefsAtStartup"))
00497                                         PrefsAtStartup = !strcmp(value, "TRUE");
00498                                 else if (!strcmp(keyword, "SystemMemory"))
00499                                         SystemMemory = !strcmp(value, "TRUE");
00500                                 else if (!strcmp(keyword, "AlwaysCopy"))
00501                                         AlwaysCopy = !strcmp(value, "TRUE");
00502                                 else if (!strcmp(keyword, "SystemKeys"))
00503                                         SystemKeys = !strcmp(value, "TRUE");
00504                                 else if (!strcmp(keyword, "ShowLEDs"))
00505                                         ShowLEDs = !strcmp(value, "TRUE");
00506 
00507 #endif // !__SYMBIAN32__
00508 
00509                         }
00510                 }
00511                 fclose(file);
00512         }
00513         else 
00514         {
00515         ELOG1(_L8("Warning: Prefs not loaded!\n"));
00516         return false;
00517         }
00518 
00519         Check();
00520         ELOG2(_L8("Prefs loaded from '%s'\n"), filename);
00521         return true;
00522 
00523 #ifndef __SYMBIAN32__
00524         //      ThePrefsOnDisk = *this; //TODO: use it
00525 #endif
00526 }
00527 
00528 
00529 /*
00530  *  Save preferences to file
00531  *  true: success, false: error
00532  */
00533 
00534 bool Prefs::Save(char *filename)
00535 {
00536         FILE *file;
00537 
00538         Check();
00539         if ((file = fopen(filename, "w")) != NULL) 
00540                 {
00541                 fprintf(file, "// Prefs for EPOC32 Frodo: \n" );
00542                 fprintf(file, "// ----------------------- \n" );
00543 
00544                 // 1541
00545                 fprintf(file, "// 1541:\n" );
00546                 fprintf(file, "Emul1541Proc = %s\n", Emul1541Proc ? "TRUE" : "FALSE");
00547                 for (int i=0; i<4; i++) {
00548                         fprintf(file, "DriveType%d = ", i+8);
00549                         switch (DriveType[i]) {
00550                                 case DRVTYPE_DIR:
00551                                         fprintf(file, "DIR\n");
00552                                         break;
00553                                 case DRVTYPE_D64:
00554                                         fprintf(file, "D64\n");
00555                                         break;
00556                                 case DRVTYPE_T64:
00557                                         fprintf(file, "T64\n");
00558                                         break;
00559                         }
00560                         fprintf(file, "DrivePath%d = %s\n", i+8, DrivePath[i]);
00561                 }
00562 
00563                 // Joystick
00564                 fprintf(file, "// Joystick:\n" );
00565                 fprintf(file, "Joystick1On = %s\n", Joystick1On ? "TRUE" : "FALSE");
00566                 fprintf(file, "Joystick2On = %s\n", Joystick2On ? "TRUE" : "FALSE");
00567 
00568                 // VIC
00569                 fprintf(file, "// VIC:\n" );
00570                 fprintf(file, "SkipFrames = %d\n", SkipFrames);
00571                 fprintf(file, "SpritesOn = %s\n", SpritesOn ? "TRUE" : "FALSE");
00572                 fprintf(file, "SpriteCollisions = %s\n", SpriteCollisions ? "TRUE" : "FALSE");
00573 
00574                 // SID
00575                 fprintf(file, "// SID:\n" );
00576                 fprintf(file, "SIDType = ");
00577                 switch (SIDType) {
00578                         case SIDTYPE_NONE:
00579                                 fprintf(file, "NONE\n");
00580                                 break;
00581                         case SIDTYPE_DIGITAL:
00582                                 fprintf(file, "DIGITAL\n");
00583                                 break;
00584                         case SIDTYPE_SIDCARD:
00585                                 fprintf(file, "SIDCARD\n");
00586                                 break;
00587                 }
00588                 fprintf(file, "SIDFilters = %s\n", SIDFilters ? "TRUE" : "FALSE");
00589                 fprintf(file, "LatencyMin = %d\n", LatencyMin);
00590                 fprintf(file, "LatencyMax = %d\n", LatencyMax);
00591                 fprintf(file, "LatencyAvg = %d\n", LatencyAvg);
00592 
00593                 // CPU
00594                 fprintf(file, "// CPU:\n" );
00595                 fprintf(file, "NormalCycles = %d\n", NormalCycles);
00596                 fprintf(file, "BadLineCycles = %d\n", BadLineCycles);
00597                 fprintf(file, "CIACycles = %d\n", CIACycles);
00598                 fprintf(file, "FloppyCycles = %d\n", FloppyCycles);
00599 
00600                 // Stuff
00601                 fprintf(file, "// Stuff:\n" );
00602                 fprintf(file, "REUSize = ");
00603                 switch (REUSize) {
00604                         case REU_NONE:
00605                                 fprintf(file, "NONE\n");
00606                                 break;
00607                         case REU_128K:
00608                                 fprintf(file, "128K\n");
00609                                 break;
00610                         case REU_256K:
00611                                 fprintf(file, "256K\n");
00612                                 break;
00613                         case REU_512K:
00614                                 fprintf(file, "512K\n");
00615                                 break;
00616                 };
00617                 fprintf(file, "LimitSpeed = %s\n", LimitSpeed ? "TRUE" : "FALSE");
00618                 fprintf(file, "FastReset = %s\n", FastReset ? "TRUE" : "FALSE");
00619                 fprintf(file, "ShowToolbar = %s\n", iShowToolbar ? "TRUE" : "FALSE");
00620 
00621                 // Colors
00622                 fprintf(file, "// Colors:\n" );
00623                 fprintf(file, "Color0Black = %d\n",       ColorTbl[0]);
00624                 fprintf(file, "Color1White = %d\n",       ColorTbl[1]);
00625                 fprintf(file, "Color2DarkRed = %d\n",     ColorTbl[2]);
00626                 fprintf(file, "Color3Cyan = %d\n",        ColorTbl[3]);
00627                 fprintf(file, "Color4Purple = %d\n",      ColorTbl[4]);
00628                 fprintf(file, "Color5DarkGreen = %d\n",   ColorTbl[5]);
00629                 fprintf(file, "Color6DarkBlue = %d\n",    ColorTbl[6]);
00630                 fprintf(file, "Color7Yellow = %d\n",      ColorTbl[7]);
00631                 fprintf(file, "Color8LightBrown = %d\n",  ColorTbl[8]);
00632                 fprintf(file, "Color9DarkBrown = %d\n",   ColorTbl[9]);
00633                 fprintf(file, "Color10LightRed = %d\n",   ColorTbl[10]);
00634                 fprintf(file, "Color11DarkGrey = %d\n",   ColorTbl[11]);
00635                 fprintf(file, "Color12MediumGrey = %d\n", ColorTbl[12]);
00636                 fprintf(file, "Color13LightGreen = %d\n", ColorTbl[13]);
00637                 fprintf(file, "Color14LightBlue = %d\n",  ColorTbl[14]);
00638                 fprintf(file, "Color15LightGrey = %d\n",  ColorTbl[15]);
00639 
00640 #ifdef __SYMBIAN32__
00641 
00642                 // XY offset
00643                 fprintf(file, "// XY Offset and volume:\n" );
00644                 fprintf(file, "Offset_X = %d\n",          iOffset.iX);
00645                 fprintf(file, "Offset_Y = %d\n",          iOffset.iY);
00646                 fprintf(file, "Volume = %d\n",            iVolume);
00647 
00648 #else // __SYMBIAN32__
00649 
00650                 fprintf(file, "CIAIRQHack = %s\n", CIAIRQHack ? "TRUE" : "FALSE");
00651                 fprintf(file, "MapSlash = %s\n", MapSlash ? "TRUE" : "FALSE");
00652                 fprintf(file, "ScalingNumerator = %d\n", ScalingNumerator);
00653                 fprintf(file, "ScalingDenominator = %d\n", ScalingDenominator);
00654                 fprintf(file, "ViewPort = %s\n", ViewPort);
00655                 fprintf(file, "DisplayMode = %s\n", DisplayMode);
00656                 fprintf(file, "DisplayType = %s\n", DisplayType == DISPTYPE_WINDOW ? "WINDOW" : "SCREEN");
00657                 fprintf(file, "JoystickSwap = %s\n", JoystickSwap ? "TRUE" : "FALSE");
00658                 fprintf(file, "DoubleScan = %s\n", DoubleScan ? "TRUE" : "FALSE");
00659                 fprintf(file, "HideCursor = %s\n", HideCursor ? "TRUE" : "FALSE");
00660                 fprintf(file, "DirectSound = %s\n", DirectSound ? "TRUE" : "FALSE");
00661                 fprintf(file, "ExclusiveSound = %s\n", ExclusiveSound ? "TRUE" : "FALSE");
00662                 fprintf(file, "AutoPause = %s\n", AutoPause ? "TRUE" : "FALSE");
00663                 fprintf(file, "PrefsAtStartup = %s\n", PrefsAtStartup ? "TRUE" : "FALSE");
00664                 fprintf(file, "SystemMemory = %s\n", SystemMemory ? "TRUE" : "FALSE");
00665                 fprintf(file, "AlwaysCopy = %s\n", AlwaysCopy ? "TRUE" : "FALSE");
00666                 fprintf(file, "SystemKeys = %s\n", SystemKeys ? "TRUE" : "FALSE");
00667                 fprintf(file, "ShowLEDs = %s\n", ShowLEDs ? "TRUE" : "FALSE");
00668 
00669 #endif // !__SYMBIAN32__
00670 
00671                 fclose(file);
00672 
00673 #ifndef __SYMBIAN32__
00674                 ThePrefsOnDisk = *this; //TODO: use it
00675 #endif
00676 
00677                 return true;
00678         }
00679         return false;
00680 }
00681 
00682 
00683 #ifdef __BEOS__
00684 #include "Prefs_Be.i"
00685 #endif
00686 
00687 #ifdef AMIGA
00688 #include "Prefs_Amiga.i"
00689 #endif
00690 
00691 #ifdef WIN32
00692 #include "Prefs_WIN32.i"
00693 #endif
00694 

Generated on Tue Feb 8 04:08:03 2005 for E32frodo by doxygen 1.3.3