Pokaż wiadomości

Ta sekcja pozwala Ci zobaczyć wszystkie wiadomości wysłane przez tego użytkownika. Zwróć uwagę, że możesz widzieć tylko wiadomości wysłane w działach do których masz aktualnie dostęp.


Wiadomości - Lehona

Strony: [1] 2 3 ... 10
1
Skrypty / Limit aivarów
« dnia: 2018-08-17, 18:41 »
'Talents' does exactly what you need. The name is slightly misleading, as there are no reasons the saved values have to be used for any sort of talent. They can be used just like any other AIVar.

2
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-05-11, 22:10 »
A cString is just a (null-terminated) char*, there's no metadata attached.

3
Skrypty / wyświetlanie info po podniesieniu itemów
« dnia: 2017-05-04, 13:27 »
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 ;)

4
Skrypty / wyświetlanie info po podniesieniu itemów
« dnia: 2017-05-04, 13:18 »
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.

5
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-05-02, 14:17 »
You can not overload operators in Daedalus (mostly because the related code would be impossible to parse, i.e. the compiler would throw an error and abort.

You can, however, just create a function like zvec3_multiplyscalar(float). If you want to use the existing engine code (although scalar multiplication is really simple and you can just do it in Daedalus), just use it like any other function. Where's the problem? I'm sure you've done this before.

6
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-05-01, 19:28 »
Repeat does not work that way. The first argument is a counter variable (to count the number of repetitions). There should be no other expression than a single variable here (so 1+1 will not work, it would crash). Before the repeat-loop begins, the counter variable's value will be set to 0. Then the code within the loop will be executed X times, where X is the second parameter. The code to be repeated has to be closed with an end;-statement. It's easier to understand if you look at an example:

var int k; // counter variable
repeat(k, 10);
    print(inttostring(k));
end;
This will print 0-9.

7
Skrypty / Problem z dekompilacją gothic.dat
« dnia: 2017-05-01, 19:22 »
You could use DecDat, it can decompile every script: https://forum.worldofplayers.de/forum/threads/1151032-Tool-DecDat

It is, however, not very useful unless you want to look at some specific scripts.

8
Skrypty / Gothic 2 - licznik potworów w dzienniku
« dnia: 2017-04-25, 19:35 »
I'm pretty sure you can just delete the log entry and create a new one with updated values.

9
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-04-22, 23:45 »
Currently handles are not reused, i.e. the number will always grow and never shrink. You should be able to allocate up to 4 billion (10^9) handles before this becomes a problem, though. Even if you create 1000 handles per second (I don't think Gothic would be able to handle that), that's still ~277 hours of playtime.

Reusing handles would mean that Hlp_IsValidHandle() doesn't work reliably anymore (without doing something more sophisticated) and I don't think anyone will reach that amount of handles unless they deliberately try to.

If you're worried, then don't destroy (delete) them but reuse them yourself.

10
Skrypty / Zmienne HookEngine
« dnia: 2017-04-22, 12:09 »
EBP is the base-pointer. It points into the stack (similar to the ESP), but is not automatically changed by stack operations (such as push/pop). It usually points to the "base" of the stackframe of a function. What does this mean? I'm sure if you've coded in C++ you'll have come across of stack allocated local variables, e.g.:

void foo() {
myStruct bar; // This is allocated on the stack
}

If myStruct is 128 bytes big, internally what will hapen is usually just something like this:

sub esp, 80h // move the stack pointer down 128 <-> allocate 128 bytes on the stack

Thus EBP points to where the stack was before local variables were allocated.

ESI is the (extended) Source Index and can be used together with EDI, the (extended) Destination Index for so-called string-operations. They're used to do something to multiple bytes (i.e. byte-strings) with a single instruction.
If you don't want to use any string operations you can just use them however you like.

11
Skrypty / Zmienne HookEngine
« dnia: 2017-04-21, 22:30 »
x86 return values are not stack based (unlike Daedalus). Before returning, a function will just assign the return value to eax. Think of it like this:

...
eax = return_value;
return;

And to access the result, the calling function will just read eax, e.g.:
calculateSomething();
print(eax);

Thus, after GetSelectedItem() has finished, the oCItem* is stored in EAX.

12
Skrypty / Gothic II [LeGo] Listy
« dnia: 2017-04-21, 22:23 »
That won't compile (missing a _^()), but I literally just said that it's equivalent to List_Add(). Why write your own if List_Add() exists?

Your code is fine otherwise, but it's like 99% the same as List_Add().

13
Skrypty / Gothic II [LeGo] Listy
« dnia: 2017-04-20, 23:11 »
List_Add() should be equivalent to Push_Back. There's no such thing as Push_Front yet, but I just made one (untested):
func int List_AddFront(var int list, var int data) {
if(!list) {
        _List_ErrPtr("AddFront");
        return;
    };
    var zCList l; l = _^(list);
var int next; next = l.next;
   
l.next = create(zCList@);
var zCList ln; ln = _^(l.next);
ln.next = next;

ln.data = l.data;
l.data = data;
};

14
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-04-09, 01:51 »
You can search the symbol table. If INIT_Global was parsed, there will be a symbol with the name INIT_GLOBAL.

Although I don't quite understand what you want to do.

15
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-03-22, 17:23 »
That's exactly what MEM_FindParserSymbol(string) does. I'm not 100% sure whether you need to use all uppercase, though, maybe the engine does that on its own. You should probably do it anyway, just to be sure.

Edit: What splash wrote does something different than MEM_FindParserSymbol, but is a valid interpretation of your post... You should probably clarify. Splash's script assigns itm to the item that is currently pointed to by the instance, MEM_FindParserSymbol just returns the instance ID.

16
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-03-18, 14:24 »
@Siemek: I see. Maybe I can take a quick look at it myself next week and see what I can do.

Miałem nadzieję na jakąś angielską dokumentację, której nie byłem w stanie wygrzebać, ale chyba będę musiał sobie poradzić z pomocą tanslatorem i moim łamanym niemieckim. Dzięki.

I'm sure it will be no problem to help translate something if you have any questions, either on here or at WoG :)

17
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-03-15, 15:45 »
I see.

What is you code in post #885 supposed to do? Like, what view are you accessing or creating there? What's the function called / what are its parameters (because you apparently are reading one of them)?

You need to give us some more in terms of what you have tried so far and what the results are. Otherwise you're pretty much just asking "do this for me" and I don't want to do the same brunt work that you probably already did, too! It's much faster and easier if you share your findings.

18
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-03-14, 15:40 »
Chciałem zrobić render przedmiotów z ekwipunku na środku. Zhookowałem tą funkcję tak:
func void Render_Test()
{
var int vptr;
if(!Hlp_IsValidHandle(vptr))
{
vptr = View_Create(1000,1000,4000,4000);
};
MEM_WriteInt(ESP + 8, getptr(vptr));
};
HookEngineF(7420608,7,Render_Test);

Działa fajnie, ale jest jeden problem :/ Mianowicie wszystkie ikonki z ramek pojawiły się na tym środku >< Ramki są puste... O co chodzi i jak temu zaradzić?

Without any explanation it will be hard to help you.

Do you want items to be rendered into your own view (instead of the standard inventory stuff)?

19
Skrypty / Ikarus (Pakiet skryptów)
« dnia: 2017-03-02, 19:29 »
an converts a real pixel offset into a virtual pixel offset in the views dimensions. Virtual pixel offsets go from 0-8191 (or 8192). So if your view was 2 pixels wide, anx(1) would return 4096 (i.e. the mid point).

na does the reverse, so for a 2 pixels wide view, nax(4096) would return 1.

LeGo can do the same, although this is currently undocumented (as I just discovered).

zCView::anx(x) == Print_ToVirtual(x, view.psizex)
zCView::nay(y) == Print_ToPixel(y, view.psizey)

Although view.psizex should not be 0 or 1, because the LeGo functions will assume the real pixel height or width of the screen respectively in those cases.

20
Skrypty / Klasy silnika
« dnia: 2017-02-27, 18:50 »
oCItems have these attributes:

// inventory darstellungs geschichten, wird nur benutzt, falls von 0 abweichend
var int     inv_zbias; //  wie weit ist das item im inventory richtung far plane verschoben (integer scale 100=1)
var int inv_rotx; //  wieviel grad um die x achse ist das item im inv gedreht
var int inv_roty; //  wieviel grad um die y achse ist das item im inv gedreht
var int inv_rotz; //  wieviel grad um die z achse ist das item im inv gedreht
var int inv_animate; //  soll das item in inv rotiert werden

In particular inv_zbias, which is the distance to the camera.

Strony: [1] 2 3 ... 10
Do góry