matefkr
07-22-2007, 12:18 PM
I will share informations here and an EUD sample for 1.12b version (remove dt permacloak and something related to marine).
Basic info:
-sc stores data in the memory (imagine like a line of bytes)
-when sc start to run, it get a sized memory (virtual memory) from windows (i don't know mac system).
-There are two part of that memory: code and data memory (segment). While code memory is readable and executable (cpu can interpret numbers here as commands); data memory is writeable and readable.
-so sc store data about deaths in the data memory.
-The first dword (4 byte) in the deaths data memory section contains the number of deaths of marines suffured (maybe typo) by player 1. The memory address of the player1 marine deaths isn't the same in every sc version.
Let's say for example: 00560009h (h in the right side means that the number is in hexadecimal) is the address of player1 marine deaths. Note: there are 4 byte to store the deaths of a unit and you can only write/addres four byte with death triggers(every 4the byte from/with the begining of death table); but you can access bytes, as a part of a dword. So the next death data (player2 marine death) is on 0056000dh (00560009+4), and the next (player3 marine death) is on 00560011h and so on, till it reach player12?).
So how does the death trigger work?
The engine have the base address of death "table" (address of player1 marine deaths), it adds unitId*48 (you can get the id from datedit and such if you wanna check) + playerId * 4 (becouse every death use 4 bytes) [!playerId is 0 based so player1 = 0]. That will be the address. If it is the condition, the engine compare the 4 byte long number with the number given in a death trigger (the number of deaths). If it is the action, it will set the 4 byte long number in that addres, or it will add to or substract from the 4 byte long number in that address.
You only can reach memory after the death table (unit id and player id can be only positive value). And also, here is a major problem about EUD: you can't write every dword after the death table. After every eigth's dword, you can't acces 4 dword (so you can't write p9-p12 deaths).
So, if you set a higher value for the unitId then The higher unitId value in units.dat, you can address memory outside of the death table (becouse you have to give the unitId as a two byte number; max value 65535, but the highest unitId in units.dat is smaller than that).
What to do?
Get a memory viewer (ArtMoney, for example), run sc, push windows button, run memvviewer, attach/get/ something else process, pick sc from the list, then searche for value 0 (if 0 player1 marine died), then continue run sc, kill one marine of yours (if you are obviously the player 1), then push windows button again, then search for 1 in the last founds (sieve in artmoney), then continue sc, kill another marine, then interrupt again and search for 2 and so on, till you can found only one address. then you should change the value in that address, and make check.
Note: bytes on greater addresses, are byte on greater powers. So if you want to write down 4 byte (when you have one on the 1, one on the 2, one on the 3 and one on the 4 address) correctly as one 4 byte long number, you have to write it reverse, so write the last one (on greatest power) to left and the first one (lowest power) to right (i think you can figure out what i mean), becouse some memviewer write bytes from left to right (addresses increase from left to right).
Back to story: after changed the value of p1 marine address, go back to sc. You should create a map for that, which should have a trigger, which should continiously do something if p1 suffured exactly "some" deaths of marines.
With that, you shall find the base address of death table, and knowing that, you can interchange offsets to death trigger parameters (playerId, unitId).
BUT YOU DONT NEED THAT process, if you want to write eud trigs for 1.12b, just get ubecalc made by LegacyWeapon. It is a little messy but well usable. On the first screen you can see a combo-box. Pick 1.12b actions from the list and work with that (this is 1.12b addresses, not actions). You can change several things. If you want to calculate an inputed address, then substract 32 from that address before.
Here is the link: übecalc2 (http://clanunknown.net/euds/ubecalc2.php)
Also you can find a free memory block usable to store custom data from
006c4f00 to 006c5d00 (1.12b version). You can use that to save/load data between scenarios.
Note: EUD actions can only work below or with 1.12b version or in every version where EUD enabler works. Here (http://quickshare.ru/upload/3829/fff2.zip) is an 1.15.1 sc executable version but still only runs on podolsk (or other similar gateways).
EDIT:
EDIT.
Basic info:
-sc stores data in the memory (imagine like a line of bytes)
-when sc start to run, it get a sized memory (virtual memory) from windows (i don't know mac system).
-There are two part of that memory: code and data memory (segment). While code memory is readable and executable (cpu can interpret numbers here as commands); data memory is writeable and readable.
-so sc store data about deaths in the data memory.
-The first dword (4 byte) in the deaths data memory section contains the number of deaths of marines suffured (maybe typo) by player 1. The memory address of the player1 marine deaths isn't the same in every sc version.
Let's say for example: 00560009h (h in the right side means that the number is in hexadecimal) is the address of player1 marine deaths. Note: there are 4 byte to store the deaths of a unit and you can only write/addres four byte with death triggers(every 4the byte from/with the begining of death table); but you can access bytes, as a part of a dword. So the next death data (player2 marine death) is on 0056000dh (00560009+4), and the next (player3 marine death) is on 00560011h and so on, till it reach player12?).
So how does the death trigger work?
The engine have the base address of death "table" (address of player1 marine deaths), it adds unitId*48 (you can get the id from datedit and such if you wanna check) + playerId * 4 (becouse every death use 4 bytes) [!playerId is 0 based so player1 = 0]. That will be the address. If it is the condition, the engine compare the 4 byte long number with the number given in a death trigger (the number of deaths). If it is the action, it will set the 4 byte long number in that addres, or it will add to or substract from the 4 byte long number in that address.
You only can reach memory after the death table (unit id and player id can be only positive value). And also, here is a major problem about EUD: you can't write every dword after the death table. After every eigth's dword, you can't acces 4 dword (so you can't write p9-p12 deaths).
So, if you set a higher value for the unitId then The higher unitId value in units.dat, you can address memory outside of the death table (becouse you have to give the unitId as a two byte number; max value 65535, but the highest unitId in units.dat is smaller than that).
What to do?
Get a memory viewer (ArtMoney, for example), run sc, push windows button, run memvviewer, attach/get/ something else process, pick sc from the list, then searche for value 0 (if 0 player1 marine died), then continue run sc, kill one marine of yours (if you are obviously the player 1), then push windows button again, then search for 1 in the last founds (sieve in artmoney), then continue sc, kill another marine, then interrupt again and search for 2 and so on, till you can found only one address. then you should change the value in that address, and make check.
Note: bytes on greater addresses, are byte on greater powers. So if you want to write down 4 byte (when you have one on the 1, one on the 2, one on the 3 and one on the 4 address) correctly as one 4 byte long number, you have to write it reverse, so write the last one (on greatest power) to left and the first one (lowest power) to right (i think you can figure out what i mean), becouse some memviewer write bytes from left to right (addresses increase from left to right).
Back to story: after changed the value of p1 marine address, go back to sc. You should create a map for that, which should have a trigger, which should continiously do something if p1 suffured exactly "some" deaths of marines.
With that, you shall find the base address of death table, and knowing that, you can interchange offsets to death trigger parameters (playerId, unitId).
BUT YOU DONT NEED THAT process, if you want to write eud trigs for 1.12b, just get ubecalc made by LegacyWeapon. It is a little messy but well usable. On the first screen you can see a combo-box. Pick 1.12b actions from the list and work with that (this is 1.12b addresses, not actions). You can change several things. If you want to calculate an inputed address, then substract 32 from that address before.
Here is the link: übecalc2 (http://clanunknown.net/euds/ubecalc2.php)
Also you can find a free memory block usable to store custom data from
006c4f00 to 006c5d00 (1.12b version). You can use that to save/load data between scenarios.
Note: EUD actions can only work below or with 1.12b version or in every version where EUD enabler works. Here (http://quickshare.ru/upload/3829/fff2.zip) is an 1.15.1 sc executable version but still only runs on podolsk (or other similar gateways).
EDIT:
EDIT.