Merge pull request #64 from Sinan-Karakaya/build/macos/arm

Build & Run support for MacOS ARM
This commit is contained in:
OwnedByWuigi 2025-08-08 00:01:45 +01:00 committed by GitHub
commit 4e090f9c89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -48,11 +48,19 @@ void JIT::translate_and_run(CPU& cpu) {
JitFunc fn = reinterpret_cast<JitFunc>(code);
u64 result;
#if defined(__x86_64__)
asm volatile("call *%1\n"
"mov %%rax, %0\n"
: "=r"(result)
: "r"(fn)
: "%rax");
#elif defined(__aarch64__)
asm volatile("blr %1\n"
"mov %0, x0\n"
: "=r"(result)
: "r"(fn)
: "x0");
#endif
cpu.regs[0] = result;
}

View file

@ -137,7 +137,13 @@ bool gui::init_imgui(gui::window_t* main_window)
return false;
}
#ifdef __APPLE__ && (__aarch64__)
ret = ::ImGui_ImplOpenGL3_Init("#version 120");
#elif __APPLE__ && (__x86_64__)
ret = ::ImGui_ImplOpenGL3_Init("#version 150");
#else
ret = ::ImGui_ImplOpenGL3_Init("#version 330");
#endif
if (false == ret)
{
LOG_ERROR(Render, "Failed to init OpenGL3: {}", SDL_GetError());