├── app
├── .gitignore
├── libs
│ └── kamome.aar
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── themes.xml
│ │ │ │ └── colors.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-anydpi
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── xml
│ │ │ │ ├── backup_rules.xml
│ │ │ │ └── data_extraction_rules.xml
│ │ │ └── drawable
│ │ │ │ ├── ic_launcher_foreground.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── assets
│ │ │ ├── media
│ │ │ │ ├── boss.webm
│ │ │ │ ├── hey.webm
│ │ │ │ ├── nuke.webm
│ │ │ │ ├── spin.webm
│ │ │ │ ├── tada.webm
│ │ │ │ ├── bonus1.webm
│ │ │ │ ├── bonus2.webm
│ │ │ │ ├── lands.webm
│ │ │ │ ├── BGSonglp2.webm
│ │ │ │ ├── Crash (1).webm
│ │ │ │ ├── Crash (4).webm
│ │ │ │ ├── Crash (5).webm
│ │ │ │ ├── Crash (7).webm
│ │ │ │ ├── Crash (9).webm
│ │ │ │ ├── Drop (1).webm
│ │ │ │ ├── Drop (2).webm
│ │ │ │ ├── Drop (4).webm
│ │ │ │ ├── Drop (6).webm
│ │ │ │ ├── Fail (5).webm
│ │ │ │ ├── Food (4).webm
│ │ │ │ ├── Laser (5).webm
│ │ │ │ ├── Laser (6).webm
│ │ │ │ ├── Laser (8).webm
│ │ │ │ ├── bass_drum.webm
│ │ │ │ ├── boss_hit.webm
│ │ │ │ ├── gameover.webm
│ │ │ │ ├── Crash (10).webm
│ │ │ │ ├── Upgrade (1).webm
│ │ │ │ ├── Upgrade (5).webm
│ │ │ │ ├── Upgrade (9).webm
│ │ │ │ ├── explosion1.webm
│ │ │ │ ├── fall_whistle.webm
│ │ │ │ └── water-splash1.webm
│ │ │ ├── fonts
│ │ │ │ └── Supply Center.otf
│ │ │ ├── images
│ │ │ │ ├── enemy-sheet0.png
│ │ │ │ ├── hero-sheet0.png
│ │ │ │ ├── bosshp-sheet0.png
│ │ │ │ ├── explode-sheet0.png
│ │ │ │ ├── explode-sheet1.png
│ │ │ │ ├── explode-sheet2.png
│ │ │ │ ├── explode-sheet3.png
│ │ │ │ ├── shared-0-sheet0.jpg
│ │ │ │ ├── shared-0-sheet1.png
│ │ │ │ ├── shared-0-sheet10.png
│ │ │ │ ├── shared-0-sheet2.png
│ │ │ │ ├── shared-0-sheet3.jpg
│ │ │ │ ├── shared-0-sheet4.png
│ │ │ │ ├── shared-0-sheet5.jpg
│ │ │ │ ├── shared-0-sheet6.png
│ │ │ │ ├── shared-0-sheet7.jpg
│ │ │ │ ├── shared-0-sheet8.png
│ │ │ │ ├── shared-0-sheet9.jpg
│ │ │ │ ├── explodetube-sheet0.png
│ │ │ │ ├── explodetube-sheet1.png
│ │ │ │ ├── explodetube-sheet2.png
│ │ │ │ ├── lazerblocker-sheet0.png
│ │ │ │ ├── nextitempreview-sheet0.png
│ │ │ │ ├── tiledbackground-sheet0.png
│ │ │ │ ├── tutorialoverlay-sheet0.jpg
│ │ │ │ ├── bombpupupoverlay-sheet0.png
│ │ │ │ └── tiledbackground2-sheet0.png
│ │ │ ├── scripts
│ │ │ │ ├── opus.wasm.wasm
│ │ │ │ ├── modernjscheck.js
│ │ │ │ ├── project
│ │ │ │ │ ├── importsForEvents.js
│ │ │ │ │ └── main.js
│ │ │ │ ├── register-sw.js
│ │ │ │ ├── offlineclient.js
│ │ │ │ ├── supportcheck.js
│ │ │ │ ├── jobworker.js
│ │ │ │ ├── kamome.min.js
│ │ │ │ ├── dispatchworker.js
│ │ │ │ └── opus.wasm.js
│ │ │ ├── appmanifest.json
│ │ │ ├── index.html
│ │ │ ├── offline.json
│ │ │ ├── config.json
│ │ │ ├── style.css
│ │ │ └── sw.js
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── hsgame
│ │ │ │ ├── ui
│ │ │ │ └── theme
│ │ │ │ │ ├── Color.kt
│ │ │ │ │ ├── Type.kt
│ │ │ │ │ └── Theme.kt
│ │ │ │ ├── LocalWebServer.kt
│ │ │ │ └── MainActivity.kt
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── hsgame
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── hsgame
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle.kts
├── .idea
├── .gitignore
├── codeStyles
│ ├── codeStyleConfig.xml
│ └── Project.xml
├── compiler.xml
├── vcs.xml
├── kotlinc.xml
├── migrations.xml
├── misc.xml
├── deploymentTargetSelector.xml
├── gradle.xml
└── inspectionProfiles
│ └── Project_Default.xml
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── libs.versions.toml
├── .gitignore
├── settings.gradle.kts
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/app/libs/kamome.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/libs/kamome.aar
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | HSGame
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/assets/media/boss.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/boss.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/hey.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/hey.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/nuke.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/nuke.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/spin.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/spin.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/tada.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/tada.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/bonus1.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/bonus1.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/bonus2.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/bonus2.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/lands.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/lands.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/BGSonglp2.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/BGSonglp2.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Crash (1).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Crash (1).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Crash (4).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Crash (4).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Crash (5).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Crash (5).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Crash (7).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Crash (7).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Crash (9).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Crash (9).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Drop (1).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Drop (1).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Drop (2).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Drop (2).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Drop (4).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Drop (4).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Drop (6).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Drop (6).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Fail (5).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Fail (5).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Food (4).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Food (4).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Laser (5).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Laser (5).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Laser (6).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Laser (6).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Laser (8).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Laser (8).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/bass_drum.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/bass_drum.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/boss_hit.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/boss_hit.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/gameover.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/gameover.webm
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/Supply Center.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/fonts/Supply Center.otf
--------------------------------------------------------------------------------
/app/src/main/assets/images/enemy-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/enemy-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/hero-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/hero-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/media/Crash (10).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Crash (10).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Upgrade (1).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Upgrade (1).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Upgrade (5).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Upgrade (5).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/Upgrade (9).webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/Upgrade (9).webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/explosion1.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/explosion1.webm
--------------------------------------------------------------------------------
/app/src/main/assets/media/fall_whistle.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/fall_whistle.webm
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/opus.wasm.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/scripts/opus.wasm.wasm
--------------------------------------------------------------------------------
/app/src/main/assets/images/bosshp-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/bosshp-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/explode-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/explode-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/explode-sheet1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/explode-sheet1.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/explode-sheet2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/explode-sheet2.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/explode-sheet3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/explode-sheet3.png
--------------------------------------------------------------------------------
/app/src/main/assets/media/water-splash1.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/media/water-splash1.webm
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet0.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet1.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet10.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet2.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet3.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet4.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet5.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet6.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet7.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet8.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/shared-0-sheet9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/shared-0-sheet9.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/assets/images/explodetube-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/explodetube-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/explodetube-sheet1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/explodetube-sheet1.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/explodetube-sheet2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/explodetube-sheet2.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/lazerblocker-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/lazerblocker-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/modernjscheck.js:
--------------------------------------------------------------------------------
1 | 'use strict';(function(){let pass=true;if((null??2)!==2)pass=false;if(pass)window["C3_ModernJSSupport_OK"]=true})();
2 |
--------------------------------------------------------------------------------
/app/src/main/assets/images/nextitempreview-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/nextitempreview-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/tiledbackground-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/tiledbackground-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/tutorialoverlay-sheet0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/tutorialoverlay-sheet0.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/assets/images/bombpupupoverlay-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/bombpupupoverlay-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/assets/images/tiledbackground2-sheet0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/assets/images/tiledbackground2-sheet0.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gritsenko/Html5AndroidWrapper/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/project/importsForEvents.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Put imports here that you wish to use for script blocks in event sheets, e.g.:
3 | // @ts-ignore
4 | import * as bridge from "./instant-games-bridge.js";
5 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Aug 30 21:34:06 MSK 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/.idea/migrations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/register-sw.js:
--------------------------------------------------------------------------------
1 | 'use strict';{window.C3_RegisterSW=async function C3_RegisterSW(){if(!navigator.serviceWorker)return;try{const reg=await navigator.serviceWorker.register("sw.js",{scope:"./"});console.info("Registered service worker on "+reg.scope)}catch(err){console.warn("Failed to register service worker: ",err)}}};
2 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/hsgame/ui/theme/Color.kt:
--------------------------------------------------------------------------------
1 | package com.example.hsgame.ui.theme
2 |
3 | import androidx.compose.ui.graphics.Color
4 |
5 | val Purple80 = Color(0xFFD0BCFF)
6 | val PurpleGrey80 = Color(0xFFCCC2DC)
7 | val Pink80 = Color(0xFFEFB8C8)
8 |
9 | val Purple40 = Color(0xFF6650a4)
10 | val PurpleGrey40 = Color(0xFF625b71)
11 | val Pink40 = Color(0xFF7D5260)
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/hsgame/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.hsgame
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/assets/appmanifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Monkey Business Juicy Rush",
3 | "short_name": "Monkey Business Juicy Rush",
4 | "description": "A Tower Defense adventure!\n\nPlay as Jackie the monkey and rack up those points! \nIt won't be easy though.\nSometimes, you'll need to think outside the banana peel and target enemies that aren't right in your face. \nUse your monkey smarts!",
5 | "start_url": "index.html",
6 | "display": "fullscreen",
7 | "orientation": "portrait",
8 | "background_color": "#ffffff",
9 | "icons": [],
10 | "screenshots": []
11 | }
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/offlineclient.js:
--------------------------------------------------------------------------------
1 | 'use strict';{class OfflineClient{constructor(){this._broadcastChannel=typeof BroadcastChannel==="undefined"?null:new BroadcastChannel("offline");this._queuedMessages=[];this._onMessageCallback=null;if(this._broadcastChannel)this._broadcastChannel.onmessage=e=>this._OnBroadcastChannelMessage(e)}_OnBroadcastChannelMessage(e){if(this._onMessageCallback){this._onMessageCallback(e);return}this._queuedMessages.push(e)}SetMessageCallback(f){this._onMessageCallback=f;for(let e of this._queuedMessages)this._onMessageCallback(e);
2 | this._queuedMessages.length=0}}window.OfflineClientInfo=new OfflineClient};
3 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google {
4 | content {
5 | includeGroupByRegex("com\\.android.*")
6 | includeGroupByRegex("com\\.google.*")
7 | includeGroupByRegex("androidx.*")
8 | }
9 | }
10 | mavenCentral()
11 | gradlePluginPortal()
12 | }
13 | }
14 | dependencyResolutionManagement {
15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
16 | repositories {
17 | google()
18 | mavenCentral()
19 | }
20 | }
21 |
22 | rootProject.name = "HSGame"
23 | include(":app")
24 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/.idea/deploymentTargetSelector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/hsgame/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.hsgame
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.example.hsgame", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/java/com/example/hsgame/ui/theme/Type.kt:
--------------------------------------------------------------------------------
1 | package com.example.hsgame.ui.theme
2 |
3 | import androidx.compose.material3.Typography
4 | import androidx.compose.ui.text.TextStyle
5 | import androidx.compose.ui.text.font.FontFamily
6 | import androidx.compose.ui.text.font.FontWeight
7 | import androidx.compose.ui.unit.sp
8 |
9 | // Set of Material typography styles to start with
10 | val Typography = Typography(
11 | bodyLarge = TextStyle(
12 | fontFamily = FontFamily.Default,
13 | fontWeight = FontWeight.Normal,
14 | fontSize = 16.sp,
15 | lineHeight = 24.sp,
16 | letterSpacing = 0.5.sp
17 | )
18 | /* Other default text styles to override
19 | titleLarge = TextStyle(
20 | fontFamily = FontFamily.Default,
21 | fontWeight = FontWeight.Normal,
22 | fontSize = 22.sp,
23 | lineHeight = 28.sp,
24 | letterSpacing = 0.sp
25 | ),
26 | labelSmall = TextStyle(
27 | fontFamily = FontFamily.Default,
28 | fontWeight = FontWeight.Medium,
29 | fontSize = 11.sp,
30 | lineHeight = 16.sp,
31 | letterSpacing = 0.5.sp
32 | )
33 | */
34 | )
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. For more details, visit
12 | # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
18 |
19 |
22 |
23 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/assets/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Monkey Business Juicy Rush
6 |
7 |
8 |
9 |
10 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
This content requires JavaScript
35 |
JavaScript appears to be disabled. Please enable it to view this content.
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/assets/offline.json:
--------------------------------------------------------------------------------
1 | {"version":1725745173206,"fileList":["scripts/c3runtime.js","data.json","style.css","scripts/modernjscheck.js","scripts/offlineclient.js","images/tutorialoverlay-sheet0.jpg","images/lazerblocker-sheet0.png","images/bosshp-sheet0.png","images/tiledbackground-sheet0.png","images/tiledbackground2-sheet0.png","images/bombpupupoverlay-sheet0.png","images/enemy-sheet0.png","images/explodetube-sheet2.png","images/shared-0-sheet5.jpg","images/shared-0-sheet7.jpg","images/explodetube-sheet1.png","images/explode-sheet2.png","images/explode-sheet1.png","images/shared-0-sheet10.png","images/shared-0-sheet8.png","images/shared-0-sheet9.jpg","images/explodetube-sheet0.png","images/explode-sheet3.png","images/nextitempreview-sheet0.png","images/explode-sheet0.png","images/shared-0-sheet0.jpg","images/shared-0-sheet3.jpg","images/hero-sheet0.png","images/shared-0-sheet4.png","images/shared-0-sheet6.png","images/shared-0-sheet1.png","images/shared-0-sheet2.png","scripts/opus.wasm.js","scripts/opus.wasm.wasm","scripts/main.js","scripts/dispatchworker.js","scripts/jobworker.js","scripts/supportcheck.js","scripts/project/main.js","scripts/project/importsForEvents.js","scripts/project/scriptsInEvents.js","fonts/Supply Center.otf","config.json","media/bass_drum.webm","media/BGSonglp2.webm","media/bonus1.webm","media/bonus2.webm","media/boss.webm","media/boss_hit.webm","media/Crash (1).webm","media/Crash (10).webm","media/Crash (4).webm","media/Crash (5).webm","media/Crash (7).webm","media/Crash (9).webm","media/Drop (1).webm","media/Drop (2).webm","media/Drop (4).webm","media/Drop (6).webm","media/explosion1.webm","media/Fail (5).webm","media/fall_whistle.webm","media/Food (4).webm","media/gameover.webm","media/hey.webm","media/lands.webm","media/Laser (5).webm","media/Laser (6).webm","media/Laser (8).webm","media/nuke.webm","media/spin.webm","media/tada.webm","media/Upgrade (1).webm","media/Upgrade (5).webm","media/Upgrade (9).webm","media/water-splash1.webm","scripts/register-sw.js"]}
--------------------------------------------------------------------------------
/app/src/main/java/com/example/hsgame/ui/theme/Theme.kt:
--------------------------------------------------------------------------------
1 | package com.example.hsgame.ui.theme
2 |
3 | import android.app.Activity
4 | import android.os.Build
5 | import androidx.compose.foundation.isSystemInDarkTheme
6 | import androidx.compose.material3.MaterialTheme
7 | import androidx.compose.material3.darkColorScheme
8 | import androidx.compose.material3.dynamicDarkColorScheme
9 | import androidx.compose.material3.dynamicLightColorScheme
10 | import androidx.compose.material3.lightColorScheme
11 | import androidx.compose.runtime.Composable
12 | import androidx.compose.ui.platform.LocalContext
13 |
14 | private val DarkColorScheme = darkColorScheme(
15 | primary = Purple80,
16 | secondary = PurpleGrey80,
17 | tertiary = Pink80
18 | )
19 |
20 | private val LightColorScheme = lightColorScheme(
21 | primary = Purple40,
22 | secondary = PurpleGrey40,
23 | tertiary = Pink40
24 |
25 | /* Other default colors to override
26 | background = Color(0xFFFFFBFE),
27 | surface = Color(0xFFFFFBFE),
28 | onPrimary = Color.White,
29 | onSecondary = Color.White,
30 | onTertiary = Color.White,
31 | onBackground = Color(0xFF1C1B1F),
32 | onSurface = Color(0xFF1C1B1F),
33 | */
34 | )
35 |
36 | @Composable
37 | fun HSGameTheme(
38 | darkTheme: Boolean = isSystemInDarkTheme(),
39 | // Dynamic color is available on Android 12+
40 | dynamicColor: Boolean = true,
41 | content: @Composable () -> Unit
42 | ) {
43 | val colorScheme = when {
44 | dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
45 | val context = LocalContext.current
46 | if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
47 | }
48 |
49 | darkTheme -> DarkColorScheme
50 | else -> LightColorScheme
51 | }
52 |
53 | MaterialTheme(
54 | colorScheme = colorScheme,
55 | typography = Typography,
56 | content = content
57 | )
58 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/hsgame/LocalWebServer.kt:
--------------------------------------------------------------------------------
1 | import android.content.Context
2 | import fi.iki.elonen.NanoHTTPD
3 | import fi.iki.elonen.NanoHTTPD.newFixedLengthResponse
4 |
5 | class LocalWebServer(private val context: Context) : NanoHTTPD(8080) {
6 |
7 | override fun serve(session: IHTTPSession?): Response {
8 | val uri = session?.uri ?: return newFixedLengthResponse(Response.Status.NOT_FOUND, "text/plain", "Not Found")
9 |
10 | // Remove leading slash if present
11 | val filePath = uri.trimStart('/')
12 |
13 | return try {
14 | // Open the file from the assets folder, including nested directories
15 | val inputStream = context.assets.open(filePath)
16 | val mimeType = getMimeType(filePath)
17 | newFixedLengthResponse(Response.Status.OK, mimeType, inputStream, inputStream.available().toLong())
18 | } catch (e: Exception) {
19 | newFixedLengthResponse(Response.Status.NOT_FOUND, "text/plain", "File Not Found: $filePath")
20 | }
21 | }
22 |
23 | // Determine MIME type based on file extension
24 | private fun getMimeType(path: String): String {
25 | return when {
26 | path.endsWith(".html") -> "text/html"
27 | path.endsWith(".js") -> "application/javascript"
28 | path.endsWith(".css") -> "text/css"
29 | path.endsWith(".json") -> "application/json"
30 | path.endsWith(".png") -> "image/png"
31 | path.endsWith(".jpg") || path.endsWith(".jpeg") -> "image/jpeg"
32 | path.endsWith(".webp") -> "image/webp"
33 | path.endsWith(".webm") -> "video/webm" // For video/audio webm files
34 | path.endsWith(".mp3") -> "audio/mpeg"
35 | path.endsWith(".wav") -> "audio/wav"
36 | path.endsWith(".ogg") -> "audio/ogg"
37 | else -> "application/octet-stream" // Generic binary stream for unknown files
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/app/src/main/assets/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "feed": [ 3,4,1,4,3
3 | ],
4 | "baseTimeScale" : 1,
5 | "showDebugInfo" : 0,
6 | "newItemsRate": 0.5,
7 | "turretLevelMultiplier" : 0.8,
8 | "laserLevelMultiplier" : 0.7,
9 | "levelMultiplier" : 0.1,
10 | "hitScore" : 10,
11 | "bombRangeX" : 538,
12 | "bombRangeY" : 366,
13 | "upgradeBasketCapacity" : 9999,
14 | "killsToBoss" : 7,
15 | "enemies" : [
16 | {
17 | "index": 0,
18 | "len": 7,
19 | "frame": 0,
20 | "hp": 20,
21 | "isBonus": false,
22 | "score" : 20,
23 | "color" : "pink"
24 | },
25 | {
26 | "index": 1,
27 | "len": 6,
28 | "frame": 1,
29 | "hp": 40,
30 | "isBonus": false,
31 | "score" : 30,
32 | "color" : "blue"
33 | },
34 | {
35 | "index": 2,
36 | "len": 5,
37 | "frame": 2,
38 | "hp": 80,
39 | "isBonus": false,
40 | "score" : 40,
41 | "color" : "green"
42 | },
43 | {
44 | "index": 3,
45 | "len": 4,
46 | "frame": 3,
47 | "hp": 100,
48 | "isBonus": false,
49 | "score" : 50,
50 | "color" : "yellow"
51 | },
52 | {
53 | "index": 4,
54 | "len": 3,
55 | "frame": 4,
56 | "hp": 120,
57 | "isBonus": false,
58 | "score" : 60,
59 | "color" : "orange"
60 | },
61 | {
62 | "index": 5,
63 | "len": 3,
64 | "frame": 0,
65 | "hp": 50,
66 | "isBonus": true,
67 | "bonusType": "BonusCrio",
68 | "score" : 20
69 | },
70 | {
71 | "index": 6,
72 | "len": 3,
73 | "frame": 0,
74 | "hp": 50,
75 | "isBonus": true,
76 | "bonusType": "BonsuBomb",
77 | "score" : 20
78 | },
79 | {
80 | "index": 7,
81 | "len": 3,
82 | "frame": 0,
83 | "hp": 50,
84 | "isBonus": true,
85 | "bonusType": "BonsuPack",
86 | "score" : 20
87 | },
88 | {
89 | "index": 8,
90 | "len": 3,
91 | "frame": 0,
92 | "hp": 50,
93 | "isBonus": true,
94 | "bonusType": "BonsuShock",
95 | "score" : 20
96 | },
97 | {
98 | "index": 9,
99 | "len": 3,
100 | "frame": 0,
101 | "hp": 50,
102 | "isBonus": true,
103 | "bonusType": "SuperBonusPack",
104 | "score" : 100
105 | }
106 | ]
107 | }
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.6.0"
3 | kamome = "5.3.4"
4 | kotlin = "1.9.0"
5 | coreKtx = "1.10.1"
6 | junit = "4.13.2"
7 | junitVersion = "1.1.5"
8 | espressoCore = "3.5.1"
9 | lifecycleRuntimeKtx = "2.6.1"
10 | activityCompose = "1.8.0"
11 | composeBom = "2024.04.01"
12 | nanohttpd = "2.3.1"
13 | playServicesAds = "23.3.0"
14 | playServicesAdsVersion = "22.3.0"
15 |
16 | [libraries]
17 | androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
18 | junit = { group = "junit", name = "junit", version.ref = "junit" }
19 | androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
20 | androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
21 | androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
22 | androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
23 | androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
24 | androidx-ui = { group = "androidx.compose.ui", name = "ui" }
25 | androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
26 | androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
27 | androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
28 | androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
29 | androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
30 | androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
31 | kamome = { module = "jp.hituzi:kamome", version.ref = "kamome" }
32 | nanohttpd = { module = "org.nanohttpd:nanohttpd", version.ref = "nanohttpd" }
33 | play-services-ads = { module = "com.google.android.gms:play-services-ads", version.ref = "playServicesAds" }
34 | play-services-ads-v2230 = { module = "com.google.android.gms:play-services-ads", version.ref = "playServicesAdsVersion" }
35 |
36 | [plugins]
37 | android-application = { id = "com.android.application", version.ref = "agp" }
38 | kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
39 |
40 |
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | alias(libs.plugins.android.application)
3 | alias(libs.plugins.kotlin.android)
4 | }
5 |
6 | android {
7 | namespace = "com.example.hsgame"
8 | compileSdk = 34
9 |
10 | defaultConfig {
11 | applicationId = "com.example.hsgame"
12 | minSdk = 26
13 | targetSdk = 34
14 | versionCode = 1
15 | versionName = "1.0"
16 |
17 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18 | vectorDrawables {
19 | useSupportLibrary = true
20 | }
21 | }
22 | sourceSets {
23 | getByName("main") {
24 | jniLibs.srcDirs("libs")
25 | }
26 | }
27 | buildTypes {
28 | release {
29 | isMinifyEnabled = false
30 | proguardFiles(
31 | getDefaultProguardFile("proguard-android-optimize.txt"),
32 | "proguard-rules.pro"
33 | )
34 | }
35 | }
36 | compileOptions {
37 | sourceCompatibility = JavaVersion.VERSION_1_8
38 | targetCompatibility = JavaVersion.VERSION_1_8
39 | }
40 | kotlinOptions {
41 | jvmTarget = "1.8"
42 | }
43 | buildFeatures {
44 | compose = true
45 | }
46 | composeOptions {
47 | kotlinCompilerExtensionVersion = "1.5.1"
48 | }
49 | packaging {
50 | resources {
51 | excludes += "/META-INF/{AL2.0,LGPL2.1}"
52 | }
53 | }
54 | }
55 |
56 | dependencies {
57 |
58 | implementation(libs.androidx.core.ktx)
59 | implementation(libs.androidx.lifecycle.runtime.ktx)
60 | implementation(libs.androidx.activity.compose)
61 | implementation(platform(libs.androidx.compose.bom))
62 | implementation(libs.androidx.ui)
63 | implementation(libs.androidx.ui.graphics)
64 | implementation(libs.androidx.ui.tooling.preview)
65 | implementation(libs.androidx.material3)
66 | implementation(files("libs/kamome.aar"))
67 | implementation(libs.nanohttpd)
68 | implementation(libs.play.services.ads)
69 | testImplementation(libs.junit)
70 | androidTestImplementation(libs.androidx.junit)
71 | androidTestImplementation(libs.androidx.espresso.core)
72 | androidTestImplementation(platform(libs.androidx.compose.bom))
73 | androidTestImplementation(libs.androidx.ui.test.junit4)
74 | debugImplementation(libs.androidx.ui.tooling)
75 | debugImplementation(libs.androidx.ui.test.manifest)
76 | }
--------------------------------------------------------------------------------
/app/src/main/assets/style.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | padding: 0;
3 | margin: 0;
4 | overflow: hidden;
5 | height: 100%;
6 | }
7 |
8 | body {
9 | background: #000000;
10 | color: white;
11 | }
12 |
13 | html, body, canvas {
14 | touch-action-delay: none;
15 | touch-action: none;
16 | }
17 |
18 | canvas, .c3htmlwrap {
19 | position: absolute;
20 | }
21 |
22 | .c3htmlwrap {
23 | contain: strict;
24 | }
25 |
26 | .c3overlay {
27 | pointer-events: none;
28 | }
29 |
30 | .c3htmlwrap > * {
31 | pointer-events: auto;
32 | }
33 |
34 | /* HACK - work around elements being selectable only in iOS WKWebView for some reason */
35 | html[ioswebview] .c3htmlwrap,
36 | html[ioswebview] canvas {
37 | -webkit-user-select: none;
38 | user-select: none;
39 | }
40 |
41 | html[ioswebview] .c3htmlwrap > * {
42 | -webkit-user-select: auto;
43 | user-select: auto;
44 | }
45 |
46 | #notSupportedWrap {
47 | margin: 2em auto 1em auto;
48 | width: 75%;
49 | max-width: 45em;
50 | border: 2px solid #aaa;
51 | border-radius: 1em;
52 | padding: 2em;
53 | background-color: #f0f0f0;
54 | font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
55 | color: black;
56 | }
57 |
58 | #notSupportedTitle {
59 | font-size: 1.8em;
60 | }
61 |
62 | .notSupportedMessage {
63 | font-size: 1.2em;
64 | }
65 |
66 | .notSupportedMessage em {
67 | color: #888;
68 | }
69 |
70 | /* bbcode styles */
71 | .bbCodeH1 {
72 | font-size: 2em;
73 | font-weight: bold;
74 | }
75 |
76 | .bbCodeH2 {
77 | font-size: 1.5em;
78 | font-weight: bold;
79 | }
80 |
81 | .bbCodeH3 {
82 | font-size: 1.25em;
83 | font-weight: bold;
84 | }
85 |
86 | .bbCodeH4 {
87 | font-size: 1.1em;
88 | font-weight: bold;
89 | }
90 |
91 | .bbCodeItem::before {
92 | content: " • ";
93 | }
94 |
95 | /* For text icons converted to HTML: size the height to the line height
96 | preserving the aspect ratio. Also add position: relative as that allows
97 | just adding a 'top' style for the iconoffsety style. */
98 | .c3-text-icon {
99 | height: 1em;
100 | width: auto;
101 | position: relative;
102 | }
103 |
104 | /* screen reader text */
105 | .c3-screen-reader-text {
106 | position: absolute;
107 | width: 1px;
108 | height: 1px;
109 | overflow: hidden;
110 | clip: rect(1px, 1px, 1px, 1px);
111 | }
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/supportcheck.js:
--------------------------------------------------------------------------------
1 | 'use strict';(function(){var isKasperskyScriptInjected=!!document.querySelector('script[src*="kaspersky"]');var tmpCanvas=document.createElement("canvas");var hasWebGL=!!tmpCanvas.getContext("webgl");var missingFeatures=[];if(!hasWebGL)missingFeatures.push("WebGL");if(typeof WebAssembly==="undefined")missingFeatures.push("WebAssembly");if(!("noModule"in HTMLScriptElement.prototype))missingFeatures.push("JavaScript Modules");if(!window["C3_ModernJSSupport_OK"])missingFeatures.push("Modern JavaScript support");
2 | if(missingFeatures.length===0&&!isKasperskyScriptInjected)window["C3_Is_Supported"]=true;else{var msgWrap=document.createElement("div");msgWrap.id="notSupportedWrap";document.body.appendChild(msgWrap);var msgTitle=document.createElement("h2");msgTitle.id="notSupportedTitle";if(isKasperskyScriptInjected)msgTitle.textContent="Kaspersky Internet Security broke this export";else msgTitle.textContent="Software update needed";msgWrap.appendChild(msgTitle);var msgBody=document.createElement("p");msgBody.className=
3 | "notSupportedMessage";var msgText="This content is not supported because your device's software appears to be out-of-date. ";var ua=navigator.userAgent;if(/android/i.test(ua))msgText+=' On Android, fix this by making sure the Android System Webview app has updates enabled and is up-to-date.';else if(/iphone|ipad|ipod/i.test(ua)){msgText+="Alternatively if Lockdown mode is enabled, try turning it off to view this content.";
4 | msgText+=" Note: using the iOS simulator requires Xcode 12+ . Otherwise try testing on a real device instead."}else if(/msie/i.test(ua)||/trident/i.test(ua)||/edge\//i.test(ua))msgText+=" Note: Internet Explorer and the legacy Edge browser are not supported. Try using Chrome or Firefox instead.";else if(isKasperskyScriptInjected)msgText=
5 | "It appears a script was added to this export by Kaspersky software. This prevents the exported project from working. Try disabling Kaspersky and exporting again.";else msgText+="Try installing any available software updates. Alternatively try on a different device.";msgText+="Missing features: "+missingFeatures.join(", ")+" User agent: "+navigator.userAgent+" ";msgBody.innerHTML=msgText;msgWrap.appendChild(msgBody)}})();
6 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/jobworker.js:
--------------------------------------------------------------------------------
1 | 'use strict';self.dispatchPort=null;self.outputPort=null;self.workerNumber=-1;self.activeJobId=null;self.sentBlobs=new Map;self.sentBuffers=new Map;self.JobHandlers={};
2 | function FlipImageData(data,width,height){const stride=width*4;const tempRow=new Uint8Array(stride);const imageBuffer=data.buffer;for(let topY=0,len=Math.floor(height/2);topY{const msg=e.data;const type=msg["type"];switch(type){case "init":self.workerNumber=msg["number"];self.dispatchPort=msg["dispatch-port"];self.dispatchPort.onmessage=OnDispatchWorkerMessage;self.outputPort=msg["output-port"];return;case "terminate":self.close();return;default:console.error("unknown message '"+type+"'");return}});function SendReady(){self.dispatchPort.postMessage({"type":"ready"});self.outputPort.postMessage({"type":"ready"})}
6 | function SendError(isBroadcast,e){if(!isBroadcast)self.outputPort.postMessage({"type":"error","jobId":self.activeJobId,"error":e.toString()});SendDone()}function SendResult(isBroadcast,ret){if(!isBroadcast){const transferables=ret.transferables||[];self.outputPort.postMessage({"type":"result","jobId":self.activeJobId,"result":ret.result},transferables)}SendDone()}function SendDone(){self.activeJobId=null;self.dispatchPort.postMessage({"type":"done"})}
7 | function SendProgress(val){self.outputPort.postMessage({"type":"progress","jobId":self.activeJobId,"progress":val})}
8 | function OnDispatchWorkerMessage(e){const msg=e.data;const type=msg["type"];if(type==="_import_scripts"){importScripts(...msg["scripts"]);return}else if(type==="_send_blob"){self.sentBlobs.set(msg["id"],msg["blob"]);return}else if(type==="_send_buffer"){self.sentBuffers.set(msg["id"],msg["buffer"]);return}else if(type==="_ready"){SendReady();return}const jobId=msg["jobId"];const isBroadcast=msg["isBroadcast"];const params=msg["params"];let ret;self.activeJobId=jobId;if(!self.JobHandlers.hasOwnProperty(type)){console.error(`no handler for message type '${type}'`);
9 | return}try{ret=self.JobHandlers[type](params)}catch(e){SendError(isBroadcast,"Exception in job handler: "+e);return}if(ret&&ret.then)ret.then(asyncRet=>SendResult(isBroadcast,asyncRet)).catch(err=>SendError(isBroadcast,"Rejection in job handler: "+err));else SendResult(isBroadcast,ret)};
10 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/kamome.min.js:
--------------------------------------------------------------------------------
1 | (()=>{"use strict";var e,n,t,o,r,i,u,a,s,d,m,c,l,f,w,v,x,h,C,k,p,_,b,T,j,y,R={};R.d=(e,n)=>{for(var t in n)R.o(n,t)&&!R.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},R.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),window.KM=(r=50201,i={requestTimeout:"RequestTimeout",rejected:"Rejected",canceled:"Canceled"},u={hasClient:function(){return navigator.userAgent.toLowerCase().indexOf("android")>0&&"kamomeAndroid"in window},_send:function(e){return setTimeout((function(){return window.kamomeAndroid.kamomeSend(e)}),0)}},a={hasClient:function(){return"webkit"in window&&!!window.webkit.messageHandlers.kamomeSend},_send:function(e){return setTimeout((function(){return window.webkit.messageHandlers.kamomeSend.postMessage(e)}),0)}},s={hasClient:function(){return"kamomeFlutter"in window||"flutter_inappwebview"in window},_send:function(e){"kamomeFlutter"in window?setTimeout((function(){return window.kamomeFlutter.postMessage(e)}),0):"flutter_inappwebview"in window&&setTimeout((function(){return window.flutter_inappwebview.callHandler("kamomeFlutter",e)}),0)}},e={},t=function(n){return o(n)&&delete e[n],this},o=function(n){return n in e},(n=function(n,t){return e[n]=t,this})("_kamomeSYN",(function(e,n){return n({versionCode:r})})),n("_kamomeACK",(function(e,n){return n()})),d={addCommand:n,removeCommand:t,hasCommand:o,send:function(e,o){return new Promise((function(r,i){var u="_km_"+e+"_"+_();n(u,(function(e,n){if(e)if(e.success)r(e.result);else{var o=e.error||"UnknownError";i(o)}else i("UnknownError");n(),t(u)})),j(e,o,u)}))},_execCommand:function(n){return setTimeout((function(){e[n.name](n.data,(function(e){return b(e,n.id)}),(function(e){return T(e?encodeURIComponent(e):null,n.id)}))}),0)}},m="_kamomeSYN",c="_kamomeACK",l={},f={},w=1e4,v=!1,x=null,h=function(e){var n=JSON.stringify({name:e.name,data:e.data,id:e.id});a.hasClient()?a._send(n):u.hasClient()?u._send(n):s.hasClient()?s._send(n):d.hasCommand(e.name)&&d._execCommand(e),e.timeout>0&&setTimeout((function(){var n=f[e.id];n&&(n.reject(i.requestTimeout+":"+n.name),delete f[n.id])}),e.timeout)},C=0,k=function e(){if(v)for(var n in f){var t=f[n];h(t)}else C<50?(C++,setTimeout(e,200)):console.error("[kamome.js] Waiting for ready has timed out.")},p=function(e,n,t){return t=t||w,new Promise((function(o,r){var i=_(),u={id:i,name:e,data:n,timeout:t,resolve:o,reject:r};f[i]=u,e===m||e===c?h(u):k()}))},_=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})).toLowerCase()},b=function(e,n){var t=f[n];return t&&(t.resolve(e),delete f[n]),null},T=function(e,n){var t=f[n];if(t){var o=e?":"+decodeURIComponent(e):"";t.reject(i.rejected+":"+t.name+o),delete f[n]}return null},j=function(e,n,t){return e in l&&new Promise((function(t,o){(0,l[e])(n,t,o)})).then((function(e){return p(t,{result:e||null,success:!0},null)})).catch((function(e){return p(t,{error:e||null,success:!1},null)})),null},y=function(){p(m,null,5e3).then((function(e){r!==e.versionCode&&console.warn("[kamome.js] The Kamome native library version does not match. Please update it to latest version."),v=!0,setTimeout((function(){x&&x()}),0),p(c,null,5e3).catch((function(){return console.warn("[kamome.js] Failed to send ACK.")}))})).catch((function(){console.warn("[kamome.js] Failed to send SYN. Please update the Kamome native library to latest version."),v=!0}))},"flutter_inappwebview"in window?window.addEventListener("flutterInAppWebViewPlatformReady",y):window.addEventListener("DOMContentLoaded",y),{VERSION_CODE:r,Error:i,android:u,iOS:a,flutter:s,browser:d,setDefaultRequestTimeout:function(e){return w=e,this},hasNoClients:function(){return!a.hasClient()&&!u.hasClient()&&!s.hasClient()},addReceiver:function(e,n){return l[e]=n,this},removeReceiver:function(e){return e in l&&delete l[e],this},send:p,onComplete:b,onError:T,onReceive:j,isReady:function(){return v},setReadyEventListener:function(e){return x=e,this}});window.KM})();
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/dispatchworker.js:
--------------------------------------------------------------------------------
1 | 'use strict';self.inputPort=null;self.jobQueue=[];self.jobWorkers=[];self.sentBlobs=[];self.sentBuffers=[];self.importedScripts=[];self.lastBroadcasts=new Map;
2 | class JobWorker{constructor(port,number){this._port=port;this._number=number;this._isReady=false;this._isBusy=false;this._port.onmessage=e=>this._OnMessage(e.data)}ImportScripts(scripts){this._port.postMessage({"type":"_import_scripts","scripts":scripts})}SendBlob(blob,id){this._port.postMessage({"type":"_send_blob","blob":blob,"id":id})}SendBuffer(buffer,id){this._port.postMessage({"type":"_send_buffer","buffer":buffer,"id":id})}SendJob(job){if(this._isBusy||!this._isReady)throw new Error("cannot take job");
3 | this._isBusy=true;this._port.postMessage(job,job["transferables"])}_InitBroadcast(job){this._port.postMessage(job,job["transferables"])}SendReady(){this._port.postMessage({"type":"_ready"})}IsReady(){return this._isReady}_OnReady(){this._isReady=true;this.MaybeStartNextJob()}IsBusy(){return this._isBusy}GetNumber(){return this._number}_OnMessage(msg){const type=msg["type"];switch(type){case "ready":this._OnReady();return;case "done":this._OnJobDone();return;default:console.error("unknown message from worker '"+
4 | type+"'");return}}_OnJobDone(){this._isBusy=false;this.MaybeStartNextJob()}MaybeStartNextJob(){if(this._isBusy||!this._isReady)return;const i=this._FindAvailableJob();if(i===-1)return;const job=self.jobQueue[i];const isBroadcast=job["isBroadcast"];if(isBroadcast){job["doneFlags"][this._number]=true;if(job["doneFlags"].every(x=>x))self.jobQueue.splice(i,1)}else self.jobQueue.splice(i,1);this.SendJob(job)}_FindAvailableJob(){for(let i=0,len=self.jobQueue.length;i=job["maxWorkerNum"])continue;if(!job["isBroadcast"]||this._number{const msg=e.data;const type=msg["type"];if(type==="_init"){self.inputPort=msg["in-port"];self.inputPort.onmessage=OnInputPortMessage}else if(type==="_addJobWorker")AddJobWorker(msg["port"])});
8 | function OnInputPortMessage(e){const msg=e.data;const type=msg["type"];if(type==="_cancel"){CancelJob(msg.jobId);return}else if(type==="_import_scripts"){const scripts=msg["scripts"];for(const w of self.jobWorkers)w.ImportScripts(scripts);self.importedScripts.push(scripts);return}else if(type==="_send_blob"){const blob=msg["blob"];const id=msg["id"];for(const w of self.jobWorkers)w.SendBlob(blob,id);self.sentBlobs.push([blob,id]);return}else if(type==="_send_buffer"){const buffer=msg["buffer"];const id=
9 | msg["id"];for(const w of self.jobWorkers)w.SendBuffer(buffer,id);self.sentBuffers.push([buffer,id]);return}else if(type==="_no_more_workers"){self.sentBlobs.length=0;self.sentBuffers.length=0;self.importedScripts.length=0;self.lastBroadcasts.clear();return}self.jobQueue.push(msg);if(msg["isBroadcast"]){const maxWorkerNum=msg["maxWorkerNum"];const curWorkerCount=self.jobWorkers.length;const useWorkerCount=typeof maxWorkerNum==="number"?Math.min(maxWorkerNum,curWorkerCount):curWorkerCount;msg["doneFlags"]=
10 | (new Array(useWorkerCount)).fill(false);msg["transferables"]=[];const broadcastKey=msg["params"]&&msg["params"]["broadcastKey"]?msg["params"]["broadcastKey"]:msg["type"];self.lastBroadcasts.delete(broadcastKey);self.lastBroadcasts.set(broadcastKey,msg)}for(const w of self.jobWorkers)w.MaybeStartNextJob()};
11 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | xmlns:android
18 |
19 | ^$
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | xmlns:.*
29 |
30 | ^$
31 |
32 |
33 | BY_NAME
34 |
35 |
36 |
37 |
38 |
39 |
40 | .*:id
41 |
42 | http://schemas.android.com/apk/res/android
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | .*:name
52 |
53 | http://schemas.android.com/apk/res/android
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | name
63 |
64 | ^$
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | style
74 |
75 | ^$
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | .*
85 |
86 | ^$
87 |
88 |
89 | BY_NAME
90 |
91 |
92 |
93 |
94 |
95 |
96 | .*
97 |
98 | http://schemas.android.com/apk/res/android
99 |
100 |
101 | ANDROID_ATTRIBUTE_ORDER
102 |
103 |
104 |
105 |
106 |
107 |
108 | .*
109 |
110 | .*
111 |
112 |
113 | BY_NAME
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/hsgame/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.hsgame
2 |
3 | import LocalWebServer
4 | import android.os.Bundle
5 | import android.util.Log
6 | import android.webkit.WebView
7 | import android.webkit.WebViewClient
8 | import androidx.activity.ComponentActivity
9 | import androidx.activity.compose.setContent
10 | import androidx.activity.enableEdgeToEdge
11 | import androidx.compose.foundation.layout.fillMaxSize
12 | import androidx.compose.runtime.Composable
13 | import androidx.compose.runtime.remember
14 | import androidx.compose.ui.Modifier
15 | import androidx.compose.ui.platform.LocalContext
16 | import androidx.compose.ui.viewinterop.AndroidView
17 | import com.example.hsgame.ui.theme.HSGameTheme
18 | import com.google.android.gms.ads.AdRequest
19 | import com.google.android.gms.ads.LoadAdError
20 | import com.google.android.gms.ads.MobileAds
21 | import com.google.android.gms.ads.rewarded.RewardItem
22 | import com.google.android.gms.ads.rewarded.RewardedAd
23 | import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback
24 | import jp.hituzi.kamome.Client
25 | import jp.hituzi.kamome.Command
26 |
27 | class MainActivity : ComponentActivity() {
28 |
29 | private var _client: Client? = null
30 | private lateinit var webServer: LocalWebServer
31 | private var rewardedAd: RewardedAd? = null
32 | private var isAdLoading = false
33 |
34 | override fun onCreate(savedInstanceState: Bundle?) {
35 | super.onCreate(savedInstanceState)
36 | enableEdgeToEdge()
37 |
38 | MobileAds.initialize(this) {}
39 | loadRewardedAd()
40 | // Start the local web server
41 | webServer = LocalWebServer(this)
42 | webServer.start()
43 |
44 | setContent {
45 | HSGameTheme {
46 | WebViewScreen("http://localhost:8080/index.html",
47 | onWebViewCreated = { webView ->
48 | // Now you have the WebView instance here
49 | setupWebView(webView)
50 | })
51 | }
52 | }
53 | }
54 |
55 | private fun loadRewardedAd() {
56 | val adRequest = AdRequest.Builder().build()
57 |
58 | RewardedAd.load(
59 | this,
60 | "ca-app-pub-3940256099942544/5224354917", // Use the test ad unit ID here
61 | adRequest,
62 | object : RewardedAdLoadCallback() {
63 | override fun onAdLoaded(ad: RewardedAd) {
64 | rewardedAd = ad
65 | isAdLoading = false
66 | Log.d("AdMob", "Ad loaded successfully")
67 | }
68 |
69 | override fun onAdFailedToLoad(error: LoadAdError) {
70 | rewardedAd = null
71 | isAdLoading = false
72 | Log.e("AdMob", "Ad failed to load: ${error.code}, ${error.message}")
73 | }
74 | }
75 | )
76 | isAdLoading = true
77 | }
78 |
79 | private fun showRewardedAd() {
80 | rewardedAd?.show(this) { rewardItem: RewardItem ->
81 | // Handle reward
82 | val rewardAmount = rewardItem.amount
83 | val rewardType = rewardItem.type
84 | // You can notify your web app about the reward if needed
85 |
86 | val data = HashMap()
87 | _client?.send(data, "adShown") { commandName, result, error ->
88 | // Received a result from the JS code.
89 | //Log.d(TAG, "result: $result")
90 | }
91 |
92 | } ?: run {
93 | // Reload the ad if it's not loaded yet
94 | loadRewardedAd()
95 | }
96 | }
97 |
98 | override fun onDestroy() {
99 | super.onDestroy()
100 | webServer.stop() // Stop the server when the activity is destroyed
101 | }
102 |
103 | private fun setupWebView(wv: WebView) {
104 | // Creates the Client object with the webView.
105 | val client = Client(wv)
106 | _client = client;
107 | // Registers `echo` command.
108 | client.add(Command("echo") { commandName, data, completion ->
109 | // Received `echo` command.
110 | // Then sends resolved result to the JavaScript callback function.
111 | val map = HashMap()
112 | map["message"] = data!!.optString("message")
113 | completion.resolve(map)
114 | // Or, sends rejected result if failed.
115 | //completion.reject("Echo Error!")
116 | })
117 |
118 | // Register the command "showAd" that the web app will send
119 | client.add(Command("showAd") { commandName, data, completion ->
120 | // Show the rewarded ad when the message is received
121 | showRewardedAd()
122 |
123 | // Send a response back to the web app (optional)
124 | val response = HashMap()
125 | response["status"] = "ad_shown"
126 | completion.resolve(response)
127 | })
128 | }
129 | }
130 |
131 | @Composable
132 | fun WebViewScreen(url: String, onWebViewCreated: (WebView) -> Unit) {
133 |
134 | val context = LocalContext.current
135 | // Create and remember a WebView instance
136 | val webView = remember { WebView(context) }
137 | onWebViewCreated(webView)
138 |
139 | // Set up the WebView (configure it only once)
140 | webView.apply {
141 | settings.javaScriptEnabled = true
142 | webViewClient = WebViewClient()
143 | loadUrl(url)
144 | }
145 |
146 | // Display the WebView in the Compose UI
147 | AndroidView(
148 | factory = { webView },
149 | modifier = Modifier.fillMaxSize()
150 | )
151 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/assets/sw.js:
--------------------------------------------------------------------------------
1 | 'use strict';const OFFLINE_DATA_FILE="offline.json";const CACHE_NAME_PREFIX="c3offline";const BROADCASTCHANNEL_NAME="offline";const CONSOLE_PREFIX="[SW] ";const LAZYLOAD_KEYNAME="";const broadcastChannel=typeof BroadcastChannel==="undefined"?null:new BroadcastChannel(BROADCASTCHANNEL_NAME);
2 | class PromiseThrottle{constructor(maxParallel){this._maxParallel=maxParallel;this._queue=[];this._activeCount=0}Add(func){return new Promise((resolve,reject)=>{this._queue.push({func,resolve,reject});this._MaybeStartNext()})}async _MaybeStartNext(){if(!this._queue.length||this._activeCount>=this._maxParallel)return;this._activeCount++;const job=this._queue.shift();try{const result=await job.func();job.resolve(result)}catch(err){job.reject(err)}this._activeCount--;this._MaybeStartNext()}}
3 | const networkThrottle=new PromiseThrottle(20);function PostBroadcastMessage(o){if(!broadcastChannel)return;setTimeout(()=>broadcastChannel.postMessage(o),3E3)}function Broadcast(type){PostBroadcastMessage({"type":type})}function BroadcastDownloadingUpdate(version){PostBroadcastMessage({"type":"downloading-update","version":version})}function BroadcastUpdateReady(version){PostBroadcastMessage({"type":"update-ready","version":version})}
4 | function IsUrlInLazyLoadList(url,lazyLoadList){if(!lazyLoadList)return false;try{for(const lazyLoadRegex of lazyLoadList)if((new RegExp(lazyLoadRegex)).test(url))return true}catch(err){console.error(CONSOLE_PREFIX+"Error matching in lazy-load list: ",err)}return false}function WriteLazyLoadListToStorage(lazyLoadList){if(typeof localforage==="undefined")return Promise.resolve();else return localforage.setItem(LAZYLOAD_KEYNAME,lazyLoadList)}
5 | function ReadLazyLoadListFromStorage(){if(typeof localforage==="undefined")return Promise.resolve([]);else return localforage.getItem(LAZYLOAD_KEYNAME)}function GetCacheBaseName(){return CACHE_NAME_PREFIX+"-"+self.registration.scope}function GetCacheVersionName(version){return GetCacheBaseName()+"-v"+version}async function GetAvailableCacheNames(){const cacheNames=await caches.keys();const cacheBaseName=GetCacheBaseName();return cacheNames.filter(n=>n.startsWith(cacheBaseName))}
6 | async function IsUpdatePending(){const availableCacheNames=await GetAvailableCacheNames();return availableCacheNames.length>=2}async function GetMainPageUrl(){const allClients=await clients.matchAll({includeUncontrolled:true,type:"window"});for(const c of allClients){let url=c.url;if(url.startsWith(self.registration.scope))url=url.substring(self.registration.scope.length);if(url&&url!=="/"){if(url.startsWith("?"))url="/"+url;return url}}return""}
7 | function fetchWithBypass(request,bypassCache){if(typeof request==="string")request=new Request(request);if(bypassCache)return fetch(request.url,{headers:request.headers,mode:request.mode,credentials:request.credentials,redirect:request.redirect,cache:"no-store"});else return fetch(request)}
8 | async function CreateCacheFromFileList(cacheName,fileList,bypassCache){const responses=await Promise.all(fileList.map(url=>networkThrottle.Add(()=>fetchWithBypass(url,bypassCache))));let allOk=true;for(const response of responses)if(!response.ok){allOk=false;console.error(CONSOLE_PREFIX+"Error fetching '"+response.url+"' ("+response.status+" "+response.statusText+")")}if(!allOk)throw new Error("not all resources were fetched successfully");const cache=await caches.open(cacheName);try{return await Promise.all(responses.map((response,
9 | i)=>cache.put(fileList[i],response)))}catch(err){console.error(CONSOLE_PREFIX+"Error writing cache entries: ",err);caches.delete(cacheName);throw err;}}
10 | async function UpdateCheck(isFirst){try{const response=await fetchWithBypass(OFFLINE_DATA_FILE,true);if(!response.ok)throw new Error(OFFLINE_DATA_FILE+" responded with "+response.status+" "+response.statusText);const data=await response.json();const version=data.version;const fileList=data.fileList;const lazyLoadList=data.lazyLoad;const currentCacheName=GetCacheVersionName(version);const cacheExists=await caches.has(currentCacheName);if(cacheExists){const isUpdatePending=await IsUpdatePending();if(isUpdatePending){console.log(CONSOLE_PREFIX+
11 | "Update pending");Broadcast("update-pending")}else{console.log(CONSOLE_PREFIX+"Up to date");Broadcast("up-to-date")}return}const mainPageUrl=await GetMainPageUrl();fileList.unshift("./");if(mainPageUrl&&fileList.indexOf(mainPageUrl)===-1)fileList.unshift(mainPageUrl);console.log(CONSOLE_PREFIX+"Caching "+fileList.length+" files for offline use");if(isFirst)Broadcast("downloading");else BroadcastDownloadingUpdate(version);if(lazyLoadList)await WriteLazyLoadListToStorage(lazyLoadList);await CreateCacheFromFileList(currentCacheName,
12 | fileList,!isFirst);const isUpdatePending=await IsUpdatePending();if(isUpdatePending){console.log(CONSOLE_PREFIX+"All resources saved, update ready");BroadcastUpdateReady(version)}else{console.log(CONSOLE_PREFIX+"All resources saved, offline support ready");Broadcast("offline-ready")}}catch(err){console.warn(CONSOLE_PREFIX+"Update check failed: ",err)}}self.addEventListener("install",event=>{event.waitUntil(UpdateCheck(true).catch(()=>null))});
13 | async function GetCacheNameToUse(availableCacheNames,doUpdateCheck){if(availableCacheNames.length===1||!doUpdateCheck)return availableCacheNames[0];const allClients=await clients.matchAll();if(allClients.length>1)return availableCacheNames[0];const latestCacheName=availableCacheNames[availableCacheNames.length-1];console.log(CONSOLE_PREFIX+"Updating to new version");await Promise.all(availableCacheNames.slice(0,-1).map(c=>caches.delete(c)));return latestCacheName}
14 | async function HandleFetch(event,doUpdateCheck){const availableCacheNames=await GetAvailableCacheNames();if(!availableCacheNames.length)return fetch(event.request);const useCacheName=await GetCacheNameToUse(availableCacheNames,doUpdateCheck);const cache=await caches.open(useCacheName);const cachedResponse=await cache.match(event.request);if(cachedResponse)return cachedResponse;const result=await Promise.all([fetch(event.request),ReadLazyLoadListFromStorage()]);const fetchResponse=result[0];const lazyLoadList=
15 | result[1];if(IsUrlInLazyLoadList(event.request.url,lazyLoadList))try{await cache.put(event.request,fetchResponse.clone())}catch(err){console.warn(CONSOLE_PREFIX+"Error caching '"+event.request.url+"': ",err)}return fetchResponse}
16 | self.addEventListener("fetch",event=>{if((new URL(event.request.url)).origin!==location.origin)return;const doUpdateCheck=event.request.mode==="navigate";const responsePromise=HandleFetch(event,doUpdateCheck);if(doUpdateCheck)event.waitUntil(responsePromise.then(()=>UpdateCheck(false)));event.respondWith(responsePromise)});
17 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/project/main.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Import any other script files here, e.g.:
3 | // import * as myModule from "./mymodule.js";
4 | let checkPoints = [];
5 | let config;
6 | const lerp = (start, end, amt) => (1 - amt) * start + amt * end;
7 | const baseSize0 = 100;
8 | const baseY = 600;
9 | function getConfig() {
10 | return config;
11 | }
12 | function initPoints(runtime) {
13 | const checkpointInsts = runtime.objects.Checkpoint.getAllInstances();
14 | //console.log(checkpointInsts);
15 | checkpointInsts.sort((p1, p2) => p1.instVars.Index - p2.instVars.Index)
16 | .forEach(p => {
17 | checkPoints.push({ uid: p.uid, x: p.x, y: p.y });
18 | });
19 | //console.log(checkPoints)
20 | }
21 | function calculatePositionOnTrajectory(trajectory, distance) {
22 | let totalDistance = 0;
23 | // Iterate over each segment of the trajectory
24 | for (let i = 0; i < trajectory.length - 1; i++) {
25 | const segmentStart = trajectory[i];
26 | const segmentEnd = trajectory[i + 1];
27 | // Calculate the distance of the current segment
28 | const segmentDistance = Math.sqrt(Math.pow(segmentEnd.x - segmentStart.x, 2) +
29 | Math.pow(segmentEnd.y - segmentStart.y, 2));
30 | // Check if the object lies on this segment
31 | if (totalDistance + segmentDistance >= distance) {
32 | // Calculate the position of the object on this segment
33 | const remainingDistance = distance - totalDistance;
34 | const ratio = remainingDistance / segmentDistance;
35 | const posX = segmentStart.x + ratio * (segmentEnd.x - segmentStart.x);
36 | const posY = segmentStart.y + ratio * (segmentEnd.y - segmentStart.y);
37 | return { uid: 0, x: posX, y: posY };
38 | }
39 | // Move to the next segment
40 | totalDistance += segmentDistance;
41 | }
42 | // If the distance exceeds the total length of the trajectory, return null
43 | return null;
44 | }
45 | function getParamsFromURL() {
46 | // Получаем строку запроса (query string) из URL
47 | let queryString = window.location.search;
48 | // Создаем экземпляр URLSearchParams
49 | let searchParams = new URLSearchParams(queryString);
50 | // Создаем объект для хранения параметров
51 | let params = {};
52 | // Проходим по всем параметрам
53 | for (let [key, value] of searchParams.entries()) {
54 | params[key] = value;
55 | }
56 | // Возвращаем параметры
57 | return params;
58 | }
59 | function isInAppMode() {
60 | return getParamsFromURL()["inAppMode"] != undefined;
61 | }
62 | function sendScore(score) {
63 | let params = getParamsFromURL();
64 | console.log('UID:', params.uid);
65 | console.log('IMID:', params.imid);
66 | //console.log('TG Share Score URL:', params['tgShareScoreUrl']);
67 | //http://127.0.0.1:3000/index.html?uid=182669810&imid=AgAAAEzrBQDyUeMKvHKPKnpdHHg#tgShareScoreUrl=tg%3A%2F%2Fshare_game_score%3Fhash%3DgOZEhzb61ZMw_vIHfoPz06n0rslM5mzCsx8HegCAnxPnjcmDTNs4YCVDYuVRT8qQ
68 | let uid = params.uid;
69 | let imid = params.imid;
70 | // uid = 182669810;
71 | // imid = 'AgAAAEzrBQDyUeMKvHKPKnpdHHg';
72 | fetch(`https://bot.gritsenko.biz/setScore?uid=${uid}&imid=${imid}&score=${score}`);
73 | }
74 | async function loadConfig(runtime) {
75 | // Get the correct URL to fetch
76 | const textFileUrl = await runtime.assets.getProjectFileUrl("config.json");
77 | // Now fetch that URL normally
78 | const response = await fetch(textFileUrl);
79 | config = await response.json();
80 | //config = gameConfig;
81 | //console.log("config loaded:", config);
82 | config.feed = config.feed.reverse();
83 | //config.feed = [];
84 | }
85 | runOnStartup(async (runtime) => {
86 | // Code to run on the loading screen.
87 | // Note layouts, objects etc. are not yet available.
88 | globalThis.isInAppMode = isInAppMode;
89 | globalThis.sendScore = sendScore;
90 | globalThis.getConfig = getConfig;
91 | globalThis.getNextEnemyIndex = getNextEnemyIndex;
92 | globalThis.initPoints = initPoints;
93 | globalThis.setEnemyPos = setEnemyPos;
94 | globalThis.findSameTypeGroupItems = findSameTypeGroupItems;
95 | await loadConfig(runtime);
96 | runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
97 | });
98 | async function OnBeforeProjectStart(runtime) {
99 | // Code to run just before 'On start of layout' on
100 | // the first layout. Loading has finished and initial
101 | // instances are created and available to use here.
102 | //globalThis.initPoints(runtime);
103 | runtime.addEventListener("tick", () => Tick(runtime));
104 | }
105 | function findSameTypeGroupItems(runtime) {
106 | const items = runtime.objects.Target
107 | .getAllInstances()
108 | .sort((a, b) => b.instVars.order - a.instVars.order);
109 | let lastGroupId = -1;
110 | let lastEnemyType = -1;
111 | let bonusOrder = -1;
112 | const groupsToDestory = [];
113 | items.forEach(item => {
114 | if (item.instVars.DestroyCooldown == 0) {
115 | const curGroupId = item.instVars.GroupId;
116 | const curEnemyType = item.instVars.enemyType;
117 | if (runtime.globalVars.NextGroupId != curGroupId
118 | && lastGroupId != curGroupId
119 | && lastEnemyType == curEnemyType) {
120 | if (groupsToDestory.indexOf(lastGroupId) == -1)
121 | groupsToDestory.push(lastGroupId);
122 | if (groupsToDestory.indexOf(curGroupId) == -1)
123 | groupsToDestory.push(curGroupId);
124 | }
125 | lastEnemyType = curEnemyType;
126 | lastGroupId = curGroupId;
127 | }
128 | });
129 | //console.log("groups to destory", groupsToDestory);
130 | const result = {
131 | order: bonusOrder,
132 | x: 0,
133 | y: 0,
134 | distance: 0,
135 | groupId: 0,
136 | items: new Array()
137 | };
138 | items.forEach(item => {
139 | if (groupsToDestory.indexOf(item.instVars.GroupId) != -1) {
140 | result.items.push(item);
141 | if (bonusOrder === -1 && item.instVars.order != undefined) {
142 | bonusOrder = item.instVars.order;
143 | result.order = item.instVars.order;
144 | result.x = item.x;
145 | result.y = item.y;
146 | result.distance = item.instVars.distance;
147 | result.groupId = item.instVars.GroupId;
148 | }
149 | }
150 | });
151 | const firstItem = result.items[0];
152 | const lastItem = result.items[result.items.length - 1];
153 | if (firstItem && lastItem) {
154 | result.distance = (lastItem.instVars.distance + firstItem.instVars.distance) / 2;
155 | const pos = calculatePositionOnTrajectory(checkPoints, result.distance);
156 | if (pos != null) {
157 | result.x = pos.x;
158 | result.y = pos.y;
159 | }
160 | }
161 | return result;
162 | }
163 | async function doTween(runtime, inst, x = 0, y = 0) {
164 | // Create a tween that moves it to (300, 300) over 2 seconds
165 | const tween = inst.behaviors.Tween.startTween("position", [x, y], 0.5, "linear");
166 | // Wait for the tween to finish
167 | await tween.finished;
168 | // Log to the console now the tween has finished
169 | //console.log("Tween finished");
170 | }
171 | function Tick(runtime) {
172 | if (runtime.globalVars.IsGameOver || !runtime.globalVars.IsGameActive)
173 | return;
174 | // Code to run every tick
175 | const dt = runtime.dt;
176 | const targets = runtime.objects.Target.getAllInstances();
177 | const targetsCount = targets.length;
178 | let i = targetsCount;
179 | const totalDist = targets.reduce((acc, inst) => acc + inst.instVars.Size, 0);
180 | let curDist = totalDist;
181 | const scaleFactor = Math.sin(18 * Math.PI / 180) / 2;
182 | const speed = runtime.globalVars.NewItemsRate;
183 | const sortedTargets = targets.sort((a, b) => a.instVars.order - b.instVars.order);
184 | sortedTargets.forEach(inst => {
185 | curDist -= inst.instVars.Size;
186 | if (inst.instVars.DestroyCooldown == 0)
187 | inst.instVars.destDistance = curDist;
188 | let isMovingBackward = inst.instVars.odlDestDist > inst.instVars.destDistance;
189 | inst.instVars.odlDestDist = inst.instVars.destDistance;
190 | const oldDist = inst.instVars.distance;
191 | inst.instVars.distance = lerp(inst.instVars.distance, inst.instVars.destDistance, isMovingBackward || inst.instVars.DestroyCooldown > 0 ? 0.1 * speed : 0.03 * speed);
192 | //inst.instVars.distance = inst.instVars.destDistance;
193 | const ox = inst.x;
194 | const oy = inst.y;
195 | //if (inst.instVars.DestroyCooldown === 0)
196 | setEnemyPos(inst, inst.instVars.distance);
197 | const dx = inst.x - ox;
198 | const dy = inst.y - oy;
199 | let invScale = 1;
200 | if (!inst.instVars.IsBonus) {
201 | invScale = dx < 0 ? -1 : 1;
202 | if (oldDist > inst.instVars.distance) {
203 | invScale = -invScale;
204 | }
205 | }
206 | const s = Math.max(baseSize0 + 10, Math.min(baseSize0 + 80, scaleFactor * (inst.y)));
207 | if (inst.instVars.DestroyCooldown <= 0) {
208 | inst.width = s * invScale * inst.instVars.SpriteScale;
209 | const offset = inst.behaviors.FloatAnim.value;
210 | inst.height = s * inst.instVars.SpriteScale + offset;
211 | }
212 | inst.instVars.YPos = inst.y;
213 | i--;
214 | });
215 | }
216 | function setEnemyPos(inst, dist) {
217 | var pos = calculatePositionOnTrajectory(checkPoints, dist);
218 | if (pos != null) {
219 | inst.x = pos.x;
220 | inst.y = pos.y;
221 | }
222 | }
223 | let tubes = [0, 1, 2, 3];
224 | // let bombs = [5,6];
225 | let hist = [6, 6, 6];
226 | function getNextEnemyIndex(runtime) {
227 | if (getConfig().feed.length > 0) {
228 | const feedIndex = getConfig().feed.pop();
229 | if (feedIndex != undefined) {
230 | hist.unshift(feedIndex);
231 | hist.pop();
232 | return feedIndex;
233 | }
234 | }
235 | ;
236 | const level = runtime.globalVars.lvl;
237 | const upgradeLevel = runtime.globalVars.LaserLevel;
238 | const turretLevel = runtime.globalVars.TurretLevel;
239 | //hist == undefined ? hist = [6, 6, 6] : null;
240 | let choices = [];
241 | let playerDominance = upgradeLevel + turretLevel - level;
242 | if (!(hist.includes(5) || hist.includes(6)))
243 | choices.push(5, 6);
244 | if (playerDominance <= 1 && !choices.includes(5) && hist[0] != 5 && hist[0] != 6)
245 | choices.push(5, 6);
246 | if (playerDominance >= 2 && !tubes.includes(4))
247 | tubes.push(4);
248 | for (let i = 0; i < tubes.length; i++) {
249 | if (tubes[i] == hist[0])
250 | continue;
251 | else
252 | choices.push(tubes[i]);
253 | if (!hist.includes(tubes[i]))
254 | choices.push(tubes[i]);
255 | if (playerDominance > 1 && !hist.includes(tubes[i]))
256 | choices.push(tubes[i]);
257 | if (playerDominance <= 1 && hist[1] == tubes[i])
258 | choices.push(tubes[i]);
259 | if (playerDominance <= 2 && hist[2] == tubes[i])
260 | choices.push(tubes[i]);
261 | }
262 | let res = choices[Math.floor(Math.random() * choices.length)];
263 | hist.unshift(res);
264 | hist.pop();
265 | //console.log(hist);
266 | return res;
267 | }
268 |
--------------------------------------------------------------------------------
/app/src/main/assets/scripts/opus.wasm.js:
--------------------------------------------------------------------------------
1 | ((function() {
2 | "use strict";
3 | var VINT_SIZES = [0, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
4 | var VINT_MASKS = [255, 127, 63, 31, 15, 7, 3, 1, 0];
5 | var OPUS_SIG = [65, 95, 79, 80, 85, 83];
6 |
7 | var _decoder = null;
8 | var _audioBuffer = null;
9 | var _inputPointer = null;
10 | var _outputBuffer = null;
11 | var _outputPointer = null;
12 | var _outputOffset = 0;
13 |
14 | // Ready promise resolves when onRuntimeInitialized called
15 | let readyPromiseResolve = null;
16 | const readyPromise = new Promise(resolve => readyPromiseResolve = resolve);
17 |
18 | Module = {
19 | // When WASM has finished loading, resolve the ready promise
20 | onRuntimeInitialized: readyPromiseResolve
21 | };
22 |
23 | function ReadVInt(data, position, length, initialMask) {
24 | var value = data.getUint8(position) & initialMask;
25 | for (var i = 1; i < length; i++) value = (value << 8) + data.getUint8(position + i);
26 | return value
27 | }
28 |
29 | function ParseIntTag(data, position, size)
30 | {
31 | switch (size) {
32 | case 1:
33 | return data.getInt8(position);
34 | case 2:
35 | return data.getInt16(position);
36 | case 3:
37 | return ReadInt24(data, position);
38 | case 4:
39 | return data.getInt32(position);
40 | default:
41 | throw new Error("Invalid size");
42 | }
43 | }
44 |
45 | function ReadInt24(data, position)
46 | {
47 | var first = data.getInt8(position);
48 | var sign = first >> 7;
49 | var value = first & 0b1111111;
50 |
51 | value = (value << 8) | data.getUint8(position);
52 | value = (value << 8) | data.getUint8(position);
53 |
54 | return sign === 1 ? -value : value;
55 | }
56 |
57 | function CalculateAudioBufferSize(rate, channels, duration) {
58 | return rate / 1e3 * channels * duration
59 | }
60 |
61 | function CreateDecoder(duration) {
62 | var frequency = 48e3;
63 | var channels = 1;
64 | var bufferSize = 2048;
65 | // the true size should be "duration - codecDelay"
66 | // but we also write the "discardpadding" at the end
67 | // of the buffer before discarding it, so we need 1 opus frame of
68 | // extra space. max size of a frame is 120ms
69 | var length = CalculateAudioBufferSize(frequency, channels, duration + 120);
70 | _audioBuffer = new Float32Array(length);
71 | if (!_outputBuffer) {
72 | _outputPointer = Module._malloc(bufferSize << 2);
73 | _outputBuffer = new Float32Array(Module.HEAPU8.buffer, _outputPointer, bufferSize)
74 | }
75 | if (!_inputPointer) {
76 | _inputPointer = Module._malloc(bufferSize)
77 | }
78 | _decoder = Module._create_decoder(frequency, channels);
79 | if (_decoder < 0) throw new Error("Failed to create decoder")
80 | }
81 |
82 | function DestroyDecoder() {
83 | Module._destroy_decoder(_decoder);
84 | _decoder = null;
85 | _outputOffset = 0;
86 | }
87 |
88 | /////////////////////////////////////////////////////////
89 | // Main job handler
90 | self.JobHandlers["OpusDecode"] = async function OpusDecode(params)
91 | {
92 | // Wait for WASM to finish loading if necessary
93 | await readyPromise;
94 |
95 | // Decode the Opus compressed audio to a float sample buffer and return the ArrayBuffer
96 | const arrayBuffer = params["arrayBuffer"];
97 | ParseMaster(new DataView(arrayBuffer), 0, arrayBuffer.byteLength);
98 | const end = _outputOffset;
99 | DestroyDecoder();
100 | const outputBuffer = _audioBuffer.buffer.slice(0, end * 4);
101 | _audioBuffer = null;
102 | return {
103 | result: outputBuffer,
104 | transferables: [outputBuffer]
105 | };
106 | };
107 |
108 | function WriteOutput (ret) {
109 | if (ret + _outputOffset > 0) {
110 | var tempBuffer;
111 | var writePosition = _outputOffset;
112 | if (_outputOffset < 0) {
113 | var trim = -_outputOffset;
114 | tempBuffer = new Float32Array(Module.HEAPU8.buffer, _outputPointer + trim * 4, ret - trim);
115 | writePosition = 0;
116 | }
117 | else {
118 | tempBuffer = new Float32Array(Module.HEAPU8.buffer, _outputPointer, ret);
119 | }
120 |
121 | if (writePosition + tempBuffer.length > _audioBuffer.length)
122 | throw new Error("Buffer overflow");
123 |
124 | _audioBuffer.set(tempBuffer, writePosition);
125 | }
126 |
127 | _outputOffset += ret;
128 | }
129 |
130 | function ParseFrame(data) {
131 | var length = data.length;
132 | Module.HEAPU8.set(data, _inputPointer);
133 | var ret = Module._decode_frame(_decoder, _inputPointer, length, _outputPointer, 4096);
134 | if (ret > 0) {
135 | WriteOutput(ret);
136 | } else {
137 | throw new Error("Failed to parse frame")
138 | }
139 | }
140 |
141 | function ParseBlock(data, position, size) {
142 | var firstByte, tagLength, mask, trackEntry, timeCode, flags, lacing;
143 | firstByte = data.getUint8(position);
144 | tagLength = VINT_SIZES[firstByte];
145 | mask = VINT_MASKS[tagLength];
146 | trackEntry = ReadVInt(data, position, tagLength, mask);
147 | position += tagLength;
148 | timeCode = data.getInt16(position);
149 | position += 2;
150 | flags = data.getUint8(position);
151 | position += 1;
152 | size -= tagLength + 3;
153 | lacing = flags & 6;
154 | if (lacing) throw "Lacing not supported";
155 | ParseFrame(new Uint8Array(data.buffer, position, size))
156 | }
157 |
158 | function ParseDuration(data, position, size) {
159 | var duration;
160 | if (size == 4) duration = data.getFloat32(position);
161 | else if (size == 8) duration = data.getFloat64(position);
162 | else throw new Error("Invalid size");
163 | CreateDecoder(duration)
164 | }
165 |
166 | function ParseDiscard(data, position, size) {
167 | // NOTE discard in an integer
168 | // postive values are trailing, negative are leading
169 | // value is in nanoseconds
170 | var discardDuration = ParseIntTag(data, position, size);
171 | if (discardDuration < 0)
172 | throw new Error("Cannot discard leading block data");
173 | var discardFrames = Math.floor(discardDuration * 0.000048);
174 | _outputOffset -= discardFrames;
175 | }
176 |
177 | function ParseDelay(data, position, size) {
178 | var discardDuration = ReadVInt(data, position, size, 0xFF);
179 | _outputOffset = -Math.floor(discardDuration * 0.000048)
180 | }
181 |
182 | function TestOpus(data, position) {
183 | for (var i = 0, l = 6; i < l; i++) {
184 | if (data.getUint8(position + i) != OPUS_SIG[i]) throw new Error("Contains non opus data")
185 | }
186 | }
187 |
188 | function ParseMaster(data, position, length) {
189 | var firstByte, tagLength, id, sizeLength, mask, size;
190 | var end = position + length;
191 | while (position < end) {
192 | firstByte = data.getUint8(position);
193 | tagLength = VINT_SIZES[firstByte];
194 | if (tagLength > 4 || tagLength == 0) throw "Invalid tag length " + tagLength;
195 | id = ReadVInt(data, position, tagLength, 255);
196 | position += tagLength;
197 | firstByte = data.getUint8(position);
198 | sizeLength = VINT_SIZES[firstByte];
199 | mask = VINT_MASKS[sizeLength];
200 | if (sizeLength == 0) throw "Invalid size length";
201 | size = ReadVInt(data, position, sizeLength, mask);
202 | position += sizeLength;
203 | switch (id) {
204 | case 408125543: // Segment
205 | case 357149030: // Info
206 | case 524531317: // Cluster
207 | case 374648427: // Tracks
208 | case 174: // TrackEntry
209 | case 160: // BlockGroup
210 | ParseMaster(data, position, size);
211 | break;
212 | case 17545: // Duration
213 | ParseDuration(data, position, size);
214 | break;
215 | case 22186: // CodecDelay
216 | ParseDelay(data, position, size);
217 | break;
218 | case 30114: // DiscardPadding
219 | ParseDiscard(data, position, size);
220 | break;
221 | case 134: // CodecID
222 | TestOpus(data, position, size);
223 | break;
224 | case 161: // Block
225 | case 163: // SimpleBlock
226 | ParseBlock(data, position, size);
227 | break;
228 | }
229 | position += size
230 | }
231 | }
232 | }))();
233 | var Module;
234 | if (!Module) Module = (typeof Module !== "undefined" ? Module : null) || {};
235 | var moduleOverrides = {};
236 | for (var key in Module) {
237 | if (Module.hasOwnProperty(key)) {
238 | moduleOverrides[key] = Module[key]
239 | }
240 | }
241 | var ENVIRONMENT_IS_WEB = false;
242 | var ENVIRONMENT_IS_WORKER = false;
243 | var ENVIRONMENT_IS_NODE = false;
244 | var ENVIRONMENT_IS_SHELL = false;
245 | if (Module["ENVIRONMENT"]) {
246 | if (Module["ENVIRONMENT"] === "WEB") {
247 | ENVIRONMENT_IS_WEB = true
248 | } else if (Module["ENVIRONMENT"] === "WORKER") {
249 | ENVIRONMENT_IS_WORKER = true
250 | } else if (Module["ENVIRONMENT"] === "NODE") {
251 | ENVIRONMENT_IS_NODE = true
252 | } else if (Module["ENVIRONMENT"] === "SHELL") {
253 | ENVIRONMENT_IS_SHELL = true
254 | } else {
255 | throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")
256 | }
257 | } else {
258 | ENVIRONMENT_IS_WEB = typeof window === "object";
259 | ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
260 | ENVIRONMENT_IS_NODE = typeof process === "object" && typeof require === "function" && !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER;
261 | ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER
262 | }
263 | if (ENVIRONMENT_IS_NODE) {
264 | if (!Module["print"]) Module["print"] = console.log;
265 | if (!Module["printErr"]) Module["printErr"] = console.warn;
266 | var nodeFS;
267 | var nodePath;
268 | Module["read"] = function shell_read(filename, binary) {
269 | if (!nodeFS) nodeFS = require("fs");
270 | if (!nodePath) nodePath = require("path");
271 | filename = nodePath["normalize"](filename);
272 | var ret = nodeFS["readFileSync"](filename);
273 | return binary ? ret : ret.toString()
274 | };
275 | Module["readBinary"] = function readBinary(filename) {
276 | var ret = Module["read"](filename, true);
277 | if (!ret.buffer) {
278 | ret = new Uint8Array(ret)
279 | }
280 | assert(ret.buffer);
281 | return ret
282 | };
283 | Module["load"] = function load(f) {
284 | globalEval(read(f))
285 | };
286 | if (!Module["thisProgram"]) {
287 | if (process["argv"].length > 1) {
288 | Module["thisProgram"] = process["argv"][1].replace(/\\/g, "/")
289 | } else {
290 | Module["thisProgram"] = "unknown-program"
291 | }
292 | }
293 | Module["arguments"] = process["argv"].slice(2);
294 | if (typeof module !== "undefined") {
295 | module["exports"] = Module
296 | }
297 | process["on"]("uncaughtException", (function(ex) {
298 | if (!(ex instanceof ExitStatus)) {
299 | throw ex
300 | }
301 | }));
302 | Module["inspect"] = (function() {
303 | return "[Emscripten Module object]"
304 | })
305 | } else if (ENVIRONMENT_IS_SHELL) {
306 | if (!Module["print"]) Module["print"] = print;
307 | if (typeof printErr != "undefined") Module["printErr"] = printErr;
308 | if (typeof read != "undefined") {
309 | Module["read"] = read
310 | } else {
311 | Module["read"] = function shell_read() {
312 | throw "no read() available"
313 | }
314 | }
315 | Module["readBinary"] = function readBinary(f) {
316 | if (typeof readbuffer === "function") {
317 | return new Uint8Array(readbuffer(f))
318 | }
319 | var data = read(f, "binary");
320 | assert(typeof data === "object");
321 | return data
322 | };
323 | if (typeof scriptArgs != "undefined") {
324 | Module["arguments"] = scriptArgs
325 | } else if (typeof arguments != "undefined") {
326 | Module["arguments"] = arguments
327 | }
328 | if (typeof quit === "function") {
329 | Module["quit"] = (function(status, toThrow) {
330 | quit(status)
331 | })
332 | }
333 | } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
334 | Module["read"] = function shell_read(url) {
335 | var xhr = new XMLHttpRequest;
336 | xhr.open("GET", url, false);
337 | xhr.send(null);
338 | return xhr.responseText
339 | };
340 | if (ENVIRONMENT_IS_WORKER) {
341 | Module["readBinary"] = function readBinary(url) {
342 | var xhr = new XMLHttpRequest;
343 | xhr.open("GET", url, false);
344 | xhr.responseType = "arraybuffer";
345 | xhr.send(null);
346 | return new Uint8Array(xhr.response)
347 | }
348 | }
349 | Module["readAsync"] = function readAsync(url, onload, onerror) {
350 | var xhr = new XMLHttpRequest;
351 | xhr.open("GET", url, true);
352 | xhr.responseType = "arraybuffer";
353 | xhr.onload = function xhr_onload() {
354 | if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
355 | onload(xhr.response)
356 | } else {
357 | onerror()
358 | }
359 | };
360 | xhr.onerror = onerror;
361 | xhr.send(null)
362 | };
363 | if (typeof arguments != "undefined") {
364 | Module["arguments"] = arguments
365 | }
366 | if (typeof console !== "undefined") {
367 | if (!Module["print"]) Module["print"] = function shell_print(x) {
368 | console.log(x)
369 | };
370 | if (!Module["printErr"]) Module["printErr"] = function shell_printErr(x) {
371 | console.warn(x)
372 | }
373 | } else {
374 | var TRY_USE_DUMP = false;
375 | if (!Module["print"]) Module["print"] = TRY_USE_DUMP && typeof dump !== "undefined" ? (function(x) {
376 | dump(x)
377 | }) : (function(x) {})
378 | }
379 | if (ENVIRONMENT_IS_WORKER) {
380 | Module["load"] = importScripts
381 | }
382 | if (typeof Module["setWindowTitle"] === "undefined") {
383 | Module["setWindowTitle"] = (function(title) {
384 | document.title = title
385 | })
386 | }
387 | } else {
388 | throw "Unknown runtime environment. Where are we?"
389 | }
390 |
391 | function globalEval(x) {
392 | eval.call(null, x)
393 | }
394 | if (!Module["load"] && Module["read"]) {
395 | Module["load"] = function load(f) {
396 | globalEval(Module["read"](f))
397 | }
398 | }
399 | if (!Module["print"]) {
400 | Module["print"] = (function() {})
401 | }
402 | if (!Module["printErr"]) {
403 | Module["printErr"] = Module["print"]
404 | }
405 | if (!Module["arguments"]) {
406 | Module["arguments"] = []
407 | }
408 | if (!Module["thisProgram"]) {
409 | Module["thisProgram"] = "./this.program"
410 | }
411 | if (!Module["quit"]) {
412 | Module["quit"] = (function(status, toThrow) {
413 | throw toThrow
414 | })
415 | }
416 | Module.print = Module["print"];
417 | Module.printErr = Module["printErr"];
418 | Module["preRun"] = [];
419 | Module["postRun"] = [];
420 | for (var key in moduleOverrides) {
421 | if (moduleOverrides.hasOwnProperty(key)) {
422 | Module[key] = moduleOverrides[key]
423 | }
424 | }
425 | moduleOverrides = undefined;
426 | var Runtime = {
427 | setTempRet0: (function(value) {
428 | tempRet0 = value;
429 | return value
430 | }),
431 | getTempRet0: (function() {
432 | return tempRet0
433 | }),
434 | stackSave: (function() {
435 | return STACKTOP
436 | }),
437 | stackRestore: (function(stackTop) {
438 | STACKTOP = stackTop
439 | }),
440 | getNativeTypeSize: (function(type) {
441 | switch (type) {
442 | case "i1":
443 | case "i8":
444 | return 1;
445 | case "i16":
446 | return 2;
447 | case "i32":
448 | return 4;
449 | case "i64":
450 | return 8;
451 | case "float":
452 | return 4;
453 | case "double":
454 | return 8;
455 | default:
456 | {
457 | if (type[type.length - 1] === "*") {
458 | return Runtime.QUANTUM_SIZE
459 | } else if (type[0] === "i") {
460 | var bits = parseInt(type.substr(1));
461 | assert(bits % 8 === 0);
462 | return bits / 8
463 | } else {
464 | return 0
465 | }
466 | }
467 | }
468 | }),
469 | getNativeFieldSize: (function(type) {
470 | return Math.max(Runtime.getNativeTypeSize(type), Runtime.QUANTUM_SIZE)
471 | }),
472 | STACK_ALIGN: 16,
473 | prepVararg: (function(ptr, type) {
474 | if (type === "double" || type === "i64") {
475 | if (ptr & 7) {
476 | assert((ptr & 7) === 4);
477 | ptr += 4
478 | }
479 | } else {
480 | assert((ptr & 3) === 0)
481 | }
482 | return ptr
483 | }),
484 | getAlignSize: (function(type, size, vararg) {
485 | if (!vararg && (type == "i64" || type == "double")) return 8;
486 | if (!type) return Math.min(size, 8);
487 | return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE)
488 | }),
489 | dynCall: (function(sig, ptr, args) {
490 | if (args && args.length) {
491 | return Module["dynCall_" + sig].apply(null, [ptr].concat(args))
492 | } else {
493 | return Module["dynCall_" + sig].call(null, ptr)
494 | }
495 | }),
496 | functionPointers: [],
497 | addFunction: (function(func) {
498 | for (var i = 0; i < Runtime.functionPointers.length; i++) {
499 | if (!Runtime.functionPointers[i]) {
500 | Runtime.functionPointers[i] = func;
501 | return 2 * (1 + i)
502 | }
503 | }
504 | throw "Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS."
505 | }),
506 | removeFunction: (function(index) {
507 | Runtime.functionPointers[(index - 2) / 2] = null
508 | }),
509 | warnOnce: (function(text) {
510 | if (!Runtime.warnOnce.shown) Runtime.warnOnce.shown = {};
511 | if (!Runtime.warnOnce.shown[text]) {
512 | Runtime.warnOnce.shown[text] = 1;
513 | Module.printErr(text)
514 | }
515 | }),
516 | funcWrappers: {},
517 | getFuncWrapper: (function(func, sig) {
518 | assert(sig);
519 | if (!Runtime.funcWrappers[sig]) {
520 | Runtime.funcWrappers[sig] = {}
521 | }
522 | var sigCache = Runtime.funcWrappers[sig];
523 | if (!sigCache[func]) {
524 | if (sig.length === 1) {
525 | sigCache[func] = function dynCall_wrapper() {
526 | return Runtime.dynCall(sig, func)
527 | }
528 | } else if (sig.length === 2) {
529 | sigCache[func] = function dynCall_wrapper(arg) {
530 | return Runtime.dynCall(sig, func, [arg])
531 | }
532 | } else {
533 | sigCache[func] = function dynCall_wrapper() {
534 | return Runtime.dynCall(sig, func, Array.prototype.slice.call(arguments))
535 | }
536 | }
537 | }
538 | return sigCache[func]
539 | }),
540 | getCompilerSetting: (function(name) {
541 | throw "You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work"
542 | }),
543 | stackAlloc: (function(size) {
544 | var ret = STACKTOP;
545 | STACKTOP = STACKTOP + size | 0;
546 | STACKTOP = STACKTOP + 15 & -16;
547 | return ret
548 | }),
549 | staticAlloc: (function(size) {
550 | var ret = STATICTOP;
551 | STATICTOP = STATICTOP + size | 0;
552 | STATICTOP = STATICTOP + 15 & -16;
553 | return ret
554 | }),
555 | dynamicAlloc: (function(size) {
556 | var ret = HEAP32[DYNAMICTOP_PTR >> 2];
557 | var end = (ret + size + 15 | 0) & -16;
558 | HEAP32[DYNAMICTOP_PTR >> 2] = end;
559 | if (end >= TOTAL_MEMORY) {
560 | var success = enlargeMemory();
561 | if (!success) {
562 | HEAP32[DYNAMICTOP_PTR >> 2] = ret;
563 | return 0
564 | }
565 | }
566 | return ret
567 | }),
568 | alignMemory: (function(size, quantum) {
569 | var ret = size = Math.ceil(size / (quantum ? quantum : 16)) * (quantum ? quantum : 16);
570 | return ret
571 | }),
572 | makeBigInt: (function(low, high, unsigned) {
573 | var ret = unsigned ? +(low >>> 0) + +(high >>> 0) * 4294967296 : +(low >>> 0) + +(high | 0) * 4294967296;
574 | return ret
575 | }),
576 | GLOBAL_BASE: 1024,
577 | QUANTUM_SIZE: 4,
578 | __dummy__: 0
579 | };
580 | Module["Runtime"] = Runtime;
581 | var ABORT = 0;
582 | var EXITSTATUS = 0;
583 |
584 | function assert(condition, text) {
585 | if (!condition) {
586 | abort("Assertion failed: " + text)
587 | }
588 | }
589 |
590 | function getCFunc(ident) {
591 | var func = Module["_" + ident];
592 | if (!func) {
593 | try {
594 | func = eval("_" + ident)
595 | } catch (e) {}
596 | }
597 | assert(func, "Cannot call unknown function " + ident + " (perhaps LLVM optimizations or closure removed it?)");
598 | return func
599 | }
600 | var cwrap, ccall;
601 | ((function() {
602 | var JSfuncs = {
603 | "stackSave": (function() {
604 | Runtime.stackSave()
605 | }),
606 | "stackRestore": (function() {
607 | Runtime.stackRestore()
608 | }),
609 | "arrayToC": (function(arr) {
610 | var ret = Runtime.stackAlloc(arr.length);
611 | writeArrayToMemory(arr, ret);
612 | return ret
613 | }),
614 | "stringToC": (function(str) {
615 | var ret = 0;
616 | if (str !== null && str !== undefined && str !== 0) {
617 | var len = (str.length << 2) + 1;
618 | ret = Runtime.stackAlloc(len);
619 | stringToUTF8(str, ret, len)
620 | }
621 | return ret
622 | })
623 | };
624 | var toC = {
625 | "string": JSfuncs["stringToC"],
626 | "array": JSfuncs["arrayToC"]
627 | };
628 | ccall = function ccallFunc(ident, returnType, argTypes, args, opts) {
629 | var func = getCFunc(ident);
630 | var cArgs = [];
631 | var stack = 0;
632 | if (args) {
633 | for (var i = 0; i < args.length; i++) {
634 | var converter = toC[argTypes[i]];
635 | if (converter) {
636 | if (stack === 0) stack = Runtime.stackSave();
637 | cArgs[i] = converter(args[i])
638 | } else {
639 | cArgs[i] = args[i]
640 | }
641 | }
642 | }
643 | var ret = func.apply(null, cArgs);
644 | if (returnType === "string") ret = Pointer_stringify(ret);
645 | if (stack !== 0) {
646 | if (opts && opts.async) {
647 | EmterpreterAsync.asyncFinalizers.push((function() {
648 | Runtime.stackRestore(stack)
649 | }));
650 | return
651 | }
652 | Runtime.stackRestore(stack)
653 | }
654 | return ret
655 | };
656 | var sourceRegex = /^function\s*[a-zA-Z$_0-9]*\s*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;
657 |
658 | function parseJSFunc(jsfunc) {
659 | var parsed = jsfunc.toString().match(sourceRegex).slice(1);
660 | return {
661 | arguments: parsed[0],
662 | body: parsed[1],
663 | returnValue: parsed[2]
664 | }
665 | }
666 | var JSsource = null;
667 |
668 | function ensureJSsource() {
669 | if (!JSsource) {
670 | JSsource = {};
671 | for (var fun in JSfuncs) {
672 | if (JSfuncs.hasOwnProperty(fun)) {
673 | JSsource[fun] = parseJSFunc(JSfuncs[fun])
674 | }
675 | }
676 | }
677 | }
678 | cwrap = function cwrap(ident, returnType, argTypes) {
679 | argTypes = argTypes || [];
680 | var cfunc = getCFunc(ident);
681 | var numericArgs = argTypes.every((function(type) {
682 | return type === "number"
683 | }));
684 | var numericRet = returnType !== "string";
685 | if (numericRet && numericArgs) {
686 | return cfunc
687 | }
688 | var argNames = argTypes.map((function(x, i) {
689 | return "$" + i
690 | }));
691 | var funcstr = "(function(" + argNames.join(",") + ") {";
692 | var nargs = argTypes.length;
693 | if (!numericArgs) {
694 | ensureJSsource();
695 | funcstr += "var stack = " + JSsource["stackSave"].body + ";";
696 | for (var i = 0; i < nargs; i++) {
697 | var arg = argNames[i],
698 | type = argTypes[i];
699 | if (type === "number") continue;
700 | var convertCode = JSsource[type + "ToC"];
701 | funcstr += "var " + convertCode.arguments + " = " + arg + ";";
702 | funcstr += convertCode.body + ";";
703 | funcstr += arg + "=(" + convertCode.returnValue + ");"
704 | }
705 | }
706 | var cfuncname = parseJSFunc((function() {
707 | return cfunc
708 | })).returnValue;
709 | funcstr += "var ret = " + cfuncname + "(" + argNames.join(",") + ");";
710 | if (!numericRet) {
711 | var strgfy = parseJSFunc((function() {
712 | return Pointer_stringify
713 | })).returnValue;
714 | funcstr += "ret = " + strgfy + "(ret);"
715 | }
716 | if (!numericArgs) {
717 | ensureJSsource();
718 | funcstr += JSsource["stackRestore"].body.replace("()", "(stack)") + ";"
719 | }
720 | funcstr += "return ret})";
721 | return eval(funcstr)
722 | }
723 | }))();
724 | Module["ccall"] = ccall;
725 | Module["cwrap"] = cwrap;
726 |
727 | function setValue(ptr, value, type, noSafe) {
728 | type = type || "i8";
729 | if (type.charAt(type.length - 1) === "*") type = "i32";
730 | switch (type) {
731 | case "i1":
732 | HEAP8[ptr >> 0] = value;
733 | break;
734 | case "i8":
735 | HEAP8[ptr >> 0] = value;
736 | break;
737 | case "i16":
738 | HEAP16[ptr >> 1] = value;
739 | break;
740 | case "i32":
741 | HEAP32[ptr >> 2] = value;
742 | break;
743 | case "i64":
744 | tempI64 = [value >>> 0, (tempDouble = value, +Math_abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math_min(+Math_floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math_ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1];
745 | break;
746 | case "float":
747 | HEAPF32[ptr >> 2] = value;
748 | break;
749 | case "double":
750 | HEAPF64[ptr >> 3] = value;
751 | break;
752 | default:
753 | abort("invalid type for setValue: " + type)
754 | }
755 | }
756 | Module["setValue"] = setValue;
757 |
758 | function getValue(ptr, type, noSafe) {
759 | type = type || "i8";
760 | if (type.charAt(type.length - 1) === "*") type = "i32";
761 | switch (type) {
762 | case "i1":
763 | return HEAP8[ptr >> 0];
764 | case "i8":
765 | return HEAP8[ptr >> 0];
766 | case "i16":
767 | return HEAP16[ptr >> 1];
768 | case "i32":
769 | return HEAP32[ptr >> 2];
770 | case "i64":
771 | return HEAP32[ptr >> 2];
772 | case "float":
773 | return HEAPF32[ptr >> 2];
774 | case "double":
775 | return HEAPF64[ptr >> 3];
776 | default:
777 | abort("invalid type for setValue: " + type)
778 | }
779 | return null
780 | }
781 | Module["getValue"] = getValue;
782 | var ALLOC_NORMAL = 0;
783 | var ALLOC_STACK = 1;
784 | var ALLOC_STATIC = 2;
785 | var ALLOC_DYNAMIC = 3;
786 | var ALLOC_NONE = 4;
787 | Module["ALLOC_NORMAL"] = ALLOC_NORMAL;
788 | Module["ALLOC_STACK"] = ALLOC_STACK;
789 | Module["ALLOC_STATIC"] = ALLOC_STATIC;
790 | Module["ALLOC_DYNAMIC"] = ALLOC_DYNAMIC;
791 | Module["ALLOC_NONE"] = ALLOC_NONE;
792 |
793 | function allocate(slab, types, allocator, ptr) {
794 | var zeroinit, size;
795 | if (typeof slab === "number") {
796 | zeroinit = true;
797 | size = slab
798 | } else {
799 | zeroinit = false;
800 | size = slab.length
801 | }
802 | var singleType = typeof types === "string" ? types : null;
803 | var ret;
804 | if (allocator == ALLOC_NONE) {
805 | ret = ptr
806 | } else {
807 | ret = [typeof _malloc === "function" ? _malloc : Runtime.staticAlloc, Runtime.stackAlloc, Runtime.staticAlloc, Runtime.dynamicAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length))
808 | }
809 | if (zeroinit) {
810 | var ptr = ret,
811 | stop;
812 | assert((ret & 3) == 0);
813 | stop = ret + (size & ~3);
814 | for (; ptr < stop; ptr += 4) {
815 | HEAP32[ptr >> 2] = 0
816 | }
817 | stop = ret + size;
818 | while (ptr < stop) {
819 | HEAP8[ptr++ >> 0] = 0
820 | }
821 | return ret
822 | }
823 | if (singleType === "i8") {
824 | if (slab.subarray || slab.slice) {
825 | HEAPU8.set(slab, ret)
826 | } else {
827 | HEAPU8.set(new Uint8Array(slab), ret)
828 | }
829 | return ret
830 | }
831 | var i = 0,
832 | type, typeSize, previousType;
833 | while (i < size) {
834 | var curr = slab[i];
835 | if (typeof curr === "function") {
836 | curr = Runtime.getFunctionIndex(curr)
837 | }
838 | type = singleType || types[i];
839 | if (type === 0) {
840 | i++;
841 | continue
842 | }
843 | if (type == "i64") type = "i32";
844 | setValue(ret + i, curr, type);
845 | if (previousType !== type) {
846 | typeSize = Runtime.getNativeTypeSize(type);
847 | previousType = type
848 | }
849 | i += typeSize
850 | }
851 | return ret
852 | }
853 | Module["allocate"] = allocate;
854 |
855 | function getMemory(size) {
856 | if (!staticSealed) return Runtime.staticAlloc(size);
857 | if (!runtimeInitialized) return Runtime.dynamicAlloc(size);
858 | return _malloc(size)
859 | }
860 | Module["getMemory"] = getMemory;
861 |
862 | function Pointer_stringify(ptr, length) {
863 | if (length === 0 || !ptr) return "";
864 | var hasUtf = 0;
865 | var t;
866 | var i = 0;
867 | while (1) {
868 | t = HEAPU8[ptr + i >> 0];
869 | hasUtf |= t;
870 | if (t == 0 && !length) break;
871 | i++;
872 | if (length && i == length) break
873 | }
874 | if (!length) length = i;
875 | var ret = "";
876 | if (hasUtf < 128) {
877 | var MAX_CHUNK = 1024;
878 | var curr;
879 | while (length > 0) {
880 | curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK)));
881 | ret = ret ? ret + curr : curr;
882 | ptr += MAX_CHUNK;
883 | length -= MAX_CHUNK
884 | }
885 | return ret
886 | }
887 | return Module["UTF8ToString"](ptr)
888 | }
889 | Module["Pointer_stringify"] = Pointer_stringify;
890 |
891 | function AsciiToString(ptr) {
892 | var str = "";
893 | while (1) {
894 | var ch = HEAP8[ptr++ >> 0];
895 | if (!ch) return str;
896 | str += String.fromCharCode(ch)
897 | }
898 | }
899 | Module["AsciiToString"] = AsciiToString;
900 |
901 | function stringToAscii(str, outPtr) {
902 | return writeAsciiToMemory(str, outPtr, false)
903 | }
904 | Module["stringToAscii"] = stringToAscii;
905 | var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;
906 |
907 | function UTF8ArrayToString(u8Array, idx) {
908 | var endPtr = idx;
909 | while (u8Array[endPtr]) ++endPtr;
910 | if (endPtr - idx > 16 && u8Array.subarray && UTF8Decoder) {
911 | return UTF8Decoder.decode(u8Array.subarray(idx, endPtr))
912 | } else {
913 | var u0, u1, u2, u3, u4, u5;
914 | var str = "";
915 | while (1) {
916 | u0 = u8Array[idx++];
917 | if (!u0) return str;
918 | if (!(u0 & 128)) {
919 | str += String.fromCharCode(u0);
920 | continue
921 | }
922 | u1 = u8Array[idx++] & 63;
923 | if ((u0 & 224) == 192) {
924 | str += String.fromCharCode((u0 & 31) << 6 | u1);
925 | continue
926 | }
927 | u2 = u8Array[idx++] & 63;
928 | if ((u0 & 240) == 224) {
929 | u0 = (u0 & 15) << 12 | u1 << 6 | u2
930 | } else {
931 | u3 = u8Array[idx++] & 63;
932 | if ((u0 & 248) == 240) {
933 | u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | u3
934 | } else {
935 | u4 = u8Array[idx++] & 63;
936 | if ((u0 & 252) == 248) {
937 | u0 = (u0 & 3) << 24 | u1 << 18 | u2 << 12 | u3 << 6 | u4
938 | } else {
939 | u5 = u8Array[idx++] & 63;
940 | u0 = (u0 & 1) << 30 | u1 << 24 | u2 << 18 | u3 << 12 | u4 << 6 | u5
941 | }
942 | }
943 | }
944 | if (u0 < 65536) {
945 | str += String.fromCharCode(u0)
946 | } else {
947 | var ch = u0 - 65536;
948 | str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023)
949 | }
950 | }
951 | }
952 | }
953 | Module["UTF8ArrayToString"] = UTF8ArrayToString;
954 |
955 | function UTF8ToString(ptr) {
956 | return UTF8ArrayToString(HEAPU8, ptr)
957 | }
958 | Module["UTF8ToString"] = UTF8ToString;
959 |
960 | function stringToUTF8Array(str, outU8Array, outIdx, maxBytesToWrite) {
961 | if (!(maxBytesToWrite > 0)) return 0;
962 | var startIdx = outIdx;
963 | var endIdx = outIdx + maxBytesToWrite - 1;
964 | for (var i = 0; i < str.length; ++i) {
965 | var u = str.charCodeAt(i);
966 | if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023;
967 | if (u <= 127) {
968 | if (outIdx >= endIdx) break;
969 | outU8Array[outIdx++] = u
970 | } else if (u <= 2047) {
971 | if (outIdx + 1 >= endIdx) break;
972 | outU8Array[outIdx++] = 192 | u >> 6;
973 | outU8Array[outIdx++] = 128 | u & 63
974 | } else if (u <= 65535) {
975 | if (outIdx + 2 >= endIdx) break;
976 | outU8Array[outIdx++] = 224 | u >> 12;
977 | outU8Array[outIdx++] = 128 | u >> 6 & 63;
978 | outU8Array[outIdx++] = 128 | u & 63
979 | } else if (u <= 2097151) {
980 | if (outIdx + 3 >= endIdx) break;
981 | outU8Array[outIdx++] = 240 | u >> 18;
982 | outU8Array[outIdx++] = 128 | u >> 12 & 63;
983 | outU8Array[outIdx++] = 128 | u >> 6 & 63;
984 | outU8Array[outIdx++] = 128 | u & 63
985 | } else if (u <= 67108863) {
986 | if (outIdx + 4 >= endIdx) break;
987 | outU8Array[outIdx++] = 248 | u >> 24;
988 | outU8Array[outIdx++] = 128 | u >> 18 & 63;
989 | outU8Array[outIdx++] = 128 | u >> 12 & 63;
990 | outU8Array[outIdx++] = 128 | u >> 6 & 63;
991 | outU8Array[outIdx++] = 128 | u & 63
992 | } else {
993 | if (outIdx + 5 >= endIdx) break;
994 | outU8Array[outIdx++] = 252 | u >> 30;
995 | outU8Array[outIdx++] = 128 | u >> 24 & 63;
996 | outU8Array[outIdx++] = 128 | u >> 18 & 63;
997 | outU8Array[outIdx++] = 128 | u >> 12 & 63;
998 | outU8Array[outIdx++] = 128 | u >> 6 & 63;
999 | outU8Array[outIdx++] = 128 | u & 63
1000 | }
1001 | }
1002 | outU8Array[outIdx] = 0;
1003 | return outIdx - startIdx
1004 | }
1005 | Module["stringToUTF8Array"] = stringToUTF8Array;
1006 |
1007 | function stringToUTF8(str, outPtr, maxBytesToWrite) {
1008 | return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite)
1009 | }
1010 | Module["stringToUTF8"] = stringToUTF8;
1011 |
1012 | function lengthBytesUTF8(str) {
1013 | var len = 0;
1014 | for (var i = 0; i < str.length; ++i) {
1015 | var u = str.charCodeAt(i);
1016 | if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023;
1017 | if (u <= 127) {
1018 | ++len
1019 | } else if (u <= 2047) {
1020 | len += 2
1021 | } else if (u <= 65535) {
1022 | len += 3
1023 | } else if (u <= 2097151) {
1024 | len += 4
1025 | } else if (u <= 67108863) {
1026 | len += 5
1027 | } else {
1028 | len += 6
1029 | }
1030 | }
1031 | return len
1032 | }
1033 | Module["lengthBytesUTF8"] = lengthBytesUTF8;
1034 | var UTF16Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le") : undefined;
1035 |
1036 | function demangle(func) {
1037 | var __cxa_demangle_func = Module["___cxa_demangle"] || Module["__cxa_demangle"];
1038 | if (__cxa_demangle_func) {
1039 | try {
1040 | var s = func.substr(1);
1041 | var len = lengthBytesUTF8(s) + 1;
1042 | var buf = _malloc(len);
1043 | stringToUTF8(s, buf, len);
1044 | var status = _malloc(4);
1045 | var ret = __cxa_demangle_func(buf, 0, 0, status);
1046 | if (getValue(status, "i32") === 0 && ret) {
1047 | return Pointer_stringify(ret)
1048 | }
1049 | } catch (e) {} finally {
1050 | if (buf) _free(buf);
1051 | if (status) _free(status);
1052 | if (ret) _free(ret)
1053 | }
1054 | return func
1055 | }
1056 | Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");
1057 | return func
1058 | }
1059 |
1060 | function demangleAll(text) {
1061 | var regex = /__Z[\w\d_]+/g;
1062 | return text.replace(regex, (function(x) {
1063 | var y = demangle(x);
1064 | return x === y ? x : x + " [" + y + "]"
1065 | }))
1066 | }
1067 |
1068 | function jsStackTrace() {
1069 | var err = new Error;
1070 | if (!err.stack) {
1071 | try {
1072 | throw new Error(0)
1073 | } catch (e) {
1074 | err = e
1075 | }
1076 | if (!err.stack) {
1077 | return "(no stack trace available)"
1078 | }
1079 | }
1080 | return err.stack.toString()
1081 | }
1082 |
1083 | function stackTrace() {
1084 | var js = jsStackTrace();
1085 | if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"]();
1086 | return demangleAll(js)
1087 | }
1088 | Module["stackTrace"] = stackTrace;
1089 | var WASM_PAGE_SIZE = 65536;
1090 | var ASMJS_PAGE_SIZE = 16777216;
1091 |
1092 | function alignUp(x, multiple) {
1093 | if (x % multiple > 0) {
1094 | x += multiple - x % multiple
1095 | }
1096 | return x
1097 | }
1098 | var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
1099 |
1100 | function updateGlobalBuffer(buf) {
1101 | Module["buffer"] = buffer = buf
1102 | }
1103 |
1104 | function updateGlobalBufferViews() {
1105 | Module["HEAP8"] = HEAP8 = new Int8Array(buffer);
1106 | Module["HEAP16"] = HEAP16 = new Int16Array(buffer);
1107 | Module["HEAP32"] = HEAP32 = new Int32Array(buffer);
1108 | Module["HEAPU8"] = HEAPU8 = new Uint8Array(buffer);
1109 | Module["HEAPU16"] = HEAPU16 = new Uint16Array(buffer);
1110 | Module["HEAPU32"] = HEAPU32 = new Uint32Array(buffer);
1111 | Module["HEAPF32"] = HEAPF32 = new Float32Array(buffer);
1112 | Module["HEAPF64"] = HEAPF64 = new Float64Array(buffer)
1113 | }
1114 | var STATIC_BASE, STATICTOP, staticSealed;
1115 | var STACK_BASE, STACKTOP, STACK_MAX;
1116 | var DYNAMIC_BASE, DYNAMICTOP_PTR;
1117 | STATIC_BASE = STATICTOP = STACK_BASE = STACKTOP = STACK_MAX = DYNAMIC_BASE = DYNAMICTOP_PTR = 0;
1118 | staticSealed = false;
1119 |
1120 | function abortOnCannotGrowMemory() {
1121 | abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value " + TOTAL_MEMORY + ", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")
1122 | }
1123 |
1124 | function enlargeMemory() {
1125 | abortOnCannotGrowMemory()
1126 | }
1127 | var TOTAL_STACK = Module["TOTAL_STACK"] || 5242880;
1128 | var TOTAL_MEMORY = Module["TOTAL_MEMORY"] || 67108864;
1129 | if (TOTAL_MEMORY < TOTAL_STACK) Module.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was " + TOTAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")");
1130 | if (Module["buffer"]) {
1131 | buffer = Module["buffer"]
1132 | } else {
1133 | if (typeof WebAssembly === "object" && typeof WebAssembly.Memory === "function") {
1134 | Module["wasmMemory"] = new WebAssembly.Memory({
1135 | "initial": TOTAL_MEMORY / WASM_PAGE_SIZE,
1136 | "maximum": TOTAL_MEMORY / WASM_PAGE_SIZE
1137 | });
1138 | buffer = Module["wasmMemory"].buffer
1139 | } else {
1140 | buffer = new ArrayBuffer(TOTAL_MEMORY)
1141 | }
1142 | }
1143 | updateGlobalBufferViews();
1144 |
1145 | function getTotalMemory() {
1146 | return TOTAL_MEMORY
1147 | }
1148 | HEAP32[0] = 1668509029;
1149 | HEAP16[1] = 25459;
1150 | if (HEAPU8[2] !== 115 || HEAPU8[3] !== 99) throw "Runtime error: expected the system to be little-endian!";
1151 | Module["HEAP"] = HEAP;
1152 | Module["buffer"] = buffer;
1153 | Module["HEAP8"] = HEAP8;
1154 | Module["HEAP16"] = HEAP16;
1155 | Module["HEAP32"] = HEAP32;
1156 | Module["HEAPU8"] = HEAPU8;
1157 | Module["HEAPU16"] = HEAPU16;
1158 | Module["HEAPU32"] = HEAPU32;
1159 | Module["HEAPF32"] = HEAPF32;
1160 | Module["HEAPF64"] = HEAPF64;
1161 |
1162 | function callRuntimeCallbacks(callbacks) {
1163 | while (callbacks.length > 0) {
1164 | var callback = callbacks.shift();
1165 | if (typeof callback == "function") {
1166 | callback();
1167 | continue
1168 | }
1169 | var func = callback.func;
1170 | if (typeof func === "number") {
1171 | if (callback.arg === undefined) {
1172 | Module["dynCall_v"](func)
1173 | } else {
1174 | Module["dynCall_vi"](func, callback.arg)
1175 | }
1176 | } else {
1177 | func(callback.arg === undefined ? null : callback.arg)
1178 | }
1179 | }
1180 | }
1181 | var __ATPRERUN__ = [];
1182 | var __ATINIT__ = [];
1183 | var __ATMAIN__ = [];
1184 | var __ATEXIT__ = [];
1185 | var __ATPOSTRUN__ = [];
1186 | var runtimeInitialized = false;
1187 | var runtimeExited = false;
1188 |
1189 | function preRun() {
1190 | if (Module["preRun"]) {
1191 | if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
1192 | while (Module["preRun"].length) {
1193 | addOnPreRun(Module["preRun"].shift())
1194 | }
1195 | }
1196 | callRuntimeCallbacks(__ATPRERUN__)
1197 | }
1198 |
1199 | function ensureInitRuntime() {
1200 | if (runtimeInitialized) return;
1201 | runtimeInitialized = true;
1202 | callRuntimeCallbacks(__ATINIT__)
1203 | }
1204 |
1205 | function preMain() {
1206 | callRuntimeCallbacks(__ATMAIN__)
1207 | }
1208 |
1209 | function exitRuntime() {
1210 | callRuntimeCallbacks(__ATEXIT__);
1211 | runtimeExited = true
1212 | }
1213 |
1214 | function postRun() {
1215 | if (Module["postRun"]) {
1216 | if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
1217 | while (Module["postRun"].length) {
1218 | addOnPostRun(Module["postRun"].shift())
1219 | }
1220 | }
1221 | callRuntimeCallbacks(__ATPOSTRUN__)
1222 | }
1223 |
1224 | function addOnPreRun(cb) {
1225 | __ATPRERUN__.unshift(cb)
1226 | }
1227 | Module["addOnPreRun"] = addOnPreRun;
1228 |
1229 | function addOnInit(cb) {
1230 | __ATINIT__.unshift(cb)
1231 | }
1232 | Module["addOnInit"] = addOnInit;
1233 |
1234 | function addOnPreMain(cb) {
1235 | __ATMAIN__.unshift(cb)
1236 | }
1237 | Module["addOnPreMain"] = addOnPreMain;
1238 |
1239 | function addOnExit(cb) {
1240 | __ATEXIT__.unshift(cb)
1241 | }
1242 | Module["addOnExit"] = addOnExit;
1243 |
1244 | function addOnPostRun(cb) {
1245 | __ATPOSTRUN__.unshift(cb)
1246 | }
1247 | Module["addOnPostRun"] = addOnPostRun;
1248 |
1249 | function intArrayFromString(stringy, dontAddNull, length) {
1250 | var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
1251 | var u8array = new Array(len);
1252 | var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
1253 | if (dontAddNull) u8array.length = numBytesWritten;
1254 | return u8array
1255 | }
1256 | Module["intArrayFromString"] = intArrayFromString;
1257 |
1258 | function intArrayToString(array) {
1259 | var ret = [];
1260 | for (var i = 0; i < array.length; i++) {
1261 | var chr = array[i];
1262 | if (chr > 255) {
1263 | chr &= 255
1264 | }
1265 | ret.push(String.fromCharCode(chr))
1266 | }
1267 | return ret.join("")
1268 | }
1269 | Module["intArrayToString"] = intArrayToString;
1270 |
1271 | function writeStringToMemory(string, buffer, dontAddNull) {
1272 | Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");
1273 | var lastChar, end;
1274 | if (dontAddNull) {
1275 | end = buffer + lengthBytesUTF8(string);
1276 | lastChar = HEAP8[end]
1277 | }
1278 | stringToUTF8(string, buffer, Infinity);
1279 | if (dontAddNull) HEAP8[end] = lastChar
1280 | }
1281 | Module["writeStringToMemory"] = writeStringToMemory;
1282 |
1283 | function writeArrayToMemory(array, buffer) {
1284 | HEAP8.set(array, buffer)
1285 | }
1286 | Module["writeArrayToMemory"] = writeArrayToMemory;
1287 |
1288 | function writeAsciiToMemory(str, buffer, dontAddNull) {
1289 | for (var i = 0; i < str.length; ++i) {
1290 | HEAP8[buffer++ >> 0] = str.charCodeAt(i)
1291 | }
1292 | if (!dontAddNull) HEAP8[buffer >> 0] = 0
1293 | }
1294 | Module["writeAsciiToMemory"] = writeAsciiToMemory;
1295 | if (!Math["imul"] || Math["imul"](4294967295, 5) !== -5) Math["imul"] = function imul(a, b) {
1296 | var ah = a >>> 16;
1297 | var al = a & 65535;
1298 | var bh = b >>> 16;
1299 | var bl = b & 65535;
1300 | return al * bl + (ah * bl + al * bh << 16) | 0
1301 | };
1302 | Math.imul = Math["imul"];
1303 | if (!Math["fround"]) {
1304 | var froundBuffer = new Float32Array(1);
1305 | Math["fround"] = (function(x) {
1306 | froundBuffer[0] = x;
1307 | return froundBuffer[0]
1308 | })
1309 | }
1310 | Math.fround = Math["fround"];
1311 | if (!Math["clz32"]) Math["clz32"] = (function(x) {
1312 | x = x >>> 0;
1313 | for (var i = 0; i < 32; i++) {
1314 | if (x & 1 << 31 - i) return i
1315 | }
1316 | return 32
1317 | });
1318 | Math.clz32 = Math["clz32"];
1319 | if (!Math["trunc"]) Math["trunc"] = (function(x) {
1320 | return x < 0 ? Math.ceil(x) : Math.floor(x)
1321 | });
1322 | Math.trunc = Math["trunc"];
1323 | var Math_abs = Math.abs;
1324 | var Math_cos = Math.cos;
1325 | var Math_sin = Math.sin;
1326 | var Math_tan = Math.tan;
1327 | var Math_acos = Math.acos;
1328 | var Math_asin = Math.asin;
1329 | var Math_atan = Math.atan;
1330 | var Math_atan2 = Math.atan2;
1331 | var Math_exp = Math.exp;
1332 | var Math_log = Math.log;
1333 | var Math_sqrt = Math.sqrt;
1334 | var Math_ceil = Math.ceil;
1335 | var Math_floor = Math.floor;
1336 | var Math_pow = Math.pow;
1337 | var Math_imul = Math.imul;
1338 | var Math_fround = Math.fround;
1339 | var Math_round = Math.round;
1340 | var Math_min = Math.min;
1341 | var Math_clz32 = Math.clz32;
1342 | var Math_trunc = Math.trunc;
1343 | var runDependencies = 0;
1344 | var runDependencyWatcher = null;
1345 | var dependenciesFulfilled = null;
1346 |
1347 | function addRunDependency(id) {
1348 | runDependencies++;
1349 | if (Module["monitorRunDependencies"]) {
1350 | Module["monitorRunDependencies"](runDependencies)
1351 | }
1352 | }
1353 | Module["addRunDependency"] = addRunDependency;
1354 |
1355 | function removeRunDependency(id) {
1356 | runDependencies--;
1357 | if (Module["monitorRunDependencies"]) {
1358 | Module["monitorRunDependencies"](runDependencies)
1359 | }
1360 | if (runDependencies == 0) {
1361 | if (runDependencyWatcher !== null) {
1362 | clearInterval(runDependencyWatcher);
1363 | runDependencyWatcher = null
1364 | }
1365 | if (dependenciesFulfilled) {
1366 | var callback = dependenciesFulfilled;
1367 | dependenciesFulfilled = null;
1368 | callback()
1369 | }
1370 | }
1371 | }
1372 | Module["removeRunDependency"] = removeRunDependency;
1373 | Module["preloadedImages"] = {};
1374 | Module["preloadedAudios"] = {};
1375 | var memoryInitializer = null;
1376 |
1377 | function integrateWasmJS(Module) {
1378 | var method = Module["wasmJSMethod"] || "native-wasm";
1379 | Module["wasmJSMethod"] = method;
1380 | var wasmTextFile = Module["wasmTextFile"] || "opus.wasm.wast";
1381 | var wasmBinaryFile = Module["wasmBinaryFile"] || self["cr_opusWasmBinaryUrl"] || "opus.wasm.wasm";
1382 | var asmjsCodeFile = Module["asmjsCodeFile"] || "opus.wasm.temp.asm.js";
1383 | if (typeof Module["locateFile"] === "function") {
1384 | wasmTextFile = Module["locateFile"](wasmTextFile);
1385 | wasmBinaryFile = Module["locateFile"](wasmBinaryFile);
1386 | asmjsCodeFile = Module["locateFile"](asmjsCodeFile)
1387 | }
1388 | var wasmPageSize = 64 * 1024;
1389 | var asm2wasmImports = {
1390 | "f64-rem": (function(x, y) {
1391 | return x % y
1392 | }),
1393 | "f64-to-int": (function(x) {
1394 | return x | 0
1395 | }),
1396 | "i32s-div": (function(x, y) {
1397 | return (x | 0) / (y | 0) | 0
1398 | }),
1399 | "i32u-div": (function(x, y) {
1400 | return (x >>> 0) / (y >>> 0) >>> 0
1401 | }),
1402 | "i32s-rem": (function(x, y) {
1403 | return (x | 0) % (y | 0) | 0
1404 | }),
1405 | "i32u-rem": (function(x, y) {
1406 | return (x >>> 0) % (y >>> 0) >>> 0
1407 | }),
1408 | "debugger": (function() {
1409 | debugger
1410 | })
1411 | };
1412 | var info = {
1413 | "global": null,
1414 | "env": null,
1415 | "asm2wasm": asm2wasmImports,
1416 | "parent": Module
1417 | };
1418 | var exports = null;
1419 |
1420 | function lookupImport(mod, base) {
1421 | var lookup = info;
1422 | if (mod.indexOf(".") < 0) {
1423 | lookup = (lookup || {})[mod]
1424 | } else {
1425 | var parts = mod.split(".");
1426 | lookup = (lookup || {})[parts[0]];
1427 | lookup = (lookup || {})[parts[1]]
1428 | }
1429 | if (base) {
1430 | lookup = (lookup || {})[base]
1431 | }
1432 | if (lookup === undefined) {
1433 | abort("bad lookupImport to (" + mod + ")." + base)
1434 | }
1435 | return lookup
1436 | }
1437 |
1438 | function mergeMemory(newBuffer) {
1439 | var oldBuffer = Module["buffer"];
1440 | if (newBuffer.byteLength < oldBuffer.byteLength) {
1441 | Module["printErr"]("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here")
1442 | }
1443 | var oldView = new Int8Array(oldBuffer);
1444 | var newView = new Int8Array(newBuffer);
1445 | if (!memoryInitializer) {
1446 | oldView.set(newView.subarray(Module["STATIC_BASE"], Module["STATIC_BASE"] + Module["STATIC_BUMP"]), Module["STATIC_BASE"])
1447 | }
1448 | newView.set(oldView);
1449 | updateGlobalBuffer(newBuffer);
1450 | updateGlobalBufferViews()
1451 | }
1452 | var WasmTypes = {
1453 | none: 0,
1454 | i32: 1,
1455 | i64: 2,
1456 | f32: 3,
1457 | f64: 4
1458 | };
1459 |
1460 | function fixImports(imports) {
1461 | if (!0) return imports;
1462 | var ret = {};
1463 | for (var i in imports) {
1464 | var fixed = i;
1465 | if (fixed[0] == "_") fixed = fixed.substr(1);
1466 | ret[fixed] = imports[i]
1467 | }
1468 | return ret
1469 | }
1470 |
1471 | function getBinary() {
1472 | try {
1473 | var binary;
1474 | if (Module["wasmBinary"]) {
1475 | binary = Module["wasmBinary"];
1476 | binary = new Uint8Array(binary)
1477 | } else if (Module["readBinary"]) {
1478 | binary = Module["readBinary"](wasmBinaryFile)
1479 | } else {
1480 | throw "on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)"
1481 | }
1482 | return binary
1483 | } catch (err) {
1484 | abort(err)
1485 | }
1486 | }
1487 |
1488 | function getBinaryPromise() {
1489 | return new Promise((resolve, reject) =>
1490 | {
1491 | const buffer = self.sentBuffers.get("opus-decoder-wasm");
1492 | if (buffer)
1493 | return resolve(new Uint8Array(buffer));
1494 |
1495 | const blob = self.sentBlobs.get("opus-decoder-wasm");
1496 | if (!blob)
1497 | return reject("not yet received opus blob");
1498 |
1499 | const fileReader = new FileReader();
1500 | fileReader.onload = () => resolve(new Uint8Array(fileReader["result"]));
1501 | fileReader.onerror = () => reject(fileReader["error"]);
1502 | fileReader.readAsArrayBuffer(blob);
1503 | });
1504 | }
1505 |
1506 | function doJustAsm(global, env, providedBuffer) {
1507 | if (typeof Module["asm"] !== "function" || Module["asm"] === methodHandler) {
1508 | if (!Module["asmPreload"]) {
1509 | eval(Module["read"](asmjsCodeFile))
1510 | } else {
1511 | Module["asm"] = Module["asmPreload"]
1512 | }
1513 | }
1514 | if (typeof Module["asm"] !== "function") {
1515 | Module["printErr"]("asm evalling did not set the module properly");
1516 | return false
1517 | }
1518 | return Module["asm"](global, env, providedBuffer)
1519 | }
1520 |
1521 | function doNativeWasm(global, env, providedBuffer) {
1522 | if (typeof WebAssembly !== "object") {
1523 | Module["printErr"]("no native wasm support detected");
1524 | return false
1525 | }
1526 | if (!(Module["wasmMemory"] instanceof WebAssembly.Memory)) {
1527 | Module["printErr"]("no native wasm Memory in use");
1528 | return false
1529 | }
1530 | env["memory"] = Module["wasmMemory"];
1531 | info["global"] = {
1532 | "NaN": NaN,
1533 | "Infinity": Infinity
1534 | };
1535 | info["global.Math"] = global.Math;
1536 | info["env"] = env;
1537 |
1538 | function receiveInstance(instance) {
1539 | exports = instance.exports;
1540 | if (exports.memory) mergeMemory(exports.memory);
1541 | Module["asm"] = exports;
1542 | Module["usingWasm"] = true;
1543 | removeRunDependency("wasm-instantiate")
1544 | }
1545 | addRunDependency("wasm-instantiate");
1546 | if (Module["instantiateWasm"]) {
1547 | try {
1548 | return Module["instantiateWasm"](info, receiveInstance)
1549 | } catch (e) {
1550 | Module["printErr"]("Module.instantiateWasm callback failed with error: " + e);
1551 | return false
1552 | }
1553 | }
1554 | getBinaryPromise().then((function(binary) {
1555 | return WebAssembly.instantiate(binary, info)
1556 | })).then((function(output) {
1557 | receiveInstance(output["instance"])
1558 | })).catch((function(reason) {
1559 | Module["printErr"]("failed to asynchronously prepare wasm: " + reason);
1560 | abort(reason)
1561 | }));
1562 | return {}
1563 | }
1564 |
1565 | function doWasmPolyfill(global, env, providedBuffer, method) {
1566 | if (typeof WasmJS !== "function") {
1567 | Module["printErr"]("WasmJS not detected - polyfill not bundled?");
1568 | return false
1569 | }
1570 | var wasmJS = WasmJS({});
1571 | wasmJS["outside"] = Module;
1572 | wasmJS["info"] = info;
1573 | wasmJS["lookupImport"] = lookupImport;
1574 | assert(providedBuffer === Module["buffer"]);
1575 | info.global = global;
1576 | info.env = env;
1577 | assert(providedBuffer === Module["buffer"]);
1578 | env["memory"] = providedBuffer;
1579 | assert(env["memory"] instanceof ArrayBuffer);
1580 | wasmJS["providedTotalMemory"] = Module["buffer"].byteLength;
1581 | var code;
1582 | if (method === "interpret-binary") {
1583 | code = getBinary()
1584 | } else {
1585 | code = Module["read"](method == "interpret-asm2wasm" ? asmjsCodeFile : wasmTextFile)
1586 | }
1587 | var temp;
1588 | if (method == "interpret-asm2wasm") {
1589 | temp = wasmJS["_malloc"](code.length + 1);
1590 | wasmJS["writeAsciiToMemory"](code, temp);
1591 | wasmJS["_load_asm2wasm"](temp)
1592 | } else if (method === "interpret-s-expr") {
1593 | temp = wasmJS["_malloc"](code.length + 1);
1594 | wasmJS["writeAsciiToMemory"](code, temp);
1595 | wasmJS["_load_s_expr2wasm"](temp)
1596 | } else if (method === "interpret-binary") {
1597 | temp = wasmJS["_malloc"](code.length);
1598 | wasmJS["HEAPU8"].set(code, temp);
1599 | wasmJS["_load_binary2wasm"](temp, code.length)
1600 | } else {
1601 | throw "what? " + method
1602 | }
1603 | wasmJS["_free"](temp);
1604 | wasmJS["_instantiate"](temp);
1605 | if (Module["newBuffer"]) {
1606 | mergeMemory(Module["newBuffer"]);
1607 | Module["newBuffer"] = null
1608 | }
1609 | exports = wasmJS["asmExports"];
1610 | return exports
1611 | }
1612 | Module["asmPreload"] = Module["asm"];
1613 | var asmjsReallocBuffer = Module["reallocBuffer"];
1614 | var wasmReallocBuffer = (function(size) {
1615 | var PAGE_MULTIPLE = Module["usingWasm"] ? WASM_PAGE_SIZE : ASMJS_PAGE_SIZE;
1616 | size = alignUp(size, PAGE_MULTIPLE);
1617 | var old = Module["buffer"];
1618 | var oldSize = old.byteLength;
1619 | if (Module["usingWasm"]) {
1620 | try {
1621 | var result = Module["wasmMemory"].grow((size - oldSize) / wasmPageSize);
1622 | if (result !== (-1 | 0)) {
1623 | return Module["buffer"] = Module["wasmMemory"].buffer
1624 | } else {
1625 | return null
1626 | }
1627 | } catch (e) {
1628 | return null
1629 | }
1630 | } else {
1631 | exports["__growWasmMemory"]((size - oldSize) / wasmPageSize);
1632 | return Module["buffer"] !== old ? Module["buffer"] : null
1633 | }
1634 | });
1635 | Module["reallocBuffer"] = (function(size) {
1636 | if (finalMethod === "asmjs") {
1637 | return asmjsReallocBuffer(size)
1638 | } else {
1639 | return wasmReallocBuffer(size)
1640 | }
1641 | });
1642 | var finalMethod = "";
1643 | Module["asm"] = (function(global, env, providedBuffer) {
1644 | global = fixImports(global);
1645 | env = fixImports(env);
1646 | if (!env["table"]) {
1647 | var TABLE_SIZE = Module["wasmTableSize"];
1648 | if (TABLE_SIZE === undefined) TABLE_SIZE = 1024;
1649 | var MAX_TABLE_SIZE = Module["wasmMaxTableSize"];
1650 | if (typeof WebAssembly === "object" && typeof WebAssembly.Table === "function") {
1651 | if (MAX_TABLE_SIZE !== undefined) {
1652 | env["table"] = new WebAssembly.Table({
1653 | "initial": TABLE_SIZE,
1654 | "maximum": MAX_TABLE_SIZE,
1655 | "element": "anyfunc"
1656 | })
1657 | } else {
1658 | env["table"] = new WebAssembly.Table({
1659 | "initial": TABLE_SIZE,
1660 | element: "anyfunc"
1661 | })
1662 | }
1663 | } else {
1664 | env["table"] = new Array(TABLE_SIZE)
1665 | }
1666 | Module["wasmTable"] = env["table"]
1667 | }
1668 | if (!env["memoryBase"]) {
1669 | env["memoryBase"] = Module["STATIC_BASE"]
1670 | }
1671 | if (!env["tableBase"]) {
1672 | env["tableBase"] = 0
1673 | }
1674 | var exports;
1675 | var methods = method.split(",");
1676 | for (var i = 0; i < methods.length; i++) {
1677 | var curr = methods[i];
1678 | finalMethod = curr;
1679 | if (curr === "native-wasm") {
1680 | if (exports = doNativeWasm(global, env, providedBuffer)) break
1681 | } else if (curr === "asmjs") {
1682 | if (exports = doJustAsm(global, env, providedBuffer)) break
1683 | } else if (curr === "interpret-asm2wasm" || curr === "interpret-s-expr" || curr === "interpret-binary") {
1684 | if (exports = doWasmPolyfill(global, env, providedBuffer, curr)) break
1685 | } else {
1686 | abort("bad method: " + curr)
1687 | }
1688 | }
1689 | if (!exports) throw "no binaryen method succeeded. consider enabling more options, like interpreting, if you want that: https://github.com/kripken/emscripten/wiki/WebAssembly#binaryen-methods";
1690 | return exports
1691 | });
1692 | var methodHandler = Module["asm"]
1693 | }
1694 | integrateWasmJS(Module);
1695 | var ASM_CONSTS = [];
1696 | STATIC_BASE = Runtime.GLOBAL_BASE;
1697 | STATICTOP = STATIC_BASE + 28816;
1698 | __ATINIT__.push();
1699 | memoryInitializer = Module["wasmJSMethod"].indexOf("asmjs") >= 0 || Module["wasmJSMethod"].indexOf("interpret-asm2wasm") >= 0 ? "opus.wasm.js.mem" : null;
1700 | var STATIC_BUMP = 28816;
1701 | Module["STATIC_BASE"] = STATIC_BASE;
1702 | Module["STATIC_BUMP"] = STATIC_BUMP;
1703 | var tempDoublePtr = STATICTOP;
1704 | STATICTOP += 16;
1705 |
1706 | function _llvm_stackrestore(p) {
1707 | var self = _llvm_stacksave;
1708 | var ret = self.LLVM_SAVEDSTACKS[p];
1709 | self.LLVM_SAVEDSTACKS.splice(p, 1);
1710 | Runtime.stackRestore(ret)
1711 | }
1712 |
1713 | function ___setErrNo(value) {
1714 | if (Module["___errno_location"]) HEAP32[Module["___errno_location"]() >> 2] = value;
1715 | return value
1716 | }
1717 | Module["_sbrk"] = _sbrk;
1718 | Module["_memset"] = _memset;
1719 |
1720 | function _emscripten_memcpy_big(dest, src, num) {
1721 | HEAPU8.set(HEAPU8.subarray(src, src + num), dest);
1722 | return dest
1723 | }
1724 | Module["_memcpy"] = _memcpy;
1725 | Module["_memmove"] = _memmove;
1726 |
1727 | function _llvm_stacksave() {
1728 | var self = _llvm_stacksave;
1729 | if (!self.LLVM_SAVEDSTACKS) {
1730 | self.LLVM_SAVEDSTACKS = []
1731 | }
1732 | self.LLVM_SAVEDSTACKS.push(Runtime.stackSave());
1733 | return self.LLVM_SAVEDSTACKS.length - 1
1734 | }
1735 | DYNAMICTOP_PTR = allocate(1, "i32", ALLOC_STATIC);
1736 | STACK_BASE = STACKTOP = Runtime.alignMemory(STATICTOP);
1737 | STACK_MAX = STACK_BASE + TOTAL_STACK;
1738 | DYNAMIC_BASE = Runtime.alignMemory(STACK_MAX);
1739 | HEAP32[DYNAMICTOP_PTR >> 2] = DYNAMIC_BASE;
1740 | staticSealed = true;
1741 | Module["wasmTableSize"] = 0;
1742 | Module["wasmMaxTableSize"] = 0;
1743 | Module.asmGlobalArg = {
1744 | "Math": Math,
1745 | "Int8Array": Int8Array,
1746 | "Int16Array": Int16Array,
1747 | "Int32Array": Int32Array,
1748 | "Uint8Array": Uint8Array,
1749 | "Uint16Array": Uint16Array,
1750 | "Uint32Array": Uint32Array,
1751 | "Float32Array": Float32Array,
1752 | "Float64Array": Float64Array,
1753 | "NaN": NaN,
1754 | "Infinity": Infinity
1755 | };
1756 | Module.asmLibraryArg = {
1757 | "abort": abort,
1758 | "assert": assert,
1759 | "enlargeMemory": enlargeMemory,
1760 | "getTotalMemory": getTotalMemory,
1761 | "abortOnCannotGrowMemory": abortOnCannotGrowMemory,
1762 | "_llvm_stackrestore": _llvm_stackrestore,
1763 | "_llvm_stacksave": _llvm_stacksave,
1764 | "_emscripten_memcpy_big": _emscripten_memcpy_big,
1765 | "___setErrNo": ___setErrNo,
1766 | "DYNAMICTOP_PTR": DYNAMICTOP_PTR,
1767 | "tempDoublePtr": tempDoublePtr,
1768 | "ABORT": ABORT,
1769 | "STACKTOP": STACKTOP,
1770 | "STACK_MAX": STACK_MAX
1771 | };
1772 | var asm = Module["asm"](Module.asmGlobalArg, Module.asmLibraryArg, buffer);
1773 | Module["asm"] = asm;
1774 | var _malloc = Module["_malloc"] = (function() {
1775 | return Module["asm"]["_malloc"].apply(null, arguments)
1776 | });
1777 | var _destroy_decoder = Module["_destroy_decoder"] = (function() {
1778 | return Module["asm"]["_destroy_decoder"].apply(null, arguments)
1779 | });
1780 | var getTempRet0 = Module["getTempRet0"] = (function() {
1781 | return Module["asm"]["getTempRet0"].apply(null, arguments)
1782 | });
1783 | var _free = Module["_free"] = (function() {
1784 | return Module["asm"]["_free"].apply(null, arguments)
1785 | });
1786 | var runPostSets = Module["runPostSets"] = (function() {
1787 | return Module["asm"]["runPostSets"].apply(null, arguments)
1788 | });
1789 | var setTempRet0 = Module["setTempRet0"] = (function() {
1790 | return Module["asm"]["setTempRet0"].apply(null, arguments)
1791 | });
1792 | var establishStackSpace = Module["establishStackSpace"] = (function() {
1793 | return Module["asm"]["establishStackSpace"].apply(null, arguments)
1794 | });
1795 | var _memmove = Module["_memmove"] = (function() {
1796 | return Module["asm"]["_memmove"].apply(null, arguments)
1797 | });
1798 | var _decode_frame = Module["_decode_frame"] = (function() {
1799 | return Module["asm"]["_decode_frame"].apply(null, arguments)
1800 | });
1801 | var stackSave = Module["stackSave"] = (function() {
1802 | return Module["asm"]["stackSave"].apply(null, arguments)
1803 | });
1804 | var _memset = Module["_memset"] = (function() {
1805 | return Module["asm"]["_memset"].apply(null, arguments)
1806 | });
1807 | var _sbrk = Module["_sbrk"] = (function() {
1808 | return Module["asm"]["_sbrk"].apply(null, arguments)
1809 | });
1810 | var _emscripten_get_global_libc = Module["_emscripten_get_global_libc"] = (function() {
1811 | return Module["asm"]["_emscripten_get_global_libc"].apply(null, arguments)
1812 | });
1813 | var _memcpy = Module["_memcpy"] = (function() {
1814 | return Module["asm"]["_memcpy"].apply(null, arguments)
1815 | });
1816 | var _create_decoder = Module["_create_decoder"] = (function() {
1817 | return Module["asm"]["_create_decoder"].apply(null, arguments)
1818 | });
1819 | var setThrew = Module["setThrew"] = (function() {
1820 | return Module["asm"]["setThrew"].apply(null, arguments)
1821 | });
1822 | var stackRestore = Module["stackRestore"] = (function() {
1823 | return Module["asm"]["stackRestore"].apply(null, arguments)
1824 | });
1825 | var ___errno_location = Module["___errno_location"] = (function() {
1826 | return Module["asm"]["___errno_location"].apply(null, arguments)
1827 | });
1828 | var stackAlloc = Module["stackAlloc"] = (function() {
1829 | return Module["asm"]["stackAlloc"].apply(null, arguments)
1830 | });
1831 | Runtime.stackAlloc = Module["stackAlloc"];
1832 | Runtime.stackSave = Module["stackSave"];
1833 | Runtime.stackRestore = Module["stackRestore"];
1834 | Runtime.establishStackSpace = Module["establishStackSpace"];
1835 | Runtime.setTempRet0 = Module["setTempRet0"];
1836 | Runtime.getTempRet0 = Module["getTempRet0"];
1837 | Module["asm"] = asm;
1838 | if (memoryInitializer) {
1839 | if (typeof Module["locateFile"] === "function") {
1840 | memoryInitializer = Module["locateFile"](memoryInitializer)
1841 | } else if (Module["memoryInitializerPrefixURL"]) {
1842 | memoryInitializer = Module["memoryInitializerPrefixURL"] + memoryInitializer
1843 | }
1844 | if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) {
1845 | var data = Module["readBinary"](memoryInitializer);
1846 | HEAPU8.set(data, Runtime.GLOBAL_BASE)
1847 | } else {
1848 | addRunDependency("memory initializer");
1849 | var applyMemoryInitializer = (function(data) {
1850 | if (data.byteLength) data = new Uint8Array(data);
1851 | HEAPU8.set(data, Runtime.GLOBAL_BASE);
1852 | if (Module["memoryInitializerRequest"]) delete Module["memoryInitializerRequest"].response;
1853 | removeRunDependency("memory initializer")
1854 | });
1855 |
1856 | function doBrowserLoad() {
1857 | Module["readAsync"](memoryInitializer, applyMemoryInitializer, (function() {
1858 | throw "could not load memory initializer " + memoryInitializer
1859 | }))
1860 | }
1861 | if (Module["memoryInitializerRequest"]) {
1862 | function useRequest() {
1863 | var request = Module["memoryInitializerRequest"];
1864 | if (request.status !== 200 && request.status !== 0) {
1865 | console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: " + request.status + ", retrying " + memoryInitializer);
1866 | doBrowserLoad();
1867 | return
1868 | }
1869 | applyMemoryInitializer(request.response)
1870 | }
1871 | if (Module["memoryInitializerRequest"].response) {
1872 | setTimeout(useRequest, 0)
1873 | } else {
1874 | Module["memoryInitializerRequest"].addEventListener("load", useRequest)
1875 | }
1876 | } else {
1877 | doBrowserLoad()
1878 | }
1879 | }
1880 | }
1881 |
1882 | function ExitStatus(status) {
1883 | this.name = "ExitStatus";
1884 | this.message = "Program terminated with exit(" + status + ")";
1885 | this.status = status
1886 | }
1887 | ExitStatus.prototype = new Error;
1888 | ExitStatus.prototype.constructor = ExitStatus;
1889 | var initialStackTop;
1890 | var preloadStartTime = null;
1891 | var calledMain = false;
1892 | dependenciesFulfilled = function runCaller() {
1893 | if (!Module["calledRun"]) run();
1894 | if (!Module["calledRun"]) dependenciesFulfilled = runCaller
1895 | };
1896 | Module["callMain"] = Module.callMain = function callMain(args) {
1897 | args = args || [];
1898 | ensureInitRuntime();
1899 | var argc = args.length + 1;
1900 |
1901 | function pad() {
1902 | for (var i = 0; i < 4 - 1; i++) {
1903 | argv.push(0)
1904 | }
1905 | }
1906 | var argv = [allocate(intArrayFromString(Module["thisProgram"]), "i8", ALLOC_NORMAL)];
1907 | pad();
1908 | for (var i = 0; i < argc - 1; i = i + 1) {
1909 | argv.push(allocate(intArrayFromString(args[i]), "i8", ALLOC_NORMAL));
1910 | pad()
1911 | }
1912 | argv.push(0);
1913 | argv = allocate(argv, "i32", ALLOC_NORMAL);
1914 | try {
1915 | var ret = Module["_main"](argc, argv, 0);
1916 | exit(ret, true)
1917 | } catch (e) {
1918 | if (e instanceof ExitStatus) {
1919 | return
1920 | } else if (e == "SimulateInfiniteLoop") {
1921 | Module["noExitRuntime"] = true;
1922 | return
1923 | } else {
1924 | var toLog = e;
1925 | if (e && typeof e === "object" && e.stack) {
1926 | toLog = [e, e.stack]
1927 | }
1928 | Module.printErr("exception thrown: " + toLog);
1929 | Module["quit"](1, e)
1930 | }
1931 | } finally {
1932 | calledMain = true
1933 | }
1934 | };
1935 |
1936 | function run(args) {
1937 | args = args || Module["arguments"];
1938 | if (preloadStartTime === null) preloadStartTime = Date.now();
1939 | if (runDependencies > 0) {
1940 | return
1941 | }
1942 | preRun();
1943 | if (runDependencies > 0) return;
1944 | if (Module["calledRun"]) return;
1945 |
1946 | function doRun() {
1947 | if (Module["calledRun"]) return;
1948 | Module["calledRun"] = true;
1949 | if (ABORT) return;
1950 | ensureInitRuntime();
1951 | preMain();
1952 | if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
1953 | if (Module["_main"] && shouldRunNow) Module["callMain"](args);
1954 | postRun()
1955 | }
1956 | if (Module["setStatus"]) {
1957 | Module["setStatus"]("Running...");
1958 | setTimeout((function() {
1959 | setTimeout((function() {
1960 | Module["setStatus"]("")
1961 | }), 1);
1962 | doRun()
1963 | }), 1)
1964 | } else {
1965 | doRun()
1966 | }
1967 | }
1968 | Module["run"] = Module.run = run;
1969 |
1970 | function exit(status, implicit) {
1971 | if (implicit && Module["noExitRuntime"]) {
1972 | return
1973 | }
1974 | if (Module["noExitRuntime"]) {} else {
1975 | ABORT = true;
1976 | EXITSTATUS = status;
1977 | STACKTOP = initialStackTop;
1978 | exitRuntime();
1979 | if (Module["onExit"]) Module["onExit"](status)
1980 | }
1981 | if (ENVIRONMENT_IS_NODE) {
1982 | process["exit"](status)
1983 | }
1984 | Module["quit"](status, new ExitStatus(status))
1985 | }
1986 | Module["exit"] = Module.exit = exit;
1987 | var abortDecorators = [];
1988 |
1989 | function abort(what) {
1990 | if (Module["onAbort"]) {
1991 | Module["onAbort"](what)
1992 | }
1993 | if (what !== undefined) {
1994 | Module.print(what);
1995 | Module.printErr(what);
1996 | what = JSON.stringify(what)
1997 | } else {
1998 | what = ""
1999 | }
2000 | ABORT = true;
2001 | EXITSTATUS = 1;
2002 | var extra = "\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";
2003 | var output = "abort(" + what + ") at " + stackTrace() + extra;
2004 | if (abortDecorators) {
2005 | abortDecorators.forEach((function(decorator) {
2006 | output = decorator(output, what)
2007 | }))
2008 | }
2009 | throw output
2010 | }
2011 | Module["abort"] = Module.abort = abort;
2012 | if (Module["preInit"]) {
2013 | if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
2014 | while (Module["preInit"].length > 0) {
2015 | Module["preInit"].pop()()
2016 | }
2017 | }
2018 | var shouldRunNow = true;
2019 | if (Module["noInitialRun"]) {
2020 | shouldRunNow = false
2021 | }
2022 | Module["noExitRuntime"] = true;
2023 | run()
--------------------------------------------------------------------------------