Remove more unused code.

This commit is contained in:
Maxim Poliakovski 2020-10-13 04:01:37 +02:00
parent ce9e8e7244
commit 27f5d981da
2 changed files with 0 additions and 74 deletions

View File

@ -169,18 +169,6 @@ void set_machine_settings(map<string, string> &settings) {
}
}
int create_machine_for_id(uint32_t id, uint32_t* grab_ram_size, uint32_t gfx_size) {
switch (id) {
case 0x476F7373:
create_gossamer();
break;
default:
LOG_F(ERROR, "Unknown machine ID: %X", id);
return -1;
}
return 0;
}
/* Read ROM file content and transfer it to the dedicated ROM region */
void load_rom(std::ifstream& rom_file, uint32_t file_size) {
unsigned char* sysrom_mem = new unsigned char[file_size];
@ -251,61 +239,3 @@ int create_machine_for_id(string& id, string& rom_filepath) {
return 0;
}
int create_machine_for_rom(const char* rom_filepath, uint32_t* grab_ram_size, uint32_t gfx_size) {
ifstream rom_file;
uint32_t file_size, config_info_offset, rom_id;
char rom_id_str[17];
rom_file.open(rom_filepath, ios::in | ios::binary);
if (rom_file.fail()) {
LOG_F(ERROR, "Cound not open the specified ROM file.");
rom_file.close();
return -1;
}
rom_file.seekg(0, rom_file.end);
file_size = rom_file.tellg();
rom_file.seekg(0, rom_file.beg);
if (file_size != 0x400000UL) {
LOG_F(ERROR, "Unxpected ROM File size. Expected size is 4 megabytes.");
rom_file.close();
return -1;
}
/* read config info offset from file */
config_info_offset = 0;
rom_file.seekg(0x300080, ios::beg);
rom_file.read((char*)&config_info_offset, 4);
config_info_offset = READ_DWORD_BE_A(&config_info_offset);
/* rewind to ConfigInfo.BootstrapVersion field */
rom_file.seekg(0x300064 + config_info_offset, ios::beg);
/* read BootstrapVersion as C string */
rom_file.read(rom_id_str, 16);
rom_id_str[16] = 0;
LOG_F(INFO, "ROM BootstrapVersion: %s", rom_id_str);
if (strncmp(rom_id_str, "Boot", 4) != 0) {
LOG_F(ERROR, "Invalid BootstrapVersion string.");
rom_file.close();
return -1;
}
/* convert BootstrapVersion string to ROM ID */
rom_id = (rom_id_str[5] << 24) | (rom_id_str[6] << 16) |
(rom_id_str[7] << 8) | rom_id_str[8];
LOG_F(INFO, "The machine is identified as... %s\n",
std::get<1>(rom_identity.at(rom_id)));
create_machine_for_id(rom_id, grab_ram_size, gfx_size);
load_rom(rom_file, file_size);
rom_file.close();
return 0;
}

View File

@ -35,14 +35,10 @@ using namespace std;
std::string machine_name_from_rom(std::string& rom_filepath);
void load_rom(std::ifstream& rom_file, uint32_t file_size);
int get_machine_settings(string& id, map<string, string> &settings);
void set_machine_settings(map<string, string> &settings);
int create_machine_for_id(string& id, string& rom_filepath);
int create_machine_for_rom(const char* rom_filepath, uint32_t* grab_ram_size, uint32_t gfx_size);
/* Machine-specific factory functions. */
int create_gossamer(void);