wyświetlanie info po podniesieniu itemów 4404 11

O temacie

Autor pawbuj

Zaczęty 3.05.2017 roku

Wyświetleń 4404

Odpowiedzi 11

pawbuj

pawbuj

Użytkownicy
posty1623
Propsy135
ProfesjaSkrypter
  • Użytkownicy
wita, czy ma ktoś może pomysł jak zrobic info po podniesieniu itemu z ziemi . rozumiem, że trzeba zrobic to hookiem.
 

Bogdan Zwei

Bogdan Zwei

Użytkownicy
Wulgarny skurwiel pierdolony.
posty1864
Propsy541
Profesjabrak
  • Użytkownicy
  • Wulgarny skurwiel pierdolony.
// ----- Item einsammeln -----
func void Hook_oCNpc__DoTakeVob() {
const int oCNpc__DoTakeVob = 7621056; //0x7449C0
//HookEngine(oCNpc__DoTakeVob, 6, "EVT_NPCTAKEVOB");
HookEngineF (oCNpc__DoTakeVob, 6, EVT_NpcTakeVob);
};

func void EVT_NpcTakeVob()
{
// ----- an den NPC und das item kommen -----
var c_npc slf; slf = MEM_PtrToInst(ECX); // der NPC, der das Item einsammelt
var C_ITEM itm; itm = MEM_PtrToInst(MEM_ReadInt(ESP + 4)); // Pointer auf das Item
// ----- an den NPC und das item kommen -----

// ----- stimmt das item? -----
if (!Hlp_IsValidItem (itm))
{
return;
};

if (Hlp_GetInstanceID(slf) == Hlp_GetInstanceID(hero))
{
PrintCol(ConcatStrings("Zdobyto ", itm.name), RGBA(255,255,255,255));
};
};

Ten kod był wysyłany na WoGu. PrintCol musisz zastąpić swoim printem. Po podniesieniu przedmiotu na ekranie wyświetli się "Zdobyto *nazwa przedmiotu*".
 
:ok: zachęca do dalszej pomocy. Nie zapominaj o tym!

Prywatne wiadomości typu "Ej, pomocy" kasuję od razu. Od tego jest forum, a nie PW.

To me, defeat in anything is merely temporary, and its punishment is but an urge for me to greater effort to achieve my goal. Defeat simply tells me that something is wrong in my doing; it is a path leading to success and truth.

In order to realize our true self we must be willing to live without being dependent upon the opinion of others.

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
Musisz mieć także adres do G1. O ile wiem do G1 nie ma sporządzonej listy adresów więc pozostaje cie użycie IDA.
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

pawbuj

pawbuj

Użytkownicy
posty1623
Propsy135
ProfesjaSkrypter
  • Użytkownicy
mega props , pozostaje tylko znalezienie właściwego adresu, ale chyba w skryptach CZ powinno być

mam te adresy od Lehony, szukał ich @Mark56



