dingusppc/machines/machineproperties.h

74 lines
1.6 KiB
C
Raw Normal View History

2020-08-22 18:05:08 +00:00
#include "endianswap.h"
2020-09-20 21:25:29 +00:00
#include <thirdparty/loguru/loguru.hpp>
2020-08-22 18:05:08 +00:00
#include <cinttypes>
2020-08-26 03:07:02 +00:00
#include <string>
2020-08-22 18:05:08 +00:00
#include <map>
#include <iostream>
#include <utility>
2020-08-26 03:07:02 +00:00
#ifndef MACHINE_PROPERTIES_H
#define MACHINE_PROPERTIES_H
2020-08-22 18:05:08 +00:00
using namespace std;
2020-08-26 03:07:02 +00:00
#define ILLEGAL_DEVICE_VALUE 0x168A523B
2020-09-20 21:25:29 +00:00
class StrProperty {
2020-08-22 18:05:08 +00:00
public:
2020-09-20 21:25:29 +00:00
StrProperty(string str) {
this->prop_val = str;
2020-08-22 18:05:08 +00:00
}
2020-09-20 21:25:29 +00:00
string get_string() {
return this->prop_val;
}
void set_string(string str) {
this->prop_val = str;
2020-08-22 18:05:08 +00:00
}
uint32_t IntRep() {
try {
2020-09-20 21:25:29 +00:00
return strtoul(get_string().c_str(), 0, 0);
2020-08-22 18:05:08 +00:00
} catch (string bad_string) {
cerr << "Could not convert string " << bad_string << "to an ineteger!" << endl;
2020-08-26 03:07:02 +00:00
return ILLEGAL_DEVICE_VALUE;
2020-08-22 18:05:08 +00:00
}
}
private:
2020-09-20 21:25:29 +00:00
string prop_val = string("");
};
class IntProperty {
public:
IntProperty(string str) {
this->prop_val = str;
}
void set_string(string str) {
this->prop_val = str;
}
uint32_t get_int() {
try {
return strtoul(this->prop_val.c_str(), 0, 0);
} catch (string bad_string) {
LOG_F(ERROR, "Could not convert string %s to an integer!",
bad_string.c_str());
}
return 0;
}
private:
string prop_val = string("");
2020-08-22 18:05:08 +00:00
};
uint32_t get_gfx_card(std::string gfx_str);
uint32_t get_cpu_type(std::string cpu_str);
void search_properties(uint32_t chosen_gestalt);
int establish_machine_presets(
const char* rom_filepath, std::string machine_str, uint32_t* ram_sizes, uint32_t gfx_mem);
2020-08-22 18:05:08 +00:00
2020-09-20 21:25:29 +00:00
#endif /* MACHINE_PROPERTIES_H */