forked from ntrteam/flashcart_core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
platform.h
42 lines (34 loc) · 1.4 KB
/
platform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include <cstdint>
#include "ntrcard.h"
namespace flashcart_core {
enum log_priority {
LOG_DEBUG = 0, // Will probably spam logs, only use when debugging.
LOG_INFO, // Reccomended default logfile level
LOG_NOTICE, // Reccomended default display level, if implemented.
LOG_WARN,
LOG_ERR,
LOG_PRIORITY_MAX
};
// override these in platform.cpp
namespace platform {
/// Whether the platform has hardware KEY2 support.
/// If false, flashcart_core will do KEY2 in software. (TODO IMPL)
/// If unset, defaults to false.
extern const bool HAS_HW_KEY2;
/// Whether the platform can reset a cart, whether electronically or by asking
/// the user to physically reinsert the card.
/// If unset, defaults to false.
extern const bool CAN_RESET;
/// The initial encryption status when flashcart_core first gains control.
/// If unset, defaults to RAW.
extern const ntrcard::Status INITIAL_ENCRYPTION;
std::int32_t resetCard();
bool sendCommand(const std::uint8_t *cmdbuf, std::uint16_t response_len, std::uint8_t *resp, ntrcard::OpFlags flags);
void ioDelay(std::uint32_t us);
void initBlowfishPS(std::uint32_t (&ps)[ntrcard::BLOWFISH_PS_N], ntrcard::BlowfishKey key = ntrcard::BlowfishKey::NTR);
void initKey2Seed(std::uint64_t x, std::uint64_t y);
void showProgress(std::uint32_t current, std::uint32_t total, const char* status_string);
int logMessage(log_priority priority, const char *fmt, ...);
}
}