save images into Cache out of bounds error

Discussion and help for Easy Save 3
Post Reply
djaydino
Posts: 10
Joined: Fri Dec 26, 2014 5:25 pm

save images into Cache out of bounds error

Post by djaydino »

Hi.
I am trying to load save some textures2D (which are used for mini map fog of war) in to Cache memory for playstation 4/5 platform.

For pc/mac/linux I load/save them into files and works perfect.
But for storing to Chace the saveImage() seems to have issues.

When saving (with Chace setting) i get this error :

Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
Am I forgetting some settings or is in not possible to store into Chace.
the files in pc version are between 5 and 10 kb only.

maybe I can convert to byte or something else then save into Chace?

or should i look into Playmakers Save plugin to save those images.

thanks in advance for any suggestion :)

here are my es3Settings :

Code: Select all

 #region ES3 Settings
            es3Settings.path = Globals.saveSlot;
            es3Settings.location = ES3.Location.Cache;
            es3Settings.encryptionType = ES3.EncryptionType.AES;
            es3Settings.encryptionPassword = pw;
            es3Settings.directory = ES3.Directory.PersistentDataPath;
            es3Settings.format = ES3.Format.JSON;
            es3Settings.bufferSize = 2048;
            #endregion
and save for map masks :

Code: Select all

        private void SaveMapMasks()
        {
            for (int i = 0; i < pData.mapMasksNames.Length; i++)
            {
                if (pData.mapMasks[i] != null) ES3.SaveImage((Texture2D)pData.mapMasks[i], 75, Globals.saveSlot + pData.mapMasksNames + ".png", es3Settings);
            }
        }
just some parts of some other stuff that i am saving :

Code: Select all

  ES3.Save<object>(Globals.saveSlot + "Currency", pData.currency, es3Settings);
            ES3.Save<object>(Globals.saveSlot + "currentArmor", pData.currentArmor, es3Settings);
            ES3.Save<object>(Globals.saveSlot + "ManaLevel", pData.manaLevel, es3Settings);
            ES3.Save<object>(Globals.saveSlot + "HealthLevel", pData.healthLevel, es3Settings);

Code: Select all

 ES3.Save<GearData[]>(Globals.saveSlot + "SO_EQPGear", pInv.eqpGear, es3Settings);
            ES3.Save<GearData[]>(Globals.saveSlot + "SO_INVGear", pInv.invGear, es3Settings);
            ES3.Save<GearData[]>(Globals.saveSlot + "SO_VaultGear", pInv.vaultGear, es3Settings);

Code: Select all

        private void SaveFactionLevels()
        {
            _dict.Clear();

            for (int i = 0; i < pData.factionLevelsNames.Length; i++)
            {
                _dict[pData.factionLevelsNames[i]] = pData.factionLevels[i];
            }

            ES3.Save<Dictionary<string, object>>(Globals.saveSlot + "Faction levels Hash V2", _dict, es3Settings);
        }
Kind regards,
Djaydino
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: save images into Cache out of bounds error

Post by Joel »

Hi there,

This isn't possible because the cache is for caching structured serialization data. However, if you private message me your invoice number I can send over an update which includes a SaveImageToBytes method which returns a byte array.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply