Compare commits

..

No commits in common. "4df1b53fc47229d4caac0028cde409eca03acf8a" and "8909077e6e3d0c52b7882182757cb9016d72e521" have entirely different histories.

13 changed files with 5 additions and 212 deletions

View File

@ -1,12 +0,0 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@ -27,4 +27,4 @@ See other releases [this](RELEASES.md).
**Forge:** **Forge:**
* 🪟 [Windows `1.16.5-forge-36.2.34`](https://git.a2s.su/iiiypuk/minecraft-launcher/raw/branch/master/forge/1.16.5-forge-36.2.34/1.16.5-forge-36.2.34-windows.bat) * 🪟 [Windows `1.16.5-forge-36.2.34`](https://git.a2s.su/iiiypuk/minecraft-launcher/raw/branch/master/forge/1.16.5-forge-36.2.34/1.16.5-forge-36.2.34-windows.bat)
* 🖥️ [Linux/macOS `1.20.1-forge-47.1.43`](https://git.a2s.su/iiiypuk/minecraft-launcher/raw/branch/master/forge/1.20.1-forge-47.1.43/1.20.1-forge-47.1.43-unix.sh) * 🖥️ [Linux/macOS `1.20.1-forge-47.1.43`](https://git.a2s.su/iiiypuk/minecraft-launcher/raw/branch/master/forge/1.20.1-forge-47.1.43/1.20.1-forge-47.1.43-unix.sh)

View File

@ -1,4 +0,0 @@
# TODO
- [ ] assets downloader
- [ ] library downloader

View File

@ -8,7 +8,7 @@ echo "============================="
# Set username # Set username
read -p "What username would you like? " player read -p "What username would you like? " player
if [ ! $player ]; then if [ ! $player ]; then
player="Steve" player="Steve"
fi fi
# A minecraft root directory # A minecraft root directory

View File

@ -8,7 +8,7 @@ echo "============================="
# Set username # Set username
read -p "What username would you like? " player read -p "What username would you like? " player
if [ ! $player ]; then if [ ! $player ]; then
player="Steve" player="Steve"
fi fi
# A minecraft root directory # A minecraft root directory

View File

@ -1,7 +0,0 @@
# XMake
build/
.xmake/
# Assets
assets/
*.data

View File

@ -1,47 +0,0 @@
# 🇺🇸 Assets downloader
> ⚠️ write it...
# 🇷🇺 Загрузчик ассетов
Утилита, которая встраивается в основной скрипт и скачивает ассеты из сети.
Используется программа на **Си** для парсинга файла индексов ассетов.
## About assets
The game itself downloads (through the launcher) further resources from
```text
https://resources.download.minecraft.net/
```
> ⚠️ http://resources.download.minecraft.net/ no longer works - you must use https
The asset index for each version is linked in the `<version>.json`. An example url to the asset index could look like this
```text
https://launchermeta.mojang.com/mc/assets/1.12/67e29e024e664064c1f04c728604f83c24cbc218/1.12.json
```
Each resource in the file has a name (the field name of the resource object), a SHA1 hash, and a file size. The client currently downloads all resources in the index from
```text
https://resources.download.minecraft.net/<first 2 hex letters of hash>/<whole hash>
```
and stores them in
```text
.minecraft/assets/objects/<first 2 hex letters of hash>/<whole hash>
```
and a copy is stored in
```text
.minecraft/assets/virtual/legacy/
```
in the old format for versions that don't support the new system (1.7 and below)
From: https://wiki.vg/Game_files#Assets

View File

@ -1,6 +0,0 @@
#!/bin/sh
# build utility
echo "Build: assets-x86_64-linux.data"
base64 -w 0 build/linux/x86_64/release/assets-parser > assets-x86_64-linux.data
echo "Build complete"

View File

@ -1,48 +0,0 @@
#!/bin/sh
# Checking cURL command
if ! [ -x "$(command -v curl)" ]; then
echo "curl not available"
exit 1
fi
UTILITY=$(mktemp)
base64 -d assets-x86_64-linux.data > $UTILITY
chmod +x $UTILITY
ASSETS=$($UTILITY assets/indexes/1.19.json)
FILES=$(echo "$ASSETS" | wc -w)
ASSETS_DIR=assets/objects
mkdir -p $ASSETS_DIR
FILE_COUNTER=0
for FILE in $ASSETS
do
# get hash and size asset
HASH=$(echo $FILE | cut -d ":" -f 1)
SIZE=$(echo $FILE | cut -d ":" -f 2)
# make hash directory (first 2 hex letters of hash)
HASH_DIR=$ASSETS_DIR/${HASH:0:2}
mkdir -p $HASH_DIR
# download asset
if ! [ -f $HASH_DIR/$HASH ]; then
curl --silent -o $HASH_DIR/$HASH "https://resources.download.minecraft.net/${HASH:0:2}/$HASH"
fi
# check asset file size
FILE_SIZE=$(wc -c $HASH_DIR/$HASH | cut -d " " -f 1)
if (( $FILE_SIZE != $SIZE )); then
rm $HASH_DIR/$HASH
echo "Error download: $HASH"
fi
# Echo progress
FILE_COUNTER=$(($FILE_COUNTER + 1))
echo -e "Progress: $FILE_COUNTER/$FILES"
done
# TODO
# - use `wget` if `curl` not available

View File

@ -1,55 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <cjson/cJSON.h>
#define VERSION "0.0.0"
int main(int argc, char const *argv[]) {
// printf("Assets Downloader for Minecraft Batch Launcher %s\n", VERSION);
if (argc < 2) {
printf("Usage: %s <assets.json>\n", argv[0]);
return 0;
}
/* ... */
if (argc == 2 && strcmp(argv[1], "--help") == 0) {
printf("Help:\n");
printf(" --help\tShow help\n");
printf(" --version\tShow version\n");
return 0;
} else if (argc == 2 && strcmp(argv[1], "--version") == 0) {
return 0;
}
FILE *index_file;
char str[900000];
char buffer[100];
index_file = fopen(argv[1], "r");
while (fgets(buffer, sizeof(buffer), index_file)) {
strcat(str, buffer);
}
fclose(index_file);
cJSON *json = cJSON_Parse(str);
cJSON *assets_objects = cJSON_GetObjectItem(json, "objects");
unsigned int assets_objects_size = cJSON_GetArraySize(assets_objects);
if (assets_objects) {
cJSON *object = assets_objects->child;
while (object) {
char *hash = cJSON_GetStringValue(cJSON_GetObjectItem(object, "hash"));
unsigned int size =
cJSON_GetNumberValue(cJSON_GetObjectItem(object, "size"));
printf("%s:%d\n", hash, size);
object = object->next;
}
}
return 0;
}

View File

@ -1,28 +0,0 @@
set_project("assets-parser")
set_languages("c99")
add_rules("mode.debug", "mode.release")
toolchain("tcc")
set_kind("standalone")
set_toolset("cc", "tcc")
set_toolset("ld", "tcc")
toolchain_end()
if is_mode("debug") then
set_symbols("debug")
set_optimize("none")
end
set_toolchains("tcc")
add_requires("cjson 1.7.15")
target("assets-parser")
set_kind("binary")
add_files("src/*.c")
add_packages("cjson")
after_build(function (target)
-- os.exec("base64 -w 0 build/linux/x86_64/release/assets-parser > assets-x86_64-linux.data")
os.exec("./compile.sh")
end)

View File

@ -8,7 +8,7 @@ echo "============================="
# Set username # Set username
read -p "What username would you like? " player read -p "What username would you like? " player
if [ ! $player ]; then if [ ! $player ]; then
player="Steve" player="Steve"
fi fi
# A minecraft root directory # A minecraft root directory

View File

@ -8,7 +8,7 @@ echo "============================="
# Set username # Set username
read -p "What username would you like? " player read -p "What username would you like? " player
if [ ! $player ]; then if [ ! $player ]; then
player="Steve" player="Steve"
fi fi
# A minecraft root directory # A minecraft root directory