Lime3DS/src/citra_libretro/emu_window/libretro_window.h
Eric Warmenhoven d9b77cc21e
Some checks are pending
citra-build / source (push) Waiting to run
citra-build / linux (appimage) (push) Waiting to run
citra-build / linux (appimage-wayland) (push) Waiting to run
citra-build / linux (fresh) (push) Waiting to run
citra-build / macos (arm64) (push) Waiting to run
citra-build / macos (x86_64) (push) Waiting to run
citra-build / macos-universal (push) Blocked by required conditions
citra-build / windows (msvc) (push) Waiting to run
citra-build / windows (msys2) (push) Waiting to run
citra-build / android (googleplay) (push) Waiting to run
citra-build / android (vanilla) (push) Waiting to run
citra-build / docker (push) Waiting to run
citra-format / clang-format (push) Waiting to run
citra-libretro / android (push) Waiting to run
citra-libretro / linux (push) Waiting to run
citra-libretro / windows (push) Waiting to run
citra-libretro / macos (arm64) (push) Waiting to run
citra-libretro / macos (x86_64) (push) Waiting to run
citra-libretro / ios (push) Waiting to run
citra-libretro / tvos (push) Waiting to run
citra-transifex / transifex (push) Waiting to run
Implement libretro core (#1215)
* libretro core

* Bringing citra libretro implementation over
* libretro: hook up vulkan renderer
* libretro: github actions
* libretro: gyro
* libretro: core options v2
* libretro: on ios turn off shader jit if unavailable
* moltenvk 1.3.0 introduces 8-bit indexes but allocates 16-bit for metal; this ends up allocating stream buffer * 2 = 132MiB. Instead, just use 16-bit indexes. (This will be necessary for standalone when bumping moltenvk version.)

* libretro core: address review feedback

* libretro: microphone support

* cmake: Add ENABLE_ROOM_STANDALONE to list of incompatible libretro flags

* libretro: proper initial geometry

* libretro: fix software renderer

* libretro: address review feedback

* .github/libretro.yml: Pin macOS runners at macOS 26

* ci: Remove explicit selection of Xcode 16.0

* .github/libretro.yml: remove unnecessary windows builder apt commands

* .github/libretro.yml: bump min macos version to 11.0

* ci: Re-enable CI jobs for all libretro cores

This is under the condition that we don't introduce build cache for these builds

---------

Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
Co-authored-by: PabloMK7 <hackyglitch2@gmail.com>
2026-02-19 22:30:25 +00:00

80 lines
2.1 KiB
C++

// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <utility>
#include "citra_libretro/input/mouse_tracker.h"
#include "core/frontend/emu_window.h"
struct LayoutGeometry {
unsigned width;
unsigned height;
bool emulated_pointer;
};
/// Compute framebuffer dimensions from current layout/scaling/swap settings.
LayoutGeometry ComputeLayoutGeometry();
void ResetGLState();
class EmuWindow_LibRetro : public Frontend::EmuWindow {
public:
EmuWindow_LibRetro();
~EmuWindow_LibRetro();
/// Swap buffers to display the next frame
void SwapBuffers() override;
/// Polls window events
void PollEvents() override;
/// Makes the graphics context current for the caller thread
void MakeCurrent() override;
/// Releases the GL context from the caller thread
void DoneCurrent() override;
void SetupFramebuffer() override;
/// Prepares the window for rendering
void UpdateLayout();
/// States whether a frame has been submitted. Resets after call.
bool HasSubmittedFrame();
/// Flags that the framebuffer should be cleared.
bool NeedsClearing() const override;
/// Creates state for a currently running OpenGL context.
void CreateContext();
/// Destroys a currently running OpenGL context.
void DestroyContext();
/// When true, SwapBuffers() is suppressed (used during savestate drain loops)
bool suppressPresentation = false;
private:
/// Called when a configuration change affects the minimal size of the window
void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) override;
int width;
int height;
bool submittedFrame = false;
// Hack to ensure stuff runs on the main thread
bool doCleanFrame = false;
// For tracking LibRetro state
bool hasTouched = false;
// For tracking mouse cursor
std::unique_ptr<LibRetro::Input::MouseTracker> tracker = nullptr;
bool enableEmulatedPointer = false;
};