Skip to content

Instantly share code, notes, and snippets.

@stmobo
Created September 27, 2018 07:12
Show Gist options
  • Save stmobo/09699e54d74cd3fa2c09f6516b676a8b to your computer and use it in GitHub Desktop.
Save stmobo/09699e54d74cd3fa2c09f6516b676a8b to your computer and use it in GitHub Desktop.
Tips on porting KisekaeLocal using JPEXS and the AIRSDK.
For future reference, this is how I updated KKL using the previous KKL version (v68) and the latest Kisekae from online:
- Grab k_kisekae2.swf and all of the other swfs loaded by it first. Each file you'll need to grab corresponds to an entry in Main.loadName or Main.loadItemName within k_kisekae2.swf.
(All of the subordinate swf files can be found under http://pochi.lix.jp/k_kisekae2_swf/ -- you can simply wget them or similar. They'll go into a local k_kisekae2_swf directory.)
- Take a copy of the previous KKL version and replace its version of k_kisekae2.swf with the latest version, then open it and kkl.swf up in JPEXS.
- Start by updating Main.version, Main.loadName, and Main.loadItemName in kkl.swf to match k_kisekae2.swf.
(This should just involve simple copy-pasting of P-code from k_kisekae2.swf to kkl.swf.)
- From there, it's a cycle of: attempt to run KKL > see what causes errors > fix said errors > repeat
- The AIRSDK includes a tool called `adl`. It'll allow you to run KKL in debugging mode (so you can get trace() output and error stack traces and etc) and you can download it for free.
- Move the `application.xml` file (in the META-INF/AIR directory) up to the main KKL directory when running via adl.
- Set ErrorReportingEnable=1 in mm.cfg (in the same directory as kkl.exe-- create it if necessary) to enable trace output.
- KKL crashes during porting are often due to:
* Missing methods and properties on Main (JPEXS can add new Traits / properties to fix this. Make sure you set added properties to be `static`!)
* Attempts to reference undefined classes when initializing Main because class names got shifted around in k_kisekae2.swf (just delete the offending code)
Helpful P-code snippets (JPEXS):
[Basic trace]
findpropstrict Qname(PackageNamespace(""),"trace")
pushstring "this.DataSetting trace 2"
callproperty Qname(PackageNamespace(""),"trace") 1
pop
[Print Error Stacktrace]
findpropstrict Qname(PackageNamespace(""),"trace")
pushstring "Error occured:"
getscopeobject 2
getslot 1
callproperty Qname(PackageNamespace(""),"getStackTrace") 0
callproperty Qname(PackageNamespace(""),"trace") 2
pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment