Fix build on main for mac/linux (#40)

* fix builds, removing COMPOUND_LITERAL around GXColor

use aurora's aurora_get_stats

add aurora::gd to libraries linked to

fixup linkage/symbol hiding on mac/linux

squashed

* aurora stat changes

* fix

---------

Co-authored-by: Jasper St. Pierre <jstpierre@mecheye.net>
Co-authored-by: TakaRikka <takarikka@outlook.com>
This commit is contained in:
Jeffrey Crowell
2026-03-06 22:22:28 -08:00
committed by GitHub
parent 1aeb04d238
commit 50970df645
11 changed files with 73 additions and 30 deletions
+18 -1
View File
@@ -67,10 +67,27 @@ target_include_directories(game_debug PUBLIC
extern/aurora/include/dolphin
${CMAKE_SOURCE_DIR}/build/${DUSK_TP_VERSION}/include
build/${DUSK_TP_VERSION}/include)
target_link_libraries(game_debug PUBLIC aurora::core aurora::gx aurora::si aurora::vi aurora::pad aurora::mtx aurora::os)
target_link_libraries(game_debug PUBLIC aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_library(game SHARED ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${SSYSTEM_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES})
# Hide global operator new/delete overrides from the dynamic symbol table.
# Without this, other dylibs (e.g. Apple's AGX GPU driver) resolve these symbols
# from libgame and crash when they encounter JKRHeap-managed memory.
if (APPLE)
target_link_options(game PRIVATE
"LINKER:-unexported_symbol,__ZdlPv" # operator delete(void*)
"LINKER:-unexported_symbol,__ZdaPv" # operator delete[](void*)
"LINKER:-unexported_symbol,__Znwm" # operator new(size_t)
"LINKER:-unexported_symbol,__Znam" # operator new[](size_t)
)
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
target_link_options(game PRIVATE
"LINKER:--version-script,${CMAKE_SOURCE_DIR}/hide_new_delete.lds"
)
endif ()
target_link_libraries(game PRIVATE game_debug)
target_compile_definitions(game PRIVATE TARGET_PC VERSION=0 NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0)
+8
View File
@@ -0,0 +1,8 @@
{
global: *;
local:
_ZdlPv;
_ZdaPv;
_Znwm;
_Znam;
};
+1
View File
@@ -2,6 +2,7 @@
#include "JSystem/J3DU/J3DUClipper.h"
#include <cmath>
#include "global.h"
void J3DUClipper::init() {
mNear = 1.0f;
@@ -5,6 +5,7 @@
#include <stdint.h>
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/JFramework/JFWDisplay.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JUtility/JUTDbPrint.h"
@@ -224,7 +225,17 @@ void JFWDisplay::endGX() {
}
void JFWDisplay::beginRender() {
#if TARGET_PC
// Temporarily clear the current JKRHeap so that Aurora/Dawn/ImGui allocations
// use malloc instead of JKRHeap. Without this, Dawn's internal std::string
// allocations would go through JKRHeap and then crash when freed via standard delete.
JKRHeap* savedHeap = JKRHeap::getCurrentHeap();
JKRHeap::setCurrentHeap(nullptr);
#endif
aurora_begin_frame();
#if TARGET_PC
JKRHeap::setCurrentHeap(savedHeap);
#endif
if (field_0x40) {
JUTProcBar::getManager()->wholeLoopEnd();
}
@@ -302,7 +313,16 @@ void JFWDisplay::endRender() {
JUTProcBar::getManager()->cpuStart();
calcCombinationRatio();
#if TARGET_PC
{
JKRHeap* savedHeap = JKRHeap::getCurrentHeap();
JKRHeap::setCurrentHeap(nullptr);
aurora_end_frame();
JKRHeap::setCurrentHeap(savedHeap);
}
#else
aurora_end_frame();
#endif
}
void JFWDisplay::endFrame() {
+1
View File
@@ -2,6 +2,7 @@
#include "JSystem/JGadget/binary.h"
#include "JSystem/JGadget/define.h"
#include "global.h"
#include <stdint.h>
#if DEBUG
+1 -1
View File
@@ -9,7 +9,7 @@ s32 JStage::TAmbientLight::JSGFGetType() const {
}
GXColor JStage::TAmbientLight::JSGGetColor() const {
return COMPOUND_LITERAL(GXColor){255, 255, 255, 255};
return GXColor{255, 255, 255, 255};
}
void JStage::TAmbientLight::JSGSetColor(GXColor) {}
+1 -1
View File
@@ -28,7 +28,7 @@ f32 JStage::TFog::JSGGetEndZ() const {
void JStage::TFog::JSGSetEndZ(f32) {}
GXColor JStage::TFog::JSGGetColor() const {
return COMPOUND_LITERAL(GXColor){255, 255, 255, 255};
return GXColor{255, 255, 255, 255};
}
void JStage::TFog::JSGSetColor(GXColor) {}
+1 -1
View File
@@ -15,7 +15,7 @@ bool JStage::TLight::JSGGetLightType() const {
void JStage::TLight::JSGSetLightType(JStage::TELight) {}
GXColor JStage::TLight::JSGGetColor() const {
return COMPOUND_LITERAL(GXColor){255, 255, 255, 255};
return GXColor{255, 255, 255, 255};
}
void JStage::TLight::JSGSetColor(GXColor) {}
+1
View File
@@ -6,6 +6,7 @@
#include "JSystem/JUtility/JUTDirectPrint.h"
#include <cstdio>
#include <vi.h>
#include "global.h"
namespace JUTAssertion {
+20 -23
View File
@@ -4,7 +4,9 @@
#include "fmt/format.h"
#include "imgui.h"
#include "aurora/gfx.h"
#include "aurora/gfx.h"
#include "imgui.hpp"
static bool m_frameRate = true;
@@ -12,19 +14,6 @@ static bool m_pipelineInfo = true;
static bool m_graphicsBackend = true;
static int m_debugOverlayCorner = 0; // top-left
namespace aurora::gfx
{
extern std::atomic_uint32_t queuedPipelines;
extern std::atomic_uint32_t createdPipelines;
extern size_t g_drawCallCount;
extern size_t g_mergedDrawCallCount;
extern size_t g_lastVertSize;
extern size_t g_lastUniformSize;
extern size_t g_lastIndexSize;
extern size_t g_lastStorageSize;
} // namespace aurora::gfx
using namespace std::string_literals;
using namespace std::string_view_literals;
@@ -117,6 +106,12 @@ void DuskImguiDebugOverlay(const AuroraInfo *info) {
std::string_view backendString = "Unknown"sv;
switch (info->backend)
{
case BACKEND_AUTO:
backendString = "Auto"sv;
break;
case BACKEND_D3D11:
backendString = "D3D11"sv;
break;
case BACKEND_D3D12:
backendString = "D3D12"sv;
break;
@@ -149,26 +144,28 @@ void DuskImguiDebugOverlay(const AuroraInfo *info) {
}
hasPrevious = true;
AuroraStats const* stats = aurora_get_stats();
ImGuiStringViewText(
fmt::format(FMT_STRING("Queued pipelines: {}\n"), aurora::gfx::queuedPipelines.load()));
fmt::format(FMT_STRING("Queued pipelines: {}\n"), stats->queuedPipelines));
ImGuiStringViewText(
fmt::format(FMT_STRING("Done pipelines: {}\n"), aurora::gfx::createdPipelines.load()));
fmt::format(FMT_STRING("Done pipelines: {}\n"), stats->createdPipelines));
ImGuiStringViewText(
fmt::format(FMT_STRING("Draw call count: {}\n"), aurora::gfx::g_drawCallCount));
fmt::format(FMT_STRING("Draw call count: {}\n"), stats->drawCallCount));
ImGuiStringViewText(fmt::format(FMT_STRING("Merged draw calls: {}\n"),
aurora::gfx::g_mergedDrawCallCount));
stats->mergedDrawCallCount));
ImGuiStringViewText(fmt::format(FMT_STRING("Vertex size: {}\n"),
BytesToString(aurora::gfx::g_lastVertSize)));
BytesToString(stats->lastVertSize)));
ImGuiStringViewText(fmt::format(FMT_STRING("Uniform size: {}\n"),
BytesToString(aurora::gfx::g_lastUniformSize)));
BytesToString(stats->lastUniformSize)));
ImGuiStringViewText(fmt::format(FMT_STRING("Index size: {}\n"),
BytesToString(aurora::gfx::g_lastIndexSize)));
BytesToString(stats->lastIndexSize)));
ImGuiStringViewText(fmt::format(FMT_STRING("Storage size: {}\n"),
BytesToString(aurora::gfx::g_lastStorageSize)));
BytesToString(stats->lastStorageSize)));
ImGuiStringViewText(fmt::format(
FMT_STRING("Total: {}\n"),
BytesToString(aurora::gfx::g_lastVertSize + aurora::gfx::g_lastUniformSize +
aurora::gfx::g_lastIndexSize + aurora::gfx::g_lastStorageSize)));
BytesToString(stats->lastVertSize + stats->lastUniformSize +
stats->lastIndexSize + stats->lastStorageSize)));
}
}
ImGui::End();
+1 -3
View File
@@ -1402,9 +1402,7 @@ u16 GXGetNumXfbLines(u16 efbHeight, f32 yScale) {
STUB_LOG("GXGetNumXfbLines is a stub");
return 0;
}
void GXGetViewportv(f32* vp) {
STUB_LOG("GXGetViewportv is a stub");
}
void GXGetScissor(u32* left, u32* top, u32* wd, u32* ht) {
STUB_LOG("GXGetScissor is a stub");
}