Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions common/resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ Resources::Resources(Tempest::Device &device)
DmResult rv = DmLoader_create(&dmLoader, DmLoader_DOWNLOAD);
if(rv != DmResult_SUCCESS) {
Log::e("Failed to created DmLoader object. Out of memory?");
dmLoader = nullptr;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure, It's not intended for library code (DmLoader_create) to change &dmLoader on error.
So, correct way to fix it is to PR into DirectMusic.

}

DmLoader_addResolver(dmLoader, [](void* ctx, char const* name, size_t* len) -> void* {
else {
DmLoader_addResolver(dmLoader, [](void* ctx, char const* name, size_t* len) -> void* {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also not need - DmLoader_* meant to early out and return DmResult_INVALID_ARGUMENT, for null-argument.

auto* slf = reinterpret_cast<Resources*>(ctx);
auto* node = slf->gothicAssets.find(name);

Expand All @@ -118,7 +119,8 @@ Resources::Resources(Tempest::Device &device)
reader->read(bytes, *len);

return bytes;
}, this);
}, this);
}
}

void Resources::mountWork(const std::filesystem::path& path) {
Expand Down