скайрим мод address library for skse plugins

Please log in or register

To enjoy the benefits of Nexus Mods, please log in or register a new account

Address Library for SKSE Plugins

File information

Last updated

Original upload

Created by

Uploaded by

Virus scan

Tags for this mod

About this mod

Contains header file and a database to make SKSE DLL plugins version independent easily.

This mod does not have any known dependencies other than the base game.

Mods requiring this file

Credits and distribution permission

Author notes

This author has not provided any additional notes regarding file permissions

File credits

This author has not credited anyone else in this file

Donation Points system

This mod is opted-in to receive Donation Points

Version 2

Description

For SKSE DLL plugin authors:
This is a modder resource (a header file). You can load a database that stores offsets so your DLL plugin can be version independent without requiring to be recompiled. The header file can be downloaded from the optional section of the files.

How to use

void * MyAddress = NULL;
unsigned long long MyOffset = 0;

bool InitializeOffsets()
<
// Allocate on stack so it will be unloaded when we exit this function.
// No need to have the whole database loaded and using up memory for no reason.
VersionDb db;

// Load database with current executable version.
if (!db.Load())
<
_FATALERROR(«Failed to load version database for current executable!»);
return false;
>
else
<
// «SkyrimSE.exe», «1.5.97.0»
_MESSAGE(«Loaded database for %s version %s.», db.GetModuleName().c_str(), db.GetLoadedVersionString().c_str());
>

// This address already includes the base address of module so we can use the address directly.
MyAddress = db.FindAddressById(123);
if (MyAddress == NULL)
<
_FATALERROR(«Failed to find address!»);
return false;
>

// This offset does not include base address. Actual address would be ModuleBase + MyOffset.
if (!db.FindOffsetById(123, MyOffset))
<
_FATALERROR(«Failed to find offset for my thing!»);
return false;
>

// Everything was successful.
return true;
>

Now you’re wondering what is that «123» value there. This is the ID of an address. Different version databases will have the same ID for an address but it may point to different values. To get a list of all ID and value pair for a specific version do this:

bool DumpSpecificVersion()
<
VersionDb db;

// Try to load database of version 1.5.62.0 regardless of running executable version.
if (!db.Load(1, 5, 62, 0))
<
_FATALERROR(«Failed to load database for 1.5.62.0!»);
return false;
>

// Write out a file called offsets-1.5.62.0.txt where each line is the ID and offset.
db.Dump(«offsets-1.5.62.0.txt»);
_MESSAGE(«Dumped offsets for 1.5.62.0»);
return true;
>

Instead of 1, 5, 62, 0 put the version you are reversing and familiar with. You must have the corresponding database file in /Data/SKSE/Plugins directory first.

After you call this you should have a new file in the main Skyrim directory called «offsets-1.5.62.0.txt» or whatever you put as the file name. It will be in the format where each line is:
Decimal ID Hex Offset

For example if you have an address 142F4DEF8 (player character static pointer) in 1.5.62.0 that you want to make version independent you would do this:
1. Look up 2F4DEF8 in the offsets file. Because this is the offset without the base 140000000
2. See that the ID is 517014 (decimal!)
3. If you want this address in your DLL at runtime do this:

void* addressOf142F4DEF8 = db.FindAddressById(517014);

And there you have it.

The VersionDb struct has the following functions:

Things you should know and keep in mind:

1. You can include any (or all) of the database files with your plugin but it may increase the file size considerably (by around 2.5 mb). I would recommend to include only the latest version (which was 1.5.97.0 at the time of writing this), and if users need older version you can point them here and let them download a specific version database themself. Although I have no issues if you do decide to include all database versions with your plugin or even upload them to other sites.

2. You should ALWAYS only load database once at startup, initialize/cache the addresses you need and let it unload. Unloading just means the VersionDb struct gets deleted or lost (if you allocated on stack). This will make sure you don’t use unnecessary amount of memory during game runtime. There’s no need to keep the database loaded during gameplay.

