diff --git a/app/build.gradle b/app/build.gradle index 08b3565c..82bc1295 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,6 +12,7 @@ android { ndk { abiFilters "arm64-v8a" } + signingConfig signingConfigs.debug } buildTypes { release { diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index f422a20e..a8d0acbe 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -10,19 +10,22 @@ std::thread *EmuThread; bool Halt = false; void ThreadMain(const std::string romPath, const std::string prefPath, const std::string logPath) { - auto log = std::make_shared(logPath); + auto logger = std::make_shared(logPath); auto settings = std::make_shared(prefPath); - settings->List(log); + //settings->List(log); // (Uncomment when you want to print out all settings strings) + auto start = std::chrono::steady_clock::now(); try { - skyline::kernel::OS os(log, settings); - log->Write(skyline::Logger::Info, "Launching ROM {}", romPath); + skyline::kernel::OS os(logger, settings); + logger->Write(skyline::Logger::Info, "Launching ROM {}", romPath); os.Execute(romPath); - log->Write(skyline::Logger::Info, "Emulation has ended"); + logger->Write(skyline::Logger::Info, "Emulation has ended"); } catch (std::exception &e) { - log->Write(skyline::Logger::Error, e.what()); + logger->Write(skyline::Logger::Error, e.what()); } catch (...) { - log->Write(skyline::Logger::Error, "An unknown exception has occurred"); + logger->Write(skyline::Logger::Error, "An unknown exception has occurred"); } + auto end = std::chrono::steady_clock::now(); + logger->Write(skyline::Logger::Info, "Done in: {} ms", (std::chrono::duration_cast(end - start).count())); } extern "C" JNIEXPORT void JNICALL Java_emu_skyline_MainActivity_loadFile(JNIEnv *env, jobject instance, jstring romPathJni, jstring prefPathJni, jstring logPathJni) { diff --git a/app/src/main/cpp/skyline/common.cpp b/app/src/main/cpp/skyline/common.cpp index e1632065..e406774f 100644 --- a/app/src/main/cpp/skyline/common.cpp +++ b/app/src/main/cpp/skyline/common.cpp @@ -58,7 +58,7 @@ namespace skyline { void Logger::Write(const LogLevel level, const std::string &str) { #ifdef NDEBUG - if (level == DEBUG) return; + if (level == Debug) return; #endif syslog(levelSyslog[level], "%s", str.c_str()); logFile << "1|" << levelStr[level] << "|" << str << "\n"; diff --git a/app/src/main/cpp/skyline/common.h b/app/src/main/cpp/skyline/common.h index bb8ad277..904f879e 100644 --- a/app/src/main/cpp/skyline/common.h +++ b/app/src/main/cpp/skyline/common.h @@ -194,7 +194,7 @@ namespace skyline { template void Write(Logger::LogLevel level, const S &formatStr, Args &&... args) { #ifdef NDEBUG - if (level == DEBUG) return; + if (level == Debug) return; #endif Write(level, fmt::format(formatStr, args...)); } diff --git a/app/src/main/cpp/skyline/kernel/types/KProcess.cpp b/app/src/main/cpp/skyline/kernel/types/KProcess.cpp index 6fc0bc7a..0ca70855 100644 --- a/app/src/main/cpp/skyline/kernel/types/KProcess.cpp +++ b/app/src/main/cpp/skyline/kernel/types/KProcess.cpp @@ -59,7 +59,7 @@ namespace skyline::kernel::type { */ int ExecuteChild(void *) { ptrace(PTRACE_TRACEME); - asm volatile("Brk #0xFF"); // BRK #constant::brkRdy (So we know when the thread/process is ready) + asm volatile("BRK #0xFF"); // BRK #constant::brkRdy (So we know when the thread/process is ready) return 0; } diff --git a/app/src/main/cpp/skyline/kernel/types/KSharedMemory.cpp b/app/src/main/cpp/skyline/kernel/types/KSharedMemory.cpp index 529382e7..ee560114 100644 --- a/app/src/main/cpp/skyline/kernel/types/KSharedMemory.cpp +++ b/app/src/main/cpp/skyline/kernel/types/KSharedMemory.cpp @@ -1,11 +1,12 @@ #include "KSharedMemory.h" #include "../../nce.h" #include "../../os.h" -//#include -#include #include #include +constexpr const char* ASHMEM_NAME_DEF = "dev/ashmem"; +constexpr int ASHMEM_SET_SIZE = 0x40087703; + namespace skyline::kernel::type { u64 MapFunc(u64 address, size_t size, u64 perms, u64 fd) { return reinterpret_cast(mmap(reinterpret_cast(address), size, static_cast(perms), MAP_SHARED | ((address) ? MAP_FIXED : 0), static_cast(fd), 0)); // NOLINT(hicpp-signed-bitwise) diff --git a/app/src/main/cpp/skyline/nce.cpp b/app/src/main/cpp/skyline/nce.cpp index bd2cef91..aa394a42 100644 --- a/app/src/main/cpp/skyline/nce.cpp +++ b/app/src/main/cpp/skyline/nce.cpp @@ -63,7 +63,7 @@ namespace skyline { WriteRegisters(currRegs); ResumeProcess(); } else { - state->logger->Write(Logger::Debug, "Thread threw unknown signal, PID: {}, Stop Signal: {}", currPid, strsignal(WSTOPSIG(status))); // NOLINT(hicpp-signed-bitwise) + state->logger->Write(Logger::Warn, "Thread threw unknown signal, PID: {}, Stop Signal: {}", currPid, strsignal(WSTOPSIG(status))); // NOLINT(hicpp-signed-bitwise) state->os->KillThread(currPid); } }