update linux home path and remove print debugging statements
This commit is contained in:
@@ -127,19 +127,19 @@ absl::Status Rom::LoadAllGraphicsData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) {
|
absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) {
|
||||||
std::cout << "Loading ROM: " << filename << std::endl;
|
std::string full_filename = filename;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
std::string const HOME = std::getenv("HOME") ? std::getenv("HOME") : ".";
|
std::string const HOME = std::getenv("HOME") ? std::getenv("HOME") : ".";
|
||||||
std::cout << "Home directory: " << HOME << std::endl;
|
std::cout << "Home directory: " << HOME << std::endl;
|
||||||
filename = absl::StrCat(HOME, "/", filename);
|
full_filename = absl::StrCat(HOME, "/", filename);
|
||||||
std::cout << "Full path: " << filename << std::endl;
|
std::cout << "Full path: " << full_path << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (filename.empty()) {
|
if (full_filename.empty()) {
|
||||||
return absl::InvalidArgumentError(
|
return absl::InvalidArgumentError(
|
||||||
"Could not load ROM: parameter `filename` is empty.");
|
"Could not load ROM: parameter `filename` is empty.");
|
||||||
}
|
}
|
||||||
// Set filename
|
// Set filename
|
||||||
filename_ = filename;
|
filename_ = full_filename;
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
std::ifstream file(filename_, std::ios::binary);
|
std::ifstream file(filename_, std::ios::binary);
|
||||||
@@ -149,14 +149,12 @@ absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get file size and resize rom_data_
|
// Get file size and resize rom_data_
|
||||||
std::cout << "Getting file size" << std::endl;
|
|
||||||
try {
|
try {
|
||||||
size_ = std::filesystem::file_size(filename_);
|
size_ = std::filesystem::file_size(filename_);
|
||||||
} catch (const std::filesystem::filesystem_error& e) {
|
} catch (const std::filesystem::filesystem_error& e) {
|
||||||
return absl::InternalError(
|
return absl::InternalError(
|
||||||
absl::StrCat("Could not get file size: ", filename, " - ", e.what()));
|
absl::StrCat("Could not get file size: ", filename, " - ", e.what()));
|
||||||
}
|
}
|
||||||
std::cout << "Size of file: " << size_ << std::endl;
|
|
||||||
rom_data_.resize(size_);
|
rom_data_.resize(size_);
|
||||||
|
|
||||||
// Read file into rom_data_
|
// Read file into rom_data_
|
||||||
@@ -183,7 +181,6 @@ absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) {
|
|||||||
|
|
||||||
// Load Zelda 3 specific data if requested
|
// Load Zelda 3 specific data if requested
|
||||||
if (z3_load) {
|
if (z3_load) {
|
||||||
std::cout << "Loading Zelda 3 specific data" << std::endl;
|
|
||||||
// Copy ROM title
|
// Copy ROM title
|
||||||
constexpr uint32_t kTitleStringOffset = 0x7FC0;
|
constexpr uint32_t kTitleStringOffset = 0x7FC0;
|
||||||
constexpr uint32_t kTitleStringLength = 20;
|
constexpr uint32_t kTitleStringLength = 20;
|
||||||
@@ -201,9 +198,6 @@ absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) {
|
|||||||
rom_data_.resize(baseROMSize * 2);
|
rom_data_.resize(baseROMSize * 2);
|
||||||
size_ = baseROMSize * 2;
|
size_ = baseROMSize * 2;
|
||||||
|
|
||||||
std::cout
|
|
||||||
<< "ROM loaded successfully, attempting to create resource label file."
|
|
||||||
<< std::endl;
|
|
||||||
// Set up the resource labels
|
// Set up the resource labels
|
||||||
std::string resource_label_filename = absl::StrFormat("%s.labels", filename);
|
std::string resource_label_filename = absl::StrFormat("%s.labels", filename);
|
||||||
resource_label_manager_.LoadLabels(resource_label_filename);
|
resource_label_manager_.LoadLabels(resource_label_filename);
|
||||||
|
|||||||
Reference in New Issue
Block a user