Compiling renderscript code at runtime - C++ or Other Android Development Languages

I was wondering if it's possible to write/modify renderscript code when the android application is running.
My main goal is to make an app where users can learn to work with renderscript without any java knowledge. The basic layout of the app would consist of an input and output image, with the possibility for code input. The basic functionality of this app is already working and this is an image of the interface.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
It would be useful to test renderscript code with direct feedback from the app.
I've already done research about the build process and came up with the following idea:
A basic "template" renderscript file, with the necessary global variables like in and out allocations.
My java code would create a script object of the generated java class and do the basic initialization of these global script variables.
The root function of this template .rs file would be empty, and it should be possible to be implemented by the user at runtime.
When the user types in his code in the main view of the app, the code is written to my own .rs file which then is compiled by the llvm-rs-cc compiler, invoked by the application. The generated .bc would then be copied to the location of the original .bc file of
the template. Because the only change of code happens inside the root function, it would not be necessary to make changes to the surrounding
java code.
The problem I'm having at the moment is the fact that the .bc files are bundled within the final apk inside the res/raw folder,
which is not accessible by the app. Overwriting old .bc files with the newly generated files is therefore not possible.
Is there a(nother) way to compile renderscript code at runtime?

Related

[Q] Eclipse and external libraries

Hi everyone :victory:
So, first of all, I'm not a java developper, I never done any java in my life, only C and C++, and i'm used to have .c/.cpp files along with .h files.
That being said, I can still understand the syntax of Java, however I don't fully understand how Eclipse is supposed to work.
I've followed a few guides on the web in order to get started and to be ready to compile APK from pre-existing code (I just want to modify a Xposed Module), and here's what I've done.
Install Eclipse
Install ADT
Update ADT and install Android SDK
Get the xposed module code from GitHub
I've then went to File -> New Project --> Android Folder --> Android Project from Existing Code, and I've selected the xposed module folder.
So far everything works, I've even found how to add the XposedBridgeAPI.jar in my project (not an easy thing to do and I'm not sure i've done it the correct way, but no more Eclipse error about Xposed functions )
But I now encounter another problem which is that I can't find a way to import this library : Android-DirectoryChooser into my project :crying:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I've tried to follow the instructions given on the GitHub :
Import the project into your favorite IDE and add android.library.reference.1=/path/to/Android-DirectoryChooser/library to your project.properties.
Click to expand...
Click to collapse
but it doesn't change anything ... :silly:
I've been struggling with this for hours now, can someone tell me what I've done wrong or what to do ?
Thank you in advance.
Regards,
Azsde.
Edit : I found the solution, I just needed to make a '' libs'' folder at the Root of my project, with my jar inside

[Q] Customizing GUI in simulator?

Hi
Need to know something rudimentary.
Is it possible to design/modify the look and feel of the Firefox OS from the device simulator? Not the apps, but the entire Firefox OS GUI.
Thanks.
arjunm009 said:
Hi
Need to know something rudimentary.
Is it possible to design/modify the look and feel of the Firefox OS from the device simulator? Not the apps, but the entire Firefox OS GUI.
Thanks.
Click to expand...
Click to collapse
Hi arjunm009,
FirefoxOS development name is b2g (boot2gecko) there is a beautiful diagram on Mozilla's pages advising how the layers work, see https://developer.mozilla.org/en-US/Firefox_OS/Platform/Architecture
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Gonk is the Hardware Abstraction Layer for the drivers
Gecko is the Rendering Engine
Gaia is the GUI, and the part you are interested in.
It is possible to modify Gaia, and Mozilla have a very detailed guide located just here: https://developer.mozilla.org/en-US/Firefox_OS/Developing_Gaia
You can also grab the B2G source code and only pull down Gaia this would then let you modify, or even fix and pass back upstream to Mozilla.
You would then need a way to get your changes into the emulator, you can do this on a live device by entering the Gaia directory and typing make gaia, and then reset gaia.
However, on the emulator Mozilla offer the following detailed tutorial on how to see your gui changes in realtime on the emulator running on Firefox:
https://developer.mozilla.org/en-US/Firefox_OS/Developing_Gaia/Making_Gaia_code_changes
thanks a lot. this would get me started.

Decrypting help on IDA Pro/XXTEA block cypher key extraction