Post połączony: 2017-05-03, 18:38
Spoiler
/***********************************\
       ADRESSEN DER ENGINECALLS
\***********************************/
//========================================
// Talents Aivar field
//========================================
const int AIV_TALENT_INDEX = 49;
//========================================
// Alle (?) genutzen Engineadressen
//========================================
const int CGameManager__ApplySomeSettings           = 4351936; //
const int CGameManager__Read_Savegame               = 4361077; //
const int CloseHandle                               = 7712294; //
const int CreateFileA                               = 7712348; //
const int Cursor_Ptr                                = 8834220; // test
const int Cursor_sX                                 = 8611128; //test
const int Cursor_sY                                 = 8611132; //test
const int GetFileSize                               = 7712378; //
const int GetLastError                              = 7712444; //
const int oCGame__changeLevel                       = 6540640; //0x63CD60 Hook: Saves
const int oCGame__changeLevelEnd                    = 6542428; //0x63D45C Hook: Saves
const int oCGame__Render                            = 6544352; //Hook: FrameFunctions
const int oCGame__RenderX                           = 6544518; //
const int oCGame__UpdateStatus                      = 6526632; //Hook: Focusnames
const int oCItem__Render                            = 6762352; //
const int oCNpc__CloseInventory                     = 7058164; // Hook: Quickslots
//const int oCNpc__DropUnconscious                    = 7560880; //0x735EB0 Hook: Shields*/
const int oCNpc__Equip                              = 6908144; //
//const int oCNpc__EquipItem                          = 7545792; //0x7323C0 Hook: Shields
const int oCNpc__EquipWeapon                        = 6908960;
//const int oCNpc__EV_DrawWeapon                      = 7654416; //0x74CC10 Hook: Shields
//const int oCNpc__EV_DrawWeapon1                     = 7656160; //0x74D2E0 Hook: Shields
const int oCNpc__EV_PlayAni                         = 7020080; // Hook: AI_Function
//const int oCNpc__EV_RemoveWeapon                    = 7658272; //0x74DB20 Hook: Shields
//const int oCNpc__EV_RemoveWeapon1                   = 7660720; //0x74E4B0 Hook: Shields*/
const int oCNpc__OpenInventory                      = 7057568; //0x6BB0A0 Hook: Quickslots | Hook:Inv
const int oCNpc__OpenInventory2                    = 7057813; // 6BB195
const int oCNpc__PutInSlot                          = 6969664; //0x6A5940 - ported
const int oCNpc__RemoveFromSlot                     = 7643760; //0x74A270
const int oCNpc__UnequipItem                        = 6880192; // Hook: Shields
//const int oCNpc__UseItem                            = 7584784; //0x73BC10
const int oCNpc__StartDialogAniX                    = 7021070; //
const int oCNpc__StartDialogAniY                    = 7021077; //
const int oCSavegameManager__SetAndWriteSavegame    = 4414389; // Hook: Saves
const int oCSavegameManager__SetAndWriteSavegame_bp_offset = 60;
const int parser                                    = ContentParserAddress; //
const int ReadFile                                  = 7905244; //
const int screen                                    = 9298364; //0x8DE1BC
const int sysGetTimePtr                             = 5204320; //
const int WriteFile                                 = 7712354; //
const int zCAICamera_StartDialogCam                 = 4889792; //
const int zCAICamera__current                       = 8823248; //
const int zCAICamera__StartDialogCam                = 4889792; //

const int zCFontMan__GetFont                        = 7205408; //
const int zCFontMan__Load                           = 7204928; //
const int zCFont__GetFontName                       = 7209408; //
const int zCFont__GetFontX                          = 7209488; //
const int zCFont__GetFontY                          = 7209472; //
const int zCViewText_vtbl                           = 8251988; //
const int zCInput_zinput                            = 8834208;
const int zCInput_Win32__SetDeviceEnabled           = 5015312;
/*const int zCInput_Win32__GetMouseButtonPressedLeft  = 5068688; //0x4D5790
const int zCInput_Win32__GetMouseButtonPressedMid   = 5068704; //0x4D57A0
const int zCInput_Win32__GetMouseButtonPressedRight = 5068720; //0x4D57B0
const int zCInput_Win32__GetMousePos                = 5068592; //0x4D5730*/
const int zCParser__CreateInstance                  = 7248864; //
//const int zCParser__CreatePrototype                 = 7942288; //0x793090
const int zCParser__DoStack                         = 7243264; //
const int zCRenderer__DrawTile                      = 5958208; //
const int zCTexture__Load                           = 6064880; //
const int zCView__@zCView                           = 7322848; //
const int zCView__Close                             = 7328400; //
const int zCView__InsertBack                        = 7325248; //
const int zCView__Move                              = 7330624; //
const int zCView__Open                              = 7327856; //
const int zCView__Render                            = 7349744; //
const int zCView__SetFontColor                      = 7339392; //
const int zCView__SetSize                           = 7330816; //
const int zCView__zCView                            = 7322656; //
const int zCView_Top                                = 7326736; //0x6FCC10
const int zCWorld__zCWorld                          = 6235152; //
const int zFontMan                                  = 9291548; //
const int zParser__CallFunc                         = 7247504; //
const int zrenderer_adr                             = 9199312; //
const int zRND_D3D__DrawLine                        = 7432960; //
const int zRND_D3D__DrawPolySimple                  = 7422960; //
const int zRND_D3D__EndFrame                        = 7434576; // Hook: Sprite
const int zRND_D3D__SetAlphaBlendFunc               = 7446336; //
const int zCRnd_D3D__XD3D_SetRenderState            = 7439808; //
const int zRND_D3D_TexMemory_offset                 = 1204;
const int zSinCosApprox                             = 6092704; //
const int T_DIALOGGESTURE_                          = 8686000;
const int _atan2f                                   = 7757480; //
const int _sinf                                     = 7757586; //
const int _acosf                                    = 7757470; //
const int menu_savegame_slot_offset                 = 3276;
const int sub_4D3D90_X                              = 5013392;
const int zCConsole__Register                       = 7875296; //0x782AE0
const int zCConsoleOutputOverwriteAddr              = 7142904; //0x6CFDF8 Hook: ConsoleCommands
const int zcon_address                              = 11221088; //0xAB3860
const int zCOption__ParmValue                       = 4586784; // 0X45FD20

