Function at 0x403790
Capabilities:
Check if file exists
Query environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x620
mov eax, dword [0x4fb2a0]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0x5000f0
mov dword [0x5000e8], 0x4d5c58
mov dword [0x5000ec], 0x4d5c48
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov eax, dword [0x4fc44c]
mov edx, dword [eax + 0xc]
xor esi, esi
mov ecx, 0x4fc44c
mov dword [0x500108], esi
mov dword [0x50010c], esi
mov dword [0x500110], esi
call edx
add eax, 0x10
push 0x206
mov dword [0x500118], eax
lea ecx, [ebp - 0x20a]
xor eax, eax
push esi
push ecx
mov dword [0x50011c], 1
mov word [ebp - 0x20c], ax
call fcn.00438200
add esp, 0xc
push 0x104
lea edx, [ebp - 0x20c]
push edx
push esi
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
push eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea eax, [ebp - 0x20c]
lea edx, [eax + 2]
jmp 0x403840
mov cx, word [eax]
add eax, 2
cmp cx, si
jne 0x403840
sub eax, edx
sar eax, 1
mov edx, eax
lea eax, [edx - 1]
mov ecx, 0x5c
lea esp, [esp]
cmp word [ebp + eax*2 - 0x20c], cx
je 0x40386d
dec eax
jmp 0x403860
inc eax
cmp eax, edx
ja 0x403893
lea ecx, [ebp - 0x20c]
jmp 0x403880
mov di, word [ebp + eax*2 - 0x20c]
mov word [ecx], di
inc eax
add ecx, 2
cmp eax, edx
jbe 0x403880
push 0x4d5b04
push esi
call fcn.004301b6
mov eax, dword [0x4fc44c]
mov edx, dword [eax + 0xc]
add esp, 8
mov ecx, 0x4fc44c
call edx
add eax, 0x10
push 0x208
mov dword [ebp - 0x620], eax
lea eax, [ebp - 0x414]
push esi
push eax
call fcn.00438200
add esp, 0xc
push 0x104
lea ecx, [ebp - 0x414]
push ecx
push 0x4d5b08
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
lea edx, [ebp - 0x414]
push edx
push str._sGamePPSdk_app.log.on
lea edi, [ebp - 0x620]
call fcn.00403db0
mov eax, dword [ebp - 0x620]
mov esi, dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
add esp, 8
push eax
call esi
lea ecx, [ebp - 0x414]
push ecx
push str._sGamePPSdk_app.log1.on
mov dword [0x4ffd2c], eax
call fcn.00403db0
mov edx, dword [ebp - 0x620]
add esp, 8
push edx
call esi
mov dword [0x4ffd38], eax
lea eax, [ebp - 0x414]
push eax
push str._sGamePPSdk_app.ext.log.on
call fcn.00403db0
mov ecx, dword [ebp - 0x620]
add esp, 8
push ecx
call esi
lea edx, [ebp - 0x414]
push edx
push str._sGamePPSdk_app.dbg.on
mov dword [0x4ffd30], eax
call fcn.00403db0
mov ebx, dword [ebp - 0x620]
add esp, 8
push ebx
call esi
push 0x208
mov dword [0x4ffd34], eax
lea eax, [ebp - 0x61c]
push 0
push eax
call fcn.00438200
add esp, 0xc
lea ecx, [ebp - 0x620]
push ecx
push 0x403760
push 6
mov dword [ebp - 0x620], 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleExW]
mov eax, dword [ebp - 0x620]
push 0x104
lea edx, [ebp - 0x61c]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.PSAPI.DLL_GetModuleBaseNameW]
call dword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
push eax
lea ecx, [ebp - 0x61c]
push ecx
lea edx, [ebp - 0x20c]
push edx
lea eax, [ebp - 0x414]
push eax
push str._sGamePPSdkLogs_s__s__d.log
mov edi, 0x500118
call fcn.00403db0
lea eax, [ebx - 0x10]
add esp, 0x14
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
pop edi
pop esi
pop ebx
test edx, edx
jg 0x403a1a
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov ecx, dword [ebp - 4]
xor ecx, ebp
mov eax, 0x5000e8
call fcn.0042e217
mov esp, ebp
pop ebp
ret