Function at 0x1001e1c0
Capabilities:
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x150
mov ecx, dword [sym.alleg40.dll__gfx_mode_set_count]
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
xor esi, esi
xor edi, edi
inc ecx
cmp ebx, 1
mov dword [ebp - 0xc], esi
mov dword [ebp - 8], esi
mov dword [ebp - 0x10], edi
mov dword [sym.alleg40.dll__gfx_mode_set_count], ecx
je 0x1001e1f7
cmp ebx, 2
jne 0x1001e3e2
xor eax, eax
cmp ebx, 2
setne al
dec eax
xor ebx, ebx
mov edi, eax
mov dword [ebp - 8], 0xffffffff
mov dword [ebp - 0x10], edi
mov dword [ebp + 8], ebx
cmp dword [0x100779b0], esi
je 0x1001e23a
mov eax, dword [sym.alleg40.dll_system_driver]
mov eax, dword [eax + 0x34]
cmp eax, esi
je 0x1001e227
call eax
push 0x1001e880
call sym.alleg40.dll__add_exit_func
add esp, 4
mov dword [0x100779b0], esi
mov ecx, dword [sym.alleg40.dll_system_driver]
mov eax, dword [ecx + 0x68]
cmp eax, esi
je 0x1001e250
push 0xffffffffffffffff
push 0xffffffffffffffff
call eax
add esp, 8
push esi
call sym.alleg40.dll_timer_simulate_retrace
mov eax, dword [sym.alleg40.dll_gfx_driver]
add esp, 4
cmp eax, esi
mov dword [sym.alleg40.dll__screen_split_position], esi
je 0x1001e31f
mov eax, dword [sym.alleg40.dll__al_linker_mouse]
cmp eax, esi
je 0x1001e27c
push esi
call dword [eax + 4]
add esp, 4
mov eax, dword [0x1007f2dc]
cmp eax, esi
je 0x1001e29a
mov edx, dword [eax + 0x10]
push edx
call sym.alleg40.dll_destroy_bitmap
mov eax, dword [0x1007f2dc]
add esp, 4
cmp eax, esi
jne 0x1001e285
mov eax, dword [sym.alleg40.dll_screen]
mov dword [ebp - 4], eax
mov edx, dword [ebp - 4]
mov ecx, dword [edx + 0x24]
mov eax, 0
call ecx
mov ecx, dword [sym.alleg40.dll_screen]
mov dword [ebp - 4], ecx
mov edx, dword [ebp - 4]
mov ecx, dword [edx + 0x20]
mov eax, 0
call ecx
mov edx, dword [sym.alleg40.dll_screen]
mov dword [ebp - 4], edx
mov edx, dword [ebp - 4]
mov ecx, dword [edx + 0x1c]
mov ecx, dword [ecx + 8]
call ecx
mov eax, dword [sym.alleg40.dll_gfx_driver]
mov eax, dword [eax + 0x18]
cmp eax, esi
je 0x1001e2ec
push esi
push esi
call eax
add esp, 8
mov ecx, dword [sym.alleg40.dll_gfx_driver]
mov eax, dword [ecx + 0x14]
cmp eax, esi
je 0x1001e305
mov edx, dword [sym.alleg40.dll_screen]
push edx
call eax
add esp, 4
mov eax, dword [sym.alleg40.dll_screen]
push eax
call sym.alleg40.dll_destroy_bitmap
add esp, 4
mov dword [sym.alleg40.dll_gfx_driver], esi
mov dword [sym.alleg40.dll_screen], esi
mov eax, 5
mov ecx, 0x10
mov dword [sym.alleg40.dll__rgb_g_shift_15], eax
mov dword [sym.alleg40.dll__rgb_g_shift_16], eax
mov eax, 8
cmp ebx, 0xffffffff
mov dword [sym.alleg40.dll__rgb_r_shift_15], esi
mov dword [sym.alleg40.dll__rgb_b_shift_15], 0xa
mov dword [sym.alleg40.dll__rgb_r_shift_16], esi
mov dword [sym.alleg40.dll__rgb_b_shift_16], 0xb
mov dword [sym.alleg40.dll__rgb_r_shift_24], esi
mov dword [sym.alleg40.dll__rgb_g_shift_24], eax
mov dword [sym.alleg40.dll__rgb_b_shift_24], ecx
mov dword [sym.alleg40.dll__rgb_r_shift_32], esi
mov dword [sym.alleg40.dll__rgb_g_shift_32], eax
mov dword [sym.alleg40.dll__rgb_b_shift_32], ecx
mov dword [sym.alleg40.dll__rgb_a_shift_32], 0x18
mov dword [sym.alleg40.dll_gfx_capabilities], esi
mov dword [sym.alleg40.dll__current_refresh_rate], esi
jne 0x1001e4d4
mov ecx, dword [sym.alleg40.dll_system_driver]
mov eax, dword [ecx + 0x38]
cmp eax, esi
je 0x1001e3a8
call eax
mov eax, dword [sym.alleg40.dll__gfx_bank]
cmp eax, esi
je 0x1001e3c1
push eax
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
mov dword [sym.alleg40.dll__gfx_bank], esi
mov edx, dword [sym.alleg40.dll_system_driver]
mov eax, dword [edx + 0x68]
cmp eax, esi
je 0x1001e86b
push esi
push esi
call eax
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp ebx, 0x53414645
jne 0x1001e211
push sym.alleg40.dll_allegro_error
lea ecx, [ebp - 0x150]
push 0x100
push ecx
mov dword [sym.alleg40.dll__safe_gfx_mode_change], 1
call sym.alleg40.dll_ustrzcpy
mov edx, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
push esi
push esi
push edx
push eax
push esi
call sym.alleg40.dll_set_gfx_mode
add esp, 0x20
test eax, eax
je 0x1001e4ac
push 8
call sym.alleg40.dll_set_color_depth
push esi
push esi
push 0x1e0
push 0x280
push 0x44585341
mov dword [0x10077ce8], esi
mov dword [sym.alleg40.dll__safe_gfx_mode_change], esi
call sym.alleg40.dll_set_gfx_mode
add esp, 0x18
test eax, eax
je 0x1001e4a2
push esi
push esi
push esi
push esi
push 0xffffffffffffffff
call sym.alleg40.dll_set_gfx_mode
push str.Fatal_error:_unable_to_set_GFX_SAFE
call sym.alleg40.dll_get_config_text
add esp, 0x18
lea ecx, [ebp - 0x50]
push eax
push 0x40
push 0x6375722e
push ecx
push 0x41534338
push 0x10077d10
call sym.alleg40.dll_uconvert
add esp, 0x14
push eax
call sym.alleg40.dll_allegro_message
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov dword [0x10077ce8], 0xffffffff
lea edx, [ebp - 0x150]
push edx
push 0x100
push sym.alleg40.dll_allegro_error
call sym.alleg40.dll_ustrzcpy
add esp, 0xc
mov dword [sym.alleg40.dll__safe_gfx_mode_change], esi
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [sym.alleg40.dll_system_driver]
mov eax, dword [eax + 0x78]
cmp eax, esi
je 0x1001e4e6
call eax
mov esi, eax
jmp 0x1001e4eb
mov esi, sym.alleg40.dll__gfx_driver_list
push 0
push sym.alleg40.dll_allegro_error
call dword [sym.alleg40.dll_usetc]
add esp, 8
test ebx, ebx
mov ebx, dword [ebp + 0x18]
jne 0x1001e5b9
mov eax, dword [0x10077ce8]
test eax, eax
je 0x1001e5b9
test edi, edi
je 0x1001e555
mov ecx, dword [ebp + 0x14]
mov edx, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
push ebx
push ecx
mov ecx, dword [ebp - 8]
push edx
push eax
push 0
push esi
push edi
push ecx
push 0x40
lea edx, [ebp - 0x50]
push 0x6375722e
push edx
push 0x41534338
push str.gfx_cardw
call sym.alleg40.dll_uconvert
add esp, 0x14
push eax
call fcn.1001e8d0
add esp, 0x24
mov dword [ebp - 0xc], eax
mov eax, dword [0x10077ce8]
mov ecx, dword [sym.alleg40.dll_gfx_driver]
test eax, eax
je 0x1001e5ac
test ecx, ecx
jne 0x1001e5ac
mov eax, dword [ebp + 0x14]
mov ecx, dword [ebp + 0x10]
mov edx, dword [ebp + 0xc]
push ebx
push eax
mov eax, dword [ebp - 8]
push ecx
push edx
push 0
push esi
push edi
push eax
push 0x40
lea ecx, [ebp - 0x50]
push 0x6375722e
push ecx
push 0x41534338
push str.gfx_card
call sym.alleg40.dll_uconvert
add esp, 0x14
push eax
call fcn.1001e8d0
mov ecx, dword [sym.alleg40.dll_gfx_driver]
add esp, 0x24
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
test eax, eax
jne 0x1001e6df
jmp 0x1001e5bf
mov ecx, dword [sym.alleg40.dll_gfx_driver]
mov eax, dword [esi + 4]
xor edx, edx
test eax, eax
je 0x1001e5f1
mov ebx, dword [ebp + 8]
mov edi, esi
mov eax, esi
cmp dword [edi], ebx
je 0x1001e5e1
add eax, 0xc
inc edx
mov edi, eax
cmp dword [eax + 4], 0
jne 0x1001e5cf
jmp 0x1001e5ee
lea edx, [edx + edx*2]
mov ecx, dword [esi + edx*4 + 4]
mov dword [sym.alleg40.dll_gfx_driver], ecx
mov ebx, dword [ebp + 0x18]
test ecx, ecx
je 0x1001e641
mov eax, dword [ecx + 0xc]
push eax
call sym.alleg40.dll_get_config_text
mov ecx, dword [sym.alleg40.dll_gfx_driver]
mov dword [ecx + 8], eax
mov eax, dword [sym.alleg40.dll_gfx_driver]
mov ecx, dword [ebp + 0x14]
mov edx, dword [eax + 8]
mov dword [eax + 4], edx
mov eax, dword [sym.alleg40.dll__color_depth]
mov edx, dword [ebp + 0x10]
push eax
mov eax, dword [ebp + 0xc]
push ebx
push ecx
mov ecx, dword [sym.alleg40.dll_gfx_driver]
push edx
push eax
call dword [ecx + 0x10]
mov ecx, dword [sym.alleg40.dll_gfx_driver]
add esp, 0x18
mov dword [sym.alleg40.dll_screen], eax
jmp 0x1001e6e4
mov eax, dword [esi + 4]
lea edi, [esi + 4]
test eax, eax
je 0x1001e6df
mov eax, dword [sym.alleg40.dll_screen]
mov edx, dword [esi + 8]
test edx, edx
je 0x1001e6cc
mov edx, dword [ebp - 8]
mov ecx, dword [edi]
test edx, edx
mov dword [sym.alleg40.dll_gfx_driver], ecx
je 0x1001e681
mov edx, dword [ebp - 0x10]
test edx, edx
mov edx, dword [ecx + 0x84]
je 0x1001e67d
test edx, edx
je 0x1001e6cc
jmp 0x1001e681
test edx, edx
jne 0x1001e6cc
mov edx, dword [ecx + 0xc]
push edx
call sym.alleg40.dll_get_config_text
mov ecx, dword [sym.alleg40.dll_gfx_driver]
mov dword [ecx + 8], eax
mov eax, dword [sym.alleg40.dll_gfx_driver]
mov ecx, dword [ebp + 0x14]
mov edx, dword [eax + 8]
mov dword [eax + 4], edx
mov eax, dword [sym.alleg40.dll__color_depth]
mov edx, dword [ebp + 0x10]
push eax
mov eax, dword [ebp + 0xc]
push ebx
push ecx
mov ecx, dword [sym.alleg40.dll_gfx_driver]
push edx
push eax
call dword [ecx + 0x10]
mov ecx, dword [sym.alleg40.dll_gfx_driver]
add esp, 0x18
test eax, eax
mov dword [sym.alleg40.dll_screen], eax
jne 0x1001e743
mov edx, dword [edi + 0xc]
add edi, 0xc
test edx, edx
lea esi, [edi - 4]
jne 0x1001e654
jmp 0x1001e6e4
mov eax, dword [sym.alleg40.dll_screen]
test eax, eax
jne 0x1001e743
xor esi, esi
push sym.alleg40.dll_allegro_error
mov dword [sym.alleg40.dll_gfx_driver], esi
mov dword [sym.alleg40.dll_screen], esi
call dword [sym.alleg40.dll_ugetc]
add esp, 4
test eax, eax
jne 0x1001e725
push str.Unable_to_find_a_suitable_graphics_driver
call sym.alleg40.dll_get_config_text
push eax
push 0x100
push sym.alleg40.dll_allegro_error
call sym.alleg40.dll_ustrzcpy
add esp, 0x10
mov edx, dword [sym.alleg40.dll_system_driver]
mov eax, dword [edx + 0x68]
cmp eax, esi
je 0x1001e739
push esi
push esi
call eax
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov esi, dword [eax]
test ecx, ecx
je 0x1001e74e
mov edx, dword [ecx + 0x68]
jmp 0x1001e750
xor edx, edx
cmp esi, edx
jg 0x1001e76e
test eax, eax
je 0x1001e75d
mov eax, dword [eax + 4]
jmp 0x1001e75f
xor eax, eax
test ecx, ecx
je 0x1001e768
mov edx, dword [ecx + 0x6c]
jmp 0x1001e76a
xor edx, edx
cmp eax, edx
jle 0x1001e79b
mov eax, dword [ecx + 0x18]
test eax, eax
je 0x1001e781
mov eax, dword [sym.alleg40.dll_gfx_capabilities]
or al, 1
mov dword [sym.alleg40.dll_gfx_capabilities], eax
mov eax, dword [ecx + 0x24]
test eax, eax
jne 0x1001e78f
mov eax, dword [ecx + 0x3c]
test eax, eax
je 0x1001e79b
mov eax, dword [sym.alleg40.dll_gfx_capabilities]
or al, 2
mov dword [sym.alleg40.dll_gfx_capabilities], eax
xor ecx, ecx
mov eax, sym.alleg40.dll__palette_color8
mov dword [eax], ecx
add eax, 4
inc ecx
cmp eax, sym.alleg40.dll__prev_current_palette
jl 0x1001e7a2
push sym.alleg40.dll_default_palette
call sym.alleg40.dll_set_palette
mov ecx, dword [sym.alleg40.dll__color_depth]
mov eax, 8
add esp, 4
cmp ecx, eax
jne 0x1001e7e6
mov dword [sym.alleg40.dll_gui_fg_color], 0xff
mov dword [sym.alleg40.dll_gui_mg_color], eax
mov dword [sym.alleg40.dll_gui_bg_color], 0
jmp 0x1001e82b
push 0
push 0
push 0
call sym.alleg40.dll_makecol
push 0x80
push 0x80
push 0x80
mov dword [sym.alleg40.dll_gui_fg_color], eax
call sym.alleg40.dll_makecol
push 0xff
push 0xff
push 0xff
mov dword [sym.alleg40.dll_gui_mg_color], eax
call sym.alleg40.dll_makecol
add esp, 0x24
mov dword [sym.alleg40.dll_gui_bg_color], eax
mov eax, dword [sym.alleg40.dll_screen]
push eax
call sym.alleg40.dll_clear_bitmap
mov eax, dword [sym.alleg40.dll__al_linker_mouse]
add esp, 4
test eax, eax
je 0x1001e844
call dword [eax]
mov ecx, dword [sym.alleg40.dll_screen]
push 0
push ecx
call sym.alleg40.dll__register_switch_bitmap
mov edx, dword [sym.alleg40.dll_system_driver]
add esp, 8
mov eax, dword [edx + 0x68]
test eax, eax
je 0x1001e86b
push 0
push 0
call eax
add esp, 8
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret