Skip to content

Commit

Permalink
Fix android compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarBLG committed Aug 2, 2023
1 parent 5eca2d6 commit 5e215a5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion DMI/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include "tcp/server.h"
#include "control/control.h"
#include "platform_runtime.h"
#ifdef _WIN32
#ifdef __ANDROID__
#elif defined(_WIN32)
#include <windows.h>
#include <imagehlp.h>
#include <errhandlingapi.h>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/assets/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ fullScreen=true
borderless=true
width=640
height=480
display=0
1 change: 1 addition & 0 deletions app/src/main/assets/tcp_bus_bridge.conf
1 change: 1 addition & 0 deletions app/src/main/assets/tcp_bus_client.conf
1 change: 1 addition & 0 deletions app/src/main/assets/tcp_bus_server.conf
9 changes: 6 additions & 3 deletions platform/console_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#ifdef __unix__
#include <signal.h>
#endif

#ifdef __ANDROID__
#include <android/log.h>
#endif
static std::atomic<bool>* quit_request_ptr;

static void sigterm_handler(int sig) {
Expand All @@ -23,7 +25,8 @@ static void sigterm_handler(int sig) {
extern "C" void Java_com_etcs_dmi_EVC_evcMain(JNIEnv *env, jobject thiz, jstring stringObject)
{
jboolean b;
platform = std::make_unique<ConsolePlatform>(std::string(env->GetStringUTFChars(stringObject, &b)), {});
std::vector<std::string> args;
platform = std::make_unique<ConsolePlatform>(std::string(env->GetStringUTFChars(stringObject, &b)) + "/", args);
on_platform_ready();
static_cast<ConsolePlatform*>(platform.get())->event_loop();
}
Expand Down Expand Up @@ -99,7 +102,7 @@ bool ConsolePlatform::write_file(const std::string_view path, const std::string_

void ConsolePlatform::debug_print(const std::string_view msg) {
#ifdef __ANDROID__
__android_log_print(ANDROID_LOG_DEBUG, "ConsolePlatform", (msg + "\n").c_str());
__android_log_print(ANDROID_LOG_DEBUG, "ConsolePlatform" ,"%s\n", std::string(msg).c_str());
#else
std::cout << msg << std::endl;
#endif
Expand Down
1 change: 1 addition & 0 deletions platform/tcp_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <netdb.h>
#include <errno.h>
#else
#include <winsock2.h>
#include <ws2tcpip.h>
Expand Down
1 change: 1 addition & 0 deletions platform/tcp_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <netdb.h>
#include <errno.h>
#else
#include <winsock2.h>
#include <ws2tcpip.h>
Expand Down

0 comments on commit 5e215a5

Please sign in to comment.