3. The database contains addresses of functions, global variables, RTTI, vtables, and anything else that may have a reference to it. It does not contain addresses that are in the middle of functions or middle of globals. If you need an address in the middle of the function you should look up the function base address and add the extra offset yourself.

4. You should always check the result to make sure the database loaded successfully (bool Load returned true) and that the addresses queried actually returned a valid result (not NULL). If it does fail to load it means the file was missing most likely. If the query fails it means the address could not be found in that version. This could mean either the game code changed enough that the address is no longer at all valid for that version OR the database itself failed to detect the correct address. If either of those things happen you should fail the plugin initialization to let SKSE know you did not load correctly. Or manually show an error message.

5. It would also be best if you checked to make sure the address exists in all versions of the game before publishing your DLL plugin. To do that load each version of the database file and query the same address ID in each of them to make sure it exists:

bool IsOk()
<
std::vector all;
if (!LoadAll(all))
<
_FATALERROR(«Failed to load one or more version databases for current executable!»);
FreeAll(all);
return false;
>

if (!ExistsInAll(all, 517014))
<
_FATALERROR(«517014 does not exist in all versions of the database!»);
FreeAll(all);
return false;
>

This way you can be sure your DLL mod will work in all versions, or if it does not work in some versions you can write that on your mod page.

6. Sometimes you’ll need to do something different based on running game version. You can do that with this code snippet:

int major = 0, minor = 0, revision = 0, build = 0;
if (!db.GetExecutableVersion(major, minor, revision, build))
<
_FATALERROR(«Something went wrong!»);
return false;
>

7. Please keep in mind: if you compile your SKSE DLL in debug mode the load time of database can be around 14 seconds! In release mode this is around 0.2 seconds.

Permissions

Do whatever you want. You can include the database files with your mod if you wish so you don’t need to mark this as a dependency. You can upload your mod including the database files to other sites. No credit is necessary.

Источник

Please log in or register

To enjoy the benefits of Nexus Mods, please log in or register a new account

Address Library for SKSE Plugins

File information

Last updated

Original upload

Created by

Uploaded by

Virus scan

Tags for this mod

About this mod

Contains header file and a database to make SKSE DLL plugins version independent easily.

This mod does not have any known dependencies other than the base game.

Mods requiring this file

Credits and distribution permission

Author notes

This author has not provided any additional notes regarding file permissions

File credits

This author has not credited anyone else in this file

Donation Points system

This mod is opted-in to receive Donation Points

Version 2

Description

For SKSE DLL plugin authors:
This is a modder resource (a header file). You can load a database that stores offsets so your DLL plugin can be version independent without requiring to be recompiled. The header file can be downloaded from the optional section of the files.

How to use

void * MyAddress = NULL;
unsigned long long MyOffset = 0;

bool InitializeOffsets()
<
// Allocate on stack so it will be unloaded when we exit this function.
// No need to have the whole database loaded and using up memory for no reason.
VersionDb db;

// Load database with current executable version.
if (!db.Load())
<
_FATALERROR(«Failed to load version database for current executable!»);
return false;
>
else
<
// «SkyrimSE.exe», «1.5.97.0»
_MESSAGE(«Loaded database for %s version %s.», db.GetModuleName().c_str(), db.GetLoadedVersionString().c_str());
>

// This address already includes the base address of module so we can use the address directly.
MyAddress = db.FindAddressById(123);
if (MyAddress == NULL)
<
_FATALERROR(«Failed to find address!»);
return false;
>

// This offset does not include base address. Actual address would be ModuleBase + MyOffset.
if (!db.FindOffsetById(123, MyOffset))
<
_FATALERROR(«Failed to find offset for my thing!»);
return false;
>

// Everything was successful.
return true;
>

