Some code clean up to help build android
This commit is contained in:
parent
4c49088dd8
commit
9ad8d49d0e
|
@ -14,6 +14,7 @@
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/Plugin.h>
|
#include <Project64-core/Plugin.h>
|
||||||
#include <Common/Trace.h>
|
#include <Common/Trace.h>
|
||||||
|
#include <Common/Thread.h>
|
||||||
#include "jniBridge.h"
|
#include "jniBridge.h"
|
||||||
#include "jniBridgeSettings.h"
|
#include "jniBridgeSettings.h"
|
||||||
#include "JavaBridge.h"
|
#include "JavaBridge.h"
|
||||||
|
@ -29,9 +30,6 @@
|
||||||
#define CALL
|
#define CALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CJniBridegSettings * JniBridegSettings = NULL;
|
|
||||||
CJavaRomList * g_JavaRomList = NULL;
|
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
|
||||||
|
@ -54,6 +52,9 @@ class AndroidLogger : public CTraceModule
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CJniBridegSettings * JniBridegSettings = NULL;
|
||||||
|
CJavaRomList * g_JavaRomList = NULL;
|
||||||
AndroidLogger * g_Logger = NULL;
|
AndroidLogger * g_Logger = NULL;
|
||||||
static pthread_key_t g_ThreadKey;
|
static pthread_key_t g_ThreadKey;
|
||||||
static JavaVM* g_JavaVM = NULL;
|
static JavaVM* g_JavaVM = NULL;
|
||||||
|
@ -65,75 +66,6 @@ jobject g_GLThread = NULL;
|
||||||
static void Android_JNI_ThreadDestroyed(void*);
|
static void Android_JNI_ThreadDestroyed(void*);
|
||||||
static void Android_JNI_SetupThread(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)
|
EXPORT jint CALL JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||||
{
|
{
|
||||||
__android_log_print(ANDROID_LOG_INFO, "jniBridge", "JNI_OnLoad called");
|
__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)
|
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)
|
if (g_Logger == NULL)
|
||||||
{
|
{
|
||||||
g_Logger = new AndroidLogger();
|
g_Logger = new AndroidLogger();
|
||||||
}
|
}
|
||||||
TraceAddModule(g_Logger);
|
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)
|
if (g_JavaVM == NULL)
|
||||||
{
|
{
|
||||||
Notify().DisplayError("No Java VM");
|
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);
|
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);
|
bool res = AppInit(&Notify(), baseDir, 0, NULL);
|
||||||
|
|
||||||
env->ReleaseStringUTFChars(BaseDir, baseDir);
|
env->ReleaseStringUTFChars(BaseDir, baseDir);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "CriticalSection.h"
|
#include "CriticalSection.h"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#else
|
||||||
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CriticalSection::CriticalSection()
|
CriticalSection::CriticalSection()
|
||||||
|
|
|
@ -18,7 +18,7 @@ DynLibHandle DynamicLibraryOpen(const char *pccLibraryPath, bool ShowErrors)
|
||||||
DynLibHandle Lib = (DynLibHandle)LoadLibraryA(pccLibraryPath);
|
DynLibHandle Lib = (DynLibHandle)LoadLibraryA(pccLibraryPath);
|
||||||
SetErrorMode(LastErrorMode);
|
SetErrorMode(LastErrorMode);
|
||||||
#else
|
#else
|
||||||
pjutil::DynLibHandle Lib = (pjutil::DynLibHandle)dlopen(pccLibraryPath, RTLD_NOW);
|
DynLibHandle Lib = (DynLibHandle)dlopen(pccLibraryPath, RTLD_NOW);
|
||||||
#endif
|
#endif
|
||||||
return Lib;
|
return Lib;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
|
#include "path.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#define USE_WINDOWS_API
|
#define USE_WINDOWS_API
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#include "HighResTimeStamp.h"
|
#include "HighResTimeStamp.h"
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "CriticalSection.h"
|
#include "CriticalSection.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
enum MEM_PROTECTION
|
enum MEM_PROTECTION
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
int _vscprintf(const char * format, va_list pargs)
|
int _vscprintf(const char * format, va_list pargs)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "StdString.h"
|
#include "StdString.h"
|
||||||
|
#include "Platform.h"
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "SyncEvent.h"
|
#include "SyncEvent.h"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#else
|
||||||
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SyncEvent::SyncEvent(bool bManualReset)
|
SyncEvent::SyncEvent(bool bManualReset)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "StdString.h"
|
#include "StdString.h"
|
||||||
#include "CriticalSection.h"
|
#include "CriticalSection.h"
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
|
#include "Platform.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
#define __except_try() __try
|
#define __except_try() __try
|
||||||
#define __except_catch() __except (g_MMU->MemoryFilter(_exception_code(), _exception_info()))
|
#define __except_catch() __except (g_MMU->MemoryFilter(_exception_code(), _exception_info()))
|
||||||
#else
|
#else
|
||||||
#define __except_try() __try
|
#define __except_try() try
|
||||||
#define __except_catch() __catch (...)
|
#define __except_catch() catch (...)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <Project64-core/N64System/Enhancement/Enhancement.h>
|
#include <Project64-core/N64System/Enhancement/Enhancement.h>
|
||||||
|
#include <Common/Platform.h>
|
||||||
|
|
||||||
struct EnhancementItemList_compare
|
struct EnhancementItemList_compare
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ CEnhancements::GAMESHARK_CODE::GAMESHARK_CODE(uint32_t Command, uint16_t Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
CEnhancements::CEnhancements() :
|
CEnhancements::CEnhancements() :
|
||||||
m_ScanFileThread(stScanFileThread),
|
m_ScanFileThread((CThread::CTHREAD_START_ROUTINE)stScanFileThread),
|
||||||
m_Scan(true),
|
m_Scan(true),
|
||||||
m_Scanned(false),
|
m_Scanned(false),
|
||||||
m_UpdateCheats(false),
|
m_UpdateCheats(false),
|
||||||
|
@ -112,7 +112,7 @@ void CEnhancements::UpdateCheats(const CEnhancementList & Cheats)
|
||||||
{
|
{
|
||||||
m_CheatFiles.erase(CheatFileItr);
|
m_CheatFiles.erase(CheatFileItr);
|
||||||
}
|
}
|
||||||
m_CheatFile = std::make_unique<CEnhancmentFile>(OutFile, CEnhancement::CheatIdent);
|
m_CheatFile.reset(new CEnhancmentFile(OutFile, CEnhancement::CheatIdent));
|
||||||
m_CheatFiles.insert(SectionFiles::value_type(SectionIdent, OutFile));
|
m_CheatFiles.insert(SectionFiles::value_type(SectionIdent, OutFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void CEnhancements::UpdateEnhancements(const CEnhancementList & Enhancements)
|
||||||
{
|
{
|
||||||
m_EnhancementFiles.erase(EnhancementFileItr);
|
m_EnhancementFiles.erase(EnhancementFileItr);
|
||||||
}
|
}
|
||||||
m_EnhancementFile = std::make_unique<CEnhancmentFile>(OutFile, CEnhancement::EnhancementIdent);
|
m_EnhancementFile.reset(new CEnhancmentFile(OutFile, CEnhancement::EnhancementIdent));
|
||||||
m_EnhancementFiles.insert(SectionFiles::value_type(SectionIdent, OutFile));
|
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)
|
if (File.get() == nullptr || strcmp(File->FileName(), CheatFile) != 0)
|
||||||
{
|
{
|
||||||
File = std::make_unique<CEnhancmentFile>(CheatFile, Ident);
|
File.reset(new CEnhancmentFile(CheatFile, Ident));
|
||||||
}
|
}
|
||||||
EnhancementList.clear();
|
EnhancementList.clear();
|
||||||
File->GetEnhancementList(SectionIdent.c_str(), EnhancementList);
|
File->GetEnhancementList(SectionIdent.c_str(), EnhancementList);
|
||||||
|
|
|
@ -49,7 +49,7 @@ void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, uint32_t len)
|
||||||
// Fix Dezaemon 3D saves
|
// Fix Dezaemon 3D saves
|
||||||
StartOffset = ((StartOffset >> 3) & 0xFFFF8000) | (StartOffset & 0x7FFF);
|
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.Seek(StartOffset, CFile::begin);
|
||||||
m_File.Read(dest, len);
|
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++)
|
for (uint32_t i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
m_File.Seek((StartOffset + i) ^ 3, CFile::begin);
|
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
|
// Fix Dezaemon 3D saves
|
||||||
StartOffset = ((StartOffset >> 3) & 0xFFFF8000) | (StartOffset & 0x7FFF);
|
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.Seek(StartOffset, CFile::begin);
|
||||||
m_File.Write(Source, len);
|
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++)
|
for (uint32_t i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
m_File.Seek((StartOffset + i) ^ 3, CFile::begin);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "N64SYstem.h"
|
#include "N64System.h"
|
||||||
#include <Project64-core/3rdParty/zip.h>
|
#include <Project64-core/3rdParty/zip.h>
|
||||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
|
@ -1375,10 +1375,14 @@ void CN64System::SyncCPU(CN64System * const SecondCPU)
|
||||||
|
|
||||||
if (bFastSP() && m_Recomp)
|
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)))
|
if (m_Recomp->MemoryStackPos() != (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF)))
|
||||||
{
|
{
|
||||||
ErrorFound = true;
|
ErrorFound = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_SystemTimer != SecondCPU->m_SystemTimer) { ErrorFound = true; }
|
if (m_SystemTimer != SecondCPU->m_SystemTimer) { ErrorFound = true; }
|
||||||
|
@ -1541,10 +1545,14 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
||||||
}
|
}
|
||||||
if (bFastSP() && m_Recomp)
|
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)))
|
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)));
|
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();
|
uint32_t * Rdram = (uint32_t *)m_MMU_VM.Rdram(), *Rdram2 = (uint32_t *)SecondCPU->m_MMU_VM.Rdram();
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#if defined(__aarch64__)
|
||||||
|
#include <Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.h>
|
||||||
|
|
||||||
|
CAarch64RegInfo::CAarch64RegInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CAarch64RegInfo::~CAarch64RegInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,14 @@
|
||||||
|
#pragma once
|
||||||
|
#if defined(__aarch64__)
|
||||||
|
#include <Project64-core/N64System/Recompiler/RegBase.h>
|
||||||
|
|
||||||
|
class CAarch64RegInfo :
|
||||||
|
public CRegBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAarch64RegInfo();
|
||||||
|
~CAarch64RegInfo();
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -11,7 +11,8 @@
|
||||||
#include <Project64-core/N64System/Recompiler/SectionInfo.h>
|
#include <Project64-core/N64System/Recompiler/SectionInfo.h>
|
||||||
#include <Project64-core/N64System/Recompiler/LoopAnalysis.h>
|
#include <Project64-core/N64System/Recompiler/LoopAnalysis.h>
|
||||||
#include <Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h>
|
#include <Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h>
|
||||||
#include <Project64-core/N64System/N64Class.h>
|
#include <Project64-core/N64System/N64System.h>
|
||||||
|
#include <Project64-core/N64System/N64Rom.h>
|
||||||
#include <Project64-core/ExceptionHandler.h>
|
#include <Project64-core/ExceptionHandler.h>
|
||||||
|
|
||||||
uint32_t CArmRecompilerOps::m_TempValue = 0;
|
uint32_t CArmRecompilerOps::m_TempValue = 0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#if defined(__arm__) || defined(_M_ARM)
|
#if defined(__arm__) || defined(_M_ARM)
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/Register.h>
|
||||||
#include <Project64-core/N64System/Recompiler/RecompilerOps.h>
|
#include <Project64-core/N64System/Recompiler/RecompilerOps.h>
|
||||||
#include <Project64-core/N64System/Recompiler/Arm/ArmOps.h>
|
#include <Project64-core/N64System/Recompiler/Arm/ArmOps.h>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#if defined(__arm__) || defined(_M_ARM)
|
#if defined(__arm__) || defined(_M_ARM)
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/N64Class.h>
|
#include <Project64-core/N64System/N64System.h>
|
||||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||||
#include <Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h>
|
#include <Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#if defined(__arm__) || defined(_M_ARM)
|
#if defined(__arm__) || defined(_M_ARM)
|
||||||
#include <Project64-core/N64System/Recompiler/RegBase.h>
|
#include <Project64-core/N64System/Recompiler/RegBase.h>
|
||||||
#include <Project64-core/N64System/Recompiler/Arm/ArmOps.h>
|
#include <Project64-core/N64System/Recompiler/Arm/ArmOps.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/Register.h>
|
||||||
|
|
||||||
class CArmRegInfo :
|
class CArmRegInfo :
|
||||||
public CRegBase,
|
public CRegBase,
|
||||||
|
|
|
@ -771,7 +771,7 @@ bool CCodeBlock::Compile()
|
||||||
MD5(g_MMU->Rdram() + PAddr, (VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash);
|
MD5(g_MMU->Rdram() + PAddr, (VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash);
|
||||||
|
|
||||||
#if defined(ANDROID) && (defined(__arm__) || defined(_M_ARM))
|
#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
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -990,6 +990,9 @@ CCompiledFunc * CRecompiler::CompileCode()
|
||||||
ret.first->second->SetNext(Func);
|
ret.first->second->SetNext(Func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__aarch64__) || defined(__amd64__)
|
||||||
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
|
#else
|
||||||
if (g_ModuleLogLevel[TraceRecompiler] >= TraceDebug)
|
if (g_ModuleLogLevel[TraceRecompiler] >= TraceDebug)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "Info->Function() = %X", Func->Function());
|
WriteTrace(TraceRecompiler, TraceDebug, "Info->Function() = %X", Func->Function());
|
||||||
|
@ -1014,6 +1017,7 @@ CCompiledFunc * CRecompiler::CompileCode()
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "%s", dumpline.c_str());
|
WriteTrace(TraceRecompiler, TraceDebug, "%s", dumpline.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
WriteTrace(TraceRecompiler, TraceVerbose, "Done");
|
WriteTrace(TraceRecompiler, TraceVerbose, "Done");
|
||||||
return Func;
|
return Func;
|
||||||
}
|
}
|
||||||
|
@ -1107,6 +1111,9 @@ void CRecompiler::ClearRecompCode_Virt(uint32_t Address, int length, REMOVE_REAS
|
||||||
|
|
||||||
void CRecompiler::ResetMemoryStackPos()
|
void CRecompiler::ResetMemoryStackPos()
|
||||||
{
|
{
|
||||||
|
#if defined(__aarch64__) || defined(__amd64__)
|
||||||
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
|
#else
|
||||||
if (m_Registers.m_GPR[29].UW[0] == 0)
|
if (m_Registers.m_GPR[29].UW[0] == 0)
|
||||||
{
|
{
|
||||||
m_MemoryStack = 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]);
|
WriteTrace(TraceRecompiler, TraceError, "Failed to translate SP address (%s)", m_Registers.m_GPR[29].UW[0]);
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecompiler::DumpFunctionTimes()
|
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");
|
CPath LogFileName(g_Settings->LoadStringVal(Directory_Log).c_str(), "FunctionTimes.csv");
|
||||||
|
|
||||||
CLog Log;
|
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);
|
Log.LogF("%X,0x%X,%d\r\n", (uint32_t)itr->first, itr->second.Address, (uint32_t)itr->second.TimeTaken);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecompiler::ResetFunctionTimes()
|
void CRecompiler::ResetFunctionTimes()
|
||||||
|
|
|
@ -17,4 +17,9 @@ typedef CX64RegInfo CRegInfo;
|
||||||
|
|
||||||
typedef CArmRegInfo CRegInfo;
|
typedef CArmRegInfo CRegInfo;
|
||||||
|
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
|
||||||
|
#include <Project64-core/N64System/Recompiler/Aarch64/Aarch64RegInfo.h>
|
||||||
|
typedef CAarch64RegInfo CRegInfo;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef PLUGIN_INFO_STRUCT
|
#ifndef PLUGIN_INFO_STRUCT
|
||||||
#define PLUGIN_INFO_STRUCT
|
#define PLUGIN_INFO_STRUCT
|
||||||
|
|
||||||
typedef struct
|
typedef struct _PLUGIN_INFO
|
||||||
{
|
{
|
||||||
uint16_t Version; // Should be set to 1
|
uint16_t Version; // Should be set to 1
|
||||||
uint16_t Type; // Set to PLUGIN_TYPE_GFX
|
uint16_t Type; // Set to PLUGIN_TYPE_GFX
|
||||||
|
|
Loading…
Reference in New Issue