void preload_images() { double start_time = platform_get_time(); #if !defined(CHOWDREN_IS_DESKTOP) && !defined(CHOWDREN_IS_ANDROID) #if defined(CHOWDREN_PRELOAD_IMAGES) || defined(CHOWDREN_PRELOAD_ALL) AssetFile fp; fp.open(); FileStream stream(fp); #ifdef CHOWDREN_IS_3DS Render::set_storage(true); #endif for (int i = 0; i < IMAGE_COUNT; i++) { unsigned short handle = stream.read_uint16(); Image * image = get_internal_image(handle); image->upload_texture(); #if !defined(CHOWDREN_PRELOAD_ALL) && defined(CHOWDREN_IS_3DS) if (Render::is_vram_full()) break; #endif image->set_static(); } #ifdef CHOWDREN_IS_3DS Render::set_storage(false); #endif #endif #endif double dt = platform_get_time() - start_time; std::cout << "Image preload took " << dt << std::endl; }
void preload_images() { double start_time = platform_get_time(); double dt; // slightly hardcoded unsigned int start = AssetFile::get_offset(0, AssetFile::IMAGE_DATA); unsigned int size = AssetFile::get_size(AssetFile::IMAGE_DATA); AssetFile read_file; read_file.open(); read_file.seek(start); startup_data = new unsigned char[size]; startup_size = size; read_file.read(startup_data, size); read_file.close(); dt = platform_get_time() - start_time; std::cout << "Image read took " << dt << std::endl; for (int i = 0; i < IMAGE_COUNT; ++i) { Image * image = get_internal_image(i); image->upload_texture(); image->set_static(); } delete[] startup_data; startup_data = NULL; dt = platform_get_time() - start_time; std::cout << "Image preload took " << dt << std::endl; }
void preload_images() { #ifndef CHOWDREN_IS_DESKTOP #if defined(CHOWDREN_PRELOAD_IMAGES) || defined(CHOWDREN_PRELOAD_ALL) AssetFile fp; fp.open(); FileStream stream(fp); glc_set_storage(true); for (int i = 0; i < IMAGE_COUNT; i++) { unsigned short handle = stream.read_uint16(); Image * image = get_internal_image(handle); image->upload_texture(); #ifndef CHOWDREN_PRELOAD_ALL if (glc_is_vram_full()) break; #endif image->set_static(); } glc_set_storage(false); #endif #endif }