mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-08 21:00:19 +02:00
FEXCore: Move to Externals/FEXCore
This commit is contained in:
1 parent
f034cef9fc
commit
e9ea4cbb76
113 files changed
No files matched your search
+63
@@ -0,0 +1,63 @@
|
||||
#include "LogManager.h"
|
||||
#include "SimpleCodeLoader.h"
|
||||
|
||||
#include <FEXCore/Config/Config.h>
|
||||
#include <FEXCore/Core/Context.h>
|
||||
#include <FEXCore/Memory/SharedMem.h>
|
||||
#include <cstdio>
|
||||
|
||||
void MsgHandler(LogMan::DebugLevels Level, const char *Message) {
|
||||
const char *CharLevel{nullptr};
|
||||
|
||||
switch (Level) {
|
||||
case LogMan::NONE:
|
||||
CharLevel = "NONE";
|
||||
break;
|
||||
case LogMan::ASSERT:
|
||||
CharLevel = "ASSERT";
|
||||
break;
|
||||
case LogMan::ERROR:
|
||||
CharLevel = "ERROR";
|
||||
break;
|
||||
case LogMan::DEBUG:
|
||||
CharLevel = "DEBUG";
|
||||
break;
|
||||
case LogMan::INFO:
|
||||
CharLevel = "Info";
|
||||
break;
|
||||
default:
|
||||
CharLevel = "???";
|
||||
break;
|
||||
}
|
||||
printf("[%s] %s\n", CharLevel, Message);
|
||||
}
|
||||
|
||||
void AssertHandler(const char *Message) {
|
||||
printf("[ASSERT] %s\n", Message);
|
||||
}
|
||||
|
||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) {
|
||||
LogMan::Throw::InstallHandler(AssertHandler);
|
||||
LogMan::Msg::InstallHandler(MsgHandler);
|
||||
|
||||
static constexpr uint8_t RawCode[] = {
|
||||
0x90, // NOP
|
||||
0xF4 // HLT
|
||||
};
|
||||
|
||||
TestCode Test(RawCode, sizeof(RawCode));
|
||||
FEXCore::Context::InitializeStaticTables();
|
||||
auto SHM = FEXCore::SHM::AllocateSHMRegion(1ULL << 36);
|
||||
auto CTX = FEXCore::Context::CreateNewContext();
|
||||
|
||||
FEXCore::Config::SetConfig(CTX, FEXCore::Config::CONFIG_MAXBLOCKINST, 1);
|
||||
FEXCore::Context::AddGuestMemoryRegion(CTX, SHM);
|
||||
FEXCore::Context::InitCore(CTX, &Test);
|
||||
|
||||
auto ShutdownReason = FEXCore::Context::RunUntilExit(CTX);
|
||||
LogMan::Msg::D("Reason we left VM: %d", ShutdownReason);
|
||||
|
||||
FEXCore::Context::DestroyContext(CTX);
|
||||
FEXCore::SHM::DestroyRegion(SHM);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user