Upload
This commit is contained in:
commit
08fddcd73e
364 changed files with 111462 additions and 0 deletions
12
PrometheOS/PrometheOS-Firmware-1.5.0/PrometheOSUtility/.gitignore
vendored
Normal file
12
PrometheOS/PrometheOS-Firmware-1.5.0/PrometheOSUtility/.gitignore
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
*.suo
|
||||
*.user
|
||||
|
||||
.vs/
|
||||
|
||||
obj/
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
|
||||
Build/
|
Binary file not shown.
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class Block
|
||||
{
|
||||
private const int BLOCK_SIZE = 256;
|
||||
|
||||
private uint mAddress;
|
||||
private byte[] mBlockBytes = new byte[BLOCK_SIZE];
|
||||
|
||||
public int BlockSize { get; } = BLOCK_SIZE;
|
||||
|
||||
public Block(uint address)
|
||||
{
|
||||
mAddress = address;
|
||||
}
|
||||
|
||||
public void SetBlockBytes(byte[] bytes)
|
||||
{
|
||||
Array.Clear(mBlockBytes, 0, BLOCK_SIZE);
|
||||
Array.Copy(bytes, mBlockBytes, bytes.Length);
|
||||
}
|
||||
|
||||
public byte[] Encode(int blockno, int numblocks, uint familyId)
|
||||
{
|
||||
const uint UF2_MAGIC_START0 = 0x0A324655;
|
||||
const uint UF2_MAGIC_START1 = 0x9E5D5157;
|
||||
const uint UF2_MAGIC_END = 0x0AB16F30;
|
||||
const uint flags = 0x2000; // withFamilyId flag
|
||||
|
||||
using var memoryStream = new MemoryStream();
|
||||
using var binaryWriter = new BinaryWriter(memoryStream);
|
||||
|
||||
binaryWriter.Write(UF2_MAGIC_START0);
|
||||
binaryWriter.Write(UF2_MAGIC_START1);
|
||||
binaryWriter.Write(flags);
|
||||
binaryWriter.Write(mAddress);
|
||||
binaryWriter.Write(BlockSize);
|
||||
binaryWriter.Write(blockno);
|
||||
binaryWriter.Write(numblocks);
|
||||
binaryWriter.Write(familyId);
|
||||
binaryWriter.Write(mBlockBytes);
|
||||
|
||||
// Pad with zeros
|
||||
while (memoryStream.Position < (512 - sizeof(uint)))
|
||||
{
|
||||
binaryWriter.Write((byte)0);
|
||||
}
|
||||
|
||||
binaryWriter.Write(UF2_MAGIC_END);
|
||||
return memoryStream.ToArray();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
public static class FlashBin
|
||||
{
|
||||
private static uint GetFlashAddressMask(uint biosSize)
|
||||
{
|
||||
var maskBits = 0u;
|
||||
|
||||
biosSize -= 1;
|
||||
while (biosSize > 0)
|
||||
{
|
||||
biosSize >>= 1;
|
||||
maskBits++;
|
||||
}
|
||||
|
||||
var memCapacity = (uint)(1 << (int)maskBits);
|
||||
var addressMask = memCapacity - 1;
|
||||
return addressMask;
|
||||
}
|
||||
|
||||
private static List<Block> GetUF2BlocksFromData(byte[] data, uint flashRomAddress)
|
||||
{
|
||||
var blocks = new List<Block>();
|
||||
|
||||
var blockAddress = flashRomAddress;
|
||||
|
||||
using var ms = new MemoryStream(data);
|
||||
while (true)
|
||||
{
|
||||
var currentBlock = new Block(blockAddress);
|
||||
var buffer = new byte[currentBlock.BlockSize];
|
||||
var bytesRead = ms.Read(buffer, 0, currentBlock.BlockSize);
|
||||
if (bytesRead == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
currentBlock.SetBlockBytes(buffer);
|
||||
blocks.Add(currentBlock);
|
||||
blockAddress += (uint)currentBlock.BlockSize;
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
private static List<Block> GetUF2RomaddrMaskBlock(uint maskAddress, uint romaddrMask)
|
||||
{
|
||||
var blocks = new List<Block>();
|
||||
var currentBlock = new Block(maskAddress);
|
||||
currentBlock.SetBlockBytes(BitConverter.GetBytes(romaddrMask));
|
||||
|
||||
// Copy 16 times a 256 block to fill a 4096 byte sector
|
||||
for (var i = 0; i < 16; i++)
|
||||
{
|
||||
blocks.Add(currentBlock);
|
||||
}
|
||||
|
||||
return blocks;
|
||||
}
|
||||
|
||||
private static byte[] CombineByteArrays(byte[] first, byte[] second)
|
||||
{
|
||||
byte[] combined = new byte[first.Length + second.Length];
|
||||
Buffer.BlockCopy(first, 0, combined, 0, first.Length);
|
||||
Buffer.BlockCopy(second, 0, combined, first.Length, second.Length);
|
||||
return combined;
|
||||
}
|
||||
|
||||
public static byte[] ProcessUf2(byte[] data, uint baseAddress, uint maskAddress, uint familyId)
|
||||
{
|
||||
var uf2Blocks = new List<Block>();
|
||||
var byteStream = Array.Empty<byte>();
|
||||
|
||||
uint romaddrMask = GetFlashAddressMask(256 * 1024);
|
||||
if (maskAddress != 0xffffffff)
|
||||
{
|
||||
uf2Blocks.AddRange(GetUF2RomaddrMaskBlock(maskAddress, romaddrMask));
|
||||
}
|
||||
|
||||
uf2Blocks.AddRange(GetUF2BlocksFromData(data, baseAddress));
|
||||
|
||||
int totalBlocks = uf2Blocks.Count;
|
||||
int currentBlock = 0;
|
||||
|
||||
foreach (var block in uf2Blocks)
|
||||
{
|
||||
byteStream = CombineByteArrays(byteStream, block.Encode(currentBlock, totalBlocks, familyId));
|
||||
currentBlock++;
|
||||
}
|
||||
|
||||
Console.WriteLine("Total blocks written: " + totalBlocks);
|
||||
|
||||
return byteStream;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
using BundlerMinifier;
|
||||
using System.Text;
|
||||
|
||||
namespace PrometheOSPacker.Helpers
|
||||
{
|
||||
internal static class Minify
|
||||
{
|
||||
private static void BundleFile(string sourceFolder, string destFolder, string filename)
|
||||
{
|
||||
var sourceFile = Path.Combine(sourceFolder, filename);
|
||||
var destFile = Path.Combine(destFolder, filename);
|
||||
|
||||
if (Path.GetExtension(filename).Equals(".ico", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
File.Copy(sourceFile, destFile, true);
|
||||
return;
|
||||
}
|
||||
|
||||
var bundleJson = Path.Combine(Utility.GetAppFolder(), "bundle.json");
|
||||
if (File.Exists(bundleJson))
|
||||
{
|
||||
File.Delete(bundleJson);
|
||||
}
|
||||
|
||||
var bundle = new Bundle
|
||||
{
|
||||
IncludeInProject = false,
|
||||
OutputFileName = destFile
|
||||
};
|
||||
bundle.InputFiles.Add(sourceFile);
|
||||
|
||||
BundleHandler.AddBundle(bundleJson, bundle);
|
||||
|
||||
var bundleProcessor = new BundleFileProcessor();
|
||||
var bundles = BundleHandler.GetBundles(bundleJson);
|
||||
bundleProcessor.Process(bundleJson, bundles);
|
||||
|
||||
var minFile = Path.Combine(destFolder, $"{Path.GetFileNameWithoutExtension(filename)}.min{Path.GetExtension(filename)}");
|
||||
if (File.Exists(minFile) == true && File.Exists(destFile))
|
||||
{
|
||||
File.Move(minFile, destFile, true);
|
||||
}
|
||||
|
||||
File.Delete(bundleJson);
|
||||
}
|
||||
|
||||
private static void IncludeFile(string ipToReplace, string sourceFolder, string destFolder, string filename)
|
||||
{
|
||||
var includeName = filename.Replace(".", "_");
|
||||
var headerName = $"{includeName}.h";
|
||||
|
||||
var sourceFile = Path.Combine(sourceFolder, filename);
|
||||
var destFile = Path.Combine(destFolder, headerName);
|
||||
|
||||
byte[] sourceData;
|
||||
if (Path.GetExtension(sourceFile).Equals(".ico", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
sourceData = File.ReadAllBytes(sourceFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
var sourceText = File.ReadAllText(sourceFile);
|
||||
sourceText = sourceText.Replace($"http://{ipToReplace}", "");
|
||||
sourceData = Encoding.UTF8.GetBytes(sourceText);
|
||||
}
|
||||
|
||||
var resultBuilder = new StringBuilder();
|
||||
resultBuilder.AppendLine("#pragma once");
|
||||
resultBuilder.AppendLine("");
|
||||
resultBuilder.AppendLine($"const uint8_t {includeName}[] = {{");
|
||||
|
||||
for (var i = 0; i < sourceData.Length; i++)
|
||||
{
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
resultBuilder.Append(" ");
|
||||
}
|
||||
resultBuilder.Append("0x");
|
||||
resultBuilder.Append(sourceData[i].ToString("x2"));
|
||||
if (i < sourceData.Length - 1)
|
||||
{
|
||||
resultBuilder.Append(',');
|
||||
if (i % 16 != 15)
|
||||
{
|
||||
resultBuilder.Append(' ');
|
||||
}
|
||||
}
|
||||
if (i % 16 == 15)
|
||||
{
|
||||
resultBuilder.AppendLine();
|
||||
}
|
||||
}
|
||||
resultBuilder.AppendLine();
|
||||
resultBuilder.AppendLine("};");
|
||||
|
||||
var result = resultBuilder.ToString();
|
||||
File.WriteAllText(destFile, result);
|
||||
}
|
||||
|
||||
public static void Process(string ipToReplace)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
|
||||
var webFolder = Path.Combine(slnFolder, "PrometheOSWeb", "wwwroot");
|
||||
var bundleFolder = Path.Combine(slnFolder, "PrometheOSPacker", "bundle");
|
||||
Directory.CreateDirectory(bundleFolder);
|
||||
|
||||
var webFiles = Directory.GetFiles(webFolder);
|
||||
foreach (var webFile in webFiles)
|
||||
{
|
||||
BundleFile(webFolder, bundleFolder, Path.GetFileName(webFile));
|
||||
}
|
||||
|
||||
var includeFolder = Path.GetFullPath("..\\PrometheOSXbe\\PrometheOSXbe\\Assets\\Web", slnFolder);
|
||||
|
||||
var bundleFiles = Directory.GetFiles(bundleFolder);
|
||||
foreach (var bundleFile in bundleFiles)
|
||||
{
|
||||
IncludeFile(ipToReplace, bundleFolder, includeFolder, Path.GetFileName(bundleFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,318 @@
|
|||
using FluentFTP;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace PrometheOSPacker.Helpers
|
||||
{
|
||||
//Bank1_256k = 3 0x000000 - 0x03ffff Sector Size 65536 Total 262144
|
||||
//Bank2_256k = 4 0x040000 - 0x07ffff Sector Size 65536 Total 262144
|
||||
//Bank3_256k = 5 0x080000 - 0x0bffff Sector Size 65536 Total 262144
|
||||
//Bank4_256k = 6 0x0c0000 - 0x0fffff Sector Size 65536 Total 262144
|
||||
//Bank1_512k = 7 0x000000 - 0x07ffff Sector Size 65536 Total 524288
|
||||
//Bank2_512k = 8 0x080000 - 0x0fffff Sector Size 65536 Total 524288
|
||||
//Bank1_1024k = 9 0x000000 - 0x0fffff Sector Size 65536 Total 1048576
|
||||
//Bank_PrometheOS = 2 0x100000 - 0x17ffff Sector Size 65536 Total 524288
|
||||
//Bank_Bootloader = 1 0x180000 - 0x1bffff Sector Size 65536 Total 262144
|
||||
//Bank_Recovery = 10 0x1c0000 - 0x1fffff See Below Total 262144
|
||||
|
||||
//0x1c0000 - 0x1effff Sector Size 65536 Total 196608 (PrometheOS Continued)
|
||||
//0x1f0000 - 0x1f7fff Sector Size 32768 Total 32768 (Installer Logo)
|
||||
//0x1f8000 - 0x1f9fff Sector Size 8192 Total 8192 (Settings)
|
||||
//0x1fa000 - 0x1fbfff Sector Size 8192 Total 8192 (Spare)
|
||||
//0x1fc000 - 0x1fffff Sector Size 16384 Total 16384 (Spare)
|
||||
|
||||
//Suggested byes for PrometheOS = 720896 (524288 bytes Bank_PrometheOS + First 196608 bytes of Bank_Recovery)
|
||||
|
||||
internal class Package
|
||||
{
|
||||
public static byte[] CompressBank(string filePath, int size)
|
||||
{
|
||||
var fileData = File.ReadAllBytes(filePath);
|
||||
var compressedData = new byte[fileData.Length];
|
||||
var compressedSize = K4os.Compression.LZ4.LZ4Codec.Encode(fileData, compressedData, K4os.Compression.LZ4.LZ4Level.L12_MAX);
|
||||
if (compressedSize <= 0)
|
||||
{
|
||||
throw new Exception("Compress failed.");
|
||||
}
|
||||
byte[] promethosLengthBytes = BitConverter.GetBytes(fileData.Length);
|
||||
byte[] compressedLengthBytes = BitConverter.GetBytes(compressedSize);
|
||||
|
||||
var bank = new byte[size];
|
||||
Array.Copy(promethosLengthBytes, 0, bank, 0, promethosLengthBytes.Length);
|
||||
Array.Copy(compressedLengthBytes, 0, bank, 4, compressedLengthBytes.Length);
|
||||
Array.Copy(compressedData, 0, bank, 8, compressedSize);
|
||||
|
||||
var checksum = 0;
|
||||
for (int i = 0; i < bank.Length; i++)
|
||||
{
|
||||
checksum = checksum + bank[i] & 0xffff;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Compressed Size = {compressedSize + 8} of {size} - Checksum {checksum}");
|
||||
|
||||
return bank;
|
||||
}
|
||||
|
||||
public static byte[] ExtractPrometheOS(string modchip)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var prometheosSourcePath = Path.GetFullPath($"..\\Input\\prometheos-{modchip}.bin", slnFolder);
|
||||
if (File.Exists(prometheosSourcePath) == false)
|
||||
{
|
||||
Console.WriteLine($"Error: Looks like you didnt suppliy prometheos-{modchip}.bin in input folder.");
|
||||
throw new Exception("Failed: ExtractPrometheOS");
|
||||
}
|
||||
|
||||
var prometheosSource = File.ReadAllBytes(prometheosSourcePath);
|
||||
var firmware = new byte[256 * 1024];
|
||||
|
||||
if (modchip.Equals("Xenium", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Array.Copy(prometheosSource, 0x180000, firmware, 0, 256 * 1024);
|
||||
return firmware;
|
||||
}
|
||||
|
||||
if (modchip.Equals("Xecuter", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Array.Copy(prometheosSource, 0x000000, firmware, 0, 256 * 1024);
|
||||
return firmware;
|
||||
}
|
||||
|
||||
if (modchip.Equals("Xchanger", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Array.Copy(prometheosSource, 0x0C0000, firmware, 0, 256 * 1024);
|
||||
return firmware;
|
||||
}
|
||||
|
||||
if (modchip.Equals("Aladdin1mb", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Array.Copy(prometheosSource, 0x0C0000, firmware, 0, 256 * 1024);
|
||||
return firmware;
|
||||
}
|
||||
|
||||
if (modchip.Equals("Aladdin2mb", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Array.Copy(prometheosSource, 0x100000, firmware, 0, 256 * 1024);
|
||||
return firmware;
|
||||
}
|
||||
|
||||
if (modchip.StartsWith("Modxo", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Array.Copy(prometheosSource, 0x040000, firmware, 0, 256 * 1024);
|
||||
return firmware;
|
||||
}
|
||||
|
||||
throw new Exception($"Failed: Unrecognized modchip {modchip}.");
|
||||
}
|
||||
|
||||
public static void PackageTools()
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var promethosToolsXbePath = Path.GetFullPath($"..\\PrometheOSXbe\\PrometheOSXbe\\Release-Tools\\PrometheOS-Tools.xbe", slnFolder);
|
||||
var tools = File.ReadAllBytes(promethosToolsXbePath);
|
||||
|
||||
var buildPath = Path.Combine(slnFolder, "..\\Build");
|
||||
Directory.CreateDirectory(buildPath);
|
||||
File.WriteAllBytes(Path.Combine(buildPath, $"prometheos-tools.xbe"), tools);
|
||||
}
|
||||
|
||||
public static void PackageXenium(string modchip)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var prometheos = ExtractPrometheOS(modchip);
|
||||
|
||||
var promethosXbePath = Path.GetFullPath($"..\\PrometheOSXbe\\PrometheOSXbe\\Release-{modchip}\\PrometheOS.xbe", slnFolder);
|
||||
if (File.Exists(promethosXbePath) == false)
|
||||
{
|
||||
Console.WriteLine("Error: Looks like you didnt build PrometheOSXbe.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Packing PrometheOS Xbe...");
|
||||
var promethosxbeBank = CompressBank(promethosXbePath, (512 + 96) * 1024);
|
||||
|
||||
var firmware = new byte[2048 * 1024];
|
||||
Array.Copy(promethosxbeBank, 0, firmware, 0x100000, 512 * 1024);
|
||||
Array.Copy(promethosxbeBank, 512 * 1024, firmware, 0x1e0000, 96 * 1024);
|
||||
Array.Copy(prometheos, 0, firmware, 0x180000, prometheos.Length);
|
||||
|
||||
//var logo = GetInstallerLogo();
|
||||
//Array.Copy(logo, 0, firmware, 0x1F0000 , logo.Length);
|
||||
|
||||
var buildPath = Path.Combine(slnFolder, "..\\Build");
|
||||
Directory.CreateDirectory(buildPath);
|
||||
File.WriteAllBytes(Path.Combine(buildPath, $"prometheos-{modchip.ToLower()}.bin"), firmware);
|
||||
}
|
||||
|
||||
public static void PackageXecuter(string modchip)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var prometheos = ExtractPrometheOS(modchip);
|
||||
|
||||
var promethosXbePath = Path.GetFullPath($"..\\PrometheOSXbe\\PrometheOSXbe\\Release-{modchip}\\PrometheOS.xbe", slnFolder);
|
||||
if (File.Exists(promethosXbePath) == false)
|
||||
{
|
||||
Console.WriteLine("Error: Looks like you didnt build PrometheOSXbe.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Packing PrometheOS Xbe...");
|
||||
var promethosxbeBank = CompressBank(promethosXbePath, 655360);
|
||||
|
||||
var firmware = new byte[2048 * 1024];
|
||||
Array.Copy(promethosxbeBank, 0, firmware, 0x040000, promethosxbeBank.Length);
|
||||
Array.Copy(prometheos, 0, firmware, 0x000000, prometheos.Length);
|
||||
|
||||
//var logo = GetInstallerLogo();
|
||||
//Array.Copy(logo, 0, firmware, 0x0e0000 , logo.Length);
|
||||
|
||||
var buildPath = Path.Combine(slnFolder, "..\\Build");
|
||||
Directory.CreateDirectory(buildPath);
|
||||
File.WriteAllBytes(Path.Combine(buildPath, $"prometheos-{modchip.ToLower()}.bin"), firmware);
|
||||
}
|
||||
|
||||
public static void PackageXchanger(string modchip)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var prometheos = ExtractPrometheOS(modchip);
|
||||
|
||||
var promethosXbePath = Path.GetFullPath($"..\\PrometheOSXbe\\PrometheOSXbe\\Release-{modchip}\\PrometheOS.xbe", slnFolder);
|
||||
if (File.Exists(promethosXbePath) == false)
|
||||
{
|
||||
Console.WriteLine("Error: Looks like you didnt build PrometheOSXbe.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Packing PrometheOS Xbe...");
|
||||
var promethosxbeBank = CompressBank(promethosXbePath, 508 * 1024);
|
||||
|
||||
var firmware = new byte[1024 * 1024];
|
||||
Array.Copy(promethosxbeBank, 0, firmware, 0x000000, 508 * 1024);
|
||||
Array.Copy(prometheos, 0, firmware, 0x0C0000, prometheos.Length);
|
||||
|
||||
|
||||
var buildPath = Path.Combine(slnFolder, "..\\Build");
|
||||
Directory.CreateDirectory(buildPath);
|
||||
File.WriteAllBytes(Path.Combine(buildPath, $"prometheos-{modchip.ToLower()}.bin"), firmware);
|
||||
}
|
||||
|
||||
private static void PackageModxoVariant(byte[] prometheos, string variant, string modchip, uint familyId)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
|
||||
var promethosXbePath = Path.GetFullPath($"..\\PrometheOSXbe\\PrometheOSXbe\\Release-{modchip}\\PrometheOS.xbe", slnFolder);
|
||||
if (File.Exists(promethosXbePath) == false)
|
||||
{
|
||||
Console.WriteLine("Error: Looks like you didnt build PrometheOSXbe.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Packing PrometheOS Xbe...");
|
||||
var promethosxbeBank = CompressBank(promethosXbePath, 0x080000 - 0x1000);
|
||||
|
||||
var firmware = new byte[1 * 1024 * 1024];
|
||||
Array.Copy(promethosxbeBank, 0, firmware, 0x080000, promethosxbeBank.Length);
|
||||
Array.Copy(prometheos, 0, firmware, 0x040000, prometheos.Length);
|
||||
|
||||
var modxo = File.ReadAllBytes($"modxo-{variant}.bin");
|
||||
Array.Copy(modxo, 0, firmware, 0x000000, modxo.Length);
|
||||
|
||||
var buildPath = Path.Combine(slnFolder, "..\\Build");
|
||||
Directory.CreateDirectory(buildPath);
|
||||
File.WriteAllBytes(Path.Combine(buildPath, $"prometheos-{modchip.ToLower()}-{variant.ToLower()}.bin"), firmware);
|
||||
|
||||
var uf2 = FlashBin.ProcessUf2(firmware, 0x10000000, 0xffffffff, familyId);
|
||||
File.WriteAllBytes(Path.Combine(buildPath, $"prometheos-{modchip.ToLower()}-{variant.ToLower()}.uf2"), uf2);
|
||||
}
|
||||
|
||||
public static void PackageModxo(string modchip)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var prometheos = ExtractPrometheOS(modchip);
|
||||
uint defaultFamilyId = 0xE48BFF56;
|
||||
|
||||
PackageModxoVariant(prometheos, "official-pico", modchip, defaultFamilyId);
|
||||
PackageModxoVariant(prometheos, "official-pico2", modchip, 0xE48BFF59);
|
||||
PackageModxoVariant(prometheos, "rp2040-zero-tiny", modchip, defaultFamilyId);
|
||||
PackageModxoVariant(prometheos, "yd-rp2040", modchip, defaultFamilyId);
|
||||
PackageModxoVariant(prometheos, "xiao-rp2040", modchip, defaultFamilyId);
|
||||
PackageModxoVariant(prometheos, "ultra", modchip, defaultFamilyId);
|
||||
|
||||
if (File.Exists("modxo-custom.bin"))
|
||||
{
|
||||
PackageModxoVariant(prometheos, "custom", modchip, defaultFamilyId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PackageAladdin1mb(string modchip)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var prometheos = ExtractPrometheOS(modchip);
|
||||
|
||||
var promethosXbePath = Path.GetFullPath($"..\\PrometheOSXbe\\PrometheOSXbe\\Release-{modchip}\\PrometheOS.xbe", slnFolder);
|
||||
if (File.Exists(promethosXbePath) == false)
|
||||
{
|
||||
Console.WriteLine("Error: Looks like you didnt build PrometheOSXbe.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Packing PrometheOS Xbe...");
|
||||
var promethosxbeBank = CompressBank(promethosXbePath, 508 * 1024);
|
||||
|
||||
var firmware = new byte[1024 * 1024];
|
||||
Array.Copy(promethosxbeBank, 0, firmware, 0x000000, 508 * 1024);
|
||||
Array.Copy(prometheos, 0, firmware, 0x0C0000, prometheos.Length);
|
||||
|
||||
var buildPath = Path.Combine(slnFolder, "..\\Build");
|
||||
Directory.CreateDirectory(buildPath);
|
||||
File.WriteAllBytes(Path.Combine(buildPath, $"prometheos-{modchip.ToLower()}.bin"), firmware);
|
||||
}
|
||||
|
||||
public static void PackageAladdin2mb(string modchip)
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var prometheos = ExtractPrometheOS(modchip);
|
||||
|
||||
var promethosXbePath = Path.GetFullPath($"..\\PrometheOSXbe\\PrometheOSXbe\\Release-{modchip}\\PrometheOS.xbe", slnFolder);
|
||||
if (File.Exists(promethosXbePath) == false)
|
||||
{
|
||||
Console.WriteLine("Error: Looks like you didnt build PrometheOSXbe.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Packing PrometheOS Xbe...");
|
||||
var promethosxbeBank = CompressBank(promethosXbePath, (768 - 36) * 1024);
|
||||
|
||||
var firmware = new byte[2 * 1024 * 1024];
|
||||
Array.Copy(promethosxbeBank, 0, firmware, 0x140000, (768 - 36) * 1024);
|
||||
Array.Copy(prometheos, 0, firmware, 0x100000, prometheos.Length);
|
||||
|
||||
var buildPath = Path.Combine(slnFolder, "..\\Build");
|
||||
Directory.CreateDirectory(buildPath);
|
||||
File.WriteAllBytes(Path.Combine(buildPath, $"prometheos-{modchip.ToLower()}.bin"), firmware);
|
||||
}
|
||||
|
||||
public static void FtpXeniumOS()
|
||||
{
|
||||
var slnFolder = Utility.GetSlnFolder();
|
||||
var buildPath = Path.Combine(slnFolder, "Build");
|
||||
|
||||
try
|
||||
{
|
||||
using (FtpClient ftpClient = new FtpClient("ftp://xenium.local", "admin", "Blu3P3t3r!"))
|
||||
{
|
||||
ftpClient.Connect();
|
||||
ftpClient.UploadFile(Path.Combine(buildPath, "xeniumos.bin"), "/home/admin/xenium-programmer/xenium-bin/xeniumos.bin");
|
||||
Console.WriteLine($"File uploaded successfully");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Error uploading file: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
namespace PrometheOSPacker.Helpers
|
||||
{
|
||||
internal static class Utility
|
||||
{
|
||||
public static string GetAppFolder()
|
||||
{
|
||||
return AppDomain.CurrentDomain.BaseDirectory;
|
||||
}
|
||||
|
||||
public static string GetSlnFolder()
|
||||
{
|
||||
var directory = GetAppFolder();
|
||||
var files = Directory.GetFiles(directory, "*.sln");
|
||||
while (files.Length == 0)
|
||||
{
|
||||
var parentDirectoryInfo = Directory.GetParent(directory);
|
||||
if (parentDirectoryInfo == null)
|
||||
{
|
||||
throw new Exception("Unable to get parent directory.");
|
||||
}
|
||||
directory = parentDirectoryInfo.FullName;
|
||||
files = Directory.GetFiles(directory, "*.sln");
|
||||
}
|
||||
return directory;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
using PrometheOSPacker.Helpers;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace PrometheOSPacker
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static async Task<bool> DownloadFileAsync(string url, string filename)
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] fileBytes = await client.GetByteArrayAsync(url);
|
||||
await File.WriteAllBytesAsync(filename, fileBytes);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"An error occurre downloading file: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Main()
|
||||
{
|
||||
var version = "V1.0.7";
|
||||
//version = "latest";
|
||||
|
||||
var baseUrl = $"https://github.com/Team-Resurgent/Modxo/releases/download/{version}";
|
||||
|
||||
Console.WriteLine("Downloading 'modxo-official-pico.bin'.");
|
||||
if (DownloadFileAsync($"{baseUrl}/modxo_official_pico.bin", "modxo-official-pico.bin").GetAwaiter().GetResult() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Downloading 'modxo-official-pico2.bin'.");
|
||||
if (DownloadFileAsync($"{baseUrl}/modxo_official_pico2.bin", "modxo-official-pico2.bin").GetAwaiter().GetResult() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Downloading 'modxo-yd-rp2040.bin'.");
|
||||
if (DownloadFileAsync($"{baseUrl}/modxo_yd_rp2040.bin", "modxo-yd-rp2040.bin").GetAwaiter().GetResult() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Downloading 'modxo-rp2040-zero-tiny.bin'.");
|
||||
if (DownloadFileAsync($"{baseUrl}/modxo_rp2040_zero_tiny.bin", "modxo-rp2040-zero-tiny.bin").GetAwaiter().GetResult() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Downloading 'modxo-xiao-rp2040.bin'.");
|
||||
if (DownloadFileAsync($"{baseUrl}/modxo_xiao_rp2040.bin", "modxo-xiao-rp2040.bin").GetAwaiter().GetResult() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Downloading 'modxo-ultra.bin'.");
|
||||
if (DownloadFileAsync($"{baseUrl}/modxo_ultra.bin", "modxo-ultra.bin").GetAwaiter().GetResult() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Console.WriteLine();
|
||||
|
||||
var prometheosWebTestIp = "192.168.1.66"; // If you change ip in PrometheOSWeb update here
|
||||
|
||||
Console.WriteLine("1) Updating embeded web files in XBE...");
|
||||
Minify.Process(prometheosWebTestIp);
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("2) Please now build as Release PrometheOSTools and PrometheOSXbe for every modchip...");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Press Enter when done.");
|
||||
Console.ReadLine();
|
||||
|
||||
Console.WriteLine("3) Packaging PrometheOSTools and PrometheOS firmware for each modchip...");
|
||||
|
||||
Package.PackageTools();
|
||||
|
||||
var modchips = new string[]
|
||||
{
|
||||
"Aladdin1mb",
|
||||
"Aladdin2mb",
|
||||
"Xenium",
|
||||
"Xecuter",
|
||||
"Xchanger",
|
||||
"Aladdin1mb",
|
||||
"Aladdin2mb",
|
||||
"Modxo",
|
||||
};
|
||||
|
||||
foreach (var modchip in modchips)
|
||||
{
|
||||
if (modchip.Equals("Xenium", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Package.PackageXenium(modchip);
|
||||
}
|
||||
|
||||
if (modchip.Equals("Xecuter", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Package.PackageXecuter(modchip);
|
||||
}
|
||||
|
||||
if (modchip.Equals("Xchanger", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Package.PackageXchanger(modchip);
|
||||
}
|
||||
|
||||
if (modchip.Equals("Aladdin1mb", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Package.PackageAladdin1mb(modchip);
|
||||
}
|
||||
|
||||
if (modchip.Equals("Aladdin2mb", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Package.PackageAladdin2mb(modchip);
|
||||
}
|
||||
|
||||
if (modchip.Equals("Modxo", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Package.PackageModxo(modchip);
|
||||
}
|
||||
|
||||
// Edit and enable below lines if you wish to ftp to xbox / xenium programmer
|
||||
//Console.WriteLine("4) FTP PrometheOS firmware...");
|
||||
//Package.FtpPrometheOS("127.0.0.1", "xbox", "xbox", $"/c/prometheos-{modchip}.bin");
|
||||
}
|
||||
|
||||
Console.WriteLine("Done\n");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Press Enter to finish.");
|
||||
Console.ReadLine();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Flashbin\**" />
|
||||
<EmbeddedResource Remove="Flashbin\**" />
|
||||
<None Remove="Flashbin\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="modxo.bin" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BundlerMinifier.Core" Version="3.2.449" />
|
||||
<PackageReference Include="FluentFTP" Version="52.0.0" />
|
||||
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.8" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.6" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang=en data-theme=dark><head><meta charset=utf-8 /><meta name=viewport content="width=device-width, initial-scale=1, shrink-to-fit=no" /><title>PrometheOS</title><link rel=icon type=image/x-icon href=favicon.ico /><link href=pico.css rel=stylesheet /></head><body><main class=container><form><h2>PrometheOS: Cerbios INI</h2><div><span id=content>Please Wait...</span></div><br /><div class=grid><a role=button href=javascript:void(0) onclick=setCerbiosIni()>Save</a> <a role=button class=secondary href=index.html>Back</a></div><br /><div><b>Copyright 2024 - Team Cerbios + Team Resurgent</b></div></form></main><script src=cerbiosini.js></script></body></html>
|
|
@ -0,0 +1,61 @@
|
|||
window.onload = function () {
|
||||
getCerbiosIni();
|
||||
};
|
||||
|
||||
async function getCerbiosIni()
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/cerbiosini").then(async response => {
|
||||
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
|
||||
let body = '';
|
||||
|
||||
while (true)
|
||||
{
|
||||
const { done, value } = await reader.read();
|
||||
if (done)
|
||||
{
|
||||
break;
|
||||
}
|
||||
const chunk = decoder.decode(value, { stream: true });
|
||||
body += chunk;
|
||||
}
|
||||
|
||||
let contentBody = "";
|
||||
contentBody += "<p><div class=\"grid\"><textarea rows=\"40\" cols=\"80\" spellcheck=\"false\" id=\"cerbiosini\">" + body + "</textarea></div></p>";
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = contentBody;
|
||||
|
||||
}).catch(error => {
|
||||
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to connect."
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async function setCerbiosIni()
|
||||
{
|
||||
let content = document.getElementById("cerbiosini");
|
||||
|
||||
var data = new FormData();
|
||||
data.append('body', content.innerText);
|
||||
await fetch("http://192.168.1.66/api/cerbiosini", {
|
||||
method: 'POST',
|
||||
body: data
|
||||
}).then(response => {
|
||||
if (response.status == 200) {
|
||||
window.location.href = "/index.html";
|
||||
} else {
|
||||
uploadFailure();
|
||||
}
|
||||
}).catch(() => {
|
||||
uploadFailure()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function uploadFailure() {
|
||||
alert("Upload failed.");
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang=en data-theme=dark><head><meta charset=utf-8 /><meta name=viewport content="width=device-width, initial-scale=1, shrink-to-fit=no" /><title>PrometheOS</title><link rel=icon type=image/x-icon href=favicon.ico /><link href=pico.css rel=stylesheet /></head><body><main class=container><form><h2>PrometheOS: Download BIOS</h2><div><span id=content>Please Wait...</span></div><br /><div class=grid><a role=button class=secondary href=index.html>Back</a></div><br /><div><b>Copyright 2024 - Team Cerbios + Team Resurgent</b></div></form></main><script src=download.js></script></body></html>
|
|
@ -0,0 +1,37 @@
|
|||
window.onload = function () {
|
||||
getBankInfo();
|
||||
};
|
||||
|
||||
async function getBankInfo() {
|
||||
await fetch("http://192.168.1.66/api/bankinfo.json").then(async response => {
|
||||
|
||||
const json = await response.json();
|
||||
|
||||
let contentBody = "";
|
||||
for (let i = 0; i < json.length; i++) {
|
||||
if (json[i].slots > 0) {
|
||||
contentBody += "<p><div class=\"grid\"><a role=\"button\" href=\"javascript:void(0)\" onclick=\"downloadBank(" + json[i].id + ", '" + json[i].name + ".bin')\">" + json[i].name + "</a></div></p>";
|
||||
}
|
||||
}
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = contentBody == "" ? "No items found." : contentBody;
|
||||
}).catch(error => {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to connect."
|
||||
});
|
||||
}
|
||||
|
||||
async function downloadBank(id, name)
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/downloadbank?" + id).catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => response.blob()).then(blob => {
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
});
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang=en data-theme=dark><head><meta charset=utf-8 /><meta name=viewport content="width=device-width, initial-scale=1, shrink-to-fit=no" /><title>PrometheOS</title><link rel=icon type=image/x-icon href=favicon.ico /><link href=pico.css rel=stylesheet /></head><body><main class=container><form><h2>PrometheOS</h2><div class=grid><a role=button href=download.html>Download BIOS</a></div><br /><div class=grid><a role=button href=javascript:void(0) onclick=downloadEeprom()>Download EEPROM</a></div><br /><div class=grid><a role=button href=javascript:void(0) onclick=downloadPrometheOS()>Download PrometheOS</a></div><br /><div class=grid><a role=button class=secondary href=index.html>Back</a></div><br /><div><b>Copyright 2024 - Team Cerbios + Team Resurgent</b></div></form></main><script src=downloads.js></script></body></html>
|
|
@ -0,0 +1 @@
|
|||
async function downloadEeprom(){await fetch("http://192.168.1.66/api/downloadeeprom").catch(()=>{content.innerHTML="Failed to connect."}).then(n=>n.blob()).then(n=>{var i=window.URL.createObjectURL(n),t=document.createElement("a");t.href=i;t.download="EEPROM.bin";document.body.appendChild(t);t.click();t.remove()})}async function downloadPrometheOS(){await fetch("http://192.168.1.66/api/downloadprom").catch(()=>{content.innerHTML="Failed to connect."}).then(n=>n.blob()).then(n=>{var i=window.URL.createObjectURL(n),t=document.createElement("a");t.href=i;t.download="PrometheOS.bin";document.body.appendChild(t);t.click();t.remove()})}
|
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang=en data-theme=dark><head><meta charset=utf-8 /><meta name=viewport content="width=device-width, initial-scale=1, shrink-to-fit=no" /><title>PrometheOS</title><link rel=icon type=image/x-icon href=favicon.ico /><link href=pico.css rel=stylesheet /><link href=main.css rel=stylesheet /></head><body><main class=container><form><h2>PrometheOS: Flash BIOS</h2><label for=file><b>File:</b></label><input type=file id=file onchange=refreshFileInfo() /><br /> <label for=name><b>Name:</b></label><input class=form-control type=text maxlength=40 id=name /><br /> <label for=slotsNeeded><b>Needed Slots:</b></label> <div id=slotsNeeded>NA</div><br /><label for=freeSlots><b>Free Slots:</b></label> <div id=freeSlots>0</div><br /><label for=ledColorButtons><b>LED Color:</b> <span id=ledColor>Off</span></label><div id=ledColorButtons><div class=grid> <button type=button class=btn-ledoff onclick=setLedColor(0)>Off</button> <button type=button class=btn-ledred onclick=setLedColor(1)>Red</button> <button type=button class=btn-ledgreen onclick=setLedColor(2)>Green</button> <button type=button class=btn-ledyellow onclick=setLedColor(3)>Yellow</button></div><div class=grid><button type=button class=btn-ledblue onclick=setLedColor(4)>Blue</button> <button type=button class=btn-ledpurple onclick=setLedColor(5)>Purple</button> <button type=button class=btn-ledturquoise onclick=setLedColor(6)>Turquoise</button> <button type=button class=btn-ledwhite onclick=setLedColor(7)>White</button></div></div><hr /><br /><div class=grid><a role=button disabled id=upload href=javascript:void(0) onclick=upload()>Upload</a> <a role=button class=secondary href=index.html>Back</a></div><br /><div><b>Copyright 2024 - Team Cerbios + Team Resurgent</b></div></form></main><script src=flash.js></script></body></html>
|
|
@ -0,0 +1,129 @@
|
|||
let ledColorState = 0;
|
||||
|
||||
window.onload = function () {
|
||||
refreshFileInfo();
|
||||
};
|
||||
|
||||
function getFileSize()
|
||||
{
|
||||
const file = document.getElementById("file");
|
||||
if (file.value == "") {
|
||||
return -1;
|
||||
}
|
||||
const fileSize = file.files[0].size;
|
||||
if (fileSize == 0) {
|
||||
return -1;
|
||||
} else if (fileSize % (256 * 1024) != 0) {
|
||||
return -1;
|
||||
} else if (fileSize > (1024 * 1024)) {
|
||||
return -1;
|
||||
}
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
async function refreshFileInfo()
|
||||
{
|
||||
const file = document.getElementById("file");
|
||||
if (file.value != "") {
|
||||
const name = document.getElementById("name");
|
||||
name.value = file.files[0].name.substring(0, 40);
|
||||
}
|
||||
|
||||
await fetch("http://192.168.1.66/api/freeslots.json").then(async response => {
|
||||
|
||||
const json = await response.json();
|
||||
const freeSlots = document.getElementById("freeSlots");
|
||||
freeSlots.textContent = json["freeslots"];
|
||||
|
||||
const upload = document.getElementById("upload");
|
||||
const slotsNeeeded = document.getElementById("slotsNeeded");
|
||||
const fileSize = getFileSize();
|
||||
|
||||
if (fileSize < 0) {
|
||||
upload.setAttribute("disabled", "disabled");
|
||||
slotsNeeeded.textContent = "NA";
|
||||
}
|
||||
else
|
||||
{
|
||||
const slotsNeededValue = fileSize / (256 * 1024);
|
||||
slotsNeeeded.textContent = slotsNeededValue;
|
||||
if (slotsNeededValue > json["freeslots"]) {
|
||||
upload.setAttribute("disabled", "disabled");
|
||||
} else {
|
||||
upload.removeAttribute("disabled");
|
||||
}
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
function setLedColor(ledColor)
|
||||
{
|
||||
ledColorState = ledColor;
|
||||
|
||||
let ledColorText = document.getElementById("ledColor");
|
||||
switch (ledColor) {
|
||||
case 1:
|
||||
ledColorText.textContent = "Red";
|
||||
break;
|
||||
case 2:
|
||||
ledColorText.textContent = "Green";
|
||||
break;
|
||||
case 3:
|
||||
ledColorText.textContent = "Yellow";
|
||||
break;
|
||||
case 4:
|
||||
ledColorText.textContent = "Blue";
|
||||
break;
|
||||
case 5:
|
||||
ledColorText.textContent = "Purple";
|
||||
break;
|
||||
case 6:
|
||||
ledColorText.textContent = "Turquoise";
|
||||
break;
|
||||
case 7:
|
||||
ledColorText.textContent = "White";
|
||||
break;
|
||||
default:
|
||||
ledColorText.textContent = "Off";
|
||||
}
|
||||
}
|
||||
|
||||
async function upload()
|
||||
{
|
||||
const upload = document.getElementById("upload");
|
||||
upload.setAttribute("disabled", "disabled");
|
||||
const file = document.getElementById("file");
|
||||
file.setAttribute("disabled", "disabled");
|
||||
|
||||
const name = document.getElementById("name");
|
||||
|
||||
var data = new FormData();
|
||||
data.append('file', file.files[0]);
|
||||
data.append('body', "{\"ledColor\":" + ledColorState + ",\"bankName\":\"" + name.value + "\"}");
|
||||
await fetch("http://192.168.1.66/api/upload", {
|
||||
method: 'POST',
|
||||
body: data
|
||||
}).then(response => {
|
||||
if (response.status == 200) {
|
||||
window.location.href = "/index.html";
|
||||
} else {
|
||||
uploadFailure();
|
||||
}
|
||||
}).catch(() => {
|
||||
uploadFailure()
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function uploadFailure()
|
||||
{
|
||||
alert("Upload failed.");
|
||||
let upload = document.getElementById("upload");
|
||||
upload.removeAttribute("disabled");
|
||||
let file = document.getElementById("file");
|
||||
file.removeAttribute("disabled");
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang=en data-theme=dark><head><meta charset=utf-8 /><meta name=viewport content="width=device-width, initial-scale=1, shrink-to-fit=no" /><title>PrometheOS</title><link rel=icon type=image/x-icon href=favicon.ico /><link href=pico.css rel=stylesheet /></head><body><main class=container><form><h2>PrometheOS</h2><div class=grid><a role=button href=launch.html>Launch BIOS</a></div><br /><div class=grid><a role=button href=remove.html>Remove BIOS</a></div><br /><div class=grid><a role=button href=flash.html>Flash BIOS</a></div><br /><div class=grid><a role=button href=downloads.html>Downloads</a></div><br /><div class=grid><a role=button href=cerbiosini.html>Cerbios INI</a></div><br /><div class=grid><a role=button href=javascript:void(0) onclick=screenshot()>Take Screenshot</a></div><br /><div class=grid><a role=button href=remoteview.html>Remote View</a></div><br /><div class=grid><a role=button href=javascript:void(0) onclick=reboot()>Reboot</a></div><br /><div class=grid><a role=button href=javascript:void(0) onclick=shutdown()>Shutdown</a></div><br /><div><b>Copyright 2024 - Team Cerbios + Team Resurgent</b></div></form></main><script src=index.js></script></body></html>
|
|
@ -0,0 +1 @@
|
|||
async function screenshot(){await fetch("http://192.168.1.66/api/screenshot").catch(()=>{content.innerHTML="Failed to connect."}).then(n=>n.blob()).then(n=>{var i=window.URL.createObjectURL(n),t=document.createElement("a");t.href=i;t.download="screenshot.png";document.body.appendChild(t);t.click();t.remove()})}async function reboot(){await fetch("http://192.168.1.66/api/reboot")}async function shutdown(){await fetch("http://192.168.1.66/api/shutdown")}
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang=en data-theme=dark><head><meta charset=utf-8 /><meta name=viewport content="width=device-width, initial-scale=1, shrink-to-fit=no" /><title>PrometheOS</title><link rel=icon type=image/x-icon href=favicon.ico /><link href=pico.css rel=stylesheet /></head><body><main class=container><form><h2>PrometheOS: Launch BIOS</h2><div><span id=content>Please Wait...</span></div><br /><div class=grid><a role=button class=secondary href=index.html>Back</a></div><br /><div><b>Copyright 2024 - Team Cerbios + Team Resurgent</b></div></form></main><script src=launch.js></script></body></html>
|
|
@ -0,0 +1,53 @@
|
|||
window.onload = function () {
|
||||
getBankInfo();
|
||||
};
|
||||
|
||||
async function getBankInfo() {
|
||||
await fetch("http://192.168.1.66/api/bankinfo.json").then(async response => {
|
||||
|
||||
const json = await response.json();
|
||||
|
||||
let contentBody = "";
|
||||
for (let i = 0; i < json.length; i++) {
|
||||
if (json[i].slots > 0) {
|
||||
contentBody += "<p><div class=\"grid\"><a role=\"button\" href=\"javascript:void(0)\" onclick=\"launchBank(" + json[i].id + ")\">" + json[i].name + "</a></div></p>";
|
||||
}
|
||||
}
|
||||
contentBody += "<p><div class=\"grid\"><a role=\"button\" href=\"javascript:void(0)\" onclick=\"launchTsop()\">TSOP</a></div></p>";
|
||||
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = contentBody;
|
||||
}).catch(error => {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to connect."
|
||||
});
|
||||
}
|
||||
|
||||
async function launchBank(id)
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/launchbank?" + id).catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => {
|
||||
if (response.status == 200) {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Launching..."
|
||||
} else {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to launch."
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function launchTsop() {
|
||||
await fetch("http://192.168.1.66/api/launchtsop").catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => {
|
||||
if (response.status == 200) {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Launching..."
|
||||
} else {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to launch."
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
.btn-ledoff{color:#fff;background-color:#404040;border-color:#000}.btn-ledoff:hover,.btn-ledoff:focus,.btn-ledoff:active,.btn-ledoff.active{color:#fff;background-color:#202020;border-color:#000}.btn-ledred{color:#000;background-color:#aa0a00;border-color:#000}.btn-ledred:hover,.btn-ledred:focus,.btn-ledred:active,.btn-ledred.active{color:#000;background-color:#d40c00;border-color:#000}.btn-ledgreen{color:#000;background-color:#289a23;border-color:#000}.btn-ledgreen:hover,.btn-ledgreen:focus,.btn-ledgreen:active,.btn-ledgreen.active{color:#000;background-color:#32c12c;border-color:#000}.btn-ledyellow{color:#000;background-color:#cca400;border-color:#000}.btn-ledyellow:hover,.btn-ledyellow:focus,.btn-ledyellow:active,.btn-ledyellow.active{color:#000;background-color:#ffcd00;border-color:#000}.btn-ledblue{color:#000;background-color:#4358cc;border-color:#000}.btn-ledblue:hover,.btn-ledblue:focus,.btn-ledblue:active,.btn-ledblue.active{color:#fff;background-color:#526eff;border-color:#000}.btn-ledpurple{color:#000;background-color:#663fa1;border-color:#000}.btn-ledpurple:hover,.btn-ledpurple:focus,.btn-ledpurple:active,.btn-ledpurple.active{color:#000;background-color:#7f4fc9;border-color:#000}.btn-ledturquoise{color:#000;background-color:#0096ae;border-color:#000}.btn-ledturquoise:hover,.btn-ledturquoise:focus,.btn-ledturquoise:active,.btn-ledturquoise.active{color:#000;background-color:#00bcd9;border-color:#000}.btn-ledwhite{color:#000;background-color:#c0c0c0;border-color:#000}.btn-ledwhite:hover,.btn-ledwhite:focus,.btn-ledwhite:active,.btn-ledwhite.active{color:#000;background-color:#f0f0f0;border-color:#000}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang=en data-theme=dark><head><meta charset=utf-8 /><meta name=viewport content="width=device-width, initial-scale=1, shrink-to-fit=no" /><title>PrometheOS</title><link rel=icon type=image/x-icon href=favicon.ico /><link href=pico.css rel=stylesheet /></head><body><main class=container><form><h2>PrometheOS: Remote View</h2><div><span id=content>Please Wait...</span></div><br /><div class=grid><a role=button href=javascript:void(0) onclick=screenshot()>Refresh View</a></div><br /><div class=grid><a role=button class=secondary href=index.html>Back</a></div><br /><div><b>Copyright 2024 - Team Cerbios + Team Resurgent</b></div></form></main><script src=remoteview.js></script></body></html>
|
|
@ -0,0 +1 @@
|
|||
async function screenshot(){await fetch("http://192.168.1.66/api/screenshot").catch(()=>{content.innerHTML="Failed to connect."}).then(n=>n.blob()).then(n=>{var r=window.URL.createObjectURL(n),t=document.createElement("img");t.src=r;t.alt="Screenshot";t.style="max-width: 100%; height: auto";const i=document.getElementById("content");i.innerHTML="";i.appendChild(t)})}window.onload=function(){screenshot()};
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html lang=en data-theme=dark><head><meta charset=utf-8 /><meta name=viewport content="width=device-width, initial-scale=1, shrink-to-fit=no" /><title>PrometheOS</title><link rel=icon type=image/x-icon href=favicon.ico /><link href=pico.css rel=stylesheet /></head><body><main class=container><form><h2>PrometheOS: Remove BIOS</h2><div><span id=content>Please Wait...</span></div><br /><div class=grid><a role=button class=secondary href=index.html>Back</a></div><br /><div><b>Copyright 2024 - Team Cerbios + Team Resurgent</b></div></form></main><script src=remove.js></script></body></html>
|
|
@ -0,0 +1,35 @@
|
|||
window.onload = function () {
|
||||
getBankInfo();
|
||||
};
|
||||
|
||||
async function getBankInfo()
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/bankinfo.json").then(async response => {
|
||||
|
||||
const json = await response.json();
|
||||
|
||||
let contentBody = "";
|
||||
for (let i = 0; i < json.length; i++) {
|
||||
if (json[i].slots > 0) {
|
||||
contentBody += "<p><div class=\"grid\"><a role=\"button\" href=\"javascript:void(0)\" onclick=\"removeBank(" + json[i].id + ")\">" + json[i].name + "</a></div></p>";
|
||||
}
|
||||
}
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = contentBody == "" ? "No items found." : contentBody;
|
||||
|
||||
}).catch(error => {
|
||||
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to connect."
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async function removeBank(id)
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/removebank?" + id).then(() => {
|
||||
getBankInfo();
|
||||
}).catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
});
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34031.279
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrometheOSWeb", "PrometheOSWeb\PrometheOSWeb.csproj", "{9349C526-499C-451B-B23C-A7F69E0AD300}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrometheOSPacker", "PrometheOSPacker\PrometheOSPacker.csproj", "{D7989A53-A931-4EB4-9E07-93152E01E701}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9349C526-499C-451B-B23C-A7F69E0AD300}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9349C526-499C-451B-B23C-A7F69E0AD300}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9349C526-499C-451B-B23C-A7F69E0AD300}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9349C526-499C-451B-B23C-A7F69E0AD300}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D7989A53-A931-4EB4-9E07-93152E01E701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D7989A53-A931-4EB4-9E07-93152E01E701}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7989A53-A931-4EB4-9E07-93152E01E701}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7989A53-A931-4EB4-9E07-93152E01E701}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C911CF43-768E-487C-81BB-34D4FAF94C2B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,30 @@
|
|||
namespace PrometheOSWeb
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorPages();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
}
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapRazorPages();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:38829",
|
||||
"launchUrl": "index.html",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"PrometheOSWeb": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5190",
|
||||
"launchUrl": "index.html",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"DetailedErrors": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>PrometheOS</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link href="pico.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<form>
|
||||
<h2>PrometheOS: Cerbios INI</h2>
|
||||
<div>
|
||||
<span id="content">Please Wait...</span>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="javascript:void(0)" onclick="setCerbiosIni()">Save</a>
|
||||
<a role="button" class="secondary" href="index.html">Back</a>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<b>Copyright 2024 - Team Cerbios + Team Resurgent</b>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
<script src="cerbiosini.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,61 @@
|
|||
window.onload = function () {
|
||||
getCerbiosIni();
|
||||
};
|
||||
|
||||
async function getCerbiosIni()
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/cerbiosini").then(async response => {
|
||||
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
|
||||
let body = '';
|
||||
|
||||
while (true)
|
||||
{
|
||||
const { done, value } = await reader.read();
|
||||
if (done)
|
||||
{
|
||||
break;
|
||||
}
|
||||
const chunk = decoder.decode(value, { stream: true });
|
||||
body += chunk;
|
||||
}
|
||||
|
||||
let contentBody = "";
|
||||
contentBody += "<p><div class=\"grid\"><textarea rows=\"40\" cols=\"80\" spellcheck=\"false\" id=\"cerbiosini\">" + body + "</textarea></div></p>";
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = contentBody;
|
||||
|
||||
}).catch(error => {
|
||||
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to connect."
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async function setCerbiosIni()
|
||||
{
|
||||
let content = document.getElementById("cerbiosini");
|
||||
|
||||
var data = new FormData();
|
||||
data.append('body', content.innerText);
|
||||
await fetch("http://192.168.1.66/api/cerbiosini", {
|
||||
method: 'POST',
|
||||
body: data
|
||||
}).then(response => {
|
||||
if (response.status == 200) {
|
||||
window.location.href = "/index.html";
|
||||
} else {
|
||||
uploadFailure();
|
||||
}
|
||||
}).catch(() => {
|
||||
uploadFailure()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function uploadFailure() {
|
||||
alert("Upload failed.");
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>PrometheOS</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link href="pico.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<form>
|
||||
<h2>PrometheOS: Download BIOS</h2>
|
||||
<div>
|
||||
<span id="content">Please Wait...</span>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" class="secondary" href="index.html">Back</a>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<b>Copyright 2024 - Team Cerbios + Team Resurgent</b>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
<script src="download.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
window.onload = function () {
|
||||
getBankInfo();
|
||||
};
|
||||
|
||||
async function getBankInfo() {
|
||||
await fetch("http://192.168.1.66/api/bankinfo.json").then(async response => {
|
||||
|
||||
const json = await response.json();
|
||||
|
||||
let contentBody = "";
|
||||
for (let i = 0; i < json.length; i++) {
|
||||
if (json[i].slots > 0) {
|
||||
contentBody += "<p><div class=\"grid\"><a role=\"button\" href=\"javascript:void(0)\" onclick=\"downloadBank(" + json[i].id + ", '" + json[i].name + ".bin')\">" + json[i].name + "</a></div></p>";
|
||||
}
|
||||
}
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = contentBody == "" ? "No items found." : contentBody;
|
||||
}).catch(error => {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to connect."
|
||||
});
|
||||
}
|
||||
|
||||
async function downloadBank(id, name)
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/downloadbank?" + id).catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => response.blob()).then(blob => {
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
});
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>PrometheOS</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link href="pico.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<form>
|
||||
<h2>PrometheOS</h2>
|
||||
<div class="grid">
|
||||
<a role="button" href="download.html">Download BIOS</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="javascript:void(0)" onclick="downloadEeprom()">Download EEPROM</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="javascript:void(0)" onclick="downloadPrometheOS()">Download PrometheOS</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" class="secondary" href="index.html">Back</a>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<b>Copyright 2024 - Team Cerbios + Team Resurgent</b>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
<script src="downloads.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
async function downloadEeprom() {
|
||||
await fetch("http://192.168.1.66/api/downloadeeprom").catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => response.blob()).then(blob => {
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = "EEPROM.bin";
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
});
|
||||
}
|
||||
|
||||
async function downloadPrometheOS(id, name) {
|
||||
await fetch("http://192.168.1.66/api/downloadprom").catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => response.blob()).then(blob => {
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = "PrometheOS.bin";
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
});
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>PrometheOS</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link href="pico.css" rel="stylesheet" />
|
||||
<link href="main.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<form>
|
||||
<h2>PrometheOS: Flash BIOS</h2>
|
||||
<label for="file"><b>File:</b></label>
|
||||
<input type="file" id="file" onchange="refreshFileInfo()" />
|
||||
<br />
|
||||
<label for="name"><b>Name:</b></label>
|
||||
<input class="form-control" type="text" maxlength="40" id="name" />
|
||||
<br />
|
||||
<label for="slotsNeeded"><b>Needed Slots:</b></label>
|
||||
<div id="slotsNeeded">NA</div>
|
||||
<br />
|
||||
<label for="freeSlots"><b>Free Slots:</b></label>
|
||||
<div id="freeSlots">0</div>
|
||||
<br />
|
||||
<label for="ledColorButtons"><b>LED Color:</b> <span id="ledColor">Off</span></label>
|
||||
<div id="ledColorButtons">
|
||||
<div class="grid">
|
||||
<button type="button" class="btn-ledoff" onclick="setLedColor(0)">Off</button>
|
||||
<button type="button" class="btn-ledred" onclick="setLedColor(1)">Red</button>
|
||||
<button type="button" class="btn-ledgreen" onclick="setLedColor(2)">Green</button>
|
||||
<button type="button" class="btn-ledyellow" onclick="setLedColor(3)">Yellow</button>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<button type="button" class="btn-ledblue" onclick="setLedColor(4)">Blue</button>
|
||||
<button type="button" class="btn-ledpurple" onclick="setLedColor(5)">Purple</button>
|
||||
<button type="button" class="btn-ledturquoise" onclick="setLedColor(6)">Turquoise</button>
|
||||
<button type="button" class="btn-ledwhite" onclick="setLedColor(7)">White</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" disabled id="upload" href="javascript:void(0)" onclick="upload()">Upload</a>
|
||||
<a role="button" class="secondary" href="index.html">Back</a>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<b>Copyright 2024 - Team Cerbios + Team Resurgent</b>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
<script src="flash.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,129 @@
|
|||
let ledColorState = 0;
|
||||
|
||||
window.onload = function () {
|
||||
refreshFileInfo();
|
||||
};
|
||||
|
||||
function getFileSize()
|
||||
{
|
||||
const file = document.getElementById("file");
|
||||
if (file.value == "") {
|
||||
return -1;
|
||||
}
|
||||
const fileSize = file.files[0].size;
|
||||
if (fileSize == 0) {
|
||||
return -1;
|
||||
} else if (fileSize % (256 * 1024) != 0) {
|
||||
return -1;
|
||||
} else if (fileSize > (1024 * 1024)) {
|
||||
return -1;
|
||||
}
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
async function refreshFileInfo()
|
||||
{
|
||||
const file = document.getElementById("file");
|
||||
if (file.value != "") {
|
||||
const name = document.getElementById("name");
|
||||
name.value = file.files[0].name.substring(0, 40);
|
||||
}
|
||||
|
||||
await fetch("http://192.168.1.66/api/freeslots.json").then(async response => {
|
||||
|
||||
const json = await response.json();
|
||||
const freeSlots = document.getElementById("freeSlots");
|
||||
freeSlots.textContent = json["freeslots"];
|
||||
|
||||
const upload = document.getElementById("upload");
|
||||
const slotsNeeeded = document.getElementById("slotsNeeded");
|
||||
const fileSize = getFileSize();
|
||||
|
||||
if (fileSize < 0) {
|
||||
upload.setAttribute("disabled", "disabled");
|
||||
slotsNeeeded.textContent = "NA";
|
||||
}
|
||||
else
|
||||
{
|
||||
const slotsNeededValue = fileSize / (256 * 1024);
|
||||
slotsNeeeded.textContent = slotsNeededValue;
|
||||
if (slotsNeededValue > json["freeslots"]) {
|
||||
upload.setAttribute("disabled", "disabled");
|
||||
} else {
|
||||
upload.removeAttribute("disabled");
|
||||
}
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
function setLedColor(ledColor)
|
||||
{
|
||||
ledColorState = ledColor;
|
||||
|
||||
let ledColorText = document.getElementById("ledColor");
|
||||
switch (ledColor) {
|
||||
case 1:
|
||||
ledColorText.textContent = "Red";
|
||||
break;
|
||||
case 2:
|
||||
ledColorText.textContent = "Green";
|
||||
break;
|
||||
case 3:
|
||||
ledColorText.textContent = "Yellow";
|
||||
break;
|
||||
case 4:
|
||||
ledColorText.textContent = "Blue";
|
||||
break;
|
||||
case 5:
|
||||
ledColorText.textContent = "Purple";
|
||||
break;
|
||||
case 6:
|
||||
ledColorText.textContent = "Turquoise";
|
||||
break;
|
||||
case 7:
|
||||
ledColorText.textContent = "White";
|
||||
break;
|
||||
default:
|
||||
ledColorText.textContent = "Off";
|
||||
}
|
||||
}
|
||||
|
||||
async function upload()
|
||||
{
|
||||
const upload = document.getElementById("upload");
|
||||
upload.setAttribute("disabled", "disabled");
|
||||
const file = document.getElementById("file");
|
||||
file.setAttribute("disabled", "disabled");
|
||||
|
||||
const name = document.getElementById("name");
|
||||
|
||||
var data = new FormData();
|
||||
data.append('file', file.files[0]);
|
||||
data.append('body', "{\"ledColor\":" + ledColorState + ",\"bankName\":\"" + name.value + "\"}");
|
||||
await fetch("http://192.168.1.66/api/upload", {
|
||||
method: 'POST',
|
||||
body: data
|
||||
}).then(response => {
|
||||
if (response.status == 200) {
|
||||
window.location.href = "/index.html";
|
||||
} else {
|
||||
uploadFailure();
|
||||
}
|
||||
}).catch(() => {
|
||||
uploadFailure()
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function uploadFailure()
|
||||
{
|
||||
alert("Upload failed.");
|
||||
let upload = document.getElementById("upload");
|
||||
upload.removeAttribute("disabled");
|
||||
let file = document.getElementById("file");
|
||||
file.removeAttribute("disabled");
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>PrometheOS</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link href="pico.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<form>
|
||||
<h2>PrometheOS</h2>
|
||||
<div class="grid">
|
||||
<a role="button" href="launch.html">Launch BIOS</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="remove.html">Remove BIOS</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="flash.html">Flash BIOS</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="downloads.html">Downloads</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="cerbiosini.html">Cerbios INI</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="javascript:void(0)" onclick="screenshot()">Take Screenshot</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="remoteview.html">Remote View</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="javascript:void(0)" onclick="reboot()">Reboot</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="javascript:void(0)" onclick="shutdown()">Shutdown</a>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<b>Copyright 2024 - Team Cerbios + Team Resurgent</b>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,19 @@
|
|||
async function screenshot() {
|
||||
await fetch("http://192.168.1.66/api/screenshot").catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => response.blob()).then(blob => {
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = "screenshot.png";
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
});
|
||||
}
|
||||
async function reboot() {
|
||||
await fetch("http://192.168.1.66/api/reboot");
|
||||
}
|
||||
async function shutdown() {
|
||||
await fetch("http://192.168.1.66/api/shutdown");
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>PrometheOS</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link href="pico.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<form>
|
||||
<h2>PrometheOS: Launch BIOS</h2>
|
||||
<div>
|
||||
<span id="content">Please Wait...</span>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" class="secondary" href="index.html">Back</a>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<b>Copyright 2024 - Team Cerbios + Team Resurgent</b>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
<script src="launch.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,53 @@
|
|||
window.onload = function () {
|
||||
getBankInfo();
|
||||
};
|
||||
|
||||
async function getBankInfo() {
|
||||
await fetch("http://192.168.1.66/api/bankinfo.json").then(async response => {
|
||||
|
||||
const json = await response.json();
|
||||
|
||||
let contentBody = "";
|
||||
for (let i = 0; i < json.length; i++) {
|
||||
if (json[i].slots > 0) {
|
||||
contentBody += "<p><div class=\"grid\"><a role=\"button\" href=\"javascript:void(0)\" onclick=\"launchBank(" + json[i].id + ")\">" + json[i].name + "</a></div></p>";
|
||||
}
|
||||
}
|
||||
contentBody += "<p><div class=\"grid\"><a role=\"button\" href=\"javascript:void(0)\" onclick=\"launchTsop()\">TSOP</a></div></p>";
|
||||
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = contentBody;
|
||||
}).catch(error => {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to connect."
|
||||
});
|
||||
}
|
||||
|
||||
async function launchBank(id)
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/launchbank?" + id).catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => {
|
||||
if (response.status == 200) {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Launching..."
|
||||
} else {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to launch."
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function launchTsop() {
|
||||
await fetch("http://192.168.1.66/api/launchtsop").catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => {
|
||||
if (response.status == 200) {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Launching..."
|
||||
} else {
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to launch."
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
.btn-ledoff {
|
||||
color: #ffffff;
|
||||
background-color: #404040;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledoff:hover,
|
||||
.btn-ledoff:focus,
|
||||
.btn-ledoff:active,
|
||||
.btn-ledoff.active {
|
||||
color: #ffffff;
|
||||
background-color: #202020;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledred {
|
||||
color: #000000;
|
||||
background-color: #aa0a00;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledred:hover,
|
||||
.btn-ledred:focus,
|
||||
.btn-ledred:active,
|
||||
.btn-ledred.active {
|
||||
color: #000000;
|
||||
background-color: #d40c00;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledgreen {
|
||||
color: #000000;
|
||||
background-color: #289a23;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledgreen:hover,
|
||||
.btn-ledgreen:focus,
|
||||
.btn-ledgreen:active,
|
||||
.btn-ledgreen.active {
|
||||
color: #000000;
|
||||
background-color: #32c12c;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledyellow {
|
||||
color: #000000;
|
||||
background-color: #cca400;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledyellow:hover,
|
||||
.btn-ledyellow:focus,
|
||||
.btn-ledyellow:active,
|
||||
.btn-ledyellow.active {
|
||||
color: #000000;
|
||||
background-color: #ffcd00;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledblue {
|
||||
color: #000000;
|
||||
background-color: #4358cc;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledblue:hover,
|
||||
.btn-ledblue:focus,
|
||||
.btn-ledblue:active,
|
||||
.btn-ledblue.active {
|
||||
color: #ffffff;
|
||||
background-color: #526eff;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledpurple {
|
||||
color: #000000;
|
||||
background-color: #663fa1;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledpurple:hover,
|
||||
.btn-ledpurple:focus,
|
||||
.btn-ledpurple:active,
|
||||
.btn-ledpurple.active {
|
||||
color: #000000;
|
||||
background-color: #7f4fc9;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledturquoise {
|
||||
color: #000000;
|
||||
background-color: #0096ae;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledturquoise:hover,
|
||||
.btn-ledturquoise:focus,
|
||||
.btn-ledturquoise:active,
|
||||
.btn-ledturquoise.active {
|
||||
color: #000000;
|
||||
background-color: #00bcd9;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledwhite {
|
||||
color: #000000;
|
||||
background-color: #c0c0c0;
|
||||
border-color: #000000;
|
||||
}
|
||||
|
||||
.btn-ledwhite:hover,
|
||||
.btn-ledwhite:focus,
|
||||
.btn-ledwhite:active,
|
||||
.btn-ledwhite.active {
|
||||
color: #000000;
|
||||
background-color: #f0f0f0;
|
||||
border-color: #000000;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>PrometheOS</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link href="pico.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<form>
|
||||
<h2>PrometheOS: Remote View</h2>
|
||||
<div>
|
||||
<span id="content">Please Wait...</span>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" href="javascript:void(0)" onclick="screenshot()">Refresh View</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" class="secondary" href="index.html">Back</a>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<b>Copyright 2024 - Team Cerbios + Team Resurgent</b>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
<script src="remoteview.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,19 @@
|
|||
window.onload = function () {
|
||||
screenshot();
|
||||
};
|
||||
async function screenshot() {
|
||||
await fetch("http://192.168.1.66/api/screenshot").catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
}).then(response => response.blob()).then(blob => {
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
|
||||
var img = document.createElement('img');
|
||||
img.src = url;
|
||||
img.alt = "Screenshot";
|
||||
img.style = "max-width: 100%; height: auto";
|
||||
|
||||
const content = document.getElementById('content');
|
||||
content.innerHTML = "";
|
||||
content.appendChild(img);
|
||||
});
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>PrometheOS</title>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link href="pico.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<form>
|
||||
<h2>PrometheOS: Remove BIOS</h2>
|
||||
<div>
|
||||
<span id="content">Please Wait...</span>
|
||||
</div>
|
||||
<br />
|
||||
<div class="grid">
|
||||
<a role="button" class="secondary" href="index.html">Back</a>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<b>Copyright 2024 - Team Cerbios + Team Resurgent</b>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
<script src="remove.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,35 @@
|
|||
window.onload = function () {
|
||||
getBankInfo();
|
||||
};
|
||||
|
||||
async function getBankInfo()
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/bankinfo.json").then(async response => {
|
||||
|
||||
const json = await response.json();
|
||||
|
||||
let contentBody = "";
|
||||
for (let i = 0; i < json.length; i++) {
|
||||
if (json[i].slots > 0) {
|
||||
contentBody += "<p><div class=\"grid\"><a role=\"button\" href=\"javascript:void(0)\" onclick=\"removeBank(" + json[i].id + ")\">" + json[i].name + "</a></div></p>";
|
||||
}
|
||||
}
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = contentBody == "" ? "No items found." : contentBody;
|
||||
|
||||
}).catch(error => {
|
||||
|
||||
let content = document.getElementById("content");
|
||||
content.innerHTML = "Failed to connect."
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async function removeBank(id)
|
||||
{
|
||||
await fetch("http://192.168.1.66/api/removebank?" + id).then(() => {
|
||||
getBankInfo();
|
||||
}).catch(error => {
|
||||
content.innerHTML = "Failed to connect."
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue