{"id":30430674,"url":"https://github.com/rh101/axmol-vfs-example","last_synced_at":"2025-08-22T18:23:46.619Z","repository":{"id":212316247,"uuid":"731216958","full_name":"rh101/axmol-vfs-example","owner":"rh101","description":"Example of virtual file system support in Axmol game engine","archived":false,"fork":false,"pushed_at":"2025-06-14T14:25:02.000Z","size":3159,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T15:33:22.188Z","etag":null,"topics":["axmol","axmol-examples","axmolengine"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rh101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-13T15:35:43.000Z","updated_at":"2025-06-14T14:25:06.000Z","dependencies_parsed_at":"2023-12-13T16:53:09.454Z","dependency_job_id":"8f1772e5-a45b-46ce-a117-73f351736230","html_url":"https://github.com/rh101/axmol-vfs-example","commit_stats":null,"previous_names":["rh101/axmol-vfs-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rh101/axmol-vfs-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh101%2Faxmol-vfs-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh101%2Faxmol-vfs-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh101%2Faxmol-vfs-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh101%2Faxmol-vfs-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rh101","download_url":"https://codeload.github.com/rh101/axmol-vfs-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh101%2Faxmol-vfs-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271681101,"owners_count":24802077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axmol","axmol-examples","axmolengine"],"created_at":"2025-08-22T18:23:42.864Z","updated_at":"2025-08-22T18:23:46.594Z","avatar_url":"https://github.com/rh101.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# axmol-vfs-example\nExample of implementing virtual file system support in a project using the [Axmol](https://github.com/axmolengine/axmol) game engine.\n\nIf audio assets are to be included in compressed archives, then ensure that all audio files are stored uncompressed in the archive.  This is required in order to ensure that the file is streamed correctly by the VFS.\n\nThis implementation is only for the Windows platform, but that is only a limitation of this project, not of Axmol VFS support. To support other platforms, sub-class the relevant FileUtils implementation for that platform and implement the required methods.\n\nThis project uses [PhysFS](https://github.com/icculus/physfs) for the VFS support.\n\nA C++ wrapper for PhysFS can also be used if required. You can find the an up-to-date version here: [physfs-cpp](https://github.com/rh101/physfs-cpp)\n\n\n## Add VFS support for a library that requires file access\n\nThere are a lot of examples in the Axmol engine code related to this. \n\nSee these implementations in these source files:\n* [FontFreeType.cpp](https://github.com/axmolengine/axmol/blob/dev/core/2d/FontFreeType.cpp)\n* [AudioDecoderMp3.cpp](https://github.com/axmolengine/axmol/tree/dev/core/audio/AudioDecoderMp3.cpp)\n* [AudioDecoderOgg.cpp](https://github.com/axmolengine/axmol/tree/dev/core/audio/AudioDecoderOgg.cpp)\n* [AudioDecoderWav.cpp](https://github.com/axmolengine/axmol/tree/dev/core/audio/AudioDecoderWav.cpp)\n* [UserDefault.cpp](https://github.com/axmolengine/axmol/tree/dev/core/base/UserDefault.cpp)\n* [ZipUtils.cpp](https://github.com/axmolengine/axmol/tree/dev/core/base/ZipUtils.cpp)\n\nThe libraries used by the implementations above provide overridable file access routines, which would be mapped to go through `ax::FileUtils`, using the `IFileStream` interface. This ensures that any access goes through the VFS.\n\n## Working with libraries that are difficult to use with a VFS\n\nIf you are working with any library that cannot be easily adapted to work with a virtual file system, then you would need to use the real file system paths as usual (not VFS paths!). In this case, you also would not be doing any file access through `ax::FileUtils`, which would most likely be the case with or without a VFS.\n\nAn example of this would be SQLite. The following example also uses SQLiteCpp as a wrapper to simplify things even further:\n\n```cpp\nauto writablePath = ax::FileUtils::getInstance()-\u003egetNativeWritableAbsolutePath(); // Get the underlying file system path to the relevant directory\n// or you can use the PHYSFS_getWriteDir() call if you have previously set the native path via PHYSFS_setWriteDir();\n// auto writablePath = PHYSFS_getWriteDir();\n\nconst auto dbPath = fmt::format(\"{}/mydb.sqlite\", writablePath); // Database file is named \"mydb.sqlite\", and is stored in the root of our writable path\nSQLite::Database db(dbPath, SQLite::OPEN_READONLY); // Opens database\n\n// Example query:\nSQLite::Statement query(db, \"SELECT * FROM MyTable WHERE Id = ?\");\nquery.bind(1, 12345); // Id of 12345\nif (query.executeStep())\n{\n    // Do something with the data\n}\n// etc. etc.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frh101%2Faxmol-vfs-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frh101%2Faxmol-vfs-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frh101%2Faxmol-vfs-example/lists"}