Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
flyinghead committed Apr 29, 2024
2 parents 8fdd1dd + 8e96590 commit 8f5f2ca
Show file tree
Hide file tree
Showing 17 changed files with 159 additions and 117 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ option(ENABLE_LOG "Enable full logging" OFF)
option(ASAN "Enable address sanitizer" OFF)
option(USE_GLES "Use GLES[3] API" OFF)
option(USE_GLES2 "Use GLES2 API" OFF)
option(USE_HOST_GLSLANG "Use host glslang" OFF)
option(USE_HOST_LIBZIP "Use host libzip" ON)
option(USE_HOST_SDL "Use host SDL library" ${USE_HOST_SDL_DEFAULT})
option(USE_OPENMP "Use OpenMP if available" ON)
Expand Down Expand Up @@ -385,14 +386,20 @@ add_subdirectory(core/deps/glm)
target_link_libraries(${PROJECT_NAME} PRIVATE glm::glm)

if(USE_VULKAN)
option(BUILD_EXTERNAL "Build external dependencies in /External" OFF)
option(SKIP_GLSLANG_INSTALL "Skip installation" ON)
option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" OFF)
option(ENABLE_GLSLANG_BINARIES "Builds glslang and spirv-remap" OFF)
option(ENABLE_HLSL "Enables HLSL input support" OFF)
option(ENABLE_PCH "Enables Precompiled header" OFF)
add_subdirectory(core/deps/glslang EXCLUDE_FROM_ALL)
target_link_libraries(${PROJECT_NAME} PRIVATE glslang-default-resource-limits SPIRV)
if(USE_HOST_GLSLANG)
find_package(glslang REQUIRED)
else()
option(BUILD_EXTERNAL "Build external dependencies in /External" OFF)
option(SKIP_GLSLANG_INSTALL "Skip installation" ON)
option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" OFF)
option(ENABLE_GLSLANG_BINARIES "Builds glslang and spirv-remap" OFF)
option(ENABLE_HLSL "Enables HLSL input support" OFF)
option(ENABLE_PCH "Enables Precompiled header" OFF)
add_subdirectory(core/deps/glslang EXCLUDE_FROM_ALL)
add_library(glslang::glslang-default-resource-limits ALIAS glslang-default-resource-limits)
add_library(glslang::SPIRV ALIAS SPIRV)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE glslang::glslang-default-resource-limits glslang::SPIRV)
endif()