// mark56 | not used
// inv
//const int _oCNpc__CloseDeadNpc                      = 7060128; // .text:006BBAA0
//const int _oCNpc__CloseSteal                        = 7059552; // .text:006BB860
//const int _oCNpc__CloseTradeContainer               = 6503824; // .text:00633D90
//const int _oCNpc__OpenDeadNpc                       = 7059600; // .text:006BB890
//const int _oCNpc__OpenSteal                         = 7058256; // .text:006BB350
//const int _oCNpc__OpenTradeContainer                = 6503392; // .text:00633BE0
//const int _oCNpc__DoDie                             = 6894752; // .text:006934A0

const int oCAniCtrl_Human_IsInWater                 = 6484544; // .text:0062F240
const int oCAniCtrl__Human_GetLayerAni              = 6451776; // .text:00627240
const int zCModelAni__GetAniID                      = 6427072; // .text:006211C0
const int zCModelAni__GetAniName                    = 5759840; // .text:0057E360
const int zCModel__GetAniIDFromAniName              = 4713552; // .text:0047EC50



//========================================
// Globale Flagvariable
//========================================
const int _LeGo_Flags = 0;

//========================================
// Namen einer Textur holen
//========================================
func string zCTexture_GetName(var int ptr) { // Eigentlich gar kein Engine-Call
    if(!ptr) { return ""; };
    var zCObject obj; obj = MEM_PtrToInst(ptr);
    return obj.objectName;
};

//========================================
// Pointer auf eine Textur holen
//========================================
func int zCTexture_Load(var string texture) {
    CALL_IntParam(1);
    CALL_zStringPtrParam(texture);
    CALL__cdecl(zCTexture__Load);
    return CALL_RetValAsInt();
};

//========================================
// FontManager holen
//========================================
func int zCFontMan_Load(var string font) {
    CALL_zStringPtrParam(font);
    CALL__Thiscall(MEM_ReadInt(zFontMan), zCFontMan__Load);
    return CALL_RetValAsInt();
};

//========================================
// Pointer auf eine Font holen
//========================================
func int Print_GetFontPtr(var string font) {
    var int i; i = zCFontMan_Load(font);
    CALL_IntParam(i);
    CALL__Thiscall(MEM_ReadInt(zFontMan), zCFontMan__GetFont);
    return CALL_RetValAsInt();
};

//========================================
// Namen einer Font holen
//========================================
func string Print_GetFontName(var int fontPtr) {
    CALL_RetValIszString();
    CALL__Thiscall(fontPtr, zCFont__GetFontName);
    return CALL_RetValAszString();
};

//========================================
// Breite eines Strings holen
//========================================
func int Print_GetStringWidthPtr(var string s, var int font) {
    CALL_zStringPtrParam(s);
    CALL__Thiscall(font, zCFont__GetFontX);
    return CALL_RetValAsInt();
};
func int Print_GetStringWidth(var string s, var string font) {
    return Print_GetStringWidthPtr(s, Print_GetFontPtr(font));
};

//========================================
// Höhe einer Font holen
//========================================
func int Print_GetFontHeight(var string font) {
    var int adr; adr = Print_GetFontPtr(font);
    CALL__thiscall(adr, zCFont__GetFontY);
    return CALL_RetValAsInt();
};

//========================================
// Beliebigen Waypoint holen
//========================================
func int MEM_GetAnyWPPtr() {
    var zCWaynet wayNet; wayNet = MEM_PtrToInst(MEM_World.wayNet);
    return MEM_ReadInt(wayNet.wplist_next+4);
};

func string MEM_GetAnyWP() {
    var zCWaypoint wp; wp = _^(MEM_GetAnyWPPtr());
    return wp.name;
};

