.text:0045853C Read_Game_Options proc near ; CODE XREF: Mainmenu_Init:loc_455E87p .text:0045853C .text:0045853C file_obj = dword ptr -48h .text:0045853C var_file__18 = dword ptr -30h .text:0045853C var_file__1C = dword ptr -2Ch .text:0045853C var_file__20 = dword ptr -28h .text:0045853C var_file__24 = dword ptr -24h .text:0045853C var_file__28 = dword ptr -20h .text:0045853C filenm_ptr = dword ptr -1Ch .text:0045853C pushed_ebp = dword ptr -18h .text:0045853C pushed_edi = dword ptr -14h .text:0045853C pushed_esi = dword ptr -10h .text:0045853C pushed_edx = dword ptr -0Ch .text:0045853C pushed_ecx = dword ptr -8 .text:0045853C pushed_ebx = dword ptr -4 .text:0045853C .text:0045853C 000 push ebx .text:0045853D 004 push ecx .text:0045853E 008 push edx .text:0045853F 00C push esi .text:00458540 010 push edi .text:00458541 014 push ebp .text:00458542 018 sub esp, 130h .text:00458548 148 mov [esp+148h+filenm_ptr], eax .text:0045854F 148 mov ecx, 40h .text:00458554 148 mov edi, esp .text:00458556 148 mov esi, offset aInvalid_123 ; "INVALID.123" .text:0045855B 148 rep movsd .text:0045855D 148 test eax, eax .text:0045855F 148 jz short loc_45857F .text:0045855F .text:00458561 148 mov edi, esp .text:00458563 148 mov esi, eax .text:00458565 148 push edi .text:00458565 .text:00458566 .text:00458566 loc_458566: ; CODE XREF: Read_Game_Options+40j .text:00458566 14C mov al, [esi] .text:00458568 14C mov [edi], al .text:0045856A 14C cmp al, 0 .text:0045856C 14C jz short loc_45857E .text:0045856C .text:0045856E 14C mov al, [esi+1] .text:00458571 14C add esi, 2 .text:00458574 14C mov [edi+1], al .text:00458577 14C add edi, 2 .text:0045857A 14C cmp al, 0 .text:0045857C 14C jnz short loc_458566 .text:0045857C .text:0045857E .text:0045857E loc_45857E: ; CODE XREF: Read_Game_Options+30j .text:0045857E 14C pop edi .text:0045857E .text:0045857F .text:0045857F loc_45857F: ; CODE XREF: Read_Game_Options+23j .text:0045857F 148 mov edx, esp .text:00458581 148 lea eax, [esp+148h+file_obj] .text:00458588 148 mov ebx, [esp+148h+filenm_ptr] .text:0045858F 148 call CCFileClass::CCFileClass(char *) .text:0045858F .text:00458594 148 test ebx, ebx .text:00458596 148 jz short loc_4585FC .text:00458596 .text:00458598 148 lea eax, [esp+148h+file_obj] .text:0045859F 148 xor edx, edx .text:004585A1 148 call CCFileClass_FileExists .text:004585A1 .text:004585A6 148 test eax, eax .text:004585A8 148 jnz short loc_4585FC .text:004585A8 .text:004585AA 148 mov edx, 1 .text:004585AF 148 mov esi, offset vt_FileClass .text:004585B4 148 mov ah, [esp+110h] .text:004585BB 148 xor ecx, ecx .text:004585BD 148 xor ebx, ebx .text:004585BF 148 mov [esp+148h+file_obj], esi .text:004585C6 148 test ah, 1 .text:004585C9 148 jz short loc_4585DD .text:004585C9 .text:004585CB 148 mov edi, [esp+10Ch] .text:004585D2 148 test edi, edi .text:004585D4 148 jz short loc_4585DD .text:004585D4 .text:004585D6 148 mov eax, edi .text:004585D8 148 call _nfree_ .text:004585D8 .text:004585DD .text:004585DD loc_4585DD: ; CODE XREF: Read_Game_Options+8Dj .text:004585DD ; Read_Game_Options+98j .text:004585DD 148 test dl, 2 .text:004585E0 148 jz short loc_4585EE .text:004585E0 .text:004585E2 148 lea eax, [esp+148h+file_obj] .text:004585E9 148 call Delete_Scrap_Memory .text:004585E9 .text:004585EE .text:004585EE loc_4585EE: ; CODE XREF: Read_Game_Options+A4j .text:004585EE 148 test bl, 2 .text:004585F1 148 jz loc_458920 .text:004585F1 .text:004585F7 148 jmp loc_458914 .text:004585F7 .text:004585FC ; --------------------------------------------------------------------------- .text:004585FC .text:004585FC loc_4585FC: ; CODE XREF: Read_Game_Options+5Aj .text:004585FC ; Read_Game_Options+6Cj .text:004585FC 148 cmp [esp+148h+filenm_ptr], 0 .text:00458604 148 jz short loc_458641 .text:00458604 .text:00458606 148 mov eax, 2000h .text:0045860B 148 mov ebx, 2000h .text:00458610 148 call new .text:00458610 .text:00458615 148 xor edx, edx .text:00458617 148 mov ecx, eax .text:00458619 148 mov ebp, eax .text:0045861B 148 call memset_ .text:0045861B .text:00458620 148 mov ebx, 1FFFh .text:00458625 148 lea eax, [esp+148h+file_obj] .text:0045862C 148 mov edx, ecx .text:0045862E 148 call CCFileClass_ReadBytes .text:0045862E .text:00458633 148 lea eax, [esp+148h+file_obj] .text:0045863A 148 call CCFileClass_CloseHandle .text:0045863A .text:0045863F 148 jmp short loc_45864D .text:0045863F .text:00458641 ; --------------------------------------------------------------------------- .text:00458641 .text:00458641 loc_458641: ; CODE XREF: Read_Game_Options+C8j .text:00458641 148 mov eax, offset unk_562538 .text:00458646 148 call sub_4C6170 .text:00458646 .text:0045864B 148 mov ebp, eax .text:0045864B .text:0045864D .text:0045864D loc_45864D: ; CODE XREF: Read_Game_Options+103j .text:0045864D 148 mov ecx, offset str_Serial_Handle .text:00458652 148 mov ebx, offset aNoname ; "Noname" .text:00458657 148 push ebp .text:00458658 14C mov edx, offset aHandle ; "Handle" .text:0045865D 14C mov eax, offset aOptions ; "Options" .text:00458662 14C push 0Ch .text:00458664 150 mov esi, offset str_Serial_Handle .text:00458669 150 mov edi, offset byte_541A5C .text:0045866E 150 call INIClass_ReadString .text:0045866E .text:00458673 148 push edi .text:00458673 .text:00458674 .text:00458674 loc_458674: ; CODE XREF: Read_Game_Options+14Ej .text:00458674 14C mov al, [esi] .text:00458676 14C mov [edi], al .text:00458678 14C cmp al, 0 .text:0045867A 14C jz short loc_45868C .text:0045867A .text:0045867C 14C mov al, [esi+1] .text:0045867F 14C add esi, 2 .text:00458682 14C mov [edi+1], al .text:00458685 14C add edi, 2 .text:00458688 14C cmp al, 0 .text:0045868A 14C jnz short loc_458674 .text:0045868A .text:0045868C .text:0045868C loc_45868C: ; CODE XREF: Read_Game_Options+13Ej .text:0045868C 14C pop edi .text:0045868D 148 mov edx, offset aColor ; "Color" .text:00458692 148 mov eax, offset aOptions_0 ; "Options" .text:00458697 148 mov ecx, ebp .text:00458699 148 xor ebx, ebx .text:0045869B 148 call INIClass_ReadInt .text:0045869B .text:004586A0 148 mov edx, offset aSide ; "Side" .text:004586A5 148 mov ds:nLAN_Color, eax .text:004586AA 148 mov ds:nLAN_Color_Copy, eax .text:004586AF 148 mov ecx, ebp .text:004586B1 148 xor ebx, ebx .text:004586B3 148 mov eax, offset aOptions_1 ; "Options" .text:004586B8 148 call INIClass_ReadInt .text:004586B8 .text:004586BD 148 mov edx, offset aCredits ; "Credits" .text:004586C2 148 mov ds:nLAN_Side, al .text:004586C7 148 mov ecx, ebp .text:004586C9 148 xor ebx, ebx .text:004586CB 148 mov eax, offset aOptions_2 ; "Options" .text:004586D0 148 call INIClass_ReadInt .text:004586D0 .text:004586D5 148 mov edx, offset aBases ; "Bases" .text:004586DA 148 mov ds:nLAN_Credits, eax .text:004586DF 148 mov ecx, ebp .text:004586E1 148 xor ebx, ebx .text:004586E3 148 mov eax, offset aOptions_3 ; "Options" .text:004586E8 148 call INIClass_ReadInt .text:004586E8 .text:004586ED 148 mov edx, offset aTiberium ; "Tiberium" .text:004586F2 148 mov ds:bLAN_BasesEnabled, eax .text:004586F7 148 mov ecx, ebp .text:004586F9 148 xor ebx, ebx .text:004586FB 148 mov eax, offset aOptions_4 ; "Options" .text:00458700 148 call INIClass_ReadInt .text:00458700 .text:00458705 148 mov ds:bLAN_Tiberium, eax .text:0045870A 148 mov edx, offset aCrates ; "Crates" .text:0045870F 148 mov eax, offset aOptions_5 ; "Options" .text:00458714 148 mov ecx, ebp .text:00458716 148 xor ebx, ebx .text:00458718 148 call INIClass_ReadInt .text:00458718 .text:0045871D 148 mov edx, offset aAi ; "AI" .text:00458722 148 mov ds:bLAN_Crates, eax .text:00458727 148 mov ecx, ebp .text:00458729 148 xor ebx, ebx .text:0045872B 148 mov eax, offset aOptions_6 ; "Options" .text:00458730 148 call INIClass_ReadInt .text:00458730 .text:00458735 148 mov edx, offset aBuildlevel ; "BuildLevel" .text:0045873A 148 mov ds:bLAN_AIEnabled, eax .text:0045873F 148 mov ecx, ebp .text:00458741 148 xor ebx, ebx .text:00458743 148 mov eax, offset aOptions_7 ; "Options" .text:00458748 148 call INIClass_ReadInt .text:00458748 .text:0045874D 148 mov edx, offset aUnitcount ; "UnitCount" .text:00458752 148 mov Scenario_BuildLevel, eax ; serves as multiplayer techlevel .text:00458757 148 mov ecx, ebp .text:00458759 148 xor ebx, ebx .text:0045875B 148 mov eax, offset aOptions_8 ; "Options" .text:00458760 148 call INIClass_ReadInt .text:00458760 .text:00458765 148 mov edx, offset aSeed ; "Seed" .text:0045876A 148 mov int_LANUnitCount, eax .text:0045876F 148 mov ecx, ebp .text:00458771 148 xor ebx, ebx .text:00458773 148 mov eax, offset aOptions_9 ; "Options" .text:00458778 148 call INIClass_ReadInt .text:00458778 .text:0045877D 148 mov edx, offset aCapturetheflag ; "CaptureTheFlag" .text:00458782 148 mov ds:nLAN_Seed, eax .text:00458787 148 mov ecx, ebp .text:00458789 148 xor ebx, ebx .text:0045878B 148 mov eax, offset aOptions_10 ; "Options" .text:00458790 148 call INIClass_ReadInt .text:00458790 .text:00458795 148 mov dl, ds:opts_1ctf2???3znd4ciq5tre6mcv7???8??? .text:0045879B 148 and dl, 11111110b ; remove previous setting .text:0045879E 148 and eax, 1 ; reduce read ini value to 1 bit .text:004587A1 148 mov ds:opts_1ctf2???3znd4ciq5tre6mcv7???8???, dl ; store settings without CTF .text:004587A7 148 shl eax, 8 ; move one byte .text:004587AA 148 or dword ptr ds:opts_1???2???3???4???5hli6cbt7nam8wol, eax ; Add new setting if it's 1 .text:004587AA ; (ends up in opts_1ctf2???3znd4ciq5tre6mcv7???8??? ) .text:004587B0 148 mov edx, offset aGameid ; "GameID" .text:004587B5 148 mov eax, offset aInternet_3 ; "Internet" .text:004587BA 148 mov ecx, ebp .text:004587BC 148 xor ebx, ebx .text:004587BE 148 call INIClass_ReadInt .text:004587BE .text:004587C3 148 mov edx, offset aStarttime ; "StartTime" .text:004587C8 148 mov ds:nWOL_GameID, eax .text:004587CD 148 mov ecx, ebp .text:004587CF 148 xor ebx, ebx .text:004587D1 148 mov eax, offset aInternet_4 ; "Internet" .text:004587D6 148 call INIClass_ReadInt .text:004587D6 .text:004587DB 148 push offset aWestwoodChat ; "Westwood Chat" .text:004587E0 14C push offset aOwl_window ; "OWL_Window" .text:004587E5 150 mov ds:nWOL_StartTime, eax .text:004587EA 150 call cs:__imp_FindWindowA .text:004587EA .text:004587F1 148 mov edx, offset aHwnd ; "HWND" .text:004587F6 148 mov ecx, ebp .text:004587F8 148 mov ebx, eax .text:004587FA 148 mov eax, offset aInternet_5 ; "Internet" .text:004587FF 148 call INIClass_ReadInt .text:004587FF .text:00458804 148 mov ebx, 2 .text:00458809 148 mov edx, offset aMaxplayers ; "MaxPlayers" .text:0045880E 148 mov ds:nWOL_HWND, eax .text:00458813 148 mov ecx, ebp .text:00458815 148 mov eax, offset aInternet_6 ; "Internet" .text:0045881A 148 call INIClass_ReadInt .text:0045881A .text:0045881F 148 mov ebx, ds:bLAN_Tiberium .text:00458825 148 mov ds:nWOL_MaxPlayers, eax .text:0045882A 148 test ebx, ebx .text:0045882C 148 jz short loc_458837 .text:0045882C .text:0045882E 148 or ds:opts_1???2???3whl4tib5tib6???7bib8ciq, 18h .text:00458835 148 jmp short loc_45883E .text:00458835 .text:00458837 ; --------------------------------------------------------------------------- .text:00458837 .text:00458837 loc_458837: ; CODE XREF: Read_Game_Options+2F0j .text:00458837 148 and ds:opts_1???2???3whl4tib5tib6???7bib8ciq, 0E7h .text:00458837 .text:0045883E .text:0045883E loc_45883E: ; CODE XREF: Read_Game_Options+2F9j .text:0045883E 148 mov edx, offset aScenario ; "Scenario" .text:00458843 148 mov eax, offset aOptions_11 ; "Options" .text:00458848 148 mov ecx, ebp .text:0045884A 148 xor ebx, ebx .text:0045884C 148 call INIClass_ReadInt .text:0045884C .text:00458851 148 mov ebx, 9 .text:00458856 148 mov edx, ds:nLAN_Color .text:0045885C 148 mov ds:dword_54072C, eax .text:00458861 148 mov ds:nScenario_number, eax .text:00458866 148 xor ecx, ecx .text:00458868 148 mov al, ds:nLAN_Side .text:0045886D 148 mov ds:pGameSettingsClass, ecx .text:00458873 148 shl edx, 4 .text:00458876 148 cbw .text:00458878 148 mov ecx, ebp .text:0045887A 148 or eax, edx .text:0045887C 148 mov edx, offset aMaxahead ; "MaxAhead" .text:00458881 148 mov ds:bLAN_PlayerColor, al .text:00458886 148 mov eax, offset aTiming ; "Timing" .text:0045888B 148 call INIClass_ReadInt .text:0045888B .text:00458890 148 mov ebx, 3 .text:00458895 148 mov edx, offset aSendrate ; "SendRate" .text:0045889A 148 mov ds:dword_544300, eax .text:0045889F 148 mov int_LANMaxAheadFrames, eax .text:004588A4 148 mov ecx, ebp .text:004588A6 148 mov eax, offset aTiming_0 ; "Timing" .text:004588AB 148 mov esi, [esp+148h+filenm_ptr] .text:004588B2 148 call INIClass_ReadInt .text:004588B2 .text:004588B7 148 mov ds:dword_544304, eax .text:004588BC 148 mov ds:dword_54174C, eax .text:004588C1 148 test esi, esi .text:004588C3 148 jz short loc_4588CC .text:004588C3 .text:004588C5 148 mov eax, ebp .text:004588C7 148 call Delete_Scrap_Memory .text:004588C7 .text:004588CC .text:004588CC loc_4588CC: ; CODE XREF: Read_Game_Options+387j .text:004588CC 148 mov ecx, 1 .text:004588D1 148 mov edi, offset vt_FileClass .text:004588D6 148 mov al, [esp+110h] .text:004588DD 148 xor ebx, ebx .text:004588DF 148 mov edx, ecx .text:004588E1 148 mov [esp+148h+file_obj], edi .text:004588E8 148 test al, 1 .text:004588EA 148 jz short loc_4588FE .text:004588EA .text:004588EC 148 mov ebp, [esp+10Ch] .text:004588F3 148 test ebp, ebp .text:004588F5 148 jz short loc_4588FE .text:004588F5 .text:004588F7 148 mov eax, ebp .text:004588F9 148 call _nfree_ .text:004588F9 .text:004588FE .text:004588FE loc_4588FE: ; CODE XREF: Read_Game_Options+3AEj .text:004588FE ; Read_Game_Options+3B9j .text:004588FE 148 test dl, 2 .text:00458901 148 jz short loc_45890F .text:00458901 .text:00458903 148 lea eax, [esp+148h+file_obj] .text:0045890A 148 call Delete_Scrap_Memory .text:0045890A .text:0045890F .text:0045890F loc_45890F: ; CODE XREF: Read_Game_Options+3C5j .text:0045890F 148 test bl, 2 .text:00458912 148 jz short loc_458920 .text:00458912 .text:00458914 .text:00458914 loc_458914: ; CODE XREF: Read_Game_Options+BBj .text:00458914 148 lea eax, [esp+148h+file_obj] .text:0045891B 148 call Delete_Scrap_Memory .text:0045891B .text:00458920 .text:00458920 loc_458920: ; CODE XREF: Read_Game_Options+B5j .text:00458920 ; Read_Game_Options+3D6j .text:00458920 148 mov eax, ecx .text:00458922 148 add esp, 130h .text:00458928 018 pop ebp .text:00458929 014 pop edi .text:0045892A 010 pop esi .text:0045892B 00C pop edx .text:0045892C 008 pop ecx .text:0045892D 004 pop ebx .text:0045892E 000 retn .text:0045892E .text:0045892E Read_Game_Options endp