if(NOT LIBRETRO)
Expand Down
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@ Get fresh builds for your system [**on the builds page**](https://flyinghead.git
**New:** Now automated test results are available as well.

### Build instructions:
`git clone https://github.com/flyinghead/flycast.git`

`cd flycast`

`git submodule update --init --recursive`

`mkdir build && cd build`

`cmake ..`

`make`
```
$ git clone --recursive https://github.com/flyinghead/flycast.git`
$ cd flycast
$ mkdir build && cd build
$ cmake ..
$ make
```
3 changes: 3 additions & 0 deletions core/cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ const WidescreenCheat CheatManager::widescreen_cheats[] =
{ "T40206N", nullptr, { 0x43296C }, { 0x3F400000 } }, // Super Magnetic Neo (US)
{ "T40206D 50", nullptr, { 0x43E34C }, { 0x3F400000 } }, // Super Magnetic Neo (EU)
// { "T7014D 50", nullptr, { 0xE2B234 }, { 0x3F800000 } }, // Super Runabout (PAL) doesn't work?
{ "T40216N", nullptr, { 0x45CE54 }, { 0x3F400000 } }, // Surf Rocket Racers (US)
{ "T17721D 50", nullptr, { 0x45CED4 }, { 0x3F400000 } }, // Surf Rocket Racers (PAL) alt: 021EBF40 3F400000
{ "T17703D 50", nullptr, { 0xCD8950 }, { 0x3F111111 } }, // Suzuki Alstare Extreme Racing
{ "T36807D 05", nullptr, { 0x140F74, 0x140FA4 }, { 0x43FA0000, 0x3F400000 } }, // Sword of Bersek (PAL)
Expand Down Expand Up @@ -349,6 +350,8 @@ const WidescreenCheat CheatManager::naomi_widescreen_cheats[] =
{ "GUN SPIKE", nullptr, { 0xBACD7C }, { 0x440A7C9A } },
{ " JAMBO SAFARI ------------", nullptr, { 0x2B1DE0 }, { 0x3FE38E39 } },
{ "SOUL SURFER IN JAPAN", nullptr, { 0x8962C8 }, { 0x3FE38E39 } },
{ "LOVE AND BERRY 3 EXP VER1.002", nullptr, { 0x3C16E4 }, { 0x3F400000 } }, // loveber3
{ "LOVE AND BERRY USA VER2.000", nullptr, { 0x4E92D0 }, { 0x3F400000 } }, // lovebery

{ nullptr },
};
Expand Down
2 changes: 1 addition & 1 deletion core/deps/SDL
Submodule SDL updated 37 files
+3 −1 CMakeLists.txt
+1 −1 Makefile.os2
+1 −1 Makefile.w32
+0 −1 VisualC-GDK/SDL/SDL.vcxproj
+0 −3 VisualC-GDK/SDL/SDL.vcxproj.filters
+0 −1 VisualC/SDL/SDL.vcxproj
+0 −3 VisualC/SDL/SDL.vcxproj.filters
+2 −2 Xcode/SDL/Info-Framework.plist
+6 −46 Xcode/SDL/SDL.xcodeproj/project.pbxproj
+1 −1 Xcode/SDL/pkg-support/SDL.info
+1 −1 android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+9 −7 android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java
+13 −1 configure
+2 −2 configure.ac
+2 −0 include/SDL_config.h.cmake
+2 −0 include/SDL_config.h.in
+3 −1 include/SDL_platform.h
+1 −1 include/SDL_version.h
+39 −40 src/core/linux/SDL_udev.c
+10 −10 src/file/SDL_rwops.c
+1 −1 src/joystick/SDL_gamecontroller.c
+2 −2 src/joystick/SDL_gamecontrollerdb.h
+28 −17 src/joystick/SDL_joystick.c
+4 −0 src/joystick/hidapi/SDL_hidapijoystick.c
+15 −12 src/joystick/linux/SDL_sysjoystick.c
+3 −1 src/joystick/psp/SDL_sysjoystick.c
+11 −2 src/joystick/sort_controllers.py
+1 −0 src/joystick/usb_ids.h
+9 −1 src/joystick/windows/SDL_dinputjoystick.c
+1 −0 src/joystick/windows/SDL_windowsjoystick_c.h
+4 −5 src/locale/n3ds/SDL_syslocale.c
+4 −4 src/main/windows/version.rc
+25 −11 src/video/cocoa/SDL_cocoawindow.m
+67 −21 src/video/wayland/SDL_waylandmouse.c
+1 −1 src/video/wayland/SDL_waylandopengles.c
+1 −1 src/video/wayland/SDL_waylandwindow.c
+30 −0 src/video/windows/SDL_windowsevents.c
5 changes: 5 additions & 0 deletions core/reios/reios_elf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ bool reios_loadElf(const std::string& elf) {
bool phys = false;
for (size_t i = 0; i < elf_getNumProgramHeaders(&elfFile); i++)
{
uint32_t type = elf_getProgramHeaderType(&elfFile, i);
if (type != PT_LOAD) {
DEBUG_LOG(REIOS, "Ignoring section %d type %d", (int)i, type);
continue;
}
// Load that section
uint64_t dest;
if (phys)
Expand Down
14 changes: 13 additions & 1 deletion core/rend/CustomTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,19 @@ void CustomTexture::DumpTexture(u32 hash, int w, int h, TextureType textype, voi
}

stbi_flip_vertically_on_write(1);
stbi_write_png(path.str().c_str(), w, h, STBI_rgb_alpha, dst_buffer, 0);
const auto& savefunc = [](void *context, void *data, int size) {
FILE *f = nowide::fopen((const char *)context, "wb");
if (f == nullptr)
{
WARN_LOG(RENDERER, "Dump texture: can't save to file %s: error %d", context, errno);
}
else
{
fwrite(data, 1, size, f);
fclose(f);
}
};
stbi_write_png_to_func(savefunc, (void *)path.str().c_str(), w, h, STBI_rgb_alpha, dst_buffer, 0);

free(dst_buffer);
}
Expand Down
14 changes: 13 additions & 1 deletion core/rend/boxart/scraper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,19 @@ void OfflineScraper::scrape(GameBoxart& item)
{
stbi_flip_vertically_on_write(0);
item.setBoxartPath(makeUniqueFilename("gdtex.png"));
stbi_write_png(item.boxartPath.c_str(), w, h, 4, out.data(), 0);
const auto& savefunc = [](void *context, void *data, int size) {
FILE *f = nowide::fopen((const char *)context, "wb");
if (f == nullptr)
{
WARN_LOG(COMMON, "can't create local file %s: error %d", context, errno);
}
else
{
fwrite(data, 1, size, f);
fclose(f);
}
};
stbi_write_png_to_func(savefunc, (void *)item.boxartPath.c_str(), w, h, 4, out.data(), 0);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions core/rend/gles/gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
#ifndef GL_PRIMITIVE_RESTART_FIXED_INDEX
#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
#endif
#ifndef GL_RGBA8
#define GL_RGBA8 0x8058
#endif
#ifndef GL_R8
#define GL_R8 0x8229
#endif

#define glCheck() do { if (unlikely(config::OpenGlChecks)) { verify(glGetError()==GL_NO_ERROR); } } while(0)

Expand Down
4 changes: 0 additions & 4 deletions core/rend/gles/gltex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,7 @@ GlFramebuffer::GlFramebuffer(int width, int height, bool withDepth, GLuint textu
// Use a renderbuffer and glBlitFramebuffer
glGenRenderbuffers(1, &colorBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, colorBuffer);
#ifdef GL_RGBA8
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, width, height);
#endif
}
}
makeFramebuffer(withDepth);
Expand Down Expand Up @@ -454,9 +452,7 @@ GlFramebuffer::GlFramebuffer(int width, int height, bool withDepth, bool withTex
// Use a renderbuffer and glBlitFramebuffer
glGenRenderbuffers(1, &colorBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, colorBuffer);
#ifdef GL_RGBA8
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, width, height);
#endif
}

makeFramebuffer(withDepth);
Expand Down
8 changes: 5 additions & 3 deletions core/rend/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2981,7 +2981,8 @@ static void gui_display_content()
static ImGuiTextFilter filter;
#if !defined(__ANDROID__) && !defined(TARGET_IPHONE) && !defined(TARGET_UWP) && !defined(__SWITCH__)
ImGui::SameLine(0, 32 * settings.display.uiScale);
filter.Draw("Filter");
filter.Draw("Filter", ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x - 32 * settings.display.uiScale
- ImGui::CalcTextSize("Settings").x - ImGui::GetStyle().FramePadding.x * 2.0f - ImGui::GetStyle().ItemSpacing.x);
#endif
if (gui_state != GuiState::SelectDisk)
{
Expand Down Expand Up @@ -3011,8 +3012,9 @@ static void gui_display_content()
// Only if Filter and Settings aren't focused... ImGui::SetNextWindowFocus();
ImGui::BeginChild(ImGui::GetID("library"), ImVec2(0, 0), ImGuiChildFlags_Border, ImGuiWindowFlags_DragScrolling | ImGuiWindowFlags_NavFlattened);
{
const int itemsPerLine = std::max<int>(ImGui::GetContentRegionMax().x / (150 * settings.display.uiScale + ImGui::GetStyle().ItemSpacing.x), 1);
const float responsiveBoxSize = ImGui::GetContentRegionMax().x / itemsPerLine - ImGui::GetStyle().FramePadding.x * 2;
const float totalWidth = ImGui::GetContentRegionMax().x - (!ImGui::GetCurrentWindow()->ScrollbarY ? ImGui::GetStyle().ScrollbarSize : 0);
const int itemsPerLine = std::max<int>(totalWidth / (150 * settings.display.uiScale + ImGui::GetStyle().ItemSpacing.x), 1);
const float responsiveBoxSize = totalWidth / itemsPerLine - ImGui::GetStyle().FramePadding.x * 2;
const ImVec2 responsiveBoxVec2 = ImVec2(responsiveBoxSize, responsiveBoxSize);

if (config::BoxartDisplayMode)
Expand Down
3 changes: 2 additions & 1 deletion core/rend/vulkan/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#include "vulkan_context.h"

#include <glslang/Public/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/SPIRV/GlslangToSpv.h>

int ShaderCompiler::initCount;

Expand Down
2 changes: 1 addition & 1 deletion core/rend/vulkan/shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
#pragma once
#include "vulkan.h"
#include "SPIRV/GlslangToSpv.h"
#include <glslang/SPIRV/GlslangToSpv.h>

#include <glm/glm.hpp>
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int darw_printf(const char* Text,...);
#ifndef TARGET_IPHONE
#if defined(__APPLE__) && defined(__MACH__) && HOST_CPU == CPU_ARM64
#define TARGET_ARM_MAC
#include "pthread.h"
#include <pthread.h>
inline static void JITWriteProtect(bool enabled) {
if (__builtin_available(macOS 11.0, *))
pthread_jit_write_protect_np(enabled);
Expand Down
2 changes: 1 addition & 1 deletion core/wsi/gl_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "types.h"
#include "context.h"

#if defined(USE_OPENGL) && !defined(LIBRETRO)
#if defined(USE_OPENGL) && !defined(LIBRETRO) && !defined(TARGET_IPHONE)
#include <glad/gl.h>
#endif

Expand Down
2 changes: 2 additions & 0 deletions core/wsi/osx.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#pragma once
#if defined(TARGET_IPHONE)
#include "gl_context.h"
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>

class OSXGraphicsContext : public GLGraphicsContext
{
Expand Down
Loading

0 comments on commit 8f5f2ca

Please sign in to comment.