Skip to content

Program Development

ZImaVI edited this page Jan 23, 2024 · 27 revisions

Diamond OS

Disk installation

Out-of-the-box installation

First of all, you need to create executable file (program, regular program for CC:Tweaked). It would be better to put all program files in folder (especially if you have more files than one). Than create file install.lua, here you need to write welcome message, terms of use, and installation process. This type of program is better to use, if it doesn’t touch any file in /os folder.

Boot installation

The easiest type of installation. Here you need startup.lua, to let system know that it should run program on disk. Also you should do same things that was written before.

Program exception connected to os

If you found moment, when user may corrupt any file (connected to program or os), you may execute file in this path /os/.runFiles/BSOD, this file will execute “Blue Screen Of Die”. So, user can understand that there is mistake, and will try to find problem. In execution, you should write error (example: shell.run(“/os/.runFiles/BSOD”, “\"[DO:00001] No or corrupted file\"”, to let user know where exactly is a problem. REMEMBER: Message shouldn’t be long, because it may not fit on the screen.

List of OS’s exceptions

  • [DO:0000] Fatal error while running os (default)
  • [DO:0001] No or corrupted file
  • [DO:0002] Memory corrupted
  • [DO:0003] Critical file corrupted
  • [DO:0004] Executed non defined device (executed devise which is not connected to pc)
  • [DO:0005] Unsupported device (execute if pc is not advanced one)
  • [DO:0006] Unsupported version of OS (executed by developer, if program doesn’t support old OS)

Diamond OS 2

Welcome to Program Development tutorial! Here is info for diamond OS 2, as old version based on text GUI, so it is very easy to write it.

Base

To load APIs, you need to copy then in work directory. To get API use settings.get(“apiDir”) and API name with .lua. Here is list with stored name, and directories.

  • “apiDir” = “/diamondOS.beta/bin/.System/apis”
  • "temp" = "diamondOS.beta/bin/.System/tmp"
  • "sysDir" = "diamondOS.beta/bin/.System"
  • "bootDir" = "diamondOS.beta/bin/.boot"

I made this system, to make your life easier. These directories are set up while installing.

Creating installers

To create an installer, you may use GUI through gui.lua API, or text installer (trow shell). To init program in system, you should do few things. First of all, you should preload diamondAPI (because next methods are using require()). Then load API. Now, you can use

dAPI.appInit(appName, author, version, path, isPatebin)

Path here means full path to .lua app. This method will register the app in the app folder. Version is used for updates. (thow pastebin or github. You may choose what to use by using True or False