Skip to content

[Feature] DaedalusVm: Expose TopIsReference and PopReference for Ikarus _@ address-of operator #23

Description

@JaXt0r

The Ikarus _@ / MEM_GetIntAddress functions (e.g., _@s, _@f, ...) return the virtual address of a Daedalus variable. They work by inspecting the raw VM stack to retrieve a symbol reference before it is consumed as a value. This requires two APIs that are not currently exposed in the C# wrapper.

Reference OpenGothic (directmemory.cpp):

auto _takeref(zenkit::DaedalusVm& vm) -> zenkit::DaedalusNakedCall {
  if (vm.top_is_reference()) {
	  auto [ref, idx, context] = vm.pop_reference();
          ...
  }
  ...
}
vm.override_function("_@",  [this](zenkit::DaedalusVm& vm) { return _takeref(vm); });
vm.override_function("_@s", [this](zenkit::DaedalusVm& vm) { return _takeref(vm); });
vm.override_function("_@f", [this](zenkit::DaedalusVm& vm) { return _takeref(vm); });

Requested C# API:

  • DaedalusVm.TopIsReference
  • DaedalusVm.PopReference();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

awaiting verificationThe problem has been fixed, though external verification of this fix is requiredenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions