Jump to content

Help needed - compile a .cpp file into a .dll


Recommended Posts

For debug build the DLL I've obtained has 5.65MB. The latest released version has 5.31MB, so is close enough. I assume that Struckur released the debug version.

For release build the DLL has 297KB, which is OK (the extensions from my F4SE\Plugins folder have between 250KB and 560KB).

 

I'm surprised that the mod used to work with the buggy GetLogFilePath, GetSettingFilePath, GetDefaultSettingFilePath functions. Returning the address of a local variable is something that may cause crashes...

Probably Struckur used an old compiler and this is why it didn't catch the bug from TransmitPowerInSelectionLatent function.

 

Anyway, you can find here everything I've done: https://drive.google.com/file/d/1qkc7g6KNJYSzoAglAvNgbXlxuJAs3ZM-/view?usp=sharing

The project, the modified source code and the resulted DLLs.

 

I assume you named your project clipboard-dll, mine is named clipboard, so you can load both in f4se solution to compare them.

 

LE: read the message written by MaybeSomeone on clipboard's forum; you'll probably need the new addresses; I can find them, but I need the new EXE (I'm not playing F4 anymore)

Edited by Wolfmark
Link to comment
Share on other sites

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

Quick question, is there any guide for creating f4se plugins?

 

The best documentation I've found is the source code of existing plugins. Some authors (registrator2000, kassent, Neanka etc...) released the source code for their mods...

Probably this thread is the best documentation about what you need to compile an extension :smile:

 

 

[...] I can find them, but I need the new EXE (I'm not playing F4 anymore)

 

How do you find them? Cheat Engine?

 

 

With a disassembler. From what I know Cheat Engine can be used for finding addresses in memory, not in the executable.

Edited by Wolfmark
Link to comment
Share on other sites

Hi Wolfmark.

 

Thankyou for providing your copies of everything, I'll get to looking at them as soon as I get the time (bit busy at the moment).

 

I saw that post on the Clipboard comments page (I check in there from time to time in the hope that someone has found a fix), and that info might be useful to someone who understands what Maybesomeone's talking about - sadly that's not me :(.

 

But you've given me, and anyone else who might decide to pick up the gauntlet (if it's OK with you for others to use your contributions?) , a lot of help, and for that I'm eternally grateful.

 

It seems that Vortex was thwarting my attempts to use my recompiled dll - I was simply replacing the standard .dll file with the compiled version and it started doing some strange things.

 

When I put the original dll file back in place, the strange behaviour stayed!

 

I then completely removed the Clipboard mod and re-installed it and it (with the original .dll) started working properly again.

 

I'm going to compile your version and then make a complete new package of the clipboard mod and install it through Vortex and see how that goes. Maybe it was actually working all this time - that would be fantastic.

 

I'll report back as soon as I get done.

 

Regards :).

Link to comment
Share on other sites

Good and bad news - new information received:

The mod can't just be recompiled for newer F4SE versions, it is using several native functions that F4SE does not make available so the local addresses need to be extracted from the Fallout 4 executable itself, doing so is what made the mod's speed possible but the address often changed with each new Fallout 4 version. Neanka and Expired know how to do this.

So even if the .dll can be recompiled it looks like it won't work because it needs some memory addresses changing, as Wolfmark alluded to, & Maybesomeone said on the Clipboard comments page.

 

That is way beyond my capabilities, so if anyone can offer any further help/info, it would be greatly appreciated.

 

Even better would be if some super skilled programmer/hacker was able to pick up the ball here and perform their magic ;).

 

My (uneducated) guess is that we would need a tool that scans every new fallout4.exe version to search for these new addresses, copy them to a new header file that can be included in each new build?

 

....but I guess that's like saying we just need a magic wand and our lives would be so much easier :D.

 

My next thought is that maybe offering a financial incentive might be the way to go. If I can get enough interest, maybe setting up a Patreon or suchlike fund to pay someone to do this? There has to be someone with the required talents/time/patience out there who can do such things?

 

Dunno, just grasping at straws & thinking out loud here.

 

Regards.

 

PS - oh look, here's the latest FO4.exe version ;).

Link to comment
Share on other sites

The way I understood it, Struckur edited the F4SE Source (and it's license prohibits distribution of modified source), I think he added the SetScale function.

 

Someone already updated the plugin a while ago, removing all of the scale related functions, so it compiled with standard F4SE. They left some comments on clipboard's page. Maybe they could give a pointer. Maybe F4SE also integrates the SetScale thing now, Idk.

 

The whole F4SE thing is quite obscure, there's zero documentation and, as has been said, the most useful information is probably gained from examining existing plugins (of which there is -for the lack of documentation- no guarantee or even indication that they do things "properly"). I can understand the F4SE developers however. Seeing as how Beth keeps messing with the exe*, I'm amazed they even bother to update the extender.

 

* Why FTLOG Beth keeps doing this, I have no idea. Why can't the cruft go into plugins, but needs to be added to the exe? What are all those new things they add? Thy're not fixing bugs for sure...

 

 

NB: https://www.codeproject.com/Articles/29527/Reverse-Engineering-and-Function-Calling-by-Addres

Link to comment
Share on other sites

F4SE has almost the best documentation available: is open source.
Most of the F4SE extension I've seen require a much higher skill than reading F4SE source code.
Anyway, it seems that only one address has changed:
RelocPtr <void*> qword_145907F18(0x05907F18);
must be changed to
RelocPtr <void*> qword_145907F18(0x058CEE98); // updated for 1.10.138

All the other addresses seems to be the same in 1.10.98 (the version for which the clipboard mod was released) and 1.10.138.

DEFINE_MEMBER_FN(SetScale, void, 0x003F8490, float scale);
RelocAddr <_Enable_Native> Enable_Native(0x0040D970);
RelocAddr <_Disable_Native> Disable_Native(0x004E4300);
RelocAddr <_EffectShaderPlay> EffectShaderPlay(0x00422060);
RelocAddr <_EffectShaderStop> EffectShaderStop(0x00F0DF40);
Edited by Wolfmark
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...