rename Config class to E2Config; remove an unused function
This commit is contained in:
parent
f0923c00dd
commit
b138df21eb
|
@ -66,7 +66,6 @@ Circuit.cpp
|
|||
clipboardhandler.cpp
|
||||
clockcard.cpp
|
||||
Common.cpp
|
||||
configep2.cpp
|
||||
Cpu6502.cpp
|
||||
Cpu6502Helper.cpp
|
||||
cpu.cpp
|
||||
|
@ -77,6 +76,7 @@ disk2steppermotorrotor.cpp
|
|||
diskcontroller.cpp
|
||||
drive.cpp
|
||||
drivemotor.cpp
|
||||
e2config.cpp
|
||||
e2filesystem.cpp
|
||||
e2string.cpp
|
||||
E2wxApp.cpp
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "E2wxFrame.h"
|
||||
#include "emulator.h"
|
||||
#include "gui.h"
|
||||
#include "configep2.h"
|
||||
#include "e2config.h"
|
||||
#include "e2filesystem.h"
|
||||
#include <wx/app.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
|
@ -105,10 +105,6 @@ static std::filesystem::path dirDocuments() {
|
|||
return path_from_string(wxStandardPaths::Get().GetAppDocumentsDir());
|
||||
}
|
||||
|
||||
static std::filesystem::path dirResources() {
|
||||
return path_from_string(wxStandardPaths::Get().GetResourcesDir());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -313,7 +309,7 @@ void E2wxApp::InitBoostLog() {
|
|||
|
||||
void E2wxApp::StartEmulator() {
|
||||
this->emu = new Emulator();
|
||||
Config cfg(this->arg_configfile, this->opt_config_from_prefs_only);
|
||||
E2Config cfg(this->arg_configfile, this->opt_config_from_prefs_only);
|
||||
this->emu->config(cfg);
|
||||
this->emu->init();
|
||||
this->emu_timer = new EmuTimer(this->emu);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "card.h"
|
||||
#include "configep2.h"
|
||||
#include "e2config.h"
|
||||
|
||||
Card::Card():
|
||||
rom(0x0100),
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "configep2.h"
|
||||
#include "e2config.h"
|
||||
|
||||
#include "E2wxApp.h"
|
||||
#include "e2filesystem.h"
|
||||
|
@ -68,10 +68,10 @@ static std::uint16_t memory_block_size(const std::string &block_size) {
|
|||
|
||||
|
||||
|
||||
Config::Config(const std::filesystem::path& f, bool p): file_path {f}, prefs_only {p} {
|
||||
E2Config::E2Config(const std::filesystem::path& f, bool p): file_path {f}, prefs_only {p} {
|
||||
}
|
||||
|
||||
Config::~Config() {
|
||||
E2Config::~E2Config() {
|
||||
}
|
||||
|
||||
static void strip_comment(std::string& str)
|
||||
|
@ -114,7 +114,7 @@ static void trim(std::string& str)
|
|||
* If successful, returns an open stream, caller is responsible for deleting it
|
||||
* Otherwise, returns null
|
||||
*/
|
||||
std::ifstream *Config::openFilePref(const wxString& s_name) {
|
||||
std::ifstream *E2Config::openFilePref(const wxString& s_name) {
|
||||
std::ifstream *ret = nullptr;
|
||||
|
||||
|
||||
|
@ -163,7 +163,7 @@ std::ifstream *Config::openFilePref(const wxString& s_name) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::ifstream *Config::openFileExternal(const std::filesystem::path& path) {
|
||||
std::ifstream *E2Config::openFileExternal(const std::filesystem::path& path) {
|
||||
std::ifstream *ret = nullptr;
|
||||
|
||||
const std::filesystem::path p = valid_input_file(path);
|
||||
|
@ -187,7 +187,7 @@ static const std::array rs_path_legacy{
|
|||
"./epple2.conf",
|
||||
};
|
||||
|
||||
std::ifstream *Config::openFileLegacy() {
|
||||
std::ifstream *E2Config::openFileLegacy() {
|
||||
std::ifstream *ret = nullptr;
|
||||
|
||||
BOOST_LOG_TRIVIAL(warning) << "Searching for config file in legacy locations...";
|
||||
|
@ -206,7 +206,7 @@ std::ifstream *Config::openFileLegacy() {
|
|||
* the user, either on command line, or via preferences, allowing for
|
||||
* backward compatibility with legacy file locations.
|
||||
*/
|
||||
std::ifstream *Config::openFile() {
|
||||
std::ifstream *E2Config::openFile() {
|
||||
std::ifstream *ret = nullptr;
|
||||
|
||||
if (this->file_path.empty()) {
|
||||
|
@ -266,7 +266,7 @@ std::ifstream *Config::openFile() {
|
|||
|
||||
|
||||
|
||||
void Config::parse(MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2) {
|
||||
void E2Config::parse(MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2) {
|
||||
std::ifstream *p_ifstream_config = openFile();
|
||||
|
||||
if (p_ifstream_config == nullptr) {
|
||||
|
@ -316,7 +316,7 @@ void Config::parse(MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revis
|
|||
|
||||
|
||||
|
||||
void Config::parseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2) {
|
||||
void E2Config::parseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2) {
|
||||
try {
|
||||
tryParseLine(line, ram, rom, slts, revision, gui, cassetteIn, cassetteOut, apple2);
|
||||
} catch (const ConfigException& err) {
|
||||
|
@ -331,7 +331,7 @@ static std::string filter_row(const std::string &row) {
|
|||
return std::string(1, static_cast<char> (std::toupper(row[0])));
|
||||
}
|
||||
|
||||
void Config::tryParseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2) {
|
||||
void E2Config::tryParseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2) {
|
||||
std::istringstream tok(line);
|
||||
|
||||
std::string cmd;
|
||||
|
@ -551,9 +551,9 @@ void Config::tryParseLine(const std::string& line, MemoryRandomAccess& ram, Memo
|
|||
|
||||
|
||||
|
||||
unsigned char Config::disk_mask(0);
|
||||
unsigned char E2Config::disk_mask(0);
|
||||
|
||||
void Config::loadDisk(Slots& slts, int slot, int drive, const std::string& fnib) {
|
||||
void E2Config::loadDisk(Slots& slts, int slot, int drive, const std::string& fnib) {
|
||||
if (drive < 1 || 2 < drive) {
|
||||
throw ConfigException("Invalid drive; must be 1 or 2");
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ void Config::loadDisk(Slots& slts, int slot, int drive, const std::string& fnib)
|
|||
controller->loadDisk(drive - 1, fnib);
|
||||
}
|
||||
|
||||
void Config::unloadDisk(Slots& slts, int slot, int drive) {
|
||||
void E2Config::unloadDisk(Slots& slts, int slot, int drive) {
|
||||
if (drive < 1 || 2 < drive) {
|
||||
throw ConfigException("Invalid drive; must be 1 or 2");
|
||||
}
|
||||
|
@ -584,14 +584,14 @@ void Config::unloadDisk(Slots& slts, int slot, int drive) {
|
|||
controller->unloadDisk(drive - 1);
|
||||
}
|
||||
|
||||
void Config::saveDisk(Slots& slts, int slot, int drive) {
|
||||
void E2Config::saveDisk(Slots& slts, int slot, int drive) {
|
||||
if (drive < 1 || 2 < drive) {
|
||||
throw ConfigException("Invalid drive; must be 1 or 2");
|
||||
}
|
||||
slts.get(slot)->save(drive - 1);
|
||||
}
|
||||
|
||||
void Config::insertCard(const std::string& cardType, int slot, Slots& slts, ScreenImage& gui, std::istringstream& tok) {
|
||||
void E2Config::insertCard(const std::string& cardType, int slot, Slots& slts, ScreenImage& gui, std::istringstream& tok) {
|
||||
if (slot < 0 || 8 <= slot) {
|
||||
throw ConfigException("Invalid slot number");
|
||||
}
|
|
@ -38,7 +38,7 @@ public:
|
|||
// TODO split out all static things into their own class (and don't make them static)
|
||||
// Remember that, besides config, also command line entry calls parseLine
|
||||
// This will also help with adding menu items in place of commands
|
||||
class Config {
|
||||
class E2Config {
|
||||
private:
|
||||
const std::filesystem::path file_path;
|
||||
const bool prefs_only;
|
||||
|
@ -55,8 +55,8 @@ private:
|
|||
static void tryParseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2);
|
||||
|
||||
public:
|
||||
Config(const std::filesystem::path& f, bool p);
|
||||
~Config();
|
||||
E2Config(const std::filesystem::path& f, bool p);
|
||||
~E2Config();
|
||||
|
||||
void parse(MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2);
|
||||
static void parseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Apple2* apple2);
|
|
@ -16,7 +16,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "emulator.h"
|
||||
#include "configep2.h"
|
||||
#include "e2config.h"
|
||||
#include "e2const.h"
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
@ -74,7 +74,7 @@ void Emulator::powerOffComputer() {
|
|||
this->timable = &this->videoStatic;
|
||||
}
|
||||
|
||||
void Emulator::config(Config& cfg) {
|
||||
void Emulator::config(E2Config& cfg) {
|
||||
cfg.parse(this->apple2.ram, this->apple2.rom, this->apple2.slts, this->apple2.revision, this->screenImage, this->apple2.cassetteIn, this->apple2.cassetteOut, &this->apple2);
|
||||
this->apple2.ram.dump_config();
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ void Emulator::processCommand() {
|
|||
return;
|
||||
}
|
||||
|
||||
Config::parseLine(cmdline, this->apple2.ram, this->apple2.rom, this->apple2.slts, this->apple2.revision, this->screenImage, this->apple2.cassetteIn, this->apple2.cassetteOut, NULL);
|
||||
E2Config::parseLine(cmdline, this->apple2.ram, this->apple2.rom, this->apple2.slts, this->apple2.revision, this->screenImage, this->apple2.cassetteIn, this->apple2.cassetteOut, NULL);
|
||||
cmdline.erase(cmdline.begin(), cmdline.end());
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <SDL.h>
|
||||
|
||||
class Timable;
|
||||
class Config;
|
||||
class E2Config;
|
||||
|
||||
class Emulator
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
Emulator();
|
||||
virtual ~Emulator();
|
||||
|
||||
void config(Config& cfg);
|
||||
void config(E2Config& cfg);
|
||||
|
||||
virtual void init();
|
||||
|
||||
|
|
Loading…
Reference in New Issue