Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pcsx-redux.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
elfio,
tracy,
md4c,
stb,
uriparser,
ucl,
llhttp,
Expand Down Expand Up @@ -91,6 +90,12 @@ let
rev = "b1e342774cbb35467dfdd3634d4f0181a76cbc89";
hash = "sha256-LYvO+chDVo6D++fuFbxqSRltGW3y82SESmtFj39TdSA=";
})
({
owner = "nothings";
repo = "stb";
rev = "ae721c50eaf761660b4f90cc590453cdb0c2acd0";
hash = "sha256-BIhbhXV7q5vodJ3N14vN9mEVwqrP6z9zqEEQrfLPzvI=";
})
Comment on lines +93 to +98
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Investigate the Nix build breakage.

The stb submodule entry structure is correct and follows the same pattern as other submodules. However, the PR comment explicitly states "Looks like this breaks nix."

The potential issues could be:

  • Incorrect revision or hash causing a fetch failure
  • Build system not finding stb headers at source/third_party/stb
  • Missing build configuration to integrate the stb submodule

Please run the following script to verify the stb submodule configuration:

Additionally, please check the actual Nix build error logs to identify the specific failure point.


🏁 Script executed:

#!/bin/bash
# Verify the stb revision exists and check Nix build configuration

# Check if the stb revision exists in the repository
echo "Checking stb revision..."
curl -s "https://api.github.com/repos/nothings/stb/commits/ae721c50eaf761660b4f90cc590453cdb0c2acd0" | jq -r '.sha // "NOT FOUND"'

# Search for stb usage in build files
echo -e "\nSearching for stb references in build configuration..."
rg -n "stb" --type=make -C2

# Search for stb includes in source files
echo -e "\nSearching for stb header includes..."
rg -n "#include.*stb" -C2

# Check if there are any Nix-specific build errors or configurations
echo -e "\nSearching for Nix build references to stb..."
rg -n "stb" -g "*.nix" -C3

Length of output: 1602


🏁 Script executed:

#!/bin/bash
# Investigate build configuration and stb integration

# Look for CMakeLists.txt or other build files
echo "=== Looking for build configuration files ==="
fd -e cmake -e "CMakeLists.txt" | head -20

# Search for include_directories or add_include_directories in CMake
echo -e "\n=== Searching for include_directories configuration ==="
rg -n "include_directories|target_include_directories" -C2 | head -40

# Look for third_party in CMakeLists files
echo -e "\n=== Checking third_party references in build files ==="
rg -n "third_party" -g "CMakeLists.txt" -C2

# Check if there's a stb directory already
echo -e "\n=== Checking for stb directory ==="
fd -t d "stb$" 2>/dev/null

# Look at how third_party/clip is configured (since it uses stb)
echo -e "\n=== Checking third_party structure and dependencies ==="
ls -la third_party/ 2>/dev/null | head -20

# Check if there's any stb configuration or build instructions
echo -e "\n=== Looking for stb-related build configuration ==="
rg -n "stb" --type=cmake -C2

Length of output: 4634


🏁 Script executed:

#!/bin/bash
# Deep dive into stb directory and build configuration

# Check what's in the stb directory
echo "=== Contents of third_party/stb/ ==="
ls -la third_party/stb/ 2>/dev/null || echo "Directory not found or empty"

# Check size and file count
echo -e "\n=== stb directory size and file count ==="
find third_party/stb/ -type f 2>/dev/null | wc -l
du -sh third_party/stb/ 2>/dev/null

# Look for any build files at repo root
echo -e "\n=== Looking for root-level build configuration ==="
ls -la | grep -E "CMakeLists|meson|setup|configure|Makefile|build" || echo "No standard build files found"

# Check the pcsx-redux.nix more carefully around fetchSubmodule and postUnpack
echo -e "\n=== Examining pcsx-redux.nix structure (around submodule handling) ==="
sed -n '105,130p' pcsx-redux.nix

# Look for how stb was previously handled (if any history)
echo -e "\n=== Checking if stb is referenced in any other Nix config ==="
rg -n "stb" -g "*.nix" -A2 -B2

# Check if stb headers actually exist in the submodule
echo -e "\n=== Checking for stb header files ==="
find third_party/stb -name "stb_*.h" 2>/dev/null | head -10

Length of output: 1563


🏁 Script executed:

#!/bin/bash
# Check Makefile and build configuration for stb handling

# Search Makefile for stb references
echo "=== Searching Makefile for stb references ==="
rg -n "stb" Makefile -C2

# Check how include paths are configured
echo -e "\n=== Checking include path configuration in Makefile ==="
rg -n "INCLUDE|CFLAGS|CPPFLAGS" Makefile -C1 | head -40

# Look for third_party references in Makefile
echo -e "\n=== Checking third_party references in Makefile ==="
rg -n "third_party" Makefile -C1

