Skip to content

Commit bbde330

Browse files
Improve UI
1 parent d4da6eb commit bbde330

14 files changed

+144
-112
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Using
2+
3+
- Open MacSplit
4+
- Enter your admin password (MacSplit needs the admin password to read Celeste's game memory
5+
- Open Celeste *but don't open any maps*
6+
- Click "Connect" in
7+
8+
# Splits JSON
9+
10+
Splits are configured using a JSON file and use "events" generated by MacSplit.Celeste. They consist of a reset event
11+
and a list of route events. Unlike the route, which listens for events in a specific order, the reset event can trigger
12+
at any point during the route. Each entry in the
13+
14+
```json
15+
{
16+
"useFileTime": false,
17+
"reset": "reset chapter",
18+
"route": [
19+
"start chapter 2",
20+
"d8 > d3",
21+
"3x > 3",
22+
"8 > 9",
23+
"10 > 2",
24+
"12 > 13",
25+
"complete chapter 2"
26+
]
27+
}
28+
```
29+
30+
The currently defined events are (`<...>` indicates a fill-in parameter):
31+
- `start chapter <n>` - Triggered when the specified chapter number is started
32+
- `reset chapter` - Triggered when the current chapter is reset (either by restarting the chapter or exiting to the map)
33+
- `complete chapter <n>` - Triggered when the specified chapter number is completed
34+
- `<from screen> > <to screen>` - Triggered when transitioning between two screens (you can find the screen IDS by
35+
looking at the `Level: Name:` when connected to Celeste, or by enabling debug and hovering over the screen in the map
36+
editor.
37+
38+
Note that the *exact* text is important. Spaces and capitalization have to match. Also, inserting an exclamation point
39+
(`!`) at the beginning of an event will cause that event to not trigger a split. This can be useful when your route
40+
passes between two screens multiple times but you only want one split.

SwiftSplit.xcodeproj/project.pbxproj

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
CD7CDC01256F5DFC002AE46F /* CelesteEventGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7CDBFB256F5DFC002AE46F /* CelesteEventGenerator.swift */; };
1818
CD7CDC03256F626D002AE46F /* LiveSplitServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7CDC02256F626D002AE46F /* LiveSplitServer.swift */; };
1919
CD7CDC05256F7304002AE46F /* MultiClientWebSocketServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7CDC04256F7304002AE46F /* MultiClientWebSocketServer.swift */; };
20+
CD7CDC2825717D2D002AE46F /* CelesteSplitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7CDC2725717D2D002AE46F /* CelesteSplitter.swift */; };
2021
DB56D9F05D0BC5B4DE4CECC8 /* Pods_SwiftSplit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CF09341B2ECF29501B823DEC /* Pods_SwiftSplit.framework */; };
2122
/* End PBXBuildFile section */
2223

