mirror of
https://github.com/kuroppoi/entralinked.git
synced 2026-09-08 16:55:16 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72d5a10ffc | ||
|
|
6f1853fc50 | ||
|
|
6999f1f976 | ||
|
|
16d1b99f1f | ||
|
|
229cfaf4ca |
@@ -284,6 +284,12 @@ public class DashboardHandler implements HttpHandler {
|
||||
BufferedImage image = ImageIO.read(ctx.bodyInputStream());
|
||||
BufferedImage previewImage = null;
|
||||
|
||||
// Make sure file is a valid image
|
||||
if(image == null) {
|
||||
ctx.json(new DashboardStatusMessage("File is either not an image or uses an unsupported format.", true));
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure image has the correct dimensions
|
||||
if(image.getWidth() != 256 || image.getHeight() != 192) {
|
||||
ctx.json(new DashboardStatusMessage("Image must be 256 x 192 pixels.", true));
|
||||
|
||||
@@ -128,7 +128,12 @@ public class TiledImageUtility {
|
||||
// In cases where background colors are present, pixels that use the *first* foreground color
|
||||
// will be replaced by the background color at that pixel's location.
|
||||
for(int i = 0; i < COLOR_PALETTE_SIZE; i++) {
|
||||
colorPalette[i] = ColorUtility.convertBGR555ToRGB888(inputStream.readShort());
|
||||
int color = inputStream.readShort();
|
||||
|
||||
// The game seems to always replace the first color of the foreground with the background,
|
||||
// so let's just set it to black so that C-Gear skin previews are more accurate.
|
||||
// This won't do anything for Pokédex skins, as they use a special background color palette.
|
||||
colorPalette[i] = i == 0 ? 0 : ColorUtility.convertBGR555ToRGB888(color);
|
||||
}
|
||||
|
||||
// Read background color data.
|
||||
@@ -153,7 +158,7 @@ public class TiledImageUtility {
|
||||
int flipBits = rightBits & 12;
|
||||
|
||||
// The normalized tile index is the index of the in-memory tile index in the lookup table.
|
||||
int tileIndex = 0;
|
||||
int tileIndex = -1;
|
||||
|
||||
for(int k = 0; k < tileIndices.length; k++) {
|
||||
if(memoryIndex == tileIndices[k]) {
|
||||
@@ -162,6 +167,12 @@ public class TiledImageUtility {
|
||||
}
|
||||
}
|
||||
|
||||
// If no tile could be found, then just skip it.
|
||||
// TODO It is possible that it uses background colors in this case, but just leaving the tile black should be good enough.
|
||||
if(tileIndex == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Apply the pixels of this tile to the resulting image.
|
||||
for(int j = 0; j < TILE_SIZE; j++) {
|
||||
// Get the color index for this pixel based on how the tile is flipped.
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
<option disabled>──────────────────────</option>
|
||||
</select>
|
||||
<button onclick="openFileChooser('cgear-file-input')">Upload Custom</button>
|
||||
<input id="cgear-file-input" type="file" accept="image/*" onchange="uploadSkin('CGEAR', this.files[0])" onclick="this.value = null;" hidden/>
|
||||
<input id="cgear-file-input" type="file" accept=".png, .bmp, .jpg, .jpeg" onchange="uploadSkin('CGEAR', this.files[0])" onclick="this.value = null;" hidden/>
|
||||
</div>
|
||||
<div>
|
||||
<label>Pokédex Skin | </label><a href="#" onclick="return previewSkin('dex-skin', 'ZUKAN')">Preview</a>
|
||||
@@ -141,7 +141,7 @@
|
||||
<option disabled>──────────────────────</option>
|
||||
</select>
|
||||
<button onclick="openFileChooser('dex-file-input')">Upload Custom</button>
|
||||
<input id="dex-file-input" type="file" accept="image/*" onchange="uploadSkin('ZUKAN', this.files[0])" onclick="this.value = null;" hidden/>
|
||||
<input id="dex-file-input" type="file" accept=".png, .bmp, .jpg, .jpeg" onchange="uploadSkin('ZUKAN', this.files[0])" onclick="this.value = null;" hidden/>
|
||||
</div>
|
||||
<div>
|
||||
<label>Musical Show</label>
|
||||
|
||||
Reference in New Issue
Block a user