From 6994f34953fac9462e899d0b2c7af64e21c92a1e Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Fri, 25 Dec 2009 10:17:25 +0100 Subject: More work --- CopyToFDD.sh | 10 ++----- CopyToHDD.sh | 2 +- Makefile | 2 ++ .../2009-12-24-233553_800x628_scrot.png | Bin 0 -> 36702 bytes Source/Applications/PaperWork/FloppyWelcome.txt | 3 ++ Source/Applications/PaperWork/PaperWork.cpp | 11 +++++++- Source/Applications/Shell/Applets/pwd.cpp | 15 ++++++++++ Source/Applications/Shell/Makefile | 3 +- Source/Applications/Shell/Shell-fs.class.cpp | 31 --------------------- Source/Applications/Shell/Shell.class.cpp | 31 ++++++++++++++++----- Source/Applications/Shell/Shell.class.h | 3 -- .../Kernel/Devices/Display/VESADisplay.class.cpp | 5 ---- 12 files changed, 59 insertions(+), 57 deletions(-) create mode 100644 Media/Screenshots/2009-12-24-233553_800x628_scrot.png create mode 100644 Source/Applications/PaperWork/FloppyWelcome.txt create mode 100644 Source/Applications/Shell/Applets/pwd.cpp diff --git a/CopyToFDD.sh b/CopyToFDD.sh index 936be0a..9818735 100755 --- a/CopyToFDD.sh +++ b/CopyToFDD.sh @@ -13,8 +13,7 @@ done cd .. # Create directories -mkdir Mount/{System,Applications,Volumes,Sandbox} -mkdir Mount/Applications/{Shell,Demos} +mkdir Mount/{System,Volumes,Sandbox} mkdir Mount/System/{Applications,Logs,Configuration} mkdir Mount/Volumes/{HDD,InitRFS} @@ -24,19 +23,14 @@ cp Init.rfs Mount/System # Copy system files cp Source/Kernel/Ressources/Configuration/* Mount/System/Configuration +cp Source/Applications/PaperWork/FloppyWelcome.txt Mount/System/Configuration/Welcome # Copy system apps cp Source/Applications/PaperWork/PaperWork Mount/System/Applications/PaperWork.app -cp Source/Applications/Shell/Shell Mount/Applications/Shell/Shell.app -cp Source/Applications/Shell/Help.txt Mount/Applications/Shell/Help.txt # Create mount configuration file echo "/Sandbox:ramfs:0" > Mount/System/Configuration/Mount echo "/Volumes/HDD:block.ata:0:1" >> Mount/System/Configuration/Mount -# Copy demo apps -cp Source/Applications/Demos/GOL Mount/Applications/Demos/GOL.app -cp Source/Applications/Demos/asmdemo Mount/Applications/Demos/ASM.dem - #echo "*** Launching a BASH shell, if you want to do any maintenance ***" #bash || exit 0 diff --git a/CopyToHDD.sh b/CopyToHDD.sh index c5530f0..03ad494 100755 --- a/CopyToHDD.sh +++ b/CopyToHDD.sh @@ -24,7 +24,7 @@ cp Source/Kernel/Ressources/Configuration/* Mount/System/Configuration cp Source/Kernel/Ressources/Keymaps/*.mkm Mount/System/Keymaps cp Source/Applications/PaperWork/PaperWork Mount/System/Applications/PaperWork.app cp Source/Applications/Shell/Shell Mount/Applications/Shell/Shell.app -cp Source/Applications/Shell/Applets/{cat,free,halt,reboot,uptime,ls} Mount/Applications/Shell/Applets +cp Source/Applications/Shell/Applets/{cat,free,halt,reboot,uptime,ls,pwd} Mount/Applications/Shell/Applets cp Source/Applications/Shell/Help.txt Mount/Applications/Shell # Create mount configuration file diff --git a/Makefile b/Makefile index 1c17615..b59b87b 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ RamFSFiles = :/System :/System/Configuration :/System/Keymaps :/Applets \ Source/Applications/Shell/Applets/uptime:/Applets/uptime \ Source/Applications/Shell/Applets/free:/Applets/free \ Source/Applications/Shell/Applets/ls:/Applets/ls \ + Source/Applications/Shell/Applets/pwd:/Applets/pwd \ + Source/Applications/Demos/GOL:/GOL.app \ Source/Kernel/Ressources/Graphics/logo.text.cxd:/Melon-logo Files = $(Kernel) $(RamFS) diff --git a/Media/Screenshots/2009-12-24-233553_800x628_scrot.png b/Media/Screenshots/2009-12-24-233553_800x628_scrot.png new file mode 100644 index 0000000..9637d22 Binary files /dev/null and b/Media/Screenshots/2009-12-24-233553_800x628_scrot.png differ diff --git a/Source/Applications/PaperWork/FloppyWelcome.txt b/Source/Applications/PaperWork/FloppyWelcome.txt new file mode 100644 index 0000000..6676719 --- /dev/null +++ b/Source/Applications/PaperWork/FloppyWelcome.txt @@ -0,0 +1,3 @@ +Welcome to this Melon floppy ! +As loading binaries from the floppy doesn't work very well, the shell has been placed on the initrd : you have to run /Sandbox/Shell.app instead of /Applications/Shell/Shell.app + diff --git a/Source/Applications/PaperWork/PaperWork.cpp b/Source/Applications/PaperWork/PaperWork.cpp index 15497e4..89cb00b 100644 --- a/Source/Applications/PaperWork/PaperWork.cpp +++ b/Source/Applications/PaperWork/PaperWork.cpp @@ -1,4 +1,6 @@ #include +#include +#include #define DEFAULT_SHELL "/Applications/Shell/Shell.app" #define PAPERWORK_PATH "/System/Applications/PaperWork.app" @@ -33,7 +35,13 @@ int PaperWork::run() { } } } else if (act == "login") { - outvt << "Logging in to Melon\n"; + FSNode welcome = FS::find("/System/Configuration/Welcome"); + if (welcome.valid() && welcome.type() == NT_FILE) { + TextFile f("/System/Configuration/Welcome"); + while (!f.eof()) outvt << f.readLine() << ENDL; + } else { + outvt << "Logging in to Melon\n"; + } String user, pw; while (1) { outvt << "Username: " << FLUSH; @@ -55,6 +63,7 @@ int PaperWork::run() { p.wait(); outvt << "\n\n"; } else { + outvt << "Could not run application : " << sh << ENDL; return 1; } return 0; diff --git a/Source/Applications/Shell/Applets/pwd.cpp b/Source/Applications/Shell/Applets/pwd.cpp new file mode 100644 index 0000000..4b27eb0 --- /dev/null +++ b/Source/Applications/Shell/Applets/pwd.cpp @@ -0,0 +1,15 @@ +#include +#include + +class pwd : public ShellApp { + public: + pwd() : ShellApp("pwd", "Shows the current directory") { + addFlag("f", "frugal", "Do not show 'Current directory: ' prefix", FT_BOOL, ""); + } + int run() { + if (!bFlag("frugal")) outvt << "Current directory: "; + outvt << FS::cwdNode().path() << ENDL; + } +}; + +APP(pwd); diff --git a/Source/Applications/Shell/Makefile b/Source/Applications/Shell/Makefile index 1bce0f4..dff539c 100644 --- a/Source/Applications/Shell/Makefile +++ b/Source/Applications/Shell/Makefile @@ -10,7 +10,8 @@ Objects = Shell.class.o \ Shell-fs.class.o OutFile = Shell -Applets = Applets/cat Applets/halt Applets/reboot Applets/uptime Applets/free Applets/ls +Applets = Applets/cat Applets/halt Applets/reboot Applets/uptime Applets/free Applets/ls \ + Applets/pwd all: $(OutFile) $(Applets) echo "* Done with $(OutFile)." diff --git a/Source/Applications/Shell/Shell-fs.class.cpp b/Source/Applications/Shell/Shell-fs.class.cpp index bb1990d..7607f34 100644 --- a/Source/Applications/Shell/Shell-fs.class.cpp +++ b/Source/Applications/Shell/Shell-fs.class.cpp @@ -2,26 +2,6 @@ #include #include -void Shell::cd(Vector& args) { - if (args.size() != 2) { - outvt << "Invalid argument count.\n"; - } else { - FSNode ncwd = FS::find(args[1], cwd); - if (!ncwd.valid()) { - outvt << "No such directory : " << args[1] << "\n"; - } else if (ncwd.type() == NT_DIRECTORY) { - ncwd.setCwd(); - cwd = ncwd; - } else { - outvt << "Not a directory.\n"; - } - } -} - -void Shell::pwd(Vector& args) { - outvt << "Current directory : " << cwd.path() << "\n"; -} - void Shell::rm(Vector& args) { if (args.size() == 1) outvt << "No file to remove.\n"; for (u32int i = 1; i < args.size(); i++) { @@ -59,14 +39,3 @@ void Shell::wf(Vector& args) { } } -void Shell::run(Vector& args) { - if (args.size() == 1) { - outvt << "Nothing to run...\n"; - } else { - Vector appargs; - for (u32int i = 1; i < args.size(); i++) appargs.push(args[i]); - if (!appRun(args[1], appargs)) { - outvt << "Error while launching process.\n"; - } - } -} diff --git a/Source/Applications/Shell/Shell.class.cpp b/Source/Applications/Shell/Shell.class.cpp index 1b7f25e..971b913 100644 --- a/Source/Applications/Shell/Shell.class.cpp +++ b/Source/Applications/Shell/Shell.class.cpp @@ -23,12 +23,9 @@ int Shell::run() { String name; void (Shell::*cmd)(Vector&); } commands[] = { - {"cd", &Shell::cd}, - {"pwd", &Shell::pwd}, {"rm", &Shell::rm}, {"mkdir", &Shell::mkdir}, {"wf", &Shell::wf}, - {"run", &Shell::run}, {"", 0} }; @@ -70,6 +67,7 @@ int Shell::run() { } } + //Look for variables to replace for (u32int i = 0; i < cmd.size(); i++) { if (cmd[i][0] == WChar("$")) { String k = cmd[i].substr(1); @@ -82,7 +80,7 @@ int Shell::run() { } //Run command - if (cmd[0] == "exit") { + if (cmd[0] == "exit") { // * * * INTEGRATED COMMANDS * * * // if (cmd.size() == 1) return 0; return cmd[1].toInt(); } else if (cmd[0] == "help") { @@ -98,7 +96,21 @@ int Shell::run() { outvt << cmd[i]; } outvt << ENDL; - } else { + } else if (cmd[0] == "cd") { + if (cmd.size() != 2) { + outvt << "Invalid argument count.\n"; + } else { + FSNode ncwd = FS::find(cmd[1], cwd); + if (!ncwd.valid()) { + outvt << "No such directory : " << cmd[1] << ENDL; + } else if (ncwd.type() != NT_DIRECTORY) { + outvt << "Not a directory : " << cmd[1] << ENDL; + } else { + ncwd.setCwd(); + cwd = ncwd; + } + } + } else { // * * * CALL AN EXTERNAL COMMAND * * * // u32int i = 0; bool found = false; while (!commands[i].name.empty()) { @@ -114,8 +126,13 @@ int Shell::run() { i++; } if (!found) { - if (!appRun(appletsDir + cmd[0], cmd)) - outvt << "Unknown command : " << cmd[0] << "\n"; + if (FS::basename(cmd[0]) != cmd[0]) { + if (!appRun(cmd[0], cmd)) + outvt << "No such file : " << cmd[0] << "\n"; + } else { + if (!appRun(appletsDir + cmd[0], cmd)) + outvt << "Unknown command : " << cmd[0] << "\n"; + } } } } diff --git a/Source/Applications/Shell/Shell.class.h b/Source/Applications/Shell/Shell.class.h index 94a6c2a..49208fe 100644 --- a/Source/Applications/Shell/Shell.class.h +++ b/Source/Applications/Shell/Shell.class.h @@ -32,12 +32,9 @@ class Shell : public ShellApp { bool appRun(const String& name, Vector& args); - void cd(Vector& args); - void pwd(Vector& args); void rm(Vector& args); void mkdir(Vector& args); void wf(Vector& args); - void run(Vector& args); }; #endif diff --git a/Source/Kernel/Devices/Display/VESADisplay.class.cpp b/Source/Kernel/Devices/Display/VESADisplay.class.cpp index 1025319..62f2f2d 100644 --- a/Source/Kernel/Devices/Display/VESADisplay.class.cpp +++ b/Source/Kernel/Devices/Display/VESADisplay.class.cpp @@ -112,11 +112,6 @@ bool VESADisplay::setMode(mode_t &mode) { if ((regs.ax & 0xFF00) != 0) return false; if (m_currMode.bpp == 8) { - //Set palette to 8 bit - regs.ax = 0x4F08; - regs.bx = 0x0800; - V86::biosInt(0x10, regs); - if ((regs.ax & 0xFF) != 0x4F or regs.bx != 0x0800) return false; //Set palette data for (int i = 0; i < 16; i++) { m_8bitPalette[i].pixels = 0; -- cgit v1.2.3