@@ -38,6 +39,7 @@
3839
CD7CDBFD256F5DFC002AE46F /* memory_scanner.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memory_scanner.c; sourceTree = "<group>"; };
3940
CD7CDC02256F626D002AE46F /* LiveSplitServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveSplitServer.swift; sourceTree = "<group>"; };
4041
CD7CDC04256F7304002AE46F /* MultiClientWebSocketServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiClientWebSocketServer.swift; sourceTree = "<group>"; };
42+
CD7CDC2725717D2D002AE46F /* CelesteSplitter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CelesteSplitter.swift; sourceTree = "<group>"; };
4143
CF09341B2ECF29501B823DEC /* Pods_SwiftSplit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftSplit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4244
E1C15A185F4552F09EFE4D9D /* Pods-SwiftSplit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSplit.release.xcconfig"; path = "Target Support Files/Pods-SwiftSplit/Pods-SwiftSplit.release.xcconfig"; sourceTree = "<group>"; };
4345
/* End PBXFileReference section */
@@ -95,26 +97,27 @@
9597
CD7CDC06256F8A21002AE46F /* Core */,
9698
CD7CDBE4256F5D0D002AE46F /* AppDelegate.swift */,
9799
CD7CDBE6256F5D0D002AE46F /* ViewController.swift */,
100+
CD7CDC2725717D2D002AE46F /* CelesteSplitter.swift */,
98101
CD7CDBE8256F5D0F002AE46F /* Assets.xcassets */,
99102
CD7CDBEA256F5D0F002AE46F /* Main.storyboard */,
100103
CD7CDBED256F5D0F002AE46F /* Info.plist */,
101104
CD7CDBEE256F5D0F002AE46F /* SwiftSplit.entitlements */,
102105
CD7CDBF4256F5DDB002AE46F /* SwiftSplit-Bridging-Header.h */,
103106
CD7CDBFC256F5DFC002AE46F /* CelesteMemoryLayout.md */,
104-
CD7CDC02256F626D002AE46F /* LiveSplitServer.swift */,
105-
CD7CDC04256F7304002AE46F /* MultiClientWebSocketServer.swift */,
106107
CD7CDBF9256F5DFC002AE46F /* CelesteScanner.swift */,
107108
CD7CDBFB256F5DFC002AE46F /* CelesteEventGenerator.swift */,
108-
CD7CDBFD256F5DFC002AE46F /* memory_scanner.c */,
109-
CD7CDBFA256F5DFC002AE46F /* memory_scanner.h */,
110-
CD7CDBF8256F5DFC002AE46F /* MemoryScanner.swift */,
111109
);
112110
path = SwiftSplit;
113111
sourceTree = "<group>";
114112
};
115113
CD7CDC06256F8A21002AE46F /* Core */ = {
116114
isa = PBXGroup;
117115
children = (
116+
CD7CDBFD256F5DFC002AE46F /* memory_scanner.c */,
117+
CD7CDBFA256F5DFC002AE46F /* memory_scanner.h */,
118+
CD7CDBF8256F5DFC002AE46F /* MemoryScanner.swift */,
119+
CD7CDC02256F626D002AE46F /* LiveSplitServer.swift */,
120+
CD7CDC04256F7304002AE46F /* MultiClientWebSocketServer.swift */,
118121
);
119122
path = Core;
120123
sourceTree = "<group>";
@@ -242,6 +245,7 @@
242245
CD7CDBFF256F5DFC002AE46F /* CelesteScanner.swift in Sources */,
243246
CD7CDC05256F7304002AE46F /* MultiClientWebSocketServer.swift in Sources */,
244247
CD7CDBE5256F5D0D002AE46F /* AppDelegate.swift in Sources */,
248+
CD7CDC2825717D2D002AE46F /* CelesteSplitter.swift in Sources */,
245249
);
246250
runOnlyForDeploymentPostprocessing = 0;
247251
};

SwiftSplit.xcodeproj/xcshareddata/xcschemes/SwiftSplit.xcscheme

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
buildConfiguration = "Debug"
3535
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
3636
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37-
debugAsWhichUser = "root"
3837
launchStyle = "0"
3938
useCustomWorkingDirectory = "NO"
4039
ignoresPersistentStateOnLaunch = "NO"

