diff --git a/game/sdl/android/jni/ht/hosthelpers.cpp b/game/sdl/android/jni/ht/hosthelpers.cpp index 8998d4b..76143df 100644 --- a/game/sdl/android/jni/ht/hosthelpers.cpp +++ b/game/sdl/android/jni/ht/hosthelpers.cpp @@ -239,6 +239,33 @@ void HostHelpers::GetSurfaceProperties(SurfaceProperties *pprops) pprops->density = density; } +bool HostHelpers::DirExists(char *psz) +{ + AAssetDir *assetDir = AAssetManager_openDir(gassetmgr, psz); + bool exists = AAssetDir_getNextFileName(assetDir) != NULL; + AAssetDir_close(assetDir); + return exists; +} + +bool HostHelpers::EnumFiles(Enum *penm, int key, char *pszFn, int cbFn) +{ + if (penm->m_pvNext == (void *)kEnmFirst) { + AAssetDir *assetDir = AAssetManager_openDir(gassetmgr, gpakr.BottomDir()); + penm->m_pvNext = (void *)assetDir; + penm->m_dwUser = 0; + } + + AAssetDir *assetDir = (AAssetDir *)penm->m_pvNext; + const char *ent = AAssetDir_getNextFileName(assetDir); + if (ent != NULL) { + strncpyz(pszFn, ent, cbFn); + penm->m_dwUser++; + return true; + } + AAssetDir_close(assetDir); + return false; +} + /* void HostHelpers::FrameStart() { diff --git a/game/sdl/hosthelpers.h b/game/sdl/hosthelpers.h index b0b36d9..c09b0c2 100644 --- a/game/sdl/hosthelpers.h +++ b/game/sdl/hosthelpers.h @@ -52,6 +52,8 @@ public: static void GameThreadStart(void *pv); static void DisplayInitComplete(); static const char *GetPlatformString(); + static bool DirExists(char *psz); + static bool EnumFiles(Enum *penm, int key, char *pszFn, int cbFn); // TODO(darrinm): unused? static int main(int argc, char **argv);