Some minor fixes

This fixes some files so release now works and removes the dependancy of "<cutils/ashmem.h>" as it isn't present on all NDK includes.
This commit is contained in:
◱ PixelyIon 2019-09-25 15:02:17 +05:30
parent a01941ac5b
commit da74d8d78c
7 changed files with 18 additions and 13 deletions

View File

@ -12,6 +12,7 @@ android {
ndk { ndk {
abiFilters "arm64-v8a" abiFilters "arm64-v8a"
} }
signingConfig signingConfigs.debug
} }
buildTypes { buildTypes {
release { release {

View File

@ -10,19 +10,22 @@ std::thread *EmuThread;
bool Halt = false; bool Halt = false;
void ThreadMain(const std::string romPath, const std::string prefPath, const std::string logPath) { void ThreadMain(const std::string romPath, const std::string prefPath, const std::string logPath) {
auto log = std::make_shared<skyline::Logger>(logPath); auto logger = std::make_shared<skyline::Logger>(logPath);
auto settings = std::make_shared<skyline::Settings>(prefPath); auto settings = std::make_shared<skyline::Settings>(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 { try {
skyline::kernel::OS os(log, settings); skyline::kernel::OS os(logger, settings);
log->Write(skyline::Logger::Info, "Launching ROM {}", romPath); logger->Write(skyline::Logger::Info, "Launching ROM {}", romPath);
os.Execute(romPath); os.Execute(romPath);
log->Write(skyline::Logger::Info, "Emulation has ended"); logger->Write(skyline::Logger::Info, "Emulation has ended");
} catch (std::exception &e) { } catch (std::exception &e) {
log->Write(skyline::Logger::Error, e.what()); logger->Write(skyline::Logger::Error, e.what());
} catch (...) { } 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<std::chrono::milliseconds>(end - start).count()));
} }
extern "C" JNIEXPORT void JNICALL Java_emu_skyline_MainActivity_loadFile(JNIEnv *env, jobject instance, jstring romPathJni, jstring prefPathJni, jstring logPathJni) { extern "C" JNIEXPORT void JNICALL Java_emu_skyline_MainActivity_loadFile(JNIEnv *env, jobject instance, jstring romPathJni, jstring prefPathJni, jstring logPathJni) {

View File

@ -58,7 +58,7 @@ namespace skyline {
void Logger::Write(const LogLevel level, const std::string &str) { void Logger::Write(const LogLevel level, const std::string &str) {
#ifdef NDEBUG #ifdef NDEBUG
if (level == DEBUG) return; if (level == Debug) return;
#endif #endif
syslog(levelSyslog[level], "%s", str.c_str()); syslog(levelSyslog[level], "%s", str.c_str());
logFile << "1|" << levelStr[level] << "|" << str << "\n"; logFile << "1|" << levelStr[level] << "|" << str << "\n";

View File

@ -194,7 +194,7 @@ namespace skyline {
template<typename S, typename... Args> template<typename S, typename... Args>
void Write(Logger::LogLevel level, const S &formatStr, Args &&... args) { void Write(Logger::LogLevel level, const S &formatStr, Args &&... args) {
#ifdef NDEBUG #ifdef NDEBUG
if (level == DEBUG) return; if (level == Debug) return;
#endif #endif
Write(level, fmt::format(formatStr, args...)); Write(level, fmt::format(formatStr, args...));
} }

View File

@ -59,7 +59,7 @@ namespace skyline::kernel::type {
*/ */
int ExecuteChild(void *) { int ExecuteChild(void *) {
ptrace(PTRACE_TRACEME); 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; return 0;
} }

View File

@ -1,11 +1,12 @@
#include "KSharedMemory.h" #include "KSharedMemory.h"
#include "../../nce.h" #include "../../nce.h"
#include "../../os.h" #include "../../os.h"
//#include <android/sharedmem.h>
#include <cutils/ashmem.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
constexpr const char* ASHMEM_NAME_DEF = "dev/ashmem";
constexpr int ASHMEM_SET_SIZE = 0x40087703;
namespace skyline::kernel::type { namespace skyline::kernel::type {
u64 MapFunc(u64 address, size_t size, u64 perms, u64 fd) { u64 MapFunc(u64 address, size_t size, u64 perms, u64 fd) {
return reinterpret_cast<u64>(mmap(reinterpret_cast<void *>(address), size, static_cast<int>(perms), MAP_SHARED | ((address) ? MAP_FIXED : 0), static_cast<int>(fd), 0)); // NOLINT(hicpp-signed-bitwise) return reinterpret_cast<u64>(mmap(reinterpret_cast<void *>(address), size, static_cast<int>(perms), MAP_SHARED | ((address) ? MAP_FIXED : 0), static_cast<int>(fd), 0)); // NOLINT(hicpp-signed-bitwise)

View File

@ -63,7 +63,7 @@ namespace skyline {
WriteRegisters(currRegs); WriteRegisters(currRegs);
ResumeProcess(); ResumeProcess();
} else { } 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); state->os->KillThread(currPid);
} }
} }