diff --git a/.gitignore b/.gitignore index c47f4c2..4d6fe3e 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ build/ src/lib/discord_social_sdk/* src/lib/godot-cpp/* *.zip +*.so +*.dll +*.dylib # release release/ diff --git a/SConstruct b/SConstruct index 5678803..57bfe42 100644 --- a/SConstruct +++ b/SConstruct @@ -21,10 +21,11 @@ elif env["platform"] == "windows": if env["target"] == "template_debug": debugsuffix = "_debug" folder = "debug/" + discord_library_target = discord_library.replace(".", f"{debugsuffix}.") else: debugsuffix = "" - folder = "release/" # - + folder = "release/" + discord_library_target = discord_library env.Append(LIBPATH=["src/lib/discord_social_sdk/lib/" + folder]) env.Append(LIBS=["discord_partner_sdk"]) @@ -41,8 +42,8 @@ library = env.SharedLibrary( env.Depends( library, Command( - "project/addons/discord-rpc-gd/bin/" + libexportfolder + discord_library, - "src/lib/discord_partner_sdk/bin/" + folder + discord_library, + "project/addons/discord-rpc-gd/bin/" + libexportfolder + discord_library_target, + "src/lib/discord_social_sdk/lib/" + folder + discord_library, Copy("$TARGET", "$SOURCE"), ), ) diff --git a/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension b/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension index 33e4e1c..541c550 100644 --- a/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension +++ b/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension @@ -19,11 +19,11 @@ linux.release.rv64 = "linux/libdiscord_partner_sdk_binding.so" [dependencies] macos = { "macos/libdiscord_partner_sdk.dylib": "" } -windows.debug.x86_64 = { "windows/discord_partner_sdk.dll": "" } +windows.debug.x86_64 = { "windows/discord_partner_sdk_debug.dll": "" } windows.release.x86_64 = { "windows/discord_partner_sdk.dll": "" } -linux.debug.x86_64 = { "linux/libdiscord_partner_sdk.so": "" } +linux.debug.x86_64 = { "linux/libdiscord_partner_sdk_debug.so": "" } linux.release.x86_64 = { "linux/libdiscord_partner_sdk.so": "" } -linux.debug.arm64 = { "linux/libdiscord_partner_sdk.so": "" } +linux.debug.arm64 = { "linux/libdiscord_partner_sdk_debug.so": "" } linux.release.arm64 = { "linux/libdiscord_partner_sdk.so": "" } -linux.debug.rv64 = { "linux/libdiscord_partner_sdk.so": "" } +linux.debug.rv64 = { "linux/libdiscord_partner_sdk_debug.so": "" } linux.release.rv64 = { "linux/libdiscord_partner_sdk.so": "" } diff --git a/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension.uid b/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension.uid new file mode 100644 index 0000000..2634095 --- /dev/null +++ b/project/addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension.uid @@ -0,0 +1 @@ +uid://jcdwy5o1utpj diff --git a/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk.so b/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk.so deleted file mode 100644 index 9dacf94..0000000 Binary files a/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk.so and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk_binding.so b/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk_binding.so deleted file mode 100644 index f9863c4..0000000 Binary files a/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk_binding.so and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk_binding_debug.so b/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk_binding_debug.so deleted file mode 100755 index cb1b423..0000000 Binary files a/project/addons/discord-rpc-gd/bin/linux/libdiscord_game_sdk_binding_debug.so and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk.dylib b/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk.dylib deleted file mode 100644 index 2cc726d..0000000 Binary files a/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk.dylib and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk_binding.dylib b/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk_binding.dylib deleted file mode 100644 index cfcd1a7..0000000 Binary files a/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk_binding.dylib and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk_binding_debug.dylib b/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk_binding_debug.dylib deleted file mode 100644 index 082e396..0000000 Binary files a/project/addons/discord-rpc-gd/bin/macos/libdiscord_game_sdk_binding_debug.dylib and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk.dll b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk.dll deleted file mode 100644 index be946ea..0000000 Binary files a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk.dll and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding.dll b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding.dll deleted file mode 100644 index 77ffef2..0000000 Binary files a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding.dll and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll deleted file mode 100644 index 2b52a76..0000000 Binary files a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_binding_debug.dll and /dev/null differ diff --git a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_x86.dll b/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_x86.dll deleted file mode 100644 index 45b9bb1..0000000 Binary files a/project/addons/discord-rpc-gd/bin/windows/discord_game_sdk_x86.dll and /dev/null differ diff --git a/project/addons/discord-rpc-gd/example.gd.uid b/project/addons/discord-rpc-gd/example.gd.uid new file mode 100644 index 0000000..b1fb16e --- /dev/null +++ b/project/addons/discord-rpc-gd/example.gd.uid @@ -0,0 +1 @@ +uid://dkv4pruvla8bn diff --git a/project/addons/discord-rpc-gd/nodes/Debug.tscn b/project/addons/discord-rpc-gd/nodes/Debug.tscn index e9501cc..7a4f9c9 100644 --- a/project/addons/discord-rpc-gd/nodes/Debug.tscn +++ b/project/addons/discord-rpc-gd/nodes/Debug.tscn @@ -115,8 +115,8 @@ tracks/0/keys = { [sub_resource type="AnimationLibrary" id="AnimationLibrary_a7ofc"] _data = { -"RESET": SubResource("Animation_mmtmn"), -"pulsate": SubResource("Animation_5u02v") +&"RESET": SubResource("Animation_mmtmn"), +&"pulsate": SubResource("Animation_5u02v") } [node name="DebugNodeGroup" type="Node"] diff --git a/project/addons/discord-rpc-gd/nodes/debug.gd.uid b/project/addons/discord-rpc-gd/nodes/debug.gd.uid new file mode 100644 index 0000000..3675e7d --- /dev/null +++ b/project/addons/discord-rpc-gd/nodes/debug.gd.uid @@ -0,0 +1 @@ +uid://46tue7u6crd6 diff --git a/project/addons/discord-rpc-gd/nodes/discord_autoload.gd.uid b/project/addons/discord-rpc-gd/nodes/discord_autoload.gd.uid new file mode 100644 index 0000000..c84b4e2 --- /dev/null +++ b/project/addons/discord-rpc-gd/nodes/discord_autoload.gd.uid @@ -0,0 +1 @@ +uid://d1ohgxo4k3cdf diff --git a/project/addons/discord-rpc-gd/plugin.gd.uid b/project/addons/discord-rpc-gd/plugin.gd.uid new file mode 100644 index 0000000..b9ae654 --- /dev/null +++ b/project/addons/discord-rpc-gd/plugin.gd.uid @@ -0,0 +1 @@ +uid://citpv7uf0k1ku diff --git a/project/addons/discord-rpc-gd/restart_window.tscn b/project/addons/discord-rpc-gd/restart_window.tscn index 0135285..84ff358 100644 --- a/project/addons/discord-rpc-gd/restart_window.tscn +++ b/project/addons/discord-rpc-gd/restart_window.tscn @@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"] -[sub_resource type="Image" id="Image_f4u3i"] +[sub_resource type="Image" id="Image_4rf8i"] data = { "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0), "format": "RGBA8", @@ -19,7 +19,7 @@ data = { } [sub_resource type="ImageTexture" id="ImageTexture_gdtpn"] -image = SubResource("Image_f4u3i") +image = SubResource("Image_4rf8i") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"] diff --git a/project/main.gd.uid b/project/main.gd.uid new file mode 100644 index 0000000..a429bf8 --- /dev/null +++ b/project/main.gd.uid @@ -0,0 +1 @@ +uid://e0nds76y78bx diff --git a/project/main.tscn b/project/main.tscn index fb1cfb8..cdc410e 100644 --- a/project/main.tscn +++ b/project/main.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=3 uid="uid://dyc3kseph4el7"] -[ext_resource type="Script" path="res://main.gd" id="1_kl8ri"] +[ext_resource type="Script" uid="uid://e0nds76y78bx" path="res://main.gd" id="1_kl8ri"] [ext_resource type="Texture2D" uid="uid://b3qm246m7pnsx" path="res://assets/Logo_V2.png" id="2_gd222"] -[ext_resource type="Script" path="res://addons/discord-rpc-gd/nodes/debug.gd" id="6_ujijw"] +[ext_resource type="Script" uid="uid://46tue7u6crd6" path="res://addons/discord-rpc-gd/nodes/debug.gd" id="6_ujijw"] [node name="Node" type="Node"] script = ExtResource("1_kl8ri") diff --git a/project/plugin_manager.gd.uid b/project/plugin_manager.gd.uid new file mode 100644 index 0000000..92e58b8 --- /dev/null +++ b/project/plugin_manager.gd.uid @@ -0,0 +1 @@ +uid://pi17u5foe8ti diff --git a/project/project.godot b/project/project.godot index 960b09f..484656b 100644 --- a/project/project.godot +++ b/project/project.godot @@ -13,15 +13,16 @@ config_version=5 config/name="GDExtension DiscordRPC Test Project" config/tags=PackedStringArray("vaporvee") run/main_scene="res://main.tscn" -config/features=PackedStringArray("4.3") +config/features=PackedStringArray("4.4") boot_splash/bg_color=Color(0.25098, 0.305882, 0.929412, 1) -boot_splash/image="res://assets/discordgodot_cover.png" boot_splash/fullsize=false +boot_splash/image="res://assets/discordgodot_cover.png" config/icon="res://assets/Logo_V2.png" [autoload] PluginManager="*res://plugin_manager.gd" +DiscordRPCLoader="*res://addons/discord-rpc-gd/nodes/discord_autoload.gd" [debug] @@ -40,6 +41,10 @@ window/size/resizable=false project/assembly_name="GDExtension Test Project" +[editor_plugins] + +enabled=PackedStringArray("res://addons/discord-rpc-gd/plugin.cfg") + [filesystem] import/blender/enabled=false diff --git a/src/discordgodot.cpp b/src/discordgodot.cpp index e4ef662..b6119e6 100644 --- a/src/discordgodot.cpp +++ b/src/discordgodot.cpp @@ -19,9 +19,7 @@ DiscordRPC *DiscordRPC::singleton = nullptr; std::shared_ptr client; -discordpp::ClientResult result; discordpp::Activity activity; -discordpp::UserHandle user; void DiscordRPC::_bind_methods() { @@ -52,7 +50,6 @@ void DiscordRPC::_bind_methods() BIND_METHOD(open_server_invite_overlay, "invite_code"); BIND_METHOD(open_voice_settings); BIND_METHOD(get_is_discord_working); - BIND_METHOD(get_result_int); } SET_GET(state, activity.SetState(value.utf8().get_data())) SET_GET(details, activity.SetDetails(value.utf8().get_data())) @@ -79,7 +76,7 @@ DiscordRPC *DiscordRPC::get_singleton() void DiscordRPC::run_callbacks() { - if (result.Successful() && app_id > 0) + if (app_id > 0) //result.Successful() && discordpp::RunCallbacks(); } void DiscordRPC::debug() @@ -175,16 +172,21 @@ void DiscordRPC::unclear() bool DiscordRPC::get_is_overlay_enabled() { bool ie; - if (get_is_discord_working()) + if (get_is_discord_working()){ // core->OverlayManager().IsEnabled(&ie); return ie; + } + return ie; } bool DiscordRPC::get_is_overlay_locked() { bool il; if (get_is_discord_working()) + { // core->OverlayManager().IsLocked(&il); return il; + } + return il; } void DiscordRPC::set_is_overlay_locked(bool value) { @@ -250,20 +252,20 @@ Dictionary DiscordRPC::get_current_user() { // discordpp::User user{}; // core->UserManager().GetCurrentUser(&user); - return user2dict(user); + return userdict; //user2dict(user) } return userdict; } Dictionary DiscordRPC::get_relationship(uint64_t user_id) { + Dictionary dict; if (get_is_discord_working()) { // discordpp::Relationship relationship{}; // core->RelationshipManager().Get(user_id, &relationship); - return /*relationship2dict(relationship)*/; + return dict /*relationship2dict(relationship)*/; } - Dictionary dict; return dict; } @@ -374,5 +376,5 @@ Dictionary DiscordRPC::relationship2dict(discordpp::RelationshipHandle relations bool DiscordRPC::get_is_discord_working() { - return result.Successful() && app_id > 0; + return app_id > 0; /*result.Successful() &&*/ } \ No newline at end of file diff --git a/src/discordgodot.h b/src/discordgodot.h index 248fed1..ec8395a 100644 --- a/src/discordgodot.h +++ b/src/discordgodot.h @@ -59,7 +59,6 @@ public: Dictionary get_relationship(uint64_t user_id); Array get_all_relationships(); bool get_is_discord_working(); - int get_result_int(); }; #endif \ No newline at end of file