Skip to content

Commit

Permalink
Merge pull request #3 from V-Sekai-fire/godot-name
Browse files Browse the repository at this point in the history
Use godot engine name property.
  • Loading branch information
fwsGonzo authored Jul 6, 2024
2 parents 3f031d0 + de37399 commit 3477d51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class RiscvEmulator : public Control
auto& machine() { return *m_machine; }
const auto& machine() const { return *m_machine; }

const String& name();

// Functions.
void load(const PackedByteArray& buffer, const TypedArray<String>& arguments);
Variant vmcall(String function,
Expand All @@ -53,5 +51,4 @@ class RiscvEmulator : public Control

bool m_last_newline = false;
unsigned m_budget_overruns = 0;
String m_name;
};
11 changes: 3 additions & 8 deletions src/shmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RiscvEmulator::RiscvEmulator()
// In order to reduce checks we guarantee that this
// class is well-formed at all times.
this->m_machine = new machine_t { };
this->m_name = "(name)";
set_name("(name)");
UtilityFunctions::print("Constructor.");
}

Expand All @@ -42,11 +42,6 @@ RiscvEmulator::~RiscvEmulator()
}

// Methods.
const String& RiscvEmulator::name()
{
return this->m_name;
}

void RiscvEmulator::load(const PackedByteArray& buffer, const TypedArray<String>& arguments)
{
UtilityFunctions::print("Loading file from buffer");
Expand Down Expand Up @@ -156,7 +151,7 @@ void RiscvEmulator::handle_exception(gaddr_t address)
{
auto callsite = machine().memory.lookup(address);
UtilityFunctions::print(
"[", name(), "] Exception when calling:\n ", callsite.name.c_str(), " (0x",
"[", get_name(), "] Exception when calling:\n ", callsite.name.c_str(), " (0x",
String("%x").format(callsite.address), ")\n", "Backtrace:\n");
//this->print_backtrace(address);

Expand Down Expand Up @@ -205,7 +200,7 @@ void RiscvEmulator::print(std::string_view text)
{
String str(static_cast<std::string> (text).c_str());
if (this->m_last_newline) {
UtilityFunctions::print("[", name(), "] says: ", str);
UtilityFunctions::print("[", get_name(), "] says: ", str);
}
else {
UtilityFunctions::print(str);
Expand Down

0 comments on commit 3477d51

Please sign in to comment.