I've been searching the web for information on how to decrypt lua files from an APK package that are encrypted with XXTEA block cipher (cocos2d game engine). When trying to retrieve the key that is used I've imported the libgame.so in IDA Pro but I'm having trouble decompiling it so I can read/understand the code better. My IDA Pro decompile plugins are failing and I don't have the knowledge on how to fix it (only started using the program today).
Is there anyone who can help me figuring out what the used key is and maybe help me understand on how to do it on my particular APK file.
The 'tutorials' I've been reading into are:
https://reverseengineering.stackexchange.com/questions/21759/decrypting-lua-files
https://forum.xda-developers.com/showthread.php?p=12853986#post12853986
https://boards.libre.io/threads/dec...er-in-lua-file-from-cocos2d-lua-games.297552/
https://boards.libre.io/threads/decrypting-lua-files.238916/
The APK I'm trying is:
http://www.filedropper.com/warofcolonyv212android42-apkpurecom
Any pointers on how to proceed with this are really appreciated!
janjaapy said:
I've been searching the web for information on how to decrypt lua files from an APK package that are encrypted with XXTEA block cipher (cocos2d game engine). When trying to retrieve the key that is used I've imported the libgame.so in IDA Pro but I'm having trouble decompiling it so I can read/understand the code better. My IDA Pro decompile plugins are failing and I don't have the knowledge on how to fix it (only started using the program today).
Is there anyone who can help me figuring out what the used key is and maybe help me understand on how to do it on my particular APK file.
The 'tutorials' I've been reading into are:
https://reverseengineering.stackexchange.com/questions/21759/decrypting-lua-files
https://forum.xda-developers.com/showthread.php?p=12853986#post12853986
https://boards.libre.io/threads/dec...er-in-lua-file-from-cocos2d-lua-games.297552/
https://boards.libre.io/threads/decrypting-lua-files.238916/
The APK I'm trying is:
http://www.filedropper.com/warofcolonyv212android42-apkpurecom
Any pointers on how to proceed with this are really appreciated!
Click to expand...
Click to collapse
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I think key is "@#k./%9l[w~!o"

Problems and Troubleshooting During Cocos Integration with AGC Services

Some problems may occur when the APM SDK is integrated into a Cocos-based app and during app release. This article summarizes some common problems and talks about how to deal with them.
1. Problem: Error message "[NDK Root] is empty, please set [NDK Root] in Preferences." is displayed when you build an Android project for the first time, indicating that the NDK is unavailable.
Cause: The Android NDK and Android SDK paths are not configured when the project is built.
Solution: Go to File > Settings... in Cocos Creator, click the Native Develop tab page, and set Android SDK Root and NDK Root.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
You can obtain the required Android SDK and NDK paths from Android Studio, as shown in the following figures.
Copy and paste the preceding paths to Cocos Creator, and go back to the Build... page for further operations.
Note: In some cases, a default NDK path may not exist. You can download the NDK here in Android Studio.
2. Problem: Error message "TypeError: Cannot read property 'xxx' of undefined." is displayed.
Cause: A script with the same name exists on the computer. This problem may occur regardless of whether the scripts of the same name are in the same folder.
Solution: Ensure that each script has a unique name by renaming or deleting scripts.
3. Problem: Error message "Task:game:externalNativeBuildReleaseFeature" is displayed during compilation, but the building process is normal.
Cause: The path contains special characters or is too long.
Solution: Place the project folder in the root directory and ensure that the project file name does not contain special characters. Then delete the build folder and try again.

Why Doesn’t My Game’s Trial Play Function Take Effect?

Symptom​I have integrated the trial play function provided by the HMS Core Game Service SDK 5.0.1.302 into my game and completed the following as instructed by the official documentation:
Applying to enable the forcible identity verification function.
Adding code snippet for implementing trial play to my game code.
However, when my game was launched and the identity verification pop-up was displayed, the trial play option was not available, which means that the function did not take effect.
Analysis​It was the first time I integrated the HMS Core SDK, so I contacted Huawei technical support. I was informed of some of the prerequisites for enabling the trial play function:
1. The integrated Game Service SDK version must be 5.0.1 or later.
2. The forcible identity verification has been enabled.
3. Code relating to the trial play function has been added.
4. The default authorization parameter of the game must be DEFAULT_AUTH_REQUEST_PARAM_GAME.
We have met the first three, but not the last one.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Solution​Finally, I modified my code by referring to the documentation, and it worked! Hope this post can offer you some help!
Am not sure but check the code for suttle errors
Tennaric said:
Am not sure but check the code for suttle errors
Click to expand...
Click to collapse
this is just a sample code. you can refer to this site to confirm the correct usage. you can even download the sample code in github.

Categories

Resources