summaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2021-05-10 19:38:02 +0800
committerIru Cai <mytbk920423@gmail.com>2021-05-10 19:56:04 +0800
commit05bfcbae9cbe9db4797ef2703c4d37f511608fe6 (patch)
tree933dbc0d8c74f313c5af665d627fa54b2f4736d3 /asm
parent30d1c31bf84a20d2144dcd2fe5c615f759f21dc4 (diff)
downloadrich4-05bfcbae9cbe9db4797ef2703c4d37f511608fe6.tar.xz
replace get_local_time function
Diffstat (limited to 'asm')
-rw-r--r--asm/Makefile10
-rw-r--r--asm/rich4.asm33
-rw-r--r--asm/rich4_time.c17
-rw-r--r--asm/rich4_time.h16
4 files changed, 46 insertions, 30 deletions
diff --git a/asm/Makefile b/asm/Makefile
index 17df9dc..410fa8f 100644
--- a/asm/Makefile
+++ b/asm/Makefile
@@ -1,11 +1,17 @@
CROSS=i686-w64-mingw32-
+CC=$(CROSS)gcc
LD=$(CROSS)ld
LDFLAGS=-e fcn_0045709c
LIBS=-lgdi32 -luser32 -lkernel32 -lwinmm -ldsound -lddraw
LIBS+=-lmsvcrt
-%.exe: %.obj
- $(LD) -o $@ $< $(LDFLAGS) $(LIBS)
+OBJS = rich4.obj rich4_time.obj
+
+rich4.exe: $(OBJS)
+ $(LD) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
%.obj: %.asm
nasm -f win32 $<
+
+%.obj: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
diff --git a/asm/rich4.asm b/asm/rich4.asm
index 209004d..8594823 100644
--- a/asm/rich4.asm
+++ b/asm/rich4.asm
@@ -130,6 +130,8 @@ extern _memcpy
extern _strlen
extern _memcmp
+extern _get_local_time
+
section .text
db 0xcc
db 0xeb
@@ -22525,7 +22527,7 @@ cmp ebx, 3
jl short loc_00411a01 ; jl 0x411a01
mov eax, esp
push eax
-call fcn_00458331 ; call 0x458331
+call _get_local_time ; call 0x458331
add esp, 4
xor eax, eax
mov ax, word [esp + 2]
@@ -22573,7 +22575,7 @@ fcn_00411aa3:
sub esp, 8
mov eax, esp
push eax
-call fcn_00458331 ; call 0x458331
+call _get_local_time ; call 0x458331
add esp, 4
xor eax, eax
mov ax, word [esp + 2]
@@ -22970,7 +22972,7 @@ add esp, 0xc
loc_00411f1e:
mov eax, esp
push eax
-call fcn_00458331 ; call 0x458331
+call _get_local_time ; call 0x458331
add esp, 4
mov edx, dword [esp + 2]
cmp dx, 0x7ce
@@ -118700,31 +118702,6 @@ pop edi
pop esi
ret
-fcn_00458331:
-push ebx
-sub esp, 0x10
-mov ebx, dword [esp + 0x18]
-mov eax, esp
-push eax
-call dword [cs:__imp__GetLocalTime@4] ; ucall: call dword cs:[0x4623b0]
-mov al, byte [esp + 6]
-mov byte [ebx], al
-mov al, byte [esp + 2]
-mov byte [ebx + 1], al
-mov eax, dword [esp]
-mov word [ebx + 2], ax
-mov al, byte [esp + 4]
-mov byte [ebx + 4], al
-add esp, 0x10
-pop ebx
-ret
-
-endloc_00458363:
-db 0x00
-dd 0x00000000
-dd 0x00000000
-dd 0x00000000
-
fcn_00458370:
push edx
mov eax, dword [esp + 8]
diff --git a/asm/rich4_time.c b/asm/rich4_time.c
new file mode 100644
index 0000000..fafac33
--- /dev/null
+++ b/asm/rich4_time.c
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2018 Iru Cai <mytbk920423@gmail.com>
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include <windows.h>
+#include "rich4_time.h"
+
+void get_local_time(rich4_time *t)
+{
+ SYSTEMTIME st;
+ GetLocalTime(&st);
+ t->day = st.wDay;
+ t->month = st.wMonth;
+ t->year = st.wYear;
+ t->dayofweek = st.wDayOfWeek;
+}
diff --git a/asm/rich4_time.h b/asm/rich4_time.h
new file mode 100644
index 0000000..0f88d28
--- /dev/null
+++ b/asm/rich4_time.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2018 Iru Cai <mytbk920423@gmail.com>
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include <stdint.h>
+
+typedef struct
+{
+ uint8_t day;
+ uint8_t month;
+ uint16_t year;
+ uint16_t dayofweek;
+} rich4_time;
+
+void get_local_time(rich4_time *t);