Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Commit

Permalink
HOTFIX 4.0.2
Browse files Browse the repository at this point in the history
Fix weapon & warp fields being completely off
Fix 290.rec editor outputting "corrupt" records
  • Loading branch information
Leo40Git committed Apr 8, 2018
1 parent 946f567 commit 2225de1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 25 deletions.
5 changes: 4 additions & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
4.0.1
4.0.2
HOTFIX 4.0.2:
- Fix weapon & warp fields being completely off
- Fix 290.rec editor outputting "corrupt" records
HOTFIX 4.0.1:
- Fix app hanging when loading mod without profile
- Fix flag editor setting the wrong flag when undefined/system flags are shown
Expand Down
19 changes: 4 additions & 15 deletions src/main/java/com/leo/cse/backend/niku/NikuRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,6 @@ public static boolean isLoaded() {
return loaded;
}

/**
* Converts a byte into it's unsigned equivalent.
*
* @param b
* signed byte
* @return unsigned byte
*/
private static byte unsigned(byte b) {
return (byte) (b & 0xFF);
}

/**
* Creates a new record.
*/
Expand All @@ -258,7 +247,7 @@ public static void load(File src) throws IOException {
fis.read(buf);
fis.close();
for (int i = 0; i < 4; i++) {
byte key = unsigned(buf[i + 16]);
int key = Byte.toUnsignedInt(buf[i + 16]);
System.out.println("result " + i + ": key=" + key);
int j = i * 4;
buf[j] = (byte) (buf[j] - key);
Expand All @@ -267,7 +256,7 @@ public static void load(File src) throws IOException {
System.out.println("buf[" + (j + 1) + "]=" + buf[j + 1]);
buf[j + 2] = (byte) (buf[j + 2] - key);
System.out.println("buf[" + (j + 2) + "]=" + buf[j + 2]);
buf[j + 3] = (byte) (buf[j + 3] - (byte) (unsigned(key) / 2));
buf[j + 3] = (byte) (buf[j + 3] - key / 2);
System.out.println("buf[" + (j + 3) + "]=" + buf[j + 3]);
result[i] = ByteUtils.readInt(buf, j);
}
Expand Down Expand Up @@ -308,12 +297,12 @@ public static void save(File dest) throws IOException {
bufByte[18] = (byte) r.nextInt(0xFF);
bufByte[19] = (byte) r.nextInt(0xFF);
for (int i = 0; i < 4; i++) {
byte key = unsigned(bufByte[i + 16]);
int key = Byte.toUnsignedInt(bufByte[i + 16]);
int j = i * 4;
bufByte[j] = (byte) (bufByte[j] + key);
bufByte[j + 1] = (byte) (bufByte[j + 1] + key);
bufByte[j + 2] = (byte) (bufByte[j + 2] + key);
bufByte[j + 3] = (byte) (bufByte[j + 3] + (byte) (unsigned(key) / 2));
bufByte[j + 3] = (byte) (bufByte[j + 3] + key / 2);
}
FileOutputStream fos = new FileOutputStream(dest);
fos.write(bufByte);
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/leo/cse/backend/profile/NormalProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,14 @@ protected void setupFields() {
makeFieldInt(FIELD_CURRENT_WEAPON, 0x024);
makeFieldFlags(FIELD_EQUIPS, 16, 0x02C);
makeFieldInt(FIELD_TIME_PLAYED, 0x034);
makeFieldInts(FIELD_WEAPON_ID, 7, Integer.BYTES * 5, 0x038);
makeFieldInts(FIELD_WEAPON_LEVEL, 7, Integer.BYTES * 5, 0x03C);
makeFieldInts(FIELD_WEAPON_EXP, 7, Integer.BYTES * 5, 0x040);
makeFieldInts(FIELD_WEAPON_MAXIMUM_AMMO, 7, Integer.BYTES * 5, 0x044);
makeFieldInts(FIELD_WEAPON_CURRENT_AMMO, 7, Integer.BYTES * 5, 0x048);
makeFieldInts(FIELD_WEAPON_ID, 7, Integer.BYTES * 4, 0x038);
makeFieldInts(FIELD_WEAPON_LEVEL, 7, Integer.BYTES * 4, 0x03C);
makeFieldInts(FIELD_WEAPON_EXP, 7, Integer.BYTES * 4, 0x040);
makeFieldInts(FIELD_WEAPON_MAXIMUM_AMMO, 7, Integer.BYTES * 4, 0x044);
makeFieldInts(FIELD_WEAPON_CURRENT_AMMO, 7, Integer.BYTES * 4, 0x048);
makeFieldInts(FIELD_ITEMS, 30, 0, 0x0D8);
makeFieldInts(FIELD_WARP_ID, 7, Integer.BYTES * 2, 0x158);
makeFieldInts(FIELD_WARP_LOCATION, 7, Integer.BYTES * 2, 0x15C);
makeFieldInts(FIELD_WARP_ID, 7, Integer.BYTES, 0x158);
makeFieldInts(FIELD_WARP_LOCATION, 7, Integer.BYTES, 0x15C);
makeFieldBools(FIELD_MAP_FLAGS, 128, 0, 0x196);
makeFieldFlags(FIELD_FLAGS, 8000, 0x21C);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ public GeneralPanel() {
}
compList.add(mp = new MapView(winSize.width / 2 - 320, 164, () -> SaveEditorPanel.showMapGrid));
ProfileManager.addListener(mp);
compList.add(new BooleanBox("Show Grid?", false, 756, 406, () -> SaveEditorPanel.showMapGrid, t -> {
compList.add(new BooleanBox("Show Grid?", false, 758, 406, () -> SaveEditorPanel.showMapGrid, t -> {
SaveEditorPanel.showMapGrid = t;
return t;
}).setEnabled(() -> ExeData.isLoaded()));
compList.add(new Button("Snap to Grid", 756, 426, 100, 20, () -> {
compList.add(new Button("Snap to Grid", 758, 426, 100, 20, () -> {
Short[] pos = new Short[2];
pos[0] = (short) (Math.round((Short) (ProfileManager.getField(NormalProfile.FIELD_X_POSITION)) / 32.0)
* 32);
Expand Down

0 comments on commit 2225de1

Please sign in to comment.