SwiftSplit/Base.lproj/Main.storyboard

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -712,23 +712,23 @@
712712
<autoresizingMask key="autoresizingMask"/>
713713
<subviews>
714714
<customView translatesAutoresizingMaskIntoConstraints="NO" id="K0D-5p-Mzb">
715-
<rect key="frame" x="138" y="92" width="205" height="21"/>
715+
<rect key="frame" x="79" y="92" width="323" height="21"/>
716716
<subviews>
717717
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bys-Uk-4ve">
718-
<rect key="frame" x="-6" y="-7" width="114" height="32"/>
718+
<rect key="frame" x="-6" y="-7" width="92" height="32"/>
719719
<constraints>
720720
<constraint firstAttribute="height" constant="21" id="xLl-gM-ObY"/>
721721
</constraints>
722-
<buttonCell key="cell" type="push" title="Find Header" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="tuf-xd-Wjg">
722+
<buttonCell key="cell" type="push" title="Connect" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="tuf-xd-Wjg">
723723
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
724724
<font key="font" metaFont="system"/>
725725
</buttonCell>
726726
<connections>
727-
<action selector="findHeader:" target="XfG-lQ-9wD" id="loM-tV-bKL"/>
727+
<action selector="connect:" target="XfG-lQ-9wD" id="loM-tV-bKL"/>
728728
</connections>
729729
</button>
730730
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ldW-cj-q2x">
731-
<rect key="frame" x="104" y="-7" width="107" height="32"/>
731+
<rect key="frame" x="82" y="-7" width="107" height="32"/>
732732
<constraints>
733733
<constraint firstAttribute="height" constant="21" id="2lC-my-0MZ"/>
734734
</constraints>
@@ -740,30 +740,46 @@
740740
<action selector="loadSplits:" target="XfG-lQ-9wD" id="IOT-IZ-asz"/>
741741
</connections>
742742
</button>
743+
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DL0-IX-MzM">
744+
<rect key="frame" x="185" y="-7" width="144" height="32"/>
745+
<constraints>
746+
<constraint firstAttribute="height" constant="21" id="iaK-MW-hAe"/>
747+
</constraints>
748+
<buttonCell key="cell" type="push" title="Copy Server URL" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OZO-lf-Lw5">
749+
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
750+
<font key="font" metaFont="system"/>
751+
</buttonCell>
752+
<connections>
753+
<action selector="copyServerUrl:" target="XfG-lQ-9wD" id="RiN-an-LcG"/>
754+
</connections>
755+
</button>
743756
</subviews>
744757
<constraints>
758+
<constraint firstItem="DL0-IX-MzM" firstAttribute="leading" secondItem="ldW-cj-q2x" secondAttribute="trailing" constant="8" id="FwI-hO-OWp"/>
759+
<constraint firstAttribute="trailing" secondItem="DL0-IX-MzM" secondAttribute="trailing" id="GrN-Sr-77F"/>
745760
<constraint firstItem="ldW-cj-q2x" firstAttribute="leading" secondItem="Bys-Uk-4ve" secondAttribute="trailing" constant="8" id="KY8-bL-VwH"/>
746761
<constraint firstItem="ldW-cj-q2x" firstAttribute="top" secondItem="K0D-5p-Mzb" secondAttribute="top" id="WIo-Sv-4IT"/>
747-
<constraint firstAttribute="trailing" secondItem="ldW-cj-q2x" secondAttribute="trailing" id="lX7-Ra-cdw"/>
762+
<constraint firstItem="DL0-IX-MzM" firstAttribute="top" secondItem="K0D-5p-Mzb" secondAttribute="top" id="grH-DI-vsj"/>
763+
<constraint firstAttribute="bottom" secondItem="DL0-IX-MzM" secondAttribute="bottom" id="sOo-Ke-Ill"/>
748764
<constraint firstItem="Bys-Uk-4ve" firstAttribute="leading" secondItem="K0D-5p-Mzb" secondAttribute="leading" id="smt-Yv-Q3H"/>
749765
<constraint firstItem="Bys-Uk-4ve" firstAttribute="top" secondItem="K0D-5p-Mzb" secondAttribute="top" id="w1l-0h-bPW"/>
750766
<constraint firstAttribute="height" constant="21" id="wNg-ht-MPb"/>
751767
</constraints>
752768
</customView>
753769
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8ue-EI-oPc">
754-
<rect key="frame" x="425" y="20" width="37" height="16"/>
755-
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="aEg-Gi-Gd9">
770+
<rect key="frame" x="327" y="20" width="135" height="16"/>
771+
<textFieldCell key="cell" lineBreakMode="clipping" title="Route config: &lt;none&gt;" id="aEg-Gi-Gd9">
756772
<font key="font" metaFont="system"/>
757773
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
758774
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
759775
</textFieldCell>
760776
</textField>
761777
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PvB-8z-yhJ">
762-
<rect key="frame" x="222" y="68" width="37" height="16"/>
778+
<rect key="frame" x="193" y="68" width="94" height="16"/>
763779
<constraints>
764780
<constraint firstAttribute="height" constant="16" id="iOX-DW-DCA"/>
765781
</constraints>
766-
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="ckk-vz-eGP">
782+
<textFieldCell key="cell" lineBreakMode="clipping" title="Not connected" id="ckk-vz-eGP">
767783
<font key="font" metaFont="system"/>
768784
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
769785
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -777,9 +793,6 @@
777793
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
778794
</textFieldCell>
779795
</textField>
780-
<progressIndicator wantsLayer="YES" maxValue="100" displayedWhenStopped="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="dLP-Qc-X57">
781-
<rect key="frame" x="353" y="95" width="16" height="16"/>
782-
</progressIndicator>
783796
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="b1e-xt-GQZ">
784797
<rect key="frame" x="18" y="20" width="37" height="16"/>
785798
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="Qn0-Na-ias">
@@ -791,13 +804,11 @@
791804
</subviews>
792805
<constraints>
793806
<constraint firstItem="8ue-EI-oPc" firstAttribute="top" secondItem="b1e-xt-GQZ" secondAttribute="top" id="3qN-mO-agB"/>
794-
<constraint firstItem="dLP-Qc-X57" firstAttribute="centerY" secondItem="K0D-5p-Mzb" secondAttribute="centerY" id="KSC-Kp-hXd"/>
795807
<constraint firstItem="b1e-xt-GQZ" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" constant="20" id="KyO-hK-buF"/>
796808
<constraint firstItem="PvB-8z-yhJ" firstAttribute="centerX" secondItem="m2S-Jp-Qdl" secondAttribute="centerX" id="NPF-dV-ETX"/>
797809
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="8ue-EI-oPc" secondAttribute="bottom" constant="20" id="Xcn-M8-Rti"/>
798810
<constraint firstItem="K0D-5p-Mzb" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="20" id="Zv6-rr-DxS"/>
799811
<constraint firstItem="6HK-T3-n61" firstAttribute="top" secondItem="PvB-8z-yhJ" secondAttribute="bottom" constant="8" id="h0e-Aa-dG0"/>
800-
<constraint firstItem="dLP-Qc-X57" firstAttribute="leading" secondItem="K0D-5p-Mzb" secondAttribute="trailing" constant="10" id="jkA-7p-Jgz"/>
801812
<constraint firstItem="8ue-EI-oPc" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="b1e-xt-GQZ" secondAttribute="trailing" constant="8" id="q1B-vx-m9d"/>
802813
<constraint firstItem="K0D-5p-Mzb" firstAttribute="centerX" secondItem="m2S-Jp-Qdl" secondAttribute="centerX" id="qVB-JD-nHh"/>
803814
<constraint firstAttribute="trailing" secondItem="8ue-EI-oPc" secondAttribute="trailing" constant="20" id="qoR-vH-H10"/>
@@ -811,7 +822,6 @@
811822
<outlet property="infoLabel" destination="b1e-xt-GQZ" id="iDP-Ku-O7J"/>
812823
<outlet property="routeLabel" destination="8ue-EI-oPc" id="BDr-aH-3zV"/>
813824
<outlet property="signatureLabel" destination="PvB-8z-yhJ" id="lAk-c0-U2y"/>
814-
<outlet property="timerRunningIndicator" destination="dLP-Qc-X57" id="pmN-6d-c1L"/>
815825
</connections>
816826
</viewController>
817827
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>