Now you’re wondering what is that «123» value there. This is the ID of an address. Different version databases will have the same ID for an address but it may point to different values. To get a list of all ID and value pair for a specific version do this:

bool DumpSpecificVersion()
<
VersionDb db;

// Try to load database of version 1.5.62.0 regardless of running executable version.
if (!db.Load(1, 5, 62, 0))
<
_FATALERROR(«Failed to load database for 1.5.62.0!»);
return false;
>

// Write out a file called offsets-1.5.62.0.txt where each line is the ID and offset.
db.Dump(«offsets-1.5.62.0.txt»);
_MESSAGE(«Dumped offsets for 1.5.62.0»);
return true;
>

Instead of 1, 5, 62, 0 put the version you are reversing and familiar with. You must have the corresponding database file in /Data/SKSE/Plugins directory first.

After you call this you should have a new file in the main Skyrim directory called «offsets-1.5.62.0.txt» or whatever you put as the file name. It will be in the format where each line is:
Decimal ID Hex Offset

For example if you have an address 142F4DEF8 (player character static pointer) in 1.5.62.0 that you want to make version independent you would do this:
1. Look up 2F4DEF8 in the offsets file. Because this is the offset without the base 140000000
2. See that the ID is 517014 (decimal!)
3. If you want this address in your DLL at runtime do this:

void* addressOf142F4DEF8 = db.FindAddressById(517014);

And there you have it.

The VersionDb struct has the following functions:

Things you should know and keep in mind:

1. You can include any (or all) of the database files with your plugin but it may increase the file size considerably (by around 2.5 mb). I would recommend to include only the latest version (which was 1.5.97.0 at the time of writing this), and if users need older version you can point them here and let them download a specific version database themself. Although I have no issues if you do decide to include all database versions with your plugin or even upload them to other sites.

2. You should ALWAYS only load database once at startup, initialize/cache the addresses you need and let it unload. Unloading just means the VersionDb struct gets deleted or lost (if you allocated on stack). This will make sure you don’t use unnecessary amount of memory during game runtime. There’s no need to keep the database loaded during gameplay.

3. The database contains addresses of functions, global variables, RTTI, vtables, and anything else that may have a reference to it. It does not contain addresses that are in the middle of functions or middle of globals. If you need an address in the middle of the function you should look up the function base address and add the extra offset yourself.

4. You should always check the result to make sure the database loaded successfully (bool Load returned true) and that the addresses queried actually returned a valid result (not NULL). If it does fail to load it means the file was missing most likely. If the query fails it means the address could not be found in that version. This could mean either the game code changed enough that the address is no longer at all valid for that version OR the database itself failed to detect the correct address. If either of those things happen you should fail the plugin initialization to let SKSE know you did not load correctly. Or manually show an error message.

5. It would also be best if you checked to make sure the address exists in all versions of the game before publishing your DLL plugin. To do that load each version of the database file and query the same address ID in each of them to make sure it exists:

bool IsOk()
<
std::vector all;
if (!LoadAll(all))
<
_FATALERROR(«Failed to load one or more version databases for current executable!»);
FreeAll(all);
return false;
>

if (!ExistsInAll(all, 517014))
<
_FATALERROR(«517014 does not exist in all versions of the database!»);
FreeAll(all);
return false;
>

This way you can be sure your DLL mod will work in all versions, or if it does not work in some versions you can write that on your mod page.

6. Sometimes you’ll need to do something different based on running game version. You can do that with this code snippet:

int major = 0, minor = 0, revision = 0, build = 0;
if (!db.GetExecutableVersion(major, minor, revision, build))
<
_FATALERROR(«Something went wrong!»);
return false;
>

7. Please keep in mind: if you compile your SKSE DLL in debug mode the load time of database can be around 14 seconds! In release mode this is around 0.2 seconds.

Permissions

Do whatever you want. You can include the database files with your mod if you wish so you don’t need to mark this as a dependency. You can upload your mod including the database files to other sites. No credit is necessary.

