Skip to content

Add "CustomMissionID" for saved games#19

Merged
Starkku merged 4 commits intoCnCNet:mainfrom
chaserli:feature/savegameinfo
Feb 27, 2026
Merged

Add "CustomMissionID" for saved games#19
Starkku merged 4 commits intoCnCNet:mainfrom
chaserli:feature/savegameinfo

Conversation

@chaserli
Copy link
Member

@chaserli chaserli commented Feb 19, 2024

Implemented the updated requirements of issue #18

@SadPencil
Copy link
Member

Sorry, but I'm a bit confused. Are there any unclear passages in issue #18?

@chaserli
Copy link
Member Author

Sorry, but I'm a bit confused. Are there any unclear passages in issue #18?

I just noticed the additional message on the issue page, sorry.
So far I introduced 4 consecutive int32, indicating the CampaignID, total House count present, total Techno count present, total Anim count present, just for testing.

I'm not sure if the ScenarioNumber is eventually unused when the spawner is present, and since we can actually append more extra info on the file, why not recording more.

So far if you can manage the previous 4 bytes (int32) of the member Spawner MetaInfo, then you can set [Settings]CampaignID in spawn.ini to modify it.

@SadPencil
Copy link
Member

SadPencil commented Feb 21, 2024

@chaserli
When loading a saved game and saving the game again, the CampaignID is set to -1 instead of previous value in the .sav file if it is not specified in spawn.ini. Could you make the spawner read this value from .sav file first? (although the client is able to specify this value again, I think it is better to handle this in the spawner; for example users might load another mission inside the game, where the client is unable to interrupt)

Also, could be better if this value is an uint64. I use hash algorithm to generate such an ID so using an 8-byte unsigned integer is better than a signed number.


Besides, all the 4 values you introduced for testing work as intended. For the sake of ABI compatibility, could you just save the campaign ID (uint64) in an separate OLE key "Campaign ID"?

@chaserli
Copy link
Member Author

yeah I'm aware of such issue. There's another problem: when finishing the current mission and proceeding to the next one, such ID should change according to your requirement, but I have no idea how to make that happen yet. I'll try to investigate when I have time later

@chaserli chaserli marked this pull request as ready for review March 5, 2024 06:10
@SadPencil
Copy link
Member

@chaserli You are right. pINI->ReadInteger does not support reading uint64 so I guess I have to use int32

@chaserli chaserli force-pushed the feature/savegameinfo branch from 4ab4af6 to 6378ce9 Compare March 7, 2024 03:38
@chaserli
Copy link
Member Author

chaserli commented Mar 7, 2024

@chaserli You are right. pINI->ReadInteger does not support reading uint64 so I guess I have to use int32

Alright, I reverted that to int. Now Campaign ID appears in sav file only when its value is not 0

@github-actions
Copy link

github-actions bot commented Mar 9, 2024

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@chaserli chaserli marked this pull request as draft March 9, 2024 14:51
@chaserli chaserli force-pushed the feature/savegameinfo branch from 825aaa8 to a4a6511 Compare March 10, 2024 05:42
@chaserli chaserli marked this pull request as ready for review March 10, 2024 07:58
@Belonit Belonit force-pushed the main branch 2 times, most recently from b0af8ba to dbcfd07 Compare March 27, 2024 11:32
@chaserli chaserli force-pushed the feature/savegameinfo branch from 60be6e3 to ba33dd3 Compare June 26, 2024 11:17
@SadPencil SadPencil changed the title Implement issue #18 Add "CustomMissionID" for saved games Sep 22, 2024
@Starkku
Copy link
Contributor

Starkku commented May 28, 2025

Took a liberty of making sure it is up-to-date with main and addressing some issues with the parsing of mission info from spawn.ini (including decoupling it from custom missions, which has been adjusted in the associated client PR as well).

@SadPencil
Copy link
Member

Can this PR be merged or are there any review comments? @Belonit @chaserli

@chaserli chaserli marked this pull request as draft May 30, 2025 12:04
@Starkku
Copy link
Contributor

Starkku commented May 31, 2025

There's still an issue caused by game seemingly reading some CSF labels/strings on spot instead of using the labels/strings from originally reading the scenario which causes issues with save/load, I will try to look for proper solution to this during the upcoming week.

@Belonit Belonit linked an issue Jul 27, 2025 that may be closed by this pull request
@Starkku Starkku marked this pull request as ready for review August 18, 2025 11:18
@Starkku
Copy link
Contributor

Starkku commented Aug 18, 2025

There's still an issue caused by game seemingly reading some CSF labels/strings on spot instead of using the labels/strings from originally reading the scenario which causes issues with save/load, I will try to look for proper solution to this during the upcoming week.

Investigated further, this is not worth fixing on game's side due to complexities involved. The current solution of always providing the mission configs in spawn.ini for custom missions is sufficient.

@Belonit Belonit marked this pull request as draft November 25, 2025 19:14
@SadPencil
Copy link
Member

Why is this PR marked as a draft? There should be no remaining work to be done and are ready for review

@chaserli chaserli force-pushed the feature/savegameinfo branch from 848f0d1 to 698d92a Compare February 22, 2026 10:51
@Metadorius
Copy link
Member

care to explain why did you dump the no save mode into an unrelated PR? I was going to say "screw it, merge as is" since multiple authors worked on this one incl. Starkku, but not with hardcore mode (which has some ??? code)

@chaserli
Copy link
Member Author

chaserli commented Feb 22, 2026

care to explain why did you dump the no save mode into an unrelated PR? I was going to say "screw it, merge as is" since multiple authors worked on this one incl. Starkku, but not with hardcore mode (which has some ??? code)

It's unfinished, just making a dll for testing then rework this one. I'll handle the commit history issue later.

Are you going to merge the custom mission part this year or next year? I didn't expect such swift reaction. I suggest reviewing #20 first. Then I'll split things

The no-save part is not unrelated. If I draft another PR it will build on top of this one, it will be harder to manage

@chaserli chaserli force-pushed the feature/savegameinfo branch from 698d92a to fb4411a Compare February 22, 2026 14:56
@Metadorius
Copy link
Member

make a branch on top of this one then rebase

I figured since Starkku took over there's no reason to leave it gathering dust, so screw it, merge it is

@chaserli chaserli marked this pull request as ready for review February 23, 2026 12:05
@chaserli chaserli requested review from Belonit and Starkku and removed request for Starkku February 24, 2026 01:53
@chaserli chaserli force-pushed the feature/savegameinfo branch from fb4411a to 4b3f484 Compare February 24, 2026 04:49
@chaserli chaserli requested a review from Starkku February 25, 2026 10:24
@chaserli
Copy link
Member Author

I figured since Starkku took over there's no reason to leave it gathering dust, so screw it, merge it is

@Belonit Is there any issue at this point?
@Starkku Anything else you want to add or check?

@CnCRAZER
Copy link
Contributor

What's the use case for this proposed pr?

@SadPencil
Copy link
Member

SadPencil commented Feb 27, 2026

What's the use case for this proposed pr?

See #18 and CnCNet/xna-cncnet-client#518

Copy link
Contributor

@Starkku Starkku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think there's anything that needs to be addressed or changed at this time. It works in conjunction with the client changes. If issues crop up further down the line they can be dealt with separately then.

@Starkku Starkku merged commit 5575434 into CnCNet:main Feb 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants