Re: The Resource Dll For Bitmaps Could Not Be Loaded

1 view
Skip to first unread message
Message has been deleted

Fabulously Favuzza

unread,
Jul 17, 2024, 6:52:23 AM7/17/24
to mebucarneck

I'm assuming the entire island (which is multiple screens long) is loaded into memory. With probably around 10 different islands, how can something like this be possible? I've attempted to do something similar in one of my games, but I always ran out of memory. The bitmaps are (estimated) at around 2000px x 500px at the largest which comes out to about 4mb each uncompressed? If you had 10 of them it would require 40mb of memory! So obviously I'm missing something.Is it plausible to be loading and unloading bitmaps into memory while the game runs? Or is there some other technique that I'm not aware of?

I am also loading a bitmap resource in runtime, from a list of approx 10 bitmaps. Each bitmap is approx 250 bytes. I only load one bitmap and not the entire list, to preserve as much memory as possible. Is there anything in terms of handling resource and bitmaps that I should think about in order to save memory?

the resource dll for bitmaps could not be loaded


Download https://xiuty.com/2yUGlH



Peak usage != current usage. If you're creating objects (and allowing them to go out of scope), that would cause a memory spike. Loading a resource may also cause a memory spike. If your background process returns an object to the main process, seems like that could also cause a memory spike. I imagine that making any Monkey C API call at all has the potential to cause a memory spike, as you don't know what it's doing behind the scenes. I imagine that getActivityInfo(), for example, would cause a spike, as it returns a pretty big object. (This is assuming that object isn't "always" available somehow -- I doubt it is.)

You do need a function to consume your own precalculated layouts, but you get to save a lot of memory by encoding layouts as efficiently as possible (e.g. as bit-packed arrays of numbers -- i.e. 32-bit integers). With CIQ 3 watches, you can store arbitrary data as JSON resources. For older watches, you could wrap your data in a function so it doesn't consume memory all the time. (This is another way to you have memory spikes, but at least it reduces the "resting" amount of memory required. It works for any kind of data that doesn't need to be accessed all the time.)

- As long as you call loadResource() at least once, all of the resource tables are loaded into memory permanently. This means that each resource (but not its contents) takes up a fixed amount of memory. This even includes application settings strings (which are 99% likely to not even be used by the app itself.)

There is also a corresponding wxBITMAP() macro which allows to create the bitmaps in much the same way as wxICON() creates icons. It assumes that bitmaps live in resources under Windows or OS2 and XPM files under all other platforms (for XPMs, the corresponding file must be included before this macro is used, of course, and the name of the bitmap should be the same as the resource name under Windows with _xpm suffix). For example:

