Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - xhumanoid

Pages: [1]
1
I suggest doing it incrementally. First write read_/write_raw that communicates with dfhack, then change the actual manipulations one by one.

Also, I suggested once to write df-structures using real C++ headers. Dunno what came of that, but I think it would make this easier (or not?).

most classes already exist in DT (Dwarf, Squad, Fortress), but they use read-write data in memory by offset with OS-specific implementations.

i want use protobuf as transport protocol, current state of Basic.proto and BasicApi.proto can fill more then 70% оf requirements for DT. But yes, I must do some work for extend this proto (or develop custom plugin for DFHack) for fulfill all requirements.

After that DT don't need know about what version of DF/DFHack running, because we don't now know anything about memory layout, structures and c++ headers.

Current main work it's replace directly work with memory on rpc calls.

after you fix one place and can display something, you must fix another place
(I use DF osx64, DT are not working for me and he simple crash on a try work with memory)
but mostly it's routine work for replacing read-write data one by one

2
2) I don't know about OSX, but on Linux you don't need root permission if you run DT as the parent of DF. But it is annoying as DT cannot be restarted without restarting DF at the same time.
On OSX you must access to attach to separate process for reading memory from them.
Attach possible in 2 cases:
1) you have admin permissions
2) your applications have right access. this means sign key from apple and correctly permissions

solution 2 not possible for us, as result DF always ask login/password on start.
fork, run separate privileged process, stop main process.
debug in this case very difficult

QPointer are not related to DF memory, VIRTADDR is used for holding pointers to DF memory. But, yes, it is tightly coupled, and I am not fond of this. But since you need to refactor everything anyway, you might as well try to do it properly.

Yes, I said incorrect.

1) support for new versions can be added fast enough thanks to the dfhack script for generating DT inis.

looks on this block:

Code: [Select]
[addresses]
fortress_entity=0x019865c4
historical_entities_vector=0x01b41280

[hist_entity_offsets]
histfigs=0x00a8
squads=0x0c60
positions=0x0930
assignments=0x0958
assign_hist_id=0x0004
assign_position_id=0x000c
position_id=0x001c
position_name=0x0068
position_female_name=0x00a0
position_male_name=0x00d8

in this example you have:

Code: [Select]
list<history_figures_ids> = fortress_entity + histfigs
list<squiad_ids> = fortress_entity + squads

list<positions_offsets> = historical_entities_vector + positions

real_position = positions_offsets[index] + position_id

why in one case we have fortress_entity as base address,
but in other case we must use historical_entities_vector
etc

all of this offsets live in one block

DFHack for all of this cases have generated data structures with correctly offsets
without any manual calculation in runtime
this less flexible but much more safe

for most people a try change something in DT it's like magic =)

3
Yes, it's replacement because current model of working DT very depend on direct work with memory.

Main benefits:
1) DFHack add support new version of memory layout more faster then DT
2) DT don't require admin/root permissions for work with DF

It not possible keep current state and simple add new backend,
all classes use QPointer and memory vector for direct read-write in memory
for support both backend in the same time we need for first will do big refactoring and cut working with memory in separate module
but for me it's unnecessary work which will gone in trash soon.

4
Clément, what do think about merge all changes in one repository?

I have some problem with running you branch on osx64 =)
as fix I started refactoring DT from memory patching to use DFHack as backend.

All communication over network in protobuf protocol.
I already implemented connection, load units, animals, basic information about world, etc.

My build it's pretty unstable now, but I think I can fix this problem soon.

Main benefit it's unification DT for work on all platforms without magic with Authorization and requirement admin permissions

Pages: [1]