diff options
| author | 2020-05-03 21:06:38 +0100 | |
|---|---|---|
| committer | 2020-05-03 21:06:38 +0100 | |
| commit | 854f4d49407e45d67dd5754afd21a7e59970ca5b (patch) | |
| tree | 582e3245786f9723b5895b0c8d41087b0e6bb416 /src/main/java/cuchaz/enigma/gui/DecompiledClassSource.java | |
| parent | Rewrite search dialog (#233) (diff) | |
| download | enigma-fork-854f4d49407e45d67dd5754afd21a7e59970ca5b.tar.gz enigma-fork-854f4d49407e45d67dd5754afd21a7e59970ca5b.tar.xz enigma-fork-854f4d49407e45d67dd5754afd21a7e59970ca5b.zip | |
Multiplayer support (#221)
* First pass on multiplayer
* Apply review suggestions
* Dedicated Enigma server
* Don't jump to references when other users do stuff
* Better UI + translations
* french translation
* Apply review suggestions
* Document the protocol
* Fix most issues with scrolling.
* Apply review suggestions
* Fix zip hash issues + add a bit more logging
* Optimize zip hash
* Fix a couple of login bugs
* Add message log and user list
* Make Message an abstract class
* Make status bar work, add chat box
* Hide message log/users list when not connected
* Fix status bar not resetting entirely
* Run stop server task on server thread to prevent multithreading race conditions
* Add c2s message to packet id list
* Fix message scroll bar not scrolling to the end
* Formatting
* User list size -> ushort
* Combine contains and remove check
* Check removal before sending packet
* Add password to login packet
* Fix the GUI closing the rename text field when someone else renames something
* Update fr_fr.json
* oups
* Make connection/server create dialogs not useless if it fails once
* Refactor UI state updating
* Fix imports
* Fix Collab menu
* Fix NPE when rename not allowed
* Make the log file a configurable option
* Don't use modified UTF
* Update fr_fr.json
* Bump version to 0.15.4
* Apparently I can't spell neither words nor semantic versions
Co-authored-by: Yanis48 <doublecraft.official@gmail.com>
Co-authored-by: 2xsaiko <git@dblsaiko.net>
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/DecompiledClassSource.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/DecompiledClassSource.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/DecompiledClassSource.java b/src/main/java/cuchaz/enigma/gui/DecompiledClassSource.java index f7097f0..08df3e7 100644 --- a/src/main/java/cuchaz/enigma/gui/DecompiledClassSource.java +++ b/src/main/java/cuchaz/enigma/gui/DecompiledClassSource.java | |||
| @@ -126,6 +126,32 @@ public class DecompiledClassSource { | |||
| 126 | highlightedTokens.computeIfAbsent(highlightType, t -> new ArrayList<>()).add(token); | 126 | highlightedTokens.computeIfAbsent(highlightType, t -> new ArrayList<>()).add(token); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | public int getObfuscatedOffset(int deobfOffset) { | ||
| 130 | return getOffset(remappedIndex, obfuscatedIndex, deobfOffset); | ||
| 131 | } | ||
| 132 | |||
| 133 | public int getDeobfuscatedOffset(int obfOffset) { | ||
| 134 | return getOffset(obfuscatedIndex, remappedIndex, obfOffset); | ||
| 135 | } | ||
| 136 | |||
| 137 | private static int getOffset(SourceIndex fromIndex, SourceIndex toIndex, int fromOffset) { | ||
| 138 | int relativeOffset = 0; | ||
| 139 | |||
| 140 | Iterator<Token> fromTokenItr = fromIndex.referenceTokens().iterator(); | ||
| 141 | Iterator<Token> toTokenItr = toIndex.referenceTokens().iterator(); | ||
| 142 | while (fromTokenItr.hasNext() && toTokenItr.hasNext()) { | ||
| 143 | Token fromToken = fromTokenItr.next(); | ||
| 144 | Token toToken = toTokenItr.next(); | ||
| 145 | if (fromToken.end > fromOffset) { | ||
| 146 | break; | ||
| 147 | } | ||
| 148 | |||
| 149 | relativeOffset = toToken.end - fromToken.end; | ||
| 150 | } | ||
| 151 | |||
| 152 | return fromOffset + relativeOffset; | ||
| 153 | } | ||
| 154 | |||
| 129 | @Override | 155 | @Override |
| 130 | public String toString() { | 156 | public String toString() { |
| 131 | return remappedIndex.getSource(); | 157 | return remappedIndex.getSource(); |