mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-23 06:29:38 +00:00
Repair code for powermacg3 presets
This commit is contained in:
parent
2f2c9aadcb
commit
4f59407cd0
@ -1,6 +1,9 @@
|
|||||||
#include "machineproperties.h"
|
#include "machineproperties.h"
|
||||||
#include "machinepresets.h"
|
#include "machinepresets.h"
|
||||||
|
#include "machinefactory.h"
|
||||||
|
#include "devices/memctrlbase.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <fstream>
|
||||||
#include <thirdparty/loguru/loguru.hpp>
|
#include <thirdparty/loguru/loguru.hpp>
|
||||||
|
|
||||||
void init_ppc_cpu_map() {
|
void init_ppc_cpu_map() {
|
||||||
@ -139,7 +142,10 @@ void search_properties(std::string machine_str) {
|
|||||||
std::cout << "GMEM SIZE: " << std::dec << gfx_size << std::endl;
|
std::cout << "GMEM SIZE: " << std::dec << gfx_size << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool establish_machine_settings(std::string machine_str, uint32_t* ram_sizes) {
|
bool establish_machine_presets(const char* rom_filepath, std::string machine_str, uint32_t* ram_sizes) {
|
||||||
|
ifstream rom_file;
|
||||||
|
uint32_t file_size;
|
||||||
|
|
||||||
init_ppc_cpu_map();
|
init_ppc_cpu_map();
|
||||||
init_gpu_map();
|
init_gpu_map();
|
||||||
init_machine_properties();
|
init_machine_properties();
|
||||||
@ -147,6 +153,22 @@ bool establish_machine_settings(std::string machine_str, uint32_t* ram_sizes) {
|
|||||||
|
|
||||||
//search_properties(machine_str);
|
//search_properties(machine_str);
|
||||||
|
|
||||||
|
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 false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_size != 0x400000UL) {
|
||||||
|
LOG_F(ERROR, "Unxpected ROM File size. Expected size is 4 megabytes.");
|
||||||
|
rom_file.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
load_rom(rom_file, file_size);
|
||||||
|
rom_file.close();
|
||||||
|
|
||||||
if (loop_ram_check (machine_str, ram_sizes)) {
|
if (loop_ram_check (machine_str, ram_sizes)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ int create_machine_for_id(uint32_t id, uint32_t* grab_ram_size, uint32_t gfx_siz
|
|||||||
|
|
||||||
|
|
||||||
/* Read ROM file content and transfer it to the dedicated ROM region */
|
/* Read ROM file content and transfer it to the dedicated ROM region */
|
||||||
void load_rom(ifstream& rom_file, uint32_t file_size) {
|
void load_rom(std::ifstream& rom_file, uint32_t file_size) {
|
||||||
unsigned char* sysrom_mem = new unsigned char[file_size];
|
unsigned char* sysrom_mem = new unsigned char[file_size];
|
||||||
|
|
||||||
rom_file.seekg(0, ios::beg);
|
rom_file.seekg(0, ios::beg);
|
||||||
|
@ -28,6 +28,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
#define MACHINE_FACTORY_H
|
#define MACHINE_FACTORY_H
|
||||||
|
|
||||||
#include "machinebase.h"
|
#include "machinebase.h"
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
void load_rom(std::ifstream& rom_file, uint32_t file_size);
|
||||||
|
|
||||||
int create_machine_for_rom(const char* rom_filepath, uint32_t* grab_ram_size, uint32_t gfx_size);
|
int create_machine_for_rom(const char* rom_filepath, uint32_t* grab_ram_size, uint32_t gfx_size);
|
||||||
|
|
||||||
|
@ -41,6 +41,6 @@ void init_gpu_map(); //JANKY FUNCTION TO FIX VS 2019 BUG!
|
|||||||
uint32_t get_gfx_card(std::string gfx_str);
|
uint32_t get_gfx_card(std::string gfx_str);
|
||||||
uint32_t get_cpu_type(std::string cpu_str);
|
uint32_t get_cpu_type(std::string cpu_str);
|
||||||
void search_properties(uint32_t chosen_gestalt);
|
void search_properties(uint32_t chosen_gestalt);
|
||||||
bool establish_machine_settings(std::string machine_str, uint32_t* ram_sizes);
|
bool establish_machine_presets(const char* rom_filepath, std::string machine_str, uint32_t* ram_sizes);
|
||||||
|
|
||||||
#endif /* MACHINE_PROPERTIES_H */
|
#endif /* MACHINE_PROPERTIES_H */
|
10
main.cpp
10
main.cpp
@ -181,7 +181,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (machine_specified) {
|
if (machine_specified) {
|
||||||
if (machine_name.compare("PowerMacG3") == 0) {
|
if (machine_name.compare("PowerMacG3") == 0) {
|
||||||
if (establish_machine_settings(machine_name, sys_ram_size)) {
|
if (establish_machine_presets(rom_file.c_str(), machine_name, sys_ram_size)) {
|
||||||
if (create_gossamer(sys_ram_size, gfx_mem)) {
|
if (create_gossamer(sys_ram_size, gfx_mem)) {
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
@ -199,15 +199,9 @@ int main(int argc, char** argv) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
if (create_machine_for_rom(rom_file.c_str(), sys_ram_size, gfx_mem)) {
|
if (create_machine_for_rom(rom_file.c_str(), sys_ram_size, gfx_mem)) {
|
||||||
goto bail;
|
goto bail;
|
||||||
} else {
|
|
||||||
LOG_F(
|
|
||||||
WARNING,
|
|
||||||
"Could not create ROM, because the file %s was not found!", rom_file.c_str());
|
|
||||||
display_help();
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user