Skip to content

Commit

Permalink
Big Picture Mode revamp, custom bg, custom music, animated wallpapers…
Browse files Browse the repository at this point in the history
…, Gyro implementation Revamp, NTSC Screen filter (and screen effects in general), Gamepad Configurator, hidden terminal activity for testing compiled binaries, a whole lot i should have made more commits.
  • Loading branch information
coffincolors committed Oct 17, 2024
1 parent fb3f04e commit 66b6001
Show file tree
Hide file tree
Showing 230 changed files with 7,083 additions and 455 deletions.
6 changes: 6 additions & 0 deletions app/.idea/appInsightsSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions app/.idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

370 changes: 308 additions & 62 deletions app/.idea/workspace.xml

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ plugins {

android {
namespace 'com.winlator'
compileSdk 34
compileSdk 31

defaultConfig {
applicationId 'com.winlator'
minSdkVersion 26
targetSdkVersion 28
versionCode 20
versionName "7.1.3-glibc-cmod-v8"
versionName "7.1.3x-glibc-cmod-v11"
externalNativeBuild {
cmake {
cppFlags ''
Expand Down Expand Up @@ -66,23 +66,29 @@ task prepareKotlinBuildScriptModel {

dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference:1.2.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'
implementation 'androidx.activity:activity-ktx:1.4.0'
implementation 'androidx.fragment:fragment-ktx:1.4.0'
implementation files('libs/MidiSynth/MidiSynth.jar')
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'org.conscrypt:conscrypt-android:2.5.2' // for Conscrypt
implementation 'org.bouncycastle:bcprov-jdk15on:1.68' // for BouncyCastle
implementation 'org.openjsse:openjsse:1.1.7'
implementation 'androidx.core:core:1.13.1'// for OpenJSSE
implementation 'androidx.core:core:1.0.1'// for OpenJSSE
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' // For Glide’s generated API





testImplementation libs.junit
androidTestImplementation libs.ext.junit
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
android:label="Winlator.glibcmod">

<activity android:name="com.winlator.MainActivity"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Dark"
android:exported="true"
android:screenOrientation="sensor"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|density|navigation">
Expand All @@ -51,7 +51,11 @@
<activity
android:name="com.winlator.BigPictureActivity"
android:theme="@style/Theme.AppCompat"
android:screenOrientation="landscape"
android:exported="false" />

<activity
android:name="com.winlator.TerminalActivity"
android:theme="@style/Theme.AppCompat"
android:exported="false" />

<activity android:name="com.winlator.XServerDisplayActivity"
Expand Down
62 changes: 46 additions & 16 deletions app/src/main/cpp/winlator/sysvshared_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,30 @@
#include <android/log.h>

#define __u32 uint32_t
#include <linux/ashmem.h>

#define printf(...) __android_log_print(ANDROID_LOG_DEBUG, "System.out", __VA_ARGS__);

static int ashmemCreateRegion(const char* name, int64_t size) {
int fd = open("/dev/ashmem", O_RDWR);
if (fd < 0) return -1;

char nameBuffer[ASHMEM_NAME_LEN] = {0};
strncpy(nameBuffer, name, sizeof(nameBuffer));
nameBuffer[sizeof(nameBuffer) - 1] = 0;

int ret = ioctl(fd, ASHMEM_SET_NAME, nameBuffer);
if (ret < 0) goto error;

ret = ioctl(fd, ASHMEM_SET_SIZE, size);
if (ret < 0) goto error;

return fd;
error:
close(fd);
return -1;
}

static int memfd_create(const char *name, unsigned int flags) {
#ifdef __NR_memfd_create
return syscall(__NR_memfd_create, name, flags);
Expand All @@ -26,7 +47,30 @@ static int memfd_create(const char *name, unsigned int flags) {
}

JNIEXPORT jint JNICALL
Java_com_winlator_sysvshm_SysVSharedMemory_createMemoryFd(JNIEnv *env, jclass obj, jstring name, jint size) {
Java_com_winlator_sysvshm_SysVSharedMemory_ashmemCreateRegion(JNIEnv *env, jobject obj, jint index,
jlong size) {
char name[32];
sprintf(name, "sysvshm-%d", index);
return ashmemCreateRegion(name, size);
}

JNIEXPORT jobject JNICALL
Java_com_winlator_sysvshm_SysVSharedMemory_mapSHMSegment(JNIEnv *env, jobject obj, jint fd, jlong size, jint offset, jboolean readonly) {
char *data = mmap(NULL, size, readonly ? PROT_READ : PROT_WRITE | PROT_READ, MAP_SHARED, fd, offset);
if (data == MAP_FAILED) return NULL;
return (*env)->NewDirectByteBuffer(env, data, size);
}

JNIEXPORT void JNICALL
Java_com_winlator_sysvshm_SysVSharedMemory_unmapSHMSegment(JNIEnv *env, jobject obj, jobject data,
jlong size) {
char *dataAddr = (*env)->GetDirectBufferAddress(env, data);
munmap(dataAddr, size);
}

JNIEXPORT jint JNICALL
Java_com_winlator_sysvshm_SysVSharedMemory_createMemoryFd(JNIEnv *env, jclass obj, jstring name,
jint size) {
const char *namePtr = (*env)->GetStringUTFChars(env, name, 0);

int fd = memfd_create(namePtr, MFD_ALLOW_SEALING);
Expand All @@ -41,18 +85,4 @@ Java_com_winlator_sysvshm_SysVSharedMemory_createMemoryFd(JNIEnv *env, jclass ob
}

return fd;
}

JNIEXPORT jobject JNICALL
Java_com_winlator_sysvshm_SysVSharedMemory_mapSHMSegment(JNIEnv *env, jobject obj, jint fd, jlong size, jint offset, jboolean readonly) {
int prot = readonly ? PROT_READ : PROT_WRITE | PROT_READ;
char *data = mmap(NULL, size, prot, MAP_SHARED, fd, offset);
if (data == MAP_FAILED) return NULL;
return (*env)->NewDirectByteBuffer(env, data, size);
}

JNIEXPORT void JNICALL
Java_com_winlator_sysvshm_SysVSharedMemory_unmapSHMSegment(JNIEnv *env, jobject obj, jobject data, jlong size) {
char *dataAddr = (*env)->GetDirectBufferAddress(env, data);
munmap(dataAddr, size);
}
}
23 changes: 22 additions & 1 deletion app/src/main/cpp/winlator/xconnector_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,25 @@ Java_com_winlator_xconnector_XConnectorEpoll_waitForSocketRead(JNIEnv *env, jobj
(*env)->CallVoidMethod(env, obj, handleExistingConnection, clientFd);
}
return JNI_TRUE;
}
}

JNIEXPORT jintArray JNICALL
Java_com_winlator_xconnector_XConnectorEpoll_pollEpollEvents(JNIEnv *env, jobject obj,
jint epollFd, jint maxEvents) {
struct epoll_event events[maxEvents];
int numFds = epoll_wait(epollFd, events, maxEvents, -1); // Wait indefinitely

if (numFds < 0) return NULL;

jintArray result = (*env)->NewIntArray(env, numFds);
if (result == NULL) return NULL;

jint *r = (*env)->GetIntArrayElements(env, result, 0);

for (int i = 0; i < numFds; i++) {
r[i] = events[i].data.fd; // Store file descriptor
}

(*env)->ReleaseIntArrayElements(env, result, r, 0);
return result;
}
Loading

0 comments on commit 66b6001

Please sign in to comment.