# Check if there's a specific build config for headers
echo -e "\n=== Looking for include directory setup ==="
rg -n "source/third_party|third_party" Makefile | head -20

# Verify the hash by checking if repo fetch would work (check GitHub)
echo -e "\n=== Testing GitHub API for stb repo ==="
curl -s "https://api.github.com/repos/nothings/stb/contents/" | jq -r '.[0:3] | .[] | .name' 2>/dev/null || echo "API call failed or no results"

# Look for any errors or comments in the PR/Nix about this change
echo -e "\n=== Full submodules section in pcsx-redux.nix ==="
sed -n '80,105p' pcsx-redux.nix

Length of output: 10991


The stb submodule is not being fetched, causing build failure.

The third_party/stb/ directory is empty despite the Nix submodule entry. The build will fail because the code includes stb headers (third_party/clip/image.cpp, third_party/ImFileDialog/ImFileDialog.cpp, and src/gui/splash.cc all require stb headers), but the files won't exist in the expected location.

The submodule entry structure is correct, but the fetchFromGitHub call is not actually copying files into source/third_party/stb. Verify the hash is correct for the specified revision, or check the actual Nix build logs to see if fetchFromGitHub is failing silently.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shut the hell up

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NotExactlySiev, understood. I'll step back on this issue.


🧠 Learnings used
Learnt from: NotExactlySiev
Repo: grumpycoders/pcsx-redux PR: 1853
File: pcsx-redux.nix:162-164
Timestamp: 2025-02-11T16:27:49.966Z
Learning: In pcsx-redux's Nix configuration, zlib will be needed as a runtime dependency for Lua functionality in the future, hence the commented placeholder in runtimeDependencies.

Learnt from: NotExactlySiev
Repo: grumpycoders/pcsx-redux PR: 1853
File: 001-patch.diff:92-97
Timestamp: 2025-02-11T16:27:22.888Z
Learning: Lua initialization is temporarily disabled in the Nix build of pcsx-redux (commented out in src/main/main.cc) and will be fixed in a future update. This is an intentional state during the Nix support implementation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lmao

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

] ++ lib.optional stdenv.hostPlatform.isAarch {
owner = "grumpycoders";
repo = "vixl";
Expand Down Expand Up @@ -127,7 +132,6 @@ in stdenv.mkDerivation {
];

buildInputs = [
stb
ucl
md4c
luajitPackages.libluv
Expand Down
22 changes: 12 additions & 10 deletions src/gui/gui.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/***************************************************************************

Check notice on line 1 in src/gui/gui.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

✅ Getting better: Lines of Code in a Single File

The lines of code decreases from 2464 to 2463, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
* Copyright (C) 2019 PCSX-Redux authors *
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -553,6 +553,8 @@
glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
});
m_listener.listen<Events::ExecutionFlow::Run>([this](const auto& event) {
m_enableSplashScreen = false;

glfwSwapInterval(0);
setRawMouseMotion();
});
Expand Down Expand Up @@ -951,16 +953,19 @@
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_renderSize.x, m_renderSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

if (m_clearTextures) {
const auto allocSize = static_cast<size_t>(std::ceil(m_renderSize.x * m_renderSize.y * sizeof(uint32_t)));
GLubyte* data = new GLubyte[allocSize]();
if (m_clearTextures || m_enableSplashScreen) {
m_clearTextures = false;
std::unique_ptr<uint32_t[]> splashImageData = getSplashScreen(m_renderSize.x, m_renderSize.y);

// Upload to both textures
for (int i = 0; i < 2; i++) {
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_renderSize.x, m_renderSize.y, GL_RGBA, GL_UNSIGNED_BYTE,
data);
splashImageData.get());
}
m_clearTextures = false;
delete[] data;
}

glBindRenderbuffer(GL_RENDERBUFFER, m_offscreenDepthBuffer);
Expand Down Expand Up @@ -1067,9 +1072,6 @@
glBindFramebuffer(GL_FRAMEBUFFER, m_offscreenFrameBuffer);
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[m_currentTexture]);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glBindRenderbuffer(GL_RENDERBUFFER, m_offscreenDepthBuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_offscreenDepthBuffer);
GLuint texture = m_offscreenTextures[m_currentTexture];
Expand Down Expand Up @@ -2890,4 +2892,4 @@
m_currentScale = scale;
m_allScales.emplace(scale);
ImGui::SetCurrentFont(getMainFont());
}
}
3 changes: 3 additions & 0 deletions src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <functional>
#include <magic_enum_all.hpp>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -454,8 +455,10 @@ class GUI final : public UI {
bool m_updateAvailable = false;
bool m_updateDownloading = false;
bool m_aboutSelectAuthors = false;
bool m_enableSplashScreen = true;

void setDefaultShaders();
std::unique_ptr<uint32_t[]> getSplashScreen(uint32_t destWidth, uint32_t destHeight);

public:
bool hasJapanese() { return m_hasJapanese; }
Expand Down
Loading
Loading