Skip to content

Commit

Permalink
v2.16.1.1 small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LogisimIt committed May 10, 2020
1 parent 5e618a1 commit e3500f8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
Binary file modified Compiled/Logisim-ITA.exe
Binary file not shown.
Binary file modified Compiled/Logisim-ITA.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion Logisim-Fork/com/cburch/logisim/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

public class Main {
// current version
public static final LogisimVersion VERSION = LogisimVersion.get(2, 16, 1, 0, LogisimVersion.getVariantFromFile());
public static final LogisimVersion VERSION = LogisimVersion.get(2, 16, 1, 1, LogisimVersion.getVariantFromFile());
// the version of the file you're using, equals to current version if new file
public static LogisimVersion FILE_VERSION;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,12 @@ private static ProgrammableGeneratorState getState(InstanceState state) {
public static boolean tick(CircuitState circState, int ticks, Component comp) {
ProgrammableGeneratorState state = getState(comp, circState);
state.incrementTicks();
int durationHigh = state.getdurationHighValue();
int statetick = state.getStateTick();
Value desired = (statetick - 1 < durationHigh ? Value.TRUE : Value.FALSE);
Value desired = Value.UNKNOWN;
if (statetick > 0) {
int durationHigh = state.getdurationHighValue();
desired = (statetick - 1 < durationHigh ? Value.TRUE : Value.FALSE);
}
if (!state.sending.equals(desired)) {
state.sending = desired;
Instance.getInstanceFor(comp).fireInvalidated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ProgrammableGeneratorState implements InstanceData, Cloneable {
Value sending = Value.FALSE;
private int[] durationHigh;
private int[] durationLow;
private boolean allZeros = false;
private String SavedData = "";
// number of clock ticks performed in the current state
private int ticks, currentstate;
Expand Down Expand Up @@ -166,17 +167,24 @@ public String getSavedData() {
}

public int getStateTick() {
if (this.allZeros)
return -1;
return this.ticks;
}

public void incrementCurrentState() {
this.ticks = 1;
if (this.allZeros)
return;
this.ticks = 0;
this.currentstate++;
if (this.currentstate >= this.durationHigh.length)
this.currentstate = 0;
incrementTicks();
}

public void incrementTicks() {
if (this.allZeros)
return;
this.ticks++;
if (this.ticks > getdurationHighValue() + getdurationLowValue())
incrementCurrentState();
Expand Down Expand Up @@ -222,9 +230,11 @@ else if (last.equals("x")) {
private void SaveValues(JTextField[] inputs) {
String onlynumber;
int value;
for (byte i = 0; i < inputs.length; i++) {
boolean allZeros = true;
byte i;
for (i = 0; i < inputs.length; i++) {
onlynumber = "";
value = 0;
value = -1;
// create a string composed by the digits of the text field
for (byte j = 0; j < inputs[i].getText().length(); j++) {
if (Character.isDigit(inputs[i].getText().charAt(j)))
Expand All @@ -234,12 +244,15 @@ private void SaveValues(JTextField[] inputs) {
if (onlynumber != "")
value = Integer.parseInt(onlynumber);
if (value >= 0) {
if (value != 0)
allZeros = false;
if (i % 2 == 0)
setdurationHigh(i / 2, value);
else
setdurationLow(i / 2, value);
}
}
this.allZeros = allZeros;
}

public void setdurationHigh(int i, int value) {
Expand Down
7 changes: 3 additions & 4 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
<!DOCTYPE xml>
<logisim>
<jar_file>https://github.com/LogisimIt/Logisim/raw/master/Compiled/Logisim-ITA.jar</jar_file>
<jar_version>2.16.1.0</jar_version>
<jar_version>2.16.1.1</jar_version>
<exe_file>https://github.com/LogisimIt/Logisim/raw/master/Compiled/Logisim-ITA.exe</exe_file>
<exe_version>2.16.1.0</exe_version>
<exe_version>2.16.1.1</exe_version>
<changelog>
* Added Simplified Chinese translation
* Compiled with Jdk 14
* Fixed a problem with zeros in programmable generator
</changelog>
</logisim>

0 comments on commit e3500f8

Please sign in to comment.