Источник

Please log in or register

To enjoy the benefits of Nexus Mods, please log in or register a new account

Address Library for SKSE Plugins

File information

Last updated

Original upload

Created by

Uploaded by

Virus scan

Tags for this mod

About this mod

Contains header file and a database to make SKSE DLL plugins version independent easily.

This mod does not have any known dependencies other than the base game.

Mods requiring this file

Credits and distribution permission

Author notes

This author has not provided any additional notes regarding file permissions

File credits

This author has not credited anyone else in this file

Donation Points system

This mod is opted-in to receive Donation Points

Version 2

Description

For SKSE DLL plugin authors:
This is a modder resource (a header file). You can load a database that stores offsets so your DLL plugin can be version independent without requiring to be recompiled. The header file can be downloaded from the optional section of the files.

How to use

void * MyAddress = NULL;
unsigned long long MyOffset = 0;

bool InitializeOffsets()
<
// Allocate on stack so it will be unloaded when we exit this function.
// No need to have the whole database loaded and using up memory for no reason.
VersionDb db;

// Load database with current executable version.
if (!db.Load())
<
_FATALERROR(«Failed to load version database for current executable!»);
return false;
>
else
<
// «SkyrimSE.exe», «1.5.97.0»
_MESSAGE(«Loaded database for %s version %s.», db.GetModuleName().c_str(), db.GetLoadedVersionString().c_str());
>

// This address already includes the base address of module so we can use the address directly.
MyAddress = db.FindAddressById(123);
if (MyAddress == NULL)
<
_FATALERROR(«Failed to find address!»);
return false;
>

// This offset does not include base address. Actual address would be ModuleBase + MyOffset.
if (!db.FindOffsetById(123, MyOffset))
<
_FATALERROR(«Failed to find offset for my thing!»);
return false;
>

// Everything was successful.
return true;
>

Now you’re wondering what is that «123» value there. This is the ID of an address. Different version databases will have the same ID for an address but it may point to different values. To get a list of all ID and value pair for a specific version do this:

bool DumpSpecificVersion()
<
VersionDb db;

// Try to load database of version 1.5.62.0 regardless of running executable version.
if (!db.Load(1, 5, 62, 0))
<
_FATALERROR(«Failed to load database for 1.5.62.0!»);
return false;
>

// Write out a file called offsets-1.5.62.0.txt where each line is the ID and offset.
db.Dump(«offsets-1.5.62.0.txt»);
_MESSAGE(«Dumped offsets for 1.5.62.0»);
return true;
>

Instead of 1, 5, 62, 0 put the version you are reversing and familiar with. You must have the corresponding database file in /Data/SKSE/Plugins directory first.

After you call this you should have a new file in the main Skyrim directory called «offsets-1.5.62.0.txt» or whatever you put as the file name. It will be in the format where each line is:
Decimal ID Hex Offset

For example if you have an address 142F4DEF8 (player character static pointer) in 1.5.62.0 that you want to make version independent you would do this:
1. Look up 2F4DEF8 in the offsets file. Because this is the offset without the base 140000000
2. See that the ID is 517014 (decimal!)
3. If you want this address in your DLL at runtime do this:

void* addressOf142F4DEF8 = db.FindAddressById(517014);

And there you have it.

The VersionDb struct has the following functions:

Things you should know and keep in mind:

1. You can include any (or all) of the database files with your plugin but it may increase the file size considerably (by around 2.5 mb). I would recommend to include only the latest version (which was 1.5.97.0 at the time of writing this), and if users need older version you can point them here and let them download a specific version database themself. Although I have no issues if you do decide to include all database versions with your plugin or even upload them to other sites.

2. You should ALWAYS only load database once at startup, initialize/cache the addresses you need and let it unload. Unloading just means the VersionDb struct gets deleted or lost (if you allocated on stack). This will make sure you don’t use unnecessary amount of memory during game runtime. There’s no need to keep the database loaded during gameplay.

3. The database contains addresses of functions, global variables, RTTI, vtables, and anything else that may have a reference to it. It does not contain addresses that are in the middle of functions or middle of globals. If you need an address in the middle of the function you should look up the function base address and add the extra offset yourself.

4. You should always check the result to make sure the database loaded successfully (bool Load returned true) and that the addresses queried actually returned a valid result (not NULL). If it does fail to load it means the file was missing most likely. If the query fails it means the address could not be found in that version. This could mean either the game code changed enough that the address is no longer at all valid for that version OR the database itself failed to detect the correct address. If either of those things happen you should fail the plugin initialization to let SKSE know you did not load correctly. Or manually show an error message.

5. It would also be best if you checked to make sure the address exists in all versions of the game before publishing your DLL plugin. To do that load each version of the database file and query the same address ID in each of them to make sure it exists:

bool IsOk()
<
std::vector all;
if (!LoadAll(all))
<
_FATALERROR(«Failed to load one or more version databases for current executable!»);
FreeAll(all);
return false;
>

if (!ExistsInAll(all, 517014))
<
_FATALERROR(«517014 does not exist in all versions of the database!»);
FreeAll(all);
return false;
>

This way you can be sure your DLL mod will work in all versions, or if it does not work in some versions you can write that on your mod page.

6. Sometimes you’ll need to do something different based on running game version. You can do that with this code snippet:

int major = 0, minor = 0, revision = 0, build = 0;
if (!db.GetExecutableVersion(major, minor, revision, build))
<
_FATALERROR(«Something went wrong!»);
return false;
>

7. Please keep in mind: if you compile your SKSE DLL in debug mode the load time of database can be around 14 seconds! In release mode this is around 0.2 seconds.

Permissions

Do whatever you want. You can include the database files with your mod if you wish so you don’t need to mark this as a dependency. You can upload your mod including the database files to other sites. No credit is necessary.

Источник

Please log in or register

To enjoy the benefits of Nexus Mods, please log in or register a new account

Address Library for SKSE Plugins

File information

Last updated

Original upload

Created by

Uploaded by

Virus scan

Tags for this mod

About this mod

Contains header file and a database to make SKSE DLL plugins version independent easily.

This mod does not have any known dependencies other than the base game.

Mods requiring this file

Credits and distribution permission

Author notes

This author has not provided any additional notes regarding file permissions

File credits

This author has not credited anyone else in this file

Donation Points system

This mod is opted-in to receive Donation Points

Version 2

Description

For SKSE DLL plugin authors:
This is a modder resource (a header file). You can load a database that stores offsets so your DLL plugin can be version independent without requiring to be recompiled. The header file can be downloaded from the optional section of the files.

How to use

void * MyAddress = NULL;
unsigned long long MyOffset = 0;

bool InitializeOffsets()
<
// Allocate on stack so it will be unloaded when we exit this function.
// No need to have the whole database loaded and using up memory for no reason.
VersionDb db;

// Load database with current executable version.
if (!db.Load())
<
_FATALERROR(«Failed to load version database for current executable!»);
return false;
>
else
<
// «SkyrimSE.exe», «1.5.97.0»
_MESSAGE(«Loaded database for %s version %s.», db.GetModuleName().c_str(), db.GetLoadedVersionString().c_str());
>

// This address already includes the base address of module so we can use the address directly.
MyAddress = db.FindAddressById(123);
if (MyAddress == NULL)
<
_FATALERROR(«Failed to find address!»);
return false;
>

// This offset does not include base address. Actual address would be ModuleBase + MyOffset.
if (!db.FindOffsetById(123, MyOffset))
<
_FATALERROR(«Failed to find offset for my thing!»);
return false;
>

// Everything was successful.
return true;
>

Now you’re wondering what is that «123» value there. This is the ID of an address. Different version databases will have the same ID for an address but it may point to different values. To get a list of all ID and value pair for a specific version do this:

