diff --git a/mapping/DKII_EXE_v170.sgmap b/mapping/DKII_EXE_v170.sgmap index 801af20..093d1d4 100644 --- a/mapping/DKII_EXE_v170.sgmap +++ b/mapping/DKII_EXE_v170.sgmap @@ -162,10 +162,10 @@ struct: id=use_00528300,path=dk2/button,name=ButtonCfg,size=80 type: kind=int,size=4 field: name=field_12 type: kind=int,size=4 - field: name=field_16 + field: name=f16_var16 type: kind=ptr type: kind=void - field: name=f1A__actionId + field: name=f1A_var1A type: kind=ptr type: kind=void field: name=f1E_posFlags @@ -257,9 +257,17 @@ struct: id=instance_0066FBBC,name=CAnimMeshResource_vtbl,size=12,super=instance_ struct: id=vtbl_0066CC94,name=CBridge,size=9855,vtable=instance_0066CC94,super=vtbl_0066CF7C field: name=field_72 type: kind=int,size=4 - field: name=gap_76 - type: kind=array,count=32 + field: name=f76_gap + type: kind=array,count=16 type: kind=int,size=1 + field: name=field_86 + type: kind=int,size=4,signed=True + field: name=field_8A + type: kind=int,size=4,signed=True + field: name=field_8E + type: kind=int,size=4,signed=True + field: name=field_92 + type: kind=int,size=4,signed=True field: name=field_96 type: kind=int,size=4 field: name=field_9A @@ -903,7 +911,8 @@ struct: id=instance_0066CC94,name=CBridge_vtbl,size=404,super=instance_0066CF7C type: kind=ptr type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=void arg: kind=int,size=2 field: name=loc_43A9E0 type: kind=ptr @@ -2388,9 +2397,12 @@ struct: id=vtbl_0066C4A4,name=CDefaultPlayerInterface,size=20273,vtable=instance type: kind=struct,id=constructor_00504D60 field: name=field_4CB9 type: kind=int,size=4,signed=True - field: name=gap_4CBD - type: kind=array,count=12 - type: kind=int,size=1 + field: name=field_4CBD + type: kind=int,size=4,signed=True + field: name=field_4CC1 + type: kind=int,size=4,signed=True + field: name=field_4CC5 + type: kind=int,size=4,signed=True field: name=field_4CC9 type: kind=int,size=4,signed=True field: name=field_4CCD @@ -2399,8 +2411,8 @@ struct: id=vtbl_0066C4A4,name=CDefaultPlayerInterface,size=20273,vtable=instance type: kind=int,size=4,signed=True field: name=field_4CD5 type: kind=int,size=4,signed=True - field: name=gap_4CD9 - type: kind=int,size=1 + field: name=field_4CD9 + type: kind=int,size=1,signed=True,winapi=char field: name=field_4CDA type: kind=int,size=4,signed=True field: name=field_4CDE @@ -2704,7 +2716,7 @@ struct: id=instance_0066EDF4,path=dk2/button,name=CDragButton_vtbl,size=16,super struct: id=vtbl_0066CBB4,name=CEffect,size=345,vtable=instance_0066CBB4,super=vtbl_0066D0C4 field: name=dword_101 type: kind=int,size=4,signed=True - field: name=word_105 + field: name=f105__id type: kind=int,size=2,signed=True field: name=field_107 type: kind=int,size=4,signed=True @@ -2728,8 +2740,10 @@ struct: id=vtbl_0066CBB4,name=CEffect,size=345,vtable=instance_0066CBB4,super=vt type: kind=int,size=4,signed=True field: name=field_12B type: kind=int,size=2 - field: name=f12d_gap - type: kind=array,count=6 + field: name=field_12D + type: kind=int,size=2,signed=True + field: name=f12f_gap + type: kind=array,count=4 type: kind=int,size=1 field: name=word_133 type: kind=int,size=2,signed=True @@ -2761,9 +2775,8 @@ struct: id=vtbl_0066CBDC,name=CEffectElement,size=287,vtable=instance_0066CBDC,s type: kind=int,size=2,signed=True field: name=field_103 type: kind=int,size=4,signed=True - field: name=f107_gap - type: kind=array,count=2 - type: kind=int,size=1 + field: name=field_107 + type: kind=int,size=2,signed=True field: name=dword_109 type: kind=int,size=4,signed=True field: name=gap_10D @@ -3679,7 +3692,7 @@ struct: id=instance_0066D1D4,name=CEngineInterface_vtbl,size=272 type: kind=function,declspec=thiscall ret: kind=int,size=2,signed=True arg: kind=ptr - type: kind=int,size=2 + type: kind=void field: name=fC8 type: kind=ptr type: kind=function,declspec=thiscall @@ -5482,7 +5495,7 @@ struct: id=vtbl_0066ED1C,name=CGuiManager,size=484,vtable=instance_0066ED1C type: kind=int,size=4 field: name=f1E0_pBtn type: kind=ptr - type: kind=struct,id=vtbl_0066ECA4 + type: kind=struct,id=vtbl_0066ED8C vtable_value: va=0052B8C0 struct: id=instance_0066ED1C,name=CGuiManager_vtbl,size=4 field: name=CGuiManager::_scalar_deleting_destructor_uint @@ -5825,7 +5838,7 @@ struct: id=vtbl_0066D3E4,path=dk2/world,name=CMap,size=3014,vtable=instance_0066 type: kind=int,size=4,signed=True field: name=f20_ptr type: kind=ptr - type: kind=void + type: kind=int,size=2 field: name=f24_gap type: kind=array,count=256 type: kind=int,size=1 @@ -7238,15 +7251,16 @@ struct: id=vtbl_0066DB7C,path=dk2/entities,name=CRoom,size=169,vtable=instance_0 field: name=field_12 type: kind=int,size=2,signed=True field: name=field_14 - type: kind=int,size=4,signed=True + type: kind=ptr + type: kind=int,size=4 field: name=f18_typeId type: kind=int,size=1 - field: name=f19_pobj + field: name=f19_pRoomDataObj type: kind=ptr type: kind=struct,id=constructor_004EAB70 field: name=f1D_playerId type: kind=int,size=2 - field: name=f1F_oomManagerNodeX + field: name=f1F_roomManagerNodeX type: kind=int,size=2 field: name=f21_roomManagerNodeY type: kind=int,size=2 @@ -7262,14 +7276,10 @@ struct: id=vtbl_0066DB7C,path=dk2/entities,name=CRoom,size=169,vtable=instance_0 type: kind=int,size=1 field: name=f2C_navigationPosY type: kind=int,size=1 - field: name=f2D_firstSlabX - type: kind=int,size=1 - field: name=f2E_firstSlabY - type: kind=int,size=1 - field: name=f2F_lastSlabX - type: kind=int,size=1 - field: name=f30_lastSlabY - type: kind=int,size=1 + field: name=f2D_firstSlab + type: kind=struct,id=pos2ub + field: name=f2F_lastSlab + type: kind=struct,id=pos2ub field: name=f31_closing type: kind=int,size=4,signed=True field: name=f35_health @@ -7311,10 +7321,8 @@ struct: id=vtbl_0066DB7C,path=dk2/entities,name=CRoom,size=169,vtable=instance_0 type: kind=int,size=4,signed=True field: name=f85_sparkPositionUpdate type: kind=int,size=2,signed=True - field: name=f87_sparkSlabX - type: kind=int,size=1 - field: name=f88_sparkSlabY - type: kind=int,size=1 + field: name=f87_sparkSlab + type: kind=struct,id=pos2ub field: name=f89_sparkEdge type: kind=int,size=1 field: name=f8A_beingDeleted @@ -8049,13 +8057,13 @@ struct: id=vtbl_0066EDAC,path=dk2/button,name=CTextBox,size=132,vtable=instance_ vtable_value: va=0052A0D0 struct: id=instance_0066EDAC,path=dk2/button,name=CTextBox_vtbl,size=16,super=instance_0066ECA4 struct: id=vtbl_0066ED8C,path=dk2/button,name=CTextInput,size=656,vtable=instance_0066ED8C,super=vtbl_0066ECA4 - field: name=f80_str + field: name=f80_str1 type: kind=array,count=128 type: kind=int,size=2,winapi=wchar_t,fname=wchar_t - field: name=f180_str + field: name=f180_str2 type: kind=array,count=128 type: kind=int,size=2,winapi=wchar_t,fname=wchar_t - field: name=field_27C + field: name=f27C_inputLimit type: kind=int,size=4,signed=True field: name=field_280 type: kind=int,size=4,signed=True @@ -8647,9 +8655,9 @@ struct: id=vtbl_0066E3EC,path=dk2,name=CWorld,size=41931,vtable=instance_0066E3E field: name=f1684_actionHandlers type: kind=array,count=138 type: kind=struct,id=copy_005139D2 - field: name=f1F24_actionHandlers2 + field: name=f1F24_worldHandlers type: kind=array,count=243 - type: kind=struct,id=copy_005139D2 + type: kind=struct,id=copy_00513A21 field: name=f2E54_playerMessageQueue type: kind=struct,id=construct_00508AAC field: name=f2E70_sacrifices @@ -8661,9 +8669,9 @@ struct: id=vtbl_0066E3EC,path=dk2,name=CWorld,size=41931,vtable=instance_0066E3E field: name=f3FF0_triggerTimers type: kind=array,count=16 type: kind=int,size=4,signed=True - field: name=f4030_gap - type: kind=array,count=12480 - type: kind=int,size=1 + field: name=f4030_objsArr + type: kind=array,count=24 + type: kind=struct,id=fill_0050FA70 field: name=f70F0_invasionPartyCountArr type: kind=array,count=24 type: kind=int,size=1 @@ -10540,6 +10548,20 @@ struct: id=constructor_005052F0,name=CWorldShortEntry2,size=38 type: kind=int,size=4,signed=True field: name=field_22 type: kind=int,size=4,signed=True +struct: id=fill_0050FA70,name=CWorld_Obj4030,size=520 + field: name=field_0 + type: kind=int,size=2,signed=True + field: name=field_2 + type: kind=int,size=1,signed=True,winapi=char + field: name=f3_gap + type: kind=array,count=1 + type: kind=int,size=1 + field: name=field_4 + type: kind=int,size=4,signed=True + field: name=field_8 + type: kind=array,count=16 + type: kind=array,count=32 + type: kind=int,size=1,signed=True,winapi=char struct: id=instance_0066E3EC,path=dk2,name=CWorld_vtbl,size=920 field: name=sub_5098E0 type: kind=ptr @@ -10706,7 +10728,7 @@ struct: id=instance_0066E3EC,path=dk2,name=CWorld_vtbl,size=920 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True,winapi=BOOL,fname=BOOL arg: kind=ptr - type: kind=int,size=4 + type: kind=void arg: kind=int,size=1 field: name=sub_509480 type: kind=ptr @@ -10724,7 +10746,7 @@ struct: id=instance_0066E3EC,path=dk2,name=CWorld_vtbl,size=920 type: kind=void arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True - field: name=loc_508DD0 + field: name=loc_508DD0_getTerrainDataObj type: kind=ptr type: kind=function,declspec=thiscall ret: kind=ptr @@ -11375,9 +11397,12 @@ struct: id=instance_0066E3EC,path=dk2,name=CWorld_vtbl,size=920 type: kind=void field: name=loc_509010 type: kind=ptr - type: kind=function,declspec=stdcall - ret: kind=ptr - type: kind=void + type: kind=function,declspec=thiscall + ret: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066E3EC + arg: kind=ptr + type: kind=int,size=4,signed=True field: name=sub_509200 type: kind=ptr type: kind=function,declspec=thiscall @@ -11852,16 +11877,20 @@ struct: id=instance_0066E3EC,path=dk2,name=CWorld_vtbl,size=920 arg: kind=ptr type: kind=int,size=4 arg: kind=int,size=4,signed=True - field: name=loc_508D60 + field: name=loc_508D60_previousRewardTy type: kind=ptr - type: kind=function,declspec=stdcall - ret: kind=ptr - type: kind=void - field: name=loc_508D70 + type: kind=function,declspec=thiscall + ret: kind=int,size=1 + arg: kind=ptr + type: kind=struct,id=vtbl_0066E3EC + arg: kind=int,size=4,signed=True + field: name=loc_508D70_getRewardTy type: kind=ptr - type: kind=function,declspec=stdcall - ret: kind=ptr - type: kind=void + type: kind=function,declspec=thiscall + ret: kind=int,size=1 + arg: kind=ptr + type: kind=struct,id=vtbl_0066E3EC + arg: kind=int,size=4,signed=True field: name=loc_508D80 type: kind=ptr type: kind=function,declspec=stdcall @@ -16607,15 +16636,13 @@ struct: id=constructor_00452B30,path=dk2/world/map,name=MyMapElement,size=16 type: kind=int,size=2 field: name=f2_roomId type: kind=int,size=2 - field: name=field_4 - type: kind=int,size=1 - field: name=field_5 - type: kind=int,size=1 + field: name=f4_nextSlab + type: kind=struct,id=pos2ub field: name=field_6 type: kind=int,size=2 - field: name=field_8 + field: name=f8__playerId type: kind=int,size=2,signed=True - field: name=field_A + field: name=fA_arr6DA4A8_idx type: kind=int,size=1 field: name=fB_flags type: kind=int,size=1 @@ -17528,13 +17555,13 @@ struct: id=constructor_004EBFE0,name=MyRooms,size=28 type: kind=struct,id=vtbl_0066DB7C field: name=fE_firstRoomId type: kind=int,size=2 - field: name=field_10 + field: name=f10__nextRoomId type: kind=int,size=2,signed=True - field: name=field_12 + field: name=f12__counter type: kind=int,size=4,signed=True field: name=field_16 type: kind=int,size=4,signed=True - field: name=field_1A + field: name=f1A__roomSceneObjId type: kind=int,size=2,signed=True struct: id=constructor_0057C420,name=MyScaledSurface,size=49 field: name=f0_idx @@ -18569,15 +18596,14 @@ struct: id=constructor_004F6570,path=dk2/entities/data,name=MyTerrainDataObj,siz field: name=field_6C type: kind=array,count=24 type: kind=int,size=1,signed=True,winapi=char - field: name=f84_gap - type: kind=array,count=4 - type: kind=int,size=1 + field: name=field_84 + type: kind=int,size=4,signed=True field: name=field_88 type: kind=array,count=8 type: kind=struct,id=constructor_00504D60 field: name=field_160 type: kind=struct,id=constructor_00504D60 - field: name=field_17B + field: name=f17B__flags type: kind=int,size=4,signed=True field: name=field_17F type: kind=int,size=2,signed=True @@ -18619,8 +18645,8 @@ struct: id=constructor_004F6570,path=dk2/entities/data,name=MyTerrainDataObj,siz type: kind=int,size=1 field: name=field_1A9 type: kind=int,size=2,signed=True - field: name=field_1AB - type: kind=int,size=2,signed=True + field: name=f1AB_deltaHealth + type: kind=int,size=2 field: name=field_1AD type: kind=int,size=2,signed=True field: name=field_1AF @@ -18641,7 +18667,7 @@ struct: id=constructor_004F6570,path=dk2/entities/data,name=MyTerrainDataObj,siz type: kind=int,size=4,signed=True field: name=field_1C3 type: kind=int,size=1,signed=True,winapi=char - field: name=field_1C4 + field: name=f1C4_arr6DA4A8_idx type: kind=int,size=1,signed=True,winapi=char field: name=field_1C5 type: kind=int,size=1,signed=True,winapi=char @@ -19955,7 +19981,7 @@ struct: id=instance_arr_0069E860,name=Obj69E860,size=17 field: name=field_D type: kind=int,size=4,signed=True struct: id=arr_006A5CD0,name=Obj6A5CD0,size=20 - field: name=f0_actionKind_138 + field: name=field_0 type: kind=int,size=4,signed=True field: name=f4_fun type: kind=ptr @@ -19964,8 +19990,8 @@ struct: id=arr_006A5CD0,name=Obj6A5CD0,size=20 arg: kind=ptr type: kind=struct,id=vtbl_0066E3EC arg: kind=ptr - type: kind=struct,id=constructor_00521F40 - field: name=f8_objOffset + type: kind=void + field: name=f8_objOffs type: kind=int,size=4,signed=True field: name=field_C type: kind=int,size=4,signed=True @@ -20012,7 +20038,7 @@ struct: id=arr_006E4AC8,name=Obj6E4AC8,size=17 arg: kind=ptr type: kind=struct,id=vtbl_0066D524 arg: kind=int,size=4,signed=True - field: name=field_4 + field: name=f4_objOffs type: kind=int,size=4,signed=True field: name=field_8 type: kind=int,size=4,signed=True @@ -20027,7 +20053,7 @@ struct: id=arr_006E4B3C,name=Obj6E4B3C,size=20 ret: kind=int,size=4,signed=True,winapi=BOOL,fname=BOOL arg: kind=ptr type: kind=struct,id=vtbl_0066D654 - field: name=field_4 + field: name=f4_objOffs type: kind=int,size=4,signed=True field: name=field_8 type: kind=int,size=4,signed=True @@ -20796,6 +20822,11 @@ struct: id=pos_fr_to,path=dk2/utils,name=Pos2p,size=8 field: name=to type: kind=ptr type: kind=int,size=4 +struct: id=pos2ub,path=dk2/utils,name=Pos2ub,size=2 + field: name=x + type: kind=int,size=1 + field: name=y + type: kind=int,size=1 struct: id=pos2us,path=dk2/utils,name=Pos2us,size=4 field: name=x type: kind=int,size=2 @@ -22081,6 +22112,21 @@ struct: id=instance_00672450,name=WndMsgDxActionList_vtbl,size=4 type: kind=void arg: kind=int,size=1,signed=True,winapi=char struct: id=instance_0067244C,name=WndMsgDxAction_vtbl,size=4,super=call_f0_at_005DA01F +struct: id=copy_00513A21,name=WorldActionHandler,size=16 + field: name=f0_handler + type: kind=ptr + type: kind=function,declspec=thiscall + ret: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=void + arg: kind=ptr + type: kind=void + field: name=f4_objOffs + type: kind=int,size=4,signed=True + field: name=field_8 + type: kind=int,size=4,signed=True + field: name=field_C + type: kind=int,size=4,signed=True struct: id=instance_arr_0066C780,name=arr_66C780_t,size=16 field: name=f0_idx type: kind=int,size=4,signed=True @@ -24325,11 +24371,12 @@ global: va=00426CA0,name=BtnHandler_sub_426CA0,size=22 arg: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066C4A4 -global: va=00426CC0,name=sub_426CC0,size=191 +global: va=00426CC0,name=sub_426CC0,size=191,member_of=vtbl_0066C4A4 type: kind=function,declspec=thiscall ret: kind=ptr type: kind=int,size=4 - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066C4A4 arg: kind=ptr type: kind=int,size=4 arg: kind=int,size=4,signed=True @@ -24341,11 +24388,12 @@ global: va=00426D80,name=sub_426D80,size=191 arg: kind=ptr type: kind=int,size=4 arg: kind=int,size=4,signed=True -global: va=00426E40,name=sub_426E40,size=163 +global: va=00426E40,name=sub_426E40,size=163,member_of=vtbl_0066C4A4 type: kind=function,declspec=thiscall ret: kind=ptr type: kind=int,size=4 - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066C4A4 arg: kind=ptr type: kind=int,size=4 global: va=00426EF0,name=sub_426EF0,size=55 @@ -24862,11 +24910,13 @@ global: va=0042BC10,name=sub_42BC10,size=5,member_of=vtbl_0066C4A4 global: va=0042BC20,name=fun_42BC20,size=65,member_of=vtbl_0066C4A4 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True -global: va=0042BC70,name=sub_42BC70,size=394 + arg: kind=ptr + type: kind=struct,id=vtbl_0066C4A4 +global: va=0042BC70,name=sub_42BC70,size=394,member_of=vtbl_0066C4A4 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066C4A4 arg: kind=int,size=4 global: va=0042BE00,name=sub_42BE00,size=23 type: kind=function,declspec=thiscall @@ -24887,11 +24937,13 @@ global: va=0042BE20,name=sub_42BE20,size=24 global: va=0042BE40,name=fun_42BE40,size=79,member_of=vtbl_0066C4A4 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True -global: va=0042BE90,name=sub_42BE90,size=326 + arg: kind=ptr + type: kind=struct,id=vtbl_0066C4A4 +global: va=0042BE90,name=sub_42BE90,size=326,member_of=vtbl_0066C4A4 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066C4A4 arg: kind=int,size=4 global: va=0042BFE0,name=fun_42BFE0,size=238,member_of=vtbl_0066C4A4 type: kind=function,declspec=thiscall @@ -25324,12 +25376,12 @@ global: va=00430F40,name=sub_430F40,size=210 arg: kind=int,size=4,fname=UINT arg: kind=int,size=4,winapi=WPARAM,fname=UINT_PTR arg: kind=int,size=4,signed=True,winapi=LPARAM,fname=LONG_PTR -global: va=00431020,name=sub_431020,size=31 +global: va=00431020,name=sub_431020,size=31,member_of=constructor_004107A0 type: kind=function,declspec=thiscall ret: kind=ptr type: kind=int,size=4,signed=True arg: kind=ptr - type: kind=int,size=4 + type: kind=struct,id=constructor_004107A0 arg: kind=int,size=4 global: va=00431040,name=sub_431040,size=13,member_of=constructor_004107A0 type: kind=function,declspec=thiscall @@ -25666,7 +25718,8 @@ global: va=004347D0,name=destructor,size=11,member_of=vtbl_0066CBB4 global: va=004347E0,name=Effect_cpp_4347E0,size=1628 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066CBB4 arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True @@ -26235,11 +26288,11 @@ global: va=0043A8B0,name=sub_43A8B0,size=44 arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True -global: va=0043A8E0,name=sub_43A8E0,size=37 +global: va=0043A8E0,name=sub_43A8E0,size=37,member_of=vtbl_0066CC94 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr - type: kind=void + type: kind=struct,id=vtbl_0066CC94 arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True @@ -26736,7 +26789,8 @@ global: va=00440F60,name=fun_440F60,size=22,member_of=vtbl_0066CC94 global: va=00440F80,name=fun_440F80,size=14,member_of=vtbl_0066CC94 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066CC94 global: va=00440F90,name=fun_440F90,size=22,member_of=vtbl_0066CC94 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True @@ -27311,7 +27365,7 @@ global: va=00443100,name=fun_443100,size=5,member_of=vtbl_0066D1D4 type: kind=function,declspec=thiscall ret: kind=int,size=2,signed=True arg: kind=ptr - type: kind=int,size=2 + type: kind=struct,id=vtbl_0066D1D4 global: va=00443110,name=fun_443110,size=12,member_of=vtbl_0066D1D4 type: kind=function,declspec=thiscall ret: kind=int,size=2,signed=True @@ -28521,7 +28575,7 @@ global: va=0044E290,name=destructor,size=7,member_of=vtbl_0066D3E4 ret: kind=void arg: kind=ptr type: kind=struct,id=vtbl_0066D3E4 -global: va=0044E2A0,name=sub_44E2A0,size=1292,member_of=vtbl_0066D3E4 +global: va=0044E2A0,name=tick,size=1292,member_of=vtbl_0066D3E4 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -28592,7 +28646,7 @@ global: va=0044F590,name=sub_44F590,size=59 arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True arg: kind=int,size=2,signed=True -global: va=0044F5D0,name=sub_44F5D0,size=81,member_of=vtbl_0066D3E4 +global: va=0044F5D0,name=hasPlayerRoomWithType,size=81,member_of=vtbl_0066D3E4 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True,winapi=BOOL,fname=BOOL arg: kind=ptr @@ -28676,7 +28730,7 @@ global: va=00450470,name=CMap_450470,size=759 arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True arg: kind=int,size=1 -global: va=00450770,name=sub_450770,size=208,member_of=vtbl_0066D3E4 +global: va=00450770,name=attachToRoom,size=208,member_of=vtbl_0066D3E4 type: kind=function,declspec=thiscall ret: kind=int,size=4 arg: kind=ptr @@ -28687,7 +28741,7 @@ global: va=00450770,name=sub_450770,size=208,member_of=vtbl_0066D3E4 arg: kind=int,size=2,signed=True arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True -global: va=00450840,name=sub_450840,size=136,member_of=vtbl_0066D3E4 +global: va=00450840,name=hasNearPlayerRoomWithType,size=136,member_of=vtbl_0066D3E4 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -29015,11 +29069,11 @@ global: va=00452B30,name=constructor,size=50,member_of=constructor_00452B30 ret: kind=void arg: kind=ptr type: kind=struct,id=constructor_00452B30 -global: va=00452B70,name=sub_452B70,size=22 +global: va=00452B70,name=roomSetBurnLevel,size=22,member_of=constructor_00452B30 type: kind=function,declspec=thiscall - ret: kind=int,size=1,signed=True,winapi=char + ret: kind=int,size=1 arg: kind=ptr - type: kind=int,size=1 + type: kind=struct,id=constructor_00452B30 arg: kind=int,size=1,signed=True,winapi=char global: va=00452B90,name=saveToTbDiscFile,size=55,member_of=constructor_00452B30 type: kind=function,declspec=thiscall @@ -29303,11 +29357,11 @@ global: va=00454D40,name=sub_454D40,size=180 ret: kind=int,size=2,signed=True arg: kind=ptr type: kind=int,size=2 -global: va=00454E00,name=sub_454E00,size=261 +global: va=00454E00,name=sub_454E00,size=261,member_of=constructor_00452B30 type: kind=function,declspec=thiscall ret: kind=int,size=1,signed=True,winapi=char arg: kind=ptr - type: kind=int,size=2 + type: kind=struct,id=constructor_00452B30 global: va=00454F10,name=sub_454F10,size=187 type: kind=function,declspec=thiscall ret: kind=int,size=2,signed=True @@ -33071,10 +33125,10 @@ global: va=00495080,name=sub_495080,size=34 type: kind=function,declspec=cdecl ret: kind=int,size=4,signed=True arg: kind=int,size=1 -global: va=004950B0,name=sub_4950B0,size=5 +global: va=004950B0,name=j_Obj6E4198_arr_static_init,size=5 type: kind=function,declspec=stdcall ret: kind=int,size=4,signed=True -global: va=004950C0,name=sub_4950C0,size=5597 +global: va=004950C0,name=Obj6E4198_arr_static_init,size=5597 type: kind=function,declspec=stdcall ret: kind=int,size=4,signed=True global: va=004966A0,name=sub_4966A0,size=32,member_of=Creature_Instance @@ -33158,10 +33212,10 @@ global: va=00496D80,name=fun_496D80,size=63,member_of=vtbl_0066D524 ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066D524 -global: va=00496DC0,name=sub_496DC0,size=21 +global: va=00496DC0,name=Obj6E4198_arr_getItem,size=21 type: kind=function,declspec=stdcall ret: kind=ptr - type: kind=int,size=1,signed=True,winapi=char + type: kind=struct,id=arr_006E4198 arg: kind=int,size=4,signed=True global: va=00496DE0,name=fun_496DE0,size=30,member_of=vtbl_0066D524 type: kind=function,declspec=thiscall @@ -33659,16 +33713,17 @@ global: va=0049DD60,name=sub_49DD60,size=2192 arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True -global: va=0049E5F0,name=sub_49E5F0,size=5 +global: va=0049E5F0,name=j_objectState_arr_static_init,size=5 type: kind=function,declspec=stdcall ret: kind=int,size=4,signed=True -global: va=0049E600,name=sub_49E600,size=2241 +global: va=0049E600,name=objectState_arr_static_init,size=2241 type: kind=function,declspec=stdcall ret: kind=int,size=4,signed=True -global: va=0049EED0,name=sub_49EED0,size=133 +global: va=0049EED0,name=handleTickState,size=133,member_of=vtbl_0066D654 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066D654 global: va=0049EF60,name=fun_49EF60,size=23,member_of=vtbl_0066D654 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True @@ -35828,7 +35883,7 @@ global: va=004B7690,name=fun_4B7690,size=404,member_of=constructor_004B59D0 ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=constructor_004B59D0 -global: va=004B7830,name=sub_4B7830,size=149,member_of=constructor_004B59D0 +global: va=004B7830,name=tick,size=149,member_of=constructor_004B59D0 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -37070,7 +37125,7 @@ global: va=004C41A0,name=clear,size=56,member_of=construct_00508AAC ret: kind=void arg: kind=ptr type: kind=struct,id=construct_00508AAC -global: va=004C41E0,name=sub_4C41E0,size=253,member_of=construct_00508AAC +global: va=004C41E0,name=tick,size=253,member_of=construct_00508AAC type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -38675,7 +38730,7 @@ global: va=004D5F50,name=Obj6ECAE0_constructor,size=74 type: kind=void arg: kind=ptr type: kind=void -global: va=004D5FA0,name=sub_4D5FA0,size=678,member_of=vtbl_0066DB7C +global: va=004D5FA0,name=tickWoodenBridge,size=678,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -38685,7 +38740,7 @@ global: va=004D6250,name=sub_4D6250,size=30,member_of=vtbl_0066DB7C ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004D6270,name=Casino_cpp_4D6270,size=1546 +global: va=004D6270,name=Casino_cpp_tick,size=1546 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True @@ -38784,7 +38839,7 @@ global: va=004D7A30,name=sub_4D7A30,size=39,member_of=vtbl_0066DB7C ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004D7A60,name=CombatPit_cpp_4D7A60,size=646 +global: va=004D7A60,name=CombatPit_cpp_tick,size=646 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True @@ -38910,7 +38965,7 @@ global: va=004D9690,name=sub_4D9690,size=975,member_of=vtbl_0066DB7C ret: kind=int,size=1,signed=True,winapi=char arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004D9A60,name=sub_4D9A60,size=1745,member_of=vtbl_0066DB7C +global: va=004D9A60,name=tickDungeonHeart,size=1745,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -38997,7 +39052,7 @@ global: va=004DBBC0,name=sub_4DBBC0,size=26,member_of=vtbl_0066DB7C ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004DBBE0,name=sub_4DBBE0,size=422,member_of=vtbl_0066DB7C +global: va=004DBBE0,name=tickEntranceOrHeroPortal,size=422,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -39092,7 +39147,7 @@ global: va=004DD3B0,name=sub_4DD3B0,size=60,member_of=vtbl_0066DB7C ret: kind=int,size=2 arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004DD3F0,name=sub_4DD3F0,size=128,member_of=vtbl_0066DB7C +global: va=004DD3F0,name=tickGraveyard,size=128,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -39140,7 +39195,7 @@ global: va=004DDCA0,name=CPlayer_sub_4DDCA0,size=206 ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066D99C -global: va=004DDD70,name=sub_4DDD70,size=271,member_of=vtbl_0066DB7C +global: va=004DDD70,name=tickGuardPost,size=271,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -39160,7 +39215,7 @@ global: va=004DE060,name=sub_4DE060,size=51,member_of=vtbl_0066DB7C ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004DE0A0,name=sub_4DE0A0,size=54,member_of=vtbl_0066DB7C +global: va=004DE0A0,name=tickHatchery,size=54,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -39262,7 +39317,7 @@ global: va=004DF690,name=sub_4DF690,size=78,member_of=vtbl_0066DB7C ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004DF6E0,name=HeroGateFrontEnd_cpp_4DF6E0,size=907 +global: va=004DF6E0,name=HeroGateFrontEnd_cpp_tick,size=907 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True @@ -39364,7 +39419,7 @@ global: va=004E0470,name=fun_4E0470,size=707,member_of=vtbl_0066D99C type: kind=ptr type: kind=struct,id=vtbl_0066E3DC arg: kind=int,size=4,signed=True -global: va=004E0740,name=sub_4E0740,size=304,member_of=vtbl_0066DB7C +global: va=004E0740,name=tickLibrary,size=304,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -39511,7 +39566,7 @@ global: va=004E29E0,name=sub_4E29E0,size=216,member_of=vtbl_0066DB7C ret: kind=int,size=1,signed=True,winapi=char arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004E2AC0,name=sub_4E2AC0,size=104,member_of=vtbl_0066DB7C +global: va=004E2AC0,name=tickPrison,size=104,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -39608,10 +39663,11 @@ global: va=004E37F0,name=destructor,size=11,member_of=vtbl_0066DB7C ret: kind=void arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004E3800,name=sub_4E3800,size=440 +global: va=004E3800,name=init,size=440,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066DB7C arg: kind=int,size=4,signed=True arg: kind=int,size=2 global: va=004E39C0,name=sub_4E39C0,size=326,member_of=vtbl_0066DB7C @@ -39634,11 +39690,11 @@ global: va=004E3C20,name=sub_4E3C20,size=432 arg: kind=ptr type: kind=ptr type: kind=struct,id=vtbl_0066F24C -global: va=004E3DD0,name=sub_4E3DD0,size=82 +global: va=004E3DD0,name=sub_4E3DD0,size=82,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr - type: kind=void + type: kind=struct,id=vtbl_0066DB7C global: va=004E3E30,name=sub_4E3E30,size=157,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=2,signed=True @@ -39712,7 +39768,7 @@ global: va=004E4AC0,name=jpt_4E45C9,size=24 global: va=004E4AD8,name=idt_4E45C3,size=26 type: kind=array,count=26 type: kind=int,size=1 -global: va=004E4B00,name=sub_4E4B00,size=257,member_of=vtbl_0066DB7C +global: va=004E4B00,name=tick,size=257,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -39766,15 +39822,16 @@ global: va=004E52F0,name=getPlayer,size=14,member_of=vtbl_0066DB7C type: kind=struct,id=vtbl_0066D99C arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004E5300,name=sub_4E5300,size=156,member_of=vtbl_0066DB7C +global: va=004E5300,name=updateHealth,size=156,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall - ret: kind=int,size=4,signed=True + ret: kind=ptr + type: kind=struct,id=constructor_004F6570 arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C arg: kind=ptr type: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True -global: va=004E53A0,name=sub_4E53A0,size=10,member_of=vtbl_0066DB7C + arg: kind=int,size=2 +global: va=004E53A0,name=setHealth,size=10,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -39805,7 +39862,7 @@ global: va=004E5650,name=sub_4E5650,size=857,member_of=vtbl_0066DB7C ret: kind=int,size=1,signed=True,winapi=char arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C - arg: kind=int,size=4,signed=True + arg: kind=int,size=2 global: va=004E59B0,name=sub_4E59B0,size=183 type: kind=function,declspec=thiscall ret: kind=int,size=1,signed=True,winapi=char @@ -39918,7 +39975,7 @@ global: va=004E6A20,name=Room_cpp_4E6A20,size=415 type: kind=struct,id=vtbl_0066DB7C arg: kind=ptr type: kind=int,size=4 -global: va=004E6BC0,name=rmoveObject,size=64,member_of=vtbl_0066DB7C +global: va=004E6BC0,name=removeObject,size=64,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=2 arg: kind=ptr @@ -39973,9 +40030,9 @@ global: va=004E7C34,name=jpt_4E750A,size=104 type: kind=array,count=26 type: kind=ptr type: kind=void -global: va=004E7CA0,name=sub_4E7CA0,size=38,member_of=vtbl_0066DB7C +global: va=004E7CA0,name=resetSparkSlab,size=38,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall - ret: kind=int,size=2,signed=True + ret: kind=struct,id=pos2ub arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C global: va=004E7CD0,name=sub_4E7CD0,size=668,member_of=vtbl_0066DB7C @@ -40198,12 +40255,12 @@ global: va=004EC410,name=fun_4EC410,size=64,member_of=constructor_004EBFE0 ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=constructor_004EBFE0 -global: va=004EC450,name=sub_4EC450,size=49,member_of=constructor_004EBFE0 +global: va=004EC450,name=tick,size=49,member_of=constructor_004EBFE0 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=constructor_004EBFE0 -global: va=004EC490,name=sub_4EC490,size=267,member_of=constructor_004EBFE0 +global: va=004EC490,name=createRoom,size=267,member_of=constructor_004EBFE0 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -40235,11 +40292,11 @@ global: va=004EC650,name=sub_4EC650,size=676,member_of=constructor_004EBFE0 arg: kind=ptr type: kind=int,size=1 arg: kind=ptr - type: kind=int,size=4 + type: kind=ptr + type: kind=struct,id=vtbl_0066DB7C arg: kind=ptr type: kind=ptr - type: kind=ptr - type: kind=void + type: kind=struct,id=vtbl_0066DB7C global: va=004EC900,name=sub_4EC900,size=619 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True @@ -40248,7 +40305,7 @@ global: va=004EC900,name=sub_4EC900,size=619 arg: kind=int,size=4,signed=True arg: kind=ptr type: kind=int,size=1 -global: va=004ECB70,name=sub_4ECB70,size=388,member_of=constructor_004EBFE0 +global: va=004ECB70,name=updateNearRoom,size=388,member_of=constructor_004EBFE0 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -40260,7 +40317,7 @@ global: va=004ECD00,name=fun_4ECD00,size=176,member_of=constructor_004EBFE0 ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=constructor_004EBFE0 - arg: kind=int,size=2,signed=True + arg: kind=int,size=2 global: va=004ECDB0,name=fun_4ECDB0,size=255,member_of=constructor_004EBFE0 type: kind=function,declspec=thiscall ret: kind=int,size=2,signed=True @@ -40307,8 +40364,7 @@ global: va=004ED320,name=sub_4ED320,size=276,member_of=constructor_004EBFE0 type: kind=struct,id=vtbl_0066DB7C arg: kind=ptr type: kind=ptr - type: kind=ptr - type: kind=void + type: kind=struct,id=vtbl_0066DB7C global: va=004ED440,name=sub_4ED440,size=873,member_of=constructor_004EBFE0 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True @@ -40437,7 +40493,7 @@ global: va=004EF6C0,name=fun_4EF6C0,size=112,member_of=constructor_004EBFE0 arg: kind=ptr type: kind=struct,id=constructor_004EBFE0 arg: kind=ptr - type: kind=void + type: kind=struct,id=vtbl_0066DB7C global: va=004EF730,name=fun_4EF730,size=585,member_of=constructor_004EBFE0 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True @@ -40597,7 +40653,7 @@ global: va=004F1040,name=sub_4F1040,size=179,member_of=constructor_004EBFE0 arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C arg: kind=int,size=4,signed=True -global: va=004F1100,name=sub_4F1100,size=312,member_of=vtbl_0066DB7C +global: va=004F1100,name=tickTemple,size=312,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -40665,7 +40721,7 @@ global: va=004F1A20,name=fun_4F1A20,size=832,member_of=vtbl_0066D99C type: kind=ptr type: kind=struct,id=vtbl_0066E3DC arg: kind=int,size=4,signed=True -global: va=004F1D60,name=Tourture_cpp_4F1D60,size=421 +global: va=004F1D60,name=Tourture_cpp_tick,size=421 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -40826,7 +40882,7 @@ global: va=004F38C0,name=sub_4F38C0,size=222,member_of=vtbl_0066DB7C ret: kind=int,size=2,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004F39A0,name=sub_4F39A0,size=83,member_of=vtbl_0066DB7C +global: va=004F39A0,name=tickTreasury,size=83,member_of=vtbl_0066DB7C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -40897,7 +40953,7 @@ global: va=004F4A60,name=Workshop_cpp_4F4A60,size=187 ret: kind=int,size=4 arg: kind=ptr type: kind=struct,id=vtbl_0066DB7C -global: va=004F4B20,name=Workshop_cpp_4F4B20,size=1293 +global: va=004F4B20,name=Workshop_cpp_tick,size=1293 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -41009,10 +41065,11 @@ global: va=004F6570,name=constructor,size=357,member_of=constructor_004F6570 ret: kind=void arg: kind=ptr type: kind=struct,id=constructor_004F6570 -global: va=004F66E0,name=sub_4F66E0,size=4298 +global: va=004F66E0,name=sub_4F66E0,size=4298,member_of=constructor_004F6570 type: kind=function,declspec=thiscall - ret: kind=int,size=1,signed=True,winapi=char - arg: kind=int,size=4,signed=True + ret: kind=int,size=1 + arg: kind=ptr + type: kind=struct,id=constructor_004F6570 arg: kind=int,size=4,signed=True arg: kind=int,size=4,signed=True global: va=004F77B0,name=sub_4F77B0,size=83 @@ -42326,13 +42383,13 @@ global: va=00508D60,name=fun_508D60,size=14,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=int,size=1,signed=True,winapi=char arg: kind=ptr - type: kind=int,size=1 + type: kind=struct,id=vtbl_0066E3EC arg: kind=int,size=4,signed=True global: va=00508D70,name=fun_508D70,size=14,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=int,size=1,signed=True,winapi=char arg: kind=ptr - type: kind=int,size=1 + type: kind=struct,id=vtbl_0066E3EC arg: kind=int,size=4,signed=True global: va=00508D80,name=fun_508D80,size=14,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall @@ -42360,7 +42417,7 @@ global: va=00508DB0,name=fun_508DB0,size=25,member_of=vtbl_0066E3EC type: kind=int,size=1,signed=True,winapi=char arg: kind=ptr type: kind=int,size=1,signed=True,winapi=char -global: va=00508DD0,name=fun_508DD0,size=32,member_of=vtbl_0066E3EC +global: va=00508DD0,name=fun_508DD0_getTerrainDataObj,size=32,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=ptr type: kind=struct,id=constructor_004F6570 @@ -42531,7 +42588,8 @@ global: va=00508FE0,name=getMapElem_2,size=42,member_of=vtbl_0066E3EC global: va=00509010,name=fun_509010,size=50,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066E3EC arg: kind=ptr type: kind=int,size=4,signed=True global: va=00509050,name=fun_509050,size=51,member_of=vtbl_0066E3EC @@ -43003,12 +43061,12 @@ global: va=0050A450,name=tick,size=1024,member_of=vtbl_0066E3EC type: kind=struct,id=vtbl_0066E3EC arg: kind=ptr type: kind=struct,id=construct_005227B5 -global: va=0050A850,name=sub_50A850,size=493 +global: va=0050A850,name=sub_50A850,size=493,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=ptr type: kind=struct,id=call_new_arr_004C40B6 arg: kind=ptr - type: kind=int,size=1 + type: kind=struct,id=vtbl_0066E3EC global: va=0050AA40,name=clearResearchOrder,size=22,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=void @@ -43077,7 +43135,7 @@ global: va=0050CEB0,name=fun_50CEB0,size=97,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=int,size=1,signed=True,winapi=char arg: kind=ptr - type: kind=int,size=4 + type: kind=struct,id=vtbl_0066E3EC arg: kind=int,size=4,signed=True global: va=0050CF20,name=fun_50CF20,size=87,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall @@ -43089,7 +43147,7 @@ global: va=0050CF80,name=fun_50CF80,size=47,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True,winapi=BOOL,fname=BOOL arg: kind=ptr - type: kind=int,size=4 + type: kind=struct,id=vtbl_0066E3EC arg: kind=int,size=1 global: va=0050CFB0,name=fun_50CFB0,size=26,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall @@ -43559,7 +43617,7 @@ global: va=0050FA70,name=fun_50FA70,size=92,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr - type: kind=struct,id=vtbl_0066E3EC + type: kind=void arg: kind=int,size=4,signed=True global: va=0050FAD0,name=sub_50FAD0,size=14 type: kind=function,declspec=thiscall @@ -44707,10 +44765,11 @@ global: va=00519A04,name=jpt_51998A,size=24 type: kind=array,count=6 type: kind=ptr type: kind=void -global: va=00519A20,name=sub_519A20,size=246 +global: va=00519A20,name=sub_519A20,size=246,member_of=vtbl_0066E3EC type: kind=function,declspec=thiscall ret: kind=void - arg: kind=int,size=4,signed=True + arg: kind=ptr + type: kind=struct,id=vtbl_0066E3EC arg: kind=int,size=2,signed=True arg: kind=int,size=4,signed=True global: va=00519B20,name=WorldTrigger_cpp_519B20,size=1124 @@ -44729,7 +44788,7 @@ global: va=00519F90,name=WorldTrigger_cpp_519F90,size=2002 type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr - type: kind=int,size=4 + type: kind=struct,id=vtbl_0066E3EC arg: kind=int,size=2,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066D524 @@ -45157,11 +45216,11 @@ global: va=00521770,name=CWorld_load_521770,size=22 type: kind=void arg: kind=ptr type: kind=struct,id=vtbl_0066E3EC -global: va=00521790,name=CWorld_load_521790,size=83 +global: va=00521790,name=CWorld_load_521790_world,size=83 type: kind=function,declspec=cdecl ret: kind=int,size=4,signed=True arg: kind=ptr - type: kind=struct,id=constructor_00521F40 + type: kind=void arg: kind=ptr type: kind=struct,id=vtbl_0066E3EC global: va=005217F0,name=sub_5217F0,size=30 @@ -46381,13 +46440,13 @@ global: va=0052A8E0,name=fun_52A8E0,size=297,member_of=vtbl_0066ED8C type: kind=struct,id=vtbl_0066ED8C arg: kind=ptr type: kind=struct,id=vtbl_0066C4A4 -global: va=0052AA10,name=fun_52AA10,size=201,member_of=vtbl_0066ED8C +global: va=0052AA10,name=fun_52AA10_configure,size=201,member_of=vtbl_0066ED8C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066ED8C arg: kind=ptr - type: kind=int,size=4 + type: kind=struct,id=use_00528300 global: va=0052AAE0,name=fun_52AAE0,size=690,member_of=vtbl_0066ED6C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True @@ -46951,7 +47010,7 @@ global: va=0052FF10,name=CTextInput_52FF10,size=621 type: kind=function,declspec=cdecl ret: kind=int,size=4,signed=True arg: kind=ptr - type: kind=struct,id=vtbl_0066ECA4 + type: kind=struct,id=vtbl_0066ED8C arg: kind=ptr type: kind=struct,id=vtbl_0066EF3C global: va=00530180,name=renderInputField,size=652,member_of=vtbl_0066EF3C @@ -47114,13 +47173,14 @@ global: va=00532350,name=sub_532350,size=24 arg: kind=ptr type: kind=struct,id=vtbl_0066ECA4 arg: kind=int,size=4,signed=True -global: va=00532370,name=sub_532370,size=24 +global: va=00532370,name=CTextBox_sub_532370,size=24 type: kind=function,declspec=cdecl ret: kind=ptr - type: kind=int,size=4 + type: kind=int,size=4,signed=True arg: kind=ptr - type: kind=struct,id=vtbl_0066ECA4 - arg: kind=int,size=4,signed=True + type: kind=struct,id=vtbl_0066EDAC + arg: kind=ptr + type: kind=struct,id=vtbl_0066EF3C global: va=00532390,name=sub_532390,size=24 type: kind=function,declspec=cdecl ret: kind=ptr @@ -47128,15 +47188,16 @@ global: va=00532390,name=sub_532390,size=24 arg: kind=ptr type: kind=struct,id=vtbl_0066ECA4 arg: kind=int,size=4,signed=True -global: va=005323B0,name=sub_5323B0,size=652 +global: va=005323B0,name=CTextBox_sub_5323B0_render,size=652 type: kind=function,declspec=cdecl ret: kind=ptr - type: kind=int,size=4 + type: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0067B8C0 arg: kind=ptr - type: kind=struct,id=vtbl_0066ECA4 - arg: kind=int,size=4,signed=True + type: kind=struct,id=vtbl_0066EDAC + arg: kind=ptr + type: kind=struct,id=vtbl_0066EF3C global: va=0053263C,name=jpt_532514,size=24 type: kind=array,count=6 type: kind=ptr @@ -48586,7 +48647,7 @@ global: va=00547AE0,name=CFrontEndComponent_systemCallback,size=56 arg: kind=int,size=4,signed=True arg: kind=ptr type: kind=struct,id=vtbl_0066EF3C -global: va=00547B20,name=sub_547B20,size=26 +global: va=00547B20,name=sub_547B20,size=26,member_of=vtbl_0066EF3C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True arg: kind=ptr @@ -49426,11 +49487,14 @@ global: va=0054EE10,name=sub_54EE10,size=17 type: kind=function,declspec=stdcall ret: kind=ptr type: kind=int,size=2,winapi=wchar_t,fname=wchar_t -global: va=0054EE30,name=_malloc_0,size=20 +global: va=0054EE30,name=sub_54EE30,size=20 type: kind=function,declspec=cdecl ret: kind=ptr type: kind=void arg: kind=int,size=4,winapi=size_t,fname=size_t +global: va=0054EE50,name=sub_54EE50,size=15 + type: kind=function,declspec=stdcall + ret: kind=int,size=4,signed=True global: va=0054EE60,name=sub_54EE60,size=488,member_of=vtbl_0066EF3C type: kind=function,declspec=thiscall ret: kind=int,size=4,signed=True @@ -49933,7 +49997,7 @@ global: va=00553E50,name=jpt_553DED,size=28 global: va=00553E6C,name=idt_553DE7,size=14 type: kind=array,count=14 type: kind=int,size=1 -global: va=00553E80,name=sub_553E80,size=87 +global: va=00553E80,name=isPrintable_sub_553E80,size=87 type: kind=function,declspec=cdecl ret: kind=int,size=1,signed=True,winapi=bool arg: kind=int,size=4,signed=True @@ -79697,6 +79761,9 @@ global: va=006BB1C8,name=Main_LoadGame_WinCfg,size=68 global: va=006BB210,name=Main_LoadGame_BtnArr,size=640 type: kind=array,count=8 type: kind=struct,id=use_00528300 +global: va=006BC350,name=g_deltaLocs,size=32 + type: kind=array,count=4 + type: kind=struct,id=pos_xy global: va=006BC430,name=g_majorVersion,size=4 type: kind=int,size=4 global: va=006BC434,name=g_minorVersion,size=4 @@ -79928,6 +79995,10 @@ global: va=006DA4A0,name=g_PlayerList_ptr,size=4 global: va=006DA4A4,name=g_CWorld_ptr_0,size=4 type: kind=ptr type: kind=struct,id=vtbl_0066E3EC +global: va=006DA4A8,name=g_MyTerrainDataObj_arr,size=1024 + type: kind=array,count=256 + type: kind=ptr + type: kind=struct,id=constructor_004F6570 global: va=006DA8A8,name=g_empty_string,size=8 type: kind=array,count=8 type: kind=int,size=1,signed=True,winapi=char @@ -79943,6 +80014,9 @@ global: va=006E4154,name=g_pObj6F2550,size=4 global: va=006E4198,name=g_Obj6E4198_arr,size=2349 type: kind=array,count=81 type: kind=struct,id=arr_006E4198 +global: va=006E4B3C,name=g_objectState_arr,size=1180 + type: kind=array,count=59 + type: kind=struct,id=arr_006E4B3C global: va=006E4FD8,name=funcs_4A8BE5,size=16 type: kind=array,count=4 type: kind=int,size=4,signed=True diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a99e241..7130937 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,7 +13,9 @@ add_executable(${TARGET} dk2/PlayerCfg.cpp dk2/RegKey.cpp dk2/MyComputerPlayer.cpp + dk2/CRoom.cpp dk2/button/button_types.cpp + dk2/button/CTextInput.cpp dk2/entities/entities_type.cpp dk2/entities/CCreature.cpp dk2/entities/CPlayer.cpp diff --git a/src/dk2/CGameComponent.cpp b/src/dk2/CGameComponent.cpp index 41c6204..7ed8853 100644 --- a/src/dk2/CGameComponent.cpp +++ b/src/dk2/CGameComponent.cpp @@ -154,7 +154,7 @@ dk2::CGameComponent *dk2::CGameComponent::mainGuiLoop() { // hook::BEFORE_GAME_LOOP while ( !this->exit_flag ) { // hook::TICK_GAME_LOOP - limit_fps::call(); + if(control_windowed_mode::enabled) limit_fps::call(); replace_mouse_dinput_to_user32::release_handled_dinput_actions(); if ( !MyGame_instance.isNeedBlt() ) { MyCollectDxAction_Action dxAct; diff --git a/src/dk2/CRoom.cpp b/src/dk2/CRoom.cpp new file mode 100644 index 0000000..f842e13 --- /dev/null +++ b/src/dk2/CRoom.cpp @@ -0,0 +1,185 @@ +// +// Created by DiaLight on 30.09.2024. +// + +#include "dk2/entities/CRoom.h" +#include "room_type.h" +#include "dk2/entities/CPlayer.h" +#include "dk2_globals.h" +#include "dk2/CBridgeCmd.h" +#include "dk2/entities/data/MyRoomDataObj.h" +#include "dk2/entities/data/MyTerrainDataObj.h" +#include "dk2/world/map/MyMapElement.h" +#include "tools/bug_hunter.h" +#include "patches/micro_patches.h" + + +namespace dk2 { + + MyMapElement *getMapElem(Pos2ub &loc) { + CMap &cmap = g_CWorld_ptr->cmap; + return &cmap.mapElements[loc.x + loc.y * cmap.width]; + } + + void testFire(CRoom *_this) { + MyMapElement *mapElem; + for (Pos2ub loc = _this->firstSlab; loc.x || loc.y; loc = mapElem->nextSlab) { + mapElem = getMapElem(loc); + uint8_t burnLevel = (mapElem->flags >> 1) & 0xF; + if ((mapElem->_playerId & 0x1000) == 0) continue; + if (burnLevel >= 9) continue; + mapElem->roomSetBurnLevel(burnLevel + 1); + burnLevel = (mapElem->flags >> 1) & 0xF; + if (burnLevel == 8) { + *(DWORD *) _this->field_49_union_start = 1; // FlagToBurn + mapElem->roomSetBurnLevel(9); + } else if (burnLevel == 4) { + CBridgeCmd v21_cmd; + v21_cmd.a1 = loc.x | (loc.y << 16); + v21_cmd.a2 = 0; + v21_cmd.a3 = 0; + v21_cmd.cmd = 3; + int v22_try; + v22_try = 0; + g_CWorld_ptr->execCBridgeCmd(&v21_cmd); + v22_try = -1; + } + } + } +} + +int dk2::CRoom::tickWoodenBridge() { + unsigned int v3 = (this->f0_tagId + g_CWorld_ptr->getGameTick()) % (5 * Obj6F2550_instance.gameTick); + if (v3 == 0) { // fire tick + testFire(this); + } + + // if nothing to burn then exit + if (*(DWORD *) this->field_49_union_start != 1) return 1; + + // tick remove mapElem by burning + __int16 v8_unkIdx = this->pRoomDataObj->f421; + bool anyBridgesBurned = false; + int burnedCount = 0; + MyMapElement *mapElem; + for (Pos2ub pos = this->firstSlab; pos.x || pos.y; pos = mapElem->nextSlab) { + mapElem = getMapElem(pos); + if ((mapElem->_playerId & 0x1000) == 0) continue; + uint8_t burnLevel = (mapElem->flags >> 1) & 0xF; + if (burnLevel != 9) continue; + auto *player = (CPlayer *) sceneObjects[this->playerId]; + if (!player->fun_4C5DB0(pos.x, pos.y, 0)) continue; + + anyBridgesBurned = true; + ++burnedCount; + mapElem->roomSetBurnLevel(0); + if (v8_unkIdx) { + CBridgeCmd v21_cmd; + v21_cmd.a1 = (pos.x << 12) + 2048; + v21_cmd.a2 = (pos.y << 12) + 2048; + v21_cmd.a3 = 0; + __int16 v14 = 0; + Pos2ub v19_bridgeLoc; + g_CWorld_ptr->v_sub_509580(v8_unkIdx, this->playerId, (int) &v21_cmd, (int) &v14, (int) &v19_bridgeLoc); + } + if (burnedCount == 8) break; + } + if (!anyBridgesBurned) *(DWORD *) this->field_49_union_start = 0; // FlagToBurn + return 1; +} + +unsigned int dk2::CMap::attachToRoom( + int a2_x, + int a3_y, + unsigned __int16 a4_roomObjId, + __int16 a5_playerId, + int a6, + int a7) { + int v8_y = a3_y; + MyMapElement *v9_mapElem = &this->mapElements[a2_x + a3_y * this->width]; + int v10_flags = g_MyTerrainDataObj_arr[v9_mapElem->arr6DA4A8_idx]->_flags; + if ((v10_flags & 0x80u) == 0) { + if ((v10_flags & 0x100) != 0) + v9_mapElem->_playerId |= 0x1000u; + } else { + v9_mapElem->_playerId &= ~0x1000u; + } + int typeId = ((CRoom *) sceneObjects[a4_roomObjId])->typeId; + if(wooden_bridge_burn_fix::enabled) { + if (typeId != CRoom_typeId_WoodenBridge) { // ignore reset burn level at attach cell to room + v9_mapElem->roomSetBurnLevel(0); + } + } else { + v9_mapElem->roomSetBurnLevel(0); + } + v9_mapElem->fun_4559D0(a5_playerId); + MyRoomDataObj *v11_roomDataObj = this->world->v_fun_50D0B0(typeId); + this->fun_44FC40(a2_x, v8_y, (int) v11_roomDataObj->f44E, v9_mapElem->_playerId & 0xFFF, 0, a7); +// v9_mapElem->roomId = v9_mapElem->roomId ^ ((v9_mapElem->roomId ^ a4_roomObjId) & 0xFFF); + v9_mapElem->roomId = (v9_mapElem->roomId & 0xF000) | (a4_roomObjId & 0xFFF); + return this->sub_4522A0(a2_x, v8_y); +} + +int dk2::MyRooms::sub_4ED1A0( + int a2_x, + int arg4_y, + int a4_roomTypeId, + __int16 a5_playerId, + unsigned __int16 a6_roomObjId, + BYTE *a7_pNearCountNeg, + int a8) { + if ((g_MyTerrainDataObj_arr[this->world->getMapElem(a2_x, arg4_y)->arr6DA4A8_idx]->_flags & 0x80) != 0) { + int *p_y; // esi + p_y = &g_deltaLocs[0].y; + do { + int v11 = a2_x + *(p_y - 1); + int v12 = *p_y + arg4_y; + CBridgeCmd bridgeCmd; + bridgeCmd.a3 = -8192; + bridgeCmd.a1 = (v11 << 12) + 2048; + bridgeCmd.a2 = (v12 << 12) + 2048; + bridgeCmd.cmd = 8; + CWorld *f6_world = this->world; + int v20_try = 0; + f6_world->execCBridgeCmd(&bridgeCmd); + v20_try = -1; + p_y += 2; + } while ((int) p_y < (int) 0x6BC374); +// } while ( (int)p_y < (int)&dword_6BC374 ); + } + CRoom *v19[4]; + memset(v19, 0, sizeof(v19)); + CRoom *a3 = 0; + int v14 = this->sub_4ED320(a2_x, arg4_y, a4_roomTypeId, a5_playerId, a6_roomObjId, a7_pNearCountNeg, &a3, v19); + if(wooden_bridge_burn_fix::enabled) { + if(((BYTE) a4_roomTypeId) == CRoom_typeId_WoodenBridge) { + CMap &map = this->world->cmap; + map.mapElements[a2_x + arg4_y * map.width].roomSetBurnLevel(0); + } + } + CRoom *v15 = a3; + int arg4_ya = v14; + if (!a3) + return arg4_ya; + if (a8 != 8) { + a3->orientation = a8; + v15 = a3; + } + v15->removeObject(); + this->fun_4ECEB0(a3, a2_x, arg4_y); + this->fun_4EF5E0(a3); + this->RoomManager_cpp_4EDFC0((int) a3); + a3->sub_4E4480(); + if ((BYTE) a4_roomTypeId == 8 || (BYTE) a4_roomTypeId == 17 || (BYTE) a4_roomTypeId == 22) + ((CPlayer *) sceneObjects[(unsigned __int16) a5_playerId])->sub_4BA720(a2_x, arg4_y); + return arg4_ya; +} + + +const char *CRoom_typeId_toString(int ty) { + switch (ty) { +#define _CRoom_typeId_toString(id, pascalName) case CRoom_typeId_##pascalName: return #pascalName; + CRoom_types(_CRoom_typeId_toString) + } + return "Unknown"; +} diff --git a/src/dk2/MyComputerPlayer.cpp b/src/dk2/MyComputerPlayer.cpp index 7cdd65b..8fbe73d 100644 --- a/src/dk2/MyComputerPlayer.cpp +++ b/src/dk2/MyComputerPlayer.cpp @@ -102,7 +102,7 @@ namespace dk2 { v59_loc.x = (v29_locX << 12) + 2048; CWorld *fA_world = cp->world; v59_loc.y = (v30_locY << 12) + 2048; - if ((fA_world->v_getMapElem_2(&v59_loc)->f8 & 0xFFF) != cp->cplayer->f0_tagId) { + if ((fA_world->v_getMapElem_2(&v59_loc)->_playerId & 0xFFF) != cp->cplayer->f0_tagId) { unsigned int v71_locX = 0; unsigned int v69_locY = 0; int v32_respondIdx = (cp->flags >> 14) & 0xF; @@ -129,7 +129,7 @@ namespace dk2 { if ((v42_cworld->cmap.pNavigationSystem->map.ptr_ui8[ v73_locY * v42_cworld->cmap.pNavigationSystem->map.width + v33_locX] & 8) == 0 && !v43_mapElement->sub_454110() - && (v43_mapElement->f8 & 0xFFF) == cp->cplayer->f0_tagId) { + && (v43_mapElement->_playerId & 0xFFF) == cp->cplayer->f0_tagId) { v71_locX = v33_locX; v69_locY = v73_locY; v74_whileBool = false; @@ -154,7 +154,7 @@ namespace dk2 { v73_locY * v48_cworld->cmap.pNavigationSystem->map.width + v44_locX] & 8) == 0 && !v49_mapElem->sub_454110() - && (v49_mapElem->f8 & 0xFFF) == cp->cplayer->f0_tagId) { + && (v49_mapElem->_playerId & 0xFFF) == cp->cplayer->f0_tagId) { break; } } @@ -179,7 +179,7 @@ namespace dk2 { v73_locY * v45_cworld->cmap.pNavigationSystem->map.width + v44_locX] & 8) == 0 && !v46_mapElem->sub_454110() - && (v46_mapElem->f8 & 0xFFF) == cp->cplayer->f0_tagId) { + && (v46_mapElem->_playerId & 0xFFF) == cp->cplayer->f0_tagId) { break; } } diff --git a/src/dk2/button/CTextInput.cpp b/src/dk2/button/CTextInput.cpp new file mode 100644 index 0000000..c381ace --- /dev/null +++ b/src/dk2/button/CTextInput.cpp @@ -0,0 +1,38 @@ +// +// Created by DiaLight on 01.10.2024. +// +#include "dk2/button/CTextInput.h" +#include "dk2/button/ButtonCfg.h" +#include "dk2_functions.h" +#include "dk2_globals.h" +#include "patches/micro_patches.h" + + +int dk2::CTextInput::fun_52AA10_configure(ButtonCfg *a2_cfg) { + void *v2_strId = a2_cfg->var16; + if (v2_strId) { + unsigned __int8 *MbString = MyMbStringList_idx1091_getMbString((unsigned int) v2_strId); + MBToUni_convert(MbString, this->str2, 128); + } else { + this->str2[0] = 0; + } + int f1A_inputLimit = (int) a2_cfg->var1A; + if (f1A_inputLimit == -1) { + if (MyResources_instance.playerCfg.kbLayoutId == 17) + this->f27C_inputLimit = 11; + else + this->f27C_inputLimit = 16; + } else { + if(max_host_port_number_fix::enabled) { + if(this->f70_idx == 0x212) { // port number + f1A_inputLimit++; + } + } + this->f27C_inputLimit = f1A_inputLimit; + } + this->field_280 = 0; + this->field_284 = (unsigned __int16) a2_cfg->idxHigh == 1; + memset(this->str1, 0, sizeof(this->str1)); + this->field_288 = ((int) a2_cfg->idxHigh & 0xFFFF0000) == 0x10000; + return 0; +} diff --git a/src/dk2/room_type.h b/src/dk2/room_type.h new file mode 100644 index 0000000..5548203 --- /dev/null +++ b/src/dk2/room_type.h @@ -0,0 +1,43 @@ +// +// Created by DiaLight on 01.10.2024. +// + +#ifndef FLAME_ROOM_TYPE_H +#define FLAME_ROOM_TYPE_H + +#define CRoom_types(cb) \ + cb(1, Treasury)\ + cb(2, unk_2)\ + cb(3, Entrance)\ + cb(4, Hatchery)\ + cb(5, DungeonHeart)\ + cb(6, Library)\ + cb(7, unk_7)\ + cb(8, WoodenBridge) /* _DWORD field_49_union_start: FlagToBurn */\ + cb(9, GuardPost)\ + cb(10, Workshop)\ + cb(11, Prison)\ + cb(12, TortureRoom)\ + cb(13, Temple)\ + cb(14, Graveyard)\ + cb(15, Casino)\ + cb(16, CombatPit)\ + cb(17, _StoneBridge) /* _DWORD field_49_union_start: FlagToBurn*/\ + cb(18, unk_18)\ + cb(19, unk_19)\ + cb(20, unk_20)\ + cb(21, HeroGateFrontEnd)\ + cb(22, unk_22)\ + cb(23, unk_23)\ + cb(24, MercenaryGate)\ + cb(25, HeroPortal)\ + cb(26, Crypt) + + +enum CRoom_typeId { +#define _CRoom_typeId(id, pascalName) CRoom_typeId_##pascalName = id, + CRoom_types(_CRoom_typeId) +}; +const char *CRoom_typeId_toString(int ty); + +#endif //FLAME_ROOM_TYPE_H diff --git a/src/patches/dev/bridge_burn.txt b/src/patches/dev/bridge_burn.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/patches/dev/state_arays.txt b/src/patches/dev/state_arays.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/patches/dev/zoom_path.txt b/src/patches/dev/zoom_path.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/patches/gog_patch_dll/gog_patch.cpp b/src/patches/gog_patch_dll/gog_patch.cpp index afe10c0..8220911 100644 --- a/src/patches/gog_patch_dll/gog_patch.cpp +++ b/src/patches/gog_patch_dll/gog_patch.cpp @@ -5,12 +5,13 @@ #include "gog_globals.h" #include "gog_debug.h" -bool gog::RtGuiView_fix::enable = true; -bool gog::RegistryConfig_patch::enable = true; -bool gog::parseCommandLine_patch::enable = true; -bool gog::SurfaceHolder_setTexture_patch::enable = true; +bool gog::enable = true; +bool gog::RtGuiView_fix::enable = gog::enable && true; +bool gog::RegistryConfig_patch::enable = gog::enable && true; +bool gog::parseCommandLine_patch::enable = gog::enable && true; +bool gog::SurfaceHolder_setTexture_patch::enable = gog::enable && true; -bool gog::BullfrogWindow_proc_patch::enable = true; +bool gog::BullfrogWindow_proc_patch::enable = gog::enable && true; bool gog::BullfrogWindow_proc_patch::window_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { if (!enable) return false; switch (Msg) { diff --git a/src/patches/gog_patch_dll/gog_patch_dll.cpp b/src/patches/gog_patch_dll/gog_patch_dll.cpp index a7015e5..382c575 100644 --- a/src/patches/gog_patch_dll/gog_patch_dll.cpp +++ b/src/patches/gog_patch_dll/gog_patch_dll.cpp @@ -9,8 +9,6 @@ using namespace gog; -bool gog::enable = true; - void _gog_print(const char *msg) { char msg_buf[1024]; wsprintfA(msg_buf, "[GOG] %s\n", msg); diff --git a/src/patches/micro_patches.cpp b/src/patches/micro_patches.cpp index 741161d..ea0e9b6 100644 --- a/src/patches/micro_patches.cpp +++ b/src/patches/micro_patches.cpp @@ -24,6 +24,8 @@ bool response_to_threat_fix::enabled = true; bool use_wasd_by_default_patch::enabled = true; bool print_game_start_errors::enabled = true; bool creatures_setup_lair_fix::enabled = true; +bool wooden_bridge_burn_fix::enabled = true; +bool max_host_port_number_fix::enabled = true; void use_wasd_by_default_patch::useAlternativeName(LPCSTR &lpValueName) { if(!use_wasd_by_default_patch::enabled) return; diff --git a/src/patches/micro_patches.h b/src/patches/micro_patches.h index 3bb5218..7fada12 100644 --- a/src/patches/micro_patches.h +++ b/src/patches/micro_patches.h @@ -52,6 +52,14 @@ namespace creatures_setup_lair_fix { extern bool enabled; } +namespace wooden_bridge_burn_fix { + extern bool enabled; +} + +namespace max_host_port_number_fix { + extern bool enabled; +} + namespace use_wasd_by_default_patch { extern bool enabled; void useAlternativeName(LPCSTR &lpValueName); diff --git a/src/patches/replace_mouse_dinput_to_user32.cpp b/src/patches/replace_mouse_dinput_to_user32.cpp index f3adb98..bcc8154 100644 --- a/src/patches/replace_mouse_dinput_to_user32.cpp +++ b/src/patches/replace_mouse_dinput_to_user32.cpp @@ -38,7 +38,7 @@ void move_mouse(DWORD offs, DWORD value) { // MouseXyzDxAction *action = this->listXYZ.getOrCreateUnhandled(); auto *action = (dk2::MouseXyzDxAction *) new char[sizeof(dk2::MouseXyzDxAction)]; - *(void **) action = &dk2::MouseRgbDxAction::vftable; + *(void **) action = &dk2::MouseXyzDxAction::vftable; xyzActionsInProgress.push_back(action); action->value = value; // relative or absolute motion diff --git a/src/patches/use_wheel_to_zoom.cpp b/src/patches/use_wheel_to_zoom.cpp index 64038c9..c8b494e 100644 --- a/src/patches/use_wheel_to_zoom.cpp +++ b/src/patches/use_wheel_to_zoom.cpp @@ -15,7 +15,9 @@ void use_wheel_to_zoom::window_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l DWORD xPos = GET_X_LPARAM(lParam); DWORD yPos = GET_Y_LPARAM(lParam); // printf("k=%08X d=%d {%d %d}\n", fwKeys, zDelta, xPos, yPos); - dk2::CBridge_instance.camera.zoomRel_449CA0(-zDelta * 50); + if(dk2::CGameComponent_instance.mt_profiler.player_i != NULL) { + dk2::CBridge_instance.camera.zoomRel_449CA0(-zDelta * 50); + } break; } } @@ -34,7 +36,9 @@ void use_wheel_to_zoom::dinput_proc(DIDEVICEOBJECTDATA *data) { int mult = 80; if (tsDelta > 100) mult = 40; if (tsDelta > 500) mult = 20; - dk2::CBridge_instance.camera.zoomRel_449CA0(-zDelta * mult); + if(dk2::CGameComponent_instance.mt_profiler.player_i != NULL) { + dk2::CBridge_instance.camera.zoomRel_449CA0(-zDelta * mult); + } break; } } diff --git a/src/replace_globals.map b/src/replace_globals.map index 1de3905..fd01f62 100644 --- a/src/replace_globals.map +++ b/src/replace_globals.map @@ -58,12 +58,24 @@ # CTextBox.h 00537E10 void __cdecl CTextBox_renderVersion(CTextBox *, CFrontEndComponent *); /* auto */ +# CTextInput.h +0052AA10 int fun_52AA10_configure(ButtonCfg *); // -- /* auto */ + # CPlayer.h 00506B50 BOOL testManufactureCompleted(uint16_t); /* auto */ 00506B70 int getManufactureRequired(uint16_t); // --- /* auto */ 004C3200 int creatureDidWorkshopWork(int, CCreature *); /* auto */ 004E8D30 void resetCreaturesState(); // ------------- /* auto */ +# MyRooms.h +004ED1A0 int sub_4ED1A0(int, int, int, int16_t, uint16_t, uint8_t *, int); /* auto */ + +# CRoom.h +004D5FA0 int tickWoodenBridge(); // ----------------- /* auto */ + +# CMap.h +00450770 uint32_t attachToRoom(int, int, uint16_t, int16_t, int, int); /* auto */ + # CComputerPlayer.h 004FE0B0 char tickRespondToAttack(char); // --------- /* auto */ diff --git a/tools/devhelper/CMakeLists.txt b/tools/devhelper/CMakeLists.txt index d03ef3e..9b98bcc 100644 --- a/tools/devhelper/CMakeLists.txt +++ b/tools/devhelper/CMakeLists.txt @@ -6,6 +6,7 @@ add_library(${TARGET} SHARED mimicry.cpp console.cpp game_version.cpp + dev_mouse_dinput_to_user32.cpp ) target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_LIST_DIR}) diff --git a/tools/devhelper/dev_mouse_dinput_to_user32.cpp b/tools/devhelper/dev_mouse_dinput_to_user32.cpp new file mode 100644 index 0000000..671ef21 --- /dev/null +++ b/tools/devhelper/dev_mouse_dinput_to_user32.cpp @@ -0,0 +1,406 @@ +// +// Created by DiaLight on 20.07.2024. +// + +#include "dev_mouse_dinput_to_user32.h" +#include "game_version.h" +#include "write_protect.h" +#include +#include +#include + +// click flags +#define DK2_Shift 0x01 +#define DK2_Ctrl 0x02 +#define DK2_Alt 0x04 +#define DK2_IsPressed 0x08 +#define DK2_IsDblClick 0x10 + +// dk2 extends dinput scancodes for keyboard to add mouse keys in keyboard state array +#define DIK_DK2_LEFTMOUSE 0xF0 +#define DIK_DK2_RIGHTMOUSE 0xF1 +#define DIK_DK2_MIDDLEMOUSE 0xF2 +#define DIK_DK2_UNKMOUSE 0xF3 + +bool dev_mouse_dinput_to_user32::enabled = true; + +namespace dk2 { +#pragma pack(push, 1) + struct DxAction { + +/* 0*/ void *vftable; +/* 4*/ int timestamp; +/* 8*/ int isNotHandled; + +/*---*/ DxAction() = delete; +/*---*/ ~DxAction() = delete; +/*---*/ // DxAction ------------------------------------- /* auto */ + + }; + static_assert(sizeof(DxAction) == 0xC); + struct Pos2i { + +/* 0*/ int x; +/* 4*/ int y; + + }; + struct MouseRgbDxAction : DxAction { + +/* C*/ uint8_t gap_C[4]; +/* 10*/ uint32_t KeyCode_F0toF3; +/* 14*/ Pos2i pos; +/* 1C*/ int data; +/* 20*/ int btnPressFlags; + +/*---*/ MouseRgbDxAction() = delete; +/*---*/ ~MouseRgbDxAction() = delete; +/*---*/ // super DxAction ------------------------------- /* auto */ +/* 0*/ // virtual int v_applyToState(MyDxInputState *); // = 005DD8C0 /* auto */ +/*---*/ // MouseRgbDxAction ----------------------------- /* auto */ + + }; + static_assert(sizeof(MouseRgbDxAction) == 0x24); + struct MouseXyzDxAction : DxAction { +/*00672900*/ __declspec( dllimport ) static void *vftable[]; /* auto */ +/*---*/ inline void *getVtbl() const { return *(void **) this; } /* auto */ + +/* C*/ int actedAxe; +/* 10*/ int value; + +/*---*/ MouseXyzDxAction() = delete; +/*---*/ ~MouseXyzDxAction() = delete; + + +}; +static_assert(sizeof(MouseXyzDxAction) == 0x14); + struct AABB { + +/* 0*/ int minX; +/* 4*/ int minY; +/* 8*/ int maxX; +/* C*/ int maxY; + +/*00404DB0*/ AABB *constructor(); +/*00404DC0*/ AABB *constructor_0(int, int, int, int); /* auto */ +/*0044BD30*/ BOOL sub_44BD30(AABB *); +/*0052D3A0*/ BOOL contains(AABB *); +/*00556590*/ AABB *appendPoint(AABB *, tagPOINT *); +/*005B6FD0*/ AABB *intersection(AABB *, AABB *); +/*005B7050*/ BOOL isIntersects(AABB *); +/*005B7090*/ AABB *getOuter(AABB *, AABB *); +/*005B7100*/ int sub_5B7100(); +/*005DC2D0*/ int move(int, int); + + }; + static_assert(sizeof(AABB) == 0x10); + struct MySharedObj { // --------------------------------- /* auto */ +// ------------------------------------------------------- /* auto */ +/* 0*/ uint8_t *vftable; // ------------------------------------ /* auto */ +/* 4*/ int refs; // ------------------------------------ /* auto */ +// ------------------------------------------------------- /* auto */ +/*---*/ MySharedObj() = delete; // ---------------------- /* auto */ +/*---*/ ~MySharedObj() = delete; // --------------------- /* auto */ +/*---*/ // MySharedObj ---------------------------------- /* auto */ +///* 0*/ virtual int v_release(); // = 0062FC10 --------- /* auto */ +///* 4*/ virtual int v_addRef(); // = 0062FC00 ---------- /* auto */ +///* 8*/ virtual MySharedObj *v_scalar_destructor(char); // = 005BB710 /* auto */ +// ------------------------------------------------------- /* auto */ +/*005BB710*/ MySharedObj *deleting_destructor(char); // - /* auto */ +/*005DCA30*/ MySharedObj *constructor(); // ------------- /* auto */ +/*0062FC00*/ int addRef(); // --------------------------- /* auto */ +/*0062FC10*/ int release(); // -------------------------- /* auto */ +// ------------------------------------------------------- /* auto */ + }; // --------------------------------------------------- /* auto */ + static_assert(sizeof(MySharedObj) == 0x8); // ----------- /* auto */ + struct MyComEx : MySharedObj { // ----------------------- /* auto */ +// ------------------------------------------------------- /* auto */ +/* 8*/ MyComEx *f4_child; // --------------------------- /* auto */ +// ------------------------------------------------------- /* auto */ +/*---*/ MyComEx() = delete; // -------------------------- /* auto */ +/*---*/ ~MyComEx() = delete; // ------------------------- /* auto */ +/*---*/ // super MySharedObj ---------------------------- /* auto */ +/* 0*/ // virtual int v_release(); // = 0062FC10 ------ /* auto */ +/* 4*/ // virtual int v_addRef(); // = 0062FC00 ------- /* auto */ +/* 8*/ // virtual MySharedObj *v_scalar_destructor(char); // = 005BB790 /* auto */ +/*---*/ // MyComEx -------------------------------------- /* auto */ +///* C*/ virtual void v_fun1(int); // = 005671E0 -------- /* auto */ +///* 10*/ virtual int v_fun2_wndmsg(DxAction *); // = 005BB760 /* auto */ +///* 14*/ virtual int v_fun3_mouse(DxAction *); // = 005BB660 /* auto */ +///* 18*/ virtual int v_fun4_keyboard(DxAction *); // = 005BB730 /* auto */ +// ------------------------------------------------------- /* auto */ +/*005BB660*/ DxAction *fun3_mouse(DxAction *); // ------- /* auto */ +/*005BB730*/ DxAction *fun4(DxAction *); // ------------- /* auto */ +/*005BB760*/ int fun2_wndmsg(DxAction *); // ------------ /* auto */ +/*005BB790*/ MyComEx *deleting_destructor(char); // ----- /* auto */ +/*005BB7B0*/ int destructor(); // ----------------------- /* auto */ +/*005DA2D0*/ int setChild(MyComEx *); // ---------------- /* auto */ +// ------------------------------------------------------- /* auto */ + }; // --------------------------------------------------- /* auto */ + static_assert(sizeof(MyComEx) == 0xC); // --------------- /* auto */ + struct ControlKeysUpdater : MyComEx { // ---------------- /* auto */ +// ------------------------------------------------------- /* auto */ +// ------------------------------------------------------- /* auto */ +/*---*/ ControlKeysUpdater() = delete; // --------------- /* auto */ +/*---*/ ~ControlKeysUpdater() = delete; // -------------- /* auto */ +/*---*/ // super MySharedObj ---------------------------- /* auto */ +/* 0*/ // virtual int v_release(); // = 0062FC10 ------ /* auto */ +/* 4*/ // virtual int v_addRef(); // = 0062FC00 ------- /* auto */ +/* 8*/ // virtual MySharedObj *v_scalar_destructor(char); // = 005DCF40 /* auto */ +/*---*/ // super MyComEx -------------------------------- /* auto */ +/* C*/ // virtual void v_fun1(int); // = 005671E0 ----- /* auto */ +/* 10*/ // virtual int v_fun2_wndmsg(DxAction *); // = 005BB760 /* auto */ +/* 14*/ // virtual int v_fun3_mouse(DxAction *); // = 005BB660 /* auto */ +/* 18*/ // virtual int v_fun4_keyboard(DxAction *); // = 005DD010 /* auto */ +/*---*/ // ControlKeysUpdater --------------------------- /* auto */ +// ------------------------------------------------------- /* auto */ + }; // --------------------------------------------------- /* auto */ + + ControlKeysUpdater **MyInputManagerCb_instance_f5C_controlKeys = (ControlKeysUpdater **) (0x0079CF90 + 0x60); + uint8_t **MyInputManagerCb_instance_f60_mouse = (uint8_t **) (0x0079CF90 + 0x64); + void **g_pWorld = (void **) 0x006E5050; + typedef void (__fastcall *MyMouse_updatePos_t)(void *); + MyMouse_updatePos_t MyMouse_updatePos = (MyMouse_updatePos_t) 0x005DD630; + +#pragma pack(pop) +} +namespace { + std::vector rgbActionsInProgress; + std::vector xyzActionsInProgress; +} + +// x=0 y=4 z=8 +void move_mouse(DWORD offs, DWORD value) { + auto *updater = *dk2::MyInputManagerCb_instance_f5C_controlKeys; + +// MouseXyzDxAction *action = this->listXYZ.getOrCreateUnhandled(); + auto *action = (dk2::MouseXyzDxAction *) new char[sizeof(dk2::MouseXyzDxAction)]; + *(void **) action = (void *) 0x00672900; + xyzActionsInProgress.push_back(action); + + action->value = value; // relative or absolute motion + action->actedAxe = offs; + action->timestamp = GetTickCount(); + action->isNotHandled = 1; + typedef void (__fastcall *MyComEx_fun3_t)(void *this_, void *edx, void *a2); + (*(MyComEx_fun3_t *) (updater->vftable + 0x14))(updater, NULL, action); +} + +void click_mouse(DWORD dik_scancode, DWORD flags) { + auto *updater = *dk2::MyInputManagerCb_instance_f5C_controlKeys; + // do not try to call constructor/destructor + auto *action = (dk2::MouseRgbDxAction *) new char[sizeof(dk2::MouseRgbDxAction)]; + *(void **) action = (void *) 0x006728F8; + rgbActionsInProgress.push_back(action); + +// action.f10_KeyCode_F0toF3 = click_dinput_to_dk2(dinput_dwOffs); + action->KeyCode_F0toF3 = dik_scancode; + action->btnPressFlags = flags; + action->pos.x = 0; + action->pos.y = 0; + // action->f1C_data = LOBYTE(DIDEVICEOBJECTDATA.dwData) + action->data = flags & DK2_IsPressed ? 0x80 : 0x00; + action->timestamp = GetTickCount(); + action->isNotHandled = 1; + typedef void (__fastcall *MyComEx_fun3_t)(void *this_, void *edx, void *a2); + (*(MyComEx_fun3_t *) (updater->vftable + 0x18))(updater, NULL, action); +} + +namespace { + DWORD controlFlags = 0; + dk2::Pos2i clientSize; + POINT lastPos = {0, 0}; + + RECT safeArea; + POINT clientResetPos; +} + +void handle_fpv_mouse_move(HWND hWnd, POINT pos) { + // update safe area + RECT clientRect; + GetClientRect(hWnd, &clientRect); + + safeArea = clientRect; + safeArea.left += (clientRect.right - clientRect.left) / 3; + safeArea.top += (clientRect.bottom - clientRect.top) / 3; + safeArea.right -= (clientRect.right - clientRect.left) / 3; + safeArea.bottom -= (clientRect.bottom - clientRect.top) / 3; + + // update reset pos + clientResetPos.x = (clientRect.left + clientRect.right) / 2; + clientResetPos.y = (clientRect.top + clientRect.bottom) / 2; + +// float sensitivity = dk2::MyResources_instance.playerCfg.mouseSensitivity / 10.0; + float sensitivity = 1; + if(pos.x != lastPos.x) { +// 28 float f24_flX_delta; // ------------------------- /* auto */ + *((float *) (*dk2::MyInputManagerCb_instance_f60_mouse + 0x28)) = (float) (pos.x - lastPos.x) * sensitivity; + lastPos.x = pos.x; + } + if(pos.y != lastPos.y) { +// 2C float f28_flY_delta; // ------------------------- /* auto */ + *((float *) (*dk2::MyInputManagerCb_instance_f60_mouse + 0x2C)) = (float) (pos.y - lastPos.y) * sensitivity; + lastPos.y = pos.y; + } + + if(!PtInRect(&safeArea, pos)) { + lastPos = clientResetPos; + POINT screenResetPos = clientResetPos; + ClientToScreen(hWnd, &screenResetPos); + SetCursorPos(screenResetPos.x, screenResetPos.y); +// printf("move to center cur=%d,%d client=%d,%d,%d,%d reset=%d,%d safe=%d,%d,%d,%d screen=%d,%d\n", +// pos.x, pos.y, +// clientRect.left, clientRect.top, +// clientRect.right, clientRect.bottom, +// clientResetPos.x, clientResetPos.y, +// safeArea.left, safeArea.top, +// safeArea.right, safeArea.bottom, +// screenResetPos.x, screenResetPos.y +// ); + } +} + +void dev_mouse_dinput_to_user32::handle_mouse_move(HWND hWnd, POINT pos) { + // handle gui mouse +// 34 AABB f30_aabb; // ------------------------------- /* auto */ + dk2::AABB renderRect = *((dk2::AABB *) (*dk2::MyInputManagerCb_instance_f60_mouse + 0x34)); + dk2::Pos2i renderSize = {renderRect.maxX - renderRect.minX, renderRect.maxY - renderRect.minY}; + POINT renderPos = { + (int) ((float) pos.x * (float) renderSize.x / (float) clientSize.x), + (int) ((float) pos.y * (float) renderSize.y / (float) clientSize.y) + }; + +/* 20*/ float f1C_flX; // ------------------------------- /* auto */ + *((float *) (*dk2::MyInputManagerCb_instance_f60_mouse + 0x20)) = renderPos.x; +/* 24*/ float f20_flY; // ------------------------------- /* auto */ + *((float *) (*dk2::MyInputManagerCb_instance_f60_mouse + 0x24)) = renderPos.y; + dk2::MyMouse_updatePos(*dk2::MyInputManagerCb_instance_f60_mouse); + + // handle first person view mouse + if(*dk2::g_pWorld != NULL) { +// if(dk2::CPlayer *pl = (dk2::CPlayer *) dk2::sceneObjects[dk2::g_pWorld->v_getMEPlayerTagId()]) { +// if(pl->creaturePossessed != 0 && !dk2::CDefaultPlayerInterface_instance.inMenu) { +// // keep mouse in the center of window +// handle_fpv_mouse_move(hWnd, pos); +// } +// } + } +} +void dev_mouse_dinput_to_user32::emulate_dinput_from_user32(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { + if(!enabled) return; + switch (Msg) { + case WM_SIZE: { + clientSize = {LOWORD(lParam), HIWORD(lParam)}; + break; + } + case WM_MOUSEMOVE: { + POINT mousePos = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; + handle_mouse_move(hWnd, mousePos); + break; + } + case WM_LBUTTONDOWN: + click_mouse(DIK_DK2_LEFTMOUSE, DK2_IsPressed | controlFlags); + break; + case WM_LBUTTONUP: + click_mouse(DIK_DK2_LEFTMOUSE, 0 | controlFlags); + break; + case WM_LBUTTONDBLCLK: + click_mouse(DIK_DK2_LEFTMOUSE, DK2_IsDblClick | controlFlags); + break; + case WM_RBUTTONDOWN: + click_mouse(DIK_DK2_RIGHTMOUSE, DK2_IsPressed | controlFlags); + break; + case WM_RBUTTONUP: + click_mouse(DIK_DK2_RIGHTMOUSE, 0 | controlFlags); + break; + case WM_RBUTTONDBLCLK: + click_mouse(DIK_DK2_RIGHTMOUSE, DK2_IsDblClick | controlFlags); + break; + case WM_MBUTTONDOWN: + click_mouse(DIK_DK2_MIDDLEMOUSE, DK2_IsPressed | controlFlags); + break; + case WM_MBUTTONUP: + click_mouse(DIK_DK2_MIDDLEMOUSE, 0 | controlFlags); + break; + case WM_MBUTTONDBLCLK: + click_mouse(DIK_DK2_MIDDLEMOUSE, DK2_IsDblClick | controlFlags); + break; + case WM_XBUTTONDOWN: + click_mouse(DIK_DK2_UNKMOUSE, DK2_IsPressed | controlFlags); + break; + case WM_XBUTTONUP: + click_mouse(DIK_DK2_UNKMOUSE, 0 | controlFlags); + break; + case WM_XBUTTONDBLCLK: + click_mouse(DIK_DK2_UNKMOUSE, DK2_IsDblClick | controlFlags); + break; + case WM_KEYDOWN: { + switch (wParam) { + case VK_SHIFT: + controlFlags |= DK2_Shift; + case VK_CONTROL: + controlFlags |= DK2_Ctrl; + case VK_MENU: + controlFlags |= DK2_Alt; + } + break; + } + case WM_KEYUP: { + switch (wParam) { + case VK_SHIFT: + controlFlags &= ~DK2_Shift; + case VK_CONTROL: + controlFlags &= ~DK2_Ctrl; + case VK_MENU: + controlFlags &= ~DK2_Alt; + } + break; + } + } +} +void dev_mouse_dinput_to_user32::release_handled_dinput_actions() { + { + auto it = std::remove_if(rgbActionsInProgress.begin(), rgbActionsInProgress.end(), [](dk2::MouseRgbDxAction *action) { + if (action->isNotHandled) return false; + delete[] (char *) action; + return true; + }); + rgbActionsInProgress.erase(it, rgbActionsInProgress.end()); + } + + auto it = std::remove_if(xyzActionsInProgress.begin(), xyzActionsInProgress.end(), [](dk2::MouseXyzDxAction *action) { + if (action->isNotHandled) return false; + delete[] (char *) action; + return true; + }); + xyzActionsInProgress.erase(it, xyzActionsInProgress.end()); +} + +typedef LRESULT (__stdcall *CWindowTest_proc_t)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); +CWindowTest_proc_t CWindowTest_proc = (CWindowTest_proc_t) 0x00556650; +LRESULT __stdcall proxy_CWindowTest_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { + dev_mouse_dinput_to_user32::emulate_dinput_from_user32(hWnd, Msg, wParam, lParam); + dev_mouse_dinput_to_user32::release_handled_dinput_actions(); + return CWindowTest_proc(hWnd, Msg, wParam, lParam); +} +int *__fastcall replace_MyDxInputManagerCb_initMouse(void *this_, void *edx, int *pstatus) { + *pstatus = STATUS_SUCCESS; + return pstatus; +} + + +uintptr_t addr(uint32_t va); +void dev_mouse_dinput_to_user32::initialize() { + + { + auto xref = (dk2_version == 170 ? 0x005BB1F8 : 0); + auto pos = addr(xref + 1); + write_protect prot((void *) pos, sizeof(uintptr_t)); + *(DWORD *) pos = (uintptr_t) replace_MyDxInputManagerCb_initMouse - (pos + 4); + } + { + auto xref = (dk2_version == 170 ? 0x00555D34 : 0); + write_protect prot((void *) xref, sizeof(uintptr_t)); + *(DWORD *) xref = (uintptr_t) proxy_CWindowTest_proc; + } +} + diff --git a/tools/devhelper/dev_mouse_dinput_to_user32.h b/tools/devhelper/dev_mouse_dinput_to_user32.h new file mode 100644 index 0000000..92c66f3 --- /dev/null +++ b/tools/devhelper/dev_mouse_dinput_to_user32.h @@ -0,0 +1,22 @@ +// +// Created by DiaLight on 20.07.2024. +// + +#ifndef FLAME_DEV_MOUSE_DINPUT_TO_USER32_H +#define FLAME_DEV_MOUSE_DINPUT_TO_USER32_H + +#include + +namespace dev_mouse_dinput_to_user32 { + + extern bool enabled; + void emulate_dinput_from_user32(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); + void handle_mouse_move(HWND hWnd, POINT pos); + void release_handled_dinput_actions(); + + void initialize(); + +} + + +#endif //FLAME_REPLACE_MOUSE_DINPUT_TO_USER32_H diff --git a/tools/devhelper/dllmain.cpp b/tools/devhelper/dllmain.cpp index a1e9b3c..50cc19a 100644 --- a/tools/devhelper/dllmain.cpp +++ b/tools/devhelper/dllmain.cpp @@ -7,32 +7,14 @@ #include "mimicry.h" #include "console.h" #include "game_version.h" +#include "write_protect.h" +#include "dev_mouse_dinput_to_user32.h" #include #include #include #define dk2_virtual_base 0x00400000 -class write_protect { - void *ptr; - size_t size; - DWORD prot; -public: - explicit write_protect(void *ptr, size_t size = sizeof(uint32_t)) : ptr(ptr), size(size), prot(0) { - if(!VirtualProtect(ptr, size, PAGE_EXECUTE_READWRITE, &prot)) { - DWORD lastError = GetLastError(); - printf("[error]: VirtualProtect failed. code=%08X\n", lastError); - throw std::exception(); - } - } - ~write_protect() { - DWORD ignore; - if(!VirtualProtect(ptr, size, prot, &ignore)) { - DWORD lastError = GetLastError(); - printf("[error]: VirtualProtect back failed. code=%08X\n", lastError); - } - } -}; uintptr_t dk2_base = 0; uintptr_t addr(uint32_t va) { @@ -128,6 +110,8 @@ bool devhelper_initialize(void *devHelperBase) { *(DWORD *) pos = (uintptr_t) proxy_MyGame_prepareScreenEx - (pos + 4); } + dev_mouse_dinput_to_user32::initialize(); + return true; } diff --git a/tools/devhelper/write_protect.h b/tools/devhelper/write_protect.h new file mode 100644 index 0000000..30b112c --- /dev/null +++ b/tools/devhelper/write_protect.h @@ -0,0 +1,34 @@ +// +// Created by DiaLight on 29.09.2024. +// + +#ifndef FLAME_WRITE_PROTECT_H +#define FLAME_WRITE_PROTECT_H + +#include +#include +#include +#include + +class write_protect { + void *ptr; + size_t size; + DWORD prot; +public: + explicit write_protect(void *ptr, size_t size = sizeof(uint32_t)) : ptr(ptr), size(size), prot(0) { + if(!VirtualProtect(ptr, size, PAGE_EXECUTE_READWRITE, &prot)) { + DWORD lastError = GetLastError(); + printf("[error]: VirtualProtect failed. code=%08X\n", lastError); + throw std::exception(); + } + } + ~write_protect() { + DWORD ignore; + if(!VirtualProtect(ptr, size, prot, &ignore)) { + DWORD lastError = GetLastError(); + printf("[error]: VirtualProtect back failed. code=%08X\n", lastError); + } + } +}; + +#endif //FLAME_WRITE_PROTECT_H diff --git a/tools/genlib_dkii/main.cpp b/tools/genlib_dkii/main.cpp index 656b233..7d6405b 100644 --- a/tools/genlib_dkii/main.cpp +++ b/tools/genlib_dkii/main.cpp @@ -35,9 +35,15 @@ bool getGlobalsToReplace(const std::string &path, std::set &globalsToR if(line.empty()) continue; std::stringstream iss(line); - std::string rva; - if ( std::getline(iss, rva, ' ')) { - globalsToReplace.insert(std::stoul(rva, nullptr, 16)); + std::string rvaStr; + if ( std::getline(iss, rvaStr, ' ')) { + try { + uint32_t rva = std::stoul(rvaStr, nullptr, 16); + globalsToReplace.insert(rva); + } catch(std::invalid_argument &e) { + std::cout << "cant parse int \"" << rvaStr << "\"" << std::endl; + exit(-1); + } } else { std::cout << "failed" << std::endl; is.setstate(std::ios::failbit); diff --git a/tools/merge_dkii/my_pdb.py b/tools/merge_dkii/my_pdb.py index fc24a3d..7269523 100644 --- a/tools/merge_dkii/my_pdb.py +++ b/tools/merge_dkii/my_pdb.py @@ -274,7 +274,6 @@ def __init__(self, pdb, data: bytes): self.files.append(name) these.append(name) self.modules.append(these) - print(f'{stream.pos:08X} {file_info_end:08X}') stream.pos = file_info_end # "TSM - type server map" related somehow to the usage of /Zi and mspdbsrv.exe.