Skip to content

Commit

Permalink
Remove couts and add idls
Browse files Browse the repository at this point in the history
  • Loading branch information
Virus-Axel committed Feb 14, 2025
1 parent e2c7904 commit d879fda
Show file tree
Hide file tree
Showing 8 changed files with 8,040 additions and 11 deletions.
2,128 changes: 2,128 additions & 0 deletions idls/candy_guard.json

Large diffs are not rendered by default.

951 changes: 951 additions & 0 deletions idls/candy_machine_core.json

Large diffs are not rendered by default.

4,960 changes: 4,960 additions & 0 deletions idls/mpl_core.json

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions src/anchor/generic_anchor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,9 @@ Array GenericAnchorNode::split_args(const Array& args, const StringName& instruc
ERR_FAIL_COND_V(!idl.has("instructions"), Array());
const Array instructions = idl["instructions"];

std::cout << String(instruction_name).ascii() << std::endl;
const Dictionary instruction = program->find_idl_instruction(instruction_name);
ERR_FAIL_COND_V(!instruction.has("accounts"), Array());
const Array accounts = instruction["accounts"];
std::cout << "SSSIISISISIS " << accounts.size() << std::endl;
return args.slice(accounts.size());
}

Expand Down Expand Up @@ -419,21 +417,18 @@ void GenericAnchorNode::bind_instruction_caller(const StringName &p_class_name,
}

bound_instruction_name = String(instruction_name).ascii();
std::cout << "IIII " << bound_instruction_name << std::endl;
auto *lambda = new auto([](void *p_method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error) {
if (p_instance == nullptr) {
return;
}
MethodBind * va = (MethodBind*)p_method_userdata;
const String stored_instruction_name = va->get_name();
std::cout << "KILLME " << String(va->get_name()).ascii() <<std::endl;
const AnchorProgram* program = Object::cast_to<AnchorProgram>(static_cast<GenericAnchorNode *>(p_instance)->anchor_program);
Array accounts_and_args;
for(unsigned int i = 0; i < p_argument_count; i++){
const Variant *var = reinterpret_cast<const Variant*>(p_args[i]);
accounts_and_args.append(*var);
}
//std::cout << p_argument_count << "atype "<< arg->get_type() << String(np.get_name(0)).ascii() << std::endl;
const Array accounts = static_cast<GenericAnchorNode *>(p_instance)->split_accounts(accounts_and_args, stored_instruction_name);
const Array args = static_cast<GenericAnchorNode *>(p_instance)->split_args(accounts_and_args, stored_instruction_name);
const Dictionary decorated_args = program->build_argument_dictionary(args, stored_instruction_name);
Expand Down Expand Up @@ -463,7 +458,6 @@ void GenericAnchorNode::bind_instruction_caller(const StringName &p_class_name,
static_cast<uint32_t>(method_bind->get_default_argument_count()),
def_args.data(),
};
std::cout << " bind class method "<< String(name).ascii() << std::endl;
internal::gdextension_interface_classdb_register_extension_class_method(internal::library, p_class_name._native_ptr(), &method_info);
}

Expand Down
1 change: 0 additions & 1 deletion src/anchor/generic_anchor_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,6 @@ void GenericAnchorResource::add_property(const Dictionary &property_data) {
};
property_database[get_class_static()][enum_value_name] = enum_value_info;

std::cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " << enum_value_name.ascii() << std::endl;
bind_resource_setter(get_class_static(), D_METHOD("set_" + enum_value_name, "value"), enum_value_name);
bind_resource_getter(get_class_static(), D_METHOD("get_" + enum_value_name), enum_value_name);

Expand Down
1 change: 0 additions & 1 deletion src/anchor_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,6 @@ Variant AnchorProgram::build_argument_dictionary(const Array& arguments, const S
const Array anchor_arguments = instruction["args"];

Dictionary result;
std::cout << arguments.size() << " - " << anchor_arguments.size() << std::endl;
UtilityFunctions::print(arguments);
UtilityFunctions::print(anchor_arguments);

Expand Down
2 changes: 0 additions & 2 deletions src/dialogs/add_custom_idl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ void AddCustomIdlDialog::clear() {
}

void AddCustomIdlDialog::load_idl(const String &filename) {
UtilityFunctions::print(filename);
Ref<FileAccess> file = FileAccess::open(filename, FileAccess::ModeFlags::READ);
const Dictionary content = JSON::parse_string(file->get_as_text());
UtilityFunctions::print(content);
GenericAnchorNode::bind_anchor_node(content);
}

Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/menubar_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void MenuBarHelper::_bind_methods() {
void MenuBarHelper::menu_pressed_callback(int64_t menu_id) {
switch (menu_id) {
case MenuID::IDL_TO_NODE:
add_custom_idl_dialog->popup_centered();
add_custom_idl_dialog->popup_centered(Vector2i(400, 300));
break;
default:
ERR_FAIL_EDMSG("Unknown menu item");
Expand Down

0 comments on commit d879fda

Please sign in to comment.