//========================================
// Item an Koordinaten einfügen
//========================================
func void MEM_InsertItem(var c_item itm, var int fX, var int fY, var int fZ) {
    var zCWaynet wayNet; wayNet = MEM_PtrToInst(MEM_World.wayNet);
    var zCWaypoint wp; wp = MEM_PtrToInst(MEM_ReadInt(wayNet.wplist_next+4));
    var int x; x = wp.pos[0];
    var int y; y = wp.pos[1];
    var int z; z = wp.pos[2];
    wp.pos[0] = fX;
    wp.pos[1] = fY;
    wp.pos[2] = fZ;
    Wld_InsertItem(Hlp_GetInstanceID(itm), wp.name);
    wp.pos[0] = x;
    wp.pos[1] = y;
    wp.pos[2] = z;
};

//========================================
// Vob an Npc hängen
//========================================
func int oCNpc_PutInSlot(var c_npc slf, var string SlotName, var int oCVobPtr, var int SlotID) {
    CALL_IntParam(SlotID);
    CALL_PtrParam(oCVobPtr);
    CALL_zStringPtrParam(SlotName);
    CALL__thiscall(MEM_InstToPtr(slf), oCNpc__PutInSlot);
    return CALL_RetValAsInt();
};

//========================================
// Vob von Npc entfernen
//========================================
func void oCNpc_RemoveFromSlot(var c_npc slf, var string SlotName, var int retVal, var int SlotID) {
    CALL_IntParam(SlotID);
    CALL_IntParam(retVal);
    CALL_zStringPtrParam(SlotName);
    CALL__thiscall(MEM_InstToPtr(slf), oCNpc__RemoveFromSlot);
};

//========================================
// Item ablegen
//========================================
func void oCNpc_UnequipItem(var c_npc slf, var int oCItemPtr) {
    CALL_PtrParam(oCItemPtr);
    CALL__thiscall(MEM_InstToPtr(slf), oCNpc__UnequipItem);
};

//========================================
// Ein Item auf einem View rendern
//========================================
func void oCItem_Render(var int itm, var int wld, var int view, var int rot) {
    var zCView v; v = _^(view);
    if(v.vposy < 0||(v.vposy+v.vsizey) > 8192) { return; };
    if(v.vposy < 0||(v.vposy+v.vsizey) > 8192) { return; };
    CALL_FloatParam(rot);
    CALL_PtrParam(view);
    CALL_PtrParam(wld);
    CALL__thiscall(itm, oCItem__Render);
};

//========================================
// <funktioniert nicht?>
//========================================
func void zCRenderer_DrawTile(var int this,
                              var int tex,
                              var int vec0x, var int vec0y,
                              var int vec1x, var int vec1y,
                              var int flt,
                              var int vec2x, var int vec2y,
                              var int vec3x, var int vec3y,
                              var int color) {
    const int vec = 0;
    if(!vec) {
        vec = MEM_Alloc(8);
    };
    CALL_IntParam(color);
    CALL_PtrParam(vec);
    CALL_PtrParam(vec);
    CALL_FloatParam(flt);
    CALL_PtrParam(vec);
    MEM_WriteInt(vec+0, vec0x);
    MEM_WriteInt(vec+4, vec0y);
    CALL_PtrParam(vec);
    CALL_PtrParam(tex);
    CALL__thiscall(this, zCRenderer__DrawTile);
};

//========================================
// Beliebiges Item anlegen
//========================================
func void oCNpc_Equip(var int npcPtr, var int itmPtr) {
    CALL_PtrParam(itmPtr);
    CALL__thiscall(npcPtr, oCNpc__Equip);
};

//========================================
// Aktuelle Instanz bearbeiten
//========================================
func void MEM_SetUseInstance(var int ptr) {
    MemoryProtectionOverride(9298296, 10);
    MEM_WriteInt(9298296, ptr);
    MEM_WriteInt(9298300, MEM_ReadInt(ptr+28));
};

func int MEM_GetUseInstance() {
    return MEM_ReadInt(9298296);
};
 

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
Nie widziałem tego w tamtym pliku. Dla G1 ten adres wygląda tak
oCNpc::DoTakeVob(zCVob *) 006A0D10
Nie wiem jaki jest Hook_Len, ponieważ nie umiem go odczytać z IDA ;/
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

Lehona

Lehona