You should always use wxICON() and wxBITMAP() macros because they work for any platform (unlike the code above which doesn't deal with wxMac, wxX11, ...) and are shorter and more clear than versions with many #ifdef blocks. Alternatively, you could use the same XPMs on all platforms and avoid dealing with Windows resource files.

If you'd like to embed bitmaps with alpha transparency in your program, neither XPM nor BMP formats are appropriate as they don't have support for alpha and another format, typically PNG, should be used. wxWidgets provides a similar helper for PNG bitmaps called wxBITMAP_PNG() that can be used to either load PNG files embedded in resources (meaning either Windows resource section of the executable file or OS X "Resource" subdirectory of the application bundle) or arrays containing PNG data included into the program code itself.

it shows that uidesc is loaded from a resource, which is how it should be.
Then,
I suppose that when building release, -DVST_GUI_LIVE_EDITING=0 is implicit. and all resources must be inside the rc file for the plugin to load them.
On the other hand, when using -DVST_GUI_LIVE_EDITING=1 in debug, the WYSIWYG editor loads assets from path defined inside the uidesc (and also use the uidesc file path to write the modified uidesc file), Which is why everything appears ok. I will add background images as resources in the rc file and hopefully it will solve the issue.

Substance 3D Designer supports 3 modes of bringing in or creating new resources for use in your graph. These resources can be of many different types, including but not limited to bitmaps, vector graphics, 3D scenes and fonts. This page explains the different methods and when each one is best used.

A special case is when you create a new bitmap or SVG: these files will show up in your Explorer and behave like an imported resource, but without requiring an external file. They can be modified in Designer. New bitmaps and SVG's created in this way are good if you don't need to rely on an external editor: for example when you just want a quick and simple vector shape, or a simple painted 2D-bitmap mask.

Linking is ideal if you know you will need to use an external editor to update your resource while you simultaneously work in Designer. Baking maps is a prime example: you could have Designer reference bitmaps form an external baking application, which will automatically reload and update your graph as soon as these files are changed. Similarly, 3D scenes can only be linked, so that every time when you export a new FBX file from your 3D application, Designer automatically updates the mesh used in the 3D view. If your are baking maps from this mesh you will have to manually start the baking process over, ideally by clicking RMB and selecting 'Refresh all baked maps'.

Each call to into() that loads a resource increments the reference count for that resource by one. If the same resource is loaded into two different Targets it will have a reference count of two after both loads complete.

If you want to edit .MSSTYLES or another DLL or ressources files (to make new skin/style for Windows XP or another application that use 32bpp bitmaps), you will probably see that a great amount of images the windows's skins are using are 32bits-bitmaps. And when you open these bitmaps on almost all applications, the alpha chanel is dropped due to the non-support of this sort of BMP in Windows Bitmap Loading API (for win 3.1 / win 95 historical reasons).

Paint.NET doesn't escape from the rule and load/save bitmaps as they were in 24bpp.

This plugin allow you to open and save file in 32-bit bitmap.
The only thing you must do is to rename it to *.bmpx (to avoid conflit with the existing PDN's BMP handler).
If you try to open non-BMP files, you should receive an error (rem: 24bpp bitmaps are loaded correcty too).

This plugin is perfectible and I'll publish updates if you find bugs/things to change.

Changelog [2.6

When handling bitmaps Android developers can come across the error java.lang.OutOfMemoryError: bitmap size exceeds VM budget. This usually occurs when the bitmaps are large (several megabytes uncompressed), also when running the code on older devices, or trying to load lots of bitmaps. This occurs because Android was design for mobile devices, which may have limited hardware resources, including memory, and bitmaps can require large amounts of memory.

The /resources/bitmaps subdirectory of the IDL distribution contains a selection of 16-color (4-bit), 16 x 16 pixel icon images. To use these images as bitmaps in a tree widget, you must convert them to 16 x 16 x 3 (24-bit color) arrays.

When the size of gap1 and gap2 is zero, the in-memory DIB data structure is customarily referred to as "packed DIB" and can be referred to by a single pointer pointing to the beginning of the DIB header. In all cases, the pixel array must begin at a memory address that is a multiple of 4 bytes. In some cases it may be necessary to adjust the number of entries in the color table in order to force the memory address of the pixel array to a multiple of 4 bytes.[8] For "packed DIBs" loaded in memory, the optional color profile data should immediately follow the pixel array, as depicted in diag. 1 (with gap1=0 and gap2=0).[7]
"Packed DIBs" are required by Windows clipboard API functions as well as by some Windows patterned brush and resource functions.[9]

I built my game basically into a class with a state system.
I load my assets in the load state or when I need.
I use an asset-manager I built to keep track of everything I loaded and allows me to reuse everything as I need. I used a hash table to determine if something is already loaded and simply return a pointer back to the asset. You could use the file name as a key for example.

In some application this is not possible or practical. For examplewhen the images are not available at compile-time (maybe they aredownloaded through an internet connection later), or when you simplyhave too many bitmaps to fit in your application flash space.

To facilitate this kind of database technology, Windows programs support what are called resources. These are simply pieces of data combined with your program code that can be loaded in later during runtime by the program itself. Figure 3.1 depicts this concept.

BitmapThese are the standard bitmaps that you would imagine: arectangular matrix of pixels in monochrome or 4-, 8-, 16-, 24-, or 32-bitformat. They are very common objects in graphical operating systems such asWindows, so they can be added as resources also. Bitmaps use the .BMPfile extension.

DialogDialog boxes are so common in Windows that the designersdecided to make them a resource rather than something that is loaded externally.Good idea! Therefore, you can either create dialog boxes on-the-fly with code,or design them with an editor and store them as a resource.

This .RES file contains all the binary data making up whichever icons, cursors, bitmaps, sounds, and so forth that you may have defined in the .RC resource file. Then the .RES file is taken, along with your .CPP, .H, .LIB, .OBJ, and so on, and compiled into one .EXE, and that's it! Figure 3.2 illustrates the data flow possibilities of this process.

aa06259810
Reply all
Reply to author
Forward
0 new messages