Scrivener07 / FO4_Overlays

A framework that loads unique HUD elements when eye covering items are equipped.
https://www.nexusmods.com/fallout4/mods/33347
MIT License
3 stars 1 forks source link

Scaleform cannot load image files from the file system. #6

Closed Scrivener07 closed 6 years ago

Scrivener07 commented 6 years ago

Scaleform cannot load image files from the file system.

Bitmaps which are directly embedded into the overlay menu are loaded correctly. Problems start to happen when loading external resources from the file system.

Here is an example of the direct embedding which works correctly. Video: https://youtu.be/fGP-TZeVQ7o

Loading Bitmaps (png)

This error occurs when loading a bitmap directly from the file system. For example, loading Data\Interface\Armor\Synth\HelmetHeavyGO.png causes the following error.

Data\Interface\Armor\Synth\HelmetHeavyGO.png helmetheavygo

Error

Image file handler registry is not installed - can't load image data
Failed loading URL "Armor\Synth\HelmetHeavyGO.png"

Loading Texture (dds)

This error occurs when loading a texture directly from the file system. For example, loading Data\Interface\Armor\Synth\HelmetHeavyGO.dds causes the following error.

Instead of an opaque shape, nothing is rendered at all.

Error

Image file handler registry is not installed - can't load image data
Failed loading URL "Armor\Synth\HelmetHeavyGO.dds"

Loading Bitmap Embedded SWF

This error occurs when loading a swf from the file system which contains a bitmap. For example Data\Interface\Armor\Synth\HelmetHeavyGO.fla is embedded with a bitmap and published to Data\Interface\Armor\Synth\HelmetHeavyGO.swf.

Data\Interface\Armor\Synth\HelmetHeavyGO.fla flashsample

The vector parts of the swf are displayed correctly but the bitmap data is not. Data\Interface\Armor\Synth\HelmetHeavyGO.swf screenshot95

Error

zlib or jpeglib are not linked - can't load jpeg+zipped image data!

Help

The scaleform file loader seems to be missing its bitmap functionality even though the scaleform renderer has the ability to display bitmap. I am now exploring the possibility of using a file loader in c++ for loading the bitmaps (png,jpeg,dds) and then loading the bitmap from c++ code --> into the UI.

Im looking for help and advice on how to proceed at this point.

Scrivener07 commented 6 years ago

I may need to create a native plugin in order to load resources containing bitmap data.

The scaleform file loader seems to be missing its bitmap functionality even though the scaleform renderer has the ability to display bitmap. I am now exploring the possibility of using a file loader in c++ for loading the bitmaps (png,jpeg,dds) and then loading the bitmap from c++ code --> into the UI.

Scrivener07 commented 6 years ago

I need to do further testing with dds texture files.

Scrivener07 commented 6 years ago

Further attempts with dds files gave the same errors as the png files.

Scrivener07 commented 6 years ago

Note: Directly embedded PNG files must have their bitmap compression set to Lossless (PNG/GIF) bitmapproperties

Scrivener07 commented 6 years ago

Expired of F4SE team has given me some useful insights. expired_may10_2018

Scrivener07 commented 6 years ago

With F4SE v0.6.8 I can now Mount/Unmount bitmap images from the file system.

0.6.8
- support for runtime 1.10.89
- changed locking implementations to BSReadWriteLock
- added Scaleform functions to load dds images
    - MountImage(menuName, pathToMount, mountName)
    - UnmountImage(menuName, pathToUnmount)
    - Image is loaded through URLRequest("img://mountName")
- added Scaleform receiving function
    - function onF4SEObjCreated(codeObject:Object):void
    - This function is called on the menu root document as well as first-level children