feat: display_message_str
This commit is contained in:
parent
264618fe3b
commit
ab3db879d2
@ -47,6 +47,23 @@ pub fn display_message<'a>(start: Dot, color: Color, text: &'a CStr, bg_color: O
|
||||
start.x << 16 | start.y,
|
||||
color.as_rgb_val() | BG_FLAG * bg_color.is_some() as u32 | UTF8_FLAG | ASCIIZ_FLAG,
|
||||
text.as_ptr() as u32,
|
||||
0,
|
||||
bg_color.unwrap_or(Color(0, 0, 0)).as_rgb_val(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn display_message_str<'a>(start: Dot, color: Color, text: &'a str, bg_color: Option<Color>) {
|
||||
// XX=ABFFCSSS
|
||||
const UTF8_FLAG: u32 = (3 << 4) << 24; // FF
|
||||
const BG_FLAG: u32 = (1 << 6) << 24; // B
|
||||
|
||||
unsafe {
|
||||
sys::display_message(
|
||||
start.x << 16 | start.y,
|
||||
color.as_rgb_val() | BG_FLAG * bg_color.is_some() as u32 | UTF8_FLAG,
|
||||
text.as_ptr() as u32,
|
||||
text.len() as u32,
|
||||
bg_color.unwrap_or(Color(0, 0, 0)).as_rgb_val(),
|
||||
);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
// 4
|
||||
#[link_name = "_display_message"]
|
||||
pub fn display_message(ebx: u32, ecx: u32, edx: u32, edi: u32);
|
||||
pub fn display_message(ebx: u32, ecx: u32, edx: u32, esi: u32, edi: u32);
|
||||
|
||||
// 8
|
||||
#[link_name = "_define_button"]
|
||||
|
@ -55,7 +55,8 @@ _display_message:
|
||||
mov ebx, dword [esp + 4 * 3]
|
||||
mov ecx, dword [esp + 4 * 4]
|
||||
mov edx, dword [esp + 4 * 5]
|
||||
mov edi, dword [esp + 4 * 6]
|
||||
mov esi, dword [esp + 4 * 6]
|
||||
mov edi, dword [esp + 4 * 7]
|
||||
int 0x40
|
||||
pop edi esi
|
||||
ret
|
||||
|
Loading…
Reference in New Issue
Block a user