discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
6k stars 1.26k forks source link

GameSDK: Image Fetch Fails #4298

Closed LennyPhoenix closed 2 years ago

LennyPhoenix commented 2 years ago

(This issue is a copy of the pre-existing GameSDK issue located here, made following the migration to a new issue tracker repo)

Description

Attempting to call IDiscordImageManager::fetch will always return an DiscordResult_InternalError via callback. We then can't run get_dimensions or get_data, as these return DiscordResult_NotFetched.

Steps to Reproduce

Minimal reproduction project:

#include "discord_game_sdk.h"

#include <stdio.h>
#include <stdlib.h>

void fetch_callback(void *p_callback_data, enum EDiscordResult p_result, struct DiscordImageHandle p_handle)
{
    printf("Result: %i\n", p_result);
}

int main(void)
{
    struct IDiscordCore *core;

    struct DiscordCreateParams params;
    DiscordCreateParamsSetDefault(&params);
    params.client_id = APPLICATION_ID;
    params.flags = DiscordCreateFlags_Default;

    enum EDiscordResult result = DiscordCreate(DISCORD_VERSION, &params, &core);
    printf("Initialised Discord core with result %i\n", result);

    if (!result)
    {
        struct IDiscordImageManager *images = core->get_image_manager(core);

        struct DiscordImageHandle handle = {
            .type = DiscordImageType_User,
            .id = 425340416531890178, // For the purpose of this test, this is my user ID.
            .size = 16,               // Size could be any power of 2 from 16 to 256.
        };
        images->fetch(images, handle, false, NULL, fetch_callback);

        while (!result)
        {
            result = core->run_callbacks(core);
        }

        printf("Callbacks failed: %i", result);

        core->destroy(core);
    }

    printf("Exiting...\n");
    return result;
}

Expected Behavior

fetch to return DiscordResult_Ok via callback:

Initialised Discord core with result 0
Result: 0

Current Behavior

Initialised Discord core with result 0
Result: 4

Screenshots/Videos

N/A

Client and System Information

night commented 2 years ago

this should be fixed in the next app deploy.

LennyPhoenix commented 2 years ago

Can confirm this is working now, thanks!