2012-04-21 00:04:34 +00:00
|
|
|
/*
|
|
|
|
epple2
|
2015-07-29 01:14:58 +00:00
|
|
|
Copyright (C) 2008 by Christopher A. Mosher <cmosher01@gmail.com>
|
2012-04-21 00:04:34 +00:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY, without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef CONFIG_H
|
|
|
|
#define CONFIG_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
class Memory;
|
2019-02-02 21:08:32 +00:00
|
|
|
class MemoryRandomAccess;
|
2012-04-21 00:04:34 +00:00
|
|
|
class Slots;
|
|
|
|
class ScreenImage;
|
2019-01-21 05:12:47 +00:00
|
|
|
class CassetteIn;
|
|
|
|
class CassetteOut;
|
2012-04-21 00:04:34 +00:00
|
|
|
|
2019-04-13 04:34:25 +00:00
|
|
|
class ConfigException {
|
2012-04-21 00:04:34 +00:00
|
|
|
public:
|
2019-04-13 04:34:25 +00:00
|
|
|
const std::string msg;
|
|
|
|
ConfigException(const std::string& msg) : msg(msg) {}
|
2012-04-21 00:04:34 +00:00
|
|
|
};
|
|
|
|
|
2019-04-13 04:34:25 +00:00
|
|
|
class Config {
|
2012-04-21 00:04:34 +00:00
|
|
|
private:
|
2019-04-13 04:34:25 +00:00
|
|
|
const std::string& file_path;
|
|
|
|
static unsigned char disk_mask;
|
2012-04-21 00:04:34 +00:00
|
|
|
|
2019-04-13 04:34:25 +00:00
|
|
|
static void loadDisk(Slots& slts, int slot, int drive, const std::string& fnib);
|
|
|
|
static void unloadDisk(Slots& slts, int slot, int drive);
|
|
|
|
static void saveDisk(Slots& slts, int slot, int drive);
|
2020-04-18 16:19:01 +00:00
|
|
|
static void insertCard(const std::string& cardType, int slot, Slots& slts, ScreenImage& gui, std::istringstream& tok);
|
2019-04-13 04:34:25 +00:00
|
|
|
static void tryParseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut);
|
2012-04-21 00:04:34 +00:00
|
|
|
|
|
|
|
public:
|
2019-04-13 04:34:25 +00:00
|
|
|
Config(const std::string& file_path);
|
|
|
|
~Config();
|
2012-04-21 00:04:34 +00:00
|
|
|
|
2019-04-13 04:34:25 +00:00
|
|
|
void parse(MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut);
|
|
|
|
static void parseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut);
|
2012-04-21 00:04:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|