Function at 0x405d40
Capabilities:
Check if file exists
Create directory
Get file attributes
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff0
sub esp, 0x878
mov eax, dword [0x473004]
xor eax, esp
mov dword [esp + 0x874], eax
mov eax, dword [0x475124]
push esi
push edi
push 0x475140
mov edi, dword [eax + 0xb8]
add edi, eax
lea eax, [esp + 0x47c]
push str._stextures_
push 0x400
push eax
mov dword [esp + 0x20], edi
call fcn.004071e0
mov esi, eax
add esp, 0x10
cmp esi, 0xffffffff
je 0x4061be
lea eax, [esp + 0x478]
push eax
call fcn.0043594b
add esp, 4
cmp eax, 0xffffffff
jne 0x405dd9
call fcn.00435613
cmp dword [eax], 0x11
jne 0x4061be
lea eax, [esp + 0x478]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x4061be
test al, 0x10
je 0x4061be
mov eax, dword [0x475124]
mov edx, 0x400
sub edx, esi
mov dword [esp + 0x1c], 0
mov dword [esp + 0x18], edx
cmp dword [eax + 0xb4], 0
jle 0x4061d3
lea eax, [esp + 0x478]
add eax, esi
mov dword [esp + 0x14], eax
nop dword [eax + eax]
test eax, eax
je 0x405e65
test edi, edi
je 0x405e65
test edx, edx
je 0x405e65
mov esi, edi
lea ecx, [esi + 1]
mov al, byte [esi]
inc esi
test al, al
jne 0x405e21
sub esi, ecx
lea eax, [esi + 1]
cmp eax, edx
jbe 0x405e51
lea eax, [edx - 1]
push eax
push edi
push dword [esp + 0x1c]
call fcn.00415ed0
mov edx, dword [esp + 0x24]
add esp, 0xc
mov eax, dword [esp + 0x14]
mov byte [eax + edx - 1], 0
jmp 0x405e67
push eax
push edi
push dword [esp + 0x1c]
call fcn.00415ed0
mov edx, dword [esp + 0x24]
add esp, 0xc
jmp 0x405e67
xor esi, esi
mov eax, edx
sub eax, esi
js 0x4061b6
lea eax, [esp + 0x478]
push 0x46d938
push eax
call fcn.00434537
mov edi, eax
add esp, 8
mov dword [esp + 0xc], edi
test edi, edi
je 0x406182
mov esi, dword [esp + 0x10]
push 0x2f
push esi
call fcn.0040da60
push 0x5c
push esi
mov dword [esp + 0x18], eax
call fcn.0040da60
mov ecx, eax
add esp, 0x10
mov eax, dword [esp + 8]
test eax, eax
je 0x405ebd
cmp eax, ecx
jae 0x405ec1
mov dword [esp + 8], ecx
push 0x3a
push esi
call fcn.0040da60
mov ecx, eax
add esp, 8
mov eax, dword [esp + 8]
test eax, eax
je 0x405eda
cmp eax, ecx
jae 0x405ede
mov dword [esp + 8], ecx
push 0x2e
push esi
call fcn.0040da60
mov ecx, eax
add esp, 8
test ecx, ecx
je 0x405f07
mov eax, dword [esp + 8]
test eax, eax
je 0x405efb
cmp ecx, eax
jb 0x405f07
lea eax, [ecx + 1]
test eax, eax
jne 0x405f0c
or eax, 0xffffffff
jmp 0x405f1a
mov eax, 0x46d152
push 0x46d964
push eax
call fcn.0043ce43
add esp, 8
mov ecx, dword [esp + 0x10]
xorps xmm0, xmm0
test eax, eax
jne 0x406019
push dword [esp + 0xc]
movzx edi, word [esi + 0x44]
movzx esi, word [esi + 0x48]
mov word [esp + 0x34], ax
mov eax, pe_nt_image_headers32
movaps xmmword [esp + 0x24], xmm0
mov word [esp + 0x29], ax
mov eax, dword [ecx + 0x4c]
add eax, dword [0x475124]
push 1
mov dword [esp + 0x10], eax
lea eax, [esp + 0x28]
push 0x12
push eax
mov word [esp + 0x31], 0x101
mov byte [esp + 0x37], 0x18
mov byte [esp + 0x40], 8
mov word [esp + 0x3c], di
mov word [esp + 0x3e], si
call fcn.004354e4
mov eax, edi
add esp, 0x10
mov edi, dword [esp + 8]
imul eax, esi
movzx esi, word [esp + 0x25]
add eax, edi
test esi, esi
je 0x405fbf
lea edx, [esp + 0x79]
nop word [eax + eax]
movzx ecx, byte [eax]
lea eax, [eax + 3]
mov byte [edx + 1], cl
lea edx, [edx + 3]
movzx ecx, byte [eax - 2]
mov byte [edx - 3], cl
movzx ecx, byte [eax - 1]
mov byte [edx - 4], cl
sub esi, 1
jne 0x405fa0
push dword [esp + 0xc]
lea eax, [esp + 0x7c]
push 1
push 0x300
push eax
call fcn.004354e4
movzx eax, word [esp + 0x3e]
add esp, 0x10
movzx ecx, word [esp + 0x2c]
lea esi, [eax - 1]
imul esi, ecx
add esi, edi
xor edi, edi
test eax, eax
je 0x406123
push dword [esp + 0xc]
push 1
push ecx
push esi
call fcn.004354e4
movzx ecx, word [esp + 0x3c]
inc edi
movzx eax, word [esp + 0x3e]
add esp, 0x10
sub esi, ecx
cmp edi, eax
jl 0x405ff3
jmp 0x406123
mov esi, dword [esi + 0x44]
mov eax, dword [ecx + 0x48]
movlpd qword [esp + 0x52], xmm0
mov dword [esp + 0x52], esi
imul esi, eax
mov dword [esp + 0x56], eax
push edi
push 1
push 0x36
mov dword [esp + 0x52], 0
mov dword [esp + 0x6a], 0
movlpd qword [esp + 0x72], xmm0
lea eax, [esi + 0x436]
mov dword [esp + 0x7e], 0
mov dword [esp + 0x4e], eax
mov eax, dword [ecx + 0x4c]
add eax, dword [0x475124]
mov dword [esp + 0x14], eax
lea eax, [esp + 0x4c]
push eax
mov word [esp + 0x50], 0x4d42
mov dword [esp + 0x6a], 0x80001
mov dword [esp + 0x72], esi
mov dword [esp + 0x7e], pe_nt_image_headers32
mov dword [esp + 0x5a], 0x436
mov dword [esp + 0x5e], 0x28
call fcn.004354e4
mov ecx, dword [esp + 0x18]
add esp, 0x10
add ecx, esi
xor edx, edx
mov esi, dword [esp + 0x6e]
test esi, esi
jle 0x4060d6
movzx eax, byte [ecx]
lea ecx, [ecx + 3]
mov byte [esp + edx*4 + 0x7a], al
movzx eax, byte [ecx - 2]
mov byte [esp + edx*4 + 0x79], al
movzx eax, byte [ecx - 1]
mov byte [esp + edx*4 + 0x78], al
mov byte [esp + edx*4 + 0x7b], 0
inc edx
cmp edx, esi
jl 0x4060b2
push edi
push 1
lea eax, [esp + 0x80]
push 0x400
push eax
call fcn.004354e4
mov eax, dword [esp + 0x66]
add esp, 0x10
mov ecx, dword [esp + 0x52]
xor edi, edi
lea esi, [eax - 1]
imul esi, ecx
add esi, dword [esp + 8]
test eax, eax
jle 0x406123
push dword [esp + 0xc]
push 1
push ecx
push esi
call fcn.004354e4
mov ecx, dword [esp + 0x62]
inc edi
add esp, 0x10
sub esi, ecx
cmp edi, dword [esp + 0x56]
jl 0x406106
push dword [esp + 0xc]
call fcn.004346f6
lea eax, [esp + 0x47c]
push eax
push str.Texture:__s_n
call fcn.00401070
mov eax, dword [0x475124]
add esp, 0xc
mov ecx, dword [esp + 0x1c]
mov edi, dword [esp + 0x10]
inc ecx
mov edx, dword [esp + 0x18]
add edi, 0x50
cmp ecx, dword [eax + 0xb4]
mov eax, dword [esp + 0x14]
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x10], edi
jl 0x405e10
pop edi
pop esi
mov ecx, dword [esp + 0x874]
xor ecx, esp
call fcn.0040c692
mov esp, ebp
pop ebp
ret
lea eax, [esp + 0x478]
push eax
push str.ERROR:_Couldnt_write_texture_file__s_n
push 2
call fcn.00417cab
add esp, 4
push eax
call fcn.00401040
add esp, 0xc
pop edi
pop esi
mov ecx, dword [esp + 0x874]
xor ecx, esp
call fcn.0040c692
mov esp, ebp
pop ebp
ret
push edi
push str.ERROR:_Destination_path_is_too_long._Couldnt_write__s_n
jmp 0x40618f
push 2
call fcn.00417cab
push eax
push str.ERROR:_Destination_path_is_too_long_or_write_permission_denied._Couldnt_create_directory_for_textures_n
call fcn.004339d5
add esp, 0xc
mov ecx, dword [esp + 0x87c]
pop edi
pop esi
xor ecx, esp
call fcn.0040c692
mov esp, ebp
pop ebp
ret