Skip to content

Commit 2bd2060

Browse files
Fix Include Population (#70)
Fixes population of the includes to the engine without making a binary compatibility breaking change. While I was in here, I also fixed the jar description because we renamed the repo. The repo is no longer under "Enigma" so a fresh clone is downloaded as "lgmplugin/". This makes it easier to build the plugin on a fresh clone.
1 parent 35ef11e commit 2bd2060

File tree

2 files changed

+44
-33
lines changed

2 files changed

+44
-33
lines changed

description.jardesc

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<jardesc>
3-
<jar path="Enigma/enigma.jar"/>
4-
<options buildIfNeeded="true" compress="true" descriptionLocation="/Enigma/description.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
3+
<jar path="lgmplugin/enigma.jar"/>
4+
<options buildIfNeeded="true" compress="true" descriptionLocation="/lgmplugin/description.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
55
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
66
<selectedProjects/>
7-
<manifest generateManifest="false" manifestLocation="/Enigma/META-INF/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
7+
<manifest generateManifest="false" manifestLocation="/lgmplugin/META-INF/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
88
<sealing sealJar="false">
99
<packagesToSeal/>
1010
<packagesToUnSeal/>
1111
</sealing>
1212
</manifest>
1313
<selectedElements exportClassFiles="true" exportJavaFiles="true" exportOutputFolder="false">
14-
<file path="/Enigma/.classpath"/>
15-
<file path="/Enigma/description.jardesc"/>
16-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.utility"/>
17-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.file"/>
18-
<folder path="/Enigma/META-INF"/>
19-
<file path="/Enigma/COPYING"/>
20-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.backend"/>
21-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma"/>
22-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.backend.sub"/>
23-
<file path="/Enigma/Makefile"/>
24-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.backend.util"/>
25-
<file path="/Enigma/LICENSE"/>
26-
<file path="/Enigma/.gitignore"/>
27-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.messages"/>
28-
<file path="/Enigma/README.md"/>
29-
<file path="/Enigma/.project"/>
30-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.backend.other"/>
31-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.frames"/>
32-
<javaElement handleIdentifier="=Enigma/&lt;org.enigma.backend.resources"/>
14+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.frames"/>
15+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.backend.other"/>
16+
<file path="/lgmplugin/org/enigma/enigma.png"/>
17+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma{SettingsHandler.java"/>
18+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.backend.util"/>
19+
<file path="/lgmplugin/.classpath"/>
20+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma{EnigmaThread.java"/>
21+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.backend.resources"/>
22+
<folder path="/lgmplugin/META-INF"/>
23+
<file path="/lgmplugin/COPYING"/>
24+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.messages"/>
25+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma{TargetHandler.java"/>
26+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.utility"/>
27+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.file"/>
28+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma{EnigmaWriter.java"/>
29+
<file path="/lgmplugin/LICENSE"/>
30+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.backend.sub"/>
31+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma{EnigmaRunner.java"/>
32+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma.backend"/>
33+
<file path="/lgmplugin/README.md"/>
34+
<file path="/lgmplugin/org/enigma/syntax.png"/>
35+
<javaElement handleIdentifier="=lgmplugin/&lt;org.enigma{EnigmaCli.java"/>
3336
</selectedElements>
3437
</jardesc>

org/enigma/EnigmaWriter.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323

2424
import java.awt.Color;
2525
import java.awt.Graphics2D;
26-
import java.awt.GraphicsEnvironment;
2726
import java.awt.RenderingHints;
28-
import java.awt.Toolkit;
2927
import java.awt.font.FontRenderContext;
3028
import java.awt.font.GlyphVector;
3129
import java.awt.geom.Point2D;
@@ -49,9 +47,11 @@
4947
import java.util.zip.DeflaterOutputStream;
5048

5149
import javax.swing.JOptionPane;
50+
5251
import org.enigma.backend.EnigmaStruct;
5352
import org.enigma.backend.other.Constant;
5453
import org.enigma.backend.other.Extension;
54+
import org.enigma.backend.other.Include;
5555
import org.enigma.backend.resources.Background;
5656
import org.enigma.backend.resources.Font;
5757
import org.enigma.backend.resources.GameInformation;
@@ -81,13 +81,15 @@
8181
import org.enigma.utility.Masker.Mask;
8282
import org.lateralgm.components.impl.ResNode;
8383
import org.lateralgm.file.ProjectFile;
84+
import org.lateralgm.file.ResourceList;
8485
import org.lateralgm.file.iconio.ICOFile;
8586
import org.lateralgm.main.LGM;
8687
import org.lateralgm.resources.Background.PBackground;
8788
import org.lateralgm.resources.Font.PFont;
8889
import org.lateralgm.resources.GameInformation.PGameInformation;
8990
import org.lateralgm.resources.GameSettings.PGameSettings;
9091
import org.lateralgm.resources.GmObject.PGmObject;
92+
import org.lateralgm.resources.Include.PInclude;
9193
import org.lateralgm.resources.InstantiableResource;
9294
import org.lateralgm.resources.Path.PPath;
9395
import org.lateralgm.resources.Resource;
@@ -169,14 +171,20 @@ protected void populateStruct() {
169171
// TODO: Populate constants from chosen configuration on the main
170172
// toolbar.
171173

172-
// TODO: Fixme
173-
o.includeCount = 0;// i.includes.size();
174-
/*
175-
* if (o.includeCount != 0) { o.includes = new Include.ByReference();
176-
* Include[] oil = (Include[]) o.includes.toArray(o.includeCount); for
177-
* (int inc = 0; inc < o.includeCount; inc++) { oil[inc].filepath =
178-
* i.includes.get(inc).filepath; } }
179-
*/
174+
ResourceList<org.lateralgm.resources.Include> includeList = i.resMap.getList(org.lateralgm.resources.Include.class);
175+
org.lateralgm.resources.Include iil[] = includeList.toArray(new org.lateralgm.resources.Include[0]);
176+
o.includeCount = includeList.size();
177+
if (o.includeCount != 0)
178+
{
179+
o.includes = new Include.ByReference();
180+
Include[] oil = (Include[]) o.includes.toArray(o.includeCount);
181+
for (int inc = 0; inc < o.includeCount; inc++)
182+
{
183+
org.lateralgm.resources.Include ii = iil[inc];
184+
oil[inc].filepath = ii.get(PInclude.FILEPATH);
185+
}
186+
}
187+
180188
// packages not implemented
181189
o.packageCount = 0;
182190
// o.packageCount = packages.length;
@@ -201,7 +209,7 @@ protected void populateStruct() {
201209
{
202210
0x1F, 0x74, 0x2F, 0x5C, 0x69, 0x2B, (byte) 0x84,
203211
(byte) 0xBB, (byte) 0xE6, (byte) 0xE5, 0x22, 0x23,
204-
0x35, 0x55, (byte) 0xE2, (byte) 0x91
212+
0x35, 0x55, (byte) 0xE2, (byte) 0x91
205213
},
206214
{
207215
0x08, (byte) 0xAA, 0x73, (byte) 0xA3, 0x5D, 0x0C,

0 commit comments

Comments
 (0)