This commit is contained in:
nakst 2021-09-23 12:03:28 +01:00
parent 5422a9e01e
commit fdce1c19ce
7 changed files with 34 additions and 25 deletions

View File

@ -2030,6 +2030,8 @@ void EsPOSIXInitialise(int *, char ***) {
EsInstance *instance = EsInstanceCreate(message, INTERFACE_STRING(POSIXTitle));
EsPanel *panel = EsPanelCreate((EsElement *) instance->window, ES_PANEL_VERTICAL | ES_CELL_FILL, ES_STYLE_PANEL_WINDOW_BACKGROUND);
EsTextDisplayCreate(panel, ES_CELL_H_CENTER | ES_CELL_V_FILL | ES_TEXT_DISPLAY_RICH_TEXT, nullptr, INTERFACE_STRING(POSIXUnavailable));
} else if (message->type == ES_MSG_INSTANCE_OPEN) {
EsInstanceOpenComplete(message, true);
}
}
}

View File

@ -1,6 +1,9 @@
set -e
rm -rf bin/uxn bin/noodle
git clone --depth=1 https://git.sr.ht/~rabbits/uxn bin/uxn
git clone https://git.sr.ht/~rabbits/uxn bin/uxn
cd bin/uxn
git checkout e79004a07563060d66bc771b6285b7fe7e6b02bf
cd ../..
git clone --depth=1 https://git.sr.ht/~rabbits/noodle bin/noodle
cc -DNDEBUG -Os -g0 -s bin/uxn/src/uxnasm.c -o bin/uxnasm
bin/uxnasm bin/noodle/src/main.tal bin/noodle.rom

View File

