fix: MSVC build fixes
Some checks are pending
Build (Linux, x86-64) / build-linux-amalgamate (push) Waiting to run
Build (Linux, x86-64) / build-linux-full (push) Waiting to run
Format Check / clang-format (push) Waiting to run
Release Nightly (Linux, x86-64) / release-linux (push) Waiting to run

This commit is contained in:
Tropical 2026-04-10 17:09:25 -07:00
parent a399023cca
commit c58c1bd9d2
8 changed files with 57 additions and 55 deletions

View file

@ -36,7 +36,7 @@ class UIScene;
// 4jcraft, used to be D3D11_RECT.
// This was the only class that used it, so it's here now.
struct RECT {
struct 4J_RECT {
long left;
long top;
long right;
@ -190,7 +190,7 @@ private:
int m_accumulatedTicks;
uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect
RECT m_customRenderingClearRect;
4J_RECT m_customRenderingClearRect;
std::unordered_map<size_t, UIScene*>
m_registeredCallbackScenes; // A collection of scenes and unique id's

View file

@ -1119,21 +1119,15 @@ void Minecraft::run_middle() {
#if !defined(_CONTENT_PACKAGE)
{
// print the time
auto now_tp = std::chrono::
system_clock::now();
std::time_t now_tt = std::chrono::
system_clock::to_time_t(now_tp);
std::tm utcTime{};
#if defined(_WIN32)
gmtime_s(&utcTime, &now_tt);
#else
gmtime_r(&now_tt, &utcTime);
#endif
auto now = std::chrono::system_clock::now();
auto dp = std::chrono::floor<std::chrono::days>(now);
std::chrono::hh_mm_ss hms{std::chrono::floor<std::chrono::seconds>(now - dp)};
Log::info("%02d:%02d:%02d\n",
utcTime.tm_hour,
utcTime.tm_min,
utcTime.tm_sec);
(int)hms.hours().count(),
(int)hms.minutes().count(),
(int)hms.seconds().count());
}
#endif
} else {

View file

@ -268,15 +268,17 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y,
levelSummary->getLastPlayed() - kFileTimeEpochToUnixEpochMs;
const auto tp = std::chrono::system_clock::time_point{
std::chrono::milliseconds{lastPlayedUnixMs}};
time_t lastPlayedTime = std::chrono::system_clock::to_time_t(tp);
std::tm utc;
gmtime_r(&lastPlayedTime, &utc);
auto dp = std::chrono::floor<std::chrono::days>(tp);
std::chrono::year_month_day ymd{dp};
std::chrono::hh_mm_ss hms{
std::chrono::floor<std::chrono::minutes>(tp - dp)};
char buffer[20];
// 4J Stu - Currently shows years as 4 digits, where java only showed 2
snprintf(buffer, 20, "%d/%d/%d %d:%02d", utc.tm_mday, utc.tm_mon + 1,
utc.tm_year + 1900, utc.tm_hour,
utc.tm_min); // 4J - TODO Localise this
// 4J - TODO Localise this
id += std::format(" ({}/{}/{} {}:{:02d}", (unsigned)ymd.day(),
(unsigned)ymd.month(), (int)ymd.year(),
(int)hms.hours().count(), (int)hms.minutes().count());
id = id + " (" + buffer;
int64_t size = levelSummary->getSizeOnDisk();

View file

@ -8,6 +8,7 @@
#include "minecraft/client/renderer/entity/ItemRenderer.h"
#include "minecraft/locale/I18n.h"
#include "minecraft/stats/Achievement.h"
#include "minecraft/SharedConstants.h"
#include "platform/renderer/renderer.h"
#include "platform/stubs.h"

View file

@ -218,8 +218,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
arm1->zRot = 0.0f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_ArmsOutFront)) {
arm0->xRot = -M_PI_2;
arm1->xRot = -M_PI_2;
arm0->xRot = -(std::numbers::pi / 2.0);
arm1->xRot = -(std::numbers::pi / 2.0);
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_SingleArms)) {
@ -256,23 +256,23 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
if (riding) {
if ((uiBitmaskOverrideAnim & (1 << eAnim_SmallModel)) == 0) {
arm0->xRot += -M_PI_2 * 0.4f;
arm1->xRot += -M_PI_2 * 0.4f;
leg0->xRot = -M_PI_2 * 0.8f;
leg1->xRot = -M_PI_2 * 0.8f;
leg0->yRot = M_PI_2 * 0.2f;
leg1->yRot = -M_PI_2 * 0.2f;
arm0->xRot += -(std::numbers::pi / 2.0) * 0.4f;
arm1->xRot += -(std::numbers::pi / 2.0) * 0.4f;
leg0->xRot = -(std::numbers::pi / 2.0) * 0.8f;
leg1->xRot = -(std::numbers::pi / 2.0) * 0.8f;
leg0->yRot = (std::numbers::pi / 2.0) * 0.2f;
leg1->yRot = -(std::numbers::pi / 2.0) * 0.2f;
} else {
arm0->xRot += -M_PI_2 * 0.4f;
arm1->xRot += -M_PI_2 * 0.4f;
leg0->xRot = -M_PI_2 * 0.4f;
leg1->xRot = -M_PI_2 * 0.4f;
arm0->xRot += -(std::numbers::pi / 2.0) * 0.4f;
arm1->xRot += -(std::numbers::pi / 2.0) * 0.4f;
leg0->xRot = -(std::numbers::pi / 2.0) * 0.4f;
leg1->xRot = -(std::numbers::pi / 2.0) * 0.4f;
}
} else if (idle && !sneaking) {
leg0->xRot = -M_PI_2;
leg1->xRot = -M_PI_2;
leg0->yRot = M_PI_2 * 0.2f;
leg1->yRot = -M_PI_2 * 0.2f;
leg0->xRot = -(std::numbers::pi / 2.0);
leg1->xRot = -(std::numbers::pi / 2.0);
leg0->yRot = (std::numbers::pi / 2.0) * 0.2f;
leg1->yRot = -(std::numbers::pi / 2.0) * 0.2f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_NoLegAnim)) {
leg0->xRot = 0.0f;
leg0->zRot = 0.0f;
@ -289,10 +289,10 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
}
if (holdingLeftHand != 0) {
arm1->xRot = arm1->xRot * 0.5f - M_PI_2 * 0.2f * holdingLeftHand;
arm1->xRot = arm1->xRot * 0.5f - (std::numbers::pi / 2.0) * 0.2f * holdingLeftHand;
}
if (holdingRightHand != 0) {
arm0->xRot = arm0->xRot * 0.5f - M_PI_2 * 0.2f * holdingRightHand;
arm0->xRot = arm0->xRot * 0.5f - (std::numbers::pi / 2.0) * 0.2f * holdingRightHand;
}
arm0->yRot = 0.0f;
@ -425,8 +425,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
arm1->zRot = 0.0f;
arm0->yRot = -(0.1f - attack2 * 0.6f) + head->yRot;
arm1->yRot = +(0.1f - attack2 * 0.6f) + head->yRot + 0.4f;
arm0->xRot = -M_PI_2 + head->xRot;
arm1->xRot = -M_PI_2 + head->xRot;
arm0->xRot = -(std::numbers::pi / 2.0) + head->xRot;
arm1->xRot = -(std::numbers::pi / 2.0) + head->xRot;
arm0->xRot -= attack2 * 1.2f - attack * 0.4f;
arm1->xRot -= attack2 * 1.2f - attack * 0.4f;
arm0->zRot += ((float)(cosf(bob * 0.09f)) * 0.05f + 0.05f);

