Skip to content

Commit

Permalink
geode ver release
Browse files Browse the repository at this point in the history
  • Loading branch information
LXanii committed Apr 28, 2024
1 parent 37730c0 commit e8385ed
Show file tree
Hide file tree
Showing 10 changed files with 252 additions and 108 deletions.
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Macos be like
**/.DS_Store

# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# Ignore build folders
**/build
# Ignore platform specific build folders
build-*/

# Workspace files are user-specific
*.sublime-workspace

# ILY vscode
**/.vscode
.idea/

# clangd
.cache/

# Visual Studio
.vs/
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.21)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(GDOptimizer VERSION 1.0.0)

add_library(${PROJECT_NAME} SHARED
src/main.cpp
# Add your cpp files here
)

if (NOT DEFINED ENV{GEODE_SDK})
message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode")
else()
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
endif()

add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)

setup_geode_mod(${PROJECT_NAME})
Binary file removed GD_Optimizer.exe
Binary file not shown.
20 changes: 2 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
# Geometry Dash Optimizer
# GD Optimizer

This program automatically sets Geometry Dash to High Priority, and Discord to Low Priority.
As more optimizes are found, they will be added so make sure to keep up to date, will post updates on Twitter as well.

OPEN THIS PROGRAM ONLY AFTER OPENING GD AND DISCORD.

"main.py" is the source code for the executable. "GD_Optimizer.exe" should work for everyone without the requirement of Python.

# Working Operating Systems

Windows 11,
Windows 10

This list will be updated with more operating systems that are confirmed to work.

# Important

Relaunch the program everytime you join a new call on discord.
Note* This will cause a little lag when entering a level, to avoid this you can download the exe version inside the python folder
3 changes: 3 additions & 0 deletions about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GD Optimizer

Note* This will cause a little lag when entering a level, to avoid this you can download the exe version inside the python folder on the github repository
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"geode": "2.0.0-beta.21",
"gd": "2.204",
"version": "v1.0.0",
"id": "xanii.gd_optimizer",
"name": "GD Optimizer",
"developer": "Xanii",
"description": "Sets different programs priorities",
"repository": "https://github.com/LXanii/GD-Optimizer"
}
19 changes: 19 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Geometry Dash Optimizer

This program automatically sets Geometry Dash to High Priority, and Discord to Low Priority.
As more optimizes are found, they will be added so make sure to keep up to date, will post updates on Twitter as well.

OPEN THIS PROGRAM ONLY AFTER OPENING GD AND DISCORD.

"main.py" is the source code for the executable. "GD_Optimizer.exe" should work for everyone without the requirement of Python.

# Working Operating Systems

Windows 11,
Windows 10

This list will be updated with more operating systems that are confirmed to work.

# Important

Relaunch the program everytime you join a new call on discord.
180 changes: 90 additions & 90 deletions main.py → python/main.py
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
import os
import time
import shutil

folder = 'C:/Users/'+os.getlogin()+'/AppData/Local/Temp'

deleteFileCount = 0
deleteFolderCount = 0

big_ver = "1"
mini_ver = ".1.0"
version = "(" + big_ver + mini_ver + ")"

"""
Priority Level Value Priority Level Name
256 Realtime
128 High
32768 Above normal
32 Normal
16384 Below normal
64 Low
"""

# sets these processes to their respective priorities
low = ["Discord.exe", "steamwebhelper.exe", "firefox.exe", "chrome.exe"]
normal = []
high = []
real = ["GeometryDash.exe"]

def lowpriority():
for i in low:
process_change = 'wmic process where name="' + i + '" CALL setpriority "64"'
print(process_change)
os.system(process_change)
os.system('cls')

def normalpriority():
for i in normal:
process_change = 'wmic process where name="' + i + '" CALL setpriority "32"'
print(process_change)
os.system(process_change)
os.system('cls')

def highpriority():
for i in high:
process_change = 'wmic process where name="' + i + '" CALL setpriority "128"'
print(process_change)
os.system(process_change)
os.system('cls')

def realpriority(): # sets to high for some reason lmfao
for i in real:
process_change = 'wmic process where name="' + i + '" CALL setpriority "256"'
print(process_change)
os.system(process_change)
os.system('cls')

def process():
realpriority()
#highpriority()
#normalpriority()
lowpriority()
return("All processes set correctly.")

print("\033[1;37;40mGD Optimizer Version", version , "\n\033[1;31;40mWarning: You will need to relaunch \nthis everytime you open GD, or join a new discord call.", "\033[1;37;40m\n" + process())
print("Running Temp Cleaner...")
time.sleep(3)

for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
indexNo = file_path.find('\\')
itemName = file_path[indexNo+1:]
try:
if os.path.isfile(file_path):
os.unlink(file_path)
print( '%s file deleted' % itemName )
deleteFileCount = deleteFileCount + 1

elif os.path.isdir(file_path):
if file_path.__contains__('chocolatey'): continue
shutil.rmtree(file_path)
print( '%s folder deleted' % itemName )
deleteFolderCount = deleteFolderCount + 1

except Exception as e:
print('Access Denied: %s' % itemName )

print(str(deleteFileCount)+' files and '+ str(deleteFolderCount)+' folders deleted.')
time.sleep(1)
print("Closing in 5 seconds...")
import os
import time
import shutil

folder = 'C:/Users/'+os.getlogin()+'/AppData/Local/Temp'

deleteFileCount = 0
deleteFolderCount = 0

big_ver = "1"
mini_ver = ".1.0"
version = "(" + big_ver + mini_ver + ")"

"""
Priority Level Value Priority Level Name
256 Realtime
128 High
32768 Above normal
32 Normal
16384 Below normal
64 Low
"""

# sets these processes to their respective priorities
low = ["Discord.exe", "steamwebhelper.exe", "firefox.exe", "chrome.exe"]
normal = []
high = []
real = ["GeometryDash.exe"]

def lowpriority():
for i in low:
process_change = 'wmic process where name="' + i + '" CALL setpriority "64"'
print(process_change)
os.system(process_change)
os.system('cls')

def normalpriority():
for i in normal:
process_change = 'wmic process where name="' + i + '" CALL setpriority "32"'
print(process_change)
os.system(process_change)
os.system('cls')

def highpriority():
for i in high:
process_change = 'wmic process where name="' + i + '" CALL setpriority "128"'
print(process_change)
os.system(process_change)
os.system('cls')

def realpriority(): # sets to high for some reason lmfao
for i in real:
process_change = 'wmic process where name="' + i + '" CALL setpriority "256"'
print(process_change)
os.system(process_change)
os.system('cls')

def process():
realpriority()
#highpriority()
#normalpriority()
lowpriority()
return("All processes set correctly.")

print("\033[1;37;40mGD Optimizer Version", version , "\n\033[1;31;40mWarning: You will need to relaunch \nthis everytime you open GD, or join a new discord call.", "\033[1;37;40m\n" + process())
print("Running Temp Cleaner...")
time.sleep(3)

for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
indexNo = file_path.find('\\')
itemName = file_path[indexNo+1:]
try:
if os.path.isfile(file_path):
os.unlink(file_path)
print( '%s file deleted' % itemName )
deleteFileCount = deleteFileCount + 1

elif os.path.isdir(file_path):
if file_path.__contains__('chocolatey'): continue
shutil.rmtree(file_path)
print( '%s folder deleted' % itemName )
deleteFolderCount = deleteFolderCount + 1

except Exception as e:
print('Access Denied: %s' % itemName )

print(str(deleteFileCount)+' files and '+ str(deleteFolderCount)+' folders deleted.')
time.sleep(1)
print("Closing in 5 seconds...")
time.sleep(5)
48 changes: 48 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/MenuLayer.hpp>
#include <Geode/modify/PlayLayer.hpp>

using namespace geode::prelude;
bool optimizerState;

std::array lowPriority = {"Discord.exe", "steamwebhelper.exe", "firefox.exe", "chrome.exe"};

class $modify(optimizerLayer, MenuLayer) {
bool init() {
if (!MenuLayer::init()) return false;
optimizerState = Mod::get()->getSavedValue<bool>("state", true);

auto optimizerButton = CCMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_reportBtn_001.png"), this, menu_selector(optimizerLayer::optimizerDisplay));
auto menu = this->getChildByID("bottom-menu");

menu->addChild(optimizerButton);
menu->updateLayout();
optimizerButton->setID("xanii.gd_optimizer/button");

return true;
}

void optimizerDisplay(CCObject*) {
if (optimizerState) createQuickPopup("GD Optimizer", "GD Optimizer is currently <cg>enabled</c>.\nWould you like to <cr>disable</c> GD Optimizer?", "Cancel", "Disable", [this](FLAlertLayer*, bool btn2) {
if (btn2) optimizerState = false;
});
else createQuickPopup("GD Optimizer", "GD Optimizer is currently <cr>disabled</c>.\nWould you like to <cg>enable</c> GD Optimizer?", "Cancel", "Enable", [this](FLAlertLayer*, bool btn2) {
if (btn2) optimizerState = true;
});
Mod::get()->setSavedValue<bool>("state", optimizerState);
}
};

class $modify(PlayLayer) {
bool init(GJGameLevel* level, bool useReplay, bool dontCreateObjects) {
if (!PlayLayer::init(level, useReplay, dontCreateObjects)) return false;
if (optimizerState) {
for (int i = 0; i < sizeof(lowPriority)/sizeof(lowPriority[0]); i++) {
std::string systemCommand = fmt::format("wmic process where name=\"{}\" CALL setpriority \"64\"", lowPriority[i]);
system(systemCommand.c_str());
log::info("{}", lowPriority[i]);
}
}
return true;
}
};

0 comments on commit e8385ed

Please sign in to comment.