Merge remote-tracking branch 'origin/main' into 26-04-05-locked-aspect-ratio

# Conflicts:
#	include/dusk/settings.h
#	src/dusk/settings.cpp
#	src/m_Do/m_Do_main.cpp
This commit is contained in:
MelonSpeedruns
2026-04-07 18:20:45 -04:00
112 changed files with 2558 additions and 261 deletions
+3
View File
@@ -2873,7 +2873,10 @@ void mDoExt_3DlineMat1_c::update(int param_0, f32 param_1, GXColor& param_2, u16
sp_38++;
}
}
#if !TARGET_PC
#include "assets/l_mat2DL__d_a_grass.h"
#endif
void mDoExt_3DlineMat2_c::setMaterial() {
j3dSys.reinitGX();
+41
View File
@@ -552,8 +552,16 @@ const tvSize l_tvSize[2] = {
{808, 448},
};
#if TARGET_PC
tvSize pc_tvSize = {608, 448};
#endif
void mDoGph_gInf_c::setTvSize() {
#if TARGET_PC
const tvSize* tvsize = &pc_tvSize;
#else
const tvSize* tvsize = &l_tvSize[mWide];
#endif
m_width = tvsize->width;
m_height = tvsize->height;
@@ -572,13 +580,28 @@ void mDoGph_gInf_c::setTvSize() {
m_aspect = m_widthF / m_heightF;
m_scale = m_aspect / 1.3571428f;
m_invScale = 1.0f / m_scale;
#if TARGET_PC
hudAspectScaleDown = 1.3571428f / mDoGph_gInf_c::getAspect();
hudAspectScaleUp = 1.0f / hudAspectScaleDown;
#endif
}
#if TARGET_PC
void mDoGph_gInf_c::onWide(f32 width, f32 height) {
mWide = TRUE;
pc_tvSize.width = width;
pc_tvSize.height = height;
setTvSize();
dMeter2Info_onWide2D();
}
#else
void mDoGph_gInf_c::onWide() {
mWide = TRUE;
setTvSize();
dMeter2Info_onWide2D();
}
#endif
void mDoGph_gInf_c::offWide() {
mWide = FALSE;
@@ -686,10 +709,16 @@ void mDoGph_gInf_c::setWideZoomLightProjection(Mtx& m) {
#endif
#if TARGET_PC
f32 mDoGph_gInf_c::hudAspectScaleDown = 1.0f;
f32 mDoGph_gInf_c::hudAspectScaleUp = 1.0f;
void mDoGph_gInf_c::setWindowSize(AuroraWindowSize const& size) {
JUTVideo::getManager()->setWindowSize(size);
dComIfGp_setWindow(0, 0.0f, 0.0f, getWidth(), getHeight(), 0.0f, 1.0f, 0, 2);
mFader->mBox.set(0, 0, getWidth(), getHeight());
f32 newWidth = (getWidth() / getHeight()) * 448.0f;
onWide(newWidth, 448.0f);
}
#endif
@@ -1285,7 +1314,13 @@ void mDoGph_gInf_c::bloom_c::draw() {
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3c);
for (int texCoord = (int)GX_TEXCOORD1; texCoord < (int)GX_MAX_TEXCOORD; texCoord++) {
GXSetTexCoordGen((GXTexCoordID)texCoord, GX_TG_MTX2x4, GX_TG_TEX0, iVar11);
#if TARGET_PC
f32 dVar15 = mBlureSize * ((448.0f / getHeight()) / 6400.0f);
#else
f32 dVar15 = mBlureSize * (1.0f / 6400.0f);
#endif
mDoMtx_stack_c::transS((dVar15 * cM_scos(sVar10)) * getInvScale(),
dVar15 * cM_ssin(sVar10), 0.0f);
GXLoadTexMtxImm(mDoMtx_stack_c::get(), iVar11, GX_MTX2x4);
@@ -2014,7 +2049,13 @@ int mDoGph_Painter() {
Mtx m2;
Mtx44 m;
#if TARGET_PC
C_MTXPerspective(m, AREG_F(8) + 60.0f, 1.3571428f, 1.0f, 100000.0f);
#else
C_MTXPerspective(m, AREG_F(8) + 60.0f, mDoGph_gInf_c::getAspect(), 1.0f, 100000.0f);
#endif
GXSetProjection(m, GX_PERSPECTIVE);
cXyz sp38c(0.0f, 0.0f, AREG_F(7) + -2.0f);
cXyz sp398(0.0f, 1.0f, 0.0f);
+8
View File
@@ -592,6 +592,7 @@ void myExceptionCallback(u16, OSContext*, u32, u32) {
VIFlush();
}
#ifndef TARGET_PC
static void fault_callback_scroll(u16, OSContext* p_context, u32, u32) {
JUTException* manager = JUTException::getManager();
JUTConsole* exConsole = manager->getConsole();
@@ -714,6 +715,7 @@ static void fault_callback_scroll(u16, OSContext* p_context, u32, u32) {
} while (true);
} while (true);
}
#endif
static void dummy_string() {
DEAD_STRING("\x1B[32m%-24s = size=%d KB\n\x1B[m");
@@ -1008,3 +1010,9 @@ int mDoMch_Create() {
return 1;
}
#if TARGET_PC
void mDoMch_Destroy() {
JFWSystem::shutdown();
}
#endif
+63 -5
View File
@@ -44,11 +44,12 @@
#include <chrono>
#include <thread>
#include "SSystem/SComponent/c_API.h"
#include "dusk/app_info.hpp"
#include "dusk/dusk.h"
#include "dusk/logging.h"
#include "dusk/time.h"
#include "dusk/main.h"
#include "dusk/imgui/ImGuiEngine.hpp"
#include "dusk/logging.h"
#include "dusk/main.h"
#include "dusk/time.h"
#include <aurora/aurora.h>
#include <aurora/event.h>
@@ -56,7 +57,9 @@
#include <aurora/dvd.h>
#include <dolphin/dvd.h>
#include "SDL3/SDL_filesystem.h"
#include "cxxopts.hpp"
#include "dusk/config.hpp"
// --- GLOBALS ---
s8 mDoMain::developmentMode = -1;
@@ -107,6 +110,8 @@ s32 LOAD_COPYDATE(void*) {
}
AuroraInfo auroraInfo;
AuroraStats dusk::lastFrameAuroraStats;
const char* configPath;
void main01(void) {
OS_REPORT("\x1b[m");
@@ -178,6 +183,7 @@ void main01(void) {
VIWaitForRetrace();
#if TARGET_PC
dusk::lastFrameAuroraStats = *aurora_get_stats();
if (!aurora_begin_frame()) {
DuskLog.debug("aurora_begin_frame returned false, skipping draw this frame");
continue;
@@ -233,10 +239,51 @@ static void aurora_imgui_init_callback(const AuroraWindowSize* size) {
dusk::ImGuiEngine_Initialize(size->scale);
}
static void ApplyCVarOverrides(const cxxopts::OptionValue& option) {
if (option.count() == 0) {
return;
}
const auto& cVars = option.as<std::vector<std::string>>();
for (const auto& cvarArg : cVars) {
const auto sep = cvarArg.find('=');
if (sep == std::string::npos) {
DuskLog.fatal("--cvar argument has no '=': '{}'", cvarArg);
continue;
}
const auto name = std::string_view(cvarArg).substr(0, sep);
const auto value = std::string_view(cvarArg).substr(sep + 1);
const auto cVar = dusk::config::GetConfigVar(name);
if (!cVar) {
DuskLog.fatal("Unknown --cvar name: '{}'", name);
}
try {
cVar->getImpl()->loadFromArg(*cVar, value);
} catch (const std::exception& e) {
DuskLog.fatal("Unable to parse: '{}': {}", value, e.what());
}
}
}
static const char* CalculateConfigPath() {
const auto result = SDL_GetPrefPath(dusk::OrgName, dusk::AppName);
if (!result) {
DuskLog.fatal("Unable to get PrefPath: {}", SDL_GetError());
}
return result;
}
// =========================================================================
// PC ENTRY POINT
// =========================================================================
int game_main(int argc, char* argv[]) {
dusk::registerSettings();
dusk::config::FinishRegistration();
cxxopts::ParseResult parsed_arg_options;
try {
@@ -246,7 +293,8 @@ int game_main(int argc, char* argv[]) {
("l,log-level", "Log level from " + std::to_string(AuroraLogLevel::LOG_DEBUG) + " to " + std::to_string(AuroraLogLevel::LOG_FATAL), cxxopts::value<uint8_t>()->default_value("0"))
("h,help", "Print usage")
("dvd", "Path to DVD image file", cxxopts::value<std::string>()->default_value("game.iso"))
("backend", "Graphics API backend to use (auto, d3d11, d3d12, metal, vulkan, opengl, opengles, webgpu, null)", cxxopts::value<std::string>()->default_value("auto"));
("backend", "Graphics API backend to use (auto, d3d11, d3d12, metal, vulkan, opengl, opengles, webgpu, null)", cxxopts::value<std::string>()->default_value("auto"))
("cvar", "Override configuration variables without modifying config", cxxopts::value<std::vector<std::string>>());
arg_options.parse_positional({"dvd"});
arg_options.positional_help("<dvd-image>");
@@ -265,8 +313,16 @@ int game_main(int argc, char* argv[]) {
exit(1);
}
configPath = CalculateConfigPath();
dusk::config::LoadFromUserPreferences();
ApplyCVarOverrides(parsed_arg_options["cvar"]);
AuroraConfig config{};
config.appName = "Dusk";
config.appName = dusk::AppName;
config.configPath = configPath;
config.vsync = dusk::getSettings().video.enableVsync;
config.startFullscreen = dusk::getSettings().video.enableFullscreen;
config.windowPosX = -1;
config.windowPosY = -1;
config.windowWidth = defaultWindowWidth * 2;
@@ -312,6 +368,8 @@ int game_main(int argc, char* argv[]) {
fflush(stdout);
fflush(stderr);
mDoMch_Destroy();
// Notifies all CVs and causes threads to exit
OSResetSystem(OS_RESET_SHUTDOWN, 0, 0);