diff --git a/app/.gitignore b/app/.gitignore
deleted file mode 100644
index 8268dac..0000000
--- a/app/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/.cxx
-/build
diff --git a/app/.gitmodules b/app/.gitmodules
deleted file mode 100644
index e1b3a21..0000000
--- a/app/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "src/main/cpp/OpenXR-SDK"]
- path = src/main/cpp/OpenXR-SDK
- url = https://github.com/KhronosGroup/OpenXR-SDK.git
diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index a7bee20..0000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,46 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdk 30
-
- defaultConfig {
- applicationId 'com.winlator'
- minSdkVersion 26
- targetSdkVersion 28
- versionCode 16
- versionName "7.1"
- }
-
- buildTypes {
- debug {
- minifyEnabled true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
-
- ndk {
- abiFilters 'arm64-v8a', 'armeabi-v7a'
- }
- }
- }
-
- lintOptions {
- checkReleaseBuilds false
- }
-
- ndkVersion '22.1.7171670'
-
- externalNativeBuild {
- cmake {
- version '3.22.1'
- path 'src/main/cpp/CMakeLists.txt'
- }
- }
-}
-
-dependencies {
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'androidx.preference:preference:1.1.1'
- implementation 'com.google.android.material:material:1.4.0'
- implementation 'com.github.luben:zstd-jni:1.5.2-3@aar'
- implementation 'org.tukaani:xz:1.7'
- implementation 'org.apache.commons:commons-compress:1.20'
-}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
deleted file mode 100644
index 1237350..0000000
--- a/app/proguard-rules.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
--dontobfuscate
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 596a102..0000000
--- a/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/assets/.gitattributes b/app/src/main/assets/.gitattributes
deleted file mode 100644
index 9d74588..0000000
--- a/app/src/main/assets/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-*.txz filter=lfs diff=lfs merge=lfs -text
diff --git a/app/src/main/assets/box64_env_vars.json b/app/src/main/assets/box64_env_vars.json
deleted file mode 100644
index 2fa17bb..0000000
--- a/app/src/main/assets/box64_env_vars.json
+++ /dev/null
@@ -1,11 +0,0 @@
-[
- {"name" : "BOX64_DYNAREC_SAFEFLAGS", "values" : ["0", "1", "2"], "defaultValue" : "2"},
- {"name" : "BOX64_DYNAREC_FASTNAN", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
- {"name" : "BOX64_DYNAREC_FASTROUND", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
- {"name" : "BOX64_DYNAREC_X87DOUBLE", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "0"},
- {"name" : "BOX64_DYNAREC_BIGBLOCK", "values" : ["0", "1", "2", "3"], "defaultValue" : "1"},
- {"name" : "BOX64_DYNAREC_STRONGMEM", "values" : ["0", "1", "2", "3"], "defaultValue" : "0"},
- {"name" : "BOX64_DYNAREC_FORWARD", "values" : ["0", "128", "256", "512", "1024"], "defaultValue" : "128"},
- {"name" : "BOX64_DYNAREC_CALLRET", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
- {"name" : "BOX64_DYNAREC_WAIT", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"}
-]
\ No newline at end of file
diff --git a/app/src/main/assets/box86_64/box64-0.2.8.tzst b/app/src/main/assets/box86_64/box64-0.2.8.tzst
deleted file mode 100644
index 19447a9..0000000
Binary files a/app/src/main/assets/box86_64/box64-0.2.8.tzst and /dev/null differ
diff --git a/app/src/main/assets/box86_64/box64-0.2.9.tzst b/app/src/main/assets/box86_64/box64-0.2.9.tzst
deleted file mode 100644
index fc2074f..0000000
Binary files a/app/src/main/assets/box86_64/box64-0.2.9.tzst and /dev/null differ
diff --git a/app/src/main/assets/box86_64/box86-0.3.2.tzst b/app/src/main/assets/box86_64/box86-0.3.2.tzst
deleted file mode 100644
index 66b45ce..0000000
Binary files a/app/src/main/assets/box86_64/box86-0.3.2.tzst and /dev/null differ
diff --git a/app/src/main/assets/box86_64/box86-0.3.7.tzst b/app/src/main/assets/box86_64/box86-0.3.7.tzst
deleted file mode 100644
index 66c4ee3..0000000
Binary files a/app/src/main/assets/box86_64/box86-0.3.7.tzst and /dev/null differ
diff --git a/app/src/main/assets/box86_env_vars.json b/app/src/main/assets/box86_env_vars.json
deleted file mode 100644
index 315104b..0000000
--- a/app/src/main/assets/box86_env_vars.json
+++ /dev/null
@@ -1,11 +0,0 @@
-[
- {"name" : "BOX86_DYNAREC_SAFEFLAGS", "values" : ["0", "1", "2"], "defaultValue" : "2"},
- {"name" : "BOX86_DYNAREC_FASTNAN", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
- {"name" : "BOX86_DYNAREC_FASTROUND", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
- {"name" : "BOX86_DYNAREC_X87DOUBLE", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "0"},
- {"name" : "BOX86_DYNAREC_BIGBLOCK", "values" : ["0", "1", "2", "3"], "defaultValue" : "1"},
- {"name" : "BOX86_DYNAREC_STRONGMEM", "values" : ["0", "1", "2", "3"], "defaultValue" : "0"},
- {"name" : "BOX86_DYNAREC_FORWARD", "values" : ["0", "128", "256", "512", "1024"], "defaultValue" : "128"},
- {"name" : "BOX86_DYNAREC_CALLRET", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
- {"name" : "BOX86_DYNAREC_WAIT", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"}
-]
\ No newline at end of file
diff --git a/app/src/main/assets/common_dlls.json b/app/src/main/assets/common_dlls.json
deleted file mode 100644
index 0634184..0000000
--- a/app/src/main/assets/common_dlls.json
+++ /dev/null
@@ -1 +0,0 @@
-{"system32":["winedevice.exe","explorer.exe","iexplore.exe","notepad.exe","msxml.dll","msxml2.dll","msxml3.dll","msxml4.dll","msxml6.dll","shdocvw.dll","acledit.dll","aclui.dll","activeds.dll","activeds.tlb","actxprxy.dll","adsldp.dll","adsldpc.dll","advapi32.dll","advpack.dll","amsi.dll","amstream.dll","apisetschema.dll","apphelp.dll","appwiz.cpl","appxdeploymentclient.dll","arp.exe","atl.dll","atl100.dll","atl110.dll","atl80.dll","atl90.dll","atlthunk.dll","atmlib.dll","attrib.exe","authz.dll","avicap32.dll","avifil32.dll","avrt.dll","bcrypt.dll","bcryptprimitives.dll","bluetoothapis.dll","browseui.dll","bthprops.cpl","cabarc.exe","cabinet.dll","cacls.exe","capi2032.dll","cards.dll","cdosys.dll","certutil.exe","cfgmgr32.dll","chcp.com","clock.exe","clusapi.dll","cmd.exe","combase.dll","comcat.dll","comctl32.dll","comdlg32.dll","coml2.dll","compstui.dll","comsvcs.dll","concrt140.dll","conhost.exe","connect.dll","control.exe","credui.dll","crtdll.dll","crypt32.dll","cryptdlg.dll","cryptdll.dll","cryptext.dll","cryptnet.dll","cryptowinrt.dll","cryptsp.dll","cryptui.dll","cscript.exe","ctapi32.dll","ctl3d32.dll","d2d1.dll","d3d10.dll","d3d10core.dll","d3d10_1.dll","d3d11.dll","d3d12.dll","d3d12core.dll","d3d8.dll","d3d8thk.dll","d3d9.dll","d3dcompiler_33.dll","d3dcompiler_34.dll","d3dcompiler_35.dll","d3dcompiler_36.dll","d3dcompiler_37.dll","d3dcompiler_38.dll","d3dcompiler_39.dll","d3dcompiler_40.dll","d3dcompiler_41.dll","d3dcompiler_42.dll","d3dcompiler_43.dll","d3dcompiler_46.dll","d3dcompiler_47.dll","d3dim.dll","d3dim700.dll","d3drm.dll","d3dx10_33.dll","d3dx10_34.dll","d3dx10_35.dll","d3dx10_36.dll","d3dx10_37.dll","d3dx10_38.dll","d3dx10_39.dll","d3dx10_40.dll","d3dx10_41.dll","d3dx10_42.dll","d3dx10_43.dll","d3dx11_42.dll","d3dx11_43.dll","d3dx9_24.dll","d3dx9_25.dll","d3dx9_26.dll","d3dx9_27.dll","d3dx9_28.dll","d3dx9_29.dll","d3dx9_30.dll","d3dx9_31.dll","d3dx9_32.dll","d3dx9_33.dll","d3dx9_34.dll","d3dx9_35.dll","d3dx9_36.dll","d3dx9_37.dll","d3dx9_38.dll","d3dx9_39.dll","d3dx9_40.dll","d3dx9_41.dll","d3dx9_42.dll","d3dx9_43.dll","d3dxof.dll","davclnt.dll","dbgeng.dll","dbghelp.dll","dciman32.dll","dcomp.dll","ddraw.dll","ddrawex.dll","devenum.dll","dhcpcsvc.dll","dhcpcsvc6.dll","dhtmled.ocx","difxapi.dll","dinput.dll","dinput8.dll","directmanipulation.dll","dism.exe","dispex.dll","dllhost.exe","dmband.dll","dmcompos.dll","dmime.dll","dmloader.dll","dmscript.dll","dmstyle.dll","dmsynth.dll","dmusic.dll","dmusic32.dll","dnsapi.dll","dplay.dll","dplaysvr.exe","dplayx.dll","dpnaddr.dll","dpnet.dll","dpnhpast.dll","dpnhupnp.dll","dpnlobby.dll","dpnsvr.exe","dpvoice.dll","dpvsetup.exe","dpwsockx.dll","drmclien.dll","dsdmo.dll","dsound.dll","dsquery.dll","dssenh.dll","dsuiext.dll","dswave.dll","dwrite.dll","dxtrans.dll","dxva2.dll","eject.exe","esent.dll","explorerframe.dll","faultrep.dll","fc.exe","gdiplus.dll","geolocation.dll","hal.dll","hnetcfg.dll","hvsimanagementapi.dll","ia2comproxy.dll","icacls.exe","iccvid.dll","icinfo.exe","icmp.dll","imm32.dll","ir50_32.dll","kernel32.dll","localui.dll","mcicda.dll","mfplay.dll","mmcndmgr.dll","msasn1.dll","mscat32.dll","msctfmonitor.dll","msg711.acm","msidb.exe","msident.dll","msiexec.exe","msisip.dll","msrle32.dll","msscript.ocx","mssign32.dll","mssip32.dll","mstask.dll","msvcirt.dll","msvcp71.dll","msvcp90.dll","msvcr100.dll","msvcr120_app.dll","msvcr71.dll","msvcr90.dll","msvcrtd.dll","msvidc32.dll","ncrypt.dll","net.exe","netutils.dll","nsi.dll","ntdsapi.dll","oleaut32.dll","opcservices.dll","progman.exe","psapi.dll","qmgrprxy.dll","rasapi32.dll","regini.exe","riched32.dll","sas.dll","scardsvr.dll","sccbase.dll","schtasks.exe","sdbinst.exe","sechost.dll","sensapi.dll","shfolder.dll","shutdown.exe","spoolss.dll","systeminfo.exe","tbs.dll","tdh.dll","ucrtbase.dll","url.dll","userenv.dll","utildll.dll","uxtheme.dll","vcomp140.dll","wer.dll","wevtsvc.dll","wiaservc.dll","windows.devices.bluetooth.dll","windows.devices.enumeration.dll","windows.devices.usb.dll","windows.media.mediacontrol.dll","windows.media.speech.dll","windows.perception.stub.dll","windows.storage.applicationdata.dll","windows.system.profile.systemmanufacturers.dll","winealsa.drv","winegstreamer.dll","winepulse.drv","winnls32.dll","wintab32.dll","wlanui.dll","wldp.dll","wmasf.dll","wmp.dll","wmvcore.dll","wnaspi32.dll","wow64cpu.dll","x3daudio1_0.dll","x3daudio1_3.dll","dx8vb.dll","dxdiag.exe","dxgi.dll","evr.dll","extrac32.exe","feclient.dll","find.exe","findstr.exe","fntcache.dll","fsutil.exe","hhctrl.ocx","hostname.exe","ieframe.dll","inetcpl.cpl","ipconfig.exe","iphlpapi.dll","iprop.dll","irprops.cpl","itircl.dll","jscript.dll","kernelbase.dll","mapi32.dll","mciseq.dll","mciwave.dll","mf3216.dll","mfplat.dll","mgmtapi.dll","mp3dmod.dll","mpr.dll","msacm32.dll","msauddecmft.dll","msctfp.dll","msdelta.dll","msimsg.dll","msls31.dll","msvcr110.dll","msvcr120.dll","nddeapi.dll","netcfgx.dll","netprofm.dll","newdev.dll","ninput.dll","npptools.dll","ntprint.dll","odbccp32.dll","olepro32.dll","oleview.exe","pidgen.dll","ping.exe","pnputil.exe","propsys.dll","pstorec.dll","qedit.dll","qwave.dll","resutils.dll","rstrtmgr.dll","rtutils.dll","rtworkq.dll","scarddlg.dll","scrrun.dll","secedit.exe","serialui.dll","setupapi.dll","sfc_os.dll","sppc.dll","srclient.dll","sspicli.dll","start.exe","sti.dll","svchost.exe","svrapi.dll","t2embed.dll","taskmgr.exe","tzres.dll","uninstaller.exe","usp10.dll","vcomp100.dll","vcruntime140.dll","view.exe","vulkan-1.dll","websocket.dll","wevtapi.dll","whoami.exe","x3daudio1_5.dll","xactengine3_2.dll","xaudio2_1.dll","xaudio2_9.dll","xolehlp.dll","winepath.exe","dwmapi.dll","dxdiagn.dll","expand.exe","fltlib.dll","fontsub.dll","fwpuclnt.dll","glu32.dll","graphicscapture.dll","imaadp32.acm","inetcomm.dll","initpki.dll","kerberos.dll","klist.exe","ksproxy.ax","ktmw32.dll","loadperf.dll","lodctr.exe","lz32.dll","mf.dll","mfmediaengine.dll","mlang.dll","mmdevapi.dll","mprapi.dll","msadp32.acm","mscms.dll","msgsm32.acm","mshtml.dll","msimg32.dll","msimtf.dll","msinfo32.exe","msmpeg2vdec.dll","msnet32.dll","mspatcha.dll","msports.dll","msv1_0.dll","msvcm90.dll","msvcp100.dll","msvcp120.dll","msvcp120_app.dll","msvcp140.dll","msvcp140_1.dll","msvcp140_codecvt_ids.dll","msvcr70.dll","msvcrt20.dll","msvcrt40.dll","msvfw32.dll","ntdll.dll","odbc32.dll","odbcbcp.dll","oleacc.dll","olecli32.dll","oledlg.dll","packager.dll","pdh.dll","printui.dll","prntvpt.dll","qcap.dll","qdvd.dll","quartz.dll","query.dll","rasdlg.dll","robocopy.exe","rpcrt4.dll","rpcss.exe","rsabase.dll","schannel.dll","secur32.dll","setx.exe","shdoclc.dll","slc.dll","snmpapi.dll","srvsvc.dll","strmdll.dll","tasklist.exe","uiribbon.dll","vbscript.dll","vcomp110.dll","vga.dll","wevtutil.exe","wimgapi.dll","win32u.dll","windows.media.dll","windows.networking.dll","windows.networking.hostname.dll","winecfg.exe","winevulkan.dll","winmm.dll","wmi.dll","wmphoto.dll","wow64win.dll","wuapi.dll","dxcore.dll","gameux.dll","gamingtcui.dll","gdi32.dll","gpkcsp.dll","hid.dll","hlink.dll","hrtfapo.dll","httpapi.dll","ieproxy.dll","imagehlp.dll","inetmib1.dll","infosoft.dll","inkobj.dll","inseng.dll","itss.dll","joy.cpl","jsproxy.dll","ksuser.dll","l3codeca.acm","localspl.dll","magnification.dll","mapistub.dll","mciavi32.dll","mciqtz32.dll","mferror.dll","mfreadwrite.dll","mfsrcsnk.dll","midimap.dll","msacm32.drv","mscoree.dll","msctf.dll","msdmo.dll","msdrm.dll","msftedit.dll","mshta.exe","mshtml.tlb","msi.dll","msisys.ocx","msvcm80.dll","msvcp110.dll","msvcp140_2.dll","msvcp140_atomic_wait.dll","msvcp60.dll","msvcp70.dll","msvcp80.dll","msvcp_win.dll","msvcr80.dll","msvcrt.dll","mswsock.dll","mtxdm.dll","netapi32.dll","netsh.exe","netstat.exe","normaliz.dll","ntoskrnl.exe","objsel.dll","odbccu32.dll","ole32.dll","olesvr32.dll","olethk32.dll","opencl.dll","opengl32.dll","photometadatahandler.dll","plugplay.exe","powrprof.dll","pwrshplugin.dll","qasf.dll","qmgr.dll","reg.exe","regapi.dll","regsvr32.exe","riched20.dll","rsaenh.dll","rundll32.exe","samlib.dll","sc.exe","schedsvc.dll","scrobj.dll","security.dll","services.exe","sfc.dll","shcore.dll","shell32.dll","shlwapi.dll","slbcsp.dll","softpub.dll","spoolsv.exe","srvcli.dll","stdole2.tlb","stdole32.tlb","subst.exe","sxs.dll","tapi32.dll","taskkill.exe","taskschd.dll","termsv.exe","threadpoolwinrt.dll","traffic.dll","twain_32.dll","twinapi.appcore.dll","uianimation.dll","uiautomationcore.dll","unicows.dll","unlodctr.exe","updspapi.dll","urlmon.dll","user32.dll","vcomp.dll","vcomp120.dll","vcomp90.dll","windows.gaming.ui.gamebar.dll","winhttp.dll","wintypes.dll","wlanapi.dll","xapofx1_1.dll","x3daudio1_4.dll","windows.security.credentials.ui.userconsentverifier.dll","wineboot.exe","winedbg.exe","winemapi.dll","wing32.dll","winver.exe","wsnmp32.dll","x3daudio1_2.dll","xactengine3_0.dll","xactengine3_3.dll","xactengine3_7.dll","vcruntime140_1.dll","vdmdbg.dll","version.dll","virtdisk.dll","vssapi.dll","where.exe","windows.applicationmodel.dll","windows.ui.dll","xaudio2_8.dll","windowscodecs.dll","winebrowser.exe","winemenubuilder.exe","winspool.drv","xactengine2_0.dll","xactengine2_7.dll","xinput1_4.dll","x3daudio1_7.dll","xactengine2_4.dll","xapofx1_3.dll","xapofx1_5.dll","xaudio2_4.dll","xaudio2_6.dll","xaudio2_7.dll","xinput1_1.dll","wineconsole.exe","winemine.exe","winemsibuilder.exe","winsta.dll","winusb.dll","wscript.exe","xaudio2_5.dll","xpssvcs.dll","windows.media.devices.dll","wininet.dll","wldap32.dll","wofutil.dll","wsdapi.dll","wusa.exe","xactengine3_4.dll","xactengine3_5.dll","xactengine2_9.dll","xapofx1_2.dll","xinput1_2.dll","xpsprint.dll","windows.globalization.dll","wined3d.dll","winefile.exe","winhlp32.exe","write.exe","wsock32.dll","wuauserv.exe","x3daudio1_1.dll","xapofx1_4.dll","xaudio2_0.dll","xaudio2_3.dll","wdscore.dll","webservices.dll","windows.gaming.input.dll","wintrust.dll","ws2_32.dll","wshom.ocx","x3daudio1_6.dll","xaudio2_2.dll","xinput9_1_0.dll","xmllite.dll","xactengine3_6.dll","windowscodecsext.dll","winex11.drv","winmgmt.exe","wow64.dll","wpc.dll","wtsapi32.dll","wuaueng.dll","xactengine3_1.dll","xcopy.exe","xinput1_3.dll","xinputuap.dll"],"syswow64":["start.exe","winhlp32.exe","stdole2.tlb","iexplore.exe","msxml.dll","msxml2.dll","msxml3.dll","msxml4.dll","msxml6.dll","shdocvw.dll","acledit.dll","aclui.dll","activeds.dll","activeds.tlb","actxprxy.dll","adsldp.dll","adsldpc.dll","advapi32.dll","advpack.dll","amsi.dll","amstream.dll","apisetschema.dll","apphelp.dll","appwiz.cpl","appxdeploymentclient.dll","arp.exe","atl.dll","atl100.dll","atl110.dll","atl80.dll","atl90.dll","atlthunk.dll","atmlib.dll","attrib.exe","authz.dll","avicap32.dll","avifil32.dll","avrt.dll","bcrypt.dll","bcryptprimitives.dll","bluetoothapis.dll","browseui.dll","bthprops.cpl","cabarc.exe","cabinet.dll","cacls.exe","capi2032.dll","cards.dll","cdosys.dll","certutil.exe","cfgmgr32.dll","chcp.com","clock.exe","clusapi.dll","cmd.exe","combase.dll","comcat.dll","comctl32.dll","comdlg32.dll","coml2.dll","compstui.dll","comsvcs.dll","concrt140.dll","connect.dll","control.exe","credui.dll","crtdll.dll","crypt32.dll","cryptdlg.dll","cryptdll.dll","cryptext.dll","cryptnet.dll","cryptowinrt.dll","cryptsp.dll","cryptui.dll","cscript.exe","ctapi32.dll","ctl3d32.dll","d2d1.dll","d3d10.dll","d3d10core.dll","d3d10_1.dll","d3d11.dll","d3d12.dll","d3d12core.dll","d3d8.dll","d3d8thk.dll","d3d9.dll","d3dcompiler_33.dll","d3dcompiler_34.dll","d3dcompiler_35.dll","d3dcompiler_36.dll","d3dcompiler_37.dll","d3dcompiler_38.dll","d3dcompiler_39.dll","d3dcompiler_40.dll","d3dcompiler_41.dll","d3dcompiler_42.dll","d3dcompiler_43.dll","d3dcompiler_46.dll","d3dcompiler_47.dll","d3dim.dll","d3dim700.dll","d3drm.dll","d3dx10_33.dll","d3dx10_34.dll","d3dx10_35.dll","d3dx10_36.dll","d3dx10_37.dll","d3dx10_38.dll","d3dx10_39.dll","d3dx10_40.dll","d3dx10_41.dll","d3dx10_42.dll","d3dx10_43.dll","d3dx11_42.dll","d3dx11_43.dll","d3dx9_24.dll","d3dx9_25.dll","d3dx9_26.dll","d3dx9_27.dll","d3dx9_28.dll","d3dx9_29.dll","d3dx9_30.dll","d3dx9_31.dll","d3dx9_32.dll","d3dx9_33.dll","d3dx9_34.dll","d3dx9_35.dll","d3dx9_36.dll","d3dx9_37.dll","d3dx9_38.dll","d3dx9_39.dll","d3dx9_40.dll","d3dx9_41.dll","d3dx9_42.dll","d3dx9_43.dll","d3dxof.dll","davclnt.dll","dbgeng.dll","dbghelp.dll","dciman32.dll","dcomp.dll","ddraw.dll","ddrawex.dll","devenum.dll","dhcpcsvc.dll","dhcpcsvc6.dll","dhtmled.ocx","difxapi.dll","dinput.dll","dinput8.dll","directmanipulation.dll","dism.exe","dispex.dll","dllhost.exe","dmband.dll","dmcompos.dll","dmime.dll","dmloader.dll","dmscript.dll","dmstyle.dll","dmsynth.dll","dmusic.dll","dmusic32.dll","dnsapi.dll","dplay.dll","dplaysvr.exe","dplayx.dll","dpnaddr.dll","dpnet.dll","dpnhpast.dll","dpnhupnp.dll","dpnlobby.dll","dpnsvr.exe","dpvoice.dll","dpvsetup.exe","dpwsockx.dll","drmclien.dll","dsdmo.dll","dsound.dll","dsquery.dll","dssenh.dll","dsuiext.dll","dswave.dll","dwmapi.dll","dwrite.dll","dx8vb.dll","dxcore.dll","dxgi.dll","dxva2.dll","expand.exe","hid.dll","hlink.dll","httpapi.dll","ia2comproxy.dll","icinfo.exe","initpki.dll","inseng.dll","ipconfig.exe","ir50_32.dll","kernel32.dll","lodctr.exe","mapistub.dll","mciavi32.dll","mciqtz32.dll","mf3216.dll","mfmediaengine.dll","mfplay.dll","mgmtapi.dll","midimap.dll","mmdevapi.dll","mpr.dll","mprapi.dll","mscat32.dll","mscoree.dll","msdelta.dll","msdmo.dll","msimtf.dll","msinfo32.exe","msisip.dll","mspatcha.dll","mssip32.dll","msvcm80.dll","msvcp100.dll","msvcp140_2.dll","msvcp140_codecvt_ids.dll","msvcp60.dll","msvcp70.dll","msvcp71.dll","msvcp80.dll","msvcr120.dll","msvcr70.dll","msvcr80.dll","msvcr90.dll","msvcrt20.dll","msvcrt40.dll","msvfw32.dll","mswsock.dll","net.exe","netapi32.dll","netsh.exe","netutils.dll","ntdsapi.dll","objsel.dll","odbccu32.dll","olepro32.dll","olesvr32.dll","ping.exe","prntvpt.dll","psapi.dll","pstorec.dll","qasf.dll","quartz.dll","query.dll","qwave.dll","regapi.dll","riched32.dll","robocopy.exe","rpcss.exe","rtworkq.dll","sas.dll","sccbase.dll","schannel.dll","schedsvc.dll","schtasks.exe","sdbinst.exe","serialui.dll","sfc_os.dll","shdoclc.dll","snmpapi.dll","srvsvc.dll","subst.exe","sxs.dll","taskschd.dll","traffic.dll","uninstaller.exe","vcomp120.dll","vcruntime140.dll","version.dll","websocket.dll","wevtapi.dll","wevtutil.exe","where.exe","windows.gaming.input.dll","windows.media.dll","windowscodecs.dll","winedbg.exe","winemapi.dll","winegstreamer.dll","dxdiag.exe","dxtrans.dll","eject.exe","explorerframe.dll","findstr.exe","fsutil.exe","fwpuclnt.dll","graphicscapture.dll","hh.exe","hostname.exe","hvsimanagementapi.dll","imaadp32.acm","imagehlp.dll","inetcomm.dll","inetcpl.cpl","inetmib1.dll","infosoft.dll","inkobj.dll","iprop.dll","irprops.cpl","joy.cpl","jsproxy.dll","localui.dll","magnification.dll","mcicda.dll","mciwave.dll","msacm32.dll","msacm32.drv","msasn1.dll","msauddecmft.dll","mscms.dll","msctf.dll","msctfp.dll","mshta.exe","msidb.exe","msimg32.dll","msmpeg2vdec.dll","msscript.ocx","mssign32.dll","msv1_0.dll","msvcp140_atomic_wait.dll","msvcp90.dll","msvcr120_app.dll","msvcrt.dll","msvcrtd.dll","ncrypt.dll","nddeapi.dll","npptools.dll","ntdll.dll","ntoskrnl.exe","odbcbcp.dll","oleacc.dll","oledlg.dll","opcservices.dll","packager.dll","pdh.dll","plugplay.exe","powrprof.dll","printui.dll","progman.exe","pwrshplugin.dll","qcap.dll","qdvd.dll","rasdlg.dll","reg.exe","rpcrt4.dll","samlib.dll","scarddlg.dll","scardsvr.dll","sechost.dll","security.dll","shell32.dll","sppc.dll","srvcli.dll","sspicli.dll","strmdll.dll","svchost.exe","svrapi.dll","threadpoolwinrt.dll","twinapi.appcore.dll","unlodctr.exe","urlmon.dll","userenv.dll","utildll.dll","vbscript.dll","vcomp.dll","virtdisk.dll","vulkan-1.dll","wevtsvc.dll","wiaservc.dll","windows.globalization.dll","windows.media.devices.dll","windows.media.speech.dll","winealsa.drv","winepulse.drv","esent.dll","evr.dll","explorer.exe","fc.exe","feclient.dll","fltlib.dll","gameux.dll","gamingtcui.dll","geolocation.dll","glu32.dll","hnetcfg.dll","hrtfapo.dll","ieframe.dll","imm32.dll","itircl.dll","itss.dll","jscript.dll","kerberos.dll","kernelbase.dll","ksuser.dll","ktmw32.dll","l3codeca.acm","loadperf.dll","localspl.dll","mciseq.dll","mferror.dll","mfsrcsnk.dll","mlang.dll","mmcndmgr.dll","msadp32.acm","msgsm32.acm","mshtml.dll","msi.dll","msiexec.exe","msls31.dll","msvcm90.dll","msvcp110.dll","msvcp120.dll","msvcp140.dll","msvcr71.dll","newdev.dll","ninput.dll","normaliz.dll","nsi.dll","odbccp32.dll","ole32.dll","olecli32.dll","olethk32.dll","oleview.exe","opengl32.dll","photometadatahandler.dll","pidgen.dll","propsys.dll","qmgr.dll","rasapi32.dll","regedit.exe","regini.exe","regsvr32.exe","riched20.dll","rsaenh.dll","rtutils.dll","sc.exe","scrrun.dll","secedit.exe","secur32.dll","sensapi.dll","setupapi.dll","shfolder.dll","shlwapi.dll","slbcsp.dll","softpub.dll","systeminfo.exe","tapi32.dll","tasklist.exe","taskmgr.exe","tbs.dll","tdh.dll","tzres.dll","ucrtbase.dll","uianimation.dll","user32.dll","usp10.dll","uxtheme.dll","vcomp90.dll","vga.dll","vssapi.dll","wdscore.dll","wer.dll","whoami.exe","wimgapi.dll","windows.devices.usb.dll","windows.networking.dll","windows.networking.hostname.dll","windows.ui.dll","wineboot.exe","winecfg.exe","wineconsole.exe","wined3d.dll","winefile.exe","winemsibuilder.exe","dxdiagn.dll","extrac32.exe","faultrep.dll","find.exe","fntcache.dll","fontsub.dll","gdi32.dll","gdiplus.dll","gpkcsp.dll","hal.dll","hhctrl.ocx","icacls.exe","iccvid.dll","icmp.dll","ieproxy.dll","iphlpapi.dll","klist.exe","ksproxy.ax","lz32.dll","mapi32.dll","mf.dll","mfplat.dll","mfreadwrite.dll","mp3dmod.dll","msctfmonitor.dll","msdrm.dll","msftedit.dll","msg711.acm","mshtml.tlb","msident.dll","msimsg.dll","msisys.ocx","msnet32.dll","msports.dll","msrle32.dll","mstask.dll","msvcirt.dll","msvcp120_app.dll","msvcp140_1.dll","msvcp_win.dll","msvcr100.dll","msvcr110.dll","msvidc32.dll","mtxdm.dll","netcfgx.dll","netprofm.dll","netstat.exe","notepad.exe","ntprint.dll","odbc32.dll","oleaut32.dll","opencl.dll","pnputil.exe","qedit.dll","qmgrprxy.dll","resutils.dll","rsabase.dll","rstrtmgr.dll","rundll32.exe","scrobj.dll","setx.exe","sfc.dll","shcore.dll","shutdown.exe","slc.dll","spoolss.dll","srclient.dll","stdole32.tlb","sti.dll","t2embed.dll","taskkill.exe","termsv.exe","uiautomationcore.dll","uiribbon.dll","unicows.dll","updspapi.dll","url.dll","vcomp100.dll","vcomp110.dll","vcomp140.dll","vdmdbg.dll","view.exe","webservices.dll","win32u.dll","windows.applicationmodel.dll","windows.devices.bluetooth.dll","windows.devices.enumeration.dll","windows.gaming.ui.gamebar.dll","windows.media.mediacontrol.dll","windows.perception.stub.dll","windows.security.credentials.ui.userconsentverifier.dll","windows.storage.applicationdata.dll","windowscodecsext.dll","winebrowser.exe","wintrust.dll","wlanui.dll","winmm.dll","x3daudio1_6.dll","xactengine2_7.dll","xactengine2_9.dll","xapofx1_4.dll","xaudio2_1.dll","xaudio2_3.dll","wldp.dll","winnls32.dll","winusb.dll","wuaueng.dll","xactengine3_2.dll","xapofx1_2.dll","xaudio2_8.dll","xinput1_4.dll","xpsprint.dll","winedevice.exe","wininet.dll","write.exe","wsnmp32.dll","wtsapi32.dll","wuapi.dll","xactengine3_3.dll","wshom.ocx","x3daudio1_1.dll","x3daudio1_7.dll","xapofx1_3.dll","xaudio2_4.dll","xinputuap.dll","xmllite.dll","wldap32.dll","xapofx1_1.dll","xapofx1_5.dll","winex11.drv","wpc.dll","xactengine3_6.dll","xaudio2_5.dll","winemine.exe","winhttp.dll","winmgmt.exe","wmi.dll","wscript.exe","wsock32.dll","xactengine2_0.dll","windows.system.profile.systemmanufacturers.dll","winsta.dll","wintypes.dll","wmasf.dll","x3daudio1_2.dll","xactengine3_5.dll","xaudio2_7.dll","xaudio2_9.dll","xolehlp.dll","xpssvcs.dll","winevulkan.dll","winver.exe","wlanapi.dll","wusa.exe","xactengine2_4.dll","xactengine3_7.dll","xinput1_3.dll","xinput9_1_0.dll","xactengine3_0.dll","xinput1_1.dll","wmphoto.dll","wnaspi32.dll","ws2_32.dll","wsdapi.dll","x3daudio1_0.dll","x3daudio1_4.dll","xactengine3_4.dll","xinput1_2.dll","wmvcore.dll","wofutil.dll","x3daudio1_5.dll","xcopy.exe","winepath.exe","wintab32.dll","wmp.dll","wuauserv.exe","xactengine3_1.dll","xaudio2_0.dll","wing32.dll","winspool.drv","x3daudio1_3.dll","xaudio2_2.dll","xaudio2_6.dll"]}
\ No newline at end of file
diff --git a/app/src/main/assets/container_pattern.tzst b/app/src/main/assets/container_pattern.tzst
deleted file mode 100644
index c588fd1..0000000
Binary files a/app/src/main/assets/container_pattern.tzst and /dev/null differ
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/bilinear.glsl b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/bilinear.glsl
deleted file mode 100644
index aa7bee6..0000000
--- a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/bilinear.glsl
+++ /dev/null
@@ -1,73 +0,0 @@
-#if defined(VERTEX)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING out
-#define COMPAT_ATTRIBUTE in
-#define COMPAT_TEXTURE texture
-#else
-#define COMPAT_VARYING varying
-#define COMPAT_ATTRIBUTE attribute
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-COMPAT_ATTRIBUTE vec4 VertexCoord;
-COMPAT_ATTRIBUTE vec4 COLOR;
-COMPAT_ATTRIBUTE vec4 TexCoord;
-COMPAT_VARYING vec4 COL0;
-COMPAT_VARYING vec4 TEX0;
-
-uniform mat4 MVPMatrix;
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-
-void main()
-{
- gl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];
- TEX0.xy = TexCoord.xy;
-}
-
-#elif defined(FRAGMENT)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING in
-#define COMPAT_TEXTURE texture
-out vec4 FragColor;
-#else
-#define COMPAT_VARYING varying
-#define FragColor gl_FragColor
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#ifdef GL_FRAGMENT_PRECISION_HIGH
-precision highp float;
-#else
-precision mediump float;
-#endif
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-uniform sampler2D Texture;
-COMPAT_VARYING vec4 TEX0;
-
-void main()
-{
- FragColor = COMPAT_TEXTURE(Texture, TEX0.xy);
-}
-#endif
\ No newline at end of file
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/catmull-rom-bilinear.glsl b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/catmull-rom-bilinear.glsl
deleted file mode 100644
index 03d5b77..0000000
--- a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/catmull-rom-bilinear.glsl
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae
- Ported from code: https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1
- Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16.
- See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details
- ATENTION: This code only work using LINEAR filter sampling set on Retroarch!
- Modified to use 5 texture fetches
-*/
-
-#if defined(VERTEX)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING out
-#define COMPAT_ATTRIBUTE in
-#define COMPAT_TEXTURE texture
-#else
-#define COMPAT_VARYING varying
-#define COMPAT_ATTRIBUTE attribute
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#define COMPAT_PRECISION mediump
-precision COMPAT_PRECISION float;
-#else
-#define COMPAT_PRECISION
-#endif
-
-COMPAT_ATTRIBUTE vec4 VertexCoord;
-COMPAT_ATTRIBUTE vec4 COLOR;
-COMPAT_ATTRIBUTE vec4 TexCoord;
-COMPAT_VARYING vec4 COL0;
-COMPAT_VARYING vec4 TEX0;
-
-uniform mat4 MVPMatrix;
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-
-void main()
-{
- gl_Position = MVPMatrix * VertexCoord;
- COL0 = COLOR;
- TEX0.xy = TexCoord.xy;
-}
-
-#elif defined(FRAGMENT)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING in
-#define COMPAT_TEXTURE texture
-out mediump vec4 FragColor;
-#else
-#define COMPAT_VARYING varying
-#define FragColor gl_FragColor
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#ifdef GL_FRAGMENT_PRECISION_HIGH
-precision highp float;
-#else
-precision mediump float;
-#endif
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-uniform sampler2D Texture;
-COMPAT_VARYING vec4 TEX0;
-
-// compatibility #defines
-#define Source Texture
-#define vTexCoord TEX0.xy
-
-#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
-#define outsize vec4(OutputSize, 1.0 / OutputSize)
-
-void main()
-{
- // We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
- // down the sample location to get the exact center of our "starting" texel. The starting texel will be at
- // location [1, 1] in the grid, where [0, 0] is the top left corner.
- vec2 samplePos = vTexCoord * SourceSize.xy;
- vec2 texPos1 = floor(samplePos - 0.5) + 0.5;
-
- // Compute the fractional offset from our starting texel to our original sample location, which we'll
- // feed into the Catmull-Rom spline function to get our filter weights.
- vec2 f = samplePos - texPos1;
-
- // Compute the Catmull-Rom weights using the fractional offset that we calculated earlier.
- // These equations are pre-expanded based on our knowledge of where the texels will be located,
- // which lets us avoid having to evaluate a piece-wise function.
- vec2 w0 = f * (-0.5 + f * (1.0 - 0.5 * f));
- vec2 w1 = 1.0 + f * f * (-2.5 + 1.5 * f);
- vec2 w2 = f * (0.5 + f * (2.0 - 1.5 * f));
- vec2 w3 = f * f * (-0.5 + 0.5 * f);
-
- // Work out weighting factors and sampling offsets that will let us use bilinear filtering to
- // simultaneously evaluate the middle 2 samples from the 4x4 grid.
- vec2 w12 = w1 + w2;
- vec2 offset12 = w2 / (w1 + w2);
-
- // Compute the final UV coordinates we'll use for sampling the texture
- vec2 texPos0 = texPos1 - 1.;
- vec2 texPos3 = texPos1 + 2.;
- vec2 texPos12 = texPos1 + offset12;
-
- texPos0 *= SourceSize.zw;
- texPos3 *= SourceSize.zw;
- texPos12 *= SourceSize.zw;
-
- float wtm = w12.x * w0.y;
- float wml = w0.x * w12.y;
- float wmm = w12.x * w12.y;
- float wmr = w3.x * w12.y;
- float wbm = w12.x * w3.y;
-
- vec3 result = vec3(0.0f);
-
- result += COMPAT_TEXTURE(Source, vec2(texPos12.x, texPos0.y)).rgb * wtm;
- result += COMPAT_TEXTURE(Source, vec2(texPos0.x, texPos12.y)).rgb * wml;
- result += COMPAT_TEXTURE(Source, vec2(texPos12.x, texPos12.y)).rgb * wmm;
- result += COMPAT_TEXTURE(Source, vec2(texPos3.x, texPos12.y)).rgb * wmr;
- result += COMPAT_TEXTURE(Source, vec2(texPos12.x, texPos3.y)).rgb * wbm;
-
- FragColor = vec4(result * (1./(wtm+wml+wmm+wmr+wbm)), 1.0);
-}
-#endif
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/fsr.glsl b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/fsr.glsl
deleted file mode 100644
index 17e574b..0000000
--- a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/fsr.glsl
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- FSR - [EASU] EDGE ADAPTIVE SPATIAL UPSAMPLING
- Ported from https://www.shadertoy.com/view/stXSWB, MIT license
-*/
-
-#if defined(VERTEX)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING out
-#define COMPAT_ATTRIBUTE in
-#define COMPAT_TEXTURE texture
-#else
-#define COMPAT_VARYING varying
-#define COMPAT_ATTRIBUTE attribute
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-COMPAT_ATTRIBUTE vec4 VertexCoord;
-COMPAT_ATTRIBUTE vec4 COLOR;
-COMPAT_ATTRIBUTE vec4 TexCoord;
-COMPAT_VARYING vec4 COL0;
-COMPAT_VARYING vec4 TEX0;
-
-uniform mat4 MVPMatrix;
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-
-void main()
-{
- gl_Position = MVPMatrix * VertexCoord;
- COL0 = COLOR;
- TEX0.xy = TexCoord.xy;
-}
-
-#elif defined(FRAGMENT)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING in
-#define COMPAT_TEXTURE texture
-out vec4 FragColor;
-#else
-#define COMPAT_VARYING varying
-#define FragColor gl_FragColor
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#ifdef GL_FRAGMENT_PRECISION_HIGH
-precision highp float;
-#else
-precision mediump float;
-#endif
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-uniform sampler2D Texture;
-COMPAT_VARYING vec4 TEX0;
-
-// compatibility #defines
-#define Source Texture
-#define vTexCoord TEX0.xy
-
-#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
-#define outsize vec4(OutputSize, 1.0 / OutputSize)
-
-vec3 FsrEasuCF(vec2 p) {
- return COMPAT_TEXTURE(Source,p).rgb;
-}
-
-/**** EASU ****/
-void FsrEasuCon(
- out vec4 con0,
- out vec4 con1,
- out vec4 con2,
- out vec4 con3,
- // This the rendered image resolution being upscaled
- vec2 inputViewportInPixels,
- // This is the resolution of the resource containing the input image (useful for dynamic resolution)
- vec2 inputSizeInPixels,
- // This is the display resolution which the input image gets upscaled to
- vec2 outputSizeInPixels
-)
-{
- // Output integer position to a pixel position in viewport.
- con0 = vec4(
- inputViewportInPixels.x/outputSizeInPixels.x,
- inputViewportInPixels.y/outputSizeInPixels.y,
- .5*inputViewportInPixels.x/outputSizeInPixels.x-.5,
- .5*inputViewportInPixels.y/outputSizeInPixels.y-.5
- );
- // Viewport pixel position to normalized image space.
- // This is used to get upper-left of 'F' tap.
- con1 = vec4(1,1,1,-1)/inputSizeInPixels.xyxy;
- // Centers of gather4, first offset from upper-left of 'F'.
- // +---+---+
- // | | |
- // +--(0)--+
- // | b | c |
- // +---F---+---+---+
- // | e | f | g | h |
- // +--(1)--+--(2)--+
- // | i | j | k | l |
- // +---+---+---+---+
- // | n | o |
- // +--(3)--+
- // | | |
- // +---+---+
- // These are from (0) instead of 'F'.
- con2 = vec4(-1,2,1,2)/inputSizeInPixels.xyxy;
- con3 = vec4(0,4,0,0)/inputSizeInPixels.xyxy;
-}
-
-// Filtering for a given tap for the scalar.
-void FsrEasuTapF(
- inout vec3 aC, // Accumulated color, with negative lobe.
- inout float aW, // Accumulated weight.
- vec2 off, // Pixel offset from resolve position to tap.
- vec2 dir, // Gradient direction.
- vec2 len, // Length.
- float lob, // Negative lobe strength.
- float clp, // Clipping point.
- vec3 c
-)
-{
- // Tap color.
- // Rotate offset by direction.
- vec2 v = vec2(dot(off, dir), dot(off,vec2(-dir.y,dir.x)));
- // Anisotropy.
- v *= len;
- // Compute distance^2.
- float d2 = min(dot(v,v),clp);
- // Limit to the window as at corner, 2 taps can easily be outside.
- // Approximation of lancos2 without sin() or rcp(), or sqrt() to get x.
- // (25/16 * (2/5 * x^2 - 1)^2 - (25/16 - 1)) * (1/4 * x^2 - 1)^2
- // |_______________________________________| |_______________|
- // base window
- // The general form of the 'base' is,
- // (a*(b*x^2-1)^2-(a-1))
- // Where 'a=1/(2*b-b^2)' and 'b' moves around the negative lobe.
- float wB = .4 * d2 - 1.;
- float wA = lob * d2 -1.;
- wB *= wB;
- wA *= wA;
- wB = 1.5625*wB-.5625;
- float w= wB * wA;
- // Do weighted average.
- aC += c*w;
- aW += w;
-}
-
-//------------------------------------------------------------------------------------------------------------------------------
-// Accumulate direction and length.
-void FsrEasuSetF(
- inout vec2 dir,
- inout float len,
- float w,
- float lA,float lB,float lC,float lD,float lE
-)
-{
- // Direction is the '+' diff.
- // a
- // b c d
- // e
- // Then takes magnitude from abs average of both sides of 'c'.
- // Length converts gradient reversal to 0, smoothly to non-reversal at 1, shaped, then adding horz and vert terms.
- float lenX = max(abs(lD - lC), abs(lC - lB));
- float dirX = lD - lB;
- dir.x += dirX * w;
- lenX = clamp(abs(dirX)/lenX,0.,1.);
- lenX *= lenX;
- len += lenX * w;
- // Repeat for the y axis.
- float lenY = max(abs(lE - lC), abs(lC - lA));
- float dirY = lE - lA;
- dir.y += dirY * w;
- lenY = clamp(abs(dirY) / lenY,0.,1.);
- lenY *= lenY;
- len += lenY * w;
-}
-
-//------------------------------------------------------------------------------------------------------------------------------
-void FsrEasuF(
- out vec3 pix,
- vec2 ip, // Integer pixel position in output.
- // Constants generated by FsrEasuCon().
- vec4 con0, // xy = output to input scale, zw = first pixel offset correction
- vec4 con1,
- vec4 con2,
- vec4 con3
-)
-{
- //------------------------------------------------------------------------------------------------------------------------------
- // Get position of 'f'.
- vec2 pp = ip * con0.xy + con0.zw; // Corresponding input pixel/subpixel
- vec2 fp = floor(pp);// fp = source nearest pixel
- pp -= fp; // pp = source subpixel
-
- //------------------------------------------------------------------------------------------------------------------------------
- // 12-tap kernel.
- // b c
- // e f g h
- // i j k l
- // n o
- // Gather 4 ordering.
- // a b
- // r g
- vec2 p0 = fp * con1.xy + con1.zw;
-
- // These are from p0 to avoid pulling two constants on pre-Navi hardware.
- vec2 p1 = p0 + con2.xy;
- vec2 p2 = p0 + con2.zw;
- vec2 p3 = p0 + con3.xy;
-
- // TextureGather is not available on WebGL2
- vec4 off = vec4(-.5,.5,-.5,.5)*con1.xxyy;
- // textureGather to texture offsets
- // x=west y=east z=north w=south
- vec3 bC = FsrEasuCF(p0 + off.xw); float bL = bC.g + 0.5 *(bC.r + bC.b);
- vec3 cC = FsrEasuCF(p0 + off.yw); float cL = cC.g + 0.5 *(cC.r + cC.b);
- vec3 iC = FsrEasuCF(p1 + off.xw); float iL = iC.g + 0.5 *(iC.r + iC.b);
- vec3 jC = FsrEasuCF(p1 + off.yw); float jL = jC.g + 0.5 *(jC.r + jC.b);
- vec3 fC = FsrEasuCF(p1 + off.yz); float fL = fC.g + 0.5 *(fC.r + fC.b);
- vec3 eC = FsrEasuCF(p1 + off.xz); float eL = eC.g + 0.5 *(eC.r + eC.b);
- vec3 kC = FsrEasuCF(p2 + off.xw); float kL = kC.g + 0.5 *(kC.r + kC.b);
- vec3 lC = FsrEasuCF(p2 + off.yw); float lL = lC.g + 0.5 *(lC.r + lC.b);
- vec3 hC = FsrEasuCF(p2 + off.yz); float hL = hC.g + 0.5 *(hC.r + hC.b);
- vec3 gC = FsrEasuCF(p2 + off.xz); float gL = gC.g + 0.5 *(gC.r + gC.b);
- vec3 oC = FsrEasuCF(p3 + off.yz); float oL = oC.g + 0.5 *(oC.r + oC.b);
- vec3 nC = FsrEasuCF(p3 + off.xz); float nL = nC.g + 0.5 *(nC.r + nC.b);
-
- //------------------------------------------------------------------------------------------------------------------------------
- // Simplest multi-channel approximate luma possible (luma times 2, in 2 FMA/MAD).
- // Accumulate for bilinear interpolation.
- vec2 dir = vec2(0);
- float len = 0.;
-
- FsrEasuSetF(dir, len, (1.-pp.x)*(1.-pp.y), bL, eL, fL, gL, jL);
- FsrEasuSetF(dir, len, pp.x *(1.-pp.y), cL, fL, gL, hL, kL);
- FsrEasuSetF(dir, len, (1.-pp.x)* pp.y , fL, iL, jL, kL, nL);
- FsrEasuSetF(dir, len, pp.x * pp.y , gL, jL, kL, lL, oL);
-
- //------------------------------------------------------------------------------------------------------------------------------
- // Normalize with approximation, and cleanup close to zero.
- vec2 dir2 = dir * dir;
- float dirR = dir2.x + dir2.y;
- bool zro = dirR < (1.0/32768.0);
- dirR = inversesqrt(dirR);
- dirR = zro ? 1.0 : dirR;
- dir.x = zro ? 1.0 : dir.x;
- dir *= vec2(dirR);
- // Transform from {0 to 2} to {0 to 1} range, and shape with square.
- len = len * 0.5;
- len *= len;
- // Stretch kernel {1.0 vert|horz, to sqrt(2.0) on diagonal}.
- float stretch = dot(dir,dir) / (max(abs(dir.x), abs(dir.y)));
- // Anisotropic length after rotation,
- // x := 1.0 lerp to 'stretch' on edges
- // y := 1.0 lerp to 2x on edges
- vec2 len2 = vec2(1. +(stretch-1.0)*len, 1. -.5 * len);
- // Based on the amount of 'edge',
- // the window shifts from +/-{sqrt(2.0) to slightly beyond 2.0}.
- float lob = .5 - .29 * len;
- // Set distance^2 clipping point to the end of the adjustable window.
- float clp = 1./lob;
-
- //------------------------------------------------------------------------------------------------------------------------------
- // Accumulation mixed with min/max of 4 nearest.
- // b c
- // e f g h
- // i j k l
- // n o
- vec3 min4 = min(min(fC,gC),min(jC,kC));
- vec3 max4 = max(max(fC,gC),max(jC,kC));
- // Accumulation.
- vec3 aC = vec3(0);
- float aW = 0.;
- FsrEasuTapF(aC, aW, vec2( 0,-1)-pp, dir, len2, lob, clp, bC);
- FsrEasuTapF(aC, aW, vec2( 1,-1)-pp, dir, len2, lob, clp, cC);
- FsrEasuTapF(aC, aW, vec2(-1, 1)-pp, dir, len2, lob, clp, iC);
- FsrEasuTapF(aC, aW, vec2( 0, 1)-pp, dir, len2, lob, clp, jC);
- FsrEasuTapF(aC, aW, vec2( 0, 0)-pp, dir, len2, lob, clp, fC);
- FsrEasuTapF(aC, aW, vec2(-1, 0)-pp, dir, len2, lob, clp, eC);
- FsrEasuTapF(aC, aW, vec2( 1, 1)-pp, dir, len2, lob, clp, kC);
- FsrEasuTapF(aC, aW, vec2( 2, 1)-pp, dir, len2, lob, clp, lC);
- FsrEasuTapF(aC, aW, vec2( 2, 0)-pp, dir, len2, lob, clp, hC);
- FsrEasuTapF(aC, aW, vec2( 1, 0)-pp, dir, len2, lob, clp, gC);
- FsrEasuTapF(aC, aW, vec2( 1, 2)-pp, dir, len2, lob, clp, oC);
- FsrEasuTapF(aC, aW, vec2( 0, 2)-pp, dir, len2, lob, clp, nC);
- //------------------------------------------------------------------------------------------------------------------------------
- // Normalize and dering.
- pix=min(max4,max(min4,aC/aW));
-}
-
-void main()
-{
- vec3 c;
- vec4 con0,con1,con2,con3;
-
- vec2 fragCoord = vTexCoord.xy * OutputSize.xy;
-
- FsrEasuCon(
- con0, con1, con2, con3, SourceSize.xy, SourceSize.xy, OutputSize.xy
- );
- FsrEasuF(c, fragCoord, con0, con1, con2, con3);
- FragColor = vec4(c.xyz, 1);
-}
-
-#endif
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/fsr.glsl.pass1 b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/fsr.glsl.pass1
deleted file mode 100644
index d9ce74f..0000000
--- a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/fsr.glsl.pass1
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- FSR - [RCAS] ROBUST CONTRAST ADAPTIVE SHARPENING
- Ported from https://www.shadertoy.com/view/stXSWB, MIT license
-*/
-
-#pragma parameter FSR_SHARPENING "FSR RCAS Sharpening Amount (Lower = Sharper)" 0.6 0.0 2.0 0.1
-
-#if defined(VERTEX)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING out
-#define COMPAT_ATTRIBUTE in
-#define COMPAT_TEXTURE texture
-#else
-#define COMPAT_VARYING varying
-#define COMPAT_ATTRIBUTE attribute
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-COMPAT_ATTRIBUTE vec4 VertexCoord;
-COMPAT_ATTRIBUTE vec4 COLOR;
-COMPAT_ATTRIBUTE vec4 TexCoord;
-COMPAT_VARYING vec4 COL0;
-COMPAT_VARYING vec4 TEX0;
-
-uniform mat4 MVPMatrix;
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-
-void main()
-{
- gl_Position = MVPMatrix * VertexCoord;
- COL0 = COLOR;
- TEX0.xy = TexCoord.xy;
-}
-
-#elif defined(FRAGMENT)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING in
-#define COMPAT_TEXTURE texture
-out vec4 FragColor;
-#else
-#define COMPAT_VARYING varying
-#define FragColor gl_FragColor
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#ifdef GL_FRAGMENT_PRECISION_HIGH
-precision highp float;
-#else
-precision mediump float;
-#endif
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-uniform sampler2D Texture;
-COMPAT_VARYING vec4 TEX0;
-
-// compatibility #defines
-#define Source Texture
-#define vTexCoord TEX0.xy
-
-#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
-#define outsize vec4(OutputSize, 1.0 / OutputSize)
-
-#ifdef PARAMETER_UNIFORM
-uniform COMPAT_PRECISION float FSR_SHARPENING;
-#else
-#define FSR_SHARPENING 0.6
-#endif
-
-#define FSR_RCAS_LIMIT (0.25-(1.0/16.0))
-//#define FSR_RCAS_DENOISE
-
-// Input callback prototypes that need to be implemented by calling shader
-vec4 FsrRcasLoadF(vec2 p);
-//------------------------------------------------------------------------------------------------------------------------------
-void FsrRcasCon(
- out float con,
- // The scale is {0.0 := maximum, to N>0, where N is the number of stops (halving) of the reduction of sharpness}.
- float sharpness
-){
- // Transform from stops to linear value.
- con = exp2(-sharpness);
-}
-
-vec3 FsrRcasF(
- vec2 ip, // Integer pixel position in output.
- float con
-)
-{
- // Constant generated by RcasSetup().
- // Algorithm uses minimal 3x3 pixel neighborhood.
- // b
- // d e f
- // h
- vec2 sp = vec2(ip);
- vec3 b = FsrRcasLoadF(sp + vec2( 0,-1)).rgb;
- vec3 d = FsrRcasLoadF(sp + vec2(-1, 0)).rgb;
- vec3 e = FsrRcasLoadF(sp).rgb;
- vec3 f = FsrRcasLoadF(sp+vec2( 1, 0)).rgb;
- vec3 h = FsrRcasLoadF(sp+vec2( 0, 1)).rgb;
- // Luma times 2.
- float bL = b.g + .5 * (b.b + b.r);
- float dL = d.g + .5 * (d.b + d.r);
- float eL = e.g + .5 * (e.b + e.r);
- float fL = f.g + .5 * (f.b + f.r);
- float hL = h.g + .5 * (h.b + h.r);
- // Noise detection.
- float nz = .25 * (bL + dL + fL + hL) - eL;
- nz=clamp(
- abs(nz)
- /(
- max(max(bL,dL),max(eL,max(fL,hL)))
- -min(min(bL,dL),min(eL,min(fL,hL)))
- ),
- 0., 1.
- );
- nz=1.-.5*nz;
- // Min and max of ring.
- vec3 mn4 = min(b, min(f, h));
- vec3 mx4 = max(b, max(f, h));
- // Immediate constants for peak range.
- vec2 peakC = vec2(1., -4.);
- // Limiters, these need to be high precision RCPs.
- vec3 hitMin = mn4 / (4. * mx4);
- vec3 hitMax = (peakC.x - mx4) / (4.* mn4 + peakC.y);
- vec3 lobeRGB = max(-hitMin, hitMax);
- float lobe = max(
- -FSR_RCAS_LIMIT,
- min(max(lobeRGB.r, max(lobeRGB.g, lobeRGB.b)), 0.)
- )*con;
- // Apply noise removal.
- #ifdef FSR_RCAS_DENOISE
- lobe *= nz;
- #endif
- // Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes.
- return (lobe * (b + d + h + f) + e) / (4. * lobe + 1.);
-}
-
-
-vec4 FsrRcasLoadF(vec2 p) {
- return COMPAT_TEXTURE(Source,p/OutputSize.xy);
-}
-
-void main()
-{
- vec2 fragCoord = vTexCoord.xy * OutputSize.xy;
-
- // Set up constants
- float con;
- FsrRcasCon(con, FSR_SHARPENING);
-
- // Perform RCAS pass
- vec3 col = FsrRcasF(fragCoord, con);
-
- FragColor = vec4(col,1);
-}
-
-#endif
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/jinc2-dedither.glsl b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/jinc2-dedither.glsl
deleted file mode 100644
index 32235e0..0000000
--- a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/jinc2-dedither.glsl
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- Hyllian's jinc windowed-jinc 2-lobe sharper with anti-ringing Shader
-
- Copyright (C) 2011-2016 Hyllian/Jararaca - sergiogdb@gmail.com
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-
-*/
-
-#define JINC2_WINDOW_SINC 0.405
-#define JINC2_SINC 0.79
-#define JINC2_AR_STRENGTH 0.8
-
-#define texCoord TEX0
-
-#if defined(VERTEX)
-
-#if __VERSION__ >= 130
-#define OUT out
-#define IN in
-#define tex2D texture
-#else
-#define OUT varying
-#define IN attribute
-#define tex2D texture2D
-#endif
-
-#ifdef GL_ES
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-
-IN vec4 VertexCoord;
-IN vec4 Color;
-IN vec2 TexCoord;
-OUT vec4 color;
-OUT vec2 texCoord;
-
-uniform mat4 MVPMatrix;
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-
-void main()
-{
- gl_Position = MVPMatrix * VertexCoord;
- color = Color;
- texCoord = TexCoord * 1.0001;
-}
-
-#elif defined(FRAGMENT)
-
-#if __VERSION__ >= 130
-#define IN in
-#define tex2D texture
-out vec4 FragColor;
-#else
-#define IN varying
-#define FragColor gl_FragColor
-#define tex2D texture2D
-#endif
-
-#ifdef GL_ES
-#ifdef GL_FRAGMENT_PRECISION_HIGH
-precision highp float;
-#else
-precision mediump float;
-#endif
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-uniform sampler2D s_p;
-IN vec2 texCoord;
-
-const float halfpi = 1.5707963267948966192313216916398;
-const float pi = 3.1415926535897932384626433832795;
-const float wa = JINC2_WINDOW_SINC*pi;
-const float wb = JINC2_SINC*pi;
-
-// Calculates the distance between two points
-float d(vec2 pt1, vec2 pt2)
-{
- vec2 v = pt2 - pt1;
- return sqrt(dot(v,v));
-}
-
-vec3 min4(vec3 a, vec3 b, vec3 c, vec3 d)
-{
- return min(a, min(b, min(c, d)));
-}
-
-vec3 max4(vec3 a, vec3 b, vec3 c, vec3 d)
-{
- return max(a, max(b, max(c, d)));
-}
-
-vec4 resampler(vec4 x)
-{
- vec4 res;
-
- res = (x==vec4(0.0, 0.0, 0.0, 0.0)) ? vec4(wa*wb) : sin(x*wa)*sin(x*wb)/(x*x);
-
- return res;
-}
-
-void main()
-{
-
- vec3 color;
- vec4 weights[4];
-
- vec2 dx = vec2(1.0, 0.0);
- vec2 dy = vec2(0.0, 1.0);
-
- vec2 pc = texCoord*TextureSize;
-
- vec2 tc = (floor(pc-vec2(0.5,0.5))+vec2(0.5,0.5));
-
- weights[0] = resampler(vec4(d(pc, tc -dx -dy), d(pc, tc -dy), d(pc, tc +dx -dy), d(pc, tc+2.0*dx -dy)));
- weights[1] = resampler(vec4(d(pc, tc -dx ), d(pc, tc ), d(pc, tc +dx ), d(pc, tc+2.0*dx )));
- weights[2] = resampler(vec4(d(pc, tc -dx +dy), d(pc, tc +dy), d(pc, tc +dx +dy), d(pc, tc+2.0*dx +dy)));
- weights[3] = resampler(vec4(d(pc, tc -dx+2.0*dy), d(pc, tc +2.0*dy), d(pc, tc +dx+2.0*dy), d(pc, tc+2.0*dx+2.0*dy)));
-
- dx = dx/TextureSize;
- dy = dy/TextureSize;
- tc = tc/TextureSize;
-
- vec3 c00 = tex2D(s_p, tc -dx -dy).xyz;
- vec3 c10 = tex2D(s_p, tc -dy).xyz;
- vec3 c20 = tex2D(s_p, tc +dx -dy).xyz;
- vec3 c30 = tex2D(s_p, tc+2.0*dx -dy).xyz;
- vec3 c01 = tex2D(s_p, tc -dx ).xyz;
- vec3 c11 = tex2D(s_p, tc ).xyz;
- vec3 c21 = tex2D(s_p, tc +dx ).xyz;
- vec3 c31 = tex2D(s_p, tc+2.0*dx ).xyz;
- vec3 c02 = tex2D(s_p, tc -dx +dy).xyz;
- vec3 c12 = tex2D(s_p, tc +dy).xyz;
- vec3 c22 = tex2D(s_p, tc +dx +dy).xyz;
- vec3 c32 = tex2D(s_p, tc+2.0*dx +dy).xyz;
- vec3 c03 = tex2D(s_p, tc -dx+2.0*dy).xyz;
- vec3 c13 = tex2D(s_p, tc +2.0*dy).xyz;
- vec3 c23 = tex2D(s_p, tc +dx+2.0*dy).xyz;
- vec3 c33 = tex2D(s_p, tc+2.0*dx+2.0*dy).xyz;
-
- color = tex2D(s_p, texCoord).xyz;
-
- // Get min/max samples
- vec3 min_sample = min4(c11, c21, c12, c22);
- vec3 max_sample = max4(c11, c21, c12, c22);
-/*
- color = mat4x3(c00, c10, c20, c30) * weights[0];
- color+= mat4x3(c01, c11, c21, c31) * weights[1];
- color+= mat4x3(c02, c12, c22, c32) * weights[2];
- color+= mat4x3(c03, c13, c23, c33) * weights[3];
- mat4 wgts = mat4(weights[0], weights[1], weights[2], weights[3]);
- vec4 wsum = wgts * vec4(1.0,1.0,1.0,1.0);
- color = color/(dot(wsum, vec4(1.0,1.0,1.0,1.0)));
-*/
-
-
- color = vec3(dot(weights[0], vec4(c00.x, c10.x, c20.x, c30.x)), dot(weights[0], vec4(c00.y, c10.y, c20.y, c30.y)), dot(weights[0], vec4(c00.z, c10.z, c20.z, c30.z)));
- color+= vec3(dot(weights[1], vec4(c01.x, c11.x, c21.x, c31.x)), dot(weights[1], vec4(c01.y, c11.y, c21.y, c31.y)), dot(weights[1], vec4(c01.z, c11.z, c21.z, c31.z)));
- color+= vec3(dot(weights[2], vec4(c02.x, c12.x, c22.x, c32.x)), dot(weights[2], vec4(c02.y, c12.y, c22.y, c32.y)), dot(weights[2], vec4(c02.z, c12.z, c22.z, c32.z)));
- color+= vec3(dot(weights[3], vec4(c03.x, c13.x, c23.x, c33.x)), dot(weights[3], vec4(c03.y, c13.y, c23.y, c33.y)), dot(weights[3], vec4(c03.z, c13.z, c23.z, c33.z)));
- color = color/(dot(weights[0], vec4(1,1,1,1)) + dot(weights[1], vec4(1,1,1,1)) + dot(weights[2], vec4(1,1,1,1)) + dot(weights[3], vec4(1,1,1,1)));
-
- // Anti-ringing
- vec3 aux = color;
- color = clamp(color, min_sample, max_sample);
- color = mix(aux, color, JINC2_AR_STRENGTH);
-
- // final sum and weight normalization
- FragColor.xyz = color;
-}
-#endif
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/lanczos2-sharp.glsl b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/lanczos2-sharp.glsl
deleted file mode 100644
index 5f83af3..0000000
--- a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/interpolation/lanczos2-sharp.glsl
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- Hyllian's jinc windowed-jinc 2-lobe sharper with anti-ringing Shader
-
- Copyright (C) 2011-2016 Hyllian/Jararaca - sergiogdb@gmail.com
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-
-*/
-
-#define JINC2_WINDOW_SINC 0.5
-#define JINC2_SINC 1.0
-#define JINC2_AR_STRENGTH 0.8
-
-#define texCoord TEX0
-
-#if defined(VERTEX)
-
-#if __VERSION__ >= 130
-#define OUT out
-#define IN in
-#define tex2D texture
-#else
-#define OUT varying
-#define IN attribute
-#define tex2D texture2D
-#endif
-
-#ifdef GL_ES
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-
-IN vec4 VertexCoord;
-IN vec4 Color;
-IN vec2 TexCoord;
-OUT vec4 color;
-OUT vec2 texCoord;
-
-uniform mat4 MVPMatrix;
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-
-void main()
-{
- gl_Position = MVPMatrix * VertexCoord;
- color = Color;
- texCoord = TexCoord;
-}
-
-#elif defined(FRAGMENT)
-
-#if __VERSION__ >= 130
-#define IN in
-#define tex2D texture
-out vec4 FragColor;
-#else
-#define IN varying
-#define FragColor gl_FragColor
-#define tex2D texture2D
-#endif
-
-#ifdef GL_ES
-#ifdef GL_FRAGMENT_PRECISION_HIGH
-precision highp float;
-#else
-precision mediump float;
-#endif
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-uniform sampler2D s_p;
-IN vec2 texCoord;
-
-const float halfpi = 1.5707963267948966192313216916398;
-const float pi = 3.1415926535897932384626433832795;
-const float wa = JINC2_WINDOW_SINC*pi;
-const float wb = JINC2_SINC*pi;
-
-// Calculates the distance between two points
-float d(vec2 pt1, vec2 pt2)
-{
- vec2 v = pt2 - pt1;
- return sqrt(dot(v,v));
-}
-
-vec3 min4(vec3 a, vec3 b, vec3 c, vec3 d)
-{
- return min(a, min(b, min(c, d)));
-}
-
-vec3 max4(vec3 a, vec3 b, vec3 c, vec3 d)
-{
- return max(a, max(b, max(c, d)));
-}
-
-vec4 resampler(vec4 x)
-{
- vec4 res;
-
- res.x = (x.x==0.0) ? wa*wb : sin(x.x*wa)*sin(x.x*wb)/(x.x*x.x);
- res.y = (x.y==0.0) ? wa*wb : sin(x.y*wa)*sin(x.y*wb)/(x.y*x.y);
- res.z = (x.z==0.0) ? wa*wb : sin(x.z*wa)*sin(x.z*wb)/(x.z*x.z);
- res.w = (x.w==0.0) ? wa*wb : sin(x.w*wa)*sin(x.w*wb)/(x.w*x.w);
-
- return res;
-}
-
-void main()
-{
-
- vec3 color;
- vec4 weights[4];
-
- vec2 dx = vec2(1.0, 0.0);
- vec2 dy = vec2(0.0, 1.0);
-
- vec2 pc = texCoord*TextureSize;
-
- vec2 tc = (floor(pc-vec2(0.5,0.5))+vec2(0.5,0.5));
-
- weights[0] = resampler(vec4(d(pc, tc -dx -dy), d(pc, tc -dy), d(pc, tc +dx -dy), d(pc, tc+2.0*dx -dy)));
- weights[1] = resampler(vec4(d(pc, tc -dx ), d(pc, tc ), d(pc, tc +dx ), d(pc, tc+2.0*dx )));
- weights[2] = resampler(vec4(d(pc, tc -dx +dy), d(pc, tc +dy), d(pc, tc +dx +dy), d(pc, tc+2.0*dx +dy)));
- weights[3] = resampler(vec4(d(pc, tc -dx+2.0*dy), d(pc, tc +2.0*dy), d(pc, tc +dx+2.0*dy), d(pc, tc+2.0*dx+2.0*dy)));
-
- dx = dx/TextureSize;
- dy = dy/TextureSize;
- tc = tc/TextureSize;
-
- vec3 c00 = tex2D(s_p, tc -dx -dy).xyz;
- vec3 c10 = tex2D(s_p, tc -dy).xyz;
- vec3 c20 = tex2D(s_p, tc +dx -dy).xyz;
- vec3 c30 = tex2D(s_p, tc+2.0*dx -dy).xyz;
- vec3 c01 = tex2D(s_p, tc -dx ).xyz;
- vec3 c11 = tex2D(s_p, tc ).xyz;
- vec3 c21 = tex2D(s_p, tc +dx ).xyz;
- vec3 c31 = tex2D(s_p, tc+2.0*dx ).xyz;
- vec3 c02 = tex2D(s_p, tc -dx +dy).xyz;
- vec3 c12 = tex2D(s_p, tc +dy).xyz;
- vec3 c22 = tex2D(s_p, tc +dx +dy).xyz;
- vec3 c32 = tex2D(s_p, tc+2.0*dx +dy).xyz;
- vec3 c03 = tex2D(s_p, tc -dx+2.0*dy).xyz;
- vec3 c13 = tex2D(s_p, tc +2.0*dy).xyz;
- vec3 c23 = tex2D(s_p, tc +dx+2.0*dy).xyz;
- vec3 c33 = tex2D(s_p, tc+2.0*dx+2.0*dy).xyz;
-
- color = tex2D(s_p, texCoord).xyz;
-
- // Get min/max samples
- vec3 min_sample = min4(c11, c21, c12, c22);
- vec3 max_sample = max4(c11, c21, c12, c22);
-/*
- color = mat4x3(c00, c10, c20, c30) * weights[0];
- color+= mat4x3(c01, c11, c21, c31) * weights[1];
- color+= mat4x3(c02, c12, c22, c32) * weights[2];
- color+= mat4x3(c03, c13, c23, c33) * weights[3];
- mat4 wgts = mat4(weights[0], weights[1], weights[2], weights[3]);
- vec4 wsum = wgts * vec4(1.0,1.0,1.0,1.0);
- color = color/(dot(wsum, vec4(1.0,1.0,1.0,1.0)));
-*/
-
-
- color = vec3(dot(weights[0], vec4(c00.x, c10.x, c20.x, c30.x)), dot(weights[0], vec4(c00.y, c10.y, c20.y, c30.y)), dot(weights[0], vec4(c00.z, c10.z, c20.z, c30.z)));
- color+= vec3(dot(weights[1], vec4(c01.x, c11.x, c21.x, c31.x)), dot(weights[1], vec4(c01.y, c11.y, c21.y, c31.y)), dot(weights[1], vec4(c01.z, c11.z, c21.z, c31.z)));
- color+= vec3(dot(weights[2], vec4(c02.x, c12.x, c22.x, c32.x)), dot(weights[2], vec4(c02.y, c12.y, c22.y, c32.y)), dot(weights[2], vec4(c02.z, c12.z, c22.z, c32.z)));
- color+= vec3(dot(weights[3], vec4(c03.x, c13.x, c23.x, c33.x)), dot(weights[3], vec4(c03.y, c13.y, c23.y, c33.y)), dot(weights[3], vec4(c03.z, c13.z, c23.z, c33.z)));
- color = color/(dot(weights[0], vec4(1,1,1,1)) + dot(weights[1], vec4(1,1,1,1)) + dot(weights[2], vec4(1,1,1,1)) + dot(weights[3], vec4(1,1,1,1)));
-
- // Anti-ringing
- vec3 aux = color;
- color = clamp(color, min_sample, max_sample);
- color = mix(aux, color, JINC2_AR_STRENGTH);
-
- // final sum and weight normalization
- FragColor.xyz = color;
-}
-#endif
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/nearest-neighbor.glsl b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/nearest-neighbor.glsl
deleted file mode 100644
index aa7bee6..0000000
--- a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/Shaders/nearest-neighbor.glsl
+++ /dev/null
@@ -1,73 +0,0 @@
-#if defined(VERTEX)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING out
-#define COMPAT_ATTRIBUTE in
-#define COMPAT_TEXTURE texture
-#else
-#define COMPAT_VARYING varying
-#define COMPAT_ATTRIBUTE attribute
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-COMPAT_ATTRIBUTE vec4 VertexCoord;
-COMPAT_ATTRIBUTE vec4 COLOR;
-COMPAT_ATTRIBUTE vec4 TexCoord;
-COMPAT_VARYING vec4 COL0;
-COMPAT_VARYING vec4 TEX0;
-
-uniform mat4 MVPMatrix;
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-
-void main()
-{
- gl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];
- TEX0.xy = TexCoord.xy;
-}
-
-#elif defined(FRAGMENT)
-
-#if __VERSION__ >= 130
-#define COMPAT_VARYING in
-#define COMPAT_TEXTURE texture
-out vec4 FragColor;
-#else
-#define COMPAT_VARYING varying
-#define FragColor gl_FragColor
-#define COMPAT_TEXTURE texture2D
-#endif
-
-#ifdef GL_ES
-#ifdef GL_FRAGMENT_PRECISION_HIGH
-precision highp float;
-#else
-precision mediump float;
-#endif
-#define COMPAT_PRECISION mediump
-#else
-#define COMPAT_PRECISION
-#endif
-
-uniform COMPAT_PRECISION int FrameDirection;
-uniform COMPAT_PRECISION int FrameCount;
-uniform COMPAT_PRECISION vec2 OutputSize;
-uniform COMPAT_PRECISION vec2 TextureSize;
-uniform COMPAT_PRECISION vec2 InputSize;
-uniform sampler2D Texture;
-COMPAT_VARYING vec4 TEX0;
-
-void main()
-{
- FragColor = COMPAT_TEXTURE(Texture, TEX0.xy);
-}
-#endif
\ No newline at end of file
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/ddraw.ini b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/ddraw.ini
deleted file mode 100644
index 80fc4bc..0000000
--- a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/ddraw.ini
+++ /dev/null
@@ -1,1243 +0,0 @@
-; cnc-ddraw - https://github.com/FunkyFr3sh/cnc-ddraw
-
-[ddraw]
-; ### Optional settings ###
-; Use the following settings to adjust the look and feel to your liking
-
-
-; Stretch to custom resolution, 0 = defaults to the size game requests
-width=0
-height=0
-
-; Override the width/height settings shown above and always stretch to fullscreen
-; Note: Can be combined with 'windowed=true' to get windowed-fullscreen aka borderless mode
-fullscreen=false
-
-; Run in windowed mode rather than going fullscreen
-windowed=false
-
-; Maintain aspect ratio
-maintas=false
-
-; Windowboxing / Integer Scaling
-boxing=false
-
-; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap
-; Note: Does not have an impact on the game speed, to limit your game speed use 'maxgameticks='
-maxfps=-1
-
-; Vertical synchronization, enable if you get tearing - (Requires 'renderer=auto/opengl*/direct3d9*')
-; Note: vsync=true can fix tearing but it will cause input lag
-vsync=false
-
-; Automatic mouse sensitivity scaling
-; Note: Only works if stretching is enabled. Sensitivity will be adjusted according to the size of the window
-adjmouse=true
-
-; Preliminary libretro shader support - (Requires 'renderer=opengl*') https://github.com/libretro/glsl-shaders
-; 2x scaling example: https://imgur.com/a/kxsM1oY - 4x scaling example: https://imgur.com/a/wjrhpFV
-; You can specify a full path to a .glsl shader file here or use one of the values listed below
-; Possible values: Nearest neighbor, Bilinear, Bicubic, Lanczos, xBR-lv2
-shader=C:\ProgramData\cnc-ddraw\Shaders\interpolation\catmull-rom-bilinear.glsl
-
-; Window position, -32000 = center to screen
-posX=-32000
-posY=-32000
-
-; Renderer, possible values: auto, opengl, openglcore, gdi, direct3d9, direct3d9on12 (auto = try direct3d9/opengl, fallback = gdi)
-renderer=auto
-
-; Developer mode (don't lock the cursor)
-devmode=false
-
-; Show window borders in windowed mode
-border=true
-
-; Save window position/size/state on game exit and restore it automatically on next game start
-; Possible values: 0 = disabled, 1 = save to global 'ddraw' section, 2 = save to game specific section
-savesettings=1
-
-; Should the window be resizable by the user in windowed mode?
-resizable=true
-
-; Upscaling filter for the direct3d9* renderers
-; Possible values: 0 = nearest-neighbor, 1 = bilinear, 2 = bicubic, 3 = lanczos (bicubic/lanczos only support 16/32bit color depth games)
-d3d9_filter=2
-
-; Enable upscale hack for high resolution patches (Supports C&C1, Red Alert 1, Worms 2 and KKND Xtreme)
-vhack=false
-
-; Where should screenshots be saved
-screenshotdir=.\Screenshots\
-
-; Switch between windowed/borderless modes with alt+enter rather than windowed/fullscreen modes
-toggle_borderless=false
-
-; Switch between windowed/fullscreen upscaled modes with alt+enter rather than windowed/fullscreen modes
-toggle_upscaled=false
-
-
-
-; ### Compatibility settings ###
-; Use the following settings in case there are any issues with the game
-
-
-; Hide WM_ACTIVATEAPP and WM_NCACTIVATE messages to prevent problems on alt+tab
-noactivateapp=false
-
-; Max game ticks per second, possible values: -1 = disabled, -2 = refresh rate, 0 = emulate 60hz vblank, 1-1000 = custom game speed
-; Note: Can be used to slow down a too fast running game, fix flickering or too fast animations
-; Note: Usually one of the following values will work: 60 / 30 / 25 / 20 / 15 (lower value = slower game speed)
-maxgameticks=0
-
-; Method that should be used to limit game ticks (maxgameticks=): 0 = Automatic, 1 = TestCooperativeLevel, 2 = BltFast
-limiter_type=0
-
-; Force minimum FPS, possible values: 0 = disabled, -1 = use 'maxfps=' value, -2 = same as -1 but force full redraw, 1-1000 = custom FPS
-; Note: Set this to a low value such as 5 or 10 if some parts of the game are not being displayed (e.g. menus or loading screens)
-minfps=0
-
-; Disable fullscreen-exclusive mode for the direct3d9*/opengl* renderers
-; Note: Can be used in case some GUI elements like buttons/textboxes/videos/etc.. are invisible
-nonexclusive=false
-
-; Force CPU0 affinity, avoids crashes/freezing, *might* have a performance impact
-; Note: Disable this if the game is not running smooth or there are sound issues
-singlecpu=false
-
-; Available resolutions, possible values: 0 = Small list, 1 = Very small list, 2 = Full list
-; Note: Set this to 2 if your chosen resolution is not working or does not show up in the list
-; Note: Set this to 1 if the game is crashing on startup
-resolutions=0
-
-; Child window handling, possible values: 0 = Disabled, 1 = Display top left, 2 = Display top left + repaint, 3 = Hide
-; Note: Disables upscaling if a child window was detected (to ensure the game is fully playable, may look weird though)
-fixchilds=2
-
-; Enable one of the following settings if your cursor doesn't work properly when upscaling is enabled
-hook_peekmessage=false
-hook_getmessage=false
-
-
-; Undocumented settings - You may or may not change these (You should rather focus on the settings above)
-releasealt=false
-game_handles_close=false
-fixnotresponding=false
-hook=4
-guard_lines=200
-max_resolutions=0
-lock_surfaces=false
-allow_wmactivate=false
-flipclear=false
-fixmousehook=false
-rgb555=false
-no_dinput_hook=false
-refresh_rate=0
-anti_aliased_fonts_min_size=13
-custom_width=0
-custom_height=0
-min_font_size=0
-direct3d_passthrough=false
-center_cursor_fix=false
-;fake_mode=640x480x32
-wine_allow_resize=false
-lock_mouse_top_left=false
-no_compat_warning=false
-
-
-
-; ### Hotkeys ###
-; Use the following settings to configure your hotkeys, 0x00 = disabled
-; Virtual-Key Codes: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
-
-
-; Switch between windowed and fullscreen mode = [Alt] + ???
-keytogglefullscreen=0x0D
-
-; Maximize window = [Alt] + ???
-keytogglemaximize=0x22
-
-; Unlock cursor 1 = [Ctrl] + ???
-keyunlockcursor1=0x09
-
-; Unlock cursor 2 = [Right Alt] + ???
-keyunlockcursor2=0xA3
-
-; Screenshot
-keyscreenshot=0x2C
-
-
-
-; ### Config program settings ###
-; The following settings are for cnc-ddraw config.exe
-
-
-; cnc-ddraw config program language, possible values: auto, english, chinese, german, spanish, russian, hungarian, french, italian
-configlang=auto
-
-; cnc-ddraw config program theme, possible values: Windows10, Cobalt XEMedia
-configtheme=Windows10
-
-; Hide the 'Compatibility Settings' tab in cnc-ddraw config
-hide_compat_tab=false
-
-; Allow the users to 'Restore default settings' via cnc-ddraw config
-allow_reset=true
-
-
-
-; ### Game specific settings ###
-; The following settings override all settings shown above, section name = executable name
-
-
-; Atrox
-[Atrox]
-nonexclusive=true
-allow_wmactivate=true
-
-; Atomic Bomberman
-[BM]
-maxgameticks=60
-
-; Age of Empires
-[empires]
-nonexclusive=true
-adjmouse=true
-resolutions=2
-
-; Age of Empires: The Rise of Rome
-[empiresx]
-nonexclusive=true
-adjmouse=true
-resolutions=2
-
-; Age of Empires II
-[EMPIRES2]
-nonexclusive=true
-adjmouse=true
-
-; Age of Empires II: The Conquerors
-[age2_x1]
-nonexclusive=true
-adjmouse=true
-
-; American Conquest / Cossacks
-[DMCR]
-resolutions=2
-guard_lines=300
-minfps=-2
-
-; American Girls Dress Designer
-[Dress Designer]
-fake_mode=640x480x32
-nonexclusive=true
-
-; Age of Wonders 2
-[AoW2]
-resolutions=2
-renderer=opengl
-
-; Age of Wonders 2
-[AoW2Compat]
-resolutions=2
-renderer=opengl
-
-; Age of Wonders 2 Config Tool
-[aow2Setup]
-resolutions=2
-
-; Age of Wonders: Shadow Magic
-[AoWSM]
-resolutions=2
-renderer=opengl
-
-; Age of Wonders: Shadow Magic
-[AoWSMCompat]
-resolutions=2
-renderer=opengl
-
-; Age of Wonders: Shadow Magic Config Tool
-[AoWSMSetup]
-resolutions=2
-
-; Anstoss 3
-[anstoss3]
-renderer=gdi
-adjmouse=true
-
-; Anno 1602
-[1602]
-adjmouse=true
-
-; Alien Nations
-[AN]
-adjmouse=true
-
-; Atlantis
-[ATLANTIS]
-renderer=opengl
-maxgameticks=60
-center_cursor_fix=true
-
-; Airline Tycoon Deluxe
-[AT]
-fixchilds=0
-
-; Arthur's Wilderness Rescue
-[Arthur]
-renderer=gdi
-
-; Baldur's Gate II
-; Note: 'Use 3D Acceleration' must be disabled and 'Full Screen' must be enabled in BGConfig.exe
-[BGMain]
-resolutions=2
-
-; BALDR FORCE EXE
-[BaldrForce]
-noactivateapp=true
-
-; Blade & Sword
-[comeon]
-maxgameticks=60
-fixchilds=3
-
-; Blood II - The Chosen / Shogo - Mobile Armor Division
-[Client]
-checkfile=.\SOUND.REZ
-noactivateapp=true
-
-; Blue's 123 Time Activities
-[Blues123Time]
-renderer=gdi
-hook=3
-
-; Blue's Treasure Hunt
-[Blue'sTreasureHunt-Disc1]
-renderer=gdi
-
-; Blue's Treasure Hunt
-[Blue'sTreasureHunt-Disc2]
-renderer=gdi
-
-; Blue's Reading Time Activities
-[Blue's Reading Time]
-renderer=gdi
-
-; Blue's ArtTime Activities
-[ArtTime]
-renderer=gdi
-
-; Carmageddon
-[CARMA95]
-noactivateapp=true
-flipclear=true
-
-; Carmageddon
-[CARM95]
-noactivateapp=true
-flipclear=true
-
-; Carmageddon 2
-[Carma2_SW]
-noactivateapp=true
-
-; Carmen Sandiego's Great Chase - NOT WORKING YET
-[TIME32]
-allow_wmactivate=true
-renderer=gdi
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Captain Claw
-[claw]
-adjmouse=true
-noactivateapp=true
-nonexclusive=true
-
-; Command & Conquer: Sole Survivor
-[SOLE]
-maxgameticks=120
-maxfps=60
-minfps=-1
-
-; Command & Conquer Gold - CnCNet
-[cnc95]
-maxfps=125
-
-; Command & Conquer Gold
-[C&C95]
-maxgameticks=120
-maxfps=60
-minfps=-1
-
-; Command & Conquer: Red Alert - CnCNet
-[ra95-spawn]
-maxfps=125
-
-; Command & Conquer: Red Alert
-[ra95]
-maxgameticks=120
-maxfps=60
-minfps=-1
-
-; Command & Conquer: Red Alert
-[ra95_Mod-Launcher]
-maxgameticks=120
-maxfps=60
-minfps=-1
-
-; Command & Conquer: Red Alert
-[ra95p]
-maxfps=60
-minfps=-1
-
-; Command & Conquer: Tiberian Sun / Command & Conquer: Red Alert 2
-[game]
-checkfile=.\blowfish.dll
-tshack=true
-noactivateapp=true
-adjmouse=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Command & Conquer: Tiberian Sun Demo
-[SUN]
-noactivateapp=true
-tshack=true
-adjmouse=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Command & Conquer: Tiberian Sun - CnCNet
-[ts-spawn]
-noactivateapp=true
-tshack=true
-adjmouse=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Command & Conquer: Red Alert 2 - XWIS
-[ra2]
-noactivateapp=true
-tshack=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Command & Conquer: Red Alert 2 - XWIS
-[Red Alert 2]
-noactivateapp=true
-tshack=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Command & Conquer: Red Alert 2: Yuri's Revenge
-[gamemd]
-noactivateapp=true
-tshack=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Command & Conquer: Red Alert 2: Yuri's Revenge - ?ModExe?
-[ra2md]
-noactivateapp=true
-tshack=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Command & Conquer: Red Alert 2: Yuri's Revenge - CnCNet
-[gamemd-spawn]
-noactivateapp=true
-tshack=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Command & Conquer: Red Alert 2: Yuri's Revenge - XWIS
-[Yuri's Revenge]
-noactivateapp=true
-tshack=true
-maxfps=60
-minfps=-1
-maintas=false
-boxing=false
-
-; Commandos
-[comandos]
-maxgameticks=-1
-
-; Commandos
-[comandos_w10]
-maxgameticks=-1
-
-; Caesar III
-[c3]
-nonexclusive=true
-adjmouse=true
-
-; Chris Sawyer's Locomotion
-[LOCO]
-adjmouse=true
-
-; Cultures 2
-[Cultures2]
-adjmouse=true
-
-; Cultures 2 MP
-[Cultures2MP]
-adjmouse=true
-
-; Close Combat 2: A Bridge Too Far
-[cc2]
-adjmouse=true
-nonexclusive=true
-
-; Close Combat 3: The Russian Front
-[cc3]
-adjmouse=true
-nonexclusive=true
-
-; Close Combat 4: The Battle of the Bulge
-[cc4]
-adjmouse=true
-nonexclusive=true
-
-; Close Combat 5: Invasion: Normandy
-[cc5]
-adjmouse=true
-nonexclusive=true
-
-; ClueFinders Math Adventures 1.0
-[TCFM32]
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; ClueFinders Math Adventures 1.0
-[cfmath32]
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Call To Power 2
-[ctp2]
-maintas=false
-boxing=false
-
-; Corsairs Gold
-[corsairs]
-adjmouse=true
-
-; Divine Divinity
-[div]
-resolutions=2
-
-; Dragon Throne: Battle of Red Cliffs
-[AdSanguo]
-maxgameticks=60
-noactivateapp=true
-limiter_type=2
-
-; Dark Reign: The Future of War
-[DKReign]
-maxgameticks=60
-
-; Dungeon Keeper 2
-[DKII]
-maxgameticks=60
-noactivateapp=true
-
-; Deadlock 2
-[DEADLOCK]
-fixchilds=0
-adjmouse=false
-maintas=false
-boxing=false
-
-; Diablo
-[Diablo]
-devmode=true
-
-; Diablo: Hellfire
-[hellfire]
-devmode=true
-
-; Escape Velocity Nova
-[EV Nova]
-nonexclusive=true
-hook_peekmessage=true
-rgb555=true
-keytogglefullscreen=0x46
-adjmouse=true
-
-; Economic War
-[EcoW]
-maxgameticks=60
-fixnotresponding=true
-
-; Enemy Infestation
-[EI]
-hook_getmessage=true
-
-; Fairy Tale About Father Frost, Ivan and Nastya
-[mrazik]
-guard_lines=0
-
-; Future Cop - L.A.P.D.
-[FCopLAPD]
-nonexclusive=true
-adjmouse=true
-
-; Freddi 1
-[Freddi1]
-renderer=gdi
-
-; Freddi Fish : The Case of the Hogfish Rustlers of Briny Gulch
-[Freddihrbg]
-renderer=gdi
-
-; Freddi Water Worries
-[Water]
-renderer=gdi
-
-; Freddi Fish
-[FreddiSCS]
-renderer=gdi
-
-; Freddi Fish
-[FREDDI4]
-renderer=gdi
-hook=3
-
-; Freddi Fish's One-Stop Fun Shop
-[FreddisFunShop]
-renderer=gdi
-
-; Freddi Fish: The Case of the Creature of Coral Cove
-[freddicove]
-renderer=gdi
-
-; Freddi Fish: The Case of the Haunted Schoolhouse
-[FreddiCHSH]
-renderer=gdi
-
-; Freddi Fish: Maze Madness
-[Maze]
-renderer=gdi
-
-; G-Police
-[GPOLICE]
-maxgameticks=60
-
-; Gangsters: Organized Crime
-[gangsters]
-adjmouse=true
-nonexclusive=true
-
-; Gruntz
-[GRUNTZ]
-adjmouse=true
-noactivateapp=true
-nonexclusive=true
-
-; Jazz Jackrabbit 2 plus
-[Jazz2]
-keytogglefullscreen=0x08
-custom_width=800
-custom_height=450
-
-; Jazz Jackrabbit 2
-[Jazz2_NonPlus]
-keytogglefullscreen=0x08
-custom_width=800
-custom_height=450
-
-; Heroes of Might and Magic II: The Succession Wars
-[HEROES2W]
-adjmouse=true
-
-; Heroes of Might and Magic III
-[Heroes3]
-renderer=opengl
-game_handles_close=true
-
-; Heroes of Might and Magic III HD Mod
-[Heroes3 HD]
-renderer=opengl
-game_handles_close=true
-
-; Hard Truck: Road to Victory
-[htruck]
-maxgameticks=25
-renderer=opengl
-noactivateapp=true
-
-; Icewind Dale 2
-; Note: 'Full Screen' must be enabled in Config.exe
-; Note: 1070x602 is the lowest possible 16:9 resolution for the Widescreen patch (600/601 height will crash)
-[iwd2]
-resolutions=2
-custom_width=1070
-custom_height=602
-
-; Invictus
-[Invictus]
-adjmouse=true
-renderer=opengl
-
-; Interstate 76
-[i76]
-adjmouse=true
-
-; Infantry
-[infantry]
-resolutions=2
-infantryhack=true
-max_resolutions=90
-
-; Infantry Steam
-[FreeInfantry]
-resolutions=2
-infantryhack=true
-max_resolutions=90
-
-; Jagged Alliance 2
-[ja2]
-fixmousehook=true
-noactivateapp=true
-releasealt=true
-
-; Jagged Alliance 2: Unfinished Business
-[JA2UB]
-fixmousehook=true
-noactivateapp=true
-releasealt=true
-
-; Jagged Alliance 2: Wildfire
-[WF6]
-fixmousehook=true
-noactivateapp=true
-releasealt=true
-
-; Jagged Alliance 2 - UC mod
-[JA2_UC]
-fixmousehook=true
-noactivateapp=true
-releasealt=true
-
-; Jagged Alliance 2 - Vengeance Reloaded mod
-[JA2_Vengeance]
-fixmousehook=true
-noactivateapp=true
-releasealt=true
-
-; Jedi Knight Dark Forces 2
-[JK]
-direct3d_passthrough=true
-
-; Kings Quest 8
-[Mask]
-renderer=opengl
-
-; Konung
-[konung]
-fixchilds=0
-
-; Konung 2
-[Konung2]
-fixchilds=0
-
-; KKND Xtreme (With high resolution patch)
-[KKNDgame]
-vhack=true
-
-; KKND2: Krossfire
-[KKND2]
-noactivateapp=true
-
-; Knights and Merchants The Shattered Kingdom
-[KaM_800]
-limiter_type=2
-maxgameticks=60
-
-; Knights and Merchants The Shattered Kingdom
-[KaM_1024]
-limiter_type=2
-maxgameticks=60
-
-; Little Bear Kindergarten/Preschool Thinking Adventures: Parent's Progress Report
-[LBPR]
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Little Bear Kindergarten/Preschool Thinking Adventures
-[LBSTART]
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Little Bear Toddler Discovery Adventures
-[LBT]
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Lionheart
-[Lionheart]
-hook_peekmessage=true
-
-; Madeline 1st Grade Math
-[madmath1]
-nonexclusive=true
-no_compat_warning=true
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Madeline 1st Grade Math: Progress Report
-[madpr]
-nonexclusive=true
-no_compat_warning=true
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Madeline 2nd Grade Math
-[madmath2]
-nonexclusive=true
-no_compat_warning=true
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Majesty Gold
-[Majesty]
-minfps=-2
-
-; Majesty Gold HD
-[MajestyHD]
-adjmouse=true
-
-; Majesty Gold HD
-[MajestyHD - Old]
-adjmouse=true
-
-; Mech Warrior 3
-[Mech3]
-nonexclusive=true
-
-; Moorhuhn 2
-[Moorhuhn2]
-releasealt=true
-
-; New Robinson
-[ROBY]
-adjmouse=true
-hook_peekmessage=true
-
-; Nancy Drew (All games)
-[Game/3]
-checkfile=.\Nancy.cid
-limiter_type=1
-maxgameticks=120
-
-; Nox
-[NOX]
-checkfile=.\NOX.ICD
-renderer=direct3d9
-nonexclusive=false
-windowed=false
-maxgameticks=125
-
-; Nox Reloaded
-[NoxReloaded]
-maxgameticks=125
-
-; Nox GOG
-[Game/2]
-checkfile=.\nox.cfg
-maxgameticks=125
-
-; Outlaws
-[olwin]
-noactivateapp=true
-maxgameticks=60
-adjmouse=true
-renderer=gdi
-
-; Pajama Sam's Games to Play on Any Day
-[PJGAMES]
-renderer=gdi
-
-; Pajama Sam
-[PajamaTAL]
-renderer=gdi
-
-; Pajama Sam: No Need to Hide When It's Dark Outside
-[PajamaNHD]
-renderer=gdi
-
-; Pajama Sam 3
-[Pajama3]
-renderer=gdi
-
-; Pajama Sam(r): Life is Rough When You Lose Your Stuff(tm)
-[PajamaLRS]
-keytogglefullscreen=0x08
-
-; Pajama Sam's One-Stop Fun Shop
-[SamsFunShop]
-renderer=gdi
-
-; Pajama Sam DON'T FEAR THE DARK
-[pjSam]
-renderer=gdi
-
-; Pajama Sam 3: You Are What You Eat From Your Head To Your Feet
-[UKpajamaEAT]
-renderer=gdi
-
-; Pharaoh
-[Pharaoh]
-adjmouse=true
-
-; Putt-Putt Saves The Zoo
-[PUTTZOO]
-renderer=gdi
-hook=3
-
-; Putt-Putt's One-Stop Fun Shop
-[PuttsFunShop]
-renderer=gdi
-
-; Putt-Putt and Pep's Dog On A Stick
-[DOG]
-renderer=gdi
-
-; Putt-Putt Joins the Circus
-[puttcircus]
-renderer=gdi
-
-; Putt-Putt Enters The Race
-[UKPuttRace]
-renderer=gdi
-
-; Putt-Putt: Travels Through Time
-[PuttTTT]
-renderer=gdi
-
-; Putt-Putt and Pep's Balloon-o-Rama
-[Balloon]
-renderer=gdi
-
-; Putt-Putt Travels Through Time
-[PUTTPUTTTTT]
-renderer=gdi
-
-; Putt-Putt Joins the Circus
-[puttputtjtc]
-renderer=gdi
-
-; Putt-Putt: Pep's Birthday Surprise
-[PuttsFunShop]
-keytogglefullscreen=0x08
-
-; Pizza Syndicate
-[Pizza2]
-renderer=opengl
-
-; Pizza Syndicate - Mehr Biss (Mission CD)
-[Pizza_Mission]
-renderer=opengl
-
-; Pax Imperia
-[Pax Imperia]
-nonexclusive=true
-
-; Railroad Tycoon II
-[RT2]
-adjmouse=true
-
-; Reader Rabbit Thinking Ages 4-6 (US)
-[rrta32]
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Reader Rabbit Reading Ages 4-6
-[rrirjw32]
-renderer=gdi
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Reader Rabbit Reading Ages 6-9
-[irj2w32]
-renderer=gdi
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; ROAD RASH
-[RoadRash]
-adjmouse=true
-nonexclusive=true
-
-; Scooby-Doo(TM), Case File #1 The Glowing Bug Man - NOT WORKING YET
-[Case File #1]
-windowed=true
-nonexclusive=true
-fake_mode=640x480x32
-
-; Sim Copter
-[SimCopter]
-nonexclusive=true
-
-; Settlers 3
-[s3]
-nonexclusive=true
-
-; Star Trek - Armada
-[Armada]
-armadahack=true
-nonexclusive=true
-adjmouse=true
-maintas=false
-boxing=false
-
-; Star Wars: Galactic Battlegrounds
-[battlegrounds]
-nonexclusive=true
-adjmouse=true
-
-; Star Wars: Galactic Battlegrounds: Clone Campaigns
-[battlegrounds_x1]
-nonexclusive=true
-adjmouse=true
-
-; Starcraft
-[StarCraft]
-game_handles_close=true
-
-; Space Rangers
-[Rangers]
-hook_peekmessage=true
-
-; SPYFox: Hold the Mustard
-[mustard]
-renderer=gdi
-
-; SPY Fox: Some Assembly Required
-[Spyfox2]
-renderer=gdi
-
-; SPY Fox in Dry Cereal (2008)
-[SpyFox]
-renderer=gdi
-
-; SPY Fox in Dry Cereal (2001)
-[SPYFOXDC]
-renderer=gdi
-
-; SPY Fox : Some Assembly Required
-[SPYFOXSR]
-renderer=gdi
-
-; SPY Fox: Operation Ozone
-[spyozon]
-renderer=gdi
-
-; SPY Fox: Operation Ozone
-[spyfoxozu]
-renderer=gdi
-
-; Stronghold Crusader HD
-[Stronghold Crusader]
-resolutions=2
-stronghold_hack=true
-adjmouse=true
-
-; Stronghold Crusader Extreme HD
-[Stronghold_Crusader_Extreme]
-resolutions=2
-stronghold_hack=true
-adjmouse=true
-
-; Stronghold HD
-[Stronghold]
-resolutions=2
-stronghold_hack=true
-adjmouse=true
-
-; Sim City 3000
-[SC3]
-minfps=-2
-
-; Shadow Watch
-[sw]
-adjmouse=true
-
-; Shadow Flare
-[ShadowFlare]
-nonexclusive=true
-adjmouse=true
-maintas=false
-boxing=false
-
-; Total Annihilation (Unofficial Beta Patch v3.9.02)
-[TotalA]
-max_resolutions=32
-lock_surfaces=true
-
-; Total Annihilation Replay Viewer (Unofficial Beta Patch v3.9.02)
-[Viewer]
-max_resolutions=32
-lock_surfaces=true
-
-; Total Annihilation: Kingdoms
-[Kingdoms]
-game_handles_close=true
-max_resolutions=32
-
-; The X-Files DVD
-[XFiles]
-windowed=true
-fullscreen=true
-toggle_borderless=true
-
-; The Learning Company Launcher
-[TLCLauncher]
-tlc_hack=true
-adjmouse=false
-width=0
-height=0
-resizable=false
-maintas=false
-boxing=false
-
-; Three Kingdoms: Fate of the Dragon
-[sanguo]
-maxgameticks=60
-noactivateapp=true
-limiter_type=2
-
-; RollerCoaster Tycoon
-[rct]
-no_dinput_hook=true
-maxfps=0
-adjmouse=true
-
-; Twisted Metal
-[TWISTED]
-nonexclusive=true
-maxgameticks=25
-minfps=5
-
-; Twisted Metal 2
-[Tm2]
-nonexclusive=true
-maxgameticks=60
-adjmouse=true
-fixchilds=1
-maintas=false
-boxing=false
-
-; Tzar: The Burden of the Crown
-; Note: Must set 'DIRECTXDEVICE=0' in 'Tzar.ini'
-[Tzar]
-adjmouse=true
-
-; Uprising
-[uprising]
-adjmouse=true
-
-; Uprising 2
-[Uprising 2]
-renderer=opengl
-adjmouse=true
-
-; Vermeer
-[vermeer]
-adjmouse=true
-fake_mode=640x480x32
-
-; Wizardry 8
-[Wiz8]
-fixmousehook=true
-noactivateapp=true
-releasealt=true
-
-; Worms 2
-[worms2]
-vhack=true
-flipclear=true
-game_handles_close=true
-center_cursor_fix=true
-
-; Worms Armageddon
-[WA]
-adjmouse=true
-width=0
-height=0
-resizable=false
-
-; War Wind
-[WW]
-minfps=-1
-
-; Zeus and Poseidon
-[Zeus]
-adjmouse=true
-
diff --git a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/ddraw.tzst b/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/ddraw.tzst
deleted file mode 100644
index 6d03ec5..0000000
Binary files a/app/src/main/assets/dxwrapper/cnc-ddraw-6.6/ddraw.tzst and /dev/null differ
diff --git a/app/src/main/assets/dxwrapper/d8vk-1.0.tzst b/app/src/main/assets/dxwrapper/d8vk-1.0.tzst
deleted file mode 100644
index 5847fdc..0000000
Binary files a/app/src/main/assets/dxwrapper/d8vk-1.0.tzst and /dev/null differ
diff --git a/app/src/main/assets/dxwrapper/dxvk-0.96.tzst b/app/src/main/assets/dxwrapper/dxvk-0.96.tzst
deleted file mode 100644
index 0a17575..0000000
Binary files a/app/src/main/assets/dxwrapper/dxvk-0.96.tzst and /dev/null differ
diff --git a/app/src/main/assets/dxwrapper/dxvk-1.10.3.tzst b/app/src/main/assets/dxwrapper/dxvk-1.10.3.tzst
deleted file mode 100644
index 6581b37..0000000
Binary files a/app/src/main/assets/dxwrapper/dxvk-1.10.3.tzst and /dev/null differ
diff --git a/app/src/main/assets/dxwrapper/dxvk-2.3.1.tzst b/app/src/main/assets/dxwrapper/dxvk-2.3.1.tzst
deleted file mode 100644
index 7b76e70..0000000
Binary files a/app/src/main/assets/dxwrapper/dxvk-2.3.1.tzst and /dev/null differ
diff --git a/app/src/main/assets/dxwrapper/vkd3d-2.12.tzst b/app/src/main/assets/dxwrapper/vkd3d-2.12.tzst
deleted file mode 100644
index 8480298..0000000
Binary files a/app/src/main/assets/dxwrapper/vkd3d-2.12.tzst and /dev/null differ
diff --git a/app/src/main/assets/gpu_cards.json b/app/src/main/assets/gpu_cards.json
deleted file mode 100644
index ad7a56f..0000000
--- a/app/src/main/assets/gpu_cards.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"name":"NVIDIA RIVA 128","deviceID":24,"vendorID":4318},{"name":"NVIDIA RIVA TNT","deviceID":32,"vendorID":4318},{"name":"NVIDIA RIVA TNT2\/TNT2 Pro","deviceID":40,"vendorID":4318},{"name":"NVIDIA GeForce 256","deviceID":256,"vendorID":4318},{"name":"NVIDIA GeForce2 GTS\/GeForce2 Pro","deviceID":336,"vendorID":4318},{"name":"NVIDIA GeForce2 MX\/MX 400","deviceID":272,"vendorID":4318},{"name":"NVIDIA GeForce3","deviceID":512,"vendorID":4318},{"name":"NVIDIA GeForce4 MX 460","deviceID":368,"vendorID":4318},{"name":"NVIDIA GeForce4 Ti 4200","deviceID":595,"vendorID":4318},{"name":"NVIDIA GeForce FX 5200","deviceID":800,"vendorID":4318},{"name":"NVIDIA GeForce FX 5600","deviceID":786,"vendorID":4318},{"name":"NVIDIA GeForce FX 5800","deviceID":770,"vendorID":4318},{"name":"NVIDIA GeForce 6200","deviceID":335,"vendorID":4318},{"name":"NVIDIA GeForce 6600 GT","deviceID":320,"vendorID":4318},{"name":"NVIDIA GeForce 6800","deviceID":65,"vendorID":4318},{"name":"NVIDIA GeForce Go 7300","deviceID":2026952880896,"vendorID":4318},{"name":"NVIDIA GeForce Go 7400","deviceID":472,"vendorID":4318},{"name":"NVIDIA GeForce 7600 GT","deviceID":913,"vendorID":4318},{"name":"NVIDIA GeForce 7800 GT","deviceID":146,"vendorID":4318},{"name":"NVIDIA GeForce 8200","deviceID":9113598691403,"vendorID":4318},{"name":"NVIDIA GeForce 8300 GS","deviceID":1059,"vendorID":4318},{"name":"NVIDIA GeForce 8400 GS","deviceID":1028,"vendorID":4318},{"name":"NVIDIA GeForce 8500 GT","deviceID":1057,"vendorID":4318},{"name":"NVIDIA GeForce 8600 GT","deviceID":1026,"vendorID":4318},{"name":"NVIDIA GeForce 8600M GT","deviceID":1031,"vendorID":4318},{"name":"NVIDIA GeForce 8800 GTS","deviceID":403,"vendorID":4318},{"name":"NVIDIA GeForce 8800 GTX","deviceID":401,"vendorID":4318},{"name":"NVIDIA GeForce 9200","deviceID":2157,"vendorID":4318},{"name":"NVIDIA GeForce 9300","deviceID":2156,"vendorID":4318},{"name":"NVIDIA GeForce 9400M","deviceID":2147,"vendorID":4318},{"name":"NVIDIA GeForce 9400 GT","deviceID":1068,"vendorID":4318},{"name":"NVIDIA GeForce 9500 GT","deviceID":1600,"vendorID":4318},{"name":"NVIDIA GeForce 9600 GT","deviceID":1570,"vendorID":4318},{"name":"NVIDIA GeForce 9700M GT","deviceID":1610,"vendorID":4318},{"name":"NVIDIA GeForce 9800 GT","deviceID":1556,"vendorID":4318},{"name":"NVIDIA GeForce 210","deviceID":2595,"vendorID":4318},{"name":"NVIDIA GeForce GT 220","deviceID":2592,"vendorID":4318},{"name":"NVIDIA GeForce GT 240","deviceID":3235,"vendorID":4318},{"name":"NVIDIA GeForce GTS 250","deviceID":1557,"vendorID":4318},{"name":"NVIDIA GeForce GTX 260","deviceID":1506,"vendorID":4318},{"name":"NVIDIA GeForce GTX 275","deviceID":1510,"vendorID":4318},{"name":"NVIDIA GeForce GTX 280","deviceID":1505,"vendorID":4318},{"name":"NVIDIA GeForce 315M","deviceID":2682,"vendorID":4318},{"name":"NVIDIA GeForce 320M","deviceID":2211,"vendorID":4318},{"name":"NVIDIA GeForce GT 320M","deviceID":2605,"vendorID":4318},{"name":"NVIDIA GeForce GT 325M","deviceID":2613,"vendorID":4318},{"name":"NVIDIA GeForce GT 330","deviceID":3232,"vendorID":4318},{"name":"NVIDIA GeForce GTS 350M","deviceID":3248,"vendorID":4318},{"name":"NVIDIA GeForce 410M","deviceID":4181,"vendorID":4318},{"name":"NVIDIA GeForce GT 420","deviceID":3554,"vendorID":4318},{"name":"NVIDIA GeForce GT 425M","deviceID":3568,"vendorID":4318},{"name":"NVIDIA GeForce GT 430","deviceID":3553,"vendorID":4318},{"name":"NVIDIA GeForce GT 440","deviceID":3552,"vendorID":4318},{"name":"NVIDIA GeForce GTS 450","deviceID":3524,"vendorID":4318},{"name":"NVIDIA GeForce GTX 460","deviceID":3618,"vendorID":4318},{"name":"NVIDIA GeForce GTX 460M","deviceID":3537,"vendorID":4318},{"name":"NVIDIA GeForce GTX 465","deviceID":1732,"vendorID":4318},{"name":"NVIDIA GeForce GTX 470","deviceID":1741,"vendorID":4318},{"name":"NVIDIA GeForce GTX 480","deviceID":1728,"vendorID":4318},{"name":"NVIDIA GeForce GT 520","deviceID":4160,"vendorID":4318},{"name":"NVIDIA GeForce GT 525M","deviceID":3564,"vendorID":4318},{"name":"NVIDIA GeForce GT 540M","deviceID":3572,"vendorID":4318},{"name":"NVIDIA GeForce GTX 550 Ti","deviceID":4676,"vendorID":4318},{"name":"NVIDIA GeForce GT 555M","deviceID":1208,"vendorID":4318},{"name":"NVIDIA GeForce GTX 560 Ti","deviceID":4608,"vendorID":4318},{"name":"NVIDIA GeForce GTX 560M","deviceID":4689,"vendorID":4318},{"name":"NVIDIA GeForce GTX 560","deviceID":4609,"vendorID":4318},{"name":"NVIDIA GeForce GTX 570","deviceID":4225,"vendorID":4318},{"name":"NVIDIA GeForce GTX 580","deviceID":4224,"vendorID":4318},{"name":"NVIDIA GeForce GT 610","deviceID":4170,"vendorID":4318},{"name":"NVIDIA GeForce GT 630","deviceID":3840,"vendorID":4318},{"name":"NVIDIA GeForce GT 630M","deviceID":3561,"vendorID":4318},{"name":"NVIDIA GeForce GT 640","deviceID":4033,"vendorID":4318},{"name":"NVIDIA GeForce GT 640M","deviceID":4050,"vendorID":4318},{"name":"NVIDIA GeForce GT 650M","deviceID":4049,"vendorID":4318},{"name":"NVIDIA GeForce GTX 650","deviceID":4038,"vendorID":4318},{"name":"NVIDIA GeForce GTX 650 Ti","deviceID":4550,"vendorID":4318},{"name":"NVIDIA GeForce GTX 660","deviceID":4544,"vendorID":4318},{"name":"NVIDIA GeForce GTX 660M","deviceID":4052,"vendorID":4318},{"name":"NVIDIA GeForce GTX 660 Ti","deviceID":4483,"vendorID":4318},{"name":"NVIDIA GeForce GTX 670","deviceID":4489,"vendorID":4318},{"name":"NVIDIA GeForce GTX 670MX","deviceID":4513,"vendorID":4318},{"name":"NVIDIA GeForce GTX 675MX","deviceID":4519,"vendorID":4318},{"name":"NVIDIA GeForce GTX 675MX","deviceID":4514,"vendorID":4318},{"name":"NVIDIA GeForce GTX 680","deviceID":4480,"vendorID":4318},{"name":"NVIDIA GeForce GTX 690","deviceID":4488,"vendorID":4318},{"name":"NVIDIA GeForce GT 720","deviceID":4747,"vendorID":4318},{"name":"NVIDIA GeForce GT 730","deviceID":4743,"vendorID":4318},{"name":"NVIDIA GeForce GT 730M","deviceID":4065,"vendorID":4318},{"name":"NVIDIA GeForce GT 740M","deviceID":4754,"vendorID":4318},{"name":"NVIDIA GeForce GT 750M","deviceID":4073,"vendorID":4318},{"name":"NVIDIA GeForce GT 755M","deviceID":4045,"vendorID":4318},{"name":"NVIDIA GeForce GTX 750","deviceID":4993,"vendorID":4318},{"name":"NVIDIA GeForce GTX 750 Ti","deviceID":4992,"vendorID":4318},{"name":"NVIDIA GeForce GTX 760","deviceID":4487,"vendorID":4318},{"name":"NVIDIA GeForce GTX 760 Ti","deviceID":4499,"vendorID":4318},{"name":"NVIDIA GeForce GTX 765M","deviceID":4578,"vendorID":4318},{"name":"NVIDIA GeForce GTX 770M","deviceID":4576,"vendorID":4318},{"name":"NVIDIA GeForce GTX 770","deviceID":4484,"vendorID":4318},{"name":"NVIDIA GeForce GTX 775M","deviceID":4509,"vendorID":4318},{"name":"NVIDIA GeForce GTX 780","deviceID":4100,"vendorID":4318},{"name":"NVIDIA GeForce GTX 780M","deviceID":4510,"vendorID":4318},{"name":"NVIDIA GeForce GTX 780 Ti","deviceID":4106,"vendorID":4318},{"name":"NVIDIA GeForce GTX TITAN","deviceID":4101,"vendorID":4318},{"name":"NVIDIA GeForce GTX TITAN Black","deviceID":4108,"vendorID":4318},{"name":"NVIDIA GeForce GTX TITAN X","deviceID":6082,"vendorID":4318},{"name":"NVIDIA GeForce GTX TITAN Z","deviceID":4097,"vendorID":4318},{"name":"NVIDIA GeForce 820M","deviceID":4077,"vendorID":4318},{"name":"NVIDIA GeForce 830M","deviceID":4928,"vendorID":4318},{"name":"NVIDIA GeForce 840M","deviceID":4929,"vendorID":4318},{"name":"NVIDIA GeForce 845M","deviceID":4932,"vendorID":4318},{"name":"NVIDIA GeForce GTX 850M","deviceID":5009,"vendorID":4318},{"name":"NVIDIA GeForce GTX 860M","deviceID":21521759211930,"vendorID":4318},{"name":"NVIDIA GeForce GTX 870M","deviceID":4505,"vendorID":4318},{"name":"NVIDIA GeForce GTX 880M","deviceID":4504,"vendorID":4318},{"name":"NVIDIA GeForce 940M","deviceID":4935,"vendorID":4318},{"name":"NVIDIA GeForce GTX 950","deviceID":5122,"vendorID":4318},{"name":"NVIDIA GeForce GTX 950M","deviceID":5018,"vendorID":4318},{"name":"NVIDIA GeForce GTX 960","deviceID":5121,"vendorID":4318},{"name":"NVIDIA GeForce GTX 960M","deviceID":5019,"vendorID":4318},{"name":"NVIDIA GeForce GTX 970","deviceID":5058,"vendorID":4318},{"name":"NVIDIA GeForce GTX 970M","deviceID":5080,"vendorID":4318},{"name":"NVIDIA GeForce GTX 980","deviceID":5056,"vendorID":4318},{"name":"NVIDIA GeForce GTX 980 Ti","deviceID":6088,"vendorID":4318},{"name":"NVIDIA GeForce GT 1030","deviceID":7425,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1050","deviceID":7297,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1050 Ti","deviceID":7298,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1060 3GB","deviceID":7170,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1060","deviceID":7171,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1060M","deviceID":7200,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1070","deviceID":7041,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1080","deviceID":7040,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1080M","deviceID":7136,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1080 Ti","deviceID":6918,"vendorID":4318},{"name":"NVIDIA TITAN X (Pascal)","deviceID":6912,"vendorID":4318},{"name":"NVIDIA TITAN V","deviceID":7553,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1650 SUPER","deviceID":8583,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1660 SUPER","deviceID":8644,"vendorID":4318},{"name":"NVIDIA GeForce GTX 1660 Ti","deviceID":8578,"vendorID":4318},{"name":"NVIDIA GeForce RTX 2060","deviceID":7944,"vendorID":4318},{"name":"NVIDIA GeForce RTX 2070","deviceID":7943,"vendorID":4318},{"name":"NVIDIA GeForce RTX 2080","deviceID":7815,"vendorID":4318},{"name":"NVIDIA GeForce RTX 2080 Ti","deviceID":7687,"vendorID":4318},{"name":"NVIDIA GeForce RTX 3070","deviceID":9373,"vendorID":4318},{"name":"NVIDIA Tesla T4","deviceID":7864,"vendorID":4318},{"name":"NVIDIA Ampere A10","deviceID":8758,"vendorID":4318},{"name":"ATI Rage Fury","deviceID":21062,"vendorID":4098},{"name":"ATI RADEON 7200 SERIES","deviceID":20804,"vendorID":4098},{"name":"ATI RADEON 8500 SERIES","deviceID":20812,"vendorID":4098},{"name":"ATI Radeon 9500","deviceID":16708,"vendorID":4098},{"name":"ATI RADEON XPRESS 200M Series","deviceID":22869,"vendorID":4098},{"name":"ATI Radeon X700 SE","deviceID":24140,"vendorID":4098},{"name":"ATI Radeon X1600 Series","deviceID":29122,"vendorID":4098},{"name":"ATI Mobility Radeon HD 2350","deviceID":38087,"vendorID":4098},{"name":"ATI Mobility Radeon HD 2600","deviceID":38273,"vendorID":4098},{"name":"ATI Radeon HD 2900 XT","deviceID":37888,"vendorID":4098},{"name":"ATI Radeon HD 3200 Graphics","deviceID":38432,"vendorID":4098},{"name":"ATI Radeon HD 3850 AGP","deviceID":38165,"vendorID":4098},{"name":"ATI Mobility Radeon HD 4200","deviceID":38674,"vendorID":4098},{"name":"ATI Radeon HD 4350","deviceID":38223,"vendorID":4098},{"name":"ATI Radeon HD 4600 Series","deviceID":38037,"vendorID":4098},{"name":"ATI Radeon HD 4700 Series","deviceID":37966,"vendorID":4098},{"name":"ATI Radeon HD 4800 Series","deviceID":37964,"vendorID":4098},{"name":"ATI Radeon HD 5400 Series","deviceID":26873,"vendorID":4098},{"name":"ATI Radeon HD 5600 Series","deviceID":26840,"vendorID":4098},{"name":"ATI Radeon HD 5700 Series","deviceID":26814,"vendorID":4098},{"name":"ATI Radeon HD 5800 Series","deviceID":26776,"vendorID":4098},{"name":"ATI Radeon HD 5900 Series","deviceID":26780,"vendorID":4098},{"name":"AMD Radeon HD 6300 series Graphics","deviceID":38915,"vendorID":4098},{"name":"AMD Radeon HD 6400 Series","deviceID":26480,"vendorID":4098},{"name":"AMD Radeon HD 6410D","deviceID":38468,"vendorID":4098},{"name":"AMD Radeon HD 6480G","deviceID":38472,"vendorID":4098},{"name":"AMD Radeon HD 6490M","deviceID":26464,"vendorID":4098},{"name":"AMD Radeon HD 6550D","deviceID":38464,"vendorID":4098},{"name":"AMD Radeon HD 6600 Series","deviceID":26456,"vendorID":4098},{"name":"AMD Radeon HD 6600M Series","deviceID":26433,"vendorID":4098},{"name":"AMD Radeon HD 6700 Series","deviceID":26810,"vendorID":4098},{"name":"AMD Radeon HD 6800 Series","deviceID":26425,"vendorID":4098},{"name":"AMD Radeon HD 6900 Series","deviceID":26393,"vendorID":4098},{"name":"AMD Radeon HD 7660D","deviceID":39169,"vendorID":4098},{"name":"AMD Radeon HD 7700 Series","deviceID":26685,"vendorID":4098},{"name":"AMD Radeon HD 7800 Series","deviceID":26649,"vendorID":4098},{"name":"AMD Radeon HD 7870 Series","deviceID":26648,"vendorID":4098},{"name":"AMD Radeon HD 7900 Series","deviceID":26522,"vendorID":4098},{"name":"AMD Radeon HD 8600M Series","deviceID":26208,"vendorID":4098},{"name":"AMD Radeon HD 8670","deviceID":26128,"vendorID":4098},{"name":"AMD Radeon HD 8770","deviceID":26204,"vendorID":4098},{"name":"AMD Radeon HD 8400 \/ R3 Series","deviceID":38960,"vendorID":4098},{"name":"AMD Radeon(TM) R7 Graphics","deviceID":4879,"vendorID":4098},{"name":"AMD Radeon R9 285","deviceID":26937,"vendorID":4098},{"name":"AMD Radeon R9 290","deviceID":26545,"vendorID":4098},{"name":"AMD Radeon R9 290X","deviceID":26544,"vendorID":4098},{"name":"AMD Radeon (TM) R9 Fury Series","deviceID":29440,"vendorID":4098},{"name":"AMD Radeon R9 M370X","deviceID":26657,"vendorID":4098},{"name":"AMD Radeon R9 M380","deviceID":26183,"vendorID":4098},{"name":"AMD Radeon R9 M395X","deviceID":26912,"vendorID":4098},{"name":"Radeon(TM) RX 460 Graphics","deviceID":26607,"vendorID":4098},{"name":"Radeon (TM) RX 480 Graphics","deviceID":26591,"vendorID":4098},{"name":"Radeon RX Vega","deviceID":26751,"vendorID":4098},{"name":"Radeon Pro Vega 20","deviceID":27055,"vendorID":4098},{"name":"AMD Radeon(TM) Vega 10 Mobile Graphics","deviceID":5597,"vendorID":4098},{"name":"Radeon RX Vega 20","deviceID":26287,"vendorID":4098},{"name":"Radeon RX 5700 \/ 5700 XT","deviceID":29471,"vendorID":4098},{"name":"Radeon RX 5500M","deviceID":29504,"vendorID":4098},{"name":"Radeon RX 6800\/6800 XT \/ 6900 XT","deviceID":29631,"vendorID":4098},{"name":"Radeon Pro V620","deviceID":29601,"vendorID":4098},{"name":"Radeon Pro V620 VF","deviceID":29614,"vendorID":4098},{"name":"AMD VANGOGH","deviceID":5695,"vendorID":4098},{"name":"AMD Radeon(TM) Graphics","deviceID":5710,"vendorID":4098},{"name":"Intel(R) 82830M Graphics Controller","deviceID":13687,"vendorID":32902},{"name":"Intel(R) 82852\/82855 GM\/GME Graphics Controller","deviceID":13698,"vendorID":32902},{"name":"Intel(R) 845G","deviceID":9570,"vendorID":32902},{"name":"Intel(R) 82865G Graphics Controller","deviceID":9586,"vendorID":32902},{"name":"Intel(R) 82915G\/GV\/910GL Express Chipset Family","deviceID":9602,"vendorID":32902},{"name":"Intel(R) E7221G","deviceID":9610,"vendorID":32902},{"name":"Mobile Intel(R) 915GM\/GMS","deviceID":9618,"vendorID":32902},{"name":"Intel(R) 945G","deviceID":10098,"vendorID":32902},{"name":"Mobile Intel(R) 945GM Express Chipset Family","deviceID":10146,"vendorID":32902},{"name":"Intel(R) 945GME","deviceID":10158,"vendorID":32902},{"name":"Intel(R) Q35","deviceID":10674,"vendorID":32902},{"name":"Intel(R) G33","deviceID":10690,"vendorID":32902},{"name":"Intel(R) Q33","deviceID":10706,"vendorID":32902},{"name":"Intel(R) IGD","deviceID":40961,"vendorID":32902},{"name":"Intel(R) IGD","deviceID":40977,"vendorID":32902},{"name":"Intel(R) 965Q","deviceID":10642,"vendorID":32902},{"name":"Intel(R) 965G","deviceID":10626,"vendorID":32902},{"name":"Intel(R) 946GZ","deviceID":10610,"vendorID":32902},{"name":"Mobile Intel(R) 965 Express Chipset Family","deviceID":10754,"vendorID":32902},{"name":"Intel(R) 965GME","deviceID":10770,"vendorID":32902},{"name":"Mobile Intel(R) GM45 Express Chipset Family","deviceID":10818,"vendorID":32902},{"name":"Intel(R) Integrated Graphics Device","deviceID":11778,"vendorID":32902},{"name":"Intel(R) G45\/G43","deviceID":11810,"vendorID":32902},{"name":"Intel(R) Q45\/Q43","deviceID":11794,"vendorID":32902},{"name":"Intel(R) G41","deviceID":11826,"vendorID":32902},{"name":"Intel(R) B43","deviceID":11922,"vendorID":32902},{"name":"Intel(R) HD Graphics","deviceID":66,"vendorID":32902},{"name":"Intel(R) HD Graphics","deviceID":70,"vendorID":32902},{"name":"Intel(R) HD Graphics 3000","deviceID":290,"vendorID":32902},{"name":"Intel(R) HD Graphics 3000","deviceID":294,"vendorID":32902},{"name":"Intel(R) HD Graphics Family","deviceID":266,"vendorID":32902},{"name":"Intel(R) HD Graphics 4000","deviceID":354,"vendorID":32902},{"name":"Intel(R) HD Graphics 4000","deviceID":358,"vendorID":32902},{"name":"Intel(R) HD Graphics Family","deviceID":346,"vendorID":32902},{"name":"Intel(R) HD Graphics 4600","deviceID":1042,"vendorID":32902},{"name":"Intel(R) HD Graphics 4600","deviceID":1046,"vendorID":32902},{"name":"Intel(R) HD Graphics 5000","deviceID":2598,"vendorID":32902},{"name":"Intel(R) HD Graphics 5000","deviceID":1058,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics 5100","deviceID":2594,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics 5100","deviceID":2602,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics 5100","deviceID":2603,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics 5100","deviceID":2606,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 5200","deviceID":3362,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 5200","deviceID":3366,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 5200","deviceID":3370,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 5200","deviceID":3371,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 5200","deviceID":3374,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 5200","deviceID":3106,"vendorID":32902},{"name":"Intel(R) HD Graphics 5300","deviceID":5662,"vendorID":32902},{"name":"Intel(R) HD Graphics 5500","deviceID":5654,"vendorID":32902},{"name":"Intel(R) HD Graphics 5600","deviceID":5650,"vendorID":32902},{"name":"Intel(R) HD Graphics 6000","deviceID":5670,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics 6100","deviceID":5675,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 6200","deviceID":5666,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics P6300","deviceID":5674,"vendorID":32902},{"name":"Intel(R) HD Graphics 510","deviceID":6402,"vendorID":32902},{"name":"Intel(R) HD Graphics 510","deviceID":6406,"vendorID":32902},{"name":"Intel(R) HD Graphics 510","deviceID":6411,"vendorID":32902},{"name":"Intel(R) HD Graphics 515","deviceID":6430,"vendorID":32902},{"name":"Intel(R) HD Graphics 520","deviceID":6422,"vendorID":32902},{"name":"Intel(R) HD Graphics 520","deviceID":6433,"vendorID":32902},{"name":"Intel(R) HD Graphics 530","deviceID":6418,"vendorID":32902},{"name":"Intel(R) HD Graphics 530","deviceID":6427,"vendorID":32902},{"name":"Intel(R) HD Graphics P530","deviceID":6429,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics 540","deviceID":6438,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics 550","deviceID":6439,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics 555","deviceID":6443,"vendorID":32902},{"name":"Intel(R) Iris(TM) Graphics P555","deviceID":6445,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 580","deviceID":6450,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics 580","deviceID":6459,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics P580","deviceID":6458,"vendorID":32902},{"name":"Intel(R) Iris(TM) Pro Graphics P580","deviceID":6461,"vendorID":32902},{"name":"Intel(R) UHD Graphics 617","deviceID":34752,"vendorID":32902},{"name":"Intel(R) UHD Graphics 620","deviceID":16032,"vendorID":32902},{"name":"Intel(R) HD Graphics 615","deviceID":22814,"vendorID":32902},{"name":"Intel(R) HD Graphics 620","deviceID":22806,"vendorID":32902},{"name":"Intel(R) HD Graphics 630","deviceID":22802,"vendorID":32902},{"name":"Intel(R) HD Graphics 630","deviceID":22811,"vendorID":32902},{"name":"Intel(R) UHD Graphics 630","deviceID":16027,"vendorID":32902},{"name":"Intel(R) UHD Graphics 630","deviceID":16017,"vendorID":32902}]
\ No newline at end of file
diff --git a/app/src/main/assets/graphics_driver/turnip-24.1.0.tzst b/app/src/main/assets/graphics_driver/turnip-24.1.0.tzst
deleted file mode 100644
index 6603aaa..0000000
Binary files a/app/src/main/assets/graphics_driver/turnip-24.1.0.tzst and /dev/null differ
diff --git a/app/src/main/assets/graphics_driver/virgl-23.1.9.tzst b/app/src/main/assets/graphics_driver/virgl-23.1.9.tzst
deleted file mode 100644
index 1961439..0000000
Binary files a/app/src/main/assets/graphics_driver/virgl-23.1.9.tzst and /dev/null differ
diff --git a/app/src/main/assets/graphics_driver/zink-22.2.5.tzst b/app/src/main/assets/graphics_driver/zink-22.2.5.tzst
deleted file mode 100644
index 8c6c9fe..0000000
Binary files a/app/src/main/assets/graphics_driver/zink-22.2.5.tzst and /dev/null differ
diff --git a/app/src/main/assets/imagefs.txz b/app/src/main/assets/imagefs.txz
deleted file mode 100644
index ebff812..0000000
--- a/app/src/main/assets/imagefs.txz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:00a283c7d3e9ed2399b8d73175f92a3932b65e86925f7a5bd0fe0d4736e81e8a
-size 165829076
diff --git a/app/src/main/assets/imagefs_patches.tzst b/app/src/main/assets/imagefs_patches.tzst
deleted file mode 100644
index f2b6051..0000000
Binary files a/app/src/main/assets/imagefs_patches.tzst and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/0.png b/app/src/main/assets/inputcontrols/icons/0.png
deleted file mode 100644
index 508ae1e..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/0.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/1.png b/app/src/main/assets/inputcontrols/icons/1.png
deleted file mode 100644
index 5f17fd3..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/1.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/10.png b/app/src/main/assets/inputcontrols/icons/10.png
deleted file mode 100644
index b2942b8..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/10.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/11.png b/app/src/main/assets/inputcontrols/icons/11.png
deleted file mode 100644
index 69a4a95..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/11.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/12.png b/app/src/main/assets/inputcontrols/icons/12.png
deleted file mode 100644
index 0b93253..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/12.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/13.png b/app/src/main/assets/inputcontrols/icons/13.png
deleted file mode 100644
index 0c35939..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/13.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/14.png b/app/src/main/assets/inputcontrols/icons/14.png
deleted file mode 100644
index bb96019..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/14.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/15.png b/app/src/main/assets/inputcontrols/icons/15.png
deleted file mode 100644
index 3c998b9..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/15.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/16.png b/app/src/main/assets/inputcontrols/icons/16.png
deleted file mode 100644
index 5c608be..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/16.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/2.png b/app/src/main/assets/inputcontrols/icons/2.png
deleted file mode 100644
index 6828c0a..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/2.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/3.png b/app/src/main/assets/inputcontrols/icons/3.png
deleted file mode 100644
index 8907233..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/3.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/4.png b/app/src/main/assets/inputcontrols/icons/4.png
deleted file mode 100644
index a933119..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/4.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/5.png b/app/src/main/assets/inputcontrols/icons/5.png
deleted file mode 100644
index b2a4652..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/5.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/6.png b/app/src/main/assets/inputcontrols/icons/6.png
deleted file mode 100644
index b8cbaac..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/6.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/7.png b/app/src/main/assets/inputcontrols/icons/7.png
deleted file mode 100644
index d77a563..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/7.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/8.png b/app/src/main/assets/inputcontrols/icons/8.png
deleted file mode 100644
index f854efa..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/8.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/icons/9.png b/app/src/main/assets/inputcontrols/icons/9.png
deleted file mode 100644
index 465134c..0000000
Binary files a/app/src/main/assets/inputcontrols/icons/9.png and /dev/null differ
diff --git a/app/src/main/assets/inputcontrols/profiles/controls-1.icp b/app/src/main/assets/inputcontrols/profiles/controls-1.icp
deleted file mode 100644
index 9edb7f0..0000000
--- a/app/src/main/assets/inputcontrols/profiles/controls-1.icp
+++ /dev/null
@@ -1 +0,0 @@
-{"id":1,"name":"RTS","cursorSpeed":1,"elements":[{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_DEL","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_DOWN","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":5},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_RIGHT","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.6222222447395325,"toggleSwitch":false,"text":"","iconId":4},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_LEFT","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.6222222447395325,"toggleSwitch":false,"text":"","iconId":2},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_UP","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.4888888895511627,"toggleSwitch":false,"text":"","iconId":3},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_ESC","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["MOUSE_RIGHT_BUTTON","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_TAB","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.4888888895511627,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_SHIFT_L","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_CTRL_L","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.8888888955116272,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_ALT_L","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.8888888955116272,"toggleSwitch":false,"text":"","iconId":0},{"type":"RANGE_BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE","NONE","NONE"],"scale":1,"x":0.1568627506494522,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0,"range":"FROM_0_TO_9"},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_SPACE","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8888888955116272,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_BKSP","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_ENTER","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.8888888955116272,"toggleSwitch":false,"text":"","iconId":0},{"type":"RANGE_BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE","NONE","NONE"],"scale":1,"x":0.843137264251709,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0}]}
\ No newline at end of file
diff --git a/app/src/main/assets/inputcontrols/profiles/controls-2.icp b/app/src/main/assets/inputcontrols/profiles/controls-2.icp
deleted file mode 100644
index d88d799..0000000
--- a/app/src/main/assets/inputcontrols/profiles/controls-2.icp
+++ /dev/null
@@ -1 +0,0 @@
-{"id":2,"name":"Template (12 buttons)","cursorSpeed":1,"elements":[{"type":"D_PAD","shape":"CIRCLE","bindings":["KEY_W","KEY_D","KEY_S","KEY_A"],"scale":1,"x":0.10784313827753067,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.8133170008659363,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.6000000238418579,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.8235294222831726,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.9215686321258545,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":0.85,"x":0.06862745434045792,"y":0.4444444477558136,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.1764705926179886,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":0.85,"x":0.9309640526771545,"y":0.4444444477558136,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0}]}
\ No newline at end of file
diff --git a/app/src/main/assets/inputcontrols/profiles/controls-3.icp b/app/src/main/assets/inputcontrols/profiles/controls-3.icp
deleted file mode 100644
index cf10357..0000000
--- a/app/src/main/assets/inputcontrols/profiles/controls-3.icp
+++ /dev/null
@@ -1 +0,0 @@
-{"id":3,"name":"Virtual Gamepad","cursorSpeed":1,"elements":[{"type":"D_PAD","shape":"CIRCLE","bindings":["GAMEPAD_DPAD_UP","GAMEPAD_DPAD_RIGHT","GAMEPAD_DPAD_DOWN","GAMEPAD_DPAD_LEFT"],"scale":0.85,"x":0.21568627655506134,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_X","NONE","NONE","NONE"],"scale":1,"x":0.8133170008659363,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_Y","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.6000000238418579,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_A","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_B","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["GAMEPAD_BUTTON_R2","NONE","NONE","NONE"],"scale":1,"x":0.9215686321258545,"y":0.2888889014720917,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["GAMEPAD_BUTTON_R1","NONE","NONE","NONE"],"scale":1,"x":0.9215686321258545,"y":0.42222222685813904,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["GAMEPAD_BUTTON_L1","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.42222222685813904,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["GAMEPAD_BUTTON_L2","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.2888889014720917,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["GAMEPAD_BUTTON_START","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":15},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["GAMEPAD_BUTTON_SELECT","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":16},{"type":"STICK","shape":"CIRCLE","bindings":["GAMEPAD_LEFT_THUMB_UP","GAMEPAD_LEFT_THUMB_RIGHT","GAMEPAD_LEFT_THUMB_DOWN","GAMEPAD_LEFT_THUMB_LEFT"],"scale":1,"x":0.10784313827753067,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"TRACKPAD","shape":"CIRCLE","bindings":["GAMEPAD_RIGHT_THUMB_UP","GAMEPAD_RIGHT_THUMB_RIGHT","GAMEPAD_RIGHT_THUMB_DOWN","GAMEPAD_RIGHT_THUMB_LEFT"],"scale":1,"x":0.7843137383460999,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_L3","NONE","NONE","NONE"],"scale":0.85,"x":0.21568627655506134,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_R3","NONE","NONE","NONE"],"scale":0.85,"x":0.7843137383460999,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0}]}
\ No newline at end of file
diff --git a/app/src/main/assets/pulseaudio.tzst b/app/src/main/assets/pulseaudio.tzst
deleted file mode 100644
index 21ae130..0000000
Binary files a/app/src/main/assets/pulseaudio.tzst and /dev/null differ
diff --git a/app/src/main/assets/wincomponents/direct3d.tzst b/app/src/main/assets/wincomponents/direct3d.tzst
deleted file mode 100644
index ffdeebb..0000000
Binary files a/app/src/main/assets/wincomponents/direct3d.tzst and /dev/null differ
diff --git a/app/src/main/assets/wincomponents/directmusic.tzst b/app/src/main/assets/wincomponents/directmusic.tzst
deleted file mode 100644
index 237ba7a..0000000
Binary files a/app/src/main/assets/wincomponents/directmusic.tzst and /dev/null differ
diff --git a/app/src/main/assets/wincomponents/directplay.tzst b/app/src/main/assets/wincomponents/directplay.tzst
deleted file mode 100644
index c263e89..0000000
Binary files a/app/src/main/assets/wincomponents/directplay.tzst and /dev/null differ
diff --git a/app/src/main/assets/wincomponents/directshow.tzst b/app/src/main/assets/wincomponents/directshow.tzst
deleted file mode 100644
index 9f6e129..0000000
Binary files a/app/src/main/assets/wincomponents/directshow.tzst and /dev/null differ
diff --git a/app/src/main/assets/wincomponents/directsound.tzst b/app/src/main/assets/wincomponents/directsound.tzst
deleted file mode 100644
index 791a16c..0000000
Binary files a/app/src/main/assets/wincomponents/directsound.tzst and /dev/null differ
diff --git a/app/src/main/assets/wincomponents/vcrun2010.tzst b/app/src/main/assets/wincomponents/vcrun2010.tzst
deleted file mode 100644
index 0c29cb7..0000000
Binary files a/app/src/main/assets/wincomponents/vcrun2010.tzst and /dev/null differ
diff --git a/app/src/main/assets/wincomponents/wincomponents.json b/app/src/main/assets/wincomponents/wincomponents.json
deleted file mode 100644
index e23fb49..0000000
--- a/app/src/main/assets/wincomponents/wincomponents.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "direct3d" : ["d3dcompiler_33", "d3dcompiler_34", "d3dcompiler_35", "d3dcompiler_36", "d3dcompiler_37", "d3dcompiler_38", "d3dcompiler_39", "d3dcompiler_40", "d3dcompiler_41", "d3dcompiler_42", "d3dcompiler_43", "d3dcompiler_46", "d3dcompiler_47", "d3dcsx_42", "d3dcsx_43", "d3dx10", "d3dx10_33", "d3dx10_34", "d3dx10_35", "d3dx10_36", "d3dx10_37", "d3dx10_38", "d3dx10_39", "d3dx10_40", "d3dx10_41", "d3dx10_42", "d3dx10_43", "d3dx11_42", "d3dx11_43", "d3dx9_24", "d3dx9_25", "d3dx9_26", "d3dx9_27", "d3dx9_28", "d3dx9_29", "d3dx9_30", "d3dx9_31", "d3dx9_32", "d3dx9_33", "d3dx9_34", "d3dx9_35", "d3dx9_36", "d3dx9_37", "d3dx9_38", "d3dx9_39", "d3dx9_40", "d3dx9_41", "d3dx9_42", "d3dx9_43"],
- "directsound" : ["dsound"],
- "directmusic" : ["dmband", "dmcompos", "dmime", "dmloader", "dmscript", "dmstyle", "dmsynth", "dmusic", "dmusic32", "dswave"],
- "directshow" : ["amstream", "qasf", "qcap", "qdvd", "qedit", "quartz"],
- "directplay" : ["dplaysvr.exe", "dplayx", "dpmodemx", "dpnet", "dpnhpast", "dpnhupnp", "dpnsvr.exe", "dpwsockx"],
- "vcrun2010" : ["msvcp100", "msvcr100", "vcomp100", "atl100"],
- "wmdecoder" : ["wmvcore", "wmasf", "wmadmod", "wmvdecod"]
-}
\ No newline at end of file
diff --git a/app/src/main/assets/wincomponents/wmdecoder.tzst b/app/src/main/assets/wincomponents/wmdecoder.tzst
deleted file mode 100644
index 30f493a..0000000
Binary files a/app/src/main/assets/wincomponents/wmdecoder.tzst and /dev/null differ
diff --git a/app/src/main/assets/wine_debug_channels.json b/app/src/main/assets/wine_debug_channels.json
deleted file mode 100644
index 69cd920..0000000
--- a/app/src/main/assets/wine_debug_channels.json
+++ /dev/null
@@ -1 +0,0 @@
-["acledit","aclui","actctx","activeds","actxprxy","adpcm","adsldp","advapi","advpack","alsa","amsi","animate","appbar","apphelp","appwizcpl","appx","asmshader","aspi","atl","atlthunk","atmlib","atom","authz","avicap","avifile","avrt","bcrypt","bidi","bitblt","bitmap","bluetooth","bluetoothapis","browseui","button","bytecodewriter","cabinet","capi","capture","cards","cdosys","class","clipboard","clipping","clusapi","combase","combo","comboex","comm","commctrl","commdlg","compstui","comsvcs","concrt","connect","console","context","coreaudio","cred","credentials","credui","crypt","cryptasn","cryptdlg","cryptext","cryptnet","crypto","cryptui","ctapi32","cursor","d2d","d3d","d3d10","d3d10core","d3d11","d3d12","d3d8","d3d9","d3d_decl","d3d_shader","d3dcompiler","d3drm","d3dx","d3dxof","d3dxof_parsing","data","datetime","davclnt","dbgeng","dbghelp","dbghelp_coff","dbghelp_dwarf","dbghelp_macho","dbghelp_msc","dbghelp_stabs","dc","dciman","dcomp","ddeml","ddraw","ddrawex","debug_buffer","debugstr","devenum","dhcpcsvc","dhtmled","dialog","diasymreader","difxapi","dinput","display","dll","dmband","dmcompos","dmfile","dmime","dmloader","dmobj","dmscript","dmstyle","dmsynth","dmusic","dmusic32","dnsapi","dosmem","dpa","dplay","dpnet","dpnhpast","dpnhupnp","dpvoice","dragdrop","driver","dsa","dsdmo","dsound","dsound3d","dsquery","dssenh","dsuiext","dswave","dwmapi","dwrite","dx8vb","dxcore","dxdiag","dxgi","dxtrans","dxva2","edit","enhmetafile","enumeration","environ","err","event","eventlog","evr","exception","exec","explorerframe","faultrep","file","fixme","fixup","fltlib","fltmgr","font","fontcache","fontsub","fusion","fwpuclnt","g711","gamebar","gameux","gamingtcui","gdi","gdiplus","geolocator","gl_compat","global","globalmem","glu","graphics","gsm","handle","header","heap","hid","hlink","hnetcfg","hook","hostname","hotkey","htmlhelp","http","hvsi","iccvid","icm","icon","ieframe","image","imagehlp","imagelist","imm","inetcomm","inetcpl","inetmib1","infosoft","inkobj","input","inseng","int","int21","int31","ipaddress","iphlpapi","ir50_32","itss","joycpl","jscript","jsproxy","kerberos","kernelbase","keyboard","ksecdd","lanman","listbox","listview","loaddll","loadperf","local","locale","localspl","localui","macdrv","manipulation","mapi","mci","mciavi","mcicda","mcimidi","mciqtz","mciwave","mdi","media","mediacontrol","menu","message","metafile","mfplat","mgmtapi","midi","mlang","mmaux","mmc","mmdevapi","mmio","mmsys","mmtime","model","module","monthcal","mountmgr","mp3dmod","mpeg3","mpr","mprapi","msacm","msado15","msasn1","msauddecmft","mscms","msctf","msctfmonitor","msdasql","msdmo","msdrm","msftedit","msg","mshtml","msi","msidb","msident","msimg32","msimtf","msisip","msisys","msmpeg2vdec","msnet","msopc","mspatcha","msrle32","msscript","mssign","mstask","msttsengine","msvcirt","msvcm","msvcp","msvcrt","msvidc32","msvideo","mswsock","msxml","nativefont","ncrypt","nddeapi","ndis","netapi32","netbios","netcfgx","netio","netprofm","ninput","nls","nonclient","nsi","nstc","ntdll","ntdsapi","ntlm","ntoskrnl","ntprint","objsel","odbc","ole","oleacc","oledb","oledlg","olemalloc","olepicture","opencl","opengl","oss","packager","pager","palette","path","pdh","perception","pidgen","pidl","plugplay","powermgnt","powrprof","print","printui","prntvpt","process","profile","progress","propsheet","propsys","psdrv","pstores","pulse","qmgr","quartz","query","qwave","ras","rasdlg","rawinput","rebar","recyclebin","reg","region","relay","resource","richedit","richedit_lists","rpc","rstrtmgr","rtutils","sapi","schannel","schedsvc","scrobj","scroll","scrrun","scsiport","secur32","security","seh","selector","sensapi","service","setupapi","sfc","shcore","shdocvw","shell","shlctrl","slc","smbios","snmpapi","snoop","sound","speech","spoolss","sspicli","static","statusbar","sti","storage","stress","string","sxs","sync","syslevel","syslink","system","systray","t2embed","tab","tape","tapi","task","taskdialog","taskschd","tbs","tdh","tdi","text","theme_scroll","thread","threadpool","thunk","toolbar","toolhelp","tooltips","trackbar","traffic","treeview","twain","twinapi","ui","uianimation","uiautomation","uiribbon","unloaddll","unwind","updown","updspapi","url","urlmon","usb","usbd","user","uxtheme","variant","vbscript","vcomp","vcruntime","vdmdbg","ver","virtdisk","volume","vulkan","vxd","warn","wavemap","waylanddrv","wbemdisp","wbemprox","webservices","wer","wevtapi","wgl","wia","wimgapi","win","wincodecs","winemapi","wineusb","wing","winhttp","wininet","winmm","winprint","winscard","winsock","winspool","winsta","winstation","winstring","wintab","wintab32","wintrust","wintypes","winusb","wlanapi","wldap32","wldp","wmadec","wmi","wmiutils","wmp","wmvcore","wnet","wofutil","wow","wpc","wpcap","wsdapi","wshom","wsnmp32","wtsapi","wuapi","x11drv","xaudio2","xdnd","xim","xinput","xmllite","xolehlp","xrandr","xrender","xvidmode"]
\ No newline at end of file
diff --git a/app/src/main/assets/wine_startmenu.json b/app/src/main/assets/wine_startmenu.json
deleted file mode 100644
index a2f4cb8..0000000
--- a/app/src/main/assets/wine_startmenu.json
+++ /dev/null
@@ -1,76 +0,0 @@
-[
- {
- "name" : "Programs",
- "children" : [
- {
- "name" : "7-Zip",
- "path" : "Z:/opt/apps/7-Zip/7zFM.exe"
- },
- {
- "name" : "Internet Explorer",
- "path" : "C:/windows/system32/iexplore.exe"
- },
- {
- "name" : "Notepad",
- "path" : "C:/windows/notepad.exe"
- },
- {
- "name" : "Wordpad",
- "path" : "C:/windows/system32/write.exe",
- "iconLocation" : "Z:/opt/wine/lib/wine/i386-windows/wordpad.exe"
- },
- {
- "name" : "Games",
- "children" : [
- {
- "name" : "WineMine",
- "path" : "C:/windows/system32/winemine.exe"
- }
- ]
- }
- ]
- },
- {
- "name" : "System Tools",
- "children" : [
- {
- "name" : "Test Direct3D",
- "path" : "Z:/opt/apps/TestD3D.exe"
- },
- {
- "name" : "Computer",
- "path" : "C:/windows/wfm.exe"
- },
- {
- "name" : "Task Manager",
- "path" : "C:/windows/system32/taskmgr.exe"
- },
- {
- "name" : "Registry Editor",
- "path" : "C:/windows/regedit.exe"
- },
- {
- "name" : "Command Prompt",
- "path" : "C:/windows/system32/cmd.exe"
- },
- {
- "name" : "Wine Mono Installer",
- "path" : "C:/windows/system32/control.exe",
- "cmdArgs" : "appwiz.cpl install_mono",
- "iconLocation" : "shell32.dll",
- "iconIndex" : -25
- },
- {
- "name" : "Wine Gecko Installer",
- "path" : "C:/windows/system32/control.exe",
- "cmdArgs" : "appwiz.cpl install_gecko",
- "iconLocation" : "shell32.dll",
- "iconIndex" : -25
- },
- {
- "name" : "Wine Configuration",
- "path" : "C:/windows/system32/winecfg.exe"
- }
- ]
- }
-]
\ No newline at end of file
diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt
deleted file mode 100644
index 3ffc1c9..0000000
--- a/app/src/main/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-cmake_minimum_required(VERSION 3.22.1)
-
-Project(Winlator)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wno-unused-function -Wimplicit-function-declaration")
-
-add_subdirectory(proot)
-add_subdirectory(virglrenderer)
-add_subdirectory(OpenXR-SDK)
-add_subdirectory(midihandler)
-
-add_library(winlator SHARED
- xr/engine.c
- xr/framebuffer.c
- xr/input.c
- xr/main.c
- xr/math.c
- xr/renderer.c
- winlator/drawable.c
- winlator/gpu_image.c
- winlator/sysvshared_memory.c
- winlator/xconnector_epoll.c
- winlator/alsa_client.c)
-
-target_link_libraries(winlator
- log
- android
- jnigraphics
- openxr_loader
- aaudio
- EGL
- GLESv2
- GLESv3)
\ No newline at end of file
diff --git a/app/src/main/cpp/OpenXR-SDK b/app/src/main/cpp/OpenXR-SDK
deleted file mode 160000
index 288d3a7..0000000
--- a/app/src/main/cpp/OpenXR-SDK
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 288d3a7ebc1ad959f62d51da75baa3d27438c499
diff --git a/app/src/main/cpp/midihandler/CMakeLists.txt b/app/src/main/cpp/midihandler/CMakeLists.txt
deleted file mode 100644
index 1c9c0e2..0000000
--- a/app/src/main/cpp/midihandler/CMakeLists.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-cmake_minimum_required(VERSION 3.22.1)
-
-project(MIDIHandler)
-
-set(JNILIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../jniLibs/arm64-v8a)
-
-add_library(libc++_shared SHARED IMPORTED)
-set_target_properties(libc++_shared PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libc++_shared.so)
-
-add_library(libFLAC SHARED IMPORTED)
-set_target_properties(libFLAC PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libFLAC.so)
-
-add_library(libfluidsynth SHARED IMPORTED)
-set_target_properties(libfluidsynth PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libfluidsynth.so)
-
-add_library(libfluidsynth-assetloader SHARED IMPORTED)
-set_target_properties(libfluidsynth-assetloader PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libfluidsynth-assetloader.so)
-
-add_library(libgio-2.0 SHARED IMPORTED)
-set_target_properties(libgio-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libgio-2.0.so)
-
-add_library(libglib-2.0 SHARED IMPORTED)
-set_target_properties(libglib-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libglib-2.0.so)
-
-add_library(libgmodule-2.0 SHARED IMPORTED)
-set_target_properties(libgmodule-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libgmodule-2.0.so)
-
-add_library(libgobject-2.0 SHARED IMPORTED)
-set_target_properties(libgobject-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libgobject-2.0.so)
-
-add_library(libgthread-2.0 SHARED IMPORTED)
-set_target_properties(libgthread-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libgthread-2.0.so)
-
-add_library(libinstpatch-1.0 SHARED IMPORTED)
-set_target_properties(libinstpatch-1.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libinstpatch-1.0.so)
-
-add_library(liboboe SHARED IMPORTED)
-set_target_properties(liboboe PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/liboboe.so)
-
-add_library(libogg SHARED IMPORTED)
-set_target_properties(libogg PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libogg.so)
-
-add_library(libopus SHARED IMPORTED)
-set_target_properties(libopus PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libopus.so)
-
-add_library(libpcre SHARED IMPORTED)
-set_target_properties(libpcre PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libpcre.so)
-
-add_library(libpcreposix SHARED IMPORTED)
-set_target_properties(libpcreposix PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libpcreposix.so)
-
-add_library(libsndfile SHARED IMPORTED)
-set_target_properties(libsndfile PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libsndfile.so)
-
-add_library(libvorbis SHARED IMPORTED)
-set_target_properties(libvorbis PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libvorbis.so)
-
-add_library(libvorbisenc SHARED IMPORTED)
-set_target_properties(libvorbisenc PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libvorbisenc.so)
-
-add_library(libvorbisfile SHARED IMPORTED)
-set_target_properties(libvorbisfile PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libvorbisfile.so)
-
-find_package(OpenMP REQUIRED)
-
-add_library(midihandler SHARED
- midihandler.c)
-
-target_include_directories(midihandler PRIVATE fluidsynth/include)
-
-target_link_libraries(midihandler
- libFLAC
- libfluidsynth-assetloader
- libgio-2.0
- libglib-2.0
- libgmodule-2.0
- libgobject-2.0
- libgthread-2.0
- libinstpatch-1.0
- liboboe
- libogg
- libopus
- libpcre
- libpcreposix
- libsndfile
- libvorbis
- libvorbisenc
- libvorbisfile
- libfluidsynth
- OpenMP::OpenMP_CXX
- log)
\ No newline at end of file
diff --git a/app/src/main/cpp/midihandler/fluidsynth/LICENSE b/app/src/main/cpp/midihandler/fluidsynth/LICENSE
deleted file mode 100644
index 19e3071..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/LICENSE
+++ /dev/null
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-(This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.)
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- {description}
- Copyright (C) {year} {fullname}
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random
- Hacker.
-
- {signature of Ty Coon}, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth.h
deleted file mode 100644
index 3e7096f..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_H
-#define _FLUIDSYNTH_H
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BUILD_SHARED_LIBS 1
-
-#if (BUILD_SHARED_LIBS == 0)
- #define FLUIDSYNTH_API // building static lib? no visibility control then
-#elif defined(WIN32)
- #if defined(FLUIDSYNTH_NOT_A_DLL)
- #define FLUIDSYNTH_API
- #elif defined(FLUIDSYNTH_DLL_EXPORTS)
- #define FLUIDSYNTH_API __declspec(dllexport)
- #else
- #define FLUIDSYNTH_API __declspec(dllimport)
- #endif
-
-#elif defined(MACOS9)
-#define FLUIDSYNTH_API __declspec(export)
-
-#elif defined(__OS2__)
-#define FLUIDSYNTH_API __declspec(dllexport)
-
-#elif defined(__GNUC__)
-#define FLUIDSYNTH_API __attribute__ ((visibility ("default")))
-
-#else
-#define FLUIDSYNTH_API
-
-#endif
-
-#if defined(__GNUC__) || defined(__clang__)
-# define FLUID_DEPRECATED __attribute__((deprecated))
-#elif defined(_MSC_VER) && _MSC_VER > 1200
-# define FLUID_DEPRECATED __declspec(deprecated)
-#else
-# define FLUID_DEPRECATED
-#endif
-
-
-/**
- * @file fluidsynth.h
- * @brief FluidSynth is a real-time synthesizer designed for SoundFont(R) files.
- *
- * This is the header of the fluidsynth library and contains the
- * synthesizer's public API.
- *
- * Depending on how you want to use or extend the synthesizer you
- * will need different API functions. You probably do not need all
- * of them. Here is what you might want to do:
- *
- * - Embedded synthesizer: create a new synthesizer and send MIDI
- * events to it. The sound goes directly to the audio output of
- * your system.
- *
- * - Plugin synthesizer: create a synthesizer and send MIDI events
- * but pull the audio back into your application.
- *
- * - SoundFont plugin: create a new type of "SoundFont" and allow
- * the synthesizer to load your type of SoundFonts.
- *
- * - MIDI input: Create a MIDI handler to read the MIDI input on your
- * machine and send the MIDI events directly to the synthesizer.
- *
- * - MIDI files: Open MIDI files and send the MIDI events to the
- * synthesizer.
- *
- * - Command lines: You can send textual commands to the synthesizer.
- *
- * SoundFont(R) is a registered trademark of E-mu Systems, Inc.
- */
-
-#include "fluidsynth/types.h"
-#include "fluidsynth/settings.h"
-#include "fluidsynth/synth.h"
-#include "fluidsynth/shell.h"
-#include "fluidsynth/sfont.h"
-#include "fluidsynth/audio.h"
-#include "fluidsynth/event.h"
-#include "fluidsynth/midi.h"
-#include "fluidsynth/seq.h"
-#include "fluidsynth/seqbind.h"
-#include "fluidsynth/log.h"
-#include "fluidsynth/misc.h"
-#include "fluidsynth/mod.h"
-#include "fluidsynth/gen.h"
-#include "fluidsynth/voice.h"
-#include "fluidsynth/version.h"
-#include "fluidsynth/ladspa.h"
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/audio.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/audio.h
deleted file mode 100644
index 1c12ff7..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/audio.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_AUDIO_H
-#define _FLUIDSYNTH_AUDIO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup audio_output Audio Output
- *
- * Functions for managing audio drivers and file renderers.
- *
- * The file renderer is used for fast rendering of MIDI files to
- * audio files. The audio drivers are a high-level interface to
- * connect the synthesizer with external audio sinks or to render
- * real-time audio to files.
- */
-
-/**
- * @defgroup audio_driver Audio Driver
- * @ingroup audio_output
- *
- * Functions for managing audio drivers.
- *
- * Defines functions for creating audio driver output. Use
- * new_fluid_audio_driver() to create a new audio driver for a given synth
- * and configuration settings.
- *
- * The function new_fluid_audio_driver2() can be
- * used if custom audio processing is desired before the audio is sent to the
- * audio driver (although it is not as efficient).
- *
- * @sa @ref CreatingAudioDriver
- *
- * @{
- */
-
-/**
- * Callback function type used with new_fluid_audio_driver2() to allow for
- * custom user audio processing before the audio is sent to the driver.
- *
- * @param data The user data parameter as passed to new_fluid_audio_driver2().
- * @param len Count of audio frames to synthesize.
- * @param nfx Count of arrays in \c fx.
- * @param fx Array of buffers to store effects audio to. Buffers may alias with buffers of \c out.
- * @param nout Count of arrays in \c out.
- * @param out Array of buffers to store (dry) audio to. Buffers may alias with buffers of \c fx.
- * @return Should return #FLUID_OK on success, #FLUID_FAILED if an error occurred.
- *
- * This function is responsible for rendering audio to the buffers.
- * The buffers passed to this function are allocated and owned by the respective
- * audio driver and are only valid during that specific call (do not cache them).
- * The buffers have already been zeroed-out.
- * For further details please refer to fluid_synth_process().
- *
- * @parblock
- * @note Whereas fluid_synth_process() allows aliasing buffers, there is the guarantee that @p out
- * and @p fx buffers provided by fluidsynth's audio drivers never alias. This prevents downstream
- * applications from e.g. applying a custom effect accidentally to the same buffer multiple times.
- * @endparblock
- *
- * @parblock
- * @note Also note that the Jack driver is currently the only driver that has dedicated @p fx buffers
- * (but only if \setting{audio_jack_multi} is true). All other drivers do not provide @p fx buffers.
- * In this case, users are encouraged to mix the effects into the provided dry buffers when calling
- * fluid_synth_process().
- * @code{.cpp}
-int myCallback(void *, int len, int nfx, float *fx[], int nout, float *out[])
-{
- int ret;
- if(nfx == 0)
- {
- float *fxb[4] = {out[0], out[1], out[0], out[1]};
- ret = fluid_synth_process(synth, len, sizeof(fxb) / sizeof(fxb[0]), fxb, nout, out);
- }
- else
- {
- ret = fluid_synth_process(synth, len, nfx, fx, nout, out);
- }
- // ... client-code ...
- return ret;
-}
- * @endcode
- * For other possible use-cases refer to \ref fluidsynth_process.c .
- * @endparblock
- */
-typedef int (*fluid_audio_func_t)(void *data, int len,
- int nfx, float *fx[],
- int nout, float *out[]);
-
-/** @startlifecycle{Audio Driver} */
-FLUIDSYNTH_API fluid_audio_driver_t *new_fluid_audio_driver(fluid_settings_t *settings,
- fluid_synth_t *synth);
-
-FLUIDSYNTH_API fluid_audio_driver_t *new_fluid_audio_driver2(fluid_settings_t *settings,
- fluid_audio_func_t func,
- void *data);
-
-FLUIDSYNTH_API void delete_fluid_audio_driver(fluid_audio_driver_t *driver);
-/** @endlifecycle */
-
-FLUIDSYNTH_API int fluid_audio_driver_register(const char **adrivers);
-/** @} */
-
-/**
- * @defgroup file_renderer File Renderer
- * @ingroup audio_output
- *
- * Functions for managing file renderers and triggering the rendering.
- *
- * The file renderer is only used to render a MIDI file to audio as fast
- * as possible. Please see \ref FileRenderer for a full example.
- *
- * If you are looking for a way to write audio generated
- * from real-time events (for example from an external sequencer or a MIDI controller) to a file,
- * please have a look at the \c file \ref audio_driver instead.
- *
- *
- * @{
- */
-
-/** @startlifecycle{File Renderer} */
-FLUIDSYNTH_API fluid_file_renderer_t *new_fluid_file_renderer(fluid_synth_t *synth);
-FLUIDSYNTH_API void delete_fluid_file_renderer(fluid_file_renderer_t *dev);
-/** @endlifecycle */
-
-FLUIDSYNTH_API int fluid_file_renderer_process_block(fluid_file_renderer_t *dev);
-FLUIDSYNTH_API int fluid_file_set_encoding_quality(fluid_file_renderer_t *dev, double q);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_AUDIO_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/event.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/event.h
deleted file mode 100644
index dbc29c7..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/event.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_EVENT_H
-#define _FLUIDSYNTH_EVENT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup sequencer_events Sequencer Events
- * @ingroup sequencer
- *
- * Create, modify, query and destroy sequencer events.
- *
- * @{
- */
-
-/**
- * Sequencer event type enumeration.
- */
-enum fluid_seq_event_type
-{
- FLUID_SEQ_NOTE = 0, /**< Note event with duration */
- FLUID_SEQ_NOTEON, /**< Note on event */
- FLUID_SEQ_NOTEOFF, /**< Note off event */
- FLUID_SEQ_ALLSOUNDSOFF, /**< All sounds off event */
- FLUID_SEQ_ALLNOTESOFF, /**< All notes off event */
- FLUID_SEQ_BANKSELECT, /**< Bank select message */
- FLUID_SEQ_PROGRAMCHANGE, /**< Program change message */
- FLUID_SEQ_PROGRAMSELECT, /**< Program select message */
- FLUID_SEQ_PITCHBEND, /**< Pitch bend message */
- FLUID_SEQ_PITCHWHEELSENS, /**< Pitch wheel sensitivity set message @since 1.1.0 was misspelled previously */
- FLUID_SEQ_MODULATION, /**< Modulation controller event */
- FLUID_SEQ_SUSTAIN, /**< Sustain controller event */
- FLUID_SEQ_CONTROLCHANGE, /**< MIDI control change event */
- FLUID_SEQ_PAN, /**< Stereo pan set event */
- FLUID_SEQ_VOLUME, /**< Volume set event */
- FLUID_SEQ_REVERBSEND, /**< Reverb send set event */
- FLUID_SEQ_CHORUSSEND, /**< Chorus send set event */
- FLUID_SEQ_TIMER, /**< Timer event (useful for giving a callback at a certain time) */
- FLUID_SEQ_CHANNELPRESSURE, /**< Channel aftertouch event @since 1.1.0 */
- FLUID_SEQ_KEYPRESSURE, /**< Polyphonic aftertouch event @since 2.0.0 */
- FLUID_SEQ_SYSTEMRESET, /**< System reset event @since 1.1.0 */
- FLUID_SEQ_UNREGISTERING, /**< Called when a sequencer client is being unregistered. @since 1.1.0 */
- FLUID_SEQ_SCALE, /**< Sets a new time scale for the sequencer @since 2.2.0 */
- FLUID_SEQ_LASTEVENT /**< @internal Defines the count of events enums @warning This symbol
- is not part of the public API and ABI stability guarantee and
- may change at any time! */
-};
-
-/* Event alloc/free */
-/** @startlifecycle{Sequencer Event} */
-FLUIDSYNTH_API fluid_event_t *new_fluid_event(void);
-FLUIDSYNTH_API void delete_fluid_event(fluid_event_t *evt);
-/** @endlifecycle */
-
-/* Initializing events */
-FLUIDSYNTH_API void fluid_event_set_source(fluid_event_t *evt, fluid_seq_id_t src);
-FLUIDSYNTH_API void fluid_event_set_dest(fluid_event_t *evt, fluid_seq_id_t dest);
-
-/* Timer events */
-FLUIDSYNTH_API void fluid_event_timer(fluid_event_t *evt, void *data);
-
-/* Note events */
-FLUIDSYNTH_API void fluid_event_note(fluid_event_t *evt, int channel,
- short key, short vel,
- unsigned int duration);
-
-FLUIDSYNTH_API void fluid_event_noteon(fluid_event_t *evt, int channel, short key, short vel);
-FLUIDSYNTH_API void fluid_event_noteoff(fluid_event_t *evt, int channel, short key);
-FLUIDSYNTH_API void fluid_event_all_sounds_off(fluid_event_t *evt, int channel);
-FLUIDSYNTH_API void fluid_event_all_notes_off(fluid_event_t *evt, int channel);
-
-/* Instrument selection */
-FLUIDSYNTH_API void fluid_event_bank_select(fluid_event_t *evt, int channel, short bank_num);
-FLUIDSYNTH_API void fluid_event_program_change(fluid_event_t *evt, int channel, int preset_num);
-FLUIDSYNTH_API void fluid_event_program_select(fluid_event_t *evt, int channel, unsigned int sfont_id, short bank_num, short preset_num);
-
-/* Real-time generic instrument controllers */
-FLUIDSYNTH_API
-void fluid_event_control_change(fluid_event_t *evt, int channel, short control, int val);
-
-/* Real-time instrument controllers shortcuts */
-FLUIDSYNTH_API void fluid_event_pitch_bend(fluid_event_t *evt, int channel, int val);
-FLUIDSYNTH_API void fluid_event_pitch_wheelsens(fluid_event_t *evt, int channel, int val);
-FLUIDSYNTH_API void fluid_event_modulation(fluid_event_t *evt, int channel, int val);
-FLUIDSYNTH_API void fluid_event_sustain(fluid_event_t *evt, int channel, int val);
-FLUIDSYNTH_API void fluid_event_pan(fluid_event_t *evt, int channel, int val);
-FLUIDSYNTH_API void fluid_event_volume(fluid_event_t *evt, int channel, int val);
-FLUIDSYNTH_API void fluid_event_reverb_send(fluid_event_t *evt, int channel, int val);
-FLUIDSYNTH_API void fluid_event_chorus_send(fluid_event_t *evt, int channel, int val);
-
-FLUIDSYNTH_API void fluid_event_key_pressure(fluid_event_t *evt, int channel, short key, int val);
-FLUIDSYNTH_API void fluid_event_channel_pressure(fluid_event_t *evt, int channel, int val);
-FLUIDSYNTH_API void fluid_event_system_reset(fluid_event_t *evt);
-
-/* Only when unregistering clients */
-FLUIDSYNTH_API void fluid_event_unregistering(fluid_event_t *evt);
-
-FLUIDSYNTH_API void fluid_event_scale(fluid_event_t *evt, double new_scale);
-FLUIDSYNTH_API int fluid_event_from_midi_event(fluid_event_t *, const fluid_midi_event_t *);
-
-/* Accessing event data */
-FLUIDSYNTH_API int fluid_event_get_type(fluid_event_t *evt);
-FLUIDSYNTH_API fluid_seq_id_t fluid_event_get_source(fluid_event_t *evt);
-FLUIDSYNTH_API fluid_seq_id_t fluid_event_get_dest(fluid_event_t *evt);
-FLUIDSYNTH_API int fluid_event_get_channel(fluid_event_t *evt);
-FLUIDSYNTH_API short fluid_event_get_key(fluid_event_t *evt);
-FLUIDSYNTH_API short fluid_event_get_velocity(fluid_event_t *evt);
-FLUIDSYNTH_API short fluid_event_get_control(fluid_event_t *evt);
-FLUIDSYNTH_API int fluid_event_get_value(fluid_event_t *evt);
-FLUIDSYNTH_API int fluid_event_get_program(fluid_event_t *evt);
-FLUIDSYNTH_API void *fluid_event_get_data(fluid_event_t *evt);
-FLUIDSYNTH_API unsigned int fluid_event_get_duration(fluid_event_t *evt);
-FLUIDSYNTH_API short fluid_event_get_bank(fluid_event_t *evt);
-FLUIDSYNTH_API int fluid_event_get_pitch(fluid_event_t *evt);
-FLUIDSYNTH_API double fluid_event_get_scale(fluid_event_t *evt);
-FLUIDSYNTH_API unsigned int fluid_event_get_sfont_id(fluid_event_t *evt);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _FLUIDSYNTH_EVENT_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/gen.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/gen.h
deleted file mode 100644
index a04c362..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/gen.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_GEN_H
-#define _FLUIDSYNTH_GEN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup generators SoundFont Generators
- * @ingroup soundfonts
- *
- * Functions and defines for SoundFont generator effects.
- *
- * @{
- */
-
-/**
- * Generator (effect) numbers (Soundfont 2.01 specifications section 8.1.3)
- */
-enum fluid_gen_type
-{
- GEN_STARTADDROFS, /**< Sample start address offset (0-32767) */
- GEN_ENDADDROFS, /**< Sample end address offset (-32767-0) */
- GEN_STARTLOOPADDROFS, /**< Sample loop start address offset (-32767-32767) */
- GEN_ENDLOOPADDROFS, /**< Sample loop end address offset (-32767-32767) */
- GEN_STARTADDRCOARSEOFS, /**< Sample start address coarse offset (X 32768) */
- GEN_MODLFOTOPITCH, /**< Modulation LFO to pitch */
- GEN_VIBLFOTOPITCH, /**< Vibrato LFO to pitch */
- GEN_MODENVTOPITCH, /**< Modulation envelope to pitch */
- GEN_FILTERFC, /**< Filter cutoff */
- GEN_FILTERQ, /**< Filter Q */
- GEN_MODLFOTOFILTERFC, /**< Modulation LFO to filter cutoff */
- GEN_MODENVTOFILTERFC, /**< Modulation envelope to filter cutoff */
- GEN_ENDADDRCOARSEOFS, /**< Sample end address coarse offset (X 32768) */
- GEN_MODLFOTOVOL, /**< Modulation LFO to volume */
- GEN_UNUSED1, /**< Unused */
- GEN_CHORUSSEND, /**< Chorus send amount */
- GEN_REVERBSEND, /**< Reverb send amount */
- GEN_PAN, /**< Stereo panning */
- GEN_UNUSED2, /**< Unused */
- GEN_UNUSED3, /**< Unused */
- GEN_UNUSED4, /**< Unused */
- GEN_MODLFODELAY, /**< Modulation LFO delay */
- GEN_MODLFOFREQ, /**< Modulation LFO frequency */
- GEN_VIBLFODELAY, /**< Vibrato LFO delay */
- GEN_VIBLFOFREQ, /**< Vibrato LFO frequency */
- GEN_MODENVDELAY, /**< Modulation envelope delay */
- GEN_MODENVATTACK, /**< Modulation envelope attack */
- GEN_MODENVHOLD, /**< Modulation envelope hold */
- GEN_MODENVDECAY, /**< Modulation envelope decay */
- GEN_MODENVSUSTAIN, /**< Modulation envelope sustain */
- GEN_MODENVRELEASE, /**< Modulation envelope release */
- GEN_KEYTOMODENVHOLD, /**< Key to modulation envelope hold */
- GEN_KEYTOMODENVDECAY, /**< Key to modulation envelope decay */
- GEN_VOLENVDELAY, /**< Volume envelope delay */
- GEN_VOLENVATTACK, /**< Volume envelope attack */
- GEN_VOLENVHOLD, /**< Volume envelope hold */
- GEN_VOLENVDECAY, /**< Volume envelope decay */
- GEN_VOLENVSUSTAIN, /**< Volume envelope sustain */
- GEN_VOLENVRELEASE, /**< Volume envelope release */
- GEN_KEYTOVOLENVHOLD, /**< Key to volume envelope hold */
- GEN_KEYTOVOLENVDECAY, /**< Key to volume envelope decay */
- GEN_INSTRUMENT, /**< Instrument ID (shouldn't be set by user) */
- GEN_RESERVED1, /**< Reserved */
- GEN_KEYRANGE, /**< MIDI note range */
- GEN_VELRANGE, /**< MIDI velocity range */
- GEN_STARTLOOPADDRCOARSEOFS, /**< Sample start loop address coarse offset (X 32768) */
- GEN_KEYNUM, /**< Fixed MIDI note number */
- GEN_VELOCITY, /**< Fixed MIDI velocity value */
- GEN_ATTENUATION, /**< Initial volume attenuation */
- GEN_RESERVED2, /**< Reserved */
- GEN_ENDLOOPADDRCOARSEOFS, /**< Sample end loop address coarse offset (X 32768) */
- GEN_COARSETUNE, /**< Coarse tuning */
- GEN_FINETUNE, /**< Fine tuning */
- GEN_SAMPLEID, /**< Sample ID (shouldn't be set by user) */
- GEN_SAMPLEMODE, /**< Sample mode flags */
- GEN_RESERVED3, /**< Reserved */
- GEN_SCALETUNE, /**< Scale tuning */
- GEN_EXCLUSIVECLASS, /**< Exclusive class number */
- GEN_OVERRIDEROOTKEY, /**< Sample root note override */
-
- /**
- * Initial Pitch
- *
- * @note This is not "standard" SoundFont generator, because it is not
- * mentioned in the list of generators in the SF2 specifications.
- * It is used by FluidSynth internally to compute the nominal pitch of
- * a note on note-on event. By nature it shouldn't be allowed to be modulated,
- * however the specification defines a default modulator having "Initial Pitch"
- * as destination (cf. SF2.01 page 57 section 8.4.10 MIDI Pitch Wheel to Initial Pitch).
- * Thus it is impossible to cancel this default modulator, which would be required
- * to let the MIDI Pitch Wheel controller modulate a different generator.
- * In order to provide this flexibility, FluidSynth >= 2.1.0 uses a default modulator
- * "Pitch Wheel to Fine Tune", rather than Initial Pitch. The same "compromise" can
- * be found on the Audigy 2 ZS for instance.
- */
- GEN_PITCH,
-
- GEN_CUSTOM_BALANCE, /**< Balance @note Not a real SoundFont generator */
- /* non-standard generator for an additional custom high- or low-pass filter */
- GEN_CUSTOM_FILTERFC, /**< Custom filter cutoff frequency */
- GEN_CUSTOM_FILTERQ, /**< Custom filter Q */
-
- GEN_LAST /**< @internal Value defines the count of generators (#fluid_gen_type)
- @warning This symbol is not part of the public API and ABI
- stability guarantee and may change at any time! */
-};
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _FLUIDSYNTH_GEN_H */
-
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/ladspa.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/ladspa.h
deleted file mode 100644
index ae44f2b..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/ladspa.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_LADSPA_H
-#define _FLUIDSYNTH_LADSPA_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup ladspa Effect - LADSPA
- * @ingroup synth
- *
- * Functions for configuring the LADSPA effects unit
- *
- * This header defines useful functions for programmatically manipulating the ladspa
- * effects unit of the synth that can be retrieved via fluid_synth_get_ladspa_fx().
- *
- * Using any of those functions requires fluidsynth to be compiled with LADSPA support.
- * Else all of those functions are useless dummies.
- *
- * @{
- */
-FLUIDSYNTH_API int fluid_ladspa_is_active(fluid_ladspa_fx_t *fx);
-FLUIDSYNTH_API int fluid_ladspa_activate(fluid_ladspa_fx_t *fx);
-FLUIDSYNTH_API int fluid_ladspa_deactivate(fluid_ladspa_fx_t *fx);
-FLUIDSYNTH_API int fluid_ladspa_reset(fluid_ladspa_fx_t *fx);
-FLUIDSYNTH_API int fluid_ladspa_check(fluid_ladspa_fx_t *fx, char *err, int err_size);
-
-FLUIDSYNTH_API int fluid_ladspa_host_port_exists(fluid_ladspa_fx_t *fx, const char *name);
-
-FLUIDSYNTH_API int fluid_ladspa_add_buffer(fluid_ladspa_fx_t *fx, const char *name);
-FLUIDSYNTH_API int fluid_ladspa_buffer_exists(fluid_ladspa_fx_t *fx, const char *name);
-
-FLUIDSYNTH_API int fluid_ladspa_add_effect(fluid_ladspa_fx_t *fx, const char *effect_name,
- const char *lib_name, const char *plugin_name);
-FLUIDSYNTH_API int fluid_ladspa_effect_can_mix(fluid_ladspa_fx_t *fx, const char *name);
-FLUIDSYNTH_API int fluid_ladspa_effect_set_mix(fluid_ladspa_fx_t *fx, const char *name, int mix, float gain);
-FLUIDSYNTH_API int fluid_ladspa_effect_port_exists(fluid_ladspa_fx_t *fx, const char *effect_name, const char *port_name);
-FLUIDSYNTH_API int fluid_ladspa_effect_set_control(fluid_ladspa_fx_t *fx, const char *effect_name,
- const char *port_name, float val);
-FLUIDSYNTH_API int fluid_ladspa_effect_link(fluid_ladspa_fx_t *fx, const char *effect_name,
- const char *port_name, const char *name);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_LADSPA_H */
-
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/log.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/log.h
deleted file mode 100644
index ab5911e..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/log.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_LOG_H
-#define _FLUIDSYNTH_LOG_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @defgroup logging Logging
- *
- * Logging interface
- *
- * The default logging function of the fluidsynth prints its messages to the
- * stderr. The synthesizer uses five level of messages: #FLUID_PANIC,
- * #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG.
- *
- * A client application can install a new log function to handle the messages
- * differently. In the following example, the application sets a callback
- * function to display #FLUID_PANIC messages in a dialog, and ignores all other
- * messages by setting the log function to NULL:
- *
- * @code
- * fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window);
- * fluid_set_log_function(FLUID_ERR, NULL, NULL);
- * fluid_set_log_function(FLUID_WARN, NULL, NULL);
- * fluid_set_log_function(FLUID_DBG, NULL, NULL);
- * @endcode
- *
- * @note The logging configuration is global and not tied to a specific
- * synthesizer instance. That means that all synthesizer instances created in
- * the same process share the same logging configuration.
- *
- * @{
- */
-
-/**
- * FluidSynth log levels.
- */
-enum fluid_log_level
-{
- FLUID_PANIC, /**< The synth can't function correctly any more */
- FLUID_ERR, /**< Serious error occurred */
- FLUID_WARN, /**< Warning */
- FLUID_INFO, /**< Verbose informational messages */
- FLUID_DBG, /**< Debugging messages */
- LAST_LOG_LEVEL /**< @internal This symbol is not part of the public API and ABI
- stability guarantee and may change at any time! */
-};
-
-/**
- * Log function handler callback type used by fluid_set_log_function().
- *
- * @param level Log level (#fluid_log_level)
- * @param message Log message text
- * @param data User data pointer supplied to fluid_set_log_function().
- */
-typedef void (*fluid_log_function_t)(int level, const char *message, void *data);
-
-FLUIDSYNTH_API
-fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void *data);
-
-FLUIDSYNTH_API void fluid_default_log_function(int level, const char *message, void *data);
-
-FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...)
-#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
-__attribute__ ((format (printf, 2, 3)))
-#endif
-;
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_LOG_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/midi.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/midi.h
deleted file mode 100644
index 044eeeb..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/midi.h
+++ /dev/null
@@ -1,295 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_MIDI_H
-#define _FLUIDSYNTH_MIDI_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup midi_input MIDI Input
- *
- * MIDI Input Subsystem
- *
- * There are multiple ways to send MIDI events to the synthesizer. They can come
- * from MIDI files, from external MIDI sequencers or raw MIDI event sources,
- * can be modified via MIDI routers and also generated manually.
- *
- * The interface connecting all sources and sinks of MIDI events in libfluidsynth
- * is \ref handle_midi_event_func_t.
- *
- * @{
- */
-
-/**
- * Generic callback function for MIDI event handler.
- *
- * @param data User defined data pointer
- * @param event The MIDI event
- * @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise
- *
- * This callback is used to pass MIDI events
- * - from \ref midi_player, \ref midi_router or \ref midi_driver
- * - to \ref midi_router via fluid_midi_router_handle_midi_event()
- * - or to \ref synth via fluid_synth_handle_midi_event().
- *
- * Additionally, there is a translation layer to pass MIDI events to
- * a \ref sequencer via fluid_sequencer_add_midi_event_to_buffer().
- */
-typedef int (*handle_midi_event_func_t)(void *data, fluid_midi_event_t *event);
-
-/**
- * Generic callback function fired once by MIDI tick change.
- *
- * @param data User defined data pointer
- * @param tick The current (zero-based) tick, which triggered the callback
- * @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise
- *
- * This callback is fired at a constant rate depending on the current BPM and PPQ.
- * e.g. for PPQ = 192 and BPM = 140 the callback is fired 192 * 140 times per minute (448/sec).
- *
- * It can be used to sync external elements with the beat,
- * or stop / loop the song on a given tick.
- * Ticks being BPM-dependent, you can manipulate values such as bars or beats,
- * without having to care about BPM.
- *
- * For example, this callback loops the song whenever it reaches the 5th bar :
- *
- * @code{.cpp}
-int handle_tick(void *data, int tick)
-{
- fluid_player_t *player = (fluid_player_t *)data;
- int ppq = 192; // From MIDI header
- int beatsPerBar = 4; // From the song's time signature
- int loopBar = 5;
- int loopTick = (loopBar - 1) * ppq * beatsPerBar;
-
- if (tick == loopTick)
- {
- return fluid_player_seek(player, 0);
- }
-
- return FLUID_OK;
-}
- * @endcode
- */
-typedef int (*handle_midi_tick_func_t)(void *data, int tick);
-/** @} */
-
-/**
- * @defgroup midi_events MIDI Events
- * @ingroup midi_input
- *
- * Functions to create, modify, query and delete MIDI events.
- *
- * These functions are intended to be used in MIDI routers and other filtering
- * and processing functions in the MIDI event path. If you want to simply
- * send MIDI messages to the synthesizer, you can use the more convenient
- * \ref midi_messages interface.
- *
- * @{
- */
-/** @startlifecycle{MIDI Event} */
-FLUIDSYNTH_API fluid_midi_event_t *new_fluid_midi_event(void);
-FLUIDSYNTH_API void delete_fluid_midi_event(fluid_midi_event_t *event);
-/** @endlifecycle */
-
-FLUIDSYNTH_API int fluid_midi_event_set_type(fluid_midi_event_t *evt, int type);
-FLUIDSYNTH_API int fluid_midi_event_get_type(const fluid_midi_event_t *evt);
-FLUIDSYNTH_API int fluid_midi_event_set_channel(fluid_midi_event_t *evt, int chan);
-FLUIDSYNTH_API int fluid_midi_event_get_channel(const fluid_midi_event_t *evt);
-FLUIDSYNTH_API int fluid_midi_event_get_key(const fluid_midi_event_t *evt);
-FLUIDSYNTH_API int fluid_midi_event_set_key(fluid_midi_event_t *evt, int key);
-FLUIDSYNTH_API int fluid_midi_event_get_velocity(const fluid_midi_event_t *evt);
-FLUIDSYNTH_API int fluid_midi_event_set_velocity(fluid_midi_event_t *evt, int vel);
-FLUIDSYNTH_API int fluid_midi_event_get_control(const fluid_midi_event_t *evt);
-FLUIDSYNTH_API int fluid_midi_event_set_control(fluid_midi_event_t *evt, int ctrl);
-FLUIDSYNTH_API int fluid_midi_event_get_value(const fluid_midi_event_t *evt);
-FLUIDSYNTH_API int fluid_midi_event_set_value(fluid_midi_event_t *evt, int val);
-FLUIDSYNTH_API int fluid_midi_event_get_program(const fluid_midi_event_t *evt);
-FLUIDSYNTH_API int fluid_midi_event_set_program(fluid_midi_event_t *evt, int val);
-FLUIDSYNTH_API int fluid_midi_event_get_pitch(const fluid_midi_event_t *evt);
-FLUIDSYNTH_API int fluid_midi_event_set_pitch(fluid_midi_event_t *evt, int val);
-FLUIDSYNTH_API int fluid_midi_event_set_sysex(fluid_midi_event_t *evt, void *data,
- int size, int dynamic);
-FLUIDSYNTH_API int fluid_midi_event_set_text(fluid_midi_event_t *evt,
- void *data, int size, int dynamic);
-FLUIDSYNTH_API int fluid_midi_event_get_text(fluid_midi_event_t *evt,
- void **data, int *size);
-FLUIDSYNTH_API int fluid_midi_event_set_lyrics(fluid_midi_event_t *evt,
- void *data, int size, int dynamic);
-FLUIDSYNTH_API int fluid_midi_event_get_lyrics(fluid_midi_event_t *evt,
- void **data, int *size);
-/** @} */
-
-/**
- * @defgroup midi_router MIDI Router
- * @ingroup midi_input
- *
- * Rule based transformation and filtering of MIDI events.
- *
- * @{
- */
-
-/**
- * MIDI router rule type.
- *
- * @since 1.1.0
- */
-typedef enum
-{
- FLUID_MIDI_ROUTER_RULE_NOTE, /**< MIDI note rule */
- FLUID_MIDI_ROUTER_RULE_CC, /**< MIDI controller rule */
- FLUID_MIDI_ROUTER_RULE_PROG_CHANGE, /**< MIDI program change rule */
- FLUID_MIDI_ROUTER_RULE_PITCH_BEND, /**< MIDI pitch bend rule */
- FLUID_MIDI_ROUTER_RULE_CHANNEL_PRESSURE, /**< MIDI channel pressure rule */
- FLUID_MIDI_ROUTER_RULE_KEY_PRESSURE, /**< MIDI key pressure rule */
- FLUID_MIDI_ROUTER_RULE_COUNT /**< @internal Total count of rule types. This symbol
- is not part of the public API and ABI stability
- guarantee and may change at any time!*/
-} fluid_midi_router_rule_type;
-
-
-/** @startlifecycle{MIDI Router} */
-FLUIDSYNTH_API fluid_midi_router_t *new_fluid_midi_router(fluid_settings_t *settings,
- handle_midi_event_func_t handler,
- void *event_handler_data);
-FLUIDSYNTH_API void delete_fluid_midi_router(fluid_midi_router_t *handler);
-/** @endlifecycle */
-
-FLUIDSYNTH_API int fluid_midi_router_set_default_rules(fluid_midi_router_t *router);
-FLUIDSYNTH_API int fluid_midi_router_clear_rules(fluid_midi_router_t *router);
-FLUIDSYNTH_API int fluid_midi_router_add_rule(fluid_midi_router_t *router,
- fluid_midi_router_rule_t *rule, int type);
-
-
-/** @startlifecycle{MIDI Router Rule} */
-FLUIDSYNTH_API fluid_midi_router_rule_t *new_fluid_midi_router_rule(void);
-FLUIDSYNTH_API void delete_fluid_midi_router_rule(fluid_midi_router_rule_t *rule);
-/** @endlifecycle */
-
-FLUIDSYNTH_API void fluid_midi_router_rule_set_chan(fluid_midi_router_rule_t *rule,
- int min, int max, float mul, int add);
-FLUIDSYNTH_API void fluid_midi_router_rule_set_param1(fluid_midi_router_rule_t *rule,
- int min, int max, float mul, int add);
-FLUIDSYNTH_API void fluid_midi_router_rule_set_param2(fluid_midi_router_rule_t *rule,
- int min, int max, float mul, int add);
-FLUIDSYNTH_API int fluid_midi_router_handle_midi_event(void *data, fluid_midi_event_t *event);
-FLUIDSYNTH_API int fluid_midi_dump_prerouter(void *data, fluid_midi_event_t *event);
-FLUIDSYNTH_API int fluid_midi_dump_postrouter(void *data, fluid_midi_event_t *event);
-/** @} */
-
-/**
- * @defgroup midi_driver MIDI Driver
- * @ingroup midi_input
- *
- * Functions for managing MIDI drivers.
- *
- * The available MIDI drivers depend on your platform. See \ref settings_midi for all
- * available configuration options.
- *
- * To create a MIDI driver, you need to specify a source for the MIDI events to be
- * forwarded to via the \ref fluid_midi_event_t callback. Normally this will be
- * either a \ref midi_router via fluid_midi_router_handle_midi_event() or the synthesizer
- * via fluid_synth_handle_midi_event().
- *
- * But you can also write your own handler function that preprocesses the events and
- * forwards them on to the router or synthesizer instead.
- *
- * @{
- */
-
-/** @startlifecycle{MIDI Driver} */
-FLUIDSYNTH_API
-fluid_midi_driver_t *new_fluid_midi_driver(fluid_settings_t *settings,
- handle_midi_event_func_t handler,
- void *event_handler_data);
-
-FLUIDSYNTH_API void delete_fluid_midi_driver(fluid_midi_driver_t *driver);
-/** @endlifecycle */
-
-/** @} */
-
-/**
- * @defgroup midi_player MIDI File Player
- * @ingroup midi_input
- *
- * Parse standard MIDI files and emit MIDI events.
- *
- * @{
- */
-
-/**
- * MIDI File Player status enum.
- * @since 1.1.0
- */
-enum fluid_player_status
-{
- FLUID_PLAYER_READY, /**< Player is ready */
- FLUID_PLAYER_PLAYING, /**< Player is currently playing */
- FLUID_PLAYER_STOPPING, /**< Player is stopping, but hasn't finished yet (currently unused) */
- FLUID_PLAYER_DONE /**< Player is finished playing */
-};
-
-/**
- * MIDI File Player tempo enum.
- * @since 2.2.0
- */
-enum fluid_player_set_tempo_type
-{
- FLUID_PLAYER_TEMPO_INTERNAL, /**< Use midi file tempo set in midi file (120 bpm by default). Multiplied by a factor */
- FLUID_PLAYER_TEMPO_EXTERNAL_BPM, /**< Set player tempo in bpm, supersede midi file tempo */
- FLUID_PLAYER_TEMPO_EXTERNAL_MIDI, /**< Set player tempo in us per quarter note, supersede midi file tempo */
- FLUID_PLAYER_TEMPO_NBR /**< @internal Value defines the count of player tempo type (#fluid_player_set_tempo_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
-};
-
-/** @startlifecycle{MIDI File Player} */
-FLUIDSYNTH_API fluid_player_t *new_fluid_player(fluid_synth_t *synth);
-FLUIDSYNTH_API void delete_fluid_player(fluid_player_t *player);
-/** @endlifecycle */
-
-FLUIDSYNTH_API int fluid_player_add(fluid_player_t *player, const char *midifile);
-FLUIDSYNTH_API int fluid_player_add_mem(fluid_player_t *player, const void *buffer, size_t len);
-FLUIDSYNTH_API int fluid_player_play(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_stop(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_join(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_set_loop(fluid_player_t *player, int loop);
-FLUIDSYNTH_API int fluid_player_set_tempo(fluid_player_t *player, int tempo_type, double tempo);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_player_set_midi_tempo(fluid_player_t *player, int tempo);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_player_set_bpm(fluid_player_t *player, int bpm);
-FLUIDSYNTH_API int fluid_player_set_playback_callback(fluid_player_t *player, handle_midi_event_func_t handler, void *handler_data);
-FLUIDSYNTH_API int fluid_player_set_tick_callback(fluid_player_t *player, handle_midi_tick_func_t handler, void *handler_data);
-
-FLUIDSYNTH_API int fluid_player_get_status(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_get_current_tick(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_get_total_ticks(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_get_bpm(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_get_division(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_get_midi_tempo(fluid_player_t *player);
-FLUIDSYNTH_API int fluid_player_seek(fluid_player_t *player, int ticks);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_MIDI_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/misc.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/misc.h
deleted file mode 100644
index f60bf61..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/misc.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_MISC_H
-#define _FLUIDSYNTH_MISC_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @defgroup misc Miscellaneous
- *
- * Miscellaneous utility functions and defines
- *
- * @{
- */
-
-/**
- * Value that indicates success, used by most libfluidsynth functions.
- *
- * @note This was not publicly defined prior to libfluidsynth 1.1.0. When
- * writing code which should also be compatible with older versions, something
- * like the following can be used:
- *
- * @code
- * #include
- *
- * #ifndef FLUID_OK
- * #define FLUID_OK (0)
- * #define FLUID_FAILED (-1)
- * #endif
- * @endcode
- *
- * @since 1.1.0
- */
-#define FLUID_OK (0)
-
-/**
- * Value that indicates failure, used by most libfluidsynth functions.
- *
- * @note See #FLUID_OK for more details.
- *
- * @since 1.1.0
- */
-#define FLUID_FAILED (-1)
-
-
-FLUIDSYNTH_API int fluid_is_soundfont(const char *filename);
-FLUIDSYNTH_API int fluid_is_midifile(const char *filename);
-FLUIDSYNTH_API void fluid_free(void* ptr);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_MISC_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/mod.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/mod.h
deleted file mode 100644
index 001b790..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/mod.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_MOD_H
-#define _FLUIDSYNTH_MOD_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup modulators SoundFont Modulators
- * @ingroup soundfonts
- *
- * SoundFont modulator functions and constants.
- *
- * @{
- */
-
-/**
- * Flags defining the polarity, mapping function and type of a modulator source.
- * Compare with SoundFont 2.04 PDF section 8.2.
- *
- * Note: Bit values do not correspond to the SoundFont spec! Also note that
- * #FLUID_MOD_GC and #FLUID_MOD_CC are in the flags field instead of the source field.
- */
-enum fluid_mod_flags
-{
- FLUID_MOD_POSITIVE = 0, /**< Mapping function is positive */
- FLUID_MOD_NEGATIVE = 1, /**< Mapping function is negative */
- FLUID_MOD_UNIPOLAR = 0, /**< Mapping function is unipolar */
- FLUID_MOD_BIPOLAR = 2, /**< Mapping function is bipolar */
- FLUID_MOD_LINEAR = 0, /**< Linear mapping function */
- FLUID_MOD_CONCAVE = 4, /**< Concave mapping function */
- FLUID_MOD_CONVEX = 8, /**< Convex mapping function */
- FLUID_MOD_SWITCH = 12, /**< Switch (on/off) mapping function */
- FLUID_MOD_GC = 0, /**< General controller source type (#fluid_mod_src) */
- FLUID_MOD_CC = 16, /**< MIDI CC controller (source will be a MIDI CC number) */
-
- FLUID_MOD_SIN = 0x80, /**< Custom non-standard sinus mapping function */
-};
-
-/**
- * Transform types for the SoundFont2 modulators as defined by SoundFont 2.04 section 8.3.
- */
-enum fluid_mod_transforms
-{
- FLUID_MOD_TRANSFORM_LINEAR = 0, /**< Linear: directly add the computed value to summing node */
- FLUID_MOD_TRANSFORM_ABS = 2 /**< Abs: add the absolute value of the computed to summing node */
-};
-
-/**
- * General controller (if #FLUID_MOD_GC in flags). This
- * corresponds to SoundFont 2.04 PDF section 8.2.1
- */
-enum fluid_mod_src
-{
- FLUID_MOD_NONE = 0, /**< No source controller */
- FLUID_MOD_VELOCITY = 2, /**< MIDI note-on velocity */
- FLUID_MOD_KEY = 3, /**< MIDI note-on note number */
- FLUID_MOD_KEYPRESSURE = 10, /**< MIDI key pressure */
- FLUID_MOD_CHANNELPRESSURE = 13, /**< MIDI channel pressure */
- FLUID_MOD_PITCHWHEEL = 14, /**< Pitch wheel */
- FLUID_MOD_PITCHWHEELSENS = 16 /**< Pitch wheel sensitivity */
-};
-
-/** @startlifecycle{Modulator} */
-FLUIDSYNTH_API fluid_mod_t *new_fluid_mod(void);
-FLUIDSYNTH_API void delete_fluid_mod(fluid_mod_t *mod);
-/** @endlifecycle */
-
-FLUIDSYNTH_API size_t fluid_mod_sizeof(void);
-
-FLUIDSYNTH_API void fluid_mod_set_source1(fluid_mod_t *mod, int src, int flags);
-FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t *mod, int src, int flags);
-FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t *mod, int dst);
-FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t *mod, double amount);
-FLUIDSYNTH_API void fluid_mod_set_transform(fluid_mod_t *mod, int type);
-
-FLUIDSYNTH_API int fluid_mod_get_source1(const fluid_mod_t *mod);
-FLUIDSYNTH_API int fluid_mod_get_flags1(const fluid_mod_t *mod);
-FLUIDSYNTH_API int fluid_mod_get_source2(const fluid_mod_t *mod);
-FLUIDSYNTH_API int fluid_mod_get_flags2(const fluid_mod_t *mod);
-FLUIDSYNTH_API int fluid_mod_get_dest(const fluid_mod_t *mod);
-FLUIDSYNTH_API double fluid_mod_get_amount(const fluid_mod_t *mod);
-FLUIDSYNTH_API int fluid_mod_get_transform(fluid_mod_t *mod);
-
-FLUIDSYNTH_API int fluid_mod_test_identity(const fluid_mod_t *mod1, const fluid_mod_t *mod2);
-FLUIDSYNTH_API int fluid_mod_has_source(const fluid_mod_t *mod, int cc, int ctrl);
-FLUIDSYNTH_API int fluid_mod_has_dest(const fluid_mod_t *mod, int gen);
-
-FLUIDSYNTH_API void fluid_mod_clone(fluid_mod_t *mod, const fluid_mod_t *src);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _FLUIDSYNTH_MOD_H */
-
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/seq.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/seq.h
deleted file mode 100644
index cdcc959..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/seq.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_SEQ_H
-#define _FLUIDSYNTH_SEQ_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup sequencer MIDI Sequencer
- *
- * MIDI event sequencer.
- *
- * The MIDI sequencer can be used to play MIDI events in a more flexible way than
- * using the MIDI file player, which expects the events to be stored as
- * Standard MIDI Files. Using the sequencer, you can provide the events one by
- * one, with an optional timestamp for scheduling.
- *
- * @{
- */
-
-/**
- * Event callback prototype for destination clients.
- *
- * @param time Current sequencer tick value (see fluid_sequencer_get_tick()).
- * @param event The event being received
- * @param seq The sequencer instance
- * @param data User defined data registered with the client
- *
- * @note @p time may not be of the same tick value as the scheduled event! In fact, depending on
- * the sequencer's scale and the synth's sample-rate, @p time may be a few ticks too late. Although this
- * itself is inaudible, it is important to consider,
- * when you use this callback for enqueuing additional events over and over again with
- * fluid_sequencer_send_at(): If you enqueue new events with a relative tick value you might introduce
- * a timing error, which causes your sequence to sound e.g. slower than it's supposed to be. If this is
- * your use-case, make sure to enqueue events with an absolute tick value.
- */
-typedef void (*fluid_event_callback_t)(unsigned int time, fluid_event_t *event,
- fluid_sequencer_t *seq, void *data);
-
-
-/** @startlifecycle{MIDI Sequencer} */
-FLUID_DEPRECATED FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer(void);
-FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer2(int use_system_timer);
-FLUIDSYNTH_API void delete_fluid_sequencer(fluid_sequencer_t *seq);
-/** @endlifecycle */
-
-FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer(fluid_sequencer_t *seq);
-FLUIDSYNTH_API
-fluid_seq_id_t fluid_sequencer_register_client(fluid_sequencer_t *seq, const char *name,
- fluid_event_callback_t callback, void *data);
-FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t *seq, fluid_seq_id_t id);
-FLUIDSYNTH_API int fluid_sequencer_count_clients(fluid_sequencer_t *seq);
-FLUIDSYNTH_API fluid_seq_id_t fluid_sequencer_get_client_id(fluid_sequencer_t *seq, int index);
-FLUIDSYNTH_API char *fluid_sequencer_get_client_name(fluid_sequencer_t *seq, fluid_seq_id_t id);
-FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t *seq, fluid_seq_id_t id);
-FLUIDSYNTH_API void fluid_sequencer_process(fluid_sequencer_t *seq, unsigned int msec);
-FLUIDSYNTH_API void fluid_sequencer_send_now(fluid_sequencer_t *seq, fluid_event_t *evt);
-FLUIDSYNTH_API
-int fluid_sequencer_send_at(fluid_sequencer_t *seq, fluid_event_t *evt,
- unsigned int time, int absolute);
-FLUIDSYNTH_API
-void fluid_sequencer_remove_events(fluid_sequencer_t *seq, fluid_seq_id_t source, fluid_seq_id_t dest, int type);
-FLUIDSYNTH_API unsigned int fluid_sequencer_get_tick(fluid_sequencer_t *seq);
-FLUIDSYNTH_API void fluid_sequencer_set_time_scale(fluid_sequencer_t *seq, double scale);
-FLUIDSYNTH_API double fluid_sequencer_get_time_scale(fluid_sequencer_t *seq);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_SEQ_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/seqbind.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/seqbind.h
deleted file mode 100644
index 1a50981..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/seqbind.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_SEQBIND_H
-#define _FLUIDSYNTH_SEQBIND_H
-
-#include "seq.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup sequencer
- *
- * @{
- */
-FLUIDSYNTH_API
-fluid_seq_id_t fluid_sequencer_register_fluidsynth(fluid_sequencer_t *seq, fluid_synth_t *synth);
-FLUIDSYNTH_API
-int fluid_sequencer_add_midi_event_to_buffer(void *data, fluid_midi_event_t *event);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _FLUIDSYNTH_SEQBIND_H */
-
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/settings.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/settings.h
deleted file mode 100644
index 45ab07a..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/settings.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_SETTINGS_H
-#define _FLUIDSYNTH_SETTINGS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup settings Settings
- *
- * Functions for settings management
- *
- * To create a synthesizer object you will have to specify its
- * settings. These settings are stored in a fluid_settings_t object.
- * @code
- * void
- * my_synthesizer ()
- * {
- * fluid_settings_t *settings;
- * fluid_synth_t *synth;
- * fluid_audio_driver_t *adriver;
- *
- * settings = new_fluid_settings ();
- * fluid_settings_setstr(settings, "audio.driver", "alsa");
- * // ... change settings ...
- * synth = new_fluid_synth (settings);
- * adriver = new_fluid_audio_driver (settings, synth);
- * // ...
- * }
- * @endcode
- * All string settings are encoded in UTF-8. This includes the names
- * of the audio and MIDI devices, exposed as setting options.
- *
- * @sa @ref CreatingSettings
- *
- * @{
- */
-
-/**
- * Hint FLUID_HINT_BOUNDED_BELOW indicates that the LowerBound field
- * of the FLUID_PortRangeHint should be considered meaningful. The
- * value in this field should be considered the (inclusive) lower
- * bound of the valid range. If FLUID_HINT_SAMPLE_RATE is also
- * specified then the value of LowerBound should be multiplied by the
- * sample rate.
- */
-#define FLUID_HINT_BOUNDED_BELOW 0x1
-
-/** Hint FLUID_HINT_BOUNDED_ABOVE indicates that the UpperBound field
- of the FLUID_PortRangeHint should be considered meaningful. The
- value in this field should be considered the (inclusive) upper
- bound of the valid range. If FLUID_HINT_SAMPLE_RATE is also
- specified then the value of UpperBound should be multiplied by the
- sample rate. */
-#define FLUID_HINT_BOUNDED_ABOVE 0x2
-
-/**
- * Hint FLUID_HINT_TOGGLED indicates that the data item should be
- * considered a Boolean toggle. Data less than or equal to zero should
- * be considered `off' or `false,' and data above zero should be
- * considered `on' or `true.' FLUID_HINT_TOGGLED may not be used in
- * conjunction with any other hint.
- */
-#define FLUID_HINT_TOGGLED 0x4
-
-#define FLUID_HINT_OPTIONLIST 0x02 /**< Setting is a list of string options */
-
-
-/**
- * Settings type
- *
- * Each setting has a defined type: numeric (double), integer, string or a
- * set of values. The type of each setting can be retrieved using the
- * function fluid_settings_get_type()
- */
-enum fluid_types_enum
-{
- FLUID_NO_TYPE = -1, /**< Undefined type */
- FLUID_NUM_TYPE, /**< Numeric (double) */
- FLUID_INT_TYPE, /**< Integer */
- FLUID_STR_TYPE, /**< String */
- FLUID_SET_TYPE /**< Set of values */
-};
-
-/** @startlifecycle{Settings} */
-FLUIDSYNTH_API fluid_settings_t *new_fluid_settings(void);
-FLUIDSYNTH_API void delete_fluid_settings(fluid_settings_t *settings);
-/** @endlifecycle */
-
-FLUIDSYNTH_API
-int fluid_settings_get_type(fluid_settings_t *settings, const char *name);
-
-FLUIDSYNTH_API
-int fluid_settings_get_hints(fluid_settings_t *settings, const char *name, int *val);
-
-FLUIDSYNTH_API
-int fluid_settings_is_realtime(fluid_settings_t *settings, const char *name);
-
-FLUIDSYNTH_API
-int fluid_settings_setstr(fluid_settings_t *settings, const char *name, const char *str);
-
-FLUIDSYNTH_API
-int fluid_settings_copystr(fluid_settings_t *settings, const char *name, char *str, int len);
-
-FLUIDSYNTH_API
-int fluid_settings_dupstr(fluid_settings_t *settings, const char *name, char **str);
-
-FLUIDSYNTH_API
-int fluid_settings_getstr_default(fluid_settings_t *settings, const char *name, char **def);
-
-FLUIDSYNTH_API
-int fluid_settings_str_equal(fluid_settings_t *settings, const char *name, const char *value);
-
-FLUIDSYNTH_API
-int fluid_settings_setnum(fluid_settings_t *settings, const char *name, double val);
-
-FLUIDSYNTH_API
-int fluid_settings_getnum(fluid_settings_t *settings, const char *name, double *val);
-
-FLUIDSYNTH_API
-int fluid_settings_getnum_default(fluid_settings_t *settings, const char *name, double *val);
-
-FLUIDSYNTH_API
-int fluid_settings_getnum_range(fluid_settings_t *settings, const char *name,
- double *min, double *max);
-
-FLUIDSYNTH_API
-int fluid_settings_setint(fluid_settings_t *settings, const char *name, int val);
-
-FLUIDSYNTH_API
-int fluid_settings_getint(fluid_settings_t *settings, const char *name, int *val);
-
-FLUIDSYNTH_API
-int fluid_settings_getint_default(fluid_settings_t *settings, const char *name, int *val);
-
-FLUIDSYNTH_API
-int fluid_settings_getint_range(fluid_settings_t *settings, const char *name,
- int *min, int *max);
-
-/**
- * Callback function type used with fluid_settings_foreach_option()
- *
- * @param data User defined data pointer
- * @param name Setting name
- * @param option A string option for this setting (iterates through the list)
- */
-typedef void (*fluid_settings_foreach_option_t)(void *data, const char *name, const char *option);
-
-FLUIDSYNTH_API
-void fluid_settings_foreach_option(fluid_settings_t *settings,
- const char *name, void *data,
- fluid_settings_foreach_option_t func);
-FLUIDSYNTH_API
-int fluid_settings_option_count(fluid_settings_t *settings, const char *name);
-FLUIDSYNTH_API char *fluid_settings_option_concat(fluid_settings_t *settings,
- const char *name,
- const char *separator);
-
-/**
- * Callback function type used with fluid_settings_foreach()
- *
- * @param data User defined data pointer
- * @param name Setting name
- * @param type Setting type (#fluid_types_enum)
- */
-typedef void (*fluid_settings_foreach_t)(void *data, const char *name, int type);
-
-FLUIDSYNTH_API
-void fluid_settings_foreach(fluid_settings_t *settings, void *data,
- fluid_settings_foreach_t func);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_SETTINGS_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/sfont.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/sfont.h
deleted file mode 100644
index 6d0fd4c..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/sfont.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_SFONT_H
-#define _FLUIDSYNTH_SFONT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup soundfonts SoundFonts
- *
- * SoundFont related functions
- *
- * This part of the API contains functions, defines and types that are mostly
- * only used by internal or custom SoundFont loaders or client code that
- * modifies loaded presets, SoundFonts or voices directly.
- */
-
-/**
- * @defgroup soundfont_loader SoundFont Loader
- * @ingroup soundfonts
- *
- * Create custom SoundFont loaders
- *
- * It is possible to add new SoundFont loaders to the
- * synthesizer. This API allows for virtual SoundFont files to be loaded
- * and synthesized, which may not actually be SoundFont files, as long as they
- * can be represented by the SoundFont synthesis model.
- *
- * To add a new SoundFont loader to the synthesizer, call
- * fluid_synth_add_sfloader() and pass a pointer to an
- * #fluid_sfloader_t instance created by new_fluid_sfloader().
- * On creation, you must specify a callback function \p load
- * that will be called for every file attempting to load it and
- * if successful returns a #fluid_sfont_t instance, or NULL if it fails.
- *
- * The #fluid_sfont_t structure contains a callback to obtain the
- * name of the SoundFont. It contains two functions to iterate
- * though the contained presets, and one function to obtain a
- * preset corresponding to a bank and preset number. This
- * function should return a #fluid_preset_t instance.
- *
- * The #fluid_preset_t instance contains some functions to obtain
- * information from the preset (name, bank, number). The most
- * important callback is the noteon function. The noteon function
- * is called by fluidsynth internally and
- * should call fluid_synth_alloc_voice() for every sample that has
- * to be played. fluid_synth_alloc_voice() expects a pointer to a
- * #fluid_sample_t instance and returns a pointer to the opaque
- * #fluid_voice_t structure. To set or increment the values of a
- * generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are
- * finished initializing the voice call fluid_voice_start() to
- * start playing the synthesis voice.
- *
- * @{
- */
-
-/**
- * Some notification enums for presets and samples.
- */
-enum
-{
- FLUID_PRESET_SELECTED, /**< Preset selected notify */
- FLUID_PRESET_UNSELECTED, /**< Preset unselected notify */
- FLUID_SAMPLE_DONE, /**< Sample no longer needed notify */
- FLUID_PRESET_PIN, /**< Request to pin preset samples to cache */
- FLUID_PRESET_UNPIN /**< Request to unpin preset samples from cache */
-};
-
-/**
- * Indicates the type of a sample used by the _fluid_sample_t::sampletype field.
- *
- * This enum corresponds to the \c SFSampleLink enum in the SoundFont spec.
- * One \c flag may be bit-wise OR-ed with one \c value.
- */
-enum fluid_sample_type
-{
- FLUID_SAMPLETYPE_MONO = 0x1, /**< Value used for mono samples */
- FLUID_SAMPLETYPE_RIGHT = 0x2, /**< Value used for right samples of a stereo pair */
- FLUID_SAMPLETYPE_LEFT = 0x4, /**< Value used for left samples of a stereo pair */
- FLUID_SAMPLETYPE_LINKED = 0x8, /**< Value used for linked sample, which is currently not supported */
- FLUID_SAMPLETYPE_OGG_VORBIS = 0x10, /**< Flag used for Ogg Vorbis compressed samples (non-standard compliant extension) as found in the program "sftools" developed by Werner Schweer from MuseScore @since 1.1.7 */
- FLUID_SAMPLETYPE_ROM = 0x8000 /**< Flag that indicates ROM samples, causing the sample to be ignored */
-};
-
-
-/**
- * Method to load an instrument file (does not actually need to be a real file name,
- * could be another type of string identifier that the \a loader understands).
- *
- * @param loader SoundFont loader
- * @param filename File name or other string identifier
- * @return The loaded instrument file (SoundFont) or NULL if an error occurred.
- */
-typedef fluid_sfont_t *(*fluid_sfloader_load_t)(fluid_sfloader_t *loader, const char *filename);
-
-/**
- * The free method should free the memory allocated for a fluid_sfloader_t instance in
- * addition to any private data.
- *
- * @param loader SoundFont loader
- *
- * Any custom user provided cleanup function must ultimately call
- * delete_fluid_sfloader() to ensure proper cleanup of the #fluid_sfloader_t struct. If no private data
- * needs to be freed, setting this to delete_fluid_sfloader() is sufficient.
- *
- */
-typedef void (*fluid_sfloader_free_t)(fluid_sfloader_t *loader);
-
-
-/** @startlifecycle{SoundFont Loader} */
-FLUIDSYNTH_API fluid_sfloader_t *new_fluid_sfloader(fluid_sfloader_load_t load, fluid_sfloader_free_t free);
-FLUIDSYNTH_API void delete_fluid_sfloader(fluid_sfloader_t *loader);
-
-FLUIDSYNTH_API fluid_sfloader_t *new_fluid_defsfloader(fluid_settings_t *settings);
-/** @endlifecycle */
-
-/**
- * Opens the file or memory indicated by \c filename in binary read mode.
- *
- * @return returns a file handle on success, NULL otherwise
- *
- * \c filename matches the string provided during the fluid_synth_sfload() call.
- */
-typedef void *(* fluid_sfloader_callback_open_t)(const char *filename);
-
-/**
- * Reads \c count bytes to the specified buffer \c buf.
- *
- * @return returns #FLUID_OK if exactly \c count bytes were successfully read, else returns #FLUID_FAILED and leaves \a buf unmodified.
- */
-typedef int (* fluid_sfloader_callback_read_t)(void *buf, fluid_long_long_t count, void *handle);
-
-/**
- * Same purpose and behaviour as fseek.
- *
- * @param origin either \c SEEK_SET, \c SEEK_CUR or \c SEEK_END
- * @return returns #FLUID_OK if the seek was successfully performed while not seeking beyond a buffer or file, #FLUID_FAILED otherwise
- */
-typedef int (* fluid_sfloader_callback_seek_t)(void *handle, fluid_long_long_t offset, int origin);
-
-/**
- * Closes the handle returned by #fluid_sfloader_callback_open_t and frees used resources.
- *
- * @return returns #FLUID_OK on success, #FLUID_FAILED on error
- */
-typedef int (* fluid_sfloader_callback_close_t)(void *handle);
-
-/** @return returns current file offset or #FLUID_FAILED on error */
-typedef fluid_long_long_t (* fluid_sfloader_callback_tell_t)(void *handle);
-
-
-FLUIDSYNTH_API int fluid_sfloader_set_callbacks(fluid_sfloader_t *loader,
- fluid_sfloader_callback_open_t open,
- fluid_sfloader_callback_read_t read,
- fluid_sfloader_callback_seek_t seek,
- fluid_sfloader_callback_tell_t tell,
- fluid_sfloader_callback_close_t close);
-
-FLUIDSYNTH_API int fluid_sfloader_set_data(fluid_sfloader_t *loader, void *data);
-FLUIDSYNTH_API void *fluid_sfloader_get_data(fluid_sfloader_t *loader);
-
-
-
-/**
- * Method to return the name of a virtual SoundFont.
- *
- * @param sfont Virtual SoundFont
- * @return The name of the virtual SoundFont.
- */
-typedef const char *(*fluid_sfont_get_name_t)(fluid_sfont_t *sfont);
-
-/**
- * Get a virtual SoundFont preset by bank and program numbers.
- *
- * @param sfont Virtual SoundFont
- * @param bank MIDI bank number (0-16383)
- * @param prenum MIDI preset number (0-127)
- * @return Should return an allocated virtual preset or NULL if it could not
- * be found.
- */
-typedef fluid_preset_t *(*fluid_sfont_get_preset_t)(fluid_sfont_t *sfont, int bank, int prenum);
-
-/**
- * Start virtual SoundFont preset iteration method.
- *
- * @param sfont Virtual SoundFont
- *
- * Starts/re-starts virtual preset iteration in a SoundFont.
- */
-typedef void (*fluid_sfont_iteration_start_t)(fluid_sfont_t *sfont);
-
-/**
- * Virtual SoundFont preset iteration function.
- *
- * @param sfont Virtual SoundFont
- * @return NULL when no more presets are available, otherwise the a pointer to the current preset
- *
- * Returns preset information to the caller. The returned buffer is only valid until a subsequent
- * call to this function.
- */
-typedef fluid_preset_t *(*fluid_sfont_iteration_next_t)(fluid_sfont_t *sfont);
-
-/**
- * Method to free a virtual SoundFont bank.
- *
- * @param sfont Virtual SoundFont to free.
- * @return Should return 0 when it was able to free all resources or non-zero
- * if some of the samples could not be freed because they are still in use,
- * in which case the free will be tried again later, until success.
- *
- * Any custom user provided cleanup function must ultimately call
- * delete_fluid_sfont() to ensure proper cleanup of the #fluid_sfont_t struct. If no private data
- * needs to be freed, setting this to delete_fluid_sfont() is sufficient.
- */
-typedef int (*fluid_sfont_free_t)(fluid_sfont_t *sfont);
-
-
-/** @startlifecycle{SoundFont} */
-FLUIDSYNTH_API fluid_sfont_t *new_fluid_sfont(fluid_sfont_get_name_t get_name,
- fluid_sfont_get_preset_t get_preset,
- fluid_sfont_iteration_start_t iter_start,
- fluid_sfont_iteration_next_t iter_next,
- fluid_sfont_free_t free);
-
-FLUIDSYNTH_API int delete_fluid_sfont(fluid_sfont_t *sfont);
-/** @endlifecycle */
-
-FLUIDSYNTH_API int fluid_sfont_set_data(fluid_sfont_t *sfont, void *data);
-FLUIDSYNTH_API void *fluid_sfont_get_data(fluid_sfont_t *sfont);
-
-FLUIDSYNTH_API int fluid_sfont_get_id(fluid_sfont_t *sfont);
-FLUIDSYNTH_API const char *fluid_sfont_get_name(fluid_sfont_t *sfont);
-FLUIDSYNTH_API fluid_preset_t *fluid_sfont_get_preset(fluid_sfont_t *sfont, int bank, int prenum);
-FLUIDSYNTH_API void fluid_sfont_iteration_start(fluid_sfont_t *sfont);
-FLUIDSYNTH_API fluid_preset_t *fluid_sfont_iteration_next(fluid_sfont_t *sfont);
-
-/**
- * Method to get a virtual SoundFont preset name.
- *
- * @param preset Virtual SoundFont preset
- * @return Should return the name of the preset. The returned string must be
- * valid for the duration of the virtual preset (or the duration of the
- * SoundFont, in the case of preset iteration).
- */
-typedef const char *(*fluid_preset_get_name_t)(fluid_preset_t *preset);
-
-/**
- * Method to get a virtual SoundFont preset MIDI bank number.
- *
- * @param preset Virtual SoundFont preset
- * @param return The bank number of the preset
- */
-typedef int (*fluid_preset_get_banknum_t)(fluid_preset_t *preset);
-
-/**
- * Method to get a virtual SoundFont preset MIDI program number.
- *
- * @param preset Virtual SoundFont preset
- * @param return The program number of the preset
- */
-typedef int (*fluid_preset_get_num_t)(fluid_preset_t *preset);
-
-/**
- * Method to handle a noteon event (synthesize the instrument).
- *
- * @param preset Virtual SoundFont preset
- * @param synth Synthesizer instance
- * @param chan MIDI channel number of the note on event
- * @param key MIDI note number (0-127)
- * @param vel MIDI velocity (0-127)
- * @return #FLUID_OK on success (0) or #FLUID_FAILED (-1) otherwise
- *
- * This method may be called from within synthesis context and therefore
- * should be as efficient as possible and not perform any operations considered
- * bad for realtime audio output (memory allocations and other OS calls).
- *
- * Call fluid_synth_alloc_voice() for every sample that has
- * to be played. fluid_synth_alloc_voice() expects a pointer to a
- * #fluid_sample_t structure and returns a pointer to the opaque
- * #fluid_voice_t structure. To set or increment the values of a
- * generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are
- * finished initializing the voice call fluid_voice_start() to
- * start playing the synthesis voice. Starting with FluidSynth 1.1.0 all voices
- * created will be started at the same time.
- */
-typedef int (*fluid_preset_noteon_t)(fluid_preset_t *preset, fluid_synth_t *synth, int chan, int key, int vel);
-
-/**
- * Method to free a virtual SoundFont preset.
- *
- * @param preset Virtual SoundFont preset
- * @return Should return 0
- *
- * Any custom user provided cleanup function must ultimately call
- * delete_fluid_preset() to ensure proper cleanup of the #fluid_preset_t struct. If no private data
- * needs to be freed, setting this to delete_fluid_preset() is sufficient.
- */
-typedef void (*fluid_preset_free_t)(fluid_preset_t *preset);
-
-/** @startlifecycle{Preset} */
-FLUIDSYNTH_API fluid_preset_t *new_fluid_preset(fluid_sfont_t *parent_sfont,
- fluid_preset_get_name_t get_name,
- fluid_preset_get_banknum_t get_bank,
- fluid_preset_get_num_t get_num,
- fluid_preset_noteon_t noteon,
- fluid_preset_free_t free);
-FLUIDSYNTH_API void delete_fluid_preset(fluid_preset_t *preset);
-/** @endlifecycle */
-
-FLUIDSYNTH_API int fluid_preset_set_data(fluid_preset_t *preset, void *data);
-FLUIDSYNTH_API void *fluid_preset_get_data(fluid_preset_t *preset);
-
-FLUIDSYNTH_API const char *fluid_preset_get_name(fluid_preset_t *preset);
-FLUIDSYNTH_API int fluid_preset_get_banknum(fluid_preset_t *preset);
-FLUIDSYNTH_API int fluid_preset_get_num(fluid_preset_t *preset);
-FLUIDSYNTH_API fluid_sfont_t *fluid_preset_get_sfont(fluid_preset_t *preset);
-
-/** @startlifecycle{Sample} */
-FLUIDSYNTH_API fluid_sample_t *new_fluid_sample(void);
-FLUIDSYNTH_API void delete_fluid_sample(fluid_sample_t *sample);
-/** @endlifecycle */
-
-FLUIDSYNTH_API size_t fluid_sample_sizeof(void);
-
-FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t *sample, const char *name);
-FLUIDSYNTH_API int fluid_sample_set_sound_data(fluid_sample_t *sample,
- short *data,
- char *data24,
- unsigned int nbframes,
- unsigned int sample_rate,
- short copy_data);
-
-FLUIDSYNTH_API int fluid_sample_set_loop(fluid_sample_t *sample, unsigned int loop_start, unsigned int loop_end);
-FLUIDSYNTH_API int fluid_sample_set_pitch(fluid_sample_t *sample, int root_key, int fine_tune);
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_SFONT_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/shell.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/shell.h
deleted file mode 100644
index cb555c9..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/shell.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_SHELL_H
-#define _FLUIDSYNTH_SHELL_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @defgroup command_interface Command Interface
- *
- * Control and configuration interface
- *
- * The command interface allows you to send textual commands to
- * the synthesizer, to parse a command file, or to read commands
- * from the stdin or other input streams (like a TCP socket).
- *
- * For a full list of available commands, type \c help in the
- * \ref command_shell or send the same command via a command handler.
- * Further documentation can be found at
- * https://github.com/FluidSynth/fluidsynth/wiki/UserManual#shell-commands
- *
- * @{
- */
-FLUIDSYNTH_API fluid_istream_t fluid_get_stdin(void);
-FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout(void);
-FLUIDSYNTH_API char *fluid_get_userconf(char *buf, int len);
-FLUIDSYNTH_API char *fluid_get_sysconf(char *buf, int len);
-/** @} */
-
-
-/**
- * @defgroup command_handler Command Handler
- * @ingroup command_interface
- * @brief Handles text commands and reading of configuration files
- *
- * @{
- */
-
-/** @startlifecycle{Command Handler} */
-FLUIDSYNTH_API
-fluid_cmd_handler_t *new_fluid_cmd_handler(fluid_synth_t *synth, fluid_midi_router_t *router);
-
-FLUIDSYNTH_API
-fluid_cmd_handler_t *new_fluid_cmd_handler2(fluid_settings_t *settings, fluid_synth_t *synth,
- fluid_midi_router_t *router, fluid_player_t *player);
-
-FLUIDSYNTH_API
-void delete_fluid_cmd_handler(fluid_cmd_handler_t *handler);
-/** @endlifecycle */
-
-FLUIDSYNTH_API
-void fluid_cmd_handler_set_synth(fluid_cmd_handler_t *handler, fluid_synth_t *synth);
-
-FLUIDSYNTH_API
-int fluid_command(fluid_cmd_handler_t *handler, const char *cmd, fluid_ostream_t out);
-
-FLUIDSYNTH_API
-int fluid_source(fluid_cmd_handler_t *handler, const char *filename);
-/** @} */
-
-
-/**
- * @defgroup command_shell Command Shell
- * @ingroup command_interface
- *
- * Interactive shell to control and configure a synthesizer instance.
- *
- * If you need a platform independent way to get the standard input
- * and output streams, use fluid_get_stdin() and fluid_get_stdout().
- *
- * For a full list of available commands, type \c help in the shell.
- *
- * @{
- */
-
-/** @startlifecycle{Command Shell} */
-FLUIDSYNTH_API
-fluid_shell_t *new_fluid_shell(fluid_settings_t *settings, fluid_cmd_handler_t *handler,
- fluid_istream_t in, fluid_ostream_t out, int thread);
-
-FLUIDSYNTH_API
-void fluid_usershell(fluid_settings_t *settings, fluid_cmd_handler_t *handler);
-
-FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t *shell);
-/** @endlifecycle */
-
-/** @} */
-
-
-/**
- * @defgroup command_server Command Server
- * @ingroup command_interface
- *
- * TCP socket server for a command handler.
- *
- * The socket server will open the TCP port set by \ref settings_shell_port
- * (default 9800) and starts a new thread and \ref command_handler for each
- * incoming connection.
- *
- * @note The server is only available if libfluidsynth has been compiled
- * with network support (enable-network). Without network support, all related
- * functions will return FLUID_FAILED or NULL.
- *
- * @{
- */
-
-/** @startlifecycle{Command Server} */
-FLUIDSYNTH_API
-fluid_server_t *new_fluid_server(fluid_settings_t *settings,
- fluid_synth_t *synth, fluid_midi_router_t *router);
-
-FLUIDSYNTH_API
-fluid_server_t *new_fluid_server2(fluid_settings_t *settings,
- fluid_synth_t *synth, fluid_midi_router_t *router,
- fluid_player_t *player);
-
-FLUIDSYNTH_API void delete_fluid_server(fluid_server_t *server);
-
-FLUIDSYNTH_API int fluid_server_join(fluid_server_t *server);
-/** @endlifecycle */
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_SHELL_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/synth.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/synth.h
deleted file mode 100644
index 59a1cb1..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/synth.h
+++ /dev/null
@@ -1,559 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_SYNTH_H
-#define _FLUIDSYNTH_SYNTH_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @defgroup synth Synthesizer
- *
- * SoundFont synthesizer
- *
- * You create a new synthesizer with new_fluid_synth() and you destroy
- * it with delete_fluid_synth(). Use the fluid_settings_t structure to specify
- * the synthesizer characteristics.
- *
- * You have to load a SoundFont in order to hear any sound. For that
- * you use the fluid_synth_sfload() function.
- *
- * You can use the audio driver functions to open
- * the audio device and create a background audio thread.
- *
- * The API for sending MIDI events is probably what you expect:
- * fluid_synth_noteon(), fluid_synth_noteoff(), ...
- *
- * @{
- */
-
-/** @startlifecycle{Synthesizer} */
-FLUIDSYNTH_API fluid_synth_t *new_fluid_synth(fluid_settings_t *settings);
-FLUIDSYNTH_API void delete_fluid_synth(fluid_synth_t *synth);
-/** @endlifecycle */
-
-FLUIDSYNTH_API double fluid_synth_get_cpu_load(fluid_synth_t *synth);
-FLUID_DEPRECATED FLUIDSYNTH_API const char *fluid_synth_error(fluid_synth_t *synth);
-/** @} */
-
-/**
- * @defgroup midi_messages MIDI Channel Messages
- * @ingroup synth
- *
- * The MIDI channel message functions are mostly directly named after their
- * counterpart MIDI messages. They are a high-level interface to controlling
- * the synthesizer, playing notes and changing note and channel parameters.
- *
- * @{
- */
-FLUIDSYNTH_API int fluid_synth_noteon(fluid_synth_t *synth, int chan, int key, int vel);
-FLUIDSYNTH_API int fluid_synth_noteoff(fluid_synth_t *synth, int chan, int key);
-FLUIDSYNTH_API int fluid_synth_cc(fluid_synth_t *synth, int chan, int ctrl, int val);
-FLUIDSYNTH_API int fluid_synth_get_cc(fluid_synth_t *synth, int chan, int ctrl, int *pval);
-FLUIDSYNTH_API int fluid_synth_sysex(fluid_synth_t *synth, const char *data, int len,
- char *response, int *response_len, int *handled, int dryrun);
-FLUIDSYNTH_API int fluid_synth_pitch_bend(fluid_synth_t *synth, int chan, int val);
-FLUIDSYNTH_API int fluid_synth_get_pitch_bend(fluid_synth_t *synth, int chan, int *ppitch_bend);
-FLUIDSYNTH_API int fluid_synth_pitch_wheel_sens(fluid_synth_t *synth, int chan, int val);
-FLUIDSYNTH_API int fluid_synth_get_pitch_wheel_sens(fluid_synth_t *synth, int chan, int *pval);
-FLUIDSYNTH_API int fluid_synth_program_change(fluid_synth_t *synth, int chan, int program);
-FLUIDSYNTH_API int fluid_synth_channel_pressure(fluid_synth_t *synth, int chan, int val);
-FLUIDSYNTH_API int fluid_synth_key_pressure(fluid_synth_t *synth, int chan, int key, int val);
-FLUIDSYNTH_API int fluid_synth_bank_select(fluid_synth_t *synth, int chan, int bank);
-FLUIDSYNTH_API int fluid_synth_sfont_select(fluid_synth_t *synth, int chan, int sfont_id);
-FLUIDSYNTH_API
-int fluid_synth_program_select(fluid_synth_t *synth, int chan, int sfont_id,
- int bank_num, int preset_num);
-FLUIDSYNTH_API int
-fluid_synth_program_select_by_sfont_name(fluid_synth_t *synth, int chan,
- const char *sfont_name, int bank_num,
- int preset_num);
-FLUIDSYNTH_API
-int fluid_synth_get_program(fluid_synth_t *synth, int chan, int *sfont_id,
- int *bank_num, int *preset_num);
-FLUIDSYNTH_API int fluid_synth_unset_program(fluid_synth_t *synth, int chan);
-FLUIDSYNTH_API int fluid_synth_program_reset(fluid_synth_t *synth);
-FLUIDSYNTH_API int fluid_synth_system_reset(fluid_synth_t *synth);
-
-FLUIDSYNTH_API int fluid_synth_all_notes_off(fluid_synth_t *synth, int chan);
-FLUIDSYNTH_API int fluid_synth_all_sounds_off(fluid_synth_t *synth, int chan);
-
-FLUIDSYNTH_API int fluid_synth_set_gen(fluid_synth_t *synth, int chan,
- int param, float value);
-FLUIDSYNTH_API float fluid_synth_get_gen(fluid_synth_t *synth, int chan, int param);
-/** @} MIDI Channel Messages */
-
-
-/**
- * @defgroup voice_control Synthesis Voice Control
- * @ingroup synth
- *
- * Low-level access to synthesis voices.
- *
- * @{
- */
-FLUIDSYNTH_API int fluid_synth_start(fluid_synth_t *synth, unsigned int id,
- fluid_preset_t *preset, int audio_chan,
- int midi_chan, int key, int vel);
-FLUIDSYNTH_API int fluid_synth_stop(fluid_synth_t *synth, unsigned int id);
-
-FLUIDSYNTH_API fluid_voice_t *fluid_synth_alloc_voice(fluid_synth_t *synth,
- fluid_sample_t *sample,
- int channum, int key, int vel);
-FLUIDSYNTH_API void fluid_synth_start_voice(fluid_synth_t *synth, fluid_voice_t *voice);
-FLUIDSYNTH_API void fluid_synth_get_voicelist(fluid_synth_t *synth,
- fluid_voice_t *buf[], int bufsize, int ID);
-/** @} Voice Control */
-
-
-/**
- * @defgroup soundfont_management SoundFont Management
- * @ingroup synth
- *
- * Functions to load and unload SoundFonts.
- *
- * @{
- */
-FLUIDSYNTH_API
-int fluid_synth_sfload(fluid_synth_t *synth, const char *filename, int reset_presets);
-FLUIDSYNTH_API int fluid_synth_sfreload(fluid_synth_t *synth, int id);
-FLUIDSYNTH_API int fluid_synth_sfunload(fluid_synth_t *synth, int id, int reset_presets);
-FLUIDSYNTH_API int fluid_synth_add_sfont(fluid_synth_t *synth, fluid_sfont_t *sfont);
-FLUIDSYNTH_API int fluid_synth_remove_sfont(fluid_synth_t *synth, fluid_sfont_t *sfont);
-FLUIDSYNTH_API int fluid_synth_sfcount(fluid_synth_t *synth);
-FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont(fluid_synth_t *synth, unsigned int num);
-FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_id(fluid_synth_t *synth, int id);
-FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_name(fluid_synth_t *synth,
- const char *name);
-FLUIDSYNTH_API int fluid_synth_set_bank_offset(fluid_synth_t *synth, int sfont_id, int offset);
-FLUIDSYNTH_API int fluid_synth_get_bank_offset(fluid_synth_t *synth, int sfont_id);
-/** @} Soundfont Management */
-
-
-/**
- * @defgroup reverb_effect Effect - Reverb
- * @ingroup synth
- *
- * Functions for configuring the built-in reverb effect
- *
- * @{
- */
-FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_reverb_on(fluid_synth_t *synth, int on);
-FLUIDSYNTH_API int fluid_synth_reverb_on(fluid_synth_t *synth, int fx_group, int on);
-
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb(fluid_synth_t *synth, double roomsize,
- double damping, double width, double level);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize(fluid_synth_t *synth, double roomsize);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_damp(fluid_synth_t *synth, double damping);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_width(fluid_synth_t *synth, double width);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_level(fluid_synth_t *synth, double level);
-
-FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize(fluid_synth_t *synth);
-FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_damp(fluid_synth_t *synth);
-FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_level(fluid_synth_t *synth);
-FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_width(fluid_synth_t *synth);
-
-FLUIDSYNTH_API int fluid_synth_set_reverb_group_roomsize(fluid_synth_t *synth, int fx_group, double roomsize);
-FLUIDSYNTH_API int fluid_synth_set_reverb_group_damp(fluid_synth_t *synth, int fx_group, double damping);
-FLUIDSYNTH_API int fluid_synth_set_reverb_group_width(fluid_synth_t *synth, int fx_group, double width);
-FLUIDSYNTH_API int fluid_synth_set_reverb_group_level(fluid_synth_t *synth, int fx_group, double level);
-
-FLUIDSYNTH_API int fluid_synth_get_reverb_group_roomsize(fluid_synth_t *synth, int fx_group, double *roomsize);
-FLUIDSYNTH_API int fluid_synth_get_reverb_group_damp(fluid_synth_t *synth, int fx_group, double *damping);
-FLUIDSYNTH_API int fluid_synth_get_reverb_group_width(fluid_synth_t *synth, int fx_group, double *width);
-FLUIDSYNTH_API int fluid_synth_get_reverb_group_level(fluid_synth_t *synth, int fx_group, double *level);
- /** @} Reverb */
-
-
-/**
- * @defgroup chorus_effect Effect - Chorus
- * @ingroup synth
- *
- * Functions for configuring the built-in chorus effect
- *
- * @{
- */
-
-/**
- * Chorus modulation waveform type.
- */
-enum fluid_chorus_mod
-{
- FLUID_CHORUS_MOD_SINE = 0, /**< Sine wave chorus modulation */
- FLUID_CHORUS_MOD_TRIANGLE = 1 /**< Triangle wave chorus modulation */
-};
-
-
-FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_chorus_on(fluid_synth_t *synth, int on);
-FLUIDSYNTH_API int fluid_synth_chorus_on(fluid_synth_t *synth, int fx_group, int on);
-
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus(fluid_synth_t *synth, int nr, double level,
- double speed, double depth_ms, int type);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_nr(fluid_synth_t *synth, int nr);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_level(fluid_synth_t *synth, double level);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_speed(fluid_synth_t *synth, double speed);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_depth(fluid_synth_t *synth, double depth_ms);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_type(fluid_synth_t *synth, int type);
-
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_get_chorus_nr(fluid_synth_t *synth);
-FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_level(fluid_synth_t *synth);
-FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_speed(fluid_synth_t *synth);
-FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_depth(fluid_synth_t *synth);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_get_chorus_type(fluid_synth_t *synth); /* see fluid_chorus_mod */
-
-FLUIDSYNTH_API int fluid_synth_set_chorus_group_nr(fluid_synth_t *synth, int fx_group, int nr);
-FLUIDSYNTH_API int fluid_synth_set_chorus_group_level(fluid_synth_t *synth, int fx_group, double level);
-FLUIDSYNTH_API int fluid_synth_set_chorus_group_speed(fluid_synth_t *synth, int fx_group, double speed);
-FLUIDSYNTH_API int fluid_synth_set_chorus_group_depth(fluid_synth_t *synth, int fx_group, double depth_ms);
-FLUIDSYNTH_API int fluid_synth_set_chorus_group_type(fluid_synth_t *synth, int fx_group, int type);
-
-FLUIDSYNTH_API int fluid_synth_get_chorus_group_nr(fluid_synth_t *synth, int fx_group, int *nr);
-FLUIDSYNTH_API int fluid_synth_get_chorus_group_level(fluid_synth_t *synth, int fx_group, double *level);
-FLUIDSYNTH_API int fluid_synth_get_chorus_group_speed(fluid_synth_t *synth, int fx_group, double *speed);
-FLUIDSYNTH_API int fluid_synth_get_chorus_group_depth(fluid_synth_t *synth, int fx_group, double *depth_ms);
-FLUIDSYNTH_API int fluid_synth_get_chorus_group_type(fluid_synth_t *synth, int fx_group, int *type);
-/** @} Chorus */
-
-/**
- * @defgroup synthesis_params Synthesis Parameters
- * @ingroup synth
- *
- * Functions to control and query synthesis parameters like gain and
- * polyphony count.
- *
- * @{
- */
-FLUIDSYNTH_API int fluid_synth_count_midi_channels(fluid_synth_t *synth);
-FLUIDSYNTH_API int fluid_synth_count_audio_channels(fluid_synth_t *synth);
-FLUIDSYNTH_API int fluid_synth_count_audio_groups(fluid_synth_t *synth);
-FLUIDSYNTH_API int fluid_synth_count_effects_channels(fluid_synth_t *synth);
-FLUIDSYNTH_API int fluid_synth_count_effects_groups(fluid_synth_t *synth);
-
-FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_sample_rate(fluid_synth_t *synth, float sample_rate);
-FLUIDSYNTH_API void fluid_synth_set_gain(fluid_synth_t *synth, float gain);
-FLUIDSYNTH_API float fluid_synth_get_gain(fluid_synth_t *synth);
-FLUIDSYNTH_API int fluid_synth_set_polyphony(fluid_synth_t *synth, int polyphony);
-FLUIDSYNTH_API int fluid_synth_get_polyphony(fluid_synth_t *synth);
-FLUIDSYNTH_API int fluid_synth_get_active_voice_count(fluid_synth_t *synth);
-FLUIDSYNTH_API int fluid_synth_get_internal_bufsize(fluid_synth_t *synth);
-
-FLUIDSYNTH_API
-int fluid_synth_set_interp_method(fluid_synth_t *synth, int chan, int interp_method);
-
-/**
- * Synthesis interpolation method.
- */
-enum fluid_interp
-{
- FLUID_INTERP_NONE = 0, /**< No interpolation: Fastest, but questionable audio quality */
- FLUID_INTERP_LINEAR = 1, /**< Straight-line interpolation: A bit slower, reasonable audio quality */
- FLUID_INTERP_4THORDER = 4, /**< Fourth-order interpolation, best quality, the default */
-
- /**
- * Seventh-point sinc interpolation
- * @note This interpolation method was believed to provide highest quality. However, in Feb. 2025 it was discovered
- * that for certain samples it does introduce ringing artifacts, which
- * are not present in the 4th order interpolation. This is not a bug, it's rather a limitation of only using 7 points for the sinc interpolation.
- */
- FLUID_INTERP_7THORDER = 7,
-
- FLUID_INTERP_DEFAULT = FLUID_INTERP_4THORDER, /**< Default interpolation method */
- FLUID_INTERP_HIGHEST = FLUID_INTERP_7THORDER, /**< Highest interpolation method */
-};
-
-/**
- * Enum used with fluid_synth_add_default_mod() to specify how to handle duplicate modulators.
- */
-enum fluid_synth_add_mod
-{
- FLUID_SYNTH_OVERWRITE, /**< Overwrite any existing matching modulator */
- FLUID_SYNTH_ADD, /**< Sum up modulator amounts */
-};
-
-FLUIDSYNTH_API int fluid_synth_add_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod, int mode);
-FLUIDSYNTH_API int fluid_synth_remove_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod);
-/** @} Synthesis Parameters */
-
-
-/**
- * @defgroup tuning MIDI Tuning
- * @ingroup synth
- *
- * The functions in this section implement the MIDI Tuning Standard interface.
- *
- * @{
- */
-FLUIDSYNTH_API
-int fluid_synth_activate_key_tuning(fluid_synth_t *synth, int bank, int prog,
- const char *name, const double *pitch, int apply);
-FLUIDSYNTH_API
-int fluid_synth_activate_octave_tuning(fluid_synth_t *synth, int bank, int prog,
- const char *name, const double *pitch, int apply);
-FLUIDSYNTH_API
-int fluid_synth_tune_notes(fluid_synth_t *synth, int bank, int prog,
- int len, const int *keys, const double *pitch, int apply);
-FLUIDSYNTH_API
-int fluid_synth_activate_tuning(fluid_synth_t *synth, int chan, int bank, int prog,
- int apply);
-FLUIDSYNTH_API
-int fluid_synth_deactivate_tuning(fluid_synth_t *synth, int chan, int apply);
-FLUIDSYNTH_API void fluid_synth_tuning_iteration_start(fluid_synth_t *synth);
-FLUIDSYNTH_API
-int fluid_synth_tuning_iteration_next(fluid_synth_t *synth, int *bank, int *prog);
-FLUIDSYNTH_API int fluid_synth_tuning_dump(fluid_synth_t *synth, int bank, int prog,
- char *name, int len, double *pitch);
-/** @} MIDI Tuning */
-
-
-/**
- * @defgroup audio_rendering Audio Rendering
- * @ingroup synth
- *
- * The functions in this section can be used to render audio directly to
- * memory buffers. They are used internally by the \ref audio_driver and \ref file_renderer,
- * but can also be used manually for custom processing of the rendered audio.
- *
- * @note Please note that all following functions block during rendering. If your goal is to
- * render real-time audio, ensure that you call these functions from a high-priority
- * thread with little to no other duties other than calling the rendering functions.
- *
- * @warning
- * If a concurrently running thread calls any other sound affecting synth function
- * (e.g. fluid_synth_noteon(), fluid_synth_cc(), etc.) it is unspecified whether the event triggered by such a call
- * will be effective in the recently synthesized audio. While this is inaudible when only requesting small chunks from the
- * synth with every call (cf. fluid_synth_get_internal_bufsize()), it will become evident when requesting larger sample chunks:
- * With larger sample chunks it will get harder for the synth to react on those spontaneously occurring events in time
- * (like events received from a MIDI driver, or directly made synth API calls).
- * In those real-time scenarios, prefer requesting smaller
- * sample chunks from the synth with each call, to avoid poor quantization of your events in the synthesized audio.
- * This issue is not applicable when using the MIDI player or sequencer for event dispatching. Also
- * refer to the documentation of \setting{audio_period-size}.
- *
- * @{
- */
-FLUIDSYNTH_API int fluid_synth_write_s16(fluid_synth_t *synth, int len,
- void *lout, int loff, int lincr,
- void *rout, int roff, int rincr);
-FLUIDSYNTH_API int fluid_synth_write_float(fluid_synth_t *synth, int len,
- void *lout, int loff, int lincr,
- void *rout, int roff, int rincr);
-FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
- float **left, float **right,
- float **fx_left, float **fx_right);
-FLUIDSYNTH_API int fluid_synth_process(fluid_synth_t *synth, int len,
- int nfx, float *fx[],
- int nout, float *out[]);
-/** @} Audio Rendering */
-
-
-/**
- * @defgroup iir_filter Effect - IIR Filter
- * @ingroup synth
- *
- * Functions for configuring the built-in IIR filter effect
- *
- * @{
- */
-
-/**
- * Specifies the type of filter to use for the custom IIR filter
- */
-enum fluid_iir_filter_type
-{
- FLUID_IIR_DISABLED = 0, /**< Custom IIR filter is not operating */
- FLUID_IIR_LOWPASS, /**< Custom IIR filter is operating as low-pass filter */
- FLUID_IIR_HIGHPASS, /**< Custom IIR filter is operating as high-pass filter */
- FLUID_IIR_LAST /**< @internal Value defines the count of filter types (#fluid_iir_filter_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
-};
-
-/**
- * Specifies optional settings to use for the custom IIR filter. Can be bitwise ORed.
- */
-enum fluid_iir_filter_flags
-{
- FLUID_IIR_Q_LINEAR = 1 << 0, /**< The Soundfont spec requires the filter Q to be interpreted in dB. If this flag is set the filter Q is instead assumed to be in a linear range */
- FLUID_IIR_Q_ZERO_OFF = 1 << 1, /**< If this flag the filter is switched off if Q == 0 (prior to any transformation) */
- FLUID_IIR_NO_GAIN_AMP = 1 << 2 /**< The Soundfont spec requires to correct the gain of the filter depending on the filter's Q. If this flag is set the filter gain will not be corrected. */
-};
-
-FLUIDSYNTH_API int fluid_synth_set_custom_filter(fluid_synth_t *, int type, int flags);
-/** @} IIR Filter */
-
-
-
-
-/**
- * @defgroup channel_setup MIDI Channel Setup
- * @ingroup synth
- *
- * The functions in this section provide interfaces to change the channel type
- * and to configure basic channels, legato and portamento setups.
- *
- * @{
- */
-
-/** @name Channel Type
- * @{
- */
-
-/**
- * The midi channel type used by fluid_synth_set_channel_type()
- */
-enum fluid_midi_channel_type
-{
- CHANNEL_TYPE_MELODIC = 0, /**< Melodic midi channel */
- CHANNEL_TYPE_DRUM = 1 /**< Drum midi channel */
-};
-
-FLUIDSYNTH_API int fluid_synth_set_channel_type(fluid_synth_t *synth, int chan, int type);
-/** @} Channel Type */
-
-
-/** @name Basic Channel Mode
- * @{
- */
-
-/**
- * Channel mode bits OR-ed together so that it matches with the midi spec: poly omnion (0), mono omnion (1), poly omnioff (2), mono omnioff (3)
- */
-enum fluid_channel_mode_flags
-{
- FLUID_CHANNEL_POLY_OFF = 0x01, /**< if flag is set, the basic channel is in mono on state, if not set poly is on */
- FLUID_CHANNEL_OMNI_OFF = 0x02, /**< if flag is set, the basic channel is in omni off state, if not set omni is on */
-};
-
-/**
- * Indicates the mode a basic channel is set to
- */
-enum fluid_basic_channel_modes
-{
- FLUID_CHANNEL_MODE_MASK = (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), /**< Mask Poly and Omni bits of #fluid_channel_mode_flags, usually only used internally */
- FLUID_CHANNEL_MODE_OMNION_POLY = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 0 */
- FLUID_CHANNEL_MODE_OMNION_MONO = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 1 */
- FLUID_CHANNEL_MODE_OMNIOFF_POLY = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 2 */
- FLUID_CHANNEL_MODE_OMNIOFF_MONO = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 3 */
- FLUID_CHANNEL_MODE_LAST /**< @internal Value defines the count of basic channel modes (#fluid_basic_channel_modes) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
-};
-
-FLUIDSYNTH_API int fluid_synth_reset_basic_channel(fluid_synth_t *synth, int chan);
-
-FLUIDSYNTH_API int fluid_synth_get_basic_channel(fluid_synth_t *synth, int chan,
- int *basic_chan_out,
- int *mode_chan_out,
- int *basic_val_out);
-FLUIDSYNTH_API int fluid_synth_set_basic_channel(fluid_synth_t *synth, int chan, int mode, int val);
-
-/** @} Basic Channel Mode */
-
-/** @name Legato Mode
- * @{
- */
-
-/**
- * Indicates the legato mode a channel is set to
- * n1,n2,n3,.. is a legato passage. n1 is the first note, and n2,n3,n4 are played legato with previous note. */
-enum fluid_channel_legato_mode
-{
- FLUID_CHANNEL_LEGATO_MODE_RETRIGGER, /**< Mode 0 - Release previous note, start a new note */
- FLUID_CHANNEL_LEGATO_MODE_MULTI_RETRIGGER, /**< Mode 1 - On contiguous notes retrigger in attack section using current value, shape attack using current dynamic and make use of previous voices if any */
- FLUID_CHANNEL_LEGATO_MODE_LAST /**< @internal Value defines the count of legato modes (#fluid_channel_legato_mode) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
-};
-
-FLUIDSYNTH_API int fluid_synth_set_legato_mode(fluid_synth_t *synth, int chan, int legatomode);
-FLUIDSYNTH_API int fluid_synth_get_legato_mode(fluid_synth_t *synth, int chan, int *legatomode);
-/** @} Legato Mode */
-
-/** @name Portamento Mode
- * @{
- */
-
-/**
- * Indicates the portamento mode a channel is set to
- */
-enum fluid_channel_portamento_mode
-{
- FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE, /**< Mode 0 - Portamento on each note (staccato or legato) */
- FLUID_CHANNEL_PORTAMENTO_MODE_LEGATO_ONLY, /**< Mode 1 - Portamento only on legato note */
- FLUID_CHANNEL_PORTAMENTO_MODE_STACCATO_ONLY, /**< Mode 2 - Portamento only on staccato note */
- FLUID_CHANNEL_PORTAMENTO_MODE_LAST /**< @internal Value defines the count of portamento modes
- @warning This symbol is not part of the public API and ABI
- stability guarantee and may change at any time! */
-};
-
-FLUIDSYNTH_API int fluid_synth_set_portamento_mode(fluid_synth_t *synth,
- int chan, int portamentomode);
-FLUIDSYNTH_API int fluid_synth_get_portamento_mode(fluid_synth_t *synth,
- int chan, int *portamentomode);
-/** @} Portamento Mode */
-
-/**@name Breath Mode
- * @{
- */
-
-/**
- * Indicates the breath mode a channel is set to
- */
-enum fluid_channel_breath_flags
-{
- FLUID_CHANNEL_BREATH_POLY = 0x10, /**< when channel is poly, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath to initial attenuation modulator */
- FLUID_CHANNEL_BREATH_MONO = 0x20, /**< when channel is mono, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath modulator */
- FLUID_CHANNEL_BREATH_SYNC = 0x40, /**< when channel is mono, this flag indicates that the breath controller(MSB)triggers noteon/noteoff on the running note */
-};
-
-FLUIDSYNTH_API int fluid_synth_set_breath_mode(fluid_synth_t *synth,
- int chan, int breathmode);
-FLUIDSYNTH_API int fluid_synth_get_breath_mode(fluid_synth_t *synth,
- int chan, int *breathmode);
-/** @} Breath Mode */
-/** @} MIDI Channel Setup */
-
-
-/** @ingroup settings */
-FLUIDSYNTH_API fluid_settings_t *fluid_synth_get_settings(fluid_synth_t *synth);
-
-/** @ingroup soundfont_loader */
-FLUIDSYNTH_API void fluid_synth_add_sfloader(fluid_synth_t *synth, fluid_sfloader_t *loader);
-
-/** @ingroup soundfont_loader */
-FLUIDSYNTH_API fluid_preset_t *fluid_synth_get_channel_preset(fluid_synth_t *synth, int chan);
-
-/** @ingroup midi_input */
-FLUIDSYNTH_API int fluid_synth_handle_midi_event(void *data, fluid_midi_event_t *event);
-
-/** @ingroup soundfonts */
-FLUIDSYNTH_API
-int fluid_synth_pin_preset(fluid_synth_t *synth, int sfont_id, int bank_num, int preset_num);
-
-/** @ingroup soundfonts */
-FLUIDSYNTH_API
-int fluid_synth_unpin_preset(fluid_synth_t *synth, int sfont_id, int bank_num, int preset_num);
-
-/** @ingroup ladspa */
-FLUIDSYNTH_API fluid_ladspa_fx_t *fluid_synth_get_ladspa_fx(fluid_synth_t *synth);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_SYNTH_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/types.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/types.h
deleted file mode 100644
index 09a8509..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/types.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_TYPES_H
-#define _FLUIDSYNTH_TYPES_H
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @defgroup Types Types
- * @brief Type declarations
- *
- * @{
- */
-
-typedef struct _fluid_hashtable_t fluid_settings_t; /**< Configuration settings instance */
-typedef struct _fluid_synth_t fluid_synth_t; /**< Synthesizer instance */
-typedef struct _fluid_voice_t fluid_voice_t; /**< Synthesis voice instance */
-typedef struct _fluid_sfloader_t fluid_sfloader_t; /**< SoundFont loader plugin */
-typedef struct _fluid_sfont_t fluid_sfont_t; /**< SoundFont */
-typedef struct _fluid_preset_t fluid_preset_t; /**< SoundFont preset */
-typedef struct _fluid_sample_t fluid_sample_t; /**< SoundFont sample */
-typedef struct _fluid_mod_t fluid_mod_t; /**< SoundFont modulator */
-typedef struct _fluid_audio_driver_t fluid_audio_driver_t; /**< Audio driver instance */
-typedef struct _fluid_file_renderer_t fluid_file_renderer_t; /**< Audio file renderer instance */
-typedef struct _fluid_player_t fluid_player_t; /**< MIDI player instance */
-typedef struct _fluid_midi_event_t fluid_midi_event_t; /**< MIDI event */
-typedef struct _fluid_midi_driver_t fluid_midi_driver_t; /**< MIDI driver instance */
-typedef struct _fluid_midi_router_t fluid_midi_router_t; /**< MIDI router instance */
-typedef struct _fluid_midi_router_rule_t fluid_midi_router_rule_t; /**< MIDI router rule */
-typedef struct _fluid_hashtable_t fluid_cmd_hash_t; /**< Command handler hash table */
-typedef struct _fluid_shell_t fluid_shell_t; /**< Command shell */
-typedef struct _fluid_server_t fluid_server_t; /**< TCP/IP shell server instance */
-typedef struct _fluid_event_t fluid_event_t; /**< Sequencer event */
-typedef struct _fluid_sequencer_t fluid_sequencer_t; /**< Sequencer instance */
-typedef struct _fluid_cmd_handler_t fluid_cmd_handler_t; /**< Shell Command Handler */
-typedef struct _fluid_ladspa_fx_t fluid_ladspa_fx_t; /**< LADSPA effects instance */
-typedef struct _fluid_file_callbacks_t fluid_file_callbacks_t; /**< Callback struct to perform custom file loading of soundfonts */
-
-typedef int fluid_istream_t; /**< Input stream descriptor */
-typedef int fluid_ostream_t; /**< Output stream descriptor */
-
-typedef short fluid_seq_id_t; /**< Unique client IDs used by the sequencer and #fluid_event_t, obtained by fluid_sequencer_register_client() and fluid_sequencer_register_fluidsynth() */
-
-#if defined(_MSC_VER) && (_MSC_VER < 1800)
-typedef __int64 fluid_long_long_t; // even on 32bit windows
-#else
-/**
- * A typedef for C99's type long long, which is at least 64-bit wide, as guaranteed by the C99.
- * @p __int64 will be used as replacement for VisualStudio 2010 and older.
- */
-typedef long long fluid_long_long_t;
-#endif
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_TYPES_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/version.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/version.h
deleted file mode 100644
index 39ba5cf..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/version.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_VERSION_H
-#define _FLUIDSYNTH_VERSION_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup misc
- *
- * @{
- */
-#define FLUIDSYNTH_VERSION "2.4.5" /**< String constant of libfluidsynth version. */
-#define FLUIDSYNTH_VERSION_MAJOR 2 /**< libfluidsynth major version integer constant. */
-#define FLUIDSYNTH_VERSION_MINOR 4 /**< libfluidsynth minor version integer constant. */
-#define FLUIDSYNTH_VERSION_MICRO 5 /**< libfluidsynth micro version integer constant. */
-
-FLUIDSYNTH_API void fluid_version(int *major, int *minor, int *micro);
-FLUIDSYNTH_API char* fluid_version_str(void);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FLUIDSYNTH_VERSION_H */
diff --git a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/voice.h b/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/voice.h
deleted file mode 100644
index 1d31cba..0000000
--- a/app/src/main/cpp/midihandler/fluidsynth/include/fluidsynth/voice.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* FluidSynth - A Software Synthesizer
- *
- * Copyright (C) 2003 Peter Hanappe and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- */
-
-#ifndef _FLUIDSYNTH_VOICE_H
-#define _FLUIDSYNTH_VOICE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup voices Voice Manipulation
- * @ingroup soundfonts
- *
- * Synthesis voice manipulation functions.
- *
- * The interface to the synthesizer's voices.
- * Examples on using them can be found in the source code of the default SoundFont
- * loader (fluid_defsfont.c).
- *
- * Most of these functions should only be called from within synthesis context,
- * such as the SoundFont loader's noteon method.
- *
- * @{
- */
-
-/**
- * Enum used with fluid_voice_add_mod() to specify how to handle duplicate modulators.
- */
-enum fluid_voice_add_mod
-{
- FLUID_VOICE_OVERWRITE, /**< Overwrite any existing matching modulator */
- FLUID_VOICE_ADD, /**< Add (sum) modulator amounts */
- FLUID_VOICE_DEFAULT /**< For default modulators only, no need to check for duplicates */
-};
-
-FLUIDSYNTH_API void fluid_voice_add_mod(fluid_voice_t *voice, fluid_mod_t *mod, int mode);
-FLUIDSYNTH_API float fluid_voice_gen_get(fluid_voice_t *voice, int gen);
-FLUIDSYNTH_API void fluid_voice_gen_set(fluid_voice_t *voice, int gen, float val);
-FLUIDSYNTH_API void fluid_voice_gen_incr(fluid_voice_t *voice, int gen, float val);
-
-FLUIDSYNTH_API unsigned int fluid_voice_get_id(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_get_channel(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_get_key(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_get_actual_key(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_get_velocity(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_get_actual_velocity(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_is_playing(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_is_on(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_is_sustained(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_is_sostenuto(const fluid_voice_t *voice);
-FLUIDSYNTH_API int fluid_voice_optimize_sample(fluid_sample_t *s);
-FLUIDSYNTH_API void fluid_voice_update_param(fluid_voice_t *voice, int gen);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _FLUIDSYNTH_VOICE_H */
-
diff --git a/app/src/main/cpp/midihandler/midihandler.c b/app/src/main/cpp/midihandler/midihandler.c
deleted file mode 100644
index fb10f45..0000000
--- a/app/src/main/cpp/midihandler/midihandler.c
+++ /dev/null
@@ -1,164 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define FLUIDSYNTH_SAMPLE_RATE 44100
-#define FLUIDSYNTH_LATENCY 40
-#define LATENCY_MILLIS_TO_BUFFER_SIZE(ms) (FLUIDSYNTH_SAMPLE_RATE * ms / 1000.0)
-
-#define println(...) __android_log_print(ANDROID_LOG_DEBUG, "System.out", __VA_ARGS__)
-
-typedef struct MIDIHandler {
- fluid_settings_t* settings;
- fluid_synth_t* synth;
- fluid_audio_driver_t* driver;
- int soundfontId;
-} MIDIHandler;
-
-static void setAudioLatency(fluid_settings_t* settings, int ms) {
- double periodSize = LATENCY_MILLIS_TO_BUFFER_SIZE(ms);
- fluid_settings_setnum(settings, "audio.period-size", periodSize);
- fluid_settings_setint(settings, "audio.periods", 2);
-}
-
-static MIDIHandler* MIDIHandler_allocate() {
- fluid_settings_t* settings = new_fluid_settings();
- if (!settings) return NULL;
- fluid_settings_setint(settings, "synth.cpu-cores", 4);
- fluid_settings_setnum(settings, "synth.gain", 0.6f);
- fluid_settings_setstr(settings, "audio.oboe.performance-mode", "LowLatency");
- fluid_settings_setstr(settings, "audio.oboe.sharing-mode", "Exclusive");
- fluid_settings_setnum(settings, "synth.sample-rate", FLUIDSYNTH_SAMPLE_RATE);
-
- setAudioLatency(settings, FLUIDSYNTH_LATENCY);
-
- fluid_synth_t* synth = new_fluid_synth(settings);
- if (!synth) {
- delete_fluid_settings(settings);
- return NULL;
- }
-
- fluid_audio_driver_t* driver = new_fluid_audio_driver(settings, synth);
- if (!driver) {
- delete_fluid_synth(synth);
- delete_fluid_settings(settings);
- return NULL;
- }
-
- MIDIHandler* midiHandler = calloc(1, sizeof(MIDIHandler));
- midiHandler->settings = settings;
- midiHandler->synth = synth;
- midiHandler->driver = driver;
- midiHandler->soundfontId = -1;
- return midiHandler;
-}
-
-static void MIDIHandler_destroy(MIDIHandler* midiHandler) {
- if (!midiHandler) return;
- if (midiHandler->soundfontId != -1) fluid_synth_sfunload(midiHandler->synth, midiHandler->soundfontId, 1);
- delete_fluid_audio_driver(midiHandler->driver);
- delete_fluid_synth(midiHandler->synth);
- delete_fluid_settings(midiHandler->settings);
- free(midiHandler);
-}
-
-static void MIDIHandler_noteOn(MIDIHandler* midiHandler, int channel, int note, int velocity) {
- if (!midiHandler) return;
- fluid_synth_noteon(midiHandler->synth, channel, note, velocity);
-}
-
-static void MIDIHandler_noteOff(MIDIHandler* midiHandler, int channel, int note) {
- if (!midiHandler) return;
- fluid_synth_noteoff(midiHandler->synth, channel, note);
-}
-
-static void MIDIHandler_keyPressure(MIDIHandler* midiHandler, int channel, int key, int value) {
- if (!midiHandler) return;
- fluid_synth_key_pressure(midiHandler->synth, channel, key, value);
-}
-
-static void MIDIHandler_programChange(MIDIHandler* midiHandler, int channel, int program) {
- if (!midiHandler) return;
- fluid_synth_program_change(midiHandler->synth, channel, program);
-}
-
-static void MIDIHandler_controlChange(MIDIHandler* midiHandler, int channel, int control, int value) {
- if (!midiHandler) return;
- fluid_synth_cc(midiHandler->synth, channel, control, value);
-}
-
-static void MIDIHandler_pitchBend(MIDIHandler* midiHandler, int channel, int value) {
- if (!midiHandler) return;
- fluid_synth_pitch_bend(midiHandler->synth, channel, value);
-}
-
-static void MIDIHandler_loadSoundFont(MIDIHandler* midiHandler, const char* path) {
- if (!midiHandler) return;
- midiHandler->soundfontId = -1;
- int id = fluid_synth_sfload(midiHandler->synth, path, 0);
- if (id != FLUID_FAILED) {
- midiHandler->soundfontId = id;
- for (int i = 0; i < 16; i++) {
- fluid_synth_sfont_select(midiHandler->synth, i, id);
- fluid_synth_program_change(midiHandler->synth, i, 0);
- }
- }
-}
-
-JNIEXPORT jlong JNICALL
-Java_com_winlator_winhandler_MIDIHandler_nativeAllocate(JNIEnv *env, jobject obj) {
- MIDIHandler* midiHandler = MIDIHandler_allocate();
- return (jlong)midiHandler;
-}
-
-JNIEXPORT void JNICALL
-Java_com_winlator_winhandler_MIDIHandler_destroy(JNIEnv *env, jobject obj,
- jlong nativePtr) {
- MIDIHandler_destroy((MIDIHandler*)nativePtr);
-}
-
-JNIEXPORT void JNICALL
-Java_com_winlator_winhandler_MIDIHandler_noteOn(JNIEnv *env, jobject obj, jlong nativePtr,
- jint channel, jint note, jint velocity) {
- MIDIHandler_noteOn((MIDIHandler*)nativePtr, channel, note, velocity);
-}
-
-JNIEXPORT void JNICALL
-Java_com_winlator_winhandler_MIDIHandler_noteOff(JNIEnv *env, jobject obj, jlong nativePtr,
- jint channel, jint note) {
- MIDIHandler_noteOff((MIDIHandler*)nativePtr, channel, note);
-}
-
-JNIEXPORT void JNICALL
-Java_com_winlator_winhandler_MIDIHandler_loadSoundFont(JNIEnv *env, jobject obj, jlong nativePtr,
- jstring soundfontPath) {
- const char* path = (*env)->GetStringUTFChars(env, soundfontPath, NULL);
- MIDIHandler_loadSoundFont((MIDIHandler*)nativePtr, path);
-}
-
-JNIEXPORT void JNICALL
-Java_com_winlator_winhandler_MIDIHandler_programChange(JNIEnv *env, jobject obj, jlong nativePtr,
- jint channel, jint program) {
- MIDIHandler_programChange((MIDIHandler*)nativePtr, channel, program);
-}
-
-JNIEXPORT void JNICALL
-Java_com_winlator_winhandler_MIDIHandler_controlChange(JNIEnv *env, jobject obj, jlong nativePtr,
- jint channel, jint control, jint value) {
- MIDIHandler_controlChange((MIDIHandler*)nativePtr, channel, control, value);
-}
-
-JNIEXPORT void JNICALL
-Java_com_winlator_winhandler_MIDIHandler_pitchBend(JNIEnv *env, jobject obj, jlong nativePtr,
- jint channel, jint value) {
- MIDIHandler_pitchBend((MIDIHandler*)nativePtr, channel, value);
-}
-
-JNIEXPORT void JNICALL
-Java_com_winlator_winhandler_MIDIHandler_keyPressure(JNIEnv *env, jobject obj, jlong nativePtr,
- jint channel, jint key, jint value) {
- MIDIHandler_keyPressure((MIDIHandler*)nativePtr, channel, key, value);
-}
\ No newline at end of file
diff --git a/app/src/main/cpp/proot/CMakeLists.txt b/app/src/main/cpp/proot/CMakeLists.txt
deleted file mode 100644
index e9090b7..0000000
--- a/app/src/main/cpp/proot/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-cmake_minimum_required(VERSION 3.22.1)
-
-project(PRoot)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wno-unused-function -Wimplicit-function-declaration")
-
-add_library(talloc STATIC
- talloc/talloc.c)
-
-include_directories(src
- talloc)
-
-add_executable(libproot.so
- src/cli/cli.c
- src/cli/proot.c
- src/cli/note.c
- src/execve/enter.c
- src/execve/exit.c
- src/execve/elf.c
- src/execve/auxv.c
- src/path/binding.c
- src/path/glue.c
- src/path/canon.c
- src/path/path.c
- src/path/proc.c
- src/path/temp.c
- src/syscall/seccomp.c
- src/syscall/syscall.c
- src/syscall/chain.c
- src/syscall/enter.c
- src/syscall/exit.c
- src/syscall/sysnum.c
- src/syscall/socket.c
- src/syscall/heap.c
- src/syscall/rlimit.c
- src/tracee/tracee.c
- src/tracee/mem.c
- src/tracee/reg.c
- src/tracee/event.c
- src/tracee/seccomp.c
- src/ptrace/ptrace.c
- src/ptrace/wait.c)
-
-target_link_libraries(libproot.so
- talloc)
-
-add_library(proot-loader SHARED
- src/loader/loader.c)
\ No newline at end of file
diff --git a/app/src/main/cpp/proot/src/COPYING b/app/src/main/cpp/proot/src/COPYING
deleted file mode 100644
index 1f127a0..0000000
--- a/app/src/main/cpp/proot/src/COPYING
+++ /dev/null
@@ -1,372 +0,0 @@
-The copyright holder for PRoot and CARE is STMicroelectronics, these
-tools are developed in the Compilation Expertise Center by:
-
-Cédric VINCENT
- Original author, maintainer.
-
-Rémi DURAFFORT
- Improved the -0 feature, many experiments, bug reports, fixes, and articles.
-
-Christophe GUILLON
- Improved CARE, plugin experiments, bug reports, and fixes.
-
-Yves JANIN
- Support for the i386 architecture, many experiments and bug reports.
-
-Antoine MOYNAULT
- Many experiments and bug reports.
-
-Claire ROBINE
- Many bug fixes.
-
-Clément BAZIN
- Plugins interface, dependency tracker plugin, and bug reports.
-
-Christian BERTIN
- Valuable support.
-
-Denis FERRANTI
- Valuable support.
-
-Paul GHALEB
- User manual review.
-
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/app/src/main/cpp/proot/src/arch.h b/app/src/main/cpp/proot/src/arch.h
deleted file mode 100644
index 64ad5ef..0000000
--- a/app/src/main/cpp/proot/src/arch.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef ARCH_H
-#define ARCH_H
-
-#ifndef NO_LIBC_HEADER
-#include /* linux.git:c0a3a20b */
-#include /* AUDIT_ARCH_*, */
-#endif
-
-typedef unsigned long word_t;
-typedef unsigned char byte_t;
-
-#define SYSCALL_AVOIDER ((word_t) -1)
-#define SYSTRAP_NUM SYSARG_NUM
-#define STACK_ALIGNMENT 16
-
-#if defined(__ARM_EABI__)
- #define ARCH_ARM_EABI 1
-#elif defined(__aarch64__)
- #define ARCH_ARM64 1
-#elif defined(__arm__)
- #error "Only EABI is currently supported for ARM"
-#else
- #error "Unsupported architecture"
-#endif
-
-/* Architecture specific definitions. */
-#if defined(ARCH_ARM_EABI)
-
- #define SYSNUMS_HEADER1 "syscall/sysnums-arm.h"
- #define SYSNUMS_ABI1 sysnums_arm
-
- #define SYSTRAP_SIZE 4
-
- #define SECCOMP_ARCHS { { .value = AUDIT_ARCH_ARM, .nb_abis = 1, .abis = { ABI_DEFAULT } } }
-
- #define user_regs_struct user_regs
- #define HOST_ELF_MACHINE {40, 0};
- #define RED_ZONE_SIZE 0
- #define OFFSETOF_STAT_UID_32 0
- #define OFFSETOF_STAT_GID_32 0
- #define EM_ARM 40
-
- #define LOADER_ADDRESS 0x20000000
-
- #define EXEC_PIC_ADDRESS 0x0f000000
- #define INTERP_PIC_ADDRESS 0x1f000000
-
-#elif defined(ARCH_ARM64)
-
- #define SYSNUMS_HEADER1 "syscall/sysnums-arm64.h"
- #define SYSNUMS_HEADER2 "syscall/sysnums-arm.h"
-
- #define SYSNUMS_ABI1 sysnums_arm64
- #define SYSNUMS_ABI2 sysnums_arm
-
- #define SYSTRAP_SIZE 4
-
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-
- #define SECCOMP_ARCHS { \
- { .value = AUDIT_ARCH_AARCH64, .nb_abis = 1, .abis = { ABI_DEFAULT } }, \
- { .value = AUDIT_ARCH_ARM, .nb_abis = 1, .abis = { ABI_2 } }, \
- }
-
- #define HOST_ELF_MACHINE {183, 0};
- #define RED_ZONE_SIZE 0
- #define OFFSETOF_STAT_UID_32 24
- #define OFFSETOF_STAT_GID_32 28
-
- #define LOADER_ADDRESS 0x2000000000
- #define EXEC_PIC_ADDRESS 0x3000000000
- #define INTERP_PIC_ADDRESS 0x3f00000000
-
- #define HAS_LOADER_32BIT true
- #define EXEC_PIC_ADDRESS_32 0x0f000000
- #define INTERP_PIC_ADDRESS_32 0x1f000000
-
-#endif
-
-#endif /* ARCH_H */
diff --git a/app/src/main/cpp/proot/src/attribute.h b/app/src/main/cpp/proot/src/attribute.h
deleted file mode 100644
index f772954..0000000
--- a/app/src/main/cpp/proot/src/attribute.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef ATTRIBUTE_H
-#define ATTRIBUTE_H
-
-#define UNUSED __attribute__((unused))
-#define FORMAT(a, b, c) __attribute__ ((format (a, b, c)))
-#define DONT_INSTRUMENT __attribute__((no_instrument_function))
-#define PACKED __attribute__((packed))
-#define WEAK __attribute__((weak))
-
-#endif /* ATTRIBUTE_H */
diff --git a/app/src/main/cpp/proot/src/cli/cli.c b/app/src/main/cpp/proot/src/cli/cli.c
deleted file mode 100644
index a8f8bd2..0000000
--- a/app/src/main/cpp/proot/src/cli/cli.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* printf(3), */
-#include /* bool, true, false, */
-#include /* ARG_MAX, PATH_MAX, */
-#include /* str*(3), basename(3), */
-#include /* talloc*, */
-#include /* exit(3), EXIT_*, strtol(3), {g,s}etenv(3), */
-#include /* assert(3), */
-#include /* getpid(2), */
-#include /* getpid(2), */
-#include /* errno(3), */
-#include /* INT_MAX, */
-
-#include "cli/cli.h"
-#include "cli/note.h"
-#include "tracee/tracee.h"
-#include "tracee/event.h"
-#include "path/binding.h"
-#include "path/canon.h"
-#include "path/path.h"
-
-/**
- * Print a (@detailed) usage of PRoot.
- */
-void print_usage(Tracee *tracee, const Cli *cli, bool detailed)
-{
- const char *current_class = "none";
- const Option *options;
- size_t i, j;
-
-#define DETAIL(a) if (detailed) a
-
- DETAIL(printf("%s %s: %s.\n\n", cli->name, cli->version, cli->subtitle));
- printf("Usage:\n %s\n", cli->synopsis);
- DETAIL(printf("\n"));
-
- options = cli->options;
- for (i = 0; options[i].class != NULL; i++) {
- for (j = 0; ; j++) {
- const Argument *argument = &(options[i].arguments[j]);
-
- if (!argument->name || (!detailed && j != 0)) {
- DETAIL(printf("\n"));
- printf("\t%s\n", options[i].description);
- if (detailed) {
- if (options[i].detail[0] != '\0')
- printf("\n%s\n\n", options[i].detail);
- else
- printf("\n");
- }
- break;
- }
-
- if (strcmp(options[i].class, current_class) != 0) {
- current_class = options[i].class;
- printf("\n%s:\n", current_class);
- }
-
- if (j == 0)
- printf(" %s", argument->name);
- else
- printf(", %s", argument->name);
-
- if (argument->separator != '\0')
- printf("%c*%s*", argument->separator, argument->value);
- else if (!detailed)
- printf("\t");
- }
- }
-
- if (detailed)
- printf("%s\n", cli->colophon);
-}
-
-/**
- * Print the version of PRoot.
- */
-void print_version(const Cli *cli)
-{
- printf("%s %s\n\n", cli->logo, cli->version);
-}
-
-static void print_execve_help(const Tracee *tracee, const char *argv0, int status)
-{
- note(tracee, ERROR, SYSTEM, "execve(\"%s\")", argv0);
-
- note(tracee, INFO, USER, "possible causes:\n"
-" * the program is a script but its interpreter (eg. /bin/sh) was not found;\n"
-" * the program is an ELF but its interpreter (eg. ld-linux.so) was not found;\n"
-" * the loader was not found or doesn't work.");
-}
-
-static void print_error_separator(const Tracee *tracee, const Argument *argument)
-{
- if (argument->separator == '\0')
- note(tracee, ERROR, USER, "option '%s' expects no value.", argument->name);
- else
- note(tracee, ERROR, USER, "option '%s' and its value must be separated by '%c'.",
- argument->name, argument->separator);
-}
-
-static void print_argv(const Tracee *tracee, const char *prompt, char *const argv[])
-{
- char string[ARG_MAX] = "";
- size_t i;
-
- if (!argv)
- return;
-
-#define APPEND(post) \
- do { \
- ssize_t length = sizeof(string) - (strlen(string) + strlen(post)); \
- if (length <= 0) \
- return; \
- strncat(string, post, length); \
- } while (0)
-
- APPEND(prompt);
- APPEND(" =");
- for (i = 0; argv[i] != NULL; i++) {
- APPEND(" ");
- APPEND(argv[i]);
- }
- string[sizeof(string) - 1] = '\0';
-
-#undef APPEND
-
- note(tracee, INFO, USER, "%s", string);
-}
-
-static void print_config(Tracee *tracee, char *const argv[])
-{
- assert(tracee != NULL);
-
- if (tracee->verbose <= 0)
- return;
-
- if (tracee->glue)
- note(tracee, INFO, USER, "glue rootfs = %s", tracee->glue);
-
- note(tracee, INFO, USER, "exe = %s", tracee->exe);
- print_argv(tracee, "argv", argv);
- note(tracee, INFO, USER, "initial cwd = %s", tracee->fs->cwd);
- note(tracee, INFO, USER, "verbose level = %d", tracee->verbose);
-}
-
-/**
- * Initialize @tracee's current working directory. This function
- * returns -1 if an error occurred, otherwise 0.
- */
-static int initialize_cwd(Tracee *tracee)
-{
- char path2[PATH_MAX];
- char path[PATH_MAX];
- int status;
-
- /* Compute the base directory. */
- if (tracee->fs->cwd[0] != '/') {
- strcpy(path, "/");
- }
- else
- strcpy(path, tracee->fs->cwd);
-
- /* The ending "." ensures canonicalize() will report an error
- * if tracee->fs->cwd does not exist or if it is not a
- * directory. */
- join_paths(path2, path, ".");
-
- /* Initiate state for canonicalization. */
- strcpy(path, "/");
-
- status = canonicalize(tracee, path2, true, path, 0);
- if (status < 0) {
- note(tracee, WARNING, USER, "can't chdir(\"%s\") in the guest rootfs: %s",
- path2, strerror(-status));
- note(tracee, INFO, USER, "default working directory is now \"/\"");
- strcpy(path, "/");
- }
- chop_finality(path);
-
- /* Replace with the canonicalized working directory. */
- TALLOC_FREE(tracee->fs->cwd);
- tracee->fs->cwd = talloc_strdup(tracee->fs, path);
- if (tracee->fs->cwd == NULL)
- return -1;
- talloc_set_name_const(tracee->fs->cwd, "$cwd");
-
- /* Keep this special environment variable consistent. */
- setenv("PWD", path, 1);
-
- return 0;
-}
-
-/**
- * Initialize @tracee->exe from @exe, i.e. canonicalize it from a
- * guest point-of-view.
- */
-static int initialize_exe(Tracee *tracee, const char *exe)
-{
- char path[PATH_MAX];
- int status;
-
- status = which(tracee, tracee->reconf.paths, path, exe ?: "/bin/sh");
- if (status < 0)
- return -1;
-
- status = detranslate_path(tracee, path, NULL);
- if (status < 0)
- return -1;
-
- tracee->exe = talloc_strdup(tracee, path);
- if (tracee->exe == NULL)
- return -1;
- talloc_set_name_const(tracee->exe, "$exe");
-
- return 0;
-}
-
-/**
- * Configure @tracee according to the command-line arguments stored in
- * @argv[]. This function returns the index in @argv[] of the command
- * to launch, otherwise -1 if an error occured.
- */
-static int parse_config(Tracee *tracee, size_t argc, char *const argv[])
-{
- option_handler_t handler = NULL;
- const Option *options;
- const Cli *cli = NULL;
- size_t argc_offset;
- size_t i, j, k;
- int status;
-
- /* Unknown tool name? Default to PRoot. */
- if (cli == NULL)
- cli = get_proot_cli(tracee->ctx);
-
- if (argc == 1) {
- print_usage(tracee, cli, false);
- return -1;
- }
-
- for (i = 1; i < argc; i++) {
- const char *arg = argv[i];
-
- /* The current argument is the value of a short option. */
- if (handler != NULL) {
- status = handler(tracee, cli, arg);
- if (status < 0)
- return -1;
- handler = NULL;
- continue;
- }
-
- if (arg[0] != '-')
- break; /* End of PRoot options. */
-
- options = cli->options;
- for (j = 0; options[j].class != NULL; j++) {
- const Option *option = &options[j];
-
- /* A given option has several aliases. */
- for (k = 0; ; k++) {
- const Argument *argument;
- size_t length;
-
- argument = &option->arguments[k];
-
- /* End of aliases for this option. */
- if (!argument->name)
- break;
-
- length = strlen(argument->name);
- if (strncmp(arg, argument->name, length) != 0)
- continue;
-
- /* Avoid ambiguities. */
- if (strlen(arg) > length
- && arg[length] != argument->separator) {
- print_error_separator(tracee, argument);
- return -1;
- }
-
- /* No option value. */
- if (!argument->value) {
- status = option->handler(tracee, cli, NULL);
- if (status < 0)
- return -1;
- goto known_option;
- }
-
- /* Value coalesced with to its option. */
- if (argument->separator == arg[length]) {
- assert(strlen(arg) >= length);
- status = option->handler(tracee, cli, &arg[length + 1]);
- if (status < 0)
- return -1;
- goto known_option;
- }
-
- /* Avoid ambiguities. */
- if (argument->separator != ' ') {
- print_error_separator(tracee, argument);
- return -1;
- }
-
- /* Short option with a separated value. */
- handler = option->handler;
- goto known_option;
- }
- }
-
- note(tracee, ERROR, USER, "unknown option '%s'.", arg);
- return -1;
-
- known_option:
- if (handler != NULL && i == argc - 1) {
- note(tracee, ERROR, USER, "missing value for option '%s'.", arg);
- return -1;
- }
- }
- argc_offset = i;
-
- status = pre_initialize_bindings(tracee, cli);
- if (status < 0)
- return -1;
-
- /* The guest rootfs is now known: bindings specified by the
- * user (tracee->bindings.user) can be canonicalized. */
- status = initialize_bindings(tracee);
- if (status < 0)
- return -1;
-
- /* Bindings are now installed (tracee->bindings.guest &
- * tracee->bindings.host): the current working directory can
- * be canonicalized. */
- status = initialize_cwd(tracee);
- if (status < 0)
- return -1;
-
- /* Bindings are now installed and the current working
- * directory is canonicalized: resolve path to @tracee->exe
- * and configure @tracee->cmdline. */
- status = initialize_exe(tracee, argv[argc_offset]);
- if (status < 0)
- return -1;
-
- print_config(tracee, &argv[argc_offset]);
-
- return argc_offset;
-}
-
-bool exit_failure = true;
-
-int main(int argc, char *const argv[])
-{
- Tracee *tracee;
- int status;
-
- /* Configure the memory allocator. */
- talloc_enable_leak_report();
-
-#if defined(TALLOC_VERSION_MAJOR) && TALLOC_VERSION_MAJOR >= 2
- talloc_set_log_stderr();
-#endif
-
- /* Pre-create the first tracee (pid == 0). */
- tracee = get_tracee(NULL, 0, true);
- if (tracee == NULL)
- goto error;
- tracee->pid = getpid();
-
- /* Set verboseness from env variable, may be overriden by option */
- {
- const char *verbose_env = getenv("PROOT_VERBOSE");
- if (verbose_env != NULL) {
- tracee->verbose = strtol(verbose_env, NULL, 10);
- global_verbose_level = tracee->verbose;
- }
- }
-
- /* Pre-configure the first tracee. */
- status = parse_config(tracee, argc, argv);
- if (status < 0)
- goto error;
-
- /* Start the first tracee. */
- status = launch_process(tracee, &argv[status]);
- if (status < 0) {
- print_execve_help(tracee, tracee->exe, status);
- goto error;
- }
-
- /* Start tracing the first tracee and all its children. */
- exit(event_loop());
-
-error:
- TALLOC_FREE(tracee);
-
- if (exit_failure) {
- exit(EXIT_FAILURE);
- }
- else
- exit(EXIT_SUCCESS);
-}
-
-/**
- * Convert @value into an integer, then put the result into
- * *@variable. This function prints a warning and returns -1 if a
- * conversion error occured, otherwise it returns 0.
- */
-int parse_integer_option(const Tracee *tracee, int *variable, const char *value, const char *option)
-{
- char *end_ptr = NULL;
-
- errno = 0;
- *variable = strtol(value, &end_ptr, 10);
- if (errno != 0 || end_ptr == value) {
- note(tracee, ERROR, USER, "option `%s` expects an integer value.", option);
- return -1;
- }
-
- return 0;
-}
diff --git a/app/src/main/cpp/proot/src/cli/cli.h b/app/src/main/cpp/proot/src/cli/cli.h
deleted file mode 100644
index 6827fb8..0000000
--- a/app/src/main/cpp/proot/src/cli/cli.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* This file is automatically generated from the documentation. EDIT AT YOUR OWN RISK. */
-
-#ifndef CLI_H
-#define CLI_H
-
-#include
-#include "tracee/tracee.h"
-#include "attribute.h"
-
-typedef struct {
- const char *name;
- char separator;
- const char *value;
-} Argument;
-
-struct Cli;
-typedef int (*option_handler_t)(Tracee *tracee, const struct Cli *cli, const char *value);
-
-typedef struct {
- const char *class;
- option_handler_t handler;
- const char *description;
- const char *detail;
- Argument arguments[5];
-} Option;
-
-#define END_OF_OPTIONS { .class = NULL, \
- .arguments = {{ .name = NULL, .separator = '\0', .value = NULL }}, \
- .handler = NULL, \
- .description = NULL, \
- .detail = NULL \
- }
-
-typedef struct Cli {
- const char *name;
- const char *version;
- const char *subtitle;
- const char *synopsis;
- const char *colophon;
- const char *logo;
-
- void *private;
-
- const Option options[];
-} Cli;
-
-extern int pre_initialize_bindings(Tracee *, const Cli *);
-extern const Cli *get_proot_cli(TALLOC_CTX *context);
-
-extern void print_usage(Tracee *tracee, const Cli *cli, bool detailed);
-extern void print_version(const Cli *cli);
-extern int parse_integer_option(const Tracee *tracee, int *variable, const char *value, const char *option);
-
-extern bool exit_failure;
-
-#endif /* CLI_H */
diff --git a/app/src/main/cpp/proot/src/cli/note.c b/app/src/main/cpp/proot/src/cli/note.c
deleted file mode 100644
index aad7f1d..0000000
--- a/app/src/main/cpp/proot/src/cli/note.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* errno, */
-#include /* strerror(3), */
-#include /* va_*, */
-#include /* vfprintf(3), */
-#include /* INT_MAX, */
-
-#include "cli/note.h"
-#include "tracee/tracee.h"
-
-int global_verbose_level;
-const char *global_tool_name;
-
-/**
- * Print @message to the standard error stream according to its
- * @severity and @origin.
- */
-void note(const Tracee *tracee, Severity severity, Origin origin, const char *message, ...)
-{
- const char *tool_name;
- va_list extra_params;
- int verbose_level;
-
- tool_name = global_tool_name ?: "";
- if (tracee == NULL) {
- verbose_level = global_verbose_level;
- }
- else
- verbose_level = tracee->verbose;
-
- if (verbose_level < 0 && severity != ERROR)
- return;
-
- switch (severity) {
- case WARNING:
- fprintf(stderr, "%s warning: ", tool_name);
- break;
-
- case ERROR:
- fprintf(stderr, "%s error: ", tool_name);
- break;
-
- case INFO:
- default:
- fprintf(stderr, "%s info: ", tool_name);
- break;
- }
-
- if (origin == TALLOC)
- fprintf(stderr, "talloc: ");
-
- va_start(extra_params, message);
- vfprintf(stderr, message, extra_params);
- va_end(extra_params);
-
- switch (origin) {
- case SYSTEM:
- fprintf(stderr, ": ");
- perror(NULL);
- break;
-
- case TALLOC:
- break;
-
- case INTERNAL:
- case USER:
- default:
- fprintf(stderr, "\n");
- break;
- }
-
- return;
-}
-
diff --git a/app/src/main/cpp/proot/src/cli/note.h b/app/src/main/cpp/proot/src/cli/note.h
deleted file mode 100644
index 8c73f84..0000000
--- a/app/src/main/cpp/proot/src/cli/note.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef NOTE_H
-#define NOTE_H
-
-#include "tracee/tracee.h"
-#include "attribute.h"
-
-/* Specify where a notice is coming from. */
-typedef enum {
- SYSTEM,
- INTERNAL,
- USER,
- TALLOC,
-} Origin;
-
-/* Specify the severity of a notice. */
-typedef enum {
- ERROR,
- WARNING,
- INFO,
-} Severity;
-
-#define VERBOSE(tracee, level, message, args...) do { \
- if (tracee == NULL || tracee->verbose >= (level)) \
- note(tracee, INFO, INTERNAL, (message), ## args); \
- } while (0)
-
-extern void note(const Tracee *tracee, Severity severity, Origin origin, const char *message, ...) FORMAT(printf, 4, 5);
-
-extern int global_verbose_level;
-extern const char *global_tool_name;
-
-#endif /* NOTE_H */
diff --git a/app/src/main/cpp/proot/src/cli/proot.c b/app/src/main/cpp/proot/src/cli/proot.c
deleted file mode 100644
index eb7c4e5..0000000
--- a/app/src/main/cpp/proot/src/cli/proot.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* str*(3), */
-#include /* assert(3), */
-#include /* printf(3), fflush(3), */
-#include /* write(2), */
-
-#include "cli/cli.h"
-#include "cli/note.h"
-#include "path/binding.h"
-#include "attribute.h"
-
-/* These should be included last. */
-#include "cli/proot.h"
-
-char *root_path = NULL;
-
-static int handle_option_r(Tracee *tracee, const Cli *cli UNUSED, const char *value)
-{
- Binding *binding;
-
- /* ``chroot $PATH`` is semantically equivalent to ``mount
- * --bind $PATH /``. */
- binding = new_binding(tracee, value, "/", true);
- if (binding == NULL)
- return -1;
-
- root_path = binding->host.path;
- return 0;
-}
-
-static int handle_option_b(Tracee *tracee, const Cli *cli UNUSED, const char *value)
-{
- char *host;
- char *guest;
-
- host = talloc_strdup(tracee->ctx, value);
- if (host == NULL) {
- note(tracee, ERROR, INTERNAL, "can't allocate memory");
- return -1;
- }
-
- guest = strchr(host, ':');
- if (guest != NULL) {
- *guest = '\0';
- guest++;
- }
-
- new_binding(tracee, host, guest, true);
- return 0;
-}
-
-static int handle_option_w(Tracee *tracee, const Cli *cli UNUSED, const char *value)
-{
- tracee->fs->cwd = talloc_strdup(tracee->fs, value);
- if (tracee->fs->cwd == NULL)
- return -1;
- talloc_set_name_const(tracee->fs->cwd, "$cwd");
- return 0;
-}
-
-static int handle_option_kill_on_exit(Tracee *tracee, const Cli *cli UNUSED, const char *value UNUSED)
-{
- tracee->killall_on_exit = true;
- return 0;
-}
-
-static int handle_option_v(Tracee *tracee, const Cli *cli UNUSED, const char *value)
-{
- int status;
-
- status = parse_integer_option(tracee, &tracee->verbose, value, "-v");
- if (status < 0)
- return status;
-
- global_verbose_level = tracee->verbose;
- return 0;
-}
-
-extern unsigned char WEAK _binary_licenses_start;
-extern unsigned char WEAK _binary_licenses_end;
-
-static int handle_option_V(Tracee *tracee UNUSED, const Cli *cli, const char *value UNUSED)
-{
- size_t size;
-
- print_version(cli);
- printf("\n%s\n", cli->colophon);
- fflush(stdout);
-
- size = &_binary_licenses_end - &_binary_licenses_start;
- if (size > 0)
- write(1, &_binary_licenses_start, size);
-
- exit_failure = false;
- return -1;
-}
-
-static int handle_option_h(Tracee *tracee, const Cli *cli, const char *value UNUSED)
-{
- print_usage(tracee, cli, true);
- exit_failure = false;
- return -1;
-}
-
-/**
- * Initialize @tracee's fields that are mandatory for PRoot but that
- * are not required on the command line, i.e. "-w" and "-r".
- */
-int pre_initialize_bindings(Tracee *tracee, const Cli *cli)
-{
- int status;
-
- /* Default to "." if no CWD were specified. */
- if (tracee->fs->cwd == NULL) {
- status = handle_option_w(tracee, cli, ".");
- if (status < 0)
- return -1;
- }
-
- /* The default guest rootfs is "/" if none was specified. */
- if (root_path == NULL) {
- status = handle_option_r(tracee, cli, "/");
- if (status < 0)
- return -1;
- }
-
- return 0;
-}
-
-const Cli *get_proot_cli(TALLOC_CTX *context UNUSED)
-{
- global_tool_name = proot_cli.name;
- return &proot_cli;
-}
diff --git a/app/src/main/cpp/proot/src/cli/proot.h b/app/src/main/cpp/proot/src/cli/proot.h
deleted file mode 100644
index 4ba5628..0000000
--- a/app/src/main/cpp/proot/src/cli/proot.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* This file is automatically generated from the documentation. EDIT AT YOUR OWN RISK. */
-
-#ifndef PROOT_CLI_H
-#define PROOT_CLI_H
-
-#include "cli/cli.h"
-
-#ifndef VERSION
-#define VERSION "5.1.0"
-#endif
-
-static int handle_option_r(Tracee *tracee, const Cli *cli, const char *value);
-static int handle_option_b(Tracee *tracee, const Cli *cli, const char *value);
-static int handle_option_w(Tracee *tracee, const Cli *cli, const char *value);
-static int handle_option_v(Tracee *tracee, const Cli *cli, const char *value);
-static int handle_option_V(Tracee *tracee, const Cli *cli, const char *value);
-static int handle_option_h(Tracee *tracee, const Cli *cli, const char *value);
-static int handle_option_kill_on_exit(Tracee *tracee, const Cli *cli, const char *value);
-
-static Cli proot_cli = {
- .version = VERSION,
- .name = "proot",
- .subtitle = "chroot, mount --bind, and binfmt_misc without privilege/setup",
- .synopsis = "proot [option] ... [command]",
- .colophon = "Visit http://proot.me for help, bug reports, suggestions, patchs, ...\n\
-Copyright (C) 2015 STMicroelectronics, licensed under GPL v2 or later.",
- .logo = "\
- _____ _____ ___\n\
-| __ \\ __ \\_____ _____| |_\n\
-| __/ / _ \\/ _ \\ _|\n\
-|__| |__|__\\_____/\\_____/\\____|",
-
- .options = {
- { .class = "Regular options",
- .arguments = {
- { .name = "-r", .separator = ' ', .value = "path" },
- { .name = "--rootfs", .separator = '=', .value = "path" },
- { .name = NULL, .separator = '\0', .value = NULL } },
- .handler = handle_option_r,
- .description = "Use *path* as the new guest root file-system, default is /.",
- .detail = "\tThe specified path typically contains a Linux distribution where\n\
-\tall new programs will be confined. The default rootfs is /\n\
-\twhen none is specified, this makes sense when the bind mechanism\n\
-\tis used to relocate host files and directories, see the -b\n\
-\toption and the Examples section for details.\n\
-\t\n\
-\tIt is recommended to use the -R or -S options instead.",
- },
- { .class = "Regular options",
- .arguments = {
- { .name = "-b", .separator = ' ', .value = "path" },
- { .name = "--bind", .separator = '=', .value = "path" },
- { .name = "-m", .separator = ' ', .value = "path" },
- { .name = "--mount", .separator = '=', .value = "path" },
- { .name = NULL, .separator = '\0', .value = NULL } },
- .handler = handle_option_b,
- .description = "Make the content of *path* accessible in the guest rootfs.",
- .detail = "\tThis option makes any file or directory of the host rootfs\n\
-\taccessible in the confined environment just as if it were part of\n\
-\tthe guest rootfs. By default the host path is bound to the same\n\
-\tpath in the guest rootfs but users can specify any other location\n\
-\twith the syntax: -b *host_path*:*guest_location*. If the\n\
-\tguest location is a symbolic link, it is dereferenced to ensure\n\
-\tthe new content is accessible through all the symbolic links that\n\
-\tpoint to the overlaid content. In most cases this default\n\
-\tbehavior shouldn't be a problem, although it is possible to\n\
-\texplicitly not dereference the guest location by appending it the\n\
-\t! character: -b *host_path*:*guest_location!*.",
- },
- { .class = "Regular options",
- .arguments = {
- { .name = "-w", .separator = ' ', .value = "path" },
- { .name = "--pwd", .separator = '=', .value = "path" },
- { .name = "--cwd", .separator = '=', .value = "path" },
- { .name = NULL, .separator = '\0', .value = NULL } },
- .handler = handle_option_w,
- .description = "Set the initial working directory to *path*.",
- .detail = "\tSome programs expect to be launched from a given directory but do\n\
-\tnot perform any chdir by themselves. This option avoids the\n\
-\tneed for running a shell and then entering the directory manually.",
- },
- { .class = "Regular options",
- .arguments = {
- { .name = "--kill-on-exit", .separator = '\0', .value = NULL },
- { .name = NULL, .separator = '\0', .value = NULL } },
- .handler = handle_option_kill_on_exit,
- .description = "Kill all processes on command exit.",
- .detail = "\tWhen the executed command leaves orphan or detached processes\n\
-\taround, proot waits until all processes possibly terminate. This option forces\n\
-\tthe immediate termination of all tracee processes when the main command exits.",
- },
- { .class = "Regular options",
- .arguments = {
- { .name = "-v", .separator = ' ', .value = "value" },
- { .name = "--verbose", .separator = '=', .value = "value" },
- { .name = NULL, .separator = '\0', .value = NULL } },
- .handler = handle_option_v,
- .description = "Set the level of debug information to *value*.",
- .detail = "\tThe higher the integer value is, the more detailed debug\n\
-\tinformation is printed to the standard error stream. A negative\n\
-\tvalue makes PRoot quiet except on fatal errors.",
- },
- { .class = "Regular options",
- .arguments = {
- { .name = "-V", .separator = '\0', .value = NULL },
- { .name = "--version", .separator = '\0', .value = NULL },
- { .name = "--about", .separator = '\0', .value = NULL },
- { .name = NULL, .separator = '\0', .value = NULL } },
- .handler = handle_option_V,
- .description = "Print version, copyright, license and contact, then exit.",
- .detail = "",
- },
- { .class = "Regular options",
- .arguments = {
- { .name = "-h", .separator = '\0', .value = NULL },
- { .name = "--help", .separator = '\0', .value = NULL },
- { .name = "--usage", .separator = '\0', .value = NULL },
- { .name = NULL, .separator = '\0', .value = NULL } },
- .handler = handle_option_h,
- .description = "Print the version and the command-line usage, then exit.",
- .detail = "",
- },
- END_OF_OPTIONS,
- },
-};
-
-#endif /* PROOT_CLI_H */
diff --git a/app/src/main/cpp/proot/src/compat.h b/app/src/main/cpp/proot/src/compat.h
deleted file mode 100644
index f69bc3f..0000000
--- a/app/src/main/cpp/proot/src/compat.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef COMPAT_H
-#define COMPAT_H
-
-/* Local definitions for compatibility with old and/or broken distros... */
-# ifndef AT_NULL
-# define AT_NULL 0
-# endif
-# ifndef AT_PHDR
-# define AT_PHDR 3
-# endif
-# ifndef AT_PHENT
-# define AT_PHENT 4
-# endif
-# ifndef AT_PHNUM
-# define AT_PHNUM 5
-# endif
-# ifndef AT_BASE
-# define AT_BASE 7
-# endif
-# ifndef AT_ENTRY
-# define AT_ENTRY 9
-# endif
-# ifndef AT_RANDOM
-# define AT_RANDOM 25
-# endif
-# ifndef AT_EXECFN
-# define AT_EXECFN 31
-# endif
-# ifndef AT_SYSINFO
-# define AT_SYSINFO 32
-# endif
-# ifndef AT_SYSINFO_EHDR
-# define AT_SYSINFO_EHDR 33
-# endif
-# ifndef AT_FDCWD
-# define AT_FDCWD -100
-# endif
-# ifndef AT_SYMLINK_FOLLOW
-# define AT_SYMLINK_FOLLOW 0x400
-# endif
-# ifndef AT_REMOVEDIR
-# define AT_REMOVEDIR 0x200
-# endif
-# ifndef AT_SYMLINK_NOFOLLOW
-# define AT_SYMLINK_NOFOLLOW 0x100
-# endif
-# ifndef IN_DONT_FOLLOW
-# define IN_DONT_FOLLOW 0x02000000
-# endif
-# ifndef WIFCONTINUED
-# define WIFCONTINUED(status) ((status) == 0xffff)
-# endif
-# ifndef PTRACE_GETREGS
-# define PTRACE_GETREGS 12
-# endif
-# ifndef PTRACE_SETREGS
-# define PTRACE_SETREGS 13
-# endif
-# ifndef PTRACE_GETFPREGS
-# define PTRACE_GETFPREGS 14
-# endif
-# ifndef PTRACE_SETFPREGS
-# define PTRACE_SETFPREGS 15
-# endif
-# ifndef PTRACE_GETFPXREGS
-# define PTRACE_GETFPXREGS 18
-# endif
-# ifndef PTRACE_SETFPXREGS
-# define PTRACE_SETFPXREGS 19
-# endif
-# ifndef PTRACE_SETOPTIONS
-# define PTRACE_SETOPTIONS 0x4200
-# endif
-# ifndef PTRACE_GETEVENTMSG
-# define PTRACE_GETEVENTMSG 0x4201
-# endif
-# ifndef PTRACE_GETREGSET
-# define PTRACE_GETREGSET 0x4204
-# endif
-# ifndef PTRACE_SETREGSET
-# define PTRACE_SETREGSET 0x4205
-# endif
-# ifndef PTRACE_SEIZE
-# define PTRACE_SEIZE 0x4206
-# endif
-# ifndef PTRACE_INTERRUPT
-# define PTRACE_INTERRUPT 0x4207
-# endif
-# ifndef PTRACE_LISTEN
-# define PTRACE_LISTEN 0x4208
-# endif
-# ifndef PTRACE_O_TRACESYSGOOD
-# define PTRACE_O_TRACESYSGOOD 0x00000001
-# endif
-# ifndef PTRACE_O_TRACEFORK
-# define PTRACE_O_TRACEFORK 0x00000002
-# endif
-# ifndef PTRACE_O_TRACEVFORK
-# define PTRACE_O_TRACEVFORK 0x00000004
-# endif
-# ifndef PTRACE_O_TRACECLONE
-# define PTRACE_O_TRACECLONE 0x00000008
-# endif
-# ifndef PTRACE_O_TRACEEXEC
-# define PTRACE_O_TRACEEXEC 0x00000010
-# endif
-# ifndef PTRACE_O_TRACEVFORKDONE
-# define PTRACE_O_TRACEVFORKDONE 0x00000020
-# endif
-# ifndef PTRACE_O_TRACEEXIT
-# define PTRACE_O_TRACEEXIT 0x00000040
-# endif
-# ifndef PTRACE_O_TRACESECCOMP
-# define PTRACE_O_TRACESECCOMP 0x00000080
-# endif
-# ifndef PTRACE_EVENT_FORK
-# define PTRACE_EVENT_FORK 1
-# endif
-# ifndef PTRACE_EVENT_VFORK
-# define PTRACE_EVENT_VFORK 2
-# endif
-# ifndef PTRACE_EVENT_CLONE
-# define PTRACE_EVENT_CLONE 3
-# endif
-# ifndef PTRACE_EVENT_EXEC
-# define PTRACE_EVENT_EXEC 4
-# endif
-# ifndef PTRACE_EVENT_VFORK_DONE
-# define PTRACE_EVENT_VFORK_DONE 5
-# endif
-# ifndef PTRACE_EVENT_EXIT
-# define PTRACE_EVENT_EXIT 6
-# endif
-# ifndef PTRACE_EVENT_SECCOMP
-# define PTRACE_EVENT_SECCOMP 7
-# endif
-# ifndef PTRACE_EVENT_SECCOMP2
-# if PTRACE_EVENT_SECCOMP == 7
-# define PTRACE_EVENT_SECCOMP2 8
-# elif PTRACE_EVENT_SECCOMP == 8
-# define PTRACE_EVENT_SECCOMP2 7
-# else
-# error "unknown PTRACE_EVENT_SECCOMP value"
-# endif
-# endif
-# ifndef PTRACE_SET_SYSCALL
-# define PTRACE_SET_SYSCALL 23
-# endif
-# ifndef PTRACE_GET_THREAD_AREA
-# define PTRACE_GET_THREAD_AREA 25
-# endif
-# ifndef PTRACE_SET_THREAD_AREA
-# define PTRACE_SET_THREAD_AREA 26
-# endif
-# ifndef PTRACE_GETVFPREGS
-# define PTRACE_GETVFPREGS 27
-# endif
-# ifndef PTRACE_ARCH_PRCTL
-# define PTRACE_ARCH_PRCTL 30
-# endif
-# ifndef ARCH_SET_GS
-# define ARCH_SET_GS 0x1001
-# endif
-# ifndef ARCH_SET_FS
-# define ARCH_SET_FS 0x1002
-# endif
-# ifndef ARCH_GET_GS
-# define ARCH_GET_FS 0x1003
-# endif
-# ifndef ARCH_GET_FS
-# define ARCH_GET_GS 0x1004
-# endif
-# ifndef PTRACE_SINGLEBLOCK
-# define PTRACE_SINGLEBLOCK 33
-# endif
-# ifndef ADDR_NO_RANDOMIZE
-# define ADDR_NO_RANDOMIZE 0x0040000
-# endif
-# ifndef SYS_ACCEPT4
-# define SYS_ACCEPT4 18
-# endif
-# ifndef TALLOC_FREE
-# define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx = NULL; } while(0)
-# endif
-# ifndef PR_SET_NAME
-# define PR_SET_NAME 15
-# endif
-# ifndef PR_SET_NO_NEW_PRIVS
-# define PR_SET_NO_NEW_PRIVS 38
-# endif
-# ifndef PR_SET_SECCOMP
-# define PR_SET_SECCOMP 22
-# endif
-# ifndef SECCOMP_MODE_FILTER
-# define SECCOMP_MODE_FILTER 2
-# endif
-# ifndef talloc_get_type_abort
-# define talloc_get_type_abort talloc_get_type
-# endif
-# ifndef FUTEX_PRIVATE_FLAG
-# define FUTEX_PRIVATE_FLAG 128
-# endif
-# ifndef EFD_SEMAPHORE
-# define EFD_SEMAPHORE 1
-# endif
-# ifndef F_DUPFD_CLOEXEC
-# define F_DUPFD_CLOEXEC 1030
-# endif
-# ifndef O_RDONLY
-# define O_RDONLY 00000000
-# endif
-# ifndef O_CLOEXEC
-# define O_CLOEXEC 02000000
-# endif
-# ifndef MAP_PRIVATE
-# define MAP_PRIVATE 0x02
-# endif
-# ifndef MAP_FIXED
-# define MAP_FIXED 0x10
-# endif
-# ifndef MAP_ANONYMOUS
-# define MAP_ANONYMOUS 0x20
-# endif
-# ifndef PROT_READ
-# define PROT_READ 0x1
-# endif
-# ifndef PROT_WRITE
-# define PROT_WRITE 0x2
-# endif
-# ifndef PROT_EXEC
-# define PROT_EXEC 0x4
-# endif
-# ifndef PROT_GROWSDOWN
-# define PROT_GROWSDOWN 0x01000000
-# endif
-# ifndef NT_ARM_SYSTEM_CALL
-# define NT_ARM_SYSTEM_CALL 0x404
-# endif
-# ifndef SYS_SECCOMP
-# define SYS_SECCOMP 1
-# endif
-
-#endif /* COMPAT_H */
diff --git a/app/src/main/cpp/proot/src/execve/auxv.c b/app/src/main/cpp/proot/src/execve/auxv.c
deleted file mode 100644
index 7ab0779..0000000
--- a/app/src/main/cpp/proot/src/execve/auxv.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* AT_*, */
-#include /* assert(3), */
-#include /* E*, */
-#include /* write(3), close(3), */
-#include /* open(2), */
-#include /* open(2), */
-#include /* open(2), */
-
-#include "execve/auxv.h"
-#include "syscall/sysnum.h"
-#include "tracee/tracee.h"
-#include "tracee/mem.h"
-#include "tracee/reg.h"
-#include "tracee/abi.h"
-#include "arch.h"
-
-
-/**
- * Add the given vector [@type, @value] to @vectors. This function
- * returns -errno if an error occurred, otherwise 0.
- */
-int add_elf_aux_vector(ElfAuxVector **vectors, word_t type, word_t value)
-{
- ElfAuxVector *tmp;
- size_t nb_vectors;
-
- assert(*vectors != NULL);
-
- nb_vectors = talloc_array_length(*vectors);
-
- /* Sanity checks. */
- assert(nb_vectors > 0);
- assert((*vectors)[nb_vectors - 1].type == AT_NULL);
-
- tmp = talloc_realloc(talloc_parent(*vectors), *vectors, ElfAuxVector, nb_vectors + 1);
- if (tmp == NULL)
- return -ENOMEM;
- *vectors = tmp;
-
- /* Replace the sentinel with the new vector. */
- (*vectors)[nb_vectors - 1].type = type;
- (*vectors)[nb_vectors - 1].value = value;
-
- /* Restore the sentinel. */
- (*vectors)[nb_vectors].type = AT_NULL;
- (*vectors)[nb_vectors].value = 0;
-
- return 0;
-}
-
-/**
- * Get the address of the the ELF auxiliary vectors table for the
- * given @tracee. This function returns 0 if an error occurred.
- */
-word_t get_elf_aux_vectors_address(const Tracee *tracee)
-{
- word_t address;
- word_t data;
-
- /* Sanity check: this works only in execve sysexit. */
- assert(IS_IN_SYSEXIT2(tracee, PR_execve));
-
- /* Right after execve, the stack layout is:
- *
- * argc, argv[0], ..., 0, envp[0], ..., 0, auxv[0].type, auxv[0].value, ..., 0, 0
- */
- address = peek_reg(tracee, CURRENT, STACK_POINTER);
-
- /* Read: argc */
- data = peek_word(tracee, address);
- if (errno != 0)
- return 0;
-
- /* Skip: argc, argv, 0 */
- address += (1 + data + 1) * sizeof_word(tracee);
-
- /* Skip: envp, 0 */
- do {
- data = peek_word(tracee, address);
- if (errno != 0)
- return 0;
- address += sizeof_word(tracee);
- } while (data != 0);
-
- return address;
-}
-
-/**
- * Fetch ELF auxiliary vectors stored at the given @address in
- * @tracee's memory. This function returns NULL if an error occurred,
- * otherwise it returns a pointer to the new vectors, in an ABI
- * independent form (the Talloc parent of this pointer is
- * @tracee->ctx).
- */
-ElfAuxVector *fetch_elf_aux_vectors(const Tracee *tracee, word_t address)
-{
- ElfAuxVector *vectors = NULL;
- ElfAuxVector vector;
- int status;
-
- /* It is assumed the sentinel always exists. */
- vectors = talloc_array(tracee->ctx, ElfAuxVector, 1);
- if (vectors == NULL)
- return NULL;
- vectors[0].type = AT_NULL;
- vectors[0].value = 0;
-
- while (1) {
- vector.type = peek_word(tracee, address);
- if (errno != 0)
- return NULL;
- address += sizeof_word(tracee);
-
- if (vector.type == AT_NULL)
- break; /* Already added. */
-
- vector.value = peek_word(tracee, address);
- if (errno != 0)
- return NULL;
- address += sizeof_word(tracee);
-
- status = add_elf_aux_vector(&vectors, vector.type, vector.value);
- if (status < 0)
- return NULL;
- }
-
- return vectors;
-}
diff --git a/app/src/main/cpp/proot/src/execve/auxv.h b/app/src/main/cpp/proot/src/execve/auxv.h
deleted file mode 100644
index 8dd59e7..0000000
--- a/app/src/main/cpp/proot/src/execve/auxv.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef AUXV
-#define AUXV
-
-#include "tracee/tracee.h"
-#include "arch.h"
-
-typedef struct elf_aux_vector {
- word_t type;
- word_t value;
-} ElfAuxVector;
-
-extern word_t get_elf_aux_vectors_address(const Tracee *tracee);
-extern ElfAuxVector *fetch_elf_aux_vectors(const Tracee *tracee, word_t address);
-extern int add_elf_aux_vector(ElfAuxVector **vectors, word_t type, word_t value);
-
-#endif /* AUXV */
diff --git a/app/src/main/cpp/proot/src/execve/elf.c b/app/src/main/cpp/proot/src/execve/elf.c
deleted file mode 100644
index 88fe150..0000000
--- a/app/src/main/cpp/proot/src/execve/elf.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* open(2), */
-#include /* read(2), close(2), */
-#include /* EACCES, ENOTSUP, */
-#include /* UINT64_MAX, */
-#include /* PATH_MAX, */
-#include /* str*(3), memcpy(3), */
-#include /* assert(3), */
-#include /* talloc_*, */
-#include /* bool, true, false, */
-
-#include "execve/elf.h"
-#include "tracee/tracee.h"
-#include "cli/note.h"
-#include "arch.h"
-
-#include "compat.h"
-
-/**
- * Open the ELF file @t_path and extract its header into @elf_header.
- * This function returns -errno if an error occured, otherwise the
- * file descriptor for @t_path.
- */
-int open_elf(const char *t_path, ElfHeader *elf_header)
-{
- int fd;
- int status;
-
- /*
- * Read the ELF header.
- */
-
- fd = open(t_path, O_RDONLY);
- if (fd < 0)
- return -errno;
-
- /* Check if it is an ELF file. */
- status = read(fd, elf_header, sizeof(ElfHeader));
- if (status < 0) {
- status = -errno;
- goto end;
- }
- if ((size_t) status < sizeof(ElfHeader)
- || ELF_IDENT(*elf_header, 0) != 0x7f
- || ELF_IDENT(*elf_header, 1) != 'E'
- || ELF_IDENT(*elf_header, 2) != 'L'
- || ELF_IDENT(*elf_header, 3) != 'F') {
- status = -ENOEXEC;
- goto end;
- }
-
- /* Check if it is a known class (32-bit or 64-bit). */
- if ( !IS_CLASS32(*elf_header)
- && !IS_CLASS64(*elf_header)) {
- status = -ENOEXEC;
- goto end;
- }
-
- status = 0;
-end:
- /* Delayed error handling. */
- if (status < 0) {
- close(fd);
- return status;
- }
-
- return fd;
-}
-
-/**
- * Invoke @callback(..., @data) for each program headers from the
- * specified ELF file (referenced by @fd, with the given @elf_header).
- * This function returns -errno if an error occured, or it returns
- * immediately the value != 0 returned by @callback, otherwise 0.
- */
-int iterate_program_headers(const Tracee *tracee, int fd, const ElfHeader *elf_header,
- program_headers_iterator_t callback, void *data)
-{
- ProgramHeader program_header;
-
- uint64_t elf_phoff;
- uint16_t elf_phentsize;
- uint16_t elf_phnum;
-
- int status;
- int i;
-
- /* Get class-specific fields. */
- elf_phnum = ELF_FIELD(*elf_header, phnum);
- elf_phentsize = ELF_FIELD(*elf_header, phentsize);
- elf_phoff = ELF_FIELD(*elf_header, phoff);
-
- /*
- * Some sanity checks regarding the current
- * support of the ELF specification in PRoot.
- */
-
- if (elf_phnum >= 0xffff) {
- note(tracee, WARNING, INTERNAL, "%d: big PH tables are not yet supported.", fd);
- return -ENOTSUP;
- }
-
- if (!KNOWN_PHENTSIZE(*elf_header, elf_phentsize)) {
- note(tracee, WARNING, INTERNAL, "%d: unsupported size of program header.", fd);
- return -ENOTSUP;
- }
-
- status = (int) lseek(fd, elf_phoff, SEEK_SET);
- if (status < 0)
- return -errno;
-
- for (i = 0; i < elf_phnum; i++) {
- status = read(fd, &program_header, elf_phentsize);
- if (status != elf_phentsize)
- return (status < 0 ? -errno : -ENOTSUP);
-
- status = callback(elf_header, &program_header, data);
- if (status != 0)
- return status;
- }
-
- return 0;
-}
diff --git a/app/src/main/cpp/proot/src/execve/elf.h b/app/src/main/cpp/proot/src/execve/elf.h
deleted file mode 100644
index a6251e8..0000000
--- a/app/src/main/cpp/proot/src/execve/elf.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef ELF_H
-#define ELF_H
-
-#define EI_NIDENT 16
-
-#include
-#include
-
-typedef struct {
- unsigned char e_ident[EI_NIDENT];
- uint16_t e_type;
- uint16_t e_machine;
- uint32_t e_version;
- uint32_t e_entry;
- uint32_t e_phoff;
- uint32_t e_shoff;
- uint32_t e_flags;
- uint16_t e_ehsize;
- uint16_t e_phentsize;
- uint16_t e_phnum;
- uint16_t e_shentsize;
- uint16_t e_shnum;
- uint16_t e_shstrndx;
-} ElfHeader32;
-
-typedef struct {
- unsigned char e_ident[EI_NIDENT];
- uint16_t e_type;
- uint16_t e_machine;
- uint32_t e_version;
- uint64_t e_entry;
- uint64_t e_phoff;
- uint64_t e_shoff;
- uint32_t e_flags;
- uint16_t e_ehsize;
- uint16_t e_phentsize;
- uint16_t e_phnum;
- uint16_t e_shentsize;
- uint16_t e_shnum;
- uint16_t e_shstrndx;
-} ElfHeader64;
-
-typedef union {
- ElfHeader32 class32;
- ElfHeader64 class64;
-} ElfHeader;
-
-typedef struct {
- uint32_t p_type;
- uint32_t p_offset;
- uint32_t p_vaddr;
- uint32_t p_paddr;
- uint32_t p_filesz;
- uint32_t p_memsz;
- uint32_t p_flags;
- uint32_t p_align;
-} ProgramHeader32;
-
-typedef struct {
- uint32_t p_type;
- uint32_t p_flags;
- uint64_t p_offset;
- uint64_t p_vaddr;
- uint64_t p_paddr;
- uint64_t p_filesz;
- uint64_t p_memsz;
- uint64_t p_align;
-} ProgramHeader64;
-
-typedef union {
- ProgramHeader32 class32;
- ProgramHeader64 class64;
-} ProgramHeader;
-
-/* Object type: */
-#define ET_REL 1
-#define ET_EXEC 2
-#define ET_DYN 3
-#define ET_CORE 4
-
-/* Segment flags: */
-#define PF_X 1
-#define PF_W 2
-#define PF_R 4
-
-typedef enum {
- PT_LOAD = 1,
- PT_DYNAMIC = 2,
- PT_INTERP = 3,
- PT_GNU_STACK = 0x6474e551,
-} SegmentType;
-
-typedef enum {
- DT_STRTAB = 5,
- DT_RPATH = 15,
- DT_RUNPATH = 29
-} DynamicType;
-
-/* The following macros are also compatible with ELF 64-bit. */
-#define ELF_IDENT(header, index) (header).class32.e_ident[(index)]
-#define ELF_CLASS(header) ELF_IDENT(header, 4)
-#define IS_CLASS32(header) (ELF_CLASS(header) == 1)
-#define IS_CLASS64(header) (ELF_CLASS(header) == 2)
-
-/* Helper to access a @field of the structure ElfHeaderXX. */
-#define ELF_FIELD(header, field) \
- (IS_CLASS64(header) \
- ? (header).class64. e_ ## field \
- : (header).class32. e_ ## field)
-
-/* Helper to access a @field of the structure ProgramHeaderXX */
-#define PROGRAM_FIELD(ehdr, phdr, field) \
- (IS_CLASS64(ehdr) \
- ? (phdr).class64. p_ ## field \
- : (phdr).class32. p_ ## field)
-
-/* Helper to access a @field of the structure DynamicEntryXX */
-#define DYNAMIC_FIELD(ehdr, dynent, field) \
- (IS_CLASS64(ehdr) \
- ? (dynent).class64. d_ ## field \
- : (dynent).class32. d_ ## field)
-
-#define KNOWN_PHENTSIZE(header, size) \
- ( (IS_CLASS32(header) && (size) == sizeof(ProgramHeader32)) \
- || (IS_CLASS64(header) && (size) == sizeof(ProgramHeader64)))
-
-#define IS_POSITION_INDENPENDANT(elf_header) \
- (ELF_FIELD((elf_header), type) == ET_DYN)
-
-#include "tracee/tracee.h"
-
-extern int open_elf(const char *t_path, ElfHeader *elf_header);
-
-typedef int (* program_headers_iterator_t)(const ElfHeader *elf_header,
- const ProgramHeader *program_header, void *data);
-
-extern int iterate_program_headers(const Tracee *tracee, int fd, const ElfHeader *elf_header,
- program_headers_iterator_t callback, void *data);
-
-#endif /* ELF_H */
diff --git a/app/src/main/cpp/proot/src/execve/enter.c b/app/src/main/cpp/proot/src/execve/enter.c
deleted file mode 100644
index 215d299..0000000
--- a/app/src/main/cpp/proot/src/execve/enter.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* lstat(2), lseek(2), */
-#include /* lstat(2), lseek(2), fchmod(2), */
-#include /* access(2), lstat(2), close(2), read(2), */
-#include /* E*, */
-#include /* assert(3), */
-#include /* talloc*, */
-#include /* PROT_*, */
-#include /* strlen(3), strcpy(3), */
-#include /* getenv(3), */
-#include /* fwrite(3), */
-#include /* assert(3), */
-
-#include "execve/execve.h"
-#include "execve/elf.h"
-#include "path/path.h"
-#include "path/temp.h"
-#include "path/binding.h"
-#include "tracee/tracee.h"
-#include "syscall/syscall.h"
-#include "syscall/sysnum.h"
-#include "arch.h"
-#include "cli/note.h"
-
-#define P(a) PROGRAM_FIELD(load_info->elf_header, *program_header, a)
-
-/**
- * Add @program_header (type PT_LOAD) to @load_info->mappings. This
- * function returns -errno if an error occured, otherwise it returns
- * 0.
- */
-static int add_mapping(const Tracee *tracee UNUSED, LoadInfo *load_info,
- const ProgramHeader *program_header)
-{
- size_t index;
- word_t start_address;
- word_t end_address;
- static word_t page_size = 0;
- static word_t page_mask = 0;
-
- if (page_size == 0) {
- page_size = sysconf(_SC_PAGE_SIZE);
- if ((int) page_size <= 0)
- page_size = 0x1000;
- page_mask = ~(page_size - 1);
- }
-
- if (load_info->mappings == NULL)
- index = 0;
- else
- index = talloc_array_length(load_info->mappings);
-
- load_info->mappings = talloc_realloc(load_info, load_info->mappings, Mapping, index + 1);
- if (load_info->mappings == NULL)
- return -ENOMEM;
-
- start_address = P(vaddr) & page_mask;
- end_address = (P(vaddr) + P(filesz) + page_size) & page_mask;
-
- load_info->mappings[index].fd = -1; /* Unknown yet. */
- load_info->mappings[index].offset = P(offset) & page_mask;
- load_info->mappings[index].addr = start_address;
- load_info->mappings[index].length = end_address - start_address;
- load_info->mappings[index].flags = MAP_PRIVATE | MAP_FIXED;
- load_info->mappings[index].prot = ( (P(flags) & PF_R ? PROT_READ : 0)
- | (P(flags) & PF_W ? PROT_WRITE : 0)
- | (P(flags) & PF_X ? PROT_EXEC : 0));
-
- /* "If the segment's memory size p_memsz is larger than the
- * file size p_filesz, the "extra" bytes are defined to hold
- * the value 0 and to follow the segment's initialized area."
- * -- man 7 elf. */
- if (P(memsz) > P(filesz)) {
- /* How many extra bytes in the current page? */
- load_info->mappings[index].clear_length = end_address - P(vaddr) - P(filesz);
-
- /* Create new pages for the remaining extra bytes. */
- start_address = end_address;
- end_address = (P(vaddr) + P(memsz) + page_size) & page_mask;
- if (end_address > start_address) {
- index++;
- load_info->mappings = talloc_realloc(load_info, load_info->mappings,
- Mapping, index + 1);
- if (load_info->mappings == NULL)
- return -ENOMEM;
-
- load_info->mappings[index].fd = -1; /* Anonymous. */
- load_info->mappings[index].offset = 0;
- load_info->mappings[index].addr = start_address;
- load_info->mappings[index].length = end_address - start_address;
- load_info->mappings[index].clear_length = 0;
- load_info->mappings[index].flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED;
- load_info->mappings[index].prot = load_info->mappings[index - 1].prot;
- }
- }
- else
- load_info->mappings[index].clear_length = 0;
-
- return 0;
-}
-
-/**
- * Translate @user_path into @host_path and check if this latter exists, is
- * executable and is a regular file. This function returns -errno if
- * an error occured, 0 otherwise.
- */
-int translate_and_check_exec(Tracee *tracee, char host_path[PATH_MAX], const char *user_path)
-{
- struct stat statl;
- int status;
-
- if (user_path[0] == '\0')
- return -ENOEXEC;
-
- status = translate_path(tracee, host_path, AT_FDCWD, user_path, true);
- if (status < 0)
- return status;
-
- status = access(host_path, F_OK);
- if (status < 0)
- return -ENOENT;
-
- status = access(host_path, X_OK);
- if (status < 0)
- return -EACCES;
-
- status = lstat(host_path, &statl);
- if (status < 0)
- return -EPERM;
-
- return 0;
-}
-
-/**
- * Add @program_header (type PT_INTERP) to @load_info->interp. This
- * function returns -errno if an error occured, otherwise it returns
- * 0.
- */
-static int add_interp(Tracee *tracee, int fd, LoadInfo *load_info,
- const ProgramHeader *program_header)
-{
- char host_path[PATH_MAX];
- char *user_path;
- int status;
-
- /* Only one PT_INTERP segment is allowed. */
- if (load_info->interp != NULL)
- return -EINVAL;
-
- load_info->interp = talloc_zero(load_info, LoadInfo);
- if (load_info->interp == NULL)
- return -ENOMEM;
-
- user_path = talloc_size(tracee->ctx, P(filesz) + 1);
- if (user_path == NULL)
- return -ENOMEM;
-
- /* Remember pread(2) doesn't change the
- * current position in the file. */
- status = pread(fd, user_path, P(filesz), P(offset));
- if ((size_t) status != P(filesz)) /* Unexpected size. */
- status = -EACCES;
- if (status < 0)
- return status;
-
- user_path[P(filesz)] = '\0';
-
- status = translate_and_check_exec(tracee, host_path, user_path);
- if (status < 0)
- return status;
-
- load_info->interp->host_path = talloc_strdup(load_info->interp, host_path);
- if (load_info->interp->host_path == NULL)
- return -ENOMEM;
-
- load_info->interp->user_path = talloc_strdup(load_info->interp, user_path);
- if (load_info->interp->user_path == NULL)
- return -ENOMEM;
-
- return 0;
-}
-
-#undef P
-
-struct add_load_info_data {
- LoadInfo *load_info;
- Tracee *tracee;
- int fd;
-};
-
-/**
- * This function is a program header iterator. It invokes
- * add_mapping() or add_interp(), according to the type of
- * @program_header. This function returns -errno if an error
- * occurred, otherwise 0.
- */
-static int add_load_info(const ElfHeader *elf_header,
- const ProgramHeader *program_header, void *data_)
-{
- struct add_load_info_data *data = data_;
- int status;
-
- switch (PROGRAM_FIELD(*elf_header, *program_header, type)) {
- case PT_LOAD:
- status = add_mapping(data->tracee, data->load_info, program_header);
- if (status < 0)
- return status;
- break;
-
- case PT_INTERP:
- status = add_interp(data->tracee, data->fd, data->load_info, program_header);
- if (status < 0)
- return status;
- break;
-
- case PT_GNU_STACK:
- data->load_info->needs_executable_stack |=
- ((PROGRAM_FIELD(*elf_header, *program_header, flags) & PF_X) != 0);
- break;
-
- default:
- break;
- }
-
- return 0;
-}
-
-/**
- * Extract the load info from @load->host_path. This function returns
- * -errno if an error occured, otherwise it returns 0.
- */
-static int extract_load_info(Tracee *tracee, LoadInfo *load_info)
-{
- struct add_load_info_data data;
- int fd = -1;
- int status;
-
- assert(load_info != NULL);
- assert(load_info->host_path != NULL);
-
- fd = open_elf(load_info->host_path, &load_info->elf_header);
- if (fd < 0)
- return fd;
-
- /* Sanity check. */
- switch (ELF_FIELD(load_info->elf_header, type)) {
- case ET_EXEC:
- case ET_DYN:
- break;
-
- default:
- status = -EINVAL;
- goto end;
- }
-
- data.load_info = load_info;
- data.tracee = tracee;
- data.fd = fd;
-
- status = iterate_program_headers(tracee, fd, &load_info->elf_header, add_load_info, &data);
-end:
- if (fd >= 0)
- close(fd);
-
- return status;
-}
-
-/**
- * Add @load_base to each adresses of @load_info.
- */
-static void add_load_base(LoadInfo *load_info, word_t load_base)
-{
- size_t nb_mappings;
- size_t i;
-
- nb_mappings = talloc_array_length(load_info->mappings);
- for (i = 0; i < nb_mappings; i++)
- load_info->mappings[i].addr += load_base;
-
- if (IS_CLASS64(load_info->elf_header))
- load_info->elf_header.class64.e_entry += load_base;
- else
- load_info->elf_header.class32.e_entry += load_base;
-}
-
-/**
- * Compute the final load address for each position independant
- * objects of @tracee.
- *
- */
-static void compute_load_addresses(Tracee *tracee)
-{
- if (IS_POSITION_INDENPENDANT(tracee->load_info->elf_header)
- && tracee->load_info->mappings[0].addr == 0) {
-#if defined(HAS_LOADER_32BIT)
- if (IS_CLASS32(tracee->load_info->elf_header))
- add_load_base(tracee->load_info, EXEC_PIC_ADDRESS_32);
- else
-#endif
- add_load_base(tracee->load_info, EXEC_PIC_ADDRESS);
- }
-
- /* Nothing more to do? */
- if (tracee->load_info->interp == NULL)
- return;
-
- if (IS_POSITION_INDENPENDANT(tracee->load_info->interp->elf_header)
- && tracee->load_info->interp->mappings[0].addr == 0) {
-#if defined(HAS_LOADER_32BIT)
- if (IS_CLASS32(tracee->load_info->elf_header))
- add_load_base(tracee->load_info->interp, INTERP_PIC_ADDRESS_32);
- else
-#endif
- add_load_base(tracee->load_info->interp, INTERP_PIC_ADDRESS);
- }
-}
-
-/**
- * Get the path to the loader for the given @tracee. This function
- * returns NULL if an error occurred.
- */
-static inline const char *get_loader_path(const Tracee *tracee)
-{
- static char *loader_path = NULL;
-
- if (IS_CLASS32(tracee->load_info->elf_header))
- loader_path = getenv("PROOT_LOADER_32");
- else
- loader_path = getenv("PROOT_LOADER");
-
- return loader_path;
-}
-
-/**
- * Extract all the information that will be required by
- * translate_load_*(). This function returns -errno if an error
- * occured, otherwise 0.
- */
-int translate_execve_enter(Tracee *tracee)
-{
- char user_path[PATH_MAX];
- char host_path[PATH_MAX];
- char new_exe[PATH_MAX];
- const char *loader_path;
- int status;
-
- if (IS_NOTIFICATION_PTRACED_LOAD_DONE(tracee)) {
- /* Syscalls can now be reported to its ptracer. */
- tracee->as_ptracee.ignore_loader_syscalls = false;
-
- /* Cancel this spurious execve, it was only used as a
- * notification. */
- set_sysnum(tracee, PR_void);
- return 0;
- }
-
- status = get_sysarg_path(tracee, user_path, SYSARG_1);
- if (status < 0)
- return status;
-
- /* Translate this path (user -> host), then check it is executable. */
- status = translate_and_check_exec(tracee, host_path, user_path);
- if (status < 0)
- return status;
-
- strcpy(new_exe, host_path);
- status = detranslate_path(tracee, new_exe, NULL);
- if (status >= 0) {
- talloc_unlink(tracee, tracee->new_exe);
- tracee->new_exe = talloc_strdup(tracee, new_exe);
- }
- else
- tracee->new_exe = NULL;
-
- talloc_unlink(tracee, tracee->load_info);
-
- tracee->load_info = talloc_zero(tracee, LoadInfo);
- if (tracee->load_info == NULL)
- return -ENOMEM;
-
- tracee->load_info->host_path = talloc_strdup(tracee->load_info, host_path);
- if (tracee->load_info->host_path == NULL)
- return -ENOMEM;
-
- tracee->load_info->user_path = talloc_strdup(tracee->load_info, user_path);
- if (tracee->load_info->user_path == NULL)
- return -ENOMEM;
-
- status = extract_load_info(tracee, tracee->load_info);
- if (status < 0)
- return status;
-
- if (tracee->load_info->interp != NULL) {
- status = extract_load_info(tracee, tracee->load_info->interp);
- if (status < 0)
- return status;
-
- /* An ELF interpreter is supposed to be
- * standalone. */
- if (tracee->load_info->interp->interp != NULL) {
- TALLOC_FREE(tracee->load_info->interp->interp);
- return -EINVAL;
- }
- }
-
- compute_load_addresses(tracee);
-
- /* Execute the loader instead of the program. */
- loader_path = get_loader_path(tracee);
- if (loader_path == NULL)
- return -ENOENT;
-
- status = set_sysarg_path(tracee, loader_path, SYSARG_1);
- if (status < 0)
- return status;
-
- /* Mask to its ptracer syscalls performed by the loader. */
- tracee->as_ptracee.ignore_loader_syscalls = true;
-
- return 0;
-}
diff --git a/app/src/main/cpp/proot/src/execve/execve.h b/app/src/main/cpp/proot/src/execve/execve.h
deleted file mode 100644
index 93da9eb..0000000
--- a/app/src/main/cpp/proot/src/execve/execve.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef EXECVE_H
-#define EXECVE_H
-
-#include /* PATH_MAX, */
-
-#include "tracee/tracee.h"
-#include "execve/elf.h"
-#include "arch.h"
-
-extern int translate_execve_enter(Tracee *tracee);
-extern void translate_execve_exit(Tracee *tracee);
-extern int translate_and_check_exec(Tracee *tracee, char host_path[PATH_MAX], const char *user_path);
-
-typedef struct mapping {
- word_t addr;
- word_t length;
- word_t clear_length;
- word_t prot;
- word_t flags;
- word_t fd;
- word_t offset;
-} Mapping;
-
-typedef struct load_info {
- char *host_path;
- char *user_path;
- Mapping *mappings;
- ElfHeader elf_header;
- bool needs_executable_stack;
-
- struct load_info *interp;
-} LoadInfo;
-
-#define IS_NOTIFICATION_PTRACED_LOAD_DONE(tracee) ( \
- (tracee)->as_ptracee.ptracer != NULL \
- && peek_reg((tracee), ORIGINAL, SYSARG_1) == (word_t) 1 \
- && peek_reg((tracee), ORIGINAL, SYSARG_4) == (word_t) 2 \
- && peek_reg((tracee), ORIGINAL, SYSARG_5) == (word_t) 3 \
- && peek_reg((tracee), ORIGINAL, SYSARG_6) == (word_t) 4)
-
-#endif /* EXECVE_H */
diff --git a/app/src/main/cpp/proot/src/execve/exit.c b/app/src/main/cpp/proot/src/execve/exit.c
deleted file mode 100644
index 48a1b4a..0000000
--- a/app/src/main/cpp/proot/src/execve/exit.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* AT_*, */
-#include /* talloc*, */
-#include /* MAP_*, */
-#include /* assert(3), */
-#include /* strlen(3), strerror(3), */
-#include /* bzero(3), */
-#include /* kill(2), SIG*, */
-#include /* write(2), */
-#include /* E*, */
-
-#include "execve/execve.h"
-#include "execve/elf.h"
-#include "loader/script.h"
-#include "tracee/reg.h"
-#include "tracee/abi.h"
-#include "tracee/mem.h"
-#include "syscall/sysnum.h"
-#include "execve/auxv.h"
-#include "path/binding.h"
-#include "path/temp.h"
-#include "cli/note.h"
-
-
-/**
- * Fill @path with the content of @vectors, formatted according to
- * @ptracee's current ABI.
- */
-static int fill_file_with_auxv(const Tracee *ptracee, const char *path,
- const ElfAuxVector *vectors)
-{
- const ssize_t current_sizeof_word = sizeof_word(ptracee);
- ssize_t status;
- int fd = -1;
- int i;
-
- fd = open(path, O_WRONLY);
- if (fd < 0)
- return -1;
-
- i = 0;
- do {
- status = write(fd, &vectors[i].type, current_sizeof_word);
- if (status < current_sizeof_word) {
- status = -1;
- goto end;
- }
-
- status = write(fd, &vectors[i].value, current_sizeof_word);
- if (status < current_sizeof_word) {
- status = -1;
- goto end;
- }
- } while (vectors[i++].type != AT_NULL);
-
- status = 0;
-end:
- if (fd >= 0)
- (void) close(fd);
-
- return status;
-}
-
-/**
- * Bind content of @vectors over /proc/{@ptracee->pid}/auxv. This
- * function returns -1 if an error occurred, otherwise 0.
- */
-static int bind_proc_pid_auxv(const Tracee *ptracee)
-{
- word_t vectors_address;
- ElfAuxVector *vectors;
-
- const char *guest_path;
- const char *host_path;
- Binding *binding;
- int status;
-
- vectors_address = get_elf_aux_vectors_address(ptracee);
- if (vectors_address == 0)
- return -1;
-
- vectors = fetch_elf_aux_vectors(ptracee, vectors_address);
- if (vectors == NULL)
- return -1;
-
- /* Path to these ELF auxiliary vectors. */
- guest_path = talloc_asprintf(ptracee->ctx, "/proc/%d/auxv", ptracee->pid);
- if (guest_path == NULL)
- return -1;
-
- /* Remove binding to this path, if any. It contains ELF
- * auxiliary vectors of the previous execve(2). */
- binding = get_binding(ptracee, GUEST, guest_path);
- if (binding != NULL && compare_paths(binding->guest.path, guest_path) == PATHS_ARE_EQUAL) {
- remove_binding_from_all_lists(ptracee, binding);
- TALLOC_FREE(binding);
- }
-
- host_path = create_temp_file(ptracee->ctx, "auxv");
- if (host_path == NULL)
- return -1;
-
- status = fill_file_with_auxv(ptracee, host_path, vectors);
- if (status < 0)
- return -1;
-
- /* Note: this binding will be removed once ptracee gets freed. */
- binding = insort_binding3(ptracee, ptracee->life_context, host_path, guest_path);
- if (binding == NULL)
- return -1;
-
- /* This temporary file (host_path) will be removed once the
- * binding is freed. */
- talloc_reparent(ptracee->ctx, binding, host_path);
-
- return 0;
-}
-
-/**
- * Convert @mappings into load @script statements at the given @cursor
- * position. This function returns the new cursor position.
- */
-static void *transcript_mappings(void *cursor, const Mapping *mappings)
-{
- size_t nb_mappings;
- size_t i;
-
- nb_mappings = talloc_array_length(mappings);
- for (i = 0; i < nb_mappings; i++) {
- LoadStatement *statement = cursor;
-
- if ((mappings[i].flags & MAP_ANONYMOUS) != 0)
- statement->action = LOAD_ACTION_MMAP_ANON;
- else
- statement->action = LOAD_ACTION_MMAP_FILE;
-
- statement->mmap.addr = mappings[i].addr;
- statement->mmap.length = mappings[i].length;
- statement->mmap.prot = mappings[i].prot;
- statement->mmap.offset = mappings[i].offset;
- statement->mmap.clear_length = mappings[i].clear_length;
-
- cursor += LOAD_STATEMENT_SIZE(*statement, mmap);
- }
-
- return cursor;
-}
-
-/**
- * Convert @tracee->load_info into a load script, then transfer this
- * latter into @tracee's memory.
- */
-static int transfer_load_script(Tracee *tracee)
-{
- const word_t stack_pointer = peek_reg(tracee, CURRENT, STACK_POINTER);
- static word_t page_size = 0;
- static word_t page_mask = 0;
-
- word_t entry_point;
-
- size_t script_size;
- size_t strings_size;
- size_t string1_size;
- size_t string2_size;
- size_t padding_size;
-
- word_t string1_address;
- word_t string2_address;
-
- void *buffer;
- size_t buffer_size;
-
- bool needs_executable_stack;
- LoadStatement *statement;
- void *cursor;
- int status;
-
- if (page_size == 0) {
- page_size = sysconf(_SC_PAGE_SIZE);
- if ((int) page_size <= 0)
- page_size = 0x1000;
- page_mask = ~(page_size - 1);
- }
-
- needs_executable_stack = (tracee->load_info->needs_executable_stack
- || ( tracee->load_info->interp != NULL
- && tracee->load_info->interp->needs_executable_stack));
-
- /* Strings addresses are required to generate the load script,
- * for "open" actions. Since I want to generate it in one
- * pass, these strings will be put right below the current
- * stack pointer -- the only known adresses so far -- in the
- * "strings area". */
- string1_size = strlen(tracee->load_info->user_path) + 1;
-
- string2_size = (tracee->load_info->interp == NULL ? 0
- : strlen(tracee->load_info->interp->user_path) + 1);
-
- /* A padding will be appended at the end of the load script
- * (a.k.a "strings area") to ensure this latter is aligned properly. */
- padding_size = (stack_pointer - string1_size - string2_size) % STACK_ALIGNMENT;
-
- strings_size = string1_size + string2_size + padding_size;
- string1_address = stack_pointer - strings_size;
- string2_address = stack_pointer - strings_size + string1_size;
-
- /* Compute the size of the load script. */
- script_size =
- LOAD_STATEMENT_SIZE(*statement, open)
- + (LOAD_STATEMENT_SIZE(*statement, mmap)
- * talloc_array_length(tracee->load_info->mappings))
- + (tracee->load_info->interp == NULL ? 0
- : LOAD_STATEMENT_SIZE(*statement, open)
- + (LOAD_STATEMENT_SIZE(*statement, mmap)
- * talloc_array_length(tracee->load_info->interp->mappings)))
- + (needs_executable_stack ? LOAD_STATEMENT_SIZE(*statement, make_stack_exec) : 0)
- + LOAD_STATEMENT_SIZE(*statement, start);
-
- /* Allocate enough room for both the load script and the
- * strings area. */
- buffer_size = script_size + strings_size;
- buffer = talloc_zero_size(tracee->ctx, buffer_size);
- if (buffer == NULL)
- return -ENOMEM;
-
- cursor = buffer;
-
- /* Load script statement: open. */
- statement = cursor;
- statement->action = LOAD_ACTION_OPEN;
- statement->open.string_address = string1_address;
-
- cursor += LOAD_STATEMENT_SIZE(*statement, open);
-
- /* Load script statements: mmap. */
- cursor = transcript_mappings(cursor, tracee->load_info->mappings);
-
- if (tracee->load_info->interp != NULL) {
- /* Load script statement: open. */
- statement = cursor;
- statement->action = LOAD_ACTION_OPEN_NEXT;
- statement->open.string_address = string2_address;
-
- cursor += LOAD_STATEMENT_SIZE(*statement, open);
-
- /* Load script statements: mmap. */
- cursor = transcript_mappings(cursor, tracee->load_info->interp->mappings);
-
- entry_point = ELF_FIELD(tracee->load_info->interp->elf_header, entry);
- }
- else
- entry_point = ELF_FIELD(tracee->load_info->elf_header, entry);
-
- if (needs_executable_stack) {
- /* Load script statement: stack_exec. */
- statement = cursor;
-
- statement->action = LOAD_ACTION_MAKE_STACK_EXEC;
- statement->make_stack_exec.start = stack_pointer & page_mask;
-
- cursor += LOAD_STATEMENT_SIZE(*statement, make_stack_exec);
- }
-
- /* Load script statement: start. */
- statement = cursor;
-
- /* Start of the program slightly differs when ptraced. */
- if (tracee->as_ptracee.ptracer != NULL)
- statement->action = LOAD_ACTION_START_TRACED;
- else
- statement->action = LOAD_ACTION_START;
-
- statement->start.stack_pointer = stack_pointer;
- statement->start.entry_point = entry_point;
- statement->start.at_phent = ELF_FIELD(tracee->load_info->elf_header, phentsize);
- statement->start.at_phnum = ELF_FIELD(tracee->load_info->elf_header, phnum);
- statement->start.at_entry = ELF_FIELD(tracee->load_info->elf_header, entry);
- statement->start.at_phdr = ELF_FIELD(tracee->load_info->elf_header, phoff)
- + tracee->load_info->mappings[0].addr;
- statement->start.at_execfn = string1_address;
-
- cursor += LOAD_STATEMENT_SIZE(*statement, start);
-
- /* Sanity check. */
- assert((uintptr_t) cursor - (uintptr_t) buffer == script_size);
-
- /* Convert the load script to the expected format. */
- if (is_32on64_mode(tracee)) {
- int i;
- for (i = 0; buffer + i * sizeof(uint64_t) < cursor; i++)
- ((uint32_t *) buffer)[i] = ((uint64_t *) buffer)[i];
- }
-
- /* Concatenate the load script and the strings. */
- memcpy(cursor, tracee->load_info->user_path, string1_size);
- cursor += string1_size;
-
- if (string2_size != 0) {
- memcpy(cursor, tracee->load_info->interp->user_path, string2_size);
- cursor += string2_size;
- }
-
- /* Sanity check. */
- cursor += padding_size;
- assert((uintptr_t) cursor - (uintptr_t) buffer == buffer_size);
-
- /* Allocate enough room in tracee's memory for the load
- * script, and make the first user argument points to this
- * location. Note that it is safe to update the stack pointer
- * manually since we are in execve sysexit. However it should
- * be done before transfering data since the kernel might not
- * allow page faults below the stack pointer. */
- poke_reg(tracee, STACK_POINTER, stack_pointer - buffer_size);
- poke_reg(tracee, USERARG_1, stack_pointer - buffer_size);
-
- /* Copy everything in the tracee's memory at once. */
- status = write_data(tracee, stack_pointer - buffer_size, buffer, buffer_size);
- if (status < 0)
- return status;
-
- /* Tracee's stack content is now as follow:
- *
- * +------------+ <- initial stack pointer (higher address)
- * | padding |
- * +------------+
- * | string3 |
- * +------------+
- * | string2 |
- * +------------+
- * | string1 |
- * +------------+
- * | start |
- * +------------+
- * | mmap anon |
- * +------------+
- * | mmap file |
- * +------------+
- * | open next |
- * +------------+
- * | mmap anon. |
- * +------------+
- * | mmap file |
- * +------------+
- * | open |
- * +------------+ <- stack pointer, userarg1 (word aligned)
- */
-
- /* Remember we are in the sysexit stage, so be sure the
- * current register values will be used as-is at the end. */
- save_current_regs(tracee, ORIGINAL);
- tracee->_regs_were_changed = true;
-
- return 0;
-}
-
-/**
- * Start the loading of @tracee. This function returns no error since
- * it's either too late to do anything useful (the calling process is
- * already replaced) or the error reported by the kernel
- * (syscall_result < 0) will be propagated as-is.
- */
-void translate_execve_exit(Tracee *tracee)
-{
- word_t syscall_result;
- int status;
-
- if (IS_NOTIFICATION_PTRACED_LOAD_DONE(tracee)) {
- /* Be sure not to confuse the ptracer with an
- * unexpected syscall/returned value. */
- poke_reg(tracee, SYSARG_RESULT, 0);
- set_sysnum(tracee, PR_execve);
-
- /* According to most ABIs, all registers have
- * undefined values at program startup except:
- *
- * - the stack pointer
- * - the instruction pointer
- * - the rtld_fini pointer
- * - the state flags
- */
- poke_reg(tracee, STACK_POINTER, peek_reg(tracee, ORIGINAL, SYSARG_2));
- poke_reg(tracee, INSTR_POINTER, peek_reg(tracee, ORIGINAL, SYSARG_3));
- poke_reg(tracee, RTLD_FINI, 0);
- poke_reg(tracee, STATE_FLAGS, 0);
-
-#if defined(ARCH_ARM_EABI) && defined(__thumb__)
- /* Leave ARM thumb mode */
- tracee->_regs[CURRENT].ARM_cpsr &= ~PSR_T_BIT;
-#endif
-
- /* Restore registers to their current values. */
- save_current_regs(tracee, ORIGINAL);
- tracee->_regs_were_changed = true;
-
- /* This is is required to make GDB work correctly
- * under PRoot, however it deserves to be used
- * unconditionally. */
- (void) bind_proc_pid_auxv(tracee);
-
- /* If the PTRACE_O_TRACEEXEC option is *not* in effect
- * for the execing tracee, the kernel delivers an
- * extra SIGTRAP to the tracee after execve(2)
- * *returns*. This is an ordinary signal (similar to
- * one which can be generated by "kill -TRAP"), not a
- * special kind of ptrace-stop. Employing
- * PTRACE_GETSIGINFO for this signal returns si_code
- * set to 0 (SI_USER). This signal may be blocked by
- * signal mask, and thus may be delivered (much)
- * later. -- man 2 ptrace
- *
- * This signal is delayed so far since the program was
- * not fully loaded yet; GDB would get "invalid
- * adress" errors otherwise. */
- if ((tracee->as_ptracee.options & PTRACE_O_TRACEEXEC) == 0)
- kill(tracee->pid, SIGTRAP);
-
- return;
- }
-
-#ifdef ARCH_ARM64
- tracee->is_aarch32 = IS_CLASS32(tracee->load_info->elf_header);
-#endif
-
- syscall_result = peek_reg(tracee, CURRENT, SYSARG_RESULT);
- if ((int) syscall_result < 0)
- return;
-
- /* Execve happened; commit the new "/proc/self/exe". */
- if (tracee->new_exe != NULL) {
- (void) talloc_unlink(tracee, tracee->exe);
- tracee->exe = talloc_reference(tracee, tracee->new_exe);
- talloc_set_name_const(tracee->exe, "$exe");
- }
-
- /* New processes have no heap. The process could've been cloned with
- * CLONE_VM so it has been sharing the heap with its parent. execve()
- * discards the VM so make sure to reallocate new heap. */
- if (talloc_reference_count(tracee->heap) > 0) {
- talloc_unlink(tracee, tracee->heap);
- tracee->heap = talloc_zero(tracee, Heap);
- if (!tracee->heap)
- note(tracee, ERROR, INTERNAL, "can't allocate heap");
- } else {
- bzero(tracee->heap, sizeof(Heap));
- }
-
- status = transfer_load_script(tracee);
- if (status < 0)
- note(tracee, ERROR, INTERNAL, "can't transfer load script: %s", strerror(-status));
-
- return;
-}
diff --git a/app/src/main/cpp/proot/src/loader/assembly-arm.h b/app/src/main/cpp/proot/src/loader/assembly-arm.h
deleted file mode 100644
index 6848d4d..0000000
--- a/app/src/main/cpp/proot/src/loader/assembly-arm.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/* According to the ARM EABI, all registers have undefined values at
- * program startup except:
- *
- * - the instruction pointer (r15)
- * - the stack pointer (r13)
- * - the rtld_fini pointer (r0)
- */
-#define BRANCH(stack_pointer, destination) do { \
- asm volatile ( \
- "// Restore initial stack pointer. \n\t" \
- "mov sp, %0 \n\t" \
- " \n\t" \
- "// Clear rtld_fini. \n\t" \
- "mov r0, #0 \n\t" \
- " \n\t" \
- "// Start the program. \n\t" \
- "bx %1 \n" \
- : /* no output */ \
- : "r" (stack_pointer), "r" (destination) \
- : "memory", "sp", "r0", "pc"); \
- __builtin_unreachable(); \
- } while (0)
-
-#define PREPARE_ARGS_1(arg1_) \
- register word_t arg1 asm("r0") = arg1_; \
-
-#define PREPARE_ARGS_3(arg1_, arg2_, arg3_) \
- PREPARE_ARGS_1(arg1_) \
- register word_t arg2 asm("r1") = arg2_; \
- register word_t arg3 asm("r2") = arg3_; \
-
-#define PREPARE_ARGS_6(arg1_, arg2_, arg3_, arg4_, arg5_, arg6_) \
- PREPARE_ARGS_3(arg1_, arg2_, arg3_) \
- register word_t arg4 asm("r3") = arg4_; \
- register word_t arg5 asm("r4") = arg5_; \
- register word_t arg6 asm("r5") = arg6_;
-
-#define OUTPUT_CONTRAINTS_1 \
- "r" (arg1)
-
-#define OUTPUT_CONTRAINTS_3 \
- OUTPUT_CONTRAINTS_1, \
- "r" (arg2), "r" (arg3)
-
-#define OUTPUT_CONTRAINTS_6 \
- OUTPUT_CONTRAINTS_3, \
- "r" (arg4), "r" (arg5), "r" (arg6)
-
-#ifdef __thumb__
-#define STRINGIFY_EXPANDED(s) #s
-#define SYSCALL(number_, nb_args, args...) \
- ({ \
- register word_t result asm("r0"); \
- PREPARE_ARGS_##nb_args(args) \
- asm volatile ( \
- "push {r7} \n\t" \
- "mov r7, #" STRINGIFY_EXPANDED(number_) "\n\t" \
- "svc #0x00000000 \n\t" \
- "pop {r7} \n\t" \
- : "=r" (result) \
- : OUTPUT_CONTRAINTS_##nb_args \
- : "memory"); \
- result; \
- })
-#else
-#define SYSCALL(number_, nb_args, args...) \
- ({ \
- register word_t number asm("r7") = number_; \
- register word_t result asm("r0"); \
- PREPARE_ARGS_##nb_args(args) \
- asm volatile ( \
- "svc #0x00000000 \n\t" \
- : "=r" (result) \
- : "r" (number), \
- OUTPUT_CONTRAINTS_##nb_args \
- : "memory"); \
- result; \
- })
-#endif
-
-#define OPEN 5
-#define CLOSE 6
-#define MMAP 192
-#define MMAP_OFFSET_SHIFT 12
-#define EXECVE 11
-#define EXIT 1
-#define PRCTL 172
-#define MPROTECT 125
-
diff --git a/app/src/main/cpp/proot/src/loader/assembly-arm64.h b/app/src/main/cpp/proot/src/loader/assembly-arm64.h
deleted file mode 100644
index 4a79db3..0000000
--- a/app/src/main/cpp/proot/src/loader/assembly-arm64.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/* According to the ARM64 EABI, all registers have undefined values at
- * program startup except:
- *
- * - the instruction pointer (pc)
- * - the stack pointer (sp)
- * - the rtld_fini pointer (x0)
- */
-#define BRANCH(stack_pointer, destination) do { \
- asm volatile ( \
- "// Restore initial stack pointer. \n\t" \
- "mov sp, %0 \n\t" \
- " \n\t" \
- "// Clear rtld_fini. \n\t" \
- "mov x0, #0 \n\t" \
- " \n\t" \
- "// Start the program. \n\t" \
- "br %1 \n" \
- : /* no output */ \
- : "r" (stack_pointer), "r" (destination) \
- : "memory", "sp", "x0"); \
- __builtin_unreachable(); \
- } while (0)
-
-#define PREPARE_ARGS_1(arg1_) \
- register word_t arg1 asm("x0") = arg1_; \
-
-#define PREPARE_ARGS_3(arg1_, arg2_, arg3_) \
- PREPARE_ARGS_1(arg1_) \
- register word_t arg2 asm("x1") = arg2_; \
- register word_t arg3 asm("x2") = arg3_; \
-
-#define PREPARE_ARGS_4(arg1_, arg2_, arg3_, arg4_) \
- PREPARE_ARGS_3(arg1_, arg2_, arg3_) \
- register word_t arg4 asm("x3") = arg4_; \
-
-#define PREPARE_ARGS_6(arg1_, arg2_, arg3_, arg4_, arg5_, arg6_) \
- PREPARE_ARGS_4(arg1_, arg2_, arg3_, arg4_) \
- register word_t arg5 asm("x4") = arg5_; \
- register word_t arg6 asm("x5") = arg6_;
-
-#define OUTPUT_CONTRAINTS_1 \
- "r" (arg1)
-
-#define OUTPUT_CONTRAINTS_3 \
- OUTPUT_CONTRAINTS_1, \
- "r" (arg2), "r" (arg3)
-
-#define OUTPUT_CONTRAINTS_4 \
- OUTPUT_CONTRAINTS_3, \
- "r" (arg4)
-
-#define OUTPUT_CONTRAINTS_6 \
- OUTPUT_CONTRAINTS_4, \
- "r" (arg5), "r" (arg6)
-
-#define SYSCALL(number_, nb_args, args...) \
- ({ \
- register word_t number asm("x8") = number_; \
- register word_t result asm("x0"); \
- PREPARE_ARGS_##nb_args(args) \
- asm volatile ( \
- "svc #0x00000000 \n\t" \
- : "=r" (result) \
- : "r" (number), \
- OUTPUT_CONTRAINTS_##nb_args \
- : "memory"); \
- result; \
- })
-
-#define OPENAT 56
-#define CLOSE 57
-#define MMAP 222
-#define EXECVE 221
-#define EXIT 93
-#define PRCTL 167
-#define MPROTECT 226
diff --git a/app/src/main/cpp/proot/src/loader/loader.c b/app/src/main/cpp/proot/src/loader/loader.c
deleted file mode 100644
index 4842761..0000000
--- a/app/src/main/cpp/proot/src/loader/loader.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* bool, true, false, */
-
-#define NO_LIBC_HEADER
-#include "loader/script.h"
-#include "compat.h"
-#include "arch.h"
-
-#if defined(ARCH_ARM_EABI)
- #include "loader/assembly-arm.h"
-#elif defined(ARCH_ARM64)
- #include "loader/assembly-arm64.h"
-#else
- #error "Unsupported architecture"
-#endif
-
-#if !defined(MMAP_OFFSET_SHIFT)
- #define MMAP_OFFSET_SHIFT 0
-#endif
-
-#define FATAL() do { \
- SYSCALL(EXIT, 1, 182); \
- __builtin_unreachable(); \
- } while (0)
-
-#define unlikely(expr) __builtin_expect(!!(expr), 0)
-
-/**
- * Clear the memory from @start (inclusive) to @end (exclusive).
- */
-static inline void clear(word_t start, word_t end)
-{
- byte_t *start_misaligned;
- byte_t *end_misaligned;
-
- word_t *start_aligned;
- word_t *end_aligned;
-
- /* Compute the number of mis-aligned bytes. */
- word_t start_bytes = start % sizeof(word_t);
- word_t end_bytes = end % sizeof(word_t);
-
- /* Compute aligned addresses. */
- start_aligned = (word_t *) (start_bytes ? start + sizeof(word_t) - start_bytes : start);
- end_aligned = (word_t *) (end - end_bytes);
-
- /* Clear leading mis-aligned bytes. */
- start_misaligned = (byte_t *) start;
- while (start_misaligned < (byte_t *) start_aligned)
- *start_misaligned++ = 0;
-
- /* Clear aligned bytes. */
- while (start_aligned < end_aligned)
- *start_aligned++ = 0;
-
- /* Clear trailing mis-aligned bytes. */
- end_misaligned = (byte_t *) end_aligned;
- while (end_misaligned < (byte_t *) end)
- *end_misaligned++ = 0;
-}
-
-/**
- * Return the address of the last path component of @string_. Note
- * that @string_ is not modified.
- */
-static inline word_t basename(word_t string_)
-{
- byte_t *string = (byte_t *) string_;
- byte_t *cursor;
-
- for (cursor = string; *cursor != 0; cursor++)
- ;
-
- for (; *cursor != (byte_t) '/' && cursor > string; cursor--)
- ;
-
- if (cursor != string)
- cursor++;
-
- return (word_t) cursor;
-}
-
-/**
- * Interpret the load script pointed to by @cursor.
- */
-void _start(void *cursor)
-{
- bool traced = false;
- bool reset_at_base = true;
- word_t at_base = 0;
-
- word_t fd = -1;
- word_t status;
-
- while(1) {
- LoadStatement *stmt = cursor;
-
- switch (stmt->action) {
- case LOAD_ACTION_OPEN_NEXT:
- status = SYSCALL(CLOSE, 1, fd);
- if (unlikely((int) status < 0))
- FATAL();
- /* Fall through. */
-
- case LOAD_ACTION_OPEN:
-#if defined(OPEN)
- fd = SYSCALL(OPEN, 3, stmt->open.string_address, O_RDONLY, 0);
-#else
- fd = SYSCALL(OPENAT, 4, AT_FDCWD, stmt->open.string_address, O_RDONLY, 0);
-#endif
- if (unlikely((int) fd < 0))
- FATAL();
-
- reset_at_base = true;
-
- cursor += LOAD_STATEMENT_SIZE(*stmt, open);
- break;
-
- case LOAD_ACTION_MMAP_FILE:
- status = SYSCALL(MMAP, 6, stmt->mmap.addr, stmt->mmap.length,
- stmt->mmap.prot, MAP_PRIVATE | MAP_FIXED, fd,
- stmt->mmap.offset >> MMAP_OFFSET_SHIFT);
- if (unlikely(status != stmt->mmap.addr))
- FATAL();
-
- if (stmt->mmap.clear_length != 0)
- clear(stmt->mmap.addr + stmt->mmap.length - stmt->mmap.clear_length,
- stmt->mmap.addr + stmt->mmap.length);
-
- if (reset_at_base) {
- at_base = stmt->mmap.addr;
- reset_at_base = false;
- }
-
- cursor += LOAD_STATEMENT_SIZE(*stmt, mmap);
- break;
-
- case LOAD_ACTION_MMAP_ANON:
- status = SYSCALL(MMAP, 6, stmt->mmap.addr, stmt->mmap.length,
- stmt->mmap.prot, MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
- if (unlikely(status != stmt->mmap.addr))
- FATAL();
-
- cursor += LOAD_STATEMENT_SIZE(*stmt, mmap);
- break;
-
- case LOAD_ACTION_MAKE_STACK_EXEC:
- SYSCALL(MPROTECT, 3,
- stmt->make_stack_exec.start, 1,
- PROT_READ | PROT_WRITE | PROT_EXEC | PROT_GROWSDOWN);
-
- cursor += LOAD_STATEMENT_SIZE(*stmt, make_stack_exec);
- break;
-
- case LOAD_ACTION_START_TRACED:
- traced = true;
- /* Fall through. */
-
- case LOAD_ACTION_START: {
- word_t *cursor2 = (word_t *) stmt->start.stack_pointer;
- const word_t argc = cursor2[0];
- const word_t at_execfn = cursor2[1];
- word_t name;
-
- status = SYSCALL(CLOSE, 1, fd);
- if (unlikely((int) status < 0))
- FATAL();
-
- /* Right after execve, the stack content is as follow:
- *
- * +------+--------+--------+--------+
- * | argc | argv[] | envp[] | auxv[] |
- * +------+--------+--------+--------+
- */
-
- /* Skip argv[]. */
- cursor2 += argc + 1;
-
- /* Skip envp[]. */
- do cursor2++; while (cursor2[0] != 0);
- cursor2++;
-
- /* Adjust auxv[]. */
- do {
- switch (cursor2[0]) {
- case AT_PHDR:
- cursor2[1] = stmt->start.at_phdr;
- break;
-
- case AT_PHENT:
- cursor2[1] = stmt->start.at_phent;
- break;
-
- case AT_PHNUM:
- cursor2[1] = stmt->start.at_phnum;
- break;
-
- case AT_ENTRY:
- cursor2[1] = stmt->start.at_entry;
- break;
-
- case AT_BASE:
- cursor2[1] = at_base;
- break;
-
- case AT_EXECFN:
- /* stmt->start.at_execfn can't be used for now since it is
- * currently stored in a location that will be scratched
- * by the process (below the final stack pointer). */
- cursor2[1] = at_execfn;
- break;
-
- default:
- break;
- }
- cursor2 += 2;
- } while (cursor2[0] != AT_NULL);
-
- /* Note that only 2 arguments are actually necessary... */
- name = basename(stmt->start.at_execfn);
- SYSCALL(PRCTL, 3, PR_SET_NAME, name, 0);
-
- if (unlikely(traced))
- SYSCALL(EXECVE, 6, 1,
- stmt->start.stack_pointer,
- stmt->start.entry_point, 2, 3, 4);
- else
- BRANCH(stmt->start.stack_pointer, stmt->start.entry_point);
- FATAL();
- }
-
- default:
- FATAL();
- }
- }
-
- FATAL();
-}
diff --git a/app/src/main/cpp/proot/src/loader/script.h b/app/src/main/cpp/proot/src/loader/script.h
deleted file mode 100644
index 6ae7621..0000000
--- a/app/src/main/cpp/proot/src/loader/script.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef SCRIPT
-#define SCRIPT
-
-#include "arch.h"
-#include "attribute.h"
-
-struct load_statement {
- word_t action;
-
- union {
- struct {
- word_t string_address;
- } open;
-
- struct {
- word_t addr;
- word_t length;
- word_t prot;
- word_t offset;
- word_t clear_length;
- } mmap;
-
- struct {
- word_t start;
- } make_stack_exec;
-
- struct {
- word_t stack_pointer;
- word_t entry_point;
- word_t at_phdr;
- word_t at_phent;
- word_t at_phnum;
- word_t at_entry;
- word_t at_execfn;
- } start;
- };
-} PACKED;
-
-typedef struct load_statement LoadStatement;
-
-#define LOAD_STATEMENT_SIZE(statement, type) \
- (sizeof((statement).action) + sizeof((statement).type))
-
-/* Don't use enum, since sizeof(enum) doesn't have to be equal to
- * sizeof(word_t). Keep values in the same order as their respective
- * actions appear in loader.c to get a change GCC produces a jump
- * table. */
-#define LOAD_ACTION_OPEN_NEXT 0
-#define LOAD_ACTION_OPEN 1
-#define LOAD_ACTION_MMAP_FILE 2
-#define LOAD_ACTION_MMAP_ANON 3
-#define LOAD_ACTION_MAKE_STACK_EXEC 4
-#define LOAD_ACTION_START_TRACED 5
-#define LOAD_ACTION_START 6
-
-#endif /* SCRIPT */
diff --git a/app/src/main/cpp/proot/src/path/binding.c b/app/src/main/cpp/proot/src/path/binding.c
deleted file mode 100644
index 1012846..0000000
--- a/app/src/main/cpp/proot/src/path/binding.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* lstat(2), */
-#include /* getcwd(2), lstat(2), */
-#include /* string(3), */
-#include /* bzero(3), */
-#include /* assert(3), */
-#include /* PATH_MAX, */
-#include /* E* */
-#include /* CIRCLEQ_*, */
-#include /* talloc_*, */
-
-#include "path/binding.h"
-#include "path/path.h"
-#include "path/canon.h"
-#include "cli/note.h"
-
-#include "compat.h"
-
-#define HEAD(tracee, side) \
- (side == GUEST \
- ? (tracee)->fs->bindings.guest \
- : (side == HOST \
- ? (tracee)->fs->bindings.host \
- : (tracee)->fs->bindings.pending))
-
-#define NEXT(binding, side) \
- (side == GUEST \
- ? CIRCLEQ_NEXT(binding, link.guest) \
- : (side == HOST \
- ? CIRCLEQ_NEXT(binding, link.host) \
- : CIRCLEQ_NEXT(binding, link.pending)))
-
-#define CIRCLEQ_FOREACH_(tracee, binding, side) \
- for (binding = CIRCLEQ_FIRST(HEAD(tracee, side)); \
- binding != (void *) HEAD(tracee, side); \
- binding = NEXT(binding, side))
-
-#define CIRCLEQ_INSERT_AFTER_(tracee, previous, binding, side) do { \
- switch (side) { \
- case GUEST: CIRCLEQ_INSERT_AFTER(HEAD(tracee, side), previous, binding, link.guest); break; \
- case HOST: CIRCLEQ_INSERT_AFTER(HEAD(tracee, side), previous, binding, link.host); break; \
- default: CIRCLEQ_INSERT_AFTER(HEAD(tracee, side), previous, binding, link.pending); break; \
- } \
- (void) talloc_reference(HEAD(tracee, side), binding); \
-} while (0)
-
-#define CIRCLEQ_INSERT_BEFORE_(tracee, next, binding, side) do { \
- switch (side) { \
- case GUEST: CIRCLEQ_INSERT_BEFORE(HEAD(tracee, side), next, binding, link.guest); break; \
- case HOST: CIRCLEQ_INSERT_BEFORE(HEAD(tracee, side), next, binding, link.host); break; \
- default: CIRCLEQ_INSERT_BEFORE(HEAD(tracee, side), next, binding, link.pending); break; \
- } \
- (void) talloc_reference(HEAD(tracee, side), binding); \
-} while (0)
-
-#define CIRCLEQ_INSERT_HEAD_(tracee, binding, side) do { \
- switch (side) { \
- case GUEST: CIRCLEQ_INSERT_HEAD(HEAD(tracee, side), binding, link.guest); break; \
- case HOST: CIRCLEQ_INSERT_HEAD(HEAD(tracee, side), binding, link.host); break; \
- default: CIRCLEQ_INSERT_HEAD(HEAD(tracee, side), binding, link.pending); break; \
- } \
- (void) talloc_reference(HEAD(tracee, side), binding); \
-} while (0)
-
-#define IS_LINKED(binding, link) \
- ((binding)->link.cqe_next != NULL && (binding)->link.cqe_prev != NULL)
-
-#define CIRCLEQ_REMOVE_(tracee, binding, name) do { \
- CIRCLEQ_REMOVE((tracee)->fs->bindings.name, binding, link.name);\
- (binding)->link.name.cqe_next = NULL; \
- (binding)->link.name.cqe_prev = NULL; \
- talloc_unlink((tracee)->fs->bindings.name, binding); \
-} while (0)
-
-extern char *root_path;
-
-/**
- * Print all bindings (verbose purpose).
- */
-static void print_bindings(const Tracee *tracee)
-{
- const Binding *binding;
-
- if (tracee->fs->bindings.guest == NULL)
- return;
-
- CIRCLEQ_FOREACH_(tracee, binding, GUEST) {
- if (compare_paths(binding->host.path, binding->guest.path) == PATHS_ARE_EQUAL)
- note(tracee, INFO, USER, "binding = %s", binding->host.path);
- else
- note(tracee, INFO, USER, "binding = %s:%s",
- binding->host.path, binding->guest.path);
- }
-}
-
-/**
- * Get the binding for the given @path (relatively to the given
- * binding @side).
- */
-Binding *get_binding(const Tracee *tracee, Side side, const char path[PATH_MAX])
-{
- Binding *binding;
- size_t path_length = strlen(path);
-
- /* Sanity checks. */
- assert(path != NULL && path[0] == '/');
-
- CIRCLEQ_FOREACH_(tracee, binding, side) {
- Comparison comparison;
- const Path *ref;
-
- switch (side) {
- case GUEST:
- ref = &binding->guest;
- break;
-
- case HOST:
- ref = &binding->host;
- break;
-
- default:
- assert(0);
- return NULL;
- }
-
- comparison = compare_paths2(ref->path, ref->length, path, path_length);
- if ( comparison != PATHS_ARE_EQUAL
- && comparison != PATH1_IS_PREFIX)
- continue;
-
- /* Avoid false positive when a prefix of the rootfs is
- * used as an asymmetric binding, ex.:
- *
- * proot -m /usr:/location /usr/local/slackware
- */
- if ( side == HOST
- && compare_paths(root_path, "/") != PATHS_ARE_EQUAL
- && belongs_to_guestfs(path))
- continue;
-
- return binding;
- }
-
- return NULL;
-}
-
-/**
- * Get the binding path for the given @path (relatively to the given
- * binding @side).
- */
-const char *get_path_binding(const Tracee *tracee, Side side, const char path[PATH_MAX])
-{
- const Binding *binding;
-
- binding = get_binding(tracee, side, path);
- if (!binding)
- return NULL;
-
- switch (side) {
- case GUEST:
- return binding->guest.path;
-
- case HOST:
- return binding->host.path;
-
- default:
- assert(0);
- return NULL;
- }
-}
-
-/**
- * Substitute the guest path (if any) with the host path in @path.
- * This function returns:
- *
- * * -errno if an error occured
- *
- * * 0 if it is a binding location but no substitution is needed
- * ("symetric" binding)
- *
- * * 1 if it is a binding location and a substitution was performed
- * ("asymmetric" binding)
- */
-int substitute_binding(const Tracee *tracee, Side side, char path[PATH_MAX])
-{
- const Path *reverse_ref;
- const Path *ref;
- const Binding *binding;
-
- binding = get_binding(tracee, side, path);
- if (!binding)
- return -ENOENT;
-
- /* Is it a "symetric" binding? */
- if (!binding->need_substitution)
- return 0;
-
- switch (side) {
- case GUEST:
- ref = &binding->guest;
- reverse_ref = &binding->host;
- break;
-
- case HOST:
- ref = &binding->host;
- reverse_ref = &binding->guest;
- break;
-
- default:
- assert(0);
- return -EACCES;
- }
-
- substitute_path_prefix(path, ref->length, reverse_ref->path, reverse_ref->length);
-
- return 1;
-}
-
-/**
- * Remove @binding from all the @tracee's lists of bindings it belongs to.
- */
-void remove_binding_from_all_lists(const Tracee *tracee, Binding *binding)
-{
- if (IS_LINKED(binding, link.pending))
- CIRCLEQ_REMOVE_(tracee, binding, pending);
-
- if (IS_LINKED(binding, link.guest))
- CIRCLEQ_REMOVE_(tracee, binding, guest);
-
- if (IS_LINKED(binding, link.host))
- CIRCLEQ_REMOVE_(tracee, binding, host);
-}
-
-/**
- * Insert @binding into the list of @bindings, in a sorted manner so
- * as to make the substitution of nested bindings determistic, ex.:
- *
- * -b /bin:/foo/bin -b /usr/bin/more:/foo/bin/more
- *
- * Note: "nested" from the @side point-of-view.
- */
-static void insort_binding(const Tracee *tracee, Side side, Binding *binding)
-{
- Binding *iterator;
- Binding *previous = NULL;
- Binding *next = CIRCLEQ_FIRST(HEAD(tracee, side));
-
- /* Find where it should be added in the list. */
- CIRCLEQ_FOREACH_(tracee, iterator, side) {
- Comparison comparison;
- const Path *binding_path;
- const Path *iterator_path;
-
- switch (side) {
- case PENDING:
- case GUEST:
- binding_path = &binding->guest;
- iterator_path = &iterator->guest;
- break;
-
- case HOST:
- binding_path = &binding->host;
- iterator_path = &iterator->host;
- break;
-
- default:
- assert(0);
- return;
- }
-
- comparison = compare_paths2(binding_path->path, binding_path->length,
- iterator_path->path, iterator_path->length);
- switch (comparison) {
- case PATHS_ARE_EQUAL:
- if (side == HOST) {
- previous = iterator;
- break;
- }
-
- if (tracee->verbose > 0 && getenv("PROOT_IGNORE_MISSING_BINDINGS") == NULL) {
- note(tracee, WARNING, USER,
- "both '%s' and '%s' are bound to '%s', "
- "only the last binding is active.",
- iterator->host.path, binding->host.path,
- binding->guest.path);
- }
-
- /* Replace this iterator with the new binding. */
- CIRCLEQ_INSERT_AFTER_(tracee, iterator, binding, side);
- remove_binding_from_all_lists(tracee, iterator);
- return;
-
- case PATH1_IS_PREFIX:
- /* The new binding contains the iterator. */
- previous = iterator;
- break;
-
- case PATH2_IS_PREFIX:
- /* The iterator contains the new binding.
- * Use the deepest container. */
- if (next == (void *) HEAD(tracee, side))
- next = iterator;
- break;
-
- case PATHS_ARE_NOT_COMPARABLE:
- break;
-
- default:
- assert(0);
- return;
- }
- }
-
- /* Insert this binding in the list. */
- if (previous != NULL)
- CIRCLEQ_INSERT_AFTER_(tracee, previous, binding, side);
- else if (next != (void *) HEAD(tracee, side))
- CIRCLEQ_INSERT_BEFORE_(tracee, next, binding, side);
- else
- CIRCLEQ_INSERT_HEAD_(tracee, binding, side);
-}
-
-/**
- * c.f. function above.
- */
-static void insort_binding2(const Tracee *tracee, Binding *binding)
-{
- binding->need_substitution =
- compare_paths(binding->host.path, binding->guest.path) != PATHS_ARE_EQUAL;
-
- insort_binding(tracee, GUEST, binding);
- insort_binding(tracee, HOST, binding);
-}
-
-/**
- * Create and insert a new binding (@host_path:@guest_path) into the
- * list of @tracee's bindings. The Talloc parent of this new binding
- * is @context. This function returns NULL if an error occurred,
- * otherwise a pointer to the newly created binding.
- */
-Binding *insort_binding3(const Tracee *tracee, const TALLOC_CTX *context,
- const char host_path[PATH_MAX],
- const char guest_path[PATH_MAX])
-{
- Binding *binding;
-
- binding = talloc_zero(context, Binding);
- if (binding == NULL)
- return NULL;
-
- strcpy(binding->host.path, host_path);
- strcpy(binding->guest.path, guest_path);
-
- binding->host.length = strlen(binding->host.path);
- binding->guest.length = strlen(binding->guest.path);
-
- insort_binding2(tracee, binding);
-
- return binding;
-}
-
-/**
- * Free all bindings from @bindings.
- *
- * Note: this is a Talloc destructor.
- */
-static int remove_bindings(Bindings *bindings)
-{
- Binding *binding;
- Tracee *tracee;
-
- /* Unlink all bindings from the @link list. */
-#define CIRCLEQ_REMOVE_ALL(name) do { \
- binding = CIRCLEQ_FIRST(bindings); \
- while (binding != (void *) bindings) { \
- Binding *next = CIRCLEQ_NEXT(binding, link.name);\
- CIRCLEQ_REMOVE_(tracee, binding, name); \
- binding = next; \
- } \
-} while (0)
-
- /* Search which link is used by this list. */
- tracee = TRACEE(bindings);
- if (bindings == tracee->fs->bindings.pending)
- CIRCLEQ_REMOVE_ALL(pending);
- else if (bindings == tracee->fs->bindings.guest)
- CIRCLEQ_REMOVE_ALL(guest);
- else if (bindings == tracee->fs->bindings.host)
- CIRCLEQ_REMOVE_ALL(host);
-
- bzero(bindings, sizeof(Bindings));
-
- return 0;
-}
-
-/**
- * Allocate a new binding "@host:@guest" and attach it to
- * @tracee->fs->bindings.pending. This function complains about
- * missing @host path only if @must_exist is true. This function
- * returns the allocated binding on success, NULL on error.
- */
-Binding *new_binding(Tracee *tracee, const char *host, const char *guest, bool must_exist)
-{
- Binding *binding;
- char base[PATH_MAX];
- int status;
-
- /* Lasy allocation of the list of bindings specified by the
- * user. This list will be used by initialize_bindings(). */
- if (tracee->fs->bindings.pending == NULL) {
- tracee->fs->bindings.pending = talloc_zero(tracee->fs, Bindings);
- if (tracee->fs->bindings.pending == NULL)
- return NULL;
- CIRCLEQ_INIT(tracee->fs->bindings.pending);
- talloc_set_destructor(tracee->fs->bindings.pending, remove_bindings);
- }
-
- /* Allocate an empty binding. */
- binding = talloc_zero(tracee->ctx, Binding);
- if (binding == NULL)
- return NULL;
-
- /* Canonicalize the host part of the binding, as expected by
- * get_binding(). */
- status = realpath2(tracee->reconf.tracee, binding->host.path, host, true);
- if (status < 0) {
- if (must_exist && getenv("PROOT_IGNORE_MISSING_BINDINGS") == NULL)
- note(tracee, WARNING, INTERNAL, "can't sanitize binding \"%s\": %s",
- host, strerror(-status));
- goto error;
- }
- binding->host.length = strlen(binding->host.path);
-
- /* Symetric binding? */
- guest = guest ?: host;
-
- /* When not absolute, assume the guest path is relative to the
- * current working directory, as with ``-b .`` for instance. */
- if (guest[0] != '/') {
- status = getcwd2(tracee->reconf.tracee, base);
- if (status < 0) {
- note(tracee, WARNING, INTERNAL, "can't sanitize binding \"%s\": %s",
- binding->guest.path, strerror(-status));
- goto error;
- }
- }
- else
- strcpy(base, "/");
-
- join_paths(binding->guest.path, base, guest);
- binding->guest.length = strlen(binding->guest.path);
-
- /* Keep the list of bindings specified by the user ordered,
- * for the sake of consistency. For instance binding to "/"
- * has to be the last in the list. */
- insort_binding(tracee, PENDING, binding);
-
- return binding;
-
-error:
- TALLOC_FREE(binding);
- return NULL;
-}
-
-/**
- * Canonicalize the guest part of the given @binding, insert it into
- * @tracee->fs->bindings.guest and @tracee->fs->bindings.host. This
- * function returns -1 if an error occured, 0 otherwise.
- */
-static void initialize_binding(Tracee *tracee, Binding *binding)
-{
- char path[PATH_MAX];
- struct stat statl;
- int status;
-
- /* All bindings but "/" must be canonicalized. The exception
- * for "/" is required to bootstrap the canonicalization. */
- if (compare_paths(binding->guest.path, "/") != PATHS_ARE_EQUAL) {
- bool dereference;
- size_t length;
-
- strcpy(path, binding->guest.path);
- length = strlen(path);
- assert(length > 0);
-
- /* Does the user explicitly tell not to dereference
- * guest path? */
- dereference = (path[length - 1] != '!');
- if (!dereference)
- path[length - 1] = '\0';
-
- /* Initial state before canonicalization. */
- strcpy(binding->guest.path, "/");
-
- /* Remember the type of the final component, it will
- * be used in build_glue() later. */
- status = lstat(binding->host.path, &statl);
- tracee->glue_type = (status < 0 || S_ISBLK(statl.st_mode) || S_ISCHR(statl.st_mode)
- ? S_IFREG : statl.st_mode & S_IFMT);
-
- /* Sanitize the guest path of the binding within the
- alternate rootfs since it is assumed by
- substitute_binding(). */
- status = canonicalize(tracee, path, dereference, binding->guest.path, 0);
- if (status < 0) {
- note(tracee, WARNING, INTERNAL,
- "sanitizing the guest path (binding) \"%s\": %s",
- path, strerror(-status));
- return;
- }
-
- /* Remove the trailing "/" or "/." as expected by
- * substitute_binding(). */
- chop_finality(binding->guest.path);
-
- /* Disable definitively the creation of the glue for
- * this binding. */
- tracee->glue_type = 0;
- }
-
- binding->guest.length = strlen(binding->guest.path);
-
- insort_binding2(tracee, binding);
-}
-
-/**
- * Add bindings induced by @new_binding when @tracee is being sub-reconfigured.
- * For example, if the previous configuration ("-r /rootfs1") contains this
- * binding:
- *
- * -b /home/ced:/usr/local/ced
- *
- * and if the current configuration ("-r /rootfs2") introduces such a new
- * binding:
- *
- * -b /usr:/media
- *
- * then the following binding is induced:
- *
- * -b /home/ced:/media/local/ced
- */
-static void add_induced_bindings(Tracee *tracee, const Binding *new_binding)
-{
- Binding *old_binding;
- char path[PATH_MAX];
- int status;
-
- /* Only for reconfiguration. */
- if (tracee->reconf.tracee == NULL)
- return;
-
- /* From the example, PRoot has already converted "-b /usr:/media" into
- * "-b /rootfs1/usr:/media" in order to ensure the host part is really a
- * host path. Here, the host part is converted back to "/usr" since the
- * comparison can't be made on "/rootfs1/usr".
- */
- strcpy(path, new_binding->host.path);
- status = detranslate_path(tracee->reconf.tracee, path, NULL);
- if (status < 0)
- return;
-
- CIRCLEQ_FOREACH_(tracee->reconf.tracee, old_binding, GUEST) {
- Binding *induced_binding;
- Comparison comparison;
- char path2[PATH_MAX];
- size_t prefix_length;
-
- /* Check if there's an induced binding by searching a common
- * path prefix in between new/old bindings:
- *
- * -b /home/ced:[/usr]/local/ced
- * -b [/usr]:/media
- */
- comparison = compare_paths(path, old_binding->guest.path);
- if (comparison != PATH1_IS_PREFIX)
- continue;
-
- /* Convert the path of this induced binding to the new
- * filesystem namespace. From the example, "/usr/local/ced" is
- * converted into "/media/local/ced". Note: substitute_binding
- * can't be used in this case since it would expect
- * "/rootfs1/usr/local/ced instead".
- */
- prefix_length = strlen(path);
- if (prefix_length == 1)
- prefix_length = 0;
-
- join_paths(path2, new_binding->guest.path, old_binding->guest.path + prefix_length);
-
- /* Install the induced binding. From the example:
- *
- * -b /home/ced:/media/local/ced
- */
- induced_binding = talloc_zero(tracee->ctx, Binding);
- if (induced_binding == NULL)
- continue;
-
- strcpy(induced_binding->host.path, old_binding->host.path);
- strcpy(induced_binding->guest.path, path2);
-
- induced_binding->host.length = strlen(induced_binding->host.path);
- induced_binding->guest.length = strlen(induced_binding->guest.path);
-
- VERBOSE(tracee, 2, "induced binding: %s:%s (old) & %s:%s (new) -> %s:%s (induced)",
- old_binding->host.path, old_binding->guest.path, path, new_binding->guest.path,
- induced_binding->host.path, induced_binding->guest.path);
-
- insort_binding2(tracee, induced_binding);
- }
-}
-
-/**
- * Allocate @tracee->fs->bindings.guest and
- * @tracee->fs->bindings.host, then call initialize_binding() on each
- * binding listed in @tracee->fs->bindings.pending.
- */
-int initialize_bindings(Tracee *tracee)
-{
- Binding *binding;
-
- /* Sanity checks. */
- assert(root_path != NULL);
- assert(tracee->fs->bindings.pending != NULL);
- assert(tracee->fs->bindings.guest == NULL);
- assert(tracee->fs->bindings.host == NULL);
-
- /* Allocate @tracee->fs->bindings.guest and
- * @tracee->fs->bindings.host. */
- tracee->fs->bindings.guest = talloc_zero(tracee->fs, Bindings);
- tracee->fs->bindings.host = talloc_zero(tracee->fs, Bindings);
- if (tracee->fs->bindings.guest == NULL || tracee->fs->bindings.host == NULL) {
- note(tracee, ERROR, INTERNAL, "can't allocate enough memory");
- TALLOC_FREE(tracee->fs->bindings.guest);
- TALLOC_FREE(tracee->fs->bindings.host);
- return -1;
- }
-
- CIRCLEQ_INIT(tracee->fs->bindings.guest);
- CIRCLEQ_INIT(tracee->fs->bindings.host);
-
- talloc_set_destructor(tracee->fs->bindings.guest, remove_bindings);
- talloc_set_destructor(tracee->fs->bindings.host, remove_bindings);
-
- /* The binding to "/" has to be installed before other
- * bindings since this former is required to canonicalize
- * these latters. */
- binding = CIRCLEQ_LAST(tracee->fs->bindings.pending);
- assert(compare_paths(binding->guest.path, "/") == PATHS_ARE_EQUAL);
-
- /* Call initialize_binding() on each pending binding in
- * reverse order: the last binding "/" is used to bootstrap
- * the canonicalization. */
- while (binding != (void *) tracee->fs->bindings.pending) {
- Binding *previous;
- previous = CIRCLEQ_PREV(binding, link.pending);
-
- /* Canonicalize then insert this binding into
- * tracee->fs->bindings.guest/host. */
- initialize_binding(tracee, binding);
-
- /* Add induced bindings on sub-reconfiguration. */
- add_induced_bindings(tracee, binding);
-
- binding = previous;
- }
-
- TALLOC_FREE(tracee->fs->bindings.pending);
-
- if (tracee->verbose > 0)
- print_bindings(tracee);
-
- return 0;
-}
diff --git a/app/src/main/cpp/proot/src/path/binding.h b/app/src/main/cpp/proot/src/path/binding.h
deleted file mode 100644
index 8945e76..0000000
--- a/app/src/main/cpp/proot/src/path/binding.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef BINDING_H
-#define BINDING_H
-
-#include /* PATH_MAX, */
-#include
-
-#include "tracee/tracee.h"
-#include "path.h"
-
-typedef struct binding {
- Path host;
- Path guest;
-
- bool need_substitution;
-
- struct {
- CIRCLEQ_ENTRY(binding) pending;
- CIRCLEQ_ENTRY(binding) guest;
- CIRCLEQ_ENTRY(binding) host;
- } link;
-} Binding;
-
-typedef CIRCLEQ_HEAD(bindings, binding) Bindings;
-
-extern Binding *insort_binding3(const Tracee *tracee, const TALLOC_CTX *context,
- const char host_path[PATH_MAX], const char guest_path[PATH_MAX]);
-extern Binding *new_binding(Tracee *tracee, const char *host, const char *guest, bool must_exist);
-extern int initialize_bindings(Tracee *tracee);
-extern const char *get_path_binding(const Tracee* tracee, Side side, const char path[PATH_MAX]);
-extern Binding *get_binding(const Tracee *tracee, Side side, const char path[PATH_MAX]);
-extern int substitute_binding(const Tracee* tracee, Side side, char path[PATH_MAX]);
-extern void remove_binding_from_all_lists(const Tracee *tracee, Binding *binding);
-
-#endif /* BINDING_H */
diff --git a/app/src/main/cpp/proot/src/path/canon.c b/app/src/main/cpp/proot/src/path/canon.c
deleted file mode 100644
index 0382a25..0000000
--- a/app/src/main/cpp/proot/src/path/canon.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* pid_t */
-#include /* PATH_MAX, */
-#include /* MAXSYMLINKS, */
-#include /* E*, */
-#include /* lstat(2), S_ISREG(), */
-#include /* access(2), lstat(2), */
-#include /* string(3), */
-#include /* assert(3), */
-#include /* sscanf(3), */
-
-#include "path/canon.h"
-#include "path/path.h"
-#include "path/binding.h"
-#include "path/glue.h"
-#include "path/proc.h"
-
-/**
- * Put an end-of-string ('\0') right before the last component of @path.
- */
-static inline void pop_component(char *path)
-{
- int offset;
-
- offset = strlen(path) - 1;
- assert(offset >= 0);
-
- /* Don't pop over "/", it doesn't mean anything. */
- if (offset == 0) {
- assert(path[0] == '/' && path[1] == '\0');
- return;
- }
-
- /* Skip trailing path separators. */
- while (offset > 1 && path[offset] == '/')
- offset--;
-
- /* Search for the previous path separator. */
- while (offset > 1 && path[offset] != '/')
- offset--;
-
- /* Cut the end of the string before the last component. */
- path[offset] = '\0';
- assert(path[0] == '/');
-}
-
-/**
- * Copy in @component the first path component pointed to by @cursor,
- * this later is updated to point to the next component for a further
- * call. This function returns:
- *
- * - -errno if an error occured.
- *
- * - FINAL_SLASH if it the last component of the path but we
- * really expect a directory.
- *
- * - FINAL_NORMAL if it the last component of the path.
- *
- * - 0 otherwise.
- */
-static inline Finality next_component(char component[NAME_MAX], const char **cursor)
-{
- const char *start;
- ptrdiff_t length;
- bool want_dir;
-
- /* Skip leading path separators. */
- while (**cursor == '/')
- (*cursor)++;
-
- /* Find the next component. */
- start = *cursor;
- while (**cursor != '\0' && **cursor != '/')
- (*cursor)++;
- length = *cursor - start;
-
- if (length >= NAME_MAX)
- return -ENAMETOOLONG;
-
- /* Extract the component. */
- strncpy(component, start, length);
- component[length] = '\0';
-
- /* Check if a [link to a] directory is expected. */
- want_dir = (**cursor == '/');
-
- /* Skip trailing path separators. */
- while (**cursor == '/')
- (*cursor)++;
-
- if (**cursor == '\0')
- return (want_dir
- ? FINAL_SLASH
- : FINAL_NORMAL);
-
- return NOT_FINAL;
-}
-
-/**
- * Resolve bindings (if any) in @guest_path and copy the translated
- * path into @host_path. Also, this function checks that a non-final
- * component is either a directory (returned value is 0) or a symlink
- * (returned value is 1), otherwise it returns -errno (-ENOENT or
- * -ENOTDIR).
- */
-static inline int substitute_binding_stat(Tracee *tracee, Finality finality, const char guest_path[PATH_MAX], char host_path[PATH_MAX])
-{
- struct stat statl;
- int status;
-
- strcpy(host_path, guest_path);
- status = substitute_binding(tracee, GUEST, host_path);
- if (status < 0)
- return status;
-
- statl.st_mode = 0;
- status = lstat(host_path, &statl);
-
- /* Build the glue between the hostfs and the guestfs during
- * the initialization of a binding. */
- if (status < 0 && tracee->glue_type != 0) {
- statl.st_mode = build_glue(tracee, guest_path, host_path, finality);
- if (statl.st_mode == 0)
- status = -1;
- }
-
- /* Return an error if a non-final component isn't a directory
- * nor a symlink. The error depends on why the component
- * could not be accessed (ENOENT, EACCES, ...), otherwise the
- * error is "Not a directory". */
- if (!IS_FINAL(finality) && !S_ISDIR(statl.st_mode) && !S_ISLNK(statl.st_mode))
- return (status < 0 ? -ENOENT : -ENOTDIR);
-
- return (S_ISLNK(statl.st_mode) ? 1 : 0);
-}
-
-/**
- * Copy in @guest_path the canonicalization (see `man 3 realpath`) of
- * @user_path regarding to @tracee->root. The path to canonicalize
- * could be either absolute or relative to @guest_path. When the last
- * component of @user_path is a link, it is dereferenced only if
- * @deref_final is true -- it is useful for syscalls like lstat(2).
- * The parameter @recursion_level should be set to 0 unless you know
- * what you are doing. This function returns -errno if an error
- * occured, otherwise it returns 0.
- */
-int canonicalize(Tracee *tracee, const char *user_path, bool deref_final,
- char guest_path[PATH_MAX], unsigned int recursion_level)
-{
- char scratch_path[PATH_MAX];
- char host_path[PATH_MAX];
- Finality finality;
- const char *cursor;
- int status;
-
- /* Avoid infinite loop on circular links. */
- if (recursion_level > MAXSYMLINKS)
- return -ELOOP;
-
- if (user_path[0] != '/') {
- /* Ensure 'guest_path' contains an absolute base of
- * the relative `user_path`. */
- if (guest_path[0] != '/')
- return -EINVAL;
- }
- else
- strcpy(guest_path, "/");
-
- /* Resolve bindings for the initial '/' component or user_path,
- * which is not handled in the loop below.
- * In particular HOST_PATH extensions are called from there. */
- status = substitute_binding_stat(tracee, NOT_FINAL, guest_path, host_path);
- if (status < 0)
- return status;
-
- /* Canonicalize recursely 'user_path' into 'guest_path'. */
- cursor = user_path;
- finality = NOT_FINAL;
- while (!IS_FINAL(finality)) {
- Comparison comparison;
- char component[NAME_MAX];
-
- finality = next_component(component, &cursor);
- status = (int) finality;
- if (status < 0)
- return status;
-
- if (strcmp(component, ".") == 0) {
- if (IS_FINAL(finality))
- finality = FINAL_DOT;
- continue;
- }
-
- if (strcmp(component, "..") == 0) {
- pop_component(guest_path);
- if (IS_FINAL(finality))
- finality = FINAL_SLASH;
- continue;
- }
-
- join_paths(scratch_path, guest_path, component);
-
- /* Resolve bindings and check that a non-final
- * component exists and either is a directory or is a
- * symlink. For this latter case, we check that the
- * symlink points to a directory once it is
- * canonicalized, at the end of this loop. */
- status = substitute_binding_stat(tracee, finality, scratch_path, host_path);
- if (status < 0)
- return status;
-
- /* Nothing special to do if it's not a link or if we
- * explicitly ask to not dereference 'user_path', as
- * required by syscalls like lstat(2). Obviously, this
- * later condition does not apply to intermediate path
- * components. Errors are explicitly ignored since
- * they should be handled by the caller. */
- if (status <= 0 || (finality == FINAL_NORMAL && !deref_final)) {
- strcpy(scratch_path, guest_path);
- join_paths(guest_path, scratch_path, component);
- continue;
- }
-
- /* It's a link, so we have to dereference *and*
- * canonicalize to ensure we are not going outside the
- * new root. */
- comparison = compare_paths("/proc", guest_path);
- switch (comparison) {
- case PATHS_ARE_EQUAL:
- case PATH1_IS_PREFIX:
- /* Some links in "/proc" are generated
- * dynamically by the kernel. PRoot has to
- * emulate some of them. */
- status = readlink_proc(tracee, scratch_path,
- guest_path, component, comparison);
- switch (status) {
- case CANONICALIZE:
- /* The symlink is already dereferenced,
- * now canonicalize it. */
- goto canon;
-
- case DONT_CANONICALIZE:
- /* If and only very final, this symlink
- * shouldn't be dereferenced nor canonicalized. */
- if (finality == FINAL_NORMAL) {
- strcpy(guest_path, scratch_path);
- return 0;
- }
- break;
-
- default:
- if (status < 0)
- return status;
- }
-
- default:
- break;
- }
-
- status = readlink(host_path, scratch_path, sizeof(scratch_path));
- if (status < 0)
- return status;
- else if (status == sizeof(scratch_path))
- return -ENAMETOOLONG;
- scratch_path[status] = '\0';
-
- /* Remove the leading "root" part if needed, it's
- * useful for "/proc/self/cwd/" for instance. */
- status = detranslate_path(tracee, scratch_path, host_path);
- if (status < 0)
- return status;
-
- canon:
- /* Canonicalize recursively the referee in case it
- * is/contains a link, moreover if it is not an
- * absolute link then it is relative to
- * 'guest_path'. */
- status = canonicalize(tracee, scratch_path, true, guest_path, recursion_level + 1);
- if (status < 0)
- return status;
-
- /* Check that a non-final canonicalized/dereferenced
- * symlink exists and is a directory. */
- status = substitute_binding_stat(tracee, finality, guest_path, host_path);
- if (status < 0)
- return status;
-
- /* Here, 'guest_path' shouldn't be a symlink anymore,
- * unless it is a named file descriptor. */
- assert(status != 1 || sscanf(guest_path, "/proc/%*d/fd/%d", &status) == 1);
- }
-
- /* At the exit stage of the first level of recursion,
- * `guest_path` is fully canonicalized but a terminating '/'
- * or a terminating '.' may be required to keep the initial
- * semantic of `user_path`. */
- if (recursion_level == 0) {
- switch (finality) {
- case FINAL_NORMAL:
- break;
-
- case FINAL_SLASH:
- strcpy(scratch_path, guest_path);
- join_paths(guest_path, scratch_path, "");
- break;
-
- case FINAL_DOT:
- strcpy(scratch_path, guest_path);
- join_paths(guest_path, scratch_path, ".");
- break;
-
- default:
- assert(0);
- }
- }
-
- return 0;
-}
diff --git a/app/src/main/cpp/proot/src/path/canon.h b/app/src/main/cpp/proot/src/path/canon.h
deleted file mode 100644
index fa6546f..0000000
--- a/app/src/main/cpp/proot/src/path/canon.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef CANON_H
-#define CANON_H
-
-#include
-#include
-
-#include "tracee/tracee.h"
-
-extern int canonicalize(Tracee *tracee, const char *user_path, bool deref_final,
- char guest_path[PATH_MAX], unsigned int nb_recursion);
-
-#endif /* CANON_H */
diff --git a/app/src/main/cpp/proot/src/path/glue.c b/app/src/main/cpp/proot/src/path/glue.c
deleted file mode 100644
index 14975a4..0000000
--- a/app/src/main/cpp/proot/src/path/glue.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* mkdir(2), lstat(2), */
-#include /* mkdir(2), lstat(2), */
-#include /* mknod(2), */
-#include /* mknod(2), lstat(2), unlink(2), rmdir(2), */
-#include /* string(3), */
-#include /* assert(3), */
-#include /* PATH_MAX, */
-#include /* errno, E* */
-#include /* talloc_*, */
-
-#include "path/binding.h"
-#include "path/path.h"
-#include "path/temp.h"
-#include "cli/note.h"
-
-#include "compat.h"
-
-/**
- * Remove @path if it is empty only.
- *
- * Note: this is a Talloc destructor.
- */
-static int remove_placeholder(char *path)
-{
- struct stat statl;
- int status;
-
- status = lstat(path, &statl);
- if (status)
- return 0; /* Not fatal. */
-
- if (!S_ISDIR(statl.st_mode)) {
- if (statl.st_size != 0)
- return 0; /* Not fatal. */
- status = unlink(path);
- }
- else
- status = rmdir(path);
- if (status)
- return 0; /* Not fatal. */
-
- return 0;
-}
-
-/**
- * Attach a copy of @path to the autofree context, and set its
- * destructor to remove_placeholder().
- */
-static void set_placeholder_destructor(const char *path)
-{
- TALLOC_CTX *autofreed;
- char *placeholder;
-
- autofreed = talloc_autofree_context();
- if (autofreed == NULL)
- return;
-
- placeholder = talloc_strdup(autofreed, path);
- if (placeholder == NULL)
- return;
-
- talloc_set_destructor(placeholder, remove_placeholder);
-}
-
-/**
- * Build in a temporary filesystem the glue between the guest part and
- * the host part of the @binding_path. This function returns the type
- * of the bound path, otherwise 0 if an error occured.
- *
- * For example, assuming the host path "/opt" is mounted/bound to the
- * guest path "/black/holes/and/revelations", and assuming this path
- * can't be created in the guest rootfs (eg. permission denied), then
- * it is created in a temporary rootfs and all these paths are glued
- * that way:
- *
- * $GUEST/black/ --> $GLUE/black/
- * ./holes
- * ./holes/and
- * ./holes/and/revelations --> $HOST/opt/
- *
- * This glue allows operations on paths that do not exist in the guest
- * rootfs but that were specified as the guest part of a binding.
- */
-mode_t build_glue(Tracee *tracee, const char *guest_path, char host_path[PATH_MAX],
- Finality finality)
-{
- bool belongs_to_gluefs;
- Comparison comparison;
- Binding *binding;
- mode_t type;
- mode_t mode;
- int status;
-
- assert(tracee->glue_type != 0);
-
- /* Create the temporary directory where the "glue" rootfs will
- * lie. */
- if (tracee->glue == NULL) {
- tracee->glue = create_temp_directory(NULL, global_tool_name);
- if (tracee->glue == NULL) {
- note(tracee, ERROR, INTERNAL, "can't create glue rootfs");
- return 0;
- }
- talloc_set_name_const(tracee->glue, "$glue");
- }
-
- comparison = compare_paths(tracee->glue, host_path);
- belongs_to_gluefs = (comparison == PATHS_ARE_EQUAL || comparison == PATH1_IS_PREFIX);
-
- /* If it's not a final component then it is a directory. I definitely
- * hate how the potential type of the final component is propagated
- * from initialize_binding() down to here, sadly there's no elegant way
- * to know its type at this stage. */
- if (IS_FINAL(finality)) {
- type = tracee->glue_type;
- mode = (belongs_to_gluefs ? 0777 : 0);
- }
- else {
- type = S_IFDIR;
- mode = 0777;
- }
-
- if (getenv("PROOT_DONT_POLLUTE_ROOTFS") != NULL && !belongs_to_gluefs)
- goto create_binding;
-
- /* Try to create this component into the "guest" or "glue"
- * rootfs (depending if there were a glue previously). */
- if (S_ISDIR(type))
- status = mkdir(host_path, mode);
- else /* S_IFREG, S_IFCHR, S_IFBLK, S_IFIFO or S_IFSOCK. */
- status = mknod(host_path, mode | type, 0);
-
- /* Remove placeholders from the guest rootfs once PRoot is
- * terminated. */
- if (status >= 0 && !belongs_to_gluefs)
- set_placeholder_destructor(host_path);
-
- /* Nothing else to do if the path already exists or if it is
- * the final component since it will be pointed to by the
- * binding being initialized (from the example,
- * "$GUEST/black/holes/and/revelations" -> "$HOST/opt"). */
- if (status >= 0 || errno == EEXIST || IS_FINAL(finality))
- return type;
-
- /* mkdir/mknod are supposed to always succeed in
- * tracee->glue. */
- if (belongs_to_gluefs) {
- note(tracee, WARNING, SYSTEM, "mkdir/mknod");
- return 0;
- }
-
-create_binding:
- /* Sanity checks. */
- if ( strnlen(tracee->glue, PATH_MAX) >= PATH_MAX
- || strnlen(guest_path, PATH_MAX) >= PATH_MAX) {
- note(tracee, WARNING, INTERNAL, "installing the binding: guest path too long");
- return 0;
- }
-
- /* From the example, create the binding "/black" ->
- * "$GLUE/black". */
- binding = insort_binding3(tracee, tracee->glue, tracee->glue, guest_path);
- if (binding == NULL)
- return 0;
-
- return type;
-}
diff --git a/app/src/main/cpp/proot/src/path/glue.h b/app/src/main/cpp/proot/src/path/glue.h
deleted file mode 100644
index cebf3a9..0000000
--- a/app/src/main/cpp/proot/src/path/glue.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef GLUE_H
-#define GLUE_H
-
-#include /* PATH_MAX, */
-
-#include "tracee/tracee.h"
-#include "path.h"
-
-extern mode_t build_glue(Tracee *tracee, const char *guest_path, char host_path[PATH_MAX],
- Finality finality);
-
-#endif /* GLUE_H */
diff --git a/app/src/main/cpp/proot/src/path/path.c b/app/src/main/cpp/proot/src/path/path.c
deleted file mode 100644
index f201b11..0000000
--- a/app/src/main/cpp/proot/src/path/path.c
+++ /dev/null
@@ -1,663 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* string(3), */
-#include /* va_*(3), */
-#include /* assert(3), */
-#include /* AT_*, */
-#include /* readlink*(2), *stat(2), getpid(2), */
-#include /* pid_t, */
-#include /* S_ISDIR, */
-#include /* opendir(3), readdir(3), */
-#include /* snprintf(3), */
-#include /* E*, */
-#include /* ptrdiff_t, */
-#include /* PRI*, */
-
-#include "path/path.h"
-#include "path/binding.h"
-#include "path/canon.h"
-#include "path/proc.h"
-#include "cli/note.h"
-
-#include "compat.h"
-
-extern char *root_path;
-
-/**
- * Copy in @result the concatenation of several paths (@number_paths)
- * and adds a path separator ('/') in between when needed. This
- * function returns -errno if an error occured, otherwise it returns 0.
- */
-void join_paths(char result[PATH_MAX], const char *path1, const char *path2)
-{
- size_t length;
-
- strcpy(result, path1);
- length = strlen(result);
-
- /* A new path separator is needed. */
- if (length > 0 && result[length - 1] != '/' && path2[0] != '/') {
- strcat(result + length, "/");
- strcat(result + length, path2);
- }
- /* There are already two path separators. */
- else if (length > 0 && result[length - 1] == '/' && path2[0] == '/') {
- strcat(result + length, path2 + 1);
- }
- /* There's already one path separator or result[] is empty. */
- else
- strcat(result + length, path2);
-}
-
-/**
- * Put in @host_path the full path to the given shell @command. The
- * @command is searched in @paths if not null, otherwise in $PATH
- * (relatively to the @tracee's file-system name-space). This
- * function always returns -1 on error, otherwise 0.
- */
-int which(Tracee *tracee, const char *paths, char host_path[PATH_MAX], const char *command)
-{
- char path[PATH_MAX];
- const char *cursor;
- struct stat statr;
- int status;
-
- bool is_explicit;
- bool found;
-
- assert(command != NULL);
- is_explicit = (strchr(command, '/') != NULL);
-
- /* Is the command available without any $PATH look-up? */
- status = realpath2(tracee, host_path, command, true);
- if (status == 0 && stat(host_path, &statr) == 0) {
- if (is_explicit && !S_ISREG(statr.st_mode)) {
- note(tracee, ERROR, USER, "'%s' is not a regular file", command);
- return -EACCES;
- }
-
- if (is_explicit && (statr.st_mode & S_IXUSR) == 0) {
- note(tracee, ERROR, USER, "'%s' is not executable", command);
- return -EACCES;
- }
-
- found = true;
-
- /* Don't dereference the final component to preserve
- * argv0 in case it is a symlink to script. */
- (void) realpath2(tracee, host_path, command, false);
- }
- else
- found = false;
-
- /* Is the the explicit command was found? */
- if (is_explicit) {
- if (found)
- return 0;
- else
- goto not_found;
- }
-
- /* Otherwise search the command in $PATH. */
- paths = paths ?: getenv("PATH");
- if (paths == NULL || strcmp(paths, "") == 0)
- goto not_found;
-
- cursor = paths;
- do {
- size_t length;
-
- length = strcspn(cursor, ":");
- cursor += length + 1;
-
- if (length >= PATH_MAX)
- continue;
- else if (length == 0)
- strcpy(path, ".");
- else {
- strncpy(path, cursor - length - 1, length);
- path[length] = '\0';
- }
-
- /* Avoid buffer-overflow. */
- if (length + strlen(command) + 2 >= PATH_MAX)
- continue;
-
- strcat(path, "/");
- strcat(path, command);
-
- status = realpath2(tracee, host_path, path, true);
- if (status == 0
- && stat(host_path, &statr) == 0
- && S_ISREG(statr.st_mode)
- && (statr.st_mode & S_IXUSR) != 0) {
- /* Don't dereference the final component to preserve
- * argv0 in case it is a symlink to script. */
- (void) realpath2(tracee, host_path, path, false);
- return 0;
- }
- } while (*(cursor - 1) != '\0');
-
-not_found:
- status = getcwd2(tracee, path);
- if (status < 0)
- strcpy(path, "");
-
- note(tracee, ERROR, USER, "'%s' not found (root = %s, cwd = %s, $PATH=%s)",
- command, root_path, path, paths);
-
- /* Check if the command was found without any $PATH look-up
- * but it didn't contain "/". */
- if (found && !is_explicit)
- note(tracee, ERROR, USER,
- "to execute a local program, use the './' prefix, for example: ./%s", command);
-
- return -1;
-}
-
-/**
- * Put in @host_path the canonicalized form of @path. In the nominal
- * case (@tracee == NULL), this function is barely equivalent to
- * realpath(), but when doing sub-reconfiguration, the path is
- * canonicalized relatively to the current @tracee's file-system
- * name-space. This function returns -errno on error, otherwise 0.
- */
-int realpath2(Tracee *tracee, char host_path[PATH_MAX], const char *path, bool deref_final)
-{
- int status;
-
- if (tracee == NULL)
- status = (realpath(path, host_path) == NULL ? -errno : 0);
- else
- status = translate_path(tracee, host_path, AT_FDCWD, path, deref_final);
- return status;
-}
-
-/**
- * Put in @guest_path the canonicalized current working directory. In
- * the nominal case (@tracee == NULL), this function is barely
- * equivalent to realpath(), but when doing sub-reconfiguration, the
- * path is canonicalized relatively to the current @tracee's
- * file-system name-space. This function returns -errno on error,
- * otherwise 0.
- */
-int getcwd2(Tracee *tracee, char guest_path[PATH_MAX])
-{
- if (tracee == NULL) {
- if (getcwd(guest_path, PATH_MAX) == NULL)
- return -errno;
- }
- else
- strcpy(guest_path, tracee->fs->cwd);
-
- return 0;
-}
-
-/**
- * Remove the trailing "/" or "/.".
- */
-void chop_finality(char *path)
-{
- size_t length = strlen(path);
-
- if (path[length - 1] == '.') {
- assert(length >= 2);
- /* Special case for "/." */
- if (length == 2)
- path[length - 1] = '\0';
- else
- path[length - 2] = '\0';
- }
- else if (path[length - 1] == '/') {
- /* Special case for "/" */
- if (length > 1)
- path[length - 1] = '\0';
- }
-}
-
-/**
- * Put in @path the result of readlink(/proc/@pid/fd/@fd). This
- * function returns -errno if an error occured, otherwise 0.
- */
-int readlink_proc_pid_fd(pid_t pid, int fd, char path[PATH_MAX])
-{
- char link[32]; /* 32 > sizeof("/proc//cwd") + sizeof(#ULONG_MAX) */
- int status;
-
- /* Format the path to the "virtual" link. */
- status = snprintf(link, sizeof(link), "/proc/%d/fd/%d", pid, fd);
- if (status < 0)
- return -EBADF;
- if ((size_t) status >= sizeof(link))
- return -EBADF;
-
- /* Read the value of this "virtual" link. */
- status = readlink(link, path, PATH_MAX);
- if (status < 0)
- return -EBADF;
- if (status >= PATH_MAX)
- return -ENAMETOOLONG;
- path[status] = '\0';
-
- return 0;
-}
-
-/**
- * Copy in @result the equivalent of "@tracee->root + canon(@dir_fd +
- * @user_path)". If @user_path is not absolute then it is relative to
- * the directory referred by the descriptor @dir_fd (AT_FDCWD is for
- * the current working directory). See the documentation of
- * canonicalize() for the meaning of @deref_final. This function
- * returns -errno if an error occured, otherwise 0.
- */
-int translate_path(Tracee *tracee, char result[PATH_MAX], int dir_fd,
- const char *user_path, bool deref_final)
-{
- char guest_path[PATH_MAX];
- int status;
-
- /* Use "/" as the base if it is an absolute guest path. */
- if (user_path[0] == '/') {
- strcpy(result, "/");
- }
- /* It is relative to a directory referred by a descriptor, see
- * openat(2) for details. */
- else if (dir_fd != AT_FDCWD) {
- /* /proc/@tracee->pid/fd/@dir_fd -> result. */
- status = readlink_proc_pid_fd(tracee->pid, dir_fd, result);
- if (status < 0)
- return status;
-
- /* Named file descriptors may reference special
- * objects like pipes, sockets, inodes, ... Such
- * objects do not belong to the file-system. */
- if (result[0] != '/')
- return -ENOTDIR;
-
- /* Remove the leading "root" part of the base
- * (required!). */
- status = detranslate_path(tracee, result, NULL);
- if (status < 0)
- return status;
- }
- /* It is relative to the current working directory. */
- else {
- status = getcwd2(tracee, result);
- if (status < 0)
- return status;
- }
-
- VERBOSE(tracee, 2, "pid %d: translate(\"%s\" + \"%s\")",
- tracee != NULL ? tracee->pid : 0, result, user_path);
-
- /* So far "result" was used as a base path, it's time to join
- * it to the user path. */
- join_paths(guest_path, result, user_path);
- strcpy(result, "/");
-
- /* Canonicalize regarding the new root. */
- status = canonicalize(tracee, guest_path, deref_final, result, 0);
- if (status < 0)
- return status;
-
- /* Final binding substitution to convert "result" into a host
- * path, since canonicalize() works from the guest
- * point-of-view. */
- status = substitute_binding(tracee, GUEST, result);
- if (status < 0)
- return status;
-
- return 0;
-}
-
-/**
- * Remove/substitute the leading part of a "translated" @path. It
- * returns 0 if no transformation is required (ie. symmetric binding),
- * otherwise it returns the size in bytes of the updated @path,
- * including the end-of-string terminator. On error it returns
- * -errno.
- */
-int detranslate_path(Tracee *tracee, char path[PATH_MAX], const char t_referrer[PATH_MAX])
-{
- size_t prefix_length;
- ssize_t new_length;
-
- bool sanity_check;
- bool follow_binding;
-
- /* Don't try to detranslate relative paths (typically the
- * target of a relative symbolic link). */
- if (path[0] != '/')
- return 0;
-
- /* Is it a symlink? */
- if (t_referrer != NULL) {
- Comparison comparison;
-
- sanity_check = false;
- follow_binding = false;
-
- /* In some cases bindings have to be resolved. */
- comparison = compare_paths("/proc", t_referrer);
- if (comparison == PATH1_IS_PREFIX) {
- /* Some links in "/proc" are generated
- * dynamically by the kernel. PRoot has to
- * emulate some of them. */
- char proc_path[PATH_MAX];
- strcpy(proc_path, path);
- new_length = readlink_proc2(tracee, proc_path, t_referrer);
- if (new_length < 0)
- return new_length;
- if (new_length != 0) {
- strcpy(path, proc_path);
- return new_length + 1;
- }
-
- /* Always resolve bindings for symlinks in
- * "/proc", they always point to the emulated
- * file-system namespace by design. */
- follow_binding = true;
- }
- else if (!belongs_to_guestfs(t_referrer)) {
- const char *binding_referree;
- const char *binding_referrer;
-
- binding_referree = get_path_binding(tracee, HOST, path);
- binding_referrer = get_path_binding(tracee, HOST, t_referrer);
- assert(binding_referrer != NULL);
-
- /* Resolve bindings for symlinks that belong
- * to a binding and point to the same binding.
- * For example, if "-b /lib:/foo" is specified
- * and the symlink "/lib/a -> /lib/b" exists
- * in the host rootfs namespace, then it
- * should appear as "/foo/a -> /foo/b" in the
- * guest rootfs namespace for consistency
- * reasons. */
- if (binding_referree != NULL) {
- comparison = compare_paths(binding_referree, binding_referrer);
- follow_binding = (comparison == PATHS_ARE_EQUAL);
- }
- }
- }
- else {
- sanity_check = true;
- follow_binding = true;
- }
-
- if (follow_binding) {
- switch (substitute_binding(tracee, HOST, path)) {
- case 0:
- return 0;
- case 1:
- return strlen(path) + 1;
- default:
- break;
- }
- }
-
- switch (compare_paths(root_path, path)) {
- case PATH1_IS_PREFIX:
- /* Remove the leading part, that is, the "root". */
- prefix_length = strlen(root_path);
-
- /* Special case when path to the guest rootfs == "/". */
- if (prefix_length == 1)
- prefix_length = 0;
-
- new_length = strlen(path) - prefix_length;
- memmove(path, path + prefix_length, new_length);
-
- path[new_length] = '\0';
- break;
-
- case PATHS_ARE_EQUAL:
- /* Special case when path == root. */
- new_length = 1;
- strcpy(path, "/");
- break;
-
- default:
- /* Ensure the path is within the new root. */
- if (sanity_check)
- return -EPERM;
- else
- return 0;
- }
-
- return new_length + 1;
-}
-
-/**
- * Check if the translated @host_path belongs to the guest rootfs,
- * that is, isn't from a binding.
- */
-bool belongs_to_guestfs(const char *host_path)
-{
- Comparison comparison;
-
- comparison = compare_paths(root_path, host_path);
- return (comparison == PATHS_ARE_EQUAL || comparison == PATH1_IS_PREFIX);
-}
-
-/**
- * Compare @path1 with @path2, which are respectively @length1 and
- * @length2 long.
- *
- * This function works only with paths canonicalized in the same
- * namespace (host/guest)!
- */
-Comparison compare_paths2(const char *path1, size_t length1, const char *path2, size_t length2)
-{
- size_t length_min;
- bool is_prefix;
- char sentinel;
-
- if (!length1 || !length2)
- return PATHS_ARE_NOT_COMPARABLE;
-
- /* Remove potential trailing '/' for the comparison. */
- if (path1[length1 - 1] == '/')
- length1--;
-
- if (path2[length2 - 1] == '/')
- length2--;
-
- if (length1 < length2) {
- length_min = length1;
- sentinel = path2[length_min];
- }
- else {
- length_min = length2;
- sentinel = path1[length_min];
- }
-
- /* Optimize obvious cases. */
- if (sentinel != '/' && sentinel != '\0')
- return PATHS_ARE_NOT_COMPARABLE;
-
- is_prefix = (strncmp(path1, path2, length_min) == 0);
-
- if (!is_prefix)
- return PATHS_ARE_NOT_COMPARABLE;
-
- if (length1 == length2)
- return PATHS_ARE_EQUAL;
- else if (length1 < length2)
- return PATH1_IS_PREFIX;
- else if (length1 > length2)
- return PATH2_IS_PREFIX;
-
- return PATHS_ARE_NOT_COMPARABLE;
-}
-
-Comparison compare_paths(const char *path1, const char *path2)
-{
- return compare_paths2(path1, strlen(path1), path2, strlen(path2));
-}
-
-typedef int (*foreach_fd_t)(const Tracee *tracee, int fd, char path[PATH_MAX]);
-
-/**
- * Call @callback on each open file descriptors of @pid. It returns
- * the status of the first failure, that is, if @callback returned
- * seomthing lesser than 0, otherwise 0.
- */
-static int foreach_fd(const Tracee *tracee, foreach_fd_t callback)
-{
- struct dirent *dirent;
- char path[PATH_MAX];
- char proc_fd[32]; /* 32 > sizeof("/proc//fd") + sizeof(#ULONG_MAX) */
- int status;
- DIR *dirp;
-
- /* Format the path to the "virtual" directory. */
- status = snprintf(proc_fd, sizeof(proc_fd), "/proc/%d/fd", tracee->pid);
- if (status < 0 || (size_t) status >= sizeof(proc_fd))
- return 0;
-
- /* Open the virtual directory "/proc/$pid/fd". */
- dirp = opendir(proc_fd);
- if (dirp == NULL)
- return 0;
-
- while ((dirent = readdir(dirp)) != NULL) {
- /* Read the value of this "virtual" link. Don't use
- * readlinkat(2) here since it would require Linux >=
- * 2.6.16 and Glibc >= 2.4, whereas PRoot is supposed
- * to work on any Linux 2.6 systems. */
-
- char tmp[PATH_MAX];
- if (strlen(proc_fd) + strlen(dirent->d_name) + 1 >= PATH_MAX)
- continue;
-
- strcpy(tmp, proc_fd);
- strcat(tmp, "/");
- strcat(tmp, dirent->d_name);
-
- status = readlink(tmp, path, PATH_MAX);
- if (status < 0 || status >= PATH_MAX)
- continue;
- path[status] = '\0';
-
- /* Ensure it points to a path (not a socket or somethink like that). */
- if (path[0] != '/')
- continue;
-
- status = callback(tracee, atoi(dirent->d_name), path);
- if (status < 0)
- goto end;
- }
- status = 0;
-
-end:
- closedir(dirp);
- return status;
-}
-
-/**
- * Helper for list_open_fd().
- */
-static int list_open_fd_callback(const Tracee *tracee, int fd, char path[PATH_MAX])
-{
- VERBOSE(tracee, 1, "pid %d: access to \"%s\" (fd %d) won't be translated until closed",
- tracee->pid, path, fd);
- return 0;
-}
-
-/**
- * Warn for files that are open. It is useful right after PRoot has
- * attached a process.
- */
-int list_open_fd(const Tracee *tracee)
-{
- return foreach_fd(tracee, list_open_fd_callback);
-}
-
-/**
- * Substitute the first @old_prefix_length bytes of @path with
- * @new_prefix (the caller has to provides a correct
- * @new_prefix_length). This function returns the new length of
- * @path. Note: this function takes care about special cases (like
- * "/").
- */
-size_t substitute_path_prefix(char path[PATH_MAX], size_t old_prefix_length,
- const char *new_prefix, size_t new_prefix_length)
-{
- size_t path_length;
- size_t new_length;
-
- path_length = strlen(path);
-
- assert(old_prefix_length < PATH_MAX);
- assert(new_prefix_length < PATH_MAX);
-
- if (new_prefix_length == 1) {
- /* Special case: "/foo" -> "/". Substitute "/foo/bin"
- * with "/bin" not "//bin". */
-
- new_length = path_length - old_prefix_length;
- if (new_length != 0)
- memmove(path, path + old_prefix_length, new_length);
- else {
- /* Special case: "/". */
- path[0] = '/';
- new_length = 1;
- }
- }
- else if (old_prefix_length == 1) {
- /* Special case: "/" -> "/foo". Substitute "/bin" with
- * "/foo/bin" not "/foobin". */
-
- new_length = new_prefix_length + path_length;
- if (new_length >= PATH_MAX)
- return -ENAMETOOLONG;
-
- if (path_length > 1) {
- memmove(path + new_prefix_length, path, path_length);
- memcpy(path, new_prefix, new_prefix_length);
- }
- else {
- /* Special case: "/". */
- memcpy(path, new_prefix, new_prefix_length);
- new_length = new_prefix_length;
- }
- }
- else {
- /* Generic case. */
-
- new_length = path_length - old_prefix_length + new_prefix_length;
- if (new_length >= PATH_MAX)
- return -ENAMETOOLONG;
-
- memmove(path + new_prefix_length,
- path + old_prefix_length,
- path_length - old_prefix_length);
- memcpy(path, new_prefix, new_prefix_length);
- }
-
- assert(new_length < PATH_MAX);
- path[new_length] = '\0';
-
- return new_length;
-}
diff --git a/app/src/main/cpp/proot/src/path/path.h b/app/src/main/cpp/proot/src/path/path.h
deleted file mode 100644
index 2cc1adf..0000000
--- a/app/src/main/cpp/proot/src/path/path.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef PATH_H
-#define PATH_H
-
-#include /* pid_t, */
-#include /* AT_FDCWD, */
-#include /* PATH_MAX, */
-#include
-
-#include "tracee/tracee.h"
-
-/* File type. */
-typedef enum {
- REGULAR,
- SYMLINK,
-} Type;
-
-/* Path point-of-view. */
-typedef enum {
- GUEST,
- HOST,
-
- /* Used for bindings as specified by the user but not
- * canonicalized yet (new_binding, initialize_binding). */
- PENDING,
-} Side;
-
-/* Path with cached attributes. */
-typedef struct {
- char path[PATH_MAX];
- size_t length;
- Side side;
-} Path;
-
-/* Path ending type. */
-typedef enum {
- NOT_FINAL,
- FINAL_NORMAL,
- FINAL_SLASH,
- FINAL_DOT
-} Finality;
-
-#define IS_FINAL(a) ((a) != NOT_FINAL)
-
-/* Comparison between two paths. */
-typedef enum Comparison {
- PATHS_ARE_EQUAL,
- PATH1_IS_PREFIX,
- PATH2_IS_PREFIX,
- PATHS_ARE_NOT_COMPARABLE,
-} Comparison;
-
-extern int which(Tracee *tracee, const char *paths, char host_path[PATH_MAX], const char *command);
-extern int realpath2(Tracee *tracee, char host_path[PATH_MAX], const char *path, bool deref_final);
-extern int getcwd2(Tracee *tracee, char guest_path[PATH_MAX]);
-extern void chop_finality(char *path);
-
-extern int translate_path(Tracee *tracee, char host_path[PATH_MAX],
- int dir_fd, const char *guest_path, bool deref_final);
-
-extern int detranslate_path(Tracee *tracee, char path[PATH_MAX], const char t_referrer[PATH_MAX]);
-extern bool belongs_to_guestfs(const char *path);
-
-extern void join_paths(char result[PATH_MAX], const char *path1, const char *path2);
-extern int list_open_fd(const Tracee *tracee);
-
-extern Comparison compare_paths(const char *path1, const char *path2);
-extern Comparison compare_paths2(const char *path1, size_t length1, const char *path2, size_t length2);
-
-extern size_t substitute_path_prefix(char path[PATH_MAX], size_t old_prefix_length,
- const char *new_prefix, size_t new_prefix_length);
-
-extern int readlink_proc_pid_fd(pid_t pid, int fd, char path[PATH_MAX]);
-
-#endif /* PATH_H */
diff --git a/app/src/main/cpp/proot/src/path/proc.c b/app/src/main/cpp/proot/src/path/proc.c
deleted file mode 100644
index eb4a3b6..0000000
--- a/app/src/main/cpp/proot/src/path/proc.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* snprintf(3), */
-#include /* strcmp(3), */
-#include /* atoi(3), strtol(3), */
-#include /* E*, */
-#include /* assert(3), */
-
-#include "path/proc.h"
-#include "tracee/tracee.h"
-#include "path/path.h"
-#include "path/binding.h"
-
-extern char *root_path;
-
-/**
- * This function emulates the @result of readlink("@base/@component")
- * with respect to @tracee, where @base belongs to "/proc" (according
- * to @comparison). This function returns -errno on error, an enum
- * @action otherwise (c.f. above).
- *
- * Unlike readlink(), this function includes the nul terminating byte
- * to @result.
- */
-Action readlink_proc(const Tracee *tracee, char result[PATH_MAX],
- const char base[PATH_MAX], const char component[NAME_MAX],
- Comparison comparison)
-{
- const Tracee *known_tracee;
- char proc_path[64]; /* 64 > sizeof("/proc//fd/") + 2 * sizeof(#ULONG_MAX) */
- int status;
- pid_t pid;
-
- /* Remember: comparison = compare_paths("/proc", base) */
- switch (comparison) {
- case PATHS_ARE_EQUAL:
- /* Substitute "/proc/self" with "/proc/". */
- if (strcmp(component, "self") != 0)
- return DEFAULT;
-
- status = snprintf(result, PATH_MAX, "/proc/%d", tracee->pid);
- if (status < 0 || status >= PATH_MAX)
- return -EPERM;
-
- return CANONICALIZE;
-
- case PATH1_IS_PREFIX:
- /* Handle "/proc/" below, where is process
- * monitored by PRoot. */
- break;
-
- default:
- return DEFAULT;
- }
-
- pid = atoi(base + strlen("/proc/"));
- if (pid == 0)
- return DEFAULT;
-
- /* Handle links in "/proc//". */
- status = snprintf(proc_path, sizeof(proc_path), "/proc/%d", pid);
- if (status < 0 || (size_t) status >= sizeof(proc_path))
- return -EPERM;
-
- comparison = compare_paths(proc_path, base);
- switch (comparison) {
- case PATHS_ARE_EQUAL:
- known_tracee = get_tracee(tracee, pid, false);
- if (known_tracee == NULL)
- return DEFAULT;
-
-#define SUBSTITUTE(name, string) \
- do { \
- if (strcmp(component, #name) != 0) \
- break; \
- \
- status = strlen(string); \
- if (status >= PATH_MAX) \
- return -EPERM; \
- \
- strncpy(result, string, status + 1); \
- return CANONICALIZE; \
- } while (0)
-
- /* Substitute link "/proc//???" with the content
- * of tracee->???. */
- SUBSTITUTE(exe, known_tracee->exe);
- SUBSTITUTE(cwd, known_tracee->fs->cwd);
- SUBSTITUTE(root, root_path);
-#undef SUBSTITUTE
- return DEFAULT;
-
- case PATH1_IS_PREFIX:
- /* Handle "/proc//???" below. */
- break;
-
- default:
- return DEFAULT;
- }
-
- /* Handle links in "/proc//fd/". */
- status = snprintf(proc_path, sizeof(proc_path), "/proc/%d/fd", pid);
- if (status < 0 || (size_t) status >= sizeof(proc_path))
- return -EPERM;
-
- comparison = compare_paths(proc_path, base);
- switch (comparison) {
- char *end_ptr;
-
- case PATHS_ARE_EQUAL:
- /* Sanity check: a number is expected. */
- errno = 0;
- (void) strtol(component, &end_ptr, 10);
- if (errno != 0 || end_ptr == component)
- return -EPERM;
-
- /* Don't dereference "/proc//fd/???" now: they
- * can point to anonymous pipe, socket, ... otherwise
- * they point to a path already canonicalized by the
- * kernel.
- *
- * Note they are still correctly detranslated in
- * syscall/exit.c if a monitored process uses
- * readlink() against any of them. */
- status = snprintf(result, PATH_MAX, "%s/%s", base, component);
- if (status < 0 || status >= PATH_MAX)
- return -EPERM;
-
- return DONT_CANONICALIZE;
-
- default:
- break;
- }
-
- return DEFAULT;
-}
-
-/**
- * This function emulates the @result of readlink("@referer") with
- * respect to @tracee, where @referer is a strict subpath of "/proc".
- * This function returns -errno if an error occured, the length of
- * @result if the readlink was emulated, 0 otherwise.
- *
- * Unlike readlink(), this function includes the nul terminating byte
- * to @result (but this byte is not counted in the returned value).
- */
-ssize_t readlink_proc2(const Tracee *tracee, char result[PATH_MAX], const char referer[PATH_MAX])
-{
- Action action;
- char base[PATH_MAX];
- char *component;
-
- assert(compare_paths("/proc", referer) == PATH1_IS_PREFIX);
-
- /* It's safe to use strrchr() here since @referer was
- * previously canonicalized. */
- strcpy(base, referer);
- component = strrchr(base, '/');
-
- /* These cases are not possible: @referer is supposed to be a
- * canonicalized subpath of "/proc". */
- assert(component != NULL && component != base);
-
- component[0] = '\0';
- component++;
- if (component[0] == '\0')
- return 0;
-
- action = readlink_proc(tracee, result, base, component, PATH1_IS_PREFIX);
- return (action == CANONICALIZE ? strlen(result) : 0);
-}
diff --git a/app/src/main/cpp/proot/src/path/proc.h b/app/src/main/cpp/proot/src/path/proc.h
deleted file mode 100644
index 7081dd7..0000000
--- a/app/src/main/cpp/proot/src/path/proc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef PROC_H
-#define PROC_H
-
-#include
-
-#include "tracee/tracee.h"
-#include "path/path.h"
-
-/* Action to do after a call to readlink_proc(). */
-typedef enum {
- DEFAULT, /* Nothing special to do, treat it as a regular link. */
- CANONICALIZE, /* The symlink was dereferenced, now canonicalize it. */
- DONT_CANONICALIZE, /* The symlink shouldn't be dereferenced nor canonicalized. */
-} Action;
-
-
-extern Action readlink_proc(const Tracee *tracee, char result[PATH_MAX], const char path[PATH_MAX],
- const char component[NAME_MAX], Comparison comparison);
-
-extern ssize_t readlink_proc2(const Tracee *tracee, char result[PATH_MAX], const char path[PATH_MAX]);
-
-#endif /* PROC_H */
diff --git a/app/src/main/cpp/proot/src/path/temp.c b/app/src/main/cpp/proot/src/path/temp.c
deleted file mode 100644
index b300aff..0000000
--- a/app/src/main/cpp/proot/src/path/temp.c
+++ /dev/null
@@ -1,354 +0,0 @@
-#include /* stat(2), opendir(3), */
-#include /* stat(2), chmod(2), */
-#include /* stat(2), rmdir(2), unlink(2), readlink(2), */
-#include /* errno(2), */
-#include /* readdir(3), opendir(3), */
-#include /* strcmp(3), */
-#include /* free(3), getenv(3), */
-#include /* P_tmpdir, */
-#include /* talloc(3), */
-
-#include "cli/note.h"
-
-/**
- * Return the path to a directory where temporary files should be
- * created.
- */
-const char *get_temp_directory()
-{
- static const char *temp_directory = NULL;
- char *tmp;
-
- if (temp_directory != NULL)
- return temp_directory;
-
- temp_directory = getenv("PROOT_TMP_DIR");
- if (temp_directory == NULL) {
- temp_directory = P_tmpdir;
- return temp_directory;
- }
-
- tmp = realpath(temp_directory, NULL);
- if (tmp == NULL) {
- note(NULL, WARNING, SYSTEM,
- "can't canonicalize %s, using %s instead of PROOT_TMP_DIR",
- temp_directory, P_tmpdir);
-
- temp_directory = P_tmpdir;
- return temp_directory;
- }
-
- temp_directory = talloc_strdup(talloc_autofree_context(), tmp);
- if (temp_directory == NULL)
- temp_directory = tmp;
- else
- free(tmp);
-
- return temp_directory;
-}
-
-/**
- * Handle the return of d_type = DT_UNKNOWN by readdir(3)
- * Not all filesystems support returning d_type in readdir(3)
- */
-static int get_dtype(struct dirent *de)
-{
- int dtype = de ? de->d_type : DT_UNKNOWN;
- struct stat st;
-
- if (dtype != DT_UNKNOWN)
- return dtype;
- if (lstat(de->d_name, &st))
- return dtype;
- if (S_ISREG(st.st_mode))
- return DT_REG;
- if (S_ISDIR(st.st_mode))
- return DT_DIR;
- if (S_ISLNK(st.st_mode))
- return DT_LNK;
- return dtype;
-}
-
-/**
- * Remove recursively the content of the current working directory.
- * This latter has to lie in temp_directory (ie. "/tmp" on most
- * systems). This function returns -1 if a fatal error occured
- * (ie. the recursion must be stopped), the number of non-fatal errors
- * otherwise.
- *
- * WARNING: this function changes the current working directory for
- * the calling process.
- */
-static int clean_temp_cwd()
-{
- const char *temp_directory = get_temp_directory();
- const size_t length_temp_directory = strlen(temp_directory);
- char *prefix = NULL;
- int nb_errors = 0;
- DIR *dir = NULL;
- int status;
-
- prefix = talloc_size(NULL, length_temp_directory + 1);
- if (prefix == NULL) {
- note(NULL, WARNING, INTERNAL, "can't allocate memory");
- nb_errors++;
- goto end;
- }
-
- /* Sanity check: ensure the current directory lies in
- * "/tmp". */
- status = readlink("/proc/self/cwd", prefix, length_temp_directory);
- if (status < 0) {
- note(NULL, WARNING, SYSTEM, "can't readlink '/proc/self/cwd'");
- nb_errors++;
- goto end;
- }
- prefix[status] = '\0';
-
- if (strncmp(prefix, temp_directory, length_temp_directory) != 0) {
- note(NULL, ERROR, INTERNAL,
- "trying to remove a directory outside of '%s', "
- "please report this error.\n", temp_directory);
- nb_errors++;
- goto end;
- }
-
- dir = opendir(".");
- if (dir == NULL) {
- note(NULL, WARNING, SYSTEM, "can't open '.'");
- nb_errors++;
- goto end;
- }
-
- while (1) {
- struct dirent *entry;
-
- errno = 0;
- entry = readdir(dir);
- if (entry == NULL)
- break;
-
- if ( strcmp(entry->d_name, ".") == 0
- || strcmp(entry->d_name, "..") == 0)
- continue;
-
- status = chmod(entry->d_name, 0700);
- if (status < 0) {
- note(NULL, WARNING, SYSTEM, "cant chmod '%s'", entry->d_name);
- nb_errors++;
- continue;
- }
-
- if (get_dtype(entry) == DT_DIR) {
- status = chdir(entry->d_name);
- if (status < 0) {
- note(NULL, WARNING, SYSTEM, "can't chdir '%s'", entry->d_name);
- nb_errors++;
- continue;
- }
-
- /* Recurse. */
- status = clean_temp_cwd();
- if (status < 0) {
- nb_errors = -1;
- goto end;
- }
- nb_errors += status;
-
- status = chdir("..");
- if (status < 0) {
- note(NULL, ERROR, SYSTEM, "can't chdir to '..'");
- nb_errors = -1;
- goto end;
- }
-
- status = rmdir(entry->d_name);
- }
- else {
- status = unlink(entry->d_name);
- }
- if (status < 0) {
- note(NULL, WARNING, SYSTEM, "can't remove '%s'", entry->d_name);
- nb_errors++;
- continue;
- }
- }
- if (errno != 0) {
- note(NULL, WARNING, SYSTEM, "can't readdir '.'");
- nb_errors++;
- }
-
-end:
- TALLOC_FREE(prefix);
-
- if (dir != NULL)
- (void) closedir(dir);
-
- return nb_errors;
-}
-
-/**
- * Remove recursively @path. This latter has to be a directory lying
- * in temp_directory (ie. "/tmp" on most systems). This function
- * returns -1 on error, otherwise 0.
- */
-static int remove_temp_directory2(const char *path)
-{
- int result;
- int status;
- char *cwd;
-
- cwd = malloc(PATH_MAX);
- getcwd(cwd, PATH_MAX);
-
- status = chmod(path, 0700);
- if (status < 0) {
- note(NULL, ERROR, SYSTEM, "can't chmod '%s'", path);
- result = -1;
- goto end;
- }
-
- status = chdir(path);
- if (status < 0) {
- note(NULL, ERROR, SYSTEM, "can't chdir to '%s'", path);
- result = -1;
- goto end;
- }
-
- status = clean_temp_cwd();
- result = (status == 0 ? 0 : -1);
-
- /* Try to remove path even if something went wrong. */
- status = chdir("..");
- if (status < 0) {
- note(NULL, ERROR, SYSTEM, "can't chdir to '..'");
- result = -1;
- goto end;
- }
-
- status = rmdir(path);
- if (status < 0) {
- note(NULL, ERROR, SYSTEM, "cant remove '%s'", path);
- result = -1;
- goto end;
- }
-
-end:
- if (cwd != NULL) {
- status = chdir(cwd);
- if (status < 0) {
- result = -1;
- note(NULL, ERROR, SYSTEM, "can't chdir to '%s'", cwd);
- }
- free(cwd);
- }
-
- return result;
-}
-
-/**
- * Like remove_temp_directory2() but always return 0.
- *
- * Note: this is a talloc destructor.
- */
-static int remove_temp_directory(char *path)
-{
- (void) remove_temp_directory2(path);
- return 0;
-}
-
-/**
- * Remove the file @path. This function always returns 0.
- *
- * Note: this is a talloc destructor.
- */
-static int remove_temp_file(char *path)
-{
- int status;
-
- status = unlink(path);
- if (status < 0)
- note(NULL, ERROR, SYSTEM, "can't remove '%s'", path);
-
- return 0;
-}
-
-/**
- * Create a path name with the following format:
- * "/tmp/@prefix-$PID-XXXXXX". The returned C string is either
- * auto-freed if @context is NULL. This function returns NULL if an
- * error occurred.
- */
-char *create_temp_name(TALLOC_CTX *context, const char *prefix)
-{
- const char *temp_directory = get_temp_directory();
- char *name;
-
- if (context == NULL)
- context = talloc_autofree_context();
-
- name = talloc_asprintf(context, "%s/%s-%d-XXXXXX", temp_directory, prefix, getpid());
- if (name == NULL) {
- note(NULL, ERROR, INTERNAL, "can't allocate memory");
- return NULL;
- }
-
- return name;
-}
-
-/**
- * Create a directory that will be automatically removed either on
- * PRoot termination if @context is NULL, or once its path name
- * (attached to @context) is freed. This function returns NULL on
- * error, otherwise the absolute path name to the created directory
- * (@prefix-ed).
- */
-const char *create_temp_directory(TALLOC_CTX *context, const char *prefix)
-{
- char *name;
-
- name = create_temp_name(context, prefix);
- if (name == NULL)
- return NULL;
-
- name = mkdtemp(name);
- if (name == NULL) {
- note(NULL, ERROR, SYSTEM, "can't create temporary directory");
- note(NULL, INFO, USER, "Please set PROOT_TMP_DIR env. variable "
- "to an alternate location (with write permission).");
- return NULL;
- }
-
- talloc_set_destructor(name, remove_temp_directory);
-
- return name;
-}
-
-/**
- * Create a file that will be automatically removed either on PRoot
- * termination if @context is NULL, or once its path name (attached to
- * @context) is freed. This function returns NULL on error,
- * otherwise the absolute path name to the created file (@prefix-ed).
- */
-const char *create_temp_file(TALLOC_CTX *context, const char *prefix)
-{
- char *name;
- int fd;
-
- name = create_temp_name(context, prefix);
- if (name == NULL)
- return NULL;
-
- fd = mkstemp(name);
- if (fd < 0) {
- note(NULL, ERROR, SYSTEM, "can't create temporary file");
- note(NULL, INFO, USER, "Please set PROOT_TMP_DIR env. variable "
- "to an alternate location (with write permission).");
- return NULL;
- }
- close(fd);
-
- talloc_set_destructor(name, remove_temp_file);
-
- return name;
-}
diff --git a/app/src/main/cpp/proot/src/path/temp.h b/app/src/main/cpp/proot/src/path/temp.h
deleted file mode 100644
index 5315f44..0000000
--- a/app/src/main/cpp/proot/src/path/temp.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef TEMP_H
-#define TEMP_H
-
-#include
-
-extern char *create_temp_name(TALLOC_CTX *context, const char *prefix);
-extern const char *create_temp_directory(TALLOC_CTX *context, const char *prefix);
-extern const char *create_temp_file(TALLOC_CTX *context, const char *prefix);
-extern const char *get_temp_directory();
-
-#endif /* TEMP_H */
diff --git a/app/src/main/cpp/proot/src/ptrace/ptrace.c b/app/src/main/cpp/proot/src/ptrace/ptrace.c
deleted file mode 100644
index 64902d6..0000000
--- a/app/src/main/cpp/proot/src/ptrace/ptrace.c
+++ /dev/null
@@ -1,575 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* PTRACE_*, */
-#include /* E*, */
-#include /* assert(3), */
-#include /* bool, true, false, */
-#include /* siginfo_t, */
-#include /* struct iovec, */
-#include /* MIN(), MAX(), */
-#include /* __WALL, */
-#include /* memcpy(3), */
-#include /* bzero(3), */
-
-#include "ptrace/ptrace.h"
-#include "tracee/tracee.h"
-#include "syscall/sysnum.h"
-#include "tracee/reg.h"
-#include "tracee/mem.h"
-#include "tracee/abi.h"
-#include "tracee/event.h"
-#include "cli/note.h"
-#include "arch.h"
-
-#include "compat.h"
-
-#if defined(ARCH_ARM_EABI)
-#define user_fpregs_struct user_fpregs
-#endif
-
-#if defined(ARCH_ARM64)
-#define user_fpregs_struct user_fpsimd_struct
-#endif
-
-static const char *stringify_ptrace(int request)
-{
-#define CASE_STR(a) case a: return #a; break;
- switch ((int) request) {
- CASE_STR(PTRACE_TRACEME) CASE_STR(PTRACE_PEEKTEXT) CASE_STR(PTRACE_PEEKDATA)
- CASE_STR(PTRACE_PEEKUSER) CASE_STR(PTRACE_POKETEXT) CASE_STR(PTRACE_POKEDATA)
- CASE_STR(PTRACE_POKEUSER) CASE_STR(PTRACE_CONT) CASE_STR(PTRACE_KILL)
- CASE_STR(PTRACE_SINGLESTEP) CASE_STR(PTRACE_GETREGS) CASE_STR(PTRACE_SETREGS)
- CASE_STR(PTRACE_GETFPREGS) CASE_STR(PTRACE_SETFPREGS) CASE_STR(PTRACE_ATTACH)
- CASE_STR(PTRACE_DETACH) CASE_STR(PTRACE_GETFPXREGS) CASE_STR(PTRACE_SETFPXREGS)
- CASE_STR(PTRACE_SYSCALL) CASE_STR(PTRACE_SETOPTIONS) CASE_STR(PTRACE_GETEVENTMSG)
- CASE_STR(PTRACE_GETSIGINFO) CASE_STR(PTRACE_SETSIGINFO) CASE_STR(PTRACE_GETREGSET)
- CASE_STR(PTRACE_SETREGSET) CASE_STR(PTRACE_SEIZE) CASE_STR(PTRACE_INTERRUPT)
- CASE_STR(PTRACE_LISTEN) CASE_STR(PTRACE_SET_SYSCALL)
- CASE_STR(PTRACE_GET_THREAD_AREA) CASE_STR(PTRACE_SET_THREAD_AREA)
- CASE_STR(PTRACE_GETVFPREGS) CASE_STR(PTRACE_SINGLEBLOCK) CASE_STR(PTRACE_ARCH_PRCTL)
- default: return "PTRACE_???"; }
-}
-
-/**
- * Translate the ptrace syscall made by @tracee into a "void" syscall
- * in order to emulate the ptrace mechanism within PRoot. This
- * function returns -errno if an error occured (unsupported request),
- * otherwise 0.
- */
-int translate_ptrace_enter(Tracee *tracee)
-{
- /* The ptrace syscall have to be emulated since it can't be nested. */
- set_sysnum(tracee, PR_void);
- return 0;
-}
-
-/**
- * Set @ptracee's tracer to @ptracer, and increment ptracees counter
- * of this later.
- */
-void attach_to_ptracer(Tracee *ptracee, Tracee *ptracer)
-{
- bzero(&(PTRACEE), sizeof(PTRACEE));
- PTRACEE.ptracer = ptracer;
-
- PTRACER.nb_ptracees++;
-}
-
-/**
- * Unset @ptracee's tracer, and decrement ptracees counter of this
- * later.
- */
-void detach_from_ptracer(Tracee *ptracee)
-{
- Tracee *ptracer = PTRACEE.ptracer;
-
- PTRACEE.ptracer = NULL;
-
- assert(PTRACER.nb_ptracees > 0);
- PTRACER.nb_ptracees--;
-}
-
-/**
- * Emulate the ptrace syscall made by @tracee. This function returns
- * -errno if an error occured (unsupported request), otherwise 0.
- */
-int translate_ptrace_exit(Tracee *tracee)
-{
- word_t request, pid, address, data, result;
- Tracee *ptracee, *ptracer;
- int forced_signal = -1;
- int signal;
- int status;
-
- /* Read ptrace parameters. */
- request = peek_reg(tracee, ORIGINAL, SYSARG_1);
- pid = peek_reg(tracee, ORIGINAL, SYSARG_2);
- address = peek_reg(tracee, ORIGINAL, SYSARG_3);
- data = peek_reg(tracee, ORIGINAL, SYSARG_4);
-
- /* Propagate signedness for this special value. */
- if (is_32on64_mode(tracee) && pid == 0xFFFFFFFF)
- pid = (word_t) -1;
-
- /* The TRACEME request is the only one used by a tracee. */
- if (request == PTRACE_TRACEME) {
- ptracer = tracee->parent;
- ptracee = tracee;
-
- /* The emulated ptrace in PRoot has the same
- * limitation as the real ptrace in the Linux kernel:
- * only one tracer per process. */
- if (PTRACEE.ptracer != NULL || ptracee == ptracer)
- return -EPERM;
-
- attach_to_ptracer(ptracee, ptracer);
-
- /* Detect when the ptracer has gone to wait before the
- * ptracee did the ptrace(ATTACHME) request. */
- if (PTRACER.waits_in == WAITS_IN_KERNEL) {
- status = kill(ptracer->pid, SIGSTOP);
- if (status < 0)
- note(tracee, WARNING, INTERNAL,
- "can't wake ptracer %d", ptracer->pid);
- else {
- ptracer->sigstop = SIGSTOP_IGNORED;
- PTRACER.waits_in = WAITS_IN_PROOT;
- }
- }
-
- /* Disable seccomp acceleration for this tracee and
- * all its children since we can't assume what are the
- * syscalls its tracer is interested with. */
- if (tracee->seccomp == ENABLED)
- tracee->seccomp = DISABLING;
-
- return 0;
- }
-
- /* The ATTACH, SEIZE, and INTERRUPT requests are the only ones
- * where the ptracee is in an unknown state. */
- if (request == PTRACE_ATTACH) {
- ptracer = tracee;
- ptracee = get_tracee(ptracer, pid, false);
- if (ptracee == NULL)
- return -ESRCH;
-
- /* The emulated ptrace in PRoot has the same
- * limitation as the real ptrace in the Linux kernel:
- * only one tracer per process. */
- if (PTRACEE.ptracer != NULL || ptracee == ptracer)
- return -EPERM;
-
- attach_to_ptracer(ptracee, ptracer);
-
- /* The tracee is sent a SIGSTOP, but will not
- * necessarily have stopped by the completion of this
- * call.
- *
- * -- man 2 ptrace. */
- kill(pid, SIGSTOP);
-
- return 0;
- }
-
- /* Here, the tracee is a ptracer. Also, the requested ptracee
- * has to be in the "stopped for ptracer" state. */
- ptracer = tracee;
- ptracee = get_stopped_ptracee(ptracer, pid, false, __WALL);
- if (ptracee == NULL) {
- static bool warned = false;
-
- /* Ensure we didn't get there only because inheritance
- * mechanism has missed this one. */
- ptracee = get_tracee(tracee, pid, false);
- if (ptracee != NULL && ptracee->exe == NULL && !warned) {
- warned = true;
- note(ptracer, WARNING, INTERNAL, "ptrace request to an unexpected ptracee");
- }
-
- return -ESRCH;
- }
-
- /* Sanity checks. */
- if ( PTRACEE.is_zombie
- || PTRACEE.ptracer != ptracer
- || pid == (word_t) -1)
- return -ESRCH;
-
- switch (request) {
- case PTRACE_SYSCALL:
- PTRACEE.ignore_syscalls = false;
- forced_signal = (int) data;
- status = 0;
- break; /* Restart the ptracee. */
-
- case PTRACE_CONT:
- PTRACEE.ignore_syscalls = true;
- forced_signal = (int) data;
- status = 0;
- break; /* Restart the ptracee. */
-
- case PTRACE_SINGLESTEP:
- ptracee->restart_how = PTRACE_SINGLESTEP;
- forced_signal = (int) data;
- status = 0;
- break; /* Restart the ptracee. */
-
- case PTRACE_SINGLEBLOCK:
- ptracee->restart_how = PTRACE_SINGLEBLOCK;
- forced_signal = (int) data;
- status = 0;
- break; /* Restart the ptracee. */
-
- case PTRACE_DETACH:
- detach_from_ptracer(ptracee);
- status = 0;
- break; /* Restart the ptracee. */
-
- case PTRACE_KILL:
- status = ptrace(request, pid, NULL, NULL);
- break; /* Restart the ptracee. */
-
- case PTRACE_SETOPTIONS:
- PTRACEE.options = data;
- return 0; /* Don't restart the ptracee. */
-
- case PTRACE_GETEVENTMSG: {
- status = ptrace(request, pid, NULL, &result);
- if (status < 0)
- return -errno;
-
- poke_word(ptracer, data, result);
- if (errno != 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_PEEKUSER:
- if (is_32on64_mode(ptracer) && address == (word_t) -1)
- return -EIO;
- /* Fall through. */
- case PTRACE_PEEKTEXT:
- case PTRACE_PEEKDATA:
- errno = 0;
- result = (word_t) ptrace(request, pid, address, NULL);
- if (errno != 0)
- return -errno;
-
- poke_word(ptracer, data, result);
- if (errno != 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
-
- case PTRACE_POKEUSER:
- if (is_32on64_mode(ptracer)) {
- if (address == (word_t) -1)
- return -EIO;
- }
-
- status = ptrace(request, pid, address, data);
- if (status < 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
-
- case PTRACE_POKETEXT:
- case PTRACE_POKEDATA:
- if (is_32on64_mode(ptracer)) {
- word_t tmp;
-
- errno = 0;
- tmp = (word_t) ptrace(PTRACE_PEEKDATA, ptracee->pid, address, NULL);
- if (errno != 0)
- return -errno;
-
- data |= (tmp & 0xFFFFFFFF00000000ULL);
- }
-
- status = ptrace(request, pid, address, data);
- if (status < 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
-
- case PTRACE_GETSIGINFO: {
- siginfo_t siginfo;
-
- status = ptrace(request, pid, NULL, &siginfo);
- if (status < 0)
- return -errno;
-
- status = write_data(ptracer, data, &siginfo, sizeof(siginfo));
- if (status < 0)
- return status;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_SETSIGINFO: {
- siginfo_t siginfo;
-
- status = read_data(ptracer, &siginfo, data, sizeof(siginfo));
- if (status < 0)
- return status;
-
- status = ptrace(request, pid, NULL, &siginfo);
- if (status < 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_GETREGS: {
- size_t size;
- union {
- struct user_regs_struct regs;
- uint32_t regs32[0];
- } buffer;
-
- status = ptrace(request, pid, NULL, &buffer);
- if (status < 0)
- return -errno;
-
- if (is_32on64_mode(tracee)) {
- struct user_regs_struct regs64;
-
- memcpy(®s64, &buffer.regs, sizeof(struct user_regs_struct));
-
- size = sizeof(buffer.regs32);
- }
- else
- size = sizeof(buffer.regs);
-
- status = write_data(ptracer, data, &buffer, size);
- if (status < 0)
- return status;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_SETREGS: {
- size_t size;
- union {
- struct user_regs_struct regs;
- uint32_t regs32[0];
- } buffer;
-
- size = (is_32on64_mode(ptracer)
- ? sizeof(buffer.regs32)
- : sizeof(buffer.regs));
-
- status = read_data(ptracer, &buffer, data, size);
- if (status < 0)
- return status;
-
- if (is_32on64_mode(ptracer)) {
- uint32_t regs32[0];
-
- memcpy(regs32, buffer.regs32, sizeof(regs32));
- }
-
- status = ptrace(request, pid, NULL, &buffer);
- if (status < 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_GETFPREGS: {
- size_t size;
- union {
- struct user_fpregs_struct fpregs;
- uint32_t fpregs32[0];
- } buffer;
-
- status = ptrace(request, pid, NULL, &buffer);
- if (status < 0)
- return -errno;
-
- if (is_32on64_mode(tracee)) {
- static bool warned = false;
- if (!warned)
- note(ptracer, WARNING, INTERNAL,
- "ptrace 32-bit request '%s' not supported on 64-bit yet",
- stringify_ptrace(request));
- warned = true;
- bzero(&buffer, sizeof(buffer));
- size = sizeof(buffer.fpregs32);
- }
- else
- size = sizeof(buffer.fpregs);
-
- status = write_data(ptracer, data, &buffer, size);
- if (status < 0)
- return status;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_SETFPREGS: {
- size_t size;
- union {
- struct user_fpregs_struct fpregs;
- uint32_t fpregs32[0];
- } buffer;
-
- size = (is_32on64_mode(ptracer)
- ? sizeof(buffer.fpregs32)
- : sizeof(buffer.fpregs));
-
- status = read_data(ptracer, &buffer, data, size);
- if (status < 0)
- return status;
-
- if (is_32on64_mode(ptracer)) {
- static bool warned = false;
- if (!warned)
- note(ptracer, WARNING, INTERNAL,
- "ptrace 32-bit request '%s' not supported on 64-bit yet",
- stringify_ptrace(request));
- warned = true;
- return -ENOTSUP;
- }
-
- status = ptrace(request, pid, NULL, &buffer);
- if (status < 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_GETREGSET: {
- struct iovec local_iovec;
- word_t remote_iovec_base;
- word_t remote_iovec_len;
-
- remote_iovec_base = peek_word(ptracer, data);
- if (errno != 0)
- return -errno;
-
- remote_iovec_len = peek_word(ptracer, data + sizeof_word(ptracer));
- if (errno != 0)
- return -errno;
-
- /* Sanity check. */
- assert(sizeof(local_iovec.iov_len) == sizeof(word_t));
-
- local_iovec.iov_len = remote_iovec_len;
- local_iovec.iov_base = talloc_zero_size(ptracer->ctx, remote_iovec_len);
- if (local_iovec.iov_base == NULL)
- return -ENOMEM;
-
- status = ptrace(PTRACE_GETREGSET, pid, address, &local_iovec);
- if (status < 0)
- return status;
-
- remote_iovec_len = local_iovec.iov_len =
- MIN(remote_iovec_len, local_iovec.iov_len);
-
- /* Update remote vector content. */
- status = writev_data(ptracer, remote_iovec_base, &local_iovec, 1);
- if (status < 0)
- return status;
-
- /* Update remote vector length. */
- poke_word(ptracer, data + sizeof_word(ptracer), remote_iovec_len);
- if (errno != 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_SETREGSET: {
- struct iovec local_iovec;
- word_t remote_iovec_base;
- word_t remote_iovec_len;
-
- remote_iovec_base = peek_word(ptracer, data);
- if (errno != 0)
- return -errno;
-
- remote_iovec_len = peek_word(ptracer, data + sizeof_word(ptracer));
- if (errno != 0)
- return -errno;
-
- /* Sanity check. */
- assert(sizeof(local_iovec.iov_len) == sizeof(word_t));
-
- local_iovec.iov_len = remote_iovec_len;
- local_iovec.iov_base = talloc_zero_size(ptracer->ctx, remote_iovec_len);
- if (local_iovec.iov_base == NULL)
- return -ENOMEM;
-
- /* Copy remote content into the local vector. */
- status = read_data(ptracer, local_iovec.iov_base,
- remote_iovec_base, local_iovec.iov_len);
- if (status < 0)
- return status;
-
- status = ptrace(PTRACE_SETREGSET, pid, address, &local_iovec);
- if (status < 0)
- return status;
-
- return 0; /* Don't restart the ptracee. */
- }
-
- case PTRACE_GETVFPREGS:
- case PTRACE_GETFPXREGS: {
- static bool warned = false;
- if (!warned)
- note(ptracer, WARNING, INTERNAL, "ptrace request '%s' not supported yet",
- stringify_ptrace(request));
- warned = true;
- return -ENOTSUP;
- }
-
- case PTRACE_SET_SYSCALL:
- status = ptrace(request, pid, address, data);
- if (status < 0)
- return -errno;
-
- return 0; /* Don't restart the ptracee. */
-
- default:
- note(ptracer, WARNING, INTERNAL, "ptrace request '%s' not supported yet",
- stringify_ptrace(request));
- return -ENOTSUP;
- }
-
- /* Now, the initial tracee's event can be handled. */
- signal = PTRACEE.event4.proot.pending
- ? handle_tracee_event(ptracee, PTRACEE.event4.proot.value)
- : PTRACEE.event4.proot.value;
-
- /* The restarting signal from the ptracer overrides the
- * restarting signal from PRoot. */
- if (forced_signal != -1)
- signal = forced_signal;
-
- (void) restart_tracee(ptracee, signal);
-
- return status;
-}
diff --git a/app/src/main/cpp/proot/src/ptrace/ptrace.h b/app/src/main/cpp/proot/src/ptrace/ptrace.h
deleted file mode 100644
index 9083ea9..0000000
--- a/app/src/main/cpp/proot/src/ptrace/ptrace.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef PTRACE_H
-#define PTRACE_H
-
-#include "tracee/tracee.h"
-
-extern int translate_ptrace_enter(Tracee *tracee);
-extern int translate_ptrace_exit(Tracee *tracee);
-extern void attach_to_ptracer(Tracee *ptracee, Tracee *ptracer);
-extern void detach_from_ptracer(Tracee *ptracee);
-
-#define PTRACEE (ptracee->as_ptracee)
-#define PTRACER (ptracer->as_ptracer)
-
-#endif /* PTRACE_H */
diff --git a/app/src/main/cpp/proot/src/ptrace/wait.c b/app/src/main/cpp/proot/src/ptrace/wait.c
deleted file mode 100644
index af447d1..0000000
--- a/app/src/main/cpp/proot/src/ptrace/wait.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* PTRACE_*, */
-#include /* E*, */
-#include /* assert(3), */
-#include /* bool, true, false, */
-#include /* SIG*, */
-#include /* talloc*, */
-
-#include "ptrace/wait.h"
-#include "ptrace/ptrace.h"
-#include "syscall/sysnum.h"
-#include "syscall/chain.h"
-#include "tracee/tracee.h"
-#include "tracee/event.h"
-#include "tracee/reg.h"
-#include "tracee/mem.h"
-
-#include "attribute.h"
-
-static const char *stringify_event(int event) UNUSED;
-static const char *stringify_event(int event)
-{
- if (WIFEXITED(event))
- return "exited";
- else if (WIFSIGNALED(event))
- return "signaled";
- else if (WIFCONTINUED(event))
- return "continued";
- else if (WIFSTOPPED(event)) {
- switch ((event & 0xfff00) >> 8) {
- case SIGTRAP:
- return "stopped: SIGTRAP";
- case SIGTRAP | 0x80:
- return "stopped: SIGTRAP: 0x80";
- case SIGTRAP | PTRACE_EVENT_VFORK << 8:
- return "stopped: SIGTRAP: PTRACE_EVENT_VFORK";
- case SIGTRAP | PTRACE_EVENT_FORK << 8:
- return "stopped: SIGTRAP: PTRACE_EVENT_FORK";
- case SIGTRAP | PTRACE_EVENT_VFORK_DONE << 8:
- return "stopped: SIGTRAP: PTRACE_EVENT_VFORK_DONE";
- case SIGTRAP | PTRACE_EVENT_CLONE << 8:
- return "stopped: SIGTRAP: PTRACE_EVENT_CLONE";
- case SIGTRAP | PTRACE_EVENT_EXEC << 8:
- return "stopped: SIGTRAP: PTRACE_EVENT_EXEC";
- case SIGTRAP | PTRACE_EVENT_EXIT << 8:
- return "stopped: SIGTRAP: PTRACE_EVENT_EXIT";
- case SIGTRAP | PTRACE_EVENT_SECCOMP2 << 8:
- return "stopped: SIGTRAP: PTRACE_EVENT_SECCOMP2";
- case SIGTRAP | PTRACE_EVENT_SECCOMP << 8:
- return "stopped: SIGTRAP: PTRACE_EVENT_SECCOMP";
- case SIGSTOP:
- return "stopped: SIGSTOP";
- default:
- return "stopped: unknown";
- }
- }
- return "unknown";
-}
-
-/**
- * Translate the wait syscall made by @ptracer into a "void" syscall
- * if the expected pid is one of its ptracees, in order to emulate the
- * ptrace mechanism within PRoot. This function returns -errno if an
- * error occured (unsupported request), otherwise 0.
- */
-int translate_wait_enter(Tracee *ptracer)
-{
- Tracee *ptracee;
- pid_t pid;
-
- PTRACER.waits_in = WAITS_IN_KERNEL;
-
- /* Don't emulate the ptrace mechanism if it's not a ptracer. */
- if (PTRACER.nb_ptracees == 0)
- return 0;
-
- /* Don't emulate the ptrace mechanism if the requested pid is
- * not a ptracee. */
- pid = (pid_t) peek_reg(ptracer, ORIGINAL, SYSARG_1);
- if (pid != -1) {
- ptracee = get_tracee(ptracer, pid, false);
- if (ptracee == NULL || PTRACEE.ptracer != ptracer)
- return 0;
- }
-
- /* This syscall is canceled at the enter stage in order to be
- * handled at the exit stage. */
- set_sysnum(ptracer, PR_void);
- PTRACER.waits_in = WAITS_IN_PROOT;
-
- return 0;
-}
-
-/**
- * Update pid & wait status of @ptracer's wait(2) for the given
- * @ptracee. This function returns -errno if an error occurred, 0 if
- * the wait syscall will be restarted (ie. the event is discarded),
- * otherwise @ptracee's pid.
- */
-static int update_wait_status(Tracee *ptracer, Tracee *ptracee)
-{
- word_t address;
- int result;
-
- /* Special case: the Linux kernel reports the terminating
- * event issued by a process to both its parent and its
- * tracer, except when they are the same. In this case the
- * Linux kernel reports the terminating event only once to the
- * tracing parent ... */
- if (PTRACEE.ptracer == ptracee->parent
- && (WIFEXITED(PTRACEE.event4.ptracer.value)
- || WIFSIGNALED(PTRACEE.event4.ptracer.value))) {
- /* ... So hide this terminating event (toward its
- * tracer, ie. PRoot) and make the second one appear
- * (towards its parent, ie. the ptracer). This will
- * ensure its exit status is collected from a kernel
- * point-of-view (ie. it doesn't stay a zombie
- * forever). */
- restart_original_syscall(ptracer);
-
- /* Detach this ptracee from its ptracer, PRoot doesn't
- * have anything else to emulate. */
- detach_from_ptracer(ptracee);
-
- /* Zombies can rest in peace once the ptracer is
- * notified. */
- if (PTRACEE.is_zombie)
- TALLOC_FREE(ptracee);
-
- return 0;
- }
-
- address = peek_reg(ptracer, ORIGINAL, SYSARG_2);
- if (address != 0) {
- poke_int32(ptracer, address, PTRACEE.event4.ptracer.value);
- if (errno != 0)
- return -errno;
- }
-
- PTRACEE.event4.ptracer.pending = false;
-
- /* Be careful; ptracee might get freed before its pid is
- * returned. */
- result = ptracee->pid;
-
- /* Zombies can rest in peace once the ptracer is notified. */
- if (PTRACEE.is_zombie) {
- detach_from_ptracer(ptracee);
- TALLOC_FREE(ptracee);
- }
-
- return result;
-}
-
-/**
- * Emulate the wait* syscall made by @ptracer if it was in the context
- * of the ptrace mechanism. This function returns -errno if an error
- * occured, otherwise the pid of the expected tracee.
- */
-int translate_wait_exit(Tracee *ptracer)
-{
- Tracee *ptracee;
- word_t options;
- int status;
- pid_t pid;
-
- assert(PTRACER.waits_in == WAITS_IN_PROOT);
- PTRACER.waits_in = DOESNT_WAIT;
-
- pid = (pid_t) peek_reg(ptracer, ORIGINAL, SYSARG_1);
- options = peek_reg(ptracer, ORIGINAL, SYSARG_3);
-
- /* Is there such a stopped ptracee with an event not yet
- * passed to its ptracer? */
- ptracee = get_stopped_ptracee(ptracer, pid, true, options);
- if (ptracee == NULL) {
- /* Is there still living ptracees? */
- if (PTRACER.nb_ptracees == 0)
- return -ECHILD;
-
- /* Non blocking wait(2) ? */
- if ((options & WNOHANG) != 0) {
- /* if WNOHANG was specified and one or more
- * child(ren) specified by pid exist, but have
- * not yet changed state, then 0 is returned.
- * On error, -1 is returned.
- *
- * -- man 2 waitpid */
- return (has_ptracees(ptracer, pid, options) ? 0 : -ECHILD);
- }
-
- /* Otherwise put this ptracer in the "waiting for
- * ptracee" state, it will be woken up in
- * handle_ptracee_event() later. */
- PTRACER.wait_pid = pid;
- PTRACER.wait_options = options;
-
- return 0;
- }
-
- status = update_wait_status(ptracer, ptracee);
- if (status < 0)
- return status;
-
- return status;
-}
-
-/**
- * For the given @ptracee, pass its current @event to its ptracer if
- * this latter is waiting for it, otherwise put the @ptracee in the
- * "waiting for ptracer" state. This function returns whether
- * @ptracee shall be kept in the stop state or not.
- */
-bool handle_ptracee_event(Tracee *ptracee, int event)
-{
- bool handled_by_proot_first = false;
- bool handled_by_proot_first_may_suppress = false;
- Tracee *ptracer = PTRACEE.ptracer;
- bool keep_stopped;
-
- assert(ptracer != NULL);
-
- /* Remember what the event initially was, this will be
- * required by PRoot to handle this event later. */
- PTRACEE.event4.proot.value = event;
- PTRACEE.event4.proot.pending = true;
-
- /* By default, this ptracee should be kept stopped until its
- * ptracer restarts it. */
- keep_stopped = true;
-
- /* Not all events are expected for this ptracee. */
- if (WIFSTOPPED(event)) {
- switch ((event & 0xfff00) >> 8) {
- case SIGTRAP | 0x80:
- if (PTRACEE.ignore_syscalls || PTRACEE.ignore_loader_syscalls)
- return false;
-
- if ((PTRACEE.options & PTRACE_O_TRACESYSGOOD) == 0)
- event &= ~(0x80 << 8);
-
- handled_by_proot_first = IS_IN_SYSEXIT(ptracee);
- break;
-
-#define PTRACE_EVENT_VFORKDONE PTRACE_EVENT_VFORK_DONE
-#define CASE_FILTER_EVENT(name) \
- case SIGTRAP | PTRACE_EVENT_ ##name << 8: \
- if ((PTRACEE.options & PTRACE_O_TRACE ##name) == 0) \
- return false; \
- PTRACEE.tracing_started = true; \
- handled_by_proot_first = true; \
- break;
-
- CASE_FILTER_EVENT(FORK);
- CASE_FILTER_EVENT(VFORK);
- CASE_FILTER_EVENT(VFORKDONE);
- CASE_FILTER_EVENT(CLONE);
- CASE_FILTER_EVENT(EXIT);
- CASE_FILTER_EVENT(EXEC);
-
- /* Never reached. */
- assert(0);
-
- case SIGTRAP | PTRACE_EVENT_SECCOMP2 << 8:
- case SIGTRAP | PTRACE_EVENT_SECCOMP << 8:
- /* These events are not supported [yet?] under
- * ptrace emulation. */
- return false;
-
- case SIGSYS:
- handled_by_proot_first = true;
- handled_by_proot_first_may_suppress = true;
- break;
-
- default:
- PTRACEE.tracing_started = true;
- break;
- }
- }
- /* In these cases, the ptracee isn't really alive anymore. To
- * ensure it will not be in limbo, PRoot restarts it whether
- * its ptracer is waiting for it or not. */
- else if (WIFEXITED(event) || WIFSIGNALED(event)) {
- PTRACEE.tracing_started = true;
- keep_stopped = false;
- }
-
- /* A process is not traced right from the TRACEME request; it
- * is traced from the first received signal, whether it was
- * raised by the process itself (implicitly or explicitly), or
- * it was induced by a PTRACE_EVENT_*. */
- if (!PTRACEE.tracing_started)
- return false;
-
- /* Under some circumstances, the event must be handled by
- * PRoot first. */
- if (handled_by_proot_first) {
- int signal;
- signal = handle_tracee_event(ptracee, PTRACEE.event4.proot.value);
- PTRACEE.event4.proot.value = signal;
-
- if (handled_by_proot_first_may_suppress) {
- /* If we've decided to suppress signal
- * (e.g. because seccomp policy blocked syscall
- * but we emulate that syscall),
- * don't notify ptracer and let ptracee resume. */
- if (signal == 0) {
- if (seccomp_event_happens_after_enter_sigtrap()) {
- if (PTRACEE.ignore_syscalls)
- {
- restart_tracee(ptracee, 0);
- return true;
- }
- /* However if we've already notified ptracer about syscall entry
- * before knowing it'll be blocked, notify ptracer about exit. */
- PTRACEE.event4.proot.value = 0;
- if (PTRACEE.options & PTRACE_O_TRACESYSGOOD) {
- event = (SIGTRAP | 0x80) << 8 | 0x7f;
- } else {
- event = SIGTRAP << 8 | 0x7f;
- }
- } else {
- restart_tracee(ptracee, 0);
- return true;
- }
- }
- } else {
- /* The computed signal is always 0 since we can come
- * in this block only on sysexit and special events
- * (as for now). */
- assert(signal == 0);
- }
- }
-
- /* Remember what the new event is, this will be required by
- the ptracer in translate_ptrace_exit() in order to restart
- this ptracee. */
- PTRACEE.event4.ptracer.value = event;
- PTRACEE.event4.ptracer.pending = true;
-
- /* Notify asynchronously the ptracer about this event, as the
- * kernel does. */
- kill(ptracer->pid, SIGCHLD);
-
- /* Note: wait_pid is set in translate_wait_exit() if no
- * ptracee event was pending when the ptracer started to
- * wait. */
- if ( (PTRACER.wait_pid == -1 || PTRACER.wait_pid == ptracee->pid)
- && EXPECTED_WAIT_CLONE(PTRACER.wait_options, ptracee)) {
- bool restarted;
- int status;
-
- status = update_wait_status(ptracer, ptracee);
- if (status == 0)
- chain_next_syscall(ptracer);
- else
- poke_reg(ptracer, SYSARG_RESULT, (word_t) status);
-
- /* Write ptracer's register cache back. */
- (void) push_regs(ptracer);
-
- /* Restart the ptracer. */
- PTRACER.wait_pid = 0;
- restarted = restart_tracee(ptracer, 0);
- if (!restarted)
- keep_stopped = false;
-
- return keep_stopped;
- }
-
- return keep_stopped;
-}
diff --git a/app/src/main/cpp/proot/src/ptrace/wait.h b/app/src/main/cpp/proot/src/ptrace/wait.h
deleted file mode 100644
index 8648f6f..0000000
--- a/app/src/main/cpp/proot/src/ptrace/wait.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef PTRACE_WAIT_H
-#define PTRACE_WAIT_H
-
-#include /* for __WALL */
-
-#include "tracee/tracee.h"
-
-extern int translate_wait_enter(Tracee *ptracer);
-extern int translate_wait_exit(Tracee *ptracer);
-extern bool handle_ptracee_event(Tracee *ptracee, int wait_status);
-
-/* __WCLONE: Wait for "clone" children only. If omitted then wait for
- * "non-clone" children only. (A "clone" child is one which delivers
- * no signal, or a signal other than SIGCHLD to its parent upon
- * termination.) This option is ignored if __WALL is also specified.
- *
- * __WALL: Wait for all children, regardless of type ("clone" or
- * "non-clone").
- *
- * -- wait(2) man-page
- */
-#define EXPECTED_WAIT_CLONE(wait_options, tracee) \
- ((((wait_options) & __WALL) != 0) \
- || ((((wait_options) & __WCLONE) != 0) && (tracee)->clone) \
- || ((((wait_options) & __WCLONE) == 0) && !(tracee)->clone))
-
-#endif /* PTRACE_WAIT_H */
diff --git a/app/src/main/cpp/proot/src/syscall/chain.c b/app/src/main/cpp/proot/src/syscall/chain.c
deleted file mode 100644
index 93d8833..0000000
--- a/app/src/main/cpp/proot/src/syscall/chain.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* talloc*, */
-#include /* STAILQ_*, */
-#include /* E*, */
-#include /* assert(3), */
-
-#include "cli/note.h"
-#include "syscall/chain.h"
-#include "syscall/sysnum.h"
-#include "tracee/tracee.h"
-#include "tracee/reg.h"
-#include "arch.h"
-
-struct chained_syscall {
- Sysnum sysnum;
- word_t sysargs[6];
- STAILQ_ENTRY(chained_syscall) link;
-};
-
-STAILQ_HEAD(chained_syscalls, chained_syscall);
-
-static int register_chained_syscall_internal(Tracee *tracee, Sysnum sysnum,
- word_t sysarg_1, word_t sysarg_2, word_t sysarg_3,
- word_t sysarg_4, word_t sysarg_5, word_t sysarg_6,
- bool at_front)
-{
- struct chained_syscall *syscall;
-
- if (tracee->chain.syscalls == NULL) {
- tracee->chain.syscalls = talloc_zero(tracee, struct chained_syscalls);
- if (tracee->chain.syscalls == NULL)
- return -ENOMEM;
-
- STAILQ_INIT(tracee->chain.syscalls);
- }
-
- syscall = talloc_zero(tracee->chain.syscalls, struct chained_syscall);
- if (syscall == NULL)
- return -ENOMEM;
-
- syscall->sysnum = sysnum;
- syscall->sysargs[0] = sysarg_1;
- syscall->sysargs[1] = sysarg_2;
- syscall->sysargs[2] = sysarg_3;
- syscall->sysargs[3] = sysarg_4;
- syscall->sysargs[4] = sysarg_5;
- syscall->sysargs[5] = sysarg_6;
-
- if (at_front) {
- STAILQ_INSERT_HEAD(tracee->chain.syscalls, syscall, link);
- } else {
- STAILQ_INSERT_TAIL(tracee->chain.syscalls, syscall, link);
- }
-
- return 0;
-}
-
-/**
- * Append a new syscall (@sysnum, @sysarg_*) to the list of
- * "unrequested" syscalls for the given @tracee. These new syscalls
- * will be triggered in order once the current syscall is done. The
- * caller is free to force the last result of this syscall chain in
- * @tracee->chain.final_result. This function returns -errno if an
- * error occurred, otherwise 0.
- */
-int register_chained_syscall(Tracee *tracee, Sysnum sysnum,
- word_t sysarg_1, word_t sysarg_2, word_t sysarg_3,
- word_t sysarg_4, word_t sysarg_5, word_t sysarg_6) {
- return register_chained_syscall_internal(
- tracee, sysnum,
- sysarg_1, sysarg_2, sysarg_3,
- sysarg_4, sysarg_5, sysarg_6,
- false
- );
-}
-
-/**
- * Use/remove the first element of @tracee->chain.syscalls to forge a
- * new syscall. This function should be called only at the end of in
- * the sysexit stage.
- */
-void chain_next_syscall(Tracee *tracee)
-{
- struct chained_syscall *syscall;
- word_t instr_pointer;
- word_t sysnum;
-
- assert(tracee->chain.syscalls != NULL);
-
- /* No more chained syscalls: force the result of the initial
- * syscall (the one explicitly requested by the tracee). */
- if (STAILQ_EMPTY(tracee->chain.syscalls)) {
- TALLOC_FREE(tracee->chain.syscalls);
-
- if (tracee->chain.force_final_result)
- poke_reg(tracee, SYSARG_RESULT, tracee->chain.final_result);
-
- tracee->chain.force_final_result = false;
- tracee->chain.final_result = 0;
-
- VERBOSE(tracee, 2, "chain_next_syscall finish");
-
- return;
- }
-
- VERBOSE(tracee, 2, "chain_next_syscall continue");
-
- /* Original register values will be restored right after the
- * last chained syscall. */
- tracee->restore_original_regs = false;
-
- /* The list of chained syscalls is a FIFO. */
- syscall = STAILQ_FIRST(tracee->chain.syscalls);
- STAILQ_REMOVE_HEAD(tracee->chain.syscalls, link);
-
- poke_reg(tracee, SYSARG_1, syscall->sysargs[0]);
- poke_reg(tracee, SYSARG_2, syscall->sysargs[1]);
- poke_reg(tracee, SYSARG_3, syscall->sysargs[2]);
- poke_reg(tracee, SYSARG_4, syscall->sysargs[3]);
- poke_reg(tracee, SYSARG_5, syscall->sysargs[4]);
- poke_reg(tracee, SYSARG_6, syscall->sysargs[5]);
-
- sysnum = detranslate_sysnum(get_abi(tracee), syscall->sysnum);
- poke_reg(tracee, SYSTRAP_NUM, sysnum);
-
- /* Move the instruction pointer back to the original trap. */
- instr_pointer = peek_reg(tracee, CURRENT, INSTR_POINTER);
- poke_reg(tracee, INSTR_POINTER, instr_pointer - get_systrap_size(tracee));
-
- /* Break after exit from syscall, there may be another one in chain */
- tracee->restart_how = PTRACE_SYSCALL;
-}
-
-/**
- * Restart the original syscall of the given @tracee. The result of
- * the current syscall will be overwritten. This function returns the
- * same status as register_chained_syscall().
- */
-int restart_original_syscall(Tracee *tracee)
-{
- return register_chained_syscall(tracee,
- get_sysnum(tracee, ORIGINAL),
- peek_reg(tracee, ORIGINAL, SYSARG_1),
- peek_reg(tracee, ORIGINAL, SYSARG_2),
- peek_reg(tracee, ORIGINAL, SYSARG_3),
- peek_reg(tracee, ORIGINAL, SYSARG_4),
- peek_reg(tracee, ORIGINAL, SYSARG_5),
- peek_reg(tracee, ORIGINAL, SYSARG_6));
-}
-
-int restart_current_syscall_as_chained(Tracee *tracee)
-{
- assert(tracee->chain.sysnum_workaround_state == SYSNUM_WORKAROUND_INACTIVE);
- tracee->chain.sysnum_workaround_state = SYSNUM_WORKAROUND_PROCESS_FAULTY_CALL;
- return register_chained_syscall_internal(tracee,
- get_sysnum(tracee, CURRENT),
- peek_reg(tracee, CURRENT, SYSARG_1),
- peek_reg(tracee, CURRENT, SYSARG_2),
- peek_reg(tracee, CURRENT, SYSARG_3),
- peek_reg(tracee, CURRENT, SYSARG_4),
- peek_reg(tracee, CURRENT, SYSARG_5),
- peek_reg(tracee, CURRENT, SYSARG_6),
- true);
-}
diff --git a/app/src/main/cpp/proot/src/syscall/chain.h b/app/src/main/cpp/proot/src/syscall/chain.h
deleted file mode 100644
index ed3e421..0000000
--- a/app/src/main/cpp/proot/src/syscall/chain.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef CHAIN_H
-#define CHAIN_H
-
-#include "tracee/tracee.h"
-#include "syscall/sysnum.h"
-#include "arch.h"
-
-extern int register_chained_syscall(Tracee *tracee, Sysnum sysnum,
- word_t sysarg_1, word_t sysarg_2, word_t sysarg_3,
- word_t sysarg_4, word_t sysarg_5, word_t sysarg_6);
-
-extern int restart_original_syscall(Tracee *tracee);
-
-extern void chain_next_syscall(Tracee *tracee);
-
-extern int restart_current_syscall_as_chained(Tracee *tracee);
-
-
-#endif /* CHAIN_H */
diff --git a/app/src/main/cpp/proot/src/syscall/enter.c b/app/src/main/cpp/proot/src/syscall/enter.c
deleted file mode 100644
index 7b33280..0000000
--- a/app/src/main/cpp/proot/src/syscall/enter.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* errno(3), E* */
-#include /* talloc_*, */
-#include /* struct sockaddr_un, */
-#include /* SYS_*, */
-#include /* AT_FDCWD, */
-#include /* PATH_MAX, */
-#include /* strcpy */
-#include /* PR_SET_DUMPABLE */
-#include /* TCSETS, TCSANOW */
-
-#include "syscall/syscall.h"
-#include "syscall/sysnum.h"
-#include "syscall/socket.h"
-#include "ptrace/ptrace.h"
-#include "ptrace/wait.h"
-#include "syscall/heap.h"
-#include "execve/execve.h"
-#include "tracee/tracee.h"
-#include "tracee/reg.h"
-#include "tracee/mem.h"
-#include "tracee/abi.h"
-#include "path/path.h"
-#include "path/canon.h"
-#include "arch.h"
-
-/**
- * Translate @path and put the result in the @tracee's memory address
- * space pointed to by the @reg argument of the current syscall. See
- * the documentation of translate_path() about the meaning of
- * @type. This function returns -errno if an error occured, otherwise
- * 0.
- */
-static int translate_path2(Tracee *tracee, int dir_fd, char path[PATH_MAX], Reg reg, Type type)
-{
- char new_path[PATH_MAX];
- int status;
-
- /* Special case where the argument was NULL. */
- if (path[0] == '\0')
- return 0;
-
- /* Translate the original path. */
- status = translate_path(tracee, new_path, dir_fd, path, type != SYMLINK);
- if (status < 0)
- return status;
-
- return set_sysarg_path(tracee, new_path, reg);
-}
-
-/**
- * A helper, see the comment of the function above.
- */
-static int translate_sysarg(Tracee *tracee, Reg reg, Type type)
-{
- char old_path[PATH_MAX];
- int status;
-
- /* Extract the original path. */
- status = get_sysarg_path(tracee, old_path, reg);
- if (status < 0)
- return status;
-
- return translate_path2(tracee, AT_FDCWD, old_path, reg, type);
-}
-
-/**
- * Translate the input arguments of the current @tracee's syscall in the
- * @tracee->pid process area. This function sets @tracee->status to
- * -errno if an error occured from the tracee's point-of-view (EFAULT
- * for instance), otherwise 0.
- */
-int translate_syscall_enter(Tracee *tracee)
-{
- int flags;
- int dirfd;
- int olddirfd;
- int newdirfd;
-
- int status = 0;
-
- char path[PATH_MAX];
- char oldpath[PATH_MAX];
- char newpath[PATH_MAX];
-
- word_t syscall_number;
- bool special = false;
-
- /* Translate input arguments. */
- syscall_number = get_sysnum(tracee, ORIGINAL);
- switch (syscall_number) {
- case PR_execve:
- status = translate_execve_enter(tracee);
- break;
-
- case PR_ptrace:
- status = translate_ptrace_enter(tracee);
- break;
-
- case PR_wait4:
- case PR_waitpid:
- status = translate_wait_enter(tracee);
- break;
-
- case PR_brk:
- translate_brk_enter(tracee);
- status = 0;
- break;
-
- case PR_getcwd:
- set_sysnum(tracee, PR_void);
- status = 0;
- break;
-
- case PR_fchdir:
- case PR_chdir: {
- struct stat statl;
- char *tmp;
-
- /* The ending "." ensures an error will be reported if
- * path does not exist or if it is not a directory. */
- if (syscall_number == PR_chdir) {
- status = get_sysarg_path(tracee, path, SYSARG_1);
- if (status < 0)
- break;
-
- join_paths(oldpath, path, ".");
- dirfd = AT_FDCWD;
- }
- else {
- strcpy(oldpath, ".");
- dirfd = peek_reg(tracee, CURRENT, SYSARG_1);
- }
-
- status = translate_path(tracee, path, dirfd, oldpath, true);
- if (status < 0)
- break;
-
- status = lstat(path, &statl);
- if (status < 0)
- break;
-
- /* Check this directory is accessible. */
- if ((statl.st_mode & S_IXUSR) == 0)
- return -EACCES;
-
- /* Sadly this method doesn't detranslate statefully,
- * this means that there's an ambiguity when several
- * bindings are from the same host path:
- *
- * $ proot -m /tmp:/a -m /tmp:/b fchdir_getcwd /a
- * /b
- *
- * $ proot -m /tmp:/b -m /tmp:/a fchdir_getcwd /a
- * /a
- *
- * A solution would be to follow each file descriptor
- * just like it is done for cwd.
- */
-
- status = detranslate_path(tracee, path, NULL);
- if (status < 0)
- break;
-
- /* Remove the trailing "/" or "/.". */
- chop_finality(path);
-
- tmp = talloc_strdup(tracee->fs, path);
- if (tmp == NULL) {
- status = -ENOMEM;
- break;
- }
- TALLOC_FREE(tracee->fs->cwd);
-
- tracee->fs->cwd = tmp;
- talloc_set_name_const(tracee->fs->cwd, "$cwd");
-
- set_sysnum(tracee, PR_void);
- status = 0;
- break;
- }
-
- case PR_bind:
- case PR_connect: {
- word_t address;
- word_t size;
-
- address = peek_reg(tracee, CURRENT, SYSARG_2);
- size = peek_reg(tracee, CURRENT, SYSARG_3);
-
- status = translate_socketcall_enter(tracee, &address, size);
- if (status <= 0)
- break;
-
- poke_reg(tracee, SYSARG_2, address);
- poke_reg(tracee, SYSARG_3, sizeof(struct sockaddr_un));
-
- status = 0;
- break;
- }
-
-#define SYSARG_ADDR(n) (args_addr + ((n) - 1) * sizeof_word(tracee))
-
-#define PEEK_WORD(addr, forced_errno) \
- peek_word(tracee, addr); \
- if (errno != 0) { \
- status = forced_errno ?: -errno; \
- break; \
- }
-
-#define POKE_WORD(addr, value) \
- poke_word(tracee, addr, value); \
- if (errno != 0) { \
- status = -errno; \
- break; \
- }
-
- case PR_accept:
- case PR_accept4:
- /* Nothing special to do if no sockaddr was specified. */
- if (peek_reg(tracee, ORIGINAL, SYSARG_2) == 0) {
- status = 0;
- break;
- }
- special = true;
- /* Fall through. */
- case PR_getsockname:
- case PR_getpeername:{
- int size;
-
- /* Remember: PEEK_WORD puts -errno in status and breaks if an
- * error occured. */
- size = (int) PEEK_WORD(peek_reg(tracee, ORIGINAL, SYSARG_3), special ? -EINVAL : 0);
-
- /* The "size" argument is both used as an input parameter
- * (max. size) and as an output parameter (actual size). The
- * exit stage needs to know the max. size to not overwrite
- * anything, that's why it is copied in the 6th argument
- * (unused) before the kernel updates it. */
- poke_reg(tracee, SYSARG_6, size);
-
- status = 0;
- break;
- }
-
-#undef SYSARG_ADDR
-#undef PEEK_WORD
-#undef POKE_WORD
-
- case PR_access:
- case PR_chmod:
- case PR_chown:
- case PR_chown32:
- case PR_getxattr:
- case PR_listxattr:
- case PR_mknod:
- case PR_removexattr:
- case PR_setxattr:
- case PR_stat:
- case PR_stat64:
- case PR_statfs:
- case PR_statfs64:
- case PR_truncate:
- case PR_truncate64:
- case PR_utime:
- case PR_utimes:
- status = translate_sysarg(tracee, SYSARG_1, REGULAR);
- break;
-
- case PR_open:
- flags = peek_reg(tracee, CURRENT, SYSARG_2);
-
- if ( ((flags & O_NOFOLLOW) != 0)
- || ((flags & O_EXCL) != 0 && (flags & O_CREAT) != 0))
- status = translate_sysarg(tracee, SYSARG_1, SYMLINK);
- else
- status = translate_sysarg(tracee, SYSARG_1, REGULAR);
- break;
-
- case PR_fchownat:
- case PR_fstatat64:
- case PR_newfstatat:
- case PR_utimensat:
- case PR_name_to_handle_at:
- dirfd = peek_reg(tracee, CURRENT, SYSARG_1);
-
- status = get_sysarg_path(tracee, path, SYSARG_2);
- if (status < 0)
- break;
-
- flags = ( syscall_number == PR_fchownat
- || syscall_number == PR_name_to_handle_at)
- ? peek_reg(tracee, CURRENT, SYSARG_5)
- : peek_reg(tracee, CURRENT, SYSARG_4);
-
- if ((flags & AT_SYMLINK_NOFOLLOW) != 0)
- status = translate_path2(tracee, dirfd, path, SYSARG_2, SYMLINK);
- else
- status = translate_path2(tracee, dirfd, path, SYSARG_2, REGULAR);
- break;
-
- case PR_fchmodat:
- case PR_faccessat:
- case PR_faccessat2:
- case PR_futimesat:
- case PR_mknodat:
- dirfd = peek_reg(tracee, CURRENT, SYSARG_1);
-
- status = get_sysarg_path(tracee, path, SYSARG_2);
- if (status < 0)
- break;
-
- status = translate_path2(tracee, dirfd, path, SYSARG_2, REGULAR);
- break;
-
- case PR_inotify_add_watch:
- flags = peek_reg(tracee, CURRENT, SYSARG_3);
-
- if ((flags & IN_DONT_FOLLOW) != 0)
- status = translate_sysarg(tracee, SYSARG_2, SYMLINK);
- else
- status = translate_sysarg(tracee, SYSARG_2, REGULAR);
- break;
-
- case PR_readlink:
- case PR_lchown:
- case PR_lchown32:
- case PR_lgetxattr:
- case PR_llistxattr:
- case PR_lremovexattr:
- case PR_lsetxattr:
- case PR_lstat:
- case PR_lstat64:
- case PR_unlink:
- case PR_rmdir:
- case PR_mkdir:
- status = translate_sysarg(tracee, SYSARG_1, SYMLINK);
- break;
-
- case PR_linkat:
- olddirfd = peek_reg(tracee, CURRENT, SYSARG_1);
- newdirfd = peek_reg(tracee, CURRENT, SYSARG_3);
- flags = peek_reg(tracee, CURRENT, SYSARG_5);
-
- status = get_sysarg_path(tracee, oldpath, SYSARG_2);
- if (status < 0)
- break;
-
- status = get_sysarg_path(tracee, newpath, SYSARG_4);
- if (status < 0)
- break;
-
- if ((flags & AT_SYMLINK_FOLLOW) != 0)
- status = translate_path2(tracee, olddirfd, oldpath, SYSARG_2, REGULAR);
- else
- status = translate_path2(tracee, olddirfd, oldpath, SYSARG_2, SYMLINK);
- if (status < 0)
- break;
-
- status = translate_path2(tracee, newdirfd, newpath, SYSARG_4, SYMLINK);
- break;
-
- case PR_openat:
- dirfd = peek_reg(tracee, CURRENT, SYSARG_1);
- flags = peek_reg(tracee, CURRENT, SYSARG_3);
-
- status = get_sysarg_path(tracee, path, SYSARG_2);
- if (status < 0)
- break;
-
- if ( ((flags & O_NOFOLLOW) != 0)
- || ((flags & O_EXCL) != 0 && (flags & O_CREAT) != 0))
- status = translate_path2(tracee, dirfd, path, SYSARG_2, SYMLINK);
- else
- status = translate_path2(tracee, dirfd, path, SYSARG_2, REGULAR);
- break;
-
- case PR_readlinkat:
- case PR_unlinkat:
- case PR_mkdirat:
- dirfd = peek_reg(tracee, CURRENT, SYSARG_1);
-
- status = get_sysarg_path(tracee, path, SYSARG_2);
- if (status < 0)
- break;
-
- status = translate_path2(tracee, dirfd, path, SYSARG_2, SYMLINK);
- break;
-
- case PR_link:
- case PR_rename:
- status = translate_sysarg(tracee, SYSARG_1, SYMLINK);
- if (status < 0)
- break;
-
- status = translate_sysarg(tracee, SYSARG_2, SYMLINK);
- break;
-
- case PR_renameat:
- case PR_renameat2:
- olddirfd = peek_reg(tracee, CURRENT, SYSARG_1);
- newdirfd = peek_reg(tracee, CURRENT, SYSARG_3);
-
- status = get_sysarg_path(tracee, oldpath, SYSARG_2);
- if (status < 0)
- break;
-
- status = get_sysarg_path(tracee, newpath, SYSARG_4);
- if (status < 0)
- break;
-
- status = translate_path2(tracee, olddirfd, oldpath, SYSARG_2, SYMLINK);
- if (status < 0)
- break;
-
- status = translate_path2(tracee, newdirfd, newpath, SYSARG_4, SYMLINK);
- break;
-
- case PR_symlink:
- status = translate_sysarg(tracee, SYSARG_2, SYMLINK);
- break;
-
- case PR_symlinkat:
- newdirfd = peek_reg(tracee, CURRENT, SYSARG_2);
-
- status = get_sysarg_path(tracee, newpath, SYSARG_3);
- if (status < 0)
- break;
-
- status = translate_path2(tracee, newdirfd, newpath, SYSARG_3, SYMLINK);
- break;
-
- case PR_prctl:
- /* Prevent tracees from setting dumpable flag.
- * (Otherwise it could break tracee memory access) */
- if (peek_reg(tracee, CURRENT, SYSARG_1) == PR_SET_DUMPABLE) {
- set_sysnum(tracee, PR_void);
- status = 0;
- }
- break;
- }
-
- return status;
-}
-
diff --git a/app/src/main/cpp/proot/src/syscall/exit.c b/app/src/main/cpp/proot/src/syscall/exit.c
deleted file mode 100644
index 36448d2..0000000
--- a/app/src/main/cpp/proot/src/syscall/exit.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* errno(3), E* */
-#include /* struct utsname, */
-#include /* SYS_*, */
-#include /* strlen(3), */
-
-#include "cli/note.h"
-#include "syscall/syscall.h"
-#include "syscall/sysnum.h"
-#include "syscall/socket.h"
-#include "syscall/chain.h"
-#include "syscall/heap.h"
-#include "syscall/rlimit.h"
-#include "execve/execve.h"
-#include "tracee/tracee.h"
-#include "tracee/reg.h"
-#include "tracee/mem.h"
-#include "tracee/abi.h"
-#include "tracee/seccomp.h"
-#include "path/path.h"
-#include "ptrace/ptrace.h"
-#include "ptrace/wait.h"
-#include "arch.h"
-
-/**
- * Translate the output arguments of the current @tracee's syscall in
- * the @tracee->pid process area. This function sets the result of
- * this syscall to @tracee->status if an error occured previously
- * during the translation, that is, if @tracee->status is less than 0.
- */
-void translate_syscall_exit(Tracee *tracee)
-{
- word_t syscall_number;
- word_t syscall_result;
- int status = 0;
-
- /* Set the tracee's errno if an error occured previously during
- * the translation. */
- if (tracee->status < 0) {
- poke_reg(tracee, SYSARG_RESULT, (word_t) tracee->status);
- return;
- }
-
- /* If proot changed syscall to PR_void during enter,
- * keep syscall result set during entry. */
- if (peek_reg(tracee, MODIFIED, SYSARG_NUM) == SYSCALL_AVOIDER &&
- peek_reg(tracee, ORIGINAL, SYSARG_NUM) != SYSCALL_AVOIDER) {
- poke_reg(tracee, SYSARG_RESULT, peek_reg(tracee, MODIFIED, SYSARG_RESULT));
- }
-
- /* Translate output arguments:
- * - break: update the syscall result register with "status"
- * - return: nothing else to do.
- */
- syscall_number = get_sysnum(tracee, ORIGINAL);
- syscall_result = peek_reg(tracee, CURRENT, SYSARG_RESULT);
- switch (syscall_number) {
- case PR_brk:
- translate_brk_exit(tracee);
- return;
-
- case PR_getcwd: {
- char path[PATH_MAX];
- size_t new_size;
- size_t size;
- word_t output;
-
- size = (size_t) peek_reg(tracee, ORIGINAL, SYSARG_2);
- if (size == 0) {
- status = -EINVAL;
- break;
- }
-
- /* Ensure cwd still exists. */
- status = translate_path(tracee, path, AT_FDCWD, ".", false);
- if (status < 0)
- break;
-
- new_size = strlen(tracee->fs->cwd) + 1;
- if (size < new_size) {
- status = -ERANGE;
- break;
- }
-
- /* Overwrite the path. */
- output = peek_reg(tracee, ORIGINAL, SYSARG_1);
- status = write_data(tracee, output, tracee->fs->cwd, new_size);
- if (status < 0)
- break;
-
- /* The value of "status" is used to update the returned value
- * in translate_syscall_exit(). */
- status = new_size;
- break;
- }
-
- case PR_accept:
- case PR_accept4:
- /* Nothing special to do if no sockaddr was specified. */
- if (peek_reg(tracee, ORIGINAL, SYSARG_2) == 0)
- return;
- /* Fall through. */
- case PR_getsockname:
- case PR_getpeername: {
- word_t sock_addr;
- word_t size_addr;
- word_t max_size;
-
- /* Error reported by the kernel. */
- if ((int) syscall_result < 0)
- return;
-
- sock_addr = peek_reg(tracee, ORIGINAL, SYSARG_2);
- size_addr = peek_reg(tracee, MODIFIED, SYSARG_3);
- max_size = peek_reg(tracee, MODIFIED, SYSARG_6);
-
- status = translate_socketcall_exit(tracee, sock_addr, size_addr, max_size);
- if (status < 0)
- break;
-
- /* Don't overwrite the syscall result. */
- return;
- }
-
-#define SYSARG_ADDR(n) (args_addr + ((n) - 1) * sizeof_word(tracee))
-
-#define POKE_WORD(addr, value) \
- poke_word(tracee, addr, value); \
- if (errno != 0) { \
- status = -errno; \
- break; \
- }
-
-#define PEEK_WORD(addr) \
- peek_word(tracee, addr); \
- if (errno != 0) { \
- status = -errno; \
- break; \
- }
-
-#undef SYSARG_ADDR
-#undef PEEK_WORD
-#undef POKE_WORD
-
- case PR_fchdir:
- case PR_chdir:
- /* These syscalls are fully emulated, see enter.c for details
- * (like errors). */
- status = 0;
- break;
-
- case PR_rename:
- case PR_renameat: {
- char old_path[PATH_MAX];
- char new_path[PATH_MAX];
- ssize_t old_length;
- ssize_t new_length;
- Comparison comparison;
- Reg old_reg;
- Reg new_reg;
- char *tmp;
-
- /* Error reported by the kernel. */
- if ((int) syscall_result < 0)
- return;
-
- if (syscall_number == PR_rename) {
- old_reg = SYSARG_1;
- new_reg = SYSARG_2;
- }
- else {
- old_reg = SYSARG_2;
- new_reg = SYSARG_4;
- }
-
- /* Get the old path, then convert it to the same
- * "point-of-view" as tracee->fs->cwd (guest). */
- status = read_path(tracee, old_path, peek_reg(tracee, MODIFIED, old_reg));
- if (status < 0)
- break;
-
- status = detranslate_path(tracee, old_path, NULL);
- if (status < 0)
- break;
- old_length = (status > 0 ? status - 1 : (ssize_t) strlen(old_path));
-
- /* Nothing special to do if the moved path is not the
- * current working directory. */
- comparison = compare_paths(old_path, tracee->fs->cwd);
- if (comparison != PATH1_IS_PREFIX && comparison != PATHS_ARE_EQUAL) {
- status = 0;
- break;
- }
-
- /* Get the new path, then convert it to the same
- * "point-of-view" as tracee->fs->cwd (guest). */
- status = read_path(tracee, new_path, peek_reg(tracee, MODIFIED, new_reg));
- if (status < 0)
- break;
-
- status = detranslate_path(tracee, new_path, NULL);
- if (status < 0)
- break;
- new_length = (status > 0 ? status - 1 : (ssize_t) strlen(new_path));
-
- /* Sanity check. */
- if (strlen(tracee->fs->cwd) >= PATH_MAX) {
- status = 0;
- break;
- }
- strcpy(old_path, tracee->fs->cwd);
-
- /* Update the virtual current working directory. */
- substitute_path_prefix(old_path, old_length, new_path, new_length);
-
- tmp = talloc_strdup(tracee->fs, old_path);
- if (tmp == NULL) {
- status = -ENOMEM;
- break;
- }
-
- TALLOC_FREE(tracee->fs->cwd);
- tracee->fs->cwd = tmp;
-
- status = 0;
- break;
- }
-
- case PR_readlink:
- case PR_readlinkat: {
- char referee[PATH_MAX];
- char referer[PATH_MAX];
- size_t old_size;
- size_t new_size;
- size_t max_size;
- word_t input;
- word_t output;
-
- /* Error reported by the kernel. */
- if ((int) syscall_result < 0)
- return;
-
- old_size = syscall_result;
-
- if (syscall_number == PR_readlink) {
- output = peek_reg(tracee, ORIGINAL, SYSARG_2);
- max_size = peek_reg(tracee, ORIGINAL, SYSARG_3);
- input = peek_reg(tracee, MODIFIED, SYSARG_1);
- }
- else {
- output = peek_reg(tracee, ORIGINAL, SYSARG_3);
- max_size = peek_reg(tracee, ORIGINAL, SYSARG_4);
- input = peek_reg(tracee, MODIFIED, SYSARG_2);
- }
-
- if (max_size > PATH_MAX)
- max_size = PATH_MAX;
-
- if (max_size == 0) {
- status = -EINVAL;
- break;
- }
-
- /* The kernel does NOT put the NULL terminating byte for
- * readlink(2). */
- status = read_data(tracee, referee, output, old_size);
- if (status < 0)
- break;
- referee[old_size] = '\0';
-
- /* Not optimal but safe (path is fully translated). */
- status = read_path(tracee, referer, input);
- if (status < 0)
- break;
-
- if (status >= PATH_MAX) {
- status = -ENAMETOOLONG;
- break;
- }
-
- if (status == 1) {
- /* Empty path was passed (""),
- * indicating that path is pointed to by fd passed in first argument */
- word_t dirfd = peek_reg(tracee, ORIGINAL, SYSARG_1);
- if (syscall_number == PR_readlink || dirfd < 0) {
- status = -EBADF;
- break;
- }
- status = readlink_proc_pid_fd(tracee->pid, dirfd, referer);
- if (status < 0)
- break;
- }
-
- status = detranslate_path(tracee, referee, referer);
- if (status < 0)
- break;
-
- /* The original path doesn't require any transformation, i.e
- * it is a symetric binding. */
- if (status == 0)
- return;
-
- /* Overwrite the path. Note: the output buffer might be
- * initialized with zeros but it was updated with the kernel
- * result, and then with the detranslated result. This later
- * might be shorter than the former, so it's safier to add a
- * NULL terminating byte when possible. This problem was
- * exposed by IDA Demo 6.3. */
- if ((size_t) status < max_size) {
- new_size = status - 1;
- status = write_data(tracee, output, referee, status);
- }
- else {
- new_size = max_size;
- status = write_data(tracee, output, referee, max_size);
- }
- if (status < 0)
- break;
-
- /* The value of "status" is used to update the returned value
- * in translate_syscall_exit(). */
- status = new_size;
- break;
- }
-
- case PR_execve:
- translate_execve_exit(tracee);
- return;
-
- case PR_ptrace:
- status = translate_ptrace_exit(tracee);
- break;
-
- case PR_wait4:
- case PR_waitpid:
- if (tracee->as_ptracer.waits_in != WAITS_IN_PROOT)
- return;
-
- status = translate_wait_exit(tracee);
- break;
-
- case PR_setrlimit:
- case PR_prlimit64:
- /* Error reported by the kernel. */
- if ((int) syscall_result < 0)
- return;
-
- status = translate_setrlimit_exit(tracee, syscall_number == PR_prlimit64);
- if (status < 0)
- break;
-
- /* Don't overwrite the syscall result. */
- return;
-
- case PR_utime:
- if ((int) syscall_result == -ENOSYS)
- {
- fix_and_restart_enosys_syscall(tracee);
- }
- return;
-
- case PR_statfs:
- case PR_statfs64: {
- /* Possibly fake that /dev/shm is living on tmpfs */
- char devshm_path[PATH_MAX];
- char statfs_path[PATH_MAX];
-
- /* Only perform changes to result of successful syscall
- * (that is, path was valid, it doesn't have to point
- * to mount root) */
- if (syscall_result != 0) {
- return;
- }
-
- if (translate_path(tracee, devshm_path, AT_FDCWD, "/dev/shm", true) < 0) {
- VERBOSE(tracee, 5, "/dev/shm is not mounted, not changing statfs() result");
- return;
- }
-
- if (read_path(tracee, statfs_path, peek_reg(tracee, MODIFIED, SYSARG_1)) < 0) {
- VERBOSE(tracee, 5, "statfs() exit couldn't read statfs_path");
- return;
- }
-
- Comparison comparison = compare_paths(devshm_path, statfs_path);
- if (comparison == PATHS_ARE_EQUAL || comparison == PATH1_IS_PREFIX) {
- VERBOSE(tracee, 5, "Updating statfs() result to fake tmpfs /dev/shm");
- /* Write TMPFS_MAGIC at beginning of statfs structure.
- *
- * (It's at beginning of structure regardless of syscall variant
- * (statfs vs statfs64) and architecture bitness
- * (on 64 bit this field is 8 bytes long, but as long as it's
- * little endian, it will need only first 4 bytes to be modified,
- * as next 4 bytes will always be 0))
- * */
- word_t stat_addr = peek_reg(tracee, ORIGINAL, syscall_number == PR_statfs64 ? SYSARG_3 : SYSARG_2);
- int write_status = write_data(tracee, stat_addr, "\x94\x19\x02\x01", 4);
- if (write_status < 0) {
- VERBOSE(tracee, 5, "Updating statfs() result failed");
- }
- }
- else {
- VERBOSE(tracee, 5, "statfs() not for /dev/shm, not changing result");
- }
-
- return;
- }
-
- default:
- return;
- }
-
- poke_reg(tracee, SYSARG_RESULT, (word_t) status);
-}
diff --git a/app/src/main/cpp/proot/src/syscall/heap.c b/app/src/main/cpp/proot/src/syscall/heap.c
deleted file mode 100644
index 29bd9d1..0000000
--- a/app/src/main/cpp/proot/src/syscall/heap.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* PROT_*, MAP_*, */
-#include /* assert(3), */
-#include /* strerror(3), */
-#include /* sysconf(3), */
-#include /* MIN(), MAX(), */
-
-#include "tracee/tracee.h"
-#include "tracee/reg.h"
-#include "tracee/mem.h"
-#include "syscall/sysnum.h"
-#include "execve/execve.h"
-#include "cli/note.h"
-
-#include "compat.h"
-
-/* The size of the heap can be zero, unlike the size of a memory
- * mapping. As a consequence, the first page of the "heap" memory
- * mapping is discarded in order to emulate an empty heap. */
-static word_t heap_offset = 0;
-
-/**
- * Put @tracee's heap to a reliable location. By default the Linux
- * kernel puts it near loader's BSS, but this default location is not
- * reliable since the kernel might put another memory mapping right
- * after it (ie. continuously). In this case, @tracee's heap can't
- * grow anymore and some programs like Bash will abort. This issue
- * can be reproduced when using a Ubuntu 12.04 x86_64 rootfs on RHEL 5
- * x86_64.
- */
-void translate_brk_enter(Tracee *tracee)
-{
- word_t new_brk_address;
- size_t old_heap_size;
- size_t new_heap_size;
-
- if (tracee->heap->disabled)
- return;
-
- if (heap_offset == 0) {
- heap_offset = sysconf(_SC_PAGE_SIZE);
- if ((int) heap_offset <= 0)
- heap_offset = 0x1000;
- }
-
- new_brk_address = peek_reg(tracee, CURRENT, SYSARG_1);
-
- /* Allocate a new mapping for the emulated heap. */
- if (tracee->heap->base == 0) {
- Sysnum sysnum;
- Mapping *mappings;
- Mapping *bss;
-
- /* From PRoot's point-of-view this is the first time this
- * tracee calls brk(2), although an address was specified.
- * This is not supposed to happen the first time. It is
- * likely because this tracee is the very first child of PRoot
- * but the first execve(2) didn't happen yet (so this is not
- * its first call to brk(2)). For instance, the installation
- * of seccomp filters is made after this very first process is
- * traced, and might call malloc(3) before the first
- * execve(2). */
- if (new_brk_address != 0) {
- if (tracee->verbose > 0)
- note(tracee, WARNING, INTERNAL,
- "process %d is doing suspicious brk()", tracee->pid);
- return;
- }
-
- /* Put the heap as close to the BSS as possible since
- * some programs -- like dump-emacs -- assume the gap
- * between the end of the BSS and the start of the
- * heap is relatively small (ie. < 1MB) even if ALSR
- * is enabled. Note that bss->addr + bss->length is
- * naturally aligned to a page boundary according to
- * add_mapping() in execve/enter.c, ie. no need to
- * align new_brk_address again. Now, the gap between
- * the BSS and the heap is only "heap_offset" bytes
- * long. To emulate ADDR_NO_RANDOMIZE personality,
- * this gap should be removed (not yet supported). */
- mappings = tracee->load_info->mappings;
- bss = &mappings[talloc_array_length(mappings) - 1];
- new_brk_address = bss->addr + bss->length;
-
-#ifdef ARCH_ARM64
- sysnum = tracee->is_aarch32 ? PR_mmap2 : PR_mmap;
-#else
- sysnum = PR_mmap2;
-#endif
-
- set_sysnum(tracee, sysnum);
- poke_reg(tracee, SYSARG_1 /* address */, new_brk_address);
- poke_reg(tracee, SYSARG_2 /* length */, heap_offset);
- poke_reg(tracee, SYSARG_3 /* prot */, PROT_READ | PROT_WRITE);
- poke_reg(tracee, SYSARG_4 /* flags */, MAP_PRIVATE | MAP_ANONYMOUS);
- poke_reg(tracee, SYSARG_5 /* fd */, -1);
- poke_reg(tracee, SYSARG_6 /* offset */, 0);
-
- return;
- }
-
- /* The size of the heap can't be negative. */
- if (new_brk_address < tracee->heap->base) {
- set_sysnum(tracee, PR_void);
- return;
- }
-
- new_heap_size = new_brk_address - tracee->heap->base;
- old_heap_size = tracee->heap->size;
-
- /* Actually resizing. */
- set_sysnum(tracee, PR_mremap);
- poke_reg(tracee, SYSARG_1 /* old_address */, tracee->heap->base - heap_offset);
- poke_reg(tracee, SYSARG_2 /* old_size */, old_heap_size + heap_offset);
- poke_reg(tracee, SYSARG_3 /* new_size */, new_heap_size + heap_offset);
- poke_reg(tracee, SYSARG_4 /* flags */, 0);
- poke_reg(tracee, SYSARG_5 /* new_address */, 0);
-
- return;
-}
-
-/**
- * c.f. function above.
- */
-void translate_brk_exit(Tracee *tracee)
-{
- word_t result;
- word_t sysnum;
- int tracee_errno;
-
- if (tracee->heap->disabled)
- return;
-
- assert(heap_offset > 0);
-
- sysnum = get_sysnum(tracee, MODIFIED);
- result = peek_reg(tracee, CURRENT, SYSARG_RESULT);
- tracee_errno = (int) result;
-
- switch (sysnum) {
- case PR_void:
- poke_reg(tracee, SYSARG_RESULT, tracee->heap->base + tracee->heap->size);
- break;
-
- case PR_mmap:
- case PR_mmap2:
- /* On error, mmap(2) returns -errno (the last 4k is
- * reserved for this), whereas brk(2) returns the
- * previous value. */
- if (tracee_errno < 0 && tracee_errno > -4096) {
- poke_reg(tracee, SYSARG_RESULT, 0);
- break;
- }
-
- tracee->heap->base = result + heap_offset;
- tracee->heap->size = 0;
-
- poke_reg(tracee, SYSARG_RESULT, tracee->heap->base + tracee->heap->size);
- break;
-
- case PR_mremap:
- /* On error, mremap(2) returns -errno (the last 4k is
- * reserved this), whereas brk(2) returns the previous
- * value. */
- if ( (tracee_errno < 0 && tracee_errno > -4096)
- || (tracee->heap->base != result + heap_offset)) {
- poke_reg(tracee, SYSARG_RESULT, tracee->heap->base + tracee->heap->size);
- break;
- }
-
- tracee->heap->size = peek_reg(tracee, MODIFIED, SYSARG_3) - heap_offset;
-
- poke_reg(tracee, SYSARG_RESULT, tracee->heap->base + tracee->heap->size);
- break;
-
- case PR_brk:
- /* Is it confirmed that this suspicious call to brk(2)
- * is actually legit? */
- if (result == peek_reg(tracee, ORIGINAL, SYSARG_1))
- tracee->heap->disabled = true;
- break;
-
- default:
- assert(0);
- }
-}
diff --git a/app/src/main/cpp/proot/src/syscall/heap.h b/app/src/main/cpp/proot/src/syscall/heap.h
deleted file mode 100644
index 8097834..0000000
--- a/app/src/main/cpp/proot/src/syscall/heap.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef HEAP_H
-#define HEAP_H
-
-#include "tracee/tracee.h"
-
-extern void translate_brk_enter(Tracee *tracee);
-extern void translate_brk_exit(Tracee *tracee);
-
-#endif /* HEAP_H */
diff --git a/app/src/main/cpp/proot/src/syscall/rlimit.c b/app/src/main/cpp/proot/src/syscall/rlimit.c
deleted file mode 100644
index d167843..0000000
--- a/app/src/main/cpp/proot/src/syscall/rlimit.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* bool, */
-#include /* prlimit(2), */
-#include /* prlimit(2), */
-
-#include "tracee/tracee.h"
-#include "tracee/reg.h"
-#include "tracee/mem.h"
-#include "tracee/abi.h"
-#include "cli/note.h"
-
-/**
- * Set PRoot's stack soft limit to @tracee's one if this latter is
- * greater. This allows to workaround a Linux kernel bug that
- * prevents a tracer to access a tracee's stack beyond its last mapped
- * page, as it might by the case under PRoot. This function returns
- * -errno if an error occurred, otherwise 0.
- *
- * Details: when a tracer tries to access a tracee's stack beyond its
- * last mapped page, the Linux kernel should be able to increase
- * tracee's stack up to its soft limit. Unfortunately the Linux
- * kernel checks the limit of the tracer instead the limit of the
- * tracee. This bug was exposed using UMEQ under PRoot.
- *
- * Ref.: https://bugzilla.kernel.org/show_bug.cgi?id=91791
- *
- * Three strategies were possible:
- *
- * - set PRoot's stack soft limit to the hard limit; this might make
- * the system collapse if PRoot starts to recurses indefinitely.
- *
- * - as it's done here; this appears to be a good compromise between
- * the strategy above and the one below.
- *
- * - as it's done here + reduce PRoot's stack soft limit as soon as
- * it's possible; this would be overly complicated.
- */
-int translate_setrlimit_exit(const Tracee *tracee, bool is_prlimit)
-{
- struct rlimit64 proot_stack;
- word_t resource;
- word_t address;
- word_t tracee_stack_limit;
- Reg sysarg;
- int status;
-
- sysarg = (is_prlimit ? SYSARG_2 : SYSARG_1);
-
- resource = peek_reg(tracee, ORIGINAL, sysarg);
- address = peek_reg(tracee, ORIGINAL, sysarg + 1);
-
- /* Not the resource we're looking for? */
- if (resource != RLIMIT_STACK)
- return 0;
-
- /* Retrieve new tracee's stack limit. */
- if (is_prlimit) {
- /* Not the prlimit usage we're looking for? */
- if (address == 0)
- return 0;
-
- tracee_stack_limit = peek_uint64(tracee, address);
- }
- else {
- tracee_stack_limit = peek_word(tracee, address);
-
- /* Convert this special value from 32-bit to 64-bit,
- * if needed. */
- if (is_32on64_mode(tracee) && tracee_stack_limit == (uint32_t) -1)
- tracee_stack_limit = RLIM_INFINITY;
- }
- if (errno != 0)
- return -errno;
-
- /* Get current PRoot's stack limit. */
- status = prlimit64(0, RLIMIT_STACK, NULL, &proot_stack);
- if (status < 0) {
- VERBOSE(tracee, 1, "can't get stack limit.");
- return 0; /* Not fatal. */
- }
-
- /* No need to increase current PRoot's stack limit? */
- if (proot_stack.rlim_cur >= tracee_stack_limit)
- return 0;
-
- proot_stack.rlim_cur = tracee_stack_limit;
-
- /* Increase current PRoot's stack limit. */
- status = prlimit64(0, RLIMIT_STACK, &proot_stack, NULL);
- if (status < 0)
- VERBOSE(tracee, 1, "can't set stack limit.");
- return 0; /* Not fatal. */
-
- VERBOSE(tracee, 1, "stack soft limit increased to %llu bytes", proot_stack.rlim_cur);
- return 0;
-}
diff --git a/app/src/main/cpp/proot/src/syscall/rlimit.h b/app/src/main/cpp/proot/src/syscall/rlimit.h
deleted file mode 100644
index 7792023..0000000
--- a/app/src/main/cpp/proot/src/syscall/rlimit.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef RLIMIT_H
-#define RLIMIT_H
-
-#include
-#include "tracee/tracee.h"
-
-extern int translate_setrlimit_exit(const Tracee *tracee, bool is_prlimit);
-
-#endif /* RLIMIT_H */
diff --git a/app/src/main/cpp/proot/src/syscall/seccomp.c b/app/src/main/cpp/proot/src/syscall/seccomp.c
deleted file mode 100644
index ecfdd94..0000000
--- a/app/src/main/cpp/proot/src/syscall/seccomp.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include "arch.h"
-
-#include /* prctl(2), PR_* */
-#include /* struct sock_*, */
-#include /* SECCOMP_MODE_FILTER, */
-#include /* struct sock_*, */
-#include /* AUDIT_, */
-#include /* LIST_FOREACH, */
-#include /* size_t, */
-#include /* talloc_*, */
-#include /* E*, */
-#include /* memcpy(3), */
-#include /* offsetof(3), */
-#include /* uint*_t, UINT*_MAX, */
-#include /* assert(3), */
-
-#include "syscall/seccomp.h"
-#include "tracee/tracee.h"
-#include "syscall/syscall.h"
-#include "syscall/sysnum.h"
-#include "cli/note.h"
-
-#include "compat.h"
-#include "attribute.h"
-
-#define DEBUG_FILTER(...) /* fprintf(stderr, __VA_ARGS__) */
-
-/**
- * Allocate an empty @program->filter. This function returns -errno
- * if an error occurred, otherwise 0.
- */
-static int new_program_filter(struct sock_fprog *program)
-{
- program->filter = talloc_array(NULL, struct sock_filter, 0);
- if (program->filter == NULL)
- return -ENOMEM;
-
- program->len = 0;
- return 0;
-}
-
-/**
- * Append to @program->filter the given @statements (@nb_statements
- * items). This function returns -errno if an error occurred,
- * otherwise 0.
- */
-static int add_statements(struct sock_fprog *program, size_t nb_statements,
- struct sock_filter *statements)
-{
- size_t length;
- void *tmp;
- size_t i;
-
- length = talloc_array_length(program->filter);
- tmp = talloc_realloc(NULL, program->filter, struct sock_filter, length + nb_statements);
- if (tmp == NULL)
- return -ENOMEM;
- program->filter = tmp;
-
- for (i = 0; i < nb_statements; i++, length++)
- memcpy(&program->filter[length], &statements[i], sizeof(struct sock_filter));
-
- return 0;
-}
-
-/**
- * Append to @program->filter the statements required to notify PRoot
- * about the given @syscall made by a tracee, with the given @flag.
- * This function returns -errno if an error occurred, otherwise 0.
- */
-static int add_trace_syscall(struct sock_fprog *program, word_t syscall, int flag)
-{
- int status;
-
- /* Sanity check. */
- if (syscall > UINT32_MAX)
- return -ERANGE;
-
- #define LENGTH_TRACE_SYSCALL 2
- struct sock_filter statements[LENGTH_TRACE_SYSCALL] = {
- /* Compare the accumulator with the expected syscall:
- * skip the next statement if not equal. */
- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, syscall, 0, 1),
-
- /* Notify the tracer. */
- BPF_STMT(BPF_RET + BPF_K, SECCOMP_RET_TRACE + flag)
- };
-
- DEBUG_FILTER("FILTER: trace if syscall == %ld\n", syscall);
-
- status = add_statements(program, LENGTH_TRACE_SYSCALL, statements);
- if (status < 0)
- return status;
-
- return 0;
-}
-
-/**
- * Append to @program->filter the statements that allow anything (if
- * unfiltered). Note that @nb_traced_syscalls is used to make a
- * sanity check. This function returns -errno if an error occurred,
- * otherwise 0.
- */
-static int end_arch_section(struct sock_fprog *program, size_t nb_traced_syscalls)
-{
- int status;
-
- #define LENGTH_END_SECTION 1
- struct sock_filter statements[LENGTH_END_SECTION] = {
- BPF_STMT(BPF_RET + BPF_K, SECCOMP_RET_ALLOW)
- };
-
- DEBUG_FILTER("FILTER: allow\n");
-
- status = add_statements(program, LENGTH_END_SECTION, statements);
- if (status < 0)
- return status;
-
- /* Sanity check, see start_arch_section(). */
- if ( talloc_array_length(program->filter) - program->len
- != LENGTH_END_SECTION + nb_traced_syscalls * LENGTH_TRACE_SYSCALL)
- return -ERANGE;
-
- return 0;
-}
-
-/**
- * Append to @program->filter the statements that check the current
- * @architecture. Note that @nb_traced_syscalls is used to make a
- * sanity check. This function returns -errno if an error occurred,
- * otherwise 0.
- */
-static int start_arch_section(struct sock_fprog *program, uint32_t arch, size_t nb_traced_syscalls)
-{
- const size_t arch_offset = offsetof(struct seccomp_data, arch);
- const size_t syscall_offset = offsetof(struct seccomp_data, nr);
- const size_t section_length = LENGTH_END_SECTION +
- nb_traced_syscalls * LENGTH_TRACE_SYSCALL;
- int status;
-
- /* Sanity checks. */
- if ( arch_offset > UINT32_MAX
- || syscall_offset > UINT32_MAX
- || section_length > UINT32_MAX - 1)
- return -ERANGE;
-
- #define LENGTH_START_SECTION 4
- struct sock_filter statements[LENGTH_START_SECTION] = {
- /* Load the current architecture into the
- * accumulator. */
- BPF_STMT(BPF_LD + BPF_W + BPF_ABS, arch_offset),
-
- /* Compare the accumulator with the expected
- * architecture: skip the following statement if
- * equal. */
- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, arch, 1, 0),
-
- /* This is not the expected architecture, so jump
- * unconditionally to the end of this section. */
- BPF_STMT(BPF_JMP + BPF_JA + BPF_K, section_length + 1),
-
- /* This is the expected architecture, so load the
- * current syscall into the accumulator. */
- BPF_STMT(BPF_LD + BPF_W + BPF_ABS, syscall_offset)
- };
-
- DEBUG_FILTER("FILTER: if arch == %ld, up to %zdth statement\n",
- arch, nb_traced_syscalls);
-
- status = add_statements(program, LENGTH_START_SECTION, statements);
- if (status < 0)
- return status;
-
- /* See the sanity check in end_arch_section(). */
- program->len = talloc_array_length(program->filter);
-
- return 0;
-}
-
-/**
- * Append to @program->filter the statements that forbid anything (if
- * unfiltered) and update @program->len. This function returns -errno
- * if an error occurred, otherwise 0.
- */
-static int finalize_program_filter(struct sock_fprog *program)
-{
- int status;
-
- #define LENGTH_FINALIZE 1
- struct sock_filter statements[LENGTH_FINALIZE] = {
- BPF_STMT(BPF_RET + BPF_K, SECCOMP_RET_KILL)
- };
-
- DEBUG_FILTER("FILTER: kill\n");
-
- status = add_statements(program, LENGTH_FINALIZE, statements);
- if (status < 0)
- return status;
-
- program->len = talloc_array_length(program->filter);
-
- return 0;
-}
-
-/**
- * Free @program->filter and set @program->len to 0.
- */
-static void free_program_filter(struct sock_fprog *program)
-{
- TALLOC_FREE(program->filter);
- program->len = 0;
-}
-
-/**
- * Convert the given @sysnums into BPF filters according to the
- * following pseudo-code, then enabled them for the given @tracee and
- * all of its future children:
- *
- * for each handled architectures
- * for each filtered syscall
- * trace
- * allow
- * kill
- *
- * This function returns -errno if an error occurred, otherwise 0.
- */
-static int set_seccomp_filters(const FilteredSysnum *sysnums)
-{
- SeccompArch seccomp_archs[] = SECCOMP_ARCHS;
- size_t nb_archs = sizeof(seccomp_archs) / sizeof(SeccompArch);
-
- struct sock_fprog program = { .len = 0, .filter = NULL };
- size_t nb_traced_syscalls;
- size_t i, j, k;
- int status;
-
- status = new_program_filter(&program);
- if (status < 0)
- goto end;
-
- /* For each handled architectures */
- for (i = 0; i < nb_archs; i++) {
- word_t syscall;
-
- nb_traced_syscalls = 0;
-
- /* Pre-compute the number of traced syscalls for this architecture. */
- for (j = 0; j < seccomp_archs[i].nb_abis; j++) {
- for (k = 0; sysnums[k].value != PR_void; k++) {
- syscall = detranslate_sysnum(seccomp_archs[i].abis[j], sysnums[k].value);
- if (syscall != SYSCALL_AVOIDER)
- nb_traced_syscalls++;
- }
- }
-
- /* Filter: if handled architecture */
- status = start_arch_section(&program, seccomp_archs[i].value, nb_traced_syscalls);
- if (status < 0)
- goto end;
-
- for (j = 0; j < seccomp_archs[i].nb_abis; j++) {
- for (k = 0; sysnums[k].value != PR_void; k++) {
- /* Get the architecture specific syscall number. */
- syscall = detranslate_sysnum(seccomp_archs[i].abis[j], sysnums[k].value);
- if (syscall == SYSCALL_AVOIDER)
- continue;
-
- /* Filter: trace if handled syscall */
- status = add_trace_syscall(&program, syscall, sysnums[k].flags);
- if (status < 0)
- goto end;
- }
- }
-
- /* Filter: allow untraced syscalls for this architecture */
- status = end_arch_section(&program, nb_traced_syscalls);
- if (status < 0)
- goto end;
- }
-
- status = finalize_program_filter(&program);
- if (status < 0)
- goto end;
-
- status = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
- if (status < 0)
- goto end;
-
- /* To output this BPF program for debug purpose:
- *
- * write(2, program.filter, program.len * sizeof(struct sock_filter));
- */
-
- status = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &program);
- if (status < 0)
- goto end;
-
- status = 0;
-end:
- free_program_filter(&program);
- return status;
-}
-
-/* List of sysnums handled by PRoot. */
-static FilteredSysnum proot_sysnums[] = {
- { PR_accept, FILTER_SYSEXIT },
- { PR_accept4, FILTER_SYSEXIT },
- { PR_access, 0 },
- { PR_bind, 0 },
- { PR_brk, FILTER_SYSEXIT },
- { PR_chdir, FILTER_SYSEXIT },
- { PR_chmod, 0 },
- { PR_chown, 0 },
- { PR_chown32, 0 },
- { PR_connect, 0 },
- { PR_execve, FILTER_SYSEXIT },
- { PR_faccessat, 0 },
- { PR_faccessat2, 0 },
- { PR_fchdir, FILTER_SYSEXIT },
- { PR_fchmodat, 0 },
- { PR_fchownat, 0 },
- { PR_fstatat64, 0 },
- { PR_futimesat, 0 },
- { PR_getcwd, FILTER_SYSEXIT },
- { PR_getpeername, FILTER_SYSEXIT },
- { PR_getsockname, FILTER_SYSEXIT },
- { PR_getxattr, 0 },
- { PR_inotify_add_watch, 0 },
- { PR_lchown, 0 },
- { PR_lchown32, 0 },
- { PR_lgetxattr, 0 },
- { PR_link, 0 },
- { PR_linkat, 0 },
- { PR_listxattr, 0 },
- { PR_llistxattr, 0 },
- { PR_lremovexattr, 0 },
- { PR_lsetxattr, 0 },
- { PR_lstat, 0 },
- { PR_lstat64, 0 },
- { PR_mkdir, 0 },
- { PR_mkdirat, 0 },
- { PR_mknod, 0 },
- { PR_mknodat, 0 },
- { PR_name_to_handle_at, 0 },
- { PR_newfstatat, 0 },
- { PR_open, 0 },
- { PR_openat, 0 },
- { PR_prctl, 0 },
- { PR_prlimit64, FILTER_SYSEXIT },
- { PR_ptrace, FILTER_SYSEXIT },
- { PR_readlink, FILTER_SYSEXIT },
- { PR_readlinkat, FILTER_SYSEXIT },
- { PR_removexattr, 0 },
- { PR_rename, FILTER_SYSEXIT },
- { PR_renameat, FILTER_SYSEXIT },
- { PR_renameat2, FILTER_SYSEXIT },
- { PR_rmdir, 0 },
- { PR_setrlimit, FILTER_SYSEXIT },
- { PR_setxattr, 0 },
- { PR_stat, 0 },
- { PR_stat64, 0 },
- { PR_statfs, FILTER_SYSEXIT },
- { PR_statfs64, FILTER_SYSEXIT },
- { PR_symlink, 0 },
- { PR_symlinkat, 0 },
- { PR_truncate, 0 },
- { PR_truncate64, 0 },
- { PR_uname, FILTER_SYSEXIT },
- { PR_unlink, 0 },
- { PR_unlinkat, 0 },
- { PR_utime, FILTER_SYSEXIT },
- { PR_utimensat, 0 },
- { PR_utimes, 0 },
- { PR_wait4, FILTER_SYSEXIT },
- { PR_waitpid, FILTER_SYSEXIT },
- FILTERED_SYSNUM_END,
-};
-
-/**
- * Add the @new_sysnums to the list of filtered @sysnums, using the
- * given Talloc @context. This function returns -errno if an error
- * occurred, otherwise 0.
- */
-static int merge_filtered_sysnums(TALLOC_CTX *context, FilteredSysnum **sysnums,
- const FilteredSysnum *new_sysnums)
-{
- size_t i, j;
-
- assert(sysnums != NULL);
-
- if (*sysnums == NULL) {
- /* Start with no sysnums but the terminator. */
- *sysnums = talloc_array(context, FilteredSysnum, 1);
- if (*sysnums == NULL)
- return -ENOMEM;
-
- (*sysnums)[0].value = PR_void;
- }
-
- for (i = 0; new_sysnums[i].value != PR_void; i++) {
- /* Search for the given sysnum. */
- for (j = 0; (*sysnums)[j].value != PR_void
- && (*sysnums)[j].value != new_sysnums[i].value; j++)
- ;
-
- if ((*sysnums)[j].value == PR_void) {
- /* No such sysnum, allocate a new entry. */
- (*sysnums) = talloc_realloc(context, (*sysnums), FilteredSysnum, j + 2);
- if ((*sysnums) == NULL)
- return -ENOMEM;
-
- (*sysnums)[j] = new_sysnums[i];
-
- /* The last item is the terminator. */
- (*sysnums)[j + 1].value = PR_void;
- }
- else
- /* The sysnum is already filtered, merge the
- * flags. */
- (*sysnums)[j].flags |= new_sysnums[i].flags;
- }
-
- return 0;
-}
-
-/**
- * Tell the kernel to trace only syscalls handled by PRoot.
- * This filter will be enabled for the given @tracee and
- * all of its future children. This function returns -errno if an
- * error occurred, otherwise 0.
- */
-int enable_syscall_filtering(const Tracee *tracee)
-{
- FilteredSysnum *filtered_sysnums = NULL;
- int status;
-
- assert(tracee != NULL && tracee->ctx != NULL);
-
- /* Add the sysnums required by PRoot to the list of filtered sysnums. */
- status = merge_filtered_sysnums(tracee->ctx, &filtered_sysnums, proot_sysnums);
- if (status < 0)
- return status;
-
- status = set_seccomp_filters(filtered_sysnums);
- if (status < 0)
- return status;
-
- return 0;
-}
diff --git a/app/src/main/cpp/proot/src/syscall/seccomp.h b/app/src/main/cpp/proot/src/syscall/seccomp.h
deleted file mode 100644
index 3d5ba40..0000000
--- a/app/src/main/cpp/proot/src/syscall/seccomp.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef SECCOMP_H
-#define SECCOMP_H
-
-#include "syscall/sysnum.h"
-#include "tracee/tracee.h"
-#include "attribute.h"
-#include "arch.h"
-
-typedef struct {
- Sysnum value;
- word_t flags;
-} FilteredSysnum;
-
-typedef struct {
- unsigned int value;
- size_t nb_abis;
- Abi abis[NB_MAX_ABIS];
-} SeccompArch;
-
-#define FILTERED_SYSNUM_END { PR_void, 0 }
-
-#define FILTER_SYSEXIT 0x1
-
-extern int enable_syscall_filtering(const Tracee *tracee);
-
-#endif /* SECCOMP_H */
diff --git a/app/src/main/cpp/proot/src/syscall/socket.c b/app/src/main/cpp/proot/src/syscall/socket.c
deleted file mode 100644
index 6aa291a..0000000
--- a/app/src/main/cpp/proot/src/syscall/socket.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* offsetof(3), */
-#include /* bzero(3), */
-#include /* strncpy(3), strlen(3), */
-#include /* assert(3), */
-#include /* E*, */
-#include /* struct sockaddr_un, AF_UNIX, */
-#include /* struct sockaddr_un, */
-#include /* MIN(), MAX(), */
-
-#include "syscall/socket.h"
-#include "tracee/tracee.h"
-#include "tracee/mem.h"
-#include "path/binding.h"
-#include "path/temp.h"
-#include "path/path.h"
-#include "arch.h"
-
-#include "compat.h"
-
-/* The sockaddr_un structure has exactly the same layout on all
- * architectures. */
-static const off_t offsetof_path = offsetof(struct sockaddr_un, sun_path);
-extern struct sockaddr_un sockaddr_un__;
-static const size_t sizeof_path = sizeof(sockaddr_un__.sun_path);
-
-/**
- * Copy in @sockaddr the struct sockaddr_un stored in the @tracee
- * memory at the given @address. Also, its pathname is copied to the
- * null-terminated @path. Only @size bytes are read from the @tracee
- * memory (should be <= @max_size <= sizeof(struct sockaddr_un)).
- * This function returns -errno if an error occurred, 0 if the
- * structure was not found (not a sockaddr_un or @size > @max_size),
- * otherwise 1.
- */
-static int read_sockaddr_un(Tracee *tracee, struct sockaddr_un *sockaddr, word_t max_size,
- char path[PATH_MAX], word_t address, int size)
-{
- int status;
-
- assert(max_size <= sizeof(struct sockaddr_un));
-
- /* Nothing to do if the sockaddr has an unexpected size. */
- if (size <= offsetof_path || (word_t) size > max_size)
- return 0;
-
- bzero(sockaddr, sizeof(struct sockaddr_un));
- status = read_data(tracee, sockaddr, address, size);
- if (status < 0)
- return status;
-
- /* Nothing to do if it's not a named Unix domain socket. */
- if ((sockaddr->sun_family != AF_UNIX)
- || sockaddr->sun_path[0] == '\0')
- return 0;
-
- /* Be careful: sun_path doesn't have to be null-terminated. */
- assert(sizeof_path < PATH_MAX - 1);
- strncpy(path, sockaddr->sun_path, sizeof_path);
- path[sizeof_path] = '\0';
-
- return 1;
-}
-
-/**
- * Translate the pathname of the struct sockaddr_un currently stored
- * in the @tracee memory at the given @address. See the documentation
- * of read_sockaddr_un() for the meaning of the @size parameter.
- * Also, the new address of the translated sockaddr_un is put in the
- * @address parameter. This function returns -errno if an error
- * occurred, otherwise 0.
- */
-int translate_socketcall_enter(Tracee *tracee, word_t *address, int size)
-{
- struct sockaddr_un sockaddr;
- char user_path[PATH_MAX];
- char host_path[PATH_MAX];
- int status;
-
- if (*address == 0)
- return 0;
-
- status = read_sockaddr_un(tracee, &sockaddr, sizeof(sockaddr), user_path, *address, size);
- if (status <= 0)
- return status;
-
- status = translate_path(tracee, host_path, AT_FDCWD, user_path, true);
- if (status < 0)
- return status;
-
- /* Be careful: sun_path doesn't have to be null-terminated. */
- if (strlen(host_path) > sizeof_path) {
- char *shorter_host_path;
- Binding *binding;
-
- /* The translated path is too long to fit the sun_path
- * array, so let's bind it to a shorter path. */
- shorter_host_path = create_temp_name(tracee->ctx, "proot");
- if (shorter_host_path == NULL || strlen(shorter_host_path) > sizeof_path)
- return -EINVAL;
-
- (void) mkstemp(shorter_host_path);
-
- if (strlen(shorter_host_path) > sizeof_path)
- return -EINVAL;
-
- /* Ensure the guest path of this new binding is
- * canonicalized, as it is always assumed. */
- strcpy(user_path, host_path);
- status = detranslate_path(tracee, user_path, NULL);
- if (status < 0)
- return -EINVAL;
-
- /* Bing the guest path to a shorter host path. */
- binding = insort_binding3(tracee, tracee->ctx, shorter_host_path, user_path);
- if (binding == NULL)
- return -EINVAL;
-
- /* This temporary file (shorter_host_path) will be removed once the
- * binding is destroyed. */
- talloc_reparent(tracee->ctx, binding, shorter_host_path);
-
- /* Let's use this shorter path now. */
- strcpy(host_path, shorter_host_path);
- }
- strncpy(sockaddr.sun_path, host_path, sizeof_path);
-
- /* Push the updated sockaddr to a newly allocated space. */
- *address = alloc_mem(tracee, sizeof(sockaddr));
- if (*address == 0)
- return -EFAULT;
-
- status = write_data(tracee, *address, &sockaddr, sizeof(sockaddr));
- if (status < 0)
- return status;
-
- return 1;
-}
-
-/**
- * Detranslate the pathname of the struct sockaddr_un currently stored
- * in the @tracee memory at the given @sock_addr. See the
- * documentation of read_sockaddr_un() for the meaning of the
- * @size_addr and @max_size parameters. This function returns -errno
- * if an error occurred, otherwise 0.
- */
-int translate_socketcall_exit(Tracee *tracee, word_t sock_addr, word_t size_addr, word_t max_size)
-{
- struct sockaddr_un sockaddr;
- bool is_truncated = false;
- char path[PATH_MAX];
- int status;
- int size;
-
- if (sock_addr == 0)
- return 0;
-
- size = peek_int32(tracee, size_addr);
- if (errno != 0)
- return -errno;
-
- max_size = MIN(max_size, sizeof(sockaddr));
- status = read_sockaddr_un(tracee, &sockaddr, max_size, path, sock_addr, size);
- if (status <= 0)
- return status;
-
- status = detranslate_path(tracee, path, NULL);
- if (status < 0)
- return status;
-
- /* Be careful: sun_path doesn't have to be null-terminated. */
- size = offsetof_path + strlen(path) + 1;
- if (size < 0 || (word_t) size > max_size) {
- size = max_size;
- is_truncated = true;
- }
- strncpy(sockaddr.sun_path, path, sizeof_path);
-
- /* Overwrite the sockaddr and socklen parameters. */
- status = write_data(tracee, sock_addr, &sockaddr, size);
- if (status < 0)
- return status;
-
- /* If sockaddr is truncated (because the buffer provided is
- * too small), addrlen will return a value greater than was
- * supplied to the call. See man 2 accept. */
- if (is_truncated)
- size = max_size + 1;
-
- poke_int32(tracee, size_addr, size);
- if (errno != 0)
- return -errno;
-
- return 0;
-}
diff --git a/app/src/main/cpp/proot/src/syscall/socket.h b/app/src/main/cpp/proot/src/syscall/socket.h
deleted file mode 100644
index 8c16cb1..0000000
--- a/app/src/main/cpp/proot/src/syscall/socket.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef SOCKET_H
-#define SOCKET_H
-
-#include "arch.h" /* word_t */
-#include "tracee/tracee.h"
-
-int translate_socketcall_enter(Tracee *tracee, word_t *sock_addr, int size);
-int translate_socketcall_exit(Tracee *tracee, word_t sock_addr, word_t size_addr, word_t max_size);
-
-#endif /* SOCKET_H */
diff --git a/app/src/main/cpp/proot/src/syscall/syscall.c b/app/src/main/cpp/proot/src/syscall/syscall.c
deleted file mode 100644
index 722b1ca..0000000
--- a/app/src/main/cpp/proot/src/syscall/syscall.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* assert(3), */
-#include /* PATH_MAX, */
-#include /* strlen(3), */
-#include /* errno(3), E* */
-
-#include "syscall/syscall.h"
-#include "syscall/chain.h"
-#include "tracee/tracee.h"
-#include "tracee/reg.h"
-#include "tracee/mem.h"
-#include "cli/note.h"
-
-/**
- * Copy in @path a C string (PATH_MAX bytes max.) from the @tracee's
- * memory address space pointed to by the @reg argument of the
- * current syscall. This function returns -errno if an error occured,
- * otherwise it returns the size in bytes put into the @path.
- */
-int get_sysarg_path(const Tracee *tracee, char path[PATH_MAX], Reg reg)
-{
- int size;
- word_t src;
-
- src = peek_reg(tracee, CURRENT, reg);
-
- /* Check if the parameter is not NULL. Technically we should
- * not return an -EFAULT for this special value since it is
- * allowed for some syscall, utimensat(2) for instance. */
- if (src == 0) {
- path[0] = '\0';
- return 0;
- }
-
- /* Get the path from the tracee's memory space. */
- size = read_path(tracee, path, src);
- if (size < 0)
- return size;
-
- path[size] = '\0';
- return size;
-}
-
-/**
- * Copy @size bytes of the data pointed to by @tracer_ptr into a
- * @tracee's memory block and make the @reg argument of the current
- * syscall points to this new block. This function returns -errno if
- * an error occured, otherwise 0.
- */
-int set_sysarg_data(Tracee *tracee, const void *tracer_ptr, word_t size, Reg reg)
-{
- word_t tracee_ptr;
- int status;
-
- /* Allocate space into the tracee's memory to host the new data. */
- tracee_ptr = alloc_mem(tracee, size);
- if (tracee_ptr == 0)
- return -EFAULT;
-
- /* Copy the new data into the previously allocated space. */
- status = write_data(tracee, tracee_ptr, tracer_ptr, size);
- if (status < 0)
- return status;
-
- /* Make this argument point to the new data. */
- poke_reg(tracee, reg, tracee_ptr);
-
- return 0;
-}
-
-/**
- * Copy @path to a @tracee's memory block and make the @reg argument
- * of the current syscall points to this new block. This function
- * returns -errno if an error occured, otherwise 0.
- */
-int set_sysarg_path(Tracee *tracee, const char path[PATH_MAX], Reg reg)
-{
- return set_sysarg_data(tracee, path, strlen(path) + 1, reg);
-}
-
-void translate_syscall(Tracee *tracee)
-{
- const bool is_enter_stage = IS_IN_SYSENTER(tracee);
- int status;
-
- assert(tracee->exe != NULL);
-
- status = fetch_regs(tracee);
- if (status < 0)
- return;
-
- int suppressed_syscall_status = 0;
-
- if (is_enter_stage) {
- /* Never restore original register values at the end
- * of this stage. */
- tracee->restore_original_regs = false;
-
- print_current_regs(tracee, 3, "sysenter start");
-
- /* Translate the syscall only if it was actually
- * requested by the tracee, it is not a syscall
- * chained by PRoot. */
- if (tracee->chain.syscalls == NULL) {
- save_current_regs(tracee, ORIGINAL);
- status = translate_syscall_enter(tracee);
- save_current_regs(tracee, MODIFIED);
- }
- else {
- if (tracee->chain.sysnum_workaround_state != SYSNUM_WORKAROUND_PROCESS_REPLACED_CALL)
- status = 0;
- tracee->restart_how = PTRACE_SYSCALL;
- }
-
- /* Remember the tracee status for the "exit" stage and
- * avoid the actual syscall if an error was reported
- * by the translation. */
- if (status < 0) {
- set_sysnum(tracee, PR_void);
- poke_reg(tracee, SYSARG_RESULT, (word_t) status);
- tracee->status = status;
-#if defined(ARCH_ARM_EABI)
- tracee->restart_how = PTRACE_SYSCALL;
-#endif
- }
- else
- tracee->status = 1;
-
- /* Restore tracee's stack pointer now if it won't hit
- * the sysexit stage (i.e. when seccomp is enabled and
- * there's nothing else to do). */
- if (tracee->restart_how == PTRACE_CONT) {
- suppressed_syscall_status = tracee->status;
- tracee->status = 0;
- poke_reg(tracee, STACK_POINTER, peek_reg(tracee, ORIGINAL, STACK_POINTER));
- }
- }
- else {
- /* By default, restore original register values at the
- * end of this stage. */
- tracee->restore_original_regs = true;
-
- print_current_regs(tracee, 5, "sysexit start");
-
- /* Translate the syscall only if it was actually
- * requested by the tracee, it is not a syscall
- * chained by PRoot. */
- if (tracee->chain.syscalls == NULL || tracee->chain.sysnum_workaround_state == SYSNUM_WORKAROUND_PROCESS_REPLACED_CALL) {
- tracee->chain.sysnum_workaround_state = SYSNUM_WORKAROUND_INACTIVE;
- translate_syscall_exit(tracee);
- }
- else if (tracee->chain.sysnum_workaround_state == SYSNUM_WORKAROUND_PROCESS_FAULTY_CALL) {
- tracee->chain.sysnum_workaround_state = SYSNUM_WORKAROUND_PROCESS_REPLACED_CALL;
- }
-
- /* Reset the tracee's status. */
- tracee->status = 0;
-
- /* Insert the next chained syscall, if any. */
- if (tracee->chain.syscalls != NULL)
- chain_next_syscall(tracee);
- }
-
- bool override_sysnum = is_enter_stage && tracee->chain.syscalls == NULL;
- int push_regs_status = push_specific_regs(tracee, override_sysnum);
-
- /* Handle inability to change syscall number */
- if (push_regs_status < 0 && override_sysnum) {
- word_t orig_sysnum = peek_reg(tracee, ORIGINAL, SYSARG_NUM);
- word_t current_sysnum = peek_reg(tracee, CURRENT, SYSARG_NUM);
- print_current_regs(tracee, 4, "pre_push");
- if (orig_sysnum != current_sysnum) {
- /* Restart current syscall as chained */
- if (current_sysnum != SYSCALL_AVOIDER) {
- restart_current_syscall_as_chained(tracee);
- } else if (suppressed_syscall_status) {
- /* If we've decided to fail this syscall
- * by setting it to no-op and continuing, but turns out
- * that we can't just make syscall nop, restore tracee->status
- * and intercept syscall exit */
- tracee->status = suppressed_syscall_status;
- tracee->restart_how = PTRACE_SYSCALL;
- }
-
- /* Set syscall arguments to make it fail
- * For most syscalls we set all args to -1
- * Hoping there is among them invalid request/address/fd/value that will make syscall fail */
- poke_reg(tracee, SYSARG_1, -1);
- poke_reg(tracee, SYSARG_2, -1);
- poke_reg(tracee, SYSARG_3, -1);
- poke_reg(tracee, SYSARG_4, -1);
- poke_reg(tracee, SYSARG_5, -1);
- poke_reg(tracee, SYSARG_6, -1);
-
- if (get_sysnum(tracee, ORIGINAL) == PR_brk) {
- /* For brk() we pass 0 as first arg; this is used to query value without changing it */
- poke_reg(tracee, SYSARG_1, 0);
- }
-
- /* Push regs again without changing syscall */
- push_regs_status = push_specific_regs(tracee, false);
- if (push_regs_status != 0) {
- note(tracee, WARNING, SYSTEM, "can't set tracee registers in workaround");
- }
- }
- }
-
- if (is_enter_stage)
- print_current_regs(tracee, 5, "sysenter end" );
- else
- print_current_regs(tracee, 4, "sysexit end");
-}
diff --git a/app/src/main/cpp/proot/src/syscall/syscall.h b/app/src/main/cpp/proot/src/syscall/syscall.h
deleted file mode 100644
index e255cc8..0000000
--- a/app/src/main/cpp/proot/src/syscall/syscall.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef SYSCALL_H
-#define SYSCALL_H
-
-#include /* PATH_MAX, */
-
-#include "tracee/tracee.h"
-#include "tracee/reg.h"
-
-extern int get_sysarg_path(const Tracee *tracee, char path[PATH_MAX], Reg reg);
-extern int set_sysarg_path(Tracee *tracee, const char path[PATH_MAX], Reg reg);
-extern int set_sysarg_data(Tracee *tracee, const void *tracer_ptr, word_t size, Reg reg);
-
-extern void translate_syscall(Tracee *tracee);
-extern int translate_syscall_enter(Tracee *tracee);
-extern void translate_syscall_exit(Tracee *tracee);
-
-#endif /* SYSCALL_H */
diff --git a/app/src/main/cpp/proot/src/syscall/sysnum.c b/app/src/main/cpp/proot/src/syscall/sysnum.c
deleted file mode 100644
index 5014aa8..0000000
--- a/app/src/main/cpp/proot/src/syscall/sysnum.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include
-
-#include "syscall/sysnum.h"
-#include "tracee/tracee.h"
-#include "tracee/abi.h"
-#include "tracee/reg.h"
-#include "arch.h"
-#include "cli/note.h"
-
-#include SYSNUMS_HEADER1
-
-#ifdef SYSNUMS_HEADER2
-#include SYSNUMS_HEADER2
-#endif
-
-typedef struct {
- const Sysnum *table;
- word_t offset;
- word_t length;
-} Sysnums;
-
-/**
- * Update @sysnums' fields with the sysnum table for the given @abi.
- */
-static void get_sysnums(Abi abi, Sysnums *sysnums)
-{
- switch (abi) {
- case ABI_DEFAULT:
- sysnums->table = SYSNUMS_ABI1;
- sysnums->length = sizeof(SYSNUMS_ABI1) / sizeof(Sysnum);
- sysnums->offset = 0;
- return;
-#ifdef SYSNUMS_ABI2
- case ABI_2:
- sysnums->table = SYSNUMS_ABI2;
- sysnums->length = sizeof(SYSNUMS_ABI2) / sizeof(Sysnum);
- sysnums->offset = 0;
- return;
-#endif
- default:
- assert(0);
- }
-}
-
-/**
- * Return the neutral value of @sysnum from the given @abi.
- */
-static Sysnum translate_sysnum(Abi abi, word_t sysnum)
-{
- Sysnums sysnums;
- word_t index;
-
- get_sysnums(abi, &sysnums);
-
- /* Sanity checks. */
- if (sysnum < sysnums.offset)
- return PR_void;
-
- index = sysnum - sysnums.offset;
-
- /* Sanity checks. */
- if (index > sysnums.length)
- return PR_void;
-
- return sysnums.table[index];
-}
-
-/**
- * Return the architecture value of @sysnum for the given @abi.
- */
-word_t detranslate_sysnum(Abi abi, Sysnum sysnum)
-{
- Sysnums sysnums;
- size_t i;
-
- /* Very special case. */
- if (sysnum == PR_void)
- return SYSCALL_AVOIDER;
-
- get_sysnums(abi, &sysnums);
-
- for (i = 0; i < sysnums.length; i++) {
- if (sysnums.table[i] != sysnum)
- continue;
-
- return i + sysnums.offset;
- }
-
- return SYSCALL_AVOIDER;
-}
-
-/**
- * Return the neutral value of the @tracee's current syscall number.
- */
-Sysnum get_sysnum(const Tracee *tracee, RegVersion version)
-{
- return translate_sysnum(get_abi(tracee), peek_reg(tracee, version, SYSARG_NUM));
-}
-
-/**
- * Overwrite the @tracee's current syscall number with @sysnum. Note:
- * this neutral value is automatically converted into the architecture
- * value.
- */
-void set_sysnum(Tracee *tracee, Sysnum sysnum)
-{
- poke_reg(tracee, SYSARG_NUM, detranslate_sysnum(get_abi(tracee), sysnum));
-}
-
-/**
- * Return the human readable name of @sysnum.
- */
-const char *stringify_sysnum(Sysnum sysnum)
-{
- #define SYSNUM(item) [ PR_ ## item ] = #item,
- static const char *names[] = {
- #include "syscall/sysnums.list"
- };
- #undef SYSNUM
-
- if (sysnum == 0)
- return "void";
-
- if (sysnum >= PR_NB_SYSNUM)
- return "";
-
- return names[sysnum];
-}
diff --git a/app/src/main/cpp/proot/src/syscall/sysnum.h b/app/src/main/cpp/proot/src/syscall/sysnum.h
deleted file mode 100644
index 8d56ab3..0000000
--- a/app/src/main/cpp/proot/src/syscall/sysnum.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef SYSNUM_H
-#define SYSNUM_H
-
-#include
-
-#include "tracee/tracee.h"
-#include "tracee/abi.h"
-#include "tracee/reg.h"
-
-#define SYSNUM(item) PR_ ## item,
-typedef enum {
- PR_void = 0,
- #include "syscall/sysnums.list"
- PR_NB_SYSNUM
-} Sysnum;
-#undef SYSNUM
-
-extern Sysnum get_sysnum(const Tracee *tracee, RegVersion version);
-extern void set_sysnum(Tracee *tracee, Sysnum sysnum);
-extern word_t detranslate_sysnum(Abi abi, Sysnum sysnum);
-extern const char *stringify_sysnum(Sysnum sysnum);
-
-#endif /* SYSNUM_H */
diff --git a/app/src/main/cpp/proot/src/syscall/sysnums-arm.h b/app/src/main/cpp/proot/src/syscall/sysnums-arm.h
deleted file mode 100644
index 30d0d75..0000000
--- a/app/src/main/cpp/proot/src/syscall/sysnums-arm.h
+++ /dev/null
@@ -1,360 +0,0 @@
-#include "syscall/sysnum.h"
-
-static const Sysnum sysnums_arm[] = {
- [ 0 ] = PR_restart_syscall,
- [ 1 ] = PR_exit,
- [ 2 ] = PR_fork,
- [ 3 ] = PR_read,
- [ 4 ] = PR_write,
- [ 5 ] = PR_open,
- [ 6 ] = PR_close,
- [ 8 ] = PR_creat,
- [ 9 ] = PR_link,
- [ 10 ] = PR_unlink,
- [ 11 ] = PR_execve,
- [ 12 ] = PR_chdir,
- [ 14 ] = PR_mknod,
- [ 15 ] = PR_chmod,
- [ 16 ] = PR_lchown,
- [ 19 ] = PR_lseek,
- [ 20 ] = PR_getpid,
- [ 21 ] = PR_mount,
- [ 23 ] = PR_setuid,
- [ 24 ] = PR_getuid,
- [ 26 ] = PR_ptrace,
- [ 29 ] = PR_pause,
- [ 30 ] = PR_utime,
- [ 33 ] = PR_access,
- [ 34 ] = PR_nice,
- [ 36 ] = PR_sync,
- [ 37 ] = PR_kill,
- [ 38 ] = PR_rename,
- [ 39 ] = PR_mkdir,
- [ 40 ] = PR_rmdir,
- [ 41 ] = PR_dup,
- [ 42 ] = PR_pipe,
- [ 43 ] = PR_times,
- [ 45 ] = PR_brk,
- [ 46 ] = PR_setgid,
- [ 47 ] = PR_getgid,
- [ 49 ] = PR_geteuid,
- [ 50 ] = PR_getegid,
- [ 51 ] = PR_acct,
- [ 52 ] = PR_umount2,
- [ 54 ] = PR_ioctl,
- [ 55 ] = PR_fcntl,
- [ 57 ] = PR_setpgid,
- [ 60 ] = PR_umask,
- [ 61 ] = PR_chroot,
- [ 62 ] = PR_ustat,
- [ 63 ] = PR_dup2,
- [ 64 ] = PR_getppid,
- [ 65 ] = PR_getpgrp,
- [ 66 ] = PR_setsid,
- [ 67 ] = PR_sigaction,
- [ 70 ] = PR_setreuid,
- [ 71 ] = PR_setregid,
- [ 72 ] = PR_sigsuspend,
- [ 73 ] = PR_sigpending,
- [ 74 ] = PR_sethostname,
- [ 75 ] = PR_setrlimit,
- [ 77 ] = PR_getrusage,
- [ 78 ] = PR_gettimeofday,
- [ 79 ] = PR_settimeofday,
- [ 80 ] = PR_getgroups,
- [ 81 ] = PR_setgroups,
- [ 83 ] = PR_symlink,
- [ 85 ] = PR_readlink,
- [ 86 ] = PR_uselib,
- [ 87 ] = PR_swapon,
- [ 88 ] = PR_reboot,
- [ 91 ] = PR_munmap,
- [ 92 ] = PR_truncate,
- [ 93 ] = PR_ftruncate,
- [ 94 ] = PR_fchmod,
- [ 95 ] = PR_fchown,
- [ 96 ] = PR_getpriority,
- [ 97 ] = PR_setpriority,
- [ 99 ] = PR_statfs,
- [ 100 ] = PR_fstatfs,
- [ 103 ] = PR_syslog,
- [ 104 ] = PR_setitimer,
- [ 105 ] = PR_getitimer,
- [ 106 ] = PR_stat,
- [ 107 ] = PR_lstat,
- [ 108 ] = PR_fstat,
- [ 111 ] = PR_vhangup,
- [ 114 ] = PR_wait4,
- [ 115 ] = PR_swapoff,
- [ 116 ] = PR_sysinfo,
- [ 118 ] = PR_fsync,
- [ 119 ] = PR_sigreturn,
- [ 120 ] = PR_clone,
- [ 121 ] = PR_setdomainname,
- [ 122 ] = PR_uname,
- [ 124 ] = PR_adjtimex,
- [ 125 ] = PR_mprotect,
- [ 126 ] = PR_sigprocmask,
- [ 128 ] = PR_init_module,
- [ 129 ] = PR_delete_module,
- [ 131 ] = PR_quotactl,
- [ 132 ] = PR_getpgid,
- [ 133 ] = PR_fchdir,
- [ 134 ] = PR_bdflush,
- [ 135 ] = PR_sysfs,
- [ 136 ] = PR_personality,
- [ 138 ] = PR_setfsuid,
- [ 139 ] = PR_setfsgid,
- [ 140 ] = PR__llseek,
- [ 141 ] = PR_getdents,
- [ 142 ] = PR__newselect,
- [ 143 ] = PR_flock,
- [ 144 ] = PR_msync,
- [ 145 ] = PR_readv,
- [ 146 ] = PR_writev,
- [ 147 ] = PR_getsid,
- [ 148 ] = PR_fdatasync,
- [ 149 ] = PR__sysctl,
- [ 150 ] = PR_mlock,
- [ 151 ] = PR_munlock,
- [ 152 ] = PR_mlockall,
- [ 153 ] = PR_munlockall,
- [ 154 ] = PR_sched_setparam,
- [ 155 ] = PR_sched_getparam,
- [ 156 ] = PR_sched_setscheduler,
- [ 157 ] = PR_sched_getscheduler,
- [ 158 ] = PR_sched_yield,
- [ 159 ] = PR_sched_get_priority_max,
- [ 160 ] = PR_sched_get_priority_min,
- [ 161 ] = PR_sched_rr_get_interval,
- [ 162 ] = PR_nanosleep,
- [ 163 ] = PR_mremap,
- [ 164 ] = PR_setresuid,
- [ 165 ] = PR_getresuid,
- [ 168 ] = PR_poll,
- [ 169 ] = PR_nfsservctl,
- [ 170 ] = PR_setresgid,
- [ 171 ] = PR_getresgid,
- [ 172 ] = PR_prctl,
- [ 173 ] = PR_rt_sigreturn,
- [ 174 ] = PR_rt_sigaction,
- [ 175 ] = PR_rt_sigprocmask,
- [ 176 ] = PR_rt_sigpending,
- [ 177 ] = PR_rt_sigtimedwait,
- [ 178 ] = PR_rt_sigqueueinfo,
- [ 179 ] = PR_rt_sigsuspend,
- [ 180 ] = PR_pread64,
- [ 181 ] = PR_pwrite64,
- [ 182 ] = PR_chown,
- [ 183 ] = PR_getcwd,
- [ 184 ] = PR_capget,
- [ 185 ] = PR_capset,
- [ 186 ] = PR_sigaltstack,
- [ 187 ] = PR_sendfile,
- [ 190 ] = PR_vfork,
- [ 191 ] = PR_ugetrlimit,
- [ 192 ] = PR_mmap2,
- [ 193 ] = PR_truncate64,
- [ 194 ] = PR_ftruncate64,
- [ 195 ] = PR_stat64,
- [ 196 ] = PR_lstat64,
- [ 197 ] = PR_fstat64,
- [ 198 ] = PR_lchown32,
- [ 199 ] = PR_getuid32,
- [ 200 ] = PR_getgid32,
- [ 201 ] = PR_geteuid32,
- [ 202 ] = PR_getegid32,
- [ 203 ] = PR_setreuid32,
- [ 204 ] = PR_setregid32,
- [ 205 ] = PR_getgroups32,
- [ 206 ] = PR_setgroups32,
- [ 207 ] = PR_fchown32,
- [ 208 ] = PR_setresuid32,
- [ 209 ] = PR_getresuid32,
- [ 210 ] = PR_setresgid32,
- [ 211 ] = PR_getresgid32,
- [ 212 ] = PR_chown32,
- [ 213 ] = PR_setuid32,
- [ 214 ] = PR_setgid32,
- [ 215 ] = PR_setfsuid32,
- [ 216 ] = PR_setfsgid32,
- [ 217 ] = PR_getdents64,
- [ 218 ] = PR_pivot_root,
- [ 219 ] = PR_mincore,
- [ 220 ] = PR_madvise,
- [ 221 ] = PR_fcntl64,
- [ 222 ] = PR_void,
- [ 224 ] = PR_gettid,
- [ 225 ] = PR_readahead,
- [ 226 ] = PR_setxattr,
- [ 227 ] = PR_lsetxattr,
- [ 228 ] = PR_fsetxattr,
- [ 229 ] = PR_getxattr,
- [ 230 ] = PR_lgetxattr,
- [ 231 ] = PR_fgetxattr,
- [ 232 ] = PR_listxattr,
- [ 233 ] = PR_llistxattr,
- [ 234 ] = PR_flistxattr,
- [ 235 ] = PR_removexattr,
- [ 236 ] = PR_lremovexattr,
- [ 237 ] = PR_fremovexattr,
- [ 238 ] = PR_tkill,
- [ 239 ] = PR_sendfile64,
- [ 240 ] = PR_futex,
- [ 241 ] = PR_sched_setaffinity,
- [ 242 ] = PR_sched_getaffinity,
- [ 243 ] = PR_io_setup,
- [ 244 ] = PR_io_destroy,
- [ 245 ] = PR_io_getevents,
- [ 246 ] = PR_io_submit,
- [ 247 ] = PR_io_cancel,
- [ 248 ] = PR_exit_group,
- [ 249 ] = PR_lookup_dcookie,
- [ 250 ] = PR_epoll_create,
- [ 251 ] = PR_epoll_ctl,
- [ 252 ] = PR_epoll_wait,
- [ 253 ] = PR_remap_file_pages,
- [ 256 ] = PR_set_tid_address,
- [ 257 ] = PR_timer_create,
- [ 258 ] = PR_timer_settime,
- [ 259 ] = PR_timer_gettime,
- [ 260 ] = PR_timer_getoverrun,
- [ 261 ] = PR_timer_delete,
- [ 262 ] = PR_clock_settime,
- [ 263 ] = PR_clock_gettime,
- [ 264 ] = PR_clock_getres,
- [ 265 ] = PR_clock_nanosleep,
- [ 266 ] = PR_statfs64,
- [ 267 ] = PR_fstatfs64,
- [ 268 ] = PR_tgkill,
- [ 269 ] = PR_utimes,
- [ 270 ] = PR_arm_fadvise64_64,
- [ 271 ] = PR_pciconfig_iobase,
- [ 272 ] = PR_pciconfig_read,
- [ 273 ] = PR_pciconfig_write,
- [ 274 ] = PR_mq_open,
- [ 275 ] = PR_mq_unlink,
- [ 276 ] = PR_mq_timedsend,
- [ 277 ] = PR_mq_timedreceive,
- [ 278 ] = PR_mq_notify,
- [ 279 ] = PR_mq_getsetattr,
- [ 280 ] = PR_waitid,
- [ 281 ] = PR_socket,
- [ 282 ] = PR_bind,
- [ 283 ] = PR_connect,
- [ 284 ] = PR_listen,
- [ 285 ] = PR_accept,
- [ 286 ] = PR_getsockname,
- [ 287 ] = PR_getpeername,
- [ 288 ] = PR_socketpair,
- [ 289 ] = PR_send,
- [ 290 ] = PR_sendto,
- [ 291 ] = PR_recv,
- [ 292 ] = PR_recvfrom,
- [ 293 ] = PR_shutdown,
- [ 294 ] = PR_setsockopt,
- [ 295 ] = PR_getsockopt,
- [ 296 ] = PR_sendmsg,
- [ 297 ] = PR_recvmsg,
- [ 298 ] = PR_semop,
- [ 299 ] = PR_semget,
- [ 300 ] = PR_semctl,
- [ 301 ] = PR_msgsnd,
- [ 302 ] = PR_msgrcv,
- [ 303 ] = PR_msgget,
- [ 304 ] = PR_msgctl,
- [ 305 ] = PR_shmat,
- [ 306 ] = PR_shmdt,
- [ 307 ] = PR_shmget,
- [ 308 ] = PR_shmctl,
- [ 309 ] = PR_add_key,
- [ 310 ] = PR_request_key,
- [ 311 ] = PR_keyctl,
- [ 312 ] = PR_semtimedop,
- [ 313 ] = PR_vserver,
- [ 314 ] = PR_ioprio_set,
- [ 315 ] = PR_ioprio_get,
- [ 316 ] = PR_inotify_init,
- [ 317 ] = PR_inotify_add_watch,
- [ 318 ] = PR_inotify_rm_watch,
- [ 319 ] = PR_mbind,
- [ 320 ] = PR_get_mempolicy,
- [ 321 ] = PR_set_mempolicy,
- [ 322 ] = PR_openat,
- [ 323 ] = PR_mkdirat,
- [ 324 ] = PR_mknodat,
- [ 325 ] = PR_fchownat,
- [ 326 ] = PR_futimesat,
- [ 327 ] = PR_fstatat64,
- [ 328 ] = PR_unlinkat,
- [ 329 ] = PR_renameat,
- [ 330 ] = PR_linkat,
- [ 331 ] = PR_symlinkat,
- [ 332 ] = PR_readlinkat,
- [ 333 ] = PR_fchmodat,
- [ 334 ] = PR_faccessat,
- [ 335 ] = PR_pselect6,
- [ 336 ] = PR_ppoll,
- [ 337 ] = PR_unshare,
- [ 338 ] = PR_set_robust_list,
- [ 339 ] = PR_get_robust_list,
- [ 340 ] = PR_splice,
- [ 341 ] = PR_arm_sync_file_range,
- [ 342 ] = PR_tee,
- [ 343 ] = PR_vmsplice,
- [ 344 ] = PR_move_pages,
- [ 345 ] = PR_getcpu,
- [ 346 ] = PR_epoll_pwait,
- [ 347 ] = PR_kexec_load,
- [ 348 ] = PR_utimensat,
- [ 349 ] = PR_signalfd,
- [ 350 ] = PR_timerfd_create,
- [ 351 ] = PR_eventfd,
- [ 352 ] = PR_fallocate,
- [ 353 ] = PR_timerfd_settime,
- [ 354 ] = PR_timerfd_gettime,
- [ 355 ] = PR_signalfd4,
- [ 356 ] = PR_eventfd2,
- [ 357 ] = PR_epoll_create1,
- [ 358 ] = PR_dup3,
- [ 359 ] = PR_pipe2,
- [ 360 ] = PR_inotify_init1,
- [ 361 ] = PR_preadv,
- [ 362 ] = PR_pwritev,
- [ 363 ] = PR_rt_tgsigqueueinfo,
- [ 364 ] = PR_perf_event_open,
- [ 365 ] = PR_recvmmsg,
- [ 366 ] = PR_accept4,
- [ 367 ] = PR_fanotify_init,
- [ 368 ] = PR_fanotify_mark,
- [ 369 ] = PR_prlimit64,
- [ 370 ] = PR_name_to_handle_at,
- [ 371 ] = PR_open_by_handle_at,
- [ 372 ] = PR_clock_adjtime,
- [ 373 ] = PR_syncfs,
- [ 374 ] = PR_sendmmsg,
- [ 375 ] = PR_setns,
- [ 376 ] = PR_process_vm_readv,
- [ 377 ] = PR_process_vm_writev,
- [ 378 ] = PR_kcmp,
- [ 379 ] = PR_finit_module,
- [ 380 ] = PR_sched_setattr,
- [ 381 ] = PR_sched_getattr,
- [ 382 ] = PR_renameat2,
- [ 383 ] = PR_seccomp,
- [ 384 ] = PR_getrandom,
- [ 385 ] = PR_memfd_create,
- [ 386 ] = PR_bpf,
- [ 387 ] = PR_execveat,
- [ 388 ] = PR_userfaultfd,
- [ 389 ] = PR_membarrier,
- [ 390 ] = PR_mlock2,
- [ 391 ] = PR_copy_file_range,
- [ 392 ] = PR_preadv2,
- [ 393 ] = PR_pwritev2,
- [ 394 ] = PR_pkey_mprotect,
- [ 395 ] = PR_pkey_alloc,
- [ 396 ] = PR_pkey_free,
- [ 397 ] = PR_statx,
- [ 439 ] = PR_faccessat2,
-};
diff --git a/app/src/main/cpp/proot/src/syscall/sysnums-arm64.h b/app/src/main/cpp/proot/src/syscall/sysnums-arm64.h
deleted file mode 100644
index 2ddd59a..0000000
--- a/app/src/main/cpp/proot/src/syscall/sysnums-arm64.h
+++ /dev/null
@@ -1,282 +0,0 @@
-#include "syscall/sysnum.h"
-
-static const Sysnum sysnums_arm64[] = {
- [ 0 ] = PR_io_setup,
- [ 1 ] = PR_io_destroy,
- [ 2 ] = PR_io_submit,
- [ 3 ] = PR_io_cancel,
- [ 4 ] = PR_io_getevents,
- [ 5 ] = PR_setxattr,
- [ 6 ] = PR_lsetxattr,
- [ 7 ] = PR_fsetxattr,
- [ 8 ] = PR_getxattr,
- [ 9 ] = PR_lgetxattr,
- [ 10 ] = PR_fgetxattr,
- [ 11 ] = PR_listxattr,
- [ 12 ] = PR_llistxattr,
- [ 13 ] = PR_flistxattr,
- [ 14 ] = PR_removexattr,
- [ 15 ] = PR_lremovexattr,
- [ 16 ] = PR_fremovexattr,
- [ 17 ] = PR_getcwd,
- [ 18 ] = PR_lookup_dcookie,
- [ 19 ] = PR_eventfd2,
- [ 20 ] = PR_epoll_create1,
- [ 21 ] = PR_epoll_ctl,
- [ 22 ] = PR_epoll_pwait,
- [ 23 ] = PR_dup,
- [ 24 ] = PR_dup3,
- [ 25 ] = PR_fcntl,
- [ 26 ] = PR_inotify_init1,
- [ 27 ] = PR_inotify_add_watch,
- [ 28 ] = PR_inotify_rm_watch,
- [ 29 ] = PR_ioctl,
- [ 30 ] = PR_ioprio_set,
- [ 31 ] = PR_ioprio_get,
- [ 32 ] = PR_flock,
- [ 33 ] = PR_mknodat,
- [ 34 ] = PR_mkdirat,
- [ 35 ] = PR_unlinkat,
- [ 36 ] = PR_symlinkat,
- [ 37 ] = PR_linkat,
- [ 38 ] = PR_renameat,
- [ 39 ] = PR_umount2,
- [ 40 ] = PR_mount,
- [ 41 ] = PR_pivot_root,
- [ 42 ] = PR_nfsservctl,
- [ 43 ] = PR_statfs,
- [ 44 ] = PR_fstatfs,
- [ 45 ] = PR_truncate,
- [ 46 ] = PR_ftruncate,
- [ 47 ] = PR_fallocate,
- [ 48 ] = PR_faccessat,
- [ 49 ] = PR_chdir,
- [ 50 ] = PR_fchdir,
- [ 51 ] = PR_chroot,
- [ 52 ] = PR_fchmod,
- [ 53 ] = PR_fchmodat,
- [ 54 ] = PR_fchownat,
- [ 55 ] = PR_fchown,
- [ 56 ] = PR_openat,
- [ 57 ] = PR_close,
- [ 58 ] = PR_vhangup,
- [ 59 ] = PR_pipe2,
- [ 60 ] = PR_quotactl,
- [ 61 ] = PR_getdents64,
- [ 62 ] = PR_lseek,
- [ 63 ] = PR_read,
- [ 64 ] = PR_write,
- [ 65 ] = PR_readv,
- [ 66 ] = PR_writev,
- [ 67 ] = PR_pread64,
- [ 68 ] = PR_pwrite64,
- [ 69 ] = PR_preadv,
- [ 70 ] = PR_pwritev,
- [ 71 ] = PR_sendfile,
- [ 72 ] = PR_pselect6,
- [ 73 ] = PR_ppoll,
- [ 74 ] = PR_signalfd4,
- [ 75 ] = PR_vmsplice,
- [ 76 ] = PR_splice,
- [ 77 ] = PR_tee,
- [ 78 ] = PR_readlinkat,
- [ 79 ] = PR_fstatat64,
- [ 80 ] = PR_fstat,
- [ 81 ] = PR_sync,
- [ 82 ] = PR_fsync,
- [ 83 ] = PR_fdatasync,
- [ 84 ] = PR_sync_file_range,
- [ 85 ] = PR_timerfd_create,
- [ 86 ] = PR_timerfd_settime,
- [ 87 ] = PR_timerfd_gettime,
- [ 88 ] = PR_utimensat,
- [ 89 ] = PR_acct,
- [ 90 ] = PR_capget,
- [ 91 ] = PR_capset,
- [ 92 ] = PR_personality,
- [ 93 ] = PR_exit,
- [ 94 ] = PR_exit_group,
- [ 95 ] = PR_waitid,
- [ 96 ] = PR_set_tid_address,
- [ 97 ] = PR_unshare,
- [ 98 ] = PR_futex,
- [ 99 ] = PR_set_robust_list,
- [ 100 ] = PR_get_robust_list,
- [ 101 ] = PR_nanosleep,
- [ 102 ] = PR_getitimer,
- [ 103 ] = PR_setitimer,
- [ 104 ] = PR_kexec_load,
- [ 105 ] = PR_init_module,
- [ 106 ] = PR_delete_module,
- [ 107 ] = PR_timer_create,
- [ 108 ] = PR_timer_gettime,
- [ 109 ] = PR_timer_getoverrun,
- [ 110 ] = PR_timer_settime,
- [ 111 ] = PR_timer_delete,
- [ 112 ] = PR_clock_settime,
- [ 113 ] = PR_clock_gettime,
- [ 114 ] = PR_clock_getres,
- [ 115 ] = PR_clock_nanosleep,
- [ 116 ] = PR_syslog,
- [ 117 ] = PR_ptrace,
- [ 118 ] = PR_sched_setparam,
- [ 119 ] = PR_sched_setscheduler,
- [ 120 ] = PR_sched_getscheduler,
- [ 121 ] = PR_sched_getparam,
- [ 122 ] = PR_sched_setaffinity,
- [ 123 ] = PR_sched_getaffinity,
- [ 124 ] = PR_sched_yield,
- [ 125 ] = PR_sched_get_priority_max,
- [ 126 ] = PR_sched_get_priority_min,
- [ 127 ] = PR_sched_rr_get_interval,
- [ 128 ] = PR_restart_syscall,
- [ 129 ] = PR_kill,
- [ 130 ] = PR_tkill,
- [ 131 ] = PR_tgkill,
- [ 132 ] = PR_sigaltstack,
- [ 133 ] = PR_rt_sigsuspend,
- [ 134 ] = PR_rt_sigaction,
- [ 135 ] = PR_rt_sigprocmask,
- [ 136 ] = PR_rt_sigpending,
- [ 137 ] = PR_rt_sigtimedwait,
- [ 138 ] = PR_rt_sigqueueinfo,
- [ 139 ] = PR_rt_sigreturn,
- [ 140 ] = PR_setpriority,
- [ 141 ] = PR_getpriority,
- [ 142 ] = PR_reboot,
- [ 143 ] = PR_setregid,
- [ 144 ] = PR_setgid,
- [ 145 ] = PR_setreuid,
- [ 146 ] = PR_setuid,
- [ 147 ] = PR_setresuid,
- [ 148 ] = PR_getresuid,
- [ 149 ] = PR_setresgid,
- [ 150 ] = PR_getresgid,
- [ 151 ] = PR_setfsuid,
- [ 152 ] = PR_setfsgid,
- [ 153 ] = PR_times,
- [ 154 ] = PR_setpgid,
- [ 155 ] = PR_getpgid,
- [ 156 ] = PR_getsid,
- [ 157 ] = PR_setsid,
- [ 158 ] = PR_getgroups,
- [ 159 ] = PR_setgroups,
- [ 160 ] = PR_uname,
- [ 161 ] = PR_sethostname,
- [ 162 ] = PR_setdomainname,
- [ 163 ] = PR_getrlimit,
- [ 164 ] = PR_setrlimit,
- [ 165 ] = PR_getrusage,
- [ 166 ] = PR_umask,
- [ 167 ] = PR_prctl,
- [ 168 ] = PR_getcpu,
- [ 169 ] = PR_gettimeofday,
- [ 170 ] = PR_settimeofday,
- [ 171 ] = PR_adjtimex,
- [ 172 ] = PR_getpid,
- [ 173 ] = PR_getppid,
- [ 174 ] = PR_getuid,
- [ 175 ] = PR_geteuid,
- [ 176 ] = PR_getgid,
- [ 177 ] = PR_getegid,
- [ 178 ] = PR_gettid,
- [ 179 ] = PR_sysinfo,
- [ 180 ] = PR_mq_open,
- [ 181 ] = PR_mq_unlink,
- [ 182 ] = PR_mq_timedsend,
- [ 183 ] = PR_mq_timedreceive,
- [ 184 ] = PR_mq_notify,
- [ 185 ] = PR_mq_getsetattr,
- [ 186 ] = PR_msgget,
- [ 187 ] = PR_msgctl,
- [ 188 ] = PR_msgrcv,
- [ 189 ] = PR_msgsnd,
- [ 190 ] = PR_semget,
- [ 191 ] = PR_semctl,
- [ 192 ] = PR_semtimedop,
- [ 193 ] = PR_semop,
- [ 194 ] = PR_shmget,
- [ 195 ] = PR_shmctl,
- [ 196 ] = PR_shmat,
- [ 197 ] = PR_shmdt,
- [ 198 ] = PR_socket,
- [ 199 ] = PR_socketpair,
- [ 200 ] = PR_bind,
- [ 201 ] = PR_listen,
- [ 202 ] = PR_accept,
- [ 203 ] = PR_connect,
- [ 204 ] = PR_getsockname,
- [ 205 ] = PR_getpeername,
- [ 206 ] = PR_sendto,
- [ 207 ] = PR_recvfrom,
- [ 208 ] = PR_setsockopt,
- [ 209 ] = PR_getsockopt,
- [ 210 ] = PR_shutdown,
- [ 211 ] = PR_sendmsg,
- [ 212 ] = PR_recvmsg,
- [ 213 ] = PR_readahead,
- [ 214 ] = PR_brk,
- [ 215 ] = PR_munmap,
- [ 216 ] = PR_mremap,
- [ 217 ] = PR_add_key,
- [ 218 ] = PR_request_key,
- [ 219 ] = PR_keyctl,
- [ 220 ] = PR_clone,
- [ 221 ] = PR_execve,
- [ 222 ] = PR_mmap,
- [ 223 ] = PR_fadvise64,
- [ 224 ] = PR_swapon,
- [ 225 ] = PR_swapoff,
- [ 226 ] = PR_mprotect,
- [ 227 ] = PR_msync,
- [ 228 ] = PR_mlock,
- [ 229 ] = PR_munlock,
- [ 230 ] = PR_mlockall,
- [ 231 ] = PR_munlockall,
- [ 232 ] = PR_mincore,
- [ 233 ] = PR_madvise,
- [ 234 ] = PR_remap_file_pages,
- [ 235 ] = PR_mbind,
- [ 236 ] = PR_get_mempolicy,
- [ 237 ] = PR_set_mempolicy,
- [ 238 ] = PR_migrate_pages,
- [ 239 ] = PR_move_pages,
- [ 240 ] = PR_rt_tgsigqueueinfo,
- [ 241 ] = PR_perf_event_open,
- [ 242 ] = PR_accept4,
- [ 243 ] = PR_recvmmsg,
- [ 244 ] = PR_arch_specific_syscall,
- [ 260 ] = PR_wait4,
- [ 261 ] = PR_prlimit64,
- [ 262 ] = PR_fanotify_init,
- [ 263 ] = PR_fanotify_mark,
- [ 264 ] = PR_name_to_handle_at,
- [ 265 ] = PR_open_by_handle_at,
- [ 266 ] = PR_clock_adjtime,
- [ 267 ] = PR_syncfs,
- [ 268 ] = PR_setns,
- [ 269 ] = PR_sendmmsg,
- [ 270 ] = PR_process_vm_readv,
- [ 271 ] = PR_process_vm_writev,
- [ 272 ] = PR_kcmp,
- [ 273 ] = PR_finit_module,
- [ 274 ] = PR_sched_setattr,
- [ 275 ] = PR_sched_getattr,
- [ 276 ] = PR_renameat2,
- [ 277 ] = PR_seccomp,
- [ 278 ] = PR_getrandom,
- [ 279 ] = PR_memfd_create,
- [ 280 ] = PR_bpf,
- [ 281 ] = PR_execveat,
- [ 282 ] = PR_userfaultfd,
- [ 283 ] = PR_membarrier,
- [ 284 ] = PR_mlock2,
- [ 285 ] = PR_copy_file_range,
- [ 286 ] = PR_preadv2,
- [ 287 ] = PR_pwritev2,
- [ 288 ] = PR_pkey_mprotect,
- [ 289 ] = PR_pkey_alloc,
- [ 290 ] = PR_pkey_free,
- [ 291 ] = PR_statx,
- [ 439 ] = PR_faccessat2,
-};
diff --git a/app/src/main/cpp/proot/src/syscall/sysnums.list b/app/src/main/cpp/proot/src/syscall/sysnums.list
deleted file mode 100644
index 5e9c0c9..0000000
--- a/app/src/main/cpp/proot/src/syscall/sysnums.list
+++ /dev/null
@@ -1,447 +0,0 @@
-SYSNUM(ARM_BASE)
-SYSNUM(ARM_breakpoint)
-SYSNUM(ARM_cacheflush)
-SYSNUM(ARM_set_tls)
-SYSNUM(ARM_usr26)
-SYSNUM(ARM_usr32)
-SYSNUM(X32_SYSCALL_BIT)
-SYSNUM(_llseek)
-SYSNUM(_newselect)
-SYSNUM(_sysctl)
-SYSNUM(accept)
-SYSNUM(accept4)
-SYSNUM(access)
-SYSNUM(acct)
-SYSNUM(add_key)
-SYSNUM(adjtimex)
-SYSNUM(afs_syscall)
-SYSNUM(alarm)
-SYSNUM(arch_prctl)
-SYSNUM(arch_specific_syscall)
-SYSNUM(arm_fadvise64_64)
-SYSNUM(arm_sync_file_range)
-SYSNUM(bdflush)
-SYSNUM(bind)
-SYSNUM(bpf)
-SYSNUM(break)
-SYSNUM(brk)
-SYSNUM(cacheflush)
-SYSNUM(capget)
-SYSNUM(capset)
-SYSNUM(chdir)
-SYSNUM(chmod)
-SYSNUM(chown)
-SYSNUM(chown32)
-SYSNUM(chroot)
-SYSNUM(clock_adjtime)
-SYSNUM(clock_getres)
-SYSNUM(clock_gettime)
-SYSNUM(clock_nanosleep)
-SYSNUM(clock_settime)
-SYSNUM(clone)
-SYSNUM(close)
-SYSNUM(connect)
-SYSNUM(copy_file_range)
-SYSNUM(creat)
-SYSNUM(create_module)
-SYSNUM(delete_module)
-SYSNUM(dup)
-SYSNUM(dup2)
-SYSNUM(dup3)
-SYSNUM(epoll_create)
-SYSNUM(epoll_create1)
-SYSNUM(epoll_ctl)
-SYSNUM(epoll_ctl_old)
-SYSNUM(epoll_pwait)
-SYSNUM(epoll_wait)
-SYSNUM(epoll_wait_old)
-SYSNUM(eventfd)
-SYSNUM(eventfd2)
-SYSNUM(execve)
-SYSNUM(execveat)
-SYSNUM(exit)
-SYSNUM(exit_group)
-SYSNUM(faccessat)
-SYSNUM(faccessat2)
-SYSNUM(fadvise64)
-SYSNUM(fadvise64_64)
-SYSNUM(fallocate)
-SYSNUM(fanotify_init)
-SYSNUM(fanotify_mark)
-SYSNUM(fchdir)
-SYSNUM(fchmod)
-SYSNUM(fchmodat)
-SYSNUM(fchown)
-SYSNUM(fchown32)
-SYSNUM(fchownat)
-SYSNUM(fcntl)
-SYSNUM(fcntl64)
-SYSNUM(fdatasync)
-SYSNUM(fgetxattr)
-SYSNUM(finit_module)
-SYSNUM(flistxattr)
-SYSNUM(flock)
-SYSNUM(fork)
-SYSNUM(fremovexattr)
-SYSNUM(fsetxattr)
-SYSNUM(fstat)
-SYSNUM(fstat64)
-SYSNUM(fstatat64)
-SYSNUM(fstatfs)
-SYSNUM(fstatfs64)
-SYSNUM(fsync)
-SYSNUM(ftime)
-SYSNUM(ftruncate)
-SYSNUM(ftruncate64)
-SYSNUM(futex)
-SYSNUM(futimesat)
-SYSNUM(get_kernel_syms)
-SYSNUM(get_mempolicy)
-SYSNUM(get_robust_list)
-SYSNUM(get_thread_area)
-SYSNUM(getcpu)
-SYSNUM(getcwd)
-SYSNUM(getdents)
-SYSNUM(getdents64)
-SYSNUM(getegid)
-SYSNUM(getegid32)
-SYSNUM(geteuid)
-SYSNUM(geteuid32)
-SYSNUM(getgid)
-SYSNUM(getgid32)
-SYSNUM(getgroups)
-SYSNUM(getgroups32)
-SYSNUM(getitimer)
-SYSNUM(getpeername)
-SYSNUM(getpgid)
-SYSNUM(getpgrp)
-SYSNUM(getpid)
-SYSNUM(getpmsg)
-SYSNUM(getppid)
-SYSNUM(getpriority)
-SYSNUM(getrandom)
-SYSNUM(getresgid)
-SYSNUM(getresgid32)
-SYSNUM(getresuid)
-SYSNUM(getresuid32)
-SYSNUM(getrlimit)
-SYSNUM(getrusage)
-SYSNUM(getsid)
-SYSNUM(getsockname)
-SYSNUM(getsockopt)
-SYSNUM(gettid)
-SYSNUM(gettimeofday)
-SYSNUM(getuid)
-SYSNUM(getuid32)
-SYSNUM(getxattr)
-SYSNUM(gtty)
-SYSNUM(idle)
-SYSNUM(init_module)
-SYSNUM(inotify_add_watch)
-SYSNUM(inotify_init)
-SYSNUM(inotify_init1)
-SYSNUM(inotify_rm_watch)
-SYSNUM(io_cancel)
-SYSNUM(io_destroy)
-SYSNUM(io_getevents)
-SYSNUM(io_setup)
-SYSNUM(io_submit)
-SYSNUM(ioctl)
-SYSNUM(ioperm)
-SYSNUM(iopl)
-SYSNUM(ioprio_get)
-SYSNUM(ioprio_set)
-SYSNUM(ipc)
-SYSNUM(kcmp)
-SYSNUM(kexec_file_load)
-SYSNUM(kexec_load)
-SYSNUM(keyctl)
-SYSNUM(kill)
-SYSNUM(lchown)
-SYSNUM(lchown32)
-SYSNUM(lgetxattr)
-SYSNUM(link)
-SYSNUM(linkat)
-SYSNUM(listen)
-SYSNUM(listxattr)
-SYSNUM(llistxattr)
-SYSNUM(lock)
-SYSNUM(lookup_dcookie)
-SYSNUM(lremovexattr)
-SYSNUM(lseek)
-SYSNUM(lsetxattr)
-SYSNUM(lstat)
-SYSNUM(lstat64)
-SYSNUM(madvise)
-SYSNUM(mbind)
-SYSNUM(membarrier)
-SYSNUM(memfd_create)
-SYSNUM(migrate_pages)
-SYSNUM(mincore)
-SYSNUM(mkdir)
-SYSNUM(mkdirat)
-SYSNUM(mknod)
-SYSNUM(mknodat)
-SYSNUM(mlock)
-SYSNUM(mlock2)
-SYSNUM(mlockall)
-SYSNUM(mmap)
-SYSNUM(mmap2)
-SYSNUM(modify_ldt)
-SYSNUM(mount)
-SYSNUM(move_pages)
-SYSNUM(mprotect)
-SYSNUM(mpx)
-SYSNUM(mq_getsetattr)
-SYSNUM(mq_notify)
-SYSNUM(mq_open)
-SYSNUM(mq_timedreceive)
-SYSNUM(mq_timedsend)
-SYSNUM(mq_unlink)
-SYSNUM(mremap)
-SYSNUM(msgctl)
-SYSNUM(msgget)
-SYSNUM(msgrcv)
-SYSNUM(msgsnd)
-SYSNUM(msync)
-SYSNUM(munlock)
-SYSNUM(munlockall)
-SYSNUM(munmap)
-SYSNUM(name_to_handle_at)
-SYSNUM(nanosleep)
-SYSNUM(newfstatat)
-SYSNUM(nfsservctl)
-SYSNUM(nice)
-SYSNUM(oldfstat)
-SYSNUM(oldlstat)
-SYSNUM(oldolduname)
-SYSNUM(oldstat)
-SYSNUM(olduname)
-SYSNUM(open)
-SYSNUM(open_by_handle_at)
-SYSNUM(openat)
-SYSNUM(pause)
-SYSNUM(pciconfig_iobase)
-SYSNUM(pciconfig_read)
-SYSNUM(pciconfig_write)
-SYSNUM(perf_event_open)
-SYSNUM(personality)
-SYSNUM(pipe)
-SYSNUM(pipe2)
-SYSNUM(pivot_root)
-SYSNUM(pkey_alloc)
-SYSNUM(pkey_free)
-SYSNUM(pkey_mprotect)
-SYSNUM(poll)
-SYSNUM(ppoll)
-SYSNUM(prctl)
-SYSNUM(pread64)
-SYSNUM(preadv)
-SYSNUM(preadv2)
-SYSNUM(prlimit64)
-SYSNUM(process_vm_readv)
-SYSNUM(process_vm_writev)
-SYSNUM(prof)
-SYSNUM(profil)
-SYSNUM(pselect6)
-SYSNUM(ptrace)
-SYSNUM(putpmsg)
-SYSNUM(pwrite64)
-SYSNUM(pwritev)
-SYSNUM(pwritev2)
-SYSNUM(query_module)
-SYSNUM(quotactl)
-SYSNUM(read)
-SYSNUM(readahead)
-SYSNUM(readdir)
-SYSNUM(readlink)
-SYSNUM(readlinkat)
-SYSNUM(readv)
-SYSNUM(reboot)
-SYSNUM(recv)
-SYSNUM(recvfrom)
-SYSNUM(recvmmsg)
-SYSNUM(recvmsg)
-SYSNUM(remap_file_pages)
-SYSNUM(removexattr)
-SYSNUM(rename)
-SYSNUM(renameat)
-SYSNUM(renameat2)
-SYSNUM(request_key)
-SYSNUM(restart_syscall)
-SYSNUM(rmdir)
-SYSNUM(rt_sigaction)
-SYSNUM(rt_sigpending)
-SYSNUM(rt_sigprocmask)
-SYSNUM(rt_sigqueueinfo)
-SYSNUM(rt_sigreturn)
-SYSNUM(rt_sigsuspend)
-SYSNUM(rt_sigtimedwait)
-SYSNUM(rt_tgsigqueueinfo)
-SYSNUM(sched_get_priority_max)
-SYSNUM(sched_get_priority_min)
-SYSNUM(sched_getaffinity)
-SYSNUM(sched_getattr)
-SYSNUM(sched_getparam)
-SYSNUM(sched_getscheduler)
-SYSNUM(sched_rr_get_interval)
-SYSNUM(sched_setaffinity)
-SYSNUM(sched_setattr)
-SYSNUM(sched_setparam)
-SYSNUM(sched_setscheduler)
-SYSNUM(sched_yield)
-SYSNUM(seccomp)
-SYSNUM(security)
-SYSNUM(select)
-SYSNUM(semctl)
-SYSNUM(semget)
-SYSNUM(semop)
-SYSNUM(semtimedop)
-SYSNUM(send)
-SYSNUM(sendfile)
-SYSNUM(sendfile64)
-SYSNUM(sendmmsg)
-SYSNUM(sendmsg)
-SYSNUM(sendto)
-SYSNUM(set_mempolicy)
-SYSNUM(set_robust_list)
-SYSNUM(set_thread_area)
-SYSNUM(set_tid_address)
-SYSNUM(setdomainname)
-SYSNUM(setfsgid)
-SYSNUM(setfsgid32)
-SYSNUM(setfsuid)
-SYSNUM(setfsuid32)
-SYSNUM(setgid)
-SYSNUM(setgid32)
-SYSNUM(setgroups)
-SYSNUM(setgroups32)
-SYSNUM(sethostname)
-SYSNUM(setitimer)
-SYSNUM(setns)
-SYSNUM(setpgid)
-SYSNUM(setpriority)
-SYSNUM(setregid)
-SYSNUM(setregid32)
-SYSNUM(setresgid)
-SYSNUM(setresgid32)
-SYSNUM(setresuid)
-SYSNUM(setresuid32)
-SYSNUM(setreuid)
-SYSNUM(setreuid32)
-SYSNUM(setrlimit)
-SYSNUM(setsid)
-SYSNUM(setsockopt)
-SYSNUM(settimeofday)
-SYSNUM(setuid)
-SYSNUM(setuid32)
-SYSNUM(setxattr)
-SYSNUM(sgetmask)
-SYSNUM(shmat)
-SYSNUM(shmctl)
-SYSNUM(shmdt)
-SYSNUM(shmget)
-SYSNUM(shutdown)
-SYSNUM(sigaction)
-SYSNUM(sigaltstack)
-SYSNUM(signal)
-SYSNUM(signalfd)
-SYSNUM(signalfd4)
-SYSNUM(sigpending)
-SYSNUM(sigprocmask)
-SYSNUM(sigreturn)
-SYSNUM(sigsuspend)
-SYSNUM(socket)
-SYSNUM(socketcall)
-SYSNUM(socketpair)
-SYSNUM(splice)
-SYSNUM(ssetmask)
-SYSNUM(stat)
-SYSNUM(stat64)
-SYSNUM(statfs)
-SYSNUM(statfs64)
-SYSNUM(statx)
-SYSNUM(stime)
-SYSNUM(stty)
-SYSNUM(swapoff)
-SYSNUM(swapon)
-SYSNUM(symlink)
-SYSNUM(symlinkat)
-SYSNUM(sync)
-SYSNUM(sync_file_range)
-SYSNUM(sync_file_range2)
-SYSNUM(syncfs)
-SYSNUM(sysfs)
-SYSNUM(sysinfo)
-SYSNUM(syslog)
-SYSNUM(tee)
-SYSNUM(tgkill)
-SYSNUM(time)
-SYSNUM(timer_create)
-SYSNUM(timer_delete)
-SYSNUM(timer_getoverrun)
-SYSNUM(timer_gettime)
-SYSNUM(timer_settime)
-SYSNUM(timerfd_create)
-SYSNUM(timerfd_gettime)
-SYSNUM(timerfd_settime)
-SYSNUM(times)
-SYSNUM(tkill)
-SYSNUM(truncate)
-SYSNUM(truncate64)
-SYSNUM(tuxcall)
-SYSNUM(ugetrlimit)
-SYSNUM(ulimit)
-SYSNUM(umask)
-SYSNUM(umount)
-SYSNUM(umount2)
-SYSNUM(uname)
-SYSNUM(unlink)
-SYSNUM(unlinkat)
-SYSNUM(unshare)
-SYSNUM(uselib)
-SYSNUM(userfaultfd)
-SYSNUM(ustat)
-SYSNUM(utime)
-SYSNUM(utimensat)
-SYSNUM(utimes)
-SYSNUM(vfork)
-SYSNUM(vhangup)
-SYSNUM(vm86)
-SYSNUM(vm86old)
-SYSNUM(vmsplice)
-SYSNUM(vserver)
-SYSNUM(wait4)
-SYSNUM(waitid)
-SYSNUM(waitpid)
-SYSNUM(write)
-SYSNUM(writev)
-SYSNUM(x32_execve)
-SYSNUM(x32_get_robust_list)
-SYSNUM(x32_ioctl)
-SYSNUM(x32_kexec_load)
-SYSNUM(x32_move_pages)
-SYSNUM(x32_mq_notify)
-SYSNUM(x32_preadv)
-SYSNUM(x32_process_vm_readv)
-SYSNUM(x32_process_vm_writev)
-SYSNUM(x32_ptrace)
-SYSNUM(x32_pwritev)
-SYSNUM(x32_readv)
-SYSNUM(x32_recvfrom)
-SYSNUM(x32_recvmmsg)
-SYSNUM(x32_recvmsg)
-SYSNUM(x32_rt_sigaction)
-SYSNUM(x32_rt_sigpending)
-SYSNUM(x32_rt_sigqueueinfo)
-SYSNUM(x32_rt_sigreturn)
-SYSNUM(x32_rt_sigtimedwait)
-SYSNUM(x32_rt_tgsigqueueinfo)
-SYSNUM(x32_sendmmsg)
-SYSNUM(x32_sendmsg)
-SYSNUM(x32_set_robust_list)
-SYSNUM(x32_sigaltstack)
-SYSNUM(x32_timer_create)
-SYSNUM(x32_vmsplice)
-SYSNUM(x32_waitid)
-SYSNUM(x32_writev)
diff --git a/app/src/main/cpp/proot/src/tracee/abi.h b/app/src/main/cpp/proot/src/tracee/abi.h
deleted file mode 100644
index eadc85a..0000000
--- a/app/src/main/cpp/proot/src/tracee/abi.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef TRACEE_ABI_H
-#define TRACEE_ABI_H
-
-#include
-#include /* offsetof(), */
-#include
-
-#include "tracee/tracee.h"
-#include "tracee/reg.h"
-#include "arch.h"
-
-#include "attribute.h"
-
-typedef enum {
- ABI_DEFAULT = 0,
- ABI_2, /* ARM EABI on AArch64. */
- NB_MAX_ABIS,
-} Abi;
-
-/**
- * Return the ABI currently used by the given @tracee.
- */
-#if defined(ARCH_ARM64)
-static inline Abi get_abi(const Tracee *tracee)
-{
- return tracee->is_aarch32 ? ABI_2 : ABI_DEFAULT;
-}
-
-/**
- * Return true if @tracee is a 32-bit process running on a 64-bit
- * kernel.
- */
-static inline bool is_32on64_mode(const Tracee *tracee)
-{
- return tracee->is_aarch32;
-}
-#else
-static inline Abi get_abi(const Tracee *tracee UNUSED)
-{
- return ABI_DEFAULT;
-}
-
-static inline bool is_32on64_mode(const Tracee *tracee UNUSED)
-{
- return false;
-}
-#endif
-
-/**
- * Return the size of a word according to the ABI currently used by
- * the given @tracee.
- */
-static inline size_t sizeof_word(const Tracee *tracee)
-{
- return (is_32on64_mode(tracee)
- ? sizeof(word_t) / 2
- : sizeof(word_t));
-}
-
-#endif /* TRACEE_ABI_H */
diff --git a/app/src/main/cpp/proot/src/tracee/event.c b/app/src/main/cpp/proot/src/tracee/event.c
deleted file mode 100644
index 23a84c0..0000000
--- a/app/src/main/cpp/proot/src/tracee/event.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* CLONE_*, */
-#include /* pid_t, */
-#include /* ptrace(1), PTRACE_*, */
-#include /* waitpid(2), */
-#include /* waitpid(2), */
-#include /* uname(2), */
-#include /* fork(2), chdir(2), getpid(2), */
-#include /* strcmp(3), */
-#include /* errno(3), */
-#include /* bool, true, false, */
-#include /* assert(3), */
-#include /* atexit(3), getenv(3), */
-#include /* talloc_*, */
-#include /* PRI*, */
-#include /* bzero(3), */
-
-#include "tracee/event.h"
-#include "tracee/seccomp.h"
-#include "tracee/mem.h"
-#include "cli/note.h"
-#include "path/path.h"
-#include "path/binding.h"
-#include "syscall/syscall.h"
-#include "syscall/seccomp.h"
-#include "ptrace/wait.h"
-#include "execve/elf.h"
-
-#include "attribute.h"
-#include "compat.h"
-
-static bool seccomp_after_ptrace_enter = false;
-
-/**
- * Start @tracee->exe with the given @argv[]. This function
- * returns -errno if an error occurred, otherwise 0.
- */
-int launch_process(Tracee *tracee, char *const argv[])
-{
- char *const default_argv[] = { "-sh", NULL };
- long status;
- pid_t pid;
-
- /* Warn about open file descriptors. They won't be
- * translated until they are closed. */
- if (tracee->verbose > 0)
- list_open_fd(tracee);
-
- pid = fork();
- switch(pid) {
- case -1:
- note(tracee, ERROR, SYSTEM, "fork()");
- return -errno;
-
- case 0: /* child */
- /* Declare myself as ptraceable before executing the
- * requested program. */
- status = ptrace(PTRACE_TRACEME, 0, NULL, NULL);
- if (status < 0) {
- note(tracee, ERROR, SYSTEM, "ptrace(TRACEME)");
- return -errno;
- }
-
- /* Synchronize with the tracer's event loop. Without
- * this trick the tracer only sees the "return" from
- * the next execve(2) so PRoot wouldn't handle the
- * interpreter/runner. I also verified that strace
- * does the same thing. */
- kill(getpid(), SIGSTOP);
-
- /* Improve performance by using seccomp mode 2 */
- enable_syscall_filtering(tracee);
-
- /* Now process is ptraced, so the current rootfs is already the
- * guest rootfs. Note: Valgrind can't handle execve(2) on
- * "foreign" binaries (ENOEXEC) but can handle execvp(3) on such
- * binaries. */
- execvp(tracee->exe, argv[0] != NULL ? argv : default_argv);
- return -errno;
-
- default: /* parent */
- /* We know the pid of the first tracee now. */
- tracee->pid = pid;
- return 0;
- }
-
- /* Never reached. */
- return -ENOSYS;
-}
-
-/* Send the KILL signal to all tracees when PRoot has received a fatal
- * signal. */
-static void kill_all_tracees2(int signum, siginfo_t *siginfo UNUSED, void *ucontext UNUSED)
-{
- note(NULL, WARNING, INTERNAL, "signal %d received from process %d",
- signum, siginfo->si_pid);
- kill_all_tracees();
-
- /* Exit immediately for system signals (segmentation fault,
- * illegal instruction, ...), otherwise exit cleanly through
- * the event loop. */
- if (signum != SIGQUIT)
- _exit(EXIT_FAILURE);
-}
-
-/**
- * Helper for print_talloc_hierarchy().
- */
-static void print_talloc_chunk(const void *ptr, int depth, int max_depth UNUSED,
- int is_ref, void *data UNUSED)
-{
- const char *name;
- size_t count;
- size_t size;
-
- name = talloc_get_name(ptr);
- size = talloc_get_size(ptr);
- count = talloc_reference_count(ptr);
-
- if (depth == 0)
- return;
-
- while (depth-- > 1)
- fprintf(stderr, "\t");
-
- fprintf(stderr, "%-16s ", name);
-
- if (is_ref)
- fprintf(stderr, "-> %-8p", ptr);
- else {
- fprintf(stderr, "%-8p %zd bytes %zd ref'", ptr, size, count);
-
- if (name[0] == '$') {
- fprintf(stderr, "\t(\"%s\")", (char *)ptr);
- }
- if (name[0] == '@') {
- char **argv;
- int i;
-
- fprintf(stderr, "\t(");
- for (i = 0, argv = (char **)ptr; argv[i] != NULL; i++)
- fprintf(stderr, "\"%s\", ", argv[i]);
- fprintf(stderr, ")");
- }
- else if (strcmp(name, "Tracee") == 0) {
- fprintf(stderr, "\t(pid = %d, parent = %p)",
- ((Tracee *)ptr)->pid, ((Tracee *)ptr)->parent);
- }
- else if (strcmp(name, "Bindings") == 0) {
- Tracee *tracee;
-
- tracee = TRACEE(ptr);
-
- if (ptr == tracee->fs->bindings.pending)
- fprintf(stderr, "\t(pending)");
- else if (ptr == tracee->fs->bindings.guest)
- fprintf(stderr, "\t(guest)");
- else if (ptr == tracee->fs->bindings.host)
- fprintf(stderr, "\t(host)");
- }
- else if (strcmp(name, "Binding") == 0) {
- Binding *binding = (Binding *)ptr;
- fprintf(stderr, "\t(%s:%s)", binding->host.path, binding->guest.path);
- }
- }
-
- fprintf(stderr, "\n");
-}
-
-/* Print on stderr the complete talloc hierarchy. */
-static void print_talloc_hierarchy(int signum, siginfo_t *siginfo UNUSED, void *ucontext UNUSED)
-{
- switch (signum) {
- case SIGUSR1:
- talloc_report_depth_cb(NULL, 0, 100, print_talloc_chunk, NULL);
- break;
-
- case SIGUSR2:
- talloc_report_depth_file(NULL, 0, 100, stderr);
- break;
-
- default:
- break;
- }
-}
-
-static int last_exit_status = -1;
-
-/**
- * Wait then handle any event from any tracee. This function returns
- * the exit status of the last terminated program.
- */
-int event_loop()
-{
- struct sigaction signal_action;
- long status;
- int signum;
-
- /* Kill all tracees when exiting. */
- status = atexit(kill_all_tracees);
- if (status != 0)
- note(NULL, WARNING, INTERNAL, "atexit() failed");
-
- /* All signals are blocked when the signal handler is called.
- * SIGINFO is used to know which process has signaled us and
- * RESTART is used to restart waitpid(2) seamlessly. */
- bzero(&signal_action, sizeof(signal_action));
- signal_action.sa_flags = SA_SIGINFO | SA_RESTART;
- status = sigfillset(&signal_action.sa_mask);
- if (status < 0)
- note(NULL, WARNING, SYSTEM, "sigfillset()");
-
- /* Handle all signals. */
- for (signum = 0; signum < SIGRTMAX; signum++) {
- switch (signum) {
- case SIGQUIT:
- case SIGILL:
- case SIGABRT:
- case SIGFPE:
- case SIGSEGV:
- /* Kill all tracees on abnormal termination
- * signals. This ensures no process is left
- * untraced. */
- signal_action.sa_sigaction = kill_all_tracees2;
- break;
-
- case SIGUSR1:
- case SIGUSR2:
- /* Print on stderr the complete talloc
- * hierarchy, useful for debug purpose. */
- signal_action.sa_sigaction = print_talloc_hierarchy;
- break;
-
- case SIGCHLD:
- case SIGCONT:
- case SIGSTOP:
- case SIGTSTP:
- case SIGTTIN:
- case SIGTTOU:
- /* The default action is OK for these signals,
- * they are related to tty and job control. */
- continue;
-
- default:
- /* Ignore all other signals, including
- * terminating ones (^C for instance). */
- signal_action.sa_sigaction = (void *)SIG_IGN;
- break;
- }
-
- status = sigaction(signum, &signal_action, NULL);
- if (status < 0 && errno != EINVAL)
- note(NULL, WARNING, SYSTEM, "sigaction(%d)", signum);
- }
-
- while (1) {
- int tracee_status;
- Tracee *tracee;
- int signal;
- pid_t pid;
-
- /* This is the only safe place to free tracees. */
- free_terminated_tracees();
-
- /* Wait for the next tracee's stop. */
- pid = waitpid(-1, &tracee_status, __WALL);
- if (pid < 0) {
- if (errno != ECHILD) {
- note(NULL, ERROR, SYSTEM, "waitpid()");
- return EXIT_FAILURE;
- }
- break;
- }
-
- /* Get information about this tracee. */
- tracee = get_tracee(NULL, pid, true);
- assert(tracee != NULL);
-
- tracee->running = false;
-
- if (tracee->as_ptracee.ptracer != NULL) {
- bool keep_stopped = handle_ptracee_event(tracee, tracee_status);
- if (keep_stopped)
- continue;
- }
-
- signal = handle_tracee_event(tracee, tracee_status);
- (void) restart_tracee(tracee, signal);
- }
-
- return last_exit_status;
-}
-
-/**
- * Handle the current event (@tracee_status) of the given @tracee.
- * This function returns the "computed" signal that should be used to
- * restart the given @tracee.
- */
-int handle_tracee_event(Tracee *tracee, int tracee_status)
-{
- static bool seccomp_detected = false;
- static bool seccomp_after_ptrace_enter_checked = false;
- long status;
- int signal;
- bool sysexit_necessary;
-
- if (!seccomp_after_ptrace_enter_checked) {
- seccomp_after_ptrace_enter = getenv("PROOT_ASSUME_NEW_SECCOMP") != NULL;
- seccomp_after_ptrace_enter_checked = true;
- }
-
- /* When seccomp is enabled, all events are restarted in
- * non-stop mode, but this default choice could be overwritten
- * later if necessary. The check against "sysexit_pending"
- * ensures PTRACE_SYSCALL (used to hit the exit stage under
- * seccomp) is not cleared due to an event that would happen
- * before the exit stage, eg. PTRACE_EVENT_EXEC for the exit
- * stage of execve(2). */
- sysexit_necessary = tracee->sysexit_pending
- || tracee->chain.syscalls != NULL
- || tracee->restore_original_regs_after_seccomp_event;
- /* Don't overwrite restart_how if it is explicitly set
- * elsewhere, i.e in the ptrace emulation when single
- * stepping. */
- if (tracee->restart_how == 0) {
- if (tracee->seccomp == ENABLED && !sysexit_necessary)
- tracee->restart_how = PTRACE_CONT;
- else
- tracee->restart_how = PTRACE_SYSCALL;
- }
-
- /* Not a signal-stop by default. */
- signal = 0;
-
- if (WIFEXITED(tracee_status)) {
- last_exit_status = WEXITSTATUS(tracee_status);
- VERBOSE(tracee, 1, "pid %d: exited with status %d", tracee->pid, last_exit_status);
- terminate_tracee(tracee);
- }
- else if (WIFSIGNALED(tracee_status)) {
- VERBOSE(tracee, (int) (tracee->pid != 1), "pid %d: terminated with signal %d", tracee->pid, WTERMSIG(tracee_status));
- terminate_tracee(tracee);
- }
- else if (WIFSTOPPED(tracee_status)) {
- /* Don't use WSTOPSIG() to extract the signal
- * since it clears the PTRACE_EVENT_* bits. */
- signal = (tracee_status & 0xfff00) >> 8;
-
- switch (signal) {
- static bool deliver_sigtrap = false;
-
- case SIGTRAP: {
- const unsigned long default_ptrace_options = (
- PTRACE_O_TRACESYSGOOD |
- PTRACE_O_TRACEFORK |
- PTRACE_O_TRACEVFORK |
- PTRACE_O_TRACEVFORKDONE |
- PTRACE_O_TRACEEXEC |
- PTRACE_O_TRACECLONE |
- PTRACE_O_TRACEEXIT);
-
- /* Distinguish some events from others and
- * automatically trace each new process with
- * the same options.
- *
- * Note that only the first bare SIGTRAP is
- * related to the tracing loop, others SIGTRAP
- * carry tracing information because of
- * TRACE*FORK/CLONE/EXEC. */
- if (deliver_sigtrap)
- break; /* Deliver this signal as-is. */
-
- deliver_sigtrap = true;
-
- /* Try to enable seccomp mode 2... */
- status = ptrace(PTRACE_SETOPTIONS, tracee->pid, NULL,
- default_ptrace_options | PTRACE_O_TRACESECCOMP);
- if (status < 0) {
- /* ... otherwise use default options only. */
- status = ptrace(PTRACE_SETOPTIONS, tracee->pid, NULL,
- default_ptrace_options);
- if (status < 0) {
- note(tracee, ERROR, SYSTEM, "ptrace(PTRACE_SETOPTIONS)");
- exit(EXIT_FAILURE);
- }
- }
- }
- /* Fall through. */
- case SIGTRAP | 0x80:
- signal = 0;
-
- /* This tracee got signaled then freed during the
- sysenter stage but the kernel reports the sysexit
- stage; just discard this spurious tracee/event. */
- if (tracee->exe == NULL) {
- tracee->restart_how = PTRACE_CONT;
- return 0;
- }
-
- switch (tracee->seccomp) {
- case ENABLED:
- if (IS_IN_SYSENTER(tracee)) {
- /* sysenter: ensure the sysexit
- * stage will be hit under seccomp. */
- tracee->restart_how = PTRACE_SYSCALL;
- tracee->sysexit_pending = true;
- }
- else {
- /* sysexit: the next sysenter
- * will be notified by seccomp. */
- tracee->restart_how = PTRACE_CONT;
- tracee->sysexit_pending = false;
- }
- /* Fall through. */
- case DISABLED:
- if (!tracee->seccomp_already_handled_enter)
- {
- bool was_sysenter = IS_IN_SYSENTER(tracee);
-
- translate_syscall(tracee);
-
- /* In case we've changed on enter sysnum to PR_void,
- * seccomp check is happening after our change
- * and seccomp policy raises SIGSYS on -1 syscall,
- * set tracee flag to ignore next SIGSYS. */
- if (was_sysenter) {
- tracee->skip_next_seccomp_signal = (
- seccomp_after_ptrace_enter &&
- get_sysnum(tracee, CURRENT) == PR_void);
- }
-
- /* Redeliver signal suppressed during
- * syscall chain once it's finished. */
- if (tracee->chain.suppressed_signal && tracee->chain.syscalls == NULL) {
- signal = tracee->chain.suppressed_signal;
- tracee->chain.suppressed_signal = 0;
- VERBOSE(tracee, 6, "pid %d: redelivering suppressed signal %d", tracee->pid, signal);
- }
- }
- else {
- VERBOSE(tracee, 6, "skipping SIGTRAP for already handled sysenter");
- assert(!IS_IN_SYSENTER(tracee));
- assert(!seccomp_after_ptrace_enter);
- tracee->seccomp_already_handled_enter = false;
- tracee->restart_how = PTRACE_SYSCALL;
- }
-
- /* This syscall has disabled seccomp. */
- if (tracee->seccomp == DISABLING) {
- tracee->restart_how = PTRACE_SYSCALL;
- tracee->seccomp = DISABLED;
- }
-
- break;
-
- case DISABLING:
- /* Seccomp was disabled by the
- * previous syscall, but its sysenter
- * stage was already handled. */
- tracee->seccomp = DISABLED;
- if (IS_IN_SYSENTER(tracee))
- tracee->status = 1;
- break;
- }
- break;
-
- case SIGTRAP | PTRACE_EVENT_SECCOMP2 << 8:
- case SIGTRAP | PTRACE_EVENT_SECCOMP << 8: {
- unsigned long flags = 0;
-
- signal = 0;
-
- if (!seccomp_detected) {
- tracee->seccomp = ENABLED;
- seccomp_detected = true;
- seccomp_after_ptrace_enter = !IS_IN_SYSENTER(tracee);
- VERBOSE(tracee, 1, "ptrace acceleration (seccomp mode 2, %s syscall order) enabled",
- seccomp_after_ptrace_enter ? "new" : "old");
- }
-
- tracee->skip_next_seccomp_signal = false;
-
- /* If kernel triggered seccomp event after we handled
- * syscall enter, skip this event and continue as it didn't happen */
- if (seccomp_after_ptrace_enter && !IS_IN_SYSENTER(tracee))
- {
- tracee->restart_how = tracee->last_restart_how;
- VERBOSE(tracee, 6, "skipping PTRACE_EVENT_SECCOMP for already handled sysenter");
-
- /* "!IS_IN_SYSENTER(tracee)" in condition above means we have pending sysexit,
- * so requesting to not be notified about it makes no sense */
- assert(tracee->restart_how != PTRACE_CONT);
- break;
- }
-
- assert(IS_IN_SYSENTER(tracee));
-
- /* Use the common ptrace flow if seccomp was
- * explicitely disabled for this tracee. */
- if (tracee->seccomp != ENABLED)
- break;
-
- status = ptrace(PTRACE_GETEVENTMSG, tracee->pid, NULL, &flags);
- if (status < 0)
- break;
-
- /* Use the common ptrace flow when
- * sysexit has to be handled. */
- if ((flags & FILTER_SYSEXIT) != 0 || sysexit_necessary) {
- if (seccomp_after_ptrace_enter) {
- tracee->restart_how = PTRACE_SYSCALL;
- translate_syscall(tracee);
- }
- tracee->restart_how = PTRACE_SYSCALL;
- break;
- }
-
- /* Otherwise, handle the sysenter
- * stage right now. */
- tracee->restart_how = PTRACE_CONT;
- translate_syscall(tracee);
-
- /* This syscall has disabled seccomp, so move
- * the ptrace flow back to the common path to
- * ensure its sysexit will be handled. */
- if (tracee->seccomp == DISABLING)
- tracee->restart_how = PTRACE_SYSCALL;
-
- if (!seccomp_after_ptrace_enter && tracee->restart_how == PTRACE_SYSCALL)
- tracee->seccomp_already_handled_enter = true;
- break;
- }
-
- case SIGTRAP | PTRACE_EVENT_VFORK << 8:
- signal = 0;
- (void) new_child(tracee, CLONE_VFORK);
- break;
-
- case SIGTRAP | PTRACE_EVENT_FORK << 8:
- case SIGTRAP | PTRACE_EVENT_CLONE << 8:
- signal = 0;
- (void) new_child(tracee, 0);
- break;
-
- case SIGTRAP | PTRACE_EVENT_VFORK_DONE << 8:
- case SIGTRAP | PTRACE_EVENT_EXEC << 8:
- case SIGTRAP | PTRACE_EVENT_EXIT << 8:
- signal = 0;
- if (tracee->last_restart_how) {
- tracee->restart_how = tracee->last_restart_how;
- }
- break;
-
- case SIGSTOP:
- /* Stop this tracee until PRoot has received
- * the EVENT_*FORK|CLONE notification. */
- if (tracee->exe == NULL) {
- tracee->sigstop = SIGSTOP_PENDING;
- signal = -1;
- }
-
- /* For each tracee, the first SIGSTOP
- * is only used to notify the tracer. */
- if (tracee->sigstop == SIGSTOP_IGNORED) {
- tracee->sigstop = SIGSTOP_ALLOWED;
- signal = 0;
- }
- break;
-
- case SIGSYS: {
- siginfo_t siginfo = {};
- ptrace(PTRACE_GETSIGINFO, tracee->pid, NULL, &siginfo);
- if (siginfo.si_code == SYS_SECCOMP) {
- /* Signal cannot happen when we're inside syscall,
- * tracee would have to exit from syscall first.
- * Execute exit handler now if seccomp triggered sysexit skip. */
- if (!IS_IN_SYSENTER(tracee)) {
- VERBOSE(tracee, 1, "Handling syscall exit from SIGSYS");
- translate_syscall(tracee);
- }
-
- if (tracee->skip_next_seccomp_signal || (seccomp_after_ptrace_enter && siginfo.si_syscall == SYSCALL_AVOIDER)) {
- VERBOSE(tracee, 4, "suppressed SIGSYS after void syscall");
- tracee->skip_next_seccomp_signal = false;
- signal = 0;
- } else {
- signal = handle_seccomp_event(tracee);
- }
- } else {
- VERBOSE(tracee, 1, "non-seccomp SIGSYS");
- }
- break;
- }
-
- default:
- /* Deliver this signal as-is,
- * unless we're chaining syscall. */
- if (tracee->chain.syscalls != NULL) {
- VERBOSE(tracee, 5,
- "pid %d: suppressing signal during chain signal=%d, prev suppressed_signal=%d",
- tracee->pid, signal, tracee->chain.suppressed_signal);
- tracee->chain.suppressed_signal = signal;
- signal = 0;
- }
- break;
- }
- }
-
- /* Clear the pending event, if any. */
- tracee->as_ptracee.event4.proot.pending = false;
-
- return signal;
-}
-
-/**
- * Returns true if on current system SIGTRAP|0x80
- * for syscall enter is reported before SIGSYS
- * when syscall is being blocked by seccomp
- */
-bool seccomp_event_happens_after_enter_sigtrap()
-{
- return !seccomp_after_ptrace_enter;
-}
-
-/**
- * Restart the given @tracee with the specified @signal. This
- * function returns false if the tracee was not restarted (error or
- * put in the "waiting for ptracee" state), otherwise true.
- */
-bool restart_tracee(Tracee *tracee, int signal)
-{
- int status;
-
- /* Put in the "stopped"/"waiting for ptracee" state?. */
- if (tracee->as_ptracer.wait_pid != 0 || signal == -1)
- return false;
-
- /* Restart the tracee and stop it at the next instruction, or
- * at the next entry or exit of a system call. */
- assert(tracee->restart_how != 0);
- status = ptrace(tracee->restart_how, tracee->pid, NULL, signal);
- if (status < 0)
- return false; /* The process likely died in a syscall. */
-
- tracee->last_restart_how = tracee->restart_how;
- tracee->restart_how = 0;
- tracee->running = true;
-
- return true;
-}
diff --git a/app/src/main/cpp/proot/src/tracee/event.h b/app/src/main/cpp/proot/src/tracee/event.h
deleted file mode 100644
index 3f78988..0000000
--- a/app/src/main/cpp/proot/src/tracee/event.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#ifndef TRACEE_EVENT_H
-#define TRACEE_EVENT_H
-
-#include
-
-#include "tracee/tracee.h"
-
-extern int launch_process(Tracee *tracee, char *const argv[]);
-extern int event_loop();
-extern int handle_tracee_event(Tracee *tracee, int tracee_status);
-extern bool restart_tracee(Tracee *tracee, int signal);
-extern bool seccomp_event_happens_after_enter_sigtrap();
-
-#endif /* TRACEE_EVENT_H */
diff --git a/app/src/main/cpp/proot/src/tracee/mem.c b/app/src/main/cpp/proot/src/tracee/mem.c
deleted file mode 100644
index 943f3b8..0000000
--- a/app/src/main/cpp/proot/src/tracee/mem.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
- *
- * This file is part of PRoot.
- *
- * Copyright (C) 2015 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-#include /* ptrace(2), PTRACE_*, */
-#include /* pid_t, size_t, */
-#include /* NULL, */
-#include /* offsetof(), */
-#include /* struct user*, */
-#include /* errno, */
-#include