From 9ad8d49d0e5e7860d1a644b4133fc0d297b4ffdf Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 28 Jun 2021 11:27:35 +0930 Subject: [PATCH] Some code clean up to help build android --- Source/Android/Bridge/jniBridge.cpp | 104 +++--------------- Source/Common/CriticalSection.cpp | 2 + Source/Common/DynamicLibrary.cpp | 2 +- Source/Common/File.cpp | 3 + Source/Common/HighResTimeStamp.cpp | 3 + Source/Common/IniFile.h | 1 + Source/Common/MemoryManagement.h | 1 + Source/Common/Platform.cpp | 2 + Source/Common/StdString.cpp | 1 + Source/Common/SyncEvent.cpp | 2 + Source/Common/Trace.cpp | 1 + Source/Project64-core/ExceptionHandler.h | 4 +- .../N64System/Enhancement/EnhancementList.h | 1 + .../N64System/Enhancement/Enhancements.cpp | 8 +- Source/Project64-core/N64System/Mips/Sram.cpp | 8 +- Source/Project64-core/N64System/N64System.cpp | 10 +- .../Recompiler/Aarch64/Aarch64RegInfo.cpp | 11 ++ .../Recompiler/Aarch64/Aarch64RegInfo.h | 14 +++ .../Recompiler/Arm/ArmRecompilerOps.cpp | 3 +- .../Recompiler/Arm/ArmRecompilerOps.h | 2 +- .../N64System/Recompiler/Arm/ArmRegInfo.cpp | 2 +- .../N64System/Recompiler/Arm/ArmRegInfo.h | 2 +- .../N64System/Recompiler/CodeBlock.cpp | 2 +- .../N64System/Recompiler/Recompiler.cpp | 12 ++ .../N64System/Recompiler/RegInfo.h | 5 + Source/Project64-core/Plugins/Plugin.h | 2 +- 26 files changed, 100 insertions(+), 108 deletions(-) create mode 100644 Source/Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.cpp create mode 100644 Source/Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.h diff --git a/Source/Android/Bridge/jniBridge.cpp b/Source/Android/Bridge/jniBridge.cpp index d9a6112ef..6f8aa5702 100644 --- a/Source/Android/Bridge/jniBridge.cpp +++ b/Source/Android/Bridge/jniBridge.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include "jniBridge.h" #include "jniBridgeSettings.h" #include "JavaBridge.h" @@ -29,9 +30,6 @@ #define CALL #endif -CJniBridegSettings * JniBridegSettings = NULL; -CJavaRomList * g_JavaRomList = NULL; - #ifdef ANDROID #include @@ -54,6 +52,9 @@ class AndroidLogger : public CTraceModule { } }; + +CJniBridegSettings * JniBridegSettings = NULL; +CJavaRomList * g_JavaRomList = NULL; AndroidLogger * g_Logger = NULL; static pthread_key_t g_ThreadKey; static JavaVM* g_JavaVM = NULL; @@ -65,75 +66,6 @@ jobject g_GLThread = NULL; static void Android_JNI_ThreadDestroyed(void*); static void Android_JNI_SetupThread(void); -static void watch_uninstall(const char *baseDir) -{ - CPath lockfile(baseDir, "uninstall.lock"); - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "LockFile = %s", (const char *)lockfile); - - int fd = open(lockfile, O_CREAT); - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "fd = %d", (unsigned int)fd); - if (flock(fd, LOCK_EX | LOCK_NB) == 0) - { - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "I have the lock"); - } - else - { - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "I don't have the lock"); - exit(1); - } - - CPath TestDir("/data/data/emu.project64", ""); - for (;;) - { - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "start"); - int fileDescriptor = inotify_init(); - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "fileDescriptor = %d", fileDescriptor); - if (fileDescriptor < 0) - { - __android_log_print(ANDROID_LOG_ERROR, "watch_uninstall", "inotify_init failed !!!"); - exit(1); - } - - int watchDescriptor; - watchDescriptor = inotify_add_watch(fileDescriptor, TestDir, IN_DELETE); - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "watchDescriptor = %d", watchDescriptor); - if (watchDescriptor < 0) - { - __android_log_print(ANDROID_LOG_ERROR, "watch_uninstall", "inotify_add_watch failed !!!"); - exit(1); - } - - enum - { - EVENT_SIZE = sizeof(struct inotify_event), - EVENT_BUF_LEN = (1024 * (EVENT_SIZE + 16)) - }; - struct inotify_event event; - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "read event"); - char buffer[EVENT_BUF_LEN]; - size_t readBytes = read(fileDescriptor, &buffer, EVENT_BUF_LEN); - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "readBytes = %d", readBytes); - inotify_rm_watch(fileDescriptor, IN_DELETE); - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "closing the INOTIFY instance"); - close(fileDescriptor); - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "Waiting to test if directory removed"); - pjutil::Sleep(2000); - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "Sleep Done"); - - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "TestDir.DirectoryExists() = %s", TestDir.DirectoryExists() ? "yes" : "no"); - if (!TestDir.DirectoryExists()) - { - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "exit loop"); - break; - } - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "continue loop"); - } - - __android_log_print(ANDROID_LOG_INFO, "watch_uninstall", "Launching web browser"); - execlp("am", "am", "start", "--user", "0", "-a", "android.intent.action.VIEW", "-d", "http://www.pj64-emu.com/android-uninstalled.html", (char *)NULL); - exit(1); -} - EXPORT jint CALL JNI_OnLoad(JavaVM* vm, void* reserved) { __android_log_print(ANDROID_LOG_INFO, "jniBridge", "JNI_OnLoad called"); @@ -288,22 +220,22 @@ void GameCpuRunning(void * /*NotUsed*/) EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_appInit(JNIEnv* env, jclass cls, jstring BaseDir) { + __android_log_print(ANDROID_LOG_INFO, "Project64", " ____ _ __ _____ __ __"); + __android_log_print(ANDROID_LOG_INFO, "Project64", " / __ \\_________ (_)__ _____/ /_/ ___// // /"); + __android_log_print(ANDROID_LOG_INFO, "Project64", " / /_/ / ___/ __ \\ / / _ \\/ ___/ __/ __ \\/ // /_"); + __android_log_print(ANDROID_LOG_INFO, "Project64", " / ____/ / / /_/ / / / __/ /__/ /_/ /_/ /__ __/"); + __android_log_print(ANDROID_LOG_INFO, "Project64", "/_/ /_/ \\____/_/ /\\___/\\___/\\__/\\____/ /_/"); + __android_log_print(ANDROID_LOG_INFO, "Project64", " /___/"); + __android_log_print(ANDROID_LOG_INFO, "Project64", "https://www.pj64-emu.com/"); + __android_log_print(ANDROID_LOG_INFO, "Project64", "%s", stdstr_f("%s Version %s", VER_FILE_DESCRIPTION_STR, VER_FILE_VERSION_STR).c_str()); + __android_log_print(ANDROID_LOG_INFO, "Project64", ""); + if (g_Logger == NULL) { g_Logger = new AndroidLogger(); } TraceAddModule(g_Logger); - Notify().DisplayMessage(10, " ____ _ __ _____ __ __"); - Notify().DisplayMessage(10, " / __ \\_________ (_)__ _____/ /_/ ___// // /"); - Notify().DisplayMessage(10, " / /_/ / ___/ __ \\ / / _ \\/ ___/ __/ __ \\/ // /_"); - Notify().DisplayMessage(10, " / ____/ / / /_/ / / / __/ /__/ /_/ /_/ /__ __/"); - Notify().DisplayMessage(10, "/_/ /_/ \\____/_/ /\\___/\\___/\\__/\\____/ /_/"); - Notify().DisplayMessage(10, " /___/"); - Notify().DisplayMessage(10, "https://www.pj64-emu.com/"); - Notify().DisplayMessage(10, stdstr_f("%s Version %s", VER_FILE_DESCRIPTION_STR, VER_FILE_VERSION_STR).c_str()); - Notify().DisplayMessage(10, ""); - if (g_JavaVM == NULL) { Notify().DisplayError("No Java VM"); @@ -311,15 +243,7 @@ EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_appInit(JNIEnv* env, j } const char *baseDir = env->GetStringUTFChars(BaseDir, 0); - pid_t pid = fork(); - __android_log_print(ANDROID_LOG_INFO, "jniBridge", "pid = %d", pid); - if (pid == 0) - { - watch_uninstall(baseDir); - exit(1); - } bool res = AppInit(&Notify(), baseDir, 0, NULL); - env->ReleaseStringUTFChars(BaseDir, baseDir); if (res) { diff --git a/Source/Common/CriticalSection.cpp b/Source/Common/CriticalSection.cpp index 84b69e778..fa366d400 100644 --- a/Source/Common/CriticalSection.cpp +++ b/Source/Common/CriticalSection.cpp @@ -1,6 +1,8 @@ #include "CriticalSection.h" #ifdef _WIN32 #include +#else +#include #endif CriticalSection::CriticalSection() diff --git a/Source/Common/DynamicLibrary.cpp b/Source/Common/DynamicLibrary.cpp index 9d8e25b60..ae685545f 100644 --- a/Source/Common/DynamicLibrary.cpp +++ b/Source/Common/DynamicLibrary.cpp @@ -18,7 +18,7 @@ DynLibHandle DynamicLibraryOpen(const char *pccLibraryPath, bool ShowErrors) DynLibHandle Lib = (DynLibHandle)LoadLibraryA(pccLibraryPath); SetErrorMode(LastErrorMode); #else - pjutil::DynLibHandle Lib = (pjutil::DynLibHandle)dlopen(pccLibraryPath, RTLD_NOW); + DynLibHandle Lib = (DynLibHandle)dlopen(pccLibraryPath, RTLD_NOW); #endif return Lib; } diff --git a/Source/Common/File.cpp b/Source/Common/File.cpp index 47990f4f3..802562955 100644 --- a/Source/Common/File.cpp +++ b/Source/Common/File.cpp @@ -1,4 +1,7 @@ #include "File.h" +#include "path.h" +#include +#include #ifdef _WIN32 #include #define USE_WINDOWS_API diff --git a/Source/Common/HighResTimeStamp.cpp b/Source/Common/HighResTimeStamp.cpp index de839de50..f72b10dc0 100644 --- a/Source/Common/HighResTimeStamp.cpp +++ b/Source/Common/HighResTimeStamp.cpp @@ -1,4 +1,7 @@ #include "HighResTimeStamp.h" +#include +#include +#include #ifdef _WIN32 #include #else diff --git a/Source/Common/IniFile.h b/Source/Common/IniFile.h index 81005950f..2e57553ce 100644 --- a/Source/Common/IniFile.h +++ b/Source/Common/IniFile.h @@ -4,6 +4,7 @@ #include #endif +#include "Platform.h" #include "File.h" #include "CriticalSection.h" #include diff --git a/Source/Common/MemoryManagement.h b/Source/Common/MemoryManagement.h index d8a1d941a..4ab7d00f9 100644 --- a/Source/Common/MemoryManagement.h +++ b/Source/Common/MemoryManagement.h @@ -1,4 +1,5 @@ #pragma once +#include enum MEM_PROTECTION { diff --git a/Source/Common/Platform.cpp b/Source/Common/Platform.cpp index a2ef16c86..25aa1d0b8 100644 --- a/Source/Common/Platform.cpp +++ b/Source/Common/Platform.cpp @@ -1,5 +1,7 @@ #include "Platform.h" #include +#include +#include #ifndef _WIN32 int _vscprintf(const char * format, va_list pargs) diff --git a/Source/Common/StdString.cpp b/Source/Common/StdString.cpp index f885d207d..c187ec072 100644 --- a/Source/Common/StdString.cpp +++ b/Source/Common/StdString.cpp @@ -1,4 +1,5 @@ #include "StdString.h" +#include "Platform.h" #include #include #ifdef _WIN32 diff --git a/Source/Common/SyncEvent.cpp b/Source/Common/SyncEvent.cpp index 78a9bed5e..ebc5a05b7 100644 --- a/Source/Common/SyncEvent.cpp +++ b/Source/Common/SyncEvent.cpp @@ -1,6 +1,8 @@ #include "SyncEvent.h" #ifdef _WIN32 #include +#else +#include #endif SyncEvent::SyncEvent(bool bManualReset) diff --git a/Source/Common/Trace.cpp b/Source/Common/Trace.cpp index 44bd23060..2dec8e98f 100644 --- a/Source/Common/Trace.cpp +++ b/Source/Common/Trace.cpp @@ -2,6 +2,7 @@ #include "StdString.h" #include "CriticalSection.h" #include "Thread.h" +#include "Platform.h" #include #include #ifdef _WIN32 diff --git a/Source/Project64-core/ExceptionHandler.h b/Source/Project64-core/ExceptionHandler.h index 3ed3b0f3c..e3a66a6f2 100644 --- a/Source/Project64-core/ExceptionHandler.h +++ b/Source/Project64-core/ExceptionHandler.h @@ -6,6 +6,6 @@ #define __except_try() __try #define __except_catch() __except (g_MMU->MemoryFilter(_exception_code(), _exception_info())) #else -#define __except_try() __try -#define __except_catch() __catch (...) +#define __except_try() try +#define __except_catch() catch (...) #endif diff --git a/Source/Project64-core/N64System/Enhancement/EnhancementList.h b/Source/Project64-core/N64System/Enhancement/EnhancementList.h index 846792c2f..7a9da44c4 100644 --- a/Source/Project64-core/N64System/Enhancement/EnhancementList.h +++ b/Source/Project64-core/N64System/Enhancement/EnhancementList.h @@ -2,6 +2,7 @@ #include #include #include +#include struct EnhancementItemList_compare { diff --git a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp index c1b971ccb..fbc3b39a8 100644 --- a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp +++ b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp @@ -29,7 +29,7 @@ CEnhancements::GAMESHARK_CODE::GAMESHARK_CODE(uint32_t Command, uint16_t Value, } CEnhancements::CEnhancements() : - m_ScanFileThread(stScanFileThread), + m_ScanFileThread((CThread::CTHREAD_START_ROUTINE)stScanFileThread), m_Scan(true), m_Scanned(false), m_UpdateCheats(false), @@ -112,7 +112,7 @@ void CEnhancements::UpdateCheats(const CEnhancementList & Cheats) { m_CheatFiles.erase(CheatFileItr); } - m_CheatFile = std::make_unique(OutFile, CEnhancement::CheatIdent); + m_CheatFile.reset(new CEnhancmentFile(OutFile, CEnhancement::CheatIdent)); m_CheatFiles.insert(SectionFiles::value_type(SectionIdent, OutFile)); } @@ -158,7 +158,7 @@ void CEnhancements::UpdateEnhancements(const CEnhancementList & Enhancements) { m_EnhancementFiles.erase(EnhancementFileItr); } - m_EnhancementFile = std::make_unique(OutFile, CEnhancement::EnhancementIdent); + m_EnhancementFile.reset(new CEnhancmentFile(OutFile, CEnhancement::EnhancementIdent)); m_EnhancementFiles.insert(SectionFiles::value_type(SectionIdent, OutFile)); } @@ -246,7 +246,7 @@ void CEnhancements::LoadEnhancements(const char * Ident, SectionFiles & Files, s { if (File.get() == nullptr || strcmp(File->FileName(), CheatFile) != 0) { - File = std::make_unique(CheatFile, Ident); + File.reset(new CEnhancmentFile(CheatFile, Ident)); } EnhancementList.clear(); File->GetEnhancementList(SectionIdent.c_str(), EnhancementList); diff --git a/Source/Project64-core/N64System/Mips/Sram.cpp b/Source/Project64-core/N64System/Mips/Sram.cpp index 5e0177566..11a9e2234 100644 --- a/Source/Project64-core/N64System/Mips/Sram.cpp +++ b/Source/Project64-core/N64System/Mips/Sram.cpp @@ -49,7 +49,7 @@ void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, uint32_t len) // Fix Dezaemon 3D saves StartOffset = ((StartOffset >> 3) & 0xFFFF8000) | (StartOffset & 0x7FFF); - if (((StartOffset & 3) == 0) && ((((uint32_t)dest) & 3) == 0)) + if (((StartOffset & 3) == 0) && ((((size_t)dest) & 3) == 0)) { m_File.Seek(StartOffset, CFile::begin); m_File.Read(dest, len); @@ -59,7 +59,7 @@ void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, uint32_t len) for (uint32_t i = 0; i < len; i++) { m_File.Seek((StartOffset + i) ^ 3, CFile::begin); - m_File.Read((uint8_t*)(((uint32_t)dest + i) ^ 3), 1); + m_File.Read((uint8_t*)(((size_t)dest + i) ^ 3), 1); } } } @@ -82,7 +82,7 @@ void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, uint32_t len) // Fix Dezaemon 3D saves StartOffset = ((StartOffset >> 3) & 0xFFFF8000) | (StartOffset & 0x7FFF); - if (((StartOffset & 3) == 0) && ((((uint32_t)Source) & 3) == 0) && nullptr != nullptr) + if (((StartOffset & 3) == 0) && ((((size_t)Source) & 3) == 0) && nullptr != nullptr) { m_File.Seek(StartOffset, CFile::begin); m_File.Write(Source, len); @@ -92,7 +92,7 @@ void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, uint32_t len) for (uint32_t i = 0; i < len; i++) { m_File.Seek((StartOffset + i) ^ 3, CFile::begin); - m_File.Write((uint8_t*)(((uint32_t)Source + i) ^ 3), 1); + m_File.Write((uint8_t*)(((size_t)Source + i) ^ 3), 1); } } } \ No newline at end of file diff --git a/Source/Project64-core/N64System/N64System.cpp b/Source/Project64-core/N64System/N64System.cpp index ff8b8d36c..07f34e1c3 100644 --- a/Source/Project64-core/N64System/N64System.cpp +++ b/Source/Project64-core/N64System/N64System.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "N64SYstem.h" +#include "N64System.h" #include #include #include @@ -1375,10 +1375,14 @@ void CN64System::SyncCPU(CN64System * const SecondCPU) if (bFastSP() && m_Recomp) { +#if defined(__aarch64__) || defined(__amd64__) + g_Notify->BreakPoint(__FILE__,__LINE__); +#else if (m_Recomp->MemoryStackPos() != (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF))) { ErrorFound = true; } +#endif } if (m_SystemTimer != SecondCPU->m_SystemTimer) { ErrorFound = true; } @@ -1541,10 +1545,14 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU) } if (bFastSP() && m_Recomp) { +#if defined(__aarch64__) || defined(__amd64__) + g_Notify->BreakPoint(__FILE__,__LINE__); +#else if (m_Recomp->MemoryStackPos() != (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF))) { Error.LogF("MemoryStack = %X should be: %X\r\n", m_Recomp->MemoryStackPos(), (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF))); } +#endif } uint32_t * Rdram = (uint32_t *)m_MMU_VM.Rdram(), *Rdram2 = (uint32_t *)SecondCPU->m_MMU_VM.Rdram(); diff --git a/Source/Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.cpp b/Source/Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.cpp new file mode 100644 index 000000000..caf81a23f --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.cpp @@ -0,0 +1,11 @@ +#if defined(__aarch64__) +#include + +CAarch64RegInfo::CAarch64RegInfo() +{ +} + +CAarch64RegInfo::~CAarch64RegInfo() +{ +} +#endif diff --git a/Source/Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.h b/Source/Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.h new file mode 100644 index 000000000..0e9dbcaca --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.h @@ -0,0 +1,14 @@ +#pragma once +#if defined(__aarch64__) +#include + +class CAarch64RegInfo : + public CRegBase +{ +public: + CAarch64RegInfo(); + ~CAarch64RegInfo(); + +private: +}; +#endif diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp index a2d1ac346..d839fac64 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp @@ -11,7 +11,8 @@ #include #include #include -#include +#include +#include #include uint32_t CArmRecompilerOps::m_TempValue = 0; diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h index 2b3aa02e8..a1e6dc522 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h @@ -1,6 +1,6 @@ #pragma once #if defined(__arm__) || defined(_M_ARM) -#include +#include #include #include diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp index ca12615ee..6edc42aa4 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp @@ -2,7 +2,7 @@ #if defined(__arm__) || defined(_M_ARM) #include -#include +#include #include #include diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h index 3f2a4b94f..97ffba7d4 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h @@ -2,7 +2,7 @@ #if defined(__arm__) || defined(_M_ARM) #include #include -#include +#include class CArmRegInfo : public CRegBase, diff --git a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp index 7c0c1d8b6..badc7dd55 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp @@ -771,7 +771,7 @@ bool CCodeBlock::Compile() MD5(g_MMU->Rdram() + PAddr, (VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash); #if defined(ANDROID) && (defined(__arm__) || defined(_M_ARM)) - __clear_cache_android((uint8_t *)((uint32_t)m_CompiledLocation & ~1), m_CompiledLocationEnd); + __clear_cache((uint8_t *)((uint32_t)m_CompiledLocation & ~1), m_CompiledLocationEnd); #endif return true; } diff --git a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp index 7f20c0e4d..11cd0c886 100644 --- a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp +++ b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp @@ -990,6 +990,9 @@ CCompiledFunc * CRecompiler::CompileCode() ret.first->second->SetNext(Func); } +#if defined(__aarch64__) || defined(__amd64__) + g_Notify->BreakPoint(__FILE__,__LINE__); +#else if (g_ModuleLogLevel[TraceRecompiler] >= TraceDebug) { WriteTrace(TraceRecompiler, TraceDebug, "Info->Function() = %X", Func->Function()); @@ -1014,6 +1017,7 @@ CCompiledFunc * CRecompiler::CompileCode() WriteTrace(TraceRecompiler, TraceDebug, "%s", dumpline.c_str()); } } +#endif WriteTrace(TraceRecompiler, TraceVerbose, "Done"); return Func; } @@ -1107,6 +1111,9 @@ void CRecompiler::ClearRecompCode_Virt(uint32_t Address, int length, REMOVE_REAS void CRecompiler::ResetMemoryStackPos() { +#if defined(__aarch64__) || defined(__amd64__) + g_Notify->BreakPoint(__FILE__,__LINE__); +#else if (m_Registers.m_GPR[29].UW[0] == 0) { m_MemoryStack = 0; @@ -1123,10 +1130,14 @@ void CRecompiler::ResetMemoryStackPos() WriteTrace(TraceRecompiler, TraceError, "Failed to translate SP address (%s)", m_Registers.m_GPR[29].UW[0]); g_Notify->BreakPoint(__FILE__, __LINE__); } +#endif } void CRecompiler::DumpFunctionTimes() { +#if defined(__aarch64__) || defined(__amd64__) + g_Notify->BreakPoint(__FILE__,__LINE__); +#else CPath LogFileName(g_Settings->LoadStringVal(Directory_Log).c_str(), "FunctionTimes.csv"); CLog Log; @@ -1136,6 +1147,7 @@ void CRecompiler::DumpFunctionTimes() { Log.LogF("%X,0x%X,%d\r\n", (uint32_t)itr->first, itr->second.Address, (uint32_t)itr->second.TimeTaken); } +#endif } void CRecompiler::ResetFunctionTimes() diff --git a/Source/Project64-core/N64System/Recompiler/RegInfo.h b/Source/Project64-core/N64System/Recompiler/RegInfo.h index 8733d9f83..600627d32 100644 --- a/Source/Project64-core/N64System/Recompiler/RegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/RegInfo.h @@ -17,4 +17,9 @@ typedef CX64RegInfo CRegInfo; typedef CArmRegInfo CRegInfo; +#elif defined(__aarch64__) + +#include +typedef CAarch64RegInfo CRegInfo; + #endif diff --git a/Source/Project64-core/Plugins/Plugin.h b/Source/Project64-core/Plugins/Plugin.h index 213e429c7..db6962282 100644 --- a/Source/Project64-core/Plugins/Plugin.h +++ b/Source/Project64-core/Plugins/Plugin.h @@ -6,7 +6,7 @@ #ifndef PLUGIN_INFO_STRUCT #define PLUGIN_INFO_STRUCT -typedef struct +typedef struct _PLUGIN_INFO { uint16_t Version; // Should be set to 1 uint16_t Type; // Set to PLUGIN_TYPE_GFX