Skip to content

Commit 43113ad

Browse files
committed
fix 3ds build in c++ files, fix some things that differ in 32 bit vs 64 bit environments
1 parent 1112168 commit 43113ad

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

src/application.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void Application::run() {
5252
#ifdef DEBUG_BUILD
5353
auto start_time = SDL_GetPerformanceCounter();
5454
const auto update_time = SDL_GetPerformanceFrequency() / 2; //0.5 s
55-
const double count_per_s = static_cast<double>(SDL_GetPerformanceFrequency());
55+
const auto count_per_s = static_cast<double>(SDL_GetPerformanceFrequency());
5656
u64 frame_counter = 0;
5757
#endif
5858
using namespace std::chrono_literals;

src/graphics/renderer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,5 @@ struct Renderer final {
9393
void present() const;
9494

9595
private:
96-
void draw_self_computed_circle_impl(const shapes::IPoint& center, int diameter) const;
96+
void draw_self_computed_circle_impl(const shapes::IPoint& center, i32 diameter) const;
9797
};

src/graphics/texture.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
#include "texture.hpp"
3+
#include "graphics/point.hpp"
34
#include "helper/graphic_utils.hpp"
45

56

@@ -99,7 +100,7 @@ Texture::~Texture() {
99100
}
100101

101102
[[nodiscard]] shapes::UPoint Texture::size() const {
102-
shapes::IPoint size;
103+
shapes::AbstractPoint<int> size;
103104
const auto result = SDL_QueryTexture(m_raw_texture, nullptr, nullptr, &size.x, &size.y);
104105

105106
if (result < 0) {

src/helper/command_line_arguments.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ struct CommandLineArguments final {
3434
.default_value(default_starting_level);
3535
parser.add_argument("-s", "--silent").help("disable audio output").default_value(false).implicit_value(true);
3636
try {
37-
if (not arguments.empty()) {
38-
parser.parse_args(arguments);
39-
}
37+
parser.parse_args(arguments);
4038

4139

4240
if (auto path = parser.present("--recording")) {

src/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ int main(int argc, char** argv) {
5151
arguments.emplace_back(argv[i]); //NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
5252
}
5353

54+
if (arguments.empty()) {
55+
arguments.emplace_back("oopetris");
56+
}
57+
5458
constexpr auto window_name = constants::program_name.c_str();
5559

5660
std::unique_ptr<Window> window{ nullptr };

src/platform/capabilities.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ namespace {
4141
return "Android";
4242
#elif defined(__SWITCH__)
4343
return "Nintendo Switch";
44+
#elif defined(__3DS__)
45+
return "Nintendo 3DS";
4446
#elif defined(FLATPAK_BUILD)
4547
return "Linux (Flatpak)";
4648
#elif defined(__linux__)
@@ -63,10 +65,9 @@ namespace {
6365
return false;
6466
}
6567

66-
6768
return true;
6869

69-
#elif defined(__SWITCH__)
70+
#elif defined(__SWITCH__) || defined(__3DS__)
7071
UNUSED(url);
7172
return false;
7273
#else

src/thirdparty/hash-library/sha256.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
#define __BYTE_ORDER __BYTE_ORDER__
2121
#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
2222
#endif
23+
#elif defined(__3DS__)
24+
#if !(defined(__BYTE_ORDER__) or defined(__ORDER_BIG_ENDIAN__))
25+
#error "__BYTE_ORDER__ or __ORDER_BIG_ENDIAN__ not defined"!
26+
#else
27+
#define __BYTE_ORDER __BYTE_ORDER__
28+
#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
29+
#endif
2330
#elif defined(__APPLE__)
2431
#include <machine/endian.h>
2532
#else

0 commit comments

Comments
 (0)