diff --git a/config/BW1W120/splits.txt b/config/BW1W120/splits.txt index 83df4cda..7d485ffe 100644 --- a/config/BW1W120/splits.txt +++ b/config/BW1W120/splits.txt @@ -3028,7 +3028,8 @@ Lionhead/LHLib/ver5.0/LHMem.cpp: .text start:0x007E69D0 end:0x007E6A50 Lionhead/LHLib/ver5.0/LHScript.cpp: - .text start:0x007E72C0 end:0x007EA0B0 + .text start:0x007E7260 end:0x007EA0B0 + .data start:0x00C341C0 end:0x00C34DF0 align:4 Lionhead/LHLib/ver5.0/LHSpriteList.cpp: .text start:0x007EE540 end:0x007EE6E0 diff --git a/config/BW1W120/symbols.txt b/config/BW1W120/symbols.txt index a766f3a1..c5741635 100644 --- a/config/BW1W120/symbols.txt +++ b/config/BW1W120/symbols.txt @@ -18525,6 +18525,7 @@ fn_0x007bc5f9 = .text:0x007BC5F9; // type:function scope:global ?Read@LHOSFile@@QAE?AW4LH_FILE_RESULT@@PAXIPAI@Z = .text:0x007BC8E0; // type:function size:0x40 scope:global ?Write@LHOSFile@@QAE?AW4LH_FILE_RESULT@@PBXIPAI@Z = .text:0x007BC920; // type:function size:0x40 scope:global ?LHFileLength@@YA?AW4LH_FILE_RESULT@@PBDPAI@Z = .text:0x007BC960; // type:function size:0x180 scope:global +??1LHReleasedOSFile@@UAE@XZ = .text:0x007BCAD0; // type:function size:0x10 scope:global ?Length@LHOSFile@@QAE?AW4LH_FILE_RESULT@@PAI@Z = .text:0x007BCAE0; // type:function size:0x30 scope:global ?DirFindFirst@LHOSFile@@QAE?AW4LH_FILE_RESULT@@PBDPAULHDir@@I@Z = .text:0x007BCB10; // type:function size:0x90 scope:global ?DirFindNext@LHOSFile@@QAE?AW4LH_FILE_RESULT@@PAULHDir@@@Z = .text:0x007BCBA0; // type:function size:0x60 scope:global @@ -19752,7 +19753,7 @@ fn_007DE8D0 = .text:0x007DE8D0; // type:function size:0x60 ?WaitForVerticalBlank@LHScreen@@QAEHXZ = .text:0x007DECC0; // type:function size:0x20 scope:global fn_007DECE0 = .text:0x007DECE0; // type:function size:0x30 fn_007DED10 = .text:0x007DED10; // type:function size:0x30 -fn_007DED40 = .text:0x007DED40; // type:function size:0x10 +?D3DSetup@@YGXJ@Z = .text:0x007DED40; // type:function size:0x10 ?IsAppMinimized@LHScreen@@QAEHXZ = .text:0x007DED50; // type:function size:0x10 scope:global fn_007DED60 = .text:0x007DED60; // type:function size:0x20 ?GetRect@LHRegion@@QBEXPAUtagRECT@@@Z = .text:0x007DED80; // type:function size:0x20 scope:global @@ -19851,7 +19852,7 @@ fn_007E2690 = .text:0x007E2690; // type:function size:0x60 ?Box24@LHDraw@@QAEHJJJJULHColor@@K@Z = .text:0x007E2B40; // type:function size:0x2B0 ?EmbossedBox16@LHDraw@@QAEHJJJJULHPixel16@@0EEK@Z = .text:0x007E2DF0; // type:function size:0x840 ?EmbossedBox24@LHDraw@@QAEHJJJJULHColor@@0EEK@Z = .text:0x007E3630; // type:function size:0x5F0 -fn_007E3C20 = .text:0x007E3C20; // type:function size:0xE0 +?LoadFont@LHText@@QAE?AW4LH_RETURN@@PADK@Z = .text:0x007E3C20; // type:function size:0xE0 scope:global ?FreeFont@LHText@@QAEHXZ = .text:0x007E3D00; // type:function size:0x20 scope:global ?StringWidth@LHText@@QAEHPAD0@Z = .text:0x007E3D20; // type:function size:0x90 scope:global ?StringHeight@LHText@@QAEHPAD0@Z = .text:0x007E3DB0; // type:function size:0x50 scope:global @@ -19905,47 +19906,79 @@ fn_007E5AF0 = .text:0x007E5AF0; // type:function size:0x30 ?Alloc@LHMem@@SGPAXI@Z = .text:0x007E69D0; // type:function size:0x10 scope:global ?AllocFilled@LHMem@@SGPAXIH@Z = .text:0x007E69E0; // type:function size:0x47 scope:global ?Free@LHMem@@SGHPAX@Z = .text:0x007E6A30; // type:function size:0x12 scope:global +?LHWideToAnsi@@YAPADPBG@Z = .text:0x007E6A80; // type:function size:0x30 scope:global fn_007E6AB0 = .text:0x007E6AB0; // type:function size:0x30 -fn_007E6B40 = .text:0x007E6B40; // type:function size:0x30 +?LHAnsiToWide@@YAPAGPBD@Z = .text:0x007E6AE0; // type:function size:0x30 scope:global +?PostFileOpenStuff@?$LHScriptX@G@@QAEXAAVLHOSFile@@@Z = .text:0x007E6B40; // type:function size:0x22 scope:global +?bodge_to_force_compilation_of_versions@@YAXXZ = .text:0x007E6B70; // type:function size:0x192 scope:global ??0LHReleasedOSFile@@QAE@XZ = .text:0x007E6D10; // type:function size:0x20 scope:global -fn_007E6D30 = .text:0x007E6D30; // type:function size:0x40 -fn_007E6D70 = .text:0x007E6D70; // type:function size:0x30 -fn_007E6DA0 = .text:0x007E6DA0; // type:function size:0x20 -fn_007E6DC0 = .text:0x007E6DC0; // type:function size:0x40 -fn_007E6F60 = .text:0x007E6F60; // type:function size:0x10 -fn_007E6F70 = .text:0x007E6F70; // type:function size:0x10 -fn_007E6F90 = .text:0x007E6F90; // type:function size:0x10 -fn_007E6FC0 = .text:0x007E6FC0; // type:function size:0x20 -fn_007E6FF0 = .text:0x007E6FF0; // type:function size:0x20 -fn_007E7170 = .text:0x007E7170; // type:function size:0x10 -fn_007E7180 = .text:0x007E7180; // type:function size:0x20 -fn_007E71C0 = .text:0x007E71C0; // type:function size:0x20 -fn_007E7210 = .text:0x007E7210; // type:function size:0x10 -fn_007E7220 = .text:0x007E7220; // type:function size:0x20 -fn_007E7240 = .text:0x007E7240; // type:function size:0x20 -?Load@LHScriptX_c_@@QAEXPADPAVLHScriptCommandX_c_@@P6AVLH_RETURN@@HPAVLHScriptPramX_c_@@@ZPAH@Z = .text:0x007E72C0; // type:function size:0x60 scope:global -fn_007E73D0 = .text:0x007E73D0; // type:function size:0x30 -?LoadOneLine@LHScriptX_c_@@QAEXAAVLHReleasedOSFile@@PAD@Z = .text:0x007E7400; // type:function size:0xC0 scope:global -fn_007E74C0 = .text:0x007E74C0; // type:function size:0x70 -fn_007E7530 = .text:0x007E7530; // type:function size:0x10 -?ScanLine@LHScriptX_c_@@QAEXPAD@Z = .text:0x007E7540; // type:function size:0x380 scope:global -fn_007E7960 = .text:0x007E7960; // type:function size:0x60 -fn_007E7AA0 = .text:0x007E7AA0; // type:function size:0xD0 -fn_007E7BF0 = .text:0x007E7BF0; // type:function size:0x384 -fn_007E7FB0 = .text:0x007E7FB0; // type:function size:0xB4 -?LoadFile@LHScriptX_c_@@QAEXPADPAH@Z = .text:0x007E8170; // type:function size:0xD0 scope:global -fn_007E8240 = .text:0x007E8240; // type:function size:0x744 +?strcat@?$LHStringOps@D@@SAPADPADPBD@Z = .text:0x007E6D30; // type:function size:0x40 scope:global +?strcpy@?$LHStringOps@D@@SAPADPADPBD@Z = .text:0x007E6D70; // type:function size:0x30 scope:global +?strlen@?$LHStringOps@D@@SAIPBD@Z = .text:0x007E6DA0; // type:function size:0x20 scope:global +?strcmp@?$LHStringOps@D@@SAHPBD0@Z = .text:0x007E6DC0; // type:function size:0x40 scope:global +?isdigit@?$LHStringOps@D@@SAHD@Z = .text:0x007E6F50; // type:function size:0x10 scope:global +?isspace@?$LHStringOps@D@@SAHD@Z = .text:0x007E6F60; // type:function size:0x10 scope:global +?atof@?$LHStringOps@D@@SAMPBD@Z = .text:0x007E6F70; // type:function size:0x10 scope:global +?atoi@?$LHStringOps@D@@SAHPBD@Z = .text:0x007E6F80; // type:function size:0x10 scope:global +?atol@?$LHStringOps@D@@SAJPBD@Z = .text:0x007E6F90; // type:function size:0x10 scope:global +?strcat@?$LHStringOps@G@@SAPAGPAGPBG@Z = .text:0x007E6FA0; // type:function size:0x20 scope:global +?strcpy@?$LHStringOps@G@@SAPAGPAGPBG@Z = .text:0x007E6FC0; // type:function size:0x20 scope:global +?strlen@?$LHStringOps@G@@SAIPBG@Z = .text:0x007E6FE0; // type:function size:0x10 scope:global +?strcmp@?$LHStringOps@G@@SAHPBG0@Z = .text:0x007E6FF0; // type:function size:0x20 scope:global +?isdigit@?$LHStringOps@G@@SAHG@Z = .text:0x007E7160; // type:function size:0x10 scope:global +?isspace@?$LHStringOps@G@@SAHG@Z = .text:0x007E7170; // type:function size:0x10 scope:global +?atof@?$LHStringOps@G@@SAMPBG@Z = .text:0x007E7180; // type:function size:0x20 scope:global +?atoi@?$LHStringOps@G@@SAHPBG@Z = .text:0x007E71A0; // type:function size:0x20 scope:global +?atol@?$LHStringOps@G@@SAJPBG@Z = .text:0x007E71C0; // type:function size:0x20 scope:global +?makechar@?$LHStringOps@G@@SAPADPAG@Z = .text:0x007E71E0; // type:function size:0x10 scope:global +?makechar@?$LHStringOps@D@@SAPADPAD@Z = .text:0x007E71F0; // type:function size:0x10 scope:global +?fromchar@?$LHStringOps@G@@SAPAGPAD@Z = .text:0x007E7200; // type:function size:0x10 scope:global +?fromchar@?$LHStringOps@D@@SAPADPAD@Z = .text:0x007E7210; // type:function size:0x10 scope:global +?itoa@?$LHStringOps@D@@SAPADHPADH@Z = .text:0x007E7220; // type:function size:0x20 scope:global +?itoa@?$LHStringOps@G@@SAPAGHPAGH@Z = .text:0x007E7240; // type:function size:0x20 scope:global +?Load@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PADPAPADP6A?AW42@JPAJ@Z2@Z = .text:0x007E7260; // type:function size:0x56 scope:global +?Load@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PADPAU?$LHScriptCommandX@D@@P6A?AW42@JPAU?$LHScriptPramX@D@@@ZPAJ@Z = .text:0x007E72C0; // type:function size:0x60 scope:global +?Load@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PADPAU?$LHScriptCommandX@D@@P6A?AW42@JPAU?$LHScriptPramX@D@@@ZPAPADP6A?AW42@JPAJ@Z5@Z = .text:0x007E7320; // type:function size:0x5D scope:global +?Load@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PADPAJ@Z = .text:0x007E7380; // type:function size:0x49 scope:global +?SetVariables@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PAU?$LHScriptCommandX@D@@P6A?AW42@JPAU?$LHScriptPramX@D@@@ZPAJ@Z = .text:0x007E73D0; // type:function size:0x30 scope:global +?LoadOneLine@?$LHScriptX@D@@QAE_NAAVLHOSFile@@PAD@Z = .text:0x007E7400; // type:function size:0xC0 scope:global +?DontProcessNumLines@?$LHScriptX@D@@QAE_NAAVLHOSFile@@PADK@Z = .text:0x007E74C0; // type:function size:0x70 scope:global +?InitIfLevel@?$LHScriptX@D@@QAEXXZ = .text:0x007E7530; // type:function size:0x10 scope:global +?ScanLine@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PAD@Z = .text:0x007E7540; // type:function size:0x3C0 scope:global +?Load@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PADPAPAGP6A?AW42@JPAJ@Z2@Z = .text:0x007E7900; // type:function size:0x56 scope:global +?Load@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PADPAU?$LHScriptCommandX@G@@P6A?AW42@JPAU?$LHScriptPramX@G@@@ZPAJ@Z = .text:0x007E7960; // type:function size:0x60 scope:global +?Load@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PADPAU?$LHScriptCommandX@G@@P6A?AW42@JPAU?$LHScriptPramX@G@@@ZPAPAGP6A?AW42@JPAJ@Z5@Z = .text:0x007E79C0; // type:function size:0x5D scope:global +?Load@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PADPAJ@Z = .text:0x007E7A20; // type:function size:0x49 scope:global +?SetVariables@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PAU?$LHScriptCommandX@G@@P6A?AW42@JPAU?$LHScriptPramX@G@@@ZPAJ@Z = .text:0x007E7A70; // type:function size:0x28 scope:global +?LoadOneLine@?$LHScriptX@G@@QAE_NAAVLHOSFile@@PAG@Z = .text:0x007E7AA0; // type:function size:0xD0 scope:global +?DontProcessNumLines@?$LHScriptX@G@@QAE_NAAVLHOSFile@@PAGK@Z = .text:0x007E7B70; // type:function size:0x6F scope:global +?InitIfLevel@?$LHScriptX@G@@QAEXXZ = .text:0x007E7BE0; // type:function size:0x10 scope:global +?ScanLine@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PAG@Z = .text:0x007E7BF0; // type:function size:0x3C0 scope:global +?GetCommandAsText@?$LHScriptCommandX@D@@QAEPADPAD@Z = .text:0x007E7FB0; // type:function size:0xE0 scope:global +?GetCommandAsText@?$LHScriptCommandX@G@@QAEPAGPAG@Z = .text:0x007E8090; // type:function size:0xE0 scope:global +?LoadFile@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PADPAJ@Z = .text:0x007E8170; // type:function size:0xC3 scope:global +?ProcessCommand@?$LHScriptX@D@@QAE?AW4LH_RETURN@@JPAU?$LHScriptPramX@D@@@Z = .text:0x007E8240; // type:function size:0x7B0 scope:global +??0LHSpriteList@@QAE@XZ = .text:0x007E89F0; // type:function size:0x10 scope:global +?Set@LHSpriteList@@QAEXPAULHSprite@@J@Z = .text:0x007E8A00; // type:function size:0x17 scope:global ?Depth@LHScreen@@QAEEXZ = .text:0x007E8A20; // type:function size:0x10 scope:global -fn_007E8A90 = .text:0x007E8A90; // type:function size:0x220 -?DestroyVariables@LHScriptX_c_@@QAEXXZ = .text:0x007E8CB0; // type:function size:0x60 scope:global -fn_007E8D10 = .text:0x007E8D10; // type:function size:0x40 -fn_007E8D50 = .text:0x007E8D50; // type:function size:0xD0 -fn_007E8E20 = .text:0x007E8E20; // type:function size:0x744 -fn_007E95D0 = .text:0x007E95D0; // type:function size:0x2A0 -fn_007E9870 = .text:0x007E9870; // type:function size:0x60 -fn_007E98D0 = .text:0x007E98D0; // type:function size:0x40 -fn_007E9AD0 = .text:0x007E9AD0; // type:function size:0x10 +?GetNextWord@?$LHScriptX@D@@QAEJPAPADPADPAE@Z = .text:0x007E8A90; // type:function size:0x220 scope:global +?DestroyVariables@?$LHScriptX@D@@QAEXXZ = .text:0x007E8CB0; // type:function size:0x54 scope:global +?FindVariable@?$LHScriptX@D@@QAEPAU?$LHScriptVariable@D@@PAD@Z = .text:0x007E8D10; // type:function size:0x38 scope:global +?LoadFile@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PADPAJ@Z = .text:0x007E8D50; // type:function size:0xC7 scope:global +?ProcessCommand@?$LHScriptX@G@@QAE?AW4LH_RETURN@@JPAU?$LHScriptPramX@G@@@Z = .text:0x007E8E20; // type:function size:0x7B0 scope:global +?GetNextWord@?$LHScriptX@G@@QAEJPAPAGPAGPAE@Z = .text:0x007E95D0; // type:function size:0x299 scope:global +?DestroyVariables@?$LHScriptX@G@@QAEXXZ = .text:0x007E9870; // type:function size:0x54 scope:global +?FindVariable@?$LHScriptX@G@@QAEPAU?$LHScriptVariable@G@@PAG@Z = .text:0x007E98D0; // type:function size:0x39 scope:global +?CommandIf@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PAD00@Z = .text:0x007E9910; // type:function size:0xF1 scope:global +?CreateVariable@?$LHScriptX@D@@QAE?AW4LH_RETURN@@JPAU?$LHScriptPramX@D@@@Z = .text:0x007E9A10; // type:function size:0xB2 scope:global +?PostFileOpenStuff@?$LHScriptX@D@@QAEXAAVLHOSFile@@@Z = .text:0x007E9AD0; // type:function size:0x10 scope:global +?CommandIf@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PAG00@Z = .text:0x007E9AE0; // type:function size:0xF1 scope:global +?CreateVariable@?$LHScriptX@G@@QAE?AW4LH_RETURN@@JPAU?$LHScriptPramX@G@@@Z = .text:0x007E9BE0; // type:function size:0xB5 scope:global +?GetConditionValue@?$LHScriptX@D@@QAE?AW4LH_RETURN@@PADPAJ@Z = .text:0x007E9CA0; // type:function size:0x150 scope:global ?MaxDepth@LHScreen@@QAEEXZ = .text:0x007E9DF0; // type:function size:0x10 scope:global +?GetConditionState@?$LHScriptX@D@@QAEDJEJ@Z = .text:0x007E9E00; // type:function size:0xB0 scope:global +?GetConditionValue@?$LHScriptX@G@@QAE?AW4LH_RETURN@@PAGPAJ@Z = .text:0x007E9EB0; // type:function size:0x150 scope:global +?GetConditionState@?$LHScriptX@G@@QAEDJEJ@Z = .text:0x007EA000; // type:function size:0xB0 scope:global ?Pixel16@LHDraw@@QAEHKKULHPixel16@@K@Z = .text:0x007EA0B0; // type:function size:0x190 ?Pixel24@LHDraw@@QAEHKKULHColor@@K@Z = .text:0x007EA240; // type:function size:0x1D0 fn_007EA410 = .text:0x007EA410; // type:function size:0x60 @@ -19986,8 +20019,8 @@ fn_007EF780 = .text:0x007EF780; // type:function size:0x10 fn_007EF7D0 = .text:0x007EF7D0; // type:function size:0x10 fn_007EF7E0 = .text:0x007EF7E0; // type:function size:0x40 fn_007EF820 = .text:0x007EF820; // type:function size:0xA0 -fn_007EFB60 = .text:0x007EFB60; // type:function size:0x190 -fn_007EFCF0 = .text:0x007EFCF0; // type:function size:0x4D0 +?LHLoadABMP@@YA?AW4LH_RETURN@@PADPAULHSprite@@K@Z = .text:0x007EFB60; // type:function size:0x190 scope:global +?ToSprites@LHConvert@@QAE?AW4LH_RETURN@@PADPAULHSpriteList@@PAULHColor@@KPAJPAUFlicHeader@@PAK@Z = .text:0x007EFCF0; // type:function size:0x4D0 scope:global fn_007F01C0 = .text:0x007F01C0; // type:function size:0x50 fn_007F0210 = .text:0x007F0210; // type:function size:0x60 fn_007F0270 = .text:0x007F0270; // type:function size:0x150 @@ -21385,6 +21418,18 @@ fn_0087FC50 = .text:0x0087FC50; // type:function size:0x10 ?LH3DRenderClose@LHIlib@@SAHXZ = .text:0x0087FC60; // type:function size:0x10 scope:global fn_0087FC70 = .text:0x0087FC70; // type:function size:0x10 fn_0087FC80 = .text:0x0087FC80; // type:function size:0x10 +?SetD3DSetup@@YAXJ@Z = .text:0x0087FC90; // type:function size:0x10 scope:global +?SetSwapTextureAGPvsLocal@@YAXJ@Z = .text:0x0087FCA0; // type:function size:0x10 scope:global +?SetShowDebugInfo@@YAXJ@Z = .text:0x0087FCB0; // type:function size:0x10 scope:global +?SetAGPMem@@YAXJ@Z = .text:0x0087FCC0; // type:function size:0x10 scope:global +?SetVRAMMem@@YAXJ@Z = .text:0x0087FCD0; // type:function size:0x10 scope:global +?SetUseWireframe@@YAXJ@Z = .text:0x0087FCE0; // type:function size:0x10 scope:global +?SetAllocMouseSurface@@YAXJ@Z = .text:0x0087FCF0; // type:function size:0x10 scope:global +?SetBuildAllMntTexture@@YAXJ@Z = .text:0x0087FD00; // type:function size:0x10 scope:global +?SetMntName@@YAPADPAD@Z = .text:0x0087FD10; // type:function size:0x10 scope:global +?SetUseLowTexture@@YAXJ@Z = .text:0x0087FD20; // type:function size:0x10 scope:global +?SetUseSmallBump@@YAXJ@Z = .text:0x0087FD30; // type:function size:0x10 scope:global +?SetVanishObjectDist@@YAXM@Z = .text:0x0087FD40; // type:function size:0x10 scope:global ?Chat@LHNetBase@@QAEXVLH_USER_ID@@PA_WPAVLHTransportInfo@@@Z = .text:0x0087FD50; // type:function size:0x1B7 fn_0087FF07 = .text:0x0087FF07; // type:function size:0x9 fn_0087FF10 = .text:0x0087FF10; // type:function size:0x60 @@ -30290,6 +30335,8 @@ lbl_00BE828D = .data:0x00BE828D; // type:object size:0xB lbl_00BE82B1 = .data:0x00BE82B1; // type:object size:0x1F ??_R0?AVDanceKeyAction@@@8 = .data:0x00BE82D0; // type:object size:0x1D lbl_00BE82ED = .data:0x00BE82ED; // type:object size:0xDB +??_C@_04PNDB@?$CFd?0?5?$AA@ = .data:0x00BE83AC; // type:object size:0x8 scope:global +lbl_00BE83B4 = .data:0x00BE83B4; // type:object size:0x14 ??_R0?AVDanceKeyFrame@@@8 = .data:0x00BE83C8; // type:object size:0x1C lbl_00BE83E4 = .data:0x00BE83E4; // type:object size:0xF data:string ??_R0?AVGData@@@8 = .data:0x00BE8988; // type:object size:0x14 @@ -30591,7 +30638,8 @@ lbl_00BEF9D7 = .data:0x00BEF9D7; // type:object size:0x11 ??_R0?AVProperty@@@8 = .data:0x00BEF9E8; // type:object size:0x17 ??_R0?AVFloatProperty@@@8 = .data:0x00BEFA00; // type:object size:0x1C ??_R0?AVFloatValueProperty@@@8 = .data:0x00BEFA20; // type:object size:0x21 -lbl_00BEFA41 = .data:0x00BEFA41; // type:object size:0xB +lbl_00BEFA41 = .data:0x00BEFA41; // type:object size:0x3 +??_C@_05JDEL@FLOAT?$AA@ = .data:0x00BEFA44; // type:object size:0x8 scope:global ??_R0?AVIntegerProperty@@@8 = .data:0x00BEFA70; // type:object size:0x1E ??_R0?AVIntegerValueProperty@@@8 = .data:0x00BEFA90; // type:object size:0x23 lbl_00BEFAB3 = .data:0x00BEFAB3; // type:object size:0xD @@ -31247,6 +31295,8 @@ lbl_00C205DB = .data:0x00C205DB; // type:object size:0x15 lbl_00C20723 = .data:0x00C20723; // type:object size:0x205 ??_R0?AVSecretCreature@@@8 = .data:0x00C20BB8; // type:object size:0x1D lbl_00C20BD5 = .data:0x00C20BD5; // type:object size:0x4B +??_C@_02HHDK@?$CJ?6?$AA@ = .data:0x00C22098; // type:object size:0x4 scope:global +lbl_00C2209C = .data:0x00C2209C; // type:object size:0xAC ??_R0?AVGShowNeedsInfo@@@8 = .data:0x00C22148; // type:object size:0x1D lbl_00C22165 = .data:0x00C22165; // type:object size:0x3 ??_R0?AVGConfirmation@@@8 = .data:0x00C22188; // type:object size:0x1C @@ -31534,7 +31584,104 @@ lbl_00C34004 = .data:0x00C34004; // type:object size:0x33 data:string ??_C@_0CI@OIOF@This?5memory?5has?5already?5been?5del@ = .data:0x00C34060; // type:object size:0x28 scope:global data:string ??_C@_0O@IBHI@Memory?5leak?$CB?$CB?$AA@ = .data:0x00C34088; // type:object size:0xE scope:global data:string ?DoNotUsePools@@3_NA = .data:0x00C34098; // type:object size:0x1 scope:global -lbl_00C3409C = .data:0x00C3409C; // type:object size:0x431C +lbl_00C3409C = .data:0x00C3409C; // type:object size:0x124 +_LastLineParsed = .data:0x00C341C0; // type:object size:0x200 scope:global +?Commands@?$LHScriptX@D@@2PAU?$LHScriptCommandX@D@@A = .data:0x00C343C0; // type:object size:0x1F0 scope:global +?Commands@?$LHScriptX@G@@2PAU?$LHScriptCommandX@G@@A = .data:0x00C345B0; // type:object size:0x1F0 scope:global +?Conditions@?$LHScriptX@D@@2PAPADA = .data:0x00C347A0; // type:object size:0x18 scope:global +?Conditions@?$LHScriptX@G@@2PAPAGA = .data:0x00C347B8; // type:object size:0x18 scope:global +?NamesToCondition@?$LHScriptX@D@@2PAPADA = .data:0x00C347D0; // type:object size:0x24 scope:global +?NamesToCondition@?$LHScriptX@G@@2PAPAGA = .data:0x00C347F4; // type:object size:0x24 scope:global +??_C@_15COEM@?$AA?$DO?$AA?$DN?$AA?$AA@ = .data:0x00C34818; // type:object size:0x6 scope:global noreloc +??_C@_15GOAG@?$AA?$DM?$AA?$DN?$AA?$AA@ = .data:0x00C34820; // type:object size:0x6 scope:global noreloc +??_C@_13BPHN@?$AA?$DO?$AA?$AA@ = .data:0x00C34828; // type:object size:0x4 scope:global noreloc +??_C@_13LLFA@?$AA?$DM?$AA?$AA@ = .data:0x00C3482C; // type:object size:0x4 scope:global noreloc +??_C@_15ENMJ@?$AA?$CB?$AA?$DN?$AA?$AA@ = .data:0x00C34830; // type:object size:0x6 scope:global noreloc +??_C@_15JIDN@?$AA?$DM?$AA?$DO?$AA?$AA@ = .data:0x00C34838; // type:object size:0x6 scope:global noreloc +??_C@_15MOCD@?$AA?$DN?$AA?$DN?$AA?$AA@ = .data:0x00C34840; // type:object size:0x6 scope:global noreloc +??_C@_13OJEG@?$AA?$DN?$AA?$AA@ = .data:0x00C34848; // type:object size:0x4 scope:global noreloc +??_C@_02NCLD@?$DO?$DN?$AA@ = .data:0x00C3484C; // type:object size:0x3 scope:global data:string +??_C@_02PPOG@?$DM?$DN?$AA@ = .data:0x00C34850; // type:object size:0x3 scope:global data:string +??_C@_01FAFK@?$DO?$AA@ = .data:0x00C34854; // type:object size:0x2 scope:global data:string +??_C@_01FHE@?$DM?$AA@ = .data:0x00C34858; // type:object size:0x2 scope:global data:string +??_C@_02GMBL@?$CB?$DN?$AA@ = .data:0x00C3485C; // type:object size:0x3 scope:global data:string +??_C@_02FP@?$DM?$DO?$AA@ = .data:0x00C34860; // type:object size:0x3 scope:global data:string +??_C@_02OJEM@?$DN?$DN?$AA@ = .data:0x00C34864; // type:object size:0x3 scope:global data:string +??_C@_1BK@DCOP@?$AAL?$AAH?$AA_?$AAN?$AAO?$AA_?$AAM?$AAE?$AAM?$AAO?$AAR?$AAY?$AA?$AA@ = .data:0x00C34868; // type:object size:0x1A scope:global noreloc +??_C@_1BC@BMAM@?$AAL?$AAH?$AA_?$AAE?$AAR?$AAR?$AAO?$AAR?$AA?$AA@ = .data:0x00C34884; // type:object size:0x12 scope:global noreloc +??_C@_1BA@MMAH@?$AAL?$AAH?$AA_?$AAF?$AAA?$AAI?$AAL?$AA?$AA@ = .data:0x00C34898; // type:object size:0x10 scope:global noreloc +??_C@_1M@KHCM@?$AAL?$AAH?$AA_?$AAO?$AAK?$AA?$AA@ = .data:0x00C348A8; // type:object size:0xC scope:global noreloc +??_C@_1BE@OKAN@?$AAM?$AAA?$AAX?$AA_?$AAD?$AAE?$AAP?$AAT?$AAH?$AA?$AA@ = .data:0x00C348B4; // type:object size:0x14 scope:global noreloc +??_C@_0N@JDNG@LH_NO_MEMORY?$AA@ = .data:0x00C348C8; // type:object size:0xD scope:global data:string +??_C@_08IJPH@LH_ERROR?$AA@ = .data:0x00C348D8; // type:object size:0x9 scope:global data:string +??_C@_07MKOA@LH_FAIL?$AA@ = .data:0x00C348E4; // type:object size:0x8 scope:global data:string +??_C@_05MIP@LH_OK?$AA@ = .data:0x00C348EC; // type:object size:0x6 scope:global data:string +??_C@_09OFBM@MAX_DEPTH?$AA@ = .data:0x00C348F4; // type:object size:0xA scope:global data:string +??_C@_1O@JJH@?$AA?$CK?$AA?$CK?$AA?$CK?$AAV?$AAA?$AAR?$AA?$AA@ = .data:0x00C34900; // type:object size:0xE scope:global noreloc +??_C@_17DHKO@?$AAR?$AAE?$AAM?$AA?$AA@ = .data:0x00C34910; // type:object size:0x8 scope:global noreloc +??_C@_1M@DAAC@?$AAE?$AAN?$AAD?$AAI?$AAF?$AA?$AA@ = .data:0x00C34918; // type:object size:0xC scope:global noreloc +??_C@_15MBIG@?$AAI?$AAF?$AA?$AA@ = .data:0x00C34924; // type:object size:0x6 scope:global noreloc +??_C@_1M@IIID@?$AAC?$AAB?$AAY?$AAT?$AAE?$AA?$AA@ = .data:0x00C3492C; // type:object size:0xC scope:global noreloc +??_C@_1M@IHM@?$AAF?$AAL?$AAO?$AAA?$AAT?$AA?$AA@ = .data:0x00C34938; // type:object size:0xC scope:global noreloc +??_C@_1M@FGLB@?$AAS?$AAL?$AAO?$AAN?$AAG?$AA?$AA@ = .data:0x00C34944; // type:object size:0xC scope:global noreloc +??_C@_1CC@JJLD@?$AAS?$AAE?$AAT?$AA_?$AAT?$AAR?$AAA?$AAN?$AAS?$AAP?$AAA?$AAR?$AAE?$AAN?$AAC?$AAY?$AA?$AA@ = .data:0x00C34950; // type:object size:0x22 scope:global noreloc +??_C@_1BE@HFBH@?$AAL?$AAO?$AAA?$AAD?$AA_?$AAF?$AAO?$AAN?$AAT?$AA?$AA@ = .data:0x00C34974; // type:object size:0x14 scope:global noreloc +??_C@_1CA@BDBB@?$AAL?$AAO?$AAA?$AAD?$AA_?$AAF?$AAO?$AAN?$AAT?$AA_?$AAD?$AAE?$AAP?$AAT?$AAH?$AA?$AA@ = .data:0x00C34988; // type:object size:0x20 scope:global noreloc +??_C@_1BE@BKEE@?$AAL?$AAO?$AAA?$AAD?$AA_?$AAD?$AAA?$AAT?$AAA?$AA?$AA@ = .data:0x00C349A8; // type:object size:0x14 scope:global noreloc +??_C@_1BK@CKDP@?$AAL?$AAO?$AAA?$AAD?$AA_?$AAS?$AAP?$AAR?$AAI?$AAT?$AAE?$AAS?$AA?$AA@ = .data:0x00C349BC; // type:object size:0x1A scope:global noreloc +??_C@_1CG@IIPC@?$AAL?$AAO?$AAA?$AAD?$AA_?$AAS?$AAP?$AAR?$AAI?$AAT?$AAE?$AAS?$AA_?$AAD?$AAE?$AAP?$AAT?$AAH?$AA?$AA@ = .data:0x00C349D8; // type:object size:0x26 scope:global noreloc +??_C@_1BC@BFCL@?$AAL?$AAO?$AAA?$AAD?$AA_?$AAB?$AAM?$AAP?$AA?$AA@ = .data:0x00C34A00; // type:object size:0x12 scope:global noreloc +??_C@_1BG@EPEM@?$AAO?$AAP?$AAE?$AAN?$AA_?$AAS?$AAO?$AAU?$AAN?$AAD?$AA?$AA@ = .data:0x00C34A14; // type:object size:0x16 scope:global noreloc +??_C@_1BG@LNDH@?$AAO?$AAP?$AAE?$AAN?$AA_?$AAM?$AAO?$AAU?$AAS?$AAE?$AA?$AA@ = .data:0x00C34A2C; // type:object size:0x16 scope:global noreloc +??_C@_1BM@LBF@?$AAO?$AAP?$AAE?$AAN?$AA_?$AAK?$AAE?$AAY?$AAB?$AAO?$AAA?$AAR?$AAD?$AA?$AA@ = .data:0x00C34A44; // type:object size:0x1C scope:global noreloc +??_C@_1CI@CHOA@?$AAA?$AAL?$AAL?$AAO?$AAC?$AA_?$AAM?$AAO?$AAU?$AAS?$AAE?$AA_?$AAS?$AAU?$AAR?$AAF?$AAA?$AAC?$AAE?$AA?$AA@ = .data:0x00C34A60; // type:object size:0x28 scope:global noreloc +??_C@_1CO@EHIO@?$AAS?$AAE?$AAT?$AA_?$AAV?$AAA?$AAN?$AAI?$AAS?$AAH?$AA_?$AAO?$AAB?$AAJ?$AAE?$AAC?$AAT?$AA_?$AAD?$AAI@ = .data:0x00C34A88; // type:object size:0x2E scope:global noreloc +??_C@_1BM@IGBC@?$AAU?$AAS?$AAE?$AA_?$AAW?$AAI?$AAR?$AAE?$AAF?$AAR?$AAA?$AAM?$AAE?$AA?$AA@ = .data:0x00C34AB8; // type:object size:0x1C scope:global noreloc +??_C@_1BO@FGNF@?$AAU?$AAS?$AAE?$AA_?$AAS?$AAM?$AAA?$AAL?$AAL?$AA_?$AAB?$AAU?$AAM?$AAP?$AA?$AA@ = .data:0x00C34AD4; // type:object size:0x1E scope:global noreloc +??_C@_1BK@EPEP@?$AAS?$AAE?$AAT?$AA_?$AAV?$AAR?$AAA?$AAM?$AA_?$AAM?$AAE?$AAM?$AA?$AA@ = .data:0x00C34AF4; // type:object size:0x1A scope:global noreloc +??_C@_1BI@JBGB@?$AAS?$AAE?$AAT?$AA_?$AAA?$AAG?$AAP?$AA_?$AAM?$AAE?$AAM?$AA?$AA@ = .data:0x00C34B10; // type:object size:0x18 scope:global noreloc +??_C@_1CA@MLKB@?$AAS?$AAH?$AAO?$AAW?$AA_?$AAD?$AAE?$AAB?$AAU?$AAG?$AA_?$AAI?$AAN?$AAF?$AAO?$AA?$AA@ = .data:0x00C34B28; // type:object size:0x20 scope:global noreloc +??_C@_1CA@GOPH@?$AAU?$AAS?$AAE?$AA_?$AAL?$AAO?$AAW?$AA_?$AAT?$AAE?$AAX?$AAT?$AAU?$AAR?$AAE?$AA?$AA@ = .data:0x00C34B48; // type:object size:0x20 scope:global noreloc +??_C@_1BC@EMOO@?$AAM?$AAN?$AAT?$AA_?$AAN?$AAA?$AAM?$AAE?$AA?$AA@ = .data:0x00C34B68; // type:object size:0x12 scope:global noreloc +??_C@_1DE@OHAK@?$AAS?$AAW?$AAA?$AAP?$AA_?$AAT?$AAE?$AAX?$AAT?$AAU?$AAR?$AAE?$AA_?$AAA?$AAG?$AAP?$AA_?$AAV?$AAS?$AA_@ = .data:0x00C34B7C; // type:object size:0x34 scope:global noreloc +??_C@_1BE@GBNJ@?$AAD?$AA3?$AAD?$AA_?$AAS?$AAE?$AAT?$AAU?$AAP?$AA?$AA@ = .data:0x00C34BB0; // type:object size:0x14 scope:global noreloc +??_C@_1CM@KPHP@?$AAB?$AAU?$AAI?$AAL?$AAD?$AA_?$AAA?$AAL?$AAL?$AA_?$AAM?$AAN?$AAT?$AA_?$AAT?$AAE?$AAX?$AAT?$AAU?$AAR@ = .data:0x00C34BC4; // type:object size:0x2C scope:global noreloc +??_C@_1BI@GOAO@?$AAO?$AAP?$AAE?$AAN?$AA_?$AAS?$AAC?$AAR?$AAE?$AAE?$AAN?$AA?$AA@ = .data:0x00C34BF0; // type:object size:0x18 scope:global noreloc +??_C@_06BANP@?$CK?$CK?$CKVAR?$AA@ = .data:0x00C34C08; // type:object size:0x7 scope:global data:string +??_C@_03BHPL@REM?$AA@ = .data:0x00C34C10; // type:object size:0x4 scope:global data:string +??_C@_05BGAE@ENDIF?$AA@ = .data:0x00C34C14; // type:object size:0x6 scope:global data:string +??_C@_02FDOJ@IF?$AA@ = .data:0x00C34C1C; // type:object size:0x3 scope:global data:string +??_C@_05KONE@CBYTE?$AA@ = .data:0x00C34C20; // type:object size:0x6 scope:global data:string +??_C@_05DDGG@SLONG?$AA@ = .data:0x00C34C28; // type:object size:0x6 scope:global data:string +??_C@_0BB@OEPH@SET_TRANSPARENCY?$AA@ = .data:0x00C34C30; // type:object size:0x11 scope:global data:string +??_C@_09KCC@LOAD_FONT?$AA@ = .data:0x00C34C44; // type:object size:0xA scope:global data:string +??_C@_0BA@LOH@LOAD_FONT_DEPTH?$AA@ = .data:0x00C34C50; // type:object size:0x10 scope:global data:string +??_C@_09GHFH@LOAD_DATA?$AA@ = .data:0x00C34C60; // type:object size:0xA scope:global data:string +??_C@_0N@PAEL@LOAD_SPRITES?$AA@ = .data:0x00C34C6C; // type:object size:0xD scope:global data:string +??_C@_0BD@JCBL@LOAD_SPRITES_DEPTH?$AA@ = .data:0x00C34C7C; // type:object size:0x13 scope:global data:string +??_C@_08KJGC@LOAD_BMP?$AA@ = .data:0x00C34C90; // type:object size:0x9 scope:global data:string +??_C@_0L@DHO@OPEN_SOUND?$AA@ = .data:0x00C34C9C; // type:object size:0xB scope:global data:string +??_C@_0L@PJLE@OPEN_MOUSE?$AA@ = .data:0x00C34CA8; // type:object size:0xB scope:global data:string +??_C@_0O@DFAN@OPEN_KEYBOARD?$AA@ = .data:0x00C34CB4; // type:object size:0xE scope:global data:string +??_C@_0BE@CIH@ALLOC_MOUSE_SURFACE?$AA@ = .data:0x00C34CC4; // type:object size:0x14 scope:global data:string +??_C@_0BH@GHCC@SET_VANISH_OBJECT_DIST?$AA@ = .data:0x00C34CD8; // type:object size:0x17 scope:global data:string +??_C@_0O@JHJC@USE_WIREFRAME?$AA@ = .data:0x00C34CF0; // type:object size:0xE scope:global data:string +??_C@_0P@BNAK@USE_SMALL_BUMP?$AA@ = .data:0x00C34D00; // type:object size:0xF scope:global data:string +??_C@_0N@BNOB@SET_VRAM_MEM?$AA@ = .data:0x00C34D10; // type:object size:0xD scope:global data:string +??_C@_0M@DCMH@SET_AGP_MEM?$AA@ = .data:0x00C34D20; // type:object size:0xC scope:global data:string +??_C@_0BA@DONH@SHOW_DEBUG_INFO?$AA@ = .data:0x00C34D2C; // type:object size:0x10 scope:global data:string +??_C@_0BA@LOEO@USE_LOW_TEXTURE?$AA@ = .data:0x00C34D3C; // type:object size:0x10 scope:global data:string +??_C@_08JKBI@MNT_NAME?$AA@ = .data:0x00C34D4C; // type:object size:0x9 scope:global data:string +??_C@_0BK@EHCF@SWAP_TEXTURE_AGP_VS_LOCAL?$AA@ = .data:0x00C34D58; // type:object size:0x1A scope:global data:string +??_C@_09MPOA@D3D_SETUP?$AA@ = .data:0x00C34D74; // type:object size:0xA scope:global data:string +??_C@_0BG@OMPP@BUILD_ALL_MNT_TEXTURE?$AA@ = .data:0x00C34D80; // type:object size:0x16 scope:global data:string +??_C@_0M@GFCM@OPEN_SCREEN?$AA@ = .data:0x00C34D98; // type:object size:0xC scope:global data:string +??_C@_0CP@CANJ@C?3?2Dev?2Libs?2lionhead?2lhlib?2VER5?4@ = .data:0x00C34DA4; // type:object size:0x2F scope:global data:string +??_C@_04FJBM@?$CFf?0?5?$AA@ = .data:0x00C34DD4; // type:object size:0x5 scope:global data:string +??_C@_04GCDK@?$CFs?0?5?$AA@ = .data:0x00C34DDC; // type:object size:0x5 scope:global data:string +??_C@_06PBPK@?$CC?$CFs?$CC?0?5?$AA@ = .data:0x00C34DE4; // type:object size:0x7 scope:global data:string +??_C@_01GFI@?$CI?$AA@ = .data:0x00C34DEC; // type:object size:0x2 scope:global data:string noreloc +lbl_00C34DF0 = .data:0x00C34DF0; // type:object size:0x35C8 ??_R0?AVios@@@8 = .data:0x00C3C138; // type:object size:0x12 ??_R0?AVostream@@@8 = .data:0x00C3C150; // type:object size:0x16 ??_R0?AVistream@@@8 = .data:0x00C3C168; // type:object size:0x16 @@ -31621,6 +31768,9 @@ _?wcbuffer@?4??__getlocaleinfo@@9@9 = .data:0x00E84564; // type:object size:0x8 ?gMouse@@3PAULHMouse@@A = .data:0x00E85204; // type:object size:0x4 scope:global ?gMouseWheelAccum@@3HA = .data:0x00E85300; // type:object size:0x4 scope:global ?gLHDraw@@3VLHDraw@@A = .data:0x00E8586C; // type:object size:0x8 scope:global +?g_lhConvert@@3VLHConvert@@A = .data:0x00E85874; // type:object size:0x90 scope:global +?g_lhScriptResources@@3PAULHScriptResource@@A = .data:0x00E85964; // type:object size:0x6720 scope:global +?g_lhText@@3ULHText@@A = .data:0x00E8C084; // type:object size:0x28 scope:global ?g_windowForScreen@@3PAUHWND__@@A = .data:0x00E8C0F4; // type:object size:0x4 scope:global ?unk_E8C0F8@@3HA = .data:0x00E8C0F8; // type:object size:0x4 scope:global ?g_appMinimized@@3HA = .data:0x00E8C0FC; // type:object size:0x4 scope:global @@ -31653,6 +31803,8 @@ _gDebugStackInitialised = .data:0x00E905F8; // type:object size:0x1 scope:global ?g_screenCritSec@@3U_RTL_CRITICAL_SECTION@@A = .data:0x00E90650; // type:object size:0x18 scope:global ?gDirectInput@@3PAUIDirectInputA@@A = .data:0x00E90668; // type:object size:0x4 scope:global ?gMouseDevice@@3PAUIDirectInputDeviceA@@A = .data:0x00E9066C; // type:object size:0x4 scope:global +?g_lhTransparentPixel16@@3ULHPixel16@@A = .data:0x00E91EDC; // type:object size:0x4 scope:global +?g_lhTransparentColour@@3ULHColor@@A = .data:0x00E91EE0; // type:object size:0x4 scope:global ?unk_EA9E9C@@3HA = .data:0x00EA9E9C; // type:object size:0x4 scope:global ?g_first@LH3DCameraChecker@@2PEAU1@EA = .data:0x00EB99A8; // type:object size:0x4 scope:global ?unk_ECA5F0@@3HA = .data:0x00ECA5F0; // type:object size:0x4 scope:global @@ -31696,4 +31848,6 @@ __acmdln = .data:0x00FADCCC; // type:object size:0x4 scope:global ___env_initialized = .data:0x00FADCD0; // type:object size:0x4 scope:global ___mbctype_initialized = .data:0x00FADCD4; // type:object size:0x4 scope:global ___onexitend = .data:0x00FADCD8; // type:object size:0x4 scope:global -___onexitbegin = .data:0x00FADCDC; // type:object size:0x12124 scope:global +___onexitbegin = .data:0x00FADCDC; // type:object size:0x4 scope:global +?Pram@?$LHScriptX@G@@2U?$LHScriptPramX@G@@A = .data:0x00FADCE0; // type:object size:0xC060 scope:global +?Pram@?$LHScriptX@D@@2U?$LHScriptPramX@D@@A = .data:0x00FB9D40; // type:object size:0x6060 scope:global diff --git a/configure.py b/configure.py index ba589819..1e9ab208 100755 --- a/configure.py +++ b/configure.py @@ -171,7 +171,7 @@ # Tool versions config.binutils_tag = "2.42-2" -config.dtk_tag = "v0.0.19" +config.dtk_tag = "v0.0.20" config.objdiff_tag = "v3.7.2" config.sjiswrap_tag = "v1.2.2" config.wibo_tag = "1.1.0" @@ -1299,7 +1299,7 @@ def LibObject(completed, archive, member, **options): Object(NonMatching, "Lionhead/LHLib/ver5.0/LHText.cpp"), Object(NonMatching, "Lionhead/LHLib/ver5.0/LHHeap2.cpp", extra_cflags=["/GX"]), Object(NonMatching, "Lionhead/LHLib/ver5.0/LHMouse.cpp"), - Object(NonMatching, "Lionhead/LHLib/ver5.0/LHScript.cpp"), + Object(NonMatching, "Lionhead/LHLib/ver5.0/LHScript.cpp", extra_cflags=["/GX", "/Ob0"]), Object(NonMatching, "Lionhead/LHLib/ver5.0/LHSpriteList.cpp"), Object(NonMatching, "Lionhead/LHLib/ver5.0/LHConvert.cpp"), Object(NonMatching, "Lionhead/LHLib/ver5.0/LHSprite.cpp"), diff --git a/src/Lionhead/LH3DLib/development/LHColor.h b/src/Lionhead/LH3DLib/development/LHColor.h index 1ced6b25..4731412c 100644 --- a/src/Lionhead/LH3DLib/development/LHColor.h +++ b/src/Lionhead/LH3DLib/development/LHColor.h @@ -1,18 +1,17 @@ #ifndef BW1_DECOMP_LH_COLOR_INCLUDED_H #define BW1_DECOMP_LH_COLOR_INCLUDED_H -#include /* For static_assert */ -#include /* For uint8_t */ +#include +#include -// Memory order is B, G, R, A. Confirmed by LHScreen::Clear, which packs -// b | (g << 8) | (r << 16) into a 0x00RRGGBB DDBLTFX colour-fill value. struct LHColor { - uint8_t b; /* 0x0 */ - uint8_t g; /* 0x1 */ - uint8_t r; /* 0x2 */ - uint8_t a; /* 0x3 */ + uint8_t b; + uint8_t g; + uint8_t r; + uint8_t a; + + void Set(uint8_t red, uint8_t green, uint8_t blue); }; -static_assert(sizeof(LHColor) == 0x4, "Data type is of wrong size"); #endif /* BW1_DECOMP_LH_COLOR_INCLUDED_H */ diff --git a/src/Lionhead/LHLib/ver5.0/LHConvert.h b/src/Lionhead/LHLib/ver5.0/LHConvert.h index 4ba5bf7e..f9853c12 100644 --- a/src/Lionhead/LHLib/ver5.0/LHConvert.h +++ b/src/Lionhead/LHLib/ver5.0/LHConvert.h @@ -1,4 +1,28 @@ #ifndef BW1_DECOMP_LHCONVERT_INCLUDED_H #define BW1_DECOMP_LHCONVERT_INCLUDED_H +#include + +#include "LHReturn.h" + +struct FlicHeader; +struct LHColor; +struct LHSprite; +struct LHSpriteList; + +// Image-to-sprite conversion. The global instance lives at 0xE85874. +// TODO: layout unknown (0x90 bytes); only ToSprites is declared so far. +class LHConvert +{ +public: + uint8_t field_0x0[0x90]; + + // BW1W120 007efcf0 LHConvert::ToSprites(char*, LHSpriteList*, LHColor*, unsigned long, long*, FlicHeader*, unsigned long*) + LH_RETURN ToSprites(char* file_name, LHSpriteList* sprite_list, LHColor* colors, unsigned long flags, long* param_5, + FlicHeader* flic_header, unsigned long* param_7); +}; + +// BW1W120 007efb60 LHLoadABMP(char*, LHSprite*, unsigned long) +LH_RETURN LHLoadABMP(char* file_name, LHSprite* sprite, unsigned long param_3); + #endif /* BW1_DECOMP_LHCONVERT_INCLUDED_H */ diff --git a/src/Lionhead/LHLib/ver5.0/LHDraw.h b/src/Lionhead/LHLib/ver5.0/LHDraw.h index e685decb..585b4ca9 100644 --- a/src/Lionhead/LHLib/ver5.0/LHDraw.h +++ b/src/Lionhead/LHLib/ver5.0/LHDraw.h @@ -8,18 +8,19 @@ struct LHRegion; struct LHPixel16 { - uint16_t value; /* 0x0 */ + uint16_t value; // BW1W120 00449650 LHPixel16::Set(LHColor) - // Packs an LHColor into this pixel using the active LHScreen format. void Set(LHColor color); + // BW1W120 00521a90 LHPixel16::Set(unsigned char, unsigned char, unsigned char) + void Set(uint8_t red, uint8_t green, uint8_t blue); }; struct LHSprite { - uint16_t Width; /* 0x0 */ - uint16_t Height; /* 0x2 */ - uint8_t* PixelData; /* 0x4 */ + uint16_t Width; + uint16_t Height; + uint8_t* PixelData; }; class LHDraw diff --git a/src/Lionhead/LHLib/ver5.0/LHReturn.h b/src/Lionhead/LHLib/ver5.0/LHReturn.h new file mode 100644 index 00000000..30330bcc --- /dev/null +++ b/src/Lionhead/LHLib/ver5.0/LHReturn.h @@ -0,0 +1,14 @@ +#ifndef BW1_DECOMP_LH_RETURN_INCLUDED_H +#define BW1_DECOMP_LH_RETURN_INCLUDED_H + +// Generic Lionhead status code, returned throughout LHLib and LHMultiplayer. +// TODO: value 1 is unnamed (never observed); header filename is fabricated. +enum LH_RETURN +{ + LH_OK = 0x0, + LH_FAIL = 0x2, + LH_ERROR = 0x3, + LH_NO_MEMORY = 0x4, +}; + +#endif /* BW1_DECOMP_LH_RETURN_INCLUDED_H */ diff --git a/src/Lionhead/LHLib/ver5.0/LHScreen.cpp b/src/Lionhead/LHLib/ver5.0/LHScreen.cpp index 6310c6e3..55d92e5c 100644 --- a/src/Lionhead/LHLib/ver5.0/LHScreen.cpp +++ b/src/Lionhead/LHLib/ver5.0/LHScreen.cpp @@ -1098,15 +1098,3 @@ int LHScreen::IsAppMinimized() { return g_appMinimized; } - -// BW1W120 007e8a20 LHScreen::Depth(void) -uint8_t LHScreen::Depth() -{ - return depth; -} - -// BW1W120 007e9df0 LHScreen::MaxDepth(void) -uint8_t LHScreen::MaxDepth() -{ - return 32; -} diff --git a/src/Lionhead/LHLib/ver5.0/LHScreen.h b/src/Lionhead/LHLib/ver5.0/LHScreen.h index 7c62c371..a7532ee9 100644 --- a/src/Lionhead/LHLib/ver5.0/LHScreen.h +++ b/src/Lionhead/LHLib/ver5.0/LHScreen.h @@ -142,9 +142,9 @@ struct LHScreen // BW1W120 007ded50 LHScreen::IsAppMinimized(void) int IsAppMinimized(); // BW1W120 007e8a20 LHScreen::Depth(void) - uint8_t Depth(); + uint8_t Depth() { return depth; } // BW1W120 007e9df0 LHScreen::MaxDepth(void) - uint8_t MaxDepth(); + uint8_t MaxDepth() { return 32; } }; static_assert(sizeof(LHScreen) == 0x1b4, "Data type is of wrong size"); diff --git a/src/Lionhead/LHLib/ver5.0/LHScript.cpp b/src/Lionhead/LHLib/ver5.0/LHScript.cpp index e69de29b..d6b326c0 100644 --- a/src/Lionhead/LHLib/ver5.0/LHScript.cpp +++ b/src/Lionhead/LHLib/ver5.0/LHScript.cpp @@ -0,0 +1,1000 @@ +#include + +#include +#include + +#pragma intrinsic(strcpy) + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern LHScreen g_lhScreen; // 0xE85050 the global LHScreen instance + +// The front-end resource bank filled by the LOAD_BMP/LOAD_SPRITES/LOAD_DATA +// commands and read back by the front end. 100 slots at 0xE85964. +// TODO: fabricated names; real home unknown (probably a member of LHSystem, +// like most globals referenced here — 0xE85964 = LHSystem 0xE85040 + 0x924). +struct LHScriptResource +{ + long type; /* 1 = raw data, 2 = BMP sprite, 3 = sprite list */ + void* data; + char name[256]; +}; +extern LHScriptResource g_lhScriptResources[100]; // 0xE85964 + +extern LHConvert g_lhConvert; // 0xE85874 +extern LHText g_lhText; // 0xE8C084 +extern LHPixel16 g_lhTransparentPixel16; // 0xE91EDC TODO: fabricated name +extern LHColor g_lhTransparentColour; // 0xE91EE0 TODO: fabricated name + +// Front-end/3D-driver setup setters called by ProcessCommand. +// TODO: all fabricated names; tiny setter bodies live at 0x0087FC90..0x0087FD40 +// (plus one empty stub at 0x007DED40), real declarations/home unknown. +void SetD3DSetup(long value); // 0x0087FC90 +void SetSwapTextureAGPvsLocal(long value); // 0x0087FCA0 +void SetShowDebugInfo(long value); // 0x0087FCB0 +void SetAGPMem(long bytes); // 0x0087FCC0 +void SetVRAMMem(long bytes); // 0x0087FCD0 +void SetUseWireframe(long value); // 0x0087FCE0 +void SetAllocMouseSurface(long value); // 0x0087FCF0 +void SetBuildAllMntTexture(long value); // 0x0087FD00 +char* SetMntName(char* name); // 0x0087FD10 wraps LH3DIsland::SetFileToLoad +void SetUseLowTexture(long value); // 0x0087FD20 +void SetUseSmallBump(long value); // 0x0087FD30 +void SetVanishObjectDist(float dist); // 0x0087FD40 +void __stdcall D3DSetup(long value); // 0x007DED40 empty stub in release builds + +// Debug copy of the most recently parsed script line, shared by both +// instantiations (see LoadOneLine). TODO: fabricated name. +static char LastLineParsed[512] = "no line parsed yet"; + +// BW1W120 00c343c0 LHScriptX::Commands +LHScriptCommandX LHScriptX::Commands[] = { + {"OPEN_SCREEN", "NNNN "}, + {"BUILD_ALL_MNT_TEXTURE", "N "}, + {"D3D_SETUP", "N "}, + {"SWAP_TEXTURE_AGP_VS_LOCAL", "N "}, + {"MNT_NAME", "A "}, + {"USE_LOW_TEXTURE", "N "}, + {"SHOW_DEBUG_INFO", "N "}, + {"SET_AGP_MEM", "N "}, + {"SET_VRAM_MEM", "N "}, + {"USE_SMALL_BUMP", "N "}, + {"USE_WIREFRAME", "N "}, + {"SET_VANISH_OBJECT_DIST", "N "}, + {"ALLOC_MOUSE_SURFACE", "N "}, + {"OPEN_KEYBOARD", "A "}, + {"OPEN_MOUSE", "A "}, + {"OPEN_SOUND", "A "}, + {"LOAD_BMP", "AN "}, + {"LOAD_SPRITES_DEPTH", "ANN "}, + {"LOAD_SPRITES", "AN "}, + {"LOAD_DATA", "AN "}, + {"LOAD_FONT_DEPTH", "AN "}, + {"LOAD_FONT", "AN "}, + {"SET_TRANSPARENCY", "NNN "}, + {"SLONG", "A "}, + {"FLOAT", "A "}, + {"CBYTE", "A "}, + {"IF", "AAA "}, + {"ENDIF", " "}, + {"REM", " "}, + {"***VAR", " "}, + {NULL, ""}, +}; + +// BW1W120 00c345b0 LHScriptX::Commands +LHScriptCommandX LHScriptX::Commands[] = { + {L"OPEN_SCREEN", "NNNN "}, + {L"BUILD_ALL_MNT_TEXTURE", "N "}, + {L"D3D_SETUP", "N "}, + {L"SWAP_TEXTURE_AGP_VS_LOCAL", "N "}, + {L"MNT_NAME", "A "}, + {L"USE_LOW_TEXTURE", "N "}, + {L"SHOW_DEBUG_INFO", "N "}, + {L"SET_AGP_MEM", "N "}, + {L"SET_VRAM_MEM", "N "}, + {L"USE_SMALL_BUMP", "N "}, + {L"USE_WIREFRAME", "N "}, + {L"SET_VANISH_OBJECT_DIST", "N "}, + {L"ALLOC_MOUSE_SURFACE", "N "}, + {L"OPEN_KEYBOARD", "A "}, + {L"OPEN_MOUSE", "A "}, + {L"OPEN_SOUND", "A "}, + {L"LOAD_BMP", "AN "}, + {L"LOAD_SPRITES_DEPTH", "ANN "}, + {L"LOAD_SPRITES", "AN "}, + {L"LOAD_DATA", "AN "}, + {L"LOAD_FONT_DEPTH", "AN "}, + {L"LOAD_FONT", "AN "}, + {L"SET_TRANSPARENCY", "NNN "}, + {L"SLONG", "A "}, + {L"FLOAT", "A "}, + {L"CBYTE", "A "}, + {L"IF", "AAA "}, + {L"ENDIF", " "}, + {L"REM", " "}, + {L"***VAR", " "}, + {NULL, ""}, +}; + +// BW1W120 00c347a0 LHScriptX::Conditions +char* LHScriptX::Conditions[] = {"MAX_DEPTH", "LH_OK", "LH_FAIL", "LH_ERROR", "LH_NO_MEMORY", NULL}; + +// BW1W120 00c347b8 LHScriptX::Conditions +wchar_t* LHScriptX::Conditions[] = {L"MAX_DEPTH", L"LH_OK", L"LH_FAIL", L"LH_ERROR", L"LH_NO_MEMORY", NULL}; + +// BW1W120 00c347d0 LHScriptX::NamesToCondition +char* LHScriptX::NamesToCondition[] = {"=", "==", "<>", "!=", "<", ">", "<=", ">=", NULL}; + +// BW1W120 00c347f4 LHScriptX::NamesToCondition +wchar_t* LHScriptX::NamesToCondition[] = {L"=", L"==", L"<>", L"!=", L"<", L">", L"<=", L">=", NULL}; + +// BW1W120 00fadce0 LHScriptX::Pram +LHScriptPramX LHScriptX::Pram; +// BW1W120 00fb9d40 LHScriptX::Pram +LHScriptPramX LHScriptX::Pram; + +// BW1W120 007e7380 BW1M100 1061e4c8 LHScriptX::Load(char*, long*) +template LH_RETURN LHScriptX::Load(char* file_name, long* param_2) +{ + DestroyVariables(); + LHScriptX saved = *this; + commands = NULL; + conditionNames = NULL; + LH_RETURN result = LoadFile(file_name, param_2); + *this = saved; + return result; +} + +// BW1W120 007e72c0 BW1M100 1061e38c LHScriptX::Load(char*, LHScriptCommandX*, LH_RETURN (*)(long, LHScriptPramX*), long*) +template +LH_RETURN LHScriptX::Load(char* file_name, LHScriptCommandX* new_commands, + LH_RETURN(__cdecl* command_callback)(long, LHScriptPramX*), long* param_4) +{ + DestroyVariables(); + LHScriptX saved = *this; + commands = new_commands; + commandCallback = command_callback; + conditionNames = NULL; + LH_RETURN result = LoadFile(file_name, param_4); + *this = saved; + return result; +} + +// BW1W120 007e7260 LHScriptX::Load(char*, char**, LH_RETURN (*)(long, long*), long*) +template +LH_RETURN LHScriptX::Load(char* file_name, T** condition_names, LH_RETURN(__cdecl* condition_callback)(long, long*), + long* param_4) +{ + DestroyVariables(); + LHScriptX saved = *this; + conditionNames = condition_names; + conditionCallback = condition_callback; + commands = NULL; + LH_RETURN result = LoadFile(file_name, param_4); + *this = saved; + return result; +} + +// BW1W120 007e7320 LHScriptX::Load(char*, LHScriptCommandX*, LH_RETURN (*)(long, LHScriptPramX*), char**, LH_RETURN (*)(long, long*), long*) +template +LH_RETURN LHScriptX::Load(char* file_name, LHScriptCommandX* new_commands, + LH_RETURN(__cdecl* command_callback)(long, LHScriptPramX*), T** condition_names, + LH_RETURN(__cdecl* condition_callback)(long, long*), long* param_6) +{ + DestroyVariables(); + LHScriptX saved = *this; + commands = new_commands; + commandCallback = command_callback; + conditionNames = condition_names; + conditionCallback = condition_callback; + LH_RETURN result = LoadFile(file_name, param_6); + *this = saved; + return result; +} + +// BW1W120 007e73d0 LHScriptX::SetVariables(LHScriptCommandX*, LH_RETURN (*)(long, LHScriptPramX*), long*) +template +LH_RETURN LHScriptX::SetVariables(LHScriptCommandX* new_commands, + LH_RETURN(__cdecl* command_callback)(long, LHScriptPramX*), long* param_3) +{ + DestroyVariables(); + commands = new_commands; + commandCallback = command_callback; + conditionNames = NULL; + ifLevel = -1; + lineNumber = 0; + return LH_OK; +} + +// BW1W120 007e8240 LHScriptX::ProcessCommand(long, LHScriptPramX*) +// Dispatches the built-in front-end setup command set; indices <= 0 are +// forwarded to the host command callback as command -1 - index. +template LH_RETURN LHScriptX::ProcessCommand(long command, LHScriptPramX* pram) +{ + LH_RETURN result; + if (command > 0) + { + switch (command) + { + case 1: // OPEN_SCREEN + if (pram->number[3] == 1) + g_lhScreen.SetFullscreenMode(1); + return (LH_RETURN)g_lhScreen.Open(pram->number[0], pram->number[1], pram->number[2]); + case 2: // BUILD_ALL_MNT_TEXTURE + SetBuildAllMntTexture(pram->number[0]); + return LH_OK; + case 3: // D3D_SETUP + D3DSetup(pram->number[0]); + SetD3DSetup(1); + return LH_OK; + case 4: // SWAP_TEXTURE_AGP_VS_LOCAL + SetSwapTextureAGPvsLocal(pram->number[0]); + return LH_OK; + case 5: // MNT_NAME + SetMntName(LHStringOps::makechar(pram->text[0])); + return LH_OK; + case 6: // USE_LOW_TEXTURE + SetUseLowTexture(pram->number[0]); + return LH_OK; + case 7: // SHOW_DEBUG_INFO + SetShowDebugInfo(pram->number[0]); + return LH_OK; + case 8: // SET_AGP_MEM + SetAGPMem(pram->number[0] << 20); + return LH_OK; + case 9: // SET_VRAM_MEM + SetVRAMMem(pram->number[0] << 20); + return LH_OK; + case 10: // USE_SMALL_BUMP + SetUseSmallBump(pram->number[0]); + return LH_OK; + case 11: // USE_WIREFRAME + SetUseWireframe(pram->number[0]); + return LH_OK; + case 12: // SET_VANISH_OBJECT_DIST + SetVanishObjectDist((float)pram->number[0] * (float)pram->number[0]); + return LH_OK; + case 13: // ALLOC_MOUSE_SURFACE + SetAllocMouseSurface(pram->number[0]); + return LH_OK; + case 20: // LOAD_DATA + { + if ((unsigned long)pram->number[1] >= 100) + return LH_ERROR; + result = (LH_RETURN)LHLoadDataToMemory(LHStringOps::makechar(pram->text[0]), + &g_lhScriptResources[pram->number[1]].data, NULL); + if (result) + return result; + g_lhScriptResources[pram->number[1]].type = 1; + strcpy(g_lhScriptResources[pram->number[1]].name, LHStringOps::makechar(pram->text[0])); + return result; + } + // TODO: the original shares a single "return result" tail and the type=3 + + // strcpy success tail across the LOAD_BMP/LOAD_SPRITES* cases (see the + // shared blocks around 0x7E85E9 in the target); the exact source shape for + // that cross-case merge has not been found yet. + case 17: // LOAD_BMP + { + if ((unsigned long)pram->number[1] >= 100) + return LH_ERROR; +// The #line pins below reproduce the original build's __FILE__/__LINE__ values +// in the memory-tracking operator new calls (evidence: the file/line immediates +// pushed at each call site, e.g. 0x408 = 1032 in CreateVariable). Compiler +// diagnostics for the rest of this file will report the original path/lines. +#line 312 "C:\\Dev\\Libs\\lionhead\\lhlib\\VER5.0\\LHScript.cpp" + LHSprite* sprite = new (__FILE__, __LINE__) LHSprite; + result = LH_ERROR; + g_lhScriptResources[pram->number[1]].data = sprite; + if (!sprite) + return result; + result = LHLoadABMP(LHStringOps::makechar(pram->text[0]), sprite, 0); + if (result) + { + delete sprite; + return result; + } + g_lhScriptResources[pram->number[1]].type = 2; + strcpy(g_lhScriptResources[pram->number[1]].name, LHStringOps::makechar(pram->text[0])); + return LH_OK; + } + case 18: // LOAD_SPRITES_DEPTH + { + if ((unsigned long)pram->number[1] >= 100) + return LH_ERROR; +#line 333 + LHSpriteList* spriteList = new (__FILE__, __LINE__) LHSpriteList; + result = LH_ERROR; + g_lhScriptResources[pram->number[1]].data = spriteList; + if (!spriteList) + return result; + if (pram->number[2] != 16 && pram->number[2] != 24) + { + delete spriteList; + return result; + } + result = g_lhConvert.ToSprites(LHStringOps::makechar(pram->text[0]), spriteList, NULL, + pram->number[2] == 16 ? 3 : 1, NULL, NULL, NULL); + if (result) + { + delete spriteList; + return result; + } + g_lhScriptResources[pram->number[1]].type = 3; + strcpy(g_lhScriptResources[pram->number[1]].name, LHStringOps::makechar(pram->text[0])); + return result; + } + case 19: // LOAD_SPRITES + { + if ((unsigned long)pram->number[1] >= 100) + return LH_ERROR; + LHSpriteList* spriteList = new (__FILE__, __LINE__) LHSpriteList; + result = LH_ERROR; + g_lhScriptResources[pram->number[1]].data = spriteList; + if (!spriteList) + return result; + result = g_lhConvert.ToSprites(LHStringOps::makechar(pram->text[0]), spriteList, NULL, + g_lhScreen.Depth() == 16 ? 3 : 1, NULL, NULL, NULL); + if (result) + { + delete spriteList; + return result; + } + g_lhScriptResources[pram->number[1]].type = 3; + strcpy(g_lhScriptResources[pram->number[1]].name, LHStringOps::makechar(pram->text[0])); + return result; + } + case 21: // LOAD_FONT_DEPTH + return g_lhText.LoadFont(LHStringOps::makechar(pram->text[0]), pram->number[1] != 16 ? 1 : 3); + case 22: // LOAD_FONT + return g_lhText.LoadFont(LHStringOps::makechar(pram->text[0]), g_lhScreen.Depth() == 16 ? 3 : 1); + case 23: // SET_TRANSPARENCY + g_lhTransparentPixel16.Set(pram->number[0], pram->number[1], pram->number[2]); + g_lhTransparentColour.Set(pram->number[0], pram->number[1], pram->number[2]); + return LH_OK; + case 24: // SLONG + case 25: // FLOAT + case 26: // CBYTE + return CreateVariable(command - 1, pram); + case 27: // IF + return CommandIf(pram->text[0], pram->text[1], pram->text[2]); + default: + return LH_ERROR; + } + } + return commandCallback(-1 - command, pram); +} + +// BW1W120 007e7fb0 LHScriptCommandX::GetCommandAsText(char*) +// Renders "NAME(%d, %s, ...)\n" style prototype text for this command. +template T* LHScriptCommandX::GetCommandAsText(T* text) +{ + LHStringOps::strcpy(text, name); + LHStringOps::strcat(text, LHStringOps::fromchar("(")); + unsigned int length = LHStringOps::strlen(text); + for (unsigned int i = 0; i < 12; i++) + { + switch (params[i]) + { + case 'A': + LHStringOps::strcat(text, LHStringOps::fromchar("%s, ")); + break; + case 'F': + LHStringOps::strcat(text, LHStringOps::fromchar("%f, ")); + break; + case 'L': + LHStringOps::strcat(text, LHStringOps::fromchar("\"%s\", ")); + break; + case 'N': + LHStringOps::strcat(text, LHStringOps::fromchar("%d, ")); + break; + } + } + if (length != LHStringOps::strlen(text)) + text[LHStringOps::strlen(text) - 2] = 0; + LHStringOps::strcat(text, LHStringOps::fromchar(")\n")); + return text; +} + +// BW1W120 007e9ad0 LHScriptX::PostFileOpenStuff(LHReleasedOSFile&) +void LHScriptX::PostFileOpenStuff(LHOSFile& file) {} + +// BW1W120 007e6b40 LHScriptX::PostFileOpenStuff(LHReleasedOSFile&) +// Reads and discards the UTF-16 byte-order mark at the head of the file. +void LHScriptX::PostFileOpenStuff(LHOSFile& file) +{ + size_t bytesRead = 0; + wchar_t byteOrderMark; + file.Read(&byteOrderMark, 2, &bytesRead); +} + +// BW1W120 007e8170 BW1M100 10153040 LHScriptX::LoadFile(char*, long*) +template LH_RETURN LHScriptX::LoadFile(char* file_name, long* param_2) +{ + LHReleasedOSFile file; + T line[2048]; + + lineNumber = 0; + ifLevel = -1; + if (!file.Open(file_name, LH_FILE_MODE_READ_ONLY)) + { + PostFileOpenStuff(file); + while (LoadOneLine(file, line)) + ; + file.Close(); + } + return LH_OK; +} + +// BW1W120 007e7400 BW1M100 1061cd3c LHScriptX::LoadOneLine(LHReleasedOSFile&, char*) +// Reads one '\n'-terminated line character by character, then ScanLine()s it. +// Returns false at end of file or on error. +template bool LHScriptX::LoadOneLine(LHOSFile& file, T* line) +{ + long charsRead = 0; + size_t bytesRead = 0; + LH_RETURN result = LH_OK; + + if (file.Read(line, sizeof(T), &bytesRead) == 3) + { + fail: + result = LH_FAIL; + } + else + { + T* curChar = line; + while (1) + { + if (!bytesRead) + goto fail; + if (*curChar == '\n') + break; + charsRead++; + curChar++; + bytesRead = 0; + if (file.Read(curChar, sizeof(T), &bytesRead) == 3) + goto fail; + } + } + if (charsRead) + { + line[charsRead] = 0; + lineNumber++; + strncpy(LastLineParsed, (char*)line, 511); + if (ScanLine(line) == LH_ERROR) + result = LH_FAIL; + } + return result == LH_OK; +} + +// BW1W120 007e74c0 LHScriptX::DontProcessNumLines(LHReleasedOSFile&, char*, unsigned long) +// Skips num_lines '\n'-terminated lines without processing them. +template bool LHScriptX::DontProcessNumLines(LHOSFile& file, T* line, unsigned long num_lines) +{ + LH_RETURN result = LH_OK; + + for (unsigned long i = 0; i < num_lines; i++) + { + if (result) + break; + for (T* curChar = line;; curChar++) + { + size_t bytesRead = 0; + if (file.Read(curChar, sizeof(T), &bytesRead) == 3 || !bytesRead) + result = LH_FAIL; + if (*curChar == '\n') + break; + } + } + return result == LH_OK; +} + +// BW1W120 007e7530 LHScriptX::InitIfLevel(void) +template void LHScriptX::InitIfLevel() +{ + ifLevel = -1; +} + +// BW1W120 007e7540 BW1M100 10150830 LHScriptX::ScanLine(char*) +// Core per-line tokeniser/executor: reads words with GetNextWord, handles +// IF/ENDIF/REM and variable assignment, parses command arguments into Pram +// per the command's parameter type string, and dispatches ProcessCommand. +template LH_RETURN LHScriptX::ScanLine(T* line) +{ + unsigned char endOfLine = 0; + T word[1000]; + + while (1) + { + long processCount = 1; + unsigned long firstParam = 0; + long command = GetNextWord(&line, word, &endOfLine); + LHScriptCommandX* currentCommand; + + switch (command) + { + case 0: + break; + case 27: // IF: process the guarded command first, then IF on its result + if (ifLevel != -1 && !ifConditionStack[ifLevel]) + return LH_OK; + command = GetNextWord(&line, word, &endOfLine); + if (command) + processCount = 2; + else + firstParam = 1; + goto process_command; + case 28: // ENDIF + if (ifLevel-- > -1) + break; + return LH_ERROR; + case 29: // REM + return LH_OK; + case 30: // NAME = value assignment to an existing variable + { + LHScriptVariable* variable = FindVariable(word); + if (!variable) + return LH_ERROR; + GetNextWord(&line, word, &endOfLine); + if (endOfLine || word[0] != '=') + return LH_ERROR; + GetNextWord(&line, word, &endOfLine); + if (variable->type == 0) + { + variable->value = LHStringOps::atoi(word); + break; + } + if (variable->type != 1) + { + if (variable->type == 2) + *(float*)&variable->value = LHStringOps::atof(word); + break; + } + if (variable->value) + delete (T*)variable->value; + unsigned int length = LHStringOps::strlen(word); +#line 737 + T* value = (T*)operator new(sizeof(T) * (length + 1), __FILE__, __LINE__); + variable->value = (long)value; + if (!value) + return LH_ERROR; + LHStringOps::strcpy(value, word); + break; + } + default: + process_command: + if (ifLevel != -1 && !ifConditionStack[ifLevel]) + return LH_OK; + if (command <= 0) + currentCommand = &commands[-1 - command]; + else + currentCommand = &Commands[command - 1]; + if (processCount < 1) + break; + while (1) + { + unsigned long i = firstParam; + for (; i < 12; i++) + { + if (currentCommand->params[i] == ' ' || endOfLine) + break; + if (GetNextWord(&line, Pram.text[i], &endOfLine) == 30) + { + LHScriptVariable* variable = FindVariable(Pram.text[i]); + if (!variable) + return LH_ERROR; + if (variable->type != 0) + { + if (variable->type == 1) + { + T* value = (T*)variable->value; + if (!value) + return LH_ERROR; + LHStringOps::strcpy(Pram.text[i], value); + } + else if (variable->type == 2) + { + if (currentCommand->params[i] != 'F') + return LH_ERROR; + Pram.flt[i] = *(float*)&variable->value; + } + } + else + { + if (currentCommand->params[i] != 'N') + return LH_ERROR; + Pram.number[i] = variable->value; + } + } + else + { + char paramType = currentCommand->params[i]; + if (paramType == 'N') + Pram.number[i] = LHStringOps::atol(Pram.text[i]); + else if (paramType == 'F') + Pram.flt[i] = LHStringOps::atof(Pram.text[i]); + } + } + if (i != 12) + { + char paramType = currentCommand->params[i]; + if (paramType == 'L' || paramType == 'A' || paramType == 'N' || paramType == 'F') + return LH_ERROR; + } + if (processCount == 2) + { + if (endOfLine == 1) + return LH_ERROR; + long result = ProcessCommand(command, &Pram); + LHStringOps::itoa(result, Pram.text[0], 10); + currentCommand = &Commands[26]; // IF + command = 27; + firstParam = 1; + } + else + { + ProcessCommand(command, &Pram); + } + processCount--; + if (processCount < 1) + break; + } + break; + } + if (endOfLine) + return LH_OK; + } +} + +// BW1W120 007e8a90 LHScriptX::GetNextWord(char**, char*, unsigned char*) +// Extracts the next word/quoted string/operator token, upper-casing bare +// words, and classifies it: 1..30 = built-in Commands index + 1, +// -1 - index = host command table index, 30 = existing variable, 0 = none. +template long LHScriptX::GetNextWord(T** cursor, T* word, unsigned char* end_of_line) +{ + *word = 0; + T* out = word; + while (LHStringOps::isspace(**cursor)) + { + if (!**cursor) + break; + (*cursor)++; + } + if (**cursor == '\n' || !**cursor) + *end_of_line = 1; + if (**cursor == '"') + { + (*cursor)++; + while (**cursor != '"') + { + if (!**cursor) + break; + if (**cursor == '\n') + break; + *out++ = **cursor; + (*cursor)++; + } + *out = 0; + if (**cursor == '"') + { + (*cursor)++; + while (LHStringOps::isspace(**cursor)) + { + if (!**cursor) + break; + (*cursor)++; + } + if (**cursor == ',' || **cursor == '(' || **cursor == ')' || **cursor == ':') + (*cursor)++; + } + if (**cursor == '\n' || !**cursor) + *end_of_line = 1; + return 0; + } + if (**cursor == '=' || **cursor == '!' || **cursor == '>' || **cursor == '<') + { + *out++ = **cursor; + (*cursor)++; + if (**cursor == '=' || **cursor == '>') + { + *out++ = **cursor; + (*cursor)++; + } + } + else + { + while (!LHStringOps::isspace(**cursor)) + { + T c = **cursor; + if (!c) + break; + if (c == ',' || c == '(' || c == ')' || c == ':') + { + (*cursor)++; + break; + } + if (c == '=' || c == '!' || c == '>' || c == '<') + break; + (*cursor)++; + *out++ = toupper(c); + } + } + *out = 0; + if (**cursor == '\n' || !**cursor) + *end_of_line = 1; + + // TODO: the built-in table search is 2 instructions off: the original + // schedules the tableCommand init between the entry test and the loop. + short index = 0; + LHScriptCommandX* tableCommand = Commands; + while (Commands[index].name) + { + if (!LHStringOps::strcmp(word, tableCommand->name)) + return index + 1; + index++; + tableCommand = &Commands[index]; + } + if (commands) + { + short hostIndex = 0; + while (commands[hostIndex].name) + { + if (!LHStringOps::strcmp(word, commands[hostIndex].name)) + return -1 - hostIndex; + hostIndex++; + } + } + if (!FindVariable(word)) + return 0; + return 30; +} + +// BW1W120 007e8cb0 BW1M100 101533a0 LHScriptX::DestroyVariables(void) +template void LHScriptX::DestroyVariables() +{ + LHScriptVariable* variable = variables; + if (variable) + { + LHScriptVariable* next; + do + { + if (variable->name) + delete variable->name; + switch (variable->type) + { + case 1: + if (variable->value) + delete (T*)variable->value; + break; + } + next = variable->next; + delete variable; + variable = next; + } while (next); + } + variables = NULL; +} + +// BW1W120 007e8d10 LHScriptX::FindVariable(char*) +template LHScriptVariable* LHScriptX::FindVariable(T* name) +{ + LHScriptVariable* variable; + if (!*name) + goto fail; + variable = variables; + if (!variable) + goto fail; + while (1) + { + if (!LHStringOps::strcmp(name, variable->name)) + break; + variable = variable->next; + if (!variable) + goto fail; + } + return variable; +fail: + return NULL; +} + +// BW1W120 007e9910 LHScriptX::CommandIf(char*, char*, char*) +// Evaluates "value1 value2" and pushes the result on the if stack. +template LH_RETURN LHScriptX::CommandIf(T* value1, T* condition, T* value2) +{ + unsigned char conditionIndex = 0; + long condition1; + long condition2; + + if (NamesToCondition[0]) + { + T** name = NamesToCondition; + while (1) + { + if (!LHStringOps::strcmp(*name, condition)) + break; + conditionIndex++; + name = &NamesToCondition[conditionIndex]; + if (!NamesToCondition[conditionIndex]) + break; + } + } + if (!NamesToCondition[conditionIndex]) + return LH_ERROR; + if (GetConditionValue(value1, &condition1)) + return LH_ERROR; + if (GetConditionValue(value2, &condition2)) + return LH_ERROR; + ifLevel++; + if ((unsigned long)ifLevel >= 20) + return LH_ERROR; + ifConditionStack[ifLevel] = GetConditionState(condition1, conditionIndex, condition2); + return LH_OK; +} + +// BW1W120 007e9a10 LHScriptX::CreateVariable(long, LHScriptPramX*) +// command 23 = SLONG (number), 24 = FLOAT, 25 = CBYTE (string). +template LH_RETURN LHScriptX::CreateVariable(long command, LHScriptPramX* pram) +{ +#line 1032 + LHScriptVariable* variable = new (__FILE__, __LINE__) LHScriptVariable; + if (variable) + { + memset(variable, 0, sizeof(LHScriptVariable)); +#line 1035 + T* name = (T*)operator new(sizeof(T) * (LHStringOps::strlen(pram->text[0]) + 1), __FILE__, __LINE__); + variable->name = name; + if (name) + { + LHStringOps::strcpy(name, pram->text[0]); + switch (command) + { + case 23: + variable->type = 0; + break; + case 24: + variable->type = 2; + break; + case 25: + variable->type = 1; + break; + } + if (variables) + variable->next = variables; + variables = variable; + return LH_OK; + } + delete variable; + } + return LH_ERROR; +} + +// BW1W120 007e9ca0 LHScriptX::GetConditionValue(char*, long*) +// Resolves a condition operand: numeric literal, built-in condition name, +// or a host condition resolved through the condition callback. +template LH_RETURN LHScriptX::GetConditionValue(T* name, long* value) +{ + if (LHStringOps::isdigit(*name) || *name == '-') + { + *value = LHStringOps::atoi(name); + return LH_OK; + } + long index = 0; + T** names; + long hostIndex; + if (Conditions[0]) + { + T** current = Conditions; + T** walk = Conditions; + while (LHStringOps::strcmp(*current, name)) + { + T* next = walk[1]; + walk++; + index++; + current = walk; + if (!next) + goto search_host; + } + switch (index) + { + case 0: // MAX_DEPTH + *value = g_lhScreen.MaxDepth(); + return LH_OK; + case 1: + *value = LH_OK; + return LH_OK; + case 2: + *value = LH_FAIL; + return LH_OK; + case 3: + *value = LH_ERROR; + return LH_OK; + case 4: + *value = LH_NO_MEMORY; + return LH_OK; + default: + return LH_OK; + } + } +search_host: + names = conditionNames; + if (!names) + goto fail; + hostIndex = 0; + if (!names[0]) + goto fail; + while (LHStringOps::strcmp(names[hostIndex], name)) + { + names = conditionNames; + hostIndex++; + if (!names[hostIndex]) + goto fail; + } + return conditionCallback(hostIndex, value); +fail: + return LH_ERROR; +} + +// BW1W120 007e9e00 LHScriptX::GetConditionState(long, unsigned char, long) +// Applies the comparison operator (index into NamesToCondition). +template char LHScriptX::GetConditionState(long value1, unsigned char condition, long value2) +{ + switch (condition) + { + case 0: // = + case 1: // == + return value1 == value2; + case 2: // <> + case 3: // != + return value1 != value2; + case 4: // < + return value1 < value2; + case 5: // > + return value1 > value2; + case 6: // <= + return value1 <= value2; + case 7: // >= + return value1 >= value2; + default: + return 0; + } +} + +// BW1W120 007e6b70 bodge_to_force_compilation_of_versions(void) +// Forces the compiler to instantiate every member of both template versions. +void bodge_to_force_compilation_of_versions() +{ + LHScriptX scriptC; + LHScriptX scriptW; + LHScriptCommandX commandC; + LHScriptCommandX commandW; + LHReleasedOSFile file; + + scriptC.Load(NULL, (long*)NULL); + scriptC.Load(NULL, (LHScriptCommandX*)NULL, NULL, (char**)NULL, NULL, NULL); + scriptC.Load(NULL, (LHScriptCommandX*)NULL, NULL, (long*)NULL); + scriptC.Load(NULL, (char**)NULL, NULL, (long*)NULL); + scriptC.SetVariables(NULL, NULL, NULL); + scriptC.LoadOneLine(file, NULL); + scriptC.DontProcessNumLines(file, NULL, 0); + scriptC.InitIfLevel(); + scriptC.ScanLine(NULL); + scriptW.Load(NULL, (long*)NULL); + scriptW.Load(NULL, (LHScriptCommandX*)NULL, NULL, (wchar_t**)NULL, NULL, NULL); + scriptW.Load(NULL, (LHScriptCommandX*)NULL, NULL, (long*)NULL); + scriptW.Load(NULL, (wchar_t**)NULL, NULL, (long*)NULL); + scriptW.SetVariables(NULL, NULL, NULL); + scriptW.LoadOneLine(file, NULL); + scriptW.DontProcessNumLines(file, NULL, 0); + scriptW.InitIfLevel(); + scriptW.ScanLine(NULL); + commandC.GetCommandAsText(NULL); + commandW.GetCommandAsText(NULL); +} diff --git a/src/Lionhead/LHLib/ver5.0/LHScript.h b/src/Lionhead/LHLib/ver5.0/LHScript.h index 996965aa..39a39477 100644 --- a/src/Lionhead/LHLib/ver5.0/LHScript.h +++ b/src/Lionhead/LHLib/ver5.0/LHScript.h @@ -1,39 +1,108 @@ #ifndef BW1_DECOMP_LH_SCRIPT_INCLUDED_H #define BW1_DECOMP_LH_SCRIPT_INCLUDED_H -#include /* For static_assert */ -#include /* For uint32_t, uint8_t */ +#include "LHReturn.h" // Forward Declares -class LHReleasedOSFile; +class LHOSFile; -struct LHScriptX_c_ +template struct LHScriptCommandX { - int field_0x0; - int field_0x4; - char field_0x8[0x14]; - int* field_0x1c; - LHScriptCommandX_c_* command; /* 0x20 */ - FuncPtr(name = 'LHScriptX_c___callback', call_type = '__cdecl', result = 'enum LH_RETURN', - args = [ 'int', 'struct LHScriptPramX_c_*' ], arg_labels = [ 'param_0', 'param_1' ], - decorated_name = 'LHScriptX_c___callback', indirection_level = 1) callback; - int field_0x28; - int field_0x2c; + T* name; + char params[12]; + + // BW1W120 007e7fb0 LHScriptCommandX::GetCommandAsText(char*) + T* GetCommandAsText(T* text); +}; + +template struct LHScriptPramX +{ + T text[12][2048]; + long number[12]; + float flt[12]; // TODO: fabricated member name +}; + +template struct LHScriptVariable +{ + long type; /* 0x0 0 = number, 1 = string, 2 = float */ + T* name; /* 0x4 */ + long value; /* 0x8 long / T* / float depending on type */ + LHScriptVariable* next; /* 0xc */ +}; + +// Text script engine: loads a plain-text script file and executes it line by +// line. The host registers a command table. +template class LHScriptX +{ +public: + long ifLevel; + long lineNumber; + char ifConditionStack[20]; + LHScriptVariable* variables; + LHScriptCommandX* commands; + LH_RETURN(__cdecl* commandCallback)(long command, LHScriptPramX* pram); + T** conditionNames; + LH_RETURN(__cdecl* conditionCallback)(long condition, long* value); + + // BW1W120 00c343c0 () 00c345b0 () built-in front-end setup command table + static LHScriptCommandX Commands[]; + // BW1W120 00c347a0 () 00c347b8 () built-in condition names + static T* Conditions[]; + // BW1W120 00c347d0 () 00c347f4 () comparison operator tokens + static T* NamesToCondition[]; + // BW1W120 00fb9d40 () 00fadce0 () shared parameter buffer + static LHScriptPramX Pram; // Non-virtual methods - // BW1W120 007e72c0 BW1M100 1061e38c LHScriptX::Load(char *, LHScriptCommandX *, LH_RETURN (*)(long, LHScriptPramX *), long *) - void Load(const char* path, LHScriptCommandX_c_* command, LH_RETURN(__cdecl*)(int, LHScriptPramX_c_*) callback, - long* param_4); - // BW1W120 007e7400 BW1M100 1061cd3c LHScriptX::LoadOneLine(LHReleasedOSFile &, char *) - bool LoadOneLine(LHReleasedOSFile* file, char* line); - // BW1W120 007e7540 BW1M100 10150830 LHScriptX::ScanLine(char *) - uint32_t ScanLine(char* line); - // BW1W120 007e8170 BW1M100 10153040 LHScriptX::LoadFile(char *, long *) - uint32_t LoadFile(const char* path, long* param_2); + // BW1W120 007e7380 BW1M100 1061e4c8 LHScriptX::Load(char*, long*) + LH_RETURN Load(char* file_name, long* param_2); + // BW1W120 007e72c0 BW1M100 1061e38c LHScriptX::Load(char*, LHScriptCommandX*, LH_RETURN (*)(long, LHScriptPramX*), long*) + LH_RETURN Load(char* file_name, LHScriptCommandX* new_commands, + LH_RETURN(__cdecl* command_callback)(long, LHScriptPramX*), long* param_4); + // BW1W120 007e7260 LHScriptX::Load(char*, char**, LH_RETURN (*)(long, long*), char**) + LH_RETURN Load(char* file_name, T** condition_names, LH_RETURN(__cdecl* condition_callback)(long, long*), + long* param_4); + // BW1W120 007e7320 LHScriptX::Load(char*, LHScriptCommandX*, LH_RETURN (*)(long, LHScriptPramX*), char**, LH_RETURN (*)(long, long*), long*) + LH_RETURN Load(char* file_name, LHScriptCommandX* new_commands, + LH_RETURN(__cdecl* command_callback)(long, LHScriptPramX*), T** condition_names, + LH_RETURN(__cdecl* condition_callback)(long, long*), long* param_6); + // BW1W120 007e73d0 LHScriptX::SetVariables(LHScriptCommandX*, LH_RETURN (*)(long, LHScriptPramX*), long*) + LH_RETURN SetVariables(LHScriptCommandX* new_commands, + LH_RETURN(__cdecl* command_callback)(long, LHScriptPramX*), long* param_3); + // BW1W120 007e7400 BW1M100 1061cd3c LHScriptX::LoadOneLine(LHReleasedOSFile&, char*) + bool LoadOneLine(LHOSFile& file, T* line); + // BW1W120 007e74c0 LHScriptX::DontProcessNumLines(LHReleasedOSFile&, char*, unsigned long) + bool DontProcessNumLines(LHOSFile& file, T* line, unsigned long num_lines); + // BW1W120 007e7530 LHScriptX::InitIfLevel(void) + void InitIfLevel(); + // BW1W120 007e7540 BW1M100 10150830 LHScriptX::ScanLine(char*) + LH_RETURN ScanLine(T* line); + // BW1W120 007e8170 BW1M100 10153040 LHScriptX::LoadFile(char*, long*) + LH_RETURN LoadFile(char* file_name, long* param_2); + // BW1W120 007e8240 LHScriptX::ProcessCommand(long, LHScriptPramX*) + LH_RETURN ProcessCommand(long command, LHScriptPramX* pram); + // BW1W120 007e8a90 LHScriptX::GetNextWord(char**, char*, unsigned char*) + long GetNextWord(T** cursor, T* word, unsigned char* end_of_line); // BW1W120 007e8cb0 BW1M100 101533a0 LHScriptX::DestroyVariables(void) void DestroyVariables(); + // BW1W120 007e8d10 LHScriptX::FindVariable(char*) + LHScriptVariable* FindVariable(T* name); + // BW1W120 007e9910 LHScriptX::CommandIf(char*, char*, char*) + LH_RETURN CommandIf(T* value1, T* condition, T* value2); + // BW1W120 007e9a10 LHScriptX::CreateVariable(long, LHScriptPramX*) + LH_RETURN CreateVariable(long command, LHScriptPramX* pram); + // BW1W120 007e9ad0 LHScriptX::PostFileOpenStuff(LHReleasedOSFile&) + // no-op for ; the specialisation skips the UTF-16 byte-order mark + void PostFileOpenStuff(LHOSFile& file); + // BW1W120 007e9ca0 LHScriptX::GetConditionValue(char*, long*) + LH_RETURN GetConditionValue(T* name, long* value); + // BW1W120 007e9e00 LHScriptX::GetConditionState(long, unsigned char, long) + char GetConditionState(long value1, unsigned char condition, long value2); }; +// BW1W120 007e6b70 bodge_to_force_compilation_of_versions(void) +void bodge_to_force_compilation_of_versions(); + #endif /* BW1_DECOMP_LH_SCRIPT_INCLUDED_H */ diff --git a/src/Lionhead/LHLib/ver5.0/LHString.h b/src/Lionhead/LHLib/ver5.0/LHString.h new file mode 100644 index 00000000..06738cd1 --- /dev/null +++ b/src/Lionhead/LHLib/ver5.0/LHString.h @@ -0,0 +1,55 @@ +#ifndef BW1_DECOMP_LH_STRING_INCLUDED_H +#define BW1_DECOMP_LH_STRING_INCLUDED_H + +#include +#include +#include +#include +#include + +// TODO: fabricated names and home; these live at BW1W120 007e6a80 / 007e6ae0 +char* LHWideToAnsi(const wchar_t* string); +wchar_t* LHAnsiToWide(const char* string); + +// Character-width-generic wrappers around the CRT string functions, used by the +// LHScriptX text script engine. +// TODO: header name fabricated; the original may have had more members (the +// binary also contains strchr/strrchr/strstr/strpbrk/strspn wrappers for both +// widths at 007e6e00..007e7160, not yet needed by any decompiled caller). +template class LHStringOps; + +template <> class LHStringOps +{ +public: + static char* strcat(char* dst, const char* src) { return ::strcat(dst, src); } + static char* strcpy(char* dst, const char* src) { return ::strcpy(dst, src); } + static unsigned int strlen(const char* str) { return ::strlen(str); } + static int strcmp(const char* string1, const char* string2) { return ::strcmp(string1, string2); } + static int isdigit(char c) { return ::isdigit(c); } + static int isspace(char c) { return ::isspace(c); } + static float atof(const char* str) { return (float)::atof(str); } + static int atoi(const char* str) { return ::atoi(str); } + static long atol(const char* str) { return ::atol(str); } + static char* itoa(int value, char* string, int radix) { return ::_itoa(value, string, radix); } + static char* makechar(char* string) { return string; } + static char* fromchar(char* string) { return string; } +}; + +template <> class LHStringOps +{ +public: + static wchar_t* strcat(wchar_t* dst, const wchar_t* src) { return ::wcscat(dst, src); } + static wchar_t* strcpy(wchar_t* dst, const wchar_t* src) { return ::wcscpy(dst, src); } + static unsigned int strlen(const wchar_t* str) { return ::wcslen(str); } + static int strcmp(const wchar_t* string1, const wchar_t* string2) { return ::wcscmp(string1, string2); } + static int isdigit(wchar_t c) { return ::iswdigit(c); } + static int isspace(wchar_t c) { return ::iswspace(c); } + static float atof(const wchar_t* str) { return (float)::wcstod(str, NULL); } + static int atoi(const wchar_t* str) { return ::_wtoi(str); } + static long atol(const wchar_t* str) { return ::_wtol(str); } + static wchar_t* itoa(int value, wchar_t* string, int radix) { return ::_itow(value, string, radix); } + static char* makechar(wchar_t* string) { return LHWideToAnsi(string); } + static wchar_t* fromchar(char* string) { return LHAnsiToWide(string); } +}; + +#endif /* BW1_DECOMP_LH_STRING_INCLUDED_H */ diff --git a/src/Lionhead/LHLib/ver5.0/LHText.h b/src/Lionhead/LHLib/ver5.0/LHText.h index 64359b13..be235ea1 100644 --- a/src/Lionhead/LHLib/ver5.0/LHText.h +++ b/src/Lionhead/LHLib/ver5.0/LHText.h @@ -2,9 +2,11 @@ #define BW1_DECOMP_LH_TEXT_INCLUDED_H #include /* For static_assert */ +#include /* For NULL */ #include /* For uint8_t */ #include /* For struct LHColor */ +#include /* For enum LH_RETURN */ // Forward Declares @@ -20,8 +22,20 @@ struct LHSpriteList LHSprite* Sprites; /* 0x4 */ int Count; /* 0x8 */ + // Constructors + + // BW1W120 007e89f0 LHSpriteList::LHSpriteList(void) (comdat, emitted from LHScript.cpp) + LHSpriteList() { Set(NULL, 0); } + // Non-virtual methods + // BW1W120 007e8a00 (comdat, emitted from LHScript.cpp) TODO: fabricated name + void Set(LHSprite* sprites, long count) + { + Sprites = sprites; + Count = count; + OwnsSprites = 1; + } // BW1W120 007ee540 LHSpriteList::FreeSpriteList(int) int FreeSpriteList(int keepPixelData); // BW1W120 007ee5b0 LHSpriteList::FreeSprite(long) @@ -51,6 +65,8 @@ struct LHText : LHSpriteList // Non-virtual methods + // BW1W120 007e3c20 LHText::LoadFont(char*, unsigned long) + LH_RETURN LoadFont(char* file_name, unsigned long flags); // BW1W120 007e3d00 LHText::FreeFont(void) int FreeFont(); // BW1W120 007e3d20 LHText::StringWidth(char *, char *) diff --git a/src/Lionhead/LHLib/ver5.0/LHWin.h b/src/Lionhead/LHLib/ver5.0/LHWin.h index cdf09cf4..77d6210b 100644 --- a/src/Lionhead/LHLib/ver5.0/LHWin.h +++ b/src/Lionhead/LHLib/ver5.0/LHWin.h @@ -7,6 +7,9 @@ // BW1W120 007db790 operator new(unsigned int, char const*, unsigned int) void* operator new(size_t size, const char* file_name, uint32_t line); +// TODO: address of the definition in the binary not yet identified. +void operator delete(void* block, const char* file_name, uint32_t line); + // BW1W120 007db7a0 FreeMemory(void*) void FreeMemory(void* block); diff --git a/src/Lionhead/LHMultiplayer/ver4.0/LHTransportInfo.h b/src/Lionhead/LHMultiplayer/ver4.0/LHTransportInfo.h index fe4db05f..061a0774 100644 --- a/src/Lionhead/LHMultiplayer/ver4.0/LHTransportInfo.h +++ b/src/Lionhead/LHMultiplayer/ver4.0/LHTransportInfo.h @@ -4,10 +4,7 @@ #include /* For static_assert */ #include /* For uint16_t, uint32_t, uint8_t */ -enum LH_RETURN -{ - LH_RETURN_0 = 0x0, -}; +#include /* For enum LH_RETURN */ enum LH_TRANSPORT_TYPE {