project_files/Android-build/SDL-android-project/jni/src/hedgewars_main.c
author Wuzzy <Wuzzy2@mail.ru>
Mon, 08 Jul 2019 21:44:26 +0200
changeset 15220 ceb289e8a582
parent 10017 de822cd3df3a
permissions -rw-r--r--
King Mode: Fix king placement phase not working correctly with multiple teams in a clan New king placement phase rules: * Before the game begins, each team can walk with their king and teleport for free, everything else is disabled * This special round does not count towards the round counter, like in gfPlaceHog * TotalRounds is set to -1 during this round, like in gfPlaceHog Under the old rules, this was much more hacky. The delay of all delay-less weapons was just set to 1 The problem with the old rules was that if any clan had more than 1 team, eventually the weapon delay will time out before all kings have been placed.

#include<stdint.h>

#include "android/log.h"
#include "SDL.h"
#include "dlfcn.h"
#include "GLES/gl.h"

#define TAG "HWEngine Loader"

typedef  (*HWEngine_Game)(int32_t argc, char** argv);

main(int argc, char *argv[]){
    void *handle;
    char *error;
    HWEngine_Game Game;


        __android_log_print(ANDROID_LOG_INFO, TAG, "HWEngine being loaded");
    handle = dlopen("libhwengine.so", RTLD_NOW|RTLD_GLOBAL);
    if(!handle){
        __android_log_print(ANDROID_LOG_INFO, TAG, dlerror());
        __android_log_print(ANDROID_LOG_INFO, TAG, "error dlopen");
        exit(EXIT_FAILURE);
    }
    dlerror();

        __android_log_print(ANDROID_LOG_INFO, TAG, "HWEngine successfully loaded..");


    Game = (HWEngine_Game) dlsym(handle,"Game");
    if((error = dlerror()) != NULL){
        __android_log_print(ANDROID_LOG_INFO, TAG, error);
        __android_log_print(ANDROID_LOG_INFO, TAG, "error dlsym");
        exit(EXIT_FAILURE);
    }
    __android_log_print(ANDROID_LOG_INFO, TAG, "dlsym succeeded");
    Game(argc, argv);
    __android_log_print(ANDROID_LOG_INFO, TAG, "Game() ended");

    dlclose(handle);
}