View file

@ -1354,14 +1354,11 @@ void ConsoleSaveFileSplit::DebugFlushToFile(
char* fileName = new char[XCONTENT_MAX_FILENAME_LENGTH + 1];
auto now_tp = std::chrono::system_clock::now();
std::time_t now_tt = std::chrono::system_clock::to_time_t(now_tp);
std::tm t{};
#if defined(_WIN32)
gmtime_s(&t, &now_tt);
#else
gmtime_r(&now_tt, &t);
#endif
auto now = std::chrono::system_clock::now();
auto dp = std::chrono::floor<std::chrono::days>(now);
std::chrono::year_month_day ymd{dp};
std::chrono::hh_mm_ss hms{
std::chrono::floor<std::chrono::seconds>(now - dp)};
// 14 chars for the digits
// 11 chars for the separators + suffix
@ -1370,10 +1367,14 @@ void ConsoleSaveFileSplit::DebugFlushToFile(
if (m_fileName.length() > XCONTENT_MAX_FILENAME_LENGTH - 25) {
cutFileName = m_fileName.substr(0, XCONTENT_MAX_FILENAME_LENGTH - 25);
}
snprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH + 1,
"\\v%04d-%s%02d.%02d.%02d.%02d.%02d.mcs", VER_PRODUCTBUILD,
cutFileName.c_str(), t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min,
t.tm_sec);
auto result =
std::format("\\v{:04d}-{}{:02d}.{:02d}.{:02d}.{:02d}.{:02d}.mcs",
VER_PRODUCTBUILD, cutFileName, (unsigned)ymd.month(),
(unsigned)ymd.day(), (int)hms.hours().count(),
(int)hms.minutes().count(), (int)hms.seconds().count());
snprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH + 1, "%s", result.c_str());
const std::string outputPath =
targetFileDir.getPath() + std::string(fileName);

View file

@ -257,6 +257,11 @@
#define GL_TRIANGLE_STRIP 0x0005
#endif
#ifndef GL_RESCALE_NORMAL
#define GL_RESCALE_NORMAL 0x803A
#endif
// glCallList / display list macros
#undef glNewList
#define glNewList(_list, _mode) PlatformRenderer.CBuffStart(_list)

View file

@ -3,7 +3,6 @@
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <print>
#include <source_location>
#include <string_view>