bool DumpSpecificVersion()
<
VersionDb db;

// Try to load database of version 1.5.62.0 regardless of running executable version.
if (!db.Load(1, 5, 62, 0))
<
_FATALERROR(«Failed to load database for 1.5.62.0!»);
return false;
>

// Write out a file called offsets-1.5.62.0.txt where each line is the ID and offset.
db.Dump(«offsets-1.5.62.0.txt»);
_MESSAGE(«Dumped offsets for 1.5.62.0»);
return true;
>

Instead of 1, 5, 62, 0 put the version you are reversing and familiar with. You must have the corresponding database file in /Data/SKSE/Plugins directory first.

After you call this you should have a new file in the main Skyrim directory called «offsets-1.5.62.0.txt» or whatever you put as the file name. It will be in the format where each line is:
Decimal ID Hex Offset

For example if you have an address 142F4DEF8 (player character static pointer) in 1.5.62.0 that you want to make version independent you would do this:
1. Look up 2F4DEF8 in the offsets file. Because this is the offset without the base 140000000
2. See that the ID is 517014 (decimal!)
3. If you want this address in your DLL at runtime do this:

void* addressOf142F4DEF8 = db.FindAddressById(517014);

And there you have it.

The VersionDb struct has the following functions:

Things you should know and keep in mind:

1. You can include any (or all) of the database files with your plugin but it may increase the file size considerably (by around 2.5 mb). I would recommend to include only the latest version (which was 1.5.97.0 at the time of writing this), and if users need older version you can point them here and let them download a specific version database themself. Although I have no issues if you do decide to include all database versions with your plugin or even upload them to other sites.

2. You should ALWAYS only load database once at startup, initialize/cache the addresses you need and let it unload. Unloading just means the VersionDb struct gets deleted or lost (if you allocated on stack). This will make sure you don’t use unnecessary amount of memory during game runtime. There’s no need to keep the database loaded during gameplay.

3. The database contains addresses of functions, global variables, RTTI, vtables, and anything else that may have a reference to it. It does not contain addresses that are in the middle of functions or middle of globals. If you need an address in the middle of the function you should look up the function base address and add the extra offset yourself.

4. You should always check the result to make sure the database loaded successfully (bool Load returned true) and that the addresses queried actually returned a valid result (not NULL). If it does fail to load it means the file was missing most likely. If the query fails it means the address could not be found in that version. This could mean either the game code changed enough that the address is no longer at all valid for that version OR the database itself failed to detect the correct address. If either of those things happen you should fail the plugin initialization to let SKSE know you did not load correctly. Or manually show an error message.

5. It would also be best if you checked to make sure the address exists in all versions of the game before publishing your DLL plugin. To do that load each version of the database file and query the same address ID in each of them to make sure it exists:

bool IsOk()
<
std::vector all;
if (!LoadAll(all))
<
_FATALERROR(«Failed to load one or more version databases for current executable!»);
FreeAll(all);
return false;
>

if (!ExistsInAll(all, 517014))
<
_FATALERROR(«517014 does not exist in all versions of the database!»);
FreeAll(all);
return false;
>

This way you can be sure your DLL mod will work in all versions, or if it does not work in some versions you can write that on your mod page.

6. Sometimes you’ll need to do something different based on running game version. You can do that with this code snippet:

int major = 0, minor = 0, revision = 0, build = 0;
if (!db.GetExecutableVersion(major, minor, revision, build))
<
_FATALERROR(«Something went wrong!»);
return false;
>

7. Please keep in mind: if you compile your SKSE DLL in debug mode the load time of database can be around 14 seconds! In release mode this is around 0.2 seconds.

Permissions

Do whatever you want. You can include the database files with your mod if you wish so you don’t need to mark this as a dependency. You can upload your mod including the database files to other sites. No credit is necessary.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *