51 Commits
Author SHA1 Message Date
khanhduytran0 bc36365994 Fix: replace all currentWindow() with static variable 2024-08-16 09:51:34 +07:00
khanhduytran0 84c63b5576 Fix[controls]: bump version 2024-07-15 22:00:58 +07:00
Antoine 060b11f9c5 Add check to make sure private property exists before modifying (otherwise program crashes) (#698) 2024-06-07 17:50:31 +07:00
khanhduytran0 299b03d51b Feat[controls]: add option to hide from screen recording
Huge thanks to @NSAntoine for https://nsantoine.dev/posts/CALayerCaptureHiding
2024-06-07 16:40:27 +07:00
khanhduytran0 faadb6081b Fix json error parsing 2024-02-15 05:42:18 +07:00
khanhduytran0 54fb8a346d Workaround[dynamic position]: replace dp: and px: calls with direct find-and-replace
Certain iOS versions don't like when expression tries to call either dp: or px:
2023-09-28 13:49:34 +07:00
khanhduytran0 c250b4436c Fix[joystick]: handle key press when it is held only 2023-08-26 07:06:24 +07:00
khanhduytran0 96b112cd1d Fix[controls]: handle uninited data list, potential crash 2023-08-17 21:12:57 +07:00
Duy Tran Khanh 36c3e312f3 Feat[controls]: v3: joystick & conditonal visibility
- Finish joystick view
+ Finish forward lock
+ When in menu, oystick can be used to move the virtual mouse
- Finish conditonal visibility
- Replace Make Default with Load
2023-08-11 20:58:14 +07:00
Duy Tran Khanh 5a0ead1d8f Feat[control]: allow resizing free drawers' subbuttons 2023-08-03 08:17:13 +07:00
khanhduytran0 6cf61e62c0 Feats: preference isolation & profile management
- Rewrote LauncherPreferences -> PLPreferences
 + Now the file layout is the same as UI layout
 + (get/set)Preference are replaced with corresponding get/set types + Getting/setting is now done through keyPath instead of manually iterating over subdictionaries.
 + Implemented an isolation layer, allowing an instance to have its own settings. This is off by default

- Implemented launcher_profiles
 + Added Profile manager that can be accessed from the sidebar
 + Moved "Game directory (instances)" to this screen
 + Replaced version selector with profile selector. Version selector is moved into profile editor.

- Other changes
 + Cleanup code by using NSPredicate instead of huge for loops
 + Titles in settings are made multilined
 + Controller config: replaced bar button items with localized ones

Due to how large the changes are, this is committed directly to the mainline branch. Bugs are expected to be found (although I did enough tests for this locally)
2023-07-06 13:59:07 +07:00
Duy Tran KhanhandDuy Tran Khanh 8d6d66dd94 Feats: external runtime, update LWJGL to 3.3.1 (#579)
* Feat: external runtime manager

Currently missing: mmap hook

* we're past this ui todo

* feat: Bypass Library Validation (untested)

This bypass works because of JIT enabled, so the process can patch
anything loaded in the memory. Unsigned dylib works with JIT too.

* Fix `could not get real path` on iOS 14.x

iOS 15+ is untested, it may need patching in dyld instead of libSystem

* Make redirectFunction syscall-friendly

Replaced builtin_mprotect and vm_protect with a simple syscall to
_kernelrpc_mach_vm_protect_trap

* Add dyld hook back for iOS 15+, auto symlink xawt lib

* Cleanup Tools.java:showError+comments

Use System.exit(1) to drop to Game Exited screen instead of presenting
alert dialog on exception handled.

* Patch both to bypass codesigning at best

* Proper way of ignoring SIGBUS during patch

Turns out other background thread might also be calling inside dirty
page, so let's SIG_IGN them all until page permission is back to RX.

* Feat(install jar): auto detect java version

Rename Default version to Preferred version to match the behavior or
Install .jar detection: only override if selected version > required
version.
Add UnzipKit just to check jar file

Refactor(showDialog): remove viewController parameter, now use its own
ViewController to present.

* Feat: update LWJGL to 3.3.1
(tinygl4angle) add alias for GL_KHR_debug functions
Include nanovg for OneConfig mod
Move all LWJGLX classes to lwjgl3 repo
Set org.lwjgl.util.NoChecks=true to improve performance

* Fix: Forge 1.20 crashes (wrong artifact path)
Now use json-provided artifact path instead of generating one
Make lwjgl fat jar again

* Fix: handle null library artifact

* Fix: fatal glfw callback cleanup

* Build: fix copying LWJGL libraries

* Perf: set default settings

* Fix: incorrect SolClient useStackQueue check

* Feat: builtin runtime installer

Refactor parts of LauncherNavigationController.m
Workaround(LogView): disable animation on update to mitigate overload

* Fix: random game directory failures

This is caused by having current working directory unchanged after
re-making symlink.

* Fixes: TL-style artifact, update arc_dns_injector

Change pojavInit names

* Fix: 1.13+ isUseStackQueueCall check

* Build: update liblwjgl.dylib in attempt to fix ffi_closure_alloc

* Fix and improvements to the logger

- Dynamically get stdout/stderr fileno instead of fixed value
- Improve file migration logging
- Improve dyld bypass logging

* Fix(pickers): file permission issue

---------

Co-authored-by: Duy Tran Khanh <[email protected]>
2023-06-28 21:49:15 +07:00
Duy Tran Khanh dc6dd283ab Fix(controls->dynamic_pos): add missing functions
Apple's NSExpression doesn't come with those functions by default,
while exp4j's ExpressionBuilder do. This commit adds missing functions
to fix certain controls fail to load.
2023-05-27 20:50:48 +07:00
Duy Tran Khanh dad9667a34 Fix(controls): drawer buttons not updating 2023-05-26 19:06:34 +07:00
Duy Tran Khanh 9fdfcf96e3 Fix: only reload controls when needed 2023-05-21 19:00:49 +07:00
Duy Tran Khanh 09f3f68763 Remove Fullscreen button from default control map
Since the window size issue in old version was resolved, this button is no longer needed, plus enabling fullscreen would prevent version < 1.13 from resizing.
2023-04-27 17:30:11 +07:00
Duy Tran Khanh 04f2fa566c didn’t remove mouse_* from mMenuMappingList
(Fix: save prompt appears even though there is nothing changed)
2023-04-22 05:42:59 +07:00
Duy Tran Khanh bcfc13a4f1 Major cleanup for the controller config vc
- Cleanup unused parts
- Cleanup complicated dictionary constructions
- Fix lag spikes during scrolling in this screen

Allow audio settings to be changed ingame
2023-04-19 19:12:32 +07:00
Eilionoir Tunnicliff bcdcc080fb Controller configurator!
Same keycode names as the on-screen editor to make it easier to identify the possible values. Xbox and PlayStation button names for familiarity. Saving configs handled by the Save and Exit buttons on the navigation bar.

Currently known issues:
- may be jumpy when cells reload or load onto the screen
- loading a new configuration file does not update the value of the cells
- loading a new configuration file does not update the "Controller configurator" item in the main Settings window
	- both of these are solved by closing and reopening the view controller for now
2023-03-21 10:52:16 -04:00
Eilionoir Tunnicliff 100b3be62c WIP Haptic feedback for buttons, taps and scrolls
Haptics in iOS require a second-generation or newer Taptic Engine (sorry iPhone 6s users). Also move gamepad configs to controlmap/gamepads (you'll see why if you open the Load menu in the custom controls vc)
2023-03-16 20:11:29 -04:00
Eilionoir Tunnicliff d8c2c68237 Changes
- Move controller init code to a file for the controller configurator code I'm working on locally
- Add option to limit framerate to 60FPS on ProMotion-enabled displays
2023-03-16 02:47:03 -04:00
Duy Tran Khanh 56bd77735c Refactoring: move initKeycodeTable to CCUtils 2023-03-05 21:45:17 +07:00
khanhduytran0 b0203d6fc7 Text input for jar launcher, update lib, fixes
News
- Added text input support for jar launcher.
- Updated MoltenVK to https://github.com/KhronosGroup/MoltenVK/commit/d880f4c

Internal changes
- Added more handling cases to avoid missing call to pojav_initOpenGL()
- Moved custom control’s global functions and properties to ControlLayout.
- Moved dylib framework outside its folder, as it’s not necessary to be bundled in framework.
- Reusing custom controls to produce flexible buttons in jar launcher, which might be extended in the future.

Fixes
- Multistage text input (Japanese, Chinese, etc) should now work again.
- Pointer lock should now function properly again.

- Updated README.md to reflect current stuff
2023-01-19 09:54:55 +07:00
Duy Tran Khanh 27924ca870 Changes to custom controls
Allow saving to default.json
Put custom controls editor to in-game menu
Localization
2022-12-06 18:27:11 +07:00
Duy Tran Khanh 414a787f38 Tweak: live custom controls editor
Removed Dynamic Position settings as it's automated by snapping.
2022-11-20 10:49:14 +07:00
khanhduytran0 32148d2bff Implement undo/redo for custom controls editor 2022-11-07 18:28:12 +07:00
Duy Tran Khanh 8d26ed38d7 Custom controls: make toggleable functional
Fixes #378
2022-09-10 18:28:09 +07:00
Duy Tran Khanh 292fb8166f Custom controls: safe area is now customizable
Other changes:
- Cleanup unused functions
- Internal changes to access ViewController globally
- Moved ControlLayout to a separate file
2022-08-03 12:23:27 +07:00
Duy Tran Khanh e1ff27c298 Fixes button scaling; Logging header cleanup 2022-07-02 11:42:22 +07:00
Duy Tran Khanh ee2c68fb98 Fixes
Makefile: fix path
Moved GameSurfaceView to a separate class
Renamed MinecraftDownloader to MinecraftResourceUtils

Fix: Some versions fails because GLFW_CLIENT_API is not set
2022-07-01 07:02:25 +07:00
khanhduytran0 bf12743457 Moved the JVM entry point to start when needed 2022-05-27 05:48:25 +07:00
khanhduytran0 1d7e8a8214 Experimental Minecraft Downloader
This is not yet finished, there are 3 main things left
- Make sure everything works
- (Assets) download old structure
- Cleanup

What are implemented?
- Downloading file is handled with AFNetworking
- SHA1 validation, can be turned off in Preferences
- inheritsFrom support (need testing)
- Downloading assets with 20 jobs parallel

Known issue
- Assets SHA1 validating freezes the UI

Additional things
- [Custom controls] Dynamic position error is now handled instead of just crashes
- [Custom controls] The editor animation is now changed to fade in/out (for now, later might change)
- VGPU renderer is now made hidden, since it's too limited on iOS, removal planned
- [Code cleanup] Use NSDictionary instead of a set of fields for renderer list; Fix wrong field name.
- Some more stuff...
2022-04-20 20:45:47 +07:00
Duy Tran Khanh 7d14371271 Custom control editor changes
- Added the resize pointer (might not work stable)
- (Attempt to) fix the wrong size of the window on iPadOS again
- The window now has a rounded corner
2022-03-23 21:32:13 +07:00
Duy Tran Khanh 5c618d907b CC: passthrough support; Lock mouse pointer
Custom controls button passthrough: currently, only passed-through
events are touch events.
Pointer locking is incomplete and might not work properly.
2022-03-03 08:16:14 +07:00
Duy Tran KhanhandDuy Tran Khanh 33cb7d0125 Custom Controls revisions implemenation (#292)
* Move control loaders to CustomControlsUtils.m

* WIP Drawer support (currently broken)

Also, updated MetalANGLE for helping debug stuff on crash.

* temp

* ControlDrawer: free orientation

* Avoid scrolling the hotbar in grab mode

* Popover: fix the frame inside the arrow

* Changes

- Attempt to allow Microsoft login when offline.
- Custom controls: drawer and sub-buttons are now visible.
- Pickers in Preferences: pre-select at the saved index.

* Bump version code to 4, hide sub-button by default

* Fix text trucanting

* impl scroll buttons, rewrite some parts to objc

* Virtual mouse implementation

Also, possible fix for popover crashes on iPad

Exception type: NSInternalInconsistencyException
> Reason: Tried to set <UIBarButtonItem: 0x10fee5660> menuOnTouchDown
menu=0x2810dce10 image=<UIImage:0x280149050 symbol(system:
ellipsis.circle) {20, 19} baseline=3.5,contentInsets={1, 1.5, 1,
1.5},alignmentRectInsets={-0.5, 0, -0.5, 0}
config=<traits=(UserInterfaceIdiom = Pad, DisplayScale = 2,
DisplayGamut = sRGB, HorizontalSizeClass = Regular, VerticalSizeClass
= Regular, UserInterfaceStyle = Dark, UserInterfaceLayoutDirection =
LTR, PreferredContentSizeCategory = L, AccessibilityContrast =
Normal)>> as sourceView of
<_UIAlertControllerActionSheetRegularPresentationController:
0x12043f5a0>, even though it is not a kind of UIView.

* Swap item between hands by double-tap item moment

* Basic editor (only several stuff implemented)

There's no save/load yet, so it's just a preview for now.

* Control editor (preview only)
TODO: Color picker for iOS < 14

* Save, load and set default are here

* Changes

- Ported Snap and Align from Android
- Added options: create and delete button

TODO:
- color picker for iOS < 14
- drawer editor
- maybe more

* Editor: Added orientation changer for drawer

Added some more check to determine whether dynamic position should be
visible (when the button is not a sub-button, or the parent drawer
doesn't use the FREE orientation)

* Editor: implemented adding drawer and sub-button

* Added a warning about unfinished custom controls

Co-authored-by: Duy Tran Khanh <[email protected]>
2021-11-26 10:35:21 +07:00
Duy Tran KhanhandDuy Tran Khanh db0074d1e5 Merge custom control changes (#284)
* Move control loaders to CustomControlsUtils.m

* WIP Drawer support (currently broken)

Also, updated MetalANGLE for helping debug stuff on crash.

* temp

* ControlDrawer: free orientation

* Avoid scrolling the hotbar in grab mode

* Popover: fix the frame inside the arrow

* Changes

- Attempt to allow Microsoft login when offline.
- Custom controls: drawer and sub-buttons are now visible.
- Pickers in Preferences: pre-select at the saved index.

* Bump version code to 4, hide sub-button by default

* Fix text trucanting

* impl scroll buttons, rewrite some parts to objc

* Virtual mouse implementation

Also, possible fix for popover crashes on iPad

Exception type: NSInternalInconsistencyException
> Reason: Tried to set <UIBarButtonItem: 0x10fee5660> menuOnTouchDown
menu=0x2810dce10 image=<UIImage:0x280149050 symbol(system:
ellipsis.circle) {20, 19} baseline=3.5,contentInsets={1, 1.5, 1,
1.5},alignmentRectInsets={-0.5, 0, -0.5, 0}
config=<traits=(UserInterfaceIdiom = Pad, DisplayScale = 2,
DisplayGamut = sRGB, HorizontalSizeClass = Regular, VerticalSizeClass
= Regular, UserInterfaceStyle = Dark, UserInterfaceLayoutDirection =
LTR, PreferredContentSizeCategory = L, AccessibilityContrast =
Normal)>> as sourceView of
<_UIAlertControllerActionSheetRegularPresentationController:
0x12043f5a0>, even though it is not a kind of UIView.

Co-authored-by: Duy Tran Khanh <[email protected]>
2021-10-15 05:16:17 +07:00
Duy Tran Khanh 2c8067dc21 Clean some debug prints 2021-08-30 07:41:23 +07:00
Duy Tran Khanh 49125524d3 Preliminary support for v2 (code 3) control
TODO:
- Control editor
- Implement Drawer

FIXME:
-[MGLLayer init] crashes. Maybe replace with CAMetalLayer?
2021-08-30 07:13:39 +07:00
Duy Tran Khanh 972caa4f03 Move the fullscreen button 2021-08-16 15:53:31 +07:00
Duy Tran Khanh 66bee901db Layout converter v1 -> unfinished v2
"i want new keyboard for pojavluancher" x20 by @𝙵𝚊𝚔ȇ̈_A𝕣ᴄᴀᴅᴇ#7200
2021-08-07 10:17:52 +07:00
Duy Tran Khanh f2566e3da5 Basic mod installer implementation 2021-08-03 16:06:32 +07:00
Duy Tran Khanh 0668d016bf Changes
- Added Caciocavallo (libawt_xawt stubs) support library.
- Added support lauching Minecraft 1.5.2 and older (requires latest
JRE8 build)
- [Custom controls] Implemented opacity property.
- Version info is now updated through macro instead of `sed` command.
2021-08-01 10:41:02 +07:00
Duy Tran Khanh 750aea7932 Forgot to add background color for default control
:trollface:
2021-07-24 07:27:26 +07:00
Duy Tran Khanh 5c0e81a7f8 Change default control size 2021-07-24 06:14:53 +07:00
Duy Tran Khanh c896da08bb A lot of more changes
* Custom controls:
- Unfinished v2 control
- Auto generate default.json, removed internal fallback control
- Compatible with Android's dp (might need scaling)
- Implemented properties: keycodes, bgColor, strokeColor, strokeWidth,
cornerRadius

* Other changes
- Updated MetalANGLE to 0.0.7
- Updated gl4es 1.1.5

* TODO:
- Control converter
- Drawer buttons
- Multiple keys support (?)
- Implement properties: opacity, isSwipeable, isToggle,
passThruEnabled, (maybe more?)
2021-07-23 16:51:51 +07:00
Duy Tran Khanh 11e11a6ccf [Unfinished] Custom controls implementation 2021-07-19 20:02:58 +07:00
Duy Tran Khanh 255e896fdc Changes
* Bug fixes:
- Duplicate version in picker list.
- Version list does not get automatic updated.
- Version picker does not scroll to the current selected version.

* Code changes.
2021-06-19 09:49:23 +07:00
Duy Tran Khanh 3be87bfa46 Changes
- Added preferences screen (currently empty)
- Cleaned compiler warnings
- Implemented GLFW clipboard
2021-05-24 20:50:40 +07:00
Duy Tran Khanh fc19e16e4f Custom controls implementation changes
- Fallback to default control if custom control data size is over 100kb.
- Implemented dynamic position.
- Renamed folder from `customcontrols` to `controlmap` to match
Android.
2021-04-22 17:46:18 +07:00
Duy Tran Khanh 6005ae7206 Stills attempting to hide home indicator
Also, fixed custom controls
2021-03-20 19:39:13 +07:00