Development

From RocketLauncher Wiki
Revision as of 13:35, 31 January 2015 by Kevinlives (talk | contribs)
Jump to navigation Jump to search
Contents


1 Creating your own functions

1.1 Lib\User Functions Init.ahk
1.2 Lib\User Functions.ahk
1.2.1 StartGlobalUserFeatures()
1.2.2 StopGlobalUserFeatures()
1.3 Don't Repeat Yourself

2 HyperLaunch.dll

2.1 checkModuleCRC
2.2 set7zdllPath
2.3 findFileInZip
2.4 findByExtension
2.5 getZipExtractedSize
2.6 getExtractionSize
2.7 getExtractionProgress
2.8 getFolderSize
2.9 getLongestPathSize
2.10 getZipFileList
2.11 getZipFileCount
2.12 checkInvalidCharacters
2.13 getConnectedJoysticks
2.14 getPdfPageCount
2.15 generatePngFromPdf
2.16 setLogMode




Creating Your Own Functions

  • You can add your own functions and code to affect every module
  • You have 2 functions in your \Lib folder called User Functions Init.ahk and User Functions.ahk


Lib\User Functions Init.ahk

  • This should contain any code you want to "Run" with the modules. This is where you place code you might need to setup or initialize something you want to run later. Take a look at and of the other Init ahks to see how these files are used.
  • DO NOT place any Functions or Labels in this file, it will lock up the thread and give the appearance it froze when it's actually stuck in your function not knowing what to do.
  • This file will "Run" before StartModule() found in each module. For example, if you place this script in this file: "MsgBox test", it will show a msgbox on launch of every emulator.
  • So you can see why it's important you place only script you feel is required for every module.


Lib\User Functions.ahk

  • This should contain any Functions and Labels that are called within the module itself. Take a look at and of the other non-Init ahks to see how these files are used.
  • If you create a function that looks like this:
MyFunc(text){
 MsgBox, %text%
}


  • Then in the module place this line anywhere you want: "MyFunc("Hello World")", it will show you the msgbox at that specific spot.


StartGlobalUserFeatures()

  • This function has already been created for you in Lib\User Functions.ahk.
  • Place any ahk code in the space provided and it will be launched at the beginning of every module, before the emulator runs.


StopGlobalUserFeatures()

  • This function has already been created for you in Lib\User Functions.ahk.
  • Place any ahk code in the space provided and it will be launched at the end of every module, after the emulator is closed, but before the module thread exits.



Don't Repeat Yourself

  • A very good rule of thumb to follow is something called DRY: http://en.wikipedia.org/wiki/Don't_repeat_yourself
  • When you create your own code, and you need to go back and change something, if you did not follow the above principles, you might not remember to change all instances of something.




HyperLaunch.dll

This dll provides some critical functions to get many of the features working. To utilize it, we have to first create a com object, then pass that along with what we want the dll to do.