diff --git a/CMakeLists.txt b/CMakeLists.txt index bc5d9b7..7e98b19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,90 +6,11 @@ set(CMAKE_CXX_STANDARD 20) option(AURORA_NATIVE_MATRIX "Assume OpenGL-layout matrices, disables transposing" OFF) add_subdirectory(extern) -add_library(aurora STATIC - lib/aurora.cpp - lib/webgpu/gpu.cpp - lib/imgui.cpp - lib/input.cpp - lib/window.cpp - lib/gfx/common.cpp - lib/gfx/texture.cpp - lib/gfx/gx.cpp - lib/gfx/gx_shader.cpp - lib/gfx/texture_convert.cpp - lib/gfx/stream/shader.cpp - lib/gfx/model/shader.cpp - lib/dolphin/GXBump.cpp - lib/dolphin/GXCull.cpp - lib/dolphin/GXDispList.cpp - lib/dolphin/GXDraw.cpp - lib/dolphin/GXExtra.cpp - lib/dolphin/GXFifo.cpp - lib/dolphin/GXFrameBuffer.cpp - lib/dolphin/GXGeometry.cpp - lib/dolphin/GXGet.cpp - lib/dolphin/GXLighting.cpp - lib/dolphin/GXManage.cpp - lib/dolphin/GXPerf.cpp - lib/dolphin/GXPixel.cpp - lib/dolphin/GXTev.cpp - lib/dolphin/GXTexture.cpp - lib/dolphin/GXTransform.cpp - lib/dolphin/GXVert.cpp - lib/dolphin/vi.cpp - ) -add_library(aurora::aurora ALIAS aurora) -target_compile_definitions(aurora PUBLIC AURORA TARGET_PC) -if (AURORA_NATIVE_MATRIX) - target_compile_definitions(aurora PRIVATE AURORA_NATIVE_MATRIX) -endif () -target_include_directories(aurora PUBLIC include) -target_include_directories(aurora PRIVATE ../imgui) -if (NOT TARGET SDL3::SDL3-static) - find_package(SDL3 REQUIRED) -endif () -target_link_libraries(aurora PUBLIC SDL3::SDL3-static fmt::fmt imgui xxhash) -if (EMSCRIPTEN) - target_link_options(aurora PUBLIC -sUSE_WEBGPU=1 -sASYNCIFY -sEXIT_RUNTIME) - target_compile_definitions(aurora PRIVATE ENABLE_BACKEND_WEBGPU) -else () - target_link_libraries(aurora PRIVATE dawn::dawn_native dawn::dawn_proc) - target_sources(aurora PRIVATE lib/dawn/BackendBinding.cpp) - target_compile_definitions(aurora PRIVATE WEBGPU_DAWN) -endif () -target_link_libraries(aurora PRIVATE absl::btree absl::flat_hash_map) -if (DAWN_ENABLE_VULKAN) - target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_VULKAN) - target_link_libraries(aurora PRIVATE Vulkan::Headers) -endif () -if (DAWN_ENABLE_METAL) - target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_METAL) - target_sources(aurora PRIVATE lib/dawn/MetalBinding.mm) - set_source_files_properties(lib/dawn/MetalBinding.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) -endif () -if (DAWN_ENABLE_D3D11) - target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_D3D11) -endif () -if (DAWN_ENABLE_D3D12) - target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_D3D12) -endif () -if (DAWN_ENABLE_DESKTOP_GL OR DAWN_ENABLE_OPENGLES) - target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_OPENGL) - if (DAWN_ENABLE_DESKTOP_GL) - target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_DESKTOP_GL) - endif () - if (DAWN_ENABLE_OPENGLES) - target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_OPENGLES) - endif () -endif () -if (DAWN_ENABLE_NULL) - target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_NULL) -endif () -add_library(aurora_main STATIC lib/main.cpp) -target_include_directories(aurora_main PUBLIC include) -target_link_libraries(aurora_main PUBLIC SDL3::SDL3-static) -add_library(aurora::main ALIAS aurora_main) +include(cmake/aurora_core.cmake) +include(cmake/aurora_gx.cmake) +include(cmake/aurora_vi.cmake) +include(cmake/aurora_main.cmake) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) add_subdirectory(examples) diff --git a/cmake/aurora_core.cmake b/cmake/aurora_core.cmake new file mode 100644 index 0000000..59f2da1 --- /dev/null +++ b/cmake/aurora_core.cmake @@ -0,0 +1,54 @@ +add_library(aurora_core STATIC + lib/aurora.cpp + lib/webgpu/gpu.cpp + lib/imgui.cpp + lib/input.cpp + lib/window.cpp +) +add_library(aurora::core ALIAS aurora_core) +target_compile_definitions(aurora_core PUBLIC AURORA TARGET_PC) +if (AURORA_NATIVE_MATRIX) + target_compile_definitions(aurora_core PRIVATE AURORA_NATIVE_MATRIX) +endif () +target_include_directories(aurora_core PUBLIC include) +target_include_directories(aurora_core PRIVATE ../imgui) +if (NOT TARGET SDL3::SDL3-static) + find_package(SDL3 REQUIRED) +endif () +target_link_libraries(aurora_core PUBLIC SDL3::SDL3-static fmt::fmt imgui xxhash) +if (EMSCRIPTEN) + target_link_options(aurora_core PUBLIC -sUSE_WEBGPU=1 -sASYNCIFY -sEXIT_RUNTIME) + target_compile_definitions(aurora_core PRIVATE ENABLE_BACKEND_WEBGPU) +else () + target_link_libraries(aurora_core PRIVATE dawn::dawn_native dawn::dawn_proc) + target_sources(aurora_core PRIVATE lib/dawn/BackendBinding.cpp) + target_compile_definitions(aurora_core PRIVATE WEBGPU_DAWN) +endif () +target_link_libraries(aurora_core PRIVATE absl::btree absl::flat_hash_map) +if (DAWN_ENABLE_VULKAN) + target_compile_definitions(aurora_core PRIVATE DAWN_ENABLE_BACKEND_VULKAN) + target_link_libraries(aurora_core PRIVATE Vulkan::Headers) +endif () +if (DAWN_ENABLE_METAL) + target_compile_definitions(aurora_core PRIVATE DAWN_ENABLE_BACKEND_METAL) + target_sources(aurora_core PRIVATE lib/dawn/MetalBinding.mm) + set_source_files_properties(lib/dawn/MetalBinding.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) +endif () +if (DAWN_ENABLE_D3D11) + target_compile_definitions(aurora_core PRIVATE DAWN_ENABLE_BACKEND_D3D11) +endif () +if (DAWN_ENABLE_D3D12) + target_compile_definitions(aurora_core PRIVATE DAWN_ENABLE_BACKEND_D3D12) +endif () +if (DAWN_ENABLE_DESKTOP_GL OR DAWN_ENABLE_OPENGLES) + target_compile_definitions(aurora_core PRIVATE DAWN_ENABLE_BACKEND_OPENGL) + if (DAWN_ENABLE_DESKTOP_GL) + target_compile_definitions(aurora_core PRIVATE DAWN_ENABLE_BACKEND_DESKTOP_GL) + endif () + if (DAWN_ENABLE_OPENGLES) + target_compile_definitions(aurora_core PRIVATE DAWN_ENABLE_BACKEND_OPENGLES) + endif () +endif () +if (DAWN_ENABLE_NULL) + target_compile_definitions(aurora_core PRIVATE DAWN_ENABLE_BACKEND_NULL) +endif () \ No newline at end of file diff --git a/cmake/aurora_gx.cmake b/cmake/aurora_gx.cmake new file mode 100644 index 0000000..0ffec04 --- /dev/null +++ b/cmake/aurora_gx.cmake @@ -0,0 +1,43 @@ +add_library(aurora_gx STATIC + lib/gfx/common.cpp + lib/gfx/texture.cpp + lib/gfx/gx.cpp + lib/gfx/gx_shader.cpp + lib/gfx/texture_convert.cpp + lib/gfx/stream/shader.cpp + lib/gfx/model/shader.cpp + lib/dolphin/gx/GXBump.cpp + lib/dolphin/gx/GXCull.cpp + lib/dolphin/gx/GXDispList.cpp + lib/dolphin/gx/GXDraw.cpp + lib/dolphin/gx/GXExtra.cpp + lib/dolphin/gx/GXFifo.cpp + lib/dolphin/gx/GXFrameBuffer.cpp + lib/dolphin/gx/GXGeometry.cpp + lib/dolphin/gx/GXGet.cpp + lib/dolphin/gx/GXLighting.cpp + lib/dolphin/gx/GXManage.cpp + lib/dolphin/gx/GXPerf.cpp + lib/dolphin/gx/GXPixel.cpp + lib/dolphin/gx/GXTev.cpp + lib/dolphin/gx/GXTexture.cpp + lib/dolphin/gx/GXTransform.cpp + lib/dolphin/gx/GXVert.cpp +) + +add_library(aurora::gx ALIAS aurora_gx) +target_include_directories(aurora_gx PUBLIC include) +target_compile_definitions(aurora_gx PUBLIC AURORA TARGET_PC) +if (AURORA_NATIVE_MATRIX) + target_compile_definitions(aurora_gx PRIVATE AURORA_NATIVE_MATRIX) +endif () +target_include_directories(aurora_gx PUBLIC include) +target_link_libraries(aurora_gx PUBLIC xxhash) +if (EMSCRIPTEN) + target_link_options(aurora_gx PUBLIC -sUSE_WEBGPU=1 -sASYNCIFY -sEXIT_RUNTIME) + target_compile_definitions(aurora_gx PRIVATE ENABLE_BACKEND_WEBGPU) +else () + target_link_libraries(aurora_gx PRIVATE dawn::dawn_native dawn::dawn_proc) + target_compile_definitions(aurora_gx PRIVATE WEBGPU_DAWN) +endif () +target_link_libraries(aurora_gx PRIVATE absl::btree absl::flat_hash_map) \ No newline at end of file diff --git a/cmake/aurora_main.cmake b/cmake/aurora_main.cmake new file mode 100644 index 0000000..335edab --- /dev/null +++ b/cmake/aurora_main.cmake @@ -0,0 +1,4 @@ +add_library(aurora_main STATIC lib/main.cpp) +target_include_directories(aurora_main PUBLIC include) +target_link_libraries(aurora_main PUBLIC SDL3::SDL3-static) +add_library(aurora::main ALIAS aurora_main) \ No newline at end of file diff --git a/cmake/aurora_vi.cmake b/cmake/aurora_vi.cmake new file mode 100644 index 0000000..00a3847 --- /dev/null +++ b/cmake/aurora_vi.cmake @@ -0,0 +1,7 @@ +add_library(aurora_vi STATIC + lib/dolphin/vi/vi.cpp +) +target_include_directories(aurora_vi PUBLIC include) +target_compile_definitions(aurora_vi PUBLIC AURORA TARGET_PC) + +add_library(aurora::vi ALIAS aurora_vi) \ No newline at end of file diff --git a/lib/dolphin/GXBump.cpp b/lib/dolphin/gx/GXBump.cpp similarity index 99% rename from lib/dolphin/GXBump.cpp rename to lib/dolphin/gx/GXBump.cpp index b4a8243..a351a94 100644 --- a/lib/dolphin/GXBump.cpp +++ b/lib/dolphin/gx/GXBump.cpp @@ -1,5 +1,6 @@ #include "gx.hpp" +extern "C" { void GXSetNumIndStages(u8 num) { update_gx_state(g_gxState.numIndStages, num); } void GXSetIndTexOrder(GXIndTexStageID indStage, GXTexCoordID texCoord, GXTexMapID texMap) { @@ -59,3 +60,4 @@ void GXSetTevIndWarp(GXTevStageID tevStage, GXIndTexStageID indStage, GXBool sig // TODO GXSetTevIndBumpST // TODO GXSetTevIndBumpXYZ // TODO GXSetTevIndRepeat +} \ No newline at end of file diff --git a/lib/dolphin/GXCull.cpp b/lib/dolphin/gx/GXCull.cpp similarity index 94% rename from lib/dolphin/GXCull.cpp rename to lib/dolphin/gx/GXCull.cpp index 7dfae7b..862b7a4 100644 --- a/lib/dolphin/GXCull.cpp +++ b/lib/dolphin/gx/GXCull.cpp @@ -1,7 +1,10 @@ #include "gx.hpp" +extern "C" { + void GXSetScissor(u32 left, u32 top, u32 width, u32 height) { aurora::gfx::set_scissor(left, top, width, height); } void GXSetCullMode(GXCullMode mode) { update_gx_state(g_gxState.cullMode, mode); } // TODO GXSetCoPlanar +} \ No newline at end of file diff --git a/lib/dolphin/GXDispList.cpp b/lib/dolphin/gx/GXDispList.cpp similarity index 83% rename from lib/dolphin/GXDispList.cpp rename to lib/dolphin/gx/GXDispList.cpp index 2be8a1c..e11a704 100644 --- a/lib/dolphin/GXDispList.cpp +++ b/lib/dolphin/gx/GXDispList.cpp @@ -1,7 +1,8 @@ #include "gx.hpp" -#include "../gfx/model/shader.hpp" +#include "../../gfx/model/shader.hpp" +extern "C" { void GXBeginDisplayList(void* list, u32 size) { // TODO } @@ -14,3 +15,4 @@ u32 GXEndDisplayList() { void GXCallDisplayList(const void* data, u32 nbytes) { aurora::gfx::model::queue_surface(static_cast(data), nbytes); } +} \ No newline at end of file diff --git a/lib/dolphin/GXDraw.cpp b/lib/dolphin/gx/GXDraw.cpp similarity index 94% rename from lib/dolphin/GXDraw.cpp rename to lib/dolphin/gx/GXDraw.cpp index cd706b2..ecc7e6e 100644 --- a/lib/dolphin/GXDraw.cpp +++ b/lib/dolphin/gx/GXDraw.cpp @@ -1,5 +1,7 @@ #include "gx.hpp" +extern "C" { + // TODO GXDrawCylinder // TODO GXDrawTorus @@ -11,3 +13,4 @@ void GXDrawSphere(u8 numMajor, u8 numMinor) { puts("GXDrawSphere is a stub"); } // TODO GXDrawIcosahedron // TODO GXDrawSphere1 // TODO GXGenNormalTable +} \ No newline at end of file diff --git a/lib/dolphin/GXExtra.cpp b/lib/dolphin/gx/GXExtra.cpp similarity index 94% rename from lib/dolphin/GXExtra.cpp rename to lib/dolphin/gx/GXExtra.cpp index 0103db4..170080b 100644 --- a/lib/dolphin/GXExtra.cpp +++ b/lib/dolphin/gx/GXExtra.cpp @@ -1,5 +1,7 @@ #include "gx.hpp" +extern "C" { + void GXDestroyTexObj(GXTexObj* obj_) { auto* obj = reinterpret_cast(obj_); obj->ref.reset(); @@ -9,3 +11,4 @@ void GXDestroyTlutObj(GXTlutObj* obj_) { auto* obj = reinterpret_cast(obj_); obj->ref.reset(); } +} \ No newline at end of file diff --git a/lib/dolphin/GXFifo.cpp b/lib/dolphin/gx/GXFifo.cpp similarity index 98% rename from lib/dolphin/GXFifo.cpp rename to lib/dolphin/gx/GXFifo.cpp index a969ac0..ab86547 100644 --- a/lib/dolphin/GXFifo.cpp +++ b/lib/dolphin/gx/GXFifo.cpp @@ -1,5 +1,7 @@ #include "gx.hpp" +extern "C" { + static GXFifoObj* GPFifo; static GXFifoObj* CPUFifo; @@ -45,3 +47,4 @@ void GXSaveCPUFifo(GXFifoObj* fifo) {} // TODO GXGetCurrentGXThread // TODO GXGetOverflowCount // TODO GXResetOverflowCount +} \ No newline at end of file diff --git a/lib/dolphin/GXFrameBuffer.cpp b/lib/dolphin/gx/GXFrameBuffer.cpp similarity index 97% rename from lib/dolphin/GXFrameBuffer.cpp rename to lib/dolphin/gx/GXFrameBuffer.cpp index 42fbf7e..6d2398f 100644 --- a/lib/dolphin/GXFrameBuffer.cpp +++ b/lib/dolphin/gx/GXFrameBuffer.cpp @@ -1,7 +1,7 @@ #include "gx.hpp" -#include "../window.hpp" -#include "../webgpu/wgpu.hpp" +#include "../../window.hpp" +#include "../../webgpu/wgpu.hpp" extern "C" { GXRenderModeObj GXNtsc480IntDf = { @@ -13,7 +13,7 @@ GXRenderModeObj GXPal528IntDf = { GXRenderModeObj GXMpal480IntDf = { VI_TVMODE_PAL_INT, 640, 480, 480, 40, 0, 640, 480, VI_XFBMODE_DF, 0, 0, }; -} + void GXAdjustForOverscan(GXRenderModeObj* rmin, GXRenderModeObj* rmout, u16 hor, u16 ver) { *rmout = *rmin; @@ -69,3 +69,4 @@ void GXCopyTex(void* dest, GXBool clear) { // TODO GXGetNumXfbLines // TODO GXClearBoundingBox // TODO GXReadBoundingBox +} \ No newline at end of file diff --git a/lib/dolphin/GXGeometry.cpp b/lib/dolphin/gx/GXGeometry.cpp similarity index 99% rename from lib/dolphin/GXGeometry.cpp rename to lib/dolphin/gx/GXGeometry.cpp index 4cf806a..8bcfeda 100644 --- a/lib/dolphin/GXGeometry.cpp +++ b/lib/dolphin/gx/GXGeometry.cpp @@ -2,6 +2,8 @@ #include +extern "C" { + void GXSetVtxDesc(GXAttr attr, GXAttrType type) { update_gx_state(g_gxState.vtxDesc[attr], type); } void GXSetVtxDescv(GXVtxDescList* list) { @@ -53,3 +55,4 @@ void GXSetLineWidth(u8 width, GXTexOffset offs) { // TODO GXSetPointSize // TODO GXEnableTexOffsets +} \ No newline at end of file diff --git a/lib/dolphin/GXGet.cpp b/lib/dolphin/gx/GXGet.cpp similarity index 98% rename from lib/dolphin/GXGet.cpp rename to lib/dolphin/gx/GXGet.cpp index 955039c..4c2cb16 100644 --- a/lib/dolphin/GXGet.cpp +++ b/lib/dolphin/gx/GXGet.cpp @@ -1,6 +1,8 @@ #include "gx.hpp" -#include "../gfx/texture.hpp" +#include "../../gfx/texture.hpp" + +extern "C" { // TODO GXGetVtxDesc // TODO GXGetVtxDescv @@ -104,3 +106,4 @@ GXBool GXGetTexObjMipMap(GXTexObj* tex_obj) { return reinterpret_cast(light_); light->a0 = a0; @@ -227,3 +228,4 @@ void GXSetChanCtrl(GXChannelID id, bool lightingEnabled, GXColorSrc ambSrc, GXCo update_gx_state(chan.attnFn, attnFn); update_gx_state(g_gxState.colorChannelState[id].lightMask, GX::LightMask{lightState}); } +} \ No newline at end of file diff --git a/lib/dolphin/GXManage.cpp b/lib/dolphin/gx/GXManage.cpp similarity index 97% rename from lib/dolphin/GXManage.cpp rename to lib/dolphin/gx/GXManage.cpp index 93577c8..c176277 100644 --- a/lib/dolphin/GXManage.cpp +++ b/lib/dolphin/gx/GXManage.cpp @@ -1,5 +1,6 @@ #include "gx.hpp" +extern "C" { static GXDrawDoneCallback DrawDoneCB = nullptr; GXFifoObj* GXInit(void* base, u32 size) { return NULL; } @@ -33,3 +34,4 @@ void GXTexModeSync() {} // TODO IsWriteGatherBufferEmpty // TODO GXSetMisc +} \ No newline at end of file diff --git a/lib/dolphin/GXPerf.cpp b/lib/dolphin/gx/GXPerf.cpp similarity index 96% rename from lib/dolphin/GXPerf.cpp rename to lib/dolphin/gx/GXPerf.cpp index 8e6ea69..54bf6af 100644 --- a/lib/dolphin/GXPerf.cpp +++ b/lib/dolphin/gx/GXPerf.cpp @@ -1,5 +1,7 @@ #include "gx.hpp" +extern "C" { + // TODO GXSetGPMetric // TODO GXClearGPMetric // TODO GXReadGPMetric @@ -15,3 +17,4 @@ // TODO GXReadXfRasMetric // TODO GXInitXfRasMetric // TODO GXReadClksPerVtx +} \ No newline at end of file diff --git a/lib/dolphin/GXPixel.cpp b/lib/dolphin/gx/GXPixel.cpp similarity index 99% rename from lib/dolphin/GXPixel.cpp rename to lib/dolphin/gx/GXPixel.cpp index 53d9c88..2004749 100644 --- a/lib/dolphin/GXPixel.cpp +++ b/lib/dolphin/gx/GXPixel.cpp @@ -1,5 +1,6 @@ #include "gx.hpp" +extern "C" { void GXSetFog(GXFogType type, float startZ, float endZ, float nearZ, float farZ, GXColor color) { update_gx_state(g_gxState.fog, {type, startZ, endZ, nearZ, farZ, from_gx_color(color)}); } @@ -44,3 +45,4 @@ void GXSetDstAlpha(bool enabled, u8 value) { // TODO GXSetFieldMask // TODO GXSetFieldMode +} \ No newline at end of file diff --git a/lib/dolphin/GXTev.cpp b/lib/dolphin/gx/GXTev.cpp similarity index 99% rename from lib/dolphin/GXTev.cpp rename to lib/dolphin/gx/GXTev.cpp index c0d4cb2..aa96cbe 100644 --- a/lib/dolphin/GXTev.cpp +++ b/lib/dolphin/gx/GXTev.cpp @@ -1,5 +1,6 @@ #include "gx.hpp" +extern "C" { void GXSetTevOp(GXTevStageID id, GXTevMode mode) { GXTevColorArg inputColor = GX_CC_RASC; GXTevAlphaArg inputAlpha = GX_CA_RASA; @@ -100,3 +101,4 @@ void GXSetTevSwapModeTable(GXTevSwapSel id, GXTevColorChan red, GXTevColorChan g CHECK(id >= GX_TEV_SWAP0 && id < GX_MAX_TEVSWAP, "bad tev swap sel {}", static_cast(id)); update_gx_state(g_gxState.tevSwapTable[id], {red, green, blue, alpha}); } +} \ No newline at end of file diff --git a/lib/dolphin/GXTexture.cpp b/lib/dolphin/gx/GXTexture.cpp similarity index 99% rename from lib/dolphin/GXTexture.cpp rename to lib/dolphin/gx/GXTexture.cpp index 16ae647..d00558a 100644 --- a/lib/dolphin/GXTexture.cpp +++ b/lib/dolphin/gx/GXTexture.cpp @@ -1,9 +1,10 @@ #include "gx.hpp" -#include "../gfx/texture.hpp" +#include "../../gfx/texture.hpp" #include +extern "C" { void GXInitTexObj(GXTexObj* obj_, const void* data, u16 width, u16 height, u32 format, GXTexWrapMode wrapS, GXTexWrapMode wrapT, GXBool mipmap) { memset(obj_, 0, sizeof(GXTexObj)); @@ -235,3 +236,4 @@ void GXInvalidateTexAll() { // TODO GXSetTexCoordScaleManually // TODO GXSetTexCoordCylWrap // TODO GXSetTexCoordBias +} \ No newline at end of file diff --git a/lib/dolphin/GXTransform.cpp b/lib/dolphin/gx/GXTransform.cpp similarity index 99% rename from lib/dolphin/GXTransform.cpp rename to lib/dolphin/gx/GXTransform.cpp index 26a1c2f..cad605a 100644 --- a/lib/dolphin/GXTransform.cpp +++ b/lib/dolphin/gx/GXTransform.cpp @@ -2,6 +2,8 @@ #include +extern "C" { + constexpr aurora::Mat4x4 DepthCorrect{ {1.f, 0.f, 0.f, 0.f}, {0.f, 1.f, 0.f, 0.f}, @@ -109,3 +111,4 @@ void GXSetViewportJitter(float left, float top, float width, float height, float // TODO GXSetZScaleOffset // TODO GXSetScissorBoxOffset // TODO GXSetClipMode +} \ No newline at end of file diff --git a/lib/dolphin/GXVert.cpp b/lib/dolphin/gx/GXVert.cpp similarity index 99% rename from lib/dolphin/GXVert.cpp rename to lib/dolphin/gx/GXVert.cpp index 5a43b68..ea08db4 100644 --- a/lib/dolphin/GXVert.cpp +++ b/lib/dolphin/gx/GXVert.cpp @@ -1,6 +1,6 @@ #include "gx.hpp" -#include "../gfx/stream/shader.hpp" +#include "../../gfx/stream/shader.hpp" #include #include @@ -40,13 +40,14 @@ struct SStreamState { } #ifndef NDEBUG nextAttr = next_attr(0); -#endif +#endif } }; static std::optional sStreamState; static u16 lastVertexStart = 0; +extern "C" { void GXBegin(GXPrimitive primitive, GXVtxFmt vtxFmt, u16 nVerts) { CHECK(!sStreamState, "Stream began twice!"); uint16_t vertexSize = 0; @@ -185,3 +186,4 @@ void GXEnd() { lastVertexStart = sStreamState->vertexStart + sStreamState->vertexCount; sStreamState.reset(); } +} \ No newline at end of file diff --git a/lib/dolphin/gx.hpp b/lib/dolphin/gx/gx.hpp similarity index 89% rename from lib/dolphin/gx.hpp rename to lib/dolphin/gx/gx.hpp index 2183b0f..d02bd19 100644 --- a/lib/dolphin/gx.hpp +++ b/lib/dolphin/gx/gx.hpp @@ -1,7 +1,7 @@ #pragma once -#include "../internal.hpp" -#include "../gfx/gx.hpp" +#include "../../internal.hpp" +#include "../../gfx/gx.hpp" static aurora::Module Log("aurora::gx"); diff --git a/lib/dolphin/vi.cpp b/lib/dolphin/vi/vi.cpp similarity index 88% rename from lib/dolphin/vi.cpp rename to lib/dolphin/vi/vi.cpp index c700c06..d1fbdca 100644 --- a/lib/dolphin/vi.cpp +++ b/lib/dolphin/vi/vi.cpp @@ -1,7 +1,8 @@ #include -#include "../window.hpp" +#include "../../window.hpp" +extern "C" { void VIInit() {} u32 VIGetTvFormat() { return 0; } void VIFlush() {} @@ -9,3 +10,4 @@ void VIFlush() {} void VISetWindowTitle(const char* title) { aurora::window::set_title(title); } void VISetWindowFullscreen(bool fullscreen) { aurora::window::set_fullscreen(fullscreen); } bool VIGetWindowFullscreen() { return aurora::window::get_fullscreen(); } +}