1313
1414namespace App
1515{
16- struct PngEncoder {
16+ struct MIPEncoder {
17+
18+ enum Format {
19+ kImageFormatPNG ,
20+ kImageFormatTGA ,
21+ kImageFormatBMP
22+ };
23+
24+ bool WriteImageToStream (IO ::IStream* outputStream, Format format);
25+
1726
18- bool EncodePNG (IO ::IStream* outputStream, int mode);
1927
2028 /* 00h */ eastl::vector<int > mPixelBuf ;
2129 /* 14h */ uint32_t mnImageWidth;
@@ -39,7 +47,7 @@ namespace App
3947 /* 58h */ eastl::vector<int8_t > mData ;
4048 /* 6Ch */ int field_6C;
4149 };
42- ASSERT_SIZE (PngEncoder , 0x70 );
50+ ASSERT_SIZE (MIPEncoder , 0x70 );
4351
4452 struct ThumbnailDecodedMetadata
4553 {
@@ -83,11 +91,11 @@ namespace App
8391 // / @param[out] dst The eastl::string where the path will be written.
8492 bool GetFolderPath (uint32_t creationType, eastl::string16& dst);
8593
86- // / Used to obtain a path from a locale file, by default `0x19F76D11 .locale`, similar to the one that would
94+ // / Used to obtain a path from a locale file, by default `SaveDataFolders .locale`, similar to the one that would
8795 // / return GetFolderPath()
8896 bool FolderPathFromLocale (uint32_t instanceID, eastl::string16& dst, uint32_t tableID = 0xFFFFFFFF );
8997
90- // / Encodes the given resource into a `.png` image and saves it, both in the given package and in the
98+ // / Encodes the given resource into a `.png` Model-in-Picture and saves it, both in the given package and in the
9199 // / "My Spore Creations" in the user Documents folder.
92100 // /
93101 // / In the package, the image will be saved using the same ResourceKey as the resource, but with a TypeIDs::png type.
@@ -100,21 +108,21 @@ namespace App
100108 // / @param forceReplace [Optional] If false (by default), if the `.png` already exists in the folder, it will try writing variants like `(1)`, `(2)`,...
101109 // / @param disableSteganography [Optional] If false (by default), the data in the `.png` will be stored in a special way meant to save space.
102110 // / @returns `true` on success, `false` if something failed.
103- bool SavePNG (Resource::ResourceObject* pResource, RenderWare::Raster* pImage, Resource::Database* database,
111+ bool SaveMIP (Resource::ResourceObject* pResource, RenderWare::Raster* pImage, Resource::Database* database,
104112 bool forceReplace = false , bool disableSteganography = false );
105113
106114 // / Reads the PNG file from the given file path, and adds the creation found within to the Sporepedia if it hasn't been added yet.
107115 // /
108116 // / @param path The full path to the file being read.
109117 // / @param key Resource key to the creation being read.
110118 // / @returns 'true' on success, 'false' if something failed.
111- bool ImportPNG (const char16_t * path, ResourceKey& key);
119+ bool ImportMIP (const char16_t * path, ResourceKey& key);
112120
113- // / Extracts information from a PNG file. It extracts both the metadata, and the data encoded within the image.
121+ // / Extracts information from a Model-in-Picture PNG file. It extracts both the metadata, and the data encoded within the image.
114122 // / @param[out] dstMetadata
115123 // / @param[out] dstDataStream
116124 // / @returns true on success, false if something failed
117- bool DecodePNG (IO ::IStream* stream, ThumbnailDecodedMetadata& dstMetadata, IStreamPtr& dstDataStream);
125+ bool DecodeMIP (IO ::IStream* stream, ThumbnailDecodedMetadata& dstMetadata, IStreamPtr& dstDataStream);
118126
119127 // / Saves the file paths information that keeps track of which PNGs have been loaded.
120128 // / It saves it in file `0x473C3E6!0x473C3E6.0x473C3E6` of Resource::SaveAreaID::Server (`Pollination.package`)
@@ -129,7 +137,7 @@ namespace App
129137 // / @param[out] dstSkippedPaths A list of paths that were skipped because they were already in mPngPathToKey or too many files were loaded
130138 // / @param[out] dstCount The number of PNGs that were imported is added to this value
131139 // / @returns True if some PNG was loaded, false otherwise
132- bool ImportDirectoryPNGs (const eastl::string16& directoryPath, eastl::hash_set<eastl::string16>& dstSkippedPaths, int & dstCount);
140+ bool ImportDirectoryMIPs (const eastl::string16& directoryPath, eastl::hash_set<eastl::string16>& dstSkippedPaths, int & dstCount);
133141
134142 static Thumbnail_cImportExport* Get ();
135143
@@ -140,7 +148,7 @@ namespace App
140148 /* 44h */ uint32_t mMachineId ; // not initialized
141149 /* 48h */ eastl::hash_map<int , int > field_48;
142150 /* 68h */ eastl::hash_map<int , int > field_68;
143- /* 88h */ PngEncoder mPngEncoder ;
151+ /* 88h */ MIPEncoder mMipEncoder ;
144152 /* F8h */ ResourceKey mCurImage ;
145153 /* 104h */ eastl::string16 mCellsPath ;
146154 /* 114h */ eastl::string16 mCreaturesPath ;
@@ -159,15 +167,15 @@ namespace App
159167 DeclareAddress (Get);
160168 DeclareAddress (GetFolderPath);
161169 DeclareAddress (FolderPathFromLocale);
162- DeclareAddress (SavePNG );
163- DeclareAddress (ImportPNG );
164- DeclareAddress (DecodePNG ); // 0x5FBA10 0x5FBB90
170+ DeclareAddress (SaveMIP );
171+ DeclareAddress (ImportMIP );
172+ DeclareAddress (DecodeMIP ); // 0x5FBA10 0x5FBB90
165173 DeclareAddress (SaveFilePaths); // 0x5F89C0 0x5F8B60
166- DeclareAddress (ImportDirectoryPNGs ); // 0x5FC900 0x5FCA80
174+ DeclareAddress (ImportDirectoryMIPs ); // 0x5FC900 0x5FCA80
167175 }
168176
169- namespace Addresses ( PngEncoder )
177+ namespace Addresses ( MIPEncoder )
170178 {
171- DeclareAddress (EncodePNG ); // 0x68E660 0x68e190
179+ DeclareAddress (WriteImageToStream ); // 0x68E660 0x68e190
172180 }
173181}
0 commit comments