Użytkownicy
posty196
Propsy190
  • Użytkownicy
mega props , pozostaje tylko znalezienie właściwego adresu, ale chyba w skryptach CZ powinno być

mam te adresy od Lehony, szukał ich @Mark56



Post połączony: 2017-05-03, 18:38
Spoiler
/***********************************\
       ADRESSEN DER ENGINECALLS
\***********************************/
//========================================
// Talents Aivar field
//========================================
const int AIV_TALENT_INDEX = 49;
//========================================
// Alle (?) genutzen Engineadressen
//========================================
const int CGameManager__ApplySomeSettings           = 4351936; //
const int CGameManager__Read_Savegame               = 4361077; //
const int CloseHandle                               = 7712294; //
const int CreateFileA                               = 7712348; //
const int Cursor_Ptr                                = 8834220; // test
const int Cursor_sX                                 = 8611128; //test
const int Cursor_sY                                 = 8611132; //test
const int GetFileSize                               = 7712378; //
const int GetLastError                              = 7712444; //
const int oCGame__changeLevel                       = 6540640; //0x63CD60 Hook: Saves
const int oCGame__changeLevelEnd                    = 6542428; //0x63D45C Hook: Saves
const int oCGame__Render                            = 6544352; //Hook: FrameFunctions
const int oCGame__RenderX                           = 6544518; //
const int oCGame__UpdateStatus                      = 6526632; //Hook: Focusnames
const int oCItem__Render                            = 6762352; //
const int oCNpc__CloseInventory                     = 7058164; // Hook: Quickslots
//const int oCNpc__DropUnconscious                    = 7560880; //0x735EB0 Hook: Shields*/
const int oCNpc__Equip                              = 6908144; //
//const int oCNpc__EquipItem                          = 7545792; //0x7323C0 Hook: Shields
const int oCNpc__EquipWeapon                        = 6908960;
//const int oCNpc__EV_DrawWeapon                      = 7654416; //0x74CC10 Hook: Shields
//const int oCNpc__EV_DrawWeapon1                     = 7656160; //0x74D2E0 Hook: Shields
const int oCNpc__EV_PlayAni                         = 7020080; // Hook: AI_Function
//const int oCNpc__EV_RemoveWeapon                    = 7658272; //0x74DB20 Hook: Shields
//const int oCNpc__EV_RemoveWeapon1                   = 7660720; //0x74E4B0 Hook: Shields*/
const int oCNpc__OpenInventory                      = 7057568; //0x6BB0A0 Hook: Quickslots | Hook:Inv
const int oCNpc__OpenInventory2                    = 7057813; // 6BB195
const int oCNpc__PutInSlot                          = 6969664; //0x6A5940 - ported
const int oCNpc__RemoveFromSlot                     = 7643760; //0x74A270
const int oCNpc__UnequipItem                        = 6880192; // Hook: Shields
//const int oCNpc__UseItem                            = 7584784; //0x73BC10
const int oCNpc__StartDialogAniX                    = 7021070; //
const int oCNpc__StartDialogAniY                    = 7021077; //
const int oCSavegameManager__SetAndWriteSavegame    = 4414389; // Hook: Saves
const int oCSavegameManager__SetAndWriteSavegame_bp_offset = 60;
const int parser                                    = ContentParserAddress; //
const int ReadFile                                  = 7905244; //
const int screen                                    = 9298364; //0x8DE1BC
const int sysGetTimePtr                             = 5204320; //
const int WriteFile                                 = 7712354; //
const int zCAICamera_StartDialogCam                 = 4889792; //
const int zCAICamera__current                       = 8823248; //
const int zCAICamera__StartDialogCam                = 4889792; //

