Skip to content

Commit c6cecd4

Browse files
committed
all: Enforce weak / global functions
1 parent be37f62 commit c6cecd4

10 files changed

Lines changed: 735 additions & 189 deletions

File tree

include/devenv/seadFontMgr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class UniformBlockBuffer
3434
class FontBase
3535
{
3636
public:
37-
virtual ~FontBase();
37+
virtual ~FontBase() = default;
3838

3939
virtual float getHeight() const = 0;
4040
virtual float getWidth() const = 0;

include/gfx/seadFrameBuffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class LogicalFrameBuffer
3131
mPhysicalArea(physical_x, physical_y, physical_x + physical_w, physical_y + physical_h)
3232
{
3333
}
34-
virtual ~LogicalFrameBuffer();
34+
virtual ~LogicalFrameBuffer() = default;
3535

3636
const Vector2f& getVirtualSize() const { return mVirtualSize; }
3737
const BoundBox2f& getPhysicalArea() const { return mPhysicalArea; }

include/gfx/seadProjection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Projection
2121

2222
public:
2323
Projection();
24-
virtual ~Projection() = default;
24+
virtual ~Projection();
2525

2626
virtual f32 getNear() const = 0;
2727
virtual f32 getFar() const = 0;
@@ -72,7 +72,7 @@ class PerspectiveProjection : public Projection
7272
public:
7373
PerspectiveProjection();
7474
PerspectiveProjection(f32 near, f32 far, f32 fovy_rad, f32 aspect);
75-
~PerspectiveProjection() override;
75+
~PerspectiveProjection() override = default;
7676

7777
f32 getNear() const override;
7878
f32 getFar() const override;

include/resource/seadResource.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class IndirectResource : public Resource
5858

5959
public:
6060
IndirectResource();
61+
~IndirectResource() override;
6162

6263
void create(sead::ReadStream* stream, u32 size, sead::Heap* heap);
6364

modules/src/devenv/seadFontMgr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
namespace sead
44
{
5-
FontBase::~FontBase() = default;
65
} // namespace sead

modules/src/gfx/seadFrameBuffer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace sead
44
{
5-
LogicalFrameBuffer::~LogicalFrameBuffer() = default;
6-
75
FrameBuffer::~FrameBuffer() = default;
86

97
void FrameBuffer::clearMRT(DrawContext*, u32, const Color4f&) const {}

modules/src/gfx/seadProjection.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Projection::Projection()
1212
mDeviceZOffset = Graphics::sDefaultDeviceZOffset;
1313
}
1414

15+
Projection::~Projection() = default;
16+
1517
void Projection::updateAttributesForDirectProjection() {}
1618

1719
const Matrix44f& Projection::getProjectionMatrix() const

modules/src/math/seadMathCalcCommon.cpp

Lines changed: 78 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,58 @@ const MathCalcCommon<f32>::LogSample MathCalcCommon<f32>::cLogTbl[256 + 1]{
609609
{0.6931471824645996, 0.0019512200960889459},
610610
};
611611

612-
template <typename T>
613-
T MathCalcCommon<T>::gcd(T x, T y)
612+
template <>
613+
s32 MathCalcCommon<s32>::gcd(s32 x, s32 y)
614+
{
615+
if (x == 0 || y == 0)
616+
return 0;
617+
618+
while (x != y)
619+
{
620+
if (x > y)
621+
x -= y;
622+
else
623+
y -= x;
624+
}
625+
626+
return x;
627+
}
628+
629+
template <>
630+
s32 MathCalcCommon<s32>::lcm(s32 x, s32 y)
631+
{
632+
if (x == 0 || y == 0)
633+
return 0;
634+
return x / gcd(x, y) * y;
635+
}
636+
637+
template <>
638+
u32 MathCalcCommon<u32>::gcd(u32 x, u32 y)
639+
{
640+
if (x == 0 || y == 0)
641+
return 0;
642+
643+
while (x != y)
644+
{
645+
if (x > y)
646+
x -= y;
647+
else
648+
y -= x;
649+
}
650+
651+
return x;
652+
}
653+
654+
template <>
655+
u32 MathCalcCommon<u32>::lcm(u32 x, u32 y)
656+
{
657+
if (x == 0 || y == 0)
658+
return 0;
659+
return x / gcd(x, y) * y;
660+
}
661+
662+
template <>
663+
s64 MathCalcCommon<s64>::gcd(s64 x, s64 y)
614664
{
615665
if (x == 0 || y == 0)
616666
return 0;
@@ -626,18 +676,38 @@ T MathCalcCommon<T>::gcd(T x, T y)
626676
return x;
627677
}
628678

629-
template <typename T>
630-
T MathCalcCommon<T>::lcm(T x, T y)
679+
template <>
680+
s64 MathCalcCommon<s64>::lcm(s64 x, s64 y)
631681
{
632682
if (x == 0 || y == 0)
633683
return 0;
634684
return x / gcd(x, y) * y;
635685
}
636686

637-
template s32 MathCalcCommon<s32>::gcd(s32 x, s32 y);
638-
template s32 MathCalcCommon<s32>::lcm(s32 x, s32 y);
639-
template u32 MathCalcCommon<u32>::gcd(u32 x, u32 y);
640-
template u32 MathCalcCommon<u32>::lcm(u32 x, u32 y);
687+
template <>
688+
u64 MathCalcCommon<u64>::gcd(u64 x, u64 y)
689+
{
690+
if (x == 0 || y == 0)
691+
return 0;
692+
693+
while (x != y)
694+
{
695+
if (x > y)
696+
x -= y;
697+
else
698+
y -= x;
699+
}
700+
701+
return x;
702+
}
703+
704+
template <>
705+
u64 MathCalcCommon<u64>::lcm(u64 x, u64 y)
706+
{
707+
if (x == 0 || y == 0)
708+
return 0;
709+
return x / gcd(x, y) * y;
710+
}
641711

642712
template <>
643713
u32 MathCalcCommon<f32>::atanIdx_(f32 t)

0 commit comments

Comments
 (0)