Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Deploying additional files with VS2015 or using embedded resources within store apps

I want to load 3D models into my Hololens app. Either by way of files or by way of embedded resources. Either approach is easy in a traditional environment (e.g. Win32). Both seem difficult in Windows 10 store apps.

For these examples below, I have been using the Hololens emulator.

Files:
If I execute this code:
Platform::String^ localfolder = Windows::Storage::ApplicationData::Current->LocalFolder->Path;
std::wstring folderNameW(localfolder->Begin());

and look at the string, folderNameW, in the debugger, I see my app's local folder path is:
L"C:\Data\Users\DefaultAccount\AppData\Local\Packages\1a91a7c9-d0c3-4356-97cc-9c57185d06f4_gydnm2md4qw34\LocalState"

How can I deploy or copy extra files to this path? I can open the Device Portal and select the "File Explorer" but the paths and folders here do not map 1:1 with reality. The closest I can come is this:

User Files \ LocalAppData \ 1a91a7c9-d0c3-4356-97cc-9c57185d06f4_1.0.0.0_x86__gydnm2md4qw34 \ LocalState

But, as you can see, it is not an exact match. Plus, File Explorer says "This folder has no data associated with it" and does not offer the file upload feature.

Does anyone understand what I am missing with the Device Portal File Explorer or does anyone know how to make VS2015 deploy additional solution files to the Hololens emulator?

Embedded Resources:
FindResource(), et al, are unavailable in store apps. I want to embed some file data into my executable at compile-time and get a pointer-to and size-of the data at run-time.

I could write a simple utility that reads a file as binary bytes or words and generates a .CPP file with the hex strings of those bytes/words as an array initializer. But, I ask myself, if my compiler/linker could do this for me in 1996, why can't it do it for me in 2016? It seems there should be a way, but after a lot of reading, I could find no examples of C++/CX store apps using any kind of embedded resources.

Consider the "spinning cube renderer" example 'embeds' the cube vertex data like this:
static const Vertex cubeVertices[] =
{
Vertex(XMFLOAT3(-0.1f, -0.1f, -0.1f), XMFLOAT3(0.0f, 0.0f, 0.0f)),
Vertex(XMFLOAT3(-0.1f, -0.1f, 0.1f), XMFLOAT3(0.0f, 0.0f, 1.0f)),
Vertex(XMFLOAT3(-0.1f, 0.1f, -0.1f), XMFLOAT3(0.0f, 1.0f, 0.0f)),
Vertex(XMFLOAT3(-0.1f, 0.1f, 0.1f), XMFLOAT3(0.0f, 1.0f, 1.0f)),
Vertex(XMFLOAT3(0.1f, -0.1f, -0.1f), XMFLOAT3(1.0f, 0.0f, 0.0f)),
Vertex(XMFLOAT3(0.1f, -0.1f, 0.1f), XMFLOAT3(1.0f, 0.0f, 1.0f)),
Vertex(XMFLOAT3(0.1f, 0.1f, -0.1f), XMFLOAT3(1.0f, 1.0f, 0.0f)),
Vertex(XMFLOAT3(0.1f, 0.1f, 0.1f), XMFLOAT3(1.0f, 1.0f, 1.0f)),
};

Does anyone know a more extensible way to embed external data into a C++/CX store app?

Thanks!
Jeff

Answers

  • Options

    I did figure out that this:
    L"C:\Data\Users\DefaultAccount\AppData\Local\Packages\1a91a7c9-d0c3-4356-97cc-9c57185d06f4_gydnm2md4qw34\LocalState"
    is the same as this:
    User Files \ LocalAppData \ 1a91a7c9-d0c3-4356-97cc-9c57185d06f41.0.0.0_x86_gydnm2md4qw34 \ LocalState
    despite the highlighted differences.

    Personally, if we are going to call something a "File Explorer" on a developer tool, I'd rather see the raw paths.

    The problem with uploading files was two-fold and pretty easy to solve:
    1) I had to upgrade to the latest version of the emulator to fix the problem of no "Upload" button appearing for empty folders.
    2) The upload script is incompatible with Firefox so I switched to Edge.

    I still do not know how to properly embed a file into a WinRT style app. I don't see why FindResource() must be disallowed since I can get the same effect in other ways, just with more work.

Sign In or Register to comment.