Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

source/model/SRAMFile.hh

Go to the documentation of this file.
00001 /*
00002  * z2se
00003  * Copyright (C) 2004-2005 emuWorks
00004  * http://games.technoplaza.net/
00005  *
00006  * This file is part of z2se.
00007  *
00008  * z2se is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * z2se is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with z2se; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00021  */
00022 
00023 // $Id: SRAMFile.hh,v 1.3 2005/08/04 05:23:21 technoplaza Exp $
00024 
00025 #ifndef _SRAM_FILE_HH
00026 #define _SRAM_FILE_HH
00027 
00028 /// The size of the SRAM file
00029 #define SRAM_SIZE 0x2000
00030 
00031 /// The starting offset of the games within the SRAM file
00032 #define GAME_OFFSET 0x1402
00033 
00034 #include "SaveSlot.hh"
00035 
00036 namespace emuWorks {
00037     /**
00038      * Class to encapsulate an SRAM file.
00039      */
00040     class SRAMFile {
00041     public:
00042         /**
00043          * Constructor for an SRAMFile object.
00044          *
00045          * @param filename The SRAM file to use.
00046          */
00047         SRAMFile(wxString &filename);
00048         
00049         /**
00050          * Destructor for an SRAMFile object.
00051          */
00052         ~SRAMFile();
00053         
00054         /**
00055          * Checks if this SRAM file has been modified.
00056          *
00057          * @return true if modified; false otherwise.
00058          */
00059         bool isModified();
00060         
00061         /**
00062          * Gets the current game.
00063          *
00064          * @return The current game data.
00065          */
00066         SaveSlot *getCurrentGame();
00067         
00068         /**
00069          * Sets the current game.
00070          *
00071          * @param current The new game.
00072          *
00073          * @return true if the current game was changed; false otherwise.
00074          */
00075         bool setCurrentGame(unsigned int current);
00076         
00077         /**
00078          * Checks if a particular game is valid.
00079          *
00080          * @param game The game to check.
00081          *
00082          * @return true if the game is valid; false otherwise.
00083          */
00084         bool isValidGame(int game);
00085         
00086         /**
00087          * Saves the SRAM data to the file it was opened from.
00088          *
00089          * @return true if the data was saved; false otherwise.
00090          */
00091         bool save();
00092         
00093         /**
00094          * Saves the SRAM data to a particular file.
00095          *
00096          * @param filename The file to save to.
00097          *
00098          * @return true if the data was saved; false otherwise.
00099          */
00100         bool save(wxString &filename);
00101         
00102     private:
00103         /**
00104          * Loads the SRAM data from a file.
00105          *
00106          * @param filename The file to load SRAM data from.
00107          */
00108         void load(wxString &filename);
00109     
00110         wxString *file;
00111         char *data;
00112         
00113         int current;
00114         SaveSlot *games[3];
00115     };
00116 }
00117 
00118 #endif

Generated on Thu Aug 4 00:30:33 2005 for Zelda II SRAM Editor by  doxygen 1.4.4