10-29-2022, 06:20 PM
(This post was last modified: 11-08-2022, 02:13 PM by Kris_Perry.)
Just incase I vanish again, it might be wise to pass along some info incase anyone else wants to give it a try.
Modifying a Flash game is not that difficult, although some flash games just don't like being modified and most big changes have dramatic effects. Your PC will LIE to you (Flashplayer32_SA will display a working game but your LeapPad may only show a slideshow of the frames.) so transfer over and test it on the LeapPad between big changes
This guide doesn't expect you to already know Adobe Action Script 2.0, I saw it for the first time this week myself and its easy to read, not the most obscure language. Having some logical knowledge (e.g working with IF statements) helps alot however.
The guide will assume that you're using Windows, if you're not then VM or Wine
Software you will need:
So you've bundled a game, transferred it to the LeapPad and the D-PAD is Unresponsive, Lopsided OR It's a mouse game but for some reason it wants you to press SPACEBAR to begin....
I've seen it, I know the pain.
If you got lucky and the D-PAD IS recognized by the game but 90degree offset that's good.
It's just LeapFrog, by fitting the D-Pad the wrong way and having their games scripted for the new directional's it would make it impossible, difficult, time consuming for someone to get unofficial games working on their system.
Case #1: Ownage - D-PAD Remap
I remember being in awe at Ownage when it first came out so when I stumbled past it again in my mega games download I had to double back and have a play and even though it needs D-PAD+1, as soon as it loaded on my laptop I badly wanted to get it to work on the LeapPad.
I opened it in FFDec and scrolled straight to the "scripts" section where I have found input binds on some other games just by looking for tags such as <Left><Right><Spacebar><Enter> but that is inefficient and as you can see doesn't always get results.
The next way I thought of was the "Text Search" function, I searched for <Left>, Left and keyPress but got no results, but the game must be getting it's inputs from somewhere, games don't just happen like that, so I looked up a table of Keyboard codes.. and started getting alot of results.
Just looking at a glimpse of the code, it was obvious why my search turned up blank so I copied the Key.isDown bit to clipboard and scratched my head. Up to now I'd only fixed a game with normal Left & Right -> LeapPad Left & Right and I used the Replace All function which wouldn't work here. (4 directions, they'd mix at some point and you'd replace ALL all of them not just all of them)
So we need to replace the input key codes to change which buttons trigger which code, (if we understand the code this would be cake..)
Start with the top search result, click edit. Now you need to remember:
Work carefully and try not to lose track of what you have changed already, you have to click save each time to save the actionscript source before you can view/edit the next on the search results list and you need to change every instance on every search result.
If you feel like you would lose track of yourself very easily like I did, there is an alternative method,
if we first remap the 4 arrow keys to different keys E.G: The Function Key in each row,
we CAN get away with using Replace All, in fact I had 4 boxes open with a different term in each, bare in mind you'll need to do 2 passes with this method and you still need to click edit, replace all x 4 and save for each actionscript on your search results but it is considerably quicker and provided its setup correctly, not prone to human error
At this point the game is completely mapped to the LeapPad D-PAD + Volume Key and therefore completely playable. I did make a few visual changes (E.G: Removed the keyboard buttons from the start menu sprite) but that will be covered in the next section of the guide.
Case #2: Dora, Mermaid Adventure - Visual Alteration
In this example, I'll walk you through changing a few visual elements, with a little care the same technique can be applied to alter most visual elements within SWF games.
![[Image: number-fonts-bshk-2.jpg]](https://bashooka.com/wp-content/uploads/2019/11/number-fonts-bshk-2.jpg)
Freerider 2 and the way it showed me the way, upon loading Freerider on the LeapPad I noticed half of the left menu was off screen, all of the right menu was inaccessible BUT the D-PAD was already mapped perfectly.
So I broke out JPEXs FFDec and had a look to see if I could change anything, first I noticed these empty black bars on the menus which were caused by simply skipping menu entries, I moved them up so they run sequentially.
Modifying a Flash game is not that difficult, although some flash games just don't like being modified and most big changes have dramatic effects. Your PC will LIE to you (Flashplayer32_SA will display a working game but your LeapPad may only show a slideshow of the frames.) so transfer over and test it on the LeapPad between big changes
This guide doesn't expect you to already know Adobe Action Script 2.0, I saw it for the first time this week myself and its easy to read, not the most obscure language. Having some logical knowledge (e.g working with IF statements) helps alot however.
The guide will assume that you're using Windows, if you're not then VM or Wine
Software you will need:
- SWF Decompiler - I Use JPEXS Free Flash Decompiler
- SWF Player (Optional: For previewing) - I use Adobe Flash Player 32 (StandAlone)
- Image Editor (Optional: For Editing Image files within the SWF) - I Use Paint.net
So you've bundled a game, transferred it to the LeapPad and the D-PAD is Unresponsive, Lopsided OR It's a mouse game but for some reason it wants you to press SPACEBAR to begin....
I've seen it, I know the pain.
If you got lucky and the D-PAD IS recognized by the game but 90degree offset that's good.
It's just LeapFrog, by fitting the D-Pad the wrong way and having their games scripted for the new directional's it would make it impossible, difficult, time consuming for someone to get unofficial games working on their system.
Case #1: Ownage - D-PAD Remap
I remember being in awe at Ownage when it first came out so when I stumbled past it again in my mega games download I had to double back and have a play and even though it needs D-PAD+1, as soon as it loaded on my laptop I badly wanted to get it to work on the LeapPad.
I opened it in FFDec and scrolled straight to the "scripts" section where I have found input binds on some other games just by looking for tags such as <Left><Right><Spacebar><Enter> but that is inefficient and as you can see doesn't always get results.
The next way I thought of was the "Text Search" function, I searched for <Left>, Left and keyPress but got no results, but the game must be getting it's inputs from somewhere, games don't just happen like that, so I looked up a table of Keyboard codes.. and started getting alot of results.
Just looking at a glimpse of the code, it was obvious why my search turned up blank so I copied the Key.isDown bit to clipboard and scratched my head. Up to now I'd only fixed a game with normal Left & Right -> LeapPad Left & Right and I used the Replace All function which wouldn't work here. (4 directions, they'd mix at some point and you'd replace ALL all of them not just all of them)
So we need to replace the input key codes to change which buttons trigger which code, (if we understand the code this would be cake..)
Start with the top search result, click edit. Now you need to remember:
- 37 "Left" and/or 65 "A" WILL BECOME 40 on the LeapPad
- 38 "Up" and/or 87 "W" WILL BECOME 37 on the LeapPad
- 39 "Right" and/or 68 "D" WILL BECOME 38 on the LeapPad
- 40 "Down" and/or 83 "S" WILL BECOME 39 on the LeapPad
Space 32 Can be Either 85 "U" or 68 "D" (Volume Keys)
Work carefully and try not to lose track of what you have changed already, you have to click save each time to save the actionscript source before you can view/edit the next on the search results list and you need to change every instance on every search result.
If you feel like you would lose track of yourself very easily like I did, there is an alternative method,
if we first remap the 4 arrow keys to different keys E.G: The Function Key in each row,
we CAN get away with using Replace All, in fact I had 4 boxes open with a different term in each, bare in mind you'll need to do 2 passes with this method and you still need to click edit, replace all x 4 and save for each actionscript on your search results but it is considerably quicker and provided its setup correctly, not prone to human error
- First Pass: remap the Controls to the function keys.
- Second Pass: remap the Controls to the LeapPad D-Pad.
At this point the game is completely mapped to the LeapPad D-PAD + Volume Key and therefore completely playable. I did make a few visual changes (E.G: Removed the keyboard buttons from the start menu sprite) but that will be covered in the next section of the guide.
Case #2: Dora, Mermaid Adventure - Visual Alteration
In this example, I'll walk you through changing a few visual elements, with a little care the same technique can be applied to alter most visual elements within SWF games.
Some games just LOOK boring...
But they don't have to look so drab:
In reality all I've changed here is the following:
- Inserted Background image.
- Inserted SF Slapstick "Dora" Font.
- Rephrased text labels to be more specific.
Adding Images.
To locate the frame that contains the Start Menu, I'm going to find a start menu button and check it's dependent frames.
Luckily, this SWF only has 2 DefineButton objects so it's easy enough to keep track of which is which and where they will be placed in the game.
Ah Frame 56, Such a drab and dreary place..
As you can see, there will only be 4 Objects placed on this frame: 2 Buttons, and 2 Text labels.
The green backdrop is actually solid Background Colour, which can be changed in the "Others>Backgroud Colour" Section.
Notice, DEPTH, an object with depth:1 is covered by an object with depth:2 and so forth.. This button needs to be raised as we'll need to use Depth:1 for our background image.
Right Click> Frame 56> Add Tag>PlaceObject2Tag... Your new blank PlaceObject2 Tag will be at the bottom of frame 56.
It doesn't contain ANY information right now so it doesn't actually place a visible object yet. But it's there..
Right Click "PlaceObject2 ()" > Raw Edit
Luckily, this SWF only has 2 DefineButton objects so it's easy enough to keep track of which is which and where they will be placed in the game.
Ah Frame 56, Such a drab and dreary place..
The green backdrop is actually solid Background Colour, which can be changed in the "Others>Backgroud Colour" Section.
Notice, DEPTH, an object with depth:1 is covered by an object with depth:2 and so forth.. This button needs to be raised as we'll need to use Depth:1 for our background image.
- Right Click "PlaceObject2 (476)"> Raw Edit
- Find the Depth property
- change it's value to 2
- Scroll up to the Shapes section and Right Click Shapes> Add Tag> DefineShape2Tag, your new blank Shape will be at the bottom of the Shapes section, in this case it's DefineShape2(480)
- Right Click DefineShape2(480)> Replace and Update Bounds... Choose your desired Background Image and it will be imported as DefineShape2(480). (I would export one of the other large background images, erase the image and keep the canvas size for my background, that way I don't have to deal with resolution and scaling.)
Right Click> Frame 56> Add Tag>PlaceObject2Tag... Your new blank PlaceObject2 Tag will be at the bottom of frame 56.
It doesn't contain ANY information right now so it doesn't actually place a visible object yet. But it's there..
Right Click "PlaceObject2 ()" > Raw Edit
- placeFlagHasCharacter=TRUE
- depth=1
- characterID=480
Changing Texts.
Changing text is easy, usually each DefineText(#) will already contain the text it will display on screen, so simply scroll through the texts until you find the string you wish to change and change it. If you're adding length to the string you may need to increase the "xmax" so all text is displayed.(If multiline = 1 you may need to increase "ymax" also)
Changing text is easy, usually each DefineText(#) will already contain the text it will display on screen, so simply scroll through the texts until you find the string you wish to change and change it. If you're adding length to the string you may need to increase the "xmax" so all text is displayed.(If multiline = 1 you may need to increase "ymax" also)
Some DefineText tags are dynamic, they usually have a variablename property, if you Search (Ctrl+F) for the variablename, you will find any occasion it is referenced or set and you can change what text is shown that way.
On occasion (Neopets) you will find a game that retrieves it's text(s) from another service (E.G: for Translations) these games will mostly display: blank text areas, NaN, undefined etc.. and simply editing the DefineText Tag isn't enough as they are set again during runtime.
I generally delete the scripts>lang, scripts>translator and scripts>core>lang
This will prevent 9/10 text(s) from being rewritten at runtime, then its just a case of working out what each text area SHOULD say and editing each DefineText tag to match(You can find out which DefineText is placed on a given frame by pausing FFDec and mouse over the DefineText, its ID is displayed in the status bar overhead.
Inserting New Font(s)
Inserting a font is very straightforward, but to optimize you SWF and save space, you only need to add the characters you're going to use, Example the title logo will only need the few characters that make up the name, menu's can get away with as few characters as g,o,b,a,c,k,n,e,x,t.
Most games will already do something like this, they may contain 1 full font((including varying symbols) especially if they have text input boxes), but for the 2 or 3 fancy fonts, they'll only have the few characters that are in use, we can add more if we already have the same font installed on our system, simply type the characters you want to add (Be CaSe SeNsIbLe.), specify Bold, Italics, etc. and click Ok.
To add a new font, Right Click Fonts> Add Tag> DefineFont2. Your new blank font is at the bottom of the Font section, Add your characters just as we did above, note you CAN mix fonts.. Lets say you want these numbers with those capital letters on a times new roman base...
![[Image: number-fonts-bshk-2.jpg]](https://bashooka.com/wp-content/uploads/2019/11/number-fonts-bshk-2.jpg)
You can do that too just add the characters from one font, then select the other font from the drop down and add the rest.
See changing text was easy, well as easy as the programmer makes it.
Case #3 - AS3, The Mother of ALL Cheat Codes
Now I took it at face value, when I read from 2 different sources that the LeapPad Supports flash up to ActionScript 2.0 and hadn't really looked much more into it, as there are thousands of games written in AS2, until today when I didn't realise the game I had loaded was written in AS3.
Freerider 2 and the way it showed me the way, upon loading Freerider on the LeapPad I noticed half of the left menu was off screen, all of the right menu was inaccessible BUT the D-PAD was already mapped perfectly.
So I broke out JPEXs FFDec and had a look to see if I could change anything, first I noticed these empty black bars on the menus which were caused by simply skipping menu entries, I moved them up so they run sequentially.
But as I scrolled through the code I noticed something about scaling:
Now I'm not an idiot but even a programmer can see that's EXACTLY what we're looking for, it doesn't matter if the screen is too big or too small, if this setting is present we can possibly make a HUGE difference. I didn't know the correct constant to use so I looked it up over at help.adobe and that presented me with 3 alternatives:
NO_SCALE : String = "noScale"
[static] Specifies that the size of the application be fixed, so that it remains unchanged even as the size of the player window changes.
I went with exactFit for this one as when I tried it with showAll the screen had vertical borders pushing the menus into the middle of the screen, I think it looks great, gets a bit weird if you're doing flips you can see the rider stretch width-ways slightly as he rotates but an absolute classic of a game, barely workable with the LeapPad touchscreen so I've pre-pasted the code for Halfpipe into the Load Map textbox so you don't have to draw your own track and balls if you don't want to.
Code:
Stage.scaleMode = "noScale";
Now I'm not an idiot but even a programmer can see that's EXACTLY what we're looking for, it doesn't matter if the screen is too big or too small, if this setting is present we can possibly make a HUGE difference. I didn't know the correct constant to use so I looked it up over at help.adobe and that presented me with 3 alternatives:
- EXACT_FIT : String = "exactFit"
- NO_BORDER : String = "noBorder"
- SHOW_ALL : String = "showAll"
NO_SCALE : String = "noScale"
[static] Specifies that the size of the application be fixed, so that it remains unchanged even as the size of the player window changes.
I went with exactFit for this one as when I tried it with showAll the screen had vertical borders pushing the menus into the middle of the screen, I think it looks great, gets a bit weird if you're doing flips you can see the rider stretch width-ways slightly as he rotates but an absolute classic of a game, barely workable with the LeapPad touchscreen so I've pre-pasted the code for Halfpipe into the Load Map textbox so you don't have to draw your own track and balls if you don't want to.
Enjoy!