Sonic and Sega Retro Message Board: CPKREDIR - loading and combining mods for Sonic Generations - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Loading News Feed...
 

CPKREDIR - loading and combining mods for Sonic Generations New version 0.41, now with save file redirection

#46 User is offline Azu 

Posted 30 May 2012 - 08:30 PM

  • I must be stupid.
  • Posts: 1316
  • Joined: 23-February 08
  • Gender:Male
  • Location:Home
Not in the version I downloaded.

#47 User is offline Dario FF 

Posted 30 May 2012 - 09:11 PM

  • Tech Support Hotline
  • Posts: 815
  • Joined: 03-April 10
  • Gender:Male
  • Location:Mar Del Plata
  • Project:SonicGLvl
What I mean is that the songs are packed inside CPKs normally in the game, but in the version we distributed, CPKREDIR can redirect to the AAX files inside of it. That's why you saw only the folders and the AAX files for Windmill Isle, CPKREDIR took care of redirecting.

While AR File redirection sounds neat it sounds like it could be a bit hard to pull off since that's more game-dependent than the external routines used to load CPKs.
This post has been edited by Dario FF: 30 May 2012 - 09:12 PM

#48 User is offline Lobotomy 

Posted 31 May 2012 - 02:01 AM

  • Every man who knows a thing knows he knows not a damn, damn thing at all.
  • Posts: 3583
  • Joined: 22-March 06
  • Gender:Male
  • Location:Traverse City
  • Project:Fixing Generations FOREVER, Project: In Silico, Unleashed PC Beautification.
  • Wiki edits:94
Is there any easy way to turn off just one mod out of the many I have?

#49 User is offline DinnerSonic 

Posted 31 May 2012 - 02:10 AM

  • Never Posting Since 2004!
  • Posts: 127
  • Joined: 11-April 04
  • Gender:Male
  • Location:West Virginia, United States of America
In the modsDB.ini file, just tack on a ; before the respective ActiveMod entry.

ActiveMod0="Logo Removal"
;ActiveMod1="Classic Sonic Adventures"
ActiveMod2="WaveOcean"

This for example would disable the Classic Sonic Adventures mod while leaving it easy to turn back on real quickly. Good for disabling conflicting mods, I assume CSA wouldn't play well with the Wave Ocean level for example.

#50 User is offline Korama 

Posted 09 July 2012 - 06:08 PM

  • Posts: 232
  • Joined: 18-May 04
I finally got around to update CPKREDIR. Version 0.4 is here.

The big new feature is save file redirection.
Activated by setting "EnableSaveFileRedirection" in cpkredir.ini to true (it is by default).

Now mods can specify custom save files in the [Main] section of their mod.ini. Excerpt from the readme for your convenience:

Quote

SaveFile (string) - specifies the path and name of the redirected save file.
This setting is only effective if EnableSaveFileRedirection is set to true. It allows the creator of a mod to supply a custom save file, e.g. one where red rings still need to be collected in the levels. It is meant for more elaborate mods that make large changes to the hub world and the levels.
Mods that replace Sonic with some other character, or change HUD elements etc. should NOT use this setting, to avoid interfering with other mods that actually need it.
Note that any custom save file data will be reset to the game's default values when the user chooses "New Game" in the main menu of Sonic Generations, which could have undesirable effects on your mod. Unfortunately, at the moment it is not possible to automatically load a custom initial save file when a "New Game" is activated.
Nevertheless, I suggest that you provide an additional copy of your initial save file, if your mod uses this feature. This copy or backup could have the file extension ".new.sav" (Example: if your mod INI contains SaveFile=mysave.sav, then provide mysave.sav of course, but also mysave.new.sav as backup of the initial state.)

On that note, has anybody reverse-engineered the save file of Sonic Generations yet?
This post has been edited by Korama: 09 July 2012 - 07:37 PM

#51 User is offline Dario FF 

Posted 09 July 2012 - 06:17 PM

  • Tech Support Hotline
  • Posts: 815
  • Joined: 03-April 10
  • Gender:Male
  • Location:Mar Del Plata
  • Project:SonicGLvl
As I mentioned before, great work. Just one question. If SaveFileFallback is "", and Save file redirection is enabled, it just won't redirect the save file? Because that's how I would expect it to work.

#52 User is offline DinnerSonic 

Posted 09 July 2012 - 06:21 PM

  • Never Posting Since 2004!
  • Posts: 127
  • Joined: 11-April 04
  • Gender:Male
  • Location:West Virginia, United States of America

View PostKorama, on 09 July 2012 - 06:08 PM, said:

On that note, has anybody reverse-engineered the save file of Sonic Generations yet?

If it matters, I found out a tiny bit of info at least, where the game stores currently equipped skills. I hoped(and failed) to force the Sonics to use the Rocket/Spikes Wisp skills which are in the skills list data along with the Mega Drive. I'm not sure where but there's surely a "what skills are bought" section that could allow that.

It's harder for me to figure out because I'm not using any tracer things, just comparing back and forth save files, which also likely include things like time played and number of steps counters going about. Still, a tiny start?

#53 User is offline Korama 

Posted 09 July 2012 - 06:43 PM

  • Posts: 232
  • Joined: 18-May 04

View PostDario FF, on 09 July 2012 - 06:17 PM, said:

As I mentioned before, great work. Just one question. If SaveFileFallback is "", and Save file redirection is enabled, it just won't redirect the save file? Because that's how I would expect it to work.

Thank you. I treat SaveFileFallback="" the same as not having that key present at all, meaning that the default value "cpkredir.sav" will be used. Same goes for LogFile, by the way. And for ModsDbIni, but there the default value is "" anyway.

View PostDinnerSonic, on 09 July 2012 - 06:21 PM, said:

If it matters, I found out a tiny bit of info at least, where the game stores currently equipped skills. I hoped(and failed) to force the Sonics to use the Rocket/Spikes Wisp skills which are in the skills list data along with the Mega Drive. I'm not sure where but there's surely a "what skills are bought" section that could allow that.

It's harder for me to figure out because I'm not using any tracer things, just comparing back and forth save files, which also likely include things like time played and number of steps counters going about. Still, a tiny start?

Thanks, that's interesting. Here's what I figured out:

The first 32 bytes (8 dwords) are a header of sorts. First dword is the ID "SGD1". The following dwords specify the sizes of the segments the save file consists of. They (always) are 0xA300, 0x134, 0x1B4, 0x8.
So, the first segment of the save file is 41728 (=0xA300) bytes, from file offset 0x20 (immediately after the header) to 0xA31F.

Some easy settings (by file offset):
0x30: Voice-Over language (00 = English, 01 = Japanese, 02 = French, 03 = German, 04 = Spanish, 05 = Italian)
0x31: Music Volume (0 - 100)
0x32: Effects Volume (0 - 100)
0x33: Brightness (0 - 100)
0x34: 3D Scale (0 - 100)

0x38: a bitfield:
Bit #0 = Control Tutorial
Bit #1 = Omochao Hints
Bit #4 = Subtitles
Bit #6 = 3D enabled
No idea what Bits #2 and #3 are for. I changed them but saw no effect.

0xA0E0: the dword at this offset is 0xFFFFFFFF for new/empty saves. But there are more factors that mark a save as empty.
This post has been edited by Korama: 09 July 2012 - 06:45 PM

#54 User is offline Dario FF 

Posted 09 July 2012 - 07:04 PM

  • Tech Support Hotline
  • Posts: 815
  • Joined: 03-April 10
  • Gender:Male
  • Location:Mar Del Plata
  • Project:SonicGLvl
If the save file stores stuff like Option Settings, it makes sense that using New Game doesn't delete it as you mentioned in your PM, but rather overwrites the contents of the current Save File. So it's likely the Delete function didn't get used after all.

Quote

I treat SaveFileFallback="" the same as not having that key present at all, meaning that the default value "cpkredir.sav" will be used.

Here's the thing, I don't think it should actually use that value as default. The user might want to leave SaveFileRedirection enabled in case one of the mods he installed uses it, but if none of them use it, CPKREDIR would create a brand new save file called "cpkredir.sav", and the player would have to start all over from scratch just for installing say, a NoHUD mod.

For example, I just tried installing CPKREDIR v0.4.0 with the LogoRemoval mod alone. Since the Save file redirection is enabled by default in the example INI that comes with it, a brand new game got started! That's definitely not what the user would like. This could be quite the issue for distributing, so if it's fixable soon, it'd be pretty much perfect. :)

Easiest way to fix it is making the default NOT use a save file even if the redirection is enabled, but the key for SaveFileFallback is empty(or ""). Of course if none of the mods use Save Files that is.
This post has been edited by Dario FF: 09 July 2012 - 07:25 PM

#55 User is offline Josh 

Posted 09 July 2012 - 07:13 PM

  • YRG Warrior
  • Posts: 453
  • Joined: 22-January 08
  • Gender:Male
  • Location:USA
  • Wiki edits:1

View PostDinnerSonic, on 09 July 2012 - 06:21 PM, said:

View PostKorama, on 09 July 2012 - 06:08 PM, said:

On that note, has anybody reverse-engineered the save file of Sonic Generations yet?

If it matters, I found out a tiny bit of info at least, where the game stores currently equipped skills. I hoped(and failed) to force the Sonics to use the Rocket/Spikes Wisp skills which are in the skills list data along with the Mega Drive. I'm not sure where but there's surely a "what skills are bought" section that could allow that.

It's harder for me to figure out because I'm not using any tracer things, just comparing back and forth save files, which also likely include things like time played and number of steps counters going about. Still, a tiny start?


The Mega Drive, eh? Would it be possible to restore that to the HUB? I mean, I know it wouldn't be functional, but I do think it's a pretty neat object, especially the way the GHZ music drops back to 16-bit when you're near it.

#56 User is offline Korama 

Posted 09 July 2012 - 07:48 PM

  • Posts: 232
  • Joined: 18-May 04

View PostDario FF, on 09 July 2012 - 07:04 PM, said:

If the save file stores stuff like Option Settings, it makes sense that using New Game doesn't delete it as you mentioned in your PM, but rather overwrites the contents of the current Save File. So it's likely the Delete function didn't get used after all.

The delete function can get called if the conditions are right, I've found the code that does it. But don't ask me what the conditions are. ;)
Anyway, the game keeps the settings in memory, so it could delete the old save file and create a new one without problem. But directly overwriting it, as the game does, requires one step less, of course.

Quote

For example, I just tried installing CPKREDIR v0.4.0 with the LogoRemoval mod alone. Since the Save file redirection is enabled by default in the example INI that comes with it, a brand new game got started! That's definitely not what the user would like. This could be quite the issue for distributing, so if it's fixable soon, it'd be pretty much perfect. :)

Yeah, I've just noticed that myself. Initially, I copied my normal save file to cpkredir.sav and therefore wasn't hit by that issue.
Anyway, I've implemented a "read-through" mechanism, as I actually intended to at the beginning. If save file redirection is enabled, but no mod specifies a save file, and no SaveFileFallback is given (or it is the default cpkredir.sav), then the game will load your normal save file, but write any changes to cpkredir.sav.
So, if cpkredir.sav doesn't exist, it is automatically copied from your regular save.
Of course, if you set SaveFileFallback to some value that isn't "" or cpkredir.sav, and that file doesn't exist yet, then you WILL start with a completely new save.

Download fixed version
(argh, link was wrong)
This post has been edited by Korama: 09 July 2012 - 07:51 PM

#57 User is offline Dario FF 

Posted 09 July 2012 - 08:01 PM

  • Tech Support Hotline
  • Posts: 815
  • Joined: 03-April 10
  • Gender:Male
  • Location:Mar Del Plata
  • Project:SonicGLvl
That solution works perfectly. Thanks for the quick update. :)

Your method actually solves the problem with people having the fear of ruining their Time-Attack scores and the like. Only way they have to ruin their save file is by explicitly disabling save file redirection, which is a default enabled option. Since the user won't likely disable it(and I could offer a warning in SonicGMI if he does), his Stats will be safe when using Mods... Upon disabling mods, he would just fall back to his original save file.

So kudos on it! Seems it's solved in the best way I can think of now.

EDIT: Mirror'd. I'm also uploading the tools to ModDB if you don't mind.
This post has been edited by Dario FF: 09 July 2012 - 08:12 PM

#58 User is offline Korama 

Posted 09 July 2012 - 08:19 PM

  • Posts: 232
  • Joined: 18-May 04
It's nice to see that there a finally some Sonic Generation mods listed on ModDB. Please upload CPKREDIR there if you like.

#59 User is offline Kharen 

Posted 09 July 2012 - 09:14 PM

  • Posts: 280
  • Joined: 29-October 11
  • Gender:Male
  • Location:Spokane Community College - Newport IEL
Wait a moment, the Mega Drive data is in the PC version? Does this mean you could make a mod to reinsert it and play the original Sonic the Hedgehog?

#60 User is offline Josh 

Posted 09 July 2012 - 09:26 PM

  • YRG Warrior
  • Posts: 453
  • Joined: 22-January 08
  • Gender:Male
  • Location:USA
  • Wiki edits:1

View PostKharen, on 09 July 2012 - 09:14 PM, said:

Wait a moment, the Mega Drive data is in the PC version? Does this mean you could make a mod to reinsert it and play the original Sonic the Hedgehog?


I don't think the emulator and ROM are there, but I'd imagine the Mega Drive object is.

  • 6 Pages +
  • ◄ First
  • 2
  • 3
  • 4
  • 5
  • 6
    Locked
    Locked Forum

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