Revert "Add support for android paths and loading datadir with playcore api"

This reverts commit 313b5824f5.
This commit is contained in:
loonycyborg 2024-12-05 21:20:22 +03:00
parent 413b2453b5
commit 3a2e969b75
No known key found for this signature in database
GPG key ID: 6E8233FAB8F26D61
2 changed files with 0 additions and 64 deletions

View file

@ -61,9 +61,6 @@
#endif
#ifdef __ANDROID__
#include <SDL2/SDL_system.h>
#endif
static lg::log_domain log_filesystem("filesystem");
#define DBG_FS LOG_STREAM(debug, log_filesystem)
@ -730,10 +727,6 @@ void set_user_data_dir(std::string newprefdir)
}
#endif
#ifdef __ANDROID__
backupprefdir = std::string(SDL_AndroidGetInternalStoragePath()) + "/" + backupprefdir;
#endif
#ifdef _X11
const char* home_str = getenv("HOME");

View file

@ -120,10 +120,6 @@
#ifdef __ANDROID__
#include <android/log.h>
#include <jni.h>
#include <play/asset_pack.h>
#endif
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
@ -990,7 +986,6 @@ static int do_gameloop(const std::vector<std::string>& args)
* Try to autodetect the location of the game data dir. Note that
* the root of the source tree currently doubles as the data dir.
*/
#ifndef __ANDROID__
static std::string autodetect_game_data_dir(std::string exe_dir)
{
std::string auto_dir;
@ -1021,7 +1016,6 @@ static std::string autodetect_game_data_dir(std::string exe_dir)
return auto_dir;
}
#endif
#ifdef _WIN32
#define error_exit(res) \
@ -1046,53 +1040,6 @@ int main(int argc, char** argv)
events::set_main_thread();
#ifdef __ANDROID__
__android_log_write(ANDROID_LOG_INFO, "wesnoth", "Wesnoth started");
JNIEnv* env = reinterpret_cast<JNIEnv*>(SDL_AndroidGetJNIEnv());
JavaVM* jvm;
env->GetJavaVM(&jvm);
jobject activity = reinterpret_cast<jobject>(SDL_AndroidGetActivity());
AssetPackManager_init(jvm, activity);
const char* asset_pack_name = "wesnoth_data";
auto result = AssetPackManager_requestInfo(&asset_pack_name, 1);
assert(result == ASSET_PACK_NO_ERROR);
AssetPackDownloadState* state;
AssetPackDownloadStatus status;
do {
auto error_code = AssetPackManager_getDownloadState(asset_pack_name, &state);
assert(error_code == ASSET_PACK_NO_ERROR);
status = AssetPackDownloadState_getStatus(state);
__android_log_print(ANDROID_LOG_INFO, "wesnoth", "Download status: %d\n", status);
AssetPackDownloadState_destroy(state);
SDL_Delay(16);
} while(status == ASSET_PACK_INFO_PENDING);
result = AssetPackManager_requestDownload(&asset_pack_name, 1);
assert(result == ASSET_PACK_NO_ERROR);
do {
auto error_code = AssetPackManager_getDownloadState(asset_pack_name, &state);
assert(error_code == ASSET_PACK_NO_ERROR);
status = AssetPackDownloadState_getStatus(state);
__android_log_print(ANDROID_LOG_INFO, "wesnoth", "Download status: %d\n", status);
AssetPackDownloadState_destroy(state);
SDL_Delay(16);
} while(status < 4);
assert(status == ASSET_PACK_DOWNLOAD_COMPLETED);
AssetPackLocation* location;
result = AssetPackManager_getAssetPackLocation(asset_pack_name, &location);
assert(result == ASSET_PACK_NO_ERROR);
std::string android_asset_path;
android_asset_path = AssetPackLocation_getAssetsPath(location);
__android_log_print(ANDROID_LOG_INFO, "wesnoth", "Download path: %s\n", android_asset_path.c_str());
AssetPackLocation_destroy(location);
#endif
auto args = read_argv(argc, argv);
assert(!args.empty());
@ -1204,9 +1151,6 @@ int main(int argc, char** argv)
PLAIN_LOG << "Started on " << ctime(&t);
}
#ifdef __ANDROID__
game_config::path = std::move(android_asset_path);
#else
if(std::string exe_dir = filesystem::get_exe_dir(); !exe_dir.empty()) {
if(std::string auto_dir = autodetect_game_data_dir(std::move(exe_dir)); !auto_dir.empty()) {
if(!nobanner) {
@ -1227,7 +1171,6 @@ int main(int argc, char** argv)
}
}
}
#endif
const int res = do_gameloop(args);
safe_exit(res);