Merge branch 'master' of github.com:fleroviux/Panda3DS into pica-tev-emulation

This commit is contained in:
fleroviux 2023-06-17 12:39:48 +02:00
commit 78827886fe
13 changed files with 22076 additions and 10164 deletions

View file

@ -3,6 +3,7 @@
#include <filesystem>
#include <fstream>
#include <SDL.h>
#include <glad/gl.h>
#include "cpu.hpp"
#include "io_file.hpp"
@ -35,7 +36,7 @@ class Emulator {
public:
Emulator() : kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory), memory(cpu.getTicksRef()) {
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) {
Helpers::panic("Failed to initialize SDL2");
}
@ -45,8 +46,21 @@ public:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
window = SDL_CreateWindow("Alber", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL);
if (window == nullptr) {
Helpers::panic("Window creation failed: %s", SDL_GetError());
}
glContext = SDL_GL_CreateContext(window);
if (glContext == nullptr) {
Helpers::panic("OpenGL context creation failed: %s", SDL_GetError());
}
if(!gladLoadGL(reinterpret_cast<GLADloadfunc>(SDL_GL_GetProcAddress))) {
Helpers::panic("OpenGL init failed: %s", SDL_GetError());
}
reset();
}

View file

@ -1,6 +1,7 @@
#pragma once
#include <cstdarg>
#include <climits>
#include <cstdint>
#include <fstream>
#include <iostream>
#include <iterator>

View file

@ -28,7 +28,7 @@
#include <type_traits>
#include <utility>
#include "gl3w.h"
#include <glad/gl.h>
// Check if we have C++20. If yes, we can add C++20 std::span support
#ifdef _MSVC_LANG // MSVC does not properly define __cplusplus without a compiler flag...
@ -523,8 +523,6 @@ namespace OpenGL {
static GLint getProgram() { return get<GLint>(GL_CURRENT_PROGRAM); }
static bool scissorEnabled() { return isEnabled(GL_SCISSOR_TEST); }
static bool versionSupported(int major, int minor) { return gl3wIsSupported(major, minor); }
[[nodiscard]] static GLint uniformLocation(GLuint program, const char* name) {
return glGetUniformLocation(program, name);
}