SwiftSplit/CelesteEventGenerator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CelesteEventGenerator {
4040
events.append("reset chapter")
4141
}
4242
if new.chapterComplete && !old.chapterComplete {
43-
events.append("complete chapter")
43+
events.append("complete chapter \(old.chapter)")
4444
}
4545
return events
4646
}

SwiftSplit/CelesteScanner.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
import Foundation
1010

11+
/**
12+
Scans for and interprets the Celeste AutoSplitterInfo
13+
*/
1114
class CelesteScanner {
1215
var enableDebugPrinting: Bool = false
1316

SwiftSplit/CelesteSplitter.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// CelesteSplitter.swift
3+
// SwiftSplit
4+
//
5+
// Created by Pierce Corcoran on 11/27/20.
6+
// Copyright © 2020 Pierce Corcoran. All rights reserved.
7+
//
8+
9+
import Foundation

SwiftSplit/MemoryScanner.swift renamed to SwiftSplit/Core/MemoryScanner.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import Foundation
1010

1111
enum MemscanError : Error {
12-
case errorGettingTask(result: kern_return_t)
13-
case scanError(result: memscan_error_t)
14-
case readError(result: memscan_error_t)
12+
case errorGettingTask(machError: String)
13+
case scanError(result: memscan_error, machError: String)
14+
case readError(result: memscan_error, machError: String)
1515
case readNullPointer
1616
}
1717

@@ -82,16 +82,16 @@ class MemscanTarget {
8282
var task: mach_port_name_t = 0
8383
let kernResult = task_for_pid(mach_task_self_, pid, &task)
8484
if(kernResult != KERN_SUCCESS) {
85-
throw MemscanError.errorGettingTask(result: kernResult)
85+
throw MemscanError.errorGettingTask(machError: String(cString: mach_error_string(kernResult)))
8686
}
8787
self.native = memscan_target(pid: pid, task: task)
8888
}
8989

9090
func read(at pointer: vm_address_t, count: vm_offset_t) throws -> MemscanReadResult {
91-
var error: memscan_error_t = 0
91+
var error: memscan_error = memscan_error()
9292
let data = memscan_read(native, pointer, count, &error)
93-
if(error != MEMSCAN_SUCCESS) {
94-
throw MemscanError.readError(result: error)
93+
if(error.memscan != MEMSCAN_SUCCESS) {
94+
throw MemscanError.readError(result: error, machError: String(cString: mach_error_string(error.mach)))
9595
}
9696
guard data != nil else {
9797
throw MemscanError.readNullPointer
@@ -163,12 +163,12 @@ class MemscanScanner {
163163

164164
func next() throws -> MemscanMatch? {
165165
var match = memscan_match()
166-
var error: memscan_error_t = 0
166+
var error: memscan_error = memscan_error()
167167
if(memscan_scanner_next(native, &match, &error)) {
168168
return MemscanMatch(native: match)
169169
}
170-
if(error != MEMSCAN_SUCCESS) {
171-
throw MemscanError.scanError(result: error)
170+
if(error.memscan != MEMSCAN_SUCCESS) {
171+
throw MemscanError.scanError(result: error, machError: String(cString: mach_error_string(error.mach)))
172172
}
173173
return nil
174174
}

0 commit comments

Comments
 (0)