Skip to content

Commit

Permalink
Initial start for Launcher Installer
Browse files Browse the repository at this point in the history
  • Loading branch information
Randy von der Weide authored and SonnyX committed Dec 24, 2021
1 parent 779ad45 commit 55e767e
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
backend/target
backend/Cargo.lock
installer/target
installer/Cargo.lock
RenegadeX-Launcher.ini
RenegadeX-Launcher.exe
C:/
.idea/
.vs/
RenegadeX-Launcher
Renegade X Launcher.exe
Launcher-Installer.exe
RenX-Launcher.zip
15 changes: 15 additions & 0 deletions installer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "Launcher-Installer"
version = "0.1.0"
authors = ["SonnyX"]
edition = "2021"

[dependencies]
sciter-rs = "0.5"

[build-dependencies]
embed-resource = "1.6"

[profile.release]
opt-level = 'z'
lto = true
2 changes: 2 additions & 0 deletions installer/Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target."i686-pc-windows-gnu"]
image = "rustembedded/cross:i686-pc-windows-gnu"
9 changes: 9 additions & 0 deletions installer/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extern crate embed_resource;
use std::env;


fn main() {
if env::var("CARGO_CFG_TARGET_OS").unwrap().eq("windows") {
embed_resource::compile("manifest.rc");
}
}
3 changes: 3 additions & 0 deletions installer/manifest.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#define RT_MANIFEST 24
1 RT_MANIFEST "rx.manifest"
2 ICON "rx.ico"
Binary file added installer/rx.ico
Binary file not shown.
2 changes: 2 additions & 0 deletions installer/rx.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity></dependentAssembly></dependency><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo><asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns="urn:schemas-microsoft-com:asm.v3"><asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"><dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware><dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness></asmv3:windowsSettings></asmv3:application><ms_compatibility:compatibility xmlns:ms_compatibility="urn:schemas-microsoft-com:compatibility.v1" xmlns="urn:schemas-microsoft-com:compatibility.v1"><ms_compatibility:application xmlns:ms_compatibility="urn:schemas-microsoft-com:compatibility.v1"><ms_compatibility:supportedOS xmlns:ms_compatibility="urn:schemas-microsoft-com:compatibility.v1" Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></ms_compatibility:supportedOS><ms_compatibility:supportedOS xmlns:ms_compatibility="urn:schemas-microsoft-com:compatibility.v1" Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></ms_compatibility:supportedOS><ms_compatibility:supportedOS xmlns:ms_compatibility="urn:schemas-microsoft-com:compatibility.v1" Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></ms_compatibility:supportedOS><ms_compatibility:supportedOS xmlns:ms_compatibility="urn:schemas-microsoft-com:compatibility.v1" Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></ms_compatibility:supportedOS><ms_compatibility:supportedOS xmlns:ms_compatibility="urn:schemas-microsoft-com:compatibility.v1" Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></ms_compatibility:supportedOS></ms_compatibility:application></ms_compatibility:compatibility></assembly>
Binary file added installer/sciter.dll
Binary file not shown.
59 changes: 59 additions & 0 deletions installer/src/dom.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<html window-frame="extended" window-resizable>

<head>
<title>Totem Arts Launcher Installer</title>
<style>

</style>
<script type="module">
import * as sys from "@sys";

function log(str)
{
const plaintext = document.$("plaintext");

plaintext.append(str);
console.log(str);
}

document.on("click", "button", async function() {
try {
const url = "https://static.ren-x.com/launcher_data/version/release.json";

log("start download...");

const json_response = await fetch(url, {
downloadProgress: function(index, total) {
log(`progress - ${index} - ${total} - ${Math.round(100 * index / total)}%`);
}
});

const version_info = await json_response.json();
const download_url = version_info["launcher"]["patch_url"];

const zip_response = await fetch(download_url, {
downloadProgress: function(index, total) {
log(`progress - ${index} - ${total} - ${Math.round(100 * index / total)}%`);
}
});
const zip = await zip_response.arrayBuffer();

log("download complete");

let file = await sys.fs.open("launcher.zip", "w+", 0o666);
await file.write(zip);
await file.close();
} catch (e) {
log(e);
}
});
</script>
</head>

<body>
<h1>fetch file download with progress</h1>
<button>Download</button>
<plaintext />
</body>

</html>
17 changes: 17 additions & 0 deletions installer/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![windows_subsystem="windows"]
extern crate sciter;
use std::io::Write;

const SCITER_DLL : &'static [u8] = include_bytes!("../sciter.dll");
const DOM_HTM : &'static [u8] = include_bytes!("dom.htm");

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sciter_dll = std::fs::OpenOptions::new().create(true).write(true).open("sciter.dll")?;
sciter_dll.write_all(SCITER_DLL)?;
sciter_dll.flush()?;
drop(sciter_dll);
let mut frame = sciter::Window::new();
frame.load_html(DOM_HTM, None);
frame.run_app();
Ok(())
}
6 changes: 6 additions & 0 deletions package-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
cd installer && \
cross +nightly update && \
cross +nightly build --target=i686-pc-windows-gnu --release && \
cd .. && \
cp ./installer/target/i686-pc-windows-gnu/release/Launcher-Installer.exe "./Launcher-Installer.exe"

0 comments on commit 55e767e

Please sign in to comment.