Author Topic: Cross Platform Outpost 2 Utility Library  (Read 4529 times)

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 926
Re: Cross Platform Outpost 2 Utility Library
« Reply #25 on: November 15, 2019, 11:30:48 AM »
I think this behavior is a bug. I may have forgotten to add an include to the master header and will look at it this evening.

Thanks for pointing it out.

-Brett

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 926
Re: Cross Platform Outpost 2 Utility Library
« Reply #26 on: November 16, 2019, 03:08:44 PM »
@TechCor,

You should be able to pull the master for OP2Utility with the issue you pointed out fixed.

-Brett

Offline TechCor

  • Jr. Member
  • **
  • Posts: 83
Re: Cross Platform Outpost 2 Utility Library
« Reply #27 on: November 17, 2019, 11:32:43 PM »
I'm having trouble getting the bitmap stored with ResourceManager. It returns null.

I do something like this (Greatly simplified):
Code: [Select]
ResourceManager resourceManager = new ResourceManager(Outpost2GameDirectory);

Code: [Select]
std::unique_ptr<Stream::BidirectionalReader> stream = resourceManager->GetResourceStream("well0004", true);
// NOTE: I've also tried "well0004.bmp"

if (stream == nullptr)
    return 0; // This happens. Stream is null.

return stream->Length();

Maybe I'm misunderstanding what ResourceManager does. I assumed it would search all the archives in the game directory for "well0004.bmp".

I can successfully get the BMPs using VolFile(Outpost2GameDirectory + "/art.vol") with ReadFileByName.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4853
Re: Cross Platform Outpost 2 Utility Library
« Reply #28 on: November 18, 2019, 01:51:02 PM »
The internal filenames within the VOL files for the tilesets includes the ".bmp" extension. You will need to specify the name exactly, including extension.

The ResourceManager object might be sensitive to things like having a trailing slash at the end of the path. If the path used does not include a trailing slash, try adding one. From your example of using VolFile directly, it looks like the Outpost2GameDirectory value does not include a trailing slash.

Nothing else jumps out at me as possibly wrong. I could check in more detail if you need.