@ -310,7 +310,7 @@ Option options[] = {
{ "Emulator.VBoxEFI", OPTION_TYPE_BOOL, { .b = false } },
{ "Emulator.QemuEFI", OPTION_TYPE_BOOL, { .b = false } },
{ "BuildCore.Verbose", OPTION_TYPE_BOOL, { .b = false } },
{ "BuildCore.DeletePOSIXBeforeImport", OPTION_TYPE_BOOL, { .b = false } },
{ "BuildCore.NoImportPOSIX", OPTION_TYPE_BOOL, { .b = false } },
{ "General.first_application", OPTION_TYPE_STRING, { .s = NULL } },
{ "General.wallpaper", OPTION_TYPE_STRING, { .s = NULL } },
{ "General.installation_state", OPTION_TYPE_STRING, { .s = "0" } },
@ -318,11 +318,7 @@ Option options[] = {
char *previousOptionsBuffer;
void LoadOptions() {
free(previousOptionsBuffer);
EsINIState s = { .buffer = (char *) LoadFile("bin/config.ini", &s.bytes) };
previousOptionsBuffer = s.buffer;
void LoadDefaultOptions() {
for (uintptr_t i = 0; i < sizeof(options) / sizeof(options[0]); i++) {
options[i].state = options[i].defaultState;
options[i].useDefaultState = true;
@ -331,6 +327,13 @@ void LoadOptions() {
options[i].state.s = strdup(options[i].state.s);
}
}
}
void LoadOptions() {
free(previousOptionsBuffer);
EsINIState s = { .buffer = (char *) LoadFile("bin/config.ini", &s.bytes) };
previousOptionsBuffer = s.buffer;
LoadDefaultOptions();
while (s.buffer && EsINIParse(&s)) {
EsINIZeroTerminate(&s);

View File

@ -156,7 +156,7 @@ char kernelAssemblyFlags[4096] = " -felf64 -Fdwarf ";
bool verbose;
bool useColoredOutput;
bool forEmulator, bootUseVBE, deletePOSIXBeforeImport;
bool forEmulator, bootUseVBE, noImportPOSIX;
bool systemBuild;
bool convertFonts = true;
EsINIState *fontLines;
@ -380,7 +380,9 @@ void CreateImportNode(const char *path, ImportNode *node) {
ImportNode child = {};
if (children[i].type == ES_NODE_DIRECTORY) {
if (noImportPOSIX && 0 == strcmp(pathBuffer, "root/Applications/POSIX")) {
continue;
} else if (children[i].type == ES_NODE_DIRECTORY) {
CreateImportNode(pathBuffer, &child);
} else {
child.isFile = true;
@ -411,7 +413,9 @@ void CreateImportNode(const char *path, ImportNode *node) {
ImportNode child = {};
if (S_ISDIR(s.st_mode)) {
if (noImportPOSIX && 0 == strcmp(pathBuffer, "root/Applications/POSIX")) {
continue;
} else if (S_ISDIR(s.st_mode)) {
CreateImportNode(pathBuffer, &child);
} else if ((s.st_mode & S_IFMT) == S_IFLNK) {
continue;
@ -1169,12 +1173,6 @@ void Install(const char *driveFile, uint64_t partitionSize, const char *partitio
_partitionOffset = 1048576;
Format(partitionSize - _partitionOffset, partitionLabel, installationIdentifier, kernel, kernelBytes);
#ifndef OS_ESSENCE
if (deletePOSIXBeforeImport) {
system("rm -r root/Applications/POSIX");
}
#endif
Log("Copying files to the drive... ");
ImportNode root = {};
@ -1308,8 +1306,8 @@ int main(int argc, char **argv) {
bootUseVBE = !!atoi(s.value);
} else if (0 == strcmp(s.key, "Flag.COM_OUTPUT") && atoi(s.value)) {
strcat(kernelAssemblyFlags, " -DCOM_OUTPUT ");
} else if (0 == strcmp(s.key, "BuildCore.DeletePOSIXBeforeImport")) {
deletePOSIXBeforeImport = !!atoi(s.value);
} else if (0 == strcmp(s.key, "BuildCore.NoImportPOSIX")) {
noImportPOSIX = !!atoi(s.value);
} else if (0 == memcmp(s.key, "General.", 8)) {
EsINIState s2 = s;
s2.key += 8, s2.keyBytes -= 8;

View File

@ -83,11 +83,7 @@ int OptionTableMessage(UIElement *element, UIMessage message, int di, void *dp)
}
void ActionDefaults(void *_unused) {
for (uintptr_t i = 0; i < sizeof(options) / sizeof(options[0]); i++) {
options[i].state = options[i].defaultState;
options[i].useDefaultState = true;
}
LoadDefaultOptions();
UIElementRefresh(&optionTable->e);
UILabelSetContent(unsavedChangedLabel, "You have unsaved changes!", -1);
UIElementRefresh(&unsavedChangedLabel->e);

View File

@ -10,9 +10,9 @@
set -e
# Duplicated in uefi_to_device.sh.
CC="clang -target x86_64-unknown-windows -ffreestanding -fshort-wchar -mno-red-zone -I ports/efitoolkit/inc -c -Wall -Wextra"
LINK="clang -target x86_64-unknown-windows -nostdlib -Wl,-entry:efi_main -Wl,-subsystem:efi_application -fuse-ld=lld-link"
$CC -o bin/uefi.o boot/x86/uefi.c
$LINK -o bin/uefi bin/uefi.o

View File

@ -3,6 +3,13 @@
# Pass device file of EsFS partition as second argument.
set -e
# Duplicated from uefi.sh.
CC="clang -target x86_64-unknown-windows -ffreestanding -fshort-wchar -mno-red-zone -I ports/efitoolkit/inc -c -Wall -Wextra"
LINK="clang -target x86_64-unknown-windows -nostdlib -Wl,-entry:efi_main -Wl,-subsystem:efi_application -fuse-ld=lld-link"
$CC -o bin/uefi.o boot/x86/uefi.c
$LINK -o bin/uefi bin/uefi.o
mkdir -p mount
mount $1 mount
mkdir -p mount/EFI/BOOT
@ -18,7 +25,7 @@ SOURCE_COUNT=`fdisk -l bin/drive | grep 'Linux' | awk '{print $5}'`
DESTINATION_COUNT=`blockdev --getsz $2`
if [ "$SOURCE_COUNT" -gt "$DESTINATION_COUNT" ]; then
echo Please set Emulator.PrimaryDriveMB lower than $DESTINATION_COUNT.
echo Please set Emulator.PrimaryDriveMB to fit on the drive.
exit 1
fi