|
|
Bersy
Honorable
Supreme Hero
|
posted March 29, 2012 10:36 PM |
|
|
Sound service function was hooked to allow additional SN: commands. By the way, some things appear for me easier to implement in my code with full power of Delphi language than staying in the limits of restricted embedded C++ and ZVS' style.
Try downloading the sources from WoG archive and searching in monsters.cpp maybe. Hard to predict.
|
|
Bersy
Honorable
Supreme Hero
|
posted March 30, 2012 11:56 AM |
|
|
1) Bug report MN:R error after pressing "End of turn".
http://wikisend.com/download/996158/sdlog.7z
2) External dwelling of halflings cannot be upgraded if Neutral town is on.
3) Weeks of monsters. Bonus is not displayed.
Also there was a preposition to include CTRL+click reaction not only on mithril objects, but also on artifacts, giving creatures and scouting bonuses.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted March 30, 2012 12:16 PM |
|
Edited by majaczek at 22:22, 30 Mar 2012.
|
I may check the sources, but separate from line which check if to apply Stack experience bonuses, what to seek? Function names? Variable names? Something Other? Because I believe that it wouldn't be easy for me to translate what i find to address....
Also I'm curious if access to wog sources (while working on binary file and hooks, like ERA) would enable *easy* method to free some hardcoded limits which were changed in wog itself (number of monsters, artifacts etc.), I'm curious because author of amethyst.dll put much of work into it and it still doesn't fully work.
Also is it planned to include more recievers/commands soon? Are some "hardcoded" changes to commanders planned? Also how to hook a function from era plugin (how to find what to hook and hook with what generally) ?
Speaking About commanders, I managed to have commanders enabled in prebattle (succubus, astral spirit specials work, commander parameter scanning too), postbattle (advancing commander levels and perhaps paladin, brute specials), out of battle (commander info per hero are kept), but not at begin of battle (so hero starts without real commander).
I also managed to summon monster commander at beggining of battle with same monster stats as real, with working stack experience. So i have to restore/replace secondary skills on commanders (via script, monster flags, or stack experience) and I almost have all functionality I wanted (commander specials which are battle-only doesn't seem to work).
EDIT: Commander magic resistance is golem type or dwarf type? I almost fully re-scripted commanders in battle, only one or two of secondary skills have to be reinterpreted. I also have to re-script specialities of hierophant and Ogre Leader, and find replacement for ones of shaman, Temple Guardian, and check if Brute spaciality works.
EDIT: i found that VR:X seems to be bugged as !!VRy1:S0 X4; !!VRy2:&y1; doesn't reset y1 bit properly
I had to use !!VRy2:&-5; for code to work; (i had to use constant)
|
|
Bersy
Honorable
Supreme Hero
|
posted March 30, 2012 11:21 PM |
|
|
Quote: I may check the sources, but separate from line which check if to apply Stack experience bonuses, what to seek? Function names? Variable names? Something Other? Because I believe that it wouldn't be easy for me to translate what i find to address....
Sorry, majaczek, but I know the same amount of information as you.
Quote: Also I'm curious if access to wog sources (while working on binary file and hooks, like ERA) would enable *easy* method to free some hardcoded limits which were changed in wog itself (number of monsters, artifacts etc.), I'm curious because author of amethyst.dll put much of work into it and it still doesn't fully work.
Nothing becomes easy: either with sources or without. Era is based on TE, it means wog T1 compiled in 2005. We cannot edit the sources and recompile. Such things would break all found addresses, Era and existing mods.
Quote: Also is it planned to include more recievers/commands soon? Are some "hardcoded" changes to commanders planned? Also how to hook a function from era plugin (how to find what to hook and hook with what generally) ?
No more development is planed for the closest future. I'm working on the concept of new language as the replacement for ERM in a role of script engine.
Quote: EDIT: Commander magic resistance is golem type or dwarf type?
Afair, dwarf-style, but need rechecking.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted March 31, 2012 02:02 AM |
|
|
@same amount of info
I don't ask for ready answer, my question is basically how to seach and what to search. So theoretically I ask for methodology of searching information, not information itself.
@Nothing become easy
well it theoretically it becomes easier. Also there is many common parts, so if someone has resources (basically time) to actually read the sources, it should remove the requirement of many dissassembling and assembler code analise, so basically it becomes vastly easier to find eg. Name of high level function to hook (but lucky person can find adresses much faster).
That's theory, but practically im totally uneducated in reverse engineering (and I want to train since this skill becomes much more common), currently my RE actions were limited to change gold value in game memory, without previously knowing the address.
Also links to practicall courses on RE is much appreciated.
@Anything other
I'm studying on the IT segment and I'm programming since I was 7, so I'm not another noob wanting to be cool, but I'm totally beginner at RE but I need something for start, and I'm not feeling good for selfeducation.
|
|
OxFEA
Promising
Famous Hero
feanor on DF2.ru
|
posted March 31, 2012 12:09 PM |
|
|
Quote: Afair, dwarf-style, but need rechecking.
Golem-type: resist some part of spell damage.
|
|
Bersy
Honorable
Supreme Hero
|
posted March 31, 2012 12:24 PM |
|
|
I would recommend you to read about x86 assembling (a bit out-of-date): http://www.skynet.ie/~darkstar/assembler/tut8.html
http://www.acm.uiuc.edu/sigwin/old/workshops/winasmtut.pdf
Then download masm32 assembler: http://www.masm32.com/
You can find "help" folder after installation with many chm/html files describing most parts of the language. The most interesting could be opcodes.chm where all basic commands are described.
After that you could try OllyDebugger: http://www.ollydbg.de/
Here are some crack tutorials using Olly: http://tuts4you.com/download.php?list.29
Some people then move to IDA Disassembler (shareware) as the main code analyses tool.
What concerns WoG sources, they are not enough structured for me to give any advice. Usually I use simple text search guessing some parts of function names.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted March 31, 2012 01:53 PM |
|
|
Actually I have basic experience on assembler (mostly coding not interpreting someone another's code), and I even made a game with both C and assembler use which purporsely doesn't use any function from standard library and other libraries (but one which was reserving some amount of memory which were unavoidable to use without making program unable to run in not pure dos/pure bios enviroment). It was pure art but I'm happy enough for such achievment. the game was already in text mode, but all input/output were assembler (lazy ones it mostly worked with bios interrupts and using some memory segments from IBM PC standard).
happily enough I know that I dont have to work with IN and OUT assembler commands when working with ERA/WOG. It makes me happy because those are almost only commands from assembler which I fail to work with (I tried to port assembler-only code for diplaying a bitmap in graphics mode which used OUT for setting bitmap palette on graphics card in VGA-compatible mode, from 16bit code to 32bit code but I snowed it so badly as it showed moving noise on monitor, made graphic driver unstable, and probably hurting a bit my own graphic card in means of hardware - I realised after it that 16bit-adressed port isn't same as 32bit-addressed port with same number, while I managed perhaps to keep proper word size).
So generally I done some crazy things with assembler once or twice in the past, but I wouldn't touch linux kernel code or low-level driver code without deeply considering if I'm availible to succeed. But i never tried to assemble something which calls high-level functions, use dynamic library function pointers (I know only there exist a macro INVOKE in assembler), outside code embedded in code in C/C++. I have some high-level assembler knowledge leaks whatever it seems to mean.
Back to the things I'm not a sucker in programming, even with some assembler. but have relatively none knowledge on reverse engineering itself, which looks like a blocker for me. I was uncapable to find the code for a "security" in a simpliest hackme.exe sample program (my abilities on searching are limited to searching integer values). Thus I'm deeply please for some links/tutorials about reverse engineeering itself. It would be cool to be able to use it, it would be useful and almost surely able for me to get. I were supprised there so many RE-based mod projects ongoing, while most of modders can *SOMETIMES* use a script.
|
|
Bersy
Honorable
Supreme Hero
|
posted March 31, 2012 02:44 PM |
|
|
Reverse engineering is Disassembler + Debugger. I propose you OllyDebugger and IDA. OlyDebugger: breakpoints (hardware, memory, conditional), tracing, searching for constants and commands, in-line assembling.
There is plenty of crackmes on the site http://crackmes.de/ for any difficulty level.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted March 31, 2012 08:55 PM |
|
|
Well I feel like a blind in the fog...
I suspected to have some lecture, about "how to search the things", and I'm unhappy to have work on tries and misatkes, but perhaps I manage to get into some time.
also i seem hijacked the http://heroescommunity.com/viewthread.php3?TID=27213&pagenumber=7 thread with comments on my incomplete script on commanders. please look there a bit because I may need some Ideas and balancing suggestions.
|
|
Bersy
Honorable
Supreme Hero
|
posted March 31, 2012 09:44 PM |
|
Edited by Bersy at 21:50, 31 Mar 2012.
|
Quote: about "how to search the things"
I could try to give a hint if you specify more concrete task (for instance, how to find a code accessing the concrete value like gold of monster structure). What concerns commanders, the code managing them is located in monsters.cpp and can be found by seraching for numbers: 174 and 191. Manual checks for each bonus.
You can use OllyDebugger to find the places in code. Search for the appropriate constants at addresses > 701000 (RMB - Search for - All constants).
|
|
Bersy
Honorable
Supreme Hero
|
posted April 01, 2012 01:46 PM |
|
|
majaczek, I think the functions testing existence of plugins and patches should know the exact names of files, because masks are not safe and may give invalid results. Such things as names are changed very rarely and should be stable in order to save mods hierarchy.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted April 02, 2012 04:34 PM |
|
|
Quote: majaczek, I think the functions testing existence of plugins and patches should know the exact names of files, because masks are not safe and may give invalid results. Such things as names are changed very rarely and should be stable in order to save mods hierarchy.
okay I don't concur. the whole point of using a mask is to threat *.dll, *.era, *.bin and *.txt plugins the same way. so if for example someone written old era plugin and want to upgrade th escript would still work (one has *.era extension and one *.dll). same with change between binmagic formats. I guess the script just would need to be fixed then without the feature.
The more important feature of this function is check whether the plugin is valid. for example phoenix mod include a standard plugin name with "empty" contents (it doesn't change nothing), just for making sure the user haven't used the plugin. so the plugin checking function should not be tricked by the thing (it should answer plugin isn't present because plugin content isn't present). there may be various ways to achieve that, but i think the easiest for binmagic plugins is to check if plugin contents is different than *.exe file contents, and for *.dll/*.era plugins just use actual API functions. If it isn't too late I may also want for the plugin to return version (0=plugin non-existent, 1=binmagic plugin, 2 or more = internal integer version of era plugin, if era/dll plugin and version<2 return 1)
|
|
Bersy
Honorable
Supreme Hero
|
posted April 02, 2012 06:21 PM |
|
Edited by Bersy at 18:23, 02 Apr 2012.
|
Sorry, a bit too late. Finishing the next release. Apart form other changes, added two functions:
bool PluginExists (char* Name)
bool PatchExists (char* Name)
Examples:
PluginExists("yona") - will check yona.dll and yona.era. The size of dll should be > 0 to return TRUE.
PatchExists("display primary skills over 99") - will check for "EraPlugins\display primary skills over 99.bin" and both After/BeforeWoG folders. The size of file should be > 4 to be treated as existing one (4 is empty binary patch).
*.txt are patches sources and not loaded by Era.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted April 02, 2012 09:03 PM |
|
Edited by majaczek at 21:08, 02 Apr 2012.
|
Quote: Sorry, a bit too late. Finishing the next release. Apart form other changes, added two functions:
bool PluginExists (char* Name)
bool PatchExists (char* Name)
Examples:
PluginExists("yona") - will check yona.dll and yona.era. The size of dll should be > 0 to return TRUE.
PatchExists("display primary skills over 99") - will check for "EraPlugins\display primary skills over 99.bin" and both After/BeforeWoG folders. The size of file should be > 4 to be treated as existing one (4 is empty binary patch).
*.txt are patches sources and not loaded by Era.
Thanks it suits me enough. There can be future function
int PluginVersion (char* Name)
if checking the version will be needed (not crucial yet), and independent of the two functions.
Really thanks for the changes you provided, and I don't want making you delayed, so feel free to publish it as you desired, because you say you are finishing now.
EDIT: Is it possible to make binary patch to change exp for level calculation, to use algorithm from VCMI? it is same effect for first 45 levels or so, but it fixes a problem with ghost levels (there would be no ghost levels anymore, the levels were ghost levels would function as normal levels each having greater exp requirement than previous).
|
|
Bersy
Honorable
Supreme Hero
|
posted April 02, 2012 10:12 PM |
|
Edited by Bersy at 22:12, 02 Apr 2012.
|
Version 2.1 April, 2.
----------------------
[+] Added fixed catapult def by Valery (Salamandre). Fixes crashes when using
catapult as war machine in battle.
[+] Added fixed animated and regular WoG objects by totkotoriy.
[+] Added Plugins Manager by SyDr. "Tools\Plugins Manager".
[+] Added Mods Manager by SyDr. "Tools\Mods Manager".
[+] Fixed towers damage (defense, petrifaction and air shield bonuses).
"Mods\WoG\EraPlugins\AfterWoG\fix towers damage.bin".
[+] Added patch for displaying primary skills with over 99 values by Jim Vogan.
"Mods\WoG\EraPlugins\AfterWoG\display primary skills over 99.bin".
[+] Added 2 Era functions for checking plugins/patches existance:
FUNCTION PluginExists (Name: STRING): BOOLEAN; STDCALL;
FUNCTION PatchExists (Name: STRING): BOOLEAN; STDCALL;
Example:
!!SN:L^era.dll^/?y1 Ay1/^PluginExists^/?y2 Ey2/1/^yona^;
!!IF&v1=0:M^Plugin "yona" is not loaded!^;
[*] The patch "no real time trigger" is now off by default.
[*] Secondary skills scrolling mod scrolls skills to top on exit.
[*] Era won't load plugins with zero size and patches with size <= 4.
[-] Fixed mistakes in triggers list. Era SDK/API/Sources were updated.
Quote: EDIT: Is it possible to make binary patch to change exp for level calculation, to use algorithm from VCMI? it is same effect for first 45 levels or so, but it fixes a problem with ghost levels (there would be no ghost levels anymore, the levels were ghost levels would function as normal levels each having greater exp requirement than previous).
Such changes are not made in patches, only in dll's/plugins. Sorry, won't take this task so far.
|
|
master_learn
Legendary Hero
walking to the library
|
posted April 02, 2012 10:33 PM |
|
|
?
If I want to update 2.0 to 2.1 do I have to install again Era on Complete or is there update file from 2.0 to 2.1?
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted April 03, 2012 10:39 AM |
|
|
Quote: Binary patch can just remove commander's special abilities at all. It's not sources correction, but constants correction. So it's up to you to decide. The patch would make commanders ordinary units.
I'd like to have source of the patch, as I myself would check which changes I want and which not.
But I thought of another thing, could the constants be changed, to make commanders take another creature numbers? (Including commander spawn event)... If so we can move commander unit indexes after Dracolich, and the current numbers would be free. It's worthful because amethyst.dll have some bugs for units over the limit but they would have low meaning for commanders. (So we will have 18 more bugless creature indexes and commander feature kept).
I also think I should write my own Era plugin, as plugins seems to be more powerfull than scripts.
PS: if SN:W can be used for plugins we would have nice interface to pass constants (and variables) from plugins to scripts. Also could ERA plugins apply binary patches during runtime? (So it for example change commander constants to value captured from SN:W)...
|
|
Bersy
Honorable
Supreme Hero
|
posted April 03, 2012 05:19 PM |
|
|
Quote: If I want to update 2.0 to 2.1 do I have to install again Era on Complete or is there update file from 2.0 to 2.1?
Currently, installing from scratch. Sorry, I'm close to the stable basic version when future updates will not require reinstallation.
Quote: So we will have 18 more bugless creature indexes and commander feature kept
No. Commanders will not exist if you use those 18 for other creatures.
Quote: PS: if SN:W can be used for plugins we would have nice interface to pass constants (and variables) from plugins to scripts.
Yes, we can use them.
Quote: Also could ERA plugins apply binary patches during runtime? (So it for example change commander constants to value captured from SN:W)...
No. Era applies patches after plugins loading only once. Of course there is a procedure "PROCEDURE ApplyBinPatch (CONST FilePath: STRING);" which can be exported if there is a demand.
|
|
majaczek
Supreme Hero
Work at Magic Dimmension
|
posted April 03, 2012 10:00 PM |
|
Edited by majaczek at 22:06, 03 Apr 2012.
|
Quote:
Quote: So we will have 18 more bugless creature indexes and commander feature kept
No. Commanders will not exist if you use those 18 for other creatures.
Please re-read my post. the thing I proposed is to switch whole commander mechanics from current monster indexes to 192-209, and those creature indexes are accessible if using amethyst era plugin. So we will still keep the need for "wasting" 18 creature indexes for commanders. Since there are multiple bugs in amethyst era plugin indexes>191 are "worse". The bugs seem have no affect for commanders. The result is all commander units will fit into amethyst range (units>191) which shouldn't produce more bugs on them, and old commander indexes then will be freed, allowing mods to include 18 more creatures without being cursed from amethyst plugin bugs (latest bugreports i found is inavability to upgrade to unit in amethyst range). This way the mod will be dependent on amethyst but not have to worry about it's bugs also it can use all old commander indexes with having commander feature undamaged. It seems a perfect compromise for me.
If no one is brave enough to use my advisory, I will include a testmod (or even a mod with similair features to New Upgrades mod), once the "commander-shift" binary patch is done and would work well with amethyst plugin.
Quote:
Quote: Also could ERA plugins apply binary patches during runtime? (So it for example change commander constants to value captured from SN:W)...
No. Era applies patches after plugins loading only once. Of course there is a procedure "PROCEDURE ApplyBinPatch (CONST FilePath: STRING);" which can be exported if there is a demand.
Ooops. I used wrong words. I meant to ask if era plugin can have a function which would exactly do the same as binary patch would but only once executing the function. So for example there would be function
void setCommanderRange (int first, int last)
which would change in memory all commander constants to values of parameter first and second, depending if it would be lower limit constant or upper one. I believe it should be able to do by calculating a pointer and write value to pointed adress, but I ask because I don't know if such technique is forbidden in era or if there's an API function intended for it. Applying a binary patch FILE would have low sense since functions are intended to take parameters, but this approach could be sometimes useful if for example there will be base of many such files and function will chose which one to import. So yeah export the function you mentioned but it isn't high priority now.
==========================================================
I found my studies have holiday on soonest friday-tuesday, so I will play with reverse engineering and wog commander feature, and eventually produce useful era plugin. The function it will include is to inteligently change constants associated with commanders. So it should be able to move Commander units range to any value supported by the game (intended to be used together with amethyst plugin), and would be able to switch on/off some commander features by changing SOME of the constants to not capture anything (so eg. constants which correspond creature numbers would be changed to 255 if they are 8bit or 65535 if they are 16bit). I would definately play with other commander-related constants (as constants are easiest to track) and perhaps hook some functions. I'm curious if for example chnging just constants would allow to have commander primary skills over 5 (and of course including graphic files according to the scheme). If I succesfully find a function to hook perhaps there can be turned on ability to check on levelup any of not yet maxed primary skills even if 4 or more types are used. I'm sceptical if it would allow commander secondary skills over 14, but there's enough flags for it so perhaps it could work after some hooks (and they will be not able to get via normal way, so there should be additional logic when they would be availible, or just export them for scripts). I also should ask if adding commands to ERM interpreter is hard (if we found an address for a code supporting targeted receiver), because I may want to add new commands for !!CO receiver (if I fail at it there's always more techniques to access functionality of plugin via scripts).
|
|
|
|