Skip to content

Commit

Permalink
Format ultramodern
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Jun 1, 2024
1 parent 9c95b2e commit 716f786
Show file tree
Hide file tree
Showing 20 changed files with 461 additions and 454 deletions.
116 changes: 58 additions & 58 deletions ultramodern/include/ultramodern/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,71 @@
#include "common/rt64_user_configuration.h"

namespace ultramodern {
enum class Resolution {
Original,
Original2x,
Auto,
OptionCount
};
enum class WindowMode {
Windowed,
Fullscreen,
OptionCount
};
enum class HUDRatioMode {
Original,
Clamp16x9,
Full,
OptionCount
};
enum class GraphicsApi {
Auto,
D3D12,
Vulkan,
OptionCount
};
enum class Resolution {
Original,
Original2x,
Auto,
OptionCount
};
enum class WindowMode {
Windowed,
Fullscreen,
OptionCount
};
enum class HUDRatioMode {
Original,
Clamp16x9,
Full,
OptionCount
};
enum class GraphicsApi {
Auto,
D3D12,
Vulkan,
OptionCount
};

struct GraphicsConfig {
Resolution res_option;
WindowMode wm_option;
HUDRatioMode hr_option;
GraphicsApi api_option;
// TODO make custom enums that map to the RT64 ones to remove the direct dependency on RT64 in this file.
RT64::UserConfiguration::AspectRatio ar_option;
RT64::UserConfiguration::Antialiasing msaa_option;
RT64::UserConfiguration::RefreshRate rr_option;
int rr_manual_value;
int ds_option;
bool developer_mode;
struct GraphicsConfig {
Resolution res_option;
WindowMode wm_option;
HUDRatioMode hr_option;
GraphicsApi api_option;
// TODO make custom enums that map to the RT64 ones to remove the direct dependency on RT64 in this file.
RT64::UserConfiguration::AspectRatio ar_option;
RT64::UserConfiguration::Antialiasing msaa_option;
RT64::UserConfiguration::RefreshRate rr_option;
int rr_manual_value;
int ds_option;
bool developer_mode;

auto operator<=>(const GraphicsConfig& rhs) const = default;
};
auto operator<=>(const GraphicsConfig& rhs) const = default;
};

void set_graphics_config(const GraphicsConfig& config);
GraphicsConfig get_graphics_config();
void set_graphics_config(const GraphicsConfig& config);
GraphicsConfig get_graphics_config();

NLOHMANN_JSON_SERIALIZE_ENUM(ultramodern::Resolution, {
{ultramodern::Resolution::Original, "Original"},
{ultramodern::Resolution::Original2x, "Original2x"},
{ultramodern::Resolution::Auto, "Auto"},
});
NLOHMANN_JSON_SERIALIZE_ENUM(ultramodern::Resolution, {
{ultramodern::Resolution::Original, "Original"},
{ultramodern::Resolution::Original2x, "Original2x"},
{ultramodern::Resolution::Auto, "Auto"},
});

NLOHMANN_JSON_SERIALIZE_ENUM(ultramodern::WindowMode, {
{ultramodern::WindowMode::Windowed, "Windowed"},
{ultramodern::WindowMode::Fullscreen, "Fullscreen"}
});
NLOHMANN_JSON_SERIALIZE_ENUM(ultramodern::WindowMode, {
{ultramodern::WindowMode::Windowed, "Windowed"},
{ultramodern::WindowMode::Fullscreen, "Fullscreen"}
});

NLOHMANN_JSON_SERIALIZE_ENUM(ultramodern::HUDRatioMode, {
{ultramodern::HUDRatioMode::Original, "Original"},
{ultramodern::HUDRatioMode::Clamp16x9, "Clamp16x9"},
{ultramodern::HUDRatioMode::Full, "Full"},
});
NLOHMANN_JSON_SERIALIZE_ENUM(ultramodern::HUDRatioMode, {
{ultramodern::HUDRatioMode::Original, "Original"},
{ultramodern::HUDRatioMode::Clamp16x9, "Clamp16x9"},
{ultramodern::HUDRatioMode::Full, "Full"},
});

NLOHMANN_JSON_SERIALIZE_ENUM(ultramodern::GraphicsApi, {
{ultramodern::GraphicsApi::Auto, "Auto"},
{ultramodern::GraphicsApi::D3D12, "D3D12"},
{ultramodern::GraphicsApi::Vulkan, "Vulkan"},
});
NLOHMANN_JSON_SERIALIZE_ENUM(ultramodern::GraphicsApi, {
{ultramodern::GraphicsApi::Auto, "Auto"},
{ultramodern::GraphicsApi::D3D12, "D3D12"},
{ultramodern::GraphicsApi::Vulkan, "Vulkan"},
});
};

#endif
6 changes: 3 additions & 3 deletions ultramodern/include/ultramodern/error_handling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ namespace ultramodern {
*
* The `msg` parameter is always non-`nullptr`.
*/
message_box_t *message_box;
message_box_t* message_box;
};

void set_callbacks(const callbacks_t& callbacks);

void message_box(const char* msg);
}
}
} // namespace error_handling
} // namespace ultramodern

#endif
4 changes: 2 additions & 2 deletions ultramodern/include/ultramodern/events.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace ultramodern {
};

void set_callbacks(const callbacks_t& callbacks);
}
}
} // namespace events
} // namespace ultramodern

#endif
2 changes: 1 addition & 1 deletion ultramodern/include/ultramodern/rsp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace ultramodern {

void init();
bool run_task(RDRAM_ARG const OSTask* task);
};
}; // namespace rsp
} // namespace ultramodern

#endif
46 changes: 25 additions & 21 deletions ultramodern/include/ultramodern/rt64_layer.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef __RT64_LAYER_H__
#define __RT64_LAYER_H__

#include "ultramodern.hpp"
#include "config.hpp"
#include "ultramodern.hpp"

namespace RT64 {
struct Application;
Expand All @@ -19,30 +19,34 @@ namespace ultramodern {

struct WindowHandle;
struct RT64Context {
public:
~RT64Context();
RT64Context(uint8_t* rdram, WindowHandle window_handle, bool developer_mode);
bool valid() { return static_cast<bool>(app); }
RT64SetupResult get_setup_result() { return setup_result; }

void update_config(const GraphicsConfig& old_config, const GraphicsConfig& new_config);
void enable_instant_present();
void send_dl(const OSTask* task);
void update_screen(uint32_t vi_origin);
void shutdown();
void set_dummy_vi();
uint32_t get_display_framerate();
void load_shader_cache(std::span<const char> cache_binary);
private:
RT64SetupResult setup_result;
std::unique_ptr<RT64::Application> app;
public:
~RT64Context();
RT64Context(uint8_t* rdram, WindowHandle window_handle, bool developer_mode);
bool valid() {
return static_cast<bool>(app);
}
RT64SetupResult get_setup_result() {
return setup_result;
}

void update_config(const GraphicsConfig& old_config, const GraphicsConfig& new_config);
void enable_instant_present();
void send_dl(const OSTask* task);
void update_screen(uint32_t vi_origin);
void shutdown();
void set_dummy_vi();
uint32_t get_display_framerate();
void load_shader_cache(std::span<const char> cache_binary);

private:
RT64SetupResult setup_result;
std::unique_ptr<RT64::Application> app;
};

RT64::UserConfiguration::Antialiasing RT64MaxMSAA();
bool RT64SamplePositionsSupported();
}
} // namespace ultramodern

void set_rt64_hooks();

#endif

Loading

0 comments on commit 716f786

Please sign in to comment.