Skip to content

Commit b2abd59

Browse files
committed
[ion] Add draw_string trampoline to UserlandHeader (for NWA apps)
1 parent 859317c commit b2abd59

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

build/config.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ DEBUG ?= 0
66
HOME_DISPLAY_EXTERNALS ?= 1
77
EPSILON_VERSION ?= 15.5.0
88
OMEGA_VERSION ?= 2.0.2
9+
OMEGA_VERSION_SHORT ?= 2.0 # 3 chars max, required for compatibility
910
UPSILON_VERSION ?= 1.1.2
1011
# OMEGA_USERNAME ?= N/A
1112
OMEGA_STATE ?= dev

ion/src/device/bootloader/platform_info.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#error This file expects EPSILON_VERSION to be defined
1010
#endif
1111

12+
#ifndef OMEGA_VERSION_SHORT
13+
#error This file expects OMEGA_VERSION_SHORT to be defined
14+
#endif
15+
1216
#ifndef OMEGA_VERSION
1317
#error This file expects OMEGA_VERSION to be defined
1418
#endif
@@ -19,14 +23,19 @@
1923

2024
extern "C" {
2125
extern void recovery_start();
26+
extern void eadk_display_draw_string(const char * text, KDPoint point, bool large_font, KDColor text_color, KDColor background_color);
2227
}
2328
namespace Ion {
2429
extern char staticStorageArea[];
2530
}
2631
constexpr void * storageAddress = &(Ion::staticStorageArea);
32+
2733
typedef void (*recoveryStartPointerType)();
2834
constexpr recoveryStartPointerType recoveryStartPointer = &(recovery_start);
2935

36+
typedef void (*drawStringPointerType)(const char * text, KDPoint point, bool large_font, KDColor text_color, KDColor background_color);
37+
constexpr drawStringPointerType drawStringPointer = &(eadk_display_draw_string);
38+
3039
class KernelHeader {
3140
public:
3241
constexpr KernelHeader() :
@@ -67,7 +76,9 @@ class UserlandHeader {
6776
m_externalAppsRAMEnd(0xFFFFFFFF),
6877
m_footer(Magic),
6978
m_omegaMagicHeader(OmegaMagic),
70-
m_omegaVersion{OMEGA_VERSION},
79+
m_omegaVersion{OMEGA_VERSION_SHORT},
80+
m_drawStringAddress(drawStringPointer),
81+
m_padding{"\0\0\0\0\0\0\0"},
7182
#ifdef OMEGA_USERNAME
7283
m_username{OMEGA_USERNAME},
7384
#else
@@ -136,7 +147,9 @@ class UserlandHeader {
136147
uint32_t m_externalAppsRAMEnd;
137148
uint32_t m_footer;
138149
uint32_t m_omegaMagicHeader;
139-
const char m_omegaVersion[16];
150+
const char m_omegaVersion[4];
151+
drawStringPointerType m_drawStringAddress;
152+
const char m_padding[8];
140153
const volatile char m_username[16];
141154
uint32_t m_omegaMagicFooter;
142155
uint32_t m_upsilonMagicHeader;
@@ -173,8 +186,12 @@ class SlotInfo {
173186

174187
};
175188

189+
const char k_omega_version[16] = {OMEGA_VERSION};
176190
const char * Ion::omegaVersion() {
177-
return k_userlandHeader.omegaVersion();
191+
// return k_userlandHeader.omegaVersion();
192+
// We don't use the UserlandHeader, as for NWA compatibility it can only
193+
// contain the short version
194+
return k_omega_version;
178195
}
179196

180197
const char * Ion::upsilonVersion() {

0 commit comments

Comments
 (0)