Sonic and Sega Retro Message Board: SA2/SADX Mod Loader - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 7 Pages +
  • ◄ First
  • 4
  • 5
  • 6
  • 7
    Locked
    Locked Forum

SA2/SADX Mod Loader I am the best at names

#76 User is offline MainMemory 

Posted 16 April 2014 - 11:36 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I have updated the cheat code system in the mod loaders to add something that I've wanted for a while: registers. Each code can now access a set of 16 unique registers by specifying a value of "r0" to "r15" for the Address field.
Additionally, there are now a new set of code types which allow you to write data from a register to an address (even another register) by specifying the register's index (without 'r') in the Value field. These new code types all have "reg" before the data type indicator, ie writereg8, mulregu16, divregfloat. There are also "readreg" code types that perform the opposite function of the "writereg" types: they read data from an address and store it in a register.

With this, several advanced codes are now possible, such as a size modifier for SA2 that remembers your size between levels and alters the character's collision sphere also (although it doesn't work quite as well as you might hope).

#77 User is offline MainMemory 

Posted 25 April 2014 - 09:34 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I have added an option for Windowed Fullscreen to the SADX Mod Loader. If you enable it, then when the game is set to run in fullscreen mode, then rather than enabling Direct3D's fullscreen mode, it creates a borderless window with the same dimensions as your primary monitor, and displays the game's screen in an appropriately sized area in the center, with black borders if the aspect ratios don't match.

Essentially, it's exactly the same as regular fullscreen, except you can use Alt+Tab to switch windows.

#78 User is offline MainMemory 

Posted 08 May 2014 - 03:06 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I have upated the SADX Mod Loader to add support for ADX music playback via vgmstream. When the game requests a song be played, the mod loader first changes the file's extension to ADX and searches for matching files, and falls back to WMA if none are found. Other vgmstream formats are also supported.

I recommend creating an adxmusic mod, copying the music files from your favorite version of Sonic Adventure (DX) to its system\sounddata\bgm\wma folder, and enabling it as the first mod loaded. Note that an ADX file will always take precedence over a custom WMA file, regardless of mod order.

I will not be uploading a premade ADX music mod, because I would rather not have a 400MB file on my website.
This post has been edited by MainMemory: 10 May 2014 - 01:53 PM

#79 User is offline MainMemory 

Posted 10 May 2014 - 01:44 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I am happy to report that thanks to angryzor, not only do songs that are supposed to stop actually stop and resume the normal stage music when applicable, the mod loader will now autodetect any of vgmstream's supported file formats, not just ADX.

#80 User is offline MainMemory 

Posted 23 May 2014 - 10:28 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
In an effort to make all the model swapping that's been going on in SA2 easier, I have given the SA2 Mod Loader the ability to load split MDL files. For example, when the game loads the SONICMDL file, if it finds a file in the gd_PC folder (original or mods) named SONICMDL\SONICMDL.ini (like splitMDL produces), it will load all the sa2mdl files in that folder, and construct the MDL index based on the information in the INI file. buildMDL is no longer necessary.
This post has been edited by MainMemory: 23 May 2014 - 10:29 AM

#81 User is offline MainMemory 

Posted 08 June 2014 - 01:55 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I have added a new parameter to the Init function in mods, which is a const reference to a structure containing pointers to helper functions. So far, all these functions enable multiple mods to add ("register") data to SADX's various global lists, such as the start position list, the common object texture list, etc. Currently the structure looks like this:
struct HelperFunctions_v3
{
	// The version of the structure.
	int Version;
	// Registers a start position for a character.
	void (__cdecl *RegisterStartPosition)(unsigned char character, const StartPosition &position);
	// Clears the list of registered start positions for a character.
	void (__cdecl *ClearStartPositionList)(unsigned char character);
	// Registers a field start position for a character.
	void (__cdecl *RegisterFieldStartPosition)(unsigned char character, const FieldStartPosition &position);
	// Clears the list of registered field start positions for a character.
	void (__cdecl *ClearFieldStartPositionList)(unsigned char character);
	// Registers a path list.
	void (__cdecl *RegisterPathList)(const PathDataPtr &paths);
	// Clears the list of registered path lists.
	void (__cdecl *ClearPathListList)();
	// Registers a PVM file for a character.
	void (__cdecl *RegisterCharacterPVM)(unsigned char character, const PVMEntry &pvm);
	// Clears the list of registered PVM files for a character.
	void (__cdecl *ClearCharacterPVMList)(unsigned char character);
	// Registers a PVM file for a common object.
	void (__cdecl *RegisterCommonObjectPVM)(const PVMEntry &pvm);
	// Clears the list of registered PVM files for common objects.
	void (__cdecl *ClearCommonObjectPVMList)();
	// Registers a trial level entry for a character.
	void (__cdecl *RegisterTrialLevel)(unsigned char character, const TrialLevelListEntry &level);
	// Clears the list of registered trial level entries for a character.
	void (__cdecl *ClearTrialLevelList)(unsigned char character);
	// Registers a trial subgame entry for a character.
	void (__cdecl *RegisterTrialSubgame)(unsigned char character, const TrialLevelListEntry &level);
	// Clears the list of registered trial subgame entries for a character.
	void (__cdecl *ClearTrialSubgameList)(unsigned char character);
};

If I add more functions to future versions of the structure, it may be necessary for mods to check the Version number and ensure that they only use functions present in that particular version of the structure, in case a newer mod is loaded with an old loader. Presently, there is no way to check for previous mod loaders, since the value of the structure reference is undefined in previous versions.

I have updated the Goal Ring Mod so that it adds its PVM to the common object texture list instead of overriding the entire list, and it works perfectly.

The SA2 Mod Loader will get this functionality soon.

#82 User is offline Strife 

Posted 12 July 2014 - 06:02 PM

  • Posts: 1181
  • Joined: 19-October 11
  • Gender:Male
  • Location:United States
  • Project:Freedom Planet
I've been having a weird problem with the SADX mod loader for a while. When the loader is in use, the character models have no gloss and some upgrades like Amy's warrior feather have no textures. The problem is fixed if I restore CHRMODELS.DLL to its original state - however, when I do this, the mod loader will no longer function unless I allow it to replace the .dll with its own, and when I do, there is once again no gloss. Any ideas?

#83 User is offline MainMemory 

Posted 12 July 2014 - 06:58 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
By itself the mod loader shouldn't have any effect on the character models, unless your copy of chrmodels.dll is hacked.

#84 User is offline MainMemory 

Posted 16 July 2014 - 11:33 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
The SADX Mod Manager now has a "Force 4:3 Aspect Ratio" checkbox which is checked by default, and a "Native Resolution" button which fills in the resolution boxes with your primary screen's current resolution.

#85 User is offline GerbilSoft 

Posted 17 July 2014 - 12:31 AM

  • RickRotate'd.
  • Posts: 2223
  • Joined: 11-January 03
  • Gender:Male
  • Location:USA
  • Project:Gens/GS
  • Wiki edits:158
9001
In case anyone's tried to run SADX Mod Loader on Wine: The current version of Wine is missing some MSVCP100 functions that were used by the mod loader due to a certain usage of ifstream. I fixed this in git, so SADX Mod Loader now runs properly on Wine. (This also affects SA2 Mod Loader, but I haven't tested it. MainMemory committed a similar fix for that.)

The fix is not currently available in a precompiled build.

As a workaround, you can install the original MSVC 2010 runtime and configure Wine to use the native DLLs instead of built-in. http://www.microsoft...ls.aspx?id=8328

#86 User is offline MainMemory 

Posted 17 July 2014 - 11:06 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Posted Image

Edit: Okay, for those of you wondering, no, I didn't port Windy Valley beta to the Steam version. I made the SADX Mod Loader's "windowed fullscreen" mode display the border image from the Steam version in the areas of the screen not covered by the game. You can customize it by changing mods\Border.png, although you'll have to do it every time you update the mod loader.
This post has been edited by MainMemory: 17 July 2014 - 03:05 PM

#87 User is offline sonicblur 

Posted 17 July 2014 - 06:34 PM

  • Posts: 848
  • Joined: 18-February 08
  • Gender:Male
  • Wiki edits:6

View PostGerbilSoft, on 17 July 2014 - 12:31 AM, said:

In case anyone's tried to run SADX Mod Loader on Wine: The current version of Wine is missing some MSVCP100 functions that were used by the mod loader due to a certain usage of ifstream. I fixed this in git, so SADX Mod Loader now runs properly on Wine. (This also affects SA2 Mod Loader, but I haven't tested it. MainMemory committed a similar fix for that.)

The fix is not currently available in a precompiled build.

As a workaround, you can install the original MSVC 2010 runtime and configure Wine to use the native DLLs instead of built-in. http://www.microsoft...ls.aspx?id=8328

It was pretty obvious when it instantly crashed and the error had MSVC in it that I needed to install the MSVC runtimes. It was the first thing I tried at least, when I set mine up.
Nice to know it was something you could work around though, so thanks for fixing it.

Edit: On a related note, the "Mod manager makes characters not shiny" bug actually happens for me too, but ONLY when running the game in WINE. If I run it in Windows natively, everything looks normal.
This post has been edited by sonicblur: 17 July 2014 - 06:36 PM

#88 User is offline GerbilSoft 

Posted 21 July 2014 - 10:17 AM

  • RickRotate'd.
  • Posts: 2223
  • Joined: 11-January 03
  • Gender:Male
  • Location:USA
  • Project:Gens/GS
  • Wiki edits:158
9001

View Postsonicblur, on 17 July 2014 - 06:34 PM, said:

It was pretty obvious when it instantly crashed and the error had MSVC in it that I needed to install the MSVC runtimes. It was the first thing I tried at least, when I set mine up.
Nice to know it was something you could work around though, so thanks for fixing it.

Edit: On a related note, the "Mod manager makes characters not shiny" bug actually happens for me too, but ONLY when running the game in WINE. If I run it in Windows natively, everything looks normal.

I noticed the "not shiny" issue on Wine too, and it's more of a feature. :) I'll check later to see what causes it.

Latest binary version of SADX Mod Loader now has the Wine fix plus SADX Steam border emulation. (Don't enable logging the debug console to file; that apparently uses an ofstream assignment, which I didn't notice at the time.)

My branch will be merged sometime this week, and has major code refactoring plus improved versioning. (The DLL itself now has a version resource with the version number and git tag.)

Randomness: I tried to build SADX Mod Loader with MinGW gcc to see how much work would be needed to get it working. Turns out gcc's libstdc++ marks basic_ofstream::operator=() [and ifstream] as *deleted*. I'm not sure if that's just a gcc implementation quirk, or if MSVC is incorrectly implementing this operator.
This post has been edited by GerbilSoft: 21 July 2014 - 10:21 AM
Reason for edit: ofstream assignment

#89 User is offline GerbilSoft 

Posted 23 July 2014 - 11:21 AM

  • RickRotate'd.
  • Posts: 2223
  • Joined: 11-January 03
  • Gender:Male
  • Location:USA
  • Project:Gens/GS
  • Wiki edits:158
9001
Coming later this week hopefully: SADX Mod Loader v3.1

No major user-visible changes, but the code has been refactored to make it easier to work with, and it now uses cmake instead of Visual Studio projects.

For modders:
  • SADXModLoader.h has been split into multiple files. You'll just need to #include "SADXModLoader.h" though.
  • Some of the auxiliary files have been consolidated into libmodutils. This isn't going to be distributed as a standalone library, but you can build it by compiling SADX Mod Loader from source. (Or just take the files from src/libmodutils/.)

And coming sometime in the next month or so: SADX Mod Manager Qt rewrite. Currently using Qt 4.8 (though I may switch to 5.3 later), this will be a full rewrite of the SADX Mod Manager using Qt and C++. As such, it will no longer depend on the .NET Framework, though it will require the Qt DLLs (which will be included). Among other things, the SADX Mod Manager Qt rewrite will have a native Linux port, which will be identical to the Windows version except it will invoke SADX through Wine.

#90 User is offline MainMemory 

Posted 09 March 2015 - 10:50 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I have updated SADX Mod Loader to v3.2.

  • SADXModLoader.h now has multiple files, so you'll need to copy all of them into your code instead of just the two.

  • You can now specify parts of data in a mod separately instead of in the ModInfo structure.
    • PointerList Pointers[] -- lists pointers to be written.
    • PointerList Jumps[] -- lists jumps to be written.
    • PointerList Calls[] -- lists calls to be written.
    • PatchList Patches[] -- lists patches to be applied.
    • void __cdecl Init(const char *path, const HelperFunctions &helperFunctions) -- called when the mod is loaded.
    • void __cdecl OnFrame() -- new function, allows code to be run every frame like the cheat code system.

    Remember to put 'extern "C"' and '__declspec(dllexport)' before all of them so the mod loader can find them.
    If you use these APIs in your mod, old versions of the mod loader will fail to run them properly.

  • You can now specify data in INI files, in the same format that split/splitDLL produce, by adding entries to mod.ini:
    • EXEData - sonic.exe
    • CHRMODELSData - CHRMODELS.DLL
    • ADV00MODELSData - ADV00MODELS.DLL
    • ADV01MODELSData - ADV01MODELS.DLL
    • ADV01CMODELSData - ADV01CMODELS.DLL
    • ADV02MODELSData - ADV02MODELS.DLL
    • ADV03MODELSData - ADV03MODELS.DLL
    • BOSSCHAOS0MODELSData - BOSSCHAOS0MODELS.DLL
    • CHAOSTGGARDEN02MR_DAYTIMEData - CHAOSTGGARDEN02MR_DAYTIME.DLL
    • CHAOSTGGARDEN02MR_EVENINGData - CHAOSTGGARDEN02MR_EVENING.DLL
    • CHAOSTGGARDEN02MR_NIGHTData - CHAOSTGGARDEN02MR_NIGHT.DLL

    Note that using this method does not allow as much freedom as building a DLL mod, and makes it easier for people to steal your content.

StructConverter and DLLModGenerator in SA Tools have been updated to have three Export buttons: one for the old C++ API, one for the new C++ API, and one for INI.

SA2 version coming... eventually.
This post has been edited by MainMemory: 03 April 2015 - 09:53 AM

  • 7 Pages +
  • ◄ First
  • 4
  • 5
  • 6
  • 7
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users