You are here

Flash custom code needed =/

12 posts / 0 new
Last post
Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 8 months ago
Joined: 2010-09-16 07:28
Flash custom code needed =/

Hi all,

I have a problem with a Flash game, in particular Super Smash Flash 2 v0.9..
I saw another Flash portable app around here.

Flash background:
Flash uses .sols which it saves in "%APPDATA%\Roaming\Macromedia\Flash Player\#SharedObjects" or something like that. In that folder there are folder(s) with 8 random numbers and letters each. WorldClock Portable saves to "VW3RMQA8". This seems to work, I assume that value is hardcoded into the app. With Super Smash Flash 2 however, things are different.
SSF2 uses the first folder inside SharedObjects, like every other online flash game, it can find and dumps "localhost\SSF2_V9.sol" inthere.
The game swf online and offline are the same, offline simply has a wrapper exe around it. Normally there already is a random letters and numbers folder in there, your browser dumps sols in there all the time.

My launcher:
[Launch]
ProgramExecutable=SuperSmashFlash2\SSF2.exe
WorkingDirectory=%PAL:AppDir%\SuperSmashFlash2
LaunchAppAfterSplash=true
SingleAppInstance=true
SinglePortableAppInstance=true
DirectoryMoveOK=yes

[FilesMove]
settings\SSF2_V9.sol=%APPDATA%\Macromedia\Flash Player\#SharedObjects\????????\localhost

[DirectoriesCleanupIfEmpty]
1=%APPDATA%\Macromedia\Flash Player\#SharedObjects\????????\localhost
1=%APPDATA%\Macromedia\Flash Player\#SharedObjects
2=%APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\#local
3=%APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys
4=%APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer
5=%APPDATA%\Macromedia\Flash Player\macromedia.com\support
6=%APPDATA%\Macromedia\Flash Player\macromedia.com
7=%APPDATA%\Macromedia\Flash Player
8=%APPDATA%\Macromedia

What happens
If I run this, the game starts, but my .sol doesn't show up anywhere. The launcher creates "%APPDATA%\Macromedia\Flash Player\#SharedObjects\localhost" (and maybe also one inside the folder with random numbers and letters, I can't check which program created that folder). The game creates a new sol inside *random numbers and letters*\localhost. I close the game, sol file in data gets overwritten with the one the game made and my savedata is lost. Don't worry, I made backups Blum

It's like I can't use ??????? in FilesMove to create a folder or move a file inside a wildcarded folder but I can use it to get the file out/remove the empty folder.

Any thoughts on this?

EDIT:
I replicated this behaviour once more.
I added this to my launcher.ini:

[FilesMove]
settings\test.txt=%PAL:AppDir%\SuperSmashFlash2\????\localhost

I added 2 folders called "test" and "test2" to the correct dir. In both I created a "localhost" folder. In fact this shouldn't be necessary, but I did it anyways.
I added a test.txt file in the settings folder.

The launcher created a localhost folder next to my 2 test folders. In this localhost folder I found my text.txt, I made some changes to it, saved it and found those changes back in settings\test.txt after I closed the app. My 2 test folders remained empty all the time. For "test2" this is normal, for "test" on the other hand it isn't.

Aluísio A. S. G.
Offline
Last seen: 7 years 8 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
Try *

Try using * instead of ???????.

Previously known as kAlug.

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 8 months ago
Joined: 2010-09-16 07:28
nope =(

Sorry, doesn't work, still creates an empty localhost folder inside %APPDATA%\Roaming\Macromedia\Flash Player\#SharedObjects

Yes, I set the working directory!

Aluísio A. S. G.
Offline
Last seen: 7 years 8 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
Wait

Is the localhost folder inside of #SharedObjects or ??????? ?

Previously known as kAlug.

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 8 months ago
Joined: 2010-09-16 07:28
SharedObjects

Inside #SharedObjects. It's like it completely ignores the question marks

Yes, I set the working directory!

Aluísio A. S. G.
Offline
Last seen: 7 years 8 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
No wildcards

If it's directly inside the #SharedObjects folder, then you don't need wildcards. Just 1=%APPDATA%\Macromedia\Flash Player\#SharedObjects\localhost.

Previously known as kAlug.

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 8 months ago
Joined: 2010-09-16 07:28
Misunderstanding

Let me rephrase this:
The localhost folder doesn't exist yet when opening the app.
The folder should be inside %APPDATA%\Macromedia\Flash Player\#SharedObjects\HG6RNGR7\localhost. Since these 8 letters and numbers are random I needed to use the wildcards.
What happens: the folder is created here #SharedObjects\localhost, while it should be here #SharedObjects\HG6RNGR7\localhost.

Yes, I set the working directory!

John T. Haller
John T. Haller's picture
Offline
Last seen: 3 hours 10 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Only The End

I think (but am not sure) that wildcards with directories move or cleanup, they can only be used with the last portion of the directory. So it could do %APPDATA%\Macromedia\Flash Player\#SharedObjects\localhost\???? but not %APPDATA%\Macromedia\Flash Player\#SharedObjects\????\localhost.

The bottom line is that for flash apps, you need to use custom code.

Sometimes, the impossible can become possible, if you're awesome!

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 8 months ago
Joined: 2010-09-16 07:28
Custom code

Ok, how would this custom code look?
2 possible options:
The folder exists => How do I get the foldername and use that to store the file.
The folder doens't exist => How do I know which foldername I should use?

For the second question: why do I care? If I'm playing the game and I open a webbrowser using flash, it also stores data inside a folder somewhere in there. If that's not the correct folder all that data will be there but in an incorrect folder (and thus useless...)

Edit: wildcards can be used in the middle of a path

Yes, I set the working directory!

John T. Haller
John T. Haller's picture
Offline
Last seen: 3 hours 10 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Source

Ah, ok. Still, it can only be used for a source directory as I indicated below. Not for a destination. When used as a destination, there could be multiple matches and PAL couldn't pick which one.

For custom code, you need to check if it exists. If it doesn't, create it. If the app is going to use a random path no matter what, it may not be a good candidate for portablization at all.

If the app does not open or save files or open any links or external documents, you can redirect the entire USERPROFILE variable. You can not do this if it does any of the above, though.

Sometimes, the impossible can become possible, if you're awesome!

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 8 months ago
Joined: 2010-09-16 07:28
1:code 2:lazy

I wrote some code that checked the number of folders inside, copied the file to the right location if it had one folder (or created AAAAAAAA if there were none). That worked if the file didn't yet exist, I still had to do error checking. Then I had to retrieve the file after the program ended and that's where I got lazy...

I simply put this in launcher.ini:
[DirectoriesMove]
settings\ssf2settings=%APPDATA%\Macromedia\Flash Player\#SharedObjects\00000000

This works if there are alphabetically no folders above 00000000, which I think, ain't possible.

If someone wants the code or the launcher fils, just ask for it inhere Smile

Yes, I set the working directory!

John T. Haller
John T. Haller's picture
Offline
Last seen: 3 hours 10 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Improper Use of Wildcards

You can't use wildcards like that with PAL or anything else I'm aware of. With FilesMove, the wildcards are only for use with a set of filenames to move, you can't use them as part of a directory name. %PAL:AppDir%\SuperSmashFlash2\????\localhost as your FilesMove target can't logically be resolved to anything as there are hundreds of thousands of possible matches. How could PAL know what you mean?

Wildcards can only be used for the source of something, not the target.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments