Offset fix

This commit is contained in:
Gleb Zaharov 2023-06-19 00:44:01 +03:00
parent 881e7b2ad3
commit 76ac2daa98
3 changed files with 16 additions and 18 deletions

View File

@ -59,6 +59,7 @@ pub fn define_window(start: Dot, width: u32, height: u32, params: WindowParams<'
start.y * 65536 + height,
params.color.as_rgb_val()
| (RELATIVE_FLAG | (params.title.is_some() as u32) << 4 | params.kind as u32) << 24,
0,
params
.title
.map(|s| s.as_ptr())
@ -82,8 +83,8 @@ pub fn display_message(start: Dot, params: WindowTextParams<'_>) {
start.x * 65536 + start.y,
params.color.as_rgb_val() | BG_FLAG * params.bg_color.is_some() as u32 | UTF8_FLAG,
params.text.as_ptr() as u32,
0,
params.text.len() as u32,
0,
);
}
}

View File

@ -10,9 +10,9 @@ extern "C" {
pub fn exit() -> !;
#[link_name = "_define_window"]
pub fn define_window(ebx: u32, ecx: u32, edx: u32, edi: u32);
pub fn define_window(ebx: u32, ecx: u32, edx: u32, esi: u32, edi: u32);
#[link_name = "_display_message"]
pub fn display_message(ebx: u32, ecx: u32, edx: u32, edi: u32, esi: u32);
pub fn display_message(ebx: u32, ecx: u32, edx: u32, esi: u32, edi: u32);
#[link_name = "_wait_event"]
pub fn wait_event() -> u32;

View File

@ -27,31 +27,28 @@ _end_window_draw:
_define_window:
push edi
push ebx
push esi
xor eax, eax
mov ebx, dword [esp + 0x14]
mov ecx, dword [esp + 0x18]
mov edx, dword [esp + 0x1c]
mov edi, dword [esp + 0x20]
mov ebx, 2
mov ebx, dword [esp + 0x0c]
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x14]
mov esi, dword [esp + 0x18]
mov edi, dword [esp + 0x1c]
int 0x40
pop ebx
pop esi
pop edi
ret
_display_message:
push edi
push esi
push ebx
mov eax, 4
mov ebx, dword [esp + 0x14]
mov ecx, dword [esp + 0x18]
mov edx, dword [esp + 0x1c]
mov esi, dword [esp + 0x20]
mov edi, dword [esp + 0x24]
mov ebx, 2
mov ebx, dword [esp + 0x0c]
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x14]
mov esi, dword [esp + 0x18]
mov edi, dword [esp + 0x1c]
int 0x40
pop ebx
pop esi
pop edi
ret