const int zCFontMan__GetFont                        = 7205408; //
const int zCFontMan__Load                           = 7204928; //
const int zCFont__GetFontName                       = 7209408; //
const int zCFont__GetFontX                          = 7209488; //
const int zCFont__GetFontY                          = 7209472; //
const int zCViewText_vtbl                           = 8251988; //
const int zCInput_zinput                            = 8834208;
const int zCInput_Win32__SetDeviceEnabled           = 5015312;
/*const int zCInput_Win32__GetMouseButtonPressedLeft  = 5068688; //0x4D5790
const int zCInput_Win32__GetMouseButtonPressedMid   = 5068704; //0x4D57A0
const int zCInput_Win32__GetMouseButtonPressedRight = 5068720; //0x4D57B0
const int zCInput_Win32__GetMousePos                = 5068592; //0x4D5730*/
const int zCParser__CreateInstance                  = 7248864; //
//const int zCParser__CreatePrototype                 = 7942288; //0x793090
const int zCParser__DoStack                         = 7243264; //
const int zCRenderer__DrawTile                      = 5958208; //
const int zCTexture__Load                           = 6064880; //
const int zCView__@zCView                           = 7322848; //
const int zCView__Close                             = 7328400; //
const int zCView__InsertBack                        = 7325248; //
const int zCView__Move                              = 7330624; //
const int zCView__Open                              = 7327856; //
const int zCView__Render                            = 7349744; //
const int zCView__SetFontColor                      = 7339392; //
const int zCView__SetSize                           = 7330816; //
const int zCView__zCView                            = 7322656; //
const int zCView_Top                                = 7326736; //0x6FCC10
const int zCWorld__zCWorld                          = 6235152; //
const int zFontMan                                  = 9291548; //
const int zParser__CallFunc                         = 7247504; //
const int zrenderer_adr                             = 9199312; //
const int zRND_D3D__DrawLine                        = 7432960; //
const int zRND_D3D__DrawPolySimple                  = 7422960; //
const int zRND_D3D__EndFrame                        = 7434576; // Hook: Sprite
const int zRND_D3D__SetAlphaBlendFunc               = 7446336; //
const int zCRnd_D3D__XD3D_SetRenderState            = 7439808; //
const int zRND_D3D_TexMemory_offset                 = 1204;
const int zSinCosApprox                             = 6092704; //
const int T_DIALOGGESTURE_                          = 8686000;
const int _atan2f                                   = 7757480; //
const int _sinf                                     = 7757586; //
const int _acosf                                    = 7757470; //
const int menu_savegame_slot_offset                 = 3276;
const int sub_4D3D90_X                              = 5013392;
const int zCConsole__Register                       = 7875296; //0x782AE0
const int zCConsoleOutputOverwriteAddr              = 7142904; //0x6CFDF8 Hook: ConsoleCommands
const int zcon_address                              = 11221088; //0xAB3860
const int zCOption__ParmValue                       = 4586784; // 0X45FD20

// mark56 | not used
// inv
//const int _oCNpc__CloseDeadNpc                      = 7060128; // .text:006BBAA0
//const int _oCNpc__CloseSteal                        = 7059552; // .text:006BB860
//const int _oCNpc__CloseTradeContainer               = 6503824; // .text:00633D90
//const int _oCNpc__OpenDeadNpc                       = 7059600; // .text:006BB890
//const int _oCNpc__OpenSteal                         = 7058256; // .text:006BB350
//const int _oCNpc__OpenTradeContainer                = 6503392; // .text:00633BE0
//const int _oCNpc__DoDie                             = 6894752; // .text:006934A0

const int oCAniCtrl_Human_IsInWater                 = 6484544; // .text:0062F240
const int oCAniCtrl__Human_GetLayerAni              = 6451776; // .text:00627240
const int zCModelAni__GetAniID                      = 6427072; // .text:006211C0
const int zCModelAni__GetAniName                    = 5759840; // .text:0057E360
const int zCModel__GetAniIDFromAniName              = 4713552; // .text:0047EC50



//========================================
// Globale Flagvariable
//========================================
const int _LeGo_Flags = 0;

//========================================
// Namen einer Textur holen
//========================================
func string zCTexture_GetName(var int ptr) { // Eigentlich gar kein Engine-Call
    if(!ptr) { return ""; };
    var zCObject obj; obj = MEM_PtrToInst(ptr);
    return obj.objectName;
};

//========================================
// Pointer auf eine Textur holen
//========================================
func int zCTexture_Load(var string texture) {
    CALL_IntParam(1);
    CALL_zStringPtrParam(texture);
    CALL__cdecl(zCTexture__Load);
    return CALL_RetValAsInt();
};

//========================================
// FontManager holen
//========================================
func int zCFontMan_Load(var string font) {
    CALL_zStringPtrParam(font);
    CALL__Thiscall(MEM_ReadInt(zFontMan), zCFontMan__Load);
    return CALL_RetValAsInt();
};

//========================================
// Pointer auf eine Font holen
//========================================
func int Print_GetFontPtr(var string font) {
    var int i; i = zCFontMan_Load(font);
    CALL_IntParam(i);
    CALL__Thiscall(MEM_ReadInt(zFontMan), zCFontMan__GetFont);
    return CALL_RetValAsInt();
};

//========================================
// Namen einer Font holen
//========================================
func string Print_GetFontName(var int fontPtr) {
    CALL_RetValIszString();
    CALL__Thiscall(fontPtr, zCFont__GetFontName);
    return CALL_RetValAszString();
};

//========================================
// Breite eines Strings holen
//========================================
func int Print_GetStringWidthPtr(var string s, var int font) {
    CALL_zStringPtrParam(s);
    CALL__Thiscall(font, zCFont__GetFontX);
    return CALL_RetValAsInt();
};
func int Print_GetStringWidth(var string s, var string font) {
    return Print_GetStringWidthPtr(s, Print_GetFontPtr(font));
};

//========================================
// Höhe einer Font holen
//========================================
func int Print_GetFontHeight(var string font) {
    var int adr; adr = Print_GetFontPtr(font);
    CALL__thiscall(adr, zCFont__GetFontY);
    return CALL_RetValAsInt();
};

//========================================
// Beliebigen Waypoint holen
//========================================
func int MEM_GetAnyWPPtr() {
    var zCWaynet wayNet; wayNet = MEM_PtrToInst(MEM_World.wayNet);
    return MEM_ReadInt(wayNet.wplist_next+4);
};

func string MEM_GetAnyWP() {
    var zCWaypoint wp; wp = _^(MEM_GetAnyWPPtr());
    return wp.name;
};

//========================================
// Item an Koordinaten einfügen
//========================================
func void MEM_InsertItem(var c_item itm, var int fX, var int fY, var int fZ) {
    var zCWaynet wayNet; wayNet = MEM_PtrToInst(MEM_World.wayNet);
    var zCWaypoint wp; wp = MEM_PtrToInst(MEM_ReadInt(wayNet.wplist_next+4));
    var int x; x = wp.pos[0];
    var int y; y = wp.pos[1];
    var int z; z = wp.pos[2];
    wp.pos[0] = fX;
    wp.pos[1] = fY;
    wp.pos[2] = fZ;
    Wld_InsertItem(Hlp_GetInstanceID(itm), wp.name);
    wp.pos[0] = x;
    wp.pos[1] = y;
    wp.pos[2] = z;
};

//========================================
// Vob an Npc hängen
//========================================
func int oCNpc_PutInSlot(var c_npc slf, var string SlotName, var int oCVobPtr, var int SlotID) {
    CALL_IntParam(SlotID);
    CALL_PtrParam(oCVobPtr);
    CALL_zStringPtrParam(SlotName);
    CALL__thiscall(MEM_InstToPtr(slf), oCNpc__PutInSlot);
    return CALL_RetValAsInt();
};

//========================================
// Vob von Npc entfernen
//========================================
func void oCNpc_RemoveFromSlot(var c_npc slf, var string SlotName, var int retVal, var int SlotID) {
    CALL_IntParam(SlotID);
    CALL_IntParam(retVal);
    CALL_zStringPtrParam(SlotName);
    CALL__thiscall(MEM_InstToPtr(slf), oCNpc__RemoveFromSlot);
};

//========================================
// Item ablegen
//========================================
func void oCNpc_UnequipItem(var c_npc slf, var int oCItemPtr) {
    CALL_PtrParam(oCItemPtr);
    CALL__thiscall(MEM_InstToPtr(slf), oCNpc__UnequipItem);
};

//========================================
// Ein Item auf einem View rendern
//========================================
func void oCItem_Render(var int itm, var int wld, var int view, var int rot) {
    var zCView v; v = _^(view);
    if(v.vposy < 0||(v.vposy+v.vsizey) > 8192) { return; };
    if(v.vposy < 0||(v.vposy+v.vsizey) > 8192) { return; };
    CALL_FloatParam(rot);
    CALL_PtrParam(view);
    CALL_PtrParam(wld);
    CALL__thiscall(itm, oCItem__Render);
};

//========================================
// <funktioniert nicht?>
//========================================
func void zCRenderer_DrawTile(var int this,
                              var int tex,
                              var int vec0x, var int vec0y,
                              var int vec1x, var int vec1y,
                              var int flt,
                              var int vec2x, var int vec2y,
                              var int vec3x, var int vec3y,
                              var int color) {
    const int vec = 0;
    if(!vec) {
        vec = MEM_Alloc(8);
    };
    CALL_IntParam(color);
    CALL_PtrParam(vec);
    CALL_PtrParam(vec);
    CALL_FloatParam(flt);
    CALL_PtrParam(vec);
    MEM_WriteInt(vec+0, vec0x);
    MEM_WriteInt(vec+4, vec0y);
    CALL_PtrParam(vec);
    CALL_PtrParam(tex);
    CALL__thiscall(this, zCRenderer__DrawTile);
};

//========================================
// Beliebiges Item anlegen
//========================================
func void oCNpc_Equip(var int npcPtr, var int itmPtr) {
    CALL_PtrParam(itmPtr);
    CALL__thiscall(npcPtr, oCNpc__Equip);
};

//========================================
// Aktuelle Instanz bearbeiten
//========================================
func void MEM_SetUseInstance(var int ptr) {
    MemoryProtectionOverride(9298296, 10);
    MEM_WriteInt(9298296, ptr);
    MEM_WriteInt(9298300, MEM_ReadInt(ptr+28));
};

func int MEM_GetUseInstance() {
    return MEM_ReadInt(9298296);
};

That's just the collection of all engine addresses LeGo uses, not all engine addresses available.
I don't have a Gothic 1 executable, so I can't help you.
 
Unless specified otherwise, my posts are always about Gothic 2 Night of the Raven.

pawbuj

pawbuj

Użytkownicy
posty1623
Propsy135
ProfesjaSkrypter
  • Użytkownicy
Nie widziałem tego w tamtym pliku. Dla G1 ten adres wygląda tak
oCNpc::DoTakeVob(zCVob *) 006A0D10
Nie wiem jaki jest Hook_Len, ponieważ nie umiem go odczytać z IDA ;/
Hook_len znajdę metoda prób i błędów. a ten adres jak się przelicza na dziesiętne?
 


Lehona

Lehona

Użytkownicy
posty196
Propsy190
  • Użytkownicy
The windows calculator does it as well. Open the calculator (via the start-menu or [Win]+R -> "calc"), press Alt+3 for the programmer view. Select "hexadecimal" on the left, input your number (copy&paste or typing), then select decimal. You can now copy the decimal value by pressing ctrl+c ;)
 
Unless specified otherwise, my posts are always about Gothic 2 Night of the Raven.

IceMan

IceMan

Użytkownicy
posty67
Profesjabrak
  • Użytkownicy
Czy ma ktoś może ten hook len do G1? 
 

Patrix9999

Patrix9999

Użytkownicy
posty127
Propsy38
Profesjabrak
  • Użytkownicy
HookLen możesz sprawdzić w jakimkolwiek disassemblerze np: Ghidra, IDA, lub nawet Cheat Engine.
Czym jest ten hook len?

Hooki byte patch wymagają 5 bajtów na spatchowanie danego miejsca w funkcji, które przekieruje nas do naszej funkcji (jmp + relative address).

Niestety, o ile 5 bajtów wystarczy na założenie hooka, o tyle niekoniecznie spowoduje to, że oryginalna funkcja będzie działać (może się okazać że spatchowaliśmy część jednej instrukcji, nie całą, co może spowodować problemy).

Jeśli dane OP code'y w ASM są dłuższe niż 5 bajtów (chodzi o początkowe instrukcje) np: mają długość 7, to taką długość trzeba dostarczyć funkcji Hook_Engine.

https://i.imgur.com/LQya8CI.jpg

Jak widać na screenie, hook len wynosi 6, wystarczy odjąć sobie końcowy adres o początkowego w kalkulatorze windowsa.
Taką długość ma ten op-code (tyle zajmuje bajtów w pamięci):

mov     eax, large fs:0

Polecam pokombinować na przyszłość samemu, bo łatwo będzie ci w ten sposób znaleźć hook len też do innych metod.
 

IceMan

IceMan

Użytkownicy
posty67
Profesjabrak
  • Użytkownicy
Dziękuje bardzo za wytłumaczenie i rozjaśnienie, skrypt działa :)
 


0 użytkowników i 1 Gość przegląda ten wątek.
0 użytkowników
Do góry