Jump to content

Introducing ShapeSet and WSASet.


Blade

Recommended Posts

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

Tested the WSA. Indeed, purple colours show up.

 

And you were right; the fact the game accepts no key input in these scenes means cnc-ddraw can't take screenshots there.

 

(side note: for some bizarre reason, in Win10, I needed to put the exe in XP Service Pack 3, without admin mode, before it wanted to start)

Link to comment
Share on other sites

Could be WSASet, it hasn't had extensive testing out the the wild yet so it could have bugs such as not encoding the palette correctly perhaps? I'd need the PCX set to run tests on it to debug it. You could also try the version in the tools pack I uploaded, that has slightly altered palette handling which shouldn't alter the results but might fix it if it was broken.

 

Edit: Err forget the new version for the time being, looks like it definitely has issues with handling the palette correctly :/

Link to comment
Share on other sites

Can't be the stretch table generator; all that does is generate a table. There are no "wrong" values in such a table that can cause anything like this; after all, a palette is 256 values, and that's only as much as a byte can contain. And their file size is fixed and always the same, too, and generally with fixed size files like these the game has the expected size saved in the read function for it and doesn't read them any further than the expected size anyway.

 

I did get one crash, yes, but the program was overall rather wonky on Windows 10 (I tested on my work laptop during a break). I actually had to DISABLE the "run as administrator" option before it wanted to run. Which seemed extra odd since the compatibility mode meant it gave the elevation prompt anyway :S

Link to comment
Share on other sites

I gave it another go and didn't seem to notice any change (still pink, still crashed on second map viewing, although after I clicked on Egypt funnily enough). I'll attach the source pcx frames here as well, not like anybody can steal 'em for anything useful haha.

 

 

Link to comment
Share on other sites

Okay, at a glance the palette is the same as the original version of this wsa, so there should be no need to generate new stretch tables as far as I can tell. wsaset for me generates a wsa file that seems to be valid and has a palette that matches the pcx files. I can't test in game at the moment, but I don't see why you should be having these palette issues. I built it with "wsaset -p -l hearth_a" out of interest just to make sure we are on the same page.

Link to comment
Share on other sites

I can confirm I am using the same command line.

 

I didn't use the palette generator at first, but I was getting some nasty black pixels because of the water being different to what XCC says is the normal palette (when I use right click -> copy as as shown in my previous screenshot).

Link to comment
Share on other sites

I'm not really sure why you keep mentioning XCC in all this as it shouldn't affect the in game results, but for the record, if I copy the wsa to pal in XCC from the one I generated and the original, they both export the same palette and neither has that pink index in them. I've attached the version I generated, I would suggest you do a binary diff against the version you generated and see if they differ and then test mine in game.

 

I can confirm I am using the same command line.

 

I didn't use the palette generator at first, but I was getting some nasty black pixels because of the water being different to what XCC says is the normal palette (when I use right click -> copy as as shown in my previous screenshot).

hearth_a.zip

Link to comment
Share on other sites

Did some more testing today to try and eliminate the problem, by putting some of the original files back in to see what's causing this. As we know both the new pal and the new wsa crashes on second playthrough of the animation.

 

First I replaced the new pal with the original pal from my old C&C install. This improved things: I got a crash on the third playthrough, although black pixels did pop up.

 

Finally as a control test I replaced my wsa with the original C&C wsa. I occasionally had a few palette flash but otherwise I saw no problems, being able to play it through 7-8 times without any problems (I stopped at that point, it did not crash).

 

Does this help narrow things down?

Link to comment
Share on other sites

Hmm, the plot thickens if the file plays through fine at least once. It is in theory possible the WSASet xordelta algorithm could cause issues as it generates subtley different encoding to the original WW one, but why would it decode correctly a few times and then cause an issue? The decoding functions don't keep any state that I can see.

Link to comment
Share on other sites

Y'know... another way to do this is reconvert original WSA files with your tool, compare the resulting files with the original files, and then figure out what the differences are and why they occur.

 

WSA is lossless, right? Not like VQA. So once the tool can make 1:1 reconversions of the originals, the problems should be fixed...

 

Kilkakon also said apparently XCC crashes on the new WSA files. That's already somewhat suspect; I know XCC can handle the WSAs from German and French DOS C&C, and Mac C&C (it has this odd xor-system for wsas building up on previous WSAs that Dune II also uses), just fine, and Olaf probably didn't have these to test his decoder on, meaning that "XCC can decode it" is a rather decent way to predict if the game will be able to handle them.

Link to comment
Share on other sites

Okay that was totally my bad. :( It looks like XCC can open these WSAs, I must have been recalling my experiences with Red Horizon. Sorry for misremembering, my brain has died tonight.

 

Conversely, if XCC _can_ open these what does that mean? It means they are probably very close... is XCC built to handle compression that C&C eventually chokes on?

Link to comment
Share on other sites

Problem is that the game code itself can decode the files initially, so what causes the eventual crash? The only difference is the preference the code gives to certain xordelta instructions when encoding, but as far as I can tell, they are all within the original spec even if they don't match exactly. I haven't looked at reversed code for the XORDelta_To_Viewport code though to ensure it decodes correctly, only the code that decodes to a buffer. At some point I will analyze the difference the commands between the original data and my implementation and try and make them conform exactly so it can round trip the data properly, it will loose some compression, but it will guarantee that any file would be indistinguishable from files encoded by the original.

Link to comment
Share on other sites

I've done some more testing tonight. And the results are... weird.

 

I decided to try a control sample: the original WW frames. I converted them from WSA to PCX frames using XCC, and then converted them back into a WSA using WsaSet. And it worked. I was able to quit and restart the campaign 8 times without crashing (I gave up at this point). The only oddity I noticed was that when the WSA ended C&C gave a brief flash of pink over Africa--this doesn't happen with the originals.

 

And to confirm, I put mine back in and got a crash on the third playthrough, with the error message "The instruction at 004d8295 referenced memory at 01018000. The memory could not be written".

 

What makes my frames crash and not WW's? What causes the pink flash?

Link to comment
Share on other sites

  • 6 months later...

Whelp, forum ate my post. Yay. Here we go again!

 

So I've been returning to working on my mod, and today I tried to figure out WsaSet again. I've been attempting a test with taking one of the original wsas, decoding it and recoding it to test if the tool works out. Unfortunately, it seems to have failed my test, so I'll explain what my process was and then you can see if it's something I did wrong or if it's WsaSet at fault.

 

I've been working with choose.wsa. I used XCC Mixer to copy the whole thing into clipboard and then pasted it into my image program (XCC's copy as PCX frames gave me rubbish). Manually cutting out the first 6 and saving them as PCX, I then copy/pasted/renamed these in Explorer to get choose 0000.pcx through choose 0029.pcx. I then ran this through WsaSet with both loop and palette options enabled, with coordinates 0, 22 as per the original.

 

Ingame, I saw no visible animation. Clicking one of the logos to start the game was fine. However, upon returning to the main menu and trying again, it would crash on either the second or third new game. The animation plays fine in XCC Mixer. Notably, my file is 56425 bytes smaller than the original one, although that could be because of less intense animation.

 

I've zipped up my files and the end result and put them into this zip here: http://kilkakon.com/kocb/Shapeset.zip

 

Anything I'm doing wrong? These aren't even my images and they are using the original palette. I'm becoming increasingly concerned that maybe it's the tool that's at fault. Any ideas?

Link to comment
Share on other sites

I think WSASet needs to set the Delta size to slightly larger than I currently have it set to which could be causing some issues. I'll compile a new version at some point for you to try out.

Link to comment
Share on other sites

Try re-encoding the radar animations too, they are very large and before I added some patch to force memory compression in-game (the game would disable it when you have more than 4 MB ram) building a Radar Dome would sometimes cause crashes because of the radar animation.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...