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 {
abiFilters "arm64-v8a"
}
signingConfig signingConfigs.debug
}
buildTypes {
release {

View File

@ -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<skyline::Logger>(logPath);
auto logger = std::make_shared<skyline::Logger>(logPath);
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 {
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<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) {

View File

@ -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";

View File

@ -194,7 +194,7 @@ namespace skyline {
template<typename S, typename... Args>
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...));
}

View File

@ -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;
}

View File

@ -1,11 +1,12 @@
#include "KSharedMemory.h"
#include "../../nce.h"
#include "../../os.h"
//#include <android/sharedmem.h>
#include <cutils/ashmem.h>
#include <fcntl.h>
#include <unistd.